efficient-easel 26.7.0 → 26.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/{chunk-PSMO25EV.js → chunk-46HR5HZC.js} +1 -1
  2. package/dist/{chunk-LP2SVO74.js → chunk-4NSLMT3M.js} +1 -1
  3. package/dist/chunk-5RZYLJLX.js +1 -0
  4. package/dist/chunk-6REU2VRA.js +1 -0
  5. package/dist/chunk-7IYL2J5L.js +5 -0
  6. package/dist/{chunk-PLHMOQXY.js → chunk-B2EQY2LB.js} +1 -1
  7. package/dist/chunk-CRITA6CA.js +1 -0
  8. package/dist/{chunk-QPXMKAQT.js → chunk-EKBP6JKX.js} +1 -1
  9. package/dist/{chunk-LUOY3A3Q.js → chunk-EMIWEYU3.js} +1 -1
  10. package/dist/chunk-FVAEJFYD.js +1 -0
  11. package/dist/chunk-H27SRIVX.js +8 -0
  12. package/dist/chunk-IYMVIA2B.js +16 -0
  13. package/dist/chunk-JAUK6YX6.js +1 -0
  14. package/dist/{chunk-SQTVXE5D.js → chunk-JHCHJNZ2.js} +4 -4
  15. package/dist/chunk-LUG22U5L.js +1 -0
  16. package/dist/{chunk-XJ2EEEAU.js → chunk-OHDC426F.js} +3 -3
  17. package/dist/chunk-SV44ICBE.js +4 -0
  18. package/dist/{chunk-RZ54L6EW.js → chunk-SY74N7LL.js} +12 -12
  19. package/dist/chunk-TGSBEKAE.js +64 -0
  20. package/dist/{chunk-JYVQ62TL.js → chunk-XDX6Y266.js} +1 -1
  21. package/dist/{chunk-OB5JP6PR.js → chunk-Z3HNIJ7N.js} +16 -16
  22. package/dist/copy/index.js +9 -9
  23. package/dist/drag/index.js +1 -1
  24. package/dist/draw/index.js +1 -1
  25. package/dist/easel/index.js +1 -1
  26. package/dist/fields/index.js +1 -1
  27. package/dist/screen/components/AddBlockRow.js +1 -1
  28. package/dist/screen/components/AddSidePanel.js +1 -1
  29. package/dist/screen/components/NodeContextMenu.js +1 -1
  30. package/dist/screen/components/ScreenChrome.js +1 -1
  31. package/dist/screen/components/ScreenMount.js +1 -1
  32. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  33. package/dist/screen/components/SectionScreenShell.js +17 -17
  34. package/dist/screen/components/usePartBridge.js +1 -1
  35. package/dist/screen/index.js +1 -1
  36. package/dist/screen/lib/document/block-set-host.js +1 -1
  37. package/dist/screen/lib/document/block-size-fields.js +1 -1
  38. package/dist/screen/lib/document/box-fields.js +1 -1
  39. package/dist/screen/lib/document/button-fields.js +1 -1
  40. package/dist/screen/lib/document/image-fields.js +5 -5
  41. package/dist/screen/lib/document/preview-dom.js +1 -1
  42. package/dist/screen/lib/document/section-doc.js +1 -1
  43. package/dist/screen/lib/document/shadow-fields.d.ts +74 -0
  44. package/dist/screen/lib/document/shadow-fields.js +2 -0
  45. package/dist/screen/lib/document/shadow-values.d.ts +17 -0
  46. package/dist/screen/lib/document/shadow-values.js +1 -0
  47. package/dist/screen/lib/document/style-clipboard.js +1 -1
  48. package/dist/screen/lib/document/style-fields.d.ts +3 -1
  49. package/dist/screen/lib/document/style-fields.js +1 -1
  50. package/dist/screen/lib/document/use-section-ops.js +1 -1
  51. package/dist/screen/lib/key-scope.js +1 -1
  52. package/dist/screen/lib/screen-parts.js +1 -1
  53. package/dist/strings/index.js +2 -2
  54. package/dist/text-styles/index.js +21 -21
  55. package/package.json +14 -2
  56. package/dist/chunk-3PN3MAKW.js +0 -8
  57. package/dist/chunk-AYYPU7YZ.js +0 -14
  58. package/dist/chunk-JQQFB7EZ.js +0 -1
  59. package/dist/chunk-KCTFS4KB.js +0 -1
  60. package/dist/chunk-MLGEQMZA.js +0 -64
  61. package/dist/chunk-OXKGD2K7.js +0 -5
  62. package/dist/chunk-OXZDSOZV.js +0 -1
  63. package/dist/chunk-QYEZMQSD.js +0 -4
  64. package/dist/chunk-X73RVMHK.js +0 -1
  65. package/dist/chunk-ZCMNFB3Y.js +0 -1
