efficient-easel 10.3.1 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +11 -6
  2. package/dist/{chunk-FCLW4LEN.js → chunk-47RGVCPH.js} +7 -7
  3. package/dist/{chunk-BJNZKYK7.js → chunk-6FFSDH62.js} +1 -1
  4. package/dist/chunk-77DQCEEF.js +5 -0
  5. package/dist/chunk-7LP3OD2E.js +56 -0
  6. package/dist/{chunk-P4CL4YQI.js → chunk-AFSSKGTD.js} +1 -1
  7. package/dist/{chunk-OGCROOTI.js → chunk-DGAXQTDW.js} +1 -1
  8. package/dist/{chunk-JSPZU7X2.js → chunk-FAAZZXIS.js} +1 -1
  9. package/dist/chunk-GCCBEY2W.js +2 -0
  10. package/dist/chunk-GG4FGBFR.js +1 -0
  11. package/dist/{chunk-BPMLHWWM.js → chunk-GJC6SNQC.js} +1 -1
  12. package/dist/{chunk-BRDCD4LK.js → chunk-IFS5P7CO.js} +1 -1
  13. package/dist/{chunk-VYHA6EA6.js → chunk-ISZI4T6A.js} +3 -3
  14. package/dist/{chunk-535CJ7J4.js → chunk-JTOZJXD7.js} +1 -1
  15. package/dist/chunk-PPHUWGLZ.js +1 -0
  16. package/dist/{chunk-545BRJIU.js → chunk-PZHQVOTU.js} +1 -1
  17. package/dist/{chunk-QDAJKEG3.js → chunk-QOYOE5CU.js} +1 -1
  18. package/dist/chunk-VWXUMVCD.js +1 -0
  19. package/dist/chunk-XZDHQ4DN.js +5 -0
  20. package/dist/drag/drag.css +11 -1
  21. package/dist/drag/index.d.ts +9 -3
  22. package/dist/drag/index.js +1 -1
  23. package/dist/screen/components/AddBlockRow.js +1 -1
  24. package/dist/screen/components/AddChildRow.js +4 -1
  25. package/dist/screen/components/AddSidePanel.d.ts +13 -17
  26. package/dist/screen/components/AddSidePanel.js +1 -1
  27. package/dist/screen/components/MediaSidePanel.js +1 -1
  28. package/dist/screen/components/NodeContextMenu.d.ts +3 -15
  29. package/dist/screen/components/NodeContextMenu.js +1 -1
  30. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  31. package/dist/screen/components/ScreenChrome.js +1 -1
  32. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  33. package/dist/screen/components/ScreenMount.js +1 -1
  34. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  35. package/dist/screen/components/SectionScreenShell.js +16 -16
  36. package/dist/screen/components/usePartBridge.js +1 -1
  37. package/dist/screen/index.d.ts +1 -1
  38. package/dist/screen/index.js +1 -1
  39. package/dist/screen/lib/puck/device-fields.js +1 -1
  40. package/dist/screen/lib/puck/style-clipboard.js +1 -1
  41. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  42. package/dist/screen/lib/screen-parts.d.ts +6 -62
  43. package/dist/screen/lib/screen-parts.js +1 -1
  44. package/dist/screen/screen.css +2 -8
  45. package/dist/screen/words.d.ts +16 -23
  46. package/dist/screen/words.js +1 -1
  47. package/dist/strings/catalogue.js +1 -1
  48. package/dist/strings/index.js +1 -1
  49. package/package.json +1 -1
  50. package/dist/chunk-5545A3PC.js +0 -4
  51. package/dist/chunk-D6N77AOS.js +0 -1
  52. package/dist/chunk-EVY5SXFW.js +0 -5
  53. package/dist/chunk-G5MRFCCW.js +0 -5
  54. package/dist/chunk-JTUUIVBZ.js +0 -1
  55. package/dist/chunk-MMAC2VER.js +0 -57
  56. package/dist/chunk-O2NLQBFX.js +0 -1
  57. package/dist/chunk-THZ46DC5.js +0 -2
package/README.md CHANGED
@@ -889,7 +889,7 @@ const drag = useTreeDrag({ …, session }); // the tree
889
889
  </div>
890
890
 
891
891
  <AddPanel groups={blocks} session={session} itemFor={(type) => ({ kind: 'new', type })}
892
- onInsert={insertAtOpenPlace} at={openPlace && { label: 'Adding to Column 2', onClear }} />
892
+ onInsert={openPlace ? insertAtOpenPlace : undefined} at={openPlace && { label: 'Adding to Column 2', onClear }} />
893
893
  ```
894
894
 
895
895
  - **The canvas measures itself:** `measureCanvas` reads the canvas's lists and
@@ -1188,11 +1188,16 @@ and confirms. `ScreenInspector.select(selector, mode)` moves the selection and
1188
1188
  shows a panel in one step, the mode kept through the reset a change of
1189
1189
  selection makes.
1190
1190
 
1191
- Add, the clipboard, the menu and the keys are the layer's where it says so
1192
- (0.105.0). `add.railTarget(data, selection)` aims the rail's "+" at a place
1193
- of the layer's (the campaign designer's column), and `add.blocksFirst` makes a
1194
- container's blocks the whole panel and leaves a gap between sections to the
1195
- catalogue; a category marked `visible: false` is not offered; Add's words are
1191
+ Add has TWO ways in, and no other (11.0.0, owner ruling A1 amended
1192
+ 2026-10-14): a tile DRAGGED out of Add to its place, or a tile PRESSED after a
1193
+ canvas ➕ opened Add at that place, where it lands. The Layers head's "+" opens
1194
+ Add at no place — every tile is only dragged; the rail has no "+", the tree's
1195
+ gaps no "+", and no menu an add row. Add is ONE list wherever it opens: the
1196
+ catalogue's groups in their order, the blank section (`blockLook.firstSection`)
1197
+ leading its own, then the blocks the catalogue does not hold, from the
1198
+ registry (`canAddTo`), each once. At a place, what it cannot take is dimmed
1199
+ and says why. (`add.railTarget` and `add.blocksFirst`, 0.105.0, went with the
1200
+ rail's "+".) A category marked `visible: false` is not offered; Add's words are
1196
1201
  `screen.add`. `styleClipboard` is Copy style / Paste style's scope and a
1197
1202
  node's look (`scope`, `rows`, `copy`, `plan`); the bridges' `menuRows` are the
1198
1203
  layer's own rows in a node's menu; ⌘C / ⌘X / ⌘V copy, cut and paste the
@@ -1,10 +1,10 @@
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-ILXP5VX5.js";import{withTip as f}from"./chunk-P2VEMZH5.js";import{parseZoneKey as p}from"./chunk-KRXQM65X.js";import{useRef as m,useEffect as g,useState as b,useCallback as x,useMemo as y,useSyncExternalStore as v,useId as w,useLayoutEffect as k}from"react";import{Tooltip as N,IconButton as z,Input as A}from"efficient-shell/ui";import{AddIcon as D,CloseIcon as T,SearchIcon as $}from"efficient-shell/icons/efficient";import{jsxs as C,jsx as M}from"react/jsx-runtime";function S({label:e,onInsert:t,style:n,axis:l="y",className:a,index:r}){const o=["es-canvas-insert","x"===l?"is-x":"",a??""].filter(Boolean).join(" ");/* @__PURE__ */
1
+ import{DEFAULT_DRAG_WORDS as e}from"./chunk-GG4FGBFR.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as a,isNoOpDrop as r}from"./chunk-67GNT6PF.js";import{useCanvasLayout as o,useCanvasEvent as s,CANVAS_TYPING_EVENT as i,framePointToHost as c,elementScale as d,frameRectToLayer as u,clientPointToLayer as h}from"./chunk-ILXP5VX5.js";import{withTip as f}from"./chunk-P2VEMZH5.js";import{parseZoneKey as p}from"./chunk-KRXQM65X.js";import{useRef as m,useEffect as g,useState as b,useCallback as x,useMemo as y,useSyncExternalStore as v,useId as w,useLayoutEffect as k}from"react";import{Tooltip as N,IconButton as z,Input as A}from"efficient-shell/ui";import{AddIcon as D,CloseIcon as T,SearchIcon as $}from"efficient-shell/icons/efficient";import{jsxs as C,jsx as M}from"react/jsx-runtime";function S({label:e,onInsert:t,style:n,axis:l="y",className:a,index:r}){const o=["es-canvas-insert","x"===l?"is-x":"",a??""].filter(Boolean).join(" ");/* @__PURE__ */
2
2
  return C("div",{className:o,style:n,"data-index":r,children:[
3
3
  /* @__PURE__ */M("span",{className:"es-canvas-insert-line","aria-hidden":"true"}),
4
- /* @__PURE__ */M("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */M(N,{content:e,children:/* @__PURE__ */M(z,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */M(D,{})})})})]})}var E=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,L=e=>e.width*e.height;function j(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>E(e.box,t,n)).sort((e,t)=>L(t.s.box)-L(e.s.box)||e.at-t.at).map(({s:e})=>e)}function B(e,t,n){return j(e,t,n).at(-1)??null}function X(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 K(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)=>L(e.box)-L(t.box));for(const e of o){const o=X(e,t,n),s={...e.list,index:o};if(a(s))return null;if(l(s))return{zone:e,to:s,line:K(e,o)};if(!r(s))return null}return null}function I(e,t,n=12){const l=e.children;if(0===l.length)return[];const a=e.box,r="x"===e.axis,o=r?a.left:a.top,s=o+(r?a.width:a.height),i=e=>r?e.left:e.top,c=e=>r?e.left+e.width:e.top+e.height,d=[];for(let u=0;u<=l.length;u++){const h=l[u-1],f=l[u];let p,m;if(h&&f)p=c(h),m=Math.max(i(f)-p,0);else{const e=h?(c(h)+s)/2:(o+i(f))/2;p=Math.min(Math.max(e,o+n),s-n),m=0}const g=r?{left:p,top:a.top,width:m,height:a.height}:{left:a.left,top:p,width:a.width,height:m};d.push({key:`${e.key}:+${u}`,place:{...e.list,index:u},box:g,axis:e.axis,label:t})}return d}function O(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 V(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:V(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",Y="data-puck-dropzone",G=140;var H=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function W(u){const{canvas:f,session:p,readOnly:w,words:z=e.canvas}=u,A=m(u);g(()=>{A.current=u});const D=m(null),T=o(f),[$,E]=b(0),L=x(()=>E(e=>e+1),[]),[B,X]=b(P);g(()=>{const e=D.current;f&&e&&X((A.current.measure??Z)(f,e))},[f,T,u.revision,$]);const K=u.model,I=y(()=>K(B),[K,B]),O=v(p.subscribe,p.shown,p.shown),F=u.choose,R=(e,t)=>{const n=j(I.sources,e,t);return 0===n.length?null:F?F(n):n[n.length-1]},[V,G]=b(null),[W,J]=b(null),U=m(null),_=()=>{U.current&&clearTimeout(U.current),U.current=null},ee=()=>{_(),U.current=setTimeout(()=>{p.get()||G(null)},140)};g(()=>_,[]);const te=m(null),ne=m(!1);s(f,i,e=>{ne.current=Boolean(e.detail?.typing),ne.current&&(_(),G(null))}),s(f,"mousemove",e=>{const t=D.current;if(!f||!t)return;const n=c(f.frame,e.clientX,e.clientY,t),l=d(t),a={x:n.x/l,y:n.y/l};if(te.current=a,A.current.readOnly||p.get()||ne.current)return;_();const r=R(a.x,a.y);G(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||L()});const le=m(null),ae=x(()=>{le.current?.(),le.current=null,J(null)},[]);g(()=>p.subscribe(()=>{p.get()?L():ae()}),[p,ae,L]),g(()=>ae,[ae]),("undefined"==typeof document?g:k)(()=>{if(p.get())return;const e=te.current;G(t=>w||ne.current?null:e?R(e.x,e.y):t?I.sources.find(e=>e.key===t.key)??null:null)},[I,O,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(I.zones,l.x,l.y,e=>A.current.canDrop(t.item,e),e=>!!t.from&&r(t.from,e),e=>A.current.fallThrough?.(t.item,e,t.from)??!0);return a?{h:t,t:a}:null},oe={onDragEnter:e=>{if(le.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),r=f?l(f.document):null,o=[];t&&o.push(a(t)),r&&f&&o.push(a(r,f.frame)),le.current=o.length?()=>o.forEach(e=>e()):null},onDragOver:e=>{const n=re(e);if(!n)return void J(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const l={zoneKey:n.t.zone.key,line:n.t.line,axis:n.t.zone.axis};J(e=>e&&e.zoneKey===l.zoneKey&&e.line.left===l.line.left&&e.line.top===l.line.top?e:l)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(te.current=null,J(null))},onDrop:e=>{const t=re(e);t&&(e.preventDefault(),p.end(),ae(),A.current.onDrop(t.h.item,t.t.to))}},se={draggable:!w&&!!V,onMouseEnter:_,onMouseLeave:()=>!p.get()&&ee(),onDragStart:e=>{if(V&&!w){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(),ae()},onClick:()=>{V&&!w&&A.current.onPick?.(V.item)}},{seams:ie=[]}=I,ce=I.zones.filter(e=>0===e.children.length),de=u.onZoneAdd&&!w?ce:[],ue=de.map(e=>e.key).join("\n");return g(()=>{const e=f?.document;if(!e)return;const t=new Set(ue?ue.split("\n"):[]);for(const n of e.querySelectorAll(`[${Y}]`))n.toggleAttribute(Q,t.has(n.getAttribute(Y)??""));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:[O||!u.onSeamAdd||w?null:ie.map(e=>
5
- /* @__PURE__ */M(S,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??u.seamLabel??z.addSection,onInsert:()=>u.onSeamAdd?.(e.place),style:"x"===e.axis?{left:e.box.left+e.box.width/2-12,top:e.box.top,width:24,height:e.box.height}:{left:e.box.left,top:e.box.top+e.box.height/2-12,width:e.box.width,height:24}},e.key)),de.length?de.map(e=>/* @__PURE__ */M("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",W?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:H(e.box),onClick:()=>u.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */M("span",{className:"es-canvas-empty-add",children:z.addButton({label:e.addLabel??u.zoneAddLabel??z.addBlock})})},e.key)):null,O?/* @__PURE__ */M("div",{className:"es-canvas-catch",...oe}):null,W&&!ce.some(e=>e.key===W.zoneKey)?/* @__PURE__ */M("div",{className:`es-canvas-line is-${W.axis}`,style:H(W.line)}):null,
6
- /* @__PURE__ */M("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__ */M(N,{className:"es-canvas-handle-tip",side:"top",content:!V||w||O?null:V.title??z.handle({label:V.label}),children:/* @__PURE__ */C("div",{className:["es-canvas-handle",V&&!w?"is-shown":"",O?"is-dragging":""].filter(Boolean).join(" "),...se,children:[
7
- /* @__PURE__ */M("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),V?.label]})})})]})}var J=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function U({groups:t,session:n,itemFor:l,onInsert:a,at:r,hint:o,searchLabel:s,readOnly:i,words:c=e.add}){const d=o??c.hint,u=s??c.search,[h,p]=b(""),m=w(),g=h.trim().toLowerCase(),x=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),y=t.map((e,t)=>({...e,key:x[t],tiles:g?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,g)):e.tiles})).filter(e=>e.tiles.length>0),v=(e,t)=>a=>{if(t)a.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),a.dataTransfer.effectAllowed="copy";try{a.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
4
+ /* @__PURE__ */M("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */M(N,{content:e,children:/* @__PURE__ */M(z,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */M(D,{})})})})]})}var E=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,j=e=>e.width*e.height;function L(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>E(e.box,t,n)).sort((e,t)=>j(t.s.box)-j(e.s.box)||e.at-t.at).map(({s:e})=>e)}function B(e,t,n){return L(e,t,n).at(-1)??null}function K(e,t,n){const l="x"===e.axis?t:n;let a=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(a+=1)}return a}function X(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],a=n[t],r=l&&a?(l.left+l.width+a.left)/2:l?l.left+l.width:a?a.left:e.box.left,o=a??l??e.box;return{left:r-1,top:o.top,width:2,height:o.height}}const l=n[t-1],a=n[t],r=l&&a?(l.top+l.height+a.top)/2:l?l.top+l.height:a?a.top:e.box.top;return{left:e.box.left,top:r-1,width:e.box.width,height:2}}function q(e,t,n,l,a=()=>!1,r=()=>!0){const o=e.filter(e=>E(e.box,t,n)).sort((e,t)=>j(e.box)-j(t.box));for(const e of o){const o=K(e,t,n),s={...e.list,index:o};if(a(s))return null;if(l(s))return{zone:e,to:s,line:X(e,o)};if(!r(s))return null}return null}function I(e,t,n=12){const l=e.children;if(0===l.length)return[];const a=e.box,r="x"===e.axis,o=r?a.left:a.top,s=o+(r?a.width:a.height),i=e=>r?e.left:e.top,c=e=>r?e.left+e.width:e.top+e.height,d=[];for(let u=0;u<=l.length;u++){const h=l[u-1],f=l[u];let p,m;if(h&&f)p=c(h),m=Math.max(i(f)-p,0);else{const e=h?(c(h)+s)/2:(o+i(f))/2;p=Math.min(Math.max(e,o+n),s-n),m=0}const g=r?{left:p,top:a.top,width:m,height:a.height}:{left:a.left,top:p,width:a.width,height:m};d.push({key:`${e.key}:+${u}`,place:{...e.list,index:u},box:g,axis:e.axis,label:t})}return d}function P(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const a=e.children[l-1],r=e.children[l],o=a.top+a.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:o,width:e.box.width,height:Math.max(r.top-o,0)}})}return n}var F={nodes:[],zones:[]},G="data-puck-dropzone",O="data-puck-component";function R(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function V(e,t){const{frame:n,document:l}=e,a=e=>u(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),r=[],o=[];for(const e of l.querySelectorAll(`[${G}]`)){const t=e.getAttribute(G)??"";let n;try{n=p(t)}catch{continue}const l=[...e.querySelectorAll(`[${O}]`)].filter(t=>t.parentElement?.closest(`[${G}]`)===e),s=l.map(a);o.push({key:t,list:n,box:a(e),axis:R(s,e),children:s}),l.forEach((e,t)=>{const l=e.getAttribute(O);l&&r.push({id:l,place:{...n,index:t},box:s[t]})})}return{nodes:r,zones:o}}var Z="data-es-empty-cell",Y="data-puck-dropzone",H=140;var Q=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function W(u){const{canvas:f,session:p,readOnly:w,words:z=e.canvas}=u,A=m(u);g(()=>{A.current=u});const D=m(null),T=o(f),[$,E]=b(0),j=x(()=>E(e=>e+1),[]),[B,K]=b(F);g(()=>{const e=D.current;f&&e&&K((A.current.measure??V)(f,e))},[f,T,u.revision,$]);const X=u.model,I=y(()=>X(B),[X,B]),P=v(p.subscribe,p.shown,p.shown),G=u.choose,O=(e,t)=>{const n=L(I.sources,e,t);return 0===n.length?null:G?G(n):n[n.length-1]},[R,H]=b(null),[W,J]=b(null),U=m(null),_=()=>{U.current&&clearTimeout(U.current),U.current=null},ee=()=>{_(),U.current=setTimeout(()=>{p.get()||H(null)},140)};g(()=>_,[]);const te=m(null),ne=m(!1);s(f,i,e=>{ne.current=Boolean(e.detail?.typing),ne.current&&(_(),H(null))}),s(f,"mousemove",e=>{const t=D.current;if(!f||!t)return;const n=c(f.frame,e.clientX,e.clientY,t),l=d(t),a={x:n.x/l,y:n.y/l};if(te.current=a,A.current.readOnly||p.get()||ne.current)return;_();const r=O(a.x,a.y);H(e=>e?.key===r?.key&&e?.box===r?.box?e:r)}),s(f,"mouseout",e=>{e.relatedTarget||(te.current=null,ee())}),s(f,"mouseover",e=>{e.relatedTarget||j()});const le=m(null),ae=x(()=>{le.current?.(),le.current=null,J(null)},[]);g(()=>p.subscribe(()=>{p.get()?j():ae()}),[p,ae,j]),g(()=>ae,[ae]),("undefined"==typeof document?g:k)(()=>{if(p.get())return;const e=te.current;H(t=>w||ne.current?null:e?O(e.x,e.y):t?I.sources.find(e=>e.key===t.key)??null:null)},[I,P,p,w,G]);const re=e=>{const t=p.get(),n=D.current;if(!t||!n)return null;const l=h(n,e.clientX,e.clientY);te.current=l;const a=q(I.zones,l.x,l.y,e=>A.current.canDrop(t.item,e),e=>!!t.from&&r(t.from,e),e=>A.current.fallThrough?.(t.item,e,t.from)??!0);return a?{h:t,t:a}:null},oe={onDragEnter:e=>{if(le.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),r=f?l(f.document):null,o=[];t&&o.push(a(t)),r&&f&&o.push(a(r,f.frame)),le.current=o.length?()=>o.forEach(e=>e()):null},onDragOver:e=>{const n=re(e);if(!n)return void J(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const l={zoneKey:n.t.zone.key,line:n.t.line,axis:n.t.zone.axis};J(e=>e&&e.zoneKey===l.zoneKey&&e.line.left===l.line.left&&e.line.top===l.line.top?e:l)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(te.current=null,J(null))},onDrop:e=>{const t=re(e);t&&(e.preventDefault(),p.end(),ae(),A.current.onDrop(t.h.item,t.t.to))}},se={draggable:!w&&!!R,onMouseEnter:_,onMouseLeave:()=>!p.get()&&ee(),onDragStart:e=>{if(R&&!w){p.start({key:R.key,item:R.item,from:R.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",R.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{p.end(),ae()},onClick:()=>{R&&!w&&A.current.onPick?.(R.item)}},{seams:ie=[]}=I,ce=I.zones.filter(e=>0===e.children.length),de=u.onZoneAdd&&!w?ce:[],ue=de.map(e=>e.key).join("\n");return g(()=>{const e=f?.document;if(!e)return;const t=new Set(ue?ue.split("\n"):[]);for(const n of e.querySelectorAll(`[${Y}]`))n.toggleAttribute(Z,t.has(n.getAttribute(Y)??""));return()=>{for(const t of e.querySelectorAll(`[${Z}]`))t.removeAttribute(Z)}},[f,ue,B,T,$]),/* @__PURE__ */C("div",{ref:D,className:"es-canvas-layer",children:[P||!u.onSeamAdd||w?null:ie.map(e=>
5
+ /* @__PURE__ */M(S,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??u.seamLabel??z.addSection,onInsert:()=>u.onSeamAdd?.(e.place),style:"x"===e.axis?{left:e.box.left+e.box.width/2-12,top:e.box.top,width:24,height:e.box.height}:{left:e.box.left,top:e.box.top+e.box.height/2-12,width:e.box.width,height:24}},e.key)),de.length?de.map(e=>/* @__PURE__ */M("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",W?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:Q(e.box),onClick:()=>u.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */M("span",{className:"es-canvas-empty-add",children:z.addButton({label:e.addLabel??u.zoneAddLabel??z.addBlock})})},e.key)):null,P?/* @__PURE__ */M("div",{className:"es-canvas-catch",...oe}):null,W&&!ce.some(e=>e.key===W.zoneKey)?/* @__PURE__ */M("div",{className:`es-canvas-line is-${W.axis}`,style:Q(W.line)}):null,
6
+ /* @__PURE__ */M("div",{className:"es-canvas-handle-spot",style:R?{"--es-handle-x":`${R.box.left+2}px`,"--es-handle-y":`${Math.max(R.box.top-11,0)}px`}:void 0,children:/* @__PURE__ */M(N,{className:"es-canvas-handle-tip",side:"top",content:!R||w||P?null:R.title??z.handle({label:R.label}),children:/* @__PURE__ */C("div",{className:["es-canvas-handle",R&&!w?"is-shown":"",P?"is-dragging":""].filter(Boolean).join(" "),...se,children:[
7
+ /* @__PURE__ */M("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),R?.label]})})})]})}var J=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function U({groups:t,session:n,itemFor:l,onInsert:a,at:r,hint:o,searchLabel:s,readOnly:i,words:c=e.add}){const d=o??c.hint,u=s??c.search,[h,p]=b(""),m=w(),g=h.trim().toLowerCase(),x=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),y=t.map((e,t)=>({...e,key:x[t],tiles:g?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,g)):e.tiles})).filter(e=>e.tiles.length>0),v=(e,t)=>a=>{if(t)a.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),a.dataTransfer.effectAllowed="copy";try{a.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
8
8
  return C("div",{className:"es-add",children:[r?/* @__PURE__ */C("div",{className:"es-add-at",role:"status",children:[
9
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
10
  /* @__PURE__ */M("p",{className:"es-add-hint",children:d}),
@@ -14,5 +14,5 @@ return C("div",{className:"es-add",children:[r?/* @__PURE__ */C("div",{className
14
14
  /* @__PURE__ */C("div",{className:"es-add-group-head",children:[
15
15
  /* @__PURE__ */M("span",{className:"es-add-group-title",children:e.title}),
16
16
  /* @__PURE__ */M("span",{className:"es-add-group-count",children:e.tiles.length})]}),
17
- /* @__PURE__ */M("div",{className:J(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(i||e.disabled),l=i?void 0:e.disabled?e.disabledReason:e.title??c.tile({label:e.label});return f(l,/* @__PURE__ */C("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":c.tile({label:e.label}),onDragStart:v(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&a(e.type),children:[null!=e.cover?/* @__PURE__ */M("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */M("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
18
- /* @__PURE__ */M("span",{className:"es-add-tile-label",children:e.label})]},e.type))})})]},e.key))]})}export{U as AddPanel,W as CanvasDragLayer,S as CanvasInsert,P as EMPTY_MEASURE,G as HANDLE_GRACE_MS,q as canvasTarget,E as contains,X as gapInZone,K as gapLine,I as insertSeams,Z as measureCanvas,B as pickSource,O as seamsBetween,j as sourcesAt};
17
+ /* @__PURE__ */M("div",{className:J(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(i||e.disabled),l=i?void 0:e.disabled?e.disabledReason:e.title??c.tile({label:e.label});return f(l,/* @__PURE__ */C("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":c.tile({label:e.label}),onDragStart:v(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&a?.(e.type),children:[null!=e.cover?/* @__PURE__ */M("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */M("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
18
+ /* @__PURE__ */M("span",{className:"es-add-tile-label",children:e.label})]},e.type))})})]},e.key))]})}export{U as AddPanel,W as CanvasDragLayer,S as CanvasInsert,F as EMPTY_MEASURE,H as HANDLE_GRACE_MS,q as canvasTarget,E as contains,K as gapInZone,X as gapLine,I as insertSeams,V as measureCanvas,B as pickSource,P as seamsBetween,L as sourcesAt};
@@ -1,4 +1,4 @@
1
- import{useScreenOwnerName as e}from"./chunk-EVY5SXFW.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-IE55HNMA.js";import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";function l({panel:l,pick:d,onHide:m}){const p=e();/* @__PURE__ */
1
+ import{useScreenOwnerName as e}from"./chunk-77DQCEEF.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-IE55HNMA.js";import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";function l({panel:l,pick:d,onHide:m}){const p=e();/* @__PURE__ */
2
2
  return o(r,{children:[
3
3
  /* @__PURE__ */t(i,{context:p,pick:d?{kind:c(d.accept),field:d.title||void 0}:null,onCancel:()=>d&&n(d.requestId,null),onHide:m}),
4
4
  /* @__PURE__ */t("div",{className:"sf-media-panel",children:/* @__PURE__ */t(l,{pick:d,onPick:e=>d&&n(d.requestId,e)})})]})}export{l as MediaSidePanel};
@@ -0,0 +1,5 @@
1
+ import{slotFieldsOf as n}from"./chunk-PLVEGYK6.js";import{usePickFollowsSelection as e}from"./chunk-R6WTQWAC.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-PE6ZY5IW.js";import{Inspector as i}from"./chunk-26GHWMNN.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(e,t,r){const i=e.slotsOf?.(r);return i||n(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},O={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},j={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},w={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},L={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function N(){/* @__PURE__ */
2
+ return s(t,{height:"fill"})}function P(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
3
+ return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var S=o({});function C({parts:n,children:e}){/* @__PURE__ */
4
+ return s(S.Provider,{value:n,children:e})}function G(){return u(S)}function D(){return(G().useOwnerName??v)()}function I(){return(G().useDocumentLabel??g)()}function x(n,e,t,r){return(G().useBridges??h)(n,e,t,r)}function B(n){return(G().useStandaloneBridges??h)(n)}function T(n,e){(G().useDocumentPass??y)(n,e)}function W(){return G().blockRules??b}function A(){return G().blockLook??O}function F(){return G().devices??j}function R(){return G().leftView??w}function E(){return G().pinned??L}function H(){return G().saveSwitch??!0}function K(n){e(!0===G().pickFollowsSelection,n)}function V(){return G().storageNamespace||void 0}function Y(){return G().styleClipboard??null}function Z(){return G().nodeKeys??!0}function M(){return G().notify??null}function Q(){return G().Canvas??N}function q(){return G().CanvasHead??null}function z(){return G().canvasDrag??null}var J=o(null);function U({target:n,children:e}){/* @__PURE__ */
5
+ return s(J.Provider,{value:n,children:e})}function X(){return u(J)}function $(){return G().Inspector??P}export{c as SELECTION_MODE,U as ScreenCanvasTargetProvider,C as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,A as useScreenBlockLook,W as useScreenBlockRules,x as useScreenBridges,z as useScreenCanvasDrag,Q as useScreenCanvasFrame,q as useScreenCanvasHead,X as useScreenCanvasTarget,F as useScreenDevices,I as useScreenDocumentLabel,T as useScreenDocumentPass,$ as useScreenInspectorPanel,R as useScreenLeftView,Z as useScreenNodeKeys,M as useScreenNotify,D as useScreenOwnerName,G as useScreenParts,K as useScreenPickFollowsSelection,E as useScreenPinned,H as useScreenSaveSwitch,V as useScreenStorageNamespace,Y as useScreenStyleClipboard,B as useStandaloneScreenBridges};
@@ -0,0 +1,56 @@
1
+ import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-IFS5P7CO.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-BHRC3ASL.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,useEaselSaveKey as m,editorRootFocus as g}from"./chunk-BGY4Q2SL.js";import{SlotChildActionsProvider as y}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as S,DEFAULT_PANEL_W as k,clampPanelWidth as v}from"./chunk-TZIIRGVY.js";import{usePartBridge as w}from"./chunk-QOYOE5CU.js";import{useSectionOps as b}from"./chunk-GJC6SNQC.js";import{useNodeClipboard as x,useNodeContextMenu as z}from"./chunk-PPHUWGLZ.js";import{PageEditGuardNotices as C}from"./chunk-AFSSKGTD.js";import{ScreenSaveIcon as B,ScreenMainButton as I}from"./chunk-W4U4SHKW.js";import{useBrowserOffline as O}from"./chunk-RKTF5XLP.js";import{useScreenDocument as N}from"./chunk-GCCBEY2W.js";import{requestMediaPick as P}from"./chunk-KG7RJWOK.js";import{heldStyle as $,styleShortcut as M}from"./chunk-V7U33NF2.js";import{AddSidePanel as j}from"./chunk-XZDHQ4DN.js";import{SidePanelHead as T,PanelShowStrip as A}from"./chunk-PPL7GB7D.js";import{useEaselSession as E}from"./chunk-O7Q4DDJT.js";import{MediaSidePanel as L}from"./chunk-6FFSDH62.js";import{useScreenSaveSwitch as R,useScreenNodeKeys as V,useScreenPinned as F,useScreenDocumentLabel as D,useScreenCanvasFrame as H,useScreenInspectorPanel as W,useScreenDevices as G,useScreenPickFollowsSelection as U,useScreenLeftView as J,SELECTION_MODE as Y,sameInspectorMode as X,useScreenBridges as K,useScreenBlockRules as q,useScreenBlockLook as Q,useScreenStorageNamespace as Z,useScreenNotify as _,useScreenCanvasHead as ee,isSlotMode as ne,useScreenStyleClipboard as te,useScreenDocumentPass as oe,useScreenCanvasDrag as re,ScreenCanvasTargetProvider as ie,isPinnedFirst as le,isPinnedLast as se,screenSlotsOf as de}from"./chunk-77DQCEEF.js";import{ROOT_ZONE as ce,blockNodeActions as ae,TREE_MAX_DEPTH as pe,childSlotsOf as ue,slotFieldsOf as fe,slotChildrenIn as he,nestsInTree as me,newNodeId as ge}from"./chunk-PLVEGYK6.js";import{useMediaPanel as ye,usePanelPick as Se,useCancelPanelPick as ke}from"./chunk-R6WTQWAC.js";import{useEaselHost as ve,useHostEscape as we}from"./chunk-U3JP4VGF.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as be}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as xe}from"./chunk-VWXUMVCD.js";import{useEasel as ze,useEaselApi as Ce,CanvasPassThroughContext as Be}from"./chunk-PE6ZY5IW.js";import{TreeRow as Ie,Subtree as Oe,LayersTree as Ne,TreeGroupLabel as Pe,TreeRowAction as $e,TreeSeam as Me}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as je}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Te}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ae,useNodeOps as Ee,clickPick as Le}from"./chunk-ECM5F6JJ.js";import{LayersIcon as Re,MediaIcon as Ve}from"./chunk-4VJATVVR.js";import{EaselTopBar as Fe,TopBarRail as De,TopBarCluster as He,EaselIconButton as We,TopBarDivider as Ge,DeviceSwitch as Ue,InspectorIconButton as Je,PanelResizeHandle as Ye,MAX_PANEL_W as Xe,MIN_PANEL_W as Ke,panelWidthVars as qe}from"./chunk-IE55HNMA.js";import{DEFAULT_NOTICE_WORDS as Qe,DEFAULT_CHROME_WORDS as Ze}from"./chunk-Z6PVRXVY.js";import{holderOf as _e,nameOrSomeone as en}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as nn}from"./chunk-RE4LP46F.js";import{useWords as tn}from"./chunk-MFIRYGHW.js";import{insertSeams as on,CanvasDragLayer as rn,CanvasInsert as ln}from"./chunk-47RGVCPH.js";import{DEFAULT_DRAG_WORDS as sn}from"./chunk-GG4FGBFR.js";import{createDragSession as dn,useTreeDrag as cn,gapToMoveIndex as an}from"./chunk-67GNT6PF.js";import{useCanvasFrame as pn,LIST_SELECTOR as un,BLOCK_SELECTOR as fn,useCanvasEvent as hn,nodeIdAt as mn,frameRectToHost as gn,BLOCK_ATTRIBUTE as yn,drawnBox as Sn}from"./chunk-ILXP5VX5.js";import{ROOT_ID as kn,ROOT_SLOT as vn,zoneKey as wn,parseZoneKey as bn,find as xn,DataError as zn}from"./chunk-KRXQM65X.js";import{useRef as Cn,useMemo as Bn,useState as In,useEffect as On,useCallback as Nn,useLayoutEffect as Pn,Fragment as $n}from"react";import{ColoredBadge as Mn,toast as jn,groupColors as Tn}from"efficient-shell/ui";import{UndoIcon as An,RedoIcon as En,RefreshIcon as Ln,AddIcon as Rn,TrashIcon as Vn,EyeOffIcon as Fn,EyeIcon as Dn,DuplicateIcon as Hn}from"efficient-shell/icons/efficient";import{jsx as Wn,jsxs as Gn,Fragment as Un}from"react/jsx-runtime";var Jn=/* @__PURE__ */new WeakSet;function Yn(e,n,t){const o=xn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function Xn({canvas:e,tabs:n,onSelect:t}){const o=Cn(null),[r,i]=In({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Pn(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=gn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),c={};for(const o of n){const n=t.querySelector(`[${yn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?Sn(n):null;if(!i||0===i.height){c[o.id]=null;continue}const s=gn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),a=s.top+s.height;if(a<d.top||s.top>d.top+d.height){c[o.id]=null;continue}const p=o.below?a+4:Math.max(s.top,d.top)+6;c[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(c)},c=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",c,!0),r.addEventListener("resize",c);const a=new r.MutationObserver(c);return a.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",c,!0),r.removeEventListener("resize",c),a.disconnect()}},[e,l]),/* @__PURE__ */Wn("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */Wn("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:/* @__PURE__ */Wn(Mn,{colorClass:Tn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function Kn({expand:e}){/* @__PURE__ */
2
+ return Wn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Gn(Un,e?{children:[
3
+ /* @__PURE__ */Wn("path",{d:"M8 9l4-4 4 4"}),
4
+ /* @__PURE__ */Wn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
5
+ /* @__PURE__ */Wn("path",{d:"M8 4l4 4 4-4"}),
6
+ /* @__PURE__ */Wn("path",{d:"M8 20l4-4 4 4"}),
7
+ /* @__PURE__ */Wn("path",{d:"M5 12h14"})]})})}var qn=`${un}, ${fn}`;function Qn(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 Zn="__rungs";var _n="screen:band",et={duplicate:!0,delete:!0};function nt(){const un=ve(),{target:gn,docId:yn,capabilities:Sn,currentSlug:Tn,siteId:nt,onPublish:tt,saveState:ot,saveConflict:rt,retrySave:it,toggleAutoSave:lt,flushSave:st,access:dt,saveUnreachable:ct=!1,readOnly:at,readOnlyReason:pt=null}=N(),ut=R(),ft=V(),{mediaEditing:ht,hasEditGuard:mt,hasPinnedChrome:gt}=Sn,{appState:yt,dispatch:St,history:kt,selectedItem:vt,getSelectorForId:wt,config:bt}=ze(e=>e),xt=F(),{first:zt,firstGroup:Ct,lastGroup:Bt,isSectionGroup:It,sectionGroupZone:Ot,panelOf:Nt}=xt,Pt=Nt(zt),$t=e=>le(xt,e),Mt=e=>se(xt,e),jt="node"===xt.firstRow,Tt=xt.band??null,At=tn("screen",xe),Et=tn("tree",je),Lt=tn("drag",sn),Rt=tn("notice",Qe),Vt=tn("lock",nn),Ft=tn("menu",Te),Dt=tn("styleClipboard",be),Ht=tn("chrome",Ze),Wt=D()??`/${Tn}`,Gt=H(),Ut=W(),Jt=b({readOnly:at}),Yt=b({readOnly:at,foldIntoHistory:!0}),Xt=Cn(null),Kt=Ce(),qt=Bn(()=>({...Jt,select:e=>{Xt.current=e,Jt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Kt.config;Xt.current=Ae(e,t,n)}Jt.commitDocument(e,n)}}),[Jt,Kt]),Qt=yt.ui,Zt=Qt.leftSideBarVisible,_t=Qt.rightSideBarVisible,{options:eo,widths:no,initial:to,fluid:oo,fit:ro}=G(),[io,lo]=In(to),so=ye(),co=ht&&null!==so,ao=Se(),po=ke();U(vt?.props.id);const{read:uo,write:fo,forSelection:ho}=J(),[mo,go]=In(uo);On(()=>{fo(mo)},[mo]);const[yo,So]=In(0),ko=Cn(null),vo=Cn(null),wo=pn(vo,{readySelector:qn}),bo=f(vo);h(vo,wo);const xo=O(),zo=_e(dt),Co={state:ot,offline:xo||ot.failed&&ct,readOnlyReason:pt,editing:zo?Rt.editing({name:en(zo.name,Vt),noun:At.noun}):null,conflict:null!=rt,notSaving:At.bar.notSaving},Bo=()=>{at||(ot.failed?it():st())};m(vo,wo,Bo);const[Io,Oo]=In(!1),No=Cn(!1),Po=Cn(!1),[$o,Mo]=In(null),[jo,To]=In([]),[Ao,Eo]=In(Y),Lo="puck"===Ao.kind,Ro=o(Ao,vt?.props.id),[Vo,Fo]=In(null);On(()=>{Vo&&(r(),Fo(null))},[Vo]);const Do=Cn(wt);Do.current=wt;const Ho=Nn((e,{scroll:n})=>{go(n=>ho(e,n)),n&&Fo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Do.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Sr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Wo=Cn(null);On(()=>{const e=Wo.current;Wo.current=null;const n=null==vt?.props.id?null:String(vt.props.id);Eo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Nt(vt?.type)??Y);const t=vt?.props.id,o=Xt.current;if(Xt.current=null,!t)return;const r=wt(t);Ho(String(t),{scroll:!i(o,r??null,ce)})},[vt?.props.id,Ho]);const Go=Nn(e=>{Eo(n=>X(n,e)?n:e),St({type:"setUi",ui:{rightSideBarVisible:!0}})},[St]),Uo=Cn(()=>{});Uo.current=(e,n)=>{const t=e?pi(e.zone??ce)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==vt?.props.id?null:String(vt.props.id);Eo(e=>X(e,n)?e:n),o!==r&&(Wo.current={id:o,mode:n},qt.select(e))};const Jo=Nn((e,n)=>Uo.current(e,n),[]),Yo={kind:Ao.kind,mode:Ao,open:Go,show:e=>Eo(e),reveal:()=>{_t||St({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Jo},Xo=K(Yo,{data:yt.data,selected:vt??null,zoneOf:e=>wt(e)?.zone,readOnly:Boolean(at),select:e=>{Eo(Y),qt.select({index:e})},replace:(e,n)=>qt.replaceComponent(ce,e,n),scrollTo:e=>Ei(e)},{device:io,refreshes:yo},{setView:go,reveal:()=>{Zt||St({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Ko=Xo.pinnedSource??!1,qo=Xo.resolveLeftView?Xo.resolveLeftView(mo,co):"media"===mo&&co?mo:"sections",Qo=q(),{isLockedBlock:Zo,duplicateBlocked:_o,nestDepth:er,newSectionNode:nr,canAddTo:tr,blockIsOffered:or}=Qo,rr=Q(),{labelAtLevel:ir,Icon:lr,useProducts:sr}=rr,dr=rr.rowName?(e,n,t)=>rr.rowName(e,n,t):void 0,cr=Nn(e=>{St({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),Ho(e,{scroll:!0})},[St,Ho]),{selectNode:ar,openPartId:pr}=w({mode:Ao,setMode:Eo,onOpenPart:cr}),[ur,fr]=In(null);we(null!==ur,()=>fr(null));const hr=S(Z()),mr=hr.collapsed,gr=hr.panelWidths,[yr,Sr]=In(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(mr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
8
+ return new Set}});On(()=>{try{window.localStorage.setItem(mr,JSON.stringify([...yr]))}catch{}},[yr]);const[kr,vr]=In(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(gr);if(!e)return{...k};const n=JSON.parse(e);return{left:v(Number(n.left)||k.left),right:v(Number(n.right)||k.right)}}catch{return{...k}}});On(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(gr,JSON.stringify(kr))}catch{}},300);return()=>clearTimeout(e)},[kr]);const wr=Nn((e,n)=>vr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),br=Nn(e=>wr("left",e),[wr]),xr=Nn(e=>wr("right",e),[wr]),zr=e=>yr.has(e),Cr=e=>Sr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Br=Cn(!1),Ir=Cn(null);On(()=>{if(Br.current&&!Io){const e=Ir.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??vo.current?.querySelector(`button[aria-label="${CSS.escape(At.add.title)}"]`))?.focus(),Ir.current=null}Br.current=Io},[Io]),On(()=>{if(!Io||!bo)return;const e=e=>{"Escape"===e.key&&Gi()};return bo.addEventListener("keydown",e),()=>bo.removeEventListener("keydown",e)},[Io,bo]),we(Io,()=>Gi()),On(()=>{!Zt&&Io&&(Oo(!1),Mo(null),No.current=!1)},[Zt]),On(()=>{if(!ao)return Po.current&&St({type:"setUi",ui:{leftSideBarVisible:!1}}),void(Po.current=!1);Io&&(Oo(!1),Mo(null),Po.current=No.current,No.current=!1),Zt||(Po.current=!0,St({type:"setUi",ui:{leftSideBarVisible:!0}}))},[ao]),On(()=>{!Zt&&ao&&(Po.current=!1,po())},[Zt]),On(()=>{if(!ao||!bo)return;const e=e=>{"Escape"===e.key&&po()};return bo.addEventListener("keydown",e),()=>bo.removeEventListener("keydown",e)},[ao,bo]),we(null!==ao,()=>po());const Or=_(),Nr=(e,n="success",t)=>{if(Or)return void(t?Or(e,"error"===n?"error":"info",t):Or(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?jn.error(e,{...o,duration:t?.duration??3200}):jn.success(e,{...o,duration:t?.duration??1900})},Pr=Cn(null),[$r,Mr]=In(0),[jr,Tr]=In(0),Ar=ee(),Er=Cn(null),Lr=e=>Math.max(0,e.clientHeight-(Er.current?.offsetHeight??0));On(()=>{const e=Pr.current;if(!e)return;const n=()=>{Mr(e.clientWidth),Tr(Lr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Er.current&&t.observe(Er.current),()=>t.disconnect()},[]),Pn(()=>{Pr.current&&(Mr(Pr.current.clientWidth),Tr(Lr(Pr.current)))},[kr,Zt,_t]);const Rr=io===oo?$r>0?$r:no[oo]:no[io],Vr=$r>0?Math.min($r/Rr,"shrink"===ro?1:2):1,Fr=Rr*Vr,Dr=$r>0&&Fr>$r+1,Hr={width:Fr,height:jr||"100%",flex:"none",position:"relative"},Wr={width:Rr,height:jr?jr/Vr:"100%",maxHeight:"none",transform:1!==Vr?`scale(${Vr})`:void 0,transformOrigin:"top left"},Gr=()=>St({type:"setUi",ui:{leftSideBarVisible:!Zt}}),Ur=()=>St({type:"setUi",ui:{rightSideBarVisible:!_t}}),Jr=e=>{Io&&(Oo(!1),Mo(null),No.current=!1,Zt&&mo===e)||ao&&(Po.current=!1,po(),Zt&&mo===e)||(Zt&&mo===e?Gr():(go(e),Zt||St({type:"setUi",ui:{leftSideBarVisible:!0}})))},Yr=()=>{P(un,{accept:"image/*",title:Ht.mediaLibrary})},Xr=()=>{Eo(Y),qt.select(null),u()},Kr=()=>{Eo(Pt??Y),_t||St({type:"setUi",ui:{rightSideBarVisible:!0}})},qr=yt.data.content??[],Qr=()=>{const e=qr.findIndex($t),n=qr.findIndex(Mt);return{floor:e>=0?e+1:0,cap:n>=0?n:qr.length}},Zr=bt,_r=Qo.stripCopy,ei=n=>e(n,_r),ni=x(),ti=Ee({data:yt.data,config:Zr,readOnly:Boolean(at),clipboard:ni,strip:_r?e=>_r(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==kn||e.slot!==vn)return{min:0,max:n-1};const{floor:t,cap:o}=Qr();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Eo(Y);const t=void 0===n||"node"===n?.kind?n:null;qt.commitDocument(e,t)}}),oi=e=>{const n=xn(yt.data,bt,e);if(!n)return!1;const t=wn(n.place),o=n.node,r=t===ce?di(o):bi(o);return!!ti.remove(e)&&(Nr(At.deleted({name:r}),"success",{duration:8e3,action:{label:At.bar.undo,onClick:()=>{ti.restore(n.node,n.place)}}}),!0)},ri={...ti,remove:oi},ii=e=>ir(e,"block",bt.components[e]?.label??e),li=Nn(e=>bt.components[e]?.defaultProps??{},[bt]),si=e=>ir(e,"section",ii(e)),di=e=>l({type:e.type,props:e.props??{}},si(e.type),dr),{nodeAddresses:ci,zoneItems:ai}=Bn(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=pe)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of ue(bt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(qr,ce,0),{nodeAddresses:e,zoneItems:n}},[qr,bt]),pi=Nn(e=>ai.get(e)??[],[ai]),ui=e=>{const n=ci.get(e);return n?pi(n.zone)[n.index]:void 0},fi=e=>de(Qo,bt,e),hi=e=>{if(!Qo.slotsOf||e===ce)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=ui(e.slice(0,n));if(!t)return null;const o=fi(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}},mi=(()=>{if(!ne(Ao))return null;const e=`${Ao.nodeId}:${Ao.slot}`;return hi(e)?.slot.panel===Ao.kind?e:null})(),gi=Cn(null);On(()=>{const e=gi.current;if(gi.current=null,!mi||!ne(Ao))return;const n=Ao.nodeId;Ho(n,{scroll:e!==mi}),Sr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Ao]);const yi=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=ci.get(e);n&&(n.zone===ce?Li(n.index):pl(n.zone,n.index,e,ui(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&mi!==i&&(gi.current=i),Jo(null,r),_t||St({type:"setUi",ui:{rightSideBarVisible:!0}}),Ei(o)},Si=(e,n,t)=>{const o=`${e}:${n}`;if(Sr(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;mi!==o&&(gi.current=o);Jo(null,{kind:t,nodeId:e,slot:n})},ki=(e,n,t)=>{if(at||!Qo.moveSlot)return;const o=ui(e),r=o?fi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Zn,index:n},s=an(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=Qo.moveSlot(e,n,s);"string"==typeof d&&Si(e,d,i.panel)},vi=sr(),wi=Bn(()=>{const e=/* @__PURE__ */new Map;for(const n of vi??[])e.set(n.slug,n.name);return e},[vi]),bi=e=>s(e,ii,rr.plainText,e=>wi.get(e),rr.rowName),xi=(e,n)=>{const t=bt.components[e.type]?.fields,o=n===ce||Ml(n)?"section":"block",r=n===ce&&($t(e)||Mt(e)||It(e.type)),i="block"===o?d(t):r?null:c(t);return rr.renamePropOf?rr.renamePropOf(e,o,i):i},zi=(e,n,t,o)=>{if(!(!at&&ur?.zone===e&&ur.index===n))return;const r=(t,o)=>{fr(null),o&&((e,n,t)=>{const o=pi(e)[n];if(!o)return;const r=xi(o,e);r&&qt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
9
+ return Wn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":At.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)},Ci=t(te(),Dt),Bi=Ci.scope({target:gn,siteId:nt,docId:yn}),Ii=bt,Oi=(e,n)=>n===ce?si(e):ii(e),Ni=(e,n,t)=>{const o=Ci.plan(Bi,t,Oi(t.type,e),Ii);o&&(o.changed&&qt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Nr(o.message))},Pi=z({nodesIn:pi,nodeAt:(e,n)=>pi(e)[n]??null,labelOf:(e,n)=>n===ce?si(e):ii(e),renamePropOf:xi,beginRename:(e,n)=>fr({zone:e,index:n}),history:{hasPast:kt.hasPast,hasFuture:kt.hasFuture,back:()=>kt.back(),forward:()=>kt.forward()},openPageSettings:()=>{qt.select(null),Eo(Y)},pageSettingsLabel:At.pageSettings,words:{menu:Ft,styleClipboard:Dt,screen:At.menu},readOnly:Boolean(at),collapseAll:()=>Sr(new Set(pi(ce).map(e=>String(e.props.id)))),onPasteRefused:e=>Nr(e?At.pasteRefused({name:e.label}):At.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Al(e,n),menuRows:Xo.menuRows,isLocked:e=>Zo(e.type),duplicateBlocked:e=>_o(yt.data,e),permits:e=>ae(bt,e.type),nodeOps:ri,isPinned:(e,n)=>n===ce&&($t(e)||Mt(e)),sectionBand:Qr,locate:e=>ci.get(e)??null,rowNameOf:(e,n)=>n===ce?di(e):bi(e),selectAt:(e,n,t,o)=>{e===ce?Li(n):pl(e,n,t,o??"")},slotRung:e=>{const n=hi(e);return n?.slot.panel?{label:n.slot.label,select:()=>yi(n.node,n.slot,!1)}:null},style:{held:()=>$(Bi),canCopy:e=>Ci.rows(Ii,e).some(e=>!1!==e.counted),copy:(e,n)=>Ci.copy(Bi,e,Oi(e.type,n),Ii),paste:(e,n,t)=>Ni(e,n,t)},keys:ft?{target:bo,selected:()=>{const e=yt.ui.itemSelector;return e?{zone:e.zone??ce,index:e.index}:null},held:()=>ni.get(),readOnly:Boolean(at),onDone:({done:e,name:n})=>{"copied"===e&&Nr(At.copied({name:n}))}}:void 0},wo),$i=Cn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});On(()=>{$i.current={copy:(e,n)=>Ci.copy(Bi,e,Oi(e.type,n),Ii),paste:Ni,at:()=>{const e=yt.ui.itemSelector;if(!e)return null;const n=e.zone??ce,t=pi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(at)}});const Mi=Nn(e=>{const n=M(e);if(!n)return;const t=$i.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);On(()=>{if(!bo)return;const e=e=>Mi(e);return bo.addEventListener("keydown",e),()=>bo.removeEventListener("keydown",e)},[Mi,bo]),hn(wo,"keydown",Mi);const ji=qr.map(e=>e.props.id).join("|");On(()=>{const e=wo?.document??null,n=wo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void To(e=>e.length?[]:e);const n=qr.findIndex(Mt),t=n>=0?n:qr.length,o=n=>{const t=qr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(fn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=qr.length>0&&!$t(qr[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=Qn(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})}To(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[wo,ji,io,Vr,Zt,_t,vt?.props.id]);const Ti=wo?.document??null,Ai=wo?.window??null;On(()=>{const e=ko.current;if(!e||!Ti||!Ai)return;const n=[],t=()=>{const n=Ti.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Ai.scrollTo({left:Ai.scrollX,top:Ai.scrollY+t,behavior:"instant"}),!0};return ko.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Ti,Ai]);const Ei=e=>{Xo.holdCanvasOn?Xo.holdCanvasOn(e):a(e)},Li=e=>{Eo(Y),qt.select({index:e}),Xo.sectionPressed?.(qr[e]);const n=qr[e]?.props?.id;n&&Ei(n)},Ri=e=>{const{floor:n,cap:t}=Qr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=vt&&Ao.kind!==Pt?.kind?qr.findIndex(e=>e.props.id===vt.props.id):-1;return o(r>=0?r+1:t)},Vi=(e,n)=>{const{floor:t,cap:o}=Qr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(qt.reorderComponent(ce,e,i),qt.select({index:i}),{moved:!0,dest:i})},Fi=(e,n,t,o)=>{Eo(Y),qt.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),Nr(At.sectionAdded({name:t}))},Di=(e,n)=>{const t=Ri(n),o=nr(e,{nodeDefaults:li,newNodeId:ge,sectionLabel:si,blockIsOffered:or}),r=o?qt.insertNode(ce,t,o):qt.insertSection(e,t);return Fi(t,r,si(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 ue(bt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=tr(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},Hi=e=>Wi(ce,e),Wi=(e,n)=>{Ir.current=document.activeElement??null,ao&&(No.current=Po.current,Po.current=!1,po()),Mo(null===n?null:{zone:e,index:n}),Oo(!0),Zt||(No.current=!0,St({type:"setUi",ui:{leftSideBarVisible:!0}}))},Gi=()=>{Oo(!1),Mo(null),No.current&&St({type:"setUi",ui:{leftSideBarVisible:!1}}),No.current=!1},Ui=(e,n)=>rr.rowName?n?$t(e)?rr.rowName(e,"section",At.header):Mt(e)?rr.rowName(e,"section",At.footer):It(e.type)?rr.rowName(e,"section",ii(e.type)):di(e):bi(e):n?si(e.type):ii(e.type),Ji=e=>n=>{e()},Yi=()=>Xo.editPinnedSource?.(),Xi=(e,n,t)=>{if(at)return null;const o=pi(e)[n];return o&&!ae(bt,o.type).delete?null:/* @__PURE__ */Wn($e,{kind:"delete",label:At.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=pi(e)[n]?.props?.id;null!=t&&oi(String(t))})(e,n),children:/* @__PURE__ */Wn(Vn,{size:15})})},Ki=e=>rr.rowPreview?.(e)||void 0,qi=e=>rr.rowMarks?.(e)??void 0,Qi=(e,n,t)=>rr.rowActions?.(e,n,t)??null,Zi=(e,n,t,o)=>{if(at)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
10
+ return Wn($e,{kind:"eye",label:r?At.showNamed({name:o}):At.hideNamed({name:o}),onClick:()=>el(e,n,t),children:/* @__PURE__ */Wn(r?Fn:Dn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},_i=e=>ps(ce,e),el=(e,n,t)=>{qt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},nl=e=>fe(bt,e),tl=e=>ue(bt,e),ol=e=>Qo.slotsOf?fi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:he(e,n.slot)})):[{slot:null,rung:null,kids:tl(e)}],rl=e=>Qo.slotsOf?ol(e).flatMap(e=>e.kids):tl(e),il=e=>Boolean(Qo.slotsOf)&&fi(e).some(e=>e.rung),ll=(e,n,t)=>null===t?void 0===n?tr(e):tr(e,n):tr(e,n,t),sl=(e,n,t)=>{const o=me(bt,e.type,n)&&(t||rl(e).length>0||il(e));return{collapsible:o,folded:o&&zr(String(e.props.id))}},dl=(e,n,t)=>ol(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>sl(e,r,t(e.type)).collapsible?[String(e.props.id),...dl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),cl=e=>rl(e).length>0||il(e)||Boolean(tr(e.type)),al=e=>Boolean(tr(e)),pl=(e,n,t,o)=>{if(Eo(Y),tr(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),qt.select({index:n,zone:e}),a(t)}else qt.select({index:n,zone:e}),Ei(t)},ul=(e,n,t,o,r)=>{const i=`${e}:${n}`;qt.insertComponent(i,t,o),tr(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),qt.select({index:o,zone:i})}):qt.select({index:o,zone:i})},fl=Cn(/* @__PURE__ */new Set);On(()=>{qr.forEach(e=>{const n=tr(e.type)?.spec;if(!n)return;const t=e.props.id;if(fl.current.has(t))return;fl.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(li)).forEach((e,t)=>Yt.seedChild(o,t,n.childType,e))})},[qr,Yt,li]);const hl=Cn(/* @__PURE__ */new Set);On(()=>{qr.forEach((e,t)=>{const o=e.props.id;if(hl.current.has(o))return;const r=n(e,nl(e.type));hl.current.add(o),r&&Yt.replaceComponent(ce,t,{...e,props:r})})},[qr,Yt]),oe(Yt,bt);const ml=qr.findIndex(Mt),gl=ml>=0?qr[ml]:null,yl=jt?qr.findIndex($t):-1,Sl=yl>=0?qr[yl]:null,kl=xt.groupTab,vl=Bn(()=>kl?e=>It(e.type):void 0,[kl]),wl=Boolean(xt.groupBadge),bl=xt.groupBadge?/* @__PURE__ */Wn("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Wn(Mn,{tone:"info",size:"xs",children:xt.groupBadge})}):void 0,xl=qr.find(e=>e.type===Ct)??null,zl=qr.find(e=>e.type===Bt)??null,Cl=ml>=0?ml:qr.length,Bl=[];qr.forEach(e=>{Mt(e)||(cl(e)&&Bl.push(String(e.props.id)),Bl.push(...dl(e,1,al)))}),gl&&(Bl.push(String(gl.props.id)),Bl.push(...dl(gl,1,al)));const Il=Bl.length>0&&Bl.every(e=>yr.has(e)),Ol=e=>{const n=rr.blockRowName(e,ii);return rr.rowName?rr.rowName(e,"block",n):n},Nl=(e,n,t,o)=>{const r=pi(e)[t];if(!r)return;const i={...bn(e),index:t},l={...bn(n),index:Math.min(Math.max(o,0),pi(n).length)},s=an(i,l);if(e!==n||s!==t)try{ti.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof zn))throw e}},Pl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of tl(e))n.add(r),t(o)};for(const t of nl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},$l=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=ci.get(n);if(!e)return null;if(e.zone===ce)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Ml=e=>{const n=e.slice(0,e.indexOf(":")),t=qr.find(e=>It(e.type)&&String(e.props.id)===n);return t&&Ot(n)===e?t:null},jl=(e,n)=>{const t=Ml(e);return!t||(!xt.groupAccepts||xt.groupAccepts(t.type,n,pi(e).length))},Tl=(e,n,t)=>{if(e.rung){const t=ui(e.rung.nodeId),o=t?fi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Zn&&n.index>=0&&n.index<=o}if(n.slot===Zn)return!1;if(e.add)return Ll(e.add,n);const o=wn(n);if(It(e.type))return!1;const r=Ml(o),i=Ml(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!jl(o,e.type))&&(n.index>=0&&n.index<=pi(o).length));if(e.zone===ce||o===ce){if(e.zone!==o)return!1;const{floor:t,cap:r}=Qr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>pi(o).length)return!1;if(e.zone===o)return!0;const l=gl&&!xt.lastIsOpen?String(gl.props.id):null;return(!l||$l(e.zone)!==l&&$l(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??pi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=ci.get(i),s=l?pi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Pl(r).has(n))return!1;const d=tr(s.type,er(yt?.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?.(pi(n),r))})(e.zone,o,e.index,t)},Al=(e,n)=>{const t=wn(e.from),o=e.node;return t===wn(n)?jl(t,o.type):Tl({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},El=e=>{const n=e.slice(0,e.indexOf(":")),t=ci.get(n),o=t?pi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=tr(o.type,er(yt?.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:ii(r.spec.childType)}]:[]),l=hi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Ui(o,t.zone===ce)}},Ll=(e,n)=>{const t=wn(n);if("block"!==e.kind){if(Ml(t)){const o="section"===e.kind?e.type:e.template.node.type;return jl(t,o)&&n.index>=0&&n.index<=pi(t).length}if(t!==ce)return!1;const{floor:o,cap:r}=Qr();return n.index>=o&&n.index<=r}if(t===ce)return!1;const o=El(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(pi(t))},Rl=(e,n)=>{if("block"!==e.kind&&Ml(wn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&jl(n,o)){if("section"===e.kind)qt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;qt.insertNode(n,t,ei(e.template.node))}Eo(Y),qt.select({index:t,zone:n})}})(e,wn(n),n.index);if("section"===e.kind)return void Di(e.type,n.index);if("template"===e.kind)return void((e,n,t)=>{const o=Ri(t),r=qt.insertNode(ce,o,n);Fi(o,r,e)})(e.template.name,ei(e.template.node),n.index);const t=wn(n),o=El(t);o&&(o.target.spec?ul(o.parentId,o.target.slot,e.type,n.index,o.parent.type):((e,n,t)=>{qt.insertComponent(e,n,t),Eo(Y),qt.select({index:t,zone:e})})(t,e.type,n.index))},Vl=(e,n)=>{e.rung?ki(e.rung.nodeId,e.index,n.index):e.add?Rl(e.add,n):e.zone===ce?Vi(e.index,n.index):Nl(e.zone,wn(n),e.index,n.index)},[Fl]=In(()=>dn()),Dl=cn({keyOf:e=>e.id,readOnly:Boolean(at),session:Fl,canDrop:Tl,onDrop:Vl,onStep:(e,n)=>{e.rung?ki(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===ce?((e,n)=>{const t=si(qr[e]?.type??""),o=Vi(e,n<0?e-1:e+2);if(!o.moved)return void Nr(n<0?At.sectionFirst({name:t}):At.sectionLast({name:t}));const{floor:r,cap:i}=Qr();Nr(At.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Nl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),Hl=Nn(e=>{const{floor:n,cap:t}=Qr(),o=[];for(const r of e.nodes){const e=wn(r.place),i=pi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if($t(i)||Mt(i)||Zo(i.type))continue;if(It(i.type))continue;const l=Boolean(Ml(e)),s=e===ce||l;e===ce&&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?si(i.type):bi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=wn(e.list);return n===ce&&0===e.children.length?[{...e,addLabel:At.addSection,addAlways:!0}]:e.children.length>0||Boolean(El(n)?.choices.length)||Boolean(Ml(n))?[e]:[]}),i=r.flatMap(e=>{const n=wn(e.list);return n===ce||Ml(n)||!El(n)?.choices.length?[]:on(e,At.addBlockHere)});return{sources:o,zones:r,seams:i}},[yt.data]),Wl=null==vt?.props.id?null:String(vt.props.id),Gl=Nn(e=>{const n=bt,t=e=>!e.item.rung&&null!==xn(yt.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(Wl);return i||(r(Le(yt.data,n,o.item.id,Wl,vl))??o)},[yt.data,bt,Wl,vl]),[Ul,Jl]=In(null);hn(wo,"mouseover",e=>{if(!kl)return;const n=mn(e.target),t=n?Yn(yt.data,bt,n):null;t!==Ul&&Jl(t)}),hn(wo,"mouseout",e=>{kl&&!e.relatedTarget&&Jl(null)});const Yl=e=>$t(e)||Mt(e)||It(e.type),Xl=[];if(kl){const e=Wl?Yn(yt.data,bt,Wl):null;for(const n of/* @__PURE__ */new Set([e,Ul])){const e=n?qr.find(e=>String(e.props.id)===n):void 0;if(!e||!Yl(e))continue;const t=kl(e);t&&Xl.push({id:String(e.props.id),label:t,below:$t(e)||e.type===Ct})}}const Kl=E(),ql=Cn(null);On(()=>{const e=xt.changeNotice;if(!e)return;const n=JSON.stringify(qr.filter(Yl)),t=ql.current;if(ql.current={doc:yn,bands:n,index:kt.index},!t||t.doc!==yn||t.bands===n)return;kt.hasPast&&kt.index>=t.index&&!Jn.has(Kl)&&(Jn.add(Kl),Nr(e,"success",{action:{label:At.bar.undo,onClick:()=>kt.back()},duration:8e3}))},[qr]);const Ql=e=>{Eo(Y),qt.select(e.zone===ce?{index:e.index}:{index:e.index,zone:e.zone})},Zl=re(),_l=()=>({data:yt.data,device:io,ops:qt,inspector:Yo}),es=Zl?.model,ns=Bn(()=>es?e=>es(e,Hl(e),_l()):Hl,[es,Hl,io]),ts=Zl?.measure,os=ts?(e,n)=>ts(e,n,_l()):void 0,rs=Zl?.canDrop,is=rs?(e,n)=>rs(e,n,Tl,_l()):Tl,ls=Zl?.drop,ss=ls?(e,n)=>ls(e,n,Vl,_l()):Vl,ds=Zl?.pick,cs=ds?e=>ds(e,Ql,_l()):Ql,as=e=>{const n=wn(e),t=hi(n);t&&yi(t.node,t.slot,!1),Wi(n,e.index)},ps=(e,n)=>/* @__PURE__ */Wn(Me,{...at?{}:Dl.seam({place:{...bn(e),index:n}})},`seam:${e}:${n}`),us={rowClick:Ji,isCollapsed:zr,toggleCollapse:Cr},fs=e=>{const n=String(e.props.id),t=qr.findIndex(e=>String(e.props.id)===n),o=Ot(n),r=pi(o),i=zr(n),l=ii(e.type),s=rr.rowName?rr.rowName(e,"section",l):l,d=e=>ps(o,e);/* @__PURE__ */
11
+ return Gn(Un,{children:[
12
+ /* @__PURE__ */Wn(Ie,{words:Et,icon:/* @__PURE__ */Wn(lr,{type:e.type,size:13}),name:s,preview:Ki(e),marks:qi(e),onSelect:()=>Li(t),nameSlot:zi(ce,t,n,s),selected:Ro===n,badge:bl,actions:Qi(e,ce,t)??void 0,rowProps:{"data-node-id":n,onClick:Ji(()=>Li(t))},fold:{open:!i,label:"section",onToggle:()=>Cr(n)}}),!i&&/* @__PURE__ */Gn(Oe,{children:[r.map((n,t)=>{const r=String(n.props.id),i=di(n),l=cl(n),s=l&&zr(r),c=()=>pl(o,t,r,e.type),{rowProps:a,...p}=Dl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...bn(o),index:t}},{"data-node-id":r,onClick:Ji(c)});/* @__PURE__ */
13
+ return Gn($n,{children:[d(t),
14
+ /* @__PURE__ */Wn(Ie,{words:Et,icon:/* @__PURE__ */Wn(lr,{type:n.type,size:13}),name:i,preview:Ki(n),marks:qi(n),onSelect:c,nameSlot:zi(o,t,r,i),selected:Ro===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Cr(r)}:void 0,actions:/* @__PURE__ */Gn(Un,{children:[Xi(o,t,i),Qi(n,o,t),Zi(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Wn(Oe,{children:gs(n,2)})]},r)}),d(r.length)]})]})},hs=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=Dl.dragging,d=!zr(l)&&s?.rung?.nodeId!==i,c={...bn(l),index:0},a=s&&!s.rung&&Tl(s,c)?c:void 0,p=()=>yi(e,n,!0),{rowProps:u,...f}=Dl.row({item:{id:`rung:${l}`,zone:`${i}:${Zn}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Zn,index:t},into:a,canDrag:Boolean(Qo.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Ji(p)}),h=at?null:Qo.slotActions?.(e,n.slot);/* @__PURE__ */
15
+ return Gn($n,{children:[n.heading,
16
+ /* @__PURE__ */Wn(Ie,{words:Et,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:mi===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Cr(l)},actions:h&&h.length>0?/* @__PURE__ */Wn(Un,{children:h.map((t,o)=>/* @__PURE__ */Wn($e,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(at||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Si(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */Wn(Vn,{size:15}):/* @__PURE__ */Wn(Hn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Wn(Oe,{children:r})]},l)},ms=(e,n)=>{const t=ol(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
17
+ return Wn(Un,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=ll(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=(e,n)=>ps(e,n),p=/* @__PURE__ */Gn(Un,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Ro===String(n.props.id),{collapsible:i,folded:s}=sl(n,l,al(n.type)),d=String(n.props.id),c=Ol(n),p=()=>pl(t,o,d,e.type),{rowProps:u,...f}=Dl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...bn(t),index:o}},{"data-node-id":d,onClick:Ji(p)});/* @__PURE__ */
18
+ return Gn($n,{children:[0===o&&a(t,0),
19
+ /* @__PURE__ */Wn(Ie,{words:Et,icon:/* @__PURE__ */Wn(lr,{type:n.type,size:13}),name:c,preview:Ki(n),marks:qi(n),onSelect:p,nameSlot:zi(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Cr(d)}:void 0,actions:/* @__PURE__ */Gn(Un,{children:[Xi(t,o,c),Qi(n,t,o),Zi(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Wn(Oe,{children:ms(n,l+1)}),a(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?a(d,0):null:0!==i.length||!t.rung&&d!==c?null:a(c,0)]});return t.rung?hs(e,t.rung,r++,o,p):/* @__PURE__ */Wn($n,{children:p},t.slot??"")})})},gs=(e,n)=>{const t=er(yt?.data,e.type,String(e.props.id)),o=ol(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
20
+ return Wn(Un,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=ll(e.type,t,o.slot),c=d?.spec??null;!c||!Array.isArray(e.props[c.slot])||e.props[c.slot];const a=d&&d.choices?{slot:d.slot,choices:d.choices}:null,p=String(e.props.id),u=c&&!c.fixed?`${p}:${c.slot}`:null,f=a?`${p}:${a.slot}`:null,h=(e,n)=>ps(e,n),m=null===o.slot?null:`${p}:${o.slot}`,g=Boolean(c&&!c.fixed&&(null===m||m===u)),y=/* @__PURE__ */Gn(Un,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Ro===String(n.props.id),i=bi(n),l=String(n.props.id),{collapsible:d,folded:c}=sl(n,s,al(n.type)),a=nl(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...bn(p),index:pi(p).length}:void 0,f=Dl.dragging,m=u&&f&&Tl(f,u)?u:void 0,g=()=>pl(t,o,l,e.type),{rowProps:y,...S}=Dl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...bn(t),index:o},into:m,canDrag:!Zo(n.type)},{"data-node-id":l,onClick:Ji(g)});/* @__PURE__ */
21
+ return Gn($n,{children:[0===o&&h(t,0),
22
+ /* @__PURE__ */Wn(Ie,{words:Et,icon:/* @__PURE__ */Wn(lr,{type:n.type,size:13}),name:i,preview:Ki(n),marks:qi(n),onSelect:g,nameSlot:zi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...S,fold:d?{open:!c,label:"group",onToggle:()=>Cr(l)}:void 0,actions:Zo(n.type)?Qi(n,t,o)??void 0:/* @__PURE__ */Gn(Un,{children:[Xi(t,o,i),Qi(n,t,o),Zi(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Wn(Oe,{children:gs(n,s+1)}),h(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===m?f&&!l.some(e=>e.zone===f)?h(f,0):null:0!==l.length||(o.rung?g:m!==f)?null:h(m,0)]});return o.rung?hs(e,o.rung,i++,r,y):/* @__PURE__ */Wn($n,{children:y},o.slot??"")})})},ys=Io||null!==ao,Ss=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:Zt&&!ys&&qo===e.id,onSelect:()=>Jr(e.id)}:e,ks=[...(Xo.railLead??[]).map(Ss),{id:"sections",label:At.layers,icon:/* @__PURE__ */Wn(Re,{}),active:Zt&&!ys&&"sections"===qo,onSelect:()=>Jr("sections")},...(Xo.railTrail??[]).map(Ss)];co?ks.push({id:"media",label:At.railMedia,icon:/* @__PURE__ */Wn(Ve,{}),active:Zt&&!Io&&(null!==ao||"media"===qo),onSelect:()=>Jr("media")}):ht&&ks.push({id:"media",label:At.railMedia,icon:/* @__PURE__ */Wn(Ve,{}),onSelect:Yr});const vs=[...Xo.railLead??[],...Xo.railTrail??[]].find(e=>"panel"in e&&e.id===qo),ws=Boolean(Tt?.foldable)&&!Ko,bs=Tt?.label??(mt?At.pageSections:At.templateSections),xs=ws&&zr(_n),zs=/* @__PURE__ */Gn(Un,{children:[qr.map((e,n)=>{if($t(e)||Mt(e)||It(e.type))return null;const t=Ro===String(e.props.id),o=Boolean(e.props._hidden);tl(e);const r=String(e.props.id),i=Xo.hasOwnRows?.(e)??!1,l=cl(e)||i,s=l&&zr(r),d=nl(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...bn(c),index:pi(c).length}:void 0,p=Dl.dragging,u=a&&p&&Tl(p,a)?a:void 0,{rowProps:f,...h}=Dl.row({item:{id:r,zone:ce,index:n,type:e.type},place:{...bn(ce),index:n},into:u},{"data-node-id":r,onClick:Ji(()=>Li(n))});/* @__PURE__ */
23
+ return Gn($n,{children:[n>0&&_i(n),
24
+ /* @__PURE__ */Wn(Ie,{words:Et,icon:/* @__PURE__ */Wn(lr,{type:e.type,size:13}),name:di(e),preview:Ki(e),marks:qi(e),onSelect:()=>Li(n),nameSlot:zi(ce,n,r,di(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Cr(r)}:void 0,actions:/* @__PURE__ */Gn(Un,{children:[Xi(ce,n,di(e)),Qi(e,ce,n),Zi(ce,n,e,di(e))]}),rowProps:f}),cl(e)&&!s&&/* @__PURE__ */Gn(Oe,{children:[gs(e,1),Xo.partRows?.(e,us)]}),i&&!s&&/* @__PURE__ */Wn(Oe,{children:Xo.ownRows?.(e,n,us)})]},String(e.props.id??n))}),!Ko&&Cl>0&&_i(Cl)]}),Cs=(e,n,t)=>{const o=String(e.props.id),r=rl(e).length>0||il(e)||Boolean(tr(e.type)),i=r&&zr(o),l="header"===t?At.header:At.footer,s=rr.rowName?rr.rowName(e,"section",l):l;/* @__PURE__ */
25
+ return Gn(Un,{children:[
26
+ /* @__PURE__ */Wn(Ie,{words:Et,icon:/* @__PURE__ */Wn(lr,{type:t,size:13}),name:s,preview:Ki(e),marks:qi(e),badge:bl,onSelect:()=>Li(n),nameSlot:zi(ce,n,o,s),selected:Ro===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Cr(o)}:void 0,actions:Qi(e,ce,n)??void 0,rowProps:{"data-node-id":o,onClick:Ji(()=>Li(n))}}),r&&!i&&/* @__PURE__ */Wn(Oe,{children:ms(e,1)})]})};return(Xo.wrap??(e=>e))(
27
+ /* @__PURE__ */Wn(ie,{target:wo,children:/* @__PURE__ */Gn("div",{ref:vo,className:"sf-editor es-editor",style:qe(kr),onContextMenu:Pi.onEditorContextMenu,...g(un),children:[
28
+ /* @__PURE__ */Gn(Fe,{children:[
29
+ /* @__PURE__ */Wn(De,{items:ks,ariaLabel:At.bar.views}),
30
+ /* @__PURE__ */Gn(He,{children:[
31
+ /* @__PURE__ */Wn(We,{label:At.bar.undo,disabled:Boolean(at)||!kt.hasPast,onClick:()=>kt.back(),children:/* @__PURE__ */Wn(An,{})}),
32
+ /* @__PURE__ */Wn(We,{label:At.bar.redo,disabled:Boolean(at)||!kt.hasFuture,onClick:()=>kt.forward(),children:/* @__PURE__ */Wn(En,{})}),
33
+ /* @__PURE__ */Wn(Ge,{}),
34
+ /* @__PURE__ */Wn(Ue,{devices:eo,value:io,onChange:lo}),
35
+ /* @__PURE__ */Wn(We,{label:At.bar.refresh,tip:At.bar.refreshTip,onClick:()=>{ko.current=(()=>{const e=wo?.document;if(!e)return null;const n=qr.findIndex(Mt),t=n>=0?n:qr.length;let o=null;for(let n=0;n<t;n++){const t=qr[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=vt?.props?.id??qr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),So(e=>e+1)},children:/* @__PURE__ */Wn(Ln,{})})]}),
36
+ /* @__PURE__ */Gn(He,{kind:"right",style:{minWidth:300},children:[
37
+ /* @__PURE__ */Wn(B,{input:Co,words:At.saveStatus}),Xo.barLead?.(),Xo.barTrail?.(),Xo.mainAction||!Xo.barMain?/* @__PURE__ */Wn(I,{input:Co,action:Xo.mainAction??{label:At.done,onPress:()=>{tt(yt.data)}},readOnly:Boolean(at),saveSwitch:ut,onToggleAutoSave:lt,onSaveNow:Bo,bar:At.bar,words:At.saveStatus}):Xo.barMain()]})]}),
38
+ /* @__PURE__ */Wn(C,{}),
39
+ /* @__PURE__ */Gn("div",{className:"sf-body",children:[Zt?/* @__PURE__ */Gn(Un,{children:[
40
+ /* @__PURE__ */Wn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":At.leftPanel,children:Io?/* @__PURE__ */Wn(j,{at:$o?{label:(e=>{const n=Ml(e.zone);if(n)return At.add.addingTo({name:rr.rowName?Ui(n,!0):ii(n.type)});if(e.zone===ce){const n=qr[e.index];return n&&!Mt(n)?At.add.addingBefore({name:Ui(n,!0)}):At.add.addingAtEnd}const t=El(e.zone);return t?At.add.addingTo({name:t.parentName}):At.add.addingHere})($o),onClear:()=>Mo(null)}:void 0,placeBlocks:$o&&$o.zone!==ce?El($o.zone)?.choices:void 0,canTake:$o?e=>{if(!$o)return null;const n={...bn($o.zone),index:$o.index};if(Ll(e,n))return null;const t=Ml($o.zone);if(t)return At.add.notInside({name:Ui(t,!0)});if($o.zone===ce)return At.add.onlySections;const o=El($o.zone);return o?At.add.notInside({name:o.parentName}):At.add.onlySections}:void 0,onPick:$o?e=>{if(!$o)return;const n={...bn($o.zone),index:$o.index};Ll(e,n)&&(Rl(e,n),Gi())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Fl,siteWide:Xo.addPanelRow?.(Gi),onClose:Gi,onHide:Gr,readOnly:Boolean(at)}):ao&&so?
41
+ /* @__PURE__ */Wn(L,{panel:so,pick:ao,onHide:Gr}):vs?vs.panel({onHide:Gr,notify:Nr}):"media"===qo&&so?/* @__PURE__ */Wn(L,{panel:so,pick:null,onHide:Gr}):/* @__PURE__ */Gn(Un,{children:[
42
+ /* @__PURE__ */Wn(T,{icon:/* @__PURE__ */Wn(Re,{}),title:At.layers,context:Wt,actions:/* @__PURE__ */Gn(Un,{children:[!at&&/* @__PURE__ */Wn(Je,{label:At.add.title,onClick:()=>Hi(null),children:/* @__PURE__ */Wn(Rn,{size:15})}),
43
+ /* @__PURE__ */Wn(Je,{label:Il?At.expandAll:At.collapseAll,title:0===Bl.length?At.nothingToFold:void 0,disabled:0===Bl.length,onClick:()=>Sr(e=>{const n=new Set(Bl);return Il?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Bl])}),children:/* @__PURE__ */Wn(Kn,{expand:Il})})]}),onHide:Gr}),
44
+ /* @__PURE__ */Gn(Ne,{className:"sf-tree sf-scroll",words:Et,children:[
45
+ /* @__PURE__ */Wn(Ie,{words:Et,icon:/* @__PURE__ */Wn(lr,{type:"page",size:13}),name:At.pageSettings,onSelect:Xr,selected:!vt&&Lo,rowProps:{onClick:Ji(Xr)}}),xl&&/* @__PURE__ */Gn(Un,{children:[!wl&&/* @__PURE__ */Wn(Pe,{children:At.header}),fs(xl)]}),!Ko&&gt&&!(wl&&xl)&&/* @__PURE__ */Gn(Un,{children:[!wl&&/* @__PURE__ */Wn(Pe,{children:At.header}),!jt&&/* @__PURE__ */Wn(Ie,{words:Et,icon:/* @__PURE__ */Wn(lr,{type:"header",size:13}),name:At.header,badge:bl,onSelect:Kr,selected:Ao.kind===Pt?.kind,rowProps:{onClick:Ji(Kr)}})]}),!Ko&&Sl&&!(wl&&xl)&&Cs(Sl,yl,"header"),!Ko&&!ws&&/* @__PURE__ */Wn(Pe,{children:bs}),ws?/* @__PURE__ */Gn(Un,{children:[
46
+ /* @__PURE__ */Wn(Ie,{words:Et,icon:null,name:bs,fold:{open:!xs,label:bs,onToggle:()=>Cr(_n)}}),!xs&&/* @__PURE__ */Wn(Oe,{children:zs})]}):zs,gt&&!wl&&/* @__PURE__ */Wn(Pe,{children:At.footer}),gl&&!(wl&&zl)&&Cs(gl,ml,"footer"),!Ko&&!gl&&gt&&!wl&&/* @__PURE__ */Wn(Ie,{words:Et,icon:/* @__PURE__ */Wn(lr,{type:"footer",size:13}),name:At.footer,onSelect:Yi,rowProps:{onClick:Ji(Yi),title:At.editFooter}}),zl&&fs(zl),Xo.treeFoot?.()]})]})}),
47
+ /* @__PURE__ */Wn(Ye,{side:"left",width:kr.left,min:Ke,max:Xe,defaultWidth:k.left,label:At.resizeLeftPanel,onResize:br})]}):/* @__PURE__ */Wn(A,{side:"left",onShow:Gr}),
48
+ /* @__PURE__ */Gn("div",{ref:Pr,className:"sf-center sf-scroll","data-sf-canvas-head":Ar?"":void 0,style:{overflowX:Dr?"auto":"hidden",overflowY:"hidden"},children:[Ar&&/* @__PURE__ */Wn("div",{ref:Er,className:"sf-canvas-head",children:/* @__PURE__ */Wn(Ar,{device:io})}),
49
+ /* @__PURE__ */Gn("div",{className:"sf-frame-scaler",style:Hr,children:[
50
+ /* @__PURE__ */Wn("div",{className:"sf-frame "+(io===oo?"":`sf-frame--${io}`),style:Wr,children:/* @__PURE__ */Gn("div",{className:"sf-preview-host",children:[
51
+ /* @__PURE__ */Wn(Be.Provider,{value:vl,children:/* @__PURE__ */Wn(Gt,{},yo)}),
52
+ /* @__PURE__ */Wn(rn,{canvas:wo,session:Fl,model:ns,measure:os,canDrop:is,onDrop:ss,choose:Gl,onPick:cs,onZoneAdd:as,onSeamAdd:as,zoneAddLabel:At.canvasAddBlock,words:Lt.canvas,readOnly:Boolean(at),revision:yt.data}),jo.length>0&&/* @__PURE__ */Wn("div",{className:"sf-preview-gaps",children:jo.map(e=>
53
+ /* @__PURE__ */Wn(ln,{index:e.index,label:At.addSectionHere,onInsert:()=>Hi(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))})]})}),kl?/* @__PURE__ */Wn(Xn,{canvas:wo,tabs:Xl,onSelect:e=>{const n=qr.findIndex(n=>String(n.props.id)===e);n>=0&&Li(n)}}):null]})]}),_t?/* @__PURE__ */Gn(Un,{children:[
54
+ /* @__PURE__ */Wn(y,{value:{selectChild:pl,addChild:ul,childRowName:bi,blockRowName:Ol},children:/* @__PURE__ */Wn(Ut,{mode:Ao,onOpenWebsiteSettings:Xo.openSettings??(()=>{}),onOpenSiteStyles:Xo.openStyles,onSelectNode:ar,onNotify:Nr,onHidePanel:Ur,nodeActions:vt?ae(bt,vt.type):et})}),
55
+ /* @__PURE__ */Wn(Ye,{side:"right",width:kr.right,min:Ke,max:Xe,defaultWidth:k.right,label:At.resizeSettingsPanel,onResize:xr})]}):
56
+ /* @__PURE__ */Wn(A,{side:"right",onShow:Ur})]}),Pi.menu]})}))}export{nt as ScreenChrome};
@@ -1 +1 @@
1
- import{useScreenDocument as n}from"./chunk-THZ46DC5.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-JTUUIVBZ.js";import{EditNotice as r}from"./chunk-IE55HNMA.js";import{useWords as e}from"./chunk-MFIRYGHW.js";import{jsx as i}from"react/jsx-runtime";function t(){const{capabilities:t,access:c,takeOverEditing:a,viewReadOnly:s,saveConflict:m,reloadFromServer:u}=n(),{noun:l}=e("screen",o);return t.hasEditGuard?/* @__PURE__ */i(r,{access:c,conflict:m,noun:l,onTakeOver:a,onViewReadOnly:s,onReload:u}):null}export{t as PageEditGuardNotices};
1
+ import{useScreenDocument as n}from"./chunk-GCCBEY2W.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VWXUMVCD.js";import{EditNotice as r}from"./chunk-IE55HNMA.js";import{useWords as e}from"./chunk-MFIRYGHW.js";import{jsx as i}from"react/jsx-runtime";function t(){const{capabilities:t,access:c,takeOverEditing:a,viewReadOnly:s,saveConflict:m,reloadFromServer:u}=n(),{noun:l}=e("screen",o);return t.hasEditGuard?/* @__PURE__ */i(r,{access:c,conflict:m,noun:l,onTakeOver:a,onViewReadOnly:s,onReload:u}):null}export{t as PageEditGuardNotices};
@@ -1,2 +1,2 @@
1
- import{noControlField as e}from"./chunk-7F52SZOI.js";import{usePreviewDevice as n}from"./chunk-BSPCSC45.js";import{DEFAULT_SCREEN_WORDS as r}from"./chunk-JTUUIVBZ.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{jsx as o}from"react/jsx-runtime";function i(e){return"mobile"===e?"mobile":"desktop"}var c={desktop:null,tablet:r.deviceNote.tablet,mobile:r.deviceNote.mobile},u="data-sf-device-hidden";function d(){/* @__PURE__ */
1
+ import{noControlField as e}from"./chunk-7F52SZOI.js";import{usePreviewDevice as n}from"./chunk-BSPCSC45.js";import{DEFAULT_SCREEN_WORDS as r}from"./chunk-VWXUMVCD.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{jsx as o}from"react/jsx-runtime";function i(e){return"mobile"===e?"mobile":"desktop"}var c={desktop:null,tablet:r.deviceNote.tablet,mobile:r.deviceNote.mobile},u="data-sf-device-hidden";function d(){/* @__PURE__ */
2
2
  return o("span",{hidden:!0,[u]:""})}function s({tier:e,render:r,...t}){return i(n())===e?/* @__PURE__ */o(r,{...t}):/* @__PURE__ */o(d,{})}var m="__device";function f(e){const n=e?.[m];return n??null}function l(e){return f(e)?.inner??e}function a(e,n){const r=n.render;return{...n,[m]:{tier:e,inner:n},render:n=>/* @__PURE__ */o(s,{tier:e,render:r,...n})}}function p(){const e=t("screen",r).deviceNote,i=n(),c="desktop"===i?null:e[i];return c?/* @__PURE__ */o("div",{className:"sf-device-scope",children:c}):/* @__PURE__ */o(d,{})}function v(){return e({type:"custom",render:()=>/* @__PURE__ */o(p,{})},"always")}export{m as DEVICE_FIELD_MARKER,u as DEVICE_HIDDEN_ATTR,c as DEVICE_NOTE,a as deviceField,f as deviceMetaOf,v as deviceNote,i as shownTier,l as withoutDeviceGate};
@@ -1 +1 @@
1
- import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as r}from"./chunk-ZAOM6PFH.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-JTUUIVBZ.js";import{DEFAULT_CANVAS_WORDS as n}from"./chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as c}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as s}from"./chunk-KFV7N2DJ.js";import{DEFAULT_NODE_MENU_WORDS as f}from"./chunk-WK3AFPXY.js";import{DEFAULT_SAVE_WORDS as p}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as e,DEFAULT_NOTICE_WORDS as i}from"./chunk-Z6PVRXVY.js";import{DEFAULT_LOCK_WORDS as u}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as k}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as j}from"./chunk-Q6AM43CA.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-FFYXVAAL.js";import{DEFAULT_DRAG_WORDS as l}from"./chunk-O2NLQBFX.js";var a={notice:i,lock:u,save:p,chrome:e,rail:k,tree:c,panel:s,fields:h,pick:r,drag:l,menu:f,styleClipboard:t,copy:j,canvas:n,textStyles:o,screen:m},F=o=>"object"==typeof o&&null!==o;function Y(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:F(n)?t[m]=F(c)?Y(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function y(o,r){return r?Y(o,r):o}export{a as DEFAULT_EASEL_STRINGS,y as mergeEaselStrings};
1
+ import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as r}from"./chunk-ZAOM6PFH.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-VWXUMVCD.js";import{DEFAULT_CANVAS_WORDS as n}from"./chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as c}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as s}from"./chunk-KFV7N2DJ.js";import{DEFAULT_NODE_MENU_WORDS as f}from"./chunk-WK3AFPXY.js";import{DEFAULT_SAVE_WORDS as p}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as e,DEFAULT_NOTICE_WORDS as i}from"./chunk-Z6PVRXVY.js";import{DEFAULT_LOCK_WORDS as u}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as k}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as j}from"./chunk-Q6AM43CA.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-FFYXVAAL.js";import{DEFAULT_DRAG_WORDS as l}from"./chunk-GG4FGBFR.js";var F={notice:i,lock:u,save:p,chrome:e,rail:k,tree:c,panel:s,fields:h,pick:r,drag:l,menu:f,styleClipboard:t,copy:j,canvas:n,textStyles:o,screen:m},a=o=>"object"==typeof o&&null!==o;function Y(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:a(n)?t[m]=a(c)?Y(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function y(o,r){return r?Y(o,r):o}export{F as DEFAULT_EASEL_STRINGS,y as mergeEaselStrings};
@@ -0,0 +1,2 @@
1
+ import{editLockOf as e}from"./chunk-GMCZXMOV.js";import{isExpiredSession as r,readEaselFailure as n}from"./chunk-CLOS6SSX.js";import{routeSharedHostMessage as t}from"./chunk-S4AWJX4Q.js";import{describeLoadFailure as o,hostLoadRefusal as u}from"./chunk-ERR437B5.js";import{useAdminBridge as a}from"./chunk-VPFNZ7TB.js";import{NO_DOCUMENT_ADDRESSING as s}from"./chunk-RLBXE4EU.js";import{saveStatusOf as i,resetForDocumentSwitch as l}from"./chunk-HNKB2ZYR.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-O7Q4DDJT.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-RSCMJIWS.js";import{useEaselHost as k}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as g}from"./chunk-VWXUMVCD.js";import{useAutosave as v}from"./chunk-NDRZP6YR.js";import{canWriteDocument as p,newEaselClientId as h,reloadIfVersionMoved as y,openUnansweredClaim as w,FAIL_OPEN_RETRY_MS as S,CLAIM_FAIL_OPEN_MS as b,holderOf as P}from"./chunk-THWO5YVZ.js";import{useWords as I}from"./chunk-MFIRYGHW.js";import{createContext as j,useContext as R,useState as B,useMemo as C,useCallback as O,useEffect as H,useRef as E}from"react";import{jsx as T}from"react/jsx-runtime";var D={content:[],root:{},zones:{}};var M=j(null);function V(){const e=R(M);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function A({target:j,addressing:R=s,onHostMessage:V,children:A}){const N=R,{homeSlug:F,entryMayBounce:L,entryBounce:W,onSwitch:U,tellsHost:X,adapterFor:Y,migrateRenamedProps:Z,describeMissing:J,onLoadFailed:x}=N,[G,K]=B(j),Q=k(),z=d(),_=C(()=>f(z),[z]),q=C(()=>e(z),[z]),$="template"===G.kind,ee="template"===G.kind?G.id:null,re="template"===G.kind?G.pageSlug??F??"":"document"===G.kind?G.slug??"":G.slug,ne="page"===G.kind?G.siteId??null:null,te=z.blocks,oe=C(()=>Y(G,_,te),[Y,_,te,G.kind,"template"===G.kind?G.id:"document"===G.kind?G.record:G.siteId]),ue=oe.capabilities,ae=O(e=>z.documentHooks?.stored?.(e)??e,[z]),se="page"===G.kind?G.originSlug??null:null;H(()=>{m(z,ne)},[z,ne]);const ie=E(G);H(()=>{ie.current=G},[G]);const{token:le,tokenRef:ce,capabilities:de}=a({onMessage:e=>{if(V?.(e)||t(e))return;const r=e;if("storefront-editor:navigate"===r?.type){const r=e;r?.target&&Cr(r.target)}}}),fe=!z.usesBridgedToken||null!==le,me=oe.lock,ke=Boolean(_.lock),[ge,ve]=B(null),[pe,he]=B(null),[ye,we]=B(null),[Se,be]=B(null),Pe=I("screen",g),Ie=Se?function(e,r){if(null!==e.sentence)return e.sentence;if(!e.missing)return r.loadFailed({cause:e.cause});switch(e.target.kind){case"template":return r.missingTemplatePage;case"document":return r.missingDocument;default:return r.missingPage({slug:e.slug})}}(Se,Pe):null,[je,Re]=B(null),Be=E(null),Ce=E(null),[Oe,He]=B(!1),Ee=E(null),[Te,De]=B(null),Me=E(null),[Ve,Ae]=B(null),[Ne,Fe]=B(!1),Le=E(null);H(()=>{Le.current=Ve},[Ve]);const[We,Ue]=B(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Xe=E(We);H(()=>{Xe.current=We},[We]);const Ye=E(()=>Promise.resolve(!1)),Ze=O(e=>{Ce.current=e,He(!0)},[]),Je=v({save:async({id:e,data:r})=>{if(p(Xe.current)){if(!await Ye.current(e,r)){if(!p(Xe.current))return void Ze({id:e,data:r});throw new Error("page save did not land")}}else Ze({id:e,data:r})},onFailure:(e,r)=>{0===r&&Q.send("storefront-editor:save-failed")}}),{state:xe,push:Ge,flush:Ke,pause:Qe,resume:ze,stop:_e,reset:qe,retryNow:$e,hasPending:er}=Je,rr=E(xe);H(()=>{rr.current=xe},[xe]);const nr=i(xe),tr=O(()=>{const e=Ce.current;e&&(Ce.current=null,He(!1),Ge(e))},[Ge]),or=E("");or.current||(or.current=h());const[ur,ar]=B(0),sr=E(!1),[ir,lr]=B(L(j)),cr=E(!1);H(()=>{if(cr.current)return;cr.current=!0;const e=Q.address.search(),r=W(j,e);r?Q.address.load(r):L(j)&&lr(!1)},[j,Q]);const dr=Q.send;H(()=>{if(!fe)return;let e=!1;const r=ie.current,n=oe.resolve(re),t=z.documentHooks?.opening?.({slug:re,isTemplate:$,capabilities:ue});return n.then(async n=>{if(e)return;if(!n)return"page"===r.kind&&null!==F&&re!==F?void Q.address.load({kind:"page",slug:F,siteId:ne??void 0}):(be({target:r,slug:re,missing:!0,sentence:J?.(r)??null}),void x?.(r,null));const o=n.readOnlyReason?n.readOnlyReason:null;Be.current=o,Re(o),ve(n.id),he(n.kind??null),Me.current=n.version??null;const u=n.layout,a=u&&Object.keys(u).length?u:D,s=Z(a),i=t?await t(s):s;e||we(i)}).catch(n=>{e||(console.error("[storefront-editor] document load failed",n),be({target:r,slug:re,missing:!1,sentence:u(n,{slug:re},z),cause:o(n,z)}),x?.(r,n))}),()=>{e=!0}},[fe,le,$,oe,re]);const fr=O(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=ce.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),mr=O(async e=>{const n=ce.current;if(!n&&z.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(n??"")}}catch(t){if(r(t,z)){dr("storefront-editor:auth-expired");const r=n?await fr(n):null;if(r)try{return{ok:!0,value:await e(r)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:t}}},[dr,fr,z]),kr=O(async e=>{const r=ce.current?await mr(e):{ok:!1};return r.ok||dr("storefront-editor:save-failed"),r.ok},[dr,mr]),gr=O(async(e,r,t=!1)=>{if(null!==Be.current)return!1;if(!p(Xe.current))return!1;if(Le.current)return!1;const o=await mr(()=>oe.saveLayout(e,r,Me.current,or.current));if(o.ok)return Me.current=o.value.version??Me.current,Fe(!1),!0;const u=q.readLockTaken(o.error);if(u){const e={kind:"takenover",holder:u};return Xe.current=e,Ue(e),!1}const a=q.readSaveConflict(o.error);if(a){if(a.savedByYou&&!t&&oe.rereadVersion){const n=await mr(()=>oe.rereadVersion(e));if(n.ok&&n.value)return Me.current=n.value,Ye.current(e,r,!0)}_e(),Le.current=a,Ae(a)}return Fe(n(o.error,z)?.status===c),!1},[oe,mr,_e,z]);H(()=>{Ye.current=gr},[gr]);const vr=O(e=>{if(null!==Be.current)return;if(dr("storefront-editor:dirty"),!ge)return;const r=ae(e);Ee.current=r,p(Xe.current)?Ge({id:ge,data:r}):Ze({id:ge,data:r})},[ge,dr,Ze,Ge,ae]),pr=O(async()=>{p(Xe.current)&&tr();return await Ke()&&null==Ce.current},[tr,Ke]),hr=E(pr);H(()=>{hr.current=pr},[pr]);const yr=E(mr);H(()=>{yr.current=mr},[mr]);const wr=O(()=>{Q.address.reload()},[Q]),Sr=E(()=>Promise.resolve(!1));H(()=>{Sr.current=()=>{const e=oe.rereadVersion;return ge&&e?y({ours:Me.current,stored:async()=>{const r=await yr.current(()=>e(ge));return r.ok?r.value:null},hasPending:()=>null!=Ce.current||er(),reload:wr}):Promise.resolve(!1)}},[oe,ge,er,wr]);const br=null!==je;H(()=>{if(!me||!ge||!fe||br)return;let e=!1,r=null,n=null;const t=or.current,o={claim:async e=>{const r=await yr.current(()=>me.claim(ge,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Xe.current,heldWrite:()=>({pending:null!=Ce.current||er(),autoSaveEnabled:!rr.current.paused,saveConflict:null!=Le.current}),setAccess:e=>{Xe.current=e,Ue(e)},releaseHeldWrite:()=>{hr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{Sr.current()}},u=q.makeClaimBeat(o),a=sr.current;return sr.current=!1,a||(Ue({kind:"checking"}),n=setTimeout(()=>{n=null,w(o)&&o.startHeartbeat(S)},b)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),me.release(ge,t).catch(()=>{})}},[ge,me,fe,le,ur,br]);const Pr=O(()=>{me&&ge&&(sr.current=!0,ar(e=>e+1))},[ge,me]),Ir=O(()=>{Ue(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),jr=O(()=>{rr.current.paused?(p(Xe.current)&&tr(),ze()):Qe()},[tr,Qe,ze]),Rr=O(()=>{$e()},[$e]),Br=O(e=>{Ee.current=null,l("template"!==e.kind&&ke,{resetAutosave:()=>{qe(),Ce.current=null,He(!1)},setVersion:e=>{Me.current=e},setSaveConflict:Ae,setAccess:Ue}),U(e),K(e),Be.current=null,Re(null),ve(null),he(null),we(null),be(null),Q.address.show(e),"document"!==e.kind&&X(e)&&Q.send("storefront-editor:navigated",{target:e})},[qe,Q,ke,U,X]),Cr=O(e=>{if(function(e,r,n){if(e.kind!==r.kind)return!1;if("template"===e.kind){const t=r;return e.id===t.id&&(e.pageSlug??n)===(t.pageSlug??n)}if("document"===e.kind){const n=r;return e.record===n.record&&(e.slug??"")===(n.slug??"")}const t=r;return e.slug===t.slug&&e.siteId===t.siteId}(e,ie.current,F))return;const r=null!=Ce.current;if(!r&&!er())return void Br(e);const n=rr.current;r||n.paused||n.failed||n.stopped?De(e):Ke().then(r=>{r?Br(e):De(e)})},[Br,er,Ke,F]),Or=O(()=>De(null),[]),Hr=O(()=>{De(e=>(e&&Br(e),null))},[Br]),Er=O(async()=>{const e=Te;if(!e)return;await pr()&&(De(null),Br(e))},[Te,pr,Br]),Tr=O(async e=>{if(null!==Be.current)return;if(!ge)return;if(!p(Xe.current)||Le.current)return;const r=ae(e);if(!await gr(ge,r))return void(Le.current||dr("storefront-editor:save-failed"));const n=oe.publish;if(!ue.canPublish||!n)return void dr("storefront-editor:saved");const t=await mr(()=>n(ge,Me.current??void 0));t.ok?(Me.current=t.value.version??Me.current,dr("storefront-editor:published")):dr("storefront-editor:save-failed")},[ge,oe,ue.canPublish,dr,gr,mr,ae]);/* @__PURE__ */
2
+ return T(M.Provider,{value:{target:G,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:pe,siteId:ne,ready:fe,token:le,tokenRef:ce,notifyParent:dr,bridgeCapabilities:de,runAuthed:kr,docId:ge,data:ye,getLiveData:()=>Ee.current??ye,footerOriginSlug:se,error:Ie,redirecting:ir,saveStatus:nr,saveState:xe,autoSaveEnabled:!xe.paused,autoSaveStoppedByConflict:xe.stopped,hasUnsavedEdits:xe.pending||Oe,toggleAutoSave:jr,retrySave:Rr,onChange:vr,flushSave:pr,onPublish:Tr,access:We,readOnly:null!==P(We)||null!==je||null!==Ve,readOnlyReason:je,takeOverEditing:Pr,viewReadOnly:Ir,saveConflict:Ve,saveUnreachable:Ne,reloadFromServer:wr,navigate:Cr,pendingNav:Te,cancelPendingNav:Or,discardAndNavigate:Hr,saveAndNavigate:Er},children:A})}export{M as ScreenDocumentContext,A as ScreenDocumentProvider,V as useScreenDocument};
@@ -0,0 +1 @@
1
+ var e={add:{stop:"Stop adding here",hint:"Drag onto the page.",search:"Search blocks",searchPlaceholder:({label:e})=>`${e}…`,clearSearch:"Clear search",nothing:({query:e})=>`Nothing matches “${e}”`,tryAnother:"Try another word.",tile:({label:e})=>`Add ${e}`},canvas:{addSection:"Add section",addBlock:"Add block",addButton:({label:e})=>`+ ${e}`,handle:({label:e})=>`Drag to move this ${e.toLowerCase()}`}};export{e as DEFAULT_DRAG_WORDS};
@@ -1 +1 @@
1
- import{useScreenBlockRules as e}from"./chunk-EVY5SXFW.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-PE6ZY5IW.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
1
+ import{useScreenBlockRules as e}from"./chunk-77DQCEEF.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-PE6ZY5IW.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
@@ -1 +1 @@
1
- import{panelFieldsOf as t}from"./chunk-ZE7I3PLX.js";import{withoutDeviceGate as o,deviceMetaOf as n}from"./chunk-OGCROOTI.js";import{DESIGN_GROUP_KEY as e,BUCKET_KEY as r}from"./chunk-MQNBD6AB.js";import{ANCHOR_FIELD_KEYS as s,foldMetaOf as c,MEDIA_FIELD_MARKER as i,TEXT_FIELD_MARKER as p,LINK_FIELD_MARKER as u}from"./chunk-DUVRZ456.js";import{STYLE_KIND as a,fieldKind as f,copyStyle as l,heldStyle as m,planPaste as h,pasteMessage as y}from"./chunk-V7U33NF2.js";var j=/* @__PURE__ */new Set([e.Size,e.Design,e.Layout,e.Position]),w=new Set(Object.values(e)),b=new Set(Object.values(r)),S=new Set(s),g=/* @__PURE__ */new Set(["focal","imageFocal"]),k=[i,p,u];function O(t){return`site:${t??""}`}function v(t){if(!t||"object"!=typeof t)return null;const n=t,e=o(t)??t,r=n[a]??e[a];if("string"==typeof r)return r;const s=n.options??e.options;if(Array.isArray(s)){return`choice:${s.map(t=>String(t?.value)).sort().join("|")}`}return f(e)}function D(t){const n=t,e=o(t);return k.some(t=>t in n||e&&t in e)}function d(o,e){const s=t(o,e)??{},i=[];let p=!0,u=!1;for(const[t,o]of Object.entries(s))b.has(t)?(p=t===r.Design,u=!1):w.has(t)?p&&(u=j.has(t)):u&&o&&"object"==typeof o&&!t.startsWith("_")&&(c(o)||S.has(t)||g.has(t)||D(o)||"slot"!==o.type&&i.push({path:[t],kind:v(o),counted:"mobile"!==n(o)?.tier}));return i}function A(t,o,n,e,r){l({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function I(t,o,n,e,r,s){const c=m(n);if(!c)return null;const i=h(c,{type:e.type,rows:t(o,e),props:e.props});return{...i,message:y(i,c.sourceLabel,r,s)}}function L(t,o,n,e){A(d,t,o,n,e)}function B(t,o,n,e,r){return I(d,t,o,n,e,r)}var F={scope:t=>O(t.siteId),rows:(t,o)=>d(t,o),copy:(t,o,n,e)=>L(e,t,o,n),plan:(t,o,n,e)=>B(e,t,o,n)};function N(t,o){if(!t&&!o)return F;const n=t?.rows,e=n?(t,o)=>n(t,o):d;return{scope:t?.scope??F.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>A(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>I(e,s,t,n,r,o))}}export{L as copyNodeStyle,d as nodeStyleRows,B as planNodePaste,v as shopFieldKind,O as siteStyleScope,N as styleClipboardOf};
1
+ import{panelFieldsOf as t}from"./chunk-ZE7I3PLX.js";import{withoutDeviceGate as o,deviceMetaOf as n}from"./chunk-DGAXQTDW.js";import{DESIGN_GROUP_KEY as e,BUCKET_KEY as r}from"./chunk-MQNBD6AB.js";import{ANCHOR_FIELD_KEYS as s,foldMetaOf as c,MEDIA_FIELD_MARKER as i,TEXT_FIELD_MARKER as p,LINK_FIELD_MARKER as u}from"./chunk-DUVRZ456.js";import{STYLE_KIND as a,fieldKind as f,copyStyle as l,heldStyle as m,planPaste as h,pasteMessage as y}from"./chunk-V7U33NF2.js";var j=/* @__PURE__ */new Set([e.Size,e.Design,e.Layout,e.Position]),w=new Set(Object.values(e)),b=new Set(Object.values(r)),S=new Set(s),g=/* @__PURE__ */new Set(["focal","imageFocal"]),k=[i,p,u];function D(t){return`site:${t??""}`}function v(t){if(!t||"object"!=typeof t)return null;const n=t,e=o(t)??t,r=n[a]??e[a];if("string"==typeof r)return r;const s=n.options??e.options;if(Array.isArray(s)){return`choice:${s.map(t=>String(t?.value)).sort().join("|")}`}return f(e)}function A(t){const n=t,e=o(t);return k.some(t=>t in n||e&&t in e)}function d(o,e){const s=t(o,e)??{},i=[];let p=!0,u=!1;for(const[t,o]of Object.entries(s))b.has(t)?(p=t===r.Design,u=!1):w.has(t)?p&&(u=j.has(t)):u&&o&&"object"==typeof o&&!t.startsWith("_")&&(c(o)||S.has(t)||g.has(t)||A(o)||"slot"!==o.type&&i.push({path:[t],kind:v(o),counted:"mobile"!==n(o)?.tier}));return i}function L(t,o,n,e,r){l({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function O(t,o,n,e,r,s){const c=m(n);if(!c)return null;const i=h(c,{type:e.type,rows:t(o,e),props:e.props});return{...i,message:y(i,c.sourceLabel,r,s)}}function B(t,o,n,e){L(d,t,o,n,e)}function F(t,o,n,e,r){return O(d,t,o,n,e,r)}var I={scope:t=>D(t.siteId),rows:(t,o)=>d(t,o),copy:(t,o,n,e)=>B(e,t,o,n),plan:(t,o,n,e)=>F(e,t,o,n)};function N(t,o){if(!t&&!o)return I;const n=t?.rows,e=n?(t,o)=>n(t,o):d;return{scope:t?.scope??I.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>L(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>O(e,s,t,n,r,o))}}export{B as copyNodeStyle,d as nodeStyleRows,F as planNodePaste,v as shopFieldKind,D as siteStyleScope,N as styleClipboardOf};
@@ -1,7 +1,7 @@
1
- import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as n}from"./chunk-535CJ7J4.js";import{ScreenChrome as e}from"./chunk-MMAC2VER.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-THZ46DC5.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-JTUUIVBZ.js";import{documentPermissions as s}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t,useState as d,useRef as l,useEffect as m,useCallback as g}from"react";import{Dialog as h,Button as f}from"efficient-shell/ui";import{jsx as u,jsxs as p,Fragment as v}from"react/jsx-runtime";var C=r(n),k=r(e);function j({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const C=g(async()=>{s(!0);try{await e()}finally{t.current&&s(!1)}},[e]);/* @__PURE__ */
1
+ import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as n}from"./chunk-JTOZJXD7.js";import{ScreenChrome as e}from"./chunk-7LP3OD2E.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-GCCBEY2W.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VWXUMVCD.js";import{documentPermissions as s}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t,useState as d,useRef as l,useEffect as m,useCallback as g}from"react";import{Dialog as h,Button as f}from"efficient-shell/ui";import{jsx as u,jsxs as p,Fragment as v}from"react/jsx-runtime";var C=r(n),k=r(e);function j({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const C=g(async()=>{s(!0);try{await e()}finally{t.current&&s(!1)}},[e]);/* @__PURE__ */
2
2
  return u(h,{open:!0,role:"alertdialog",size:"sm",title:i.title,onClose:r,footer:/* @__PURE__ */p(v,{children:[
3
3
  /* @__PURE__ */u(f,{variant:"secondary",onClick:r,children:i.cancel}),
4
4
  /* @__PURE__ */u(f,{variant:"ghost-danger",onClick:n,children:i.discard}),
5
5
  /* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{C()},children:i.save})]}),children:i.body})}function y({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
6
- return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var N=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function H({config:r,parts:n,wrap:e=N}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:y}=a(),H=t(()=>s(!g),[g]),M=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:M.loading}):d?/* @__PURE__ */u("div",{className:"sf-msg sf-msg--error",children:d}):m?i?e(
7
- /* @__PURE__ */u(C,{config:r,data:i,onChange:h,permissions:H,parts:n,children:/* @__PURE__ */u(k,{})}),f&&/* @__PURE__ */u(j,{onCancel:p,onDiscard:v,onSave:y})):/* @__PURE__ */u("div",{className:"sf-msg",children:M.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:M.waitingForAuthorization})}export{H as DocumentScreen,y as ScreenMount};
6
+ return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var N=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function D({config:r,parts:n,wrap:e=N}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:y}=a(),D=t(()=>s(!g),[g]),O=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:O.loading}):d?/* @__PURE__ */u("div",{className:"sf-msg sf-msg--error",children:d}):m?i?e(
7
+ /* @__PURE__ */u(C,{config:r,data:i,onChange:h,permissions:D,parts:n,children:/* @__PURE__ */u(k,{})}),f&&/* @__PURE__ */u(j,{onCancel:p,onDiscard:v,onSave:y})):/* @__PURE__ */u("div",{className:"sf-msg",children:O.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:O.waitingForAuthorization})}export{D as DocumentScreen,y as ScreenMount};
@@ -1,2 +1,2 @@
1
- import{ScreenPartsProvider as t}from"./chunk-EVY5SXFW.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-PE6ZY5IW.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
1
+ import{ScreenPartsProvider as t}from"./chunk-77DQCEEF.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-PE6ZY5IW.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
2
2
  return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(t,{parts:f,children:u})})}export{a as ScreenStoreProvider};
@@ -0,0 +1 @@
1
+ import{styleMenuItems as e}from"./chunk-V7U33NF2.js";import{useEaselSession as n}from"./chunk-O7Q4DDJT.js";import{ROOT_ZONE as t}from"./chunk-PLVEGYK6.js";import{useHostEscape as o}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as l}from"./chunk-VWXUMVCD.js";import{EaselMenuItems as r,menuLabel as i}from"./chunk-EA2HTX37.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as a}from"./chunk-WK3AFPXY.js";import{isTypingTarget as u,useCanvasEvent as d,framePointToHost as p}from"./chunk-ILXP5VX5.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as h}from"./chunk-KRXQM65X.js";import{useState as y,useCallback as k,useRef as b,useEffect as v}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,SettingsIcon as z,LayersIcon as P,CopyIcon as O}from"efficient-shell/icons/efficient";import{jsx as A}from"react/jsx-runtime";function D(e,n){const o=[],l=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||l.has(n.props.id))break;if(l.add(n.props.id),o.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===t)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<o.length-1;e+=1)o[e].parentType=o[e+1].node.type;return o}var X=c(),K=/* @__PURE__ */new WeakMap;function j(e){if(e.claimsPage)return X;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",c);let t=K.get(n);return t||(t=c(),K.set(n,t)),t}function M(){return j(n())}function S(e,n,o){if(n===t){const{floor:n,cap:t}=e.sectionBand();return{parentId:h,slot:m,index:Math.min(Math.max(o,n),t)}}const l=n.lastIndexOf(":");return{parentId:n.slice(0,l),slot:n.slice(l+1),index:o}}function T(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function V(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?S(e,t.zone,t.index+1):null;for(const l of D(e,t)){const t=S(e,l.zone,l.index+1);if(o(n,t))return t}return null}function E(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(u(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key||"Backspace"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function L(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=T(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:V(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function I(n,o){const{zone:l,index:r}=o,i=n.nodeAt(l,r);if(!i)return[];const c=i.props.id,a=n.labelOf(i.type,l),u=Boolean(i.props._hidden),d=n.nodeOps,p=n.isPinned(i,l),f=n.isLocked(i),m=!p&&!f&&!n.duplicateBlocked(i),h=n.permits?.(i)??{duplicate:!0,delete:!0},y=T(n,i,l),k=D(n,o),b=d.held,v=b&&!p?V(n,b,o):null,g=!n.readOnly,w=n.style?e({held:g?n.style.held():null,canCopy:n.style.canCopy(i,l),onCopy:()=>n.style?.copy(i,l),onPaste:()=>n.style?.paste(l,r,i),words:n.words?.styleClipboard}):[];return s({title:a,words:n.words?.menu,layer:{group:"pick",items:k.flatMap((e,o)=>{const l={label:n.rowNameOf(e.node,e.zone),checked:0===o,onClick:()=>n.selectAt(e.zone,e.index,e.node.props.id,e.parentType)},r=e.zone===t?null:n.slotRung?.(e.zone)??null;return r?[l,{label:r.label,checked:!1,onClick:r.select}]:[l]})},actions:{duplicate:g&&m&&h.duplicate?()=>d.duplicate(c):void 0,moveUp:g&&d.canStep(c,-1)?()=>d.step(c,-1):void 0,moveDown:g&&d.canStep(c,1)?()=>d.step(c,1):void 0,copy:y.copy?()=>d.copy(c,a):void 0,cut:g&&y.cut?()=>d.cut(c,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&n.renamePropOf(i,l)?()=>n.beginRename(l,r):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(c):void 0},style:w,extras:n.menuRows?.(i,l,r)??void 0,pinnedLine:p?R(n).pinned:void 0})}var R=e=>e.words?.screen??l.menu;function U(e){const n=R(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */A(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */A(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=[],c=e.nodeOps.held,s=S(e,t,e.sectionBand().cap);if(o&&c&&(e.canPasteAt?e.canPasteAt(c,s):f(c.from)===t)){const n=s,t=e.words?.menu??a;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[r,i,[{label:e.pageSettingsLabel??l.pageSettings,icon:/* @__PURE__ */A(z,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */A(P,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function B(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??a,c=R(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */A(O,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */A(O,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[s,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function Y(e){return e.shiftKey}function N(e,n){const[t,l]=y(null),r=k(()=>l(null),[]);o(null!==t,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=E(e);if(!o)return;const l=t.selected();if(!l)return;const r=L(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;v(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),d(n,"keydown",c);const a=k(n=>{if(Y(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);d(n,"contextmenu",t=>{if(Y(t)||!n)return;const o=t.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;t.preventDefault();const c=p(n.frame,t.clientX,t.clientY),s=n.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),d(n,"mousedown",r),d(n,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:t?/* @__PURE__ */A(F,{host:e,target:t,onClose:r}):null,closeMenu:r}}function F({host:e,target:n,onClose:t}){const o="node"===n.kind?I(e,n):"input"===n.kind?B(e,n.el):U(e);return 0===o.length?null:/* @__PURE__ */A(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":i(o),children:/* @__PURE__ */A(r,{items:o,onClose:t})})}export{X as EASEL_NODE_CLIPBOARD,D as ancestorChain,j as nodeClipboardOf,T as nodeClipboardRules,I as nodeMenuItems,E as nodeShortcut,U as pageMenuItems,V as pastePlace,L as runNodeShortcut,B as textMenuItems,M as useNodeClipboard,N as useNodeContextMenu};
@@ -1,4 +1,4 @@
1
- import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-EVY5SXFW.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-JTUUIVBZ.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{DropdownMenu as n}from"efficient-shell/ui";import{jsxs as c,Fragment as i,jsx as o}from"react/jsx-runtime";function l({choices:l,onPick:p}){const{Icon:a}=r(),m=t("screen",s),u=e(l).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */c(i,{children:[e.group," ",
1
+ import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-77DQCEEF.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-VWXUMVCD.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{DropdownMenu as n}from"efficient-shell/ui";import{jsxs as c,Fragment as i,jsx as o}from"react/jsx-runtime";function l({choices:l,onPick:p}){const{Icon:a}=r(),m=t("screen",s),u=e(l).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */c(i,{children:[e.group," ",
2
2
  /* @__PURE__ */o("span",{className:"sf-menugroup-count",children:e.items.length})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */o("span",{className:"sf-chip",children:/* @__PURE__ */o(a,{type:e.type,size:13})}),onSelect:()=>p(e.type)}))]);/* @__PURE__ */
3
3
  return o(n,{align:"start",triggerClassName:"sf-add-card",items:u,trigger:/* @__PURE__ */c(i,{children:[
4
4
  /* @__PURE__ */o("span",{className:"sf-plus sf-plus--sm",children:"+"}),m.addBlockMenu]})})}export{l as AddBlockRow};
@@ -1 +1 @@
1
- import{useSectionOps as o}from"./chunk-BPMLHWWM.js";import{decodePartId as e,encodePartId as r}from"./chunk-IYT6NN2J.js";import{usePreviewParts as t}from"./chunk-I54UCYOU.js";import{SELECTION_MODE as n}from"./chunk-EVY5SXFW.js";import{useEasel as p}from"./chunk-PE6ZY5IW.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:I}){const{getSelectorForId:a}=p(o=>o),u=o(),{setSelectedPartId:f,setSelectHandler:k}=t(),l=d(o=>{const r=e(o);if(!r)return;const{nodeId:t,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===t&&o.propKey===p?o:{kind:"part",nodeId:t,propKey:p}),I?.(t)):i(o=>"part"===o.kind?n:o)},[i,I]);c(()=>{k(l)},[k,l]);const h=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>n);const e=a(o);e&&u.select(e)},[i,a,u]),openPartId:h}}export{m as usePartBridge};
1
+ import{useSectionOps as o}from"./chunk-GJC6SNQC.js";import{decodePartId as e,encodePartId as r}from"./chunk-IYT6NN2J.js";import{usePreviewParts as t}from"./chunk-I54UCYOU.js";import{SELECTION_MODE as n}from"./chunk-77DQCEEF.js";import{useEasel as p}from"./chunk-PE6ZY5IW.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:I}){const{getSelectorForId:a}=p(o=>o),u=o(),{setSelectedPartId:f,setSelectHandler:k}=t(),l=d(o=>{const r=e(o);if(!r)return;const{nodeId:t,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===t&&o.propKey===p?o:{kind:"part",nodeId:t,propKey:p}),I?.(t)):i(o=>"part"===o.kind?n:o)},[i,I]);c(()=>{k(l)},[k,l]);const h=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>n);const e=a(o);e&&u.select(e)},[i,a,u]),openPartId:h}}export{m as usePartBridge};
@@ -0,0 +1 @@
1
+ var e={title:"Add",contextAll:"Sections and blocks",done:"Done",doneDescription:"Close Add and go back",templates:"Your templates",tile:({name:e})=>`Add ${e}`,hint:"Drag onto the page.",search:"Search",onlySections:"Only sections go here",notInside:({name:e})=>`Cannot go inside ${e}`,addingTo:({name:e})=>`Adding to ${e}`,addingBefore:({name:e})=>`Adding before ${e}`,addingAtEnd:"Adding at the end of the page",addingHere:"Adding here"};var a={savedAgo:function({seconds:e}){const a=Math.max(0,Math.floor(e));if(a<1)return"Saved just now";if(a<60)return`Saved ${a} second${1===a?"":"s"} ago`;const o=Math.floor(a/60);if(o<60)return`Saved ${o} minute${1===o?"":"s"} ago`;const n=Math.floor(o/60);return`Saved ${n} hour${1===n?"":"s"} ago`},saved:"All changes saved",saving:"Saving",pending:"Changes not saved yet — saving in a moment",failedIn:({seconds:e})=>`Not saved — trying again in ${e} s`,failedSoon:"Not saved — trying again soon",offline:"You’re offline — we’ll save when you’re back",pausedHeld:"Auto-save is off — changes not saved",paused:"Auto-save is off",locked:({editing:e})=>`Not saving — ${e}`,blockedOffline:"You’re offline. Try again when you’re back online.",blockedFailed:"Your last changes are not saved yet. Try again when they are.",blockedConflict:"Your last save was refused. See the notice below."},o={loading:"Loading…",waitingForAuthorization:"Waiting for editor authorization…",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:e})=>`No page with slug "${e}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:e})=>`Could not load the document — ${e}`,noun:"page",pageSettings:"Page settings",header:"Header",footer:"Footer",pageSections:"Page",templateSections:"Template",addSection:"Add section",addSectionHere:"Add section here",done:"Done",copied:({name:e})=>`Copied ${e}`,pasteRefused:({name:e})=>`${e} can’t be pasted here.`,add:e,canvasAddBlock:"Add block",railMedia:"Media library",leftPanel:"Left panel",resizeLeftPanel:"Resize left panel",leave:{title:"Unsaved changes",body:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them.",cancel:"Cancel",discard:"Discard & leave",save:"Save & leave",saving:"Saving…"},bar:{undo:"Undo",redo:"Redo",refresh:"Reload the preview",refreshTip:"Reload the preview (keeps your place)",notSaving:"Not saving — see the notice below",retry:"Retry now",autoSaveOff:"Auto-save is off — click to turn it back on (saves your held edits)",autoSaveOn:"Auto-save is on — click to pause it",views:"Left panel views",saveOptions:"Save options",autoSave:"Auto-save",saveNow:"Save now"},saveStatus:a,menu:{undo:"Undo",redo:"Redo",collapseAll:"Collapse all layers",selectAll:"Select all",pinned:"Pinned — can’t be moved or deleted",clipboardRefused:"Your browser won’t let us read the clipboard — press ⌘V"},layers:"Layers",expandAll:"Expand all sections",collapseAll:"Collapse all sections",nothingToFold:"Nothing to fold on this page",editFooter:"Edit the site footer",rename:"Rename",deleteNamed:({name:e})=>`Delete ${e}`,hideNamed:({name:e})=>`Hide ${e}`,showNamed:({name:e})=>`Show ${e}`,addBlockHere:"Add block here",sectionFirst:({name:e})=>`“${e}” is already first`,sectionLast:({name:e})=>`“${e}” is already last`,sectionMoved:({name:e,n:a,total:o})=>`Moved “${e}” to position ${a} of ${o}`,sectionAdded:({name:e})=>`Added “${e}” section`,deleted:({name:e})=>`Deleted “${e}”`,resizeSettingsPanel:"Resize settings panel",sectionSettings:({name:e})=>`${e} settings`,headerSettings:"Header settings",addBlockMenu:"Add block",deviceNote:{tablet:"Tablet uses the desktop settings.",mobile:"Showing the phone settings for this section."}};export{e as DEFAULT_SCREEN_ADD_WORDS,a as DEFAULT_SCREEN_SAVE_STATUS_WORDS,o as DEFAULT_SCREEN_WORDS};
@@ -0,0 +1,5 @@
1
+ import{buildPaletteSections as e,pinnedSection as t,categoryLabel as o}from"./chunk-PA3PNTVV.js";import{blockTypesIn as n}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as i,PanelModeExit as r}from"./chunk-PPL7GB7D.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as c}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as a,useScreenBlockRules as p}from"./chunk-77DQCEEF.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-VWXUMVCD.js";import{useEasel as d}from"./chunk-PE6ZY5IW.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{AddPanel as y}from"./chunk-47RGVCPH.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-GG4FGBFR.js";import{useState as u,useEffect as k,useMemo as b}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as j,jsxs as v,Fragment as E}from"react/jsx-runtime";var V=e=>`section:${e}`,B=e=>`block:${e}`,P=e=>`template:${e}`;function $({at:$,placeBlocks:w,canTake:C,onPick:D,itemFor:F,session:G,siteWide:I,onClose:O,onHide:R,readOnly:x}){const H=d(e=>e.config),L=a(),{labelAtLevel:T,categoryLabel:W,firstSection:A,Icon:N,Thumbnail:M}=L,{blockIsOffered:Q,canAddTo:Y}=p(),z=f("screen",m).add,S=f("drag",h).add,Z=l(),[J,K]=u([]);k(()=>{let e=!1;const t=e=>Q(e,Z);return s(Z).list().then(o=>{if(e)return;const s=H.components;K(o.filter(e=>e.node?.type&&s[e.node.type]&&n(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[H,Z]);const U=b(()=>e(H,L),[H]),X=e=>({type:V(e.type),label:e.name,cover:/* @__PURE__ */j(M,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:z.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),q=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=J.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null},_=e=>/* @__PURE__ */j("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */j(N,{type:e,size:26})}),ee=b(()=>{const e=t(U,A),n=/* @__PURE__ */new Map,s=e=>{!n.has(e.type)&&Q(e.type,Z)&&n.set(e.type,e)};for(const t of e?[e]:U){const e=Y(t.type)?.choices??[];e.forEach(s),e.forEach(e=>Y(e.type,1)?.choices?.forEach(s))}w?.forEach(s);const i=new Set(U.map(e=>e.type)),r=[...n.values()].filter(e=>!i.has(e.type)),l=e=>({type:B(e.type),label:e.label,cover:_(e.type),title:z.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>n.has(e.type)?{...X(e),cover:_(e.type)}:X(e),p=[];J.length>0&&p.push({key:"templates",title:z.templates,tiles:J.map(e=>{return{type:P(e.id),label:e.name,cover:/* @__PURE__ */j(M,{type:e.node.type}),keywords:[(t=e.node.type,T(t,"section",H.components[t]?.label??t)),e.node.type]};var t})});const m=r.filter(e=>!e.group);let d=!1;for(const t of Object.keys(H.categories??{})){const n=U.filter(e=>e.cat===t);if(0===n.length)continue;const s=e&&n.some(t=>t.type===e.type)?e:null,i=(s?[s,...n.filter(e=>e.type!==s.type)]:n).map(a);s&&!d&&(i.splice(1,0,...m.map(l)),d=!0),p.push({key:`category:${t}`,title:o(H,t,W),tiles:i})}const f=p.find(e=>e.key?.startsWith("category:"));if(!d&&f&&m.length>0&&(f.tiles=[...f.tiles,...m.map(l)],d=!0),c(r.filter(e=>e.group||!d)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(l)})}),!C)return p;const y=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=q(e.type),o=t?C(t):null;return o?{...e,disabled:!0,disabledReason:o}:e})})),h=e=>e.tiles.some(e=>!e.disabled);return[...y.filter(h),...y.filter(e=>!h(e))]},[J,U,H,z,C,w,Z]);/* @__PURE__ */
2
+ return v(E,{children:[
3
+ /* @__PURE__ */j(i,{icon:/* @__PURE__ */j(g,{size:15}),title:z.title,context:z.contextAll,actions:/* @__PURE__ */j(r,{label:z.done,description:z.doneDescription,onClick:O}),onHide:R}),
4
+ /* @__PURE__ */v("div",{className:"sf-addside sf-scroll",children:[
5
+ /* @__PURE__ */j(y,{groups:ee,session:G,itemFor:e=>F(q(e)??{kind:"section",type:e}),onInsert:D?e=>{const t=q(e);t&&D(t)}:void 0,at:$,hint:z.hint,searchLabel:z.search,readOnly:x,words:S}),I??null]})]})}export{$ as AddSidePanel,B as blockKey,V as sectionKey,P as templateKey};
@@ -339,7 +339,9 @@
339
339
  /* Cards (0.80.0): a group whose tiles all carry a cover — two across, the
340
340
  picture above the name, so a section is chosen by how it looks. */
341
341
  .es-add-grid.is-cards {
342
- grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
342
+ /* ONE card size for every tile (11.0.0, the Add picker Lewis approved
343
+ 2026-10-16): three across at the left panel's 288px, two at its 220px. */
344
+ grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
343
345
  gap: 8px;
344
346
  }
345
347
  .es-add-tile.has-cover {
@@ -366,6 +368,14 @@
366
368
  width: 100%;
367
369
  height: 100%;
368
370
  }
371
+ /* A block's cover is its glyph, centred on the cover's ground, so a block is
372
+ the same card as a section beside it (11.0.0). */
373
+ .es-add-tile-cover > .es-add-glyph-cover {
374
+ display: flex;
375
+ align-items: center;
376
+ justify-content: center;
377
+ color: var(--es-icon);
378
+ }
369
379
  .es-add-tile.has-cover .es-add-tile-label {
370
380
  padding: 0 2px;
371
381
  }
@@ -221,14 +221,20 @@ type AddPanelProps<I> = {
221
221
  session: DragSession<I>;
222
222
  /** The drag item for a new block of `type`. */
223
223
  itemFor: (type: string) => I;
224
- /** A tile clicked: add one — at the place the panel was opened for, or the host's default. */
225
- onInsert: (type: string) => void;
224
+ /**
225
+ * A tile pressed (a click, or Enter on a focused tile): add one at the place
226
+ * the panel was opened for. Left out, a press adds nothing and the tile is
227
+ * only dragged (11.0.0) — the owner's two ways to add (ruling A1,
228
+ * 2026-10-14): drag a tile to its place, or press one after opening the
229
+ * panel AT a place. A host hands it only while the panel has a place.
230
+ */
231
+ onInsert?: (type: string) => void;
226
232
  /** The panel was opened at a place — "Adding to Column 2" — and can stop being. */
227
233
  at?: {
228
234
  label: string;
229
235
  onClear: () => void;
230
236
  };
231
- /** The line under the title. Default "Drag onto the page, or click to add." */
237
+ /** The line under the title. Default "Drag onto the page." */
232
238
  hint?: string;
233
239
  /** The search field's name. Default "Search blocks". */
234
240
  searchLabel?: string;
@@ -1 +1 @@
1
- export{AddPanel,CanvasDragLayer,CanvasInsert,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,insertSeams,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-FCLW4LEN.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-ILXP5VX5.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-47RGVCPH.js";import"../chunk-GG4FGBFR.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-ILXP5VX5.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{AddBlockRow as default}from"../../chunk-545BRJIU.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-EVY5SXFW.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-JTUUIVBZ.js";import"../../chunk-PE6ZY5IW.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-26GHWMNN.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-RC25EGHD.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-TJ6NRHYF.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{AddBlockRow as default}from"../../chunk-PZHQVOTU.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-77DQCEEF.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-VWXUMVCD.js";import"../../chunk-PE6ZY5IW.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-26GHWMNN.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-RC25EGHD.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-TJ6NRHYF.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1,4 @@
1
- export{AddChildRow as default}from"../../chunk-5545A3PC.js";
1
+ import{Tooltip as e}from"efficient-shell/ui";import{useId as s}from"react";import{jsxs as l,Fragment as i,jsx as a}from"react/jsx-runtime";function r({label:r,blocked:d,onAdd:n,small:t=!1}){const c=null!==d,o=s(),m=/* @__PURE__ */l("button",{type:"button",className:"sf-add-card","aria-disabled":c||void 0,"aria-describedby":c?o:void 0,onClick:c?void 0:n,children:[
2
+ /* @__PURE__ */a("span",{className:t?"sf-plus sf-plus--sm":"sf-plus",children:"+"}),r]});return c?/* @__PURE__ */l(i,{children:[
3
+ /* @__PURE__ */a(e,{content:d,children:m}),
4
+ /* @__PURE__ */a("span",{id:o,className:"es-vh",children:d})]}):m}export{r as default};