efficient-easel 6.0.0 → 6.1.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.
@@ -1 +1 @@
1
- import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as o,bindUndoKeys as t}from"./chunk-RAFTHQVR.js";import{useState as e,useEffect as u}from"react";function r(o){const t=n(),[r,c]=e(null);return u(()=>c(o.current),[o]),t.ownsDocument?"undefined"==typeof document?null:document:r}function c(e,c){const m=n(),i=o(),f=r(e);u(()=>{if(!m.ownsDocument&&f)return t(f,i,{leaveTyping:!0})},[m,i,f]);const s=c?.document??null;u(()=>{if(!m.ownsDocument&&s)return t(s,i,{leaveTyping:!0})},[m,i,s])}function m(n){return n.ownsDocument?{}:{tabIndex:-1}}export{m as editorRootFocus,r as useEaselKeyTarget,c as useEaselUndoKeys};
1
+ import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as o,bindUndoKeys as t}from"./chunk-BVKNVCGX.js";import{useState as e,useEffect as u}from"react";function r(o){const t=n(),[r,c]=e(null);return u(()=>c(o.current),[o]),t.ownsDocument?"undefined"==typeof document?null:document:r}function c(e,c){const m=n(),i=o(),f=r(e);u(()=>{if(!m.ownsDocument&&f)return t(f,i,{leaveTyping:!0})},[m,i,f]);const s=c?.document??null;u(()=>{if(!m.ownsDocument&&s)return t(s,i,{leaveTyping:!0})},[m,i,s])}function m(n){return n.ownsDocument?{}:{tabIndex:-1}}export{m as editorRootFocus,r as useEaselKeyTarget,c as useEaselUndoKeys};
@@ -1 +1 @@
1
- import{useSectionOps as o}from"./chunk-RSDDVLT7.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-CVBKSCAY.js";import{useEasel as p}from"./chunk-RAFTHQVR.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=p(o=>o),I=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}),a?.(t)):i(o=>"part"===o.kind?n:o)},[i,a]);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=u(o);e&&I.select(e)},[i,u,I]),openPartId:h}}export{m as usePartBridge};
1
+ import{useSectionOps as o}from"./chunk-B6WEYEMH.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-VOKBME2Y.js";import{useEasel as p}from"./chunk-BVKNVCGX.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=p(o=>o),I=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}),a?.(t)):i(o=>"part"===o.kind?n:o)},[i,a]);c(()=>{k(l)},[k,l]);const K=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(K)},[K,f]);return{selectNode:d(o=>{i(()=>n);const e=u(o);e&&I.select(e)},[i,u,I]),openPartId:K}}export{m as usePartBridge};
@@ -1 +1 @@
1
- import{useScreenBlockRules as e}from"./chunk-CVBKSCAY.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-RAFTHQVR.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-VOKBME2Y.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-BVKNVCGX.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,4 +1,4 @@
1
- import{DEFAULT_CANVAS_WORDS as e}from"./chunk-AELNNAFM.js";import{useResolvedFields as t}from"./chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as i,clickPick as a}from"./chunk-UK2FQOUT.js";import{useWords as s}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as d,isTypingTarget as l}from"./chunk-ZNCEOSXO.js";import{find as c,ROOT_ID as u,getList as p,remove as f,parseZoneKey as h,move as m,duplicate as v,replaceNode as y,createNode as g,insert as k,normalizeData as w,createResolveCache as S,resolveNodeData as b,ROOT_SLOT as I}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as E,fieldsFrom as C,defaultsFrom as O}from"./chunk-NKB3KVAB.js";import{createContext as x,useEffect as A,useContext as D,useRef as z,useSyncExternalStore as M,useState as Z,useMemo as N,useCallback as $,useLayoutEffect as j}from"react";import{jsx as P,jsxs as L}from"react/jsx-runtime";import{createPortal as R}from"react-dom";function B(e){return!["setData","setUi","set"].includes(e.type)}var K=(e,t,n,o)=>{const r=p(e,t,h(n));return r?.[o]??null},F=(e,t,n,o,r)=>{const i=K(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function V(e,t){const{selection:o}=e;return{...e.ui,itemSelector:n(e.data,t,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function H(e,t,n){return n?"node"===n.kind?c(e,t,n.id)?n:null:n.parentId===u?p(e,t,n)?n:null:c(e,t,n.parentId)&&p(e,t,n)?n:null:null}function T(e,t,n,r=!1){const{itemSelector:i,selectedSlot:a,...s}=n;let d=e.selection;var l;return"itemSelector"in n&&(d=o(e.data,t,i??null)),"selectedSlot"in n&&(a?d=(l=a)?{kind:"slot",parentId:l.parentId,slot:l.slot}:null:"slot"===d?.kind&&(d=null)),{...e,selection:d,ui:r?s:{...e.ui,...s}}}function U(e,t,n){const o=q(e,t,n);if(o===e)return e;const r=H(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function q(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return T(e,n,"function"==typeof t.ui?t.ui(V(e,n)):t.ui);case"set":{const r={data:o,ui:V(e,n)},i="function"==typeof t.state?t.state(r):t.state;let a=i.data?{...e,data:i.data}:e;return i.ui&&(a=T(a,n,i.ui,!0)),a}case"insert":{const r={...h(t.destinationZone),index:t.destinationIndex},i=g(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:k(o,n,r,i)}}case"replace":{const r=F(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:y(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=F(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=v(o,n,r.props.id),a=K(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:a?{kind:"node",id:a.props.id}:e.selection}}case"reorder":return q(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=K(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...h(t.destinationZone),index:t.destinationIndex};return{...e,data:m(o,n,r.props.id,i)}}case"remove":{const r=F(o,n,t.zone,t.index,"remove");return{...e,data:f(o,n,r.props.id)}}default:return e}}var W={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},Y={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},X=0,Q=()=>`history-${X+=1}`;function G(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let a=e.permissions??{};const s=w(e.data,t);let d={data:s,selection:null,ui:{...Y}};if(e.ui){const{itemSelector:n,selectedSlot:r,...i}=e.ui;d={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...Y,...i}}}let l=[{core:d,at:-1/0,sealed:!0,id:Q()}],u=0;const f=e=>{const t=l[u],n=r();!e&&u===l.length-1&&u>0&&!t.sealed&&n-t.at<i?l=[...l.slice(0,u),{...t,core:d,at:n}]:(l=[...l.slice(0,u+1),{core:d,at:n,sealed:e,id:Q()}],u=l.length-1)},h=/* @__PURE__ */new Set;let m=null,v=null,g=0,k=null,I=!1;const E=()=>{for(const e of[...h])e()},C=()=>{l=[...l.slice(0,u),{...l[u],core:d},...l.slice(u+1)]},O=(t,n)=>{g>0?I=I||n:(n?f(!1):d!==t&&C(),d.data!==t.data&&e.onChange?.(d.data),d!==t&&E())},x=e=>{const n=d;if(d=U(d,e,t),d===n)return;const o=e.recordHistory??B(e);O(n,o&&d.data!==n.data)},A=t=>{0===g&&(k=d,I=!1),g+=1;try{t()}catch(e){throw g-=1,0===g&&k&&(d=k,k=null),e}if(g-=1,g>0||!k)return;const n=k;k=null,I&&d.data!==n.data?f(!0):d!==n&&C(),d.data!==n.data&&e.onChange?.(d.data),d!==n&&E()},D=e=>{const n=d,o=H(d.data,t,e);var r,i;(r=o,i=d.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(d={...d,selection:o},O(n,!1))},z=t=>{const n=d;u=t,d=l[u].core,d.data!==n.data&&e.onChange?.(d.data),d!==n&&E()},M=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...W,...a,...n}};let Z=M();const N=S(),$={resolveCache:N,async resolveAll({trigger:e="load",metadata:n}={}){const o=d.data,r={type:"root",props:{...o.root.props??{}}},i=[...o.content,...Object.values(o.zones??{}).flat()],[a,...s]=await Promise.all([b(r,t,{cache:N,trigger:e,metadata:n}),...i.map(o=>b(o,t,{cache:N,trigger:e,metadata:n}))]);A(()=>{const e=d;let n=d.data;s.forEach((e,r)=>{if(!e.didChange)return;const a=i[r].props.id,s=c(n,t,a)?.node;s&&s===c(o,t,a)?.node&&(n=y(n,t,a,e.node))}),a.didChange&&n.root===o.root&&(n={...n,root:{...n.root,props:a.node.props,readOnly:a.node.readOnly??n.root.readOnly}}),n!==d.data&&(d={...d,data:n,selection:H(n,t,d.selection)},O(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=c(d.data,t,e)?.node;if(!r)return!1;const i=await b(r,t,{cache:N,trigger:n,metadata:o});if(!i.didChange)return!1;let a=!1;return A(()=>{const n=d;if(c(d.data,t,e)?.node!==r)return;const o=y(d.data,t,e,i.node);o!==d.data&&(d={...d,data:o,selection:H(o,t,d.selection)},O(n,!1),a=!0)}),a},get config(){return t},getState(){if(m&&v===d)return m;const e=d,o={data:e.data,ui:V(e,t)},r="node"===e.selection?.kind?c(e.data,t,e.selection.id)?.node??null:null;return m={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:x,history:{back:()=>$.undo(),forward:()=>$.redo(),hasPast:u>0,hasFuture:u<l.length-1,histories:l.map(e=>({id:e.id,state:{data:e.core.data,ui:V(e.core,t)}})),index:u,setHistoryIndex:e=>{e>=0&&e<l.length&&e!==u&&z(e)}},getPermissions:Z,getItemById:n=>c(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return p(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},v=e,m},subscribe:e=>(h.add(e),()=>{h.delete(e)}),dispatch:x,batch:A,select:e=>D(e?{kind:"node",id:e}:null),selectSlot:e=>D(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){A(()=>{const n=d,o=void 0===e.select?d.selection:e.select;d={...d,data:e.data,selection:H(e.data,t,o)},O(n,e.data!==n.data)})},load(e,n={}){const o=d,r=w(e,t);d={...d,data:r,selection:H(r,t,n.selection??d.selection)},n.keepHistory||(l=[{core:d,at:-1/0,sealed:!0,id:Q()}],u=0),d!==o&&E()},undo(){u>0&&z(u-1)},redo(){u<l.length-1&&z(u+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,a)||(a=e,Z=M(),m=null,E())},setConfig(e){e!==t&&(t=e,Z=M(),m=null,E())}};return $}function J(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&l(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var _=x(null),ee=x(!0);function te({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return A(()=>{n&&e.resolveAll()},[e,n]),A(()=>{if(t&&"undefined"!=typeof document)return J(document,e)},[e,t]),/* @__PURE__ */P(_.Provider,{value:e,children:/* @__PURE__ */P(ee.Provider,{value:t,children:o})})}function ne(){const e=D(_);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function oe(e){const t=ne(),n=z({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const i=e(o);return r.has&&Object.is(r.value,i)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:i,has:!0},i)};return M(t.subscribe,o,o)}function re(){return function(e){return oe(e)}}var ie="data-puck-component",ae="data-puck-dropzone",se={},de="data-es-mirror",le="undefined"==typeof window?A:j;function ce(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${de}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(de,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function ue({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:a=!0,onDocument:l,height:c="auto",nonce:u}){const p=s("canvas",e),f=z(null),[h,m]=Z(null);return le(()=>{const e=f.current,t=h?.ownerDocument.defaultView;if("auto"!==c||!e||!h||!t)return;const n=()=>{e.style.height=`${Math.ceil(h.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(h),()=>r?.disconnect()},[h,c]),le(()=>{let e=f.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=f.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===c&&t.classList.add("es-frame-fill"),e.body.appendChild(t),d(e,u),m(t),l?.(e);let n=null;const o=f.current?.ownerDocument;if(a&&o){ce(o,e,u);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>ce(o,e,u)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),m(null),l?.(null)}},[]),/* @__PURE__ */P("iframe",{ref:f,id:n,title:o??p.frame,className:["es-canvas-frame","fill"===c?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:h?R(t,h):null})}var pe=x(null),fe=x(se),he=[];function me({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const a=ne(),s=oe(n=>p(n.appState.data,a.config,{parentId:e,slot:t})??he),d=oe(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==u),l=oe(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),c=D(pe),f=["es-zone"];return s.length&&f.push("has-children"),e===u&&f.push("is-root"),(d||l)&&f.push("is-area-selected"),null!==c&&c===e&&e!==u&&f.push("is-hovering-area"),n&&f.push(n),/* @__PURE__ */P("div",{className:f.join(" "),[ae]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */P(ge,{node:e},e.props.id))})}function ve(e,t,n,o){const r="root"===t?e.root:e.components[t],i={...o};for(const e of E(C(r)))i[e]=function(t={}){/* @__PURE__ */
1
+ import{DEFAULT_CANVAS_WORDS as e}from"./chunk-AELNNAFM.js";import{useResolvedFields as t}from"./chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as i,clickPick as a}from"./chunk-UK2FQOUT.js";import{useWords as s}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as d,isTypingTarget as l}from"./chunk-ZNCEOSXO.js";import{find as c,ROOT_ID as u,getList as p,remove as f,parseZoneKey as h,move as m,duplicate as v,replaceNode as y,createNode as g,insert as k,normalizeData as w,createResolveCache as S,resolveNodeData as b,ROOT_SLOT as I}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as E,fieldsFrom as C,defaultsFrom as O}from"./chunk-NKB3KVAB.js";import{createContext as x,useEffect as A,useContext as D,useRef as z,useSyncExternalStore as M,useState as Z,useMemo as N,useCallback as $,useLayoutEffect as j}from"react";import{jsx as P,jsxs as L}from"react/jsx-runtime";import{createPortal as R}from"react-dom";function B(e){return!["setData","setUi","set"].includes(e.type)}var K=(e,t,n,o)=>{const r=p(e,t,h(n));return r?.[o]??null},F=(e,t,n,o,r)=>{const i=K(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function V(e,t){const{selection:o}=e;return{...e.ui,itemSelector:n(e.data,t,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function H(e,t,n){return n?"node"===n.kind?c(e,t,n.id)?n:null:n.parentId===u?p(e,t,n)?n:null:c(e,t,n.parentId)&&p(e,t,n)?n:null:null}function T(e,t,n,r=!1){const{itemSelector:i,selectedSlot:a,...s}=n;let d=e.selection;var l;return"itemSelector"in n&&(d=o(e.data,t,i??null)),"selectedSlot"in n&&(a?d=(l=a)?{kind:"slot",parentId:l.parentId,slot:l.slot}:null:"slot"===d?.kind&&(d=null)),{...e,selection:d,ui:r?s:{...e.ui,...s}}}function U(e,t,n){const o=q(e,t,n);if(o===e)return e;const r=H(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function q(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return T(e,n,"function"==typeof t.ui?t.ui(V(e,n)):t.ui);case"set":{const r={data:o,ui:V(e,n)},i="function"==typeof t.state?t.state(r):t.state;let a=i.data?{...e,data:i.data}:e;return i.ui&&(a=T(a,n,i.ui,!0)),a}case"insert":{const r={...h(t.destinationZone),index:t.destinationIndex},i=g(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:k(o,n,r,i)}}case"replace":{const r=F(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:y(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=F(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=v(o,n,r.props.id),a=K(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:a?{kind:"node",id:a.props.id}:e.selection}}case"reorder":return q(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=K(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...h(t.destinationZone),index:t.destinationIndex};return{...e,data:m(o,n,r.props.id,i)}}case"remove":{const r=F(o,n,t.zone,t.index,"remove");return{...e,data:f(o,n,r.props.id)}}default:return e}}var W={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},Y={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},X=0,Q=()=>`history-${X+=1}`;function G(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let a=e.permissions??{};const s=w(e.data,t);let d={data:s,selection:null,ui:{...Y}};if(e.ui){const{itemSelector:n,selectedSlot:r,...i}=e.ui;d={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...Y,...i}}}let l=[{core:d,at:-1/0,sealed:!0,id:Q()}],u=0;const f=e=>{const t=l[u],n=r();!e&&u===l.length-1&&u>0&&!t.sealed&&n-t.at<i?l=[...l.slice(0,u),{...t,core:d,at:n}]:(l=[...l.slice(0,u+1),{core:d,at:n,sealed:e,id:Q()}],u=l.length-1)},h=/* @__PURE__ */new Set;let m=null,v=null,g=0,k=null,I=!1;const E=()=>{for(const e of[...h])e()},C=()=>{l=[...l.slice(0,u),{...l[u],core:d},...l.slice(u+1)]},O=(t,n)=>{g>0?I=I||n:(n?f(!1):d!==t&&C(),d.data!==t.data&&e.onChange?.(d.data),d!==t&&E())},x=e=>{const n=d;if(d=U(d,e,t),d===n)return;const o=e.recordHistory??B(e);O(n,o&&d.data!==n.data)},A=t=>{0===g&&(k=d,I=!1),g+=1;try{t()}catch(e){throw g-=1,0===g&&k&&(d=k,k=null),e}if(g-=1,g>0||!k)return;const n=k;k=null,I&&d.data!==n.data?f(!0):d!==n&&C(),d.data!==n.data&&e.onChange?.(d.data),d!==n&&E()},D=e=>{const n=d,o=H(d.data,t,e);var r,i;(r=o,i=d.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(d={...d,selection:o},O(n,!1))},z=t=>{const n=d;u=t,d=l[u].core,d.data!==n.data&&e.onChange?.(d.data),d!==n&&E()},M=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...W,...a,...n}};let Z=M();const N=S(),$={resolveCache:N,async resolveAll({trigger:e="load",metadata:n}={}){const o=d.data,r={type:"root",props:{...o.root.props??{}}},i=[...o.content,...Object.values(o.zones??{}).flat()],[a,...s]=await Promise.all([b(r,t,{cache:N,trigger:e,metadata:n}),...i.map(o=>b(o,t,{cache:N,trigger:e,metadata:n}))]);A(()=>{const e=d;let n=d.data;s.forEach((e,r)=>{if(!e.didChange)return;const a=i[r].props.id,s=c(n,t,a)?.node;s&&s===c(o,t,a)?.node&&(n=y(n,t,a,e.node))}),a.didChange&&n.root===o.root&&(n={...n,root:{...n.root,props:a.node.props,readOnly:a.node.readOnly??n.root.readOnly}}),n!==d.data&&(d={...d,data:n,selection:H(n,t,d.selection)},O(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=c(d.data,t,e)?.node;if(!r)return!1;const i=await b(r,t,{cache:N,trigger:n,metadata:o});if(!i.didChange)return!1;let a=!1;return A(()=>{const n=d;if(c(d.data,t,e)?.node!==r)return;const o=y(d.data,t,e,i.node);o!==d.data&&(d={...d,data:o,selection:H(o,t,d.selection)},O(n,!1),a=!0)}),a},get config(){return t},getState(){if(m&&v===d)return m;const e=d,o={data:e.data,ui:V(e,t)},r="node"===e.selection?.kind?c(e.data,t,e.selection.id)?.node??null:null;return m={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:x,history:{back:()=>$.undo(),forward:()=>$.redo(),hasPast:u>0,hasFuture:u<l.length-1,histories:l.map(e=>({id:e.id,state:{data:e.core.data,ui:V(e.core,t)}})),index:u,setHistoryIndex:e=>{e>=0&&e<l.length&&e!==u&&z(e)}},getPermissions:Z,getItemById:n=>c(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return p(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},v=e,m},subscribe:e=>(h.add(e),()=>{h.delete(e)}),dispatch:x,batch:A,group:()=>{const e=u;let t=!0;return{close:()=>{if(!t)return;if(t=!1,u<=e+1)return void(u===e+1&&(l=[...l.slice(0,u),{...l[u],sealed:!0},...l.slice(u+1)]));const n=l[u];l=[...l.slice(0,e+1),{...n,sealed:!0},...l.slice(u+1)],u=e+1}}},select:e=>D(e?{kind:"node",id:e}:null),selectSlot:e=>D(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){A(()=>{const n=d,o=void 0===e.select?d.selection:e.select;d={...d,data:e.data,selection:H(e.data,t,o)},O(n,e.data!==n.data)})},load(e,n={}){const o=d,r=w(e,t);d={...d,data:r,selection:H(r,t,n.selection??d.selection)},n.keepHistory||(l=[{core:d,at:-1/0,sealed:!0,id:Q()}],u=0),d!==o&&E()},undo(){u>0&&z(u-1)},redo(){u<l.length-1&&z(u+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,a)||(a=e,Z=M(),m=null,E())},setConfig(e){e!==t&&(t=e,Z=M(),m=null,E())}};return $}function J(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&l(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var _=x(null),ee=x(!0);function te({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return A(()=>{n&&e.resolveAll()},[e,n]),A(()=>{if(t&&"undefined"!=typeof document)return J(document,e)},[e,t]),/* @__PURE__ */P(_.Provider,{value:e,children:/* @__PURE__ */P(ee.Provider,{value:t,children:o})})}function ne(){const e=D(_);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function oe(e){const t=ne(),n=z({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const i=e(o);return r.has&&Object.is(r.value,i)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:i,has:!0},i)};return M(t.subscribe,o,o)}function re(){return function(e){return oe(e)}}var ie="data-puck-component",ae="data-puck-dropzone",se={},de="data-es-mirror",le="undefined"==typeof window?A:j;function ce(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${de}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(de,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function ue({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:a=!0,onDocument:l,height:c="auto",nonce:u}){const p=s("canvas",e),f=z(null),[h,m]=Z(null);return le(()=>{const e=f.current,t=h?.ownerDocument.defaultView;if("auto"!==c||!e||!h||!t)return;const n=()=>{e.style.height=`${Math.ceil(h.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(h),()=>r?.disconnect()},[h,c]),le(()=>{let e=f.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=f.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===c&&t.classList.add("es-frame-fill"),e.body.appendChild(t),d(e,u),m(t),l?.(e);let n=null;const o=f.current?.ownerDocument;if(a&&o){ce(o,e,u);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>ce(o,e,u)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),m(null),l?.(null)}},[]),/* @__PURE__ */P("iframe",{ref:f,id:n,title:o??p.frame,className:["es-canvas-frame","fill"===c?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:h?R(t,h):null})}var pe=x(null),fe=x(se),he=[];function me({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const a=ne(),s=oe(n=>p(n.appState.data,a.config,{parentId:e,slot:t})??he),d=oe(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==u),l=oe(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),c=D(pe),f=["es-zone"];return s.length&&f.push("has-children"),e===u&&f.push("is-root"),(d||l)&&f.push("is-area-selected"),null!==c&&c===e&&e!==u&&f.push("is-hovering-area"),n&&f.push(n),/* @__PURE__ */P("div",{className:f.join(" "),[ae]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */P(ge,{node:e},e.props.id))})}function ve(e,t,n,o){const r="root"===t?e.root:e.components[t],i={...o};for(const e of E(C(r)))i[e]=function(t={}){/* @__PURE__ */
2
2
  return P(me,{parentId:n,slot:e,...t})};return i}function ye(e){return function({zone:t,...n}){/* @__PURE__ */
3
3
  return P(me,{parentId:e,slot:t,...n})}}function ge({node:e}){const t=ne().config,n=t.components[e.type],o=e.props.id,r=function(e){const t=z(null);return N(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(ie),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(ie,e),n.setAttribute("data-puck-dnd",e),n.style.position="relative")},[e])}(o),i=D(fe);if(!n?.render)return null;const a=n.render,s=ve(t,e.type,o,{...O(n),...e.props}),d={renderDropZone:ye(o),isEditing:!0,dragRef:n.inline?r:null,metadata:{...i,...n.metadata}};return n.inline?/* @__PURE__ */P(a,{...s,puck:d,editMode:!0}):/* @__PURE__ */P("div",{[ie]:o,"data-puck-dnd":o,style:{position:"relative"},children:/* @__PURE__ */P(a,{...s,puck:d,editMode:!0})})}function ke({metadata:e}){const t=oe(e=>e.config),n=oe(e=>e.appState.data.root).props??{},o=t.root?.render,r=/* @__PURE__ */P(me,{parentId:u,slot:I}),i=o?/* @__PURE__ */P(o,{id:"puck-root",...ve(t,"root",u,n),puck:{renderDropZone:ye(u),isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:r}):r;/* @__PURE__ */
4
4
  return P(fe.Provider,{value:e??se,children:i})}function we({id:e,kind:t,overlay:n}){const o=z(null),[r,i]=Z(null);le(()=>{const t=o.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!e)return void i(null);let r=0;const a=()=>{r=0;const a=function(e,t){if(!e||!t)return null;const n=e.getBoundingClientRect(),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(t.querySelector(`[${ie}="${n.CSS?.escape?n.CSS.escape(e):e}"]`),o.current?.parentElement??null);i(e=>{return(t=e)===(n=a)||t&&n&&t.top===n.top&&t.left===n.left&&t.width===n.width&&t.height===n.height?e:a;var t,n})},s=()=>{r||(r=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(a))};a();const d="MutationObserver"in n?new n.MutationObserver(s):null;d?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const l="ResizeObserver"in n?new n.ResizeObserver(s):null;return l?.observe(t.documentElement),n.addEventListener("resize",s),()=>{d?.disconnect(),l?.disconnect(),n.removeEventListener("resize",s),r&&(n.cancelAnimationFrame??n.clearTimeout)(r)}},[e]);const a=/* @__PURE__ */P("div",{ref:o,"aria-hidden":"true",className:`es-canvas-outline is-${t}`,style:r?{position:"absolute",top:r.top,left:r.left,width:r.width,height:r.height}:{display:"none"}});return n&&e?/* @__PURE__ */P(n,{componentId:e,kind:t,children:a}):a}function Se({frame:e=!0,className:t,style:n,metadata:o,mirrorStyles:r,onDocument:s,height:d,title:l,nonce:c,hotkeys:u,frameWrapper:p,overlay:f,children:h}){const m=ne(),v=D(ee),y=u??v,[g,k]=Z(void 0),w=oe(e=>"node"===e.selection?.kind?e.selection.id:null),[S,b]=Z(null),I=e=>{const t=e.closest?.(`[${ie}]`)?.getAttribute(ie);if(!t)return;const n=m.getState(),o="node"===n.selection?.kind?n.selection.id:null;return a(n.appState.data,m.config,t,o)??t},E=/* @__PURE__ */L("div",{className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;t.closest?.("a[href]")&&e.preventDefault();const n=I(t);void 0===n?t.hasAttribute?.(ae)||m.select(null):m.select(n)},onMouseOver:e=>{const t=I(e.target)??null;t!==S&&b(t)},onMouseLeave:()=>b(null),children:[
@@ -1,2 +1,2 @@
1
- import{ScreenPartsProvider as t}from"./chunk-CVBKSCAY.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-RAFTHQVR.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-VOKBME2Y.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-BVKNVCGX.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};
@@ -1,49 +1,49 @@
1
- import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-BXQBCW3P.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-2GVCAIPX.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as a}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as c,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,editorRootFocus as m}from"./chunk-SQM6APQW.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as k,clampPanelWidth as S}from"./chunk-6TOYXESC.js";import{usePartBridge as v}from"./chunk-LNKCGJYU.js";import{useSectionOps as w}from"./chunk-RSDDVLT7.js";import{useNodeClipboard as x,useNodeContextMenu as b}from"./chunk-MTRFMGBO.js";import{PageEditGuardNotices as z}from"./chunk-HQWQLDCB.js";import{useScreenDocument as B}from"./chunk-WZMU646D.js";import{requestMediaPick as C}from"./chunk-KG7RJWOK.js";import{heldStyle as O,styleShortcut as N}from"./chunk-V7U33NF2.js";import{AddChildRow as I}from"./chunk-5545A3PC.js";import{AddSidePanel as $}from"./chunk-SYDZ5YWX.js";import{SidePanelHead as P,PanelShowStrip as T}from"./chunk-PFNIVZPN.js";import{MediaSidePanel as M}from"./chunk-3CS5BQMF.js";import{useScreenSaveSwitch as A,useScreenNodeKeys as j,useScreenPinned as R,useScreenDocumentLabel as L,useScreenCanvasFrame as E,useScreenInspectorPanel as V,useScreenDevices as F,useScreenPickFollowsSelection as D,useScreenLeftView as W,useScreenAdd as H,SELECTION_MODE as U,sameInspectorMode as G,useScreenBridges as Y,useScreenBlockRules as J,useScreenBlockLook as Q,useScreenStorageNamespace as X,useScreenNotify as K,useScreenCanvasHead as _,isSlotMode as q,useScreenStyleClipboard as Z,useScreenDocumentPass as ee,useScreenCanvasDrag as ne,ScreenCanvasTargetProvider as te,isPinnedFirst as oe,isPinnedLast as re,screenSlotsOf as ie}from"./chunk-CVBKSCAY.js";import{ROOT_ZONE as le,blockNodeActions as se,TREE_MAX_DEPTH as de,childSlotsOf as ae,slotFieldsOf as ce,slotChildrenIn as pe,nestsInTree as ue,newNodeId as fe}from"./chunk-PLVEGYK6.js";import{useMediaPanel as he,usePanelPick as me,useCancelPanelPick as ge}from"./chunk-R6WTQWAC.js";import{useEaselHost as ye,useHostEscape as ke}from"./chunk-U3JP4VGF.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as ve}from"./chunk-MCHMF32I.js";import{useEasel as we,useEaselApi as xe}from"./chunk-RAFTHQVR.js";import{TreeRow as be,Subtree as ze,LayersTree as Be,TreeGroupLabel as Ce,TreeRowAction as Oe,TreeSeam as Ne}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Ie}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as $e}from"./chunk-WK3AFPXY.js";import{toItemSelector as Pe,useNodeOps as Te,clickPick as Me}from"./chunk-UK2FQOUT.js";import{LayersIcon as Ae,MediaIcon as je}from"./chunk-4VJATVVR.js";import{DEFAULT_SAVE_WORDS as Re,saveIndicator as Le}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Ee,TopBarRail as Ve,TopBarCluster as Fe,EaselIconButton as De,TopBarDivider as We,DeviceSwitch as He,InspectorIconButton as Ue,PanelResizeHandle as Ge,MAX_PANEL_W as Ye,MIN_PANEL_W as Je,panelWidthVars as Qe,SaveState as Xe,SaveStateToggle as Ke}from"./chunk-UB4TLWVJ.js";import{DEFAULT_CHROME_WORDS as _e}from"./chunk-Y2G7CU6A.js";import{useWords as qe}from"./chunk-MFIRYGHW.js";import{CanvasDragLayer as Ze}from"./chunk-MOCX5MQ7.js";import{DEFAULT_DRAG_WORDS as en}from"./chunk-O2NLQBFX.js";import{createDragSession as nn,useTreeDrag as tn,gapToMoveIndex as on}from"./chunk-67GNT6PF.js";import{useCanvasFrame as rn,LIST_SELECTOR as ln,BLOCK_SELECTOR as sn,useCanvasEvent as dn}from"./chunk-PAELDYYS.js";import{zoneKey as an,ROOT_ID as cn,ROOT_SLOT as pn,parseZoneKey as un,DataError as fn,find as hn}from"./chunk-KRXQM65X.js";import{useRef as mn,useMemo as gn,useState as yn,useEffect as kn,useCallback as Sn,useLayoutEffect as vn,Fragment as wn}from"react";import{Tooltip as xn,Button as bn,toast as zn}from"efficient-shell/ui";import{UndoIcon as Bn,RedoIcon as Cn,TrashIcon as On,EyeOffIcon as Nn,EyeIcon as In,DuplicateIcon as $n}from"efficient-shell/icons/efficient";import{jsx as Pn,jsxs as Tn,Fragment as Mn}from"react/jsx-runtime";function An({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i,words:l,saveWords:s}){if(null!==t)/* @__PURE__ */return Pn(Xe,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
2
- return Pn(Xe,{tone:e.pending?"off-unsaved":"off",label:l.notSaving,role:"status"});const{tone:d,label:a}=Le(e,s),c=e.failed&&!e.paused&&/* @__PURE__ */Pn(bn,{variant:"secondary",size:"sm",onClick:i,children:l.retry});/* @__PURE__ */
1
+ import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-BXQBCW3P.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-2GVCAIPX.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as a}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as c,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,editorRootFocus as m}from"./chunk-7WAC3IXR.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as k,clampPanelWidth as S}from"./chunk-6TOYXESC.js";import{usePartBridge as v}from"./chunk-7XFNHML2.js";import{useSectionOps as w}from"./chunk-B6WEYEMH.js";import{useNodeClipboard as x,useNodeContextMenu as b}from"./chunk-MTRFMGBO.js";import{PageEditGuardNotices as z}from"./chunk-HQWQLDCB.js";import{useScreenDocument as B}from"./chunk-WZMU646D.js";import{requestMediaPick as C}from"./chunk-KG7RJWOK.js";import{heldStyle as O,styleShortcut as N}from"./chunk-V7U33NF2.js";import{AddChildRow as I}from"./chunk-5545A3PC.js";import{AddSidePanel as $}from"./chunk-TNV2BVL2.js";import{SidePanelHead as P,PanelShowStrip as T}from"./chunk-PFNIVZPN.js";import{MediaSidePanel as M}from"./chunk-O7IPFJGX.js";import{useScreenSaveSwitch as A,useScreenNodeKeys as j,useScreenPinned as R,useScreenDocumentLabel as L,useScreenCanvasFrame as E,useScreenInspectorPanel as V,useScreenDevices as F,useScreenPickFollowsSelection as W,useScreenLeftView as H,useScreenAdd as D,SELECTION_MODE as U,sameInspectorMode as G,useScreenBridges as X,useScreenBlockRules as Y,useScreenBlockLook as J,useScreenStorageNamespace as K,useScreenNotify as Q,useScreenCanvasHead as _,isSlotMode as q,useScreenStyleClipboard as Z,useScreenDocumentPass as ee,useScreenCanvasDrag as ne,ScreenCanvasTargetProvider as te,isPinnedFirst as oe,isPinnedLast as re,screenSlotsOf as ie}from"./chunk-VOKBME2Y.js";import{ROOT_ZONE as le,blockNodeActions as se,TREE_MAX_DEPTH as de,childSlotsOf as ae,slotFieldsOf as ce,slotChildrenIn as pe,nestsInTree as ue,newNodeId as fe}from"./chunk-PLVEGYK6.js";import{useMediaPanel as he,usePanelPick as me,useCancelPanelPick as ge}from"./chunk-R6WTQWAC.js";import{useEaselHost as ye,useHostEscape as ke}from"./chunk-U3JP4VGF.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as ve}from"./chunk-MCHMF32I.js";import{useEasel as we,useEaselApi as xe}from"./chunk-BVKNVCGX.js";import{TreeRow as be,Subtree as ze,LayersTree as Be,TreeGroupLabel as Ce,TreeRowAction as Oe,TreeSeam as Ne}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Ie}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as $e}from"./chunk-WK3AFPXY.js";import{toItemSelector as Pe,useNodeOps as Te,clickPick as Me}from"./chunk-UK2FQOUT.js";import{LayersIcon as Ae,MediaIcon as je}from"./chunk-4VJATVVR.js";import{DEFAULT_SAVE_WORDS as Re,saveIndicator as Le}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Ee,TopBarRail as Ve,TopBarCluster as Fe,EaselIconButton as We,TopBarDivider as He,DeviceSwitch as De,InspectorIconButton as Ue,PanelResizeHandle as Ge,MAX_PANEL_W as Xe,MIN_PANEL_W as Ye,panelWidthVars as Je,SaveState as Ke,SaveStateToggle as Qe}from"./chunk-UB4TLWVJ.js";import{DEFAULT_CHROME_WORDS as _e}from"./chunk-Y2G7CU6A.js";import{useWords as qe}from"./chunk-MFIRYGHW.js";import{CanvasDragLayer as Ze}from"./chunk-MOCX5MQ7.js";import{DEFAULT_DRAG_WORDS as en}from"./chunk-O2NLQBFX.js";import{createDragSession as nn,useTreeDrag as tn,gapToMoveIndex as on}from"./chunk-67GNT6PF.js";import{useCanvasFrame as rn,LIST_SELECTOR as ln,BLOCK_SELECTOR as sn,useCanvasEvent as dn}from"./chunk-PAELDYYS.js";import{zoneKey as an,ROOT_ID as cn,ROOT_SLOT as pn,parseZoneKey as un,DataError as fn,find as hn}from"./chunk-KRXQM65X.js";import{useRef as mn,useMemo as gn,useState as yn,useEffect as kn,useCallback as Sn,useLayoutEffect as vn,Fragment as wn}from"react";import{Tooltip as xn,Button as bn,toast as zn}from"efficient-shell/ui";import{UndoIcon as Bn,RedoIcon as Cn,TrashIcon as On,EyeOffIcon as Nn,EyeIcon as In,DuplicateIcon as $n}from"efficient-shell/icons/efficient";import{jsx as Pn,jsxs as Tn,Fragment as Mn}from"react/jsx-runtime";function An({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i,words:l,saveWords:s}){if(null!==t)/* @__PURE__ */return Pn(Ke,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
2
+ return Pn(Ke,{tone:e.pending?"off-unsaved":"off",label:l.notSaving,role:"status"});const{tone:d,label:a}=Le(e,s),c=e.failed&&!e.paused&&/* @__PURE__ */Pn(bn,{variant:"secondary",size:"sm",onClick:i,children:l.retry});/* @__PURE__ */
3
3
  return Tn(Mn,o?{children:[
4
- /* @__PURE__ */Pn(Ke,{pressed:e.paused,onToggle:r,title:e.paused?l.autoSaveOff:l.autoSaveOn,children:/* @__PURE__ */Pn(Xe,{tone:d,label:a})}),c]}:{children:[
5
- /* @__PURE__ */Pn(Xe,{tone:d,label:a,role:"status"}),c]})}function jn({expand:e}){/* @__PURE__ */
4
+ /* @__PURE__ */Pn(Qe,{pressed:e.paused,onToggle:r,title:e.paused?l.autoSaveOff:l.autoSaveOn,children:/* @__PURE__ */Pn(Ke,{tone:d,label:a})}),c]}:{children:[
5
+ /* @__PURE__ */Pn(Ke,{tone:d,label:a,role:"status"}),c]})}function jn({expand:e}){/* @__PURE__ */
6
6
  return Pn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Tn(Mn,e?{children:[
7
7
  /* @__PURE__ */Pn("path",{d:"M8 9l4-4 4 4"}),
8
8
  /* @__PURE__ */Pn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
9
9
  /* @__PURE__ */Pn("path",{d:"M8 4l4 4 4-4"}),
10
10
  /* @__PURE__ */Pn("path",{d:"M8 20l4-4 4 4"}),
11
- /* @__PURE__ */Pn("path",{d:"M5 12h14"})]})})}var Rn=`${ln}, ${sn}`;function Ln(e,n,t){const o=t-n;if(o<6)return null;if(o<26)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+13),t-13))}}var En="__rungs";var Vn="screen:band",Fn={duplicate:!0,delete:!0};function Dn(){const Le=ye(),{target:Xe,docId:Ke,capabilities:ln,currentSlug:Dn,siteId:Wn,onPublish:Hn,saveState:Un,saveConflict:Gn,retrySave:Yn,toggleAutoSave:Jn,readOnly:Qn,readOnlyReason:Xn=null}=B(),Kn=A(),_n=j(),{mediaEditing:qn,hasEditGuard:Zn,hasPinnedChrome:et}=ln,{appState:nt,dispatch:tt,history:ot,selectedItem:rt,getSelectorForId:it,config:lt}=we(e=>e),st=R(),{first:dt,firstGroup:at,lastGroup:ct,isSectionGroup:pt,sectionGroupZone:ut,panelOf:ft}=st,ht=ft(dt),mt=e=>oe(st,e),gt=e=>re(st,e),yt="node"===st.firstRow,kt=st.band??null,St=qe("screen",ve),vt=qe("tree",Ie),wt=qe("drag",en),xt=qe("save",Re),bt=qe("menu",$e),zt=qe("styleClipboard",Se),Bt=qe("chrome",_e),Ct=L()??`/${Dn}`,Ot=E(),Nt=V(),It=w({readOnly:Qn}),$t=w({readOnly:Qn,foldIntoHistory:!0}),Pt=mn(null),Tt=xe(),Mt=gn(()=>({...It,select:e=>{Pt.current=e,It.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Tt.config;Pt.current=Pe(e,t,n)}It.commitDocument(e,n)}}),[It,Tt]),At=nt.ui,jt=At.leftSideBarVisible,Rt=At.rightSideBarVisible,{options:Lt,widths:Et,initial:Vt,fluid:Ft,fit:Dt}=F(),[Wt,Ht]=yn(Vt),Ut=he(),Gt=qn&&null!==Ut,Yt=me(),Jt=ge();D(rt?.props.id);const{read:Qt,write:Xt,forSelection:Kt}=W(),[_t,qt]=yn(Qt);kn(()=>{Xt(_t)},[_t]);const[Zt,eo]=yn(0),no=mn(null),to=mn(null),oo=rn(to,{readySelector:Rn}),ro=f(to);h(to,oo);const[io,lo]=yn(!1),so=mn(!1),ao=mn(!1),[co,po]=yn(null),uo=H(),fo=e=>po(null===e?null:{zone:le,index:e}),[ho,mo]=yn([]),[go,yo]=yn(U),ko="puck"===go.kind,So=io&&!co&&uo.railTarget?uo.railTarget(nt.data,{node:rt??null,mode:go}):null,vo=So?{zone:an(So),index:So.index}:null,wo=co??vo,xo=wo&&wo.zone===le?wo.index:null,bo=t(go,rt?.props.id),[zo,Bo]=yn(null);kn(()=>{zo&&(o(),Bo(null))},[zo]);const Co=mn(it);Co.current=it;const Oo=Sn((e,{scroll:n})=>{qt(n=>Kt(e,n)),n&&Bo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Co.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&or(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),No=mn(null);kn(()=>{const e=No.current;No.current=null;const n=null==rt?.props.id?null:String(rt.props.id);yo(e&&e.id===n?e.mode:ft(rt?.type)??U);const t=rt?.props.id,o=Pt.current;if(Pt.current=null,!t)return;const i=it(t);Oo(String(t),{scroll:!r(o,i??null,le)})},[rt?.props.id,Oo]);const Io=Sn(e=>{yo(n=>G(n,e)?n:e),tt({type:"setUi",ui:{rightSideBarVisible:!0}})},[tt]),$o=mn(()=>{});$o.current=(e,n)=>{const t=e?Qr(e.zone??le)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==rt?.props.id?null:String(rt.props.id);yo(e=>G(e,n)?e:n),o!==r&&(No.current={id:o,mode:n},Mt.select(e))};const Po=Sn((e,n)=>$o.current(e,n),[]),To={kind:go.kind,mode:go,open:Io,show:e=>yo(e),reveal:()=>{Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Po},Mo=Y(To,{data:nt.data,selected:rt??null,zoneOf:e=>it(e)?.zone,readOnly:Boolean(Qn),select:e=>{yo(U),Mt.select({index:e})},replace:(e,n)=>Mt.replaceComponent(le,e,n),scrollTo:e=>Si(e)},{device:Wt,refreshes:Zt},{setView:qt,reveal:()=>{jt||tt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Ao=Mo.pinnedSource??!1,jo=Mo.resolveLeftView?Mo.resolveLeftView(_t,Gt):"media"===_t&&Gt?_t:"sections",Ro=J(),{isLockedBlock:Lo,duplicateBlocked:Eo,nestDepth:Vo,newSectionNode:Fo,canAddTo:Do,blockIsOffered:Wo}=Ro,Ho=Q(),{labelAtLevel:Uo,Icon:Go,useProducts:Yo}=Ho,Jo=Ho.rowName?(e,n,t)=>Ho.rowName(e,n,t):void 0,Qo=Sn(e=>{tt({type:"setUi",ui:{rightSideBarVisible:!0}}),c(e),Oo(e,{scroll:!0})},[tt,Oo]),{selectNode:Xo,openPartId:Ko}=v({mode:go,setMode:yo,onOpenPart:Qo}),[_o,qo]=yn(null);ke(null!==_o,()=>qo(null));const Zo=y(X()),er=Zo.collapsed,nr=Zo.panelWidths,[tr,or]=yn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(er);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
12
- return new Set}});kn(()=>{try{window.localStorage.setItem(er,JSON.stringify([...tr]))}catch{}},[tr]);const[rr,ir]=yn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(nr);if(!e)return{...k};const n=JSON.parse(e);return{left:S(Number(n.left)||k.left),right:S(Number(n.right)||k.right)}}catch{return{...k}}});kn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(nr,JSON.stringify(rr))}catch{}},300);return()=>clearTimeout(e)},[rr]);const lr=Sn((e,n)=>ir(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),sr=Sn(e=>lr("left",e),[lr]),dr=Sn(e=>lr("right",e),[lr]),ar=e=>tr.has(e),cr=e=>or(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),pr=mn(!1),ur=mn(null);kn(()=>{if(pr.current&&!io){const e=ur.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??to.current?.querySelector(`button[aria-label="${CSS.escape(St.add.title)}"]`))?.focus(),ur.current=null}pr.current=io},[io]),kn(()=>{if(!io||!ro)return;const e=e=>{"Escape"===e.key&&Ni()};return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[io,ro]),ke(io,()=>Ni()),kn(()=>{!jt&&io&&(lo(!1),po(null),so.current=!1)},[jt]),kn(()=>{if(!Yt)return ao.current&&tt({type:"setUi",ui:{leftSideBarVisible:!1}}),void(ao.current=!1);io&&(lo(!1),po(null),ao.current=so.current,so.current=!1),jt||(ao.current=!0,tt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[Yt]),kn(()=>{!jt&&Yt&&(ao.current=!1,Jt())},[jt]),kn(()=>{if(!Yt||!ro)return;const e=e=>{"Escape"===e.key&&Jt()};return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[Yt,ro]),ke(null!==Yt,()=>Jt());const fr=K(),hr=(e,n="success")=>{fr?fr(e,"error"===n?"error":"info"):"error"===n?zn.error(e,{duration:3200,sound:!1}):zn.success(e,{duration:1900,sound:!1})},mr=mn(null),[gr,yr]=yn(0),[kr,Sr]=yn(0),vr=_(),wr=mn(null),xr=e=>Math.max(0,e.clientHeight-(wr.current?.offsetHeight??0));kn(()=>{const e=mr.current;if(!e)return;const n=()=>{yr(e.clientWidth),Sr(xr(e))};n();const t=new ResizeObserver(n);return t.observe(e),wr.current&&t.observe(wr.current),()=>t.disconnect()},[]),vn(()=>{mr.current&&(yr(mr.current.clientWidth),Sr(xr(mr.current)))},[rr,jt,Rt]);const br=Wt===Ft?gr>0?gr:Et[Ft]:Et[Wt],zr=gr>0?Math.min(gr/br,"shrink"===Dt?1:2):1,Br=br*zr,Cr=gr>0&&Br>gr+1,Or={width:Br,height:kr||"100%",flex:"none",position:"relative"},Nr={width:br,height:kr?kr/zr:"100%",maxHeight:"none",transform:1!==zr?`scale(${zr})`:void 0,transformOrigin:"top left"},Ir=()=>tt({type:"setUi",ui:{leftSideBarVisible:!jt}}),$r=()=>tt({type:"setUi",ui:{rightSideBarVisible:!Rt}}),Pr=e=>{io&&(lo(!1),po(null),so.current=!1,jt&&_t===e)||Yt&&(ao.current=!1,Jt(),jt&&_t===e)||(jt&&_t===e?Ir():(qt(e),jt||tt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Tr=()=>{C(Le,{accept:"image/*",title:Bt.mediaLibrary})},Mr=()=>{yo(U),Mt.select(null),u()},Ar=()=>{yo(ht??U),Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}})},jr=nt.data.content??[],Rr=()=>{const e=jr.findIndex(mt),n=jr.findIndex(gt);return{floor:e>=0?e+1:0,cap:n>=0?n:jr.length}},Lr=lt,Er=Ro.stripCopy,Vr=e=>i(e,Er),Fr=x(),Dr=Te({data:nt.data,config:Lr,readOnly:Boolean(Qn),clipboard:Fr,strip:Er?e=>Er(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==cn||e.slot!==pn)return{min:0,max:n-1};const{floor:t,cap:o}=Rr();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&yo(U);const t=void 0===n||"node"===n?.kind?n:null;Mt.commitDocument(e,t)}}),Wr=e=>Uo(e,"block",lt.components[e]?.label??e),Hr=Sn(e=>lt.components[e]?.defaultProps??{},[lt]),Ur=e=>Uo(e,"section",Wr(e)),Gr=e=>l({type:e.type,props:e.props??{}},Ur(e.type),Jo),{nodeAddresses:Yr,zoneItems:Jr}=gn(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=de)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of ae(lt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(jr,le,0),{nodeAddresses:e,zoneItems:n}},[jr,lt]),Qr=Sn(e=>Jr.get(e)??[],[Jr]),Xr=e=>{const n=Yr.get(e);return n?Qr(n.zone)[n.index]:void 0},Kr=e=>ie(Ro,lt,e),_r=e=>{if(!Ro.slotsOf||e===le)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Xr(e.slice(0,n));if(!t)return null;const o=Kr(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},qr=(()=>{if(!q(go))return null;const e=`${go.nodeId}:${go.slot}`;return _r(e)?.slot.panel===go.kind?e:null})(),Zr=mn(null);kn(()=>{const e=Zr.current;if(Zr.current=null,!qr||!q(go))return;const n=go.nodeId;Oo(n,{scroll:e!==qr}),or(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[go]);const ei=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Yr.get(e);n&&(n.zone===le?vi(n.index):Ki(n.zone,n.index,e,Xr(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&qr!==i&&(Zr.current=i),Po(null,r),Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}}),Si(o)},ni=(e,n,t)=>{const o=`${e}:${n}`;if(or(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;qr!==o&&(Zr.current=o);Po(null,{kind:t,nodeId:e,slot:n})},ti=(e,n,t)=>{if(Qn||!Ro.moveSlot)return;const o=Xr(e),r=o?Kr(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:En,index:n},s=on(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=Ro.moveSlot(e,n,s);"string"==typeof d&&ni(e,d,i.panel)},oi=Yo(),ri=gn(()=>{const e=/* @__PURE__ */new Map;for(const n of oi??[])e.set(n.slug,n.name);return e},[oi]),ii=e=>s(e,Wr,Ho.plainText,e=>ri.get(e),Ho.rowName),li=(e,n)=>{const t=lt.components[e.type]?.fields,o=n===le||hl(n)?"section":"block",r=n===le&&(mt(e)||gt(e)||pt(e.type)),i="block"===o?d(t):r?null:a(t);return Ho.renamePropOf?Ho.renamePropOf(e,o,i):i},si=(e,n,t,o)=>{if(!(!Qn&&_o?.zone===e&&_o.index===n))return;const r=(t,o)=>{qo(null),o&&((e,n,t)=>{const o=Qr(e)[n];if(!o)return;const r=li(o,e);r&&Mt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
13
- return Pn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":St.rename,onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},di=n(Z(),zt),ai=di.scope({target:Xe,siteId:Wn,docId:Ke}),ci=lt,pi=(e,n)=>n===le?Ur(e):Wr(e),ui=(e,n,t)=>{const o=di.plan(ai,t,pi(t.type,e),ci);o&&(o.changed&&Mt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),hr(o.message))},fi=b({nodesIn:Qr,nodeAt:(e,n)=>Qr(e)[n]??null,labelOf:(e,n)=>n===le?Ur(e):Wr(e),renamePropOf:li,beginRename:(e,n)=>qo({zone:e,index:n}),history:{hasPast:ot.hasPast,hasFuture:ot.hasFuture,back:()=>ot.back(),forward:()=>ot.forward()},openAddSection:()=>{Mt.select(null),Ci(null)},openPageSettings:()=>{Mt.select(null),yo(U)},pageSettingsLabel:St.pageSettings,words:{menu:bt,styleClipboard:zt,screen:St.menu},readOnly:Boolean(Qn),collapseAll:()=>or(new Set(Qr(le).map(e=>String(e.props.id)))),onPasteRefused:e=>hr(e?St.pasteRefused({name:e.label}):St.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>gl(e,n),menuRows:Mo.menuRows,isLocked:e=>Lo(e.type),duplicateBlocked:e=>Eo(nt.data,e),permits:e=>se(lt,e.type),canAddTo:Do,nodeOps:Dr,isPinned:(e,n)=>n===le&&(mt(e)||gt(e)),sectionBand:Rr,openAddInside:(e,n)=>{e===le?vi(n):Mt.select({zone:e,index:n}),Ci(null)},locate:e=>Yr.get(e)??null,rowNameOf:(e,n)=>n===le?Gr(e):ii(e),selectAt:(e,n,t,o)=>{e===le?vi(n):Ki(e,n,t,o??"")},slotRung:e=>{const n=_r(e);return n?.slot.panel?{label:n.slot.label,select:()=>ei(n.node,n.slot,!1)}:null},style:{held:()=>O(ai),canCopy:e=>di.rows(ci,e).some(e=>!1!==e.counted),copy:(e,n)=>di.copy(ai,e,pi(e.type,n),ci),paste:(e,n,t)=>ui(e,n,t)},keys:_n?{target:ro,selected:()=>{const e=nt.ui.itemSelector;return e?{zone:e.zone??le,index:e.index}:null},held:()=>Fr.get(),readOnly:Boolean(Qn),onDone:({done:e,name:n})=>{"copied"===e&&hr(St.copied({name:n}))}}:void 0},oo),hi=mn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});kn(()=>{hi.current={copy:(e,n)=>di.copy(ai,e,pi(e.type,n),ci),paste:ui,at:()=>{const e=nt.ui.itemSelector;if(!e)return null;const n=e.zone??le,t=Qr(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Qn)}});const mi=Sn(e=>{const n=N(e);if(!n)return;const t=hi.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);kn(()=>{if(!ro)return;const e=e=>mi(e);return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[mi,ro]),dn(oo,"keydown",mi);const gi=jr.map(e=>e.props.id).join("|");kn(()=>{const e=oo?.document??null,n=oo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void mo(e=>e.length?[]:e);const n=jr.findIndex(gt),t=n>=0?n:jr.length,o=n=>{const t=jr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(sn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=Ln(l&&s?(s.bottom+l.top)/2:l?l.top:s.bottom,Math.max(-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}mo(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[oo,gi,Wt,zr,jt,Rt,rt?.props.id]);const yi=oo?.document??null,ki=oo?.window??null;kn(()=>{const e=no.current;if(!e||!yi||!ki)return;const n=[],t=()=>{const n=yi.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&ki.scrollTo({left:ki.scrollX,top:ki.scrollY+t,behavior:"instant"}),!0};return no.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[yi,ki]);const Si=e=>{Mo.holdCanvasOn?Mo.holdCanvasOn(e):c(e)},vi=e=>{yo(U),Mt.select({index:e}),Mo.sectionPressed?.(jr[e]);const n=jr[e]?.props?.id;n&&Si(n)},wi=e=>{const{floor:n,cap:t}=Rr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=rt&&go.kind!==ht?.kind?jr.findIndex(e=>e.props.id===rt.props.id):-1;return o(r>=0?r+1:t)},xi=(e,n)=>{const{floor:t,cap:o}=Rr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(Mt.reorderComponent(le,e,i),Mt.select({index:i}),{moved:!0,dest:i})},bi=(e,n,t,o)=>{yo(U),Mt.select(o?{index:o.index,zone:o.zone}:{index:e}),c(n),hr(St.sectionAdded({name:t}))},zi=(e,n)=>{const t=wi(n),o=Fo(e,{nodeDefaults:Hr,newNodeId:fe,sectionLabel:Ur,blockIsOffered:Wo}),r=o?Mt.insertNode(le,t,o):Mt.insertSection(e,t);return bi(t,r,Ur(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of ae(lt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Do(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},Bi=(e,n,t)=>{const o=wi(t),r=Mt.insertNode(le,o,n);return bi(o,r,e),o},Ci=e=>Oi(le,e),Oi=(e,n)=>{ur.current=document.activeElement??null,Yt&&(so.current=ao.current,ao.current=!1,Jt()),po(null===n?null:{zone:e,index:n}),lo(!0),jt||(so.current=!0,tt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Ni=()=>{lo(!1),po(null),so.current&&tt({type:"setUi",ui:{leftSideBarVisible:!1}}),so.current=!1},Ii=(e,n,t)=>{if("section"===e.kind)Mt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;Mt.insertNode(n,t,Vr(e.template.node))}yo(U),Mt.select({index:t,zone:n})},$i=(e,n)=>Ho.rowName?n?mt(e)?Ho.rowName(e,"section",St.header):gt(e)?Ho.rowName(e,"section",St.footer):pt(e.type)?Ho.rowName(e,"section",Wr(e.type)):Gr(e):ii(e):n?Ur(e.type):Wr(e.type),Pi=e=>n=>{e()},Ti=()=>Mo.editPinnedSource?.(),Mi=(e,n,t)=>{if(Qn)return null;const o=Qr(e)[n];return o&&!se(lt,o.type).delete?null:/* @__PURE__ */Pn(Oe,{kind:"delete",label:St.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Qr(e)[n]?.props?.id;null!=t&&Dr.remove(String(t))})(e,n),children:/* @__PURE__ */Pn(On,{size:15})})},Ai=e=>Ho.rowPreview?.(e)||void 0,ji=e=>Ho.rowMarks?.(e)??void 0,Ri=(e,n,t)=>Ho.rowActions?.(e,n,t)??null,Li=(e,n,t,o)=>{if(Qn)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
14
- return Pn(Oe,{kind:"eye",label:r?St.showNamed({name:o}):St.hideNamed({name:o}),onClick:()=>Vi(e,n,t),children:/* @__PURE__ */Pn(r?Nn:In,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},Ei=e=>{const n=Ur(jr[e]?.type??""),t=n?St.addSectionBefore({name:n}):St.addSectionHere;return El(le,e,()=>Ci(e),t)},Vi=(e,n,t)=>{Mt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Fi=e=>ce(lt,e),Di=e=>ae(lt,e),Wi=e=>Ro.slotsOf?Kr(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:pe(e,n.slot)})):[{slot:null,rung:null,kids:Di(e)}],Hi=e=>Ro.slotsOf?Wi(e).flatMap(e=>e.kids):Di(e),Ui=e=>Boolean(Ro.slotsOf)&&Kr(e).some(e=>e.rung),Gi=(e,n,t)=>null===t?void 0===n?Do(e):Do(e,n):Do(e,n,t),Yi=(e,n,t)=>{const o=ue(lt,e.type,n)&&(t||Hi(e).length>0||Ui(e));return{collapsible:o,folded:o&&ar(String(e.props.id))}},Ji=(e,n,t)=>Wi(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Yi(e,r,t(e.type)).collapsible?[String(e.props.id),...Ji(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Qi=e=>Hi(e).length>0||Ui(e)||Boolean(Do(e.type)),Xi=e=>Boolean(Do(e)),Ki=(e,n,t,o)=>{if(yo(U),Do(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),Mt.select({index:n,zone:e}),c(t)}else Mt.select({index:n,zone:e}),Si(t)},_i=(e,n,t,o,r)=>{const i=`${e}:${n}`;Mt.insertComponent(i,t,o),Do(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),Mt.select({index:o,zone:i})}):Mt.select({index:o,zone:i})},qi=(e,n,t)=>{Mt.insertComponent(e,n,t),yo(U),Mt.select({index:t,zone:e})},Zi=mn(/* @__PURE__ */new Set);kn(()=>{jr.forEach(e=>{const n=Do(e.type)?.spec;if(!n)return;const t=e.props.id;if(Zi.current.has(t))return;Zi.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(Hr)).forEach((e,t)=>$t.seedChild(o,t,n.childType,e))})},[jr,$t,Hr]);const el=mn(/* @__PURE__ */new Set);kn(()=>{jr.forEach((n,t)=>{const o=n.props.id;if(el.current.has(o))return;const r=e(n,Fi(n.type));el.current.add(o),r&&$t.replaceComponent(le,t,{...n,props:r})})},[jr,$t]),ee($t,lt);const nl=jr.findIndex(gt),tl=nl>=0?jr[nl]:null,ol=yt?jr.findIndex(mt):-1,rl=ol>=0?jr[ol]:null,il=jr.find(e=>e.type===at)??null,ll=jr.find(e=>e.type===ct)??null,sl=nl>=0?nl:jr.length,dl=[];jr.forEach(e=>{gt(e)||(Qi(e)&&dl.push(String(e.props.id)),dl.push(...Ji(e,1,Xi)))}),tl&&(dl.push(String(tl.props.id)),dl.push(...Ji(tl,1,Xi)));const al=dl.length>0&&dl.every(e=>tr.has(e)),cl=e=>{const n=Ho.blockRowName(e,Wr);return Ho.rowName?Ho.rowName(e,"block",n):n},pl=(e,n,t,o)=>{const r=Qr(e)[t];if(!r)return;const i={...un(e),index:t},l={...un(n),index:Math.min(Math.max(o,0),Qr(n).length)},s=on(i,l);if(e!==n||s!==t)try{Dr.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof fn))throw e}},ul=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Di(e))n.add(r),t(o)};for(const t of Fi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},fl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Yr.get(n);if(!e)return null;if(e.zone===le)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},hl=e=>{const n=e.slice(0,e.indexOf(":")),t=jr.find(e=>pt(e.type)&&String(e.props.id)===n);return t&&ut(n)===e?t:null},ml=(e,n,t)=>{if(e.rung){const t=Xr(e.rung.nodeId),o=t?Kr(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===En&&n.index>=0&&n.index<=o}if(n.slot===En)return!1;if(e.add)return kl(e.add,n);const o=an(n);if(pt(e.type))return!1;const r=hl(o),i=hl(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=Qr(o).length);if(e.zone===le||o===le){if(e.zone!==o)return!1;const{floor:t,cap:r}=Rr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Qr(o).length)return!1;if(e.zone===o)return!0;const l=tl&&!st.lastIsOpen?String(tl.props.id):null;return(!l||fl(e.zone)!==l&&fl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Qr(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Yr.get(i),s=l?Qr(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ul(r).has(n))return!1;const d=Do(s.type,Vo(nt?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Qr(n),r))})(e.zone,o,e.index,t)},gl=(e,n)=>{const t=an(e.from);if(t===an(n))return!0;const o=e.node;return ml({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},yl=e=>{const n=e.slice(0,e.indexOf(":")),t=Yr.get(n),o=t?Qr(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Do(o.type,Vo(nt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=r.choices??(r.spec?[{type:r.spec.childType,label:Wr(r.spec.childType)}]:[]),l=_r(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:$i(o,t.zone===le)}},kl=(e,n)=>{const t=an(n);if("block"!==e.kind){if(hl(t))return n.index>=0&&n.index<=Qr(t).length;if(t!==le)return!1;const{floor:e,cap:o}=Rr();return n.index>=e&&n.index<=o}if(t===le)return!1;const o=yl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Qr(t))},Sl=(e,n)=>{e.rung?ti(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&hl(an(n)))return void Ii(e,an(n),n.index);if("section"===e.kind)return void zi(e.type,n.index);if("template"===e.kind)return void Bi(e.template.name,Vr(e.template.node),n.index);const t=an(n),o=yl(t);o&&(o.target.spec?_i(o.parentId,o.target.slot,e.type,n.index,o.parent.type):qi(t,e.type,n.index))})(e.add,n):e.zone===le?xi(e.index,n.index):pl(e.zone,an(n),e.index,n.index)},[vl]=yn(()=>nn()),wl=tn({keyOf:e=>e.id,readOnly:Boolean(Qn),session:vl,canDrop:ml,onDrop:Sl,onStep:(e,n)=>{e.rung?ti(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===le?((e,n)=>{const t=Ur(jr[e]?.type??""),o=xi(e,n<0?e-1:e+2);if(!o.moved)return void hr(n<0?St.sectionFirst({name:t}):St.sectionLast({name:t}));const{floor:r,cap:i}=Rr();hr(St.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):pl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),xl=Sn(e=>{const{floor:n,cap:t}=Rr(),o=[];for(const r of e.nodes){const e=an(r.place),i=Qr(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(mt(i)||gt(i)||Lo(i.type))continue;if(pt(i.type))continue;const l=Boolean(hl(e)),s=e===le||l;e===le&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?Ur(i.type):ii(i),from:r.place})}return{sources:o,zones:e.zones.flatMap(e=>{const n=an(e.list);return n===le&&0===e.children.length?[{...e,addLabel:St.addSection,addAlways:!0}]:e.children.length>0||Boolean(yl(n)?.choices.length)||Boolean(hl(n))?[e]:[]})}},[nt.data]),bl=null==rt?.props.id?null:String(rt.props.id),zl=Sn(e=>{const n=lt,t=e=>!e.item.rung&&null!==hn(nt.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(bl);return i||(r(Me(nt.data,n,o.item.id,bl))??o)},[nt.data,lt,bl]),Bl=e=>{yo(U),Mt.select(e.zone===le?{index:e.index}:{index:e.index,zone:e.zone})},Cl=ne(),Ol=()=>({data:nt.data,device:Wt,ops:Mt,inspector:To}),Nl=Cl?.model,Il=gn(()=>Nl?e=>Nl(e,xl(e),Ol()):xl,[Nl,xl,Wt]),$l=Cl?.measure,Pl=$l?(e,n)=>$l(e,n,Ol()):void 0,Tl=Cl?.canDrop,Ml=Tl?(e,n)=>Tl(e,n,ml,Ol()):ml,Al=Cl?.drop,jl=Al?(e,n)=>Al(e,n,Sl,Ol()):Sl,Rl=Cl?.pick,Ll=Rl?e=>Rl(e,Bl,Ol()):Bl,El=(e,n,t,o)=>/* @__PURE__ */Pn(Ne,{...Qn?{}:wl.seam({place:{...un(e),index:n}}),onAdd:Qn?void 0:t,label:o},`seam:${e}:${n}`),Vl={rowClick:Pi,isCollapsed:ar,toggleCollapse:cr},Fl=e=>{const n=String(e.props.id),t=jr.findIndex(e=>String(e.props.id)===n),o=ut(n),r=Qr(o),i=ar(n),l=Wr(e.type),s=Ho.rowName?Ho.rowName(e,"section",l):l,d=e=>El(o,e,()=>Oi(o,e),St.addSectionHere);/* @__PURE__ */
11
+ /* @__PURE__ */Pn("path",{d:"M5 12h14"})]})})}var Rn=`${ln}, ${sn}`;function Ln(e,n,t){const o=t-n;if(o<6)return null;if(o<26)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+13),t-13))}}var En="__rungs";var Vn="screen:band",Fn={duplicate:!0,delete:!0};function Wn(){const Le=ye(),{target:Ke,docId:Qe,capabilities:ln,currentSlug:Wn,siteId:Hn,onPublish:Dn,saveState:Un,saveConflict:Gn,retrySave:Xn,toggleAutoSave:Yn,readOnly:Jn,readOnlyReason:Kn=null}=B(),Qn=A(),_n=j(),{mediaEditing:qn,hasEditGuard:Zn,hasPinnedChrome:et}=ln,{appState:nt,dispatch:tt,history:ot,selectedItem:rt,getSelectorForId:it,config:lt}=we(e=>e),st=R(),{first:dt,firstGroup:at,lastGroup:ct,isSectionGroup:pt,sectionGroupZone:ut,panelOf:ft}=st,ht=ft(dt),mt=e=>oe(st,e),gt=e=>re(st,e),yt="node"===st.firstRow,kt=st.band??null,St=qe("screen",ve),vt=qe("tree",Ie),wt=qe("drag",en),xt=qe("save",Re),bt=qe("menu",$e),zt=qe("styleClipboard",Se),Bt=qe("chrome",_e),Ct=L()??`/${Wn}`,Ot=E(),Nt=V(),It=w({readOnly:Jn}),$t=w({readOnly:Jn,foldIntoHistory:!0}),Pt=mn(null),Tt=xe(),Mt=gn(()=>({...It,select:e=>{Pt.current=e,It.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Tt.config;Pt.current=Pe(e,t,n)}It.commitDocument(e,n)}}),[It,Tt]),At=nt.ui,jt=At.leftSideBarVisible,Rt=At.rightSideBarVisible,{options:Lt,widths:Et,initial:Vt,fluid:Ft,fit:Wt}=F(),[Ht,Dt]=yn(Vt),Ut=he(),Gt=qn&&null!==Ut,Xt=me(),Yt=ge();W(rt?.props.id);const{read:Jt,write:Kt,forSelection:Qt}=H(),[_t,qt]=yn(Jt);kn(()=>{Kt(_t)},[_t]);const[Zt,eo]=yn(0),no=mn(null),to=mn(null),oo=rn(to,{readySelector:Rn}),ro=f(to);h(to,oo);const[io,lo]=yn(!1),so=mn(!1),ao=mn(!1),[co,po]=yn(null),uo=D(),fo=e=>po(null===e?null:{zone:le,index:e}),[ho,mo]=yn([]),[go,yo]=yn(U),ko="puck"===go.kind,So=io&&!co&&uo.railTarget?uo.railTarget(nt.data,{node:rt??null,mode:go}):null,vo=So?{zone:an(So),index:So.index}:null,wo=co??vo,xo=wo&&wo.zone===le?wo.index:null,bo=t(go,rt?.props.id),[zo,Bo]=yn(null);kn(()=>{zo&&(o(),Bo(null))},[zo]);const Co=mn(it);Co.current=it;const Oo=Sn((e,{scroll:n})=>{qt(n=>Qt(e,n)),n&&Bo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Co.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&or(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),No=mn(null);kn(()=>{const e=No.current;No.current=null;const n=null==rt?.props.id?null:String(rt.props.id);yo(e&&e.id===n?e.mode:ft(rt?.type)??U);const t=rt?.props.id,o=Pt.current;if(Pt.current=null,!t)return;const i=it(t);Oo(String(t),{scroll:!r(o,i??null,le)})},[rt?.props.id,Oo]);const Io=Sn(e=>{yo(n=>G(n,e)?n:e),tt({type:"setUi",ui:{rightSideBarVisible:!0}})},[tt]),$o=mn(()=>{});$o.current=(e,n)=>{const t=e?Jr(e.zone??le)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==rt?.props.id?null:String(rt.props.id);yo(e=>G(e,n)?e:n),o!==r&&(No.current={id:o,mode:n},Mt.select(e))};const Po=Sn((e,n)=>$o.current(e,n),[]),To={kind:go.kind,mode:go,open:Io,show:e=>yo(e),reveal:()=>{Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Po},Mo=X(To,{data:nt.data,selected:rt??null,zoneOf:e=>it(e)?.zone,readOnly:Boolean(Jn),select:e=>{yo(U),Mt.select({index:e})},replace:(e,n)=>Mt.replaceComponent(le,e,n),scrollTo:e=>Si(e)},{device:Ht,refreshes:Zt},{setView:qt,reveal:()=>{jt||tt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Ao=Mo.pinnedSource??!1,jo=Mo.resolveLeftView?Mo.resolveLeftView(_t,Gt):"media"===_t&&Gt?_t:"sections",Ro=Y(),{isLockedBlock:Lo,duplicateBlocked:Eo,nestDepth:Vo,newSectionNode:Fo,canAddTo:Wo,blockIsOffered:Ho}=Ro,Do=J(),{labelAtLevel:Uo,Icon:Go,useProducts:Xo}=Do,Yo=Do.rowName?(e,n,t)=>Do.rowName(e,n,t):void 0,Jo=Sn(e=>{tt({type:"setUi",ui:{rightSideBarVisible:!0}}),c(e),Oo(e,{scroll:!0})},[tt,Oo]),{selectNode:Ko,openPartId:Qo}=v({mode:go,setMode:yo,onOpenPart:Jo}),[_o,qo]=yn(null);ke(null!==_o,()=>qo(null));const Zo=y(K()),er=Zo.collapsed,nr=Zo.panelWidths,[tr,or]=yn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(er);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
12
+ return new Set}});kn(()=>{try{window.localStorage.setItem(er,JSON.stringify([...tr]))}catch{}},[tr]);const[rr,ir]=yn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(nr);if(!e)return{...k};const n=JSON.parse(e);return{left:S(Number(n.left)||k.left),right:S(Number(n.right)||k.right)}}catch{return{...k}}});kn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(nr,JSON.stringify(rr))}catch{}},300);return()=>clearTimeout(e)},[rr]);const lr=Sn((e,n)=>ir(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),sr=Sn(e=>lr("left",e),[lr]),dr=Sn(e=>lr("right",e),[lr]),ar=e=>tr.has(e),cr=e=>or(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),pr=mn(!1),ur=mn(null);kn(()=>{if(pr.current&&!io){const e=ur.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??to.current?.querySelector(`button[aria-label="${CSS.escape(St.add.title)}"]`))?.focus(),ur.current=null}pr.current=io},[io]),kn(()=>{if(!io||!ro)return;const e=e=>{"Escape"===e.key&&Ni()};return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[io,ro]),ke(io,()=>Ni()),kn(()=>{!jt&&io&&(lo(!1),po(null),so.current=!1)},[jt]),kn(()=>{if(!Xt)return ao.current&&tt({type:"setUi",ui:{leftSideBarVisible:!1}}),void(ao.current=!1);io&&(lo(!1),po(null),ao.current=so.current,so.current=!1),jt||(ao.current=!0,tt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[Xt]),kn(()=>{!jt&&Xt&&(ao.current=!1,Yt())},[jt]),kn(()=>{if(!Xt||!ro)return;const e=e=>{"Escape"===e.key&&Yt()};return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[Xt,ro]),ke(null!==Xt,()=>Yt());const fr=Q(),hr=(e,n="success")=>{fr?fr(e,"error"===n?"error":"info"):"error"===n?zn.error(e,{duration:3200,sound:!1}):zn.success(e,{duration:1900,sound:!1})},mr=mn(null),[gr,yr]=yn(0),[kr,Sr]=yn(0),vr=_(),wr=mn(null),xr=e=>Math.max(0,e.clientHeight-(wr.current?.offsetHeight??0));kn(()=>{const e=mr.current;if(!e)return;const n=()=>{yr(e.clientWidth),Sr(xr(e))};n();const t=new ResizeObserver(n);return t.observe(e),wr.current&&t.observe(wr.current),()=>t.disconnect()},[]),vn(()=>{mr.current&&(yr(mr.current.clientWidth),Sr(xr(mr.current)))},[rr,jt,Rt]);const br=Ht===Ft?gr>0?gr:Et[Ft]:Et[Ht],zr=gr>0?Math.min(gr/br,"shrink"===Wt?1:2):1,Br=br*zr,Cr=gr>0&&Br>gr+1,Or={width:Br,height:kr||"100%",flex:"none",position:"relative"},Nr={width:br,height:kr?kr/zr:"100%",maxHeight:"none",transform:1!==zr?`scale(${zr})`:void 0,transformOrigin:"top left"},Ir=()=>tt({type:"setUi",ui:{leftSideBarVisible:!jt}}),$r=()=>tt({type:"setUi",ui:{rightSideBarVisible:!Rt}}),Pr=e=>{io&&(lo(!1),po(null),so.current=!1,jt&&_t===e)||Xt&&(ao.current=!1,Yt(),jt&&_t===e)||(jt&&_t===e?Ir():(qt(e),jt||tt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Tr=()=>{C(Le,{accept:"image/*",title:Bt.mediaLibrary})},Mr=()=>{yo(U),Mt.select(null),u()},Ar=()=>{yo(ht??U),Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}})},jr=nt.data.content??[],Rr=()=>{const e=jr.findIndex(mt),n=jr.findIndex(gt);return{floor:e>=0?e+1:0,cap:n>=0?n:jr.length}},Lr=lt,Er=Ro.stripCopy,Vr=e=>i(e,Er),Fr=x(),Wr=Te({data:nt.data,config:Lr,readOnly:Boolean(Jn),clipboard:Fr,strip:Er?e=>Er(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==cn||e.slot!==pn)return{min:0,max:n-1};const{floor:t,cap:o}=Rr();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&yo(U);const t=void 0===n||"node"===n?.kind?n:null;Mt.commitDocument(e,t)}}),Hr=e=>Uo(e,"block",lt.components[e]?.label??e),Dr=Sn(e=>lt.components[e]?.defaultProps??{},[lt]),Ur=e=>Uo(e,"section",Hr(e)),Gr=e=>l({type:e.type,props:e.props??{}},Ur(e.type),Yo),{nodeAddresses:Xr,zoneItems:Yr}=gn(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=de)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of ae(lt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(jr,le,0),{nodeAddresses:e,zoneItems:n}},[jr,lt]),Jr=Sn(e=>Yr.get(e)??[],[Yr]),Kr=e=>{const n=Xr.get(e);return n?Jr(n.zone)[n.index]:void 0},Qr=e=>ie(Ro,lt,e),_r=e=>{if(!Ro.slotsOf||e===le)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Kr(e.slice(0,n));if(!t)return null;const o=Qr(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},qr=(()=>{if(!q(go))return null;const e=`${go.nodeId}:${go.slot}`;return _r(e)?.slot.panel===go.kind?e:null})(),Zr=mn(null);kn(()=>{const e=Zr.current;if(Zr.current=null,!qr||!q(go))return;const n=go.nodeId;Oo(n,{scroll:e!==qr}),or(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[go]);const ei=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Xr.get(e);n&&(n.zone===le?vi(n.index):Qi(n.zone,n.index,e,Kr(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&qr!==i&&(Zr.current=i),Po(null,r),Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}}),Si(o)},ni=(e,n,t)=>{const o=`${e}:${n}`;if(or(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;qr!==o&&(Zr.current=o);Po(null,{kind:t,nodeId:e,slot:n})},ti=(e,n,t)=>{if(Jn||!Ro.moveSlot)return;const o=Kr(e),r=o?Qr(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:En,index:n},s=on(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=Ro.moveSlot(e,n,s);"string"==typeof d&&ni(e,d,i.panel)},oi=Xo(),ri=gn(()=>{const e=/* @__PURE__ */new Map;for(const n of oi??[])e.set(n.slug,n.name);return e},[oi]),ii=e=>s(e,Hr,Do.plainText,e=>ri.get(e),Do.rowName),li=(e,n)=>{const t=lt.components[e.type]?.fields,o=n===le||hl(n)?"section":"block",r=n===le&&(mt(e)||gt(e)||pt(e.type)),i="block"===o?d(t):r?null:a(t);return Do.renamePropOf?Do.renamePropOf(e,o,i):i},si=(e,n,t,o)=>{if(!(!Jn&&_o?.zone===e&&_o.index===n))return;const r=(t,o)=>{qo(null),o&&((e,n,t)=>{const o=Jr(e)[n];if(!o)return;const r=li(o,e);r&&Mt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
13
+ return Pn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":St.rename,onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},di=n(Z(),zt),ai=di.scope({target:Ke,siteId:Hn,docId:Qe}),ci=lt,pi=(e,n)=>n===le?Ur(e):Hr(e),ui=(e,n,t)=>{const o=di.plan(ai,t,pi(t.type,e),ci);o&&(o.changed&&Mt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),hr(o.message))},fi=b({nodesIn:Jr,nodeAt:(e,n)=>Jr(e)[n]??null,labelOf:(e,n)=>n===le?Ur(e):Hr(e),renamePropOf:li,beginRename:(e,n)=>qo({zone:e,index:n}),history:{hasPast:ot.hasPast,hasFuture:ot.hasFuture,back:()=>ot.back(),forward:()=>ot.forward()},openAddSection:()=>{Mt.select(null),Ci(null)},openPageSettings:()=>{Mt.select(null),yo(U)},pageSettingsLabel:St.pageSettings,words:{menu:bt,styleClipboard:zt,screen:St.menu},readOnly:Boolean(Jn),collapseAll:()=>or(new Set(Jr(le).map(e=>String(e.props.id)))),onPasteRefused:e=>hr(e?St.pasteRefused({name:e.label}):St.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>gl(e,n),menuRows:Mo.menuRows,isLocked:e=>Lo(e.type),duplicateBlocked:e=>Eo(nt.data,e),permits:e=>se(lt,e.type),canAddTo:Wo,nodeOps:Wr,isPinned:(e,n)=>n===le&&(mt(e)||gt(e)),sectionBand:Rr,openAddInside:(e,n)=>{e===le?vi(n):Mt.select({zone:e,index:n}),Ci(null)},locate:e=>Xr.get(e)??null,rowNameOf:(e,n)=>n===le?Gr(e):ii(e),selectAt:(e,n,t,o)=>{e===le?vi(n):Qi(e,n,t,o??"")},slotRung:e=>{const n=_r(e);return n?.slot.panel?{label:n.slot.label,select:()=>ei(n.node,n.slot,!1)}:null},style:{held:()=>O(ai),canCopy:e=>di.rows(ci,e).some(e=>!1!==e.counted),copy:(e,n)=>di.copy(ai,e,pi(e.type,n),ci),paste:(e,n,t)=>ui(e,n,t)},keys:_n?{target:ro,selected:()=>{const e=nt.ui.itemSelector;return e?{zone:e.zone??le,index:e.index}:null},held:()=>Fr.get(),readOnly:Boolean(Jn),onDone:({done:e,name:n})=>{"copied"===e&&hr(St.copied({name:n}))}}:void 0},oo),hi=mn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});kn(()=>{hi.current={copy:(e,n)=>di.copy(ai,e,pi(e.type,n),ci),paste:ui,at:()=>{const e=nt.ui.itemSelector;if(!e)return null;const n=e.zone??le,t=Jr(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Jn)}});const mi=Sn(e=>{const n=N(e);if(!n)return;const t=hi.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);kn(()=>{if(!ro)return;const e=e=>mi(e);return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[mi,ro]),dn(oo,"keydown",mi);const gi=jr.map(e=>e.props.id).join("|");kn(()=>{const e=oo?.document??null,n=oo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void mo(e=>e.length?[]:e);const n=jr.findIndex(gt),t=n>=0?n:jr.length,o=n=>{const t=jr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(sn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=Ln(l&&s?(s.bottom+l.top)/2:l?l.top:s.bottom,Math.max(-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}mo(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[oo,gi,Ht,zr,jt,Rt,rt?.props.id]);const yi=oo?.document??null,ki=oo?.window??null;kn(()=>{const e=no.current;if(!e||!yi||!ki)return;const n=[],t=()=>{const n=yi.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&ki.scrollTo({left:ki.scrollX,top:ki.scrollY+t,behavior:"instant"}),!0};return no.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[yi,ki]);const Si=e=>{Mo.holdCanvasOn?Mo.holdCanvasOn(e):c(e)},vi=e=>{yo(U),Mt.select({index:e}),Mo.sectionPressed?.(jr[e]);const n=jr[e]?.props?.id;n&&Si(n)},wi=e=>{const{floor:n,cap:t}=Rr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=rt&&go.kind!==ht?.kind?jr.findIndex(e=>e.props.id===rt.props.id):-1;return o(r>=0?r+1:t)},xi=(e,n)=>{const{floor:t,cap:o}=Rr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(Mt.reorderComponent(le,e,i),Mt.select({index:i}),{moved:!0,dest:i})},bi=(e,n,t,o)=>{yo(U),Mt.select(o?{index:o.index,zone:o.zone}:{index:e}),c(n),hr(St.sectionAdded({name:t}))},zi=(e,n)=>{const t=wi(n),o=Fo(e,{nodeDefaults:Dr,newNodeId:fe,sectionLabel:Ur,blockIsOffered:Ho}),r=o?Mt.insertNode(le,t,o):Mt.insertSection(e,t);return bi(t,r,Ur(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of ae(lt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Wo(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},Bi=(e,n,t)=>{const o=wi(t),r=Mt.insertNode(le,o,n);return bi(o,r,e),o},Ci=e=>Oi(le,e),Oi=(e,n)=>{ur.current=document.activeElement??null,Xt&&(so.current=ao.current,ao.current=!1,Yt()),po(null===n?null:{zone:e,index:n}),lo(!0),jt||(so.current=!0,tt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Ni=()=>{lo(!1),po(null),so.current&&tt({type:"setUi",ui:{leftSideBarVisible:!1}}),so.current=!1},Ii=(e,n,t)=>{if("section"===e.kind)Mt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;Mt.insertNode(n,t,Vr(e.template.node))}yo(U),Mt.select({index:t,zone:n})},$i=(e,n)=>Do.rowName?n?mt(e)?Do.rowName(e,"section",St.header):gt(e)?Do.rowName(e,"section",St.footer):pt(e.type)?Do.rowName(e,"section",Hr(e.type)):Gr(e):ii(e):n?Ur(e.type):Hr(e.type),Pi=e=>n=>{e()},Ti=()=>Mo.editPinnedSource?.(),Mi=(e,n,t)=>{if(Jn)return null;const o=Jr(e)[n];return o&&!se(lt,o.type).delete?null:/* @__PURE__ */Pn(Oe,{kind:"delete",label:St.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Jr(e)[n]?.props?.id;null!=t&&Wr.remove(String(t))})(e,n),children:/* @__PURE__ */Pn(On,{size:15})})},Ai=e=>Do.rowPreview?.(e)||void 0,ji=e=>Do.rowMarks?.(e)??void 0,Ri=(e,n,t)=>Do.rowActions?.(e,n,t)??null,Li=(e,n,t,o)=>{if(Jn)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
14
+ return Pn(Oe,{kind:"eye",label:r?St.showNamed({name:o}):St.hideNamed({name:o}),onClick:()=>Vi(e,n,t),children:/* @__PURE__ */Pn(r?Nn:In,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},Ei=e=>{const n=Ur(jr[e]?.type??""),t=n?St.addSectionBefore({name:n}):St.addSectionHere;return El(le,e,()=>Ci(e),t)},Vi=(e,n,t)=>{Mt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Fi=e=>ce(lt,e),Wi=e=>ae(lt,e),Hi=e=>Ro.slotsOf?Qr(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:pe(e,n.slot)})):[{slot:null,rung:null,kids:Wi(e)}],Di=e=>Ro.slotsOf?Hi(e).flatMap(e=>e.kids):Wi(e),Ui=e=>Boolean(Ro.slotsOf)&&Qr(e).some(e=>e.rung),Gi=(e,n,t)=>null===t?void 0===n?Wo(e):Wo(e,n):Wo(e,n,t),Xi=(e,n,t)=>{const o=ue(lt,e.type,n)&&(t||Di(e).length>0||Ui(e));return{collapsible:o,folded:o&&ar(String(e.props.id))}},Yi=(e,n,t)=>Hi(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Xi(e,r,t(e.type)).collapsible?[String(e.props.id),...Yi(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ji=e=>Di(e).length>0||Ui(e)||Boolean(Wo(e.type)),Ki=e=>Boolean(Wo(e)),Qi=(e,n,t,o)=>{if(yo(U),Wo(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),Mt.select({index:n,zone:e}),c(t)}else Mt.select({index:n,zone:e}),Si(t)},_i=(e,n,t,o,r)=>{const i=`${e}:${n}`;Mt.insertComponent(i,t,o),Wo(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),Mt.select({index:o,zone:i})}):Mt.select({index:o,zone:i})},qi=(e,n,t)=>{Mt.insertComponent(e,n,t),yo(U),Mt.select({index:t,zone:e})},Zi=mn(/* @__PURE__ */new Set);kn(()=>{jr.forEach(e=>{const n=Wo(e.type)?.spec;if(!n)return;const t=e.props.id;if(Zi.current.has(t))return;Zi.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(Dr)).forEach((e,t)=>$t.seedChild(o,t,n.childType,e))})},[jr,$t,Dr]);const el=mn(/* @__PURE__ */new Set);kn(()=>{jr.forEach((n,t)=>{const o=n.props.id;if(el.current.has(o))return;const r=e(n,Fi(n.type));el.current.add(o),r&&$t.replaceComponent(le,t,{...n,props:r})})},[jr,$t]),ee($t,lt);const nl=jr.findIndex(gt),tl=nl>=0?jr[nl]:null,ol=yt?jr.findIndex(mt):-1,rl=ol>=0?jr[ol]:null,il=jr.find(e=>e.type===at)??null,ll=jr.find(e=>e.type===ct)??null,sl=nl>=0?nl:jr.length,dl=[];jr.forEach(e=>{gt(e)||(Ji(e)&&dl.push(String(e.props.id)),dl.push(...Yi(e,1,Ki)))}),tl&&(dl.push(String(tl.props.id)),dl.push(...Yi(tl,1,Ki)));const al=dl.length>0&&dl.every(e=>tr.has(e)),cl=e=>{const n=Do.blockRowName(e,Hr);return Do.rowName?Do.rowName(e,"block",n):n},pl=(e,n,t,o)=>{const r=Jr(e)[t];if(!r)return;const i={...un(e),index:t},l={...un(n),index:Math.min(Math.max(o,0),Jr(n).length)},s=on(i,l);if(e!==n||s!==t)try{Wr.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof fn))throw e}},ul=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Wi(e))n.add(r),t(o)};for(const t of Fi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},fl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Xr.get(n);if(!e)return null;if(e.zone===le)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},hl=e=>{const n=e.slice(0,e.indexOf(":")),t=jr.find(e=>pt(e.type)&&String(e.props.id)===n);return t&&ut(n)===e?t:null},ml=(e,n,t)=>{if(e.rung){const t=Kr(e.rung.nodeId),o=t?Qr(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===En&&n.index>=0&&n.index<=o}if(n.slot===En)return!1;if(e.add)return kl(e.add,n);const o=an(n);if(pt(e.type))return!1;const r=hl(o),i=hl(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=Jr(o).length);if(e.zone===le||o===le){if(e.zone!==o)return!1;const{floor:t,cap:r}=Rr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Jr(o).length)return!1;if(e.zone===o)return!0;const l=tl&&!st.lastIsOpen?String(tl.props.id):null;return(!l||fl(e.zone)!==l&&fl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Jr(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Xr.get(i),s=l?Jr(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ul(r).has(n))return!1;const d=Wo(s.type,Vo(nt?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Jr(n),r))})(e.zone,o,e.index,t)},gl=(e,n)=>{const t=an(e.from);if(t===an(n))return!0;const o=e.node;return ml({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},yl=e=>{const n=e.slice(0,e.indexOf(":")),t=Xr.get(n),o=t?Jr(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Wo(o.type,Vo(nt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=r.choices??(r.spec?[{type:r.spec.childType,label:Hr(r.spec.childType)}]:[]),l=_r(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:$i(o,t.zone===le)}},kl=(e,n)=>{const t=an(n);if("block"!==e.kind){if(hl(t))return n.index>=0&&n.index<=Jr(t).length;if(t!==le)return!1;const{floor:e,cap:o}=Rr();return n.index>=e&&n.index<=o}if(t===le)return!1;const o=yl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Jr(t))},Sl=(e,n)=>{e.rung?ti(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&hl(an(n)))return void Ii(e,an(n),n.index);if("section"===e.kind)return void zi(e.type,n.index);if("template"===e.kind)return void Bi(e.template.name,Vr(e.template.node),n.index);const t=an(n),o=yl(t);o&&(o.target.spec?_i(o.parentId,o.target.slot,e.type,n.index,o.parent.type):qi(t,e.type,n.index))})(e.add,n):e.zone===le?xi(e.index,n.index):pl(e.zone,an(n),e.index,n.index)},[vl]=yn(()=>nn()),wl=tn({keyOf:e=>e.id,readOnly:Boolean(Jn),session:vl,canDrop:ml,onDrop:Sl,onStep:(e,n)=>{e.rung?ti(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===le?((e,n)=>{const t=Ur(jr[e]?.type??""),o=xi(e,n<0?e-1:e+2);if(!o.moved)return void hr(n<0?St.sectionFirst({name:t}):St.sectionLast({name:t}));const{floor:r,cap:i}=Rr();hr(St.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):pl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),xl=Sn(e=>{const{floor:n,cap:t}=Rr(),o=[];for(const r of e.nodes){const e=an(r.place),i=Jr(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(mt(i)||gt(i)||Lo(i.type))continue;if(pt(i.type))continue;const l=Boolean(hl(e)),s=e===le||l;e===le&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?Ur(i.type):ii(i),from:r.place})}return{sources:o,zones:e.zones.flatMap(e=>{const n=an(e.list);return n===le&&0===e.children.length?[{...e,addLabel:St.addSection,addAlways:!0}]:e.children.length>0||Boolean(yl(n)?.choices.length)||Boolean(hl(n))?[e]:[]})}},[nt.data]),bl=null==rt?.props.id?null:String(rt.props.id),zl=Sn(e=>{const n=lt,t=e=>!e.item.rung&&null!==hn(nt.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(bl);return i||(r(Me(nt.data,n,o.item.id,bl))??o)},[nt.data,lt,bl]),Bl=e=>{yo(U),Mt.select(e.zone===le?{index:e.index}:{index:e.index,zone:e.zone})},Cl=ne(),Ol=()=>({data:nt.data,device:Ht,ops:Mt,inspector:To}),Nl=Cl?.model,Il=gn(()=>Nl?e=>Nl(e,xl(e),Ol()):xl,[Nl,xl,Ht]),$l=Cl?.measure,Pl=$l?(e,n)=>$l(e,n,Ol()):void 0,Tl=Cl?.canDrop,Ml=Tl?(e,n)=>Tl(e,n,ml,Ol()):ml,Al=Cl?.drop,jl=Al?(e,n)=>Al(e,n,Sl,Ol()):Sl,Rl=Cl?.pick,Ll=Rl?e=>Rl(e,Bl,Ol()):Bl,El=(e,n,t,o)=>/* @__PURE__ */Pn(Ne,{...Jn?{}:wl.seam({place:{...un(e),index:n}}),onAdd:Jn?void 0:t,label:o},`seam:${e}:${n}`),Vl={rowClick:Pi,isCollapsed:ar,toggleCollapse:cr},Fl=e=>{const n=String(e.props.id),t=jr.findIndex(e=>String(e.props.id)===n),o=ut(n),r=Jr(o),i=ar(n),l=Hr(e.type),s=Do.rowName?Do.rowName(e,"section",l):l,d=e=>El(o,e,()=>Oi(o,e),St.addSectionHere);/* @__PURE__ */
15
15
  return Tn(Mn,{children:[
16
- /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:e.type,size:13}),name:s,preview:Ai(e),marks:ji(e),onSelect:()=>vi(t),nameSlot:si(le,t,n,s),selected:bo===n,actions:Ri(e,le,t)??void 0,rowProps:{"data-node-id":n,onClick:Pi(()=>vi(t))},fold:{open:!i,label:"section",onToggle:()=>cr(n)}}),!i&&/* @__PURE__ */Tn(ze,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Gr(n),l=Qi(n),s=l&&ar(r),a=()=>Ki(o,t,r,e.type),{rowProps:c,...p}=wl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...un(o),index:t}},{"data-node-id":r,onClick:Pi(a)});/* @__PURE__ */
16
+ /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:e.type,size:13}),name:s,preview:Ai(e),marks:ji(e),onSelect:()=>vi(t),nameSlot:si(le,t,n,s),selected:bo===n,actions:Ri(e,le,t)??void 0,rowProps:{"data-node-id":n,onClick:Pi(()=>vi(t))},fold:{open:!i,label:"section",onToggle:()=>cr(n)}}),!i&&/* @__PURE__ */Tn(ze,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Gr(n),l=Ji(n),s=l&&ar(r),a=()=>Qi(o,t,r,e.type),{rowProps:c,...p}=wl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...un(o),index:t}},{"data-node-id":r,onClick:Pi(a)});/* @__PURE__ */
17
17
  return Tn(wn,{children:[d(t),
18
- /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:i,preview:Ai(n),marks:ji(n),onSelect:a,nameSlot:si(o,t,r,i),selected:bo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>cr(r)}:void 0,actions:/* @__PURE__ */Tn(Mn,{children:[Mi(o,t,i),Ri(n,o,t),Li(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */Pn(ze,{children:Hl(n,2)})]},r)}),d(r.length)]})]})},Dl=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=wl.dragging,d=!ar(l)&&s?.rung?.nodeId!==i,a={...un(l),index:0},c=s&&!s.rung&&ml(s,a)?a:void 0,p=()=>ei(e,n,!0),{rowProps:u,...f}=wl.row({item:{id:`rung:${l}`,zone:`${i}:${En}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:En,index:t},into:c,canDrag:Boolean(Ro.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Pi(p)}),h=Qn?null:Ro.slotActions?.(e,n.slot);/* @__PURE__ */
18
+ /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:i,preview:Ai(n),marks:ji(n),onSelect:a,nameSlot:si(o,t,r,i),selected:bo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>cr(r)}:void 0,actions:/* @__PURE__ */Tn(Mn,{children:[Mi(o,t,i),Ri(n,o,t),Li(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */Pn(ze,{children:Dl(n,2)})]},r)}),d(r.length)]})]})},Wl=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=wl.dragging,d=!ar(l)&&s?.rung?.nodeId!==i,a={...un(l),index:0},c=s&&!s.rung&&ml(s,a)?a:void 0,p=()=>ei(e,n,!0),{rowProps:u,...f}=wl.row({item:{id:`rung:${l}`,zone:`${i}:${En}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:En,index:t},into:c,canDrag:Boolean(Ro.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Pi(p)}),h=Jn?null:Ro.slotActions?.(e,n.slot);/* @__PURE__ */
19
19
  return Tn(wn,{children:[n.heading,
20
- /* @__PURE__ */Pn(be,{words:vt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:qr===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>cr(l)},actions:h&&h.length>0?/* @__PURE__ */Pn(Mn,{children:h.map((t,o)=>/* @__PURE__ */Pn(Oe,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Qn||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&ni(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */Pn(On,{size:15}):/* @__PURE__ */Pn($n,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Pn(ze,{children:r})]},l)},Wl=(e,n)=>{const t=Wi(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
21
- return Pn(Mn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Gi(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=null!==a&&Boolean(yl(a)?.choices.length),p=(e,n)=>c?El(e,n,()=>Oi(e,n),St.addBlockHere):El(e,n),u=/* @__PURE__ */Tn(Mn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=bo===String(n.props.id),{collapsible:i,folded:s}=Yi(n,l,Xi(n.type)),d=String(n.props.id),a=cl(n),c=()=>Ki(t,o,d,e.type),{rowProps:u,...f}=wl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...un(t),index:o}},{"data-node-id":d,onClick:Pi(c)});/* @__PURE__ */
20
+ /* @__PURE__ */Pn(be,{words:vt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:qr===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>cr(l)},actions:h&&h.length>0?/* @__PURE__ */Pn(Mn,{children:h.map((t,o)=>/* @__PURE__ */Pn(Oe,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Jn||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&ni(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */Pn(On,{size:15}):/* @__PURE__ */Pn($n,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Pn(ze,{children:r})]},l)},Hl=(e,n)=>{const t=Hi(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
21
+ return Pn(Mn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Gi(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=null!==a&&Boolean(yl(a)?.choices.length),p=(e,n)=>c?El(e,n,()=>Oi(e,n),St.addBlockHere):El(e,n),u=/* @__PURE__ */Tn(Mn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=bo===String(n.props.id),{collapsible:i,folded:s}=Xi(n,l,Ki(n.type)),d=String(n.props.id),a=cl(n),c=()=>Qi(t,o,d,e.type),{rowProps:u,...f}=wl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...un(t),index:o}},{"data-node-id":d,onClick:Pi(c)});/* @__PURE__ */
22
22
  return Tn(wn,{children:[0===o&&p(t,0),
23
- /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:a,preview:Ai(n),marks:ji(n),onSelect:c,nameSlot:si(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>cr(d)}:void 0,actions:/* @__PURE__ */Tn(Mn,{children:[Mi(t,o,a),Ri(n,t,o),Li(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Pn(ze,{children:Wl(n,l+1)}),p(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?p(d,0):null:0!==i.length||!t.rung&&d!==a?null:p(a,0)]});return t.rung?Dl(e,t.rung,r++,o,u):/* @__PURE__ */Pn(wn,{children:u},t.slot??"")})})},Hl=(e,n)=>{const t=Vo(nt?.data,e.type,String(e.props.id)),o=Wi(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
24
- return Pn(Mn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Gi(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(n,t)=>{const o=n===f&&a&&!a.addBlocked?.(c)?()=>_i(e.props.id,a.slot,a.childType,t,e.type):n===h?()=>Oi(n,t):void 0;return El(n,t,o,n===f&&a?a.addLabel:St.addBlockHere)},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),k=/* @__PURE__ */Tn(Mn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=bo===String(n.props.id),i=ii(n),l=String(n.props.id),{collapsible:d,folded:a}=Yi(n,s,Xi(n.type)),c=Fi(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...un(p),index:Qr(p).length}:void 0,f=wl.dragging,h=u&&f&&ml(f,u)?u:void 0,g=()=>Ki(t,o,l,e.type),{rowProps:y,...k}=wl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...un(t),index:o},into:h,canDrag:!Lo(n.type)},{"data-node-id":l,onClick:Pi(g)});/* @__PURE__ */
23
+ /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:a,preview:Ai(n),marks:ji(n),onSelect:c,nameSlot:si(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>cr(d)}:void 0,actions:/* @__PURE__ */Tn(Mn,{children:[Mi(t,o,a),Ri(n,t,o),Li(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Pn(ze,{children:Hl(n,l+1)}),p(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?p(d,0):null:0!==i.length||!t.rung&&d!==a?null:p(a,0)]});return t.rung?Wl(e,t.rung,r++,o,u):/* @__PURE__ */Pn(wn,{children:u},t.slot??"")})})},Dl=(e,n)=>{const t=Vo(nt?.data,e.type,String(e.props.id)),o=Hi(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
24
+ return Pn(Mn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Gi(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(n,t)=>{const o=n===f&&a&&!a.addBlocked?.(c)?()=>_i(e.props.id,a.slot,a.childType,t,e.type):n===h?()=>Oi(n,t):void 0;return El(n,t,o,n===f&&a?a.addLabel:St.addBlockHere)},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),k=/* @__PURE__ */Tn(Mn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=bo===String(n.props.id),i=ii(n),l=String(n.props.id),{collapsible:d,folded:a}=Xi(n,s,Ki(n.type)),c=Fi(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...un(p),index:Jr(p).length}:void 0,f=wl.dragging,h=u&&f&&ml(f,u)?u:void 0,g=()=>Qi(t,o,l,e.type),{rowProps:y,...k}=wl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...un(t),index:o},into:h,canDrag:!Lo(n.type)},{"data-node-id":l,onClick:Pi(g)});/* @__PURE__ */
25
25
  return Tn(wn,{children:[0===o&&m(t,0),
26
- /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:i,preview:Ai(n),marks:ji(n),onSelect:g,nameSlot:si(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!a,label:"group",onToggle:()=>cr(l)}:void 0,actions:Lo(n.type)?Ri(n,t,o)??void 0:/* @__PURE__ */Tn(Mn,{children:[Mi(t,o,i),Ri(n,t,o),Li(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */Pn(ze,{children:Hl(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
27
- /* @__PURE__ */Pn(I,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>_i(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?Dl(e,o.rung,i++,r,k):/* @__PURE__ */Pn(wn,{children:k},o.slot??"")})})},Ul=(()=>{if(!rt||!ko)return null;const e=String(rt.type),n=String(rt.props.id),t=Do(e,Vo(nt?.data,e,n));if(!t||"footer"===t.source)return null;const o=jr.some(e=>String(e.props?.id)===n),r=Array.isArray(rt.props[t.slot])?rt.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:Wr(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:$i(rt,o),choices:i,onPick:o=>{t.spec?_i(n,t.slot,o,r.length,e):qi(`${n}:${t.slot}`,o,r.length)}}})(),Gl=wo&&wo.zone!==le&&!hl(wo.zone)?wo.zone:null,Yl=!0===uo.blocksFirst,Jl=Gl?yl(Gl):Yl&&wo?null:Ul,Ql=Boolean(co&&Gl)||Yl&&Boolean(Jl&&Jl.choices.length>0),Xl=io||null!==Yt,Kl=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:jt&&!Xl&&jo===e.id,onSelect:()=>Pr(e.id)}:e,_l=[{id:"add",label:St.add.title,icon:/* @__PURE__ */Pn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:io,onSelect:()=>io?Ni():Ci(null)},...(Mo.railLead??[]).map(Kl),{id:"sections",label:St.layers,icon:/* @__PURE__ */Pn(Ae,{}),active:jt&&!Xl&&"sections"===jo,onSelect:()=>Pr("sections")},...(Mo.railTrail??[]).map(Kl)];Gt?_l.push({id:"media",label:St.railMedia,icon:/* @__PURE__ */Pn(je,{}),active:jt&&!io&&(null!==Yt||"media"===jo),onSelect:()=>Pr("media")}):qn&&_l.push({id:"media",label:St.railMedia,icon:/* @__PURE__ */Pn(je,{}),onSelect:Tr});const ql=[...Mo.railLead??[],...Mo.railTrail??[]].find(e=>"panel"in e&&e.id===jo),Zl=Boolean(kt?.foldable)&&!Ao,es=kt?.label??(Zn?St.pageSections:St.templateSections),ns=Zl&&ar(Vn),ts=/* @__PURE__ */Tn(Mn,{children:[jr.map((e,n)=>{if(mt(e)||gt(e)||pt(e.type))return null;const t=bo===String(e.props.id),o=Boolean(e.props._hidden);Di(e);const r=String(e.props.id),i=Mo.hasOwnRows?.(e)??!1,l=Qi(e)||i,s=l&&ar(r),{rowProps:d,...a}=wl.row({item:{id:r,zone:le,index:n,type:e.type},place:{...un(le),index:n}},{"data-node-id":r,onClick:Pi(()=>vi(n))});/* @__PURE__ */
26
+ /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:i,preview:Ai(n),marks:ji(n),onSelect:g,nameSlot:si(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!a,label:"group",onToggle:()=>cr(l)}:void 0,actions:Lo(n.type)?Ri(n,t,o)??void 0:/* @__PURE__ */Tn(Mn,{children:[Mi(t,o,i),Ri(n,t,o),Li(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */Pn(ze,{children:Dl(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
27
+ /* @__PURE__ */Pn(I,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>_i(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?Wl(e,o.rung,i++,r,k):/* @__PURE__ */Pn(wn,{children:k},o.slot??"")})})},Ul=(()=>{if(!rt||!ko)return null;const e=String(rt.type),n=String(rt.props.id),t=Wo(e,Vo(nt?.data,e,n));if(!t||"footer"===t.source)return null;const o=jr.some(e=>String(e.props?.id)===n),r=Array.isArray(rt.props[t.slot])?rt.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:Hr(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:$i(rt,o),choices:i,onPick:o=>{t.spec?_i(n,t.slot,o,r.length,e):qi(`${n}:${t.slot}`,o,r.length)}}})(),Gl=wo&&wo.zone!==le&&!hl(wo.zone)?wo.zone:null,Xl=!0===uo.blocksFirst,Yl=Gl?yl(Gl):Xl&&wo?null:Ul,Jl=Boolean(co&&Gl)||Xl&&Boolean(Yl&&Yl.choices.length>0),Kl=io||null!==Xt,Ql=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:jt&&!Kl&&jo===e.id,onSelect:()=>Pr(e.id)}:e,_l=[{id:"add",label:St.add.title,icon:/* @__PURE__ */Pn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:io,onSelect:()=>io?Ni():Ci(null)},...(Mo.railLead??[]).map(Ql),{id:"sections",label:St.layers,icon:/* @__PURE__ */Pn(Ae,{}),active:jt&&!Kl&&"sections"===jo,onSelect:()=>Pr("sections")},...(Mo.railTrail??[]).map(Ql)];Gt?_l.push({id:"media",label:St.railMedia,icon:/* @__PURE__ */Pn(je,{}),active:jt&&!io&&(null!==Xt||"media"===jo),onSelect:()=>Pr("media")}):qn&&_l.push({id:"media",label:St.railMedia,icon:/* @__PURE__ */Pn(je,{}),onSelect:Tr});const ql=[...Mo.railLead??[],...Mo.railTrail??[]].find(e=>"panel"in e&&e.id===jo),Zl=Boolean(kt?.foldable)&&!Ao,es=kt?.label??(Zn?St.pageSections:St.templateSections),ns=Zl&&ar(Vn),ts=/* @__PURE__ */Tn(Mn,{children:[jr.map((e,n)=>{if(mt(e)||gt(e)||pt(e.type))return null;const t=bo===String(e.props.id),o=Boolean(e.props._hidden);Wi(e);const r=String(e.props.id),i=Mo.hasOwnRows?.(e)??!1,l=Ji(e)||i,s=l&&ar(r),{rowProps:d,...a}=wl.row({item:{id:r,zone:le,index:n,type:e.type},place:{...un(le),index:n}},{"data-node-id":r,onClick:Pi(()=>vi(n))});/* @__PURE__ */
28
28
  return Tn(wn,{children:[n>0&&Ei(n),
29
- /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:e.type,size:13}),name:Gr(e),preview:Ai(e),marks:ji(e),onSelect:()=>vi(n),nameSlot:si(le,n,r,Gr(e)),selected:t,hidden:o,...a,fold:l?{open:!s,label:"section",onToggle:()=>cr(r)}:void 0,actions:/* @__PURE__ */Tn(Mn,{children:[Mi(le,n,Gr(e)),Ri(e,le,n),Li(le,n,e,Gr(e))]}),rowProps:d}),Qi(e)&&!s&&/* @__PURE__ */Tn(ze,{children:[Hl(e,1),Mo.partRows?.(e,Vl)]}),i&&!s&&/* @__PURE__ */Pn(ze,{children:Mo.ownRows?.(e,n,Vl)})]},String(e.props.id??n))}),!Ao&&sl>0&&Ei(sl),kt?.addAtEnd&&!Ao&&!Qn&&/* @__PURE__ */Pn(I,{small:!0,label:St.addSection,blocked:null,onAdd:()=>Ci(sl)})]}),os=(e,n,t)=>{const o=String(e.props.id),r=Hi(e).length>0||Ui(e)||Boolean(Do(e.type)),i=r&&ar(o),l="header"===t?St.header:St.footer,s=Ho.rowName?Ho.rowName(e,"section",l):l;/* @__PURE__ */
29
+ /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:e.type,size:13}),name:Gr(e),preview:Ai(e),marks:ji(e),onSelect:()=>vi(n),nameSlot:si(le,n,r,Gr(e)),selected:t,hidden:o,...a,fold:l?{open:!s,label:"section",onToggle:()=>cr(r)}:void 0,actions:/* @__PURE__ */Tn(Mn,{children:[Mi(le,n,Gr(e)),Ri(e,le,n),Li(le,n,e,Gr(e))]}),rowProps:d}),Ji(e)&&!s&&/* @__PURE__ */Tn(ze,{children:[Dl(e,1),Mo.partRows?.(e,Vl)]}),i&&!s&&/* @__PURE__ */Pn(ze,{children:Mo.ownRows?.(e,n,Vl)})]},String(e.props.id??n))}),!Ao&&sl>0&&Ei(sl),kt?.addAtEnd&&!Ao&&!Jn&&/* @__PURE__ */Pn(I,{small:!0,label:St.addSection,blocked:null,onAdd:()=>Ci(sl)})]}),os=(e,n,t)=>{const o=String(e.props.id),r=Di(e).length>0||Ui(e)||Boolean(Wo(e.type)),i=r&&ar(o),l="header"===t?St.header:St.footer,s=Do.rowName?Do.rowName(e,"section",l):l;/* @__PURE__ */
30
30
  return Tn(Mn,{children:[
31
- /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:t,size:13}),name:s,preview:Ai(e),marks:ji(e),onSelect:()=>vi(n),nameSlot:si(le,n,o,s),selected:bo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>cr(o)}:void 0,actions:Ri(e,le,n)??void 0,rowProps:{"data-node-id":o,onClick:Pi(()=>vi(n))}}),r&&!i&&/* @__PURE__ */Pn(ze,{children:Wl(e,1)})]})};return(Mo.wrap??(e=>e))(
32
- /* @__PURE__ */Pn(te,{target:oo,children:/* @__PURE__ */Tn("div",{ref:to,className:"sf-editor es-editor",style:Qe(rr),onContextMenu:fi.onEditorContextMenu,...m(Le),children:[
31
+ /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:t,size:13}),name:s,preview:Ai(e),marks:ji(e),onSelect:()=>vi(n),nameSlot:si(le,n,o,s),selected:bo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>cr(o)}:void 0,actions:Ri(e,le,n)??void 0,rowProps:{"data-node-id":o,onClick:Pi(()=>vi(n))}}),r&&!i&&/* @__PURE__ */Pn(ze,{children:Hl(e,1)})]})};return(Mo.wrap??(e=>e))(
32
+ /* @__PURE__ */Pn(te,{target:oo,children:/* @__PURE__ */Tn("div",{ref:to,className:"sf-editor es-editor",style:Je(rr),onContextMenu:fi.onEditorContextMenu,...m(Le),children:[
33
33
  /* @__PURE__ */Tn(Ee,{children:[
34
34
  /* @__PURE__ */Pn(Ve,{items:_l,ariaLabel:St.bar.views}),
35
35
  /* @__PURE__ */Tn(Fe,{children:[
36
- /* @__PURE__ */Pn(De,{label:St.bar.undo,disabled:Boolean(Qn)||!ot.hasPast,onClick:()=>ot.back(),children:/* @__PURE__ */Pn(Bn,{})}),
37
- /* @__PURE__ */Pn(De,{label:St.bar.redo,disabled:Boolean(Qn)||!ot.hasFuture,onClick:()=>ot.forward(),children:/* @__PURE__ */Pn(Cn,{})}),
38
- /* @__PURE__ */Pn(We,{}),
39
- /* @__PURE__ */Pn(He,{devices:Lt,value:Wt,onChange:Ht})]}),
36
+ /* @__PURE__ */Pn(We,{label:St.bar.undo,disabled:Boolean(Jn)||!ot.hasPast,onClick:()=>ot.back(),children:/* @__PURE__ */Pn(Bn,{})}),
37
+ /* @__PURE__ */Pn(We,{label:St.bar.redo,disabled:Boolean(Jn)||!ot.hasFuture,onClick:()=>ot.forward(),children:/* @__PURE__ */Pn(Cn,{})}),
38
+ /* @__PURE__ */Pn(He,{}),
39
+ /* @__PURE__ */Pn(De,{devices:Lt,value:Ht,onChange:Dt})]}),
40
40
  /* @__PURE__ */Tn(Fe,{kind:"right",style:{minWidth:300},children:[
41
- /* @__PURE__ */Pn(An,{saveState:Un,notSaving:Boolean(Qn)||null!=Gn,readOnlyReason:Xn,toggle:Kn,onToggle:Jn,onRetry:Yn,words:St.bar,saveWords:xt}),Mo.barLead?.(),
42
- /* @__PURE__ */Pn(xn,{content:St.bar.refreshTip,side:"bottom",children:/* @__PURE__ */Pn(bn,{variant:"secondary",onClick:()=>{no.current=(()=>{const e=oo?.document;if(!e)return null;const n=jr.findIndex(gt),t=n>=0?n:jr.length;let o=null;for(let n=0;n<t;n++){const t=jr[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=rt?.props?.id??jr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),eo(e=>e+1)},children:St.bar.refresh})}),Mo.barTrail?.(),Mo.barMain?Mo.barMain():/* @__PURE__ */Pn(bn,{variant:"primary",disabled:null!==Xn,onClick:()=>{Hn(nt.data)},children:St.done})]})]}),
41
+ /* @__PURE__ */Pn(An,{saveState:Un,notSaving:Boolean(Jn)||null!=Gn,readOnlyReason:Kn,toggle:Qn,onToggle:Yn,onRetry:Xn,words:St.bar,saveWords:xt}),Mo.barLead?.(),
42
+ /* @__PURE__ */Pn(xn,{content:St.bar.refreshTip,side:"bottom",children:/* @__PURE__ */Pn(bn,{variant:"secondary",onClick:()=>{no.current=(()=>{const e=oo?.document;if(!e)return null;const n=jr.findIndex(gt),t=n>=0?n:jr.length;let o=null;for(let n=0;n<t;n++){const t=jr[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=rt?.props?.id??jr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),eo(e=>e+1)},children:St.bar.refresh})}),Mo.barTrail?.(),Mo.barMain?Mo.barMain():/* @__PURE__ */Pn(bn,{variant:"primary",disabled:null!==Kn,onClick:()=>{Dn(nt.data)},children:St.done})]})]}),
43
43
  /* @__PURE__ */Pn(z,{}),
44
44
  /* @__PURE__ */Tn("div",{className:"sf-body",children:[jt?/* @__PURE__ */Tn(Mn,{children:[
45
- /* @__PURE__ */Pn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":St.leftPanel,children:io?/* @__PURE__ */Pn($,{blocks:Jl,blocksOnly:Ql,at:co?{label:(e=>{const n=hl(e.zone);if(n)return St.add.addingTo({name:Ho.rowName?$i(n,!0):Wr(n.type)});if(e.zone===le){const n=jr[e.index];return n&&!gt(n)?St.add.addingBefore({name:$i(n,!0)}):St.add.addingAtEnd}const t=yl(e.zone);return t?St.add.addingTo({name:t.parentName}):St.add.addingHere})(co),onClear:()=>po(null)}:void 0,onAdd:e=>{const n=wo,t=(e,n)=>{co&&po({zone:e,index:n})};if(n&&"block"!==e.kind&&hl(n.zone))return Ii(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===xo)return void zi(e);const n=zi(e,xo);co&&fo(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===xo)return void Bi(e,n);const t=Bi(e,n,xo);co&&fo(t+1)})(e.template.name,Vr(e.template.node));if(n&&n.zone!==le){const o=yl(n.zone);if(!o)return;return o.target.spec?_i(o.parentId,o.target.slot,e.type,n.index,o.parent.type):qi(n.zone,e.type,n.index),void t(n.zone,n.index+1)}Ul?.onPick(e.type)},itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:vl,siteWide:Mo.addPanelRow?.(Ni),onClose:Ni,onHide:Ir,readOnly:Boolean(Qn)}):Yt&&Ut?
46
- /* @__PURE__ */Pn(M,{panel:Ut,pick:Yt,onHide:Ir}):ql?ql.panel({onHide:Ir,notify:hr}):"media"===jo&&Ut?/* @__PURE__ */Pn(M,{panel:Ut,pick:null,onHide:Ir}):/* @__PURE__ */Tn(Mn,{children:[
45
+ /* @__PURE__ */Pn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":St.leftPanel,children:io?/* @__PURE__ */Pn($,{blocks:Yl,blocksOnly:Jl,at:co?{label:(e=>{const n=hl(e.zone);if(n)return St.add.addingTo({name:Do.rowName?$i(n,!0):Hr(n.type)});if(e.zone===le){const n=jr[e.index];return n&&!gt(n)?St.add.addingBefore({name:$i(n,!0)}):St.add.addingAtEnd}const t=yl(e.zone);return t?St.add.addingTo({name:t.parentName}):St.add.addingHere})(co),onClear:()=>po(null)}:void 0,onAdd:e=>{const n=wo,t=(e,n)=>{co&&po({zone:e,index:n})};if(n&&"block"!==e.kind&&hl(n.zone))return Ii(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===xo)return void zi(e);const n=zi(e,xo);co&&fo(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===xo)return void Bi(e,n);const t=Bi(e,n,xo);co&&fo(t+1)})(e.template.name,Vr(e.template.node));if(n&&n.zone!==le){const o=yl(n.zone);if(!o)return;return o.target.spec?_i(o.parentId,o.target.slot,e.type,n.index,o.parent.type):qi(n.zone,e.type,n.index),void t(n.zone,n.index+1)}Ul?.onPick(e.type)},itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:vl,siteWide:Mo.addPanelRow?.(Ni),onClose:Ni,onHide:Ir,readOnly:Boolean(Jn)}):Xt&&Ut?
46
+ /* @__PURE__ */Pn(M,{panel:Ut,pick:Xt,onHide:Ir}):ql?ql.panel({onHide:Ir,notify:hr}):"media"===jo&&Ut?/* @__PURE__ */Pn(M,{panel:Ut,pick:null,onHide:Ir}):/* @__PURE__ */Tn(Mn,{children:[
47
47
  /* @__PURE__ */Pn(P,{icon:/* @__PURE__ */Pn(Ae,{}),title:St.layers,context:Ct,actions:
48
48
  /* @__PURE__ */Pn(Ue,{label:al?St.expandAll:St.collapseAll,title:0===dl.length?St.nothingToFold:void 0,disabled:0===dl.length,onClick:()=>or(e=>{const n=new Set(dl);return al?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...dl])}),children:/* @__PURE__ */Pn(jn,{expand:al})}),onHide:Ir}),
49
49
  /* @__PURE__ */Tn(Be,{className:"sf-tree sf-scroll",words:vt,children:[
@@ -51,15 +51,15 @@ return Tn(Mn,{children:[
51
51
  /* @__PURE__ */Pn(Ce,{children:St.header}),Fl(il)]}),!Ao&&et&&/* @__PURE__ */Tn(Mn,{children:[
52
52
  /* @__PURE__ */Pn(Ce,{children:St.header}),!yt&&/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:"header",size:13}),name:St.header,onSelect:Ar,selected:go.kind===ht?.kind,rowProps:{onClick:Pi(Ar)}})]}),!Ao&&rl&&os(rl,ol,"header"),!Ao&&!Zl&&/* @__PURE__ */Pn(Ce,{children:es}),Zl?/* @__PURE__ */Tn(Mn,{children:[
53
53
  /* @__PURE__ */Pn(be,{words:vt,icon:null,name:es,fold:{open:!ns,label:es,onToggle:()=>cr(Vn)}}),!ns&&/* @__PURE__ */Pn(ze,{children:ts})]}):ts,et&&/* @__PURE__ */Pn(Ce,{children:St.footer}),tl&&os(tl,nl,"footer"),!Ao&&!tl&&et&&/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:"footer",size:13}),name:St.footer,onSelect:Ti,rowProps:{onClick:Pi(Ti),title:St.editFooter}}),ll&&Fl(ll),Mo.treeFoot?.()]})]})}),
54
- /* @__PURE__ */Pn(Ge,{side:"left",width:rr.left,min:Je,max:Ye,defaultWidth:k.left,label:St.resizeLeftPanel,onResize:sr})]}):/* @__PURE__ */Pn(T,{side:"left",onShow:Ir}),
55
- /* @__PURE__ */Tn("div",{ref:mr,className:"sf-center sf-scroll","data-sf-canvas-head":vr?"":void 0,style:{overflowX:Cr?"auto":"hidden",overflowY:"hidden"},children:[vr&&/* @__PURE__ */Pn("div",{ref:wr,className:"sf-canvas-head",children:/* @__PURE__ */Pn(vr,{device:Wt})}),
56
- /* @__PURE__ */Pn("div",{className:"sf-frame-scaler",style:Or,children:/* @__PURE__ */Pn("div",{className:"sf-frame "+(Wt===Ft?"":`sf-frame--${Wt}`),style:Nr,children:/* @__PURE__ */Tn("div",{className:"sf-preview-host",children:[
54
+ /* @__PURE__ */Pn(Ge,{side:"left",width:rr.left,min:Ye,max:Xe,defaultWidth:k.left,label:St.resizeLeftPanel,onResize:sr})]}):/* @__PURE__ */Pn(T,{side:"left",onShow:Ir}),
55
+ /* @__PURE__ */Tn("div",{ref:mr,className:"sf-center sf-scroll","data-sf-canvas-head":vr?"":void 0,style:{overflowX:Cr?"auto":"hidden",overflowY:"hidden"},children:[vr&&/* @__PURE__ */Pn("div",{ref:wr,className:"sf-canvas-head",children:/* @__PURE__ */Pn(vr,{device:Ht})}),
56
+ /* @__PURE__ */Pn("div",{className:"sf-frame-scaler",style:Or,children:/* @__PURE__ */Pn("div",{className:"sf-frame "+(Ht===Ft?"":`sf-frame--${Ht}`),style:Nr,children:/* @__PURE__ */Tn("div",{className:"sf-preview-host",children:[
57
57
  /* @__PURE__ */Pn(Ot,{},Zt),
58
- /* @__PURE__ */Pn(Ze,{canvas:oo,session:vl,model:Il,measure:Pl,canDrop:Ml,onDrop:jl,choose:zl,onPick:Ll,onZoneAdd:e=>{const n=an(e),t=_r(n);t&&ei(t.node,t.slot,!1),Oi(n,0)},zoneAddLabel:St.canvasAddBlock,words:wt.canvas,readOnly:Boolean(Qn),revision:nt.data}),ho.length>0&&/* @__PURE__ */Pn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:ho.map(e=>/* @__PURE__ */Tn("button",{type:"button",tabIndex:-1,className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height},onClick:()=>Ci(e.index),children:[
58
+ /* @__PURE__ */Pn(Ze,{canvas:oo,session:vl,model:Il,measure:Pl,canDrop:Ml,onDrop:jl,choose:zl,onPick:Ll,onZoneAdd:e=>{const n=an(e),t=_r(n);t&&ei(t.node,t.slot,!1),Oi(n,0)},zoneAddLabel:St.canvasAddBlock,words:wt.canvas,readOnly:Boolean(Jn),revision:nt.data}),ho.length>0&&/* @__PURE__ */Pn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:ho.map(e=>/* @__PURE__ */Tn("button",{type:"button",tabIndex:-1,className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height},onClick:()=>Ci(e.index),children:[
59
59
  /* @__PURE__ */Pn("span",{className:"sf-preview-gap-line"}),
60
60
  /* @__PURE__ */Tn("span",{className:"sf-preview-gap-pill",children:[
61
61
  /* @__PURE__ */Pn("span",{className:"sf-preview-gap-plus",children:"+"}),
62
62
  /* @__PURE__ */Pn("span",{className:"sf-preview-gap-label",children:St.addSection})]})]},e.index))})]})})})]}),Rt?/* @__PURE__ */Tn(Mn,{children:[
63
- /* @__PURE__ */Pn(g,{value:{selectChild:Ki,addChild:_i,childRowName:ii,blockRowName:cl},children:/* @__PURE__ */Pn(Nt,{mode:go,onOpenWebsiteSettings:Mo.openSettings??(()=>{}),onOpenSiteStyles:Mo.openStyles,onSelectNode:Xo,onNotify:hr,onHidePanel:$r,nodeActions:rt?se(lt,rt.type):Fn})}),
64
- /* @__PURE__ */Pn(Ge,{side:"right",width:rr.right,min:Je,max:Ye,defaultWidth:k.right,label:St.resizeSettingsPanel,onResize:dr})]}):
65
- /* @__PURE__ */Pn(T,{side:"right",onShow:$r})]}),fi.menu]})}))}export{Dn as ScreenChrome};
63
+ /* @__PURE__ */Pn(g,{value:{selectChild:Qi,addChild:_i,childRowName:ii,blockRowName:cl},children:/* @__PURE__ */Pn(Nt,{mode:go,onOpenWebsiteSettings:Mo.openSettings??(()=>{}),onOpenSiteStyles:Mo.openStyles,onSelectNode:Ko,onNotify:hr,onHidePanel:$r,nodeActions:rt?se(lt,rt.type):Fn})}),
64
+ /* @__PURE__ */Pn(Ge,{side:"right",width:rr.right,min:Ye,max:Xe,defaultWidth:k.right,label:St.resizeSettingsPanel,onResize:dr})]}):
65
+ /* @__PURE__ */Pn(T,{side:"right",onShow:$r})]}),fi.menu]})}))}export{Wn as ScreenChrome};
@@ -1,4 +1,4 @@
1
- import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-CVBKSCAY.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.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-VOKBME2Y.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.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,4 +1,4 @@
1
- import{useScreenOwnerName as e}from"./chunk-CVBKSCAY.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-UB4TLWVJ.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-VOKBME2Y.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-UB4TLWVJ.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{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as i}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-PFNIVZPN.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-VOKBME2Y.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-MCHMF32I.js";import{useEasel as f}from"./chunk-BVKNVCGX.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-MOCX5MQ7.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-O2NLQBFX.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as B,jsxs as O,Fragment as $}from"react/jsx-runtime";var V=e=>`section:${e}`,N=e=>`block:${e}`,v=e=>`template:${e}`;function I({blocks:I,blocksOnly:x,at:C,onAdd:F,itemFor:M,session:H,siteWide:L,onClose:A,onHide:P,readOnly:Q}){const w=f(e=>e.config),D=p(),{labelAtLevel:K,categoryLabel:R,firstSection:T,Icon:X,Thumbnail:Y}=D,{blockIsOffered:z}=m(),E=u("screen",d).add,G=u("drag",h).add,S=l(),[W,Z]=y([]);b(()=>{let t=!1;const o=e=>z(e,S);return s(S).list().then(n=>{if(t)return;const i=w.components;Z(n.filter(t=>t.node?.type&&i[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[w,S]);const J=j(()=>t(w,D),[w]),q=e=>({type:V(e.type),label:e.name,cover:/* @__PURE__ */B(Y,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:E.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),U=j(()=>{const e=[];if(I&&I.choices.length>0&&a(I.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${E.inside({name:I.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:N(e.type),label:e.label,icon:/* @__PURE__ */B(X,{type:e.type,size:18}),title:E.tile({name:e.label})}))})}),x)return e;const t=o(J,T);t&&e.push({key:"start",title:E.startBlank,tiles:[q(t)]}),W.length>0&&e.push({key:"templates",title:E.templates,tiles:W.map(e=>{return{type:v(e.id),label:e.name,cover:/* @__PURE__ */B(Y,{type:e.node.type}),keywords:[(t=e.node.type,K(t,"section",w.components[t]?.label??t)),e.node.type]};var t})});const s=n(J,T);for(const t of Object.keys(w.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:i(w,t,R),tiles:o.map(q)})}return e},[I,x,W,J,w,E]),_=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=W.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
2
+ return O($,{children:[
3
+ /* @__PURE__ */B(r,{icon:/* @__PURE__ */B(g,{size:15}),title:E.title,context:x?E.contextBlocks:E.contextAll,actions:/* @__PURE__ */B(c,{label:E.done,description:E.doneDescription,onClick:A}),onHide:P}),
4
+ /* @__PURE__ */O("div",{className:"sf-addside sf-scroll",children:[
5
+ /* @__PURE__ */B(k,{groups:U,session:H,itemFor:e=>M(_(e)??{kind:"section",type:e}),onInsert:e=>{const t=_(e);t&&F(t)},at:C,hint:x?E.hintBlocks:E.hint,searchLabel:x?E.searchBlocks:E.searchSections,readOnly:Q,words:G}),L&&!x?L:null]})]})}export{I as AddSidePanel,N as blockKey,V as sectionKey,v as templateKey};
@@ -1,7 +1,7 @@
1
- import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as r}from"./chunk-7YFUG75W.js";import{ScreenChrome as e}from"./chunk-ATVN7L2J.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-WZMU646D.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.js";import{documentPermissions as o}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t}from"react";import{Dialog as d,Button as l}from"efficient-shell/ui";import{jsx as m,jsxs as g,Fragment as h}from"react/jsx-runtime";var f=n(r),v=n(e);function p({saving:n,onCancel:r,onDiscard:e,onSave:i}){const a=c("screen",s).leave;/* @__PURE__ */
1
+ import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as r}from"./chunk-IH2O5CZO.js";import{ScreenChrome as e}from"./chunk-LSBQ74U4.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-WZMU646D.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.js";import{documentPermissions as o}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t}from"react";import{Dialog as d,Button as l}from"efficient-shell/ui";import{jsx as m,jsxs as g,Fragment as h}from"react/jsx-runtime";var f=n(r),v=n(e);function p({saving:n,onCancel:r,onDiscard:e,onSave:i}){const a=c("screen",s).leave;/* @__PURE__ */
2
2
  return m(d,{open:!0,role:"alertdialog",size:"sm",title:a.title,onClose:r,footer:/* @__PURE__ */g(h,{children:[
3
3
  /* @__PURE__ */m(l,{variant:"secondary",onClick:r,children:a.cancel}),
4
4
  /* @__PURE__ */m(l,{variant:"ghost-danger",onClick:e,children:a.discard}),
5
5
  /* @__PURE__ */m(l,{variant:"primary",loading:n,onClick:i,children:n?a.saving:a.save})]}),children:a.body})}function u({target:n,addressing:r,onHostMessage:e,children:a}){/* @__PURE__ */
6
- return m(i,{target:n,addressing:r,onHostMessage:e,children:a})}var k=(n,r)=>/* @__PURE__ */g(h,{children:[n,r]});function C({config:n,parts:r,wrap:e=k}){const{data:i,error:d,redirecting:l,ready:g,saveStatus:h,readOnly:u,onChange:C,pendingNav:N,cancelPendingNav:j,discardAndNavigate:M,saveAndNavigate:y}=a(),H=t(()=>o(!u),[u]),A=c("screen",s);return l?/* @__PURE__ */m("div",{className:"sf-msg",children:A.loading}):d?/* @__PURE__ */m("div",{className:"sf-msg sf-msg--error",children:d}):g?i?e(
7
- /* @__PURE__ */m(f,{config:n,data:i,onChange:C,permissions:H,parts:r,children:/* @__PURE__ */m(v,{})}),N&&/* @__PURE__ */m(p,{saving:"saving"===h,onCancel:j,onDiscard:M,onSave:()=>{y()}})):/* @__PURE__ */m("div",{className:"sf-msg",children:A.loading}):/* @__PURE__ */m("div",{className:"sf-msg",children:A.waitingForAuthorization})}export{C as DocumentScreen,u as ScreenMount};
6
+ return m(i,{target:n,addressing:r,onHostMessage:e,children:a})}var C=(n,r)=>/* @__PURE__ */g(h,{children:[n,r]});function k({config:n,parts:r,wrap:e=C}){const{data:i,error:d,redirecting:l,ready:g,saveStatus:h,readOnly:u,onChange:k,pendingNav:j,cancelPendingNav:N,discardAndNavigate:H,saveAndNavigate:M}=a(),y=t(()=>o(!u),[u]),O=c("screen",s);return l?/* @__PURE__ */m("div",{className:"sf-msg",children:O.loading}):d?/* @__PURE__ */m("div",{className:"sf-msg sf-msg--error",children:d}):g?i?e(
7
+ /* @__PURE__ */m(f,{config:n,data:i,onChange:k,permissions:y,parts:r,children:/* @__PURE__ */m(v,{})}),j&&/* @__PURE__ */m(p,{saving:"saving"===h,onCancel:N,onDiscard:H,onSave:()=>{M()}})):/* @__PURE__ */m("div",{className:"sf-msg",children:O.loading}):/* @__PURE__ */m("div",{className:"sf-msg",children:O.waitingForAuthorization})}export{k as DocumentScreen,u as ScreenMount};
@@ -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-BVKNVCGX.js";import{Inspector as i}from"./chunk-CRWFB7MU.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={},v=()=>k,g=()=>"",y=()=>null,b=()=>{},O={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},j={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},w={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},C={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},L={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function S(){/* @__PURE__ */
2
+ return s(t,{height:"fill"})}function B(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
3
+ return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var G=o({});function N({parts:n,children:e}){/* @__PURE__ */
4
+ return s(G.Provider,{value:n,children:e})}function P(){return u(G)}function D(){return(P().useOwnerName??g)()}function x(){return(P().useDocumentLabel??y)()}function F(n,e,t,r){return(P().useBridges??v)(n,e,t,r)}function I(n){return(P().useStandaloneBridges??v)(n)}function R(n,e){(P().useDocumentPass??b)(n,e)}function T(){return P().blockRules??O}function V(){return P().blockLook??j}function A(){return P().devices??w}function K(){return P().leftView??C}function W(){return P().pinned??L}function E(){return P().saveSwitch??!0}function H(n){e(!0===P().pickFollowsSelection,n)}function M(){return P().add??h}function Q(){return P().storageNamespace||void 0}function U(){return P().styleClipboard??null}function X(){return P().nodeKeys??!0}function Y(){return P().notify??null}function Z(){return P().Canvas??S}function q(){return P().CanvasHead??null}function z(){return P().canvasDrag??null}var J=o(null);function $({target:n,children:e}){/* @__PURE__ */
5
+ return s(J.Provider,{value:n,children:e})}function _(){return u(J)}function nn(){return P().Inspector??B}export{c as SELECTION_MODE,$ as ScreenCanvasTargetProvider,N as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,M as useScreenAdd,V as useScreenBlockLook,T as useScreenBlockRules,F as useScreenBridges,z as useScreenCanvasDrag,Z as useScreenCanvasFrame,q as useScreenCanvasHead,_ as useScreenCanvasTarget,A as useScreenDevices,x as useScreenDocumentLabel,R as useScreenDocumentPass,nn as useScreenInspectorPanel,K as useScreenLeftView,X as useScreenNodeKeys,Y as useScreenNotify,D as useScreenOwnerName,P as useScreenParts,H as useScreenPickFollowsSelection,W as useScreenPinned,E as useScreenSaveSwitch,Q as useScreenStorageNamespace,U as useScreenStyleClipboard,I as useStandaloneScreenBridges};
@@ -62,6 +62,17 @@ interface Easel<C extends EaselConfig = EaselConfig> {
62
62
  * records.
63
63
  */
64
64
  batch: (fn: () => void) => void;
65
+ /**
66
+ * Open a group: every recorded change from now until `close()` becomes ONE
67
+ * undo step, however far apart the changes are — where `batch` is one
68
+ * synchronous call, a group spans time. A typing session on the canvas
69
+ * writes on every key and is one edit to undo. A group with no change in it
70
+ * adds no step; the step after a closed group is its own; `close()` again
71
+ * does nothing.
72
+ */
73
+ group: () => {
74
+ close: () => void;
75
+ };
65
76
  /** Select a node by id, or nothing. Selection is not an undo step. */
66
77
  select: (id: string | null) => void;
67
78
  /** Select a slot — a column — or nothing. */
@@ -1 +1 @@
1
- export{CanvasFrame,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,bindUndoKeys,createEasel,createUseEasel,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useSelectedFields,validSelection}from"../chunk-RAFTHQVR.js";import"../chunk-AELNNAFM.js";import"../chunk-YRLPFZW3.js";import"../chunk-UK2FQOUT.js";import"../chunk-MFIRYGHW.js";import"../chunk-ZNCEOSXO.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
1
+ export{CanvasFrame,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,bindUndoKeys,createEasel,createUseEasel,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useSelectedFields,validSelection}from"../chunk-BVKNVCGX.js";import"../chunk-AELNNAFM.js";import"../chunk-YRLPFZW3.js";import"../chunk-UK2FQOUT.js";import"../chunk-MFIRYGHW.js";import"../chunk-ZNCEOSXO.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{AddBlockRow as default}from"../../chunk-AL65NE2M.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-CVBKSCAY.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-MCHMF32I.js";import"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{AddBlockRow as default}from"../../chunk-MTG37BOC.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-VOKBME2Y.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-MCHMF32I.js";import"../../chunk-BVKNVCGX.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{blockKey,AddSidePanel as default,sectionKey,templateKey}from"../../chunk-SYDZ5YWX.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-CVBKSCAY.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-MCHMF32I.js";import"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-MOCX5MQ7.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{blockKey,AddSidePanel as default,sectionKey,templateKey}from"../../chunk-TNV2BVL2.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-VOKBME2Y.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-MCHMF32I.js";import"../../chunk-BVKNVCGX.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-MOCX5MQ7.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{MediaSidePanel as default}from"../../chunk-3CS5BQMF.js";import"../../chunk-CVBKSCAY.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{MediaSidePanel as default}from"../../chunk-O7IPFJGX.js";import"../../chunk-VOKBME2Y.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-BVKNVCGX.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{ScreenChrome as default}from"../../chunk-ATVN7L2J.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-BXQBCW3P.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-PAM3NLFL.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-SQM6APQW.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-6TOYXESC.js";import"../../chunk-LNKCGJYU.js";import"../../chunk-RSDDVLT7.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-MTRFMGBO.js";import"../../chunk-HQWQLDCB.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-WZMU646D.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-V7U33NF2.js";import"../../chunk-5545A3PC.js";import"../../chunk-SYDZ5YWX.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-3CS5BQMF.js";import"../../chunk-CVBKSCAY.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-MCHMF32I.js";import"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-4VJATVVR.js";import"../../chunk-BDTITTMW.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-MOCX5MQ7.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{ScreenChrome as default}from"../../chunk-LSBQ74U4.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-BXQBCW3P.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-PAM3NLFL.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-7WAC3IXR.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-6TOYXESC.js";import"../../chunk-7XFNHML2.js";import"../../chunk-B6WEYEMH.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-MTRFMGBO.js";import"../../chunk-HQWQLDCB.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-WZMU646D.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-V7U33NF2.js";import"../../chunk-5545A3PC.js";import"../../chunk-TNV2BVL2.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-O7IPFJGX.js";import"../../chunk-VOKBME2Y.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-MCHMF32I.js";import"../../chunk-BVKNVCGX.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-4VJATVVR.js";import"../../chunk-BDTITTMW.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-MOCX5MQ7.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{DocumentScreen,ScreenMount as default}from"../../chunk-74A4LGYT.js";import"../../chunk-GXQCZJOP.js";import"../../chunk-7YFUG75W.js";import"../../chunk-ATVN7L2J.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-BXQBCW3P.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-PAM3NLFL.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-SQM6APQW.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-6TOYXESC.js";import"../../chunk-LNKCGJYU.js";import"../../chunk-RSDDVLT7.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-MTRFMGBO.js";import"../../chunk-HQWQLDCB.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-WZMU646D.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-V7U33NF2.js";import"../../chunk-5545A3PC.js";import"../../chunk-SYDZ5YWX.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-3CS5BQMF.js";import"../../chunk-CVBKSCAY.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-MCHMF32I.js";import"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-4VJATVVR.js";import"../../chunk-BDTITTMW.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-MOCX5MQ7.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{DocumentScreen,ScreenMount as default}from"../../chunk-U32MAI4R.js";import"../../chunk-GXQCZJOP.js";import"../../chunk-IH2O5CZO.js";import"../../chunk-LSBQ74U4.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-BXQBCW3P.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-PAM3NLFL.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-7WAC3IXR.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-6TOYXESC.js";import"../../chunk-7XFNHML2.js";import"../../chunk-B6WEYEMH.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-MTRFMGBO.js";import"../../chunk-HQWQLDCB.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-WZMU646D.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-V7U33NF2.js";import"../../chunk-5545A3PC.js";import"../../chunk-TNV2BVL2.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-O7IPFJGX.js";import"../../chunk-VOKBME2Y.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-MCHMF32I.js";import"../../chunk-BVKNVCGX.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-4VJATVVR.js";import"../../chunk-BDTITTMW.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-MOCX5MQ7.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{ScreenStoreProvider as default}from"../../chunk-7YFUG75W.js";import"../../chunk-CVBKSCAY.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{ScreenStoreProvider as default}from"../../chunk-IH2O5CZO.js";import"../../chunk-VOKBME2Y.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-BVKNVCGX.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1,16 +1,16 @@
1
- import{AddBlockRow as e}from"../../chunk-AL65NE2M.js";import{slotChildRowName as n}from"../../chunk-TBF5CVPA.js";import{scrollPreviewToSection as o,gotoPreviewSlide as r}from"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import{useEaselUndoKeys as t}from"../../chunk-SQM6APQW.js";import{SlotChildActionsProvider as s}from"../../chunk-KCBEE2MC.js";import{DEFAULT_PANEL_W as i}from"../../chunk-6TOYXESC.js";import{usePartBridge as c}from"../../chunk-LNKCGJYU.js";import{useSectionOps as p}from"../../chunk-RSDDVLT7.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import{useScreenDocument as l}from"../../chunk-WZMU646D.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import{MediaSidePanel as m}from"../../chunk-3CS5BQMF.js";import{SELECTION_MODE as d,useScreenPinned as a,useScreenCanvasFrame as u,useScreenInspectorPanel as h,useScreenPickFollowsSelection as k,sameInspectorMode as f,useStandaloneScreenBridges as j,useScreenBlockLook as S,useScreenBlockRules as y}from"../../chunk-CVBKSCAY.js";import{nestsInTree as C,slotFieldsOf as N}from"../../chunk-PLVEGYK6.js";import{useMediaPanel as A,usePanelPick as x,useCancelPanelPick as M}from"../../chunk-R6WTQWAC.js";import{useHostEscape as O}from"../../chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as v}from"../../chunk-MCHMF32I.js";import{useEasel as L}from"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import{LayersTree as R,Subtree as B,TreeRow as P,TreeRowAction as F,TreeSeam as T}from"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import{DEFAULT_TREE_WORDS as g}from"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-BDTITTMW.js";import{DEFAULT_SAVE_WORDS as w,saveIndicator as z}from"../../chunk-H6DDIBQ4.js";import{SaveState as E,panelWidthVars as b}from"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import{useWords as W}from"../../chunk-MFIRYGHW.js";import"../../chunk-MOCX5MQ7.js";import"../../chunk-O2NLQBFX.js";import{useTreeDrag as Y}from"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import{zoneKey as D,parseZoneKey as H}from"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import{useState as V,useRef as Q,useEffect as J,useCallback as K,Fragment as I}from"react";import{Tooltip as X}from"efficient-shell/ui";import{TrashIcon as G}from"efficient-shell/icons/efficient";import{jsxs as Z,jsx as U,Fragment as $}from"react/jsx-runtime";var q=e=>n=>{n.target.closest("button, input")||e()},_={rowClick:q};function ee(){const{saveState:ee,readOnly:ne,readOnlyReason:oe=null}=l(),re=p(),{appState:te,selectedItem:se,config:ie}=L(e=>e),[ce,pe]=V(d),le=W("screen",v),me=W("tree",g),de=W("save",w),{first:ae,last:ue,panelOf:he}=a(),ke=he(ae),fe=u(),je=h(),Se=te.data.content?.[0]??null,ye=Se?.props.id??null,Ce=Se?.type===ae,Ne=Se?.type===ue,Ae=Q(null),xe=Q(null);t(xe);const Me=A(),Oe=x(),ve=M();k(se?.props.id),J(()=>{const e=xe.current;if(!Oe||!e)return;const n=e=>{"Escape"===e.key&&ve()};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)},[Oe]),O(null!==Oe,()=>ve()),J(()=>{ye&&Ae.current!==ye&&(Ae.current=ye,Ce?pe(ke??d):se||re.select({index:0}))},[ye,se,re,Ce]);const Le=K(e=>pe(n=>f(n,e)?n:e),[]),Re=j({kind:ce.kind,mode:ce,open:Le,show:e=>pe(e),reveal:()=>{},select:(e,n)=>{pe(e=>f(e,n)?e:n),re.select(e)}}),{selectNode:Be}=c({mode:ce,setMode:pe,onOpenPart:o}),Pe=S(),{labelAtLevel:Fe,Icon:Te}=Pe,{canAddTo:ge}=y(),we=e=>Fe(e,"block",ie.components[e]?.label??e),ze=e=>Fe(e,"section",we(e)),Ee=!Ce&&"puck"===ce.kind&&se?.props.id===ye,be=Se?ge(Se.type)?.spec??null:null,We=Se&&be?`${Se.props.id}:${be.slot}`:null,Ye=Se&&be&&Array.isArray(Se.props[be.slot])?Se.props[be.slot]:[],De=e=>n(e,we,Pe.plainText),He=(e,n)=>{Se&&be&&We&&(pe(d),be.slider?(r(String(Se.props.id),e),re.select({index:e,zone:We}),o(String(Se.props.id))):(re.select({index:e,zone:We}),o(n)))},Ve=()=>{if(!Se||!be||!We)return;const e=Ye.length;re.insertComponent(We,be.childType,e),pe(d),be.slider?requestAnimationFrame(()=>{r(String(Se.props.id),e),re.select({index:e,zone:We})}):re.select({index:e,zone:We})},Qe=e=>N(ie,e),Je=e=>{const{parentId:n,slot:o}=H(e),r=e=>{if(!e)return null;if(String(e.props.id)===n)return e;for(const n of Qe(e.type)){const o=Array.isArray(e.props[n])?e.props[n]:[];for(const e of o){const n=r(e);if(n)return n}}return null},t=r(Se)?.props[o];return Array.isArray(t)?t.length:0},Ke=(e,n,o)=>{const r=Math.min(Math.max(o,0),Je(e)),t=n<r?r-1:r;t!==n&&(re.reorderComponent(e,n,t),pe(d),re.select({index:t,zone:e}))},Ie=Y({keyOf:e=>e.id,readOnly:Boolean(ne),canDrop:(e,n)=>D(n)===e.zone&&n.index>=0&&n.index<=Je(e.zone),onDrop:(e,n)=>Ke(e.zone,e.index,n.index),onStep:(e,n)=>Ke(e.zone,e.index,n<0?e.index-1:e.index+2)}),Xe=(e,n)=>/* @__PURE__ */U(T,{...ne?{}:Ie.seam({place:{...H(e),index:n}})},`seam:${e}:${n}`),Ge=e=>Pe.blockRowName(e,we),Ze=(e,n,r)=>{pe(d),re.select({index:n,zone:e}),o(r)},Ue=(e,n,o)=>{re.insertComponent(e,n,o),pe(d),re.select({index:o,zone:e})},$e=(n,o,r)=>/* @__PURE__ */U(e,{choices:r,onPick:e=>Ue(n,e,o)}),qe=(e,n)=>{const o=Qe((r=e).type).flatMap(e=>(Array.isArray(r.props[e])?r.props[e]:[]).map((n,o)=>({child:n,zone:`${r.props.id}:${e}`,index:o})));var r;const t=ge(e.type),s=t?.choices??null,i="footer"===t?.source?Ge:De;/* @__PURE__ */
2
- return Z($,{children:[o.map(({child:e,zone:o,index:r})=>{const t=se?.props.id===e.props.id,s=C(ie,e.type,n),c=i(e),p=String(e.props.id),l=()=>Ze(o,r,p),{rowProps:m,...a}=Ie.row({item:{id:p,zone:o,index:r},place:{...H(o),index:r}},{onClick:q(l)});/* @__PURE__ */
3
- return Z(I,{children:[0===r&&Xe(o,0),
4
- /* @__PURE__ */U(P,{words:me,icon:/* @__PURE__ */U(Te,{type:e.type,size:13}),name:c,selected:t,onSelect:l,...a,actions:/* @__PURE__ */U(F,{kind:"delete",label:le.deleteNamed({name:c}),onClick:()=>{return e=o,n=r,re.removeComponent(e,n),pe(d),void re.select(null);var e,n},children:/* @__PURE__ */U(G,{size:13})}),rowProps:m}),s&&/* @__PURE__ */U(B,{children:qe(e,n+1)}),Xe(o,r+1)]},String(e.props.id??`${o}-${r}`))}),t&&s?$e(`${e.props.id}:${t.slot}`,o.length,s):null]})},_e="HeroSingle"===Se?.type,en=Boolean(Se)&&(Boolean(be)||Ne||Ce||_e);/* @__PURE__ */
5
- return Z("div",{ref:xe,className:"sf-editor es-editor",style:b(i),children:[
6
- /* @__PURE__ */U("div",{className:"sf-section-bar",children:/* @__PURE__ */U(E,null!==oe?{tone:"off",label:oe,role:"status"}:{...z(ee,de),role:"status"})}),
7
- /* @__PURE__ */Z("div",{className:"sf-body",children:[Oe&&Me?/* @__PURE__ */U("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:/* @__PURE__ */U(m,{panel:Me,pick:Oe})}):en&&Se&&/* @__PURE__ */Z("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:[
8
- /* @__PURE__ */U("div",{className:"sf-panel-head",children:/* @__PURE__ */U(X,{content:Ce?le.headerSettings:le.sectionSettings({name:ze(Se.type)}),side:"bottom",children:/* @__PURE__ */U("button",{type:"button",className:"sf-panel-title sf-panel-title--btn "+(Ee?"is-selected":""),"aria-pressed":Ee,onClick:()=>{Ce?pe(ke??d):(pe(d),re.select({index:0}))},children:ze(Se.type)})})}),
9
- /* @__PURE__ */U(R,{className:"sf-tree sf-scroll",rootProps:Ie.rootProps(),words:me,children:/* @__PURE__ */U(B,{children:Ce?
10
- /* @__PURE__ */U(P,{words:me,icon:/* @__PURE__ */U(Te,{type:"header",size:13}),name:le.headerSettings,selected:ce.kind===ke?.kind,onSelect:()=>pe(ke??d),rowProps:{onClick:q(()=>pe(ke??d))}}):be?/* @__PURE__ */Z($,{children:[Ye.map((e,n)=>{const o=se?.props.id===e.props.id,r=De(e),t=String(e.props.id),s=()=>He(n,t),{rowProps:i,...c}=Ie.row({item:{id:t,zone:We,index:n},place:{...H(We),index:n}},{onClick:q(s)});/* @__PURE__ */
11
- return Z(I,{children:[0===n&&Xe(We,0),
12
- /* @__PURE__ */U(P,{words:me,icon:/* @__PURE__ */U(Te,{type:e.type,size:13}),name:r,selected:o,onSelect:s,...c,actions:/* @__PURE__ */U(F,{kind:"delete",label:le.deleteNamed({name:r}),onClick:()=>{return e=n,void(We&&(re.removeComponent(We,e),pe(d),re.select(null)));var e},children:/* @__PURE__ */U(G,{size:13})}),rowProps:i}),Xe(We,n+1)]},String(e.props.id??n))}),
13
- /* @__PURE__ */Z("button",{type:"button",className:"sf-add-card",onClick:Ve,children:[
14
- /* @__PURE__ */U("span",{className:"sf-plus sf-plus--sm",children:"+"}),be.addLabel]}),ye?Re.partRows?.(Se,_):null]}):qe(Se,1)})})]}),
15
- /* @__PURE__ */U("div",{className:"sf-center",children:/* @__PURE__ */U("div",{className:"sf-preview-host",children:/* @__PURE__ */U(fe,{})})}),
16
- /* @__PURE__ */U(s,{value:{selectChild:(e,n,o,r)=>"section"===ge(r)?.source?He(n,o):Ze(e,n,o),addChild:(e,n,o,r,t)=>"section"===ge(t)?.source?Ve():Ue(`${e}:${n}`,o,r),childRowName:De,blockRowName:Ge},children:/* @__PURE__ */U(je,{mode:ce,onOpenWebsiteSettings:Re.openSettings??(()=>{}),onSelectNode:Be,hideNodeActions:!0})})]})]})}export{ee as default};
1
+ import{AddBlockRow as e}from"../../chunk-MTG37BOC.js";import{slotChildRowName as n}from"../../chunk-TBF5CVPA.js";import{scrollPreviewToSection as o,gotoPreviewSlide as r}from"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import{useEaselUndoKeys as t}from"../../chunk-7WAC3IXR.js";import{SlotChildActionsProvider as s}from"../../chunk-KCBEE2MC.js";import{DEFAULT_PANEL_W as i}from"../../chunk-6TOYXESC.js";import{usePartBridge as c}from"../../chunk-7XFNHML2.js";import{useSectionOps as p}from"../../chunk-B6WEYEMH.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import{useScreenDocument as l}from"../../chunk-WZMU646D.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import{MediaSidePanel as m}from"../../chunk-O7IPFJGX.js";import{SELECTION_MODE as d,useScreenPinned as a,useScreenCanvasFrame as u,useScreenInspectorPanel as h,useScreenPickFollowsSelection as k,sameInspectorMode as f,useStandaloneScreenBridges as j,useScreenBlockLook as y,useScreenBlockRules as N}from"../../chunk-VOKBME2Y.js";import{nestsInTree as S,slotFieldsOf as C}from"../../chunk-PLVEGYK6.js";import{useMediaPanel as A,usePanelPick as M,useCancelPanelPick as x}from"../../chunk-R6WTQWAC.js";import{useHostEscape as O}from"../../chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as B}from"../../chunk-MCHMF32I.js";import{useEasel as v}from"../../chunk-BVKNVCGX.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import{LayersTree as E,Subtree as P,TreeRow as F,TreeRowAction as L,TreeSeam as R}from"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import{DEFAULT_TREE_WORDS as g}from"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-BDTITTMW.js";import{DEFAULT_SAVE_WORDS as w,saveIndicator as z}from"../../chunk-H6DDIBQ4.js";import{SaveState as T,panelWidthVars as W}from"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import{useWords as b}from"../../chunk-MFIRYGHW.js";import"../../chunk-MOCX5MQ7.js";import"../../chunk-O2NLQBFX.js";import{useTreeDrag as Y}from"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import{zoneKey as H,parseZoneKey as X}from"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import{useState as V,useRef as D,useEffect as I,useCallback as G,Fragment as J}from"react";import{Tooltip as K}from"efficient-shell/ui";import{TrashIcon as Z}from"efficient-shell/icons/efficient";import{jsxs as Q,jsx as $,Fragment as U}from"react/jsx-runtime";var q=e=>n=>{n.target.closest("button, input")||e()},_={rowClick:q};function ee(){const{saveState:ee,readOnly:ne,readOnlyReason:oe=null}=l(),re=p(),{appState:te,selectedItem:se,config:ie}=v(e=>e),[ce,pe]=V(d),le=b("screen",B),me=b("tree",g),de=b("save",w),{first:ae,last:ue,panelOf:he}=a(),ke=he(ae),fe=u(),je=h(),ye=te.data.content?.[0]??null,Ne=ye?.props.id??null,Se=ye?.type===ae,Ce=ye?.type===ue,Ae=D(null),Me=D(null);t(Me);const xe=A(),Oe=M(),Be=x();k(se?.props.id),I(()=>{const e=Me.current;if(!Oe||!e)return;const n=e=>{"Escape"===e.key&&Be()};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)},[Oe]),O(null!==Oe,()=>Be()),I(()=>{Ne&&Ae.current!==Ne&&(Ae.current=Ne,Se?pe(ke??d):se||re.select({index:0}))},[Ne,se,re,Se]);const ve=G(e=>pe(n=>f(n,e)?n:e),[]),Ee=j({kind:ce.kind,mode:ce,open:ve,show:e=>pe(e),reveal:()=>{},select:(e,n)=>{pe(e=>f(e,n)?e:n),re.select(e)}}),{selectNode:Pe}=c({mode:ce,setMode:pe,onOpenPart:o}),Fe=y(),{labelAtLevel:Le,Icon:Re}=Fe,{canAddTo:ge}=N(),we=e=>Le(e,"block",ie.components[e]?.label??e),ze=e=>Le(e,"section",we(e)),Te=!Se&&"puck"===ce.kind&&se?.props.id===Ne,We=ye?ge(ye.type)?.spec??null:null,be=ye&&We?`${ye.props.id}:${We.slot}`:null,Ye=ye&&We&&Array.isArray(ye.props[We.slot])?ye.props[We.slot]:[],He=e=>n(e,we,Fe.plainText),Xe=(e,n)=>{ye&&We&&be&&(pe(d),We.slider?(r(String(ye.props.id),e),re.select({index:e,zone:be}),o(String(ye.props.id))):(re.select({index:e,zone:be}),o(n)))},Ve=()=>{if(!ye||!We||!be)return;const e=Ye.length;re.insertComponent(be,We.childType,e),pe(d),We.slider?requestAnimationFrame(()=>{r(String(ye.props.id),e),re.select({index:e,zone:be})}):re.select({index:e,zone:be})},De=e=>C(ie,e),Ie=e=>{const{parentId:n,slot:o}=X(e),r=e=>{if(!e)return null;if(String(e.props.id)===n)return e;for(const n of De(e.type)){const o=Array.isArray(e.props[n])?e.props[n]:[];for(const e of o){const n=r(e);if(n)return n}}return null},t=r(ye)?.props[o];return Array.isArray(t)?t.length:0},Ge=(e,n,o)=>{const r=Math.min(Math.max(o,0),Ie(e)),t=n<r?r-1:r;t!==n&&(re.reorderComponent(e,n,t),pe(d),re.select({index:t,zone:e}))},Je=Y({keyOf:e=>e.id,readOnly:Boolean(ne),canDrop:(e,n)=>H(n)===e.zone&&n.index>=0&&n.index<=Ie(e.zone),onDrop:(e,n)=>Ge(e.zone,e.index,n.index),onStep:(e,n)=>Ge(e.zone,e.index,n<0?e.index-1:e.index+2)}),Ke=(e,n)=>/* @__PURE__ */$(R,{...ne?{}:Je.seam({place:{...X(e),index:n}})},`seam:${e}:${n}`),Ze=e=>Fe.blockRowName(e,we),Qe=(e,n,r)=>{pe(d),re.select({index:n,zone:e}),o(r)},$e=(e,n,o)=>{re.insertComponent(e,n,o),pe(d),re.select({index:o,zone:e})},Ue=(n,o,r)=>/* @__PURE__ */$(e,{choices:r,onPick:e=>$e(n,e,o)}),qe=(e,n)=>{const o=De((r=e).type).flatMap(e=>(Array.isArray(r.props[e])?r.props[e]:[]).map((n,o)=>({child:n,zone:`${r.props.id}:${e}`,index:o})));var r;const t=ge(e.type),s=t?.choices??null,i="footer"===t?.source?Ze:He;/* @__PURE__ */
2
+ return Q(U,{children:[o.map(({child:e,zone:o,index:r})=>{const t=se?.props.id===e.props.id,s=S(ie,e.type,n),c=i(e),p=String(e.props.id),l=()=>Qe(o,r,p),{rowProps:m,...a}=Je.row({item:{id:p,zone:o,index:r},place:{...X(o),index:r}},{onClick:q(l)});/* @__PURE__ */
3
+ return Q(J,{children:[0===r&&Ke(o,0),
4
+ /* @__PURE__ */$(F,{words:me,icon:/* @__PURE__ */$(Re,{type:e.type,size:13}),name:c,selected:t,onSelect:l,...a,actions:/* @__PURE__ */$(L,{kind:"delete",label:le.deleteNamed({name:c}),onClick:()=>{return e=o,n=r,re.removeComponent(e,n),pe(d),void re.select(null);var e,n},children:/* @__PURE__ */$(Z,{size:13})}),rowProps:m}),s&&/* @__PURE__ */$(P,{children:qe(e,n+1)}),Ke(o,r+1)]},String(e.props.id??`${o}-${r}`))}),t&&s?Ue(`${e.props.id}:${t.slot}`,o.length,s):null]})},_e="HeroSingle"===ye?.type,en=Boolean(ye)&&(Boolean(We)||Ce||Se||_e);/* @__PURE__ */
5
+ return Q("div",{ref:Me,className:"sf-editor es-editor",style:W(i),children:[
6
+ /* @__PURE__ */$("div",{className:"sf-section-bar",children:/* @__PURE__ */$(T,null!==oe?{tone:"off",label:oe,role:"status"}:{...z(ee,de),role:"status"})}),
7
+ /* @__PURE__ */Q("div",{className:"sf-body",children:[Oe&&xe?/* @__PURE__ */$("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:/* @__PURE__ */$(m,{panel:xe,pick:Oe})}):en&&ye&&/* @__PURE__ */Q("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:[
8
+ /* @__PURE__ */$("div",{className:"sf-panel-head",children:/* @__PURE__ */$(K,{content:Se?le.headerSettings:le.sectionSettings({name:ze(ye.type)}),side:"bottom",children:/* @__PURE__ */$("button",{type:"button",className:"sf-panel-title sf-panel-title--btn "+(Te?"is-selected":""),"aria-pressed":Te,onClick:()=>{Se?pe(ke??d):(pe(d),re.select({index:0}))},children:ze(ye.type)})})}),
9
+ /* @__PURE__ */$(E,{className:"sf-tree sf-scroll",rootProps:Je.rootProps(),words:me,children:/* @__PURE__ */$(P,{children:Se?
10
+ /* @__PURE__ */$(F,{words:me,icon:/* @__PURE__ */$(Re,{type:"header",size:13}),name:le.headerSettings,selected:ce.kind===ke?.kind,onSelect:()=>pe(ke??d),rowProps:{onClick:q(()=>pe(ke??d))}}):We?/* @__PURE__ */Q(U,{children:[Ye.map((e,n)=>{const o=se?.props.id===e.props.id,r=He(e),t=String(e.props.id),s=()=>Xe(n,t),{rowProps:i,...c}=Je.row({item:{id:t,zone:be,index:n},place:{...X(be),index:n}},{onClick:q(s)});/* @__PURE__ */
11
+ return Q(J,{children:[0===n&&Ke(be,0),
12
+ /* @__PURE__ */$(F,{words:me,icon:/* @__PURE__ */$(Re,{type:e.type,size:13}),name:r,selected:o,onSelect:s,...c,actions:/* @__PURE__ */$(L,{kind:"delete",label:le.deleteNamed({name:r}),onClick:()=>{return e=n,void(be&&(re.removeComponent(be,e),pe(d),re.select(null)));var e},children:/* @__PURE__ */$(Z,{size:13})}),rowProps:i}),Ke(be,n+1)]},String(e.props.id??n))}),
13
+ /* @__PURE__ */Q("button",{type:"button",className:"sf-add-card",onClick:Ve,children:[
14
+ /* @__PURE__ */$("span",{className:"sf-plus sf-plus--sm",children:"+"}),We.addLabel]}),Ne?Ee.partRows?.(ye,_):null]}):qe(ye,1)})})]}),
15
+ /* @__PURE__ */$("div",{className:"sf-center",children:/* @__PURE__ */$("div",{className:"sf-preview-host",children:/* @__PURE__ */$(fe,{})})}),
16
+ /* @__PURE__ */$(s,{value:{selectChild:(e,n,o,r)=>"section"===ge(r)?.source?Xe(n,o):Qe(e,n,o),addChild:(e,n,o,r,t)=>"section"===ge(t)?.source?Ve():$e(`${e}:${n}`,o,r),childRowName:He,blockRowName:Ze},children:/* @__PURE__ */$(je,{mode:ce,onOpenWebsiteSettings:Ee.openSettings??(()=>{}),onSelectNode:Pe,hideNodeActions:!0})})]})]})}export{ee as default};
@@ -1 +1 @@
1
- export{usePartBridge}from"../../chunk-LNKCGJYU.js";import"../../chunk-RSDDVLT7.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-CVBKSCAY.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{usePartBridge}from"../../chunk-7XFNHML2.js";import"../../chunk-B6WEYEMH.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-VOKBME2Y.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-BVKNVCGX.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-74A4LGYT.js";import"../chunk-GXQCZJOP.js";export{ScreenStoreProvider}from"../chunk-7YFUG75W.js";import"../chunk-ATVN7L2J.js";import"../chunk-26OOWIJJ.js";import"../chunk-BXQBCW3P.js";import"../chunk-FGNR22NY.js";import"../chunk-ZE7I3PLX.js";import"../chunk-2GVCAIPX.js";import"../chunk-PAM3NLFL.js";import"../chunk-7F52SZOI.js";import"../chunk-MQNBD6AB.js";import"../chunk-TBF5CVPA.js";import"../chunk-4ES5JGGX.js";import"../chunk-IQ5TA7AM.js";import"../chunk-DUVRZ456.js";import"../chunk-6W7WLPZH.js";import"../chunk-SQM6APQW.js";import"../chunk-KCBEE2MC.js";import"../chunk-6TOYXESC.js";import"../chunk-LNKCGJYU.js";import"../chunk-RSDDVLT7.js";import"../chunk-IYT6NN2J.js";import"../chunk-MTRFMGBO.js";import"../chunk-HQWQLDCB.js";import"../chunk-BSPCSC45.js";import"../chunk-I54UCYOU.js";import"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";import"../chunk-WZMU646D.js";import"../chunk-S4AWJX4Q.js";import"../chunk-ERR437B5.js";import"../chunk-KG7RJWOK.js";import"../chunk-GMCZXMOV.js";export{NO_DOCUMENT_ADDRESSING}from"../chunk-RLBXE4EU.js";import"../chunk-HNKB2ZYR.js";import"../chunk-CLOS6SSX.js";import"../chunk-VPFNZ7TB.js";import"../chunk-LOMEH6DG.js";import"../chunk-V7U33NF2.js";import"../chunk-5545A3PC.js";import"../chunk-SYDZ5YWX.js";import"../chunk-5ZBY24K7.js";import"../chunk-PA3PNTVV.js";import"../chunk-BVN33R76.js";import"../chunk-PFNIVZPN.js";import"../chunk-KQMML6JM.js";import"../chunk-KCOBHPN6.js";export{EaselSessionProvider,useEaselSession}from"../chunk-O7Q4DDJT.js";export{EFFICIENT_BACKEND,activateEaselSession,backendOf,createEaselSession,currentEaselSession,deactivateEaselSession,efficientClientOpen,isEfficientBackend,provideDefaultBackend,resetAmbientEaselSession,sessionRegistry,setSessionBridgedSite,setSessionDocumentSite}from"../chunk-RSCMJIWS.js";import"../chunk-HQ4VVRIC.js";import"../chunk-3CS5BQMF.js";export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenAdd,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../chunk-CVBKSCAY.js";import"../chunk-PLVEGYK6.js";import"../chunk-R6WTQWAC.js";export{DETACHED_EASEL_HOST,EaselHostContext,EaselHostProvider,createEaselHost,useEaselHost,useHostEscape}from"../chunk-U3JP4VGF.js";import"../chunk-6WY6ZXJG.js";import"../chunk-MCHMF32I.js";import"../chunk-RAFTHQVR.js";import"../chunk-AELNNAFM.js";import"../chunk-CRWFB7MU.js";import"../chunk-OZ72A6MY.js";import"../chunk-4JSBIW5H.js";import"../chunk-3ZJSLHHI.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-YRLPFZW3.js";import"../chunk-BXMXTO36.js";import"../chunk-EA2HTX37.js";import"../chunk-OSPUG6S6.js";import"../chunk-WK3AFPXY.js";import"../chunk-UK2FQOUT.js";import"../chunk-4VJATVVR.js";import"../chunk-BDTITTMW.js";import"../chunk-H6DDIBQ4.js";import"../chunk-UB4TLWVJ.js";import"../chunk-Y2G7CU6A.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-66LWADFP.js";import"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import"../chunk-MFIRYGHW.js";import"../chunk-MOCX5MQ7.js";import"../chunk-O2NLQBFX.js";import"../chunk-67GNT6PF.js";import"../chunk-PAELDYYS.js";import"../chunk-ZNCEOSXO.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
1
+ import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-U32MAI4R.js";import"../chunk-GXQCZJOP.js";export{ScreenStoreProvider}from"../chunk-IH2O5CZO.js";import"../chunk-LSBQ74U4.js";import"../chunk-26OOWIJJ.js";import"../chunk-BXQBCW3P.js";import"../chunk-FGNR22NY.js";import"../chunk-ZE7I3PLX.js";import"../chunk-2GVCAIPX.js";import"../chunk-PAM3NLFL.js";import"../chunk-7F52SZOI.js";import"../chunk-MQNBD6AB.js";import"../chunk-TBF5CVPA.js";import"../chunk-4ES5JGGX.js";import"../chunk-IQ5TA7AM.js";import"../chunk-DUVRZ456.js";import"../chunk-6W7WLPZH.js";import"../chunk-7WAC3IXR.js";import"../chunk-KCBEE2MC.js";import"../chunk-6TOYXESC.js";import"../chunk-7XFNHML2.js";import"../chunk-B6WEYEMH.js";import"../chunk-IYT6NN2J.js";import"../chunk-MTRFMGBO.js";import"../chunk-HQWQLDCB.js";import"../chunk-BSPCSC45.js";import"../chunk-I54UCYOU.js";import"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";import"../chunk-WZMU646D.js";import"../chunk-S4AWJX4Q.js";import"../chunk-ERR437B5.js";import"../chunk-KG7RJWOK.js";import"../chunk-GMCZXMOV.js";export{NO_DOCUMENT_ADDRESSING}from"../chunk-RLBXE4EU.js";import"../chunk-HNKB2ZYR.js";import"../chunk-CLOS6SSX.js";import"../chunk-VPFNZ7TB.js";import"../chunk-LOMEH6DG.js";import"../chunk-V7U33NF2.js";import"../chunk-5545A3PC.js";import"../chunk-TNV2BVL2.js";import"../chunk-5ZBY24K7.js";import"../chunk-PA3PNTVV.js";import"../chunk-BVN33R76.js";import"../chunk-PFNIVZPN.js";import"../chunk-KQMML6JM.js";import"../chunk-KCOBHPN6.js";export{EaselSessionProvider,useEaselSession}from"../chunk-O7Q4DDJT.js";export{EFFICIENT_BACKEND,activateEaselSession,backendOf,createEaselSession,currentEaselSession,deactivateEaselSession,efficientClientOpen,isEfficientBackend,provideDefaultBackend,resetAmbientEaselSession,sessionRegistry,setSessionBridgedSite,setSessionDocumentSite}from"../chunk-RSCMJIWS.js";import"../chunk-HQ4VVRIC.js";import"../chunk-O7IPFJGX.js";export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenAdd,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../chunk-VOKBME2Y.js";import"../chunk-PLVEGYK6.js";import"../chunk-R6WTQWAC.js";export{DETACHED_EASEL_HOST,EaselHostContext,EaselHostProvider,createEaselHost,useEaselHost,useHostEscape}from"../chunk-U3JP4VGF.js";import"../chunk-6WY6ZXJG.js";import"../chunk-MCHMF32I.js";import"../chunk-BVKNVCGX.js";import"../chunk-AELNNAFM.js";import"../chunk-CRWFB7MU.js";import"../chunk-OZ72A6MY.js";import"../chunk-4JSBIW5H.js";import"../chunk-3ZJSLHHI.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-YRLPFZW3.js";import"../chunk-BXMXTO36.js";import"../chunk-EA2HTX37.js";import"../chunk-OSPUG6S6.js";import"../chunk-WK3AFPXY.js";import"../chunk-UK2FQOUT.js";import"../chunk-4VJATVVR.js";import"../chunk-BDTITTMW.js";import"../chunk-H6DDIBQ4.js";import"../chunk-UB4TLWVJ.js";import"../chunk-Y2G7CU6A.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-66LWADFP.js";import"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import"../chunk-MFIRYGHW.js";import"../chunk-MOCX5MQ7.js";import"../chunk-O2NLQBFX.js";import"../chunk-67GNT6PF.js";import"../chunk-PAELDYYS.js";import"../chunk-ZNCEOSXO.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{editorRootFocus,useEaselKeyTarget,useEaselUndoKeys}from"../../chunk-SQM6APQW.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{editorRootFocus,useEaselKeyTarget,useEaselUndoKeys}from"../../chunk-7WAC3IXR.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-BVKNVCGX.js";import"../../chunk-AELNNAFM.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{useSectionOps}from"../../../chunk-RSDDVLT7.js";import"../../../chunk-CVBKSCAY.js";import"../../../chunk-PLVEGYK6.js";import"../../../chunk-R6WTQWAC.js";import"../../../chunk-U3JP4VGF.js";import"../../../chunk-RAFTHQVR.js";import"../../../chunk-AELNNAFM.js";import"../../../chunk-CRWFB7MU.js";import"../../../chunk-OZ72A6MY.js";import"../../../chunk-4JSBIW5H.js";import"../../../chunk-3ZJSLHHI.js";import"../../../chunk-K56YDHYQ.js";import"../../../chunk-KFV7N2DJ.js";import"../../../chunk-YRLPFZW3.js";import"../../../chunk-EA2HTX37.js";import"../../../chunk-UK2FQOUT.js";import"../../../chunk-66LWADFP.js";import"../../../chunk-QLD57GBB.js";import"../../../chunk-FFYXVAAL.js";import"../../../chunk-MFIRYGHW.js";import"../../../chunk-67GNT6PF.js";import"../../../chunk-ZNCEOSXO.js";import"../../../chunk-P2VEMZH5.js";import"../../../chunk-KRXQM65X.js";import"../../../chunk-NKB3KVAB.js";
1
+ export{useSectionOps}from"../../../chunk-B6WEYEMH.js";import"../../../chunk-VOKBME2Y.js";import"../../../chunk-PLVEGYK6.js";import"../../../chunk-R6WTQWAC.js";import"../../../chunk-U3JP4VGF.js";import"../../../chunk-BVKNVCGX.js";import"../../../chunk-AELNNAFM.js";import"../../../chunk-CRWFB7MU.js";import"../../../chunk-OZ72A6MY.js";import"../../../chunk-4JSBIW5H.js";import"../../../chunk-3ZJSLHHI.js";import"../../../chunk-K56YDHYQ.js";import"../../../chunk-KFV7N2DJ.js";import"../../../chunk-YRLPFZW3.js";import"../../../chunk-EA2HTX37.js";import"../../../chunk-UK2FQOUT.js";import"../../../chunk-66LWADFP.js";import"../../../chunk-QLD57GBB.js";import"../../../chunk-FFYXVAAL.js";import"../../../chunk-MFIRYGHW.js";import"../../../chunk-67GNT6PF.js";import"../../../chunk-ZNCEOSXO.js";import"../../../chunk-P2VEMZH5.js";import"../../../chunk-KRXQM65X.js";import"../../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenAdd,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-CVBKSCAY.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenAdd,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-VOKBME2Y.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-BVKNVCGX.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-easel",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Efficient Pty Ltd",
@@ -1,5 +0,0 @@
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-RAFTHQVR.js";import{Inspector as i}from"./chunk-CRWFB7MU.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={},v=()=>k,g=()=>"",y=()=>null,b=()=>{},O={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},j={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},w={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},L={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},C={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function S(){/* @__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 R=o({});function B({parts:n,children:e}){/* @__PURE__ */
4
- return s(R.Provider,{value:n,children:e})}function D(){return u(R)}function F(){return(D().useOwnerName??g)()}function G(){return(D().useDocumentLabel??y)()}function N(n,e,t,r){return(D().useBridges??v)(n,e,t,r)}function T(n){return(D().useStandaloneBridges??v)(n)}function x(n,e){(D().useDocumentPass??b)(n,e)}function A(){return D().blockRules??O}function I(){return D().blockLook??j}function V(){return D().devices??w}function W(){return D().leftView??L}function H(){return D().pinned??C}function K(){return D().saveSwitch??!0}function Q(n){e(!0===D().pickFollowsSelection,n)}function E(){return D().add??h}function M(){return D().storageNamespace||void 0}function U(){return D().styleClipboard??null}function Y(){return D().nodeKeys??!0}function Z(){return D().notify??null}function q(){return D().Canvas??S}function z(){return D().CanvasHead??null}function J(){return D().canvasDrag??null}var X=o(null);function $({target:n,children:e}){/* @__PURE__ */
5
- return s(X.Provider,{value:n,children:e})}function _(){return u(X)}function nn(){return D().Inspector??P}export{c as SELECTION_MODE,$ as ScreenCanvasTargetProvider,B as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,E as useScreenAdd,I as useScreenBlockLook,A as useScreenBlockRules,N as useScreenBridges,J as useScreenCanvasDrag,q as useScreenCanvasFrame,z as useScreenCanvasHead,_ as useScreenCanvasTarget,V as useScreenDevices,G as useScreenDocumentLabel,x as useScreenDocumentPass,nn as useScreenInspectorPanel,W as useScreenLeftView,Y as useScreenNodeKeys,Z as useScreenNotify,F as useScreenOwnerName,D as useScreenParts,Q as useScreenPickFollowsSelection,H as useScreenPinned,K as useScreenSaveSwitch,M as useScreenStorageNamespace,U as useScreenStyleClipboard,T as useStandaloneScreenBridges};
@@ -1,5 +0,0 @@
1
- import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as i}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-PFNIVZPN.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-CVBKSCAY.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-MCHMF32I.js";import{useEasel as f}from"./chunk-RAFTHQVR.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-MOCX5MQ7.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-O2NLQBFX.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as $,jsxs as B,Fragment as O}from"react/jsx-runtime";var V=e=>`section:${e}`,v=e=>`block:${e}`,C=e=>`template:${e}`;function F({blocks:F,blocksOnly:I,at:N,onAdd:x,itemFor:A,session:H,siteWide:L,onClose:M,onHide:Q,readOnly:R}){const P=f(e=>e.config),T=p(),{labelAtLevel:w,categoryLabel:D,firstSection:S,Icon:Y,Thumbnail:z}=T,{blockIsOffered:K}=m(),W=u("screen",d).add,X=u("drag",h).add,Z=l(),[E,G]=y([]);b(()=>{let t=!1;const o=e=>K(e,Z);return s(Z).list().then(n=>{if(t)return;const i=P.components;G(n.filter(t=>t.node?.type&&i[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[P,Z]);const J=j(()=>t(P,T),[P]),q=e=>({type:V(e.type),label:e.name,cover:/* @__PURE__ */$(z,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:W.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),U=j(()=>{const e=[];if(F&&F.choices.length>0&&a(F.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${W.inside({name:F.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:v(e.type),label:e.label,icon:/* @__PURE__ */$(Y,{type:e.type,size:18}),title:W.tile({name:e.label})}))})}),I)return e;const t=o(J,S);t&&e.push({key:"start",title:W.startBlank,tiles:[q(t)]}),E.length>0&&e.push({key:"templates",title:W.templates,tiles:E.map(e=>{return{type:C(e.id),label:e.name,cover:/* @__PURE__ */$(z,{type:e.node.type}),keywords:[(t=e.node.type,w(t,"section",P.components[t]?.label??t)),e.node.type]};var t})});const s=n(J,S);for(const t of Object.keys(P.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:i(P,t,D),tiles:o.map(q)})}return e},[F,I,E,J,P,W]),_=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=E.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
2
- return B(O,{children:[
3
- /* @__PURE__ */$(r,{icon:/* @__PURE__ */$(g,{size:15}),title:W.title,context:I?W.contextBlocks:W.contextAll,actions:/* @__PURE__ */$(c,{label:W.done,description:W.doneDescription,onClick:M}),onHide:Q}),
4
- /* @__PURE__ */B("div",{className:"sf-addside sf-scroll",children:[
5
- /* @__PURE__ */$(k,{groups:U,session:H,itemFor:e=>A(_(e)??{kind:"section",type:e}),onInsert:e=>{const t=_(e);t&&x(t)},at:N,hint:I?W.hintBlocks:W.hint,searchLabel:I?W.searchBlocks:W.searchSections,readOnly:R,words:X}),L&&!I?L:null]})]})}export{F as AddSidePanel,v as blockKey,V as sectionKey,C as templateKey};