@@ -1,2 +1,2 @@
1
- import{DEFAULT_TEXT_STYLES_WORDS as o}from"../chunk-OGH6CC3E.js";import{DEFAULT_NODE_MENU_WORDS as r}from"../chunk-WK3AFPXY.js";import{DEFAULT_SCREEN_WORDS as n,DEFAULT_IMAGE_ROW_WORDS as t}from"../chunk-Q3VAJMXS.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as c}from"../chunk-6WY6ZXJG.js";import{DEFAULT_CANVAS_WORDS as e}from"../chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as m}from"../chunk-K56YDHYQ.js";import{DEFAULT_PAGE_COPY_WORDS as i}from"../chunk-CEC5XLN4.js";import{DEFAULT_COLOUR_ROW_WORDS as s,DEFAULT_PANEL_WORDS as u}from"../chunk-56ID6FKZ.js";import{DEFAULT_SAVE_WORDS as f}from"../chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as p,DEFAULT_NOTICE_WORDS as l}from"../chunk-AJSDWWJW.js";import{DEFAULT_RAIL_WORDS as h}from"../chunk-2OAZYSWJ.js";import{DEFAULT_LOCK_WORDS as j}from"../chunk-RE4LP46F.js";import{DEFAULT_COPY_WORDS as a}from"../chunk-PMRN5Z3T.js";import{DEFAULT_FIELDS_WORDS as k}from"../chunk-JACEEVVF.js";import{stringsContext as y}from"../chunk-MFIRYGHW.js";import{DEFAULT_DRAG_WORDS as Y}from"../chunk-TQ5Y6S2X.js";import{useContext as C,useMemo as W}from"react";import{jsx as d}from"react/jsx-runtime";var g={notice:l,lock:j,save:f,chrome:p,rail:h,tree:m,panel:u,fields:k,colourRow:s,imageRow:t,drag:Y,menu:r,styleClipboard:c,copy:a,canvas:e,textStyles:o,screen:n,pageCopy:i},v=o=>"object"==typeof o&&null!==o;function D(o,r){const n={};for(const t of Object.keys(o)){const c=o[t],e=r[t];null==e?n[t]=c:v(c)?n[t]=v(e)?D(c,e):c:n[t]=typeof e==typeof c?e:c}return n}function F(o,r){return r?D(o,r):o}function J({value:o,locale:r,children:n}){const t=y(),c=C(t),e=c?.strings??g,m=r??c?.locale??"en",i=W(()=>({strings:F(e,o),locale:m}),[e,o,m]);/* @__PURE__ */
2
- return d(t.Provider,{value:i,children:n})}function S(){return C(y())?.strings??g}function A(){return C(y())?.locale??"en"}export{g as DEFAULT_EASEL_STRINGS,J as EaselStringsProvider,F as mergeEaselStrings,A as useEaselLocale,S as useEaselStrings};
1
+ import{DEFAULT_TEXT_STYLES_WORDS as o}from"../chunk-OGH6CC3E.js";import{DEFAULT_SCREEN_WORDS as r,DEFAULT_IMAGE_ROW_WORDS as n}from"../chunk-Q3VAJMXS.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"../chunk-6WY6ZXJG.js";import{DEFAULT_DRAG_WORDS as c}from"../chunk-TQ5Y6S2X.js";import{DEFAULT_CANVAS_WORDS as e}from"../chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as m}from"../chunk-K56YDHYQ.js";import{DEFAULT_COLOUR_ROW_WORDS as i,DEFAULT_PANEL_WORDS as s}from"../chunk-56ID6FKZ.js";import{DEFAULT_NODE_MENU_WORDS as u}from"../chunk-WK3AFPXY.js";import{DEFAULT_PAGE_COPY_WORDS as f}from"../chunk-CEC5XLN4.js";import{DEFAULT_SAVE_WORDS as p}from"../chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as l,DEFAULT_NOTICE_WORDS as h}from"../chunk-AJSDWWJW.js";import{DEFAULT_RAIL_WORDS as j}from"../chunk-2OAZYSWJ.js";import{DEFAULT_LOCK_WORDS as a}from"../chunk-RE4LP46F.js";import{DEFAULT_COPY_WORDS as k}from"../chunk-PMRN5Z3T.js";import{DEFAULT_FIELDS_WORDS as y}from"../chunk-JACEEVVF.js";import{stringsContext as Y}from"../chunk-MFIRYGHW.js";import{useContext as C,useMemo as W}from"react";import{jsx as d}from"react/jsx-runtime";var g={notice:h,lock:a,save:p,chrome:l,rail:j,tree:m,panel:s,fields:y,colourRow:i,imageRow:n,drag:c,menu:u,styleClipboard:t,copy:k,canvas:e,textStyles:o,screen:r,pageCopy:f},v=o=>"object"==typeof o&&null!==o;function D(o,r){const n={};for(const t of Object.keys(o)){const c=o[t],e=r[t];null==e?n[t]=c:v(c)?n[t]=v(e)?D(c,e):c:n[t]=typeof e==typeof c?e:c}return n}function F(o,r){return r?D(o,r):o}function J({value:o,locale:r,children:n}){const t=Y(),c=C(t),e=c?.strings??g,m=r??c?.locale??"en",i=W(()=>({strings:F(e,o),locale:m}),[e,o,m]);/* @__PURE__ */
2
+ return d(t.Provider,{value:i,children:n})}function S(){return C(Y())?.strings??g}function A(){return C(Y())?.locale??"en"}export{g as DEFAULT_EASEL_STRINGS,J as EaselStringsProvider,F as mergeEaselStrings,A as useEaselLocale,S as useEaselStrings};
@@ -1,37 +1,37 @@
1
- import{hexReadout as e,typedHex as s}from"../chunk-4FFDGEWA.js";import{DEFAULT_TEXT_STYLES_WORDS as t}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import{FieldSlider as a}from"../chunk-ZEH6QLBH.js";import{TEXT_STYLE_KINDS as l,canAddTextStyle as i,TEXT_STYLE_MAX as n,isDefaultTextStyle as r,CAMPAIGN_TEXT_STYLE_SETTINGS as o,TEXT_STYLE_SETTINGS as d,textStyleRowSize as c,describeTextStyle as u,updateTextStyle as m,textStyleCaseCss as h,TEXT_STYLE_CASES as p,addTextStyle as v,removeTextStyle as f,TEXT_STYLE_RANGES as y}from"../chunk-YHZSBL2N.js";export{CAMPAIGN_TEXT_STYLE_SETTINGS,TEXT_STYLE_CASES,TEXT_STYLE_CASE_CSS,TEXT_STYLE_DEFAULT_COUNT,TEXT_STYLE_KINDS,TEXT_STYLE_MAX,TEXT_STYLE_RANGES,TEXT_STYLE_SETTINGS,addTextStyle,canAddTextStyle,defaultTextStyles,describeTextStyle,isDefaultTextStyle,isTextStyleCase,removeTextStyle,resolveTextStyle,textStyleCaseCss,textStyleCaseOfCss,textStyleRowSize,updateTextStyle,weightWord}from"../chunk-YHZSBL2N.js";import{FieldSelect as g}from"../chunk-KFWNGPW3.js";import"../chunk-JACEEVVF.js";import{SettingsSegmented as S}from"../chunk-DX3VILZ3.js";import{useWords as b}from"../chunk-MFIRYGHW.js";import{withTip as N}from"../chunk-P2VEMZH5.js";import{hsvToHex as C,Tooltip as T,ColorSwatch as k,Popover as x,ColorPickerPanel as w,colorSwatchClasses as z,IconButton as E,Button as O}from"efficient-shell/ui";import{useId as _,useState as L,useRef as A,useEffect as j,Fragment as M}from"react";import{TrashIcon as $,ChevronIcon as W,BoldIcon as Y,ItalicIcon as X,CaseLowerIcon as F,CaseCapitalizedIcon as G,CaseUpperIcon as H,CaseNormalIcon as I}from"efficient-shell/icons/efficient";import{jsxs as P,jsx as B,Fragment as D}from"react/jsx-runtime";var R=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>C({h:e,s:1,v:1})).join(", ")})`;function V({value:s,hex:t,colours:a,label:l,followsWord:i,anyWord:n,onChange:r,readOnly:o=!1}){const d=void 0!==s&&a.some(e=>e.key===s),c=void 0!==s&&!d;/* @__PURE__ */
1
+ import{hexReadout as e,typedHex as s}from"../chunk-4FFDGEWA.js";import{DEFAULT_TEXT_STYLES_WORDS as t}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import{FieldSlider as a}from"../chunk-ZEH6QLBH.js";import{withTip as l}from"../chunk-P2VEMZH5.js";import{FieldSelect as i}from"../chunk-KFWNGPW3.js";import{SettingsSegmented as n}from"../chunk-DX3VILZ3.js";import"../chunk-JACEEVVF.js";import{useWords as r}from"../chunk-MFIRYGHW.js";import{TEXT_STYLE_KINDS as o,canAddTextStyle as d,TEXT_STYLE_MAX as c,isDefaultTextStyle as u,CAMPAIGN_TEXT_STYLE_SETTINGS as m,TEXT_STYLE_SETTINGS as h,textStyleRowSize as p,describeTextStyle as v,updateTextStyle as f,textStyleCaseCss as y,TEXT_STYLE_CASES as g,addTextStyle as S,removeTextStyle as b,TEXT_STYLE_RANGES as N}from"../chunk-YHZSBL2N.js";export{CAMPAIGN_TEXT_STYLE_SETTINGS,TEXT_STYLE_CASES,TEXT_STYLE_CASE_CSS,TEXT_STYLE_DEFAULT_COUNT,TEXT_STYLE_KINDS,TEXT_STYLE_MAX,TEXT_STYLE_RANGES,TEXT_STYLE_SETTINGS,addTextStyle,canAddTextStyle,defaultTextStyles,describeTextStyle,isDefaultTextStyle,isTextStyleCase,removeTextStyle,resolveTextStyle,textStyleCaseCss,textStyleCaseOfCss,textStyleRowSize,updateTextStyle,weightWord}from"../chunk-YHZSBL2N.js";import{hsvToHex as C,Tooltip as T,ColorSwatch as k,Popover as x,ColorPickerPanel as w,colorSwatchClasses as z,IconButton as E,Button as O}from"efficient-shell/ui";import{useId as _,useState as L,useRef as A,useEffect as j,Fragment as M}from"react";import{TrashIcon as $,ChevronIcon as W,BoldIcon as Y,ItalicIcon as X,CaseLowerIcon as F,CaseCapitalizedIcon as G,CaseUpperIcon as H,CaseNormalIcon as I}from"efficient-shell/icons/efficient";import{jsxs as P,jsx as B,Fragment as D}from"react/jsx-runtime";var R=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>C({h:e,s:1,v:1})).join(", ")})`;function V({value:s,hex:t,colours:a,label:l,followsWord:i,anyWord:n,onChange:r,readOnly:o=!1}){const d=void 0!==s&&a.some(e=>e.key===s),c=void 0!==s&&!d;/* @__PURE__ */
2
2
  return P("div",{className:"es-ts-set","data-ts-setting":"color",children:[
3
3
  /* @__PURE__ */P("div",{className:"es-ts-top",children:[
4
4
  /* @__PURE__ */B("span",{className:"es-ts-sub",children:l}),
5
5
  /* @__PURE__ */B("span",{className:"es-ts-colour-read",children:t?e(t):i})]}),
6
6
  /* @__PURE__ */P("div",{className:"es-ts-swatches",role:"group","aria-label":l,children:[a.map(t=>/* @__PURE__ */B(T,{content:`${t.name} · ${e(t.value)}`,children:/* @__PURE__ */B(k,{color:t.value,size:"sm",className:"es-ts-swatch","aria-label":t.name,selected:s===t.key,disabled:o,onClick:()=>r(t.key)})},t.key)),
7
- /* @__PURE__ */B(T,{content:n,children:/* @__PURE__ */B(x,{trigger:/* @__PURE__ */B("span",{"aria-hidden":"true",className:"absolute inset-0",style:{background:R}}),triggerLabel:n,triggerClassName:z({size:"sm",selected:c,className:"es-ts-swatch es-ts-swatch--any"}),"aria-label":l,disabled:o,children:/* @__PURE__ */B(w,{className:"es-pick-window",value:t??"",onChange:e=>r(e),label:l,disabled:o})})})]})]})}function Z({styles:e,onChange:s,fonts:a,colours:d=[],settings:c=o,auto:u=[],fallback:m,sample:h,openId:p,defaultOpenId:y=null,onOpenChange:g,onAdd:S,rowActions:C,onRemove:T,max:k=n,device:x="desktop",readOnly:w=!1}){const z=b("textStyles",t),M=_(),[W,Y]=L(y),X=void 0!==p?p:W,F=e=>{void 0===p&&Y(e),g?.(e)},G=A(null),[H,I]=L(null);j(()=>{if(!H||!G.current)return;const e=[...G.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===H.id),s=e?e.querySelector(".es-ts-row"):G.current.querySelector(`.es-ts-add[data-ts-kind="${H.kind}"]`);s?.focus(),I(null)},[H]);/* @__PURE__ */
8
- return B("div",{className:"es-ts",ref:G,children:l.map(t=>{const l=e.filter(e=>e.kind===t),n=!i(e,t,k),o=!w&&!n;/* @__PURE__ */
9
- return P(q,{label:z.groups[t],children:[l.map(t=>{const l=C?.(t),i=null!=l&&!1!==l,n=Boolean(T)&&!w&&!r(t);/* @__PURE__ */
10
- return B(U,{style:t,fonts:a,colours:d,settings:c,auto:u,fallback:m,sample:h,device:x,readOnly:w,open:X===t.id,onOpenChange:e=>F(e?t.id:null),onChange:t=>s(e.map(e=>e.id===t.id?t:e)),actions:n||i?/* @__PURE__ */P(D,{children:[n?N(z.remove,/* @__PURE__ */B(E,{variant:"ghost-danger",size:"sm",className:"es-ts-del","aria-label":z.removeNamed({name:t.name}),onClick:()=>(t=>{if(w||!T)return;const a=f(e,t.id,{name:z.styleName});if(!a)return;const l=e.filter(e=>e.kind===t.kind),i=l[l.indexOf(t)+1];X===t.id&&F(null),s(a.styles),T(a.removed),I({id:i?.id??null,kind:t.kind})})(t),children:/* @__PURE__ */B($,{size:14,"aria-hidden":"true"})})):null,i?l:null]}):null},t.id)}),N(!w&&n?z.full({kind:t,max:k}):void 0,/* @__PURE__ */P(O,{variant:"link",className:"es-ts-add","data-ts-kind":t,disabled:w,"aria-disabled":!(w||!n)||void 0,"aria-describedby":!w&&n?`${M}-full-${t}`:void 0,onClick:()=>{o&&(t=>{if(w)return;const a=v(e,t,{max:k,name:z.styleName,make:S});a&&s(a.styles)})(t)},children:[
7
+ /* @__PURE__ */B(T,{content:n,children:/* @__PURE__ */B(x,{trigger:/* @__PURE__ */B("span",{"aria-hidden":"true",className:"absolute inset-0",style:{background:R}}),triggerLabel:n,triggerClassName:z({size:"sm",selected:c,className:"es-ts-swatch es-ts-swatch--any"}),"aria-label":l,disabled:o,children:/* @__PURE__ */B(w,{className:"es-pick-window",value:t??"",onChange:e=>r(e),label:l,disabled:o})})})]})]})}function Z({styles:e,onChange:s,fonts:a,colours:i=[],settings:n=m,auto:h=[],fallback:p,sample:v,openId:f,defaultOpenId:y=null,onOpenChange:g,onAdd:N,rowActions:C,onRemove:T,max:k=c,device:x="desktop",readOnly:w=!1}){const z=r("textStyles",t),M=_(),[W,Y]=L(y),X=void 0!==f?f:W,F=e=>{void 0===f&&Y(e),g?.(e)},G=A(null),[H,I]=L(null);j(()=>{if(!H||!G.current)return;const e=[...G.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===H.id),s=e?e.querySelector(".es-ts-row"):G.current.querySelector(`.es-ts-add[data-ts-kind="${H.kind}"]`);s?.focus(),I(null)},[H]);/* @__PURE__ */
8
+ return B("div",{className:"es-ts",ref:G,children:o.map(t=>{const r=e.filter(e=>e.kind===t),o=!d(e,t,k),c=!w&&!o;/* @__PURE__ */
9
+ return P(q,{label:z.groups[t],children:[r.map(t=>{const r=C?.(t),o=null!=r&&!1!==r,d=Boolean(T)&&!w&&!u(t);/* @__PURE__ */
10
+ return B(U,{style:t,fonts:a,colours:i,settings:n,auto:h,fallback:p,sample:v,device:x,readOnly:w,open:X===t.id,onOpenChange:e=>F(e?t.id:null),onChange:t=>s(e.map(e=>e.id===t.id?t:e)),actions:d||o?/* @__PURE__ */P(D,{children:[d?l(z.remove,/* @__PURE__ */B(E,{variant:"ghost-danger",size:"sm",className:"es-ts-del","aria-label":z.removeNamed({name:t.name}),onClick:()=>(t=>{if(w||!T)return;const a=b(e,t.id,{name:z.styleName});if(!a)return;const l=e.filter(e=>e.kind===t.kind),i=l[l.indexOf(t)+1];X===t.id&&F(null),s(a.styles),T(a.removed),I({id:i?.id??null,kind:t.kind})})(t),children:/* @__PURE__ */B($,{size:14,"aria-hidden":"true"})})):null,o?r:null]}):null},t.id)}),l(!w&&o?z.full({kind:t,max:k}):void 0,/* @__PURE__ */P(O,{variant:"link",className:"es-ts-add","data-ts-kind":t,disabled:w,"aria-disabled":!(w||!o)||void 0,"aria-describedby":!w&&o?`${M}-full-${t}`:void 0,onClick:()=>{c&&(t=>{if(w)return;const a=S(e,t,{max:k,name:z.styleName,make:N});a&&s(a.styles)})(t)},children:[
11
11
  /* @__PURE__ */B("span",{className:"es-ts-add-word",children:z.add[t]}),
12
- /* @__PURE__ */B("span",{className:"es-ts-count",children:z.count({n:l.length,max:k})})]})),w||!n?null:/* @__PURE__ */B("span",{id:`${M}-full-${t}`,className:"es-vh",children:z.full({kind:t,max:k})})]},t)})})}function q({label:e,children:s}){const t=_();/* @__PURE__ */
12
+ /* @__PURE__ */B("span",{className:"es-ts-count",children:z.count({n:r.length,max:k})})]})),w||!o?null:/* @__PURE__ */B("span",{id:`${M}-full-${t}`,className:"es-vh",children:z.full({kind:t,max:k})})]},t)})})}function q({label:e,children:s}){const t=_();/* @__PURE__ */
13
13
  return P("section",{className:"es-ts-section","aria-labelledby":t,children:[
14
- /* @__PURE__ */B("div",{className:"es-ts-group",id:t,children:e}),s]})}function U({style:e,fonts:s,colours:a=[],settings:l=o,auto:i=[],fallback:n,sample:r,open:h,onOpenChange:p,onChange:v,actions:f,device:y="desktop",readOnly:g=!1}){const S=b("textStyles",t),N=`${_()}-open-${e.id}`,C=new Set(i),T=d.filter(e=>l.includes(e)),k={...n?.(e)??{},...e.values},x="phone"===y,w=x&&void 0!==e.values.sizePhone?{...k,size:e.values.sizePhone}:k,z=s.find(e=>e.value===k.font),E={fontFamily:z?.family,fontSize:`${c(w.size??16)}px`,fontWeight:k.weight,fontStyle:k.italic?"italic":void 0};/* @__PURE__ */
14
+ /* @__PURE__ */B("div",{className:"es-ts-group",id:t,children:e}),s]})}function U({style:e,fonts:s,colours:a=[],settings:l=m,auto:i=[],fallback:n,sample:o,open:d,onOpenChange:c,onChange:u,actions:y,device:g="desktop",readOnly:S=!1}){const b=r("textStyles",t),N=`${_()}-open-${e.id}`,C=new Set(i),T=h.filter(e=>l.includes(e)),k={...n?.(e)??{},...e.values},x="phone"===g,w=x&&void 0!==e.values.sizePhone?{...k,size:e.values.sizePhone}:k,z=s.find(e=>e.value===k.font),E={fontFamily:z?.family,fontSize:`${p(w.size??16)}px`,fontWeight:k.weight,fontStyle:k.italic?"italic":void 0};/* @__PURE__ */
15
15
  return P(M,{children:[
16
16
  /* @__PURE__ */P("div",{className:"es-ts-item","data-ts-id":e.id,children:[
17
- /* @__PURE__ */P("button",{type:"button",className:"es-ts-row","aria-expanded":h,"aria-controls":h?N:void 0,onClick:()=>p(!h),children:[
17
+ /* @__PURE__ */P("button",{type:"button",className:"es-ts-row","aria-expanded":d,"aria-controls":d?N:void 0,onClick:()=>c(!d),children:[
18
18
  /* @__PURE__ */B("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */B(W,{size:12})}),
19
19
  /* @__PURE__ */B("span",{className:"es-ts-name",style:E,children:e.name}),
20
- /* @__PURE__ */B("span",{className:"es-ts-meta",children:u(w,s,S,{autoSize:C.has("size")&&w===k&&void 0===e.values.size})})]}),f?/* @__PURE__ */B("div",{className:"es-ts-actions",children:f}):null]}),h?/* @__PURE__ */B("div",{className:"es-ts-open",id:N,children:/* @__PURE__ */B(J,{style:e,values:k,fonts:s,colours:a,settings:T,autoSet:C,sample:r??S.sample,words:S,phone:x,readOnly:g,set:s=>v(m([e],e.id,s)[0])})}):null]})}var K={none:I,upper:H,capitalize:G,lower:F};function J({style:e,values:t,fonts:l,colours:i,settings:n,autoSet:r,sample:o,words:d,phone:c,readOnly:u,set:m}){const p=e.values,v=l.find(e=>e.value===t.font),f=function(e,t){return e?t.find(s=>s.key===e)?.value??s(e)??void 0:void 0}(t.color,i),g=e=>"largestSize"===e||r.has(e),S=e=>g(e)?p[e]:t[e],b=S("size"),C=c&&void 0!==p.sizePhone?p.sizePhone:b,T=S("lineSpacing"),k=S("letterSpacing"),x=g("letterCase")?p.letterCase:t.letterCase,w={fontFamily:v?.family,fontSize:void 0===C?void 0:`${C}px`,fontWeight:t.weight,fontStyle:t.italic?"italic":void 0,lineHeight:void 0===T?void 0:String(T/100),letterSpacing:void 0===k?void 0:`${k}px`,color:f,textTransform:h(x)},z=e=>{const s=y[e],l=g(e);/* @__PURE__ */
21
- return B("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */B(a,{label:d.settings[e],value:p[e],onChange:s=>m({[e]:s}),min:s.min,max:s.max,step:s.step,shiftStep:s.shiftStep,sliderMin:s.sliderMin,sliderMax:s.sliderMax,unit:s.unit||void 0,styleValue:l?void 0:t[e],auto:l?d.auto:void 0,readOnly:u})},e)};/* @__PURE__ */
20
+ /* @__PURE__ */B("span",{className:"es-ts-meta",children:v(w,s,b,{autoSize:C.has("size")&&w===k&&void 0===e.values.size})})]}),y?/* @__PURE__ */B("div",{className:"es-ts-actions",children:y}):null]}),d?/* @__PURE__ */B("div",{className:"es-ts-open",id:N,children:/* @__PURE__ */B(J,{style:e,values:k,fonts:s,colours:a,settings:T,autoSet:C,sample:o??b.sample,words:b,phone:x,readOnly:S,set:s=>u(f([e],e.id,s)[0])})}):null]})}var K={none:I,upper:H,capitalize:G,lower:F};function J({style:e,values:t,fonts:i,colours:n,settings:r,autoSet:o,sample:d,words:c,phone:u,readOnly:m,set:h}){const p=e.values,v=i.find(e=>e.value===t.font),f=function(e,t){return e?t.find(s=>s.key===e)?.value??s(e)??void 0:void 0}(t.color,n),g=e=>"largestSize"===e||o.has(e),S=e=>g(e)?p[e]:t[e],b=S("size"),C=u&&void 0!==p.sizePhone?p.sizePhone:b,T=S("lineSpacing"),k=S("letterSpacing"),x=g("letterCase")?p.letterCase:t.letterCase,w={fontFamily:v?.family,fontSize:void 0===C?void 0:`${C}px`,fontWeight:t.weight,fontStyle:t.italic?"italic":void 0,lineHeight:void 0===T?void 0:String(T/100),letterSpacing:void 0===k?void 0:`${k}px`,color:f,textTransform:y(x)},z=e=>{const s=N[e],l=g(e);/* @__PURE__ */
21
+ return B("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */B(a,{label:c.settings[e],value:p[e],onChange:s=>h({[e]:s}),min:s.min,max:s.max,step:s.step,shiftStep:s.shiftStep,sliderMin:s.sliderMin,sliderMax:s.sliderMax,unit:s.unit||void 0,styleValue:l?void 0:t[e],auto:l?c.auto:void 0,readOnly:m})},e)};/* @__PURE__ */
22
22
  return P(D,{children:[
23
- /* @__PURE__ */B("div",{className:"es-ts-preview",style:w,"aria-label":d.preview,children:o}),n.map(s=>{switch(s){case"font":/* @__PURE__ */
24
- return B(Q,{value:p.font,fonts:l,words:d,readOnly:u,set:m},s);case"color":/* @__PURE__ */
25
- return B(ee,{value:p.color,hex:f,colours:i,words:d,readOnly:u,set:m},s);case"emphasis":{const e=(t.weight??400)>=600,a=!1!==v?.italic;/* @__PURE__ */
23
+ /* @__PURE__ */B("div",{className:"es-ts-preview",style:w,"aria-label":c.preview,children:d}),r.map(s=>{switch(s){case"font":/* @__PURE__ */
24
+ return B(Q,{value:p.font,fonts:i,words:c,readOnly:m,set:h},s);case"color":/* @__PURE__ */
25
+ return B(ee,{value:p.color,hex:f,colours:n,words:c,readOnly:m,set:h},s);case"emphasis":{const e=(t.weight??400)>=600,a=!1!==v?.italic;/* @__PURE__ */
26
26
  return P("div",{className:"es-ts-set","data-ts-setting":s,children:[
27
- /* @__PURE__ */B("span",{className:"es-ts-sub",children:d.settings.emphasis}),
28
- /* @__PURE__ */P("div",{className:"es-ts-icons",children:[N(d.bold,/* @__PURE__ */B(E,{className:"es-ts-icon","aria-label":d.bold,"aria-pressed":e,disabled:u,onClick:()=>m({weight:e?400:700}),children:/* @__PURE__ */B(Y,{size:16})})),u||a?N(d.italic,/* @__PURE__ */B(E,{className:"es-ts-icon","aria-label":d.italic,"aria-pressed":Boolean(t.italic),disabled:u,onClick:()=>m({italic:!t.italic||void 0}),children:/* @__PURE__ */B(X,{size:16})})):/* @__PURE__ */B(E,{className:"es-ts-icon","aria-label":d.italic,"aria-pressed":Boolean(t.italic),"aria-disabled":!0,disabledReason:d.italicMissing,children:/* @__PURE__ */B(X,{size:16})})]})]},s)}case"letterCase":/* @__PURE__ */
29
- return B(se,{value:p.letterCase??t.letterCase,auto:g("letterCase"),words:d,readOnly:u,set:m},s);case"largestSize":return"heading"===e.kind?z(s):null;case"size":return c?(()=>{const e=y.size;/* @__PURE__ */
30
- return B("div",{className:"es-ts-slider","data-ts-setting":"size","data-ts-device":"phone",children:/* @__PURE__ */B(a,{label:d.settings.size,value:p.sizePhone,onChange:e=>m({sizePhone:e}),min:e.min,max:e.max,step:e.step,shiftStep:e.shiftStep,sliderMin:e.sliderMin,sliderMax:e.sliderMax,unit:e.unit||void 0,styleValue:b,readOnly:u})},"size")})():z(s);default:return z(s)}})]})}function Q({value:e,fonts:s,words:t,readOnly:a,set:l}){const i=_();/* @__PURE__ */
27
+ /* @__PURE__ */B("span",{className:"es-ts-sub",children:c.settings.emphasis}),
28
+ /* @__PURE__ */P("div",{className:"es-ts-icons",children:[l(c.bold,/* @__PURE__ */B(E,{className:"es-ts-icon","aria-label":c.bold,"aria-pressed":e,disabled:m,onClick:()=>h({weight:e?400:700}),children:/* @__PURE__ */B(Y,{size:16})})),m||a?l(c.italic,/* @__PURE__ */B(E,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(t.italic),disabled:m,onClick:()=>h({italic:!t.italic||void 0}),children:/* @__PURE__ */B(X,{size:16})})):/* @__PURE__ */B(E,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(t.italic),"aria-disabled":!0,disabledReason:c.italicMissing,children:/* @__PURE__ */B(X,{size:16})})]})]},s)}case"letterCase":/* @__PURE__ */
29
+ return B(se,{value:p.letterCase??t.letterCase,auto:g("letterCase"),words:c,readOnly:m,set:h},s);case"largestSize":return"heading"===e.kind?z(s):null;case"size":return u?(()=>{const e=N.size;/* @__PURE__ */
30
+ return B("div",{className:"es-ts-slider","data-ts-setting":"size","data-ts-device":"phone",children:/* @__PURE__ */B(a,{label:c.settings.size,value:p.sizePhone,onChange:e=>h({sizePhone:e}),min:e.min,max:e.max,step:e.step,shiftStep:e.shiftStep,sliderMin:e.sliderMin,sliderMax:e.sliderMax,unit:e.unit||void 0,styleValue:b,readOnly:m})},"size")})():z(s);default:return z(s)}})]})}function Q({value:e,fonts:s,words:t,readOnly:a,set:l}){const n=_();/* @__PURE__ */
31
31
  return P("div",{className:"es-ts-set","data-ts-setting":"font",children:[
32
- /* @__PURE__ */B("span",{className:"es-ts-sub",id:i,children:t.settings.font}),
33
- /* @__PURE__ */B(g,{value:e,options:s.map(e=>({label:e.label,value:e.value})),onChange:e=>l({font:e}),ariaLabelledBy:i,readOnly:a})]})}function ee({value:e,hex:s,colours:t,words:a,readOnly:l,set:i}){/* @__PURE__ */
34
- return B(V,{value:e,hex:s,colours:t,label:a.settings.color,followsWord:a.colour.follows,anyWord:a.colour.any,readOnly:l,onChange:e=>i({color:e})})}function se({value:e,auto:s,words:t,readOnly:a,set:l}){const i=p.map(e=>{const s=K[e];return{id:e,label:/* @__PURE__ */B(s,{size:16}),title:t.case[e]}}),n=s?[{id:"auto",label:/* @__PURE__ */B("span",{children:t.case.auto}),title:t.case.autoTitle},...i]:i;/* @__PURE__ */
32
+ /* @__PURE__ */B("span",{className:"es-ts-sub",id:n,children:t.settings.font}),
33
+ /* @__PURE__ */B(i,{value:e,options:s.map(e=>({label:e.label,value:e.value})),onChange:e=>l({font:e}),ariaLabelledBy:n,readOnly:a})]})}function ee({value:e,hex:s,colours:t,words:a,readOnly:l,set:i}){/* @__PURE__ */
34
+ return B(V,{value:e,hex:s,colours:t,label:a.settings.color,followsWord:a.colour.follows,anyWord:a.colour.any,readOnly:l,onChange:e=>i({color:e})})}function se({value:e,auto:s,words:t,readOnly:a,set:l}){const i=g.map(e=>{const s=K[e];return{id:e,label:/* @__PURE__ */B(s,{size:16}),title:t.case[e]}}),r=s?[{id:"auto",label:/* @__PURE__ */B("span",{children:t.case.auto}),title:t.case.autoTitle},...i]:i;/* @__PURE__ */
35
35
  return P("div",{className:"es-ts-set","data-ts-setting":"letterCase",children:[
36
36
  /* @__PURE__ */B("span",{className:"es-ts-sub",children:t.settings.letterCase}),
37
- /* @__PURE__ */B(S,{options:n,value:e??(s?"auto":"none"),ariaLabel:t.settings.letterCase,disabled:a,onChange:e=>l({letterCase:"auto"===e?void 0:e})})]})}export{V as ColourSwatchRow,U as TextStyleItem,q as TextStylesGroup,Z as TextStylesList};
37
+ /* @__PURE__ */B(n,{options:r,value:e??(s?"auto":"none"),ariaLabel:t.settings.letterCase,disabled:a,onChange:e=>l({letterCase:"auto"===e?void 0:e})})]})}export{V as ColourSwatchRow,U as TextStyleItem,q as TextStylesGroup,Z as TextStylesList};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-easel",
3
- "version": "26.7.0",
3
+ "version": "26.9.0",
4
4
  "description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Efficient Pty Ltd",
@@ -35,7 +35,8 @@
35
35
  "./screen/lib/content/style-keys",
36
36
  "./screen/lib/document/content-tree",
37
37
  "./screen/lib/document/hidable",
38
- "./screen/lib/document/slot-child-name"
38
+ "./screen/lib/document/slot-child-name",
39
+ "./screen/lib/document/shadow-values"
39
40
  ],
40
41
  "editor": [
41
42
  "./rail",
@@ -106,6 +107,7 @@
106
107
  "./screen/lib/document/field-buckets",
107
108
  "./screen/lib/document/field-markers",
108
109
  "./screen/lib/document/image-fields",
110
+ "./screen/lib/document/shadow-fields",
109
111
  "./screen/lib/document/palette-sections",
110
112
  "./screen/lib/document/panel-fields",
111
113
  "./screen/lib/document/panel-no-control-mark",
@@ -481,6 +483,16 @@
481
483
  "import": "./dist/screen/lib/document/image-fields.js",
482
484
  "default": "./dist/screen/lib/document/image-fields.js"
483
485
  },
486
+ "./screen/lib/document/shadow-fields": {
487
+ "types": "./dist/screen/lib/document/shadow-fields.d.ts",
488
+ "import": "./dist/screen/lib/document/shadow-fields.js",
489
+ "default": "./dist/screen/lib/document/shadow-fields.js"
490
+ },
491
+ "./screen/lib/document/shadow-values": {
492
+ "types": "./dist/screen/lib/document/shadow-values.d.ts",
493
+ "import": "./dist/screen/lib/document/shadow-values.js",
494
+ "default": "./dist/screen/lib/document/shadow-values.js"
495
+ },
484
496
  "./screen/lib/document/device-fields": {
485
497
  "types": "./dist/screen/lib/document/device-fields.d.ts",
486
498
  "import": "./dist/screen/lib/document/device-fields.js",
@@ -1,8 +0,0 @@
1
- import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-GDO4QJ4G.js";import{blockTypesIn as o}from"./chunk-IZGFJWH4.js";import{sectionTemplatesOf as r}from"./chunk-N7E6264U.js";import{sharedSectionsOf as l}from"./chunk-N3MJOHAG.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-SBVIW3KJ.js";import{blockRuns as c}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as a,useScreenBlockRules as p,useScreenPinned as d}from"./chunk-OXKGD2K7.js";import{useEaselSession as m}from"./chunk-YM4UEGBV.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-Q3VAJMXS.js";import{useEasel as u}from"./chunk-OB5JP6PR.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-SQTVXE5D.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-TQ5Y6S2X.js";import{useState as b,useEffect as v,useMemo as j,useRef as w}from"react";import{SharedIcon as O,AddIcon as C}from"efficient-shell/icons/efficient";import{ContextMenu as I,toast as $,Dialog as E,Button as S}from"efficient-shell/ui";import{jsx as x,jsxs as F,Fragment as G}from"react/jsx-runtime";function M({name:e,pages:t,onDelete:n,onCancel:o}){const r=h("screen",f).shared,[l,i]=b(!1),s=w(null);/* @__PURE__ */
2
- return x(E,{open:!0,role:"alertdialog",size:"sm",title:r.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */F(G,{children:[
3
- /* @__PURE__ */x(S,{ref:s,variant:"secondary",onClick:o,children:r.cancel}),
4
- /* @__PURE__ */x(S,{variant:"danger",loading:l,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:r.deleteShared})]}),children:r.deleteMessage({count:t})})}var Q=e=>`section:${e}`,T=e=>`block:${e}`,B=e=>`template:${e}`,D=e=>`shared:${e}`,J=e=>`preset:${e}`;function W({at:w,placeBlocks:E,canTake:S,onPick:W,itemFor:A,session:H,siteWide:V,onClose:z,onHide:L,readOnly:N}){const P=u(e=>e.config),R=a(),{labelAtLevel:U,categoryLabel:X,firstSection:K,Icon:Y,Thumbnail:_}=R,{blockIsOffered:Z,canAddTo:q}=p(),ee=h("screen",f).add,te=h("drag",g).add,ne=m(),[oe,re]=b([]);v(()=>{let e=!1;const t=e=>Z(e,ne);return r(ne).list().then(n=>{if(e)return;const r=P.components;re(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[P,ne]);const le=d().shared,ie=h("screen",f).shared,[se,ce]=b([]),[ae,pe]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>Z(e,ne);return l(ne).list().then(n=>{if(e)return;const r=P.components;ce(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[P,ne,ae]);const[de,me]=b(null),[fe,ue]=b(null),ye=j(()=>e(P,R),[P]),he=e=>U(e,"section",P.components[e]?.label??e),ke=e=>({type:e.preset?J(e.preset.key):Q(e.type),label:e.name,cover:/* @__PURE__ */x(_,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:ee.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ge=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=oe.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=se.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}if("preset"===n){const e=ye.find(e=>e.preset?.key===o)?.preset;return e?{kind:"preset",preset:e}:null}return null},be=e=>/* @__PURE__ */x("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */x(Y,{type:e,size:26})}),ve=j(()=>{const e=t(ye,K),o=/* @__PURE__ */new Map,r=e=>{e.retired||o.has(e.type)||!Z(e.type,ne)||o.set(e.type,e)};for(const t of e?[e]:ye.filter(e=>!e.preset)){const e=q(t.type)?.choices??[];e.forEach(r),e.forEach(e=>q(e.type,1)?.choices?.forEach(r))}E?.forEach(r);const l=new Set(ye.filter(e=>!e.preset).map(e=>e.type)),i=[...o.values()].filter(e=>!l.has(e.type)),s=e=>({type:T(e.type),label:e.label,cover:be(e.type),title:ee.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>!e.preset&&o.has(e.type)?{...ke(e),cover:be(e.type)}:ke(e),p=[];se.length>0&&p.push({key:"shared",title:ie.group,tiles:se.map(e=>({type:D(e.id),label:e.title,cover:/* @__PURE__ */x(_,{type:e.node.type}),mark:/* @__PURE__ */x(O,{size:12}),title:ie.onPages({count:e.used_on.length}),keywords:[he(e.node.type),e.node.type]}))}),oe.length>0&&p.push({key:"templates",title:ee.templates,tiles:oe.map(e=>({type:B(e.id),label:e.name,cover:/* @__PURE__ */x(_,{type:e.node.type}),keywords:[he(e.node.type),e.node.type]}))});const d=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(P.categories??{})){const o=ye.filter(e=>e.cat===t);if(0===o.length)continue;const r=e&&o.some(t=>t.type===e.type)?e:null,l=(r?[r,...o.filter(e=>e.type!==r.type)]:o).map(a);r&&!m&&(l.splice(1,0,...d.map(s)),m=!0),p.push({key:`category:${t}`,title:n(P,t,X),tiles:l})}const f=p.find(e=>e.key?.startsWith("category:"));if(!m&&f&&d.length>0&&(f.tiles=[...f.tiles,...d.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!S)return p;const u=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ge(e.type),n=t?S(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),y=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(y),...u.filter(e=>!y(e))]},[oe,se,ie,ye,P,ee,S,E,ne]);/* @__PURE__ */
5
- return F(G,{children:[
6
- /* @__PURE__ */x(i,{icon:/* @__PURE__ */x(C,{size:15}),title:ee.title,context:ee.contextAll,actions:/* @__PURE__ */x(s,{label:ee.done,description:ee.doneDescription,onClick:z}),onHide:L}),
7
- /* @__PURE__ */F("div",{className:"sf-addside sf-scroll",children:[
8
- /* @__PURE__ */x(k,{groups:ve,session:H,itemFor:e=>A(ge(e)??{kind:"section",type:e}),onInsert:W?e=>{const t=ge(e);t&&W(t)}:void 0,onTileMenu:(e,t)=>{const n=ge(e);return"shared"===n?.kind&&!N&&(me({section:n.section,...t}),!0)},at:w,hint:ee.hint,searchLabel:ee.search,readOnly:N,words:te}),V??null]}),de?/* @__PURE__ */x(I,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>me(null),"aria-label":de.section.title,items:y([{label:ie.deleteShared,danger:!0,onClick:()=>{ue(de.section),me(null)}}])}):null,fe?/* @__PURE__ */x(M,{name:fe.title,pages:fe.used_on.length,onDelete:()=>(async e=>{try{await l(ne).remove(e.id)}catch{return void $.error(ie.deleteFailed)}ue(null),le?.removed?.(e),ce(t=>t.filter(t=>t.id!==e.id)),pe(e=>e+1)})(fe),onCancel:()=>ue(null)}):null]})}export{W as AddSidePanel,T as blockKey,J as presetKey,Q as sectionKey,D as sharedKey,B as templateKey};
@@ -1,14 +0,0 @@
1
- import{deviceField as e}from"./chunk-7GGNFLHT.js";import{noControlField as n,NoControlMark as t}from"./chunk-22I55W37.js";import{describedAs as l}from"./chunk-LX23TCTP.js";import{withStyleKind as o}from"./chunk-CWELHADJ.js";import{phoneKey as a}from"./chunk-E52W3M5I.js";import{foldMetaOf as i,FOLD_FIELD_MARKER as r}from"./chunk-ANPOR6EY.js";import{useSelectedHost as s,useEaselApi as u,useEasel as c}from"./chunk-OB5JP6PR.js";import{sidesStartEach as d,SidesInput as p,SidesEachToggle as f}from"./chunk-CLAADE4J.js";import{SettingsDefaultReset as b}from"./chunk-2T22IY3J.js";import{DEFAULT_PANEL_WORDS as m}from"./chunk-56ID6FKZ.js";import{FieldSelect as h}from"./chunk-KFWNGPW3.js";import{SettingsSwitch as v}from"./chunk-OECWLNKJ.js";import{SettingsField as g}from"./chunk-MIX7EGRG.js";import{SettingsSegmented as y}from"./chunk-DX3VILZ3.js";import{useWords as k}from"./chunk-MFIRYGHW.js";import{useState as w}from"react";import{AlignmentIcon as x,BoxJustifyIcon as C,WrapIcon as j,GapIcon as F,WidthIcon as L,PlacementIcon as O,NudgeIcon as S,DesktopIcon as P,BoxXEndIcon as E,BoxXCenterIcon as R,BoxXStartIcon as I,PaddingAllIcon as A,BoxYBetweenIcon as M,BoxYStretchIcon as B,BoxYEndIcon as K,BoxYCenterIcon as W,BoxYStartIcon as G,BoxXBetweenIcon as N,BoxXStretchIcon as T,BoxItemAlignmentIcon as V}from"efficient-shell/icons/efficient";import{textAlignOptions as $,AlignmentGrid as J,PositionInput as D,Slider as H}from"efficient-shell/ui";import{jsx as _,Fragment as X,jsxs as Y}from"react/jsx-runtime";var z=e=>e;function Z(e,n){return e("{value} on desktop").replace("{value}",n)}var U=()=>{};function q(){return null}function Q(e){if(!e.trim())throw new Error("noGlyph() needs a reason naming the ruling that decided it.");/* @__PURE__ */
2
- return _(q,{},e)}function ee(e){return e.type===q}function ne(e){return ee(e)?void 0:e}function te(e){for(const[n,t]of Object.entries(e))t&&"object"==typeof t&&!i(t)&&o(t,`section:${n}`);return e}function le(e,n){return{type:"custom",[r]:{label:e,level:n},marker:!0,fold:e,render:()=>/* @__PURE__ */_(X,{})}}function oe(e){return le(e,2)}function ae(e){return le(e,1)}var ie=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"Space between",value:"between"},{label:"End",value:"end"}],re=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"End",value:"end"},{label:"Stretch",value:"stretch"}],se="Wrap",ue=[{label:"Wrap",value:"wrap"},{label:"No wrap",value:"nowrap"}],ce="Direction",de=[{label:"Stacked",value:"column"},{label:"One row",value:"row"}],pe={min:-32,max:64,step:2,builtIn:0},fe={min:30,max:100,step:5,fallback:60},be=["top-left","top-center","top-right","left","center","right","bottom-left","bottom-center","bottom-right"],me="bottom-left",he={"top-left":"Top left","top-center":"Top center","top-right":"Top right",left:"Left",center:"Center",right:"Right","bottom-left":"Bottom left","bottom-center":"Bottom center","bottom-right":"Bottom right"},ve=be.map(e=>({value:e,label:he[e]}));function ge(e,n=me){return be.includes(e)?e:n}var ye=40,ke=e=>"number"==typeof e?e:null;function we(e,n,t){const l={};for(const o of["x","y"])t[o]!==n[o]&&(l[e[o]]=t[o]??void 0);return l}var xe=["top","right","bottom","left"],Ce={top:"sectionPaddingTop",right:"sectionPaddingRight",bottom:"sectionPaddingBottom",left:"sectionPaddingLeft"},je=e=>"number"==typeof e?e:null;function Fe(e,n,t){const l={};for(const o of xe)t[o]!==n[o]&&(l[e[o]]=t[o]??void 0);return l}function Le(e){if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const n=e&&"object"==typeof e?e:{};return Object.fromEntries(xe.map(e=>[e,je(n[e])]))}function Oe(e){const n={};for(const t of xe)"number"==typeof e[t]&&(n[t]=e[t]);return Object.keys(n).length?n:void 0}function Se(e,n={}){const t=n=>{const t=n[e];return t&&"object"==typeof t?t:{}},l=e=>Object.hasOwn(n,e)?n[e]:e;return{read:(e,n)=>t(e)[l(n)],write:(n,o,a)=>{const i={...t(n)};return void 0===a?delete i[l(o)]:i[l(o)]=a,{[e]:Object.keys(i).length?i:void 0}}}}function Pe(e,n,t){const l=Ee(e),o=s();if(t)return[t.value,t.onChange];const a=o?.values??{};return[e.read(a,n),e=>l([[n,e]])]}function Ee(e){const n=s(),t=function(){try{return u()}catch{return null}}();return l=>{if(!n)return;const o=t?.getState(),a=(o?"root"===n.id?o.appState.data.root.props:o.getItemById(n.id)?.props:void 0)??n.values??{};let i={};for(const[n,t]of l)i={...i,...e.write({...a,...i},n,t)};n.onChangeMany(i)}}var Re={read:(e,n)=>e[n],write:(e,n,t)=>({[n]:t})},Ie={fieldKey:a,ownField:!0,read:(e,n)=>e[a(n)],write:(e,n,t)=>({[a(n)]:t})};function Ae(e){return{...Se(e),fieldKey:n=>`_${e}_${n}`}}function Me({row:e,desktopKey:n,access:t,props:l}){const o=s(),a=o?.values?.[n],[i,r]=Pe(t,n);return t.ownField?e.render({...l,follows:a,twinAccess:t}):e.render({...l,value:i,storedValue:i,follows:a,twinAccess:t,onChange:r})}function Be(n,t,l=Ie,o={}){const a=o.phoneRow??t,i={...a,render:e=>/* @__PURE__ */_(Me,{row:a,desktopKey:n,access:l,props:e})};return{[n]:e("desktop",t),[l.fieldKey(n)]:e("mobile",i)}}var Ke=["left","center","right"];function We(e,{options:n,value:t,onChange:l,ariaLabel:o,disabled:a=!1}){/* @__PURE__ */
3
- return _(y,{options:n.map(n=>n.picture?{id:n.value,label:n.picture,title:e(n.title??n.label)}:{id:n.value,label:e(n.label),title:void 0===n.title?void 0:e(n.title)}),value:t,onChange:l,ariaLabel:e(o),disabled:a})}function Ge(e,{label:n,value:t,onChange:l,points:o}){const a=o.find(e=>e.disabled),i=o.map(n=>({...n,label:e(n.label),...n.title?{title:e(n.title)}:null}));/* @__PURE__ */
4
- return _(g,{label:e(n),icon:/* @__PURE__ */_(O,{}),hint:a?.title?e(a.title):void 0,children:/* @__PURE__ */_(J,{label:e(n),value:t,points:i,onChange:l})})}function Ne({say:e,label:n,value:t,onChange:l,pointsFor:o}){const{appState:a,selectedItem:i}=c(e=>e),r=i?.props?.id?String(i.props.id):void 0;return Ge(e,{label:n,value:t,onChange:l,points:o(a?.data,r)})}function Te({say:e,o:n}){const t=s(),l=k("panel",m),o=t?.values??{},a={x:ke(o[n.keys.x]),y:ke(o[n.keys.y])},i=e(n.label??"Position"),r=Boolean(a.x||a.y),u=e=>{const l=we(n.keys,a,e);Object.keys(l).length&&t?.onChangeMany(l)},c=/* @__PURE__ */_(D,{label:i,value:a,onChange:u,words:{x:e("Left and right"),y:e("Up and down"),unit:"px"},placeholder:{x:"0",y:"0"},min:n.min,max:n.max,step:n.step??1}),d=/* @__PURE__ */_(b,{words:l,label:i,changed:r,detail:"0 px, 0 px",onReset:()=>u({x:null,y:null})});return null===n.label?/* @__PURE__ */Y("div",{className:"sf-position-line",children:[c,d]}):/* @__PURE__ */_(g,{label:i,icon:/* @__PURE__ */_(S,{}),changed:r,action:d,children:c})}var Ve={x:{start:/* @__PURE__ */_(I,{}),center:/* @__PURE__ */_(R,{}),end:/* @__PURE__ */_(E,{}),stretch:/* @__PURE__ */_(T,{}),between:/* @__PURE__ */_(N,{})},y:{start:/* @__PURE__ */_(G,{}),center:/* @__PURE__ */_(W,{}),end:/* @__PURE__ */_(K,{}),stretch:/* @__PURE__ */_(B,{}),between:/* @__PURE__ */_(M,{})}},$e=e=>"row"===e?"row":"column";function Je({say:e,kind:n,label:t,options:l,value:o,onChange:a,o:i}){const r=s(),u="justify"===n==("row"===(i.runs??$e)(r?.values?.[i.directionKey??"direction"]))?"x":"y";return We(e,{options:l.map(e=>({label:e.label,value:e.value,picture:Ve[u][e.value]})),value:o,onChange:a,ariaLabel:t})}function De(e,n){const t=(e.useFallback??U)(n);return Object.fromEntries(xe.map(n=>[n,t?.[n]??e.fallback[n]]))}function He({say:e,tier:n,o:t,props:l}){const o=De(t,l),a=s(),i=a?.values??{},r="mobile"===n?t.phoneKeys:t.keys,u=Object.fromEntries(xe.map(e=>[e,je(i[r[e]])])),c="mobile"===n?Object.fromEntries(xe.map(e=>[e,je(i[t.keys[e]])])):null;/* @__PURE__ */
5
- return _(Xe,{say:e,o:t,fallback:o,value:u,follows:c,readOnly:l.readOnly,onChange:e=>{const n=Fe(r,u,e);Object.keys(n).length&&a?.onChangeMany(n)}})}function _e({say:e,o:n,props:t}){const l=De(n,t);/* @__PURE__ */
6
- return _(Xe,{say:e,o:n,fallback:l,value:Le(t.value),follows:"follows"in t?Le(t.follows):null,readOnly:t.readOnly,onChange:e=>t.onChange(Oe(e))})}function Xe({say:e,o:n,fallback:t,value:l,follows:o,readOnly:a,onChange:i}){const r=Object.fromEntries(xe.map(e=>[e,String(o?.[e]??t[e])])),[s,u]=w(()=>d(l,r));/* @__PURE__ */
7
- return _(g,{label:e(n.label),icon:n.icon??/* @__PURE__ */_(A,{}),action:/* @__PURE__ */_(f,{each:s,label:e("Each side"),onChange:u,disabled:a}),children:/* @__PURE__ */_(p,{label:e(n.label),each:s,value:l,placeholder:r,min:n.min,max:n.max,step:n.step,readOnly:a,onChange:i,words:{sides:{top:e("Padding top"),right:e("Padding right"),bottom:e("Padding bottom"),left:e("Padding left")},vertical:e("Top and bottom"),horizontal:e("Left and right"),unit:"px"}})})}var Ye=e=>""===e||"px"===e?e:` ${e}`;function ze({label:e,value:n,onChange:t,min:l,max:o,step:a=1,unit:i="",hint:r,emptyLabel:s,inputMax:u,readOnly:c=!1,clears:d,detail:p,resetWords:f}){const m="number"==typeof n,h=d?/* @__PURE__ */_(b,{label:e,changed:m,detail:p??s??(void 0===r?void 0:`${r}${Ye(i)}`),disabled:c,onReset:()=>t(void 0),...f?{words:f}:{}}):void 0;return{track:/* @__PURE__ */_("div",{className:"sf-slider",children:/* @__PURE__ */_(H,{min:l,max:o,step:a,value:n,suffix:i||void 0,showInput:!0,label:e,disabled:c,...d&&void 0!==r?{placeholderValue:r}:{},...s?{emptyLabel:s}:{},...void 0!==u?{inputMax:u}:{},size:"sm",boxSize:"md",className:"sf-slider-track",onChange:e=>{null===e?d&&m&&t(void 0):e!==n&&t(e)}})}),reset:h}}function Ze({caption:e,label:n,value:t,hint:l,emptyLabel:o,...a}){const i=void 0!==l||void 0!==o,r="number"==typeof t,{track:s,reset:u}=ze({...a,label:n,value:r?t:i?null:a.min,hint:l,emptyLabel:o,clears:i});/* @__PURE__ */
8
- return _(g,{label:e??n,action:u,children:s})}function Ue({draw:e,props:n,useMax:t,useHint:l}){return e(n,{max:(t??U)(n),hint:(l??U)(n)})}function qe(o=z){function i(e,n,t,a,i,r,s="",u){const c="function"==typeof u?{action:u}:u??{},{action:d,clear:p}=c,f=(l,u)=>{const f="storedValue"in l?l.storedValue:l.value,b="follows"in l,m=b&&!1!==p?.phoneFollows,h=b||void 0!==p,v="number"==typeof l.value,y=void 0===p?r:u.hint??("function"==typeof p.hint?p.hint(l):p.hint)??r,k=m&&"number"==typeof l.follows?l.follows:y,w=Ye(s),x=!p?.emptyLabel||m&&"number"==typeof l.follows?void 0:p.emptyLabel,C=x??`${k}${w}`,j="function"==typeof c.hint?c.hint(l):c.hint,{track:F,reset:L}=ze({label:o(e),value:v?l.value:h?null:r,onChange:e=>l.onChange(e),min:t,max:u.max??a,step:i,unit:s,hint:h?k:void 0,emptyLabel:x,inputMax:c.inputMax,readOnly:!0===l.readOnly,clears:h,detail:m?Z(o,C):C});/* @__PURE__ */
9
- return _(g,{label:o(e),icon:ne(n),hint:void 0===j?void 0:o(j),action:h?L:d?d(f,l.onChange):void 0,children:F})},b=c.useMax,m=p?.useHint;return{type:"custom",...l({},{type:"number",label:e}),render:b||m?e=>/* @__PURE__ */_(Ue,{draw:f,props:e,useMax:b,useHint:m}):e=>f(e,{})}}function r(e){return We(o,e)}function s(e,n,t,a,i={}){const s=t.map(e=>"string"==typeof e?{label:e,value:e}:e);return{type:"custom",...l({},{type:"radio",label:e,options:s.map(e=>({value:e.value,label:e.label}))}),render:t=>{const{value:l,onChange:u,field:c}=t,d=s.some(e=>e.value===l),p=!0===t.readOnly;if("follows"in t&&!s.some(e=>""===e.value)){const c=i.phoneRest?i.phoneRest(t.follows):t.follows,f=s.find(e=>e.value===c)??s.find(e=>e.value===a);/* @__PURE__ */
10
- return _(g,{label:o(e),icon:ne(n),action:/* @__PURE__ */_(b,{label:o(e),changed:d,detail:Z(o,o(f?.label??"")),disabled:p,onReset:()=>u(void 0)}),children:r({options:s,value:d?l:f?.value??a,onChange:u,ariaLabel:e,disabled:p})})}const f="follows"in t&&i.followsLabel?i.followsLabel(t.follows):void 0;/* @__PURE__ */
11
- return _(g,{label:o(e),icon:ne(n),action:"follows"in t&&i.followsLabel?/* @__PURE__ */_(b,{label:o(e),changed:null!=l&&""!==l,detail:void 0===f?void 0:Z(o,o(f)),disabled:p,onReset:()=>u(void 0)}):void 0,children:r({options:s,value:d?l:l||c?.currentValue||a,onChange:u,ariaLabel:e,disabled:p})})}}}function u(e,n){return n.phone?e.unshift({label:"Match desktop",value:"",picture:/* @__PURE__ */_(P,{})}):n.inherit&&e.unshift({label:n.inherit,value:""}),e}function c(e,n){return n.inherit||n.phone?{...e,render:n=>e.render({...n,onChange:e=>n.onChange(""===e?void 0:e)})}:e}function d(n,t,l,o){if(o.access){const e=o.inherit?"":o.fallback??"left",a=l({...o,phone:!1}),i=n=>{const t="string"==typeof n&&""!==n&&a.some(e=>e.value===n)?n:e;return a.find(e=>e.value===t)?.label};return Be(n,t(o,e),o.access,{phoneRow:t({...o,phone:!0},"",i)})}return{[n]:e("desktop",t(o)),[a(n)]:e("mobile",t({...o,phone:!0},""))}}function p(e){return u($(e.allow??Ke).map(e=>({label:e.label,value:e.value,picture:e.icon})),e)}function f(e,n=e.fallback??"left",t){return c(s(e.label??"Text alignment",/* @__PURE__ */_(x,{}),p(e),n,t?{followsLabel:t}:{}),e)}function m(e){const n={left:Ve.x.start,center:Ve.x.center,right:Ve.x.end};return u($((e.allow??Ke).filter(e=>e in n)).map(e=>({label:e.label,value:e.value,picture:n[e.value]})),e)}function y(e,n=e.fallback??"left",t){return c(s(e.label??"Block alignment",/* @__PURE__ */_(C,{}),m(e),n,t?{followsLabel:t}:{}),e)}function k(e,n,t,a,i,r){return{type:"custom",options:a,fallback:i,...l({},{type:"radio",label:n,options:a.map(e=>({value:e.value,label:e.label}))}),render:({value:l,onChange:s,field:u})=>{const c=u.options??a,d=u.fallback??i,p=c.some(e=>e.value===l)?l:d;/* @__PURE__ */
12
- return _(g,{label:o(n),icon:ne(t),children:/* @__PURE__ */_(Je,{say:o,kind:e,label:n,options:c,value:p,onChange:s,o:r})})}}}function w(e={}){return k("justify","Justify",/* @__PURE__ */_(C,{}),ie,ie[0].value,e)}function O(e={}){return k("align","Item alignment",/* @__PURE__ */_(V,{}),re,"stretch",e)}function S(){const e=se;return{type:"custom",options:ue,fallback:ue[1].value,...l({},{type:"radio",label:e,options:ue.map(e=>({value:e.value,label:e.label}))}),render:({value:n,onChange:t,id:l,name:a})=>{const i=`${l??a??e}-label`;/* @__PURE__ */
13
- return _(g,{label:o(e),labelId:i,icon:/* @__PURE__ */_(j,{}),action:/* @__PURE__ */_(v,{checked:(r=n,!0===r||"wrap"===r),onChange:e=>t(e?ue[0].value:ue[1].value),ariaLabelledBy:i})});var r}}}function E({offered:e,fallback:n,resolve:t}){const l=t??(t=>e.some(e=>e.value===t)?t:n),o=s(ce,Q("`Direction` names how a container’s children run — a MODIFIER, not a thing. doc/naming.md N10.1 gives the idea a dash in its Glyph column; the shell’s own `direction` meaning says the bare row is CORRECT and not an omission (SS seat, 2026-09-11)."),e.map(e=>({label:e.label,value:e.value})),l(void 0));return{type:"custom",render:e=>o.render({...e,value:l(e.value),onChange:n=>e.onChange(n)})}}function R({min:e,max:n,step:t,builtIn:l,resolve:o,action:a,mark:r}){const s=i("Gap",/* @__PURE__ */_(F,{}),e,n,t,l,"px",a),u=o??(e=>"number"==typeof e?e:l);return{...r,type:"custom",render:e=>s.render({...e,value:u(e.value,e.field),storedValue:e.value,onChange:n=>e.onChange(n)})}}function I(e,{fallback:n=me,pointsFor:t}={}){return{type:"custom",render:({value:l,onChange:a})=>{const i=ge(l,n);return t?/* @__PURE__ */_(Ne,{say:o,label:e,value:i,onChange:a,pointsFor:t}):Ge(o,{label:e,value:i,onChange:a,points:ve})}}}function A(e){return{[e.keys.x]:{type:"custom",render:()=>/* @__PURE__ */_(Te,{say:o,o:e})},[e.keys.y]:{...n({type:"custom",render:()=>/* @__PURE__ */_(t,{})},"always"),reachedBy:e.keys.x}}}function M(l={}){const i={...Ce,...l.keys},r={keys:i,phoneKeys:Object.fromEntries(xe.map(e=>[e,a(i[e])])),fallback:{top:0,right:0,bottom:0,left:0,...l.fallback},useFallback:l.useFallback,label:l.label??"Padding",icon:l.icon,min:l.min??0,max:l.max??200,step:l.step??4},s=!1!==l.phone,u=!1===l.group?{}:{_gSpacing:oe("Padding")};if(l.object){const e={type:"custom",render:e=>/* @__PURE__ */_(_e,{say:o,o:r,props:e})};return te({...u,...s?Be(l.object.key,e,l.object.phone):{[l.object.key]:e}})}const c=n=>{const t={type:"custom",render:e=>/* @__PURE__ */_(He,{say:o,tier:n,o:r,props:e})};return s?e(n,t):t},d=()=>n({type:"custom",render:()=>/* @__PURE__ */_(t,{})},"always"),p=xe.filter(e=>"top"!==e);return te({...u,[r.keys.top]:c("desktop"),...s?{[r.phoneKeys.top]:c("mobile")}:{},...Object.fromEntries(p.map(e=>[r.keys[e],{...d(),reachedBy:r.keys.top}])),...s?Object.fromEntries(p.map(n=>[r.phoneKeys[n],e("mobile",d())])):{}})}return{slider:i,select:function(e,n,t,a,i){return{type:"custom",options:t,fallback:a,...i?{note:i}:{},...l({},{type:"select",label:e}),render:l=>{const{value:r,onChange:s,field:u}=l,c=u.options??t,d=u.fallback??a,p=c.some(e=>e.value===r),f="follows"in l,m=f?c.find(e=>e.value===l.follows)??c.find(e=>e.value===d):void 0,v=p?r:m?.value??d,y=!0===l.readOnly;/* @__PURE__ */
14
- return _(g,{label:o(e),icon:ne(n),action:f?/* @__PURE__ */_(b,{label:o(e),changed:null!=r&&""!==r,detail:m?Z(o,o(m.label)):void 0,disabled:y,onReset:()=>s(void 0)}):void 0,children:/* @__PURE__ */_(h,{value:v,ariaLabel:o(e),readOnly:y,onChange:s,options:[...i?[{label:o(i),value:"\0note",disabled:!0}]:[],...c.map(e=>({label:o(e.label),value:e.value}))]})})}}},Segmented:r,segmented:s,boxJustifyField:w,boxAlignField:O,boxWrapField:S,directionField:E,gapField:R,placementField:I,PlacementGridView:function(e){return Ge(o,e)},positionFields:A,sidesPaddingFields:M,alignmentField:function(e={},n=e.fallback??"left"){return f(e,n)},alignmentFields:function(e="align",n={}){return d(e,f,p,n)},AlignmentStrip:function({opts:e={},value:n,onChange:t,ariaLabel:l,disabled:o=!1}){return r({options:p(e),value:n,onChange:t,ariaLabel:l,disabled:o})},blockAlignmentField:function(e={},n=e.fallback??"left"){return y(e,n)},blockAlignmentFields:function(e="align",n={}){return d(e,y,m,n)},BlockAlignmentStrip:function({opts:e={},value:n,onChange:t,ariaLabel:l,disabled:o=!1}){return r({options:m(e),value:n,onChange:t,ariaLabel:l,disabled:o})},boxFieldSet:function(e={}){const n=e.width??fe,t=e.nudge?.limit??40,l=e.direction??{offered:de,fallback:"column"},o=l.resolve??(e=>l.offered.some(n=>n.value===e)?e:l.fallback),a={runs:e=>"row"===o(e)?"row":"column"};return{_gLayout:oe("Layout"),placement:I("Placement",e.placement),width:i("Width",/* @__PURE__ */_(L,{}),n.min,n.max,n.step,n.fallback,"%"),direction:E(l),gap:R(e.gap??pe),justify:w(a),align:O(a),wrap:S(),_gNudge:oe("Nudge"),...A({keys:e.nudge?.keys??{x:"nudgeX",y:"nudgeY"},min:-t,max:t,label:null}),...M(e.padding)}}}}var{slider:Qe,select:en,Segmented:nn,segmented:tn,boxJustifyField:ln,boxAlignField:on,boxWrapField:an,directionField:rn,gapField:sn,placementField:un,PlacementGridView:cn,positionFields:dn,sidesPaddingFields:pn,alignmentField:fn,alignmentFields:bn,AlignmentStrip:mn,blockAlignmentField:hn,blockAlignmentFields:vn,BlockAlignmentStrip:gn,boxFieldSet:yn}=qe();export{he as ANCHOR_LABELS,mn as AlignmentStrip,re as BOX_ALIGN_POINTS,de as BOX_DIRECTIONS,ce as BOX_DIRECTION_LABEL,pe as BOX_GAP,ie as BOX_JUSTIFY_POINTS,ye as BOX_NUDGE_LIMIT,be as BOX_PLACEMENTS,me as BOX_PLACEMENT_DEFAULT,fe as BOX_WIDTH,se as BOX_WRAP_LABEL,ue as BOX_WRAP_POINTS,gn as BlockAlignmentStrip,Re as FLAT_ACCESS,ve as OPEN_PLACEMENT_POINTS,Ie as PHONE_KEY_ACCESS,cn as PlacementGridView,Ce as SIDE_PAD_KEYS,nn as Segmented,Ze as SliderControl,fn as alignmentField,bn as alignmentFields,hn as blockAlignmentField,vn as blockAlignmentFields,on as boxAlignField,qe as boxFieldBuilders,yn as boxFieldSet,ln as boxJustifyField,an as boxWrapField,rn as directionField,sn as gapField,oe as group,ne as iconOf,ee as isNoGlyph,Q as noGlyph,ge as normaliseBoxPlacement,Se as objectAccess,Z as onDesktopWords,Ae as phoneObjectAccess,Be as phoneTwinFields,un as placementField,dn as positionFields,we as positionPatch,ae as section,tn as segmented,en as select,te as sharedStyleKinds,Le as sidesFromObject,pn as sidesPaddingFields,Fe as sidesPaddingPatch,Oe as sidesToObject,Qe as slider,Ee as useAccessPatch,Pe as useAccessValue};
@@ -1 +0,0 @@
1
- import{repeatWrapperAt as t,REPEAT_ATTRIBUTE as e,REPEAT_INDEX_ATTRIBUTE as r}from"./chunk-7UFKEX72.js";import{parseZoneKey as n}from"./chunk-EUFDQ4KL.js";var o=`[${e}][${r}]`;function l(l){const c=t(l);if(!c)return null;let i;try{i=n(c.zone)}catch{return null}if(!i.parentId||!i.slot)return null;const{wrapper:a,zone:p,index:f}=c;let s=a.parentElement;for(let t=a.parentElement;t;t=t.parentElement)if(t.getAttribute("data-easel-block")===i.parentId){s=t;break}const d=/* @__PURE__ */new Set;for(const t of Array.from(s?.querySelectorAll(o)??[]))t.getAttribute(e)===p&&d.add(t.getAttribute(r)??"");const m={ownerId:i.parentId,slot:i.slot,index:f,count:Math.max(d.size,f+1)},y=a.parentElement?u(a.parentElement):null;return y&&(m.outer=y),{copy:m,wrapper:a}}function u(t){return l(t)?.copy??null}function c(t,e){return t&&e?t.ownerId===e.ownerId&&t.slot===e.slot&&t.index===e.index&&c(t.outer,e.outer):t===e}function i(t,e){for(const n of Array.from(t.querySelectorAll(o))){if(n.getAttribute(r)!==String(e.index))continue;const t=l(n);if(t?.wrapper===n&&c(t.copy,e))return n}return null}export{i as findCopy,u as repeatCopyAt,l as repeatCopyWithWrapper};
@@ -1 +0,0 @@
1
- import{useSectionOps as o}from"./chunk-X73RVMHK.js";import{SELECTION_MODE as e}from"./chunk-OXKGD2K7.js";import{decodePartId as r,encodePartId as t}from"./chunk-R4AUZVA3.js";import{useEasel as n}from"./chunk-OB5JP6PR.js";import{usePreviewParts as p}from"./chunk-467WWV4I.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=n(o=>o),f=o(),{setSelectedPartId:k,setSelectHandler:l}=p(),I=d(o=>{const t=r(o);if(!t)return;const{nodeId:n,propKey:p}=t;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),a?.(n)):i(o=>"part"===o.kind?e:o)},[i,a]);c(()=>{l(I)},[l,I]);const K=s(m)?t(m.nodeId,m.propKey):null;c(()=>{k(K)},[K,k]);return{selectNode:d(o=>{i(()=>e);const r=u(o);r&&f.select(r)},[i,u,f]),openPartId:K}}export{m as usePartBridge};
@@ -1,64 +0,0 @@
1
- import{cloneNodeWithFreshIds as e}from"./chunk-OXZDSOZV.js";import{dedupeSlotChildren as n}from"./chunk-7OCEPOEJ.js";import{styleClipboardOf as t}from"./chunk-JYVQ62TL.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-UMBNBCL4.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s}from"./chunk-LUOY3A3Q.js";import{useEaselKeyTarget as d,useEaselUndoKeys as a,useEaselSaveKey as c,editorRootFocus as p}from"./chunk-LP2SVO74.js";import{SlotChildActionsProvider as u}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as f,DEFAULT_PANEL_W as h,clampPanelWidth as m}from"./chunk-6EDVZBUO.js";import{usePartBridge as g}from"./chunk-KCTFS4KB.js";import{useSectionOps as y}from"./chunk-X73RVMHK.js";import{PageEditGuardNotices as v}from"./chunk-TOEJCZUO.js";import{ScreenSaveIcon as b,ScreenMainButton as k}from"./chunk-PVBDKBJB.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{useScreenDocument as w}from"./chunk-BYONFJVQ.js";import{requestMediaPick as x}from"./chunk-JIP5JNRB.js";import{AddChildRow as z}from"./chunk-5545A3PC.js";import{AddSidePanel as C}from"./chunk-3PN3MAKW.js";import{keepsSharedSections as O,sharedSectionsOf as B}from"./chunk-N3MJOHAG.js";import{PanelHideButton as N,SidePanelHead as I,PanelShowStrip as P}from"./chunk-SBVIW3KJ.js";import{offeredChoices as $}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as T,useScreenNodeKeys as M,useScreenPinned as j,useScreenDocumentLabel as E,useScreenCanvasFrame as L,useScreenInspectorPanel as A,useScreenDevices as R,useScreenPickFollowsSelection as F,useScreenLeftView as D,SELECTION_MODE as V,isSelectionMode as W,sameInspectorMode as H,useScreenBridges as J,useScreenBlockRules as U,useScreenBlockLook as Y,useScreenStorageNamespace as X,useScreenNotify as K,useScreenCanvasHead as Q,isSlotMode as G,useScreenStyleClipboard as Z,useScreenDocumentPass as _,useScreenCanvasDrag as q,ScreenCanvasTargetProvider as ee,isPinnedFirst as ne,isPinnedLast as te,screenSlotsOf as oe,shownChildSlotsOf as re}from"./chunk-OXKGD2K7.js";import{MediaPopup as ie}from"./chunk-T2RINM7R.js";import{useMediaPanel as le,usePanelPick as se,useMediaBrowsing as de,useOpenMediaBrowse as ae,useMediaPlace as ce}from"./chunk-NCXYC7WI.js";import{useNodeClipboard as pe,useNodeContextMenu as ue}from"./chunk-ZCMNFB3Y.js";import{useEaselSession as fe}from"./chunk-YM4UEGBV.js";import{useEaselHost as he,useHostEscape as me}from"./chunk-LX23TCTP.js";import{LayersIcon as ge,MediaIcon as ye}from"./chunk-XFYFKITX.js";import{DEFAULT_NODE_MENU_WORDS as ve}from"./chunk-WK3AFPXY.js";import{DEFAULT_SCREEN_WORDS as be}from"./chunk-Q3VAJMXS.js";import{heldStyle as ke,styleShortcut as Se}from"./chunk-CWELHADJ.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as we}from"./chunk-6WY6ZXJG.js";import{rootRowName as xe,slotChildRowName as ze,slotChildRenameProp as Ce,sectionRenameProp as Oe}from"./chunk-5NHQ452C.js";import{ROOT_ZONE as Be,blockNodeActions as Ne,TREE_MAX_DEPTH as Ie,childSlotsOf as Pe,slotFieldsOf as $e,newNodeId as Te,slotChildrenIn as Me,nestsInTree as je}from"./chunk-TCAAOYQY.js";import{useEasel as Ee,useEaselApi as Le,CanvasPartsContext as Ae,partHasOwnBox as Re,CanvasPassThroughContext as Fe,CanvasSharedContext as De}from"./chunk-OB5JP6PR.js";import{toItemSelector as Ve,useNodeOps as We,clickPick as He}from"./chunk-QTHQPJWA.js";import{TreeRow as Je,Subtree as Ue,LayersTree as Ye,TreeGroupLabel as Xe,TreeRowAction as Ke,TreeSeam as Qe}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as Ge}from"./chunk-K56YDHYQ.js";import{EaselTopBar as Ze,EaselIconButton as _e,TopBarCluster as qe,DeviceSwitch as en,InspectorIconButton as nn,PanelResizeHandle as tn,MAX_PANEL_W as on,MIN_PANEL_W_BY_SIDE as rn,panelWidthVars as ln}from"./chunk-VBEVZZTV.js";import{DEFAULT_NOTICE_WORDS as sn,DEFAULT_CHROME_WORDS as dn}from"./chunk-AJSDWWJW.js";import{holderOf as an,nameOrSomeone as cn}from"./chunk-YYD257TD.js";import{DEFAULT_LOCK_WORDS as pn}from"./chunk-RE4LP46F.js";import{useWords as un}from"./chunk-MFIRYGHW.js";import{insertSeams as fn,CanvasDragLayer as hn,CanvasInsert as mn}from"./chunk-SQTVXE5D.js";import{DEFAULT_DRAG_WORDS as gn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as yn,useTreeDrag as vn,gapToMoveIndex as bn}from"./chunk-3XECMGXX.js";import{useCanvasFrame as kn,LIST_SELECTOR as Sn,BLOCK_SELECTOR as wn,useCanvasTyping as xn,useCanvasEvent as zn}from"./chunk-TOKMFZPB.js";import{nodeIdAt as Cn,frameRectToHost as On,BLOCK_ATTRIBUTE as Bn,drawnBox as Nn}from"./chunk-FR7EEKFF.js";import{queryMainCopy as In}from"./chunk-7UFKEX72.js";import{ROOT_ID as Pn,ROOT_SLOT as $n,zoneKey as Tn,parseZoneKey as Mn,find as jn,DataError as En}from"./chunk-EUFDQ4KL.js";import{useRef as Ln,useMemo as An,useState as Rn,useEffect as Fn,useCallback as Dn,useLayoutEffect as Vn,useContext as Wn,Fragment as Hn,useId as Jn}from"react";import{ColoredBadge as Un,Button as Yn,Tabs as Xn,toast as Kn,readMediaFileDrag as Qn,Tooltip as Gn,groupColors as Zn,Dialog as _n,FormField as qn,Input as et,MEDIA_FILE_DRAG_TYPE as nt}from"efficient-shell/ui";import{UndoIcon as tt,RedoIcon as ot,RefreshIcon as rt,AddIcon as it,TrashIcon as lt,EyeOffIcon as st,EyeIcon as dt,SharedIcon as at,DuplicateIcon as ct}from"efficient-shell/icons/efficient";import{jsx as pt,jsxs as ut,Fragment as ft}from"react/jsx-runtime";var ht="media-file";function mt({name:e,onMake:n,onCancel:t}){const o=un("screen",be).shared,[r,i]=Rn(e),[l,s]=Rn(!1),d=Jn(),a=Ln(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
2
- return pt(_n,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */ut(ft,{children:[
3
- /* @__PURE__ */pt(Yn,{variant:"secondary",onClick:t,children:o.cancel}),
4
- /* @__PURE__ */pt(Yn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */pt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */pt(qn,{label:o.name,htmlFor:d,children:/* @__PURE__ */pt(et,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var gt=/* @__PURE__ */new WeakSet;function yt(e,n,t){const o=jn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function vt({canvas:e,tabs:n,onSelect:t}){const o=Ln(null),[r,i]=Rn({}),l=n.map(e=>`${e.id}:${e.below?1:e.above?2:0}`).join("|");return Vn(()=>{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=On(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=In(t,`[${Bn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?Nn(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=On(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=!0===o.above&&s.top-4>d.top,u=o.below?c+4:p?s.top-4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+(o.above?0:6),top:u,above: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__ */pt("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */pt("span",{className:"es-band-tab"+(n.above?" is-above":""),"data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
5
- /* @__PURE__ */pt(Gn,{content:e.reach,children:/* @__PURE__ */ut(Un,{colorClass:Zn("success","solid"),size:"sm",children:[
6
- /* @__PURE__ */pt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */pt(at,{size:12})}),e.label]})}):/* @__PURE__ */pt(Un,{colorClass:Zn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function bt({expand:e}){/* @__PURE__ */
7
- return pt("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */ut(ft,e?{children:[
8
- /* @__PURE__ */pt("path",{d:"M8 9l4-4 4 4"}),
9
- /* @__PURE__ */pt("path",{d:"M8 15l4 4 4-4"})]}:{children:[
10
- /* @__PURE__ */pt("path",{d:"M8 4l4 4 4-4"}),
11
- /* @__PURE__ */pt("path",{d:"M8 20l4-4 4 4"}),
12
- /* @__PURE__ */pt("path",{d:"M5 12h14"})]})})}var kt=`${Sn}, ${wn}`;function St(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 wt="__rungs",xt=e=>"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:"preset"===e.kind?e.preset.key:e.type;var zt="screen:band",Ct={duplicate:!0,delete:!0},Ot=()=>null;function Bt(){const Sn=he(),On=Sn.panels?.Toolbar,Bn=(Sn.panels?.useRight??Ot)(),{target:Nn,docId:Jn,capabilities:Gn,currentSlug:Zn,siteId:_n,onPublish:qn,saveState:et,saveConflict:at,retrySave:Bt,toggleAutoSave:Nt,flushSave:It,access:Pt,saveUnreachable:$t=!1,readOnly:Tt,readOnlyReason:Mt=null}=w(),jt=T(),Et=M(),{mediaEditing:Lt,hasEditGuard:At,hasPinnedChrome:Rt}=Gn,{appState:Ft,dispatch:Dt,history:Vt,selectedItem:Wt,getSelectorForId:Ht,config:Jt}=Ee(e=>e),Ut=j(),{first:Yt,firstGroup:Xt,lastGroup:Kt,isSectionGroup:Qt,sectionGroupZone:Gt,panelOf:Zt}=Ut,_t=Zt(Yt),qt=e=>ne(Ut,e),eo=e=>te(Ut,e),no="node"===Ut.firstRow,to=Ut.band??null,oo=un("screen",be),ro=un("tree",Ge),io=un("drag",gn),lo=un("notice",sn),so=un("lock",pn),ao=un("menu",ve),co=un("styleClipboard",we),po=un("chrome",dn),uo=E()??`/${Zn}`,fo=L(),ho=A(),mo=y({readOnly:Tt}),go=y({readOnly:Tt,foldIntoHistory:!0}),yo=Ln(null),vo=Le(),bo=An(()=>({...mo,select:e=>{yo.current=e,mo.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=vo.config;yo.current=Ve(e,t,n)}mo.commitDocument(e,n)}}),[mo,vo]),ko=Ft.ui,So=ko.leftSideBarVisible,wo=ko.rightSideBarVisible,{options:xo,widths:zo,initial:Co,fluid:Oo,fit:Bo}=R(),[No,Io]=Rn(Co),Po=le(),$o=Lt&&null!==Po;se(),de();const To=ae();F(Wt?.props.id);const{read:Mo,write:jo,forSelection:Eo}=D(),[Lo,Ao]=Rn(Mo);Fn(()=>{jo(Lo)},[Lo]);const[Ro,Fo]=Rn(0),Do=Ln(null),Vo=Ln(null),Wo=kn(Vo,{readySelector:kt}),Ho=xn(Wo),Jo=d(Vo);a(Vo,Wo);const Uo=S(),Yo=an(Pt),Xo={state:et,offline:Uo||et.failed&&$t,readOnlyReason:Mt,editing:Yo?lo.editing({name:cn(Yo.name,so),noun:oo.noun}):null,conflict:null!=at,notSaving:oo.bar.notSaving},Ko=()=>{Tt||(et.failed?Bt():It())};c(Vo,Wo,Ko);const[Qo,Go]=Rn(!1),Zo=Ln(!1),[_o,qo]=Rn(null),[er,nr]=Rn([]),[tr,or]=Rn(V);W(tr);const rr=o(tr,Wt?.props.id),[ir,lr]=Rn(null);Fn(()=>{ir&&(r(),lr(null))},[ir]);const sr=Ln(Ht);sr.current=Ht;const dr=Dn((e,{scroll:n})=>{Ao(n=>Eo(e,n)),n&&lr(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=sr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Rr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),ar=Ln(null);Fn(()=>{const e=ar.current;ar.current=null;const n=null==Wt?.props.id?null:String(Wt.props.id);or(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Zt(Wt?.type)??V);const t=Wt?.props.id,o=yo.current;if(yo.current=null,!t)return;const r=Ht(t);dr(String(t),{scroll:!i(o,r??null,Be)})},[Wt?.props.id,dr]);const cr=Dn(e=>{or(n=>H(n,e)?n:e),Dt({type:"setUi",ui:{rightSideBarVisible:!0}})},[Dt]),pr=Ln(()=>{});pr.current=(e,n)=>{const t=e?Mi(e.zone??Be)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Wt?.props.id?null:String(Wt.props.id);or(e=>H(e,n)?e:n),o!==r&&(ar.current={id:o,mode:n},bo.select(e))};const ur=Dn((e,n)=>pr.current(e,n),[]),fr={kind:tr.kind,mode:tr,open:cr,show:e=>or(e),reveal:()=>{wo||Dt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:ur},hr=J(fr,{data:Ft.data,selected:Wt??null,zoneOf:e=>Ht(e)?.zone,readOnly:Boolean(Tt),select:e=>{or(V),bo.select({index:e})},replace:(e,n)=>bo.replaceComponent(Be,e,n),scrollTo:e=>l(e)},{device:No,refreshes:Ro},{setView:Ao,reveal:()=>{So||Dt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),mr=hr.resolveLeftView?hr.resolveLeftView(Lo):"sections",gr=U(),{isLockedBlock:yr,duplicateBlocked:vr,nestDepth:br,newSectionNode:kr,canAddTo:Sr,blockIsOffered:wr}=gr,xr=e=>({id:String(e.props.id??""),data:Ft?.data}),zr=Y(),{labelAtLevel:Cr,Icon:Or,useProducts:Br}=zr,Nr=zr.rowName?(e,n,t)=>zr.rowName(e,n,t):void 0,Ir=Dn(e=>{Dt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),dr(e,{scroll:!0})},[Dt,dr]),{selectNode:Pr,openPartId:$r}=g({mode:tr,setMode:or,onOpenPart:Ir}),[Tr,Mr]=Rn(null);me(null!==Tr,()=>Mr(null));const jr=f(X()),Er=jr.collapsed,Lr=jr.panelWidths,[Ar,Rr]=Rn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Er);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
13
- return new Set}});Fn(()=>{try{window.localStorage.setItem(Er,JSON.stringify([...Ar]))}catch{}},[Ar]);const[Fr,Dr]=Rn(()=>{if("undefined"==typeof window)return{...h};try{const e=window.localStorage.getItem(Lr);if(!e)return{...h};const n=JSON.parse(e);return{left:m(Number(n.left)||h.left,"left"),right:m(Number(n.right)||h.right,"right")}}catch{return{...h}}});Fn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Lr,JSON.stringify(Fr))}catch{}},300);return()=>clearTimeout(e)},[Fr]);const Vr=Dn((e,n)=>Dr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Wr=Dn(e=>Vr("left",e),[Vr]),Hr=Dn(e=>Vr("right",e),[Vr]),Jr=e=>Ar.has(e),Ur=e=>Rr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Yr=Ln(!1),Xr=Ln(null);Fn(()=>{if(Yr.current&&!Qo){const e=Xr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Vo.current?.querySelector(`button[aria-label="${CSS.escape(oo.add.title)}"]`))?.focus(),Xr.current=null}Yr.current=Qo},[Qo]),Fn(()=>{if(!Qo||!Jo)return;const e=e=>{"Escape"===e.key&&ul()};return Jo.addEventListener("keydown",e),()=>Jo.removeEventListener("keydown",e)},[Qo,Jo]),me(Qo,()=>ul()),Fn(()=>{!So&&Qo&&(Go(!1),qo(null),Zo.current=!1)},[So]);const Kr=K(),Qr=(e,n="success",t)=>{if(Kr)return void(t?Kr(e,"error"===n?"error":"info",t):Kr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Kn.error(e,{...o,duration:t?.duration??3200}):Kn.success(e,{...o,duration:t?.duration??1900})},Gr=Ln(null),[Zr,_r]=Rn(0),[qr,ei]=Rn(0),ni=Q(),ti=Ln(null),oi=e=>Math.max(0,e.clientHeight-(ti.current?.offsetHeight??0));Fn(()=>{const e=Gr.current;if(!e)return;const n=()=>{_r(e.clientWidth),ei(oi(e))};n();const t=new ResizeObserver(n);return t.observe(e),ti.current&&t.observe(ti.current),()=>t.disconnect()},[]),Vn(()=>{Gr.current&&(_r(Gr.current.clientWidth),ei(oi(Gr.current)))},[Fr,So,wo]);const ri=No===Oo?Zr>0?Zr:zo[Oo]:zo[No],ii=Zr>0?Math.min(Zr/ri,"shrink"===Bo?1:2):1,li=ri*ii,si=Zr>0&&li>Zr+1,di={width:li,height:qr||"100%",flex:"none",position:"relative"},ai={width:ri,height:qr?qr/ii:"100%",maxHeight:"none",transform:1!==ii?`scale(${ii})`:void 0,transformOrigin:"top left"},ci=()=>Dt({type:"setUi",ui:{leftSideBarVisible:!So}}),pi=()=>Dt({type:"setUi",ui:{rightSideBarVisible:!wo}}),ui=e=>{Qo&&(Go(!1),qo(null),Zo.current=!1,So&&Lo===e)||(Ao(e),So||Dt({type:"setUi",ui:{leftSideBarVisible:!0}}))},fi=()=>{or(_t??V),wo||Dt({type:"setUi",ui:{rightSideBarVisible:!0}})},hi=Ft.data.content??[],mi=()=>{const e=hi.findIndex(qt),n=hi.findIndex(eo);return{floor:e>=0?e+1:0,cap:n>=0?n:hi.length}},gi=Jt,yi=gr.stripCopy,vi=n=>e(n,yi),bi=pe(),ki=We({data:Ft.data,config:gi,readOnly:Boolean(Tt),clipboard:bi,strip:yi?e=>yi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==Pn||e.slot!==$n)return{min:0,max:n-1};const{floor:t,cap:o}=mi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&or(V);const t=void 0===n||"node"===n?.kind?n:null;bo.commitDocument(e,t)}}),Si=fe(),[wi,xi]=Rn(null),zi=e=>{const n=hi.find(n=>String(n.props.id)===e),t=Ut.shared;n&&t&&ki.swap(e,t.detach(n))},Ci=e=>{const n=jn(Ft.data,Jt,e);if(!n)return!1;const t=Tn(n.place),o=n.node,r=t===Be?Pi(o):Ui(o),i=t===Be?Ut.shared?.usedOn(o):null;return!!ki.remove(e)&&(Qr(i?oo.shared.removed({count:Math.max(0,i.length-1)}):oo.deleted({name:r}),"success",{duration:8e3,action:{label:oo.bar.undo,onClick:()=>{ki.restore(n.node,n.place)}}}),!0)},Oi={...ki,remove:Ci},Bi=e=>Cr(e,"block",Jt.components[e]?.label??e),Ni=Dn(e=>Jt.components[e]?.defaultProps??{},[Jt]),Ii=e=>Cr(e,"section",Bi(e)),Pi=e=>xe({type:e.type,props:e.props??{}},Ii(e.type),Nr),{nodeAddresses:$i,zoneItems:Ti}=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 Pe(Jt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(hi,Be,0),{nodeAddresses:e,zoneItems:n}},[hi,Jt]),Mi=Dn(e=>Ti.get(e)??[],[Ti]),ji=e=>{const n=$i.get(e);return n?Mi(n.zone)[n.index]:void 0},Ei=e=>oe(gr,Jt,e),Li=e=>{if(!gr.slotsOf||e===Be)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=ji(e.slice(0,n));if(!t)return null;const o=Ei(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}},Ai=(()=>{if(!G(tr))return null;const e=`${tr.nodeId}:${tr.slot}`;return Li(e)?.slot.panel===tr.kind?e:null})(),Ri=Ln(null);Fn(()=>{const e=Ri.current;if(Ri.current=null,!Ai||!G(tr))return;const n=tr.nodeId;dr(n,{scroll:e!==Ai}),Rr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[tr]);const Fi=e=>{const n=$i.get(e);n&&(n.zone===Be?il(n.index):Tl(n.zone,n.index,e,ji(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))},Di=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void Fi(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Ai!==i&&(Ri.current=i),ur(null,r),wo||Dt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Vi=(e,n,t)=>{const o=`${e}:${n}`;if(Rr(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;Ai!==o&&(Ri.current=o);ur(null,{kind:t,nodeId:e,slot:n})},Wi=(e,n,t)=>{if(Tt||!gr.moveSlot)return;const o=ji(e),r=o?Ei(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:wt,index:n},s=bn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=gr.moveSlot(e,n,s);"string"==typeof d&&Vi(e,d,i.panel)},Hi=Br(),Ji=An(()=>{const e=/* @__PURE__ */new Map;for(const n of Hi??[])e.set(n.slug,n.name);return e},[Hi]),Ui=e=>ze(e,Bi,zr.plainText,e=>Ji.get(e),zr.rowName),Yi=(e,n)=>{const t=Jt.components[e.type]?.fields,o=n===Be||rs(n)?"section":"block",r=n===Be&&(qt(e)||eo(e)||Qt(e.type)),i="block"===o?Ce(t):r?null:Oe(t);return zr.renamePropOf?zr.renamePropOf(e,o,i):i},Xi=(e,n,t,o)=>{if(!(!Tt&&Tr?.zone===e&&Tr.index===n))return;const r=(t,o)=>{Mr(null),o&&((e,n,t)=>{const o=Mi(e)[n];if(!o)return;const r=Yi(o,e);r&&bo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
14
- return pt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":oo.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)},Ki=t(Z(),co),Qi=Ki.scope({target:Nn,siteId:_n,docId:Jn}),Gi=Jt,Zi=(e,n)=>n===Be?Ii(e):Bi(e),_i=(e,n,t)=>{const o=Ki.plan(Qi,t,Zi(t.type,e),Gi);o&&(o.changed&&bo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Qr(o.message))},qi=ue({nodesIn:Mi,nodeAt:(e,n)=>Mi(e)[n]??null,labelOf:(e,n)=>n===Be?Ii(e):Bi(e),renamePropOf:Yi,beginRename:(e,n)=>Mr({zone:e,index:n}),history:{hasPast:Vt.hasPast,hasFuture:Vt.hasFuture,back:()=>Vt.back(),forward:()=>Vt.forward()},openPageStyles:hr.openPageStyles,pageStylesLabel:oo.pageStyles,words:{menu:ao,styleClipboard:co,screen:oo.menu},readOnly:Boolean(Tt),collapseAll:()=>Rr(new Set(Mi(Be).map(e=>String(e.props.id)))),onPasteRefused:e=>Qr(e?oo.pasteRefused({name:e.label}):oo.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ss(e,n),copyItem:hr.onCopyItem,menuRows:(e,n,t)=>{const o=hr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Ut.shared;if(!t||n!==Be)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:oo.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return Tt||yr(e.type,e)?n:{...n,change:[{label:oo.shared.detach,onClick:()=>zi(e.props.id)}],remove:[{label:oo.shared.removeFromPage,danger:!0,onClick:()=>{Ci(e.props.id)}}]}}return Tt||qt(e)||eo(e)||Qt(e.type)?null:O(Si)?{change:[{label:oo.shared.makeShared,onClick:()=>xi({id:e.props.id,name:Pi(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=>yr(e.type,e),duplicateBlocked:e=>vr(Ft.data,e),permits:e=>{const n=Ne(Jt,e.type);return Ut.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:Oi,isPinned:(e,n)=>n===Be&&(qt(e)||eo(e)),sectionBand:mi,locate:e=>$i.get(e)??null,rowNameOf:(e,n)=>n===Be?Pi(e):Ui(e),selectAt:(e,n,t,o)=>{e===Be?il(n):Tl(e,n,t,o??"")},slotRung:e=>{const n=Li(e);return n?.slot.panel?{label:n.slot.label,select:()=>Di(n.node,n.slot,!1)}:null},style:{held:()=>ke(Qi),canCopy:e=>Ki.rows(Gi,e).some(e=>!1!==e.counted),copy:(e,n)=>Ki.copy(Qi,e,Zi(e.type,n),Gi),paste:(e,n,t)=>_i(e,n,t)},keys:Et?{target:Jo,selected:()=>{const e=Ft.ui.itemSelector;return e?{zone:e.zone??Be,index:e.index}:null},held:()=>bi.get(),readOnly:Boolean(Tt),onDone:({done:e,name:n})=>{"copied"===e&&Qr(oo.copied({name:n}))}}:void 0},Wo),el=Ln({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Fn(()=>{el.current={copy:(e,n)=>Ki.copy(Qi,e,Zi(e.type,n),Gi),paste:_i,at:()=>{const e=Ft.ui.itemSelector;if(!e)return null;const n=e.zone??Be,t=Mi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Tt)}});const nl=Dn(e=>{const n=Se(e);if(!n)return;const t=el.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))},[]);Fn(()=>{if(!Jo)return;const e=e=>nl(e);return Jo.addEventListener("keydown",e),()=>Jo.removeEventListener("keydown",e)},[nl,Jo]),zn(Wo,"keydown",nl);const tl=hi.map(e=>e.props.id).join("|");Fn(()=>{const e=Wo?.document??null,n=Wo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void nr(e=>e.length?[]:e);const n=hi.findIndex(eo),t=n>=0?n:hi.length,o=n=>{const t=hi[n]?.props?.id;return null==t?null:In(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(wn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=hi.length>0&&!qt(hi[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=St(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})}nr(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[Wo,tl,No,ii,So,wo,Wt?.props.id]);const ol=Wo?.document??null,rl=Wo?.window??null;Fn(()=>{const e=Do.current;if(!e||!ol||!rl)return;const n=[],t=()=>{const n=In(ol,`[data-easel-block="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&rl.scrollTo({left:rl.scrollX,top:rl.scrollY+t,behavior:"instant"}),!0};return Do.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[ol,rl]);const il=e=>{or(V),bo.select({index:e}),hr.sectionPressed?.(hi[e]);const n=hi[e]?.props?.id;n&&l(n)},ll=e=>{const{floor:n,cap:t}=mi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Wt&&tr.kind!==_t?.kind?hi.findIndex(e=>e.props.id===Wt.props.id):-1;return o(r>=0?r+1:t)},sl=(e,n)=>{const{floor:t,cap:o}=mi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(bo.reorderComponent(Be,e,i),bo.select({index:i}),{moved:!0,dest:i})},dl=(e,n,t,o)=>{or(V),bo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Qr(oo.sectionAdded({name:t}))},al=(e,n)=>{const t=ll(n),o=kr(e,{nodeDefaults:Ni,newNodeId:Te,sectionLabel:Ii,blockIsOffered:wr}),r=o?bo.insertNode(Be,t,o):bo.insertSection(e,t);return dl(t,r,Ii(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 Pe(Jt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Sr(e.type,l,d.slice(d.lastIndexOf(":")+1),xr(e)),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},cl=e=>pl(Be,e),pl=(e,n)=>{Xr.current=document.activeElement??null,qo(null===n?null:{zone:e,index:n}),Go(!0),So||(Zo.current=!0,Dt({type:"setUi",ui:{leftSideBarVisible:!0}}))},ul=()=>{Go(!1),qo(null),Zo.current&&Dt({type:"setUi",ui:{leftSideBarVisible:!1}}),Zo.current=!1},fl=(e,n)=>zr.rowName?n?qt(e)?zr.rowName(e,"section",oo.header):eo(e)?zr.rowName(e,"section",oo.footer):Qt(e.type)?zr.rowName(e,"section",Bi(e.type)):Pi(e):Ui(e):n?Ii(e.type):Bi(e.type),hl=e=>n=>{e()},ml=(e,n,t)=>{if(Tt)return null;const o=Mi(e)[n];return o&&!Ne(Jt,o.type).delete||o&&yr(o.type,o)?null:/* @__PURE__ */pt(Ke,{kind:"delete",label:e===Be&&o&&Ut.shared?.usedOn(o)?oo.shared.removeFromPage:oo.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Mi(e)[n]?.props?.id;null!=t&&Ci(String(t))})(e,n),children:/* @__PURE__ */pt(lt,{size:15})})},gl=e=>zr.rowPreview?.(e)||void 0,yl=e=>zr.rowMarks?.(e)??void 0,vl=(e,n,t)=>zr.rowActions?.(e,n,t)??null,bl=(e,n,t,o)=>{if(Tt)return null;if(yr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
15
- return pt(Ke,{kind:"eye",label:r?oo.showNamed({name:o}):oo.hideNamed({name:o}),onClick:()=>Sl(e,n,t),children:/* @__PURE__ */pt(r?st:dt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},kl=e=>nd(Be,e),Sl=(e,n,t)=>{bo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},wl=e=>$e(Jt,e),xl=e=>Pe(Jt,e),zl=e=>gr.slotsOf?Ei(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Me(e,n.slot)})):[{slot:null,rung:null,kids:re(Jt,e)}],Cl=e=>gr.slotsOf?zl(e).flatMap(e=>e.kids):re(Jt,e),Ol=e=>Boolean(gr.slotsOf)&&Ei(e).some(e=>e.rung),Bl=(e,n,t)=>Sr(e.type,n,t??void 0,xr(e)),Nl=(e,n,t)=>{const o=je(Jt,e.type,n)&&(t||Cl(e).length>0||Ol(e));return{collapsible:o,folded:o&&Jr(String(e.props.id))}},Il=(e,n,t)=>zl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Nl(e,r,t(e.type)).collapsible?[String(e.props.id),...Il(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Pl=e=>Cl(e).length>0||Ol(e)||Boolean(Sr(e.type)),$l=e=>Boolean(Sr(e)),Tl=(e,n,t,o)=>{if(or(V),Sr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),bo.select({index:n,zone:e}),l(t)}else bo.select({index:n,zone:e}),l(t)},Ml=(e,n,t,o,r)=>{const i=`${e}:${n}`;bo.insertComponent(i,t,o),Sr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),bo.select({index:o,zone:i})}):bo.select({index:o,zone:i})},jl=Ln(/* @__PURE__ */new Set);Fn(()=>{hi.forEach(e=>{const n=Sr(e.type)?.spec;if(!n)return;const t=e.props.id;if(jl.current.has(t))return;jl.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(Ni)).forEach((e,t)=>go.seedChild(o,t,n.childType,e))})},[hi,go,Ni]);const El=Ln(/* @__PURE__ */new Set);Fn(()=>{hi.forEach((e,t)=>{const o=e.props.id;if(El.current.has(o))return;const r=n(e,wl(e.type));El.current.add(o),r&&go.replaceComponent(Be,t,{...e,props:r})})},[hi,go]),_(go,Jt);const Ll=hi.findIndex(eo),Al=Ll>=0?hi[Ll]:null,Rl=no?hi.findIndex(qt):-1,Fl=Rl>=0?hi[Rl]:null,Dl=Ut.groupTab,Vl=An(()=>Dl?e=>Qt(e.type):void 0,[Dl]),Wl=Boolean(Ut.groupBadge),Hl=Ut.sharedReach,Jl=e=>Hl?.(e)??void 0,Ul=An(()=>Hl?new Set(hi.filter(e=>Jl(e)).map(e=>String(e.props.id))):null,[hi,Hl]),Yl=An(()=>Ul?e=>Ul.has(e):void 0,[Ul]),Xl=Ut.first?Hl?.({type:Ut.first,props:{id:""}})??void 0:void 0,Kl=Ut.groupBadge?/* @__PURE__ */pt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */pt(Un,{tone:"info",size:"xs",children:Ut.groupBadge})}):void 0,Ql=hi.find(e=>e.type===Xt)??null,Gl=hi.find(e=>e.type===Kt)??null,Zl=Ll>=0?Ll:hi.length,_l=[];hi.forEach(e=>{eo(e)||(Pl(e)&&_l.push(String(e.props.id)),_l.push(...Il(e,1,$l)))}),Al&&(_l.push(String(Al.props.id)),_l.push(...Il(Al,1,$l)));const ql=_l.length>0&&_l.every(e=>Ar.has(e)),es=e=>{const n=zr.blockRowName(e,Bi);return zr.rowName?zr.rowName(e,"block",n):n},ns=(e,n,t,o)=>{const r=Mi(e)[t];if(!r)return;const i={...Mn(e),index:t},l={...Mn(n),index:Math.min(Math.max(o,0),Mi(n).length)},s=bn(i,l);if(e!==n||s!==t)try{ki.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof En))throw e}},ts=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of xl(e))n.add(r),t(o)};for(const t of wl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},os=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=$i.get(n);if(!e)return null;if(e.zone===Be)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},rs=e=>{const n=e.slice(0,e.indexOf(":")),t=hi.find(e=>Qt(e.type)&&String(e.props.id)===n);return t&&Gt(n)===e?t:null},is=(e,n)=>{const t=rs(e);return!t||(!Ut.groupAccepts||Ut.groupAccepts(t.type,n,Mi(e).length))},ls=(e,n,t)=>{if(e.rung){const t=ji(e.rung.nodeId),o=t?Ei(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===wt&&n.index>=0&&n.index<=o}if(n.slot===wt)return!1;if(e.add)return cs(e.add,n);const o=Tn(n);if(Qt(e.type))return!1;const r=rs(o),i=rs(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!is(o,e.type))&&(n.index>=0&&n.index<=Mi(o).length));if(e.zone===Be||o===Be){if(e.zone!==o)return!1;const{floor:t,cap:r}=mi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Mi(o).length)return!1;if(e.zone===o)return!0;const l=Al&&!Ut.lastIsOpen?String(Al.props.id):null;return(!l||os(e.zone)!==l&&os(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Mi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=$i.get(i),s=l?Mi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ts(r).has(n))return!1;const d=Sr(s.type,br(Ft?.data,s.type,i),n.slice(n.lastIndexOf(":")+1),xr(s));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Mi(n),r))})(e.zone,o,e.index,t)},ss=(e,n)=>{const t=Tn(e.from),o=e.node;return t===Tn(n)?is(t,o.type):ls({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},ds=e=>{const n=e.slice(0,e.indexOf(":")),t=$i.get(n),o=t?Mi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Sr(o.type,br(Ft?.data,o.type,n),e.slice(e.lastIndexOf(":")+1),xr(o));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=$(r.choices??(r.spec?[{type:r.spec.childType,label:Bi(r.spec.childType)}]:[])),l=Li(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:fl(o,t.zone===Be)}},as=(e,n)=>{if("section"!==e.kind)return e;const t=Tn(n);return t===Be||rs(t)?e:ds(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},cs=(e,n)=>{const t=as(e,n),o=Tn(n);if("shared"===t.kind){if(o!==Be||!Ut.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=mi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(rs(o)){if("preset"===t.kind)return!1;const e="section"===t.kind?t.type:t.template.node.type;return is(o,e)&&n.index>=0&&n.index<=Mi(o).length}if(o!==Be)return!1;const{floor:e,cap:r}=mi();return n.index>=e&&n.index<=r}if(o===Be)return!1;const r=ds(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Mi(o))},ps=(e,n)=>{const t=as(e,n);if("block"!==t.kind&&rs(Tn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&is(n,o)){if("section"===e.kind)bo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;bo.insertNode(n,t,vi(e.template.node))}or(V),bo.select({index:t,zone:n})}})(t,Tn(n),n.index);if("section"===t.kind)return void al(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=ll(t),r=bo.insertNode(Be,o,n);dl(o,r,e)})(t.template.name,vi(t.template.node),n.index);if("preset"===t.kind)return void((e,n,t)=>{const o=n({nodeDefaults:Ni,newNodeId:Te,sectionLabel:Ii,blockIsOffered:wr});if(!o)return;const r=ll(t),i=bo.insertNode(Be,r,o);dl(r,i,e)})(t.preset.label,t.preset.insert,n.index);if("shared"===t.kind){const e=Ut.shared?.nodeOf(t.section);if(!e)return;const o=ll(n.index);return void(ki.restore(e,{parentId:Pn,slot:$n,index:o})&&dl(o,e.props.id,t.section.title))}const o=Tn(n),r=ds(o);r&&(r.target.spec?Ml(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{bo.insertComponent(e,n,t),or(V),bo.select({index:t,zone:e})})(o,t.type,n.index))},us=(e,n)=>{e.media?function(e){const n=Gs();if(!n||!Xs)return;_s(n).then(n=>{n&&function(e,n){if(!Xs)return;const t=Xs.create(e,{nodeDefaults:Ni,newNodeId:Te,sectionLabel:Ii,blockIsOffered:wr}),o=Tn(n);if(o===Be){const e=ll(n.index),o=bo.insertNode(Be,e,t);return void dl(e,o,Ii(t.type))}bo.insertNode(o,n.index,t),or(V),bo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Wi(e.rung.nodeId,e.index,n.index):e.add?ps(e.add,n):e.zone===Be?sl(e.index,n.index):ns(e.zone,Tn(n),e.index,n.index)},[fs]=Rn(()=>yn()),hs=vn({keyOf:e=>e.id,readOnly:Boolean(Tt),session:fs,canDrop:ls,onDrop:us,onStep:(e,n)=>{e.rung?Wi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Be?((e,n)=>{const t=Ii(hi[e]?.type??""),o=sl(e,n<0?e-1:e+2);if(!o.moved)return void Qr(n<0?oo.sectionFirst({name:t}):oo.sectionLast({name:t}));const{floor:r,cap:i}=mi();Qr(oo.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):ns(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),ms=Dn(e=>{const{floor:n,cap:t}=mi(),o=[];for(const r of e.nodes){const e=Tn(r.place),i=Mi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(qt(i)||eo(i)||yr(i.type,i))continue;if(Qt(i.type))continue;const l=Boolean(rs(e)),s=e===Be||l;e===Be&&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?Ii(i.type):Ui(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=Tn(e.list);if(n===Be&&0===e.children.length)return[{...e,addLabel:oo.addSection,addAlways:!0}];const t=ds(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(rs(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=Tn(e.list),t=n===Be||rs(n)?null:ds(n);return t?.choices.length?fn(e,t.target.spec?.addLabel??oo.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Ft.data]),gs=null==Wt?.props.id?null:String(Wt.props.id),ys=Wn(Ae),vs=ys?.selected()&&Wo?.document&&gs?ys.selectedPart?.(Wo.document)??null:null,bs=vs&&gs&&Re(Ft.data,Jt,gs,vs)?vs:null,ks=bs?.label?{element:bs.element,label:bs.label}:null,Ss=null!==bs,ws=Dn(e=>{const n=Jt,t=e=>!e.item.rung&&null!==jn(Ft.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(gs);return i?Ss?null:i:r(He(Ft.data,n,o.item.id,gs,Vl))??o},[Ft.data,Jt,gs,Vl,Ss]),[xs,zs]=Rn(null),[Cs,Os]=Rn(null),Bs=zr.canvasTab,Ns=Boolean(Dl||Hl||Bs);zn(Wo,"mouseover",e=>{if(!Ns)return;const n=Cn(e.target),t=n?yt(Ft.data,Jt,n):null;t!==xs&&zs(t),Bs&&n!==Cs&&Os(n)}),zn(Wo,"mouseout",e=>{Ns&&!e.relatedTarget&&(zs(null),Os(null))});const Is=e=>qt(e)||eo(e)||Qt(e.type),Ps=e=>{const n=Qt(e.type)?Bi(e.type):qt(e)?oo.header:eo(e)?oo.footer:null;return null===n?Pi(e):zr.rowName?zr.rowName(e,"section",n):n},$s=[];if(Ns){const e=gs?yt(Ft.data,Jt,gs):null;for(const n of/* @__PURE__ */new Set([e,xs])){const e=n?hi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=qt(e)||e.type===Xt,o=Jl(e);if(o){$s.push({id:String(e.props.id),label:Ps(e),below:t,reach:o});continue}if(!Dl||!Is(e))continue;const r=Dl(e);r&&$s.push({id:String(e.props.id),label:r,below:t})}for(const e of Bs?/* @__PURE__ */new Set([gs,Cs]):[]){const n=e?ji(e):void 0,t=n?Bs(n):null;t&&!$s.some(n=>n.id===e)&&$s.push({id:e,label:t,below:!1,above:!0})}}const Ts=fe(),Ms=Ln(null);Fn(()=>{const e=Ut.changeNotice;if(!e)return;const n=JSON.stringify(hi.filter(Is)),t=Ms.current;if(Ms.current={doc:Jn,bands:n,index:Vt.index},!t||t.doc!==Jn||t.bands===n)return;Vt.hasPast&&Vt.index>=t.index&&!gt.has(Ts)&&(gt.add(Ts),Qr(e,"success",{action:{label:oo.bar.undo,onClick:()=>Vt.back()},duration:8e3}))},[hi]);const js=e=>{or(V),bo.select(e.zone===Be?{index:e.index}:{index:e.index,zone:e.zone})},Es=q(),Ls=()=>({data:Ft.data,device:No,ops:bo,inspector:fr}),As=Es?.model,Rs=An(()=>As?e=>As(e,ms(e),Ls()):ms,[As,ms,No]),Fs=Es?.measure,Ds=Fs?(e,n)=>Fs(e,n,Ls()):void 0,Vs=Es?.canDrop,Ws=Vs?(e,n)=>Vs(e,n,ls,Ls()):ls,Hs=Es?.drop,Js=Hs?(e,n)=>Hs(e,n,us,Ls()):us,Us=Es?.pick,Ys=Us?e=>Us(e,js,Ls()):js,Xs=Es?.media??null,Ks=Ln(null),Qs=An(()=>Xs?{id:ht,zone:"",index:-1,type:Xs.adds.type,add:{kind:Xs.adds.kind,type:Xs.adds.type},media:!0}:null,[Xs]);Fn(()=>{if(!Qs||Tt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(nt))(e)&&(Ks.current=null,fs.start({key:ht,item:Qs}))},n=e=>{fs.get()?.item.media&&(Ks.current=Qn(e.dataTransfer))},t=()=>{fs.get()?.item.media&&fs.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)}},[Qs,Tt,fs]);const Gs=()=>{const e=Ks.current;return Ks.current=null,e},Zs=ce(),_s=async e=>{if(!Zs)return e;const n=await Zs(e);return n?{...e,id:n.id,url:n.url}:null};const qs=(e,n)=>{if(!Xs)return;const t=jn(vo.getState().appState.data,gi,n);if(!t)return;const o=t.node;bo.replaceComponent(Tn(t.place),t.place.index,{...o,props:{...Xs.replace(o,e),id:o.props.id}})},ed=e=>{const n=Tn(e),t=Li(n);t&&Di(t.node,t.slot,!1),pl(n,e.index)},nd=(e,n)=>/* @__PURE__ */pt(Qe,{...Tt?{}:hs.seam({place:{...Mn(e),index:n}})},`seam:${e}:${n}`),td={rowClick:hl,isCollapsed:Jr,toggleCollapse:Ur},od=e=>{const n=String(e.props.id),t=hi.findIndex(e=>String(e.props.id)===n),o=Gt(n),r=Mi(o),i=Jr(n),l=Bi(e.type),s=zr.rowName?zr.rowName(e,"section",l):l,d=e=>nd(o,e);/* @__PURE__ */
16
- return ut(ft,{children:[
17
- /* @__PURE__ */pt(Je,{words:ro,icon:/* @__PURE__ */pt(Or,{type:e.type,size:13}),name:s,preview:gl(e),marks:yl(e),onSelect:()=>il(t),nameSlot:Xi(Be,t,n,s),selected:rr===n,badge:Jl(e)?void 0:Kl,shared:Jl(e),actions:vl(e,Be,t)??void 0,rowProps:{"data-node-id":n,onClick:hl(()=>il(t))},fold:{open:!i,label:"section",onToggle:()=>Ur(n)}}),!i&&/* @__PURE__ */ut(Ue,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Pi(n),l=Pl(n),s=l&&Jr(r),a=()=>Tl(o,t,r,e.type),{rowProps:c,...p}=hs.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Mn(o),index:t}},{"data-node-id":r,onClick:hl(a)});/* @__PURE__ */
18
- return ut(Hn,{children:[d(t),
19
- /* @__PURE__ */pt(Je,{words:ro,icon:/* @__PURE__ */pt(Or,{type:n.type,size:13}),name:i,preview:gl(n),marks:yl(n),onSelect:a,nameSlot:Xi(o,t,r,i),selected:rr===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Ur(r)}:void 0,actions:/* @__PURE__ */ut(ft,{children:[ml(o,t,i),vl(n,o,t),bl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */pt(Ue,{children:ld(n,2)})]},r)}),d(r.length)]})]})},rd=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=hs.dragging,d=!Jr(l)&&s?.rung?.nodeId!==i,a={...Mn(l),index:0},c=s&&!s.rung&&ls(s,a)?a:void 0,p=()=>Di(e,n,!0),{rowProps:u,...f}=hs.row({item:{id:`rung:${l}`,zone:`${i}:${wt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:wt,index:t},into:c,canDrag:Boolean(gr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:hl(p)}),h=Tt?null:gr.slotActions?.(e,n.slot);/* @__PURE__ */
20
- return ut(Hn,{children:[n.heading,
21
- /* @__PURE__ */pt(Je,{words:ro,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Ai===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Ur(l)},actions:h&&h.length>0?/* @__PURE__ */pt(ft,{children:h.map((t,o)=>/* @__PURE__ */pt(Ke,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Tt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Vi(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__ */pt(lt,{size:15}):/* @__PURE__ */pt(ct,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */pt(Ue,{children:r})]},l)},id=(e,n)=>{const t=zl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
22
- return pt(ft,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Bl(e,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)=>nd(e,n),p=/* @__PURE__ */ut(ft,{children:[i.map(({child:n,zone:t,index:o})=>{const r=rr===String(n.props.id),{collapsible:i,folded:s}=Nl(n,l,$l(n.type)),d=String(n.props.id),a=es(n),p=()=>Tl(t,o,d,e.type),{rowProps:u,...f}=hs.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Mn(t),index:o}},{"data-node-id":d,onClick:hl(p)});/* @__PURE__ */
23
- return ut(Hn,{children:[0===o&&c(t,0),
24
- /* @__PURE__ */pt(Je,{words:ro,icon:/* @__PURE__ */pt(Or,{type:n.type,size:13}),name:a,preview:gl(n),marks:yl(n),onSelect:p,nameSlot:Xi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Ur(d)}:void 0,actions:/* @__PURE__ */ut(ft,{children:[ml(t,o,a),vl(n,t,o),bl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */pt(Ue,{children:id(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?rd(e,t.rung,r++,o,p):/* @__PURE__ */pt(Hn,{children:p},t.slot??"")})})},ld=(e,n)=>{const t=br(Ft?.data,e.type,String(e.props.id)),o=zl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
25
- return pt(ft,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Bl(e,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>nd(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),v=/* @__PURE__ */ut(ft,{children:[l.map(({child:n,zone:t,index:o})=>{const r=rr===String(n.props.id),i=Ui(n),l=String(n.props.id),{collapsible:d,folded:a}=Nl(n,s,$l(n.type)),c=wl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...Mn(p),index:Mi(p).length}:void 0,f=hs.dragging,h=u&&f&&ls(f,u)?u:void 0,g=()=>Tl(t,o,l,e.type),{rowProps:y,...v}=hs.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Mn(t),index:o},into:h,canDrag:!yr(n.type,n)},{"data-node-id":l,onClick:hl(g)});/* @__PURE__ */
26
- return ut(Hn,{children:[0===o&&m(t,0),
27
- /* @__PURE__ */pt(Je,{words:ro,icon:/* @__PURE__ */pt(Or,{type:n.type,size:13}),name:i,preview:gl(n),marks:yl(n),onSelect:g,nameSlot:Xi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Ur(l)}:void 0,actions:yr(n.type,n)?vl(n,t,o)??void 0:/* @__PURE__ */ut(ft,{children:[ml(t,o,i),vl(n,t,o),bl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */pt(Ue,{children:ld(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
28
- /* @__PURE__ */pt(z,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Ml(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?rd(e,o.rung,i++,r,v):/* @__PURE__ */pt(Hn,{children:v},o.slot??"")})})},sd=Qo,dd=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:So&&!sd&&mr===e.id,onSelect:()=>ui(e.id)}:e,ad=[...(hr.railLead??[]).map(dd),{id:"sections",label:oo.layers,icon:/* @__PURE__ */pt(ge,{}),active:So&&!sd&&"sections"===mr,onSelect:()=>ui("sections")},...(hr.railTrail??[]).map(dd)],cd=$o?{onPress:To}:Lt?{onPress:()=>{x(Sn,{accept:"image/*",title:po.mediaLibrary})}}:null,pd={value:ad.find(e=>!0===e.active)?.id??"",press:e=>{const n=ad.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:ad.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */pt("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},ud=[...hr.railLead??[],...hr.railTrail??[]].find(e=>"panel"in e&&e.id===mr),fd=Boolean(to?.foldable),hd=to?.label??(At?oo.pageSections:oo.templateSections),md=fd&&Jr(zt),gd=/* @__PURE__ */ut(ft,{children:[hi.map((e,n)=>{if(qt(e)||eo(e)||Qt(e.type))return null;const t=rr===String(e.props.id),o=Boolean(e.props._hidden);xl(e);const r=String(e.props.id),i=hr.hasOwnRows?.(e)??!1,l=Pl(e)||i,s=l&&Jr(r),d=wl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...Mn(a),index:Mi(a).length}:void 0,p=hs.dragging,u=c&&p&&ls(p,c)?c:void 0,{rowProps:f,...h}=hs.row({item:{id:r,zone:Be,index:n,type:e.type},place:{...Mn(Be),index:n},into:u,canDrag:!yr(e.type,e)},{"data-node-id":r,onClick:hl(()=>il(n))});/* @__PURE__ */
29
- return ut(Hn,{children:[n>0&&kl(n),
30
- /* @__PURE__ */pt(Je,{words:ro,icon:/* @__PURE__ */pt(Or,{type:e.type,size:13}),name:Pi(e),preview:gl(e),marks:yl(e),shared:Jl(e),onSelect:()=>il(n),nameSlot:Xi(Be,n,r,Pi(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Ur(r)}:void 0,actions:/* @__PURE__ */ut(ft,{children:[ml(Be,n,Pi(e)),vl(e,Be,n),bl(Be,n,e,Pi(e))]}),rowProps:f}),Pl(e)&&!s&&/* @__PURE__ */ut(Ue,{children:[ld(e,1),hr.partRows?.(e,td)]}),i&&!s&&/* @__PURE__ */pt(Ue,{children:hr.ownRows?.(e,n,td)})]},String(e.props.id??n))}),Zl>0&&kl(Zl)]}),yd=(e,n,t)=>{const o=String(e.props.id),r=Cl(e).length>0||Ol(e)||Boolean(Sr(e.type)),i=r&&Jr(o),l="header"===t?oo.header:oo.footer,s=zr.rowName?zr.rowName(e,"section",l):l;/* @__PURE__ */
31
- return ut(ft,{children:[
32
- /* @__PURE__ */pt(Je,{words:ro,icon:/* @__PURE__ */pt(Or,{type:t,size:13}),name:s,preview:gl(e),marks:yl(e),badge:Jl(e)?void 0:Kl,shared:Jl(e),onSelect:()=>il(n),nameSlot:Xi(Be,n,o,s),selected:rr===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Ur(o)}:void 0,actions:vl(e,Be,n)??void 0,rowProps:{"data-node-id":o,onClick:hl(()=>il(n))}}),r&&!i&&/* @__PURE__ */pt(Ue,{children:id(e,1)})]})};return(hr.wrap??(e=>e))(
33
- /* @__PURE__ */pt(ee,{target:Wo,children:/* @__PURE__ */ut("div",{ref:Vo,className:"sf-editor es-editor",style:ln(Fr),onContextMenu:qi.onEditorContextMenu,...p(Sn),children:[
34
- /* @__PURE__ */ut(Ze,{children:[
35
- /* @__PURE__ */ut("div",{className:"es-cluster es-cluster--left",children:[cd?/* @__PURE__ */pt(Yn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */pt(ye,{}),onClick:cd.onPress,children:oo.railMedia}):null,
36
- /* @__PURE__ */pt(_e,{label:oo.bar.undo,disabled:Boolean(Tt)||!Vt.hasPast,onClick:()=>Vt.back(),children:/* @__PURE__ */pt(tt,{})}),
37
- /* @__PURE__ */pt(_e,{label:oo.bar.redo,disabled:Boolean(Tt)||!Vt.hasFuture,onClick:()=>Vt.forward(),children:/* @__PURE__ */pt(ot,{})})]}),
38
- /* @__PURE__ */ut(qe,{children:[
39
- /* @__PURE__ */pt(en,{devices:xo,value:No,onChange:Io}),
40
- /* @__PURE__ */pt(_e,{label:oo.bar.refresh,tip:oo.bar.refreshTip,onClick:()=>{Do.current=(()=>{const e=Wo?.document;if(!e)return null;const n=hi.findIndex(eo),t=n>=0?n:hi.length;let o=null;for(let n=0;n<t;n++){const t=hi[n]?.props?.id;if(null==t)continue;const r=In(e,`[data-easel-block="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=Wt?.props?.id??hi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Fo(e=>e+1)},children:/* @__PURE__ */pt(rt,{})}),hr.barView?.()]}),
41
- /* @__PURE__ */ut(qe,{kind:"right",style:{minWidth:300},children:[
42
- /* @__PURE__ */pt(b,{input:Xo,words:oo.saveStatus}),On?/* @__PURE__ */pt(On,{}):null,hr.barLead?.(),hr.barTrail?.(),hr.mainAction||!hr.barMain?/* @__PURE__ */pt(k,{input:Xo,action:hr.mainAction??{label:oo.done,onPress:()=>{qn(Ft.data)}},readOnly:Boolean(Tt),saveSwitch:jt,onToggleAutoSave:Nt,onSaveNow:Ko,bar:oo.bar,words:oo.saveStatus}):hr.barMain()]})]}),
43
- /* @__PURE__ */pt(v,{}),
44
- /* @__PURE__ */ut("div",{className:"sf-body",children:[So?/* @__PURE__ */ut(ft,{children:[
45
- /* @__PURE__ */ut("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":oo.leftPanel,children:[
46
- /* @__PURE__ */ut("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
47
- /* @__PURE__ */pt(N,{side:"left",onHide:ci}),
48
- /* @__PURE__ */pt("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
49
- /* @__PURE__ */pt(Xn,{variant:"underline",block:!0,"aria-label":oo.bar.views,value:pd.value,onChange:pd.press,items:pd.items})]}),Qo?/* @__PURE__ */pt(C,{at:_o?{label:(e=>{const n=rs(e.zone);if(n)return oo.add.addingTo({name:zr.rowName?fl(n,!0):Bi(n.type)});if(e.zone===Be){const n=hi[e.index];return n&&!eo(n)?oo.add.addingBefore({name:fl(n,!0)}):oo.add.addingAtEnd}const t=ds(e.zone);return t?oo.add.addingTo({name:t.parentName}):oo.add.addingHere})(_o),onClear:()=>qo(null)}:void 0,placeBlocks:_o&&_o.zone!==Be?ds(_o.zone)?.choices:void 0,canTake:_o?e=>{if(!_o)return null;const n={...Mn(_o.zone),index:_o.index};if(cs(e,n))return null;if("shared"===e.kind&&_o.zone===Be&&!Ut.shared?.nodeOf(e.section))return oo.shared.alreadyHere;const t=rs(_o.zone);if(t)return oo.add.notInside({name:fl(t,!0)});if(_o.zone===Be)return oo.add.onlySections;const o=ds(_o.zone);return o?oo.add.notInside({name:o.parentName}):oo.add.onlySections}:void 0,onPick:_o?e=>{if(!_o)return;const n={...Mn(_o.zone),index:_o.index};cs(e,n)&&(ps(e,n),ul())}:void 0,itemFor:e=>({id:`new:${e.kind}:${xt(e)}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:xt(e),add:e}),session:fs,siteWide:hr.addPanelRow?.(ul),onClose:ul,readOnly:Boolean(Tt)}):ud?ud.panel({onHide:ci,notify:Qr}):/* @__PURE__ */ut(ft,{children:[
50
- /* @__PURE__ */pt(I,{icon:/* @__PURE__ */pt(ge,{}),title:oo.layers,context:uo,actions:/* @__PURE__ */ut(ft,{children:[!Tt&&/* @__PURE__ */pt(nn,{label:oo.add.title,onClick:()=>cl(null),children:/* @__PURE__ */pt(it,{size:15})}),
51
- /* @__PURE__ */pt(nn,{label:ql?oo.expandAll:oo.collapseAll,title:0===_l.length?oo.nothingToFold:void 0,disabled:0===_l.length,onClick:()=>Rr(e=>{const n=new Set(_l);return ql?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,..._l])}),children:/* @__PURE__ */pt(bt,{expand:ql})})]})}),
52
- /* @__PURE__ */ut(Ye,{className:"sf-tree sf-scroll",words:ro,children:[Ql&&/* @__PURE__ */ut(ft,{children:[!Wl&&/* @__PURE__ */pt(Xe,{children:oo.header}),od(Ql)]}),Rt&&!(Wl&&Ql)&&/* @__PURE__ */ut(ft,{children:[!Wl&&/* @__PURE__ */pt(Xe,{children:oo.header}),!no&&/* @__PURE__ */pt(Je,{words:ro,icon:/* @__PURE__ */pt(Or,{type:"header",size:13}),name:oo.header,badge:Xl?void 0:Kl,shared:Xl,onSelect:fi,selected:tr.kind===_t?.kind,rowProps:{onClick:hl(fi)}})]}),Fl&&!(Wl&&Ql)&&yd(Fl,Rl,"header"),!fd&&/* @__PURE__ */pt(Xe,{children:hd}),fd?/* @__PURE__ */ut(ft,{children:[
53
- /* @__PURE__ */pt(Je,{words:ro,icon:null,name:hd,fold:{open:!md,label:hd,onToggle:()=>Ur(zt)}}),!md&&/* @__PURE__ */pt(Ue,{children:gd})]}):gd,Rt&&!Wl&&/* @__PURE__ */pt(Xe,{children:oo.footer}),Al&&!(Wl&&Gl)&&yd(Al,Ll,"footer"),Gl&&od(Gl),hr.treeFoot?.()]})]})]}),
54
- /* @__PURE__ */pt(tn,{side:"left",width:Fr.left,min:rn.left,max:on,defaultWidth:h.left,label:oo.resizeLeftPanel,onResize:Wr})]}):/* @__PURE__ */pt(P,{side:"left",onShow:ci}),
55
- /* @__PURE__ */ut("div",{ref:Gr,className:"sf-center sf-scroll","data-sf-canvas-head":ni?"":void 0,style:{overflowX:si?"auto":"hidden",overflowY:"hidden"},children:[ni&&/* @__PURE__ */pt("div",{ref:ti,className:"sf-canvas-head",children:/* @__PURE__ */pt(ni,{device:No})}),
56
- /* @__PURE__ */ut("div",{className:"sf-frame-scaler",style:di,children:[
57
- /* @__PURE__ */pt("div",{className:"sf-frame "+(No===Oo?"":`sf-frame--${No}`),style:ai,children:/* @__PURE__ */ut("div",{className:"sf-preview-host",children:[
58
- /* @__PURE__ */pt(Fe.Provider,{value:Vl,children:/* @__PURE__ */pt(De.Provider,{value:Yl,children:/* @__PURE__ */pt(fo,{},Ro)})}),
59
- /* @__PURE__ */pt(hn,{canvas:Wo,session:fs,model:Rs,measure:Ds,canDrop:Ws,onDrop:Js,choose:ws,tag:ks,onPick:Ys,dropOn:Xs?{accepts:(e,n)=>{if(!e.media||!Xs||n.item.rung)return!1;const t=jn(Ft.data,gi,n.item.id);return null!==t&&Xs.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Gs();n&&Xs&&_s(n).then(n=>{n&&qs(n,e.item.id)})})(n),label:()=>oo.canvasReplaceImage}:void 0,onZoneAdd:ed,onSeamAdd:ed,zoneAddLabel:oo.canvasAddBlock,words:io.canvas,readOnly:Boolean(Tt),revision:Ft.data}),er.length>0&&!Ho&&/* @__PURE__ */pt("div",{className:"sf-preview-gaps",children:er.map(e=>
60
- /* @__PURE__ */pt(mn,{index:e.index,label:oo.addSectionHere,onInsert:()=>cl(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))})]})}),Ns?/* @__PURE__ */pt(vt,{canvas:Wo,tabs:$s,onSelect:Fi}):null]})]}),wo?/* @__PURE__ */ut(ft,{children:[Bn?
61
- /* @__PURE__ */pt("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:Bn}):/* @__PURE__ */pt(ft,{children:/* @__PURE__ */pt(u,{value:{selectChild:Tl,addChild:Ml,childRowName:Ui,blockRowName:es},children:/* @__PURE__ */pt(ho,{mode:tr,onOpenWebsiteSettings:hr.openSettings??(()=>{}),onOpenSiteStyles:hr.openStyles,onOpenPageStyles:hr.openPageStyles,onSelectNode:Pr,onNotify:Qr,onHidePanel:pi,nodeActions:Wt?Ne(Jt,Wt.type):Ct})})}),
62
- /* @__PURE__ */pt(tn,{side:"right",width:Fr.right,min:rn.right,max:on,defaultWidth:h.right,label:oo.resizeSettingsPanel,onResize:Hr})]}):
63
- /* @__PURE__ */pt(P,{side:"right",onShow:pi})]}),qi.menu,
64
- /* @__PURE__ */pt(ie,{}),wi?/* @__PURE__ */pt(mt,{name:wi.name,onMake:e=>(async(e,n)=>{const t=hi.find(n=>String(n.props.id)===e),o=Ut.shared;if(!t||!o)return;let r;try{r=await B(Si).create(n,t)}catch{return void Qr(oo.shared.makeFailed,"error")}o.adopt(t,r),xi(null)})(wi.id,e),onCancel:()=>xi(null)}):null]})}))}export{Bt as ScreenChrome};
@@ -1,5 +0,0 @@
1
- import{usePickFollowsSelection as n}from"./chunk-NCXYC7WI.js";import{slotFieldsOf as e,slotChildrenIn as t}from"./chunk-TCAAOYQY.js";import{EaselCanvas as r,useSelectedFields as o}from"./chunk-OB5JP6PR.js";import{Inspector as i}from"./chunk-RZ54L6EW.js";import{fieldIsShown as u}from"./chunk-BPXEFVSQ.js";import{createContext as l,useContext as s}from"react";import{DesktopIcon as c}from"efficient-shell/icons/efficient";import{jsx as f}from"react/jsx-runtime";var a={kind:"selection"};function d(n){return"selection"===n.kind}function p(n,e){if(d(n)&&d(e))return!0;const t=n,r=e,o=Object.keys(t);return o.length===Object.keys(r).length&&o.every(n=>Object.is(t[n],r[n]))}function m(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function k(n,t){const r=n.components?.[t.type]?.fields??{};return e(n,t.type).filter(n=>u(r[n],{values:t.props}))}function h(n,e){return k(n,e).flatMap(n=>t(e,n))}function v(n,e,t){const r=n.slotsOf?.(t);return r||k(e,t).map(n=>({slot:n,label:n,rung:!1}))}function y(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function g(n,e){return n.isLast?n.isLast(e):e.type===n.last}var b={},O=()=>b,j=()=>"",w=()=>null,C=()=>{},L={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},P={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},S={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */f(c,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},B={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},N={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function D(){/* @__PURE__ */
2
- return f(r,{height:"fill"})}function I(){const{id:n,fields:e,values:t,readOnly:r,onChange:u}=o();/* @__PURE__ */
3
- return f("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */f(i,{fields:e,values:t,onChange:u,readOnly:r,idPrefix:n})})}var x=l({});function A({parts:n,children:e}){/* @__PURE__ */
4
- return f(x.Provider,{value:n,children:e})}function F(){return s(x)}function G(){return(F().useOwnerName??j)()}function R(){return(F().useDocumentLabel??w)()}function T(n,e,t,r){return(F().useBridges??O)(n,e,t,r)}function Y(n){return(F().useStandaloneBridges??O)(n)}function E(n,e){(F().useDocumentPass??C)(n,e)}function Q(){return F().blockRules??L}function V(){return F().blockLook??P}function W(){return F().devices??S}function X(){return F().leftView??B}function Z(){return F().pinned??N}function H(){return F().saveSwitch??!0}function J(e){n(!0===F().pickFollowsSelection,e)}function K(){return F().storageNamespace||void 0}function M(){return F().styleClipboard??null}function q(){return F().nodeKeys??!0}function z(){return F().notify??null}function U(){return F().Canvas??D}function $(){return F().CanvasHead??null}function _(){return F().canvasDrag??null}var nn=l(null);function en({target:n,children:e}){/* @__PURE__ */
5
- return f(nn.Provider,{value:n,children:e})}function tn(){return s(nn)}function rn(){return F().Inspector??I}export{a as SELECTION_MODE,en as ScreenCanvasTargetProvider,A as ScreenPartsProvider,y as isPinnedFirst,g as isPinnedLast,d as isSelectionMode,m as isSlotMode,p as sameInspectorMode,v as screenSlotsOf,h as shownChildSlotsOf,k as shownSlotFieldsOf,V as useScreenBlockLook,Q as useScreenBlockRules,T as useScreenBridges,_ as useScreenCanvasDrag,U as useScreenCanvasFrame,$ as useScreenCanvasHead,tn as useScreenCanvasTarget,W as useScreenDevices,R as useScreenDocumentLabel,E as useScreenDocumentPass,rn as useScreenInspectorPanel,X as useScreenLeftView,q as useScreenNodeKeys,z as useScreenNotify,G as useScreenOwnerName,F as useScreenParts,J as useScreenPickFollowsSelection,Z as useScreenPinned,H as useScreenSaveSwitch,K as useScreenStorageNamespace,M as useScreenStyleClipboard,Y as useStandaloneScreenBridges};
@@ -1 +0,0 @@
1
- import{newNodeId as o}from"./chunk-TCAAOYQY.js";import{isNodeList as t}from"./chunk-KXM6YRG2.js";function n(o){return{root:{props:{}},content:[o],zones:{}}}function r(o){return(o.content??[])[0]??null}function p(n,r){const e={...n.props,id:o(n.type)};for(const[o,n]of Object.entries(e))t(n)&&(e[o]=n.map(o=>p(o,r)));const s={type:n.type,props:e};if(!r)return s;const c=r(s);return{...c,props:{...c.props,id:e.id}}}export{p as cloneNodeWithFreshIds,r as docToNode,n as nodeToDoc};
@@ -1,4 +0,0 @@
1
- import{useAccessPatch as e,FLAT_ACCESS as o,onDesktopWords as r,useAccessValue as t}from"./chunk-AYYPU7YZ.js";import{noControlField as s,NoControlMark as l}from"./chunk-22I55W37.js";import{normalizeCornerSides as n,CORNER_SIDES as i}from"./chunk-PLTTPHK5.js";import{CornersInput as c,BorderInput as a,SettingsColour as d}from"./chunk-CLAADE4J.js";import{SettingsDefaultReset as u}from"./chunk-2T22IY3J.js";import{DEFAULT_PANEL_WORDS as p,DEFAULT_COLOUR_ROW_WORDS as y}from"./chunk-56ID6FKZ.js";import{SettingsField as f}from"./chunk-MIX7EGRG.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{CornerIcon as m,BorderAllIcon as b}from"efficient-shell/icons/efficient";import{jsx as w}from"react/jsx-runtime";var g=e=>e;function v(e,o){const r=o.twinAccess;return r?{key:e.key,access:r,ownField:r.ownField}:e}function k(e,r){const s=!e.access||e.ownField?{value:r.value,onChange:r.onChange}:void 0;return t(e.access??o,e.key,s)}function F(e,r){return t(e.access??o,r??"")}function j(e){return{...s({type:"custom",render:()=>/* @__PURE__ */w(l,{})},"always"),reachedBy:e}}function C({o:t,say:s,props:l}){const n=h("colourRow",y),i=h("panel",p),c=t.useFollows(),a=t.usePresets?.(),u=t.opacity?.useUnset?.()??100,f=v(t,l),[m,b]=k(f,l),[g,j]=F(f,t.opacity?.key),C=e(f.access??o),B="string"==typeof m?m:"",O="number"==typeof g,A="follows"in l,T=(A&&"string"==typeof l.follows&&""!==l.follows?l.follows:void 0)??c,x=t.access||A?void 0:"";/* @__PURE__ */
2
- return w(d,{label:s(t.label),icon:t.icon,value:B,onChange:e=>b(""===e?x:e),inherited:T,presets:a,changed:""!==B||O,onReset:()=>{O&&t.opacity?C([[t.key,x],[t.opacity.key,void 0]]):b(x)},resetTo:A?r(s,T.toUpperCase()):t.resetTo?t.resetTo(c.toUpperCase()):c.toUpperCase(),...t.opacity?{opacity:O?g:u,onOpacityChange:e=>j(e)}:{},readOnly:l.readOnly,words:n,resetWords:i})}var B=20;function O({o:e,say:o,props:t}){const s=e.useFollows(),[l,n]=k(v(e,t),t),i=l&&"object"==typeof l?l:{},c="follows"in t,d=c&&t.follows&&"object"==typeof t.follows?t.follows:{},p="number"==typeof d.width?d.width:s.width,y="string"==typeof d.color&&""!==d.color?d.color:s.color,h=Object.keys(i).length>0,m={width:o("Border width"),sides:{top:o("Border top"),right:o("Border right"),bottom:o("Border bottom"),left:o("Border left")},style:o("Border style"),styles:{solid:o("Solid"),dashed:o("Dashed"),dotted:o("Dotted")},color:o("Border color"),unit:"px"};/* @__PURE__ */
3
- return w(f,{label:o("Border"),icon:/* @__PURE__ */w(b,{}),action:c?/* @__PURE__ */w(u,{label:o("Border"),changed:h,detail:r(o,`${p}px`),disabled:t.readOnly,onReset:()=>n(void 0)}):void 0,children:/* @__PURE__ */w(a,{label:o("Border"),value:i,each:!1,onChange:o=>n(function(e){const o=Object.fromEntries(Object.entries(e).filter(([,e])=>null!=e&&""!==e));return Object.keys(o).length?o:void 0}(e.styles?{width:o.width,color:o.color,style:o.style}:{width:o.width,color:o.color})),placeholder:{sides:{top:p,right:p,bottom:p,left:p},style:d.style??"solid",color:y},presets:[y],words:m,styles:e.styles??!1,max:20,readOnly:t.readOnly})})}var A=40,T=()=>null;function x({o:r,say:t,props:s}){const l=h("panel",p),a=r.useFollows(),[d,y]=k(r,s),[b,g]=F(r,r.sidesKey),v=e(r.access??o),j=r.access?void 0:null,C="number"==typeof d&&Number.isFinite(d)?d:null,B=n((r.useFollowsSides??T)())??[...i],O=n(b)??B,A=[{value:"tl",label:t("Top left")},{value:"tr",label:t("Top right")},{value:"bl",label:t("Bottom left")},{value:"br",label:t("Bottom right")}];/* @__PURE__ */
4
- return w(f,{label:t("Corners"),icon:/* @__PURE__ */w(m,{}),changed:null!==C||Array.isArray(b),action:/* @__PURE__ */w(u,{label:t("Corners"),changed:null!==C||Array.isArray(b),detail:`${a}px`,onReset:()=>Array.isArray(b)?v([[r.key,j],[r.sidesKey,j]]):y(j),words:l}),children:/* @__PURE__ */w(c,{label:t("Corners"),value:O,corners:A,onChange:e=>{const o=i.filter(o=>e.includes(o)),r=o.length===B.length&&o.every(e=>B.includes(e));g(r?j:o)},radius:C,onRadiusChange:e=>y(e??j),radiusMin:0,radiusMax:40,radiusStep:r.step??1,radiusPlaceholder:String(a),disabled:s.readOnly})})}function R(e=g){return{colourField:o=>({type:"custom",render:r=>/* @__PURE__ */w(C,{o:o,say:e,props:r})}),borderField:o=>({type:"custom",render:r=>/* @__PURE__ */w(O,{o:o,say:e,props:r})}),cornersField:o=>({type:"custom",render:r=>/* @__PURE__ */w(x,{o:o,say:e,props:r})})}}var{colourField:I,borderField:P,cornersField:U}=R();export{B as BORDER_WIDTH_MAX,A as CORNER_RADIUS_MAX,P as borderField,I as colourField,U as cornersField,j as keptByRow,R as styleFieldBuilders};
@@ -1 +0,0 @@
1
- import{useScreenBlockRules as e}from"./chunk-OXKGD2K7.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-TCAAOYQY.js";import{useEasel as o,useEaselApi as r}from"./chunk-OB5JP6PR.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 +0,0 @@
1
- import{useEaselSession as e}from"./chunk-YM4UEGBV.js";import{useHostEscape as n}from"./chunk-LX23TCTP.js";import{createNodeClipboard as t,nodeMenuItems as o}from"./chunk-P5VYGWYO.js";import{DEFAULT_NODE_MENU_WORDS as l}from"./chunk-WK3AFPXY.js";import{DEFAULT_SCREEN_WORDS as r}from"./chunk-Q3VAJMXS.js";import{styleMenuItems as i}from"./chunk-CWELHADJ.js";import{ROOT_ZONE as c}from"./chunk-TCAAOYQY.js";import{repeatCopyAt as s}from"./chunk-JQQFB7EZ.js";import{easelMenuEntries as a,menuLabel as u}from"./chunk-FIVU2COQ.js";import{useCanvasEvent as d}from"./chunk-TOKMFZPB.js";import{isTypingTarget as p,framePointToHost as f}from"./chunk-FR7EEKFF.js";import{zoneKey as m,ROOT_SLOT as y,ROOT_ID as h}from"./chunk-EUFDQ4KL.js";import{useState as k,useCallback as b,useRef as v,useEffect as x}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{TrashIcon as w,AddIcon as C,MoveUpIcon as O,MoveDownIcon as z,UndoIcon as A,RedoIcon as P,PasteIcon as E,StylesIcon as j,LayersIcon as M,CopyIcon as D}from"efficient-shell/icons/efficient";import{jsx as K}from"react/jsx-runtime";function T(e,n){const t=[],o=/* @__PURE__ */new Set;let l={zone:n.zone,index:n.index};for(;l;){const n=e.nodeAt(l.zone,l.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:l.zone,index:l.index,node:n,parentType:null}),l.zone===c)break;const r=l.zone.lastIndexOf(":");if(r<=0)break;l=e.locate(l.zone.slice(0,r))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var L=t(),I=/* @__PURE__ */new WeakMap;function S(e){if(e.claimsPage)return L;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",t);let o=I.get(n);return o||(o=t(),I.set(n,o)),o}function Y(){return S(e())}function F(e,n,t){if(n===c){const{floor:n,cap:o}=e.sectionBand();return{parentId:h,slot:y,index:Math.min(Math.max(t,n),o)}}const o=n.lastIndexOf(":");return{parentId:n.slice(0,o),slot:n.slice(o+1),index:t}}function X(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function B(e,n,t){const o=e.canPasteAt;if(!o)return m(n.from)===t.zone?F(e,t.zone,t.index+1):null;for(const l of T(e,t)){const t=F(e,l.zone,l.index+1);if(o(n,t))return t}return null}function R(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(p(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function V(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=X(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:B(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function Q(e,n){const{zone:t,index:l}=n,r=e.nodeAt(t,l);if(!r)return[];const s=r.props.id,a=e.labelOf(r.type,t),u=Boolean(r.props._hidden),d=e.nodeOps,p=e.isPinned(r,t),f=e.isLocked(r),m=!p&&!f&&!e.duplicateBlocked(r),y=e.permits?.(r)??{duplicate:!0,delete:!0},h=X(e,r,t),k=T(e,n),b=d.held,v=b&&!p?B(e,b,n):null,x=!e.readOnly,g=e.style?i({held:x?e.style.held():null,canCopy:e.style.canCopy(r,t),onCopy:()=>e.style?.copy(r,t),onPaste:()=>e.style?.paste(t,l,r),words:e.words?.styleClipboard}):[];return o({title:a,words:e.words?.menu,layer:{group:"pick",items:k.flatMap((n,t)=>{const o={label:e.rowNameOf(n.node,n.zone),checked:0===t,onClick:()=>e.selectAt(n.zone,n.index,n.node.props.id,n.parentType)},l=n.zone===c?null:e.slotRung?.(n.zone)??null;return l?[o,{label:l.label,checked:!1,onClick:l.select}]:[o]})},actions:{duplicate:x&&m&&y.duplicate?()=>d.duplicate(s):void 0,...W(x&&!p,e=>d.canStep(s,e),e=>d.step(s,e)),copy:h.copy?()=>d.copy(s,a):void 0,cut:x&&h.cut?()=>d.cut(s,a):void 0,paste:x&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:x&&e.renamePropOf(r,t)?()=>e.beginRename(t,l):void 0,hide:!x||f||p?void 0:{hidden:u,run:()=>d.setProps(s,{_hidden:!u})},delete:x&&m&&y.delete?()=>d.remove(s):void 0},style:g,extras:N(x?U(e,n.copy):null,e.menuRows?.(r,t,l)),pinnedLine:p?Z(e).pinned:void 0})}function U(e,n){const t=e.copyItem;if(!t||!n)return null;const o=Z(e),l=r.menu,i=e=>o[e]??l[e]??"",c={ownerId:n.ownerId,slot:n.slot,index:n.index,...n.outer?{outer:n.outer}:{}},s=e=>()=>t({...c,action:e});return{make:[{label:i("itemAddAfter"),icon:/* @__PURE__ */K(C,{}),onClick:s("addAfter")},{label:i("itemMoveEarlier"),icon:/* @__PURE__ */K(O,{}),onClick:s("moveEarlier"),disabled:n.index<=0},{label:i("itemMoveLater"),icon:/* @__PURE__ */K(z,{}),onClick:s("moveLater"),disabled:n.index>=n.count-1}],remove:[{label:i("itemDelete"),icon:/* @__PURE__ */K(w,{}),danger:!0,onClick:s("delete")}]}}function N(e,n){if(!e)return n??void 0;if(!n)return e;return Object.fromEntries(["pick","make","change","remove"].map(t=>[t,[...e[t]??[],...n[t]??[]]]).filter(([,e])=>e.length>0))}function W(e,n,t){return e?{moveUp:n(-1)?()=>t(-1):null,moveDown:n(1)?()=>t(1):null}:{}}var Z=e=>e.words?.screen??r.menu;function J(e){const n=Z(e),t=!e.readOnly,o=[];t&&e.history.hasPast&&o.push({label:n.undo,icon:/* @__PURE__ */K(A,{}),shortcut:"⌘Z",onClick:e.history.back}),t&&e.history.hasFuture&&o.push({label:n.redo,icon:/* @__PURE__ */K(P,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=[],s=e.nodeOps.held,a=F(e,c,e.sectionBand().cap);if(t&&s&&(e.canPasteAt?e.canPasteAt(s,a):m(s.from)===c)){const n=a,t=e.words?.menu??l;i.push({label:t.pasteNamed({paste:t.paste,label:s.label}),icon:/* @__PURE__ */K(E,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[o,i,[...e.openPageStyles?[{label:e.pageStylesLabel??r.pageStyles,icon:/* @__PURE__ */K(j,{}),onClick:e.openPageStyles}]:[],{label:n.collapseAll,icon:/* @__PURE__ */K(M,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function G(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,r=n.value.slice(t,o),i=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},c=e.words?.menu??l,s=Z(e),a=[];r&&(a.push({label:c.copy,icon:/* @__PURE__ */K(D,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(r)}),a.push({label:c.cut,icon:/* @__PURE__ */K(D,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(r),i("")}})),a.push({label:c.paste,icon:/* @__PURE__ */K(E,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&i(e)}).catch(()=>e.onPasteRefused())}});const u=[a,n.value?[{label:s.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function _(e){return e.shiftKey}function H(e,t){const[o,l]=k(null),r=b(()=>l(null),[]);n(null!==o,r);const i=v(e);i.current=e;const c=b(e=>{const n=i.current,t=n.keys;if(!t)return;const o=R(e);if(!o)return;const l=t.selected();if(!l)return;const r=V(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),a=e.keys?.target??null;x(()=>{if(!a)return;const e=e=>c(e);return a.addEventListener("keydown",e),()=>a.removeEventListener("keydown",e)},[a,c]),d(t,"keydown",c);const u=b(n=>{if(_(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);d(t,"contextmenu",n=>{if(_(n)||!t)return;const o=n.target?.closest?.("[data-easel-block]")??null,r=o?.getAttribute("data-easel-block"),i=r?e.locate(r):null;n.preventDefault();const c=f(t.frame,n.clientX,n.clientY),a=t.frame,u=o?s(o):null;l(i?{kind:"node",...c,...i,copy:u,owner:a}:{kind:"empty",...c,owner:a})}),d(t,"mousedown",r),d(t,"scroll",r,{on:"window"});return{onEditorContextMenu:u,menu:o?/* @__PURE__ */K($,{host:e,target:o,onClose:r}):null,closeMenu:r}}function $({host:e,target:n,onClose:t}){const o="node"===n.kind?Q(e,n):"input"===n.kind?G(e,n.el):J(e);return 0===o.length?null:/* @__PURE__ */K(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":u(o),items:a(o)})}export{L as EASEL_NODE_CLIPBOARD,T as ancestorChain,S as nodeClipboardOf,X as nodeClipboardRules,Q as nodeMenuItems,R as nodeShortcut,J as pageMenuItems,B as pastePlace,V as runNodeShortcut,G as textMenuItems,Y as useNodeClipboard,H as useNodeContextMenu};