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