efficient-easel 20.2.1 → 21.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -6
- package/dist/{CanvasDragLayer-ARfaivCu.d.ts → CanvasDragLayer-Cd1o0HQf.d.ts} +1 -1
- package/dist/{chunk-TNGOL65V.js → chunk-2E2SXDYQ.js} +1 -1
- package/dist/chunk-2M4T27BI.js +18 -0
- package/dist/chunk-4IJVV7DA.js +1 -0
- package/dist/{chunk-JQXD3TDE.js → chunk-66JNVRQM.js} +1 -1
- package/dist/{chunk-EFHV56BO.js → chunk-7L3NKHEC.js} +14 -14
- package/dist/{chunk-XJ2WXGFJ.js → chunk-APVUYICP.js} +42 -42
- package/dist/{chunk-HK6I3NVO.js → chunk-E52W3M5I.js} +1 -1
- package/dist/chunk-EB6NI2VK.js +1 -0
- package/dist/chunk-EZTP6E2M.js +5 -0
- package/dist/chunk-FM6JO4WF.js +2 -0
- package/dist/chunk-FOHHXSOL.js +1 -0
- package/dist/{chunk-I7BROL77.js → chunk-HGCGIRVA.js} +1 -1
- package/dist/chunk-JACEEVVF.js +1 -0
- package/dist/{chunk-QAJAEWCZ.js → chunk-KFWNGPW3.js} +5 -5
- package/dist/{chunk-276MBG5P.js → chunk-LXTM2OLQ.js} +2 -2
- package/dist/{chunk-FGYJ5DJY.js → chunk-MSGZ56QL.js} +1 -1
- package/dist/chunk-MZ5GSSZ3.js +7 -0
- package/dist/{chunk-UJ46J7QW.js → chunk-N2RISV46.js} +1 -1
- package/dist/chunk-NA3GMA43.js +5 -0
- package/dist/chunk-OBWDHKLI.js +8 -0
- package/dist/chunk-Q2A7RHG2.js +1 -0
- package/dist/{chunk-JBOSEHIX.js → chunk-R4QJ6DC5.js} +1 -1
- package/dist/chunk-S3DUFDQ6.js +6 -0
- package/dist/chunk-TQ5Y6S2X.js +1 -0
- package/dist/{chunk-7YVEYQDE.js → chunk-V2ULLALL.js} +3 -3
- package/dist/chunk-WHS6Y55E.js +10 -0
- package/dist/{chunk-ZOBSIXRD.js → chunk-Y2T3JX7K.js} +1 -1
- package/dist/chunk-YHFKWV7H.js +21 -0
- package/dist/copy/index.js +13 -13
- package/dist/drag/drag.css +3 -9
- package/dist/drag/index.d.ts +2 -2
- package/dist/drag/index.js +1 -1
- package/dist/draw/index.d.ts +1 -1
- package/dist/draw/index.js +1 -1
- package/dist/easel/index.js +1 -1
- package/dist/fields/fields.css +2 -2
- package/dist/fields/index.d.ts +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/panel/index.d.ts +37 -138
- package/dist/panel/index.js +15 -15
- package/dist/panel/panel.css +53 -347
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +3 -3
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +3 -3
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +3 -3
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +3 -3
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/usePartBridge.d.ts +3 -3
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +3 -3
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/content/view-tiers.d.ts +14 -2
- package/dist/screen/lib/content/view-tiers.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/puck/device-fields.js +1 -1
- package/dist/screen/lib/puck/preview-dom.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +3 -3
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +3 -3
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +3 -7
- package/dist/screen/words.d.ts +4 -0
- package/dist/screen/words.js +1 -1
- package/dist/strings/index.d.ts +2 -2
- package/dist/strings/index.js +2 -2
- package/dist/text-styles/index.js +30 -30
- package/dist/tree/index.d.ts +4 -4
- package/dist/tree/index.js +1 -1
- package/dist/{types-Bqq6ya0y.d.ts → types-DBy3L69b.d.ts} +11 -4
- package/dist/{words-vhnV8sM7.d.ts → words-CFkb8XtN.d.ts} +5 -0
- package/dist/{words-CvwYvkJm.d.ts → words-SD4neL0n.d.ts} +6 -0
- package/package.json +3 -3
- package/dist/chunk-23DYNW6S.js +0 -1
- package/dist/chunk-23VM4PMV.js +0 -7
- package/dist/chunk-6FWAE2RN.js +0 -1
- package/dist/chunk-7LYKFL3Q.js +0 -21
- package/dist/chunk-A6Z4SD3I.js +0 -10
- package/dist/chunk-KAML3KQH.js +0 -1
- package/dist/chunk-L2Y3PF2R.js +0 -4
- package/dist/chunk-LQV5FZTQ.js +0 -18
- package/dist/chunk-MEHLY5Q4.js +0 -1
- package/dist/chunk-PAOZMXEI.js +0 -5
- package/dist/chunk-R5KEFI55.js +0 -8
- package/dist/chunk-RC25EGHD.js +0 -5
- package/dist/chunk-VANKQVOW.js +0 -8
- package/dist/chunk-WEIE2FBC.js +0 -1
- package/dist/chunk-WRFD4EXD.js +0 -1
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-
|
|
1
|
+
import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-R4QJ6DC5.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s,scrollPreviewToTop as d}from"./chunk-2E2SXDYQ.js";import{useEaselKeyTarget as a,useEaselUndoKeys as c,useEaselSaveKey as p,editorRootFocus as u}from"./chunk-HGCGIRVA.js";import{SlotChildActionsProvider as h}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as f,DEFAULT_PANEL_W as m,clampPanelWidth as g}from"./chunk-C56MPJBH.js";import{usePartBridge as y}from"./chunk-Q2A7RHG2.js";import{useSectionOps as v}from"./chunk-FOHHXSOL.js";import{ScreenSaveIcon as k,ScreenMainButton as b}from"./chunk-PY7OOQEZ.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-OBWDHKLI.js";import{keepsSharedSections as z,sharedSectionsOf as C}from"./chunk-43AEUUNQ.js";import{PanelHideButton as N,SidePanelHead as I,PanelShowStrip as O}from"./chunk-SINAM2IT.js";import{offeredChoices as B}from"./chunk-M2Z775ZC.js";import{useScreenSaveSwitch as P,useScreenNodeKeys as $,useScreenPinned as M,useScreenDocumentLabel as j,useScreenCanvasFrame as A,useScreenInspectorPanel as L,useScreenDevices as T,useScreenPickFollowsSelection as E,useScreenLeftView as R,SELECTION_MODE as F,sameInspectorMode as D,useScreenBridges as H,useScreenBlockRules as V,useScreenBlockLook as W,useScreenStorageNamespace as U,useScreenNotify as G,useScreenCanvasHead as J,isSlotMode as Y,useScreenStyleClipboard as K,useScreenDocumentPass as Q,useScreenCanvasDrag as X,ScreenCanvasTargetProvider as Z,isPinnedFirst as _,isPinnedLast as q,screenSlotsOf as ee}from"./chunk-NA3GMA43.js";import{MediaPopup as ne}from"./chunk-2G6MAXPY.js";import{useNodeClipboard as te,useNodeContextMenu as oe}from"./chunk-4IJVV7DA.js";import{PageEditGuardNotices as re}from"./chunk-N2RISV46.js";import{useScreenDocument as ie}from"./chunk-LXTM2OLQ.js";import{requestMediaPick as le}from"./chunk-UNVKPVZW.js";import{useMediaPanel as se,usePanelPick as de,useMediaBrowsing as ae,useOpenMediaBrowse as ce,useMediaPlace as pe}from"./chunk-FHCKFOCD.js";import{useEaselSession as ue}from"./chunk-O7Q4DDJT.js";import{useEaselHost as he,useHostEscape as fe}from"./chunk-MQA7OFRA.js";import{LayersIcon as me,MediaIcon as ge}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as ye}from"./chunk-EB6NI2VK.js";import{heldStyle as ve,styleShortcut as ke}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as be}from"./chunk-6WY6ZXJG.js";import{rootRowName as Se,slotChildRowName as we,slotChildRenameProp as xe,sectionRenameProp as ze}from"./chunk-BHRC3ASL.js";import{ROOT_ZONE as Ce,blockNodeActions as Ne,TREE_MAX_DEPTH as Ie,childSlotsOf as Oe,slotFieldsOf as Be,newNodeId as Pe,slotChildrenIn as $e,nestsInTree as Me}from"./chunk-PLVEGYK6.js";import{useEasel as je,useEaselApi as Ae,CanvasPassThroughContext as Le,CanvasSharedContext as Te}from"./chunk-7L3NKHEC.js";import{TreeRow as Ee,Subtree as Re,LayersTree as Fe,TreeGroupLabel as De,TreeRowAction as He,TreeSeam as Ve}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as We}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Ue}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ge,useNodeOps as Je,clickPick as Ye}from"./chunk-BSHIQIZC.js";import{EaselTopBar as Ke,EaselIconButton as Qe,TopBarCluster as Xe,DeviceSwitch as Ze,InspectorIconButton as _e,PanelResizeHandle as qe,MAX_PANEL_W as en,MIN_PANEL_W_BY_SIDE as nn,panelWidthVars as tn}from"./chunk-ZG6PVMC3.js";import{DEFAULT_NOTICE_WORDS as on,DEFAULT_CHROME_WORDS as rn}from"./chunk-AJSDWWJW.js";import{holderOf as ln,nameOrSomeone as sn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as dn}from"./chunk-RE4LP46F.js";import{useWords as an}from"./chunk-MFIRYGHW.js";import{insertSeams as cn,CanvasDragLayer as pn,CanvasInsert as un}from"./chunk-2M4T27BI.js";import{DEFAULT_DRAG_WORDS as hn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as fn,useTreeDrag as mn,gapToMoveIndex as gn}from"./chunk-3S5N4HLJ.js";import{ROOT_ID as yn,ROOT_SLOT as vn,zoneKey as kn,parseZoneKey as bn,find as Sn,DataError as wn}from"./chunk-K7BTCBWD.js";import{useCanvasFrame as xn,LIST_SELECTOR as zn,BLOCK_SELECTOR as Cn,useCanvasTyping as Nn,useCanvasEvent as In,nodeIdAt as On,frameRectToHost as Bn,BLOCK_ATTRIBUTE as Pn,drawnBox as $n}from"./chunk-QIDRJH3S.js";import{queryMainCopy as Mn}from"./chunk-LF3FUSCQ.js";import{useRef as jn,useMemo as An,useState as Ln,useEffect as Tn,useCallback as En,useLayoutEffect as Rn,Fragment as Fn,useId as Dn}from"react";import{ColoredBadge as Hn,Button as Vn,Tabs as Wn,toast as Un,readMediaFileDrag as Gn,Tooltip as Jn,groupColors as Yn,Dialog as Kn,FormField as Qn,Input as Xn,MEDIA_FILE_DRAG_TYPE as Zn}from"efficient-shell/ui";import{UndoIcon as _n,RedoIcon as qn,RefreshIcon as et,AddIcon as nt,TrashIcon as tt,EyeOffIcon as ot,EyeIcon as rt,SharedIcon as it,DuplicateIcon as lt}from"efficient-shell/icons/efficient";import{jsx as st,jsxs as dt,Fragment as at}from"react/jsx-runtime";var ct="media-file";function pt({name:e,onMake:n,onCancel:t}){const o=an("screen",ye).shared,[r,i]=Ln(e),[l,s]=Ln(!1),d=Dn(),a=jn(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
2
|
return st(Kn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */dt(at,{children:[
|
|
3
3
|
/* @__PURE__ */st(Vn,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
-
/* @__PURE__ */st(Vn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */st("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */st(Qn,{label:o.name,htmlFor:d,children:/* @__PURE__ */st(
|
|
5
|
-
/* @__PURE__ */st(
|
|
6
|
-
/* @__PURE__ */st("span",{className:"es-band-tab-mark",children:/* @__PURE__ */st(it,{size:12})}),e.label]})}):/* @__PURE__ */st(Hn,{colorClass:
|
|
4
|
+
/* @__PURE__ */st(Vn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */st("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */st(Qn,{label:o.name,htmlFor:d,children:/* @__PURE__ */st(Xn,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var ut=/* @__PURE__ */new WeakSet;function ht(e,n,t){const o=Sn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function ft({canvas:e,tabs:n,onSelect:t}){const o=jn(null),[r,i]=Ln({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Rn(()=>{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=Bn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=Mn(t,`[${Pn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?$n(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=Bn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=o.below?c+4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */st("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */st("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:e.reach?
|
|
5
|
+
/* @__PURE__ */st(Jn,{content:e.reach,children:/* @__PURE__ */dt(Hn,{colorClass:Yn("success","solid"),size:"sm",children:[
|
|
6
|
+
/* @__PURE__ */st("span",{className:"es-band-tab-mark",children:/* @__PURE__ */st(it,{size:12})}),e.label]})}):/* @__PURE__ */st(Hn,{colorClass:Yn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function mt({expand:e}){/* @__PURE__ */
|
|
7
7
|
return st("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */dt(at,e?{children:[
|
|
8
8
|
/* @__PURE__ */st("path",{d:"M8 9l4-4 4 4"}),
|
|
9
9
|
/* @__PURE__ */st("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
10
|
/* @__PURE__ */st("path",{d:"M8 4l4 4 4-4"}),
|
|
11
11
|
/* @__PURE__ */st("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
-
/* @__PURE__ */st("path",{d:"M5 12h14"})]})})}var gt=`${
|
|
13
|
-
return new Set}});Tn(()=>{try{window.localStorage.setItem(Pr,JSON.stringify([...Mr]))}catch{}},[Mr]);const[Ar,Lr]=Ln(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem($r);if(!e)return{...m};const n=JSON.parse(e);return{left:g(Number(n.left)||m.left,"left"),right:g(Number(n.right)||m.right,"right")}}catch{return{...m}}});Tn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem($r,JSON.stringify(Ar))}catch{}},300);return()=>clearTimeout(e)},[Ar]);const Tr=En((e,n)=>Lr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Er=En(e=>Tr("left",e),[Tr]),Rr=En(e=>Tr("right",e),[Tr]),Fr=e=>Mr.has(e),Dr=e=>jr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Hr=jn(!1),Vr=jn(null);Tn(()=>{if(Hr.current&&!Uo){const e=Vr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??To.current?.querySelector(`button[aria-label="${CSS.escape(_t.add.title)}"]`))?.focus(),Vr.current=null}Hr.current=Uo},[Uo]),Tn(()=>{if(!Uo||!Fo)return;const e=e=>{"Escape"===e.key&&sl()};return Fo.addEventListener("keydown",e),()=>Fo.removeEventListener("keydown",e)},[Uo,Fo]),fe(Uo,()=>sl()),Tn(()=>{!go&&Uo&&(
|
|
14
|
-
return st("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":_t.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)},Wi=t(K(),ro),Ui=Wi.scope({target
|
|
15
|
-
return st(Be,{kind:"eye",label:r?_t.showNamed({name:o}):_t.hideNamed({name:o}),onClick:()=>gl(e,n,t),children:/* @__PURE__ */st(r?ot:rt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},ml=e=>Vs(zn,e),gl=(e,n,t)=>{fo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},yl=e=>On(Ft,e),vl=e=>Nn(Ft,e),kl=e=>ur.slotsOf?$i(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Pn(e,n.slot)})):[{slot:null,rung:null,kids:vl(e)}],bl=e=>ur.slotsOf?kl(e).flatMap(e=>e.kids):vl(e),Sl=e=>Boolean(ur.slotsOf)&&$i(e).some(e=>e.rung),wl=(e,n,t)=>null===t?void 0===n?yr(e):yr(e,n):yr(e,n,t),xl=(e,n,t)=>{const o=$n(Ft,e.type,n)&&(t||bl(e).length>0||Sl(e));return{collapsible:o,folded:o&&Fr(String(e.props.id))}},zl=(e,n,t)=>kl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>xl(e,r,t(e.type)).collapsible?[String(e.props.id),...zl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Cl=e=>bl(e).length>0||Sl(e)||Boolean(yr(e.type)),Il=e=>Boolean(yr(e)),Nl=(e,n,t,o)=>{if(_o(F),yr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),fo.select({index:n,zone:e}),l(t)}else fo.select({index:n,zone:e}),l(t)},Ol=(e,n,t,o,r)=>{const i=`${e}:${n}`;fo.insertComponent(i,t,o),yr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),fo.select({index:o,zone:i})}):fo.select({index:o,zone:i})},Bl=jn(/* @__PURE__ */new Set);Tn(()=>{ci.forEach(e=>{const n=yr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Bl.current.has(t))return;Bl.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(zi)).forEach((e,t)=>po.seedChild(o,t,n.childType,e))})},[ci,po,zi]);const Pl=jn(/* @__PURE__ */new Set);Tn(()=>{ci.forEach((e,t)=>{const o=e.props.id;if(Pl.current.has(o))return;const r=n(e,yl(e.type));Pl.current.add(o),r&&po.replaceComponent(zn,t,{...e,props:r})})},[ci,po]),Q(po,Ft);const $l=ci.findIndex(Qt),Ml=$l>=0?ci[$l]:null,jl=Zt?ci.findIndex(Kt):-1,Al=jl>=0?ci[jl]:null,Ll=Dt.groupTab,Tl=An(()=>Ll?e=>Ut(e.type):void 0,[Ll]),El=Boolean(Dt.groupBadge),Rl=Dt.sharedReach,Fl=e=>Rl?.(e)??void 0,Dl=An(()=>Rl?new Set(ci.filter(e=>Fl(e)).map(e=>String(e.props.id))):null,[ci,Rl]),Hl=An(()=>Dl?e=>Dl.has(e):void 0,[Dl]),Vl=Dt.first?Rl?.({type:Dt.first,props:{id:""}})??void 0:void 0,Wl=Dt.groupBadge?/* @__PURE__ */st("span",{className:"es-tree-group-badge",children:/* @__PURE__ */st(Hn,{tone:"info",size:"xs",children:Dt.groupBadge})}):void 0,Ul=ci.find(e=>e.type===Vt)??null,Jl=ci.find(e=>e.type===Wt)??null,Yl=$l>=0?$l:ci.length,Gl=[];ci.forEach(e=>{Qt(e)||(Cl(e)&&Gl.push(String(e.props.id)),Gl.push(...zl(e,1,Il)))}),Ml&&(Gl.push(String(Ml.props.id)),Gl.push(...zl(Ml,1,Il)));const Kl=Gl.length>0&&Gl.every(e=>Mr.has(e)),Ql=e=>{const n=kr.blockRowName(e,xi);return kr.rowName?kr.rowName(e,"block",n):n},Zl=(e,n,t,o)=>{const r=Bi(e)[t];if(!r)return;const i={...dn(e),index:t},l={...dn(n),index:Math.min(Math.max(o,0),Bi(n).length)},s=on(i,l);if(e!==n||s!==t)try{gi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof cn))throw e}},Xl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of vl(e))n.add(r),t(o)};for(const t of yl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},_l=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Ni.get(n);if(!e)return null;if(e.zone===zn)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},ql=e=>{const n=e.slice(0,e.indexOf(":")),t=ci.find(e=>Ut(e.type)&&String(e.props.id)===n);return t&&Jt(n)===e?t:null},es=(e,n)=>{const t=ql(e);return!t||(!Dt.groupAccepts||Dt.groupAccepts(t.type,n,Bi(e).length))},ns=(e,n,t)=>{if(e.rung){const t=Pi(e.rung.nodeId),o=t?$i(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===vt&&n.index>=0&&n.index<=o}if(n.slot===vt)return!1;if(e.add)return is(e.add,n);const o=sn(n);if(Ut(e.type))return!1;const r=ql(o),i=ql(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!es(o,e.type))&&(n.index>=0&&n.index<=Bi(o).length));if(e.zone===zn||o===zn){if(e.zone!==o)return!1;const{floor:t,cap:r}=pi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Bi(o).length)return!1;if(e.zone===o)return!0;const l=Ml&&!Dt.lastIsOpen?String(Ml.props.id):null;return(!l||_l(e.zone)!==l&&_l(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Bi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Ni.get(i),s=l?Bi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Xl(r).has(n))return!1;const d=yr(s.type,mr(At?.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?.(Bi(n),r))})(e.zone,o,e.index,t)},ts=(e,n)=>{const t=sn(e.from),o=e.node;return t===sn(n)?es(t,o.type):ns({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},os=e=>{const n=e.slice(0,e.indexOf(":")),t=Ni.get(n),o=t?Bi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=yr(o.type,mr(At?.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=B(r.choices??(r.spec?[{type:r.spec.childType,label:xi(r.spec.childType)}]:[])),l=Mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:dl(o,t.zone===zn)}},rs=(e,n)=>{if("section"!==e.kind)return e;const t=sn(n);return t===zn||ql(t)?e:os(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},is=(e,n)=>{const t=rs(e,n),o=sn(n);if("shared"===t.kind){if(o!==zn||!Dt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=pi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(ql(o)){const e="section"===t.kind?t.type:t.template.node.type;return es(o,e)&&n.index>=0&&n.index<=Bi(o).length}if(o!==zn)return!1;const{floor:e,cap:r}=pi();return n.index>=e&&n.index<=r}if(o===zn)return!1;const r=os(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Bi(o))},ls=(e,n)=>{const t=rs(e,n);if("block"!==t.kind&&ql(sn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&es(n,o)){if("section"===e.kind)fo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;fo.insertNode(n,t,fi(e.template.node))}_o(F),fo.select({index:t,zone:n})}})(t,sn(n),n.index);if("section"===t.kind)return void rl(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=nl(t),r=fo.insertNode(zn,o,n);ol(o,r,e)})(t.template.name,fi(t.template.node),n.index);if("shared"===t.kind){const e=Dt.shared?.nodeOf(t.section);if(!e)return;const o=nl(n.index);return void(gi.restore(e,{parentId:rn,slot:ln,index:o})&&ol(o,e.props.id,t.section.title))}const o=sn(n),r=os(o);r&&(r.target.spec?Ol(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{fo.insertComponent(e,n,t),_o(F),fo.select({index:t,zone:e})})(o,t.type,n.index))},ss=(e,n)=>{e.media?function(e){const n=Es();if(!n||!As)return;Fs(n).then(n=>{n&&function(e,n){if(!As)return;const t=As.create(e,{nodeDefaults:zi,newNodeId:Bn,sectionLabel:Ci,blockIsOffered:vr}),o=sn(n);if(o===zn){const e=nl(n.index),o=fo.insertNode(zn,e,t);return void ol(e,o,Ci(t.type))}fo.insertNode(o,n.index,t),_o(F),fo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Ei(e.rung.nodeId,e.index,n.index):e.add?ls(e.add,n):e.zone===zn?tl(e.index,n.index):Zl(e.zone,sn(n),e.index,n.index)},[ds]=Ln(()=>nn()),as=tn({keyOf:e=>e.id,readOnly:Boolean(Nt),session:ds,canDrop:ns,onDrop:ss,onStep:(e,n)=>{e.rung?Ei(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===zn?((e,n)=>{const t=Ci(ci[e]?.type??""),o=tl(e,n<0?e-1:e+2);if(!o.moved)return void Ur(n<0?_t.sectionFirst({name:t}):_t.sectionLast({name:t}));const{floor:r,cap:i}=pi();Ur(_t.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Zl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),cs=En(e=>{const{floor:n,cap:t}=pi(),o=[];for(const r of e.nodes){const e=sn(r.place),i=Bi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Kt(i)||Qt(i)||hr(i.type,i))continue;if(Ut(i.type))continue;const l=Boolean(ql(e)),s=e===zn||l;e===zn&&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?Ci(i.type):Di(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=sn(e.list);if(n===zn&&0===e.children.length)return[{...e,addLabel:_t.addSection,addAlways:!0}];const t=os(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(ql(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=sn(e.list),t=n===zn||ql(n)?null:os(n);return t?.choices.length?Xe(e,t.target.spec?.addLabel??_t.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[At.data]),ps=null==Et?.props.id?null:String(Et.props.id),us=En(e=>{const n=Ft,t=e=>!e.item.rung&&null!==an(At.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(ps);return i||(r(Le(At.data,n,o.item.id,ps,Tl))??o)},[At.data,Ft,ps,Tl]),[hs,fs]=Ln(null),ms=Boolean(Ll||Rl);mn(Eo,"mouseover",e=>{if(!ms)return;const n=gn(e.target),t=n?ht(At.data,Ft,n):null;t!==hs&&fs(t)}),mn(Eo,"mouseout",e=>{ms&&!e.relatedTarget&&fs(null)});const gs=e=>Kt(e)||Qt(e)||Ut(e.type),ys=e=>{const n=Ut(e.type)?xi(e.type):Kt(e)?_t.header:Qt(e)?_t.footer:null;return null===n?Ii(e):kr.rowName?kr.rowName(e,"section",n):n},vs=[];if(ms){const e=ps?ht(At.data,Ft,ps):null;for(const n of/* @__PURE__ */new Set([e,hs])){const e=n?ci.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Kt(e)||e.type===Vt,o=Fl(e);if(o){vs.push({id:String(e.props.id),label:ys(e),below:t,reach:o});continue}if(!Ll||!gs(e))continue;const r=Ll(e);r&&vs.push({id:String(e.props.id),label:r,below:t})}}const ks=ue(),bs=jn(null);Tn(()=>{const e=Dt.changeNotice;if(!e)return;const n=JSON.stringify(ci.filter(gs)),t=bs.current;if(bs.current={doc:Dn,bands:n,index:Tt.index},!t||t.doc!==Dn||t.bands===n)return;Tt.hasPast&&Tt.index>=t.index&&!ut.has(ks)&&(ut.add(ks),Ur(e,"success",{action:{label:_t.bar.undo,onClick:()=>Tt.back()},duration:8e3}))},[ci]);const Ss=e=>{_o(F),fo.select(e.zone===zn?{index:e.index}:{index:e.index,zone:e.zone})},ws=Z(),xs=()=>({data:At.data,device:xo,ops:fo,inspector:ar}),zs=ws?.model,Cs=An(()=>zs?e=>zs(e,cs(e),xs()):cs,[zs,cs,xo]),Is=ws?.measure,Ns=Is?(e,n)=>Is(e,n,xs()):void 0,Os=ws?.canDrop,Bs=Os?(e,n)=>Os(e,n,ns,xs()):ns,Ps=ws?.drop,$s=Ps?(e,n)=>Ps(e,n,ss,xs()):ss,Ms=ws?.pick,js=Ms?e=>Ms(e,Ss,xs()):Ss,As=ws?.media??null,Ls=jn(null),Ts=An(()=>As?{id:ct,zone:"",index:-1,type:As.adds.type,add:{kind:As.adds.kind,type:As.adds.type},media:!0}:null,[As]);Tn(()=>{if(!Ts||Nt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(Xn))(e)&&(Ls.current=null,ds.start({key:ct,item:Ts}))},n=e=>{ds.get()?.item.media&&(Ls.current=Jn(e.dataTransfer))},t=()=>{ds.get()?.item.media&&ds.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[Ts,Nt,ds]);const Es=()=>{const e=Ls.current;return Ls.current=null,e},Rs=pe(),Fs=async e=>{if(!Rs)return e;const n=await Rs(e);return n?{...e,id:n.id,url:n.url}:null};const Ds=(e,n)=>{if(!As)return;const t=an(ho.getState().appState.data,ui,n);if(!t)return;const o=t.node;fo.replaceComponent(sn(t.place),t.place.index,{...o,props:{...As.replace(o,e),id:o.props.id}})},Hs=e=>{const n=sn(e),t=Mi(n);t&&Li(t.node,t.slot,!1),ll(n,e.index)},Vs=(e,n)=>/* @__PURE__ */st(Pe,{...Nt?{}:as.seam({place:{...dn(e),index:n}})},`seam:${e}:${n}`),Ws={rowClick:al,isCollapsed:Fr,toggleCollapse:Dr},Us=e=>{const n=String(e.props.id),t=ci.findIndex(e=>String(e.props.id)===n),o=Jt(n),r=Bi(o),i=Fr(n),l=xi(e.type),s=kr.rowName?kr.rowName(e,"section",l):l,d=e=>Vs(o,e);/* @__PURE__ */
|
|
12
|
+
/* @__PURE__ */st("path",{d:"M5 12h14"})]})})}var gt=`${zn}, ${Cn}`;function yt(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 vt="__rungs";var kt="screen:band",bt={duplicate:!0,delete:!0},St=()=>null;function wt(){const zn=he(),Bn=zn.panels?.Toolbar,Pn=(zn.panels?.useRight??St)(),{target:$n,docId:Dn,capabilities:Jn,currentSlug:Yn,siteId:Kn,onPublish:Qn,saveState:Xn,saveConflict:it,retrySave:wt,toggleAutoSave:xt,flushSave:zt,access:Ct,saveUnreachable:Nt=!1,readOnly:It,readOnlyReason:Ot=null}=ie(),Bt=P(),Pt=$(),{mediaEditing:$t,hasEditGuard:Mt,hasPinnedChrome:jt}=Jn,{appState:At,dispatch:Lt,history:Tt,selectedItem:Et,getSelectorForId:Rt,config:Ft}=je(e=>e),Dt=M(),{first:Ht,firstGroup:Vt,lastGroup:Wt,isSectionGroup:Ut,sectionGroupZone:Gt,panelOf:Jt}=Dt,Yt=Jt(Ht),Kt=e=>_(Dt,e),Qt=e=>q(Dt,e),Xt="node"===Dt.firstRow,Zt=Dt.band??null,_t=an("screen",ye),qt=an("tree",We),eo=an("drag",hn),no=an("notice",on),to=an("lock",dn),oo=an("menu",Ue),ro=an("styleClipboard",be),io=an("chrome",rn),lo=j()??`/${Yn}`,so=A(),ao=L(),co=v({readOnly:It}),po=v({readOnly:It,foldIntoHistory:!0}),uo=jn(null),ho=Ae(),fo=An(()=>({...co,select:e=>{uo.current=e,co.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=ho.config;uo.current=Ge(e,t,n)}co.commitDocument(e,n)}}),[co,ho]),mo=At.ui,go=mo.leftSideBarVisible,yo=mo.rightSideBarVisible,{options:vo,widths:ko,initial:bo,fluid:So,fit:wo}=T(),[xo,zo]=Ln(bo),Co=se(),No=$t&&null!==Co;de(),ae();const Io=ce();E(Et?.props.id);const{read:Oo,write:Bo,forSelection:Po}=R(),[$o,Mo]=Ln(Oo);Tn(()=>{Bo($o)},[$o]);const[jo,Ao]=Ln(0),Lo=jn(null),To=jn(null),Eo=xn(To,{readySelector:gt}),Ro=Nn(Eo),Fo=a(To);c(To,Eo);const Do=S(),Ho=ln(Ct),Vo={state:Xn,offline:Do||Xn.failed&&Nt,readOnlyReason:Ot,editing:Ho?no.editing({name:sn(Ho.name,to),noun:_t.noun}):null,conflict:null!=it,notSaving:_t.bar.notSaving},Wo=()=>{It||(Xn.failed?wt():zt())};p(To,Eo,Wo);const[Uo,Go]=Ln(!1),Jo=jn(!1),[Yo,Ko]=Ln(null),[Qo,Xo]=Ln([]),[Zo,_o]=Ln(F),qo="puck"===Zo.kind,er=o(Zo,Et?.props.id),[nr,tr]=Ln(null);Tn(()=>{nr&&(r(),tr(null))},[nr]);const or=jn(Rt);or.current=Rt;const rr=En((e,{scroll:n})=>{Mo(n=>Po(e,n)),n&&tr(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=or.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&jr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),ir=jn(null);Tn(()=>{const e=ir.current;ir.current=null;const n=null==Et?.props.id?null:String(Et.props.id);_o(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Jt(Et?.type)??F);const t=Et?.props.id,o=uo.current;if(uo.current=null,!t)return;const r=Rt(t);rr(String(t),{scroll:!i(o,r??null,Ce)})},[Et?.props.id,rr]);const lr=En(e=>{_o(n=>D(n,e)?n:e),Lt({type:"setUi",ui:{rightSideBarVisible:!0}})},[Lt]),sr=jn(()=>{});sr.current=(e,n)=>{const t=e?Bi(e.zone??Ce)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Et?.props.id?null:String(Et.props.id);_o(e=>D(e,n)?e:n),o!==r&&(ir.current={id:o,mode:n},fo.select(e))};const dr=En((e,n)=>sr.current(e,n),[]),ar={kind:Zo.kind,mode:Zo,open:lr,show:e=>_o(e),reveal:()=>{yo||Lt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:dr},cr=H(ar,{data:At.data,selected:Et??null,zoneOf:e=>Rt(e)?.zone,readOnly:Boolean(It),select:e=>{_o(F),fo.select({index:e})},replace:(e,n)=>fo.replaceComponent(Ce,e,n),scrollTo:e=>l(e)},{device:xo,refreshes:jo},{setView:Mo,reveal:()=>{go||Lt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),pr=cr.resolveLeftView?cr.resolveLeftView($o):"sections",ur=V(),{isLockedBlock:hr,duplicateBlocked:fr,nestDepth:mr,newSectionNode:gr,canAddTo:yr,blockIsOffered:vr}=ur,kr=W(),{labelAtLevel:br,Icon:Sr,useProducts:wr}=kr,xr=kr.rowName?(e,n,t)=>kr.rowName(e,n,t):void 0,zr=En(e=>{Lt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),rr(e,{scroll:!0})},[Lt,rr]),{selectNode:Cr,openPartId:Nr}=y({mode:Zo,setMode:_o,onOpenPart:zr}),[Ir,Or]=Ln(null);fe(null!==Ir,()=>Or(null));const Br=f(U()),Pr=Br.collapsed,$r=Br.panelWidths,[Mr,jr]=Ln(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Pr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
+
return new Set}});Tn(()=>{try{window.localStorage.setItem(Pr,JSON.stringify([...Mr]))}catch{}},[Mr]);const[Ar,Lr]=Ln(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem($r);if(!e)return{...m};const n=JSON.parse(e);return{left:g(Number(n.left)||m.left,"left"),right:g(Number(n.right)||m.right,"right")}}catch{return{...m}}});Tn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem($r,JSON.stringify(Ar))}catch{}},300);return()=>clearTimeout(e)},[Ar]);const Tr=En((e,n)=>Lr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Er=En(e=>Tr("left",e),[Tr]),Rr=En(e=>Tr("right",e),[Tr]),Fr=e=>Mr.has(e),Dr=e=>jr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Hr=jn(!1),Vr=jn(null);Tn(()=>{if(Hr.current&&!Uo){const e=Vr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??To.current?.querySelector(`button[aria-label="${CSS.escape(_t.add.title)}"]`))?.focus(),Vr.current=null}Hr.current=Uo},[Uo]),Tn(()=>{if(!Uo||!Fo)return;const e=e=>{"Escape"===e.key&&sl()};return Fo.addEventListener("keydown",e),()=>Fo.removeEventListener("keydown",e)},[Uo,Fo]),fe(Uo,()=>sl()),Tn(()=>{!go&&Uo&&(Go(!1),Ko(null),Jo.current=!1)},[go]);const Wr=G(),Ur=(e,n="success",t)=>{if(Wr)return void(t?Wr(e,"error"===n?"error":"info",t):Wr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Un.error(e,{...o,duration:t?.duration??3200}):Un.success(e,{...o,duration:t?.duration??1900})},Gr=jn(null),[Jr,Yr]=Ln(0),[Kr,Qr]=Ln(0),Xr=J(),Zr=jn(null),_r=e=>Math.max(0,e.clientHeight-(Zr.current?.offsetHeight??0));Tn(()=>{const e=Gr.current;if(!e)return;const n=()=>{Yr(e.clientWidth),Qr(_r(e))};n();const t=new ResizeObserver(n);return t.observe(e),Zr.current&&t.observe(Zr.current),()=>t.disconnect()},[]),Rn(()=>{Gr.current&&(Yr(Gr.current.clientWidth),Qr(_r(Gr.current)))},[Ar,go,yo]);const qr=xo===So?Jr>0?Jr:ko[So]:ko[xo],ei=Jr>0?Math.min(Jr/qr,"shrink"===wo?1:2):1,ni=qr*ei,ti=Jr>0&&ni>Jr+1,oi={width:ni,height:Kr||"100%",flex:"none",position:"relative"},ri={width:qr,height:Kr?Kr/ei:"100%",maxHeight:"none",transform:1!==ei?`scale(${ei})`:void 0,transformOrigin:"top left"},ii=()=>Lt({type:"setUi",ui:{leftSideBarVisible:!go}}),li=()=>Lt({type:"setUi",ui:{rightSideBarVisible:!yo}}),si=e=>{Uo&&(Go(!1),Ko(null),Jo.current=!1,go&&$o===e)||(Mo(e),go||Lt({type:"setUi",ui:{leftSideBarVisible:!0}}))},di=()=>{_o(F),fo.select(null),d()},ai=()=>{_o(Yt??F),yo||Lt({type:"setUi",ui:{rightSideBarVisible:!0}})},ci=At.data.content??[],pi=()=>{const e=ci.findIndex(Kt),n=ci.findIndex(Qt);return{floor:e>=0?e+1:0,cap:n>=0?n:ci.length}},ui=Ft,hi=ur.stripCopy,fi=n=>e(n,hi),mi=te(),gi=Je({data:At.data,config:ui,readOnly:Boolean(It),clipboard:mi,strip:hi?e=>hi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==yn||e.slot!==vn)return{min:0,max:n-1};const{floor:t,cap:o}=pi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&_o(F);const t=void 0===n||"node"===n?.kind?n:null;fo.commitDocument(e,t)}}),yi=ue(),[vi,ki]=Ln(null),bi=e=>{const n=ci.find(n=>String(n.props.id)===e),t=Dt.shared;n&&t&&gi.swap(e,t.detach(n))},Si=e=>{const n=Sn(At.data,Ft,e);if(!n)return!1;const t=kn(n.place),o=n.node,r=t===Ce?Ni(o):Di(o),i=t===Ce?Dt.shared?.usedOn(o):null;return!!gi.remove(e)&&(Ur(i?_t.shared.removed({count:Math.max(0,i.length-1)}):_t.deleted({name:r}),"success",{duration:8e3,action:{label:_t.bar.undo,onClick:()=>{gi.restore(n.node,n.place)}}}),!0)},wi={...gi,remove:Si},xi=e=>br(e,"block",Ft.components[e]?.label??e),zi=En(e=>Ft.components[e]?.defaultProps??{},[Ft]),Ci=e=>br(e,"section",xi(e)),Ni=e=>Se({type:e.type,props:e.props??{}},Ci(e.type),xr),{nodeAddresses:Ii,zoneItems:Oi}=An(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=Ie)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Oe(Ft,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(ci,Ce,0),{nodeAddresses:e,zoneItems:n}},[ci,Ft]),Bi=En(e=>Oi.get(e)??[],[Oi]),Pi=e=>{const n=Ii.get(e);return n?Bi(n.zone)[n.index]:void 0},$i=e=>ee(ur,Ft,e),Mi=e=>{if(!ur.slotsOf||e===Ce)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Pi(e.slice(0,n));if(!t)return null;const o=$i(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}},ji=(()=>{if(!Y(Zo))return null;const e=`${Zo.nodeId}:${Zo.slot}`;return Mi(e)?.slot.panel===Zo.kind?e:null})(),Ai=jn(null);Tn(()=>{const e=Ai.current;if(Ai.current=null,!ji||!Y(Zo))return;const n=Zo.nodeId;rr(n,{scroll:e!==ji}),jr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Zo]);const Li=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Ii.get(e);n&&(n.zone===Ce?el(n.index):Il(n.zone,n.index,e,Pi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&ji!==i&&(Ai.current=i),dr(null,r),yo||Lt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ti=(e,n,t)=>{const o=`${e}:${n}`;if(jr(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;ji!==o&&(Ai.current=o);dr(null,{kind:t,nodeId:e,slot:n})},Ei=(e,n,t)=>{if(It||!ur.moveSlot)return;const o=Pi(e),r=o?$i(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:vt,index:n},s=gn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=ur.moveSlot(e,n,s);"string"==typeof d&&Ti(e,d,i.panel)},Ri=wr(),Fi=An(()=>{const e=/* @__PURE__ */new Map;for(const n of Ri??[])e.set(n.slug,n.name);return e},[Ri]),Di=e=>we(e,xi,kr.plainText,e=>Fi.get(e),kr.rowName),Hi=(e,n)=>{const t=Ft.components[e.type]?.fields,o=n===Ce||ql(n)?"section":"block",r=n===Ce&&(Kt(e)||Qt(e)||Ut(e.type)),i="block"===o?xe(t):r?null:ze(t);return kr.renamePropOf?kr.renamePropOf(e,o,i):i},Vi=(e,n,t,o)=>{if(!(!It&&Ir?.zone===e&&Ir.index===n))return;const r=(t,o)=>{Or(null),o&&((e,n,t)=>{const o=Bi(e)[n];if(!o)return;const r=Hi(o,e);r&&fo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
+
return st("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":_t.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)},Wi=t(K(),ro),Ui=Wi.scope({target:$n,siteId:Kn,docId:Dn}),Gi=Ft,Ji=(e,n)=>n===Ce?Ci(e):xi(e),Yi=(e,n,t)=>{const o=Wi.plan(Ui,t,Ji(t.type,e),Gi);o&&(o.changed&&fo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Ur(o.message))},Ki=oe({nodesIn:Bi,nodeAt:(e,n)=>Bi(e)[n]??null,labelOf:(e,n)=>n===Ce?Ci(e):xi(e),renamePropOf:Hi,beginRename:(e,n)=>Or({zone:e,index:n}),history:{hasPast:Tt.hasPast,hasFuture:Tt.hasFuture,back:()=>Tt.back(),forward:()=>Tt.forward()},openPageSettings:()=>{fo.select(null),_o(F)},pageSettingsLabel:_t.pageSettings,words:{menu:oo,styleClipboard:ro,screen:_t.menu},readOnly:Boolean(It),collapseAll:()=>jr(new Set(Bi(Ce).map(e=>String(e.props.id)))),onPasteRefused:e=>Ur(e?_t.pasteRefused({name:e.label}):_t.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ts(e,n),menuRows:(e,n,t)=>{const o=cr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Dt.shared;if(!t||n!==Ce)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:_t.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return It||hr(e.type,e)?n:{...n,change:[{label:_t.shared.detach,onClick:()=>bi(e.props.id)}],remove:[{label:_t.shared.removeFromPage,danger:!0,onClick:()=>{Si(e.props.id)}}]}}return It||Kt(e)||Qt(e)||Ut(e.type)?null:z(yi)?{change:[{label:_t.shared.makeShared,onClick:()=>ki({id:e.props.id,name:Ni(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>hr(e.type,e),duplicateBlocked:e=>fr(At.data,e),permits:e=>{const n=Ne(Ft,e.type);return Dt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:wi,isPinned:(e,n)=>n===Ce&&(Kt(e)||Qt(e)),sectionBand:pi,locate:e=>Ii.get(e)??null,rowNameOf:(e,n)=>n===Ce?Ni(e):Di(e),selectAt:(e,n,t,o)=>{e===Ce?el(n):Il(e,n,t,o??"")},slotRung:e=>{const n=Mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>Li(n.node,n.slot,!1)}:null},style:{held:()=>ve(Ui),canCopy:e=>Wi.rows(Gi,e).some(e=>!1!==e.counted),copy:(e,n)=>Wi.copy(Ui,e,Ji(e.type,n),Gi),paste:(e,n,t)=>Yi(e,n,t)},keys:Pt?{target:Fo,selected:()=>{const e=At.ui.itemSelector;return e?{zone:e.zone??Ce,index:e.index}:null},held:()=>mi.get(),readOnly:Boolean(It),onDone:({done:e,name:n})=>{"copied"===e&&Ur(_t.copied({name:n}))}}:void 0},Eo),Qi=jn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Tn(()=>{Qi.current={copy:(e,n)=>Wi.copy(Ui,e,Ji(e.type,n),Gi),paste:Yi,at:()=>{const e=At.ui.itemSelector;if(!e)return null;const n=e.zone??Ce,t=Bi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(It)}});const Xi=En(e=>{const n=ke(e);if(!n)return;const t=Qi.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))},[]);Tn(()=>{if(!Fo)return;const e=e=>Xi(e);return Fo.addEventListener("keydown",e),()=>Fo.removeEventListener("keydown",e)},[Xi,Fo]),In(Eo,"keydown",Xi);const Zi=ci.map(e=>e.props.id).join("|");Tn(()=>{const e=Eo?.document??null,n=Eo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Xo(e=>e.length?[]:e);const n=ci.findIndex(Qt),t=n>=0?n:ci.length,o=n=>{const t=ci[n]?.props?.id;return null==t?null:Mn(e,`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Cn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=ci.length>0&&!Kt(ci[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=yt(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})}Xo(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()}},[Eo,Zi,xo,ei,go,yo,Et?.props.id]);const _i=Eo?.document??null,qi=Eo?.window??null;Tn(()=>{const e=Lo.current;if(!e||!_i||!qi)return;const n=[],t=()=>{const n=Mn(_i,`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&qi.scrollTo({left:qi.scrollX,top:qi.scrollY+t,behavior:"instant"}),!0};return Lo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[_i,qi]);const el=e=>{_o(F),fo.select({index:e}),cr.sectionPressed?.(ci[e]);const n=ci[e]?.props?.id;n&&l(n)},nl=e=>{const{floor:n,cap:t}=pi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Et&&Zo.kind!==Yt?.kind?ci.findIndex(e=>e.props.id===Et.props.id):-1;return o(r>=0?r+1:t)},tl=(e,n)=>{const{floor:t,cap:o}=pi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(fo.reorderComponent(Ce,e,i),fo.select({index:i}),{moved:!0,dest:i})},ol=(e,n,t,o)=>{_o(F),fo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Ur(_t.sectionAdded({name:t}))},rl=(e,n)=>{const t=nl(n),o=gr(e,{nodeDefaults:zi,newNodeId:Pe,sectionLabel:Ci,blockIsOffered:vr}),r=o?fo.insertNode(Ce,t,o):fo.insertSection(e,t);return ol(t,r,Ci(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 Oe(Ft,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=yr(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},il=e=>ll(Ce,e),ll=(e,n)=>{Vr.current=document.activeElement??null,Ko(null===n?null:{zone:e,index:n}),Go(!0),go||(Jo.current=!0,Lt({type:"setUi",ui:{leftSideBarVisible:!0}}))},sl=()=>{Go(!1),Ko(null),Jo.current&&Lt({type:"setUi",ui:{leftSideBarVisible:!1}}),Jo.current=!1},dl=(e,n)=>kr.rowName?n?Kt(e)?kr.rowName(e,"section",_t.header):Qt(e)?kr.rowName(e,"section",_t.footer):Ut(e.type)?kr.rowName(e,"section",xi(e.type)):Ni(e):Di(e):n?Ci(e.type):xi(e.type),al=e=>n=>{e()},cl=(e,n,t)=>{if(It)return null;const o=Bi(e)[n];return o&&!Ne(Ft,o.type).delete||o&&hr(o.type,o)?null:/* @__PURE__ */st(He,{kind:"delete",label:e===Ce&&o&&Dt.shared?.usedOn(o)?_t.shared.removeFromPage:_t.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Bi(e)[n]?.props?.id;null!=t&&Si(String(t))})(e,n),children:/* @__PURE__ */st(tt,{size:15})})},pl=e=>kr.rowPreview?.(e)||void 0,ul=e=>kr.rowMarks?.(e)??void 0,hl=(e,n,t)=>kr.rowActions?.(e,n,t)??null,fl=(e,n,t,o)=>{if(It)return null;if(hr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
+
return st(He,{kind:"eye",label:r?_t.showNamed({name:o}):_t.hideNamed({name:o}),onClick:()=>gl(e,n,t),children:/* @__PURE__ */st(r?ot:rt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},ml=e=>Vs(Ce,e),gl=(e,n,t)=>{fo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},yl=e=>Be(Ft,e),vl=e=>Oe(Ft,e),kl=e=>ur.slotsOf?$i(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:$e(e,n.slot)})):[{slot:null,rung:null,kids:vl(e)}],bl=e=>ur.slotsOf?kl(e).flatMap(e=>e.kids):vl(e),Sl=e=>Boolean(ur.slotsOf)&&$i(e).some(e=>e.rung),wl=(e,n,t)=>null===t?void 0===n?yr(e):yr(e,n):yr(e,n,t),xl=(e,n,t)=>{const o=Me(Ft,e.type,n)&&(t||bl(e).length>0||Sl(e));return{collapsible:o,folded:o&&Fr(String(e.props.id))}},zl=(e,n,t)=>kl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>xl(e,r,t(e.type)).collapsible?[String(e.props.id),...zl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Cl=e=>bl(e).length>0||Sl(e)||Boolean(yr(e.type)),Nl=e=>Boolean(yr(e)),Il=(e,n,t,o)=>{if(_o(F),yr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),fo.select({index:n,zone:e}),l(t)}else fo.select({index:n,zone:e}),l(t)},Ol=(e,n,t,o,r)=>{const i=`${e}:${n}`;fo.insertComponent(i,t,o),yr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),fo.select({index:o,zone:i})}):fo.select({index:o,zone:i})},Bl=jn(/* @__PURE__ */new Set);Tn(()=>{ci.forEach(e=>{const n=yr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Bl.current.has(t))return;Bl.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(zi)).forEach((e,t)=>po.seedChild(o,t,n.childType,e))})},[ci,po,zi]);const Pl=jn(/* @__PURE__ */new Set);Tn(()=>{ci.forEach((e,t)=>{const o=e.props.id;if(Pl.current.has(o))return;const r=n(e,yl(e.type));Pl.current.add(o),r&&po.replaceComponent(Ce,t,{...e,props:r})})},[ci,po]),Q(po,Ft);const $l=ci.findIndex(Qt),Ml=$l>=0?ci[$l]:null,jl=Xt?ci.findIndex(Kt):-1,Al=jl>=0?ci[jl]:null,Ll=Dt.groupTab,Tl=An(()=>Ll?e=>Ut(e.type):void 0,[Ll]),El=Boolean(Dt.groupBadge),Rl=Dt.sharedReach,Fl=e=>Rl?.(e)??void 0,Dl=An(()=>Rl?new Set(ci.filter(e=>Fl(e)).map(e=>String(e.props.id))):null,[ci,Rl]),Hl=An(()=>Dl?e=>Dl.has(e):void 0,[Dl]),Vl=Dt.first?Rl?.({type:Dt.first,props:{id:""}})??void 0:void 0,Wl=Dt.groupBadge?/* @__PURE__ */st("span",{className:"es-tree-group-badge",children:/* @__PURE__ */st(Hn,{tone:"info",size:"xs",children:Dt.groupBadge})}):void 0,Ul=ci.find(e=>e.type===Vt)??null,Gl=ci.find(e=>e.type===Wt)??null,Jl=$l>=0?$l:ci.length,Yl=[];ci.forEach(e=>{Qt(e)||(Cl(e)&&Yl.push(String(e.props.id)),Yl.push(...zl(e,1,Nl)))}),Ml&&(Yl.push(String(Ml.props.id)),Yl.push(...zl(Ml,1,Nl)));const Kl=Yl.length>0&&Yl.every(e=>Mr.has(e)),Ql=e=>{const n=kr.blockRowName(e,xi);return kr.rowName?kr.rowName(e,"block",n):n},Xl=(e,n,t,o)=>{const r=Bi(e)[t];if(!r)return;const i={...bn(e),index:t},l={...bn(n),index:Math.min(Math.max(o,0),Bi(n).length)},s=gn(i,l);if(e!==n||s!==t)try{gi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof wn))throw e}},Zl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of vl(e))n.add(r),t(o)};for(const t of yl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},_l=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Ii.get(n);if(!e)return null;if(e.zone===Ce)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},ql=e=>{const n=e.slice(0,e.indexOf(":")),t=ci.find(e=>Ut(e.type)&&String(e.props.id)===n);return t&&Gt(n)===e?t:null},es=(e,n)=>{const t=ql(e);return!t||(!Dt.groupAccepts||Dt.groupAccepts(t.type,n,Bi(e).length))},ns=(e,n,t)=>{if(e.rung){const t=Pi(e.rung.nodeId),o=t?$i(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===vt&&n.index>=0&&n.index<=o}if(n.slot===vt)return!1;if(e.add)return is(e.add,n);const o=kn(n);if(Ut(e.type))return!1;const r=ql(o),i=ql(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!es(o,e.type))&&(n.index>=0&&n.index<=Bi(o).length));if(e.zone===Ce||o===Ce){if(e.zone!==o)return!1;const{floor:t,cap:r}=pi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Bi(o).length)return!1;if(e.zone===o)return!0;const l=Ml&&!Dt.lastIsOpen?String(Ml.props.id):null;return(!l||_l(e.zone)!==l&&_l(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Bi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Ii.get(i),s=l?Bi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Zl(r).has(n))return!1;const d=yr(s.type,mr(At?.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?.(Bi(n),r))})(e.zone,o,e.index,t)},ts=(e,n)=>{const t=kn(e.from),o=e.node;return t===kn(n)?es(t,o.type):ns({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},os=e=>{const n=e.slice(0,e.indexOf(":")),t=Ii.get(n),o=t?Bi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=yr(o.type,mr(At?.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=B(r.choices??(r.spec?[{type:r.spec.childType,label:xi(r.spec.childType)}]:[])),l=Mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:dl(o,t.zone===Ce)}},rs=(e,n)=>{if("section"!==e.kind)return e;const t=kn(n);return t===Ce||ql(t)?e:os(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},is=(e,n)=>{const t=rs(e,n),o=kn(n);if("shared"===t.kind){if(o!==Ce||!Dt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=pi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(ql(o)){const e="section"===t.kind?t.type:t.template.node.type;return es(o,e)&&n.index>=0&&n.index<=Bi(o).length}if(o!==Ce)return!1;const{floor:e,cap:r}=pi();return n.index>=e&&n.index<=r}if(o===Ce)return!1;const r=os(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Bi(o))},ls=(e,n)=>{const t=rs(e,n);if("block"!==t.kind&&ql(kn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&es(n,o)){if("section"===e.kind)fo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;fo.insertNode(n,t,fi(e.template.node))}_o(F),fo.select({index:t,zone:n})}})(t,kn(n),n.index);if("section"===t.kind)return void rl(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=nl(t),r=fo.insertNode(Ce,o,n);ol(o,r,e)})(t.template.name,fi(t.template.node),n.index);if("shared"===t.kind){const e=Dt.shared?.nodeOf(t.section);if(!e)return;const o=nl(n.index);return void(gi.restore(e,{parentId:yn,slot:vn,index:o})&&ol(o,e.props.id,t.section.title))}const o=kn(n),r=os(o);r&&(r.target.spec?Ol(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{fo.insertComponent(e,n,t),_o(F),fo.select({index:t,zone:e})})(o,t.type,n.index))},ss=(e,n)=>{e.media?function(e){const n=Es();if(!n||!As)return;Fs(n).then(n=>{n&&function(e,n){if(!As)return;const t=As.create(e,{nodeDefaults:zi,newNodeId:Pe,sectionLabel:Ci,blockIsOffered:vr}),o=kn(n);if(o===Ce){const e=nl(n.index),o=fo.insertNode(Ce,e,t);return void ol(e,o,Ci(t.type))}fo.insertNode(o,n.index,t),_o(F),fo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Ei(e.rung.nodeId,e.index,n.index):e.add?ls(e.add,n):e.zone===Ce?tl(e.index,n.index):Xl(e.zone,kn(n),e.index,n.index)},[ds]=Ln(()=>fn()),as=mn({keyOf:e=>e.id,readOnly:Boolean(It),session:ds,canDrop:ns,onDrop:ss,onStep:(e,n)=>{e.rung?Ei(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Ce?((e,n)=>{const t=Ci(ci[e]?.type??""),o=tl(e,n<0?e-1:e+2);if(!o.moved)return void Ur(n<0?_t.sectionFirst({name:t}):_t.sectionLast({name:t}));const{floor:r,cap:i}=pi();Ur(_t.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Xl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),cs=En(e=>{const{floor:n,cap:t}=pi(),o=[];for(const r of e.nodes){const e=kn(r.place),i=Bi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Kt(i)||Qt(i)||hr(i.type,i))continue;if(Ut(i.type))continue;const l=Boolean(ql(e)),s=e===Ce||l;e===Ce&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?Ci(i.type):Di(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=kn(e.list);if(n===Ce&&0===e.children.length)return[{...e,addLabel:_t.addSection,addAlways:!0}];const t=os(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(ql(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=kn(e.list),t=n===Ce||ql(n)?null:os(n);return t?.choices.length?cn(e,t.target.spec?.addLabel??_t.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[At.data]),ps=null==Et?.props.id?null:String(Et.props.id),us=En(e=>{const n=Ft,t=e=>!e.item.rung&&null!==Sn(At.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(ps);return i||(r(Ye(At.data,n,o.item.id,ps,Tl))??o)},[At.data,Ft,ps,Tl]),[hs,fs]=Ln(null),ms=Boolean(Ll||Rl);In(Eo,"mouseover",e=>{if(!ms)return;const n=On(e.target),t=n?ht(At.data,Ft,n):null;t!==hs&&fs(t)}),In(Eo,"mouseout",e=>{ms&&!e.relatedTarget&&fs(null)});const gs=e=>Kt(e)||Qt(e)||Ut(e.type),ys=e=>{const n=Ut(e.type)?xi(e.type):Kt(e)?_t.header:Qt(e)?_t.footer:null;return null===n?Ni(e):kr.rowName?kr.rowName(e,"section",n):n},vs=[];if(ms){const e=ps?ht(At.data,Ft,ps):null;for(const n of/* @__PURE__ */new Set([e,hs])){const e=n?ci.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Kt(e)||e.type===Vt,o=Fl(e);if(o){vs.push({id:String(e.props.id),label:ys(e),below:t,reach:o});continue}if(!Ll||!gs(e))continue;const r=Ll(e);r&&vs.push({id:String(e.props.id),label:r,below:t})}}const ks=ue(),bs=jn(null);Tn(()=>{const e=Dt.changeNotice;if(!e)return;const n=JSON.stringify(ci.filter(gs)),t=bs.current;if(bs.current={doc:Dn,bands:n,index:Tt.index},!t||t.doc!==Dn||t.bands===n)return;Tt.hasPast&&Tt.index>=t.index&&!ut.has(ks)&&(ut.add(ks),Ur(e,"success",{action:{label:_t.bar.undo,onClick:()=>Tt.back()},duration:8e3}))},[ci]);const Ss=e=>{_o(F),fo.select(e.zone===Ce?{index:e.index}:{index:e.index,zone:e.zone})},ws=X(),xs=()=>({data:At.data,device:xo,ops:fo,inspector:ar}),zs=ws?.model,Cs=An(()=>zs?e=>zs(e,cs(e),xs()):cs,[zs,cs,xo]),Ns=ws?.measure,Is=Ns?(e,n)=>Ns(e,n,xs()):void 0,Os=ws?.canDrop,Bs=Os?(e,n)=>Os(e,n,ns,xs()):ns,Ps=ws?.drop,$s=Ps?(e,n)=>Ps(e,n,ss,xs()):ss,Ms=ws?.pick,js=Ms?e=>Ms(e,Ss,xs()):Ss,As=ws?.media??null,Ls=jn(null),Ts=An(()=>As?{id:ct,zone:"",index:-1,type:As.adds.type,add:{kind:As.adds.kind,type:As.adds.type},media:!0}:null,[As]);Tn(()=>{if(!Ts||It||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(Zn))(e)&&(Ls.current=null,ds.start({key:ct,item:Ts}))},n=e=>{ds.get()?.item.media&&(Ls.current=Gn(e.dataTransfer))},t=()=>{ds.get()?.item.media&&ds.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[Ts,It,ds]);const Es=()=>{const e=Ls.current;return Ls.current=null,e},Rs=pe(),Fs=async e=>{if(!Rs)return e;const n=await Rs(e);return n?{...e,id:n.id,url:n.url}:null};const Ds=(e,n)=>{if(!As)return;const t=Sn(ho.getState().appState.data,ui,n);if(!t)return;const o=t.node;fo.replaceComponent(kn(t.place),t.place.index,{...o,props:{...As.replace(o,e),id:o.props.id}})},Hs=e=>{const n=kn(e),t=Mi(n);t&&Li(t.node,t.slot,!1),ll(n,e.index)},Vs=(e,n)=>/* @__PURE__ */st(Ve,{...It?{}:as.seam({place:{...bn(e),index:n}})},`seam:${e}:${n}`),Ws={rowClick:al,isCollapsed:Fr,toggleCollapse:Dr},Us=e=>{const n=String(e.props.id),t=ci.findIndex(e=>String(e.props.id)===n),o=Gt(n),r=Bi(o),i=Fr(n),l=xi(e.type),s=kr.rowName?kr.rowName(e,"section",l):l,d=e=>Vs(o,e);/* @__PURE__ */
|
|
16
16
|
return dt(at,{children:[
|
|
17
|
-
/* @__PURE__ */st(
|
|
17
|
+
/* @__PURE__ */st(Ee,{words:qt,icon:/* @__PURE__ */st(Sr,{type:e.type,size:13}),name:s,preview:pl(e),marks:ul(e),onSelect:()=>el(t),nameSlot:Vi(Ce,t,n,s),selected:er===n,badge:Fl(e)?void 0:Wl,shared:Fl(e),actions:hl(e,Ce,t)??void 0,rowProps:{"data-node-id":n,onClick:al(()=>el(t))},fold:{open:!i,label:"section",onToggle:()=>Dr(n)}}),!i&&/* @__PURE__ */dt(Re,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ni(n),l=Cl(n),s=l&&Fr(r),a=()=>Il(o,t,r,e.type),{rowProps:c,...p}=as.row({item:{id:r,zone:o,index:t,type:n.type},place:{...bn(o),index:t}},{"data-node-id":r,onClick:al(a)});/* @__PURE__ */
|
|
18
18
|
return dt(Fn,{children:[d(t),
|
|
19
|
-
/* @__PURE__ */st(
|
|
19
|
+
/* @__PURE__ */st(Ee,{words:qt,icon:/* @__PURE__ */st(Sr,{type:n.type,size:13}),name:i,preview:pl(n),marks:ul(n),onSelect:a,nameSlot:Vi(o,t,r,i),selected:er===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Dr(r)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(o,t,i),hl(n,o,t),fl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */st(Re,{children:Ys(n,2)})]},r)}),d(r.length)]})]})},Gs=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=as.dragging,d=!Fr(l)&&s?.rung?.nodeId!==i,a={...bn(l),index:0},c=s&&!s.rung&&ns(s,a)?a:void 0,p=()=>Li(e,n,!0),{rowProps:u,...h}=as.row({item:{id:`rung:${l}`,zone:`${i}:${vt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:vt,index:t},into:c,canDrag:Boolean(ur.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:al(p)}),f=It?null:ur.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
20
|
return dt(Fn,{children:[n.heading,
|
|
21
|
-
/* @__PURE__ */st(
|
|
22
|
-
return st(at,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=wl(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=(e,n)=>Vs(e,n),p=/* @__PURE__ */dt(at,{children:[i.map(({child:n,zone:t,index:o})=>{const r=er===String(n.props.id),{collapsible:i,folded:s}=xl(n,l,
|
|
21
|
+
/* @__PURE__ */st(Ee,{words:qt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:ji===l,...h,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Dr(l)},actions:f&&f.length>0?/* @__PURE__ */st(at,{children:f.map((t,o)=>/* @__PURE__ */st(He,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(It||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ti(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__ */st(tt,{size:15}):/* @__PURE__ */st(lt,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */st(Re,{children:r})]},l)},Js=(e,n)=>{const t=kl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
+
return st(at,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=wl(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=(e,n)=>Vs(e,n),p=/* @__PURE__ */dt(at,{children:[i.map(({child:n,zone:t,index:o})=>{const r=er===String(n.props.id),{collapsible:i,folded:s}=xl(n,l,Nl(n.type)),d=String(n.props.id),a=Ql(n),p=()=>Il(t,o,d,e.type),{rowProps:u,...h}=as.row({item:{id:d,zone:t,index:o,type:n.type},place:{...bn(t),index:o}},{"data-node-id":d,onClick:al(p)});/* @__PURE__ */
|
|
23
23
|
return dt(Fn,{children:[0===o&&c(t,0),
|
|
24
|
-
/* @__PURE__ */st(
|
|
25
|
-
return st(at,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=wl(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),h=a&&!a.fixed?`${u}:${a.slot}`:null,f=p?`${u}:${p.slot}`:null,m=(e,n)=>Vs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===h)),v=/* @__PURE__ */dt(at,{children:[l.map(({child:n,zone:t,index:o})=>{const r=er===String(n.props.id),i=Di(n),l=String(n.props.id),{collapsible:d,folded:a}=xl(n,s,
|
|
24
|
+
/* @__PURE__ */st(Ee,{words:qt,icon:/* @__PURE__ */st(Sr,{type:n.type,size:13}),name:a,preview:pl(n),marks:ul(n),onSelect:p,nameSlot:Vi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...h,fold:i?{open:!s,label:"group",onToggle:()=>Dr(d)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(t,o,a),hl(n,t,o),fl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */st(Re,{children:Js(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?Gs(e,t.rung,r++,o,p):/* @__PURE__ */st(Fn,{children:p},t.slot??"")})})},Ys=(e,n)=>{const t=mr(At?.data,e.type,String(e.props.id)),o=kl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
+
return st(at,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=wl(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),h=a&&!a.fixed?`${u}:${a.slot}`:null,f=p?`${u}:${p.slot}`:null,m=(e,n)=>Vs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===h)),v=/* @__PURE__ */dt(at,{children:[l.map(({child:n,zone:t,index:o})=>{const r=er===String(n.props.id),i=Di(n),l=String(n.props.id),{collapsible:d,folded:a}=xl(n,s,Nl(n.type)),c=yl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...bn(p),index:Bi(p).length}:void 0,h=as.dragging,f=u&&h&&ns(h,u)?u:void 0,g=()=>Il(t,o,l,e.type),{rowProps:y,...v}=as.row({item:{id:l,zone:t,index:o,type:n.type},place:{...bn(t),index:o},into:f,canDrag:!hr(n.type,n)},{"data-node-id":l,onClick:al(g)});/* @__PURE__ */
|
|
26
26
|
return dt(Fn,{children:[0===o&&m(t,0),
|
|
27
|
-
/* @__PURE__ */st(
|
|
28
|
-
/* @__PURE__ */st(w,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Ol(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?f&&!l.some(e=>e.zone===f)?m(f,0):null:0!==l.length||(o.rung?y:g!==f)?null:m(g,0)]});return o.rung?
|
|
27
|
+
/* @__PURE__ */st(Ee,{words:qt,icon:/* @__PURE__ */st(Sr,{type:n.type,size:13}),name:i,preview:pl(n),marks:ul(n),onSelect:g,nameSlot:Vi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Dr(l)}:void 0,actions:hr(n.type,n)?hl(n,t,o)??void 0:/* @__PURE__ */dt(at,{children:[cl(t,o,i),hl(n,t,o),fl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */st(Re,{children:Ys(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
+
/* @__PURE__ */st(w,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Ol(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?f&&!l.some(e=>e.zone===f)?m(f,0):null:0!==l.length||(o.rung?y:g!==f)?null:m(g,0)]});return o.rung?Gs(e,o.rung,i++,r,v):/* @__PURE__ */st(Fn,{children:v},o.slot??"")})})},Ks=Uo,Qs=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:go&&!Ks&&pr===e.id,onSelect:()=>si(e.id)}:e,Xs=[...(cr.railLead??[]).map(Qs),{id:"sections",label:_t.layers,icon:/* @__PURE__ */st(me,{}),active:go&&!Ks&&"sections"===pr,onSelect:()=>si("sections")},...(cr.railTrail??[]).map(Qs)],Zs=No?{onPress:Io}:$t?{onPress:()=>{le(zn,{accept:"image/*",title:io.mediaLibrary})}}:null,_s={value:Xs.find(e=>!0===e.active)?.id??"",press:e=>{const n=Xs.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:Xs.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */st("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},qs=[...cr.railLead??[],...cr.railTrail??[]].find(e=>"panel"in e&&e.id===pr),ed=Boolean(Zt?.foldable),nd=Zt?.label??(Mt?_t.pageSections:_t.templateSections),td=ed&&Fr(kt),od=/* @__PURE__ */dt(at,{children:[ci.map((e,n)=>{if(Kt(e)||Qt(e)||Ut(e.type))return null;const t=er===String(e.props.id),o=Boolean(e.props._hidden);vl(e);const r=String(e.props.id),i=cr.hasOwnRows?.(e)??!1,l=Cl(e)||i,s=l&&Fr(r),d=yl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...bn(a),index:Bi(a).length}:void 0,p=as.dragging,u=c&&p&&ns(p,c)?c:void 0,{rowProps:h,...f}=as.row({item:{id:r,zone:Ce,index:n,type:e.type},place:{...bn(Ce),index:n},into:u,canDrag:!hr(e.type,e)},{"data-node-id":r,onClick:al(()=>el(n))});/* @__PURE__ */
|
|
29
29
|
return dt(Fn,{children:[n>0&&ml(n),
|
|
30
|
-
/* @__PURE__ */st(
|
|
30
|
+
/* @__PURE__ */st(Ee,{words:qt,icon:/* @__PURE__ */st(Sr,{type:e.type,size:13}),name:Ni(e),preview:pl(e),marks:ul(e),shared:Fl(e),onSelect:()=>el(n),nameSlot:Vi(Ce,n,r,Ni(e)),selected:t,hidden:o,...f,fold:l?{open:!s,label:"section",onToggle:()=>Dr(r)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(Ce,n,Ni(e)),hl(e,Ce,n),fl(Ce,n,e,Ni(e))]}),rowProps:h}),Cl(e)&&!s&&/* @__PURE__ */dt(Re,{children:[Ys(e,1),cr.partRows?.(e,Ws)]}),i&&!s&&/* @__PURE__ */st(Re,{children:cr.ownRows?.(e,n,Ws)})]},String(e.props.id??n))}),Jl>0&&ml(Jl)]}),rd=(e,n,t)=>{const o=String(e.props.id),r=bl(e).length>0||Sl(e)||Boolean(yr(e.type)),i=r&&Fr(o),l="header"===t?_t.header:_t.footer,s=kr.rowName?kr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
31
|
return dt(at,{children:[
|
|
32
|
-
/* @__PURE__ */st(
|
|
33
|
-
/* @__PURE__ */st(
|
|
34
|
-
/* @__PURE__ */dt(
|
|
35
|
-
/* @__PURE__ */dt("div",{className:"es-cluster es-cluster--left",children:[
|
|
36
|
-
/* @__PURE__ */st(
|
|
37
|
-
/* @__PURE__ */st(
|
|
38
|
-
/* @__PURE__ */dt(
|
|
39
|
-
/* @__PURE__ */st(
|
|
40
|
-
/* @__PURE__ */st(
|
|
41
|
-
/* @__PURE__ */dt(
|
|
42
|
-
/* @__PURE__ */st(k,{input:Vo,words:_t.saveStatus}),
|
|
32
|
+
/* @__PURE__ */st(Ee,{words:qt,icon:/* @__PURE__ */st(Sr,{type:t,size:13}),name:s,preview:pl(e),marks:ul(e),badge:Fl(e)?void 0:Wl,shared:Fl(e),onSelect:()=>el(n),nameSlot:Vi(Ce,n,o,s),selected:er===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Dr(o)}:void 0,actions:hl(e,Ce,n)??void 0,rowProps:{"data-node-id":o,onClick:al(()=>el(n))}}),r&&!i&&/* @__PURE__ */st(Re,{children:Js(e,1)})]})};return(cr.wrap??(e=>e))(
|
|
33
|
+
/* @__PURE__ */st(Z,{target:Eo,children:/* @__PURE__ */dt("div",{ref:To,className:"sf-editor es-editor",style:tn(Ar),onContextMenu:Ki.onEditorContextMenu,...u(zn),children:[
|
|
34
|
+
/* @__PURE__ */dt(Ke,{children:[
|
|
35
|
+
/* @__PURE__ */dt("div",{className:"es-cluster es-cluster--left",children:[Zs?/* @__PURE__ */st(Vn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */st(ge,{}),onClick:Zs.onPress,children:_t.railMedia}):null,
|
|
36
|
+
/* @__PURE__ */st(Qe,{label:_t.bar.undo,disabled:Boolean(It)||!Tt.hasPast,onClick:()=>Tt.back(),children:/* @__PURE__ */st(_n,{})}),
|
|
37
|
+
/* @__PURE__ */st(Qe,{label:_t.bar.redo,disabled:Boolean(It)||!Tt.hasFuture,onClick:()=>Tt.forward(),children:/* @__PURE__ */st(qn,{})})]}),
|
|
38
|
+
/* @__PURE__ */dt(Xe,{children:[
|
|
39
|
+
/* @__PURE__ */st(Ze,{devices:vo,value:xo,onChange:zo}),
|
|
40
|
+
/* @__PURE__ */st(Qe,{label:_t.bar.refresh,tip:_t.bar.refreshTip,onClick:()=>{Lo.current=(()=>{const e=Eo?.document;if(!e)return null;const n=ci.findIndex(Qt),t=n>=0?n:ci.length;let o=null;for(let n=0;n<t;n++){const t=ci[n]?.props?.id;if(null==t)continue;const r=Mn(e,`[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=Et?.props?.id??ci[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Ao(e=>e+1)},children:/* @__PURE__ */st(et,{})}),cr.barView?.()]}),
|
|
41
|
+
/* @__PURE__ */dt(Xe,{kind:"right",style:{minWidth:300},children:[
|
|
42
|
+
/* @__PURE__ */st(k,{input:Vo,words:_t.saveStatus}),Bn?/* @__PURE__ */st(Bn,{}):null,cr.barLead?.(),cr.barTrail?.(),cr.mainAction||!cr.barMain?/* @__PURE__ */st(b,{input:Vo,action:cr.mainAction??{label:_t.done,onPress:()=>{Qn(At.data)}},readOnly:Boolean(It),saveSwitch:Bt,onToggleAutoSave:xt,onSaveNow:Wo,bar:_t.bar,words:_t.saveStatus}):cr.barMain()]})]}),
|
|
43
43
|
/* @__PURE__ */st(re,{}),
|
|
44
44
|
/* @__PURE__ */dt("div",{className:"sf-body",children:[go?/* @__PURE__ */dt(at,{children:[
|
|
45
45
|
/* @__PURE__ */dt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":_t.leftPanel,children:[
|
|
46
46
|
/* @__PURE__ */dt("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
|
|
47
|
-
/* @__PURE__ */st(
|
|
47
|
+
/* @__PURE__ */st(N,{side:"left",onHide:ii}),
|
|
48
48
|
/* @__PURE__ */st("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
|
|
49
|
-
/* @__PURE__ */st(Wn,{variant:"underline",block:!0,"aria-label":_t.bar.views,value:_s.value,onChange:_s.press,items:_s.items})]}),Uo?/* @__PURE__ */st(x,{at:
|
|
50
|
-
/* @__PURE__ */st(
|
|
51
|
-
/* @__PURE__ */st(
|
|
52
|
-
/* @__PURE__ */dt(
|
|
53
|
-
/* @__PURE__ */st(
|
|
54
|
-
/* @__PURE__ */st(
|
|
55
|
-
/* @__PURE__ */st(
|
|
56
|
-
/* @__PURE__ */dt("div",{ref:
|
|
49
|
+
/* @__PURE__ */st(Wn,{variant:"underline",block:!0,"aria-label":_t.bar.views,value:_s.value,onChange:_s.press,items:_s.items})]}),Uo?/* @__PURE__ */st(x,{at:Yo?{label:(e=>{const n=ql(e.zone);if(n)return _t.add.addingTo({name:kr.rowName?dl(n,!0):xi(n.type)});if(e.zone===Ce){const n=ci[e.index];return n&&!Qt(n)?_t.add.addingBefore({name:dl(n,!0)}):_t.add.addingAtEnd}const t=os(e.zone);return t?_t.add.addingTo({name:t.parentName}):_t.add.addingHere})(Yo),onClear:()=>Ko(null)}:void 0,placeBlocks:Yo&&Yo.zone!==Ce?os(Yo.zone)?.choices:void 0,canTake:Yo?e=>{if(!Yo)return null;const n={...bn(Yo.zone),index:Yo.index};if(is(e,n))return null;if("shared"===e.kind&&Yo.zone===Ce&&!Dt.shared?.nodeOf(e.section))return _t.shared.alreadyHere;const t=ql(Yo.zone);if(t)return _t.add.notInside({name:dl(t,!0)});if(Yo.zone===Ce)return _t.add.onlySections;const o=os(Yo.zone);return o?_t.add.notInside({name:o.parentName}):_t.add.onlySections}:void 0,onPick:Yo?e=>{if(!Yo)return;const n={...bn(Yo.zone),index:Yo.index};is(e,n)&&(ls(e,n),sl())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:e.type,add:e}),session:ds,siteWide:cr.addPanelRow?.(sl),onClose:sl,readOnly:Boolean(It)}):qs?qs.panel({onHide:ii,notify:Ur}):/* @__PURE__ */dt(at,{children:[
|
|
50
|
+
/* @__PURE__ */st(I,{icon:/* @__PURE__ */st(me,{}),title:_t.layers,context:lo,actions:/* @__PURE__ */dt(at,{children:[!It&&/* @__PURE__ */st(_e,{label:_t.add.title,onClick:()=>il(null),children:/* @__PURE__ */st(nt,{size:15})}),
|
|
51
|
+
/* @__PURE__ */st(_e,{label:Kl?_t.expandAll:_t.collapseAll,title:0===Yl.length?_t.nothingToFold:void 0,disabled:0===Yl.length,onClick:()=>jr(e=>{const n=new Set(Yl);return Kl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Yl])}),children:/* @__PURE__ */st(mt,{expand:Kl})})]})}),
|
|
52
|
+
/* @__PURE__ */dt(Fe,{className:"sf-tree sf-scroll",words:qt,children:[
|
|
53
|
+
/* @__PURE__ */st(Ee,{words:qt,icon:/* @__PURE__ */st(Sr,{type:"page",size:13}),name:_t.pageSettings,onSelect:di,selected:!Et&&qo,rowProps:{onClick:al(di)}}),Ul&&/* @__PURE__ */dt(at,{children:[!El&&/* @__PURE__ */st(De,{children:_t.header}),Us(Ul)]}),jt&&!(El&&Ul)&&/* @__PURE__ */dt(at,{children:[!El&&/* @__PURE__ */st(De,{children:_t.header}),!Xt&&/* @__PURE__ */st(Ee,{words:qt,icon:/* @__PURE__ */st(Sr,{type:"header",size:13}),name:_t.header,badge:Vl?void 0:Wl,shared:Vl,onSelect:ai,selected:Zo.kind===Yt?.kind,rowProps:{onClick:al(ai)}})]}),Al&&!(El&&Ul)&&rd(Al,jl,"header"),!ed&&/* @__PURE__ */st(De,{children:nd}),ed?/* @__PURE__ */dt(at,{children:[
|
|
54
|
+
/* @__PURE__ */st(Ee,{words:qt,icon:null,name:nd,fold:{open:!td,label:nd,onToggle:()=>Dr(kt)}}),!td&&/* @__PURE__ */st(Re,{children:od})]}):od,jt&&!El&&/* @__PURE__ */st(De,{children:_t.footer}),Ml&&!(El&&Gl)&&rd(Ml,$l,"footer"),Gl&&Us(Gl),cr.treeFoot?.()]})]})]}),
|
|
55
|
+
/* @__PURE__ */st(qe,{side:"left",width:Ar.left,min:nn.left,max:en,defaultWidth:m.left,label:_t.resizeLeftPanel,onResize:Er})]}):/* @__PURE__ */st(O,{side:"left",onShow:ii}),
|
|
56
|
+
/* @__PURE__ */dt("div",{ref:Gr,className:"sf-center sf-scroll","data-sf-canvas-head":Xr?"":void 0,style:{overflowX:ti?"auto":"hidden",overflowY:"hidden"},children:[Xr&&/* @__PURE__ */st("div",{ref:Zr,className:"sf-canvas-head",children:/* @__PURE__ */st(Xr,{device:xo})}),
|
|
57
57
|
/* @__PURE__ */dt("div",{className:"sf-frame-scaler",style:oi,children:[
|
|
58
58
|
/* @__PURE__ */st("div",{className:"sf-frame "+(xo===So?"":`sf-frame--${xo}`),style:ri,children:/* @__PURE__ */dt("div",{className:"sf-preview-host",children:[
|
|
59
|
-
/* @__PURE__ */st(
|
|
60
|
-
/* @__PURE__ */st(
|
|
61
|
-
/* @__PURE__ */st(
|
|
62
|
-
/* @__PURE__ */st("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:
|
|
63
|
-
/* @__PURE__ */st(
|
|
59
|
+
/* @__PURE__ */st(Le.Provider,{value:Tl,children:/* @__PURE__ */st(Te.Provider,{value:Hl,children:/* @__PURE__ */st(so,{},jo)})}),
|
|
60
|
+
/* @__PURE__ */st(pn,{canvas:Eo,session:ds,model:Cs,measure:Is,canDrop:Bs,onDrop:$s,choose:us,onPick:js,dropOn:As?{accepts:(e,n)=>{if(!e.media||!As||n.item.rung)return!1;const t=Sn(At.data,ui,n.item.id);return null!==t&&As.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Es();n&&As&&Fs(n).then(n=>{n&&Ds(n,e.item.id)})})(n),label:()=>_t.canvasReplaceImage}:void 0,onZoneAdd:Hs,onSeamAdd:Hs,zoneAddLabel:_t.canvasAddBlock,words:eo.canvas,readOnly:Boolean(It),revision:At.data}),Qo.length>0&&!Ro&&/* @__PURE__ */st("div",{className:"sf-preview-gaps",children:Qo.map(e=>
|
|
61
|
+
/* @__PURE__ */st(un,{index:e.index,label:_t.addSectionHere,onInsert:()=>il(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))})]})}),ms?/* @__PURE__ */st(ft,{canvas:Eo,tabs:vs,onSelect:e=>{const n=ci.findIndex(n=>String(n.props.id)===e);n>=0&&el(n)}}):null]})]}),yo?/* @__PURE__ */dt(at,{children:[Pn?
|
|
62
|
+
/* @__PURE__ */st("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:Pn}):/* @__PURE__ */st(at,{children:/* @__PURE__ */st(h,{value:{selectChild:Il,addChild:Ol,childRowName:Di,blockRowName:Ql},children:/* @__PURE__ */st(ao,{mode:Zo,onOpenWebsiteSettings:cr.openSettings??(()=>{}),onOpenSiteStyles:cr.openStyles,onSelectNode:Cr,onNotify:Ur,onHidePanel:li,nodeActions:Et?Ne(Ft,Et.type):bt})})}),
|
|
63
|
+
/* @__PURE__ */st(qe,{side:"right",width:Ar.right,min:nn.right,max:en,defaultWidth:m.right,label:_t.resizeSettingsPanel,onResize:Rr})]}):
|
|
64
64
|
/* @__PURE__ */st(O,{side:"right",onShow:li})]}),Ki.menu,
|
|
65
65
|
/* @__PURE__ */st(ne,{}),vi?/* @__PURE__ */st(pt,{name:vi.name,onMake:e=>(async(e,n)=>{const t=ci.find(n=>String(n.props.id)===e),o=Dt.shared;if(!t||!o)return;let r;try{r=await C(yi).create(n,t)}catch{return void Ur(_t.shared.makeFailed,"error")}o.adopt(t,r),ki(null)})(vi.id,e),onCancel:()=>ki(null)}):null]})}))}export{wt as ScreenChrome};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=["desktop","tablet","mobile"],e={desktop:"Desktop",tablet:"Tablet",mobile:"Mobile"},n=720,o=1100;function a(t){return t>=1100?"desktop":t>=720?"tablet":"mobile"}function r(t){return`${t}Tablet`}function
|
|
1
|
+
var t=["desktop","tablet","mobile"],e={desktop:"Desktop",tablet:"Tablet",mobile:"Mobile"},n=720,o=1100;function a(t){return t>=1100?"desktop":t>=720?"tablet":"mobile"}function r(t){return`${t}Tablet`}function b(t){return`${t}Phone`}function u(t){return null==t}var l=t=>e=>"number"==typeof e?e*t:e,p=t=>t;var h={spacing:{tablet:l(.75),phone:l(2/3),round:function(t){const e=Math.ceil(Math.abs(t)/4-.5);return 4*(t<0?-e:e)+0}},columns:{tablet:t=>"number"==typeof t?Math.min(t,2):t,phone:t=>"number"==typeof t?1:t},stack:{tablet:p,phone:t=>void 0===t?t:"stacked"},textSize:{tablet:l(.85),phone:l(.7/.85),round:Math.round},heightMode:{tablet:p,phone:t=>"px"===t?"fit":t},heightPx:{tablet:l(.75),phone:p,round:Math.round},same:{tablet:p,phone:p}},i=Object.fromEntries(Object.keys(h).map(t=>[t,{tablet:p,phone:p}]));function c(t,e,n,o,a=h){const r=a[t],b=t=>r.round&&"number"==typeof t?r.round(t):t,l=u(n)?r.tablet(e):n,p=u(o)?r.phone(l):o;return{desktop:e,tablet:u(n)?b(l):n,phone:u(o)?b(p):o}}export{h as AUTO_RULES,i as FOLLOW_RULES,o as VIEW_DESKTOP_MIN,n as VIEW_TABLET_MIN,t as VIEW_TIERS,e as VIEW_TIER_LABEL,u as isAuto,b as phoneKey,c as resolveViewValue,r as tabletKey,a as viewTierForWidth};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={title:"Add",contextAll:"Sections and blocks",done:"Done",doneDescription:"Close Add and go back",templates:"Your templates",tile:({name:e})=>`Add ${e}`,hint:"Drag onto the page.",search:"Search",onlySections:"Only sections go here",notInside:({name:e})=>`Cannot go inside ${e}`,addingTo:({name:e})=>`Adding to ${e}`,addingBefore:({name:e})=>`Adding before ${e}`,addingAtEnd:"Adding at the end of the page",addingHere:"Adding here"},a=e=>1===e?"1 page":`${e} pages`,o={group:"Shared sections",onPages:({count:e})=>`On ${a(e)}`,makeShared:"Make shared",makeSharedHint:"Use this section on other pages from Add. Change it once, and every page changes.",name:"Name",cancel:"Cancel",makeFailed:"Could not make it shared. Try again.",detach:"Detach from shared",removeFromPage:"Remove from this page",removed:({count:e})=>e>0?`Removed from this page · still on ${a(e)}`:"Removed from this page",deleteShared:"Delete shared section",deleteTitle:({name:e})=>`Delete “${e}”?`,deleteMessage:({count:e})=>0===e?"No page uses it. Nothing on the website changes.":1===e?"The page that uses it keeps its own copy. Nothing disappears from the website.":`The ${e} pages that use it each keep their own copy. Nothing disappears from the website.`,deleteFailed:"Could not delete it. Try again.",alreadyHere:"Already on this page"};var t={savedAgo:function({seconds:e}){const a=Math.max(0,Math.floor(e));if(a<1)return"Saved just now";if(a<60)return`Saved ${a} second${1===a?"":"s"} ago`;const o=Math.floor(a/60);if(o<60)return`Saved ${o} minute${1===o?"":"s"} ago`;const t=Math.floor(o/60);return`Saved ${t} hour${1===t?"":"s"} ago`},saved:"All changes saved",saving:"Saving",pending:"Changes not saved yet — saving in a moment",failedIn:({seconds:e})=>`Not saved — trying again in ${e} s`,failedSoon:"Not saved — trying again soon",offline:"You’re offline — we’ll save when you’re back",pausedHeld:"Auto-save is off — changes not saved",paused:"Auto-save is off",locked:({editing:e})=>`Not saving — ${e}`,blockedOffline:"You’re offline. Try again when you’re back online.",blockedFailed:"Your last changes are not saved yet. Try again when they are.",blockedConflict:"Your last save was refused. See the notice below."},n={blockCount:({count:e})=>`${e} ${1===e?"block":"blocks"}`,loading:"Loading",waitingForAuthorization:"Waiting for editor authorization",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:e})=>`No page with slug "${e}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:e})=>`Could not load the document — ${e}`,noun:"page",pageSettings:"Page settings",header:"Header",footer:"Footer",pageSections:"Page",templateSections:"Template",addSection:"Add section",addSectionHere:"Add section here",done:"Done",copied:({name:e})=>`Copied ${e}`,pasteRefused:({name:e})=>`${e} can’t be pasted here.`,add:e,shared:o,canvasAddBlock:"Add block",canvasReplaceImage:"Replace image",railMedia:"Media library",leftPanel:"Left panel",resizeLeftPanel:"Resize left panel",leave:{title:"Unsaved changes",body:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them.",cancel:"Cancel",discard:"Discard & leave",save:"Save & leave",saving:"Saving"},bar:{undo:"Undo",redo:"Redo",refresh:"Reload the preview",refreshTip:"Reload the preview (keeps your place)",notSaving:"Not saving — see the notice below",retry:"Retry now",autoSaveOff:"Auto-save is off — click to turn it back on (saves your held edits)",autoSaveOn:"Auto-save is on — click to pause it",views:"Left panel views",saveOptions:"Save options",autoSave:"Auto-save",saveNow:"Save now"},saveStatus:t,menu:{undo:"Undo",redo:"Redo",collapseAll:"Collapse all layers",selectAll:"Select all",pinned:"Pinned — can’t be moved or deleted",clipboardRefused:"Your browser won’t let us read the clipboard — press ⌘V"},layers:"Layers",expandAll:"Expand all sections",collapseAll:"Collapse all sections",nothingToFold:"Nothing to fold on this page",rename:"Rename",deleteNamed:({name:e})=>`Delete ${e}`,hideNamed:({name:e})=>`Hide ${e}`,showNamed:({name:e})=>`Show ${e}`,addBlockHere:"Add block here",sectionFirst:({name:e})=>`“${e}” is already first`,sectionLast:({name:e})=>`“${e}” is already last`,sectionMoved:({name:e,n:a,total:o})=>`Moved “${e}” to position ${a} of ${o}`,sectionAdded:({name:e})=>`Added “${e}” section`,deleted:({name:e})=>`Deleted “${e}”`,resizeSettingsPanel:"Resize settings panel",sectionSettings:({name:e})=>`${e} settings`,headerSettings:"Header settings",addBlockMenu:"Add block",deviceNote:{tablet:"Tablet uses the desktop settings.",mobile:"Showing the phone settings for this section."}};export{e as DEFAULT_SCREEN_ADD_WORDS,t as DEFAULT_SCREEN_SAVE_STATUS_WORDS,o as DEFAULT_SCREEN_SHARED_WORDS,n as DEFAULT_SCREEN_WORDS};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{blockRuns as e,offeredChoices as s}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as t}from"./chunk-NA3GMA43.js";import{DEFAULT_SCREEN_WORDS as l}from"./chunk-EB6NI2VK.js";import{useWords as r}from"./chunk-MFIRYGHW.js";import{ItemCount as n,DropdownMenu as c}from"efficient-shell/ui";import{jsxs as a,jsx as o,Fragment as i}from"react/jsx-runtime";function m({choices:m,onPick:p}){const{Icon:u}=t(),f=r("screen",l),h=e(s(m)).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */a("span",{className:"flex w-full items-center gap-2",children:[
|
|
2
|
+
/* @__PURE__ */o("span",{children:e.group}),
|
|
3
|
+
/* @__PURE__ */o(n,{count:e.items.length,label:f.blockCount({count:e.items.length}),className:"ml-auto"})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */o("span",{className:"sf-chip",children:/* @__PURE__ */o(u,{type:e.type,size:13})}),onSelect:()=>p(e.type)}))]);/* @__PURE__ */
|
|
4
|
+
return o(c,{align:"start",triggerClassName:"sf-add-card",items:h,trigger:/* @__PURE__ */a(i,{children:[
|
|
5
|
+
/* @__PURE__ */o("span",{className:"sf-plus sf-plus--sm",children:"+"}),f.addBlockMenu]})})}export{m as AddBlockRow};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Accordion as e}from"efficient-shell/ui";import{jsx as n}from"react/jsx-runtime";function t({title:t,open:o,onToggle:i,count:l,level:r=3,id:s,children:a,className:c}){const d=s??"group";/* @__PURE__ */
|
|
2
|
+
return n(e,{level:r,keepMounted:!0,openIds:o?[d]:[],onOpenChange:e=>i(e.includes(d)),items:[{id:d,headId:s,title:t,count:l,className:c?`es-panel-band ${c}`:"es-panel-band",content:a}]})}var o=Object.freeze(["Design","Animation"]),i=Object.freeze(["Content","Size","Design","Layout","Position","Anchor"]);export{i as DESIGN_GROUPS,o as SETTINGS_BUCKETS,t as SettingsGroup};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-NA3GMA43.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-7L3NKHEC.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEaselHost as n}from"./chunk-MQA7OFRA.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-
|
|
1
|
+
import{useEaselHost as n}from"./chunk-MQA7OFRA.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-7L3NKHEC.js";import{useState as r,useEffect as o,useRef as u}from"react";function c(e){const t=n(),[u,c]=r(null);return o(()=>c(e.current),[e]),t.ownsDocument?"undefined"==typeof document?null:document:u}function i(r,u){const i=n(),s=e(),f=c(r);o(()=>{if(!i.ownsDocument&&f)return t(f,s,{leaveTyping:!0})},[i,s,f]);const m=u?.document??null;o(()=>{if(!i.ownsDocument&&m)return t(m,s,{leaveTyping:!0})},[i,s,m])}function s(n){return n.ownsDocument?{}:{tabIndex:-1}}function f(n){return!n.altKey&&!n.shiftKey&&(!(!n.metaKey&&!n.ctrlKey)&&("s"===n.key||"S"===n.key||"KeyS"===n.code))}function m(n,e,t){const r=c(n),i=u(t);o(()=>{i.current=t}),o(()=>{if(!r)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return r.addEventListener("keydown",n),()=>r.removeEventListener("keydown",n)},[r]);const s=e?.document??null;o(()=>{if(!s)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return s.addEventListener("keydown",n),()=>s.removeEventListener("keydown",n)},[s])}export{s as editorRootFocus,f as isSaveShortcut,c as useEaselKeyTarget,m as useEaselSaveKey,i as useEaselUndoKeys};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={less:"Less",more:"More",choose:"Choose",search:"Search",noMatches:"No matches",list:{item:"item",itemName:({noun:e,n:o})=>{return`${t=e,t?t[0].toUpperCase()+t.slice(1):t} ${o}`;var t},count:({noun:e,n:o})=>`${o} ${1===o?e:(e=>/(s|x|z|ch|sh)$/i.test(e)?`${e}es`:/[^aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:`${e}s`)(e)}`,position:({n:e,total:o})=>`${e} of ${o}`,duplicate:"Duplicate",duplicateItem:({noun:e})=>`Duplicate ${e}`,deleteItem:({noun:e})=>`Delete ${e}`,add:({noun:e})=>`+ Add ${e}`,addHere:({noun:e})=>`Add ${e} here`,moveUp:"Move up",moveDown:"Move down",delete:"Delete",locked:"This one cannot be removed",moved:({n:e,total:o})=>`Moved to ${e} of ${o}`}};export{e as DEFAULT_FIELDS_WORDS};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{DEFAULT_FIELDS_WORDS as e}from"./chunk-
|
|
2
|
-
/* @__PURE__ */s("span",{className:"es-fsel-label",children:b?b(a,{active:l.active??!1,chosen:l.selected}):a.label}),void 0===a.meta||m?null:/* @__PURE__ */s("span",{className:"es-fsel-meta","aria-hidden":"true",children:a.meta})]}):e.label},
|
|
1
|
+
import{DEFAULT_FIELDS_WORDS as e}from"./chunk-JACEEVVF.js";import{useWords as l}from"./chunk-MFIRYGHW.js";import{SearchableSelect as a,Select as n}from"efficient-shell/ui";import{jsx as s,jsxs as i}from"react/jsx-runtime";function r(e,l){return e.find(e=>Object.is(e.value,l))}var o=e=>String(e);function t(r){const{id:t,options:u,placeholder:d,readOnly:c=!1,ariaLabel:v,ariaLabelledBy:h,searchable:m=!1,searchPlaceholder:p,groupCount:f=!1,renderOption:b}=r,g=l("fields",e),O=h?{"aria-labelledby":h}:v?{"aria-label":v}:{},j=u.some(e=>void 0!==e.thumb),x=j||void 0!==b||u.some(e=>void 0!==e.meta),C=e=>""===e?void 0:u[Number(e)],N=(e,l)=>{const a=C(e.value);return a?/* @__PURE__ */i("span",{className:"es-fsel-row",children:[j?/* @__PURE__ */s("span",{className:"es-fsel-thumb","aria-hidden":"true",children:a.thumb?/* @__PURE__ */s("img",{src:a.thumb,alt:"",loading:"lazy"}):null}):null,
|
|
2
|
+
/* @__PURE__ */s("span",{className:"es-fsel-label",children:b?b(a,{active:l.active??!1,chosen:l.selected}):a.label}),void 0===a.meta||m?null:/* @__PURE__ */s("span",{className:"es-fsel-meta","aria-hidden":"true",children:a.meta})]}):e.label},y=[];let V=null;if(u.forEach((e,l)=>{const a={value:o(l),label:e.label,...e.disabled?{disabled:!0}:{},...m&&e.meta?{sublabel:e.meta}:{},...!m&&e.description?{description:e.description}:{}};void 0===e.group?(V=null,y.push(a)):V&&V.label===e.group?V.options.push(a):(V={label:e.group,options:[a]},y.push(V))}),f)for(const e of y)"options"in e&&(e.label=`${e.label} ${e.options.length}`);const T=e=>e.flatMap(e=>{const l=C(e.value);return l?[l]:[]});if(m){const l={id:t,options:y,placeholder:p??d??g.search??e.search,disabled:c,renderOption:x?N:void 0,...O};if(!0===r.multiple){const e=Array.isArray(r.value)?r.value:[],n=r.onChange;/* @__PURE__ */
|
|
3
3
|
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(a,{...l,multiple:!0,value:u.flatMap((l,a)=>e.some(e=>Object.is(e,l.value))?[o(a)]:[]),onChange:e=>n(u.filter((l,a)=>e.includes(o(a))).map(e=>e.value))})})}const n=u.findIndex(e=>Object.is(e.value,r.value)),i=r.onChange;/* @__PURE__ */
|
|
4
|
-
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(a,{...l,value:n>=0?o(n):"",clearable:!1,onChange:e=>{const l=
|
|
5
|
-
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(n,{...A,multiple:!0,value:a,renderValue:r.renderValue?e=>r.renderValue(
|
|
6
|
-
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(n,{...A,value:M>=0?o(M):"",renderValue:r.renderValue?e=>r.renderValue(
|
|
4
|
+
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(a,{...l,value:n>=0?o(n):"",clearable:!1,onChange:e=>{const l=C(e);l&&!Object.is(l.value,r.value)&&i(l.value)}})})}const A={id:t,size:"md",className:"es-fsel-button",options:y,placeholder:d??g.choose,readOnly:c,renderOption:x?N:void 0,...O};if(!0===r.multiple){const e=Array.isArray(r.value)?r.value:[],l=l=>e.some(e=>Object.is(e,l.value)),a=u.flatMap((e,a)=>l(e)?[o(a)]:[]),i=r.onChange;/* @__PURE__ */
|
|
5
|
+
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(n,{...A,multiple:!0,value:a,renderValue:r.renderValue?e=>r.renderValue(T(e)):void 0,valueText:r.valueText?e=>r.valueText(T(e)):void 0,onChange:e=>i(u.filter((l,a)=>e.includes(o(a))).map(e=>e.value))})})}const M=u.findIndex(e=>Object.is(e.value,r.value)),E=r.onChange;/* @__PURE__ */
|
|
6
|
+
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(n,{...A,value:M>=0?o(M):"",renderValue:r.renderValue?e=>r.renderValue(T(e)[0]):void 0,valueText:r.valueText?e=>r.valueText(T(e)[0]):void 0,footer:r.footer?.length?[...r.footer]:void 0,changed:r.changed,onChange:e=>{const l=C(e);l&&!Object.is(l.value,r.value)&&E(l.value)}})})}export{t as FieldSelect,r as optionFor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{routeSharedHostMessage as e}from"./chunk-77IWWW6X.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-GMCZXMOV.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-HNKB2ZYR.js";import{isExpiredSession as s,readEaselFailure as i}from"./chunk-CLOS6SSX.js";import{useAdminBridge as l}from"./chunk-U66YKDAR.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-O7Q4DDJT.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-RSCMJIWS.js";import{useEaselHost as k}from"./chunk-MQA7OFRA.js";import{DEFAULT_SCREEN_WORDS as v}from"./chunk-
|
|
2
|
-
return A(M.Provider,{value:{target:G,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:ge,siteId:ne,ready:de,token:ie,tokenRef:le,notifyParent:cr,bridgeCapabilities:ce,runAuthed:mr,docId:ke,data:he,getLiveData:()=>
|
|
1
|
+
import{routeSharedHostMessage as e}from"./chunk-77IWWW6X.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-GMCZXMOV.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-HNKB2ZYR.js";import{isExpiredSession as s,readEaselFailure as i}from"./chunk-CLOS6SSX.js";import{useAdminBridge as l}from"./chunk-U66YKDAR.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-O7Q4DDJT.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-RSCMJIWS.js";import{useEaselHost as k}from"./chunk-MQA7OFRA.js";import{DEFAULT_SCREEN_WORDS as v}from"./chunk-EB6NI2VK.js";import{useAutosave as g}from"./chunk-NDRZP6YR.js";import{canWriteDocument as p,newEaselClientId as h,reloadIfVersionMoved as y,openUnansweredClaim as w,FAIL_OPEN_RETRY_MS as S,CLAIM_FAIL_OPEN_MS as b,holderOf as I}from"./chunk-THWO5YVZ.js";import{useWords as P}from"./chunk-MFIRYGHW.js";import{createContext as j,useContext as R,useState as B,useMemo as E,useCallback as O,useEffect as C,useRef as H}from"react";import{jsx as A}from"react/jsx-runtime";var D={content:[],root:{},zones:{}};var M=j(null);function T(){const e=R(M);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function N({target:j,addressing:R=o,onHostMessage:T,children:N}){const W=R,{homeSlug:F,entryMayBounce:L,entryBounce:V,onSwitch:Y,tellsHost:K,adapterFor:U,migrateRenamedProps:X,describeMissing:Z,onLoadFailed:x}=W,[G,J]=B(j),Q=k(),z=d(),_=E(()=>f(z),[z]),q=E(()=>t(z),[z]),$="template"===G.kind,ee="template"===G.kind?G.id:null,re="template"===G.kind?G.pageSlug??F??"":"document"===G.kind?G.slug??"":G.slug,ne="page"===G.kind?G.siteId??null:null,te=z.blocks,oe=E(()=>U(G,_,te),[U,_,te,G.kind,"template"===G.kind?G.id:"document"===G.kind?G.record:G.siteId]),ue=oe.capabilities,ae=O(e=>z.documentHooks?.stored?.(e)??e,[z]);C(()=>{m(z,ne)},[z,ne]);const se=H(G);C(()=>{se.current=G},[G]);const{token:ie,tokenRef:le,capabilities:ce}=l({onMessage:r=>{if(T?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&Br(e.target)}}}),de=!z.usesBridgedToken||null!==ie,fe=oe.lock,me=Boolean(_.lock),[ke,ve]=B(null),[ge,pe]=B(null),[he,ye]=B(null),[we,Se]=B(null),be=P("screen",v),Ie=we?function(e,r){if(null!==e.sentence)return e.sentence;if(!e.missing)return r.loadFailed({cause:e.cause});switch(e.target.kind){case"template":return r.missingTemplatePage;case"document":return r.missingDocument;default:return r.missingPage({slug:e.slug})}}(we,be):null,[Pe,je]=B(null),Re=H(null),Be=H(null),[Ee,Oe]=B(!1),Ce=H(null),[He,Ae]=B(null),De=H(null),[Me,Te]=B(null),[Ne,We]=B(!1),Fe=H(null);C(()=>{Fe.current=Me},[Me]);const[Le,Ve]=B(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Ye=H(Le);C(()=>{Ye.current=Le},[Le]);const Ke=H(()=>Promise.resolve(!1)),Ue=O(e=>{Be.current=e,Oe(!0)},[]),Xe=g({save:async({id:e,data:r})=>{if(p(Ye.current)){if(!await Ke.current(e,r)){if(!p(Ye.current))return void Ue({id:e,data:r});throw new Error("page save did not land")}}else Ue({id:e,data:r})},onFailure:(e,r)=>{0===r&&Q.send("storefront-editor:save-failed")}}),{state:Ze,push:xe,flush:Ge,pause:Je,resume:Qe,stop:ze,reset:_e,retryNow:qe,hasPending:$e}=Xe,er=H(Ze);C(()=>{er.current=Ze},[Ze]);const rr=u(Ze),nr=O(()=>{const e=Be.current;e&&(Be.current=null,Oe(!1),xe(e))},[xe]),tr=H("");tr.current||(tr.current=h());const[or,ur]=B(0),ar=H(!1),[sr,ir]=B(L(j)),lr=H(!1);C(()=>{if(lr.current)return;lr.current=!0;const e=Q.address.search(),r=V(j,e);r?Q.address.load(r):L(j)&&ir(!1)},[j,Q]);const cr=Q.send;C(()=>{if(!de)return;let e=!1;const t=se.current,o=oe.resolve(re),u=z.documentHooks?.opening?.({slug:re,isTemplate:$,capabilities:ue});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==F&&re!==F?void Q.address.load({kind:"page",slug:F,siteId:ne??void 0}):(Se({target:t,slug:re,missing:!0,sentence:Z?.(t)??null}),void x?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;Re.current=n,je(n),ve(r.id),pe(r.kind??null),De.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:D,s=X(a),i=u?await u(s):s;e||ye(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),Se({target:t,slug:re,missing:!1,sentence:n(o,{slug:re},z),cause:r(o,z)}),x?.(t,o))}),()=>{e=!0}},[de,ie,$,oe,re]);const dr=O(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=le.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),fr=O(async e=>{const r=le.current;if(!r&&z.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n,z)){cr("storefront-editor:auth-expired");const n=r?await dr(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[cr,dr,z]),mr=O(async e=>{const r=le.current?await fr(e):{ok:!1};return r.ok||cr("storefront-editor:save-failed"),r.ok},[cr,fr]),kr=O(async(e,r,n=!1)=>{if(null!==Re.current)return!1;if(!p(Ye.current))return!1;if(Fe.current)return!1;const t=await fr(()=>oe.saveLayout(e,r,De.current,tr.current));if(t.ok)return De.current=t.value.version??De.current,We(!1),!0;const o=q.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Ye.current=e,Ve(e),!1}const u=q.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&oe.rereadVersion){const n=await fr(()=>oe.rereadVersion(e));if(n.ok&&n.value)return De.current=n.value,Ke.current(e,r,!0)}ze(),Fe.current=u,Te(u)}return We(i(t.error,z)?.status===c),!1},[oe,fr,ze,z]);C(()=>{Ke.current=kr},[kr]);const vr=O(e=>{if(null!==Re.current)return;if(cr("storefront-editor:dirty"),!ke)return;const r=ae(e);Ce.current=r,p(Ye.current)?xe({id:ke,data:r}):Ue({id:ke,data:r})},[ke,cr,Ue,xe,ae]),gr=O(async()=>{p(Ye.current)&&nr();return await Ge()&&null==Be.current},[nr,Ge]),pr=H(gr);C(()=>{pr.current=gr},[gr]);const hr=H(fr);C(()=>{hr.current=fr},[fr]);const yr=O(()=>{Q.address.reload()},[Q]),wr=H(()=>Promise.resolve(!1));C(()=>{wr.current=()=>{const e=oe.rereadVersion;return ke&&e?y({ours:De.current,stored:async()=>{const r=await hr.current(()=>e(ke));return r.ok?r.value:null},hasPending:()=>null!=Be.current||$e(),reload:yr}):Promise.resolve(!1)}},[oe,ke,$e,yr]);const Sr=null!==Pe;C(()=>{if(!fe||!ke||!de||Sr)return;let e=!1,r=null,n=null;const t=tr.current,o={claim:async e=>{const r=await hr.current(()=>fe.claim(ke,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Ye.current,heldWrite:()=>({pending:null!=Be.current||$e(),autoSaveEnabled:!er.current.paused,saveConflict:null!=Fe.current}),setAccess:e=>{Ye.current=e,Ve(e)},releaseHeldWrite:()=>{pr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{wr.current()}},u=q.makeClaimBeat(o),a=ar.current;return ar.current=!1,a||(Ve({kind:"checking"}),n=setTimeout(()=>{n=null,w(o)&&o.startHeartbeat(S)},b)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),fe.release(ke,t).catch(()=>{})}},[ke,fe,de,ie,or,Sr]);const br=O(()=>{fe&&ke&&(ar.current=!0,ur(e=>e+1))},[ke,fe]),Ir=O(()=>{Ve(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),Pr=O(()=>{er.current.paused?(p(Ye.current)&&nr(),Qe()):Je()},[nr,Je,Qe]),jr=O(()=>{qe()},[qe]),Rr=O(e=>{Ce.current=null,a("template"!==e.kind&&me,{resetAutosave:()=>{_e(),Be.current=null,Oe(!1)},setVersion:e=>{De.current=e},setSaveConflict:Te,setAccess:Ve}),Y(e),J(e),Re.current=null,je(null),ve(null),pe(null),ye(null),Se(null),Q.address.show(e),"document"!==e.kind&&K(e)&&Q.send("storefront-editor:navigated",{target:e})},[_e,Q,me,Y,K]),Br=O(e=>{if(function(e,r,n){if(e.kind!==r.kind)return!1;if("template"===e.kind){const t=r;return e.id===t.id&&(e.pageSlug??n)===(t.pageSlug??n)}if("document"===e.kind){const n=r;return e.record===n.record&&(e.slug??"")===(n.slug??"")}const t=r;return e.slug===t.slug&&e.siteId===t.siteId}(e,se.current,F))return;const r=null!=Be.current;if(!r&&!$e())return void Rr(e);const n=er.current;r||n.paused||n.failed||n.stopped?Ae(e):Ge().then(r=>{r?Rr(e):Ae(e)})},[Rr,$e,Ge,F]),Er=O(()=>Ae(null),[]),Or=O(()=>{Ae(e=>(e&&Rr(e),null))},[Rr]),Cr=O(async()=>{const e=He;if(!e)return;await gr()&&(Ae(null),Rr(e))},[He,gr,Rr]),Hr=O(async e=>{if(null!==Re.current)return;if(!ke)return;if(!p(Ye.current)||Fe.current)return;const r=ae(e);if(!await kr(ke,r))return void(Fe.current||cr("storefront-editor:save-failed"));const n=oe.publish;if(!ue.canPublish||!n)return void cr("storefront-editor:saved");const t=await fr(()=>n(ke,De.current??void 0));if(!t.ok){const{error:e}=t;return void cr("storefront-editor:publish-failed",{reason:e instanceof Error&&e.message?e.message:null})}De.current=t.value.version??De.current,cr("storefront-editor:published")},[ke,oe,ue.canPublish,cr,kr,fr,ae]);/* @__PURE__ */
|
|
2
|
+
return A(M.Provider,{value:{target:G,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:ge,siteId:ne,ready:de,token:ie,tokenRef:le,notifyParent:cr,bridgeCapabilities:ce,runAuthed:mr,docId:ke,data:he,getLiveData:()=>Ce.current??he,error:Ie,redirecting:sr,saveStatus:rr,saveState:Ze,autoSaveEnabled:!Ze.paused,autoSaveStoppedByConflict:Ze.stopped,hasUnsavedEdits:Ze.pending||Ee,toggleAutoSave:Pr,retrySave:jr,onChange:vr,flushSave:gr,onPublish:Hr,access:Le,readOnly:null!==I(Le)||null!==Pe||null!==Me,readOnlyReason:Pe,takeOverEditing:br,viewReadOnly:Ir,saveConflict:Me,saveUnreachable:Ne,reloadFromServer:yr,navigate:Br,pendingNav:He,cancelPendingNav:Er,discardAndNavigate:Or,saveAndNavigate:Cr},children:N})}export{M as ScreenDocumentContext,N as ScreenDocumentProvider,T as useScreenDocument};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{noControlField as e}from"./chunk-7F52SZOI.js";import{DEFAULT_SCREEN_WORDS as n}from"./chunk-
|
|
1
|
+
import{noControlField as e}from"./chunk-7F52SZOI.js";import{DEFAULT_SCREEN_WORDS as n}from"./chunk-EB6NI2VK.js";import{useWords as r}from"./chunk-MFIRYGHW.js";import{usePreviewDevice as t}from"./chunk-BSPCSC45.js";import{jsx as o}from"react/jsx-runtime";function i(e){return"mobile"===e?"mobile":"desktop"}var c={desktop:null,tablet:n.deviceNote.tablet,mobile:n.deviceNote.mobile},u="data-sf-device-hidden";function d(){/* @__PURE__ */
|
|
2
2
|
return o("span",{hidden:!0,[u]:""})}function s({tier:e,render:n,...r}){return i(t())===e?/* @__PURE__ */o(n,{...r}):/* @__PURE__ */o(d,{})}var m="__device";function f(e){const n=e?.[m];return n??null}function l(e){return f(e)?.inner??e}function a(e,n){const r=n.render;return{...n,[m]:{tier:e,inner:n},render:n=>/* @__PURE__ */o(s,{tier:e,render:r,...n})}}function p(){const e=r("screen",n).deviceNote,i=t(),c="desktop"===i?null:e[i];return c?/* @__PURE__ */o("div",{className:"sf-device-scope",children:c}):/* @__PURE__ */o(d,{})}function v(){return e({type:"custom",render:()=>/* @__PURE__ */o(p,{})},"always")}export{m as DEVICE_FIELD_MARKER,u as DEVICE_HIDDEN_ATTR,c as DEVICE_NOTE,a as deviceField,f as deviceMetaOf,v as deviceNote,i as shownTier,l as withoutDeviceGate};
|