efficient-easel 6.5.0 → 6.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -851,6 +851,12 @@ const drag = useTreeDrag({ …, session }); // the tree
851
851
  to nudge it with a mouse move of its own.
852
852
  - **The line** runs across a list, or down between columns (a slot laid out
853
853
  across).
854
+ - **A ➕ insert point** (`CanvasInsert`, 6.6.0) is the one look of every place
855
+ the canvas offers to add: the shell's ghost `IconButton` with the plus, named
856
+ by its `Tooltip`, in the tab order, a 2px accent line across the gap on hover
857
+ and focus. The layer draws one per `seam`; `insertSeams(zone, label)` makes
858
+ them before, between and after a list's children (an end is kept 12px inside
859
+ the list), across or down as the list runs.
854
860
  - **An empty slot** is a dashed "+ Add block" cell that also takes drops. A
855
861
  zone the model marks `addLabel` says its own words, and `addAlways` draws it
856
862
  at rest, not only on hover (the screen's empty page: "+ Add section", 5.1.0).
@@ -62,11 +62,17 @@ type CanvasZone = {
62
62
  */
63
63
  addAlways?: boolean;
64
64
  };
65
- /** The gap between two sections, offered as a place to add one. */
65
+ /**
66
+ * A place offered to add at: the gap between two sections, or before, between
67
+ * or after the blocks of a list. `axis` is the list's ('x': the line runs
68
+ * down); `label` is the ➕'s name, when not the layer's `seamLabel`.
69
+ */
66
70
  type CanvasSeam = {
67
71
  key: string;
68
72
  place: Place;
69
73
  box: Box;
74
+ axis?: 'x' | 'y';
75
+ label?: string;
70
76
  };
71
77
  declare const contains: (b: Box, x: number, y: number) => boolean;
72
78
  /** Every source under the point, outermost first (largest box first; of two
@@ -111,6 +117,16 @@ type CanvasTarget = {
111
117
  */
112
118
  declare function canvasTarget(zones: readonly CanvasZone[], x: number, y: number, accept: (to: Place) => boolean, isNoOp?: (to: Place) => boolean, fallThrough?: (refused: Place) => boolean): CanvasTarget;
113
119
  /** The seams between a zone's children — where "+ Add section" goes. */
120
+ /**
121
+ * Every place in a list a ➕ may add at — before its first child, between each
122
+ * two, and after its last (owner 2026-10-14) — for a list that HAS children
123
+ * (an empty one draws its cell instead). Across a 'y' list, down an 'x' one.
124
+ * Between two children the band is the room they leave. At an end it is the
125
+ * room between the list's edge and its child, centred there but never closer
126
+ * than `inset` to the edge: a ➕ half outside its list is cut by the canvas, and
127
+ * focusing it scrolls the canvas to show it.
128
+ */
129
+ declare function insertSeams(zone: CanvasZone, label?: string, inset?: number): CanvasSeam[];
114
130
  declare function seamsBetween(zone: CanvasZone, keyPrefix?: string): CanvasSeam[];
115
131
 
116
132
  type MeasuredNode = {
@@ -187,4 +203,4 @@ type CanvasDragLayerProps<I> = {
187
203
  declare const HANDLE_GRACE_MS = 140;
188
204
  declare function CanvasDragLayer<I>(props: CanvasDragLayerProps<I>): react.JSX.Element;
189
205
 
190
- export { type Box as B, type CanvasDragModel as C, EMPTY_MEASURE as E, HANDLE_GRACE_MS as H, type MeasuredCanvas as M, CanvasDragLayer as a, type CanvasDragLayerProps as b, type CanvasTarget as c, type CanvasSeam as d, type CanvasSource as e, type CanvasZone as f, type MeasuredNode as g, canvasTarget as h, contains as i, gapInZone as j, gapLine as k, sourcesAt as l, measureCanvas as m, pickSource as p, seamsBetween as s };
206
+ export { type Box as B, type CanvasDragModel as C, EMPTY_MEASURE as E, HANDLE_GRACE_MS as H, type MeasuredCanvas as M, CanvasDragLayer as a, type CanvasDragLayerProps as b, type CanvasTarget as c, type CanvasSeam as d, type CanvasSource as e, type CanvasZone as f, type MeasuredNode as g, canvasTarget as h, contains as i, gapInZone as j, gapLine as k, insertSeams as l, measureCanvas as m, sourcesAt as n, pickSource as p, seamsBetween as s };
@@ -0,0 +1,5 @@
1
+ import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as i}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-PFNIVZPN.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-ZR4CFNMW.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-MCHMF32I.js";import{useEasel as f}from"./chunk-M5VRWM7M.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-SSORUDHE.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-O2NLQBFX.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as $,jsxs as O,Fragment as B}from"react/jsx-runtime";var N=e=>`section:${e}`,v=e=>`block:${e}`,F=e=>`template:${e}`;function I({blocks:I,blocksOnly:M,at:V,onAdd:x,itemFor:H,session:R,siteWide:C,onClose:L,onHide:A,readOnly:D}){const P=f(e=>e.config),S=p(),{labelAtLevel:W,categoryLabel:w,firstSection:Q,Icon:T,Thumbnail:Z}=S,{blockIsOffered:z}=m(),E=u("screen",d).add,Y=u("drag",h).add,G=l(),[J,K]=y([]);b(()=>{let t=!1;const o=e=>z(e,G);return s(G).list().then(n=>{if(t)return;const i=P.components;K(n.filter(t=>t.node?.type&&i[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[P,G]);const U=j(()=>t(P,S),[P]),X=e=>({type:N(e.type),label:e.name,cover:/* @__PURE__ */$(Z,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:E.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),q=j(()=>{const e=[];if(I&&I.choices.length>0&&a(I.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${E.inside({name:I.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:v(e.type),label:e.label,icon:/* @__PURE__ */$(T,{type:e.type,size:18}),title:E.tile({name:e.label})}))})}),M)return e;const t=o(U,Q);t&&e.push({key:"start",title:E.startBlank,tiles:[X(t)]}),J.length>0&&e.push({key:"templates",title:E.templates,tiles:J.map(e=>{return{type:F(e.id),label:e.name,cover:/* @__PURE__ */$(Z,{type:e.node.type}),keywords:[(t=e.node.type,W(t,"section",P.components[t]?.label??t)),e.node.type]};var t})});const s=n(U,Q);for(const t of Object.keys(P.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:i(P,t,w),tiles:o.map(X)})}return e},[I,M,J,U,P,E]),_=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=J.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
2
+ return O(B,{children:[
3
+ /* @__PURE__ */$(r,{icon:/* @__PURE__ */$(g,{size:15}),title:E.title,context:M?E.contextBlocks:E.contextAll,actions:/* @__PURE__ */$(c,{label:E.done,description:E.doneDescription,onClick:L}),onHide:A}),
4
+ /* @__PURE__ */O("div",{className:"sf-addside sf-scroll",children:[
5
+ /* @__PURE__ */$(k,{groups:q,session:R,itemFor:e=>H(_(e)??{kind:"section",type:e}),onInsert:e=>{const t=_(e);t&&x(t)},at:V,hint:M?E.hintBlocks:E.hint,searchLabel:M?E.searchBlocks:E.searchSections,readOnly:D,words:Y}),C&&!M?C:null]})]})}export{I as AddSidePanel,v as blockKey,N as sectionKey,F as templateKey};
@@ -0,0 +1,62 @@
1
+ import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-BXQBCW3P.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-2GVCAIPX.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,editorRootFocus as m}from"./chunk-UY7BCB32.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as k,clampPanelWidth as S}from"./chunk-6TOYXESC.js";import{usePartBridge as v}from"./chunk-5PUEZ22M.js";import{useSectionOps as x}from"./chunk-57NRNFLO.js";import{useNodeClipboard as w,useNodeContextMenu as b}from"./chunk-LVUDUQNL.js";import{PageEditGuardNotices as z}from"./chunk-HQWQLDCB.js";import{useScreenDocument as B}from"./chunk-WZMU646D.js";import{requestMediaPick as C}from"./chunk-KG7RJWOK.js";import{heldStyle as O,styleShortcut as I}from"./chunk-V7U33NF2.js";import{AddChildRow as N}from"./chunk-5545A3PC.js";import{AddSidePanel as $}from"./chunk-DSXKBICS.js";import{SidePanelHead as P,PanelShowStrip as M}from"./chunk-PFNIVZPN.js";import{MediaSidePanel as T}from"./chunk-Q2L6YTII.js";import{useScreenSaveSwitch as A,useScreenNodeKeys as j,useScreenPinned as R,useScreenDocumentLabel as L,useScreenCanvasFrame as E,useScreenInspectorPanel as V,useScreenDevices as F,useScreenPickFollowsSelection as W,useScreenLeftView as H,useScreenAdd as U,SELECTION_MODE as D,sameInspectorMode as G,useScreenBridges as J,useScreenBlockRules as Y,useScreenBlockLook as X,useScreenStorageNamespace as Q,useScreenNotify as K,useScreenCanvasHead as _,isSlotMode as q,useScreenStyleClipboard as Z,useScreenDocumentPass as ee,useScreenCanvasDrag as ne,ScreenCanvasTargetProvider as te,isPinnedFirst as oe,isPinnedLast as re,screenSlotsOf as ie}from"./chunk-ZR4CFNMW.js";import{ROOT_ZONE as le,blockNodeActions as se,TREE_MAX_DEPTH as de,childSlotsOf as ce,slotFieldsOf as ae,slotChildrenIn as pe,nestsInTree as ue,newNodeId as fe}from"./chunk-PLVEGYK6.js";import{useMediaPanel as he,usePanelPick as me,useCancelPanelPick as ge}from"./chunk-R6WTQWAC.js";import{useEaselHost as ye,useHostEscape as ke}from"./chunk-U3JP4VGF.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as ve}from"./chunk-MCHMF32I.js";import{useEasel as xe,useEaselApi as we}from"./chunk-M5VRWM7M.js";import{TreeRow as be,Subtree as ze,LayersTree as Be,TreeGroupLabel as Ce,TreeRowAction as Oe,TreeSeam as Ie}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Ne}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as $e}from"./chunk-WK3AFPXY.js";import{toItemSelector as Pe,useNodeOps as Me,clickPick as Te}from"./chunk-UK2FQOUT.js";import{LayersIcon as Ae,MediaIcon as je}from"./chunk-4VJATVVR.js";import{DEFAULT_SAVE_WORDS as Re,saveIndicator as Le}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Ee,TopBarRail as Ve,TopBarCluster as Fe,EaselIconButton as We,TopBarDivider as He,DeviceSwitch as Ue,InspectorIconButton as De,PanelResizeHandle as Ge,MAX_PANEL_W as Je,MIN_PANEL_W as Ye,panelWidthVars as Xe,SaveState as Qe,SaveStateToggle as Ke}from"./chunk-UB4TLWVJ.js";import{DEFAULT_CHROME_WORDS as _e}from"./chunk-Y2G7CU6A.js";import{useWords as qe}from"./chunk-MFIRYGHW.js";import{insertSeams as Ze,CanvasDragLayer as en,CanvasInsert as nn}from"./chunk-SSORUDHE.js";import{DEFAULT_DRAG_WORDS as tn}from"./chunk-O2NLQBFX.js";import{createDragSession as on,useTreeDrag as rn,gapToMoveIndex as ln}from"./chunk-67GNT6PF.js";import{useCanvasFrame as sn,LIST_SELECTOR as dn,BLOCK_SELECTOR as cn,useCanvasEvent as an}from"./chunk-AWJUYMX7.js";import{zoneKey as pn,ROOT_ID as un,ROOT_SLOT as fn,parseZoneKey as hn,DataError as mn,find as gn}from"./chunk-KRXQM65X.js";import{useRef as yn,useMemo as kn,useState as Sn,useEffect as vn,useCallback as xn,useLayoutEffect as wn,Fragment as bn}from"react";import{Tooltip as zn,Button as Bn,toast as Cn}from"efficient-shell/ui";import{UndoIcon as On,RedoIcon as In,TrashIcon as Nn,EyeOffIcon as $n,EyeIcon as Pn,DuplicateIcon as Mn}from"efficient-shell/icons/efficient";import{jsx as Tn,jsxs as An,Fragment as jn}from"react/jsx-runtime";function Rn({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i,words:l,saveWords:s}){if(null!==t)/* @__PURE__ */return Tn(Qe,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
2
+ return Tn(Qe,{tone:e.pending?"off-unsaved":"off",label:l.notSaving,role:"status"});const{tone:d,label:c}=Le(e,s),a=e.failed&&!e.paused&&/* @__PURE__ */Tn(Bn,{variant:"secondary",size:"sm",onClick:i,children:l.retry});/* @__PURE__ */
3
+ return An(jn,o?{children:[
4
+ /* @__PURE__ */Tn(Ke,{pressed:e.paused,onToggle:r,title:e.paused?l.autoSaveOff:l.autoSaveOn,children:/* @__PURE__ */Tn(Qe,{tone:d,label:c})}),a]}:{children:[
5
+ /* @__PURE__ */Tn(Qe,{tone:d,label:c,role:"status"}),a]})}function Ln({expand:e}){/* @__PURE__ */
6
+ return Tn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */An(jn,e?{children:[
7
+ /* @__PURE__ */Tn("path",{d:"M8 9l4-4 4 4"}),
8
+ /* @__PURE__ */Tn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
9
+ /* @__PURE__ */Tn("path",{d:"M8 4l4 4 4-4"}),
10
+ /* @__PURE__ */Tn("path",{d:"M8 20l4-4 4 4"}),
11
+ /* @__PURE__ */Tn("path",{d:"M5 12h14"})]})})}var En=`${dn}, ${cn}`;function Vn(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var Fn="__rungs";var Wn="screen:band",Hn={duplicate:!0,delete:!0};function Un(){const Le=ye(),{target:Qe,docId:Ke,capabilities:dn,currentSlug:Un,siteId:Dn,onPublish:Gn,saveState:Jn,saveConflict:Yn,retrySave:Xn,toggleAutoSave:Qn,readOnly:Kn,readOnlyReason:_n=null}=B(),qn=A(),Zn=j(),{mediaEditing:et,hasEditGuard:nt,hasPinnedChrome:tt}=dn,{appState:ot,dispatch:rt,history:it,selectedItem:lt,getSelectorForId:st,config:dt}=xe(e=>e),ct=R(),{first:at,firstGroup:pt,lastGroup:ut,isSectionGroup:ft,sectionGroupZone:ht,panelOf:mt}=ct,gt=mt(at),yt=e=>oe(ct,e),kt=e=>re(ct,e),St="node"===ct.firstRow,vt=ct.band??null,xt=qe("screen",ve),wt=qe("tree",Ne),bt=qe("drag",tn),zt=qe("save",Re),Bt=qe("menu",$e),Ct=qe("styleClipboard",Se),Ot=qe("chrome",_e),It=L()??`/${Un}`,Nt=E(),$t=V(),Pt=x({readOnly:Kn}),Mt=x({readOnly:Kn,foldIntoHistory:!0}),Tt=yn(null),At=we(),jt=kn(()=>({...Pt,select:e=>{Tt.current=e,Pt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=At.config;Tt.current=Pe(e,t,n)}Pt.commitDocument(e,n)}}),[Pt,At]),Rt=ot.ui,Lt=Rt.leftSideBarVisible,Et=Rt.rightSideBarVisible,{options:Vt,widths:Ft,initial:Wt,fluid:Ht,fit:Ut}=F(),[Dt,Gt]=Sn(Wt),Jt=he(),Yt=et&&null!==Jt,Xt=me(),Qt=ge();W(lt?.props.id);const{read:Kt,write:_t,forSelection:qt}=H(),[Zt,eo]=Sn(Kt);vn(()=>{_t(Zt)},[Zt]);const[no,to]=Sn(0),oo=yn(null),ro=yn(null),io=sn(ro,{readySelector:En}),lo=f(ro);h(ro,io);const[so,co]=Sn(!1),ao=yn(!1),po=yn(!1),[uo,fo]=Sn(null),ho=U(),mo=e=>fo(null===e?null:{zone:le,index:e}),[go,yo]=Sn([]),[ko,So]=Sn(D),vo="puck"===ko.kind,xo=so&&!uo&&ho.railTarget?ho.railTarget(ot.data,{node:lt??null,mode:ko}):null,wo=xo?{zone:pn(xo),index:xo.index}:null,bo=uo??wo,zo=bo&&bo.zone===le?bo.index:null,Bo=t(ko,lt?.props.id),[Co,Oo]=Sn(null);vn(()=>{Co&&(o(),Oo(null))},[Co]);const Io=yn(st);Io.current=st;const No=xn((e,{scroll:n})=>{eo(n=>qt(e,n)),n&&Oo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Io.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&ir(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),$o=yn(null);vn(()=>{const e=$o.current;$o.current=null;const n=null==lt?.props.id?null:String(lt.props.id);So(e&&e.id===n?e.mode:mt(lt?.type)??D);const t=lt?.props.id,o=Tt.current;if(Tt.current=null,!t)return;const i=st(t);No(String(t),{scroll:!r(o,i??null,le)})},[lt?.props.id,No]);const Po=xn(e=>{So(n=>G(n,e)?n:e),rt({type:"setUi",ui:{rightSideBarVisible:!0}})},[rt]),Mo=yn(()=>{});Mo.current=(e,n)=>{const t=e?Kr(e.zone??le)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==lt?.props.id?null:String(lt.props.id);So(e=>G(e,n)?e:n),o!==r&&($o.current={id:o,mode:n},jt.select(e))};const To=xn((e,n)=>Mo.current(e,n),[]),Ao={kind:ko.kind,mode:ko,open:Po,show:e=>So(e),reveal:()=>{Et||rt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:To},jo=J(Ao,{data:ot.data,selected:lt??null,zoneOf:e=>st(e)?.zone,readOnly:Boolean(Kn),select:e=>{So(D),jt.select({index:e})},replace:(e,n)=>jt.replaceComponent(le,e,n),scrollTo:e=>xi(e)},{device:Dt,refreshes:no},{setView:eo,reveal:()=>{Lt||rt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Ro=jo.pinnedSource??!1,Lo=jo.resolveLeftView?jo.resolveLeftView(Zt,Yt):"media"===Zt&&Yt?Zt:"sections",Eo=Y(),{isLockedBlock:Vo,duplicateBlocked:Fo,nestDepth:Wo,newSectionNode:Ho,canAddTo:Uo,blockIsOffered:Do}=Eo,Go=X(),{labelAtLevel:Jo,Icon:Yo,useProducts:Xo}=Go,Qo=Go.rowName?(e,n,t)=>Go.rowName(e,n,t):void 0,Ko=xn(e=>{rt({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),No(e,{scroll:!0})},[rt,No]),{selectNode:_o,openPartId:qo}=v({mode:ko,setMode:So,onOpenPart:Ko}),[Zo,er]=Sn(null);ke(null!==Zo,()=>er(null));const nr=y(Q()),tr=nr.collapsed,or=nr.panelWidths,[rr,ir]=Sn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(tr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
12
+ return new Set}});vn(()=>{try{window.localStorage.setItem(tr,JSON.stringify([...rr]))}catch{}},[rr]);const[lr,sr]=Sn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(or);if(!e)return{...k};const n=JSON.parse(e);return{left:S(Number(n.left)||k.left),right:S(Number(n.right)||k.right)}}catch{return{...k}}});vn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(or,JSON.stringify(lr))}catch{}},300);return()=>clearTimeout(e)},[lr]);const dr=xn((e,n)=>sr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),cr=xn(e=>dr("left",e),[dr]),ar=xn(e=>dr("right",e),[dr]),pr=e=>rr.has(e),ur=e=>ir(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),fr=yn(!1),hr=yn(null);vn(()=>{if(fr.current&&!so){const e=hr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??ro.current?.querySelector(`button[aria-label="${CSS.escape(xt.add.title)}"]`))?.focus(),hr.current=null}fr.current=so},[so]),vn(()=>{if(!so||!lo)return;const e=e=>{"Escape"===e.key&&$i()};return lo.addEventListener("keydown",e),()=>lo.removeEventListener("keydown",e)},[so,lo]),ke(so,()=>$i()),vn(()=>{!Lt&&so&&(co(!1),fo(null),ao.current=!1)},[Lt]),vn(()=>{if(!Xt)return po.current&&rt({type:"setUi",ui:{leftSideBarVisible:!1}}),void(po.current=!1);so&&(co(!1),fo(null),po.current=ao.current,ao.current=!1),Lt||(po.current=!0,rt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[Xt]),vn(()=>{!Lt&&Xt&&(po.current=!1,Qt())},[Lt]),vn(()=>{if(!Xt||!lo)return;const e=e=>{"Escape"===e.key&&Qt()};return lo.addEventListener("keydown",e),()=>lo.removeEventListener("keydown",e)},[Xt,lo]),ke(null!==Xt,()=>Qt());const mr=K(),gr=(e,n="success")=>{mr?mr(e,"error"===n?"error":"info"):"error"===n?Cn.error(e,{duration:3200,sound:!1}):Cn.success(e,{duration:1900,sound:!1})},yr=yn(null),[kr,Sr]=Sn(0),[vr,xr]=Sn(0),wr=_(),br=yn(null),zr=e=>Math.max(0,e.clientHeight-(br.current?.offsetHeight??0));vn(()=>{const e=yr.current;if(!e)return;const n=()=>{Sr(e.clientWidth),xr(zr(e))};n();const t=new ResizeObserver(n);return t.observe(e),br.current&&t.observe(br.current),()=>t.disconnect()},[]),wn(()=>{yr.current&&(Sr(yr.current.clientWidth),xr(zr(yr.current)))},[lr,Lt,Et]);const Br=Dt===Ht?kr>0?kr:Ft[Ht]:Ft[Dt],Cr=kr>0?Math.min(kr/Br,"shrink"===Ut?1:2):1,Or=Br*Cr,Ir=kr>0&&Or>kr+1,Nr={width:Or,height:vr||"100%",flex:"none",position:"relative"},$r={width:Br,height:vr?vr/Cr:"100%",maxHeight:"none",transform:1!==Cr?`scale(${Cr})`:void 0,transformOrigin:"top left"},Pr=()=>rt({type:"setUi",ui:{leftSideBarVisible:!Lt}}),Mr=()=>rt({type:"setUi",ui:{rightSideBarVisible:!Et}}),Tr=e=>{so&&(co(!1),fo(null),ao.current=!1,Lt&&Zt===e)||Xt&&(po.current=!1,Qt(),Lt&&Zt===e)||(Lt&&Zt===e?Pr():(eo(e),Lt||rt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Ar=()=>{C(Le,{accept:"image/*",title:Ot.mediaLibrary})},jr=()=>{So(D),jt.select(null),u()},Rr=()=>{So(gt??D),Et||rt({type:"setUi",ui:{rightSideBarVisible:!0}})},Lr=ot.data.content??[],Er=()=>{const e=Lr.findIndex(yt),n=Lr.findIndex(kt);return{floor:e>=0?e+1:0,cap:n>=0?n:Lr.length}},Vr=dt,Fr=Eo.stripCopy,Wr=e=>i(e,Fr),Hr=w(),Ur=Me({data:ot.data,config:Vr,readOnly:Boolean(Kn),clipboard:Hr,strip:Fr?e=>Fr(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==un||e.slot!==fn)return{min:0,max:n-1};const{floor:t,cap:o}=Er();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&So(D);const t=void 0===n||"node"===n?.kind?n:null;jt.commitDocument(e,t)}}),Dr=e=>Jo(e,"block",dt.components[e]?.label??e),Gr=xn(e=>dt.components[e]?.defaultProps??{},[dt]),Jr=e=>Jo(e,"section",Dr(e)),Yr=e=>l({type:e.type,props:e.props??{}},Jr(e.type),Qo),{nodeAddresses:Xr,zoneItems:Qr}=kn(()=>{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>=de)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of ce(dt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(Lr,le,0),{nodeAddresses:e,zoneItems:n}},[Lr,dt]),Kr=xn(e=>Qr.get(e)??[],[Qr]),_r=e=>{const n=Xr.get(e);return n?Kr(n.zone)[n.index]:void 0},qr=e=>ie(Eo,dt,e),Zr=e=>{if(!Eo.slotsOf||e===le)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=_r(e.slice(0,n));if(!t)return null;const o=qr(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}},ei=(()=>{if(!q(ko))return null;const e=`${ko.nodeId}:${ko.slot}`;return Zr(e)?.slot.panel===ko.kind?e:null})(),ni=yn(null);vn(()=>{const e=ni.current;if(ni.current=null,!ei||!q(ko))return;const n=ko.nodeId;No(n,{scroll:e!==ei}),ir(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[ko]);const ti=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Xr.get(e);n&&(n.zone===le?wi(n.index):qi(n.zone,n.index,e,_r(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&ei!==i&&(ni.current=i),To(null,r),Et||rt({type:"setUi",ui:{rightSideBarVisible:!0}}),xi(o)},oi=(e,n,t)=>{const o=`${e}:${n}`;if(ir(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;ei!==o&&(ni.current=o);To(null,{kind:t,nodeId:e,slot:n})},ri=(e,n,t)=>{if(Kn||!Eo.moveSlot)return;const o=_r(e),r=o?qr(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Fn,index:n},s=ln(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=Eo.moveSlot(e,n,s);"string"==typeof d&&oi(e,d,i.panel)},ii=Xo(),li=kn(()=>{const e=/* @__PURE__ */new Map;for(const n of ii??[])e.set(n.slug,n.name);return e},[ii]),si=e=>s(e,Dr,Go.plainText,e=>li.get(e),Go.rowName),di=(e,n)=>{const t=dt.components[e.type]?.fields,o=n===le||gl(n)?"section":"block",r=n===le&&(yt(e)||kt(e)||ft(e.type)),i="block"===o?d(t):r?null:c(t);return Go.renamePropOf?Go.renamePropOf(e,o,i):i},ci=(e,n,t,o)=>{if(!(!Kn&&Zo?.zone===e&&Zo.index===n))return;const r=(t,o)=>{er(null),o&&((e,n,t)=>{const o=Kr(e)[n];if(!o)return;const r=di(o,e);r&&jt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
13
+ return Tn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":xt.rename,onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},ai=n(Z(),Ct),pi=ai.scope({target:Qe,siteId:Dn,docId:Ke}),ui=dt,fi=(e,n)=>n===le?Jr(e):Dr(e),hi=(e,n,t)=>{const o=ai.plan(pi,t,fi(t.type,e),ui);o&&(o.changed&&jt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),gr(o.message))},mi=b({nodesIn:Kr,nodeAt:(e,n)=>Kr(e)[n]??null,labelOf:(e,n)=>n===le?Jr(e):Dr(e),renamePropOf:di,beginRename:(e,n)=>er({zone:e,index:n}),history:{hasPast:it.hasPast,hasFuture:it.hasFuture,back:()=>it.back(),forward:()=>it.forward()},openAddSection:()=>{jt.select(null),Ii(null)},openPageSettings:()=>{jt.select(null),So(D)},pageSettingsLabel:xt.pageSettings,words:{menu:Bt,styleClipboard:Ct,screen:xt.menu},readOnly:Boolean(Kn),collapseAll:()=>ir(new Set(Kr(le).map(e=>String(e.props.id)))),onPasteRefused:e=>gr(e?xt.pasteRefused({name:e.label}):xt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>kl(e,n),menuRows:jo.menuRows,isLocked:e=>Vo(e.type),duplicateBlocked:e=>Fo(ot.data,e),permits:e=>se(dt,e.type),canAddTo:Uo,nodeOps:Ur,isPinned:(e,n)=>n===le&&(yt(e)||kt(e)),sectionBand:Er,openAddInside:(e,n)=>{e===le?wi(n):jt.select({zone:e,index:n}),Ii(null)},locate:e=>Xr.get(e)??null,rowNameOf:(e,n)=>n===le?Yr(e):si(e),selectAt:(e,n,t,o)=>{e===le?wi(n):qi(e,n,t,o??"")},slotRung:e=>{const n=Zr(e);return n?.slot.panel?{label:n.slot.label,select:()=>ti(n.node,n.slot,!1)}:null},style:{held:()=>O(pi),canCopy:e=>ai.rows(ui,e).some(e=>!1!==e.counted),copy:(e,n)=>ai.copy(pi,e,fi(e.type,n),ui),paste:(e,n,t)=>hi(e,n,t)},keys:Zn?{target:lo,selected:()=>{const e=ot.ui.itemSelector;return e?{zone:e.zone??le,index:e.index}:null},held:()=>Hr.get(),readOnly:Boolean(Kn),onDone:({done:e,name:n})=>{"copied"===e&&gr(xt.copied({name:n}))}}:void 0},io),gi=yn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});vn(()=>{gi.current={copy:(e,n)=>ai.copy(pi,e,fi(e.type,n),ui),paste:hi,at:()=>{const e=ot.ui.itemSelector;if(!e)return null;const n=e.zone??le,t=Kr(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Kn)}});const yi=xn(e=>{const n=I(e);if(!n)return;const t=gi.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))},[]);vn(()=>{if(!lo)return;const e=e=>yi(e);return lo.addEventListener("keydown",e),()=>lo.removeEventListener("keydown",e)},[yi,lo]),an(io,"keydown",yi);const ki=Lr.map(e=>e.props.id).join("|");vn(()=>{const e=io?.document??null,n=io?.window??null;let t=0;const o=[],r=()=>{if(!e)return void yo(e=>e.length?[]:e);const n=Lr.findIndex(kt),t=n>=0?n:Lr.length,o=n=>{const t=Lr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(cn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=Lr.length>0&&!yt(Lr[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=Vn(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}yo(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[io,ki,Dt,Cr,Lt,Et,lt?.props.id]);const Si=io?.document??null,vi=io?.window??null;vn(()=>{const e=oo.current;if(!e||!Si||!vi)return;const n=[],t=()=>{const n=Si.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&vi.scrollTo({left:vi.scrollX,top:vi.scrollY+t,behavior:"instant"}),!0};return oo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Si,vi]);const xi=e=>{jo.holdCanvasOn?jo.holdCanvasOn(e):a(e)},wi=e=>{So(D),jt.select({index:e}),jo.sectionPressed?.(Lr[e]);const n=Lr[e]?.props?.id;n&&xi(n)},bi=e=>{const{floor:n,cap:t}=Er(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=lt&&ko.kind!==gt?.kind?Lr.findIndex(e=>e.props.id===lt.props.id):-1;return o(r>=0?r+1:t)},zi=(e,n)=>{const{floor:t,cap:o}=Er(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(jt.reorderComponent(le,e,i),jt.select({index:i}),{moved:!0,dest:i})},Bi=(e,n,t,o)=>{So(D),jt.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),gr(xt.sectionAdded({name:t}))},Ci=(e,n)=>{const t=bi(n),o=Ho(e,{nodeDefaults:Gr,newNodeId:fe,sectionLabel:Jr,blockIsOffered:Do}),r=o?jt.insertNode(le,t,o):jt.insertSection(e,t);return Bi(t,r,Jr(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:c}of ce(dt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Uo(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:c,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},Oi=(e,n,t)=>{const o=bi(t),r=jt.insertNode(le,o,n);return Bi(o,r,e),o},Ii=e=>Ni(le,e),Ni=(e,n)=>{hr.current=document.activeElement??null,Xt&&(ao.current=po.current,po.current=!1,Qt()),fo(null===n?null:{zone:e,index:n}),co(!0),Lt||(ao.current=!0,rt({type:"setUi",ui:{leftSideBarVisible:!0}}))},$i=()=>{co(!1),fo(null),ao.current&&rt({type:"setUi",ui:{leftSideBarVisible:!1}}),ao.current=!1},Pi=(e,n,t)=>{if("section"===e.kind)jt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;jt.insertNode(n,t,Wr(e.template.node))}So(D),jt.select({index:t,zone:n})},Mi=(e,n)=>Go.rowName?n?yt(e)?Go.rowName(e,"section",xt.header):kt(e)?Go.rowName(e,"section",xt.footer):ft(e.type)?Go.rowName(e,"section",Dr(e.type)):Yr(e):si(e):n?Jr(e.type):Dr(e.type),Ti=e=>n=>{e()},Ai=()=>jo.editPinnedSource?.(),ji=(e,n,t)=>{if(Kn)return null;const o=Kr(e)[n];return o&&!se(dt,o.type).delete?null:/* @__PURE__ */Tn(Oe,{kind:"delete",label:xt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Kr(e)[n]?.props?.id;null!=t&&Ur.remove(String(t))})(e,n),children:/* @__PURE__ */Tn(Nn,{size:15})})},Ri=e=>Go.rowPreview?.(e)||void 0,Li=e=>Go.rowMarks?.(e)??void 0,Ei=(e,n,t)=>Go.rowActions?.(e,n,t)??null,Vi=(e,n,t,o)=>{if(Kn)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
14
+ return Tn(Oe,{kind:"eye",label:r?xt.showNamed({name:o}):xt.hideNamed({name:o}),onClick:()=>Wi(e,n,t),children:/* @__PURE__ */Tn(r?$n:Pn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},Fi=e=>{const n=Jr(Lr[e]?.type??""),t=n?xt.addSectionBefore({name:n}):xt.addSectionHere;return Wl(le,e,()=>Ii(e),t)},Wi=(e,n,t)=>{jt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Hi=e=>ae(dt,e),Ui=e=>ce(dt,e),Di=e=>Eo.slotsOf?qr(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:pe(e,n.slot)})):[{slot:null,rung:null,kids:Ui(e)}],Gi=e=>Eo.slotsOf?Di(e).flatMap(e=>e.kids):Ui(e),Ji=e=>Boolean(Eo.slotsOf)&&qr(e).some(e=>e.rung),Yi=(e,n,t)=>null===t?void 0===n?Uo(e):Uo(e,n):Uo(e,n,t),Xi=(e,n,t)=>{const o=ue(dt,e.type,n)&&(t||Gi(e).length>0||Ji(e));return{collapsible:o,folded:o&&pr(String(e.props.id))}},Qi=(e,n,t)=>Di(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),...Qi(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ki=e=>Gi(e).length>0||Ji(e)||Boolean(Uo(e.type)),_i=e=>Boolean(Uo(e)),qi=(e,n,t,o)=>{if(So(D),Uo(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),jt.select({index:n,zone:e}),a(t)}else jt.select({index:n,zone:e}),xi(t)},Zi=(e,n,t,o,r)=>{const i=`${e}:${n}`;jt.insertComponent(i,t,o),Uo(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),jt.select({index:o,zone:i})}):jt.select({index:o,zone:i})},el=(e,n,t)=>{jt.insertComponent(e,n,t),So(D),jt.select({index:t,zone:e})},nl=yn(/* @__PURE__ */new Set);vn(()=>{Lr.forEach(e=>{const n=Uo(e.type)?.spec;if(!n)return;const t=e.props.id;if(nl.current.has(t))return;nl.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(Gr)).forEach((e,t)=>Mt.seedChild(o,t,n.childType,e))})},[Lr,Mt,Gr]);const tl=yn(/* @__PURE__ */new Set);vn(()=>{Lr.forEach((n,t)=>{const o=n.props.id;if(tl.current.has(o))return;const r=e(n,Hi(n.type));tl.current.add(o),r&&Mt.replaceComponent(le,t,{...n,props:r})})},[Lr,Mt]),ee(Mt,dt);const ol=Lr.findIndex(kt),rl=ol>=0?Lr[ol]:null,il=St?Lr.findIndex(yt):-1,ll=il>=0?Lr[il]:null,sl=Lr.find(e=>e.type===pt)??null,dl=Lr.find(e=>e.type===ut)??null,cl=ol>=0?ol:Lr.length,al=[];Lr.forEach(e=>{kt(e)||(Ki(e)&&al.push(String(e.props.id)),al.push(...Qi(e,1,_i)))}),rl&&(al.push(String(rl.props.id)),al.push(...Qi(rl,1,_i)));const pl=al.length>0&&al.every(e=>rr.has(e)),ul=e=>{const n=Go.blockRowName(e,Dr);return Go.rowName?Go.rowName(e,"block",n):n},fl=(e,n,t,o)=>{const r=Kr(e)[t];if(!r)return;const i={...hn(e),index:t},l={...hn(n),index:Math.min(Math.max(o,0),Kr(n).length)},s=ln(i,l);if(e!==n||s!==t)try{Ur.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof mn))throw e}},hl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Ui(e))n.add(r),t(o)};for(const t of Hi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},ml=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Xr.get(n);if(!e)return null;if(e.zone===le)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},gl=e=>{const n=e.slice(0,e.indexOf(":")),t=Lr.find(e=>ft(e.type)&&String(e.props.id)===n);return t&&ht(n)===e?t:null},yl=(e,n,t)=>{if(e.rung){const t=_r(e.rung.nodeId),o=t?qr(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Fn&&n.index>=0&&n.index<=o}if(n.slot===Fn)return!1;if(e.add)return vl(e.add,n);const o=pn(n);if(ft(e.type))return!1;const r=gl(o),i=gl(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=Kr(o).length);if(e.zone===le||o===le){if(e.zone!==o)return!1;const{floor:t,cap:r}=Er();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Kr(o).length)return!1;if(e.zone===o)return!0;const l=rl&&!ct.lastIsOpen?String(rl.props.id):null;return(!l||ml(e.zone)!==l&&ml(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Kr(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Xr.get(i),s=l?Kr(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&hl(r).has(n))return!1;const d=Uo(s.type,Wo(ot?.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?.(Kr(n),r))})(e.zone,o,e.index,t)},kl=(e,n)=>{const t=pn(e.from);if(t===pn(n))return!0;const o=e.node;return yl({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Sl=e=>{const n=e.slice(0,e.indexOf(":")),t=Xr.get(n),o=t?Kr(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Uo(o.type,Wo(ot?.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:Dr(r.spec.childType)}]:[]),l=Zr(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Mi(o,t.zone===le)}},vl=(e,n)=>{const t=pn(n);if("block"!==e.kind){if(gl(t))return n.index>=0&&n.index<=Kr(t).length;if(t!==le)return!1;const{floor:e,cap:o}=Er();return n.index>=e&&n.index<=o}if(t===le)return!1;const o=Sl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Kr(t))},xl=(e,n)=>{e.rung?ri(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&gl(pn(n)))return void Pi(e,pn(n),n.index);if("section"===e.kind)return void Ci(e.type,n.index);if("template"===e.kind)return void Oi(e.template.name,Wr(e.template.node),n.index);const t=pn(n),o=Sl(t);o&&(o.target.spec?Zi(o.parentId,o.target.slot,e.type,n.index,o.parent.type):el(t,e.type,n.index))})(e.add,n):e.zone===le?zi(e.index,n.index):fl(e.zone,pn(n),e.index,n.index)},[wl]=Sn(()=>on()),bl=rn({keyOf:e=>e.id,readOnly:Boolean(Kn),session:wl,canDrop:yl,onDrop:xl,onStep:(e,n)=>{e.rung?ri(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===le?((e,n)=>{const t=Jr(Lr[e]?.type??""),o=zi(e,n<0?e-1:e+2);if(!o.moved)return void gr(n<0?xt.sectionFirst({name:t}):xt.sectionLast({name:t}));const{floor:r,cap:i}=Er();gr(xt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):fl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),zl=xn(e=>{const{floor:n,cap:t}=Er(),o=[];for(const r of e.nodes){const e=pn(r.place),i=Kr(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(yt(i)||kt(i)||Vo(i.type))continue;if(ft(i.type))continue;const l=Boolean(gl(e)),s=e===le||l;e===le&&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?Jr(i.type):si(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=pn(e.list);return n===le&&0===e.children.length?[{...e,addLabel:xt.addSection,addAlways:!0}]:e.children.length>0||Boolean(Sl(n)?.choices.length)||Boolean(gl(n))?[e]:[]}),i=r.flatMap(e=>{const n=pn(e.list);return n===le||gl(n)||!Sl(n)?.choices.length?[]:Ze(e,xt.addBlockHere)});return{sources:o,zones:r,seams:i}},[ot.data]),Bl=null==lt?.props.id?null:String(lt.props.id),Cl=xn(e=>{const n=dt,t=e=>!e.item.rung&&null!==gn(ot.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(Bl);return i||(r(Te(ot.data,n,o.item.id,Bl))??o)},[ot.data,dt,Bl]),Ol=e=>{So(D),jt.select(e.zone===le?{index:e.index}:{index:e.index,zone:e.zone})},Il=ne(),Nl=()=>({data:ot.data,device:Dt,ops:jt,inspector:Ao}),$l=Il?.model,Pl=kn(()=>$l?e=>$l(e,zl(e),Nl()):zl,[$l,zl,Dt]),Ml=Il?.measure,Tl=Ml?(e,n)=>Ml(e,n,Nl()):void 0,Al=Il?.canDrop,jl=Al?(e,n)=>Al(e,n,yl,Nl()):yl,Rl=Il?.drop,Ll=Rl?(e,n)=>Rl(e,n,xl,Nl()):xl,El=Il?.pick,Vl=El?e=>El(e,Ol,Nl()):Ol,Fl=e=>{const n=pn(e),t=Zr(n);t&&ti(t.node,t.slot,!1),Ni(n,e.index)},Wl=(e,n,t,o)=>/* @__PURE__ */Tn(Ie,{...Kn?{}:bl.seam({place:{...hn(e),index:n}}),onAdd:Kn?void 0:t,label:o},`seam:${e}:${n}`),Hl={rowClick:Ti,isCollapsed:pr,toggleCollapse:ur},Ul=e=>{const n=String(e.props.id),t=Lr.findIndex(e=>String(e.props.id)===n),o=ht(n),r=Kr(o),i=pr(n),l=Dr(e.type),s=Go.rowName?Go.rowName(e,"section",l):l,d=e=>Wl(o,e,()=>Ni(o,e),xt.addSectionHere);/* @__PURE__ */
15
+ return An(jn,{children:[
16
+ /* @__PURE__ */Tn(be,{words:wt,icon:/* @__PURE__ */Tn(Yo,{type:e.type,size:13}),name:s,preview:Ri(e),marks:Li(e),onSelect:()=>wi(t),nameSlot:ci(le,t,n,s),selected:Bo===n,actions:Ei(e,le,t)??void 0,rowProps:{"data-node-id":n,onClick:Ti(()=>wi(t))},fold:{open:!i,label:"section",onToggle:()=>ur(n)}}),!i&&/* @__PURE__ */An(ze,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Yr(n),l=Ki(n),s=l&&pr(r),c=()=>qi(o,t,r,e.type),{rowProps:a,...p}=bl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...hn(o),index:t}},{"data-node-id":r,onClick:Ti(c)});/* @__PURE__ */
17
+ return An(bn,{children:[d(t),
18
+ /* @__PURE__ */Tn(be,{words:wt,icon:/* @__PURE__ */Tn(Yo,{type:n.type,size:13}),name:i,preview:Ri(n),marks:Li(n),onSelect:c,nameSlot:ci(o,t,r,i),selected:Bo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>ur(r)}:void 0,actions:/* @__PURE__ */An(jn,{children:[ji(o,t,i),Ei(n,o,t),Vi(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Tn(ze,{children:Jl(n,2)})]},r)}),d(r.length)]})]})},Dl=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=bl.dragging,d=!pr(l)&&s?.rung?.nodeId!==i,c={...hn(l),index:0},a=s&&!s.rung&&yl(s,c)?c:void 0,p=()=>ti(e,n,!0),{rowProps:u,...f}=bl.row({item:{id:`rung:${l}`,zone:`${i}:${Fn}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Fn,index:t},into:a,canDrag:Boolean(Eo.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Ti(p)}),h=Kn?null:Eo.slotActions?.(e,n.slot);/* @__PURE__ */
19
+ return An(bn,{children:[n.heading,
20
+ /* @__PURE__ */Tn(be,{words:wt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:ei===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>ur(l)},actions:h&&h.length>0?/* @__PURE__ */Tn(jn,{children:h.map((t,o)=>/* @__PURE__ */Tn(Oe,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Kn||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&oi(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__ */Tn(Nn,{size:15}):/* @__PURE__ */Tn(Mn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Tn(ze,{children:r})]},l)},Gl=(e,n)=>{const t=Di(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
21
+ return Tn(jn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Yi(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(Sl(c)?.choices.length),p=(e,n)=>a?Wl(e,n,()=>Ni(e,n),xt.addBlockHere):Wl(e,n),u=/* @__PURE__ */An(jn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Bo===String(n.props.id),{collapsible:i,folded:s}=Xi(n,l,_i(n.type)),d=String(n.props.id),c=ul(n),a=()=>qi(t,o,d,e.type),{rowProps:u,...f}=bl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...hn(t),index:o}},{"data-node-id":d,onClick:Ti(a)});/* @__PURE__ */
22
+ return An(bn,{children:[0===o&&p(t,0),
23
+ /* @__PURE__ */Tn(be,{words:wt,icon:/* @__PURE__ */Tn(Yo,{type:n.type,size:13}),name:c,preview:Ri(n),marks:Li(n),onSelect:a,nameSlot:ci(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>ur(d)}:void 0,actions:/* @__PURE__ */An(jn,{children:[ji(t,o,c),Ei(n,t,o),Vi(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Tn(ze,{children:Gl(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?Dl(e,t.rung,r++,o,u):/* @__PURE__ */Tn(bn,{children:u},t.slot??"")})})},Jl=(e,n)=>{const t=Wo(ot?.data,e.type,String(e.props.id)),o=Di(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
24
+ return Tn(jn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Yi(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)?()=>Zi(e.props.id,c.slot,c.childType,t,e.type):n===h?()=>Ni(n,t):void 0;return Wl(n,t,o,n===f&&c?c.addLabel:xt.addBlockHere)},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),k=/* @__PURE__ */An(jn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Bo===String(n.props.id),i=si(n),l=String(n.props.id),{collapsible:d,folded:c}=Xi(n,s,_i(n.type)),a=Hi(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...hn(p),index:Kr(p).length}:void 0,f=bl.dragging,h=u&&f&&yl(f,u)?u:void 0,g=()=>qi(t,o,l,e.type),{rowProps:y,...k}=bl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...hn(t),index:o},into:h,canDrag:!Vo(n.type)},{"data-node-id":l,onClick:Ti(g)});/* @__PURE__ */
25
+ return An(bn,{children:[0===o&&m(t,0),
26
+ /* @__PURE__ */Tn(be,{words:wt,icon:/* @__PURE__ */Tn(Yo,{type:n.type,size:13}),name:i,preview:Ri(n),marks:Li(n),onSelect:g,nameSlot:ci(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>ur(l)}:void 0,actions:Vo(n.type)?Ei(n,t,o)??void 0:/* @__PURE__ */An(jn,{children:[ji(t,o,i),Ei(n,t,o),Vi(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Tn(ze,{children:Jl(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
27
+ /* @__PURE__ */Tn(N,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>Zi(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?Dl(e,o.rung,i++,r,k):/* @__PURE__ */Tn(bn,{children:k},o.slot??"")})})},Yl=(()=>{if(!lt||!vo)return null;const e=String(lt.type),n=String(lt.props.id),t=Uo(e,Wo(ot?.data,e,n));if(!t||"footer"===t.source)return null;const o=Lr.some(e=>String(e.props?.id)===n),r=Array.isArray(lt.props[t.slot])?lt.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:Dr(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:Mi(lt,o),choices:i,onPick:o=>{t.spec?Zi(n,t.slot,o,r.length,e):el(`${n}:${t.slot}`,o,r.length)}}})(),Xl=bo&&bo.zone!==le&&!gl(bo.zone)?bo.zone:null,Ql=!0===ho.blocksFirst,Kl=Xl?Sl(Xl):Ql&&bo?null:Yl,_l=Boolean(uo&&Xl)||Ql&&Boolean(Kl&&Kl.choices.length>0),ql=so||null!==Xt,Zl=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:Lt&&!ql&&Lo===e.id,onSelect:()=>Tr(e.id)}:e,es=[{id:"add",label:xt.add.title,icon:/* @__PURE__ */Tn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:so,onSelect:()=>so?$i():Ii(null)},...(jo.railLead??[]).map(Zl),{id:"sections",label:xt.layers,icon:/* @__PURE__ */Tn(Ae,{}),active:Lt&&!ql&&"sections"===Lo,onSelect:()=>Tr("sections")},...(jo.railTrail??[]).map(Zl)];Yt?es.push({id:"media",label:xt.railMedia,icon:/* @__PURE__ */Tn(je,{}),active:Lt&&!so&&(null!==Xt||"media"===Lo),onSelect:()=>Tr("media")}):et&&es.push({id:"media",label:xt.railMedia,icon:/* @__PURE__ */Tn(je,{}),onSelect:Ar});const ns=[...jo.railLead??[],...jo.railTrail??[]].find(e=>"panel"in e&&e.id===Lo),ts=Boolean(vt?.foldable)&&!Ro,os=vt?.label??(nt?xt.pageSections:xt.templateSections),rs=ts&&pr(Wn),is=/* @__PURE__ */An(jn,{children:[Lr.map((e,n)=>{if(yt(e)||kt(e)||ft(e.type))return null;const t=Bo===String(e.props.id),o=Boolean(e.props._hidden);Ui(e);const r=String(e.props.id),i=jo.hasOwnRows?.(e)??!1,l=Ki(e)||i,s=l&&pr(r),d=Hi(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...hn(c),index:Kr(c).length}:void 0,p=bl.dragging,u=a&&p&&yl(p,a)?a:void 0,{rowProps:f,...h}=bl.row({item:{id:r,zone:le,index:n,type:e.type},place:{...hn(le),index:n},into:u},{"data-node-id":r,onClick:Ti(()=>wi(n))});/* @__PURE__ */
28
+ return An(bn,{children:[n>0&&Fi(n),
29
+ /* @__PURE__ */Tn(be,{words:wt,icon:/* @__PURE__ */Tn(Yo,{type:e.type,size:13}),name:Yr(e),preview:Ri(e),marks:Li(e),onSelect:()=>wi(n),nameSlot:ci(le,n,r,Yr(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>ur(r)}:void 0,actions:/* @__PURE__ */An(jn,{children:[ji(le,n,Yr(e)),Ei(e,le,n),Vi(le,n,e,Yr(e))]}),rowProps:f}),Ki(e)&&!s&&/* @__PURE__ */An(ze,{children:[Jl(e,1),jo.partRows?.(e,Hl)]}),i&&!s&&/* @__PURE__ */Tn(ze,{children:jo.ownRows?.(e,n,Hl)})]},String(e.props.id??n))}),!Ro&&cl>0&&Fi(cl),vt?.addAtEnd&&!Ro&&!Kn&&/* @__PURE__ */Tn(N,{small:!0,label:xt.addSection,blocked:null,onAdd:()=>Ii(cl)})]}),ls=(e,n,t)=>{const o=String(e.props.id),r=Gi(e).length>0||Ji(e)||Boolean(Uo(e.type)),i=r&&pr(o),l="header"===t?xt.header:xt.footer,s=Go.rowName?Go.rowName(e,"section",l):l;/* @__PURE__ */
30
+ return An(jn,{children:[
31
+ /* @__PURE__ */Tn(be,{words:wt,icon:/* @__PURE__ */Tn(Yo,{type:t,size:13}),name:s,preview:Ri(e),marks:Li(e),onSelect:()=>wi(n),nameSlot:ci(le,n,o,s),selected:Bo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>ur(o)}:void 0,actions:Ei(e,le,n)??void 0,rowProps:{"data-node-id":o,onClick:Ti(()=>wi(n))}}),r&&!i&&/* @__PURE__ */Tn(ze,{children:Gl(e,1)})]})};return(jo.wrap??(e=>e))(
32
+ /* @__PURE__ */Tn(te,{target:io,children:/* @__PURE__ */An("div",{ref:ro,className:"sf-editor es-editor",style:Xe(lr),onContextMenu:mi.onEditorContextMenu,...m(Le),children:[
33
+ /* @__PURE__ */An(Ee,{children:[
34
+ /* @__PURE__ */Tn(Ve,{items:es,ariaLabel:xt.bar.views}),
35
+ /* @__PURE__ */An(Fe,{children:[
36
+ /* @__PURE__ */Tn(We,{label:xt.bar.undo,disabled:Boolean(Kn)||!it.hasPast,onClick:()=>it.back(),children:/* @__PURE__ */Tn(On,{})}),
37
+ /* @__PURE__ */Tn(We,{label:xt.bar.redo,disabled:Boolean(Kn)||!it.hasFuture,onClick:()=>it.forward(),children:/* @__PURE__ */Tn(In,{})}),
38
+ /* @__PURE__ */Tn(He,{}),
39
+ /* @__PURE__ */Tn(Ue,{devices:Vt,value:Dt,onChange:Gt})]}),
40
+ /* @__PURE__ */An(Fe,{kind:"right",style:{minWidth:300},children:[
41
+ /* @__PURE__ */Tn(Rn,{saveState:Jn,notSaving:Boolean(Kn)||null!=Yn,readOnlyReason:_n,toggle:qn,onToggle:Qn,onRetry:Xn,words:xt.bar,saveWords:zt}),jo.barLead?.(),
42
+ /* @__PURE__ */Tn(zn,{content:xt.bar.refreshTip,side:"bottom",children:/* @__PURE__ */Tn(Bn,{variant:"secondary",onClick:()=>{oo.current=(()=>{const e=io?.document;if(!e)return null;const n=Lr.findIndex(kt),t=n>=0?n:Lr.length;let o=null;for(let n=0;n<t;n++){const t=Lr[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=lt?.props?.id??Lr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),to(e=>e+1)},children:xt.bar.refresh})}),jo.barTrail?.(),jo.barMain?jo.barMain():/* @__PURE__ */Tn(Bn,{variant:"primary",disabled:null!==_n,onClick:()=>{Gn(ot.data)},children:xt.done})]})]}),
43
+ /* @__PURE__ */Tn(z,{}),
44
+ /* @__PURE__ */An("div",{className:"sf-body",children:[Lt?/* @__PURE__ */An(jn,{children:[
45
+ /* @__PURE__ */Tn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":xt.leftPanel,children:so?/* @__PURE__ */Tn($,{blocks:Kl,blocksOnly:_l,at:uo?{label:(e=>{const n=gl(e.zone);if(n)return xt.add.addingTo({name:Go.rowName?Mi(n,!0):Dr(n.type)});if(e.zone===le){const n=Lr[e.index];return n&&!kt(n)?xt.add.addingBefore({name:Mi(n,!0)}):xt.add.addingAtEnd}const t=Sl(e.zone);return t?xt.add.addingTo({name:t.parentName}):xt.add.addingHere})(uo),onClear:()=>fo(null)}:void 0,onAdd:e=>{const n=bo,t=(e,n)=>{uo&&fo({zone:e,index:n})};if(n&&"block"!==e.kind&&gl(n.zone))return Pi(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===zo)return void Ci(e);const n=Ci(e,zo);uo&&mo(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===zo)return void Oi(e,n);const t=Oi(e,n,zo);uo&&mo(t+1)})(e.template.name,Wr(e.template.node));if(n&&n.zone!==le){const o=Sl(n.zone);if(!o)return;return o.target.spec?Zi(o.parentId,o.target.slot,e.type,n.index,o.parent.type):el(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:wl,siteWide:jo.addPanelRow?.($i),onClose:$i,onHide:Pr,readOnly:Boolean(Kn)}):Xt&&Jt?
46
+ /* @__PURE__ */Tn(T,{panel:Jt,pick:Xt,onHide:Pr}):ns?ns.panel({onHide:Pr,notify:gr}):"media"===Lo&&Jt?/* @__PURE__ */Tn(T,{panel:Jt,pick:null,onHide:Pr}):/* @__PURE__ */An(jn,{children:[
47
+ /* @__PURE__ */Tn(P,{icon:/* @__PURE__ */Tn(Ae,{}),title:xt.layers,context:It,actions:
48
+ /* @__PURE__ */Tn(De,{label:pl?xt.expandAll:xt.collapseAll,title:0===al.length?xt.nothingToFold:void 0,disabled:0===al.length,onClick:()=>ir(e=>{const n=new Set(al);return pl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...al])}),children:/* @__PURE__ */Tn(Ln,{expand:pl})}),onHide:Pr}),
49
+ /* @__PURE__ */An(Be,{className:"sf-tree sf-scroll",words:wt,children:[
50
+ /* @__PURE__ */Tn(be,{words:wt,icon:/* @__PURE__ */Tn(Yo,{type:"page",size:13}),name:xt.pageSettings,onSelect:jr,selected:!lt&&vo,rowProps:{onClick:Ti(jr)}}),sl&&/* @__PURE__ */An(jn,{children:[
51
+ /* @__PURE__ */Tn(Ce,{children:xt.header}),Ul(sl)]}),!Ro&&tt&&/* @__PURE__ */An(jn,{children:[
52
+ /* @__PURE__ */Tn(Ce,{children:xt.header}),!St&&/* @__PURE__ */Tn(be,{words:wt,icon:/* @__PURE__ */Tn(Yo,{type:"header",size:13}),name:xt.header,onSelect:Rr,selected:ko.kind===gt?.kind,rowProps:{onClick:Ti(Rr)}})]}),!Ro&&ll&&ls(ll,il,"header"),!Ro&&!ts&&/* @__PURE__ */Tn(Ce,{children:os}),ts?/* @__PURE__ */An(jn,{children:[
53
+ /* @__PURE__ */Tn(be,{words:wt,icon:null,name:os,fold:{open:!rs,label:os,onToggle:()=>ur(Wn)}}),!rs&&/* @__PURE__ */Tn(ze,{children:is})]}):is,tt&&/* @__PURE__ */Tn(Ce,{children:xt.footer}),rl&&ls(rl,ol,"footer"),!Ro&&!rl&&tt&&/* @__PURE__ */Tn(be,{words:wt,icon:/* @__PURE__ */Tn(Yo,{type:"footer",size:13}),name:xt.footer,onSelect:Ai,rowProps:{onClick:Ti(Ai),title:xt.editFooter}}),dl&&Ul(dl),jo.treeFoot?.()]})]})}),
54
+ /* @__PURE__ */Tn(Ge,{side:"left",width:lr.left,min:Ye,max:Je,defaultWidth:k.left,label:xt.resizeLeftPanel,onResize:cr})]}):/* @__PURE__ */Tn(M,{side:"left",onShow:Pr}),
55
+ /* @__PURE__ */An("div",{ref:yr,className:"sf-center sf-scroll","data-sf-canvas-head":wr?"":void 0,style:{overflowX:Ir?"auto":"hidden",overflowY:"hidden"},children:[wr&&/* @__PURE__ */Tn("div",{ref:br,className:"sf-canvas-head",children:/* @__PURE__ */Tn(wr,{device:Dt})}),
56
+ /* @__PURE__ */Tn("div",{className:"sf-frame-scaler",style:Nr,children:/* @__PURE__ */Tn("div",{className:"sf-frame "+(Dt===Ht?"":`sf-frame--${Dt}`),style:$r,children:/* @__PURE__ */An("div",{className:"sf-preview-host",children:[
57
+ /* @__PURE__ */Tn(Nt,{},no),
58
+ /* @__PURE__ */Tn(en,{canvas:io,session:wl,model:Pl,measure:Tl,canDrop:jl,onDrop:Ll,choose:Cl,onPick:Vl,onZoneAdd:Fl,onSeamAdd:Fl,zoneAddLabel:xt.canvasAddBlock,words:bt.canvas,readOnly:Boolean(Kn),revision:ot.data}),go.length>0&&/* @__PURE__ */Tn("div",{className:"sf-preview-gaps",children:go.map(e=>
59
+ /* @__PURE__ */Tn(nn,{index:e.index,label:xt.addSectionHere,onInsert:()=>Ii(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})})})]}),Et?/* @__PURE__ */An(jn,{children:[
60
+ /* @__PURE__ */Tn(g,{value:{selectChild:qi,addChild:Zi,childRowName:si,blockRowName:ul},children:/* @__PURE__ */Tn($t,{mode:ko,onOpenWebsiteSettings:jo.openSettings??(()=>{}),onOpenSiteStyles:jo.openStyles,onSelectNode:_o,onNotify:gr,onHidePanel:Mr,nodeActions:lt?se(dt,lt.type):Hn})}),
61
+ /* @__PURE__ */Tn(Ge,{side:"right",width:lr.right,min:Ye,max:Je,defaultWidth:k.right,label:xt.resizeSettingsPanel,onResize:ar})]}):
62
+ /* @__PURE__ */Tn(M,{side:"right",onShow:Mr})]}),mi.menu]})}))}export{Un as ScreenChrome};
@@ -0,0 +1,18 @@
1
+ import{DEFAULT_DRAG_WORDS as e}from"./chunk-O2NLQBFX.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as a,isNoOpDrop as r}from"./chunk-67GNT6PF.js";import{useCanvasLayout as o,useCanvasEvent as s,CANVAS_TYPING_EVENT as i,framePointToHost as c,elementScale as d,frameRectToLayer as u,clientPointToLayer as h}from"./chunk-AWJUYMX7.js";import{withTip as f}from"./chunk-P2VEMZH5.js";import{parseZoneKey as p}from"./chunk-KRXQM65X.js";import{useRef as m,useEffect as g,useState as b,useCallback as x,useMemo as y,useSyncExternalStore as v,useId as w,useLayoutEffect as k}from"react";import{Tooltip as N,IconButton as A,Input as z}from"efficient-shell/ui";import{AddIcon as D,CloseIcon as T,SearchIcon as $}from"efficient-shell/icons/efficient";import{jsxs as C,jsx as M}from"react/jsx-runtime";function S({label:e,onInsert:t,style:n,axis:l="y",className:a,index:r}){const o=["es-canvas-insert","x"===l?"is-x":"",a??""].filter(Boolean).join(" ");/* @__PURE__ */
2
+ return C("div",{className:o,style:n,"data-index":r,children:[
3
+ /* @__PURE__ */M("span",{className:"es-canvas-insert-line","aria-hidden":"true"}),
4
+ /* @__PURE__ */M("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */M(N,{content:e,children:/* @__PURE__ */M(A,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */M(D,{})})})})]})}var E=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,j=e=>e.width*e.height;function L(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>E(e.box,t,n)).sort((e,t)=>j(t.s.box)-j(e.s.box)||e.at-t.at).map(({s:e})=>e)}function B(e,t,n){return L(e,t,n).at(-1)??null}function K(e,t,n){const l="x"===e.axis?t:n;let a=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(a+=1)}return a}function X(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],a=n[t],r=l&&a?(l.left+l.width+a.left)/2:l?l.left+l.width:a?a.left:e.box.left,o=a??l??e.box;return{left:r-1,top:o.top,width:2,height:o.height}}const l=n[t-1],a=n[t],r=l&&a?(l.top+l.height+a.top)/2:l?l.top+l.height:a?a.top:e.box.top;return{left:e.box.left,top:r-1,width:e.box.width,height:2}}function q(e,t,n,l,a=()=>!1,r=()=>!0){const o=e.filter(e=>E(e.box,t,n)).sort((e,t)=>j(e.box)-j(t.box));for(const e of o){const o=K(e,t,n),s={...e.list,index:o};if(a(s))return null;if(l(s))return{zone:e,to:s,line:X(e,o)};if(!r(s))return null}return null}function O(e,t,n=12){const l=e.children;if(0===l.length)return[];const a=e.box,r="x"===e.axis,o=r?a.left:a.top,s=o+(r?a.width:a.height),i=e=>r?e.left:e.top,c=e=>r?e.left+e.width:e.top+e.height,d=[];for(let u=0;u<=l.length;u++){const h=l[u-1],f=l[u];let p,m;if(h&&f)p=c(h),m=Math.max(i(f)-p,0);else{const e=h?(c(h)+s)/2:(o+i(f))/2;p=Math.min(Math.max(e,o+n),s-n),m=0}const g=r?{left:p,top:a.top,width:m,height:a.height}:{left:a.left,top:p,width:a.width,height:m};d.push({key:`${e.key}:+${u}`,place:{...e.list,index:u},box:g,axis:e.axis,label:t})}return d}function I(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const a=e.children[l-1],r=e.children[l],o=a.top+a.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:o,width:e.box.width,height:Math.max(r.top-o,0)}})}return n}var P={nodes:[],zones:[]},F="data-puck-dropzone",R="data-puck-component";function Y(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function Z(e,t){const{frame:n,document:l}=e,a=e=>u(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),r=[],o=[];for(const e of l.querySelectorAll(`[${F}]`)){const t=e.getAttribute(F)??"";let n;try{n=p(t)}catch{continue}const l=[...e.querySelectorAll(`[${R}]`)].filter(t=>t.parentElement?.closest(`[${F}]`)===e),s=l.map(a);o.push({key:t,list:n,box:a(e),axis:Y(s,e),children:s}),l.forEach((e,t)=>{const l=e.getAttribute(R);l&&r.push({id:l,place:{...n,index:t},box:s[t]})})}return{nodes:r,zones:o}}var Q="data-es-empty-cell",V="data-puck-dropzone",W=140;var G=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function H(u){const{canvas:f,session:p,readOnly:w,words:A=e.canvas}=u,z=m(u);g(()=>{z.current=u});const D=m(null),T=o(f),[$,E]=b(0),j=x(()=>E(e=>e+1),[]),[B,K]=b(P);g(()=>{const e=D.current;f&&e&&K((z.current.measure??Z)(f,e))},[f,T,u.revision,$]);const X=u.model,O=y(()=>X(B),[X,B]),I=v(p.subscribe,p.shown,p.shown),F=u.choose,R=(e,t)=>{const n=L(O.sources,e,t);return 0===n.length?null:F?F(n):n[n.length-1]},[Y,W]=b(null),[H,J]=b(null),U=m(null),_=()=>{U.current&&clearTimeout(U.current),U.current=null},ee=()=>{_(),U.current=setTimeout(()=>{p.get()||W(null)},140)};g(()=>_,[]);const te=m(null),ne=m(!1);s(f,i,e=>{ne.current=Boolean(e.detail?.typing),ne.current&&(_(),W(null))}),s(f,"mousemove",e=>{const t=D.current;if(!f||!t)return;const n=c(f.frame,e.clientX,e.clientY,t),l=d(t),a={x:n.x/l,y:n.y/l};if(te.current=a,z.current.readOnly||p.get()||ne.current)return;_();const r=R(a.x,a.y);W(e=>e?.key===r?.key&&e?.box===r?.box?e:r)}),s(f,"mouseout",e=>{e.relatedTarget||(te.current=null,ee())}),s(f,"mouseover",e=>{e.relatedTarget||j()});const le=m(null),ae=x(()=>{le.current?.(),le.current=null,J(null)},[]);g(()=>p.subscribe(()=>{p.get()?j():ae()}),[p,ae,j]),g(()=>ae,[ae]),("undefined"==typeof document?g:k)(()=>{if(p.get())return;const e=te.current;W(t=>w||ne.current?null:e?R(e.x,e.y):t?O.sources.find(e=>e.key===t.key)??null:null)},[O,I,p,w,F]);const re=e=>{const t=p.get(),n=D.current;if(!t||!n)return null;const l=h(n,e.clientX,e.clientY);te.current=l;const a=q(O.zones,l.x,l.y,e=>z.current.canDrop(t.item,e),e=>!!t.from&&r(t.from,e),e=>z.current.fallThrough?.(t.item,e,t.from)??!0);return a?{h:t,t:a}:null},oe={onDragEnter:e=>{if(le.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),r=f?l(f.document):null,o=[];t&&o.push(a(t)),r&&f&&o.push(a(r,f.frame)),le.current=o.length?()=>o.forEach(e=>e()):null},onDragOver:e=>{const n=re(e);if(!n)return void J(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const l={zoneKey:n.t.zone.key,line:n.t.line,axis:n.t.zone.axis};J(e=>e&&e.zoneKey===l.zoneKey&&e.line.left===l.line.left&&e.line.top===l.line.top?e:l)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(te.current=null,J(null))},onDrop:e=>{const t=re(e);t&&(e.preventDefault(),p.end(),ae(),z.current.onDrop(t.h.item,t.t.to))}},se={draggable:!w&&!!Y,onMouseEnter:_,onMouseLeave:()=>!p.get()&&ee(),onDragStart:e=>{if(Y&&!w){p.start({key:Y.key,item:Y.item,from:Y.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",Y.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{p.end(),ae()},onClick:()=>{Y&&!w&&z.current.onPick?.(Y.item)}},{seams:ie=[]}=O,ce=O.zones.filter(e=>0===e.children.length),de=u.onZoneAdd&&!w?ce:[],ue=de.map(e=>e.key).join("\n");return g(()=>{const e=f?.document;if(!e)return;const t=new Set(ue?ue.split("\n"):[]);for(const n of e.querySelectorAll(`[${V}]`))n.toggleAttribute(Q,t.has(n.getAttribute(V)??""));return()=>{for(const t of e.querySelectorAll(`[${Q}]`))t.removeAttribute(Q)}},[f,ue,B,T,$]),/* @__PURE__ */C("div",{ref:D,className:"es-canvas-layer",children:[I||!u.onSeamAdd||w?null:ie.map(e=>
5
+ /* @__PURE__ */M(S,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??u.seamLabel??A.addSection,onInsert:()=>u.onSeamAdd?.(e.place),style:"x"===e.axis?{left:e.box.left+e.box.width/2-12,top:e.box.top,width:24,height:e.box.height}:{left:e.box.left,top:e.box.top+e.box.height/2-12,width:e.box.width,height:24}},e.key)),de.length?de.map(e=>/* @__PURE__ */M("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",H?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:G(e.box),onClick:()=>u.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */M("span",{className:"es-canvas-empty-add",children:A.addButton({label:e.addLabel??u.zoneAddLabel??A.addBlock})})},e.key)):null,I?/* @__PURE__ */M("div",{className:"es-canvas-catch",...oe}):null,H&&!ce.some(e=>e.key===H.zoneKey)?/* @__PURE__ */M("div",{className:`es-canvas-line is-${H.axis}`,style:G(H.line)}):null,
6
+ /* @__PURE__ */M("div",{className:"es-canvas-handle-spot",style:Y?{"--es-handle-x":`${Y.box.left+2}px`,"--es-handle-y":`${Math.max(Y.box.top-11,0)}px`}:void 0,children:/* @__PURE__ */M(N,{className:"es-canvas-handle-tip",side:"top",content:!Y||w||I?null:Y.title??A.handle({label:Y.label}),children:/* @__PURE__ */C("div",{className:["es-canvas-handle",Y&&!w?"is-shown":"",I?"is-dragging":""].filter(Boolean).join(" "),...se,children:[
7
+ /* @__PURE__ */M("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),Y?.label]})})})]})}var J=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function U({groups:t,session:n,itemFor:l,onInsert:a,at:r,hint:o,searchLabel:s,readOnly:i,words:c=e.add}){const d=o??c.hint,u=s??c.search,[h,p]=b(""),m=w(),g=h.trim().toLowerCase(),x=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),y=t.map((e,t)=>({...e,key:x[t],tiles:g?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,g)):e.tiles})).filter(e=>e.tiles.length>0),v=(e,t)=>a=>{if(t)a.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),a.dataTransfer.effectAllowed="copy";try{a.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
8
+ return C("div",{className:"es-add",children:[r?/* @__PURE__ */C("div",{className:"es-add-at",role:"status",children:[
9
+ /* @__PURE__ */M("span",{children:r.label}),f(c.stop,/* @__PURE__ */M("button",{type:"button",className:"es-add-at-clear","aria-label":c.stop,onClick:r.onClear,children:/* @__PURE__ */M(T,{size:12,"aria-hidden":"true"})}))]}):null,
10
+ /* @__PURE__ */M("p",{className:"es-add-hint",children:d}),
11
+ /* @__PURE__ */M("div",{className:"es-add-find",children:/* @__PURE__ */M(z,{id:m,type:"search","aria-label":u,placeholder:c.searchPlaceholder({label:u}),value:h,onChange:e=>p(e.target.value),leftIcon:/* @__PURE__ */M($,{size:16,"aria-hidden":"true"}),rightAdornment:h?/* @__PURE__ */M(A,{size:"sm","aria-label":c.clearSearch,onClick:()=>p(""),children:/* @__PURE__ */M(T,{size:12,"aria-hidden":"true"})}):void 0})}),0===y.length?/* @__PURE__ */C("div",{className:"es-add-empty",role:"status",children:[
12
+ /* @__PURE__ */M("div",{className:"es-add-empty-title",children:c.nothing({query:h.trim()})}),
13
+ /* @__PURE__ */M("div",{className:"es-add-empty-sub",children:c.tryAnother})]}):y.map(e=>/* @__PURE__ */C("section",{className:"es-add-group","aria-label":e.title,children:[
14
+ /* @__PURE__ */C("div",{className:"es-add-group-head",children:[
15
+ /* @__PURE__ */M("span",{className:"es-add-group-title",children:e.title}),
16
+ /* @__PURE__ */M("span",{className:"es-add-group-count",children:e.tiles.length})]}),
17
+ /* @__PURE__ */M("div",{className:J(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(i||e.disabled),l=i?void 0:e.disabled?e.disabledReason:e.title??c.tile({label:e.label});return f(l,/* @__PURE__ */C("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":c.tile({label:e.label}),onDragStart:v(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&a(e.type),children:[null!=e.cover?/* @__PURE__ */M("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */M("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
18
+ /* @__PURE__ */M("span",{className:"es-add-tile-label",children:e.label})]},e.type))})})]},e.key))]})}export{U as AddPanel,H as CanvasDragLayer,S as CanvasInsert,P as EMPTY_MEASURE,W as HANDLE_GRACE_MS,q as canvasTarget,E as contains,K as gapInZone,X as gapLine,O as insertSeams,Z as measureCanvas,B as pickSource,I as seamsBetween,L as sourcesAt};
@@ -1,7 +1,7 @@
1
- import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as r}from"./chunk-4UJ6CPLO.js";import{ScreenChrome as e}from"./chunk-GIP45GWF.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-WZMU646D.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.js";import{documentPermissions as o}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t}from"react";import{Dialog as d,Button as l}from"efficient-shell/ui";import{jsx as m,jsxs as g,Fragment as h}from"react/jsx-runtime";var f=n(r),v=n(e);function p({saving:n,onCancel:r,onDiscard:e,onSave:i}){const a=c("screen",s).leave;/* @__PURE__ */
1
+ import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as r}from"./chunk-4UJ6CPLO.js";import{ScreenChrome as e}from"./chunk-HXLF2ZQO.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-WZMU646D.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.js";import{documentPermissions as o}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t}from"react";import{Dialog as d,Button as l}from"efficient-shell/ui";import{jsx as m,jsxs as g,Fragment as h}from"react/jsx-runtime";var f=n(r),v=n(e);function p({saving:n,onCancel:r,onDiscard:e,onSave:i}){const a=c("screen",s).leave;/* @__PURE__ */
2
2
  return m(d,{open:!0,role:"alertdialog",size:"sm",title:a.title,onClose:r,footer:/* @__PURE__ */g(h,{children:[
3
3
  /* @__PURE__ */m(l,{variant:"secondary",onClick:r,children:a.cancel}),
4
4
  /* @__PURE__ */m(l,{variant:"ghost-danger",onClick:e,children:a.discard}),
5
5
  /* @__PURE__ */m(l,{variant:"primary",loading:n,onClick:i,children:n?a.saving:a.save})]}),children:a.body})}function u({target:n,addressing:r,onHostMessage:e,children:a}){/* @__PURE__ */
6
- return m(i,{target:n,addressing:r,onHostMessage:e,children:a})}var C=(n,r)=>/* @__PURE__ */g(h,{children:[n,r]});function k({config:n,parts:r,wrap:e=C}){const{data:i,error:d,redirecting:l,ready:g,saveStatus:h,readOnly:u,onChange:k,pendingNav:j,cancelPendingNav:N,discardAndNavigate:M,saveAndNavigate:y}=a(),H=t(()=>o(!u),[u]),F=c("screen",s);return l?/* @__PURE__ */m("div",{className:"sf-msg",children:F.loading}):d?/* @__PURE__ */m("div",{className:"sf-msg sf-msg--error",children:d}):g?i?e(
7
- /* @__PURE__ */m(f,{config:n,data:i,onChange:k,permissions:H,parts:r,children:/* @__PURE__ */m(v,{})}),j&&/* @__PURE__ */m(p,{saving:"saving"===h,onCancel:N,onDiscard:M,onSave:()=>{y()}})):/* @__PURE__ */m("div",{className:"sf-msg",children:F.loading}):/* @__PURE__ */m("div",{className:"sf-msg",children:F.waitingForAuthorization})}export{k as DocumentScreen,u as ScreenMount};
6
+ return m(i,{target:n,addressing:r,onHostMessage:e,children:a})}var C=(n,r)=>/* @__PURE__ */g(h,{children:[n,r]});function k({config:n,parts:r,wrap:e=C}){const{data:i,error:d,redirecting:l,ready:g,saveStatus:h,readOnly:u,onChange:k,pendingNav:j,cancelPendingNav:N,discardAndNavigate:H,saveAndNavigate:M}=a(),y=t(()=>o(!u),[u]),O=c("screen",s);return l?/* @__PURE__ */m("div",{className:"sf-msg",children:O.loading}):d?/* @__PURE__ */m("div",{className:"sf-msg sf-msg--error",children:d}):g?i?e(
7
+ /* @__PURE__ */m(f,{config:n,data:i,onChange:k,permissions:y,parts:r,children:/* @__PURE__ */m(v,{})}),j&&/* @__PURE__ */m(p,{saving:"saving"===h,onCancel:N,onDiscard:H,onSave:()=>{M()}})):/* @__PURE__ */m("div",{className:"sf-msg",children:O.loading}):/* @__PURE__ */m("div",{className:"sf-msg",children:O.waitingForAuthorization})}export{k as DocumentScreen,u as ScreenMount};
@@ -84,50 +84,57 @@
84
84
  pointer-events: none;
85
85
  }
86
86
 
87
- /* "+ Add section", in the gap between two sections, on hover. */
88
- .es-canvas-seam {
87
+ /* A ➕ INSERT POINT (./CanvasInsert, owner 2026-10-14): one look wherever the
88
+ canvas offers to add — between sections and between, before and after the
89
+ blocks of a box. The band only positions the chip and lets every other
90
+ click through; the chip is the shell's ghost IconButton on a small round
91
+ ground of the panel's, so it reads over any page. At rest the chip is clear
92
+ and still takes the pointer; hovered or focused, the chip and a 2px accent
93
+ line across the band show. `.es-canvas-seam` is a hook (the layer's seams). */
94
+ .es-canvas-insert {
89
95
  position: absolute;
90
96
  display: flex;
91
97
  align-items: center;
92
98
  justify-content: center;
93
- pointer-events: auto;
99
+ pointer-events: none;
94
100
  }
95
- .es-canvas-seam::before {
96
- content: "";
101
+ .es-canvas-insert-line {
97
102
  position: absolute;
98
- left: 8px;
99
- right: 8px;
103
+ left: 0;
104
+ right: 0;
100
105
  top: 50%;
101
106
  height: 2px;
102
- margin-top: -1px;
107
+ transform: translateY(-50%);
103
108
  background: var(--es-accent);
104
- border-radius: var(--radius-sm);
105
109
  opacity: 0;
110
+ pointer-events: none;
106
111
  transition: opacity 0.12s;
107
112
  }
108
- .es-canvas-seam-add {
113
+ .es-canvas-insert.is-x .es-canvas-insert-line {
114
+ left: 50%;
115
+ right: auto;
116
+ top: 0;
117
+ bottom: 0;
118
+ width: 2px;
119
+ height: auto;
120
+ transform: translateX(-50%);
121
+ }
122
+ .es-canvas-insert-chip {
109
123
  position: relative;
110
- padding: 2px 12px;
111
- border: none;
124
+ display: inline-flex;
112
125
  border-radius: 999px;
113
- background: var(--es-accent);
114
- color: var(--es-on-accent);
115
- font: 600 11px/16px var(--es-font);
116
- cursor: pointer;
126
+ background: var(--es-panel);
127
+ box-shadow: var(--es-panel-shadow);
128
+ pointer-events: auto;
117
129
  opacity: 0;
118
- transform: scale(0.9);
119
- transition: opacity 0.12s, transform 0.12s;
130
+ transition: opacity 0.12s;
120
131
  }
121
- .es-canvas-seam:hover::before,
122
- .es-canvas-seam:focus-within::before,
123
- .es-canvas-seam:hover .es-canvas-seam-add,
124
- .es-canvas-seam-add:focus-visible {
132
+ .es-canvas-insert:hover .es-canvas-insert-line,
133
+ .es-canvas-insert:focus-within .es-canvas-insert-line,
134
+ .es-canvas-insert:hover .es-canvas-insert-chip,
135
+ .es-canvas-insert:focus-within .es-canvas-insert-chip {
125
136
  opacity: 1;
126
137
  }
127
- .es-canvas-seam:hover .es-canvas-seam-add,
128
- .es-canvas-seam-add:focus-visible {
129
- transform: scale(1);
130
- }
131
138
 
132
139
  /* An empty slot: a cell that adds a block there, and takes a drop. At rest it
133
140
  draws NOTHING — no fill, no border, no label — so what is under it shows as
@@ -1,9 +1,9 @@
1
1
  import * as react from 'react';
2
- import { HTMLAttributes, ReactNode } from 'react';
2
+ import { HTMLAttributes, CSSProperties, ReactNode } from 'react';
3
3
  import { P as Place } from '../types-41704JE4.js';
4
4
  import { D as DragSession } from '../session-DSQFmIvx.js';
5
5
  export { a as DragHeld, c as createDragSession } from '../session-DSQFmIvx.js';
6
- export { B as Box, a as CanvasDragLayer, b as CanvasDragLayerProps, C as CanvasDragModel, c as CanvasDropTarget, d as CanvasSeam, e as CanvasSource, f as CanvasZone, E as EMPTY_MEASURE, H as HANDLE_GRACE_MS, M as MeasuredCanvas, g as MeasuredNode, h as canvasTarget, i as contains, j as gapInZone, k as gapLine, m as measureCanvas, p as pickSource, s as seamsBetween, l as sourcesAt } from '../CanvasDragLayer-O1gVT1AL.js';
6
+ export { B as Box, a as CanvasDragLayer, b as CanvasDragLayerProps, C as CanvasDragModel, c as CanvasDropTarget, d as CanvasSeam, e as CanvasSource, f as CanvasZone, E as EMPTY_MEASURE, H as HANDLE_GRACE_MS, M as MeasuredCanvas, g as MeasuredNode, h as canvasTarget, i as contains, j as gapInZone, k as gapLine, l as insertSeams, m as measureCanvas, p as pickSource, s as seamsBetween, n as sourcesAt } from '../CanvasDragLayer-CLb7j-CZ.js';
7
7
  import { D as DragWords } from '../words-BDignMl_.js';
8
8
  import '../watch-BTYOJpQU.js';
9
9
 
@@ -137,6 +137,37 @@ type TreeDrag<I> = {
137
137
  };
138
138
  declare function useTreeDrag<I>(options: TreeDragOptions<I>): TreeDrag<I>;
139
139
 
140
+ /**
141
+ * A ➕ INSERT POINT ON THE CANVAS (owner 2026-10-14, "two ways to add": click a
142
+ * ➕, pick an item, and it goes exactly there).
143
+ *
144
+ * One look for every place the canvas offers to add — between two sections,
145
+ * above the first, and before, between and after the blocks of a box — so the
146
+ * screen's section gaps and this layer's seams draw the SAME element (GG
147
+ * 2026-10-14, option A): the shell's ghost `IconButton` with the plus, named by
148
+ * the shell's `Tooltip` (harness UI-17, UI-24), the Layers seam "+"'s look. It
149
+ * is a real button in the tab order: with the Layers "+" removed, the canvas
150
+ * ➕ is how a keyboard adds.
151
+ *
152
+ * Only the chip takes the pointer; the band around it positions it and lets
153
+ * every other click through to the canvas. At rest the chip is clear and
154
+ * still hit-tests; hovered or focused, the chip and a 2px accent line across
155
+ * the band show. `axis: 'x'` is a gap between two things side by side: the
156
+ * line runs down instead of across.
157
+ */
158
+ type CanvasInsertProps = {
159
+ /** What the ➕ adds, in the host's words: "Add section here", "Add block here". */
160
+ label: string;
161
+ onInsert: () => void;
162
+ /** Where the band sits, in the layer's own pixels. */
163
+ style?: CSSProperties;
164
+ axis?: 'x' | 'y';
165
+ className?: string;
166
+ /** For hosts and specs to find one point by its place. */
167
+ index?: number;
168
+ };
169
+ declare function CanvasInsert({ label, onInsert, style, axis, className, index }: CanvasInsertProps): react.JSX.Element;
170
+
140
171
  /**
141
172
  * One thing the Add list offers.
142
173
  *
@@ -279,4 +310,4 @@ declare function frameScrollBox(doc: Document): HTMLElement | null;
279
310
  */
280
311
  declare function startAutoScroll(box: HTMLElement, edges?: Element): () => void;
281
312
 
282
- export { AUTO_SCROLL_EDGE, AUTO_SCROLL_MAX_SPEED, type AddGroup, AddPanel, type AddPanelProps, type AddTile, DragSession, DragWords, type DropRow, type DropSide, type DropSpot, type TreeDrag, type TreeDragOptions, type TreeDragRowOptions, type TreeDragRowProps, type TreeDragSeamOptions, type TreeDragSeamProps, autoScrollDelta, autoScrollSpeed, dropEffectFor, dropOnRow, frameScrollBox, gapToMoveIndex, isNoOpDrop, scrollBoxOf, scrollParent, startAutoScroll, stepGap, useTreeDrag };
313
+ export { AUTO_SCROLL_EDGE, AUTO_SCROLL_MAX_SPEED, type AddGroup, AddPanel, type AddPanelProps, type AddTile, CanvasInsert, type CanvasInsertProps, DragSession, DragWords, type DropRow, type DropSide, type DropSpot, type TreeDrag, type TreeDragOptions, type TreeDragRowOptions, type TreeDragRowProps, type TreeDragSeamOptions, type TreeDragSeamProps, autoScrollDelta, autoScrollSpeed, dropEffectFor, dropOnRow, frameScrollBox, gapToMoveIndex, isNoOpDrop, scrollBoxOf, scrollParent, startAutoScroll, stepGap, useTreeDrag };
@@ -1 +1 @@
1
- export{AddPanel,CanvasDragLayer,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-HFW6D46X.js";import"../chunk-O2NLQBFX.js";export{AUTO_SCROLL_EDGE,AUTO_SCROLL_MAX_SPEED,autoScrollDelta,autoScrollSpeed,createDragSession,dropEffectFor,dropOnRow,frameScrollBox,gapToMoveIndex,isNoOpDrop,scrollBoxOf,scrollParent,startAutoScroll,stepGap,useTreeDrag}from"../chunk-67GNT6PF.js";import"../chunk-AWJUYMX7.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
1
+ export{AddPanel,CanvasDragLayer,CanvasInsert,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,insertSeams,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-SSORUDHE.js";import"../chunk-O2NLQBFX.js";export{AUTO_SCROLL_EDGE,AUTO_SCROLL_MAX_SPEED,autoScrollDelta,autoScrollSpeed,createDragSession,dropEffectFor,dropOnRow,frameScrollBox,gapToMoveIndex,isNoOpDrop,scrollBoxOf,scrollParent,startAutoScroll,stepGap,useTreeDrag}from"../chunk-67GNT6PF.js";import"../chunk-AWJUYMX7.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{blockKey,AddSidePanel as default,sectionKey,templateKey}from"../../chunk-NAGDOIW4.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-ZR4CFNMW.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-MCHMF32I.js";import"../../chunk-M5VRWM7M.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-CIHKZMNR.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-HFW6D46X.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-AWJUYMX7.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{blockKey,AddSidePanel as default,sectionKey,templateKey}from"../../chunk-DSXKBICS.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-ZR4CFNMW.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-MCHMF32I.js";import"../../chunk-M5VRWM7M.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-CIHKZMNR.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-SSORUDHE.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-AWJUYMX7.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -22,7 +22,7 @@ import '../../types-CsgMwHHa.js';
22
22
  import '../../wordFit-7XpmhcaW.js';
23
23
  import '../../edit-lock/index.js';
24
24
  import '../../panelWidths-D9hTLR25.js';
25
- import '../../CanvasDragLayer-O1gVT1AL.js';
25
+ import '../../CanvasDragLayer-CLb7j-CZ.js';
26
26
  import '../../session-DSQFmIvx.js';
27
27
  import '../../words-BDignMl_.js';
28
28
  import '../../types-BLRK6_JO.js';
@@ -1 +1 @@
1
- export{ScreenChrome as default}from"../../chunk-GIP45GWF.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-BXQBCW3P.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-PAM3NLFL.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-UY7BCB32.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-6TOYXESC.js";import"../../chunk-5PUEZ22M.js";import"../../chunk-57NRNFLO.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-LVUDUQNL.js";import"../../chunk-HQWQLDCB.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-WZMU646D.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-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-V7U33NF2.js";import"../../chunk-5545A3PC.js";import"../../chunk-NAGDOIW4.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-Q2L6YTII.js";import"../../chunk-ZR4CFNMW.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-MCHMF32I.js";import"../../chunk-M5VRWM7M.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-4VJATVVR.js";import"../../chunk-BDTITTMW.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-CIHKZMNR.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-HFW6D46X.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-AWJUYMX7.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{ScreenChrome as default}from"../../chunk-HXLF2ZQO.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-BXQBCW3P.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-PAM3NLFL.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-UY7BCB32.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-6TOYXESC.js";import"../../chunk-5PUEZ22M.js";import"../../chunk-57NRNFLO.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-LVUDUQNL.js";import"../../chunk-HQWQLDCB.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-WZMU646D.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-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-V7U33NF2.js";import"../../chunk-5545A3PC.js";import"../../chunk-DSXKBICS.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-Q2L6YTII.js";import"../../chunk-ZR4CFNMW.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-MCHMF32I.js";import"../../chunk-M5VRWM7M.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-4VJATVVR.js";import"../../chunk-BDTITTMW.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-CIHKZMNR.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-SSORUDHE.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-AWJUYMX7.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -26,7 +26,7 @@ import '../../types-Dt1CFR1S.js';
26
26
  import '../../types-CsgMwHHa.js';
27
27
  import '../../wordFit-7XpmhcaW.js';
28
28
  import '../../panelWidths-D9hTLR25.js';
29
- import '../../CanvasDragLayer-O1gVT1AL.js';
29
+ import '../../CanvasDragLayer-CLb7j-CZ.js';
30
30
  import '../../session-DSQFmIvx.js';
31
31
  import '../../words-BDignMl_.js';
32
32
  import '../../types-BsyPh6EW.js';
@@ -1 +1 @@
1
- export{DocumentScreen,ScreenMount as default}from"../../chunk-T5ORM737.js";import"../../chunk-GXQCZJOP.js";import"../../chunk-4UJ6CPLO.js";import"../../chunk-GIP45GWF.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-BXQBCW3P.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-PAM3NLFL.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-UY7BCB32.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-6TOYXESC.js";import"../../chunk-5PUEZ22M.js";import"../../chunk-57NRNFLO.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-LVUDUQNL.js";import"../../chunk-HQWQLDCB.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-WZMU646D.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-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-V7U33NF2.js";import"../../chunk-5545A3PC.js";import"../../chunk-NAGDOIW4.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-Q2L6YTII.js";import"../../chunk-ZR4CFNMW.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-MCHMF32I.js";import"../../chunk-M5VRWM7M.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-4VJATVVR.js";import"../../chunk-BDTITTMW.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-CIHKZMNR.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-HFW6D46X.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-AWJUYMX7.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{DocumentScreen,ScreenMount as default}from"../../chunk-VQOIVFSG.js";import"../../chunk-GXQCZJOP.js";import"../../chunk-4UJ6CPLO.js";import"../../chunk-HXLF2ZQO.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-BXQBCW3P.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-PAM3NLFL.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-UY7BCB32.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-6TOYXESC.js";import"../../chunk-5PUEZ22M.js";import"../../chunk-57NRNFLO.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-LVUDUQNL.js";import"../../chunk-HQWQLDCB.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-WZMU646D.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-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-V7U33NF2.js";import"../../chunk-5545A3PC.js";import"../../chunk-DSXKBICS.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-Q2L6YTII.js";import"../../chunk-ZR4CFNMW.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-MCHMF32I.js";import"../../chunk-M5VRWM7M.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-4VJATVVR.js";import"../../chunk-BDTITTMW.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-CIHKZMNR.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-SSORUDHE.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-AWJUYMX7.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -13,7 +13,7 @@ import '../../types-CsgMwHHa.js';
13
13
  import '../../wordFit-7XpmhcaW.js';
14
14
  import '../../edit-lock/index.js';
15
15
  import '../../panelWidths-D9hTLR25.js';
16
- import '../../CanvasDragLayer-O1gVT1AL.js';
16
+ import '../../CanvasDragLayer-CLb7j-CZ.js';
17
17
  import '../../session-DSQFmIvx.js';
18
18
  import '../../words-BDignMl_.js';
19
19
  import '../../types-BsyPh6EW.js';
@@ -1,16 +1,16 @@
1
- import{AddBlockRow as e}from"../../chunk-ESQZG7B3.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-UY7BCB32.js";import{SlotChildActionsProvider as s}from"../../chunk-KCBEE2MC.js";import{DEFAULT_PANEL_W as i}from"../../chunk-6TOYXESC.js";import{usePartBridge as c}from"../../chunk-5PUEZ22M.js";import{useSectionOps as p}from"../../chunk-57NRNFLO.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import{useScreenDocument as l}from"../../chunk-WZMU646D.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-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import{MediaSidePanel as m}from"../../chunk-Q2L6YTII.js";import{SELECTION_MODE as d,useScreenPinned as a,useScreenCanvasFrame as u,useScreenInspectorPanel as h,useScreenPickFollowsSelection as k,sameInspectorMode as f,useStandaloneScreenBridges as j,useScreenBlockLook as y,useScreenBlockRules as S}from"../../chunk-ZR4CFNMW.js";import{nestsInTree as N,slotFieldsOf as C}from"../../chunk-PLVEGYK6.js";import{useMediaPanel as M,usePanelPick as x,useCancelPanelPick as A}from"../../chunk-R6WTQWAC.js";import{useHostEscape as B}from"../../chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as R}from"../../chunk-MCHMF32I.js";import{useEasel as v}from"../../chunk-M5VRWM7M.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import{LayersTree as O,Subtree as F,TreeRow as P,TreeRowAction as W,TreeSeam as T}from"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import{DEFAULT_TREE_WORDS as g}from"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-BDTITTMW.js";import{DEFAULT_SAVE_WORDS as w,saveIndicator as z}from"../../chunk-H6DDIBQ4.js";import{SaveState as L,panelWidthVars as b}from"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-CIHKZMNR.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import{useWords as E}from"../../chunk-MFIRYGHW.js";import"../../chunk-HFW6D46X.js";import"../../chunk-O2NLQBFX.js";import{useTreeDrag as Y}from"../../chunk-67GNT6PF.js";import"../../chunk-AWJUYMX7.js";import"../../chunk-P2VEMZH5.js";import{zoneKey as H,parseZoneKey as D}from"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import{useState as I,useRef as Z,useEffect as J,useCallback as K,Fragment as V}from"react";import{Tooltip as U}from"efficient-shell/ui";import{TrashIcon as X}from"efficient-shell/icons/efficient";import{jsxs as G,jsx as Q,Fragment as $}from"react/jsx-runtime";var q=e=>n=>{n.target.closest("button, input")||e()},_={rowClick:q};function ee(){const{saveState:ee,readOnly:ne,readOnlyReason:oe=null}=l(),re=p(),{appState:te,selectedItem:se,config:ie}=v(e=>e),[ce,pe]=I(d),le=E("screen",R),me=E("tree",g),de=E("save",w),{first:ae,last:ue,panelOf:he}=a(),ke=he(ae),fe=u(),je=h(),ye=te.data.content?.[0]??null,Se=ye?.props.id??null,Ne=ye?.type===ae,Ce=ye?.type===ue,Me=Z(null),xe=Z(null);t(xe);const Ae=M(),Be=x(),Re=A();k(se?.props.id),J(()=>{const e=xe.current;if(!Be||!e)return;const n=e=>{"Escape"===e.key&&Re()};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)},[Be]),B(null!==Be,()=>Re()),J(()=>{Se&&Me.current!==Se&&(Me.current=Se,Ne?pe(ke??d):se||re.select({index:0}))},[Se,se,re,Ne]);const ve=K(e=>pe(n=>f(n,e)?n:e),[]),Oe=j({kind:ce.kind,mode:ce,open:ve,show:e=>pe(e),reveal:()=>{},select:(e,n)=>{pe(e=>f(e,n)?e:n),re.select(e)}}),{selectNode:Fe}=c({mode:ce,setMode:pe,onOpenPart:o}),Pe=y(),{labelAtLevel:We,Icon:Te}=Pe,{canAddTo:ge}=S(),we=e=>We(e,"block",ie.components[e]?.label??e),ze=e=>We(e,"section",we(e)),Le=!Ne&&"puck"===ce.kind&&se?.props.id===Se,be=ye?ge(ye.type)?.spec??null:null,Ee=ye&&be?`${ye.props.id}:${be.slot}`:null,Ye=ye&&be&&Array.isArray(ye.props[be.slot])?ye.props[be.slot]:[],He=e=>n(e,we,Pe.plainText),De=(e,n)=>{ye&&be&&Ee&&(pe(d),be.slider?(r(String(ye.props.id),e),re.select({index:e,zone:Ee}),o(String(ye.props.id))):(re.select({index:e,zone:Ee}),o(n)))},Ie=()=>{if(!ye||!be||!Ee)return;const e=Ye.length;re.insertComponent(Ee,be.childType,e),pe(d),be.slider?requestAnimationFrame(()=>{r(String(ye.props.id),e),re.select({index:e,zone:Ee})}):re.select({index:e,zone:Ee})},Ze=e=>C(ie,e),Je=e=>{const{parentId:n,slot:o}=D(e),r=e=>{if(!e)return null;if(String(e.props.id)===n)return e;for(const n of Ze(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(ye)?.props[o];return Array.isArray(t)?t.length:0},Ke=(e,n,o)=>{const r=Math.min(Math.max(o,0),Je(e)),t=n<r?r-1:r;t!==n&&(re.reorderComponent(e,n,t),pe(d),re.select({index:t,zone:e}))},Ve=Y({keyOf:e=>e.id,readOnly:Boolean(ne),canDrop:(e,n)=>H(n)===e.zone&&n.index>=0&&n.index<=Je(e.zone),onDrop:(e,n)=>Ke(e.zone,e.index,n.index),onStep:(e,n)=>Ke(e.zone,e.index,n<0?e.index-1:e.index+2)}),Ue=(e,n)=>/* @__PURE__ */Q(T,{...ne?{}:Ve.seam({place:{...D(e),index:n}})},`seam:${e}:${n}`),Xe=e=>Pe.blockRowName(e,we),Ge=(e,n,r)=>{pe(d),re.select({index:n,zone:e}),o(r)},Qe=(e,n,o)=>{re.insertComponent(e,n,o),pe(d),re.select({index:o,zone:e})},$e=(n,o,r)=>/* @__PURE__ */Q(e,{choices:r,onPick:e=>Qe(n,e,o)}),qe=(e,n)=>{const o=Ze((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=ge(e.type),s=t?.choices??null,i="footer"===t?.source?Xe:He;/* @__PURE__ */
2
- return G($,{children:[o.map(({child:e,zone:o,index:r})=>{const t=se?.props.id===e.props.id,s=N(ie,e.type,n),c=i(e),p=String(e.props.id),l=()=>Ge(o,r,p),{rowProps:m,...a}=Ve.row({item:{id:p,zone:o,index:r},place:{...D(o),index:r}},{onClick:q(l)});/* @__PURE__ */
3
- return G(V,{children:[0===r&&Ue(o,0),
4
- /* @__PURE__ */Q(P,{words:me,icon:/* @__PURE__ */Q(Te,{type:e.type,size:13}),name:c,selected:t,onSelect:l,...a,actions:/* @__PURE__ */Q(W,{kind:"delete",label:le.deleteNamed({name:c}),onClick:()=>{return e=o,n=r,re.removeComponent(e,n),pe(d),void re.select(null);var e,n},children:/* @__PURE__ */Q(X,{size:13})}),rowProps:m}),s&&/* @__PURE__ */Q(F,{children:qe(e,n+1)}),Ue(o,r+1)]},String(e.props.id??`${o}-${r}`))}),t&&s?$e(`${e.props.id}:${t.slot}`,o.length,s):null]})},_e="HeroSingle"===ye?.type,en=Boolean(ye)&&(Boolean(be)||Ce||Ne||_e);/* @__PURE__ */
5
- return G("div",{ref:xe,className:"sf-editor es-editor",style:b(i),children:[
6
- /* @__PURE__ */Q("div",{className:"sf-section-bar",children:/* @__PURE__ */Q(L,null!==oe?{tone:"off",label:oe,role:"status"}:{...z(ee,de),role:"status"})}),
7
- /* @__PURE__ */G("div",{className:"sf-body",children:[Be&&Ae?/* @__PURE__ */Q("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:/* @__PURE__ */Q(m,{panel:Ae,pick:Be})}):en&&ye&&/* @__PURE__ */G("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:[
8
- /* @__PURE__ */Q("div",{className:"sf-panel-head",children:/* @__PURE__ */Q(U,{content:Ne?le.headerSettings:le.sectionSettings({name:ze(ye.type)}),side:"bottom",children:/* @__PURE__ */Q("button",{type:"button",className:"sf-panel-title sf-panel-title--btn "+(Le?"is-selected":""),"aria-pressed":Le,onClick:()=>{Ne?pe(ke??d):(pe(d),re.select({index:0}))},children:ze(ye.type)})})}),
9
- /* @__PURE__ */Q(O,{className:"sf-tree sf-scroll",rootProps:Ve.rootProps(),words:me,children:/* @__PURE__ */Q(F,{children:Ne?
10
- /* @__PURE__ */Q(P,{words:me,icon:/* @__PURE__ */Q(Te,{type:"header",size:13}),name:le.headerSettings,selected:ce.kind===ke?.kind,onSelect:()=>pe(ke??d),rowProps:{onClick:q(()=>pe(ke??d))}}):be?/* @__PURE__ */G($,{children:[Ye.map((e,n)=>{const o=se?.props.id===e.props.id,r=He(e),t=String(e.props.id),s=()=>De(n,t),{rowProps:i,...c}=Ve.row({item:{id:t,zone:Ee,index:n},place:{...D(Ee),index:n}},{onClick:q(s)});/* @__PURE__ */
11
- return G(V,{children:[0===n&&Ue(Ee,0),
12
- /* @__PURE__ */Q(P,{words:me,icon:/* @__PURE__ */Q(Te,{type:e.type,size:13}),name:r,selected:o,onSelect:s,...c,actions:/* @__PURE__ */Q(W,{kind:"delete",label:le.deleteNamed({name:r}),onClick:()=>{return e=n,void(Ee&&(re.removeComponent(Ee,e),pe(d),re.select(null)));var e},children:/* @__PURE__ */Q(X,{size:13})}),rowProps:i}),Ue(Ee,n+1)]},String(e.props.id??n))}),
13
- /* @__PURE__ */G("button",{type:"button",className:"sf-add-card",onClick:Ie,children:[
14
- /* @__PURE__ */Q("span",{className:"sf-plus sf-plus--sm",children:"+"}),be.addLabel]}),Se?Oe.partRows?.(ye,_):null]}):qe(ye,1)})})]}),
15
- /* @__PURE__ */Q("div",{className:"sf-center",children:/* @__PURE__ */Q("div",{className:"sf-preview-host",children:/* @__PURE__ */Q(fe,{})})}),
16
- /* @__PURE__ */Q(s,{value:{selectChild:(e,n,o,r)=>"section"===ge(r)?.source?De(n,o):Ge(e,n,o),addChild:(e,n,o,r,t)=>"section"===ge(t)?.source?Ie():Qe(`${e}:${n}`,o,r),childRowName:He,blockRowName:Xe},children:/* @__PURE__ */Q(je,{mode:ce,onOpenWebsiteSettings:Oe.openSettings??(()=>{}),onSelectNode:Fe,hideNodeActions:!0})})]})]})}export{ee as default};
1
+ import{AddBlockRow as e}from"../../chunk-ESQZG7B3.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-UY7BCB32.js";import{SlotChildActionsProvider as s}from"../../chunk-KCBEE2MC.js";import{DEFAULT_PANEL_W as i}from"../../chunk-6TOYXESC.js";import{usePartBridge as c}from"../../chunk-5PUEZ22M.js";import{useSectionOps as p}from"../../chunk-57NRNFLO.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import{useScreenDocument as l}from"../../chunk-WZMU646D.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-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import{MediaSidePanel as m}from"../../chunk-Q2L6YTII.js";import{SELECTION_MODE as d,useScreenPinned as a,useScreenCanvasFrame as u,useScreenInspectorPanel as h,useScreenPickFollowsSelection as k,sameInspectorMode as f,useStandaloneScreenBridges as j,useScreenBlockLook as S,useScreenBlockRules as y}from"../../chunk-ZR4CFNMW.js";import{nestsInTree as N,slotFieldsOf as C}from"../../chunk-PLVEGYK6.js";import{useMediaPanel as M,usePanelPick as x,useCancelPanelPick as A}from"../../chunk-R6WTQWAC.js";import{useHostEscape as B}from"../../chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as R}from"../../chunk-MCHMF32I.js";import{useEasel as O}from"../../chunk-M5VRWM7M.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import{LayersTree as v,Subtree as P,TreeRow as F,TreeRowAction as T,TreeSeam as W}from"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import{DEFAULT_TREE_WORDS as g}from"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-BDTITTMW.js";import{DEFAULT_SAVE_WORDS as w,saveIndicator as z}from"../../chunk-H6DDIBQ4.js";import{SaveState as E,panelWidthVars as L}from"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-CIHKZMNR.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import{useWords as b}from"../../chunk-MFIRYGHW.js";import"../../chunk-SSORUDHE.js";import"../../chunk-O2NLQBFX.js";import{useTreeDrag as Y}from"../../chunk-67GNT6PF.js";import"../../chunk-AWJUYMX7.js";import"../../chunk-P2VEMZH5.js";import{zoneKey as H,parseZoneKey as D}from"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import{useState as I,useRef as Z,useEffect as J,useCallback as K,Fragment as U}from"react";import{Tooltip as V}from"efficient-shell/ui";import{TrashIcon as G}from"efficient-shell/icons/efficient";import{jsxs as Q,jsx as X,Fragment as $}from"react/jsx-runtime";var q=e=>n=>{n.target.closest("button, input")||e()},_={rowClick:q};function ee(){const{saveState:ee,readOnly:ne,readOnlyReason:oe=null}=l(),re=p(),{appState:te,selectedItem:se,config:ie}=O(e=>e),[ce,pe]=I(d),le=b("screen",R),me=b("tree",g),de=b("save",w),{first:ae,last:ue,panelOf:he}=a(),ke=he(ae),fe=u(),je=h(),Se=te.data.content?.[0]??null,ye=Se?.props.id??null,Ne=Se?.type===ae,Ce=Se?.type===ue,Me=Z(null),xe=Z(null);t(xe);const Ae=M(),Be=x(),Re=A();k(se?.props.id),J(()=>{const e=xe.current;if(!Be||!e)return;const n=e=>{"Escape"===e.key&&Re()};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)},[Be]),B(null!==Be,()=>Re()),J(()=>{ye&&Me.current!==ye&&(Me.current=ye,Ne?pe(ke??d):se||re.select({index:0}))},[ye,se,re,Ne]);const Oe=K(e=>pe(n=>f(n,e)?n:e),[]),ve=j({kind:ce.kind,mode:ce,open:Oe,show:e=>pe(e),reveal:()=>{},select:(e,n)=>{pe(e=>f(e,n)?e:n),re.select(e)}}),{selectNode:Pe}=c({mode:ce,setMode:pe,onOpenPart:o}),Fe=S(),{labelAtLevel:Te,Icon:We}=Fe,{canAddTo:ge}=y(),we=e=>Te(e,"block",ie.components[e]?.label??e),ze=e=>Te(e,"section",we(e)),Ee=!Ne&&"puck"===ce.kind&&se?.props.id===ye,Le=Se?ge(Se.type)?.spec??null:null,be=Se&&Le?`${Se.props.id}:${Le.slot}`:null,Ye=Se&&Le&&Array.isArray(Se.props[Le.slot])?Se.props[Le.slot]:[],He=e=>n(e,we,Fe.plainText),De=(e,n)=>{Se&&Le&&be&&(pe(d),Le.slider?(r(String(Se.props.id),e),re.select({index:e,zone:be}),o(String(Se.props.id))):(re.select({index:e,zone:be}),o(n)))},Ie=()=>{if(!Se||!Le||!be)return;const e=Ye.length;re.insertComponent(be,Le.childType,e),pe(d),Le.slider?requestAnimationFrame(()=>{r(String(Se.props.id),e),re.select({index:e,zone:be})}):re.select({index:e,zone:be})},Ze=e=>C(ie,e),Je=e=>{const{parentId:n,slot:o}=D(e),r=e=>{if(!e)return null;if(String(e.props.id)===n)return e;for(const n of Ze(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(Se)?.props[o];return Array.isArray(t)?t.length:0},Ke=(e,n,o)=>{const r=Math.min(Math.max(o,0),Je(e)),t=n<r?r-1:r;t!==n&&(re.reorderComponent(e,n,t),pe(d),re.select({index:t,zone:e}))},Ue=Y({keyOf:e=>e.id,readOnly:Boolean(ne),canDrop:(e,n)=>H(n)===e.zone&&n.index>=0&&n.index<=Je(e.zone),onDrop:(e,n)=>Ke(e.zone,e.index,n.index),onStep:(e,n)=>Ke(e.zone,e.index,n<0?e.index-1:e.index+2)}),Ve=(e,n)=>/* @__PURE__ */X(W,{...ne?{}:Ue.seam({place:{...D(e),index:n}})},`seam:${e}:${n}`),Ge=e=>Fe.blockRowName(e,we),Qe=(e,n,r)=>{pe(d),re.select({index:n,zone:e}),o(r)},Xe=(e,n,o)=>{re.insertComponent(e,n,o),pe(d),re.select({index:o,zone:e})},$e=(n,o,r)=>/* @__PURE__ */X(e,{choices:r,onPick:e=>Xe(n,e,o)}),qe=(e,n)=>{const o=Ze((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=ge(e.type),s=t?.choices??null,i="footer"===t?.source?Ge:He;/* @__PURE__ */
2
+ return Q($,{children:[o.map(({child:e,zone:o,index:r})=>{const t=se?.props.id===e.props.id,s=N(ie,e.type,n),c=i(e),p=String(e.props.id),l=()=>Qe(o,r,p),{rowProps:m,...a}=Ue.row({item:{id:p,zone:o,index:r},place:{...D(o),index:r}},{onClick:q(l)});/* @__PURE__ */
3
+ return Q(U,{children:[0===r&&Ve(o,0),
4
+ /* @__PURE__ */X(F,{words:me,icon:/* @__PURE__ */X(We,{type:e.type,size:13}),name:c,selected:t,onSelect:l,...a,actions:/* @__PURE__ */X(T,{kind:"delete",label:le.deleteNamed({name:c}),onClick:()=>{return e=o,n=r,re.removeComponent(e,n),pe(d),void re.select(null);var e,n},children:/* @__PURE__ */X(G,{size:13})}),rowProps:m}),s&&/* @__PURE__ */X(P,{children:qe(e,n+1)}),Ve(o,r+1)]},String(e.props.id??`${o}-${r}`))}),t&&s?$e(`${e.props.id}:${t.slot}`,o.length,s):null]})},_e="HeroSingle"===Se?.type,en=Boolean(Se)&&(Boolean(Le)||Ce||Ne||_e);/* @__PURE__ */
5
+ return Q("div",{ref:xe,className:"sf-editor es-editor",style:L(i),children:[
6
+ /* @__PURE__ */X("div",{className:"sf-section-bar",children:/* @__PURE__ */X(E,null!==oe?{tone:"off",label:oe,role:"status"}:{...z(ee,de),role:"status"})}),
7
+ /* @__PURE__ */Q("div",{className:"sf-body",children:[Be&&Ae?/* @__PURE__ */X("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:/* @__PURE__ */X(m,{panel:Ae,pick:Be})}):en&&Se&&/* @__PURE__ */Q("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:[
8
+ /* @__PURE__ */X("div",{className:"sf-panel-head",children:/* @__PURE__ */X(V,{content:Ne?le.headerSettings:le.sectionSettings({name:ze(Se.type)}),side:"bottom",children:/* @__PURE__ */X("button",{type:"button",className:"sf-panel-title sf-panel-title--btn "+(Ee?"is-selected":""),"aria-pressed":Ee,onClick:()=>{Ne?pe(ke??d):(pe(d),re.select({index:0}))},children:ze(Se.type)})})}),
9
+ /* @__PURE__ */X(v,{className:"sf-tree sf-scroll",rootProps:Ue.rootProps(),words:me,children:/* @__PURE__ */X(P,{children:Ne?
10
+ /* @__PURE__ */X(F,{words:me,icon:/* @__PURE__ */X(We,{type:"header",size:13}),name:le.headerSettings,selected:ce.kind===ke?.kind,onSelect:()=>pe(ke??d),rowProps:{onClick:q(()=>pe(ke??d))}}):Le?/* @__PURE__ */Q($,{children:[Ye.map((e,n)=>{const o=se?.props.id===e.props.id,r=He(e),t=String(e.props.id),s=()=>De(n,t),{rowProps:i,...c}=Ue.row({item:{id:t,zone:be,index:n},place:{...D(be),index:n}},{onClick:q(s)});/* @__PURE__ */
11
+ return Q(U,{children:[0===n&&Ve(be,0),
12
+ /* @__PURE__ */X(F,{words:me,icon:/* @__PURE__ */X(We,{type:e.type,size:13}),name:r,selected:o,onSelect:s,...c,actions:/* @__PURE__ */X(T,{kind:"delete",label:le.deleteNamed({name:r}),onClick:()=>{return e=n,void(be&&(re.removeComponent(be,e),pe(d),re.select(null)));var e},children:/* @__PURE__ */X(G,{size:13})}),rowProps:i}),Ve(be,n+1)]},String(e.props.id??n))}),
13
+ /* @__PURE__ */Q("button",{type:"button",className:"sf-add-card",onClick:Ie,children:[
14
+ /* @__PURE__ */X("span",{className:"sf-plus sf-plus--sm",children:"+"}),Le.addLabel]}),ye?ve.partRows?.(Se,_):null]}):qe(Se,1)})})]}),
15
+ /* @__PURE__ */X("div",{className:"sf-center",children:/* @__PURE__ */X("div",{className:"sf-preview-host",children:/* @__PURE__ */X(fe,{})})}),
16
+ /* @__PURE__ */X(s,{value:{selectChild:(e,n,o,r)=>"section"===ge(r)?.source?De(n,o):Qe(e,n,o),addChild:(e,n,o,r,t)=>"section"===ge(t)?.source?Ie():Xe(`${e}:${n}`,o,r),childRowName:He,blockRowName:Ge},children:/* @__PURE__ */X(je,{mode:ce,onOpenWebsiteSettings:ve.openSettings??(()=>{}),onSelectNode:Pe,hideNodeActions:!0})})]})]})}export{ee as default};
@@ -12,7 +12,7 @@ import '../../types-CsgMwHHa.js';
12
12
  import '../../wordFit-7XpmhcaW.js';
13
13
  import '../../edit-lock/index.js';
14
14
  import '../../panelWidths-D9hTLR25.js';
15
- import '../../CanvasDragLayer-O1gVT1AL.js';
15
+ import '../../CanvasDragLayer-CLb7j-CZ.js';
16
16
  import '../../session-DSQFmIvx.js';
17
17
  import '../../words-BDignMl_.js';
18
18
  import '../../types-BsyPh6EW.js';
@@ -18,7 +18,7 @@ import '../types-CsgMwHHa.js';
18
18
  import '../wordFit-7XpmhcaW.js';
19
19
  import '../edit-lock/index.js';
20
20
  import '../panelWidths-D9hTLR25.js';
21
- import '../CanvasDragLayer-O1gVT1AL.js';
21
+ import '../CanvasDragLayer-CLb7j-CZ.js';
22
22
  import '../session-DSQFmIvx.js';
23
23
  import '../words-BDignMl_.js';
24
24
  import '../types-BsyPh6EW.js';
@@ -1 +1 @@
1
- import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-T5ORM737.js";import"../chunk-GXQCZJOP.js";export{ScreenStoreProvider}from"../chunk-4UJ6CPLO.js";import"../chunk-GIP45GWF.js";import"../chunk-26OOWIJJ.js";import"../chunk-BXQBCW3P.js";import"../chunk-FGNR22NY.js";import"../chunk-ZE7I3PLX.js";import"../chunk-2GVCAIPX.js";import"../chunk-PAM3NLFL.js";import"../chunk-7F52SZOI.js";import"../chunk-MQNBD6AB.js";import"../chunk-TBF5CVPA.js";import"../chunk-4ES5JGGX.js";import"../chunk-IQ5TA7AM.js";import"../chunk-DUVRZ456.js";import"../chunk-6W7WLPZH.js";import"../chunk-UY7BCB32.js";import"../chunk-KCBEE2MC.js";import"../chunk-6TOYXESC.js";import"../chunk-5PUEZ22M.js";import"../chunk-57NRNFLO.js";import"../chunk-IYT6NN2J.js";import"../chunk-LVUDUQNL.js";import"../chunk-HQWQLDCB.js";import"../chunk-BSPCSC45.js";import"../chunk-I54UCYOU.js";import"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";import"../chunk-WZMU646D.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-VPFNZ7TB.js";import"../chunk-LOMEH6DG.js";import"../chunk-V7U33NF2.js";import"../chunk-5545A3PC.js";import"../chunk-NAGDOIW4.js";import"../chunk-5ZBY24K7.js";import"../chunk-PA3PNTVV.js";import"../chunk-BVN33R76.js";import"../chunk-PFNIVZPN.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-Q2L6YTII.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,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../chunk-ZR4CFNMW.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-MCHMF32I.js";import"../chunk-M5VRWM7M.js";import"../chunk-TBY3DFKS.js";import"../chunk-CRWFB7MU.js";import"../chunk-OZ72A6MY.js";import"../chunk-4JSBIW5H.js";import"../chunk-3ZJSLHHI.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-YRLPFZW3.js";import"../chunk-BXMXTO36.js";import"../chunk-EA2HTX37.js";import"../chunk-OSPUG6S6.js";import"../chunk-WK3AFPXY.js";import"../chunk-UK2FQOUT.js";import"../chunk-4VJATVVR.js";import"../chunk-BDTITTMW.js";import"../chunk-H6DDIBQ4.js";import"../chunk-UB4TLWVJ.js";import"../chunk-Y2G7CU6A.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-CIHKZMNR.js";import"../chunk-66LWADFP.js";import"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import"../chunk-546BBOPE.js";import"../chunk-MFIRYGHW.js";import"../chunk-HFW6D46X.js";import"../chunk-O2NLQBFX.js";import"../chunk-67GNT6PF.js";import"../chunk-AWJUYMX7.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
1
+ import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-VQOIVFSG.js";import"../chunk-GXQCZJOP.js";export{ScreenStoreProvider}from"../chunk-4UJ6CPLO.js";import"../chunk-HXLF2ZQO.js";import"../chunk-26OOWIJJ.js";import"../chunk-BXQBCW3P.js";import"../chunk-FGNR22NY.js";import"../chunk-ZE7I3PLX.js";import"../chunk-2GVCAIPX.js";import"../chunk-PAM3NLFL.js";import"../chunk-7F52SZOI.js";import"../chunk-MQNBD6AB.js";import"../chunk-TBF5CVPA.js";import"../chunk-4ES5JGGX.js";import"../chunk-IQ5TA7AM.js";import"../chunk-DUVRZ456.js";import"../chunk-6W7WLPZH.js";import"../chunk-UY7BCB32.js";import"../chunk-KCBEE2MC.js";import"../chunk-6TOYXESC.js";import"../chunk-5PUEZ22M.js";import"../chunk-57NRNFLO.js";import"../chunk-IYT6NN2J.js";import"../chunk-LVUDUQNL.js";import"../chunk-HQWQLDCB.js";import"../chunk-BSPCSC45.js";import"../chunk-I54UCYOU.js";import"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";import"../chunk-WZMU646D.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-VPFNZ7TB.js";import"../chunk-LOMEH6DG.js";import"../chunk-V7U33NF2.js";import"../chunk-5545A3PC.js";import"../chunk-DSXKBICS.js";import"../chunk-5ZBY24K7.js";import"../chunk-PA3PNTVV.js";import"../chunk-BVN33R76.js";import"../chunk-PFNIVZPN.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-Q2L6YTII.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,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../chunk-ZR4CFNMW.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-MCHMF32I.js";import"../chunk-M5VRWM7M.js";import"../chunk-TBY3DFKS.js";import"../chunk-CRWFB7MU.js";import"../chunk-OZ72A6MY.js";import"../chunk-4JSBIW5H.js";import"../chunk-3ZJSLHHI.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-YRLPFZW3.js";import"../chunk-BXMXTO36.js";import"../chunk-EA2HTX37.js";import"../chunk-OSPUG6S6.js";import"../chunk-WK3AFPXY.js";import"../chunk-UK2FQOUT.js";import"../chunk-4VJATVVR.js";import"../chunk-BDTITTMW.js";import"../chunk-H6DDIBQ4.js";import"../chunk-UB4TLWVJ.js";import"../chunk-Y2G7CU6A.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-CIHKZMNR.js";import"../chunk-66LWADFP.js";import"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import"../chunk-546BBOPE.js";import"../chunk-MFIRYGHW.js";import"../chunk-SSORUDHE.js";import"../chunk-O2NLQBFX.js";import"../chunk-67GNT6PF.js";import"../chunk-AWJUYMX7.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -16,7 +16,7 @@ import '../../../types-CsgMwHHa.js';
16
16
  import '../../../wordFit-7XpmhcaW.js';
17
17
  import '../../../edit-lock/index.js';
18
18
  import '../../../panelWidths-D9hTLR25.js';
19
- import '../../../CanvasDragLayer-O1gVT1AL.js';
19
+ import '../../../CanvasDragLayer-CLb7j-CZ.js';
20
20
  import '../../../session-DSQFmIvx.js';
21
21
  import '../../../words-BDignMl_.js';
22
22
  import '../../../types-BLRK6_JO.js';
@@ -4,7 +4,7 @@ import { Data } from '../../blocks/index.js';
4
4
  import { C as CanvasTarget } from '../../watch-BTYOJpQU.js';
5
5
  import { D as DeviceOption } from '../../types-Dt1CFR1S.js';
6
6
  import { P as Place } from '../../types-41704JE4.js';
7
- import { M as MeasuredCanvas, C as CanvasDragModel } from '../../CanvasDragLayer-O1gVT1AL.js';
7
+ import { M as MeasuredCanvas, C as CanvasDragModel } from '../../CanvasDragLayer-CLb7j-CZ.js';
8
8
  import { E as EaselContextMenuItem } from '../../types-BsyPh6EW.js';
9
9
  import { a as EaselRailItem } from '../../types-CsgMwHHa.js';
10
10
  import { StyleRow } from '../../style-clipboard/index.js';
@@ -629,9 +629,11 @@
629
629
  interactive; only the slim bands are clickable. On hover a band shows an accent
630
630
  insertion line + a dark "Add section" pill; clicking opens the picker targeted
631
631
  at that seam. It sits inside the scaled device frame, so it tracks the zoom. */
632
- /* The full-width band only POSITIONS the affordance over a seam — it is itself
632
+ /* The full-width band only POSITIONS the ➕ over a seam — it is itself
633
633
  click-through (pointer-events:none) so it never steals canvas clicks / Puck
634
- selection near a section boundary. Only the centred pill is interactive. */
634
+ selection near a section boundary. Only the ➕ is interactive: the canvas
635
+ insert point (efficient-easel/drag `CanvasInsert`, drag.css), the shell's
636
+ 24px IconButton (owner 2026-10-14). */
635
637
  .sf-preview-gap {
636
638
  position: absolute;
637
639
  left: 0;
@@ -656,134 +658,11 @@
656
658
  overflow: hidden;
657
659
  }
658
660
 
659
- .sf-preview-gap--tight:hover {
661
+ .sf-preview-gap--tight:hover,
662
+ .sf-preview-gap--tight:focus-within {
660
663
  overflow: visible;
661
664
  }
662
665
 
663
- /* ── Canvas "Add section" seams (overlay between preview sections) ──────────
664
- Absolutely positioned over .sf-preview-host (the iframe's box), one band per
665
- seam between top-level sections, placed at the boundary Y measured from the
666
- live iframe. The container ignores pointer events so the canvas stays
667
- interactive; only the slim bands are clickable. On hover a band shows an accent
668
- insertion line + a dark "Add section" pill; clicking opens the picker targeted
669
- at that seam. It sits inside the scaled device frame, so it tracks the zoom. */
670
- .sf-preview-gap-line {
671
- position: absolute;
672
- left: 0;
673
- right: 0;
674
- top: 50%;
675
- height: 2px;
676
- transform: translateY(-50%);
677
- background: var(--sf-accent);
678
- opacity: 0;
679
- pointer-events: none;
680
- transition: opacity 0.12s;
681
- }
682
-
683
- /* ── Canvas "Add section" seams (overlay between preview sections) ──────────
684
- Absolutely positioned over .sf-preview-host (the iframe's box), one band per
685
- seam between top-level sections, placed at the boundary Y measured from the
686
- live iframe. The container ignores pointer events so the canvas stays
687
- interactive; only the slim bands are clickable. On hover a band shows an accent
688
- insertion line + a dark "Add section" pill; clicking opens the picker targeted
689
- at that seam. It sits inside the scaled device frame, so it tracks the zoom. */
690
- /* The only clickable element: a compact "+" chip that is hidden at rest and
691
- fades in on hover, expanding to the full "Add section" pill. Keeping it
692
- invisible until hovered means the canvas carries no persistent affordance,
693
- while the dead zone stays no larger than this small chip (opacity:0 still
694
- hit-tests, so the seam remains hoverable). */
695
- .sf-preview-gap-pill {
696
- position: relative;
697
- display: inline-flex;
698
- align-items: center;
699
- padding: 4px;
700
- border-radius: 999px;
701
- background: var(--sf-toast-bg);
702
- color: var(--sf-on-accent);
703
- font-family: var(--sf-font);
704
- font-size: 12px;
705
- font-weight: 500;
706
- white-space: nowrap;
707
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
708
- opacity: 0;
709
- cursor: pointer;
710
- pointer-events: auto;
711
- transition: opacity 0.12s, padding 0.12s;
712
- }
713
-
714
- /* ── Canvas "Add section" seams (overlay between preview sections) ──────────
715
- Absolutely positioned over .sf-preview-host (the iframe's box), one band per
716
- seam between top-level sections, placed at the boundary Y measured from the
717
- live iframe. The container ignores pointer events so the canvas stays
718
- interactive; only the slim bands are clickable. On hover a band shows an accent
719
- insertion line + a dark "Add section" pill; clicking opens the picker targeted
720
- at that seam. It sits inside the scaled device frame, so it tracks the zoom. */
721
- .sf-preview-gap-pill:hover {
722
- opacity: 1;
723
- padding: 4px 12px 4px 4px;
724
- }
725
-
726
- /* ── Canvas "Add section" seams (overlay between preview sections) ──────────
727
- Absolutely positioned over .sf-preview-host (the iframe's box), one band per
728
- seam between top-level sections, placed at the boundary Y measured from the
729
- live iframe. The container ignores pointer events so the canvas stays
730
- interactive; only the slim bands are clickable. On hover a band shows an accent
731
- insertion line + a dark "Add section" pill; clicking opens the picker targeted
732
- at that seam. It sits inside the scaled device frame, so it tracks the zoom. */
733
- .sf-preview-gap-plus {
734
- display: inline-flex;
735
- align-items: center;
736
- justify-content: center;
737
- width: 18px;
738
- height: 18px;
739
- border-radius: 50%;
740
- background: var(--sf-accent);
741
- color: var(--sf-on-accent);
742
- font-size: 14px;
743
- line-height: 1;
744
- flex: none;
745
- }
746
-
747
- /* ── Canvas "Add section" seams (overlay between preview sections) ──────────
748
- Absolutely positioned over .sf-preview-host (the iframe's box), one band per
749
- seam between top-level sections, placed at the boundary Y measured from the
750
- live iframe. The container ignores pointer events so the canvas stays
751
- interactive; only the slim bands are clickable. On hover a band shows an accent
752
- insertion line + a dark "Add section" pill; clicking opens the picker targeted
753
- at that seam. It sits inside the scaled device frame, so it tracks the zoom. */
754
- /* Label collapsed until hover so the resting chip is just the "+". */
755
- .sf-preview-gap-label {
756
- max-width: 0;
757
- margin-left: 0;
758
- overflow: hidden;
759
- opacity: 0;
760
- transition: max-width 0.14s, margin-left 0.14s, opacity 0.12s;
761
- }
762
-
763
- /* ── Canvas "Add section" seams (overlay between preview sections) ──────────
764
- Absolutely positioned over .sf-preview-host (the iframe's box), one band per
765
- seam between top-level sections, placed at the boundary Y measured from the
766
- live iframe. The container ignores pointer events so the canvas stays
767
- interactive; only the slim bands are clickable. On hover a band shows an accent
768
- insertion line + a dark "Add section" pill; clicking opens the picker targeted
769
- at that seam. It sits inside the scaled device frame, so it tracks the zoom. */
770
- .sf-preview-gap-pill:hover .sf-preview-gap-label {
771
- max-width: 140px;
772
- margin-left: 6px;
773
- opacity: 1;
774
- }
775
-
776
- /* ── Canvas "Add section" seams (overlay between preview sections) ──────────
777
- Absolutely positioned over .sf-preview-host (the iframe's box), one band per
778
- seam between top-level sections, placed at the boundary Y measured from the
779
- live iframe. The container ignores pointer events so the canvas stays
780
- interactive; only the slim bands are clickable. On hover a band shows an accent
781
- insertion line + a dark "Add section" pill; clicking opens the picker targeted
782
- at that seam. It sits inside the scaled device frame, so it tracks the zoom. */
783
- .sf-preview-gap:has(.sf-preview-gap-pill:hover) .sf-preview-gap-line {
784
- opacity: 1;
785
- }
786
-
787
666
  .sf-msg {
788
667
  padding: 24px;
789
668
  font-size: 14px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-easel",
3
- "version": "6.5.0",
3
+ "version": "6.6.0",
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",
@@ -1,65 +0,0 @@
1
- import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-BXQBCW3P.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-2GVCAIPX.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as a}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as c,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,editorRootFocus as m}from"./chunk-UY7BCB32.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as k,clampPanelWidth as S}from"./chunk-6TOYXESC.js";import{usePartBridge as v}from"./chunk-5PUEZ22M.js";import{useSectionOps as w}from"./chunk-57NRNFLO.js";import{useNodeClipboard as x,useNodeContextMenu as b}from"./chunk-LVUDUQNL.js";import{PageEditGuardNotices as z}from"./chunk-HQWQLDCB.js";import{useScreenDocument as B}from"./chunk-WZMU646D.js";import{requestMediaPick as C}from"./chunk-KG7RJWOK.js";import{heldStyle as N,styleShortcut as O}from"./chunk-V7U33NF2.js";import{AddChildRow as I}from"./chunk-5545A3PC.js";import{AddSidePanel as $}from"./chunk-NAGDOIW4.js";import{SidePanelHead as P,PanelShowStrip as T}from"./chunk-PFNIVZPN.js";import{MediaSidePanel as M}from"./chunk-Q2L6YTII.js";import{useScreenSaveSwitch as A,useScreenNodeKeys as j,useScreenPinned as R,useScreenDocumentLabel as L,useScreenCanvasFrame as E,useScreenInspectorPanel as V,useScreenDevices as F,useScreenPickFollowsSelection as W,useScreenLeftView as D,useScreenAdd as U,SELECTION_MODE as H,sameInspectorMode as G,useScreenBridges as J,useScreenBlockRules as Y,useScreenBlockLook as X,useScreenStorageNamespace as Q,useScreenNotify as K,useScreenCanvasHead as _,isSlotMode as q,useScreenStyleClipboard as Z,useScreenDocumentPass as ee,useScreenCanvasDrag as ne,ScreenCanvasTargetProvider as te,isPinnedFirst as oe,isPinnedLast as re,screenSlotsOf as ie}from"./chunk-ZR4CFNMW.js";import{ROOT_ZONE as le,blockNodeActions as se,TREE_MAX_DEPTH as de,childSlotsOf as ae,slotFieldsOf as ce,slotChildrenIn as pe,nestsInTree as ue,newNodeId as fe}from"./chunk-PLVEGYK6.js";import{useMediaPanel as he,usePanelPick as me,useCancelPanelPick as ge}from"./chunk-R6WTQWAC.js";import{useEaselHost as ye,useHostEscape as ke}from"./chunk-U3JP4VGF.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as ve}from"./chunk-MCHMF32I.js";import{useEasel as we,useEaselApi as xe}from"./chunk-M5VRWM7M.js";import{TreeRow as be,Subtree as ze,LayersTree as Be,TreeGroupLabel as Ce,TreeRowAction as Ne,TreeSeam as Oe}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Ie}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as $e}from"./chunk-WK3AFPXY.js";import{toItemSelector as Pe,useNodeOps as Te,clickPick as Me}from"./chunk-UK2FQOUT.js";import{LayersIcon as Ae,MediaIcon as je}from"./chunk-4VJATVVR.js";import{DEFAULT_SAVE_WORDS as Re,saveIndicator as Le}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Ee,TopBarRail as Ve,TopBarCluster as Fe,EaselIconButton as We,TopBarDivider as De,DeviceSwitch as Ue,InspectorIconButton as He,PanelResizeHandle as Ge,MAX_PANEL_W as Je,MIN_PANEL_W as Ye,panelWidthVars as Xe,SaveState as Qe,SaveStateToggle as Ke}from"./chunk-UB4TLWVJ.js";import{DEFAULT_CHROME_WORDS as _e}from"./chunk-Y2G7CU6A.js";import{useWords as qe}from"./chunk-MFIRYGHW.js";import{CanvasDragLayer as Ze}from"./chunk-HFW6D46X.js";import{DEFAULT_DRAG_WORDS as en}from"./chunk-O2NLQBFX.js";import{createDragSession as nn,useTreeDrag as tn,gapToMoveIndex as on}from"./chunk-67GNT6PF.js";import{useCanvasFrame as rn,LIST_SELECTOR as ln,BLOCK_SELECTOR as sn,useCanvasEvent as dn}from"./chunk-AWJUYMX7.js";import{zoneKey as an,ROOT_ID as cn,ROOT_SLOT as pn,parseZoneKey as un,DataError as fn,find as hn}from"./chunk-KRXQM65X.js";import{useRef as mn,useMemo as gn,useState as yn,useEffect as kn,useCallback as Sn,useLayoutEffect as vn,Fragment as wn}from"react";import{Tooltip as xn,Button as bn,toast as zn}from"efficient-shell/ui";import{UndoIcon as Bn,RedoIcon as Cn,TrashIcon as Nn,EyeOffIcon as On,EyeIcon as In,DuplicateIcon as $n}from"efficient-shell/icons/efficient";import{jsx as Pn,jsxs as Tn,Fragment as Mn}from"react/jsx-runtime";function An({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i,words:l,saveWords:s}){if(null!==t)/* @__PURE__ */return Pn(Qe,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
2
- return Pn(Qe,{tone:e.pending?"off-unsaved":"off",label:l.notSaving,role:"status"});const{tone:d,label:a}=Le(e,s),c=e.failed&&!e.paused&&/* @__PURE__ */Pn(bn,{variant:"secondary",size:"sm",onClick:i,children:l.retry});/* @__PURE__ */
3
- return Tn(Mn,o?{children:[
4
- /* @__PURE__ */Pn(Ke,{pressed:e.paused,onToggle:r,title:e.paused?l.autoSaveOff:l.autoSaveOn,children:/* @__PURE__ */Pn(Qe,{tone:d,label:a})}),c]}:{children:[
5
- /* @__PURE__ */Pn(Qe,{tone:d,label:a,role:"status"}),c]})}function jn({expand:e}){/* @__PURE__ */
6
- return Pn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Tn(Mn,e?{children:[
7
- /* @__PURE__ */Pn("path",{d:"M8 9l4-4 4 4"}),
8
- /* @__PURE__ */Pn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
9
- /* @__PURE__ */Pn("path",{d:"M8 4l4 4 4-4"}),
10
- /* @__PURE__ */Pn("path",{d:"M8 20l4-4 4 4"}),
11
- /* @__PURE__ */Pn("path",{d:"M5 12h14"})]})})}var Rn=`${ln}, ${sn}`;function Ln(e,n,t){const o=t-n;if(o<6)return null;if(o<26)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+13),t-13))}}var En="__rungs";var Vn="screen:band",Fn={duplicate:!0,delete:!0};function Wn(){const Le=ye(),{target:Qe,docId:Ke,capabilities:ln,currentSlug:Wn,siteId:Dn,onPublish:Un,saveState:Hn,saveConflict:Gn,retrySave:Jn,toggleAutoSave:Yn,readOnly:Xn,readOnlyReason:Qn=null}=B(),Kn=A(),_n=j(),{mediaEditing:qn,hasEditGuard:Zn,hasPinnedChrome:et}=ln,{appState:nt,dispatch:tt,history:ot,selectedItem:rt,getSelectorForId:it,config:lt}=we(e=>e),st=R(),{first:dt,firstGroup:at,lastGroup:ct,isSectionGroup:pt,sectionGroupZone:ut,panelOf:ft}=st,ht=ft(dt),mt=e=>oe(st,e),gt=e=>re(st,e),yt="node"===st.firstRow,kt=st.band??null,St=qe("screen",ve),vt=qe("tree",Ie),wt=qe("drag",en),xt=qe("save",Re),bt=qe("menu",$e),zt=qe("styleClipboard",Se),Bt=qe("chrome",_e),Ct=L()??`/${Wn}`,Nt=E(),Ot=V(),It=w({readOnly:Xn}),$t=w({readOnly:Xn,foldIntoHistory:!0}),Pt=mn(null),Tt=xe(),Mt=gn(()=>({...It,select:e=>{Pt.current=e,It.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Tt.config;Pt.current=Pe(e,t,n)}It.commitDocument(e,n)}}),[It,Tt]),At=nt.ui,jt=At.leftSideBarVisible,Rt=At.rightSideBarVisible,{options:Lt,widths:Et,initial:Vt,fluid:Ft,fit:Wt}=F(),[Dt,Ut]=yn(Vt),Ht=he(),Gt=qn&&null!==Ht,Jt=me(),Yt=ge();W(rt?.props.id);const{read:Xt,write:Qt,forSelection:Kt}=D(),[_t,qt]=yn(Xt);kn(()=>{Qt(_t)},[_t]);const[Zt,eo]=yn(0),no=mn(null),to=mn(null),oo=rn(to,{readySelector:Rn}),ro=f(to);h(to,oo);const[io,lo]=yn(!1),so=mn(!1),ao=mn(!1),[co,po]=yn(null),uo=U(),fo=e=>po(null===e?null:{zone:le,index:e}),[ho,mo]=yn([]),[go,yo]=yn(H),ko="puck"===go.kind,So=io&&!co&&uo.railTarget?uo.railTarget(nt.data,{node:rt??null,mode:go}):null,vo=So?{zone:an(So),index:So.index}:null,wo=co??vo,xo=wo&&wo.zone===le?wo.index:null,bo=t(go,rt?.props.id),[zo,Bo]=yn(null);kn(()=>{zo&&(o(),Bo(null))},[zo]);const Co=mn(it);Co.current=it;const No=Sn((e,{scroll:n})=>{qt(n=>Kt(e,n)),n&&Bo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Co.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&or(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Oo=mn(null);kn(()=>{const e=Oo.current;Oo.current=null;const n=null==rt?.props.id?null:String(rt.props.id);yo(e&&e.id===n?e.mode:ft(rt?.type)??H);const t=rt?.props.id,o=Pt.current;if(Pt.current=null,!t)return;const i=it(t);No(String(t),{scroll:!r(o,i??null,le)})},[rt?.props.id,No]);const Io=Sn(e=>{yo(n=>G(n,e)?n:e),tt({type:"setUi",ui:{rightSideBarVisible:!0}})},[tt]),$o=mn(()=>{});$o.current=(e,n)=>{const t=e?Xr(e.zone??le)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==rt?.props.id?null:String(rt.props.id);yo(e=>G(e,n)?e:n),o!==r&&(Oo.current={id:o,mode:n},Mt.select(e))};const Po=Sn((e,n)=>$o.current(e,n),[]),To={kind:go.kind,mode:go,open:Io,show:e=>yo(e),reveal:()=>{Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Po},Mo=J(To,{data:nt.data,selected:rt??null,zoneOf:e=>it(e)?.zone,readOnly:Boolean(Xn),select:e=>{yo(H),Mt.select({index:e})},replace:(e,n)=>Mt.replaceComponent(le,e,n),scrollTo:e=>Si(e)},{device:Dt,refreshes:Zt},{setView:qt,reveal:()=>{jt||tt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Ao=Mo.pinnedSource??!1,jo=Mo.resolveLeftView?Mo.resolveLeftView(_t,Gt):"media"===_t&&Gt?_t:"sections",Ro=Y(),{isLockedBlock:Lo,duplicateBlocked:Eo,nestDepth:Vo,newSectionNode:Fo,canAddTo:Wo,blockIsOffered:Do}=Ro,Uo=X(),{labelAtLevel:Ho,Icon:Go,useProducts:Jo}=Uo,Yo=Uo.rowName?(e,n,t)=>Uo.rowName(e,n,t):void 0,Xo=Sn(e=>{tt({type:"setUi",ui:{rightSideBarVisible:!0}}),c(e),No(e,{scroll:!0})},[tt,No]),{selectNode:Qo,openPartId:Ko}=v({mode:go,setMode:yo,onOpenPart:Xo}),[_o,qo]=yn(null);ke(null!==_o,()=>qo(null));const Zo=y(Q()),er=Zo.collapsed,nr=Zo.panelWidths,[tr,or]=yn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(er);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
12
- return new Set}});kn(()=>{try{window.localStorage.setItem(er,JSON.stringify([...tr]))}catch{}},[tr]);const[rr,ir]=yn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(nr);if(!e)return{...k};const n=JSON.parse(e);return{left:S(Number(n.left)||k.left),right:S(Number(n.right)||k.right)}}catch{return{...k}}});kn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(nr,JSON.stringify(rr))}catch{}},300);return()=>clearTimeout(e)},[rr]);const lr=Sn((e,n)=>ir(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),sr=Sn(e=>lr("left",e),[lr]),dr=Sn(e=>lr("right",e),[lr]),ar=e=>tr.has(e),cr=e=>or(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),pr=mn(!1),ur=mn(null);kn(()=>{if(pr.current&&!io){const e=ur.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??to.current?.querySelector(`button[aria-label="${CSS.escape(St.add.title)}"]`))?.focus(),ur.current=null}pr.current=io},[io]),kn(()=>{if(!io||!ro)return;const e=e=>{"Escape"===e.key&&Oi()};return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[io,ro]),ke(io,()=>Oi()),kn(()=>{!jt&&io&&(lo(!1),po(null),so.current=!1)},[jt]),kn(()=>{if(!Jt)return ao.current&&tt({type:"setUi",ui:{leftSideBarVisible:!1}}),void(ao.current=!1);io&&(lo(!1),po(null),ao.current=so.current,so.current=!1),jt||(ao.current=!0,tt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[Jt]),kn(()=>{!jt&&Jt&&(ao.current=!1,Yt())},[jt]),kn(()=>{if(!Jt||!ro)return;const e=e=>{"Escape"===e.key&&Yt()};return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[Jt,ro]),ke(null!==Jt,()=>Yt());const fr=K(),hr=(e,n="success")=>{fr?fr(e,"error"===n?"error":"info"):"error"===n?zn.error(e,{duration:3200,sound:!1}):zn.success(e,{duration:1900,sound:!1})},mr=mn(null),[gr,yr]=yn(0),[kr,Sr]=yn(0),vr=_(),wr=mn(null),xr=e=>Math.max(0,e.clientHeight-(wr.current?.offsetHeight??0));kn(()=>{const e=mr.current;if(!e)return;const n=()=>{yr(e.clientWidth),Sr(xr(e))};n();const t=new ResizeObserver(n);return t.observe(e),wr.current&&t.observe(wr.current),()=>t.disconnect()},[]),vn(()=>{mr.current&&(yr(mr.current.clientWidth),Sr(xr(mr.current)))},[rr,jt,Rt]);const br=Dt===Ft?gr>0?gr:Et[Ft]:Et[Dt],zr=gr>0?Math.min(gr/br,"shrink"===Wt?1:2):1,Br=br*zr,Cr=gr>0&&Br>gr+1,Nr={width:Br,height:kr||"100%",flex:"none",position:"relative"},Or={width:br,height:kr?kr/zr:"100%",maxHeight:"none",transform:1!==zr?`scale(${zr})`:void 0,transformOrigin:"top left"},Ir=()=>tt({type:"setUi",ui:{leftSideBarVisible:!jt}}),$r=()=>tt({type:"setUi",ui:{rightSideBarVisible:!Rt}}),Pr=e=>{io&&(lo(!1),po(null),so.current=!1,jt&&_t===e)||Jt&&(ao.current=!1,Yt(),jt&&_t===e)||(jt&&_t===e?Ir():(qt(e),jt||tt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Tr=()=>{C(Le,{accept:"image/*",title:Bt.mediaLibrary})},Mr=()=>{yo(H),Mt.select(null),u()},Ar=()=>{yo(ht??H),Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}})},jr=nt.data.content??[],Rr=()=>{const e=jr.findIndex(mt),n=jr.findIndex(gt);return{floor:e>=0?e+1:0,cap:n>=0?n:jr.length}},Lr=lt,Er=Ro.stripCopy,Vr=e=>i(e,Er),Fr=x(),Wr=Te({data:nt.data,config:Lr,readOnly:Boolean(Xn),clipboard:Fr,strip:Er?e=>Er(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==cn||e.slot!==pn)return{min:0,max:n-1};const{floor:t,cap:o}=Rr();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&yo(H);const t=void 0===n||"node"===n?.kind?n:null;Mt.commitDocument(e,t)}}),Dr=e=>Ho(e,"block",lt.components[e]?.label??e),Ur=Sn(e=>lt.components[e]?.defaultProps??{},[lt]),Hr=e=>Ho(e,"section",Dr(e)),Gr=e=>l({type:e.type,props:e.props??{}},Hr(e.type),Yo),{nodeAddresses:Jr,zoneItems:Yr}=gn(()=>{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>=de)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of ae(lt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(jr,le,0),{nodeAddresses:e,zoneItems:n}},[jr,lt]),Xr=Sn(e=>Yr.get(e)??[],[Yr]),Qr=e=>{const n=Jr.get(e);return n?Xr(n.zone)[n.index]:void 0},Kr=e=>ie(Ro,lt,e),_r=e=>{if(!Ro.slotsOf||e===le)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Qr(e.slice(0,n));if(!t)return null;const o=Kr(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}},qr=(()=>{if(!q(go))return null;const e=`${go.nodeId}:${go.slot}`;return _r(e)?.slot.panel===go.kind?e:null})(),Zr=mn(null);kn(()=>{const e=Zr.current;if(Zr.current=null,!qr||!q(go))return;const n=go.nodeId;No(n,{scroll:e!==qr}),or(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[go]);const ei=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Jr.get(e);n&&(n.zone===le?vi(n.index):Ki(n.zone,n.index,e,Qr(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&qr!==i&&(Zr.current=i),Po(null,r),Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}}),Si(o)},ni=(e,n,t)=>{const o=`${e}:${n}`;if(or(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;qr!==o&&(Zr.current=o);Po(null,{kind:t,nodeId:e,slot:n})},ti=(e,n,t)=>{if(Xn||!Ro.moveSlot)return;const o=Qr(e),r=o?Kr(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:En,index:n},s=on(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=Ro.moveSlot(e,n,s);"string"==typeof d&&ni(e,d,i.panel)},oi=Jo(),ri=gn(()=>{const e=/* @__PURE__ */new Map;for(const n of oi??[])e.set(n.slug,n.name);return e},[oi]),ii=e=>s(e,Dr,Uo.plainText,e=>ri.get(e),Uo.rowName),li=(e,n)=>{const t=lt.components[e.type]?.fields,o=n===le||hl(n)?"section":"block",r=n===le&&(mt(e)||gt(e)||pt(e.type)),i="block"===o?d(t):r?null:a(t);return Uo.renamePropOf?Uo.renamePropOf(e,o,i):i},si=(e,n,t,o)=>{if(!(!Xn&&_o?.zone===e&&_o.index===n))return;const r=(t,o)=>{qo(null),o&&((e,n,t)=>{const o=Xr(e)[n];if(!o)return;const r=li(o,e);r&&Mt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
13
- return Pn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":St.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)},di=n(Z(),zt),ai=di.scope({target:Qe,siteId:Dn,docId:Ke}),ci=lt,pi=(e,n)=>n===le?Hr(e):Dr(e),ui=(e,n,t)=>{const o=di.plan(ai,t,pi(t.type,e),ci);o&&(o.changed&&Mt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),hr(o.message))},fi=b({nodesIn:Xr,nodeAt:(e,n)=>Xr(e)[n]??null,labelOf:(e,n)=>n===le?Hr(e):Dr(e),renamePropOf:li,beginRename:(e,n)=>qo({zone:e,index:n}),history:{hasPast:ot.hasPast,hasFuture:ot.hasFuture,back:()=>ot.back(),forward:()=>ot.forward()},openAddSection:()=>{Mt.select(null),Ci(null)},openPageSettings:()=>{Mt.select(null),yo(H)},pageSettingsLabel:St.pageSettings,words:{menu:bt,styleClipboard:zt,screen:St.menu},readOnly:Boolean(Xn),collapseAll:()=>or(new Set(Xr(le).map(e=>String(e.props.id)))),onPasteRefused:e=>hr(e?St.pasteRefused({name:e.label}):St.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>gl(e,n),menuRows:Mo.menuRows,isLocked:e=>Lo(e.type),duplicateBlocked:e=>Eo(nt.data,e),permits:e=>se(lt,e.type),canAddTo:Wo,nodeOps:Wr,isPinned:(e,n)=>n===le&&(mt(e)||gt(e)),sectionBand:Rr,openAddInside:(e,n)=>{e===le?vi(n):Mt.select({zone:e,index:n}),Ci(null)},locate:e=>Jr.get(e)??null,rowNameOf:(e,n)=>n===le?Gr(e):ii(e),selectAt:(e,n,t,o)=>{e===le?vi(n):Ki(e,n,t,o??"")},slotRung:e=>{const n=_r(e);return n?.slot.panel?{label:n.slot.label,select:()=>ei(n.node,n.slot,!1)}:null},style:{held:()=>N(ai),canCopy:e=>di.rows(ci,e).some(e=>!1!==e.counted),copy:(e,n)=>di.copy(ai,e,pi(e.type,n),ci),paste:(e,n,t)=>ui(e,n,t)},keys:_n?{target:ro,selected:()=>{const e=nt.ui.itemSelector;return e?{zone:e.zone??le,index:e.index}:null},held:()=>Fr.get(),readOnly:Boolean(Xn),onDone:({done:e,name:n})=>{"copied"===e&&hr(St.copied({name:n}))}}:void 0},oo),hi=mn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});kn(()=>{hi.current={copy:(e,n)=>di.copy(ai,e,pi(e.type,n),ci),paste:ui,at:()=>{const e=nt.ui.itemSelector;if(!e)return null;const n=e.zone??le,t=Xr(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Xn)}});const mi=Sn(e=>{const n=O(e);if(!n)return;const t=hi.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))},[]);kn(()=>{if(!ro)return;const e=e=>mi(e);return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[mi,ro]),dn(oo,"keydown",mi);const gi=jr.map(e=>e.props.id).join("|");kn(()=>{const e=oo?.document??null,n=oo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void mo(e=>e.length?[]:e);const n=jr.findIndex(gt),t=n>=0?n:jr.length,o=n=>{const t=jr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(sn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=Ln(l&&s?(s.bottom+l.top)/2:l?l.top:s.bottom,Math.max(-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}mo(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[oo,gi,Dt,zr,jt,Rt,rt?.props.id]);const yi=oo?.document??null,ki=oo?.window??null;kn(()=>{const e=no.current;if(!e||!yi||!ki)return;const n=[],t=()=>{const n=yi.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&ki.scrollTo({left:ki.scrollX,top:ki.scrollY+t,behavior:"instant"}),!0};return no.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[yi,ki]);const Si=e=>{Mo.holdCanvasOn?Mo.holdCanvasOn(e):c(e)},vi=e=>{yo(H),Mt.select({index:e}),Mo.sectionPressed?.(jr[e]);const n=jr[e]?.props?.id;n&&Si(n)},wi=e=>{const{floor:n,cap:t}=Rr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=rt&&go.kind!==ht?.kind?jr.findIndex(e=>e.props.id===rt.props.id):-1;return o(r>=0?r+1:t)},xi=(e,n)=>{const{floor:t,cap:o}=Rr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(Mt.reorderComponent(le,e,i),Mt.select({index:i}),{moved:!0,dest:i})},bi=(e,n,t,o)=>{yo(H),Mt.select(o?{index:o.index,zone:o.zone}:{index:e}),c(n),hr(St.sectionAdded({name:t}))},zi=(e,n)=>{const t=wi(n),o=Fo(e,{nodeDefaults:Ur,newNodeId:fe,sectionLabel:Hr,blockIsOffered:Do}),r=o?Mt.insertNode(le,t,o):Mt.insertSection(e,t);return bi(t,r,Hr(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of ae(lt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Wo(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},Bi=(e,n,t)=>{const o=wi(t),r=Mt.insertNode(le,o,n);return bi(o,r,e),o},Ci=e=>Ni(le,e),Ni=(e,n)=>{ur.current=document.activeElement??null,Jt&&(so.current=ao.current,ao.current=!1,Yt()),po(null===n?null:{zone:e,index:n}),lo(!0),jt||(so.current=!0,tt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Oi=()=>{lo(!1),po(null),so.current&&tt({type:"setUi",ui:{leftSideBarVisible:!1}}),so.current=!1},Ii=(e,n,t)=>{if("section"===e.kind)Mt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;Mt.insertNode(n,t,Vr(e.template.node))}yo(H),Mt.select({index:t,zone:n})},$i=(e,n)=>Uo.rowName?n?mt(e)?Uo.rowName(e,"section",St.header):gt(e)?Uo.rowName(e,"section",St.footer):pt(e.type)?Uo.rowName(e,"section",Dr(e.type)):Gr(e):ii(e):n?Hr(e.type):Dr(e.type),Pi=e=>n=>{e()},Ti=()=>Mo.editPinnedSource?.(),Mi=(e,n,t)=>{if(Xn)return null;const o=Xr(e)[n];return o&&!se(lt,o.type).delete?null:/* @__PURE__ */Pn(Ne,{kind:"delete",label:St.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Xr(e)[n]?.props?.id;null!=t&&Wr.remove(String(t))})(e,n),children:/* @__PURE__ */Pn(Nn,{size:15})})},Ai=e=>Uo.rowPreview?.(e)||void 0,ji=e=>Uo.rowMarks?.(e)??void 0,Ri=(e,n,t)=>Uo.rowActions?.(e,n,t)??null,Li=(e,n,t,o)=>{if(Xn)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
14
- return Pn(Ne,{kind:"eye",label:r?St.showNamed({name:o}):St.hideNamed({name:o}),onClick:()=>Vi(e,n,t),children:/* @__PURE__ */Pn(r?On:In,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},Ei=e=>{const n=Hr(jr[e]?.type??""),t=n?St.addSectionBefore({name:n}):St.addSectionHere;return El(le,e,()=>Ci(e),t)},Vi=(e,n,t)=>{Mt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Fi=e=>ce(lt,e),Wi=e=>ae(lt,e),Di=e=>Ro.slotsOf?Kr(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:pe(e,n.slot)})):[{slot:null,rung:null,kids:Wi(e)}],Ui=e=>Ro.slotsOf?Di(e).flatMap(e=>e.kids):Wi(e),Hi=e=>Boolean(Ro.slotsOf)&&Kr(e).some(e=>e.rung),Gi=(e,n,t)=>null===t?void 0===n?Wo(e):Wo(e,n):Wo(e,n,t),Ji=(e,n,t)=>{const o=ue(lt,e.type,n)&&(t||Ui(e).length>0||Hi(e));return{collapsible:o,folded:o&&ar(String(e.props.id))}},Yi=(e,n,t)=>Di(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Ji(e,r,t(e.type)).collapsible?[String(e.props.id),...Yi(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Xi=e=>Ui(e).length>0||Hi(e)||Boolean(Wo(e.type)),Qi=e=>Boolean(Wo(e)),Ki=(e,n,t,o)=>{if(yo(H),Wo(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),Mt.select({index:n,zone:e}),c(t)}else Mt.select({index:n,zone:e}),Si(t)},_i=(e,n,t,o,r)=>{const i=`${e}:${n}`;Mt.insertComponent(i,t,o),Wo(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),Mt.select({index:o,zone:i})}):Mt.select({index:o,zone:i})},qi=(e,n,t)=>{Mt.insertComponent(e,n,t),yo(H),Mt.select({index:t,zone:e})},Zi=mn(/* @__PURE__ */new Set);kn(()=>{jr.forEach(e=>{const n=Wo(e.type)?.spec;if(!n)return;const t=e.props.id;if(Zi.current.has(t))return;Zi.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(Ur)).forEach((e,t)=>$t.seedChild(o,t,n.childType,e))})},[jr,$t,Ur]);const el=mn(/* @__PURE__ */new Set);kn(()=>{jr.forEach((n,t)=>{const o=n.props.id;if(el.current.has(o))return;const r=e(n,Fi(n.type));el.current.add(o),r&&$t.replaceComponent(le,t,{...n,props:r})})},[jr,$t]),ee($t,lt);const nl=jr.findIndex(gt),tl=nl>=0?jr[nl]:null,ol=yt?jr.findIndex(mt):-1,rl=ol>=0?jr[ol]:null,il=jr.find(e=>e.type===at)??null,ll=jr.find(e=>e.type===ct)??null,sl=nl>=0?nl:jr.length,dl=[];jr.forEach(e=>{gt(e)||(Xi(e)&&dl.push(String(e.props.id)),dl.push(...Yi(e,1,Qi)))}),tl&&(dl.push(String(tl.props.id)),dl.push(...Yi(tl,1,Qi)));const al=dl.length>0&&dl.every(e=>tr.has(e)),cl=e=>{const n=Uo.blockRowName(e,Dr);return Uo.rowName?Uo.rowName(e,"block",n):n},pl=(e,n,t,o)=>{const r=Xr(e)[t];if(!r)return;const i={...un(e),index:t},l={...un(n),index:Math.min(Math.max(o,0),Xr(n).length)},s=on(i,l);if(e!==n||s!==t)try{Wr.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof fn))throw e}},ul=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Wi(e))n.add(r),t(o)};for(const t of Fi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},fl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Jr.get(n);if(!e)return null;if(e.zone===le)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},hl=e=>{const n=e.slice(0,e.indexOf(":")),t=jr.find(e=>pt(e.type)&&String(e.props.id)===n);return t&&ut(n)===e?t:null},ml=(e,n,t)=>{if(e.rung){const t=Qr(e.rung.nodeId),o=t?Kr(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===En&&n.index>=0&&n.index<=o}if(n.slot===En)return!1;if(e.add)return kl(e.add,n);const o=an(n);if(pt(e.type))return!1;const r=hl(o),i=hl(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=Xr(o).length);if(e.zone===le||o===le){if(e.zone!==o)return!1;const{floor:t,cap:r}=Rr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Xr(o).length)return!1;if(e.zone===o)return!0;const l=tl&&!st.lastIsOpen?String(tl.props.id):null;return(!l||fl(e.zone)!==l&&fl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Xr(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Jr.get(i),s=l?Xr(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ul(r).has(n))return!1;const d=Wo(s.type,Vo(nt?.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?.(Xr(n),r))})(e.zone,o,e.index,t)},gl=(e,n)=>{const t=an(e.from);if(t===an(n))return!0;const o=e.node;return ml({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},yl=e=>{const n=e.slice(0,e.indexOf(":")),t=Jr.get(n),o=t?Xr(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Wo(o.type,Vo(nt?.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:Dr(r.spec.childType)}]:[]),l=_r(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:$i(o,t.zone===le)}},kl=(e,n)=>{const t=an(n);if("block"!==e.kind){if(hl(t))return n.index>=0&&n.index<=Xr(t).length;if(t!==le)return!1;const{floor:e,cap:o}=Rr();return n.index>=e&&n.index<=o}if(t===le)return!1;const o=yl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Xr(t))},Sl=(e,n)=>{e.rung?ti(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&hl(an(n)))return void Ii(e,an(n),n.index);if("section"===e.kind)return void zi(e.type,n.index);if("template"===e.kind)return void Bi(e.template.name,Vr(e.template.node),n.index);const t=an(n),o=yl(t);o&&(o.target.spec?_i(o.parentId,o.target.slot,e.type,n.index,o.parent.type):qi(t,e.type,n.index))})(e.add,n):e.zone===le?xi(e.index,n.index):pl(e.zone,an(n),e.index,n.index)},[vl]=yn(()=>nn()),wl=tn({keyOf:e=>e.id,readOnly:Boolean(Xn),session:vl,canDrop:ml,onDrop:Sl,onStep:(e,n)=>{e.rung?ti(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===le?((e,n)=>{const t=Hr(jr[e]?.type??""),o=xi(e,n<0?e-1:e+2);if(!o.moved)return void hr(n<0?St.sectionFirst({name:t}):St.sectionLast({name:t}));const{floor:r,cap:i}=Rr();hr(St.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):pl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),xl=Sn(e=>{const{floor:n,cap:t}=Rr(),o=[];for(const r of e.nodes){const e=an(r.place),i=Xr(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(mt(i)||gt(i)||Lo(i.type))continue;if(pt(i.type))continue;const l=Boolean(hl(e)),s=e===le||l;e===le&&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?Hr(i.type):ii(i),from:r.place})}return{sources:o,zones:e.zones.flatMap(e=>{const n=an(e.list);return n===le&&0===e.children.length?[{...e,addLabel:St.addSection,addAlways:!0}]:e.children.length>0||Boolean(yl(n)?.choices.length)||Boolean(hl(n))?[e]:[]})}},[nt.data]),bl=null==rt?.props.id?null:String(rt.props.id),zl=Sn(e=>{const n=lt,t=e=>!e.item.rung&&null!==hn(nt.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(bl);return i||(r(Me(nt.data,n,o.item.id,bl))??o)},[nt.data,lt,bl]),Bl=e=>{yo(H),Mt.select(e.zone===le?{index:e.index}:{index:e.index,zone:e.zone})},Cl=ne(),Nl=()=>({data:nt.data,device:Dt,ops:Mt,inspector:To}),Ol=Cl?.model,Il=gn(()=>Ol?e=>Ol(e,xl(e),Nl()):xl,[Ol,xl,Dt]),$l=Cl?.measure,Pl=$l?(e,n)=>$l(e,n,Nl()):void 0,Tl=Cl?.canDrop,Ml=Tl?(e,n)=>Tl(e,n,ml,Nl()):ml,Al=Cl?.drop,jl=Al?(e,n)=>Al(e,n,Sl,Nl()):Sl,Rl=Cl?.pick,Ll=Rl?e=>Rl(e,Bl,Nl()):Bl,El=(e,n,t,o)=>/* @__PURE__ */Pn(Oe,{...Xn?{}:wl.seam({place:{...un(e),index:n}}),onAdd:Xn?void 0:t,label:o},`seam:${e}:${n}`),Vl={rowClick:Pi,isCollapsed:ar,toggleCollapse:cr},Fl=e=>{const n=String(e.props.id),t=jr.findIndex(e=>String(e.props.id)===n),o=ut(n),r=Xr(o),i=ar(n),l=Dr(e.type),s=Uo.rowName?Uo.rowName(e,"section",l):l,d=e=>El(o,e,()=>Ni(o,e),St.addSectionHere);/* @__PURE__ */
15
- return Tn(Mn,{children:[
16
- /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:e.type,size:13}),name:s,preview:Ai(e),marks:ji(e),onSelect:()=>vi(t),nameSlot:si(le,t,n,s),selected:bo===n,actions:Ri(e,le,t)??void 0,rowProps:{"data-node-id":n,onClick:Pi(()=>vi(t))},fold:{open:!i,label:"section",onToggle:()=>cr(n)}}),!i&&/* @__PURE__ */Tn(ze,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Gr(n),l=Xi(n),s=l&&ar(r),a=()=>Ki(o,t,r,e.type),{rowProps:c,...p}=wl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...un(o),index:t}},{"data-node-id":r,onClick:Pi(a)});/* @__PURE__ */
17
- return Tn(wn,{children:[d(t),
18
- /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:i,preview:Ai(n),marks:ji(n),onSelect:a,nameSlot:si(o,t,r,i),selected:bo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>cr(r)}:void 0,actions:/* @__PURE__ */Tn(Mn,{children:[Mi(o,t,i),Ri(n,o,t),Li(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */Pn(ze,{children:Ul(n,2)})]},r)}),d(r.length)]})]})},Wl=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=wl.dragging,d=!ar(l)&&s?.rung?.nodeId!==i,a={...un(l),index:0},c=s&&!s.rung&&ml(s,a)?a:void 0,p=()=>ei(e,n,!0),{rowProps:u,...f}=wl.row({item:{id:`rung:${l}`,zone:`${i}:${En}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:En,index:t},into:c,canDrag:Boolean(Ro.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Pi(p)}),h=Xn?null:Ro.slotActions?.(e,n.slot);/* @__PURE__ */
19
- return Tn(wn,{children:[n.heading,
20
- /* @__PURE__ */Pn(be,{words:vt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:qr===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>cr(l)},actions:h&&h.length>0?/* @__PURE__ */Pn(Mn,{children:h.map((t,o)=>/* @__PURE__ */Pn(Ne,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Xn||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&ni(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__ */Pn(Nn,{size:15}):/* @__PURE__ */Pn($n,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Pn(ze,{children:r})]},l)},Dl=(e,n)=>{const t=Di(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
21
- return Pn(Mn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Gi(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=null!==a&&Boolean(yl(a)?.choices.length),p=(e,n)=>c?El(e,n,()=>Ni(e,n),St.addBlockHere):El(e,n),u=/* @__PURE__ */Tn(Mn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=bo===String(n.props.id),{collapsible:i,folded:s}=Ji(n,l,Qi(n.type)),d=String(n.props.id),a=cl(n),c=()=>Ki(t,o,d,e.type),{rowProps:u,...f}=wl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...un(t),index:o}},{"data-node-id":d,onClick:Pi(c)});/* @__PURE__ */
22
- return Tn(wn,{children:[0===o&&p(t,0),
23
- /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:a,preview:Ai(n),marks:ji(n),onSelect:c,nameSlot:si(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>cr(d)}:void 0,actions:/* @__PURE__ */Tn(Mn,{children:[Mi(t,o,a),Ri(n,t,o),Li(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Pn(ze,{children:Dl(n,l+1)}),p(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?p(d,0):null:0!==i.length||!t.rung&&d!==a?null:p(a,0)]});return t.rung?Wl(e,t.rung,r++,o,u):/* @__PURE__ */Pn(wn,{children:u},t.slot??"")})})},Ul=(e,n)=>{const t=Vo(nt?.data,e.type,String(e.props.id)),o=Di(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
24
- return Pn(Mn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Gi(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(n,t)=>{const o=n===f&&a&&!a.addBlocked?.(c)?()=>_i(e.props.id,a.slot,a.childType,t,e.type):n===h?()=>Ni(n,t):void 0;return El(n,t,o,n===f&&a?a.addLabel:St.addBlockHere)},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),k=/* @__PURE__ */Tn(Mn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=bo===String(n.props.id),i=ii(n),l=String(n.props.id),{collapsible:d,folded:a}=Ji(n,s,Qi(n.type)),c=Fi(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...un(p),index:Xr(p).length}:void 0,f=wl.dragging,h=u&&f&&ml(f,u)?u:void 0,g=()=>Ki(t,o,l,e.type),{rowProps:y,...k}=wl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...un(t),index:o},into:h,canDrag:!Lo(n.type)},{"data-node-id":l,onClick:Pi(g)});/* @__PURE__ */
25
- return Tn(wn,{children:[0===o&&m(t,0),
26
- /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:i,preview:Ai(n),marks:ji(n),onSelect:g,nameSlot:si(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!a,label:"group",onToggle:()=>cr(l)}:void 0,actions:Lo(n.type)?Ri(n,t,o)??void 0:/* @__PURE__ */Tn(Mn,{children:[Mi(t,o,i),Ri(n,t,o),Li(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */Pn(ze,{children:Ul(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
27
- /* @__PURE__ */Pn(I,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>_i(e.props.id,a.slot,a.childType,c.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?Wl(e,o.rung,i++,r,k):/* @__PURE__ */Pn(wn,{children:k},o.slot??"")})})},Hl=(()=>{if(!rt||!ko)return null;const e=String(rt.type),n=String(rt.props.id),t=Wo(e,Vo(nt?.data,e,n));if(!t||"footer"===t.source)return null;const o=jr.some(e=>String(e.props?.id)===n),r=Array.isArray(rt.props[t.slot])?rt.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:Dr(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:$i(rt,o),choices:i,onPick:o=>{t.spec?_i(n,t.slot,o,r.length,e):qi(`${n}:${t.slot}`,o,r.length)}}})(),Gl=wo&&wo.zone!==le&&!hl(wo.zone)?wo.zone:null,Jl=!0===uo.blocksFirst,Yl=Gl?yl(Gl):Jl&&wo?null:Hl,Xl=Boolean(co&&Gl)||Jl&&Boolean(Yl&&Yl.choices.length>0),Ql=io||null!==Jt,Kl=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:jt&&!Ql&&jo===e.id,onSelect:()=>Pr(e.id)}:e,_l=[{id:"add",label:St.add.title,icon:/* @__PURE__ */Pn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:io,onSelect:()=>io?Oi():Ci(null)},...(Mo.railLead??[]).map(Kl),{id:"sections",label:St.layers,icon:/* @__PURE__ */Pn(Ae,{}),active:jt&&!Ql&&"sections"===jo,onSelect:()=>Pr("sections")},...(Mo.railTrail??[]).map(Kl)];Gt?_l.push({id:"media",label:St.railMedia,icon:/* @__PURE__ */Pn(je,{}),active:jt&&!io&&(null!==Jt||"media"===jo),onSelect:()=>Pr("media")}):qn&&_l.push({id:"media",label:St.railMedia,icon:/* @__PURE__ */Pn(je,{}),onSelect:Tr});const ql=[...Mo.railLead??[],...Mo.railTrail??[]].find(e=>"panel"in e&&e.id===jo),Zl=Boolean(kt?.foldable)&&!Ao,es=kt?.label??(Zn?St.pageSections:St.templateSections),ns=Zl&&ar(Vn),ts=/* @__PURE__ */Tn(Mn,{children:[jr.map((e,n)=>{if(mt(e)||gt(e)||pt(e.type))return null;const t=bo===String(e.props.id),o=Boolean(e.props._hidden);Wi(e);const r=String(e.props.id),i=Mo.hasOwnRows?.(e)??!1,l=Xi(e)||i,s=l&&ar(r),d=Fi(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...un(a),index:Xr(a).length}:void 0,p=wl.dragging,u=c&&p&&ml(p,c)?c:void 0,{rowProps:f,...h}=wl.row({item:{id:r,zone:le,index:n,type:e.type},place:{...un(le),index:n},into:u},{"data-node-id":r,onClick:Pi(()=>vi(n))});/* @__PURE__ */
28
- return Tn(wn,{children:[n>0&&Ei(n),
29
- /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:e.type,size:13}),name:Gr(e),preview:Ai(e),marks:ji(e),onSelect:()=>vi(n),nameSlot:si(le,n,r,Gr(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>cr(r)}:void 0,actions:/* @__PURE__ */Tn(Mn,{children:[Mi(le,n,Gr(e)),Ri(e,le,n),Li(le,n,e,Gr(e))]}),rowProps:f}),Xi(e)&&!s&&/* @__PURE__ */Tn(ze,{children:[Ul(e,1),Mo.partRows?.(e,Vl)]}),i&&!s&&/* @__PURE__ */Pn(ze,{children:Mo.ownRows?.(e,n,Vl)})]},String(e.props.id??n))}),!Ao&&sl>0&&Ei(sl),kt?.addAtEnd&&!Ao&&!Xn&&/* @__PURE__ */Pn(I,{small:!0,label:St.addSection,blocked:null,onAdd:()=>Ci(sl)})]}),os=(e,n,t)=>{const o=String(e.props.id),r=Ui(e).length>0||Hi(e)||Boolean(Wo(e.type)),i=r&&ar(o),l="header"===t?St.header:St.footer,s=Uo.rowName?Uo.rowName(e,"section",l):l;/* @__PURE__ */
30
- return Tn(Mn,{children:[
31
- /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:t,size:13}),name:s,preview:Ai(e),marks:ji(e),onSelect:()=>vi(n),nameSlot:si(le,n,o,s),selected:bo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>cr(o)}:void 0,actions:Ri(e,le,n)??void 0,rowProps:{"data-node-id":o,onClick:Pi(()=>vi(n))}}),r&&!i&&/* @__PURE__ */Pn(ze,{children:Dl(e,1)})]})};return(Mo.wrap??(e=>e))(
32
- /* @__PURE__ */Pn(te,{target:oo,children:/* @__PURE__ */Tn("div",{ref:to,className:"sf-editor es-editor",style:Xe(rr),onContextMenu:fi.onEditorContextMenu,...m(Le),children:[
33
- /* @__PURE__ */Tn(Ee,{children:[
34
- /* @__PURE__ */Pn(Ve,{items:_l,ariaLabel:St.bar.views}),
35
- /* @__PURE__ */Tn(Fe,{children:[
36
- /* @__PURE__ */Pn(We,{label:St.bar.undo,disabled:Boolean(Xn)||!ot.hasPast,onClick:()=>ot.back(),children:/* @__PURE__ */Pn(Bn,{})}),
37
- /* @__PURE__ */Pn(We,{label:St.bar.redo,disabled:Boolean(Xn)||!ot.hasFuture,onClick:()=>ot.forward(),children:/* @__PURE__ */Pn(Cn,{})}),
38
- /* @__PURE__ */Pn(De,{}),
39
- /* @__PURE__ */Pn(Ue,{devices:Lt,value:Dt,onChange:Ut})]}),
40
- /* @__PURE__ */Tn(Fe,{kind:"right",style:{minWidth:300},children:[
41
- /* @__PURE__ */Pn(An,{saveState:Hn,notSaving:Boolean(Xn)||null!=Gn,readOnlyReason:Qn,toggle:Kn,onToggle:Yn,onRetry:Jn,words:St.bar,saveWords:xt}),Mo.barLead?.(),
42
- /* @__PURE__ */Pn(xn,{content:St.bar.refreshTip,side:"bottom",children:/* @__PURE__ */Pn(bn,{variant:"secondary",onClick:()=>{no.current=(()=>{const e=oo?.document;if(!e)return null;const n=jr.findIndex(gt),t=n>=0?n:jr.length;let o=null;for(let n=0;n<t;n++){const t=jr[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=rt?.props?.id??jr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),eo(e=>e+1)},children:St.bar.refresh})}),Mo.barTrail?.(),Mo.barMain?Mo.barMain():/* @__PURE__ */Pn(bn,{variant:"primary",disabled:null!==Qn,onClick:()=>{Un(nt.data)},children:St.done})]})]}),
43
- /* @__PURE__ */Pn(z,{}),
44
- /* @__PURE__ */Tn("div",{className:"sf-body",children:[jt?/* @__PURE__ */Tn(Mn,{children:[
45
- /* @__PURE__ */Pn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":St.leftPanel,children:io?/* @__PURE__ */Pn($,{blocks:Yl,blocksOnly:Xl,at:co?{label:(e=>{const n=hl(e.zone);if(n)return St.add.addingTo({name:Uo.rowName?$i(n,!0):Dr(n.type)});if(e.zone===le){const n=jr[e.index];return n&&!gt(n)?St.add.addingBefore({name:$i(n,!0)}):St.add.addingAtEnd}const t=yl(e.zone);return t?St.add.addingTo({name:t.parentName}):St.add.addingHere})(co),onClear:()=>po(null)}:void 0,onAdd:e=>{const n=wo,t=(e,n)=>{co&&po({zone:e,index:n})};if(n&&"block"!==e.kind&&hl(n.zone))return Ii(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===xo)return void zi(e);const n=zi(e,xo);co&&fo(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===xo)return void Bi(e,n);const t=Bi(e,n,xo);co&&fo(t+1)})(e.template.name,Vr(e.template.node));if(n&&n.zone!==le){const o=yl(n.zone);if(!o)return;return o.target.spec?_i(o.parentId,o.target.slot,e.type,n.index,o.parent.type):qi(n.zone,e.type,n.index),void t(n.zone,n.index+1)}Hl?.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:vl,siteWide:Mo.addPanelRow?.(Oi),onClose:Oi,onHide:Ir,readOnly:Boolean(Xn)}):Jt&&Ht?
46
- /* @__PURE__ */Pn(M,{panel:Ht,pick:Jt,onHide:Ir}):ql?ql.panel({onHide:Ir,notify:hr}):"media"===jo&&Ht?/* @__PURE__ */Pn(M,{panel:Ht,pick:null,onHide:Ir}):/* @__PURE__ */Tn(Mn,{children:[
47
- /* @__PURE__ */Pn(P,{icon:/* @__PURE__ */Pn(Ae,{}),title:St.layers,context:Ct,actions:
48
- /* @__PURE__ */Pn(He,{label:al?St.expandAll:St.collapseAll,title:0===dl.length?St.nothingToFold:void 0,disabled:0===dl.length,onClick:()=>or(e=>{const n=new Set(dl);return al?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...dl])}),children:/* @__PURE__ */Pn(jn,{expand:al})}),onHide:Ir}),
49
- /* @__PURE__ */Tn(Be,{className:"sf-tree sf-scroll",words:vt,children:[
50
- /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:"page",size:13}),name:St.pageSettings,onSelect:Mr,selected:!rt&&ko,rowProps:{onClick:Pi(Mr)}}),il&&/* @__PURE__ */Tn(Mn,{children:[
51
- /* @__PURE__ */Pn(Ce,{children:St.header}),Fl(il)]}),!Ao&&et&&/* @__PURE__ */Tn(Mn,{children:[
52
- /* @__PURE__ */Pn(Ce,{children:St.header}),!yt&&/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:"header",size:13}),name:St.header,onSelect:Ar,selected:go.kind===ht?.kind,rowProps:{onClick:Pi(Ar)}})]}),!Ao&&rl&&os(rl,ol,"header"),!Ao&&!Zl&&/* @__PURE__ */Pn(Ce,{children:es}),Zl?/* @__PURE__ */Tn(Mn,{children:[
53
- /* @__PURE__ */Pn(be,{words:vt,icon:null,name:es,fold:{open:!ns,label:es,onToggle:()=>cr(Vn)}}),!ns&&/* @__PURE__ */Pn(ze,{children:ts})]}):ts,et&&/* @__PURE__ */Pn(Ce,{children:St.footer}),tl&&os(tl,nl,"footer"),!Ao&&!tl&&et&&/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:"footer",size:13}),name:St.footer,onSelect:Ti,rowProps:{onClick:Pi(Ti),title:St.editFooter}}),ll&&Fl(ll),Mo.treeFoot?.()]})]})}),
54
- /* @__PURE__ */Pn(Ge,{side:"left",width:rr.left,min:Ye,max:Je,defaultWidth:k.left,label:St.resizeLeftPanel,onResize:sr})]}):/* @__PURE__ */Pn(T,{side:"left",onShow:Ir}),
55
- /* @__PURE__ */Tn("div",{ref:mr,className:"sf-center sf-scroll","data-sf-canvas-head":vr?"":void 0,style:{overflowX:Cr?"auto":"hidden",overflowY:"hidden"},children:[vr&&/* @__PURE__ */Pn("div",{ref:wr,className:"sf-canvas-head",children:/* @__PURE__ */Pn(vr,{device:Dt})}),
56
- /* @__PURE__ */Pn("div",{className:"sf-frame-scaler",style:Nr,children:/* @__PURE__ */Pn("div",{className:"sf-frame "+(Dt===Ft?"":`sf-frame--${Dt}`),style:Or,children:/* @__PURE__ */Tn("div",{className:"sf-preview-host",children:[
57
- /* @__PURE__ */Pn(Nt,{},Zt),
58
- /* @__PURE__ */Pn(Ze,{canvas:oo,session:vl,model:Il,measure:Pl,canDrop:Ml,onDrop:jl,choose:zl,onPick:Ll,onZoneAdd:e=>{const n=an(e),t=_r(n);t&&ei(t.node,t.slot,!1),Ni(n,0)},zoneAddLabel:St.canvasAddBlock,words:wt.canvas,readOnly:Boolean(Xn),revision:nt.data}),ho.length>0&&/* @__PURE__ */Pn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:ho.map(e=>/* @__PURE__ */Tn("button",{type:"button",tabIndex:-1,className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height},onClick:()=>Ci(e.index),children:[
59
- /* @__PURE__ */Pn("span",{className:"sf-preview-gap-line"}),
60
- /* @__PURE__ */Tn("span",{className:"sf-preview-gap-pill",children:[
61
- /* @__PURE__ */Pn("span",{className:"sf-preview-gap-plus",children:"+"}),
62
- /* @__PURE__ */Pn("span",{className:"sf-preview-gap-label",children:St.addSection})]})]},e.index))})]})})})]}),Rt?/* @__PURE__ */Tn(Mn,{children:[
63
- /* @__PURE__ */Pn(g,{value:{selectChild:Ki,addChild:_i,childRowName:ii,blockRowName:cl},children:/* @__PURE__ */Pn(Ot,{mode:go,onOpenWebsiteSettings:Mo.openSettings??(()=>{}),onOpenSiteStyles:Mo.openStyles,onSelectNode:Qo,onNotify:hr,onHidePanel:$r,nodeActions:rt?se(lt,rt.type):Fn})}),
64
- /* @__PURE__ */Pn(Ge,{side:"right",width:rr.right,min:Ye,max:Je,defaultWidth:k.right,label:St.resizeSettingsPanel,onResize:dr})]}):
65
- /* @__PURE__ */Pn(T,{side:"right",onShow:$r})]}),fi.menu]})}))}export{Wn as ScreenChrome};
@@ -1,14 +0,0 @@
1
- import{DEFAULT_DRAG_WORDS as e}from"./chunk-O2NLQBFX.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as r,isNoOpDrop as a}from"./chunk-67GNT6PF.js";import{useCanvasLayout as o,useCanvasEvent as s,CANVAS_TYPING_EVENT as i,framePointToHost as c,elementScale as d,frameRectToLayer as u,clientPointToLayer as h}from"./chunk-AWJUYMX7.js";import{withTip as f}from"./chunk-P2VEMZH5.js";import{parseZoneKey as p}from"./chunk-KRXQM65X.js";import{useRef as m,useEffect as g,useState as y,useCallback as b,useMemo as v,useSyncExternalStore as x,useId as k,useLayoutEffect as w}from"react";import{Tooltip as N,Input as A,IconButton as z}from"efficient-shell/ui";import{jsxs as D,jsx as T}from"react/jsx-runtime";import{CloseIcon as C,SearchIcon as $}from"efficient-shell/icons/efficient";var S=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,E=e=>e.width*e.height;function L(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>S(e.box,t,n)).sort((e,t)=>E(t.s.box)-E(e.s.box)||e.at-t.at).map(({s:e})=>e)}function M(e,t,n){return L(e,t,n).at(-1)??null}function j(e,t,n){const l="x"===e.axis?t:n;let r=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(r+=1)}return r}function B(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],r=n[t],a=l&&r?(l.left+l.width+r.left)/2:l?l.left+l.width:r?r.left:e.box.left,o=r??l??e.box;return{left:a-1,top:o.top,width:2,height:o.height}}const l=n[t-1],r=n[t],a=l&&r?(l.top+l.height+r.top)/2:l?l.top+l.height:r?r.top:e.box.top;return{left:e.box.left,top:a-1,width:e.box.width,height:2}}function K(e,t,n,l,r=()=>!1,a=()=>!0){const o=e.filter(e=>S(e.box,t,n)).sort((e,t)=>E(e.box)-E(t.box));for(const e of o){const o=j(e,t,n),s={...e.list,index:o};if(r(s))return null;if(l(s))return{zone:e,to:s,line:B(e,o)};if(!a(s))return null}return null}function X(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const r=e.children[l-1],a=e.children[l],o=r.top+r.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:o,width:e.box.width,height:Math.max(a.top-o,0)}})}return n}var q={nodes:[],zones:[]},O="data-puck-dropzone",P="data-puck-component";function F(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function R(e,t){const{frame:n,document:l}=e,r=e=>u(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),a=[],o=[];for(const e of l.querySelectorAll(`[${O}]`)){const t=e.getAttribute(O)??"";let n;try{n=p(t)}catch{continue}const l=[...e.querySelectorAll(`[${P}]`)].filter(t=>t.parentElement?.closest(`[${O}]`)===e),s=l.map(r);o.push({key:t,list:n,box:r(e),axis:F(s,e),children:s}),l.forEach((e,t)=>{const l=e.getAttribute(P);l&&a.push({id:l,place:{...n,index:t},box:s[t]})})}return{nodes:a,zones:o}}var Y="data-es-empty-cell",Z="data-puck-dropzone",I=140;var Q=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function V(u){const{canvas:f,session:p,readOnly:k,words:A=e.canvas}=u,z=m(u);g(()=>{z.current=u});const C=m(null),$=o(f),[S,E]=y(0),M=b(()=>E(e=>e+1),[]),[j,B]=y(q);g(()=>{const e=C.current;f&&e&&B((z.current.measure??R)(f,e))},[f,$,u.revision,S]);const X=u.model,O=v(()=>X(j),[X,j]),P=x(p.subscribe,p.shown,p.shown),F=u.choose,I=(e,t)=>{const n=L(O.sources,e,t);return 0===n.length?null:F?F(n):n[n.length-1]},[V,W]=y(null),[G,H]=y(null),J=m(null),U=()=>{J.current&&clearTimeout(J.current),J.current=null},_=()=>{U(),J.current=setTimeout(()=>{p.get()||W(null)},140)};g(()=>U,[]);const ee=m(null),te=m(!1);s(f,i,e=>{te.current=Boolean(e.detail?.typing),te.current&&(U(),W(null))}),s(f,"mousemove",e=>{const t=C.current;if(!f||!t)return;const n=c(f.frame,e.clientX,e.clientY,t),l=d(t),r={x:n.x/l,y:n.y/l};if(ee.current=r,z.current.readOnly||p.get()||te.current)return;U();const a=I(r.x,r.y);W(e=>e?.key===a?.key&&e?.box===a?.box?e:a)}),s(f,"mouseout",e=>{e.relatedTarget||(ee.current=null,_())}),s(f,"mouseover",e=>{e.relatedTarget||M()});const ne=m(null),le=b(()=>{ne.current?.(),ne.current=null,H(null)},[]);g(()=>p.subscribe(()=>{p.get()?M():le()}),[p,le,M]),g(()=>le,[le]),("undefined"==typeof document?g:w)(()=>{if(p.get())return;const e=ee.current;W(t=>k||te.current?null:e?I(e.x,e.y):t?O.sources.find(e=>e.key===t.key)??null:null)},[O,P,p,k,F]);const re=e=>{const t=p.get(),n=C.current;if(!t||!n)return null;const l=h(n,e.clientX,e.clientY);ee.current=l;const r=K(O.zones,l.x,l.y,e=>z.current.canDrop(t.item,e),e=>!!t.from&&a(t.from,e),e=>z.current.fallThrough?.(t.item,e,t.from)??!0);return r?{h:t,t:r}:null},ae={onDragEnter:e=>{if(ne.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),a=f?l(f.document):null,o=[];t&&o.push(r(t)),a&&f&&o.push(r(a,f.frame)),ne.current=o.length?()=>o.forEach(e=>e()):null},onDragOver:e=>{const n=re(e);if(!n)return void H(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const l={zoneKey:n.t.zone.key,line:n.t.line,axis:n.t.zone.axis};H(e=>e&&e.zoneKey===l.zoneKey&&e.line.left===l.line.left&&e.line.top===l.line.top?e:l)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(ee.current=null,H(null))},onDrop:e=>{const t=re(e);t&&(e.preventDefault(),p.end(),le(),z.current.onDrop(t.h.item,t.t.to))}},oe={draggable:!k&&!!V,onMouseEnter:U,onMouseLeave:()=>!p.get()&&_(),onDragStart:e=>{if(V&&!k){p.start({key:V.key,item:V.item,from:V.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",V.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{p.end(),le()},onClick:()=>{V&&!k&&z.current.onPick?.(V.item)}},{seams:se=[]}=O,ie=O.zones.filter(e=>0===e.children.length),ce=u.onZoneAdd&&!k?ie:[],de=ce.map(e=>e.key).join("\n");return g(()=>{const e=f?.document;if(!e)return;const t=new Set(de?de.split("\n"):[]);for(const n of e.querySelectorAll(`[${Z}]`))n.toggleAttribute(Y,t.has(n.getAttribute(Z)??""));return()=>{for(const t of e.querySelectorAll(`[${Y}]`))t.removeAttribute(Y)}},[f,de,j,$,S]),/* @__PURE__ */D("div",{ref:C,className:"es-canvas-layer",children:[P||!u.onSeamAdd||k?null:se.map(e=>/* @__PURE__ */T("div",{className:"es-canvas-seam",style:{left:e.box.left,top:e.box.top+e.box.height/2-8,width:e.box.width,height:16},children:/* @__PURE__ */T("button",{type:"button",className:"es-canvas-seam-add",onClick:()=>u.onSeamAdd?.(e.place),children:A.addButton({label:u.seamLabel??A.addSection})})},e.key)),ce.length?ce.map(e=>/* @__PURE__ */T("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",G?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:Q(e.box),onClick:()=>u.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */T("span",{className:"es-canvas-empty-add",children:A.addButton({label:e.addLabel??u.zoneAddLabel??A.addBlock})})},e.key)):null,P?/* @__PURE__ */T("div",{className:"es-canvas-catch",...ae}):null,G&&!ie.some(e=>e.key===G.zoneKey)?/* @__PURE__ */T("div",{className:`es-canvas-line is-${G.axis}`,style:Q(G.line)}):null,
2
- /* @__PURE__ */T("div",{className:"es-canvas-handle-spot",style:V?{"--es-handle-x":`${V.box.left+2}px`,"--es-handle-y":`${Math.max(V.box.top-11,0)}px`}:void 0,children:/* @__PURE__ */T(N,{className:"es-canvas-handle-tip",side:"top",content:!V||k||P?null:V.title??A.handle({label:V.label}),children:/* @__PURE__ */D("div",{className:["es-canvas-handle",V&&!k?"is-shown":"",P?"is-dragging":""].filter(Boolean).join(" "),...oe,children:[
3
- /* @__PURE__ */T("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),V?.label]})})})]})}var W=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function G({groups:t,session:n,itemFor:l,onInsert:r,at:a,hint:o,searchLabel:s,readOnly:i,words:c=e.add}){const d=o??c.hint,u=s??c.search,[h,p]=y(""),m=k(),g=h.trim().toLowerCase(),b=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),v=t.map((e,t)=>({...e,key:b[t],tiles:g?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,g)):e.tiles})).filter(e=>e.tiles.length>0),x=(e,t)=>r=>{if(t)r.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),r.dataTransfer.effectAllowed="copy";try{r.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
4
- return D("div",{className:"es-add",children:[a?/* @__PURE__ */D("div",{className:"es-add-at",role:"status",children:[
5
- /* @__PURE__ */T("span",{children:a.label}),f(c.stop,/* @__PURE__ */T("button",{type:"button",className:"es-add-at-clear","aria-label":c.stop,onClick:a.onClear,children:/* @__PURE__ */T(C,{size:12,"aria-hidden":"true"})}))]}):null,
6
- /* @__PURE__ */T("p",{className:"es-add-hint",children:d}),
7
- /* @__PURE__ */T("div",{className:"es-add-find",children:/* @__PURE__ */T(A,{id:m,type:"search","aria-label":u,placeholder:c.searchPlaceholder({label:u}),value:h,onChange:e=>p(e.target.value),leftIcon:/* @__PURE__ */T($,{size:16,"aria-hidden":"true"}),rightAdornment:h?/* @__PURE__ */T(z,{size:"sm","aria-label":c.clearSearch,onClick:()=>p(""),children:/* @__PURE__ */T(C,{size:12,"aria-hidden":"true"})}):void 0})}),0===v.length?/* @__PURE__ */D("div",{className:"es-add-empty",role:"status",children:[
8
- /* @__PURE__ */T("div",{className:"es-add-empty-title",children:c.nothing({query:h.trim()})}),
9
- /* @__PURE__ */T("div",{className:"es-add-empty-sub",children:c.tryAnother})]}):v.map(e=>/* @__PURE__ */D("section",{className:"es-add-group","aria-label":e.title,children:[
10
- /* @__PURE__ */D("div",{className:"es-add-group-head",children:[
11
- /* @__PURE__ */T("span",{className:"es-add-group-title",children:e.title}),
12
- /* @__PURE__ */T("span",{className:"es-add-group-count",children:e.tiles.length})]}),
13
- /* @__PURE__ */T("div",{className:W(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(i||e.disabled),l=i?void 0:e.disabled?e.disabledReason:e.title??c.tile({label:e.label});return f(l,/* @__PURE__ */D("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":c.tile({label:e.label}),onDragStart:x(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&r(e.type),children:[null!=e.cover?/* @__PURE__ */T("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */T("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
14
- /* @__PURE__ */T("span",{className:"es-add-tile-label",children:e.label})]},e.type))})})]},e.key))]})}export{G as AddPanel,V as CanvasDragLayer,q as EMPTY_MEASURE,I as HANDLE_GRACE_MS,K as canvasTarget,S as contains,j as gapInZone,B as gapLine,R as measureCanvas,M as pickSource,X as seamsBetween,L as sourcesAt};
@@ -1,5 +0,0 @@
1
- import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as i}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-PFNIVZPN.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-ZR4CFNMW.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-MCHMF32I.js";import{useEasel as f}from"./chunk-M5VRWM7M.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-HFW6D46X.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-O2NLQBFX.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as $,jsxs as B,Fragment as F}from"react/jsx-runtime";var N=e=>`section:${e}`,O=e=>`block:${e}`,v=e=>`template:${e}`;function I({blocks:I,blocksOnly:M,at:V,onAdd:x,itemFor:H,session:C,siteWide:L,onClose:R,onHide:W,readOnly:A}){const D=f(e=>e.config),P=p(),{labelAtLevel:w,categoryLabel:Q,firstSection:T,Icon:Z,Thumbnail:z}=P,{blockIsOffered:S}=m(),X=u("screen",d).add,Y=u("drag",h).add,E=l(),[G,J]=y([]);b(()=>{let t=!1;const o=e=>S(e,E);return s(E).list().then(n=>{if(t)return;const i=D.components;J(n.filter(t=>t.node?.type&&i[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[D,E]);const K=j(()=>t(D,P),[D]),q=e=>({type:N(e.type),label:e.name,cover:/* @__PURE__ */$(z,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:X.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),U=j(()=>{const e=[];if(I&&I.choices.length>0&&a(I.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${X.inside({name:I.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:O(e.type),label:e.label,icon:/* @__PURE__ */$(Z,{type:e.type,size:18}),title:X.tile({name:e.label})}))})}),M)return e;const t=o(K,T);t&&e.push({key:"start",title:X.startBlank,tiles:[q(t)]}),G.length>0&&e.push({key:"templates",title:X.templates,tiles:G.map(e=>{return{type:v(e.id),label:e.name,cover:/* @__PURE__ */$(z,{type:e.node.type}),keywords:[(t=e.node.type,w(t,"section",D.components[t]?.label??t)),e.node.type]};var t})});const s=n(K,T);for(const t of Object.keys(D.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:i(D,t,Q),tiles:o.map(q)})}return e},[I,M,G,K,D,X]),_=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=G.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
2
- return B(F,{children:[
3
- /* @__PURE__ */$(r,{icon:/* @__PURE__ */$(g,{size:15}),title:X.title,context:M?X.contextBlocks:X.contextAll,actions:/* @__PURE__ */$(c,{label:X.done,description:X.doneDescription,onClick:R}),onHide:W}),
4
- /* @__PURE__ */B("div",{className:"sf-addside sf-scroll",children:[
5
- /* @__PURE__ */$(k,{groups:U,session:C,itemFor:e=>H(_(e)??{kind:"section",type:e}),onInsert:e=>{const t=_(e);t&&x(t)},at:V,hint:M?X.hintBlocks:X.hint,searchLabel:M?X.searchBlocks:X.searchSections,readOnly:A,words:Y}),L&&!M?L:null]})]})}export{I as AddSidePanel,O as blockKey,N as sectionKey,v as templateKey};