efficient-easel 27.0.0 → 27.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/dist/blocks/index.d.ts +1 -1
  2. package/dist/canvas/index.d.ts +2 -1
  3. package/dist/canvas/index.js +1 -1
  4. package/dist/chrome/index.js +1 -1
  5. package/dist/{chunk-PVBDKBJB.js → chunk-2EEYFRQM.js} +1 -1
  6. package/dist/{chunk-TYTMUHUK.js → chunk-3FANFZ4D.js} +1 -1
  7. package/dist/{chunk-CWELHADJ.js → chunk-3OOYGEJY.js} +1 -1
  8. package/dist/{chunk-JIP5JNRB.js → chunk-5HYVOOH3.js} +1 -1
  9. package/dist/chunk-6GJEOER4.js +1 -0
  10. package/dist/{chunk-6ATIYLUL.js → chunk-6V6LC7QV.js} +1 -1
  11. package/dist/{chunk-KO47WAWR.js → chunk-7YXWWMBM.js} +1 -1
  12. package/dist/{chunk-GR3XRILS.js → chunk-A5USZ6Z6.js} +1 -1
  13. package/dist/{chunk-Y2T3JX7K.js → chunk-ANBPE45L.js} +1 -1
  14. package/dist/{chunk-KFWNGPW3.js → chunk-C63IB4VW.js} +5 -5
  15. package/dist/chunk-DTEYSPJE.js +64 -0
  16. package/dist/{chunk-YYD257TD.js → chunk-G7J6SGMF.js} +1 -1
  17. package/dist/chunk-GJ427TZL.js +8 -0
  18. package/dist/chunk-J5VPNHOW.js +1 -0
  19. package/dist/{chunk-QZJKWKGH.js → chunk-JUJEVGLY.js} +1 -1
  20. package/dist/chunk-L36E2WCO.js +19 -0
  21. package/dist/chunk-LAJYMOY3.js +1 -0
  22. package/dist/{chunk-K53PQAMP.js → chunk-LDHUPZBK.js} +1 -1
  23. package/dist/{chunk-SBVIW3KJ.js → chunk-MTWQYLJE.js} +1 -1
  24. package/dist/chunk-OB4KI2AN.js +2 -0
  25. package/dist/{chunk-W3UZNKGS.js → chunk-P3HXHLES.js} +4 -4
  26. package/dist/{chunk-3XECMGXX.js → chunk-QEEW4X64.js} +1 -1
  27. package/dist/{chunk-AAZIMKLQ.js → chunk-QPNNWQ24.js} +1 -1
  28. package/dist/{chunk-BFJAEQZ6.js → chunk-RTMDZJNE.js} +1 -1
  29. package/dist/chunk-SDSBXW3V.js +26 -0
  30. package/dist/chunk-SEC6NV6Y.js +18 -0
  31. package/dist/{chunk-5JNVMCCB.js → chunk-SEH3Q3EL.js} +1 -1
  32. package/dist/{chunk-QTHQPJWA.js → chunk-TF6NAIV7.js} +1 -1
  33. package/dist/{chunk-6EDVZBUO.js → chunk-TQUEVJOO.js} +1 -1
  34. package/dist/{chunk-2262JGFV.js → chunk-TUIBPB77.js} +5 -5
  35. package/dist/chunk-UMTUKSE6.js +1 -0
  36. package/dist/chunk-VNUXFD4X.js +1 -0
  37. package/dist/{chunk-VBEVZZTV.js → chunk-VTY7OQB5.js} +11 -11
  38. package/dist/{chunk-76MUJIZE.js → chunk-WL57KM5C.js} +17 -17
  39. package/dist/{chunk-NTG5ODKZ.js → chunk-WW24O7HT.js} +1 -1
  40. package/dist/{chunk-ZFEAWEFS.js → chunk-XESNAMI3.js} +3 -3
  41. package/dist/chunk-XT75WETI.js +1 -0
  42. package/dist/{chunk-YES5F7OS.js → chunk-XV5D4V2T.js} +1 -1
  43. package/dist/chunk-YDTEYXQW.js +1 -0
  44. package/dist/copy/index.js +11 -11
  45. package/dist/data/index.d.ts +2 -1
  46. package/dist/data/index.js +1 -1
  47. package/dist/drag/index.js +1 -1
  48. package/dist/easel/index.d.ts +1 -1
  49. package/dist/easel/index.js +1 -1
  50. package/dist/edit-lock/index.js +1 -1
  51. package/dist/fields/fields.css +8 -0
  52. package/dist/fields/index.d.ts +47 -3
  53. package/dist/fields/index.js +1 -1
  54. package/dist/node-ops/index.js +1 -1
  55. package/dist/phone-order-CRKvsTsz.d.ts +141 -0
  56. package/dist/screen/components/AddBlockRow.js +1 -1
  57. package/dist/screen/components/AddSidePanel.d.ts +1 -1
  58. package/dist/screen/components/AddSidePanel.js +1 -1
  59. package/dist/screen/components/NodeContextMenu.d.ts +1 -1
  60. package/dist/screen/components/NodeContextMenu.js +1 -1
  61. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  62. package/dist/screen/components/SaveControls.d.ts +1 -1
  63. package/dist/screen/components/SaveControls.js +1 -1
  64. package/dist/screen/components/ScreenChrome.js +1 -1
  65. package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
  66. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  67. package/dist/screen/components/ScreenMount.d.ts +1 -1
  68. package/dist/screen/components/ScreenMount.js +1 -1
  69. package/dist/screen/components/ScreenStoreProvider.d.ts +1 -1
  70. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  71. package/dist/screen/components/SectionScreenShell.js +17 -17
  72. package/dist/screen/components/SidePanelHead.js +1 -1
  73. package/dist/screen/components/panel-widths.js +1 -1
  74. package/dist/screen/components/usePartBridge.d.ts +1 -1
  75. package/dist/screen/components/usePartBridge.js +1 -1
  76. package/dist/screen/index.d.ts +1 -1
  77. package/dist/screen/index.js +1 -1
  78. package/dist/screen/lib/admin-bridge.d.ts +1 -1
  79. package/dist/screen/lib/document/block-set-host.js +1 -1
  80. package/dist/screen/lib/document/block-size-fields.d.ts +1 -1
  81. package/dist/screen/lib/document/block-size-fields.js +1 -1
  82. package/dist/screen/lib/document/block-types-in.js +1 -1
  83. package/dist/screen/lib/document/box-fields.d.ts +1 -1
  84. package/dist/screen/lib/document/box-fields.js +1 -1
  85. package/dist/screen/lib/document/button-fields.d.ts +1 -1
  86. package/dist/screen/lib/document/button-fields.js +1 -1
  87. package/dist/screen/lib/document/image-fields.d.ts +1 -1
  88. package/dist/screen/lib/document/image-fields.js +5 -5
  89. package/dist/screen/lib/document/palette-sections.d.ts +1 -1
  90. package/dist/screen/lib/document/section-doc.d.ts +1 -1
  91. package/dist/screen/lib/document/section-doc.js +1 -1
  92. package/dist/screen/lib/document/shadow-fields.d.ts +1 -1
  93. package/dist/screen/lib/document/shadow-fields.js +2 -2
  94. package/dist/screen/lib/document/style-clipboard.d.ts +1 -1
  95. package/dist/screen/lib/document/style-clipboard.js +1 -1
  96. package/dist/screen/lib/document/style-fields.d.ts +1 -1
  97. package/dist/screen/lib/document/style-fields.js +1 -1
  98. package/dist/screen/lib/document/use-section-ops.d.ts +1 -1
  99. package/dist/screen/lib/document/use-section-ops.js +1 -1
  100. package/dist/screen/lib/document-addressing.d.ts +1 -1
  101. package/dist/screen/lib/document-hooks.d.ts +1 -1
  102. package/dist/screen/lib/document-switch.js +1 -1
  103. package/dist/screen/lib/failure.js +1 -1
  104. package/dist/screen/lib/host-inbound.js +1 -1
  105. package/dist/screen/lib/host.d.ts +1 -1
  106. package/dist/screen/lib/key-scope.js +1 -1
  107. package/dist/screen/lib/media-panel.d.ts +1 -1
  108. package/dist/screen/lib/media-picker.d.ts +1 -1
  109. package/dist/screen/lib/media-picker.js +1 -1
  110. package/dist/screen/lib/page-lock.d.ts +1 -1
  111. package/dist/screen/lib/page-lock.js +1 -1
  112. package/dist/screen/lib/screen-parts.d.ts +1 -1
  113. package/dist/screen/lib/screen-parts.js +1 -1
  114. package/dist/screen/lib/section-templates.d.ts +1 -1
  115. package/dist/screen/lib/session-context.d.ts +1 -1
  116. package/dist/screen/lib/session.d.ts +1 -1
  117. package/dist/screen/lib/shared-sections.d.ts +1 -1
  118. package/dist/strings/index.d.ts +1 -1
  119. package/dist/strings/index.js +2 -2
  120. package/dist/style-clipboard/index.js +1 -1
  121. package/dist/text-styles/index.js +27 -27
  122. package/dist/{words-CFkb8XtN.d.ts → words-dNm6REMa.d.ts} +21 -0
  123. package/package.json +1 -1
  124. package/dist/chunk-3W2O22DZ.js +0 -19
  125. package/dist/chunk-5OWAV3MH.js +0 -1
  126. package/dist/chunk-DAKKPW2Z.js +0 -1
  127. package/dist/chunk-EUFDQ4KL.js +0 -1
  128. package/dist/chunk-FW35PCK7.js +0 -1
  129. package/dist/chunk-HG65R6IN.js +0 -20
  130. package/dist/chunk-JACEEVVF.js +0 -1
  131. package/dist/chunk-JQQFB7EZ.js +0 -1
  132. package/dist/chunk-L2WK5JYB.js +0 -2
  133. package/dist/chunk-L7PSERQH.js +0 -8
  134. package/dist/chunk-O4OWODU2.js +0 -64
  135. package/dist/chunk-SQTVXE5D.js +0 -18
  136. package/dist/chunk-TOKMFZPB.js +0 -1
  137. package/dist/resolve-Bz4mszpL.d.ts +0 -57
@@ -2,7 +2,7 @@ import { ReactElement, FC, CSSProperties, ReactNode, JSX } from 'react';
2
2
  import { P as Permissions, A as AppState } from '../types-BljCVdzR.js';
3
3
  import '../data/index.js';
4
4
  import '../types-Dq180WRV.js';
5
- import '../resolve-Bz4mszpL.js';
5
+ import '../phone-order-CRKvsTsz.js';
6
6
  import '../plan-D0DgSLnY.js';
7
7
 
8
8
  /**
@@ -98,7 +98,8 @@ declare function useCanvasStyle(canvas: CanvasTarget | null, key: string, css: s
98
98
  /**
99
99
  * A number that changes whenever the canvas may have MOVED — its document
100
100
  * scrolled or resized, its content resized, a block added, removed or moved in
101
- * it, the host page scrolled or resized, or the canvas itself replaced — plus
101
+ * it, a transition or an animation ended in it, the host page scrolled or
102
+ * resized, or the canvas itself replaced — plus
102
103
  * two settle passes after each new canvas (fonts and images land after the
103
104
  * first paint). An overlay re-measures when it
104
105
  * changes, instead of each surface wiring its own listeners and timers.
@@ -1 +1 @@
1
- export{BLOCK_SELECTOR,CANVAS_SELECTOR,CANVAS_TYPABLE_EVENT,CANVAS_TYPING_EVENT,LIST_SELECTOR,isFrameReady,useCanvasEvent,useCanvasFrame,useCanvasLayout,useCanvasStyle,useCanvasTyping,watchCanvasFrame}from"../chunk-TOKMFZPB.js";export{BLOCK_ATTRIBUTE,WORDS_CLEAR,clientPointToLayer,drawnBox,elementScale,fitCanvas,framePointToHost,frameRectToHost,frameRectToLayer,frameScale,isTypingTarget,nodeIdAt,related,removeCanvasStyle,setCanvasNonce,upsertCanvasStyle}from"../chunk-FR7EEKFF.js";export{REPEAT_ATTRIBUTE,REPEAT_INDEX_ATTRIBUTE,isRepeatCopy,mainCopyOf,queryAllCopies,queryMainCopy,repeatWrapperAt}from"../chunk-7UFKEX72.js";
1
+ export{BLOCK_SELECTOR,CANVAS_SELECTOR,CANVAS_TYPABLE_EVENT,CANVAS_TYPING_EVENT,LIST_SELECTOR,isFrameReady,useCanvasEvent,useCanvasFrame,useCanvasLayout,useCanvasStyle,useCanvasTyping,watchCanvasFrame}from"../chunk-6GJEOER4.js";export{BLOCK_ATTRIBUTE,WORDS_CLEAR,clientPointToLayer,drawnBox,elementScale,fitCanvas,framePointToHost,frameRectToHost,frameRectToLayer,frameScale,isTypingTarget,nodeIdAt,related,removeCanvasStyle,setCanvasNonce,upsertCanvasStyle}from"../chunk-FR7EEKFF.js";export{REPEAT_ATTRIBUTE,REPEAT_INDEX_ATTRIBUTE,isRepeatCopy,mainCopyOf,queryAllCopies,queryMainCopy,repeatWrapperAt}from"../chunk-7UFKEX72.js";
@@ -1 +1 @@
1
- export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MIN_PANEL_W_BY_SIDE,PanelResizeHandle,SaveIcon,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,headWords,panelWidthVars,saveIconTone,setPanelWidthVars}from"../chunk-VBEVZZTV.js";import"../chunk-MJM6SFD3.js";import"../chunk-AJSDWWJW.js";import"../chunk-2OAZYSWJ.js";import"../chunk-YYD257TD.js";import"../chunk-RE4LP46F.js";import"../chunk-MFIRYGHW.js";import"../chunk-EUFDQ4KL.js";import"../chunk-KXM6YRG2.js";
1
+ export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MIN_PANEL_W_BY_SIDE,PanelResizeHandle,SaveIcon,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,headWords,panelWidthVars,saveIconTone,setPanelWidthVars}from"../chunk-VTY7OQB5.js";import"../chunk-MJM6SFD3.js";import"../chunk-AJSDWWJW.js";import"../chunk-2OAZYSWJ.js";import"../chunk-G7J6SGMF.js";import"../chunk-RE4LP46F.js";import"../chunk-MFIRYGHW.js";import"../chunk-YDTEYXQW.js";import"../chunk-KXM6YRG2.js";
@@ -1,4 +1,4 @@
1
- import{useNow as e,describeSave as t}from"./chunk-RKTF5XLP.js";import{SaveIcon as a}from"./chunk-VBEVZZTV.js";import{SplitButton as l,Kbd as i,CMD_S as n}from"efficient-shell/ui";import{CloudIcon as s,CheckIcon as o}from"efficient-shell/icons/efficient";import{jsx as r,jsxs as d}from"react/jsx-runtime";var c=e=>e.state.failed&&null!=e.state.retryAt||null!=e.state.savedAt;function u({input:l,words:i}){const n=e(c(l)),s=t({...l,now:n},i);/* @__PURE__ */
1
+ import{useNow as e,describeSave as t}from"./chunk-RKTF5XLP.js";import{SaveIcon as a}from"./chunk-VTY7OQB5.js";import{SplitButton as l,Kbd as i,CMD_S as n}from"efficient-shell/ui";import{CloudIcon as s,CheckIcon as o}from"efficient-shell/icons/efficient";import{jsx as r,jsxs as d}from"react/jsx-runtime";var c=e=>e.state.failed&&null!=e.state.retryAt||null!=e.state.savedAt;function u({input:l,words:i}){const n=e(c(l)),s=t({...l,now:n},i);/* @__PURE__ */
2
2
  return r(a,{state:s.state,label:s.label})}function m({input:a,action:u,readOnly:m,saveSwitch:y,onToggleAutoSave:b,onSaveNow:p,bar:v,words:f}){const k=e(c(a)),h=t({...a,now:k},f),w=h.retry?v.retry:v.saveNow,g=/* @__PURE__ */d("span",{className:"es-savemenu-row",children:[w,
3
3
  /* @__PURE__ */r("span",{"aria-hidden":"true",children:/* @__PURE__ */r(i,{keys:n,size:"sm"})})]}),S=[{type:"status",key:"status",label:h.line(u.status)},...(u.goingLive??[]).map((e,t)=>({type:"status",key:`going-live-${t}`,label:e})),{type:"divider",key:"divider"},...y?[{type:"checkbox",key:"auto-save",label:v.autoSave,checked:!a.state.paused,disabled:m,onSelect:b}]:[],{key:"save-now",label:g,icon:/* @__PURE__ */r(s,{}),disabled:m,onSelect:p},...u.menuItems?.length?[{type:"divider",key:"layer-divider"},...u.menuItems.map(e=>({key:`layer-${e.key}`,label:e.label,icon:e.icon,disabled:e.disabled,onSelect:e.onSelect}))]:[]],j=u.quiet??null,x=h.blocked??u.disabledReason??j?.reason??null;/* @__PURE__ */
4
4
  return r(l,{variant:j?"secondary":"primary",leftIcon:j?/* @__PURE__ */r(o,{}):void 0,onClick:()=>u.onPress(),disabled:null!==x,disabledReason:x??void 0,tooltip:u.tooltip,loading:!0===u.busy,menuLabel:v.saveOptions,items:S,menuMinWidth:300,children:j?j.label:u.label})}export{m as ScreenMainButton,u as ScreenSaveIcon};
@@ -1 +1 @@
1
- import{useScreenBlockRules as e}from"./chunk-2262JGFV.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-TCAAOYQY.js";import{useEasel as o,useEaselApi as r}from"./chunk-3W2O22DZ.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
1
+ import{useScreenBlockRules as e}from"./chunk-TUIBPB77.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-TCAAOYQY.js";import{useEasel as o,useEaselApi as r}from"./chunk-L36E2WCO.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
@@ -1 +1 @@
1
- import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"./chunk-6WY6ZXJG.js";import{clone as e}from"./chunk-EUFDQ4KL.js";import{CopyStyleIcon as n,PasteStyleIcon as o}from"efficient-shell/icons/efficient";import{jsx as r}from"react/jsx-runtime";var c="__styleKind";function u(t,e){return t[c]=e,t}function i(t,e){return`${t}:${e.map(t=>String(t)).sort().join("|")}`}function s(t){if(!t)return null;const e=t.indexOf(":");if(e<0)return null;const n=t.slice(0,e);return l.has(n)?{control:n,values:t.slice(e+1).split("|")}:null}var l=/* @__PURE__ */new Set(["choice","select","radio"]);function a(t){if(!t||"object"!=typeof t)return null;const e=t;return"string"==typeof e[c]?e[c]:"text"===e.type||"textarea"===e.type||"number"===e.type?e.type:"select"!==e.type&&"radio"!==e.type||!Array.isArray(e.options)?null:i(e.type,e.options.map(t=>t?.value))}function p(t){return null!=t&&""!==t}function f(t,e){let n=t;for(const t of e){if(!n||"object"!=typeof n)return;n=n[t]}return n}function d(t,e,n){const[o,...r]=e,c={...t};if(0===r.length)return void 0===n?delete c[o]:c[o]=n,c;const u=c[o],i=d(u&&"object"==typeof u?u:{},r,n);return 0===Object.keys(i).length?delete c[o]:c[o]=i,c}var y=t=>t.join("."),h="editor-shell:style-clipboard",m=null,g=!1,v=/* @__PURE__ */new Set;function b(){try{return"undefined"==typeof sessionStorage?null:sessionStorage}catch{return null}}function k(){if(!g){g=!0;try{const t=b()?.getItem(h);t&&(m=JSON.parse(t))}catch{m=null}}}function S(t){k(),m={scope:t.scope,sourceType:t.type,sourceLabel:t.label,rows:t.rows.map(n=>{const o=f(t.props,n.path);return{path:[...n.path],kind:n.kind,counted:!1!==n.counted,value:p(o)?e(o):void 0}})};try{b()?.setItem(h,JSON.stringify(m))}catch{}return v.forEach(t=>t()),m}function j(t){return k(),m&&m.scope===t?m:null}function C(t){return v.add(t),()=>{v.delete(t)}}function w(){m=null,g=!0;try{b()?.removeItem(h)}catch{}v.forEach(t=>t())}function E(t,e,n){if(t.kind===e.kind)return null!==e.kind||n;const o=s(t.kind),r=s(e.kind);return!(!o||!r||o.control!==r.control)&&(!p(t.value)||r.values.includes(String(t.value)))}function K(t,n){const o=t.sourceType===n.type,r=new Map(t.rows.map(t=>[y(t.path),t]));let c=n.props,u=0,i=!1;for(const t of n.rows){const n=r.get(y(t.path));if(!n)continue;if(!E(n,t,o))continue;const s=f(c,t.path),l=void 0===n.value?void 0:e(n.value);JSON.stringify(p(s)?s:void 0)!==JSON.stringify(l)&&(c=d(c,t.path,l),i=!0),!1!==t.counted&&(u+=1)}return{props:c,pasted:u,changed:i}}function N(e,n,o,r=t){return 0===e.pasted?r.nothing({source:n,target:o}):r.pasted({count:e.pasted,source:n})}var O="⌥⌘C",T="⌥⌘V";function x(e){const c=e.words??t,u=[];return e.canCopy&&u.push({label:c.copy,icon:/* @__PURE__ */r(n,{}),shortcut:"⌥⌘C",onClick:e.onCopy}),e.held&&u.push({label:c.paste({source:e.held.sourceLabel}),icon:/* @__PURE__ */r(o,{}),shortcut:"⌥⌘V",onClick:e.onPaste}),u}function J(t){if(!t.altKey||t.shiftKey||!t.metaKey&&!t.ctrlKey)return null;const e=t.target;return e&&(e.isContentEditable||"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName)?null:"KeyC"===t.code?"copy":"KeyV"===t.code?"paste":null}export{O as COPY_STYLE_SHORTCUT,T as PASTE_STYLE_SHORTCUT,c as STYLE_KIND,i as choiceKind,w as clearStyle,S as copyStyle,a as fieldKind,j as heldStyle,N as pasteMessage,K as planPaste,x as styleMenuItems,J as styleShortcut,C as subscribeStyle,u as withStyleKind};
1
+ import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"./chunk-6WY6ZXJG.js";import{clone as e}from"./chunk-YDTEYXQW.js";import{CopyStyleIcon as n,PasteStyleIcon as o}from"efficient-shell/icons/efficient";import{jsx as r}from"react/jsx-runtime";var c="__styleKind";function u(t,e){return t[c]=e,t}function i(t,e){return`${t}:${e.map(t=>String(t)).sort().join("|")}`}function s(t){if(!t)return null;const e=t.indexOf(":");if(e<0)return null;const n=t.slice(0,e);return l.has(n)?{control:n,values:t.slice(e+1).split("|")}:null}var l=/* @__PURE__ */new Set(["choice","select","radio"]);function a(t){if(!t||"object"!=typeof t)return null;const e=t;return"string"==typeof e[c]?e[c]:"text"===e.type||"textarea"===e.type||"number"===e.type?e.type:"select"!==e.type&&"radio"!==e.type||!Array.isArray(e.options)?null:i(e.type,e.options.map(t=>t?.value))}function p(t){return null!=t&&""!==t}function f(t,e){let n=t;for(const t of e){if(!n||"object"!=typeof n)return;n=n[t]}return n}function d(t,e,n){const[o,...r]=e,c={...t};if(0===r.length)return void 0===n?delete c[o]:c[o]=n,c;const u=c[o],i=d(u&&"object"==typeof u?u:{},r,n);return 0===Object.keys(i).length?delete c[o]:c[o]=i,c}var y=t=>t.join("."),h="editor-shell:style-clipboard",m=null,g=!1,v=/* @__PURE__ */new Set;function b(){try{return"undefined"==typeof sessionStorage?null:sessionStorage}catch{return null}}function k(){if(!g){g=!0;try{const t=b()?.getItem(h);t&&(m=JSON.parse(t))}catch{m=null}}}function S(t){k(),m={scope:t.scope,sourceType:t.type,sourceLabel:t.label,rows:t.rows.map(n=>{const o=f(t.props,n.path);return{path:[...n.path],kind:n.kind,counted:!1!==n.counted,value:p(o)?e(o):void 0}})};try{b()?.setItem(h,JSON.stringify(m))}catch{}return v.forEach(t=>t()),m}function j(t){return k(),m&&m.scope===t?m:null}function C(t){return v.add(t),()=>{v.delete(t)}}function w(){m=null,g=!0;try{b()?.removeItem(h)}catch{}v.forEach(t=>t())}function E(t,e,n){if(t.kind===e.kind)return null!==e.kind||n;const o=s(t.kind),r=s(e.kind);return!(!o||!r||o.control!==r.control)&&(!p(t.value)||r.values.includes(String(t.value)))}function N(t,n){const o=t.sourceType===n.type,r=new Map(t.rows.map(t=>[y(t.path),t]));let c=n.props,u=0,i=!1;for(const t of n.rows){const n=r.get(y(t.path));if(!n)continue;if(!E(n,t,o))continue;const s=f(c,t.path),l=void 0===n.value?void 0:e(n.value);JSON.stringify(p(s)?s:void 0)!==JSON.stringify(l)&&(c=d(c,t.path,l),i=!0),!1!==t.counted&&(u+=1)}return{props:c,pasted:u,changed:i}}function K(e,n,o,r=t){return 0===e.pasted?r.nothing({source:n,target:o}):r.pasted({count:e.pasted,source:n})}var T="⌥⌘C",O="⌥⌘V";function x(e){const c=e.words??t,u=[];return e.canCopy&&u.push({label:c.copy,icon:/* @__PURE__ */r(n,{}),shortcut:"⌥⌘C",onClick:e.onCopy}),e.held&&u.push({label:c.paste({source:e.held.sourceLabel}),icon:/* @__PURE__ */r(o,{}),shortcut:"⌥⌘V",onClick:e.onPaste}),u}function J(t){if(!t.altKey||t.shiftKey||!t.metaKey&&!t.ctrlKey)return null;const e=t.target;return e&&(e.isContentEditable||"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName)?null:"KeyC"===t.code?"copy":"KeyV"===t.code?"paste":null}export{T as COPY_STYLE_SHORTCUT,O as PASTE_STYLE_SHORTCUT,c as STYLE_KIND,i as choiceKind,w as clearStyle,S as copyStyle,a as fieldKind,j as heldStyle,K as pasteMessage,N as planPaste,x as styleMenuItems,J as styleShortcut,C as subscribeStyle,u as withStyleKind};
@@ -1 +1 @@
1
- import{mediaPickStoreFor as e}from"./chunk-NCXYC7WI.js";import{newId as t}from"./chunk-EUFDQ4KL.js";var o=/* @__PURE__ */new Map;function i(i,n){if(!i.connected)return Promise.resolve(null);const r=t("mp"),c=e(i);return c?c.request({requestId:r,accept:n.accept,title:n.title,file:n.file??null,...n.options?{options:n.options}:{}}):new Promise(e=>{o.set(r,e),i.send("storefront-editor:open-media-picker",{requestId:r,accept:n.accept,title:n.title,...n.file?{file:n.file}:{}})})}function n(e,t){const i=o.get(e);i&&(o.delete(e),i(t))}export{i as requestMediaPick,n as resolveMediaPick};
1
+ import{mediaPickStoreFor as e}from"./chunk-NCXYC7WI.js";import{newId as t}from"./chunk-YDTEYXQW.js";var o=/* @__PURE__ */new Map;function i(i,n){if(!i.connected)return Promise.resolve(null);const r=t("mp"),c=e(i);return c?c.request({requestId:r,accept:n.accept,title:n.title,file:n.file??null,...n.options?{options:n.options}:{}}):new Promise(e=>{o.set(r,e),i.send("storefront-editor:open-media-picker",{requestId:r,accept:n.accept,title:n.title,...n.file?{file:n.file}:{}})})}function n(e,t){const i=o.get(e);i&&(o.delete(e),i(t))}export{i as requestMediaPick,n as resolveMediaPick};
@@ -0,0 +1 @@
1
+ import{removeCanvasStyle as e,upsertCanvasStyle as n}from"./chunk-FR7EEKFF.js";import{useState as t,useEffect as o,useRef as r}from"react";var c=["transitionend","transitioncancel","animationend","animationcancel"];function s(e,n){for(const t of c)e.addEventListener(t,n,!0);return()=>{for(const t of c)e.removeEventListener(t,n,!0)}}var i="[data-easel-block]",u="[data-easel-dropzone]",l="iframe#preview-frame";function a(e){const n=e.contentDocument;if(!n||!e.contentWindow||"loading"===n.readyState||!n.body)return!1;if(e.hasAttribute("srcdoc"))return"about:srcdoc"===n.URL;const t=e.getAttribute("src");return!t||"about:blank"===t||"about:blank"!==n.URL}function d(e,n,{selector:t=l,readySelector:o}={}){let r=null,c=null,s=!1,i=!1,u=null;const d=()=>{u?.observer.disconnect(),u=null},m=()=>{if(i)return;let e=null;if(r&&a(r)){const n=r.contentDocument;(e=>{if(!o||e.querySelector(o))return d(),!0;if(u?.doc!==e){d();const n=e.defaultView?.MutationObserver;if(n){const t=new n(()=>m());t.observe(e,{childList:!0,subtree:!0}),u={doc:e,observer:t}}}return!1})(n)&&(e={frame:r,document:n,window:r.contentWindow})}else d();(e===c||!!e&&!!c&&e.frame===c.frame&&e.document===c.document)&&s||(s=!0,c=e,n(c))},f=()=>m(),v=()=>{const n=e.querySelector?.(t);n!==r?(r?.removeEventListener("load",f),r=n,r?.addEventListener("load",f),m()):m()},b=e.ownerDocument?.defaultView??e.defaultView,w=b?.MutationObserver,E=w?new w(e=>(e=>null!==r&&!r.isConnected||e.some(e=>[...e.addedNodes,...e.removedNodes].some(e=>"IFRAME"===e.nodeName||!!e.querySelector?.("iframe"))))(e)&&v()):null;return E?.observe(e,{childList:!0,subtree:!0}),v(),()=>{i=!0,E?.disconnect(),d(),r?.removeEventListener("load",f),r=null}}function m(e,{selector:n,readySelector:r}={}){const[c,s]=t(null);return o(()=>{const t=e.current;if(!t)return;const o=d(t,s,{selector:n,readySelector:r});return()=>{o(),s(null)}},[e,n,r]),c}var f="easel:canvas-typing",v="easel:canvas-typable";function b(e,n,t,{on:c="document",capture:s=!1}={}){const i=r(t);i.current=t;const u=e?.document??null,l=e?.window??null;o(()=>{const e="window"===c?l:u;if(!e)return;const t=e=>i.current(e);return e.addEventListener(n,t,s),()=>e.removeEventListener(n,t,s)},[u,l,n,c,s])}function w(e){const[n,o]=t(!1);return b(e,f,e=>o(Boolean(e.detail?.typing))),n}function E(t,r,c){const s=t?.document??null;o(()=>{if(!s)return;if(!c)return void e(s,r);const t=n(s,r,c),o=s.defaultView?.MutationObserver,i=o?new o(()=>{t.isConnected||n(s,r,c)}):null;return i?.observe(s.head??s.documentElement,{childList:!0}),()=>{i?.disconnect(),e(s,r)}},[s,r,c])}function L(e,{settle:n=[150,450]}={}){const[r,c]=t(0),i=e?.frame??null,u=e?.document??null,l=e?.window??null,a=n.join(",");return o(()=>{if(!i||!u||!l)return;const e=i.ownerDocument.defaultView;let t=!1,o=0;const r=()=>{if(t)return;t=!0;const n=()=>{t=!1,c(e=>e+1)};e?.requestAnimationFrame?o=e.requestAnimationFrame(n):n()},a=[],d=(e,n)=>{e.addEventListener(n,r,!0),a.push(()=>e.removeEventListener(n,r,!0))};d(u,"scroll"),d(l,"resize"),e&&(d(e,"scroll"),d(e,"resize"));const m=e?.ResizeObserver;if(m){const e=new m(r);e.observe(i),u.documentElement&&e.observe(u.documentElement),a.push(()=>e.disconnect())}const f=u.defaultView?.MutationObserver,v=u.body??u.documentElement;if(f&&v){const e=new f(r);e.observe(u===i.ownerDocument?i:v,{childList:!0,subtree:!0}),a.push(()=>e.disconnect())}const b=u.fonts;b&&d(b,"loadingdone"),a.push(s(l,r));const w=n.map(e=>setTimeout(r,e));return r(),()=>{for(const e of a)e();for(const e of w)clearTimeout(e);o&&e?.cancelAnimationFrame&&e.cancelAnimationFrame(o)}},[i,u,l,a]),r}export{i as BLOCK_SELECTOR,l as CANVAS_SELECTOR,v as CANVAS_TYPABLE_EVENT,f as CANVAS_TYPING_EVENT,u as LIST_SELECTOR,a as isFrameReady,s as onMotionEnd,b as useCanvasEvent,m as useCanvasFrame,L as useCanvasLayout,E as useCanvasStyle,w as useCanvasTyping,d as watchCanvasFrame};
@@ -1 +1 @@
1
- import{accessForNewDocument as e}from"./chunk-YYD257TD.js";function n(e){return e.failed?"error":e.pending?"saving":e.saved?"saved":"idle"}function t(e){return"idle"}function r(n,t){t.resetAutosave(),t.setVersion(null),t.setSaveConflict(null),t.setAccess(e(n))}export{r as resetForDocumentSwitch,t as saveStatusForNewDocument,n as saveStatusOf};
1
+ import{accessForNewDocument as e}from"./chunk-G7J6SGMF.js";function n(e){return e.failed?"error":e.pending?"saving":e.saved?"saved":"idle"}function t(e){return"idle"}function r(n,t){t.resetAutosave(),t.setVersion(null),t.setSaveConflict(null),t.setAccess(e(n))}export{r as resetForDocumentSwitch,t as saveStatusForNewDocument,n as saveStatusOf};
@@ -1 +1 @@
1
- import{readHostFailure as e,isBackendError as n,STATUS_UNREACHABLE as s}from"./chunk-KCOBHPN6.js";import{EDIT_LOCK_TAKEN as t}from"./chunk-YYD257TD.js";var a="page_changed_elsewhere",d={unauthorized:401,"changed-elsewhere":409,"lock-taken":409,"not-found":404,invalid:400,unavailable:s};function o(s,o){const c=e(s,o);if(c)return{status:c.status,data:c.data};if(!n(s))return null;const u=e(s.cause,o);if(u)return{status:u.status,data:u.data};const r=d[s.kind];return"changed-elsewhere"===s.kind?{status:r,data:{code:a,saved_by:s.conflict?.savedBy??"",saved_by_you:!0===s.conflict?.savedByYou,seconds_ago:s.conflict?.secondsAgo??0}}:"lock-taken"===s.kind?{status:r,data:{code:t,holder_name:s.holder?.name??"",seconds_since_seen:s.holder?.secondsSinceSeen??0,seconds_since_held:s.holder?.secondsSinceHeld??0}}:{status:r,data:null}}function c(e,n){return 401===o(e,n)?.status}export{a as PAGE_CONFLICT_CODE,c as isExpiredSession,o as readEaselFailure};
1
+ import{readHostFailure as e,isBackendError as n,STATUS_UNREACHABLE as s}from"./chunk-KCOBHPN6.js";import{EDIT_LOCK_TAKEN as t}from"./chunk-G7J6SGMF.js";var a="page_changed_elsewhere",d={unauthorized:401,"changed-elsewhere":409,"lock-taken":409,"not-found":404,invalid:400,unavailable:s};function o(s,o){const c=e(s,o);if(c)return{status:c.status,data:c.data};if(!n(s))return null;const u=e(s.cause,o);if(u)return{status:u.status,data:u.data};const r=d[s.kind];return"changed-elsewhere"===s.kind?{status:r,data:{code:a,saved_by:s.conflict?.savedBy??"",saved_by_you:!0===s.conflict?.savedByYou,seconds_ago:s.conflict?.secondsAgo??0}}:"lock-taken"===s.kind?{status:r,data:{code:t,holder_name:s.holder?.name??"",seconds_since_seen:s.holder?.secondsSinceSeen??0,seconds_since_held:s.holder?.secondsSinceHeld??0}}:{status:r,data:null}}function c(e,n){return 401===o(e,n)?.status}export{a as PAGE_CONFLICT_CODE,c as isExpiredSession,o as readEaselFailure};
@@ -1 +1 @@
1
- import{PAGE_CONFLICT_CODE as e,readEaselFailure as r}from"./chunk-KO47WAWR.js";import{createEditLock as o}from"./chunk-YYD257TD.js";var c=o({readFailure:r,conflictCode:e});function i(i){return i.hostFailures?i.cache("easel:edit-lock",()=>o({readFailure:e=>r(e,i),conflictCode:e})):c}export{i as editLockOf,c as pageEditLock};
1
+ import{PAGE_CONFLICT_CODE as e,readEaselFailure as r}from"./chunk-7YXWWMBM.js";import{createEditLock as o}from"./chunk-G7J6SGMF.js";var c=o({readFailure:r,conflictCode:e});function i(i){return i.hostFailures?i.cache("easel:edit-lock",()=>o({readFailure:e=>r(e,i),conflictCode:e})):c}export{i as editLockOf,c as pageEditLock};
@@ -1 +1 @@
1
- import{DEFAULT_FIELDS_WORDS as e}from"./chunk-JACEEVVF.js";import{useWords as i}from"./chunk-MFIRYGHW.js";import{ShellStringsProvider as n,InputNumber as s,Tooltip as a}from"efficient-shell/ui";import{jsx as l}from"react/jsx-runtime";function r({id:r,value:t,onChange:m,min:o,max:c,step:u=1,shiftStep:d,styleValue:p,icon:f,unit:h,steppers:b=!1,placeholder:v,readOnly:x=!1,ariaLabel:y,ariaLabelledBy:N,title:g}){const j=i("fields",e),C="number"==typeof t&&Number.isFinite(t)?t:null,F=/* @__PURE__ */l("div",{className:`es-fnum${f?" es-fnum--icon":""}${null===C&&void 0!==p?" is-style":""}`,children:/* @__PURE__ */l(n,{value:{number:{increase:j.more,decrease:j.less}},children:/* @__PURE__ */l(s,{id:r,size:"md",className:"es-fnum-box",value:C,onChange:e=>m(e??void 0),min:o,max:c,step:u,shiftStep:d,readOnly:x,steppers:b,snap:!0,placeholder:void 0!==p?String(p):v,prefix:f?/* @__PURE__ */l("span",{className:"es-fnum-icon",children:f}):void 0,suffix:h?/* @__PURE__ */l("span",{className:"es-fnum-unit",children:h}):void 0,"aria-label":y,"aria-labelledby":N})})});return g?/* @__PURE__ */l(a,{content:g,children:F}):F}export{r as FieldNumber};
1
+ import{DEFAULT_FIELDS_WORDS as e}from"./chunk-UMTUKSE6.js";import{useWords as i}from"./chunk-MFIRYGHW.js";import{ShellStringsProvider as n,InputNumber as s,Tooltip as a}from"efficient-shell/ui";import{jsx as l}from"react/jsx-runtime";function r({id:r,value:t,onChange:m,min:o,max:c,step:u=1,shiftStep:d,styleValue:p,icon:f,unit:h,steppers:b=!1,placeholder:v,readOnly:x=!1,ariaLabel:y,ariaLabelledBy:N,title:S}){const g=i("fields",e),j="number"==typeof t&&Number.isFinite(t)?t:null,k=/* @__PURE__ */l("div",{className:`es-fnum${f?" es-fnum--icon":""}${null===j&&void 0!==p?" is-style":""}`,children:/* @__PURE__ */l(n,{value:{number:{increase:g.more,decrease:g.less}},children:/* @__PURE__ */l(s,{id:r,size:"md",className:"es-fnum-box",value:j,onChange:e=>m(e??void 0),min:o,max:c,step:u,shiftStep:d,readOnly:x,steppers:b,snap:!0,placeholder:void 0!==p?String(p):v,prefix:f?/* @__PURE__ */l("span",{className:"es-fnum-icon",children:f}):void 0,suffix:h?/* @__PURE__ */l("span",{className:"es-fnum-unit",children:h}):void 0,"aria-label":y,"aria-labelledby":N})})});return S?/* @__PURE__ */l(a,{content:S,children:k}):k}export{r as FieldNumber};
@@ -1,6 +1,6 @@
1
- import{DEFAULT_FIELDS_WORDS as e}from"./chunk-JACEEVVF.js";import{useWords as l}from"./chunk-MFIRYGHW.js";import{SearchableSelect as a,Select as n}from"efficient-shell/ui";import{jsx as s,jsxs as i}from"react/jsx-runtime";function r(e,l){return e.find(e=>Object.is(e.value,l))}var o=e=>String(e);function t(r){const{id:t,options:u,placeholder:d,readOnly:c=!1,ariaLabel:v,ariaLabelledBy:h,searchable:m=!1,searchPlaceholder:p,groupCount:f=!1,renderOption:b}=r,g=l("fields",e),O=h?{"aria-labelledby":h}:v?{"aria-label":v}:{},j=u.some(e=>void 0!==e.thumb),x=j||void 0!==b||u.some(e=>void 0!==e.meta),C=e=>""===e?void 0:u[Number(e)],N=(e,l)=>{const a=C(e.value);return a?/* @__PURE__ */i("span",{className:"es-fsel-row",children:[j?/* @__PURE__ */s("span",{className:"es-fsel-thumb","aria-hidden":"true",children:a.thumb?/* @__PURE__ */s("img",{src:a.thumb,alt:"",loading:"lazy"}):null}):null,
2
- /* @__PURE__ */s("span",{className:"es-fsel-label",children:b?b(a,{active:l.active??!1,chosen:l.selected}):a.label}),void 0===a.meta||m?null:/* @__PURE__ */s("span",{className:"es-fsel-meta","aria-hidden":"true",children:a.meta})]}):e.label},y=[];let V=null;if(u.forEach((e,l)=>{const a={value:o(l),label:e.label,...e.disabled?{disabled:!0}:{},...m&&e.meta?{sublabel:e.meta}:{},...!m&&e.description?{description:e.description}:{}};void 0===e.group?(V=null,y.push(a)):V&&V.label===e.group?V.options.push(a):(V={label:e.group,options:[a]},y.push(V))}),f)for(const e of y)"options"in e&&(e.label=`${e.label} ${e.options.length}`);const T=e=>e.flatMap(e=>{const l=C(e.value);return l?[l]:[]});if(m){const l={id:t,options:y,placeholder:p??d??g.search??e.search,disabled:c,renderOption:x?N:void 0,...O};if(!0===r.multiple){const e=Array.isArray(r.value)?r.value:[],n=r.onChange;/* @__PURE__ */
1
+ import{DEFAULT_FIELDS_WORDS as e}from"./chunk-UMTUKSE6.js";import{useWords as l}from"./chunk-MFIRYGHW.js";import{SearchableSelect as a,Select as n}from"efficient-shell/ui";import{jsx as s,jsxs as i}from"react/jsx-runtime";function r(e,l){return e.find(e=>Object.is(e.value,l))}var o=e=>String(e);function t(r){const{id:t,options:u,placeholder:d,readOnly:c=!1,ariaLabel:v,ariaLabelledBy:h,searchable:m=!1,searchPlaceholder:p,groupCount:f=!1,renderOption:b}=r,g=l("fields",e),O=h?{"aria-labelledby":h}:v?{"aria-label":v}:{},j=u.some(e=>void 0!==e.thumb),x=j||void 0!==b||u.some(e=>void 0!==e.meta),N=e=>""===e?void 0:u[Number(e)],y=(e,l)=>{const a=N(e.value);return a?/* @__PURE__ */i("span",{className:"es-fsel-row",children:[j?/* @__PURE__ */s("span",{className:"es-fsel-thumb","aria-hidden":"true",children:a.thumb?/* @__PURE__ */s("img",{src:a.thumb,alt:"",loading:"lazy"}):null}):null,
2
+ /* @__PURE__ */s("span",{className:"es-fsel-label",children:b?b(a,{active:l.active??!1,chosen:l.selected}):a.label}),void 0===a.meta||m?null:/* @__PURE__ */s("span",{className:"es-fsel-meta","aria-hidden":"true",children:a.meta})]}):e.label},C=[];let T=null;if(u.forEach((e,l)=>{const a={value:o(l),label:e.label,...e.disabled?{disabled:!0}:{},...m&&e.meta?{sublabel:e.meta}:{},...!m&&e.description?{description:e.description}:{}};void 0===e.group?(T=null,C.push(a)):T&&T.label===e.group?T.options.push(a):(T={label:e.group,options:[a]},C.push(T))}),f)for(const e of C)"options"in e&&(e.label=`${e.label} ${e.options.length}`);const V=e=>e.flatMap(e=>{const l=N(e.value);return l?[l]:[]});if(m){const l={id:t,options:C,placeholder:p??d??g.search??e.search,disabled:c,renderOption:x?y:void 0,...O};if(!0===r.multiple){const e=Array.isArray(r.value)?r.value:[],n=r.onChange;/* @__PURE__ */
3
3
  return s("div",{className:"es-fsel",children:/* @__PURE__ */s(a,{...l,multiple:!0,value:u.flatMap((l,a)=>e.some(e=>Object.is(e,l.value))?[o(a)]:[]),onChange:e=>n(u.filter((l,a)=>e.includes(o(a))).map(e=>e.value))})})}const n=u.findIndex(e=>Object.is(e.value,r.value)),i=r.onChange;/* @__PURE__ */
4
- return s("div",{className:"es-fsel",children:/* @__PURE__ */s(a,{...l,value:n>=0?o(n):"",clearable:!1,onChange:e=>{const l=C(e);l&&!Object.is(l.value,r.value)&&i(l.value)}})})}const A={id:t,size:"md",className:"es-fsel-button",options:y,placeholder:d??g.choose,readOnly:c,renderOption:x?N:void 0,...O};if(!0===r.multiple){const e=Array.isArray(r.value)?r.value:[],l=l=>e.some(e=>Object.is(e,l.value)),a=u.flatMap((e,a)=>l(e)?[o(a)]:[]),i=r.onChange;/* @__PURE__ */
5
- return s("div",{className:"es-fsel",children:/* @__PURE__ */s(n,{...A,multiple:!0,value:a,renderValue:r.renderValue?e=>r.renderValue(T(e)):void 0,valueText:r.valueText?e=>r.valueText(T(e)):void 0,onChange:e=>i(u.filter((l,a)=>e.includes(o(a))).map(e=>e.value))})})}const M=u.findIndex(e=>Object.is(e.value,r.value)),E=r.onChange;/* @__PURE__ */
6
- return s("div",{className:"es-fsel",children:/* @__PURE__ */s(n,{...A,value:M>=0?o(M):"",renderValue:r.renderValue?e=>r.renderValue(T(e)[0]):void 0,valueText:r.valueText?e=>r.valueText(T(e)[0]):void 0,footer:r.footer?.length?[...r.footer]:void 0,changed:r.changed,onChange:e=>{const l=C(e);l&&!Object.is(l.value,r.value)&&E(l.value)}})})}export{t as FieldSelect,r as optionFor};
4
+ return s("div",{className:"es-fsel",children:/* @__PURE__ */s(a,{...l,value:n>=0?o(n):"",clearable:!1,onChange:e=>{const l=N(e);l&&!Object.is(l.value,r.value)&&i(l.value)}})})}const M={id:t,size:"md",className:"es-fsel-button",options:C,placeholder:d??g.choose,readOnly:c,renderOption:x?y:void 0,...O};if(!0===r.multiple){const e=Array.isArray(r.value)?r.value:[],l=l=>e.some(e=>Object.is(e,l.value)),a=u.flatMap((e,a)=>l(e)?[o(a)]:[]),i=r.onChange;/* @__PURE__ */
5
+ return s("div",{className:"es-fsel",children:/* @__PURE__ */s(n,{...M,multiple:!0,value:a,renderValue:r.renderValue?e=>r.renderValue(V(e)):void 0,valueText:r.valueText?e=>r.valueText(V(e)):void 0,onChange:e=>i(u.filter((l,a)=>e.includes(o(a))).map(e=>e.value))})})}const A=u.findIndex(e=>Object.is(e.value,r.value)),I=r.onChange;/* @__PURE__ */
6
+ return s("div",{className:"es-fsel",children:/* @__PURE__ */s(n,{...M,value:A>=0?o(A):"",renderValue:r.renderValue?e=>r.renderValue(V(e)[0]):void 0,valueText:r.valueText?e=>r.valueText(V(e)[0]):void 0,footer:r.footer?.length?[...r.footer]:void 0,changed:r.changed,onChange:e=>{const l=N(e);l&&!Object.is(l.value,r.value)&&I(l.value)}})})}export{t as FieldSelect,r as optionFor};
@@ -0,0 +1,64 @@
1
+ import{markedTreeNodeId as e,revealSelectedTreeRow as n,sameSelector as t}from"./chunk-UMBNBCL4.js";import{cloneNodeWithFreshIds as o}from"./chunk-OXZDSOZV.js";import{dedupeSlotChildren as r}from"./chunk-7OCEPOEJ.js";import{styleClipboardOf as i}from"./chunk-VNUXFD4X.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-RTMDZJNE.js";import{SlotChildActionsProvider as u}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as f,DEFAULT_PANEL_W as h,clampPanelWidth as m}from"./chunk-TQUEVJOO.js";import{usePartBridge as g}from"./chunk-J5VPNHOW.js";import{useSectionOps as y}from"./chunk-3FANFZ4D.js";import{PageEditGuardNotices as b}from"./chunk-XV5D4V2T.js";import{ScreenSaveIcon as v,ScreenMainButton as k}from"./chunk-2EEYFRQM.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{useScreenDocument as w}from"./chunk-OB4KI2AN.js";import{requestMediaPick as x}from"./chunk-5HYVOOH3.js";import{AddChildRow as z}from"./chunk-5545A3PC.js";import{AddSidePanel as C}from"./chunk-GJ427TZL.js";import{keepsSharedSections as O,sharedSectionsOf as N}from"./chunk-N3MJOHAG.js";import{PanelHideButton as I,SidePanelHead as B,PanelShowStrip as P}from"./chunk-MTWQYLJE.js";import{offeredChoices as $}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as E,useScreenNodeKeys as M,useScreenPinned as T,useScreenDocumentLabel as j,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 Y,useScreenBlockRules as U,useScreenBlockLook as J,useScreenStorageNamespace as X,useScreenNotify as G,useScreenCanvasHead as Q,isSlotMode as K,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-TUIBPB77.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-WW24O7HT.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_SCREEN_WORDS as be}from"./chunk-G2VZ4DET.js";import{heldStyle as ve,styleShortcut as ke}from"./chunk-3OOYGEJY.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{rootRowName as we,slotChildRowName as xe,slotChildRenameProp as ze,sectionRenameProp as Ce}from"./chunk-5NHQ452C.js";import{ROOT_ZONE as Oe,blockNodeActions as Ne,TREE_MAX_DEPTH as Ie,childSlotsOf as Be,slotFieldsOf as Pe,newNodeId as $e,slotChildrenIn as Ee,nestsInTree as Me}from"./chunk-TCAAOYQY.js";import{useEasel as Te,useEaselApi as je,useSettledAction as Le,subscribeLateWrites as Ae,CanvasPartsContext as Re,partHasOwnBox as Fe,CanvasPassThroughContext as De,CanvasSharedContext as Ve}from"./chunk-L36E2WCO.js";import{TreeRow as We,Subtree as He,LayersTree as Ye,TreeGroupLabel as Ue,TreeRowAction as Je,TreeSeam as Xe}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as Ge}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Qe}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ke,useNodeOps as Ze,clickPick as _e}from"./chunk-TF6NAIV7.js";import{EaselTopBar as qe,EaselIconButton as en,TopBarCluster as nn,DeviceSwitch as tn,InspectorIconButton as on,PanelResizeHandle as rn,MAX_PANEL_W as ln,MIN_PANEL_W_BY_SIDE as sn,panelWidthVars as dn}from"./chunk-VTY7OQB5.js";import{DEFAULT_NOTICE_WORDS as an,DEFAULT_CHROME_WORDS as cn}from"./chunk-AJSDWWJW.js";import{holderOf as pn,nameOrSomeone as un}from"./chunk-G7J6SGMF.js";import{DEFAULT_LOCK_WORDS as fn}from"./chunk-RE4LP46F.js";import{useWords as hn}from"./chunk-MFIRYGHW.js";import{insertSeams as mn,CanvasDragLayer as gn,CanvasInsert as yn}from"./chunk-SEC6NV6Y.js";import{DEFAULT_DRAG_WORDS as bn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as vn,useTreeDrag as kn,gapToMoveIndex as Sn}from"./chunk-QEEW4X64.js";import{ROOT_ID as wn,ROOT_SLOT as xn,zoneKey as zn,parseZoneKey as Cn,find as On,DataError as Nn}from"./chunk-YDTEYXQW.js";import{useCanvasFrame as In,LIST_SELECTOR as Bn,BLOCK_SELECTOR as Pn,useCanvasTyping as $n,useCanvasEvent as En,onMotionEnd as Mn}from"./chunk-6GJEOER4.js";import{nodeIdAt as Tn,frameRectToHost as jn,BLOCK_ATTRIBUTE as Ln,drawnBox as An}from"./chunk-FR7EEKFF.js";import{queryMainCopy as Rn}from"./chunk-7UFKEX72.js";import{useRef as Fn,useMemo as Dn,useState as Vn,useEffect as Wn,useCallback as Hn,useLayoutEffect as Yn,useContext as Un,Fragment as Jn,useId as Xn}from"react";import{ColoredBadge as Gn,Button as Qn,Tabs as Kn,toast as Zn,readMediaFileDrag as _n,Tooltip as qn,groupColors as et,Dialog as nt,FormField as tt,Input as ot,MEDIA_FILE_DRAG_TYPE as rt}from"efficient-shell/ui";import{UndoIcon as it,RedoIcon as lt,RefreshIcon as st,AddIcon as dt,TrashIcon as at,EyeOffIcon as ct,EyeIcon as pt,SharedIcon as ut,DuplicateIcon as ft}from"efficient-shell/icons/efficient";import{jsx as ht,jsxs as mt,Fragment as gt}from"react/jsx-runtime";var yt="media-file";function bt({name:e,onMake:n,onCancel:t}){const o=hn("screen",be).shared,[r,i]=Vn(e),[l,s]=Vn(!1),d=Xn(),a=Fn(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
2
+ return ht(nt,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */mt(gt,{children:[
3
+ /* @__PURE__ */ht(Qn,{variant:"secondary",onClick:t,children:o.cancel}),
4
+ /* @__PURE__ */ht(Qn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */ht("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */ht(tt,{label:o.name,htmlFor:d,children:/* @__PURE__ */ht(ot,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var vt=/* @__PURE__ */new WeakSet;function kt(e,n,t){const o=On(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function St(e,n,t){const o=o=>o>=t.left&&o+e.width<=t.left+t.width&&n.every(n=>n.right<=o||n.left>=o+e.width||n.bottom<=e.top||n.top>=e.top+e.height);if(n.every(n=>n.right<=e.left||n.left>=e.left+e.width||n.bottom<=e.top||n.top>=e.top+e.height))return e.left;const r=n.map(e=>e.right+4).filter(n=>n>e.left&&o(n));if(r.length)return Math.min(...r);const i=n.map(n=>n.left-4-e.width).filter(n=>n<e.left&&o(n));return i.length?Math.max(...i):e.left}function wt({canvas:e,tabs:n,onSelect:t,onPointer:o}){const r=Fn(null),[i,l]=Vn({}),s=Fn({id:null,places:{},measure:null});s.current.places=i;const d=!(null===s.current.id||n.some(e=>e.id===s.current.id)&&i[s.current.id]);Wn(()=>{d&&(s.current.id=null,o(null))},[d,o]),Wn(()=>()=>{null!==s.current.id&&o(null)},[o]);const a=n.map(e=>`${e.id}:${e.below?1:0}:${e.label}:${e.reach??""}`).join("|");return Yn(()=>{const t=e?.document,o=e?.window,i=e?.frame;if(!t||!o||!i||0===n.length)return void l(e=>0===Object.keys(e).length?e:{});let d=0;const a=()=>{d=0;const e=r.current;if(!e)return;const a=jn(i,{left:0,top:0,width:o.innerWidth,height:o.innerHeight},e),p={};let u=!1;const f=e.getBoundingClientRect(),h=[...e.parentElement?.querySelectorAll(".es-canvas-handle.is-shown:not(.is-dragging), .es-canvas-tag, .es-canvas-hint")??[]].map(e=>{const n=e.getBoundingClientRect();return{left:n.left-f.left,top:n.top-f.top,right:n.right-f.left,bottom:n.bottom-f.top}});for(const r of n){const n=o.CSS?.escape?o.CSS.escape(r.id):JSON.stringify(r.id).slice(1,-1),l=Rn(t,`[${Ln}="${n}"]`),d=l?An(l):null;if(!d||0===d.height){p[r.id]=null;continue}const c=jn(i,{left:d.left,top:d.top,width:d.width,height:d.height},e),f=c.top+c.height;if(f<a.top||c.top>a.top+a.height){p[r.id]=null;continue}const m=r.below?f+4:Math.max(c.top,a.top)+6,g=e.querySelector(`[data-band-tab="${n}"]`);g||(u=!0);const y=Math.max(c.left,a.left)+6,b=g?.offsetHeight??0,v=g?.offsetWidth??0,k=s.current.id===r.id?s.current.places[r.id]:null,S=k?k.left:St({left:y,top:m,width:v,height:b},h,a);v>0&&b>0&&h.push({left:S,top:m,right:S+v,bottom:m+b}),p[r.id]={left:S,top:m}}l(e=>function(e,n){const t=Object.keys(e);return t.length===Object.keys(n).length&&t.every(t=>{const o=e[t],r=n[t];return o===r||!!o&&!!r&&o.left===r.left&&o.top===r.top})}(e,p)?e:p),u&&c()},c=()=>{d||(d=o.requestAnimationFrame(a))};s.current.measure=c,a(),o.addEventListener("scroll",c,!0),o.addEventListener("resize",c);const p=Mn(o,c),u=new o.MutationObserver(c);u.observe(t.body,{childList:!0,subtree:!0,attributes:!0});const f=r.current?.parentElement,h=f?.ownerDocument.defaultView?.MutationObserver,m=h?new h(c):null;return f&&m?.observe(f,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style"]}),()=>{d&&o.cancelAnimationFrame(d),o.removeEventListener("scroll",c,!0),o.removeEventListener("resize",c),p(),u.disconnect(),m?.disconnect(),s.current.measure=null}},[e,a]),/* @__PURE__ */ht("div",{ref:r,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=i[e.id];return n?/* @__PURE__ */ht("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onMouseEnter:()=>{s.current.id=e.id,o(e.id)},onMouseLeave:()=>{s.current.id=null,o(null),s.current.measure?.()},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
5
+ /* @__PURE__ */ht(qn,{content:e.reach,children:/* @__PURE__ */mt(Gn,{colorClass:et("success","solid"),size:"sm",children:[
6
+ /* @__PURE__ */ht("span",{className:"es-band-tab-mark",children:/* @__PURE__ */ht(ut,{size:12})}),e.label]})}):/* @__PURE__ */ht(Gn,{colorClass:et("info","solid"),size:"sm",children:e.label})},e.id):null})})}function xt({expand:e}){/* @__PURE__ */
7
+ return ht("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */mt(gt,e?{children:[
8
+ /* @__PURE__ */ht("path",{d:"M8 9l4-4 4 4"}),
9
+ /* @__PURE__ */ht("path",{d:"M8 15l4 4 4-4"})]}:{children:[
10
+ /* @__PURE__ */ht("path",{d:"M8 4l4 4 4-4"}),
11
+ /* @__PURE__ */ht("path",{d:"M8 20l4-4 4 4"}),
12
+ /* @__PURE__ */ht("path",{d:"M5 12h14"})]})})}var zt=`${Bn}, ${Pn}`;function Ct(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 Ot="__rungs",Nt=e=>"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:"preset"===e.kind?e.preset.key:e.type;var It="screen:band",Bt={duplicate:!0,delete:!0},Pt=()=>null;function $t(){const Bn=he(),jn=Bn.panels?.Toolbar,Ln=(Bn.panels?.useRight??Pt)(),{target:An,docId:Xn,capabilities:qn,currentSlug:et,siteId:nt,onPublish:tt,saveState:ot,saveConflict:ut,retrySave:St,toggleAutoSave:$t,flushSave:Et,access:Mt,saveUnreachable:Tt=!1,readOnly:jt,readOnlyReason:Lt=null}=w(),At=E(),Rt=M(),{mediaEditing:Ft,hasEditGuard:Dt,hasPinnedChrome:Vt}=qn,{appState:Wt,dispatch:Ht,history:Yt,selectedItem:Ut,getSelectorForId:Jt,config:Xt}=Te(e=>e),Gt=T(),{first:Qt,firstGroup:Kt,lastGroup:Zt,isSectionGroup:_t,sectionGroupZone:qt,panelOf:eo}=Gt,no=eo(Qt),to=e=>ne(Gt,e),oo=e=>te(Gt,e),ro="node"===Gt.firstRow,io=Gt.band??null,lo=hn("screen",be),so=hn("tree",Ge),ao=hn("drag",bn),co=hn("notice",an),po=hn("lock",fn),uo=hn("menu",Qe),fo=hn("styleClipboard",Se),ho=hn("chrome",cn),mo=j()??`/${et}`,go=L(),yo=A(),bo=y({readOnly:jt}),vo=y({readOnly:jt,foldIntoHistory:!0}),ko=Fn(null),So=je(),wo=Dn(()=>({...bo,select:e=>{ko.current=e,bo.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=So.config;ko.current=Ke(e,t,n)}bo.commitDocument(e,n)}}),[bo,So]),xo=Wt.ui,zo=xo.leftSideBarVisible,Co=xo.rightSideBarVisible,{options:Oo,widths:No,initial:Io,fluid:Bo,fit:Po}=R(),[$o,Eo]=Vn(Io),Mo=le(),To=Ft&&null!==Mo;se(),de();const jo=ae();F(Ut?.props.id);const{read:Lo,write:Ao,forSelection:Ro}=D(),[Fo,Do]=Vn(Lo);Wn(()=>{Ao(Fo)},[Fo]);const[Vo,Wo]=Vn(0),Ho=Fn(null),Yo=Fn(null),Uo=In(Yo,{readySelector:zt}),Jo=$n(Uo),Xo=d(Yo);a(Yo,Uo);const Go=S(),Qo=pn(Mt),Ko={state:ot,offline:Go||ot.failed&&Tt,readOnlyReason:Lt,editing:Qo?co.editing({name:un(Qo.name,po),noun:lo.noun}):null,conflict:null!=ut,notSaving:lo.bar.notSaving},Zo=Le({onPress:()=>{jt||(ot.failed?St():Et())}}).onPress;c(Yo,Uo,Zo);const[_o,qo]=Vn(!1),er=Fn(!1),[nr,tr]=Vn(null),[or,rr]=Vn([]),[ir,lr]=Vn(V);W(ir);const sr=e(ir,Ut?.props.id),[dr,ar]=Vn(null);Wn(()=>{dr&&(n(),ar(null))},[dr]);const cr=Fn(Jt);cr.current=Jt;const pr=Hn((e,{scroll:n})=>{Do(n=>Ro(e,n)),n&&ar(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=cr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Vr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),ur=Fn(null);Wn(()=>{const e=ur.current;ur.current=null;const n=null==Ut?.props.id?null:String(Ut.props.id);lr(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:eo(Ut?.type)??V);const o=Ut?.props.id,r=ko.current;if(ko.current=null,!o)return;const i=Jt(o);pr(String(o),{scroll:!t(r,i??null,Oe)})},[Ut?.props.id,pr]);const fr=Hn(e=>{lr(n=>H(n,e)?n:e),Ht({type:"setUi",ui:{rightSideBarVisible:!0}})},[Ht]),hr=Fn(()=>{});hr.current=(e,n)=>{const t=e?Ri(e.zone??Oe)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Ut?.props.id?null:String(Ut.props.id);lr(e=>H(e,n)?e:n),o!==r&&(ur.current={id:o,mode:n},wo.select(e))};const mr=Hn((e,n)=>hr.current(e,n),[]),gr={kind:ir.kind,mode:ir,open:fr,show:e=>lr(e),reveal:()=>{Co||Ht({type:"setUi",ui:{rightSideBarVisible:!0}})},select:mr},yr=Y(gr,{data:Wt.data,selected:Ut??null,zoneOf:e=>Jt(e)?.zone,readOnly:Boolean(jt),select:e=>{lr(V),wo.select({index:e})},replace:(e,n)=>wo.replaceComponent(Oe,e,n),scrollTo:e=>l(e)},{device:$o,refreshes:Vo},{setView:Do,reveal:()=>{zo||Ht({type:"setUi",ui:{leftSideBarVisible:!0}})}}),br=yr.resolveLeftView?yr.resolveLeftView(Fo):"sections",vr=U(),{isLockedBlock:kr,duplicateBlocked:Sr,nestDepth:wr,newSectionNode:xr,canAddTo:zr,blockIsOffered:Cr}=vr,Or=e=>({id:String(e.props.id??""),data:Wt?.data}),Nr=J(),{labelAtLevel:Ir,Icon:Br,useProducts:Pr}=Nr,$r=Nr.rowName?(e,n,t)=>Nr.rowName(e,n,t):void 0,Er=Hn(e=>{Ht({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),pr(e,{scroll:!0})},[Ht,pr]),{selectNode:Mr,openPartId:Tr}=g({mode:ir,setMode:lr,onOpenPart:Er}),[jr,Lr]=Vn(null);me(null!==jr,()=>Lr(null));const Ar=f(X()),Rr=Ar.collapsed,Fr=Ar.panelWidths,[Dr,Vr]=Vn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Rr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
13
+ return new Set}});Wn(()=>{try{window.localStorage.setItem(Rr,JSON.stringify([...Dr]))}catch{}},[Dr]);const[Wr,Hr]=Vn(()=>{if("undefined"==typeof window)return{...h};try{const e=window.localStorage.getItem(Fr);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}}});Wn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Fr,JSON.stringify(Wr))}catch{}},300);return()=>clearTimeout(e)},[Wr]);const Yr=Hn((e,n)=>Hr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Ur=Hn(e=>Yr("left",e),[Yr]),Jr=Hn(e=>Yr("right",e),[Yr]),Xr=e=>Dr.has(e),Gr=e=>Vr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Qr=Fn(!1),Kr=Fn(null);Wn(()=>{if(Qr.current&&!_o){const e=Kr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Yo.current?.querySelector(`button[aria-label="${CSS.escape(lo.add.title)}"]`))?.focus(),Kr.current=null}Qr.current=_o},[_o]),Wn(()=>{if(!_o||!Xo)return;const e=e=>{"Escape"===e.key&&yl()};return Xo.addEventListener("keydown",e),()=>Xo.removeEventListener("keydown",e)},[_o,Xo]),me(_o,()=>yl()),Wn(()=>{!zo&&_o&&(qo(!1),tr(null),er.current=!1)},[zo]);const Zr=G(),_r=(e,n="success",t)=>{if(Zr)return void(t?Zr(e,"error"===n?"error":"info",t):Zr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Zn.error(e,{...o,duration:t?.duration??3200}):Zn.success(e,{...o,duration:t?.duration??1900})},qr=Le(yr.mainAction??{label:lo.done,onPress:()=>{tt(So.getState().appState.data)}}),ei=Fn(_r);ei.current=_r,Wn(()=>Ae(So,()=>ei.current(lo.writeLate,"error")),[So,lo]);const ni=Fn(null),[ti,oi]=Vn(0),[ri,ii]=Vn(0),li=Q(),si=Fn(null),di=e=>Math.max(0,e.clientHeight-(si.current?.offsetHeight??0));Wn(()=>{const e=ni.current;if(!e)return;const n=()=>{oi(e.clientWidth),ii(di(e))};n();const t=new ResizeObserver(n);return t.observe(e),si.current&&t.observe(si.current),()=>t.disconnect()},[]),Yn(()=>{ni.current&&(oi(ni.current.clientWidth),ii(di(ni.current)))},[Wr,zo,Co]);const ai=$o===Bo?ti>0?ti:No[Bo]:No[$o],ci=ti>0?Math.min(ti/ai,"shrink"===Po?1:2):1,pi=ai*ci,ui=ti>0&&pi>ti+1,fi={width:pi,height:ri||"100%",flex:"none",position:"relative"},hi={width:ai,height:ri?ri/ci:"100%",maxHeight:"none",transform:1!==ci?`scale(${ci})`:void 0,transformOrigin:"top left"},mi=()=>Ht({type:"setUi",ui:{leftSideBarVisible:!zo}}),gi=()=>Ht({type:"setUi",ui:{rightSideBarVisible:!Co}}),yi=e=>{_o&&(qo(!1),tr(null),er.current=!1,zo&&Fo===e)||(Do(e),zo||Ht({type:"setUi",ui:{leftSideBarVisible:!0}}))},bi=()=>{lr(no??V),Co||Ht({type:"setUi",ui:{rightSideBarVisible:!0}})},vi=Wt.data.content??[],ki=()=>{const e=vi.findIndex(to),n=vi.findIndex(oo);return{floor:e>=0?e+1:0,cap:n>=0?n:vi.length}},Si=Xt,wi=vr.stripCopy,xi=e=>o(e,wi),zi=pe(),Ci=Ze({data:Wt.data,config:Si,readOnly:Boolean(jt),clipboard:zi,strip:wi?e=>wi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==wn||e.slot!==xn)return{min:0,max:n-1};const{floor:t,cap:o}=ki();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&lr(V);const t=void 0===n||"node"===n?.kind?n:null;wo.commitDocument(e,t)}}),Oi=fe(),[Ni,Ii]=Vn(null),Bi=e=>{const n=vi.find(n=>String(n.props.id)===e),t=Gt.shared;n&&t&&Ci.swap(e,t.detach(n))},Pi=e=>{const n=On(Wt.data,Xt,e);if(!n)return!1;const t=zn(n.place),o=n.node,r=t===Oe?ji(o):Ki(o),i=t===Oe?Gt.shared?.usedOn(o):null;return!!Ci.remove(e)&&(_r(i?lo.shared.removed({count:Math.max(0,i.length-1)}):lo.deleted({name:r}),"success",{duration:8e3,action:{label:lo.bar.undo,onClick:()=>{Ci.restore(n.node,n.place)}}}),!0)},$i={...Ci,remove:Pi},Ei=e=>Ir(e,"block",Xt.components[e]?.label??e),Mi=Hn(e=>Xt.components[e]?.defaultProps??{},[Xt]),Ti=e=>Ir(e,"section",Ei(e)),ji=e=>we({type:e.type,props:e.props??{}},Ti(e.type),$r),{nodeAddresses:Li,zoneItems:Ai}=Dn(()=>{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 Be(Xt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(vi,Oe,0),{nodeAddresses:e,zoneItems:n}},[vi,Xt]),Ri=Hn(e=>Ai.get(e)??[],[Ai]),Fi=e=>{const n=Li.get(e);return n?Ri(n.zone)[n.index]:void 0},Di=e=>oe(vr,Xt,e),Vi=e=>{if(!vr.slotsOf||e===Oe)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Fi(e.slice(0,n));if(!t)return null;const o=Di(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}},Wi=(()=>{if(!K(ir))return null;const e=`${ir.nodeId}:${ir.slot}`;return Vi(e)?.slot.panel===ir.kind?e:null})(),Hi=Fn(null);Wn(()=>{const e=Hi.current;if(Hi.current=null,!Wi||!K(ir))return;const n=ir.nodeId;pr(n,{scroll:e!==Wi}),Vr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[ir]);const Yi=e=>{const n=Li.get(e);n&&(n.zone===Oe?cl(n.index):Al(n.zone,n.index,e,Fi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))},Ui=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void Yi(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Wi!==i&&(Hi.current=i),mr(null,r),Co||Ht({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ji=(e,n,t)=>{const o=`${e}:${n}`;if(Vr(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;Wi!==o&&(Hi.current=o);mr(null,{kind:t,nodeId:e,slot:n})},Xi=(e,n,t)=>{if(jt||!vr.moveSlot)return;const o=Fi(e),r=o?Di(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Ot,index:n},s=Sn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=vr.moveSlot(e,n,s);"string"==typeof d&&Ji(e,d,i.panel)},Gi=Pr(),Qi=Dn(()=>{const e=/* @__PURE__ */new Map;for(const n of Gi??[])e.set(n.slug,n.name);return e},[Gi]),Ki=e=>xe(e,Ei,Nr.plainText,e=>Qi.get(e),Nr.rowName),Zi=(e,n)=>{const t=Xt.components[e.type]?.fields,o=n===Oe||as(n)?"section":"block",r=n===Oe&&(to(e)||oo(e)||_t(e.type)),i="block"===o?ze(t):r?null:Ce(t);return Nr.renamePropOf?Nr.renamePropOf(e,o,i):i},_i=(e,n,t,o)=>{if(!(!jt&&jr?.zone===e&&jr.index===n))return;const r=(t,o)=>{Lr(null),o&&((e,n,t)=>{const o=Ri(e)[n];if(!o)return;const r=Zi(o,e);r&&wo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
14
+ return ht("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":lo.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)},qi=i(Z(),fo),el=qi.scope({target:An,siteId:nt,docId:Xn}),nl=Xt,tl=(e,n)=>n===Oe?Ti(e):Ei(e),ol=(e,n,t)=>{const o=qi.plan(el,t,tl(t.type,e),nl);o&&(o.changed&&wo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),_r(o.message))},rl=ue({nodesIn:Ri,nodeAt:(e,n)=>Ri(e)[n]??null,labelOf:(e,n)=>n===Oe?Ti(e):Ei(e),renamePropOf:Zi,beginRename:(e,n)=>Lr({zone:e,index:n}),history:{hasPast:Yt.hasPast,hasFuture:Yt.hasFuture,back:()=>Yt.back(),forward:()=>Yt.forward()},openPageStyles:yr.openPageStyles,pageStylesLabel:lo.pageStyles,words:{menu:uo,styleClipboard:fo,screen:lo.menu},readOnly:Boolean(jt),collapseAll:()=>Vr(new Set(Ri(Oe).map(e=>String(e.props.id)))),onPasteRefused:e=>_r(e?lo.pasteRefused({name:e.label}):lo.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>us(e,n),copyItem:yr.onCopyItem,menuRows:(e,n,t)=>{const o=yr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Gt.shared;if(!t||n!==Oe)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:lo.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return jt||kr(e.type,e)?n:{...n,change:[{label:lo.shared.detach,onClick:()=>Bi(e.props.id)}],remove:[{label:lo.shared.removeFromPage,danger:!0,onClick:()=>{Pi(e.props.id)}}]}}return jt||to(e)||oo(e)||_t(e.type)?null:O(Oi)?{change:[{label:lo.shared.makeShared,onClick:()=>Ii({id:e.props.id,name:ji(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=>kr(e.type,e),duplicateBlocked:e=>Sr(Wt.data,e),permits:e=>{const n=Ne(Xt,e.type);return Gt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:$i,isPinned:(e,n)=>n===Oe&&(to(e)||oo(e)),sectionBand:ki,locate:e=>Li.get(e)??null,rowNameOf:(e,n)=>n===Oe?ji(e):Ki(e),selectAt:(e,n,t,o)=>{e===Oe?cl(n):Al(e,n,t,o??"")},slotRung:e=>{const n=Vi(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ui(n.node,n.slot,!1)}:null},style:{held:()=>ve(el),canCopy:e=>qi.rows(nl,e).some(e=>!1!==e.counted),copy:(e,n)=>qi.copy(el,e,tl(e.type,n),nl),paste:(e,n,t)=>ol(e,n,t)},keys:Rt?{target:Xo,selected:()=>{const e=Wt.ui.itemSelector;return e?{zone:e.zone??Oe,index:e.index}:null},held:()=>zi.get(),readOnly:Boolean(jt),onDone:({done:e,name:n})=>{"copied"===e&&_r(lo.copied({name:n}))}}:void 0},Uo),il=Fn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Wn(()=>{il.current={copy:(e,n)=>qi.copy(el,e,tl(e.type,n),nl),paste:ol,at:()=>{const e=Wt.ui.itemSelector;if(!e)return null;const n=e.zone??Oe,t=Ri(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(jt)}});const ll=Hn(e=>{const n=ke(e);if(!n)return;const t=il.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))},[]);Wn(()=>{if(!Xo)return;const e=e=>ll(e);return Xo.addEventListener("keydown",e),()=>Xo.removeEventListener("keydown",e)},[ll,Xo]),En(Uo,"keydown",ll);const sl=vi.map(e=>e.props.id).join("|");Wn(()=>{const e=Uo?.document??null,n=Uo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void rr(e=>e.length?[]:e);const n=vi.findIndex(oo),t=n>=0?n:vi.length,o=n=>{const t=vi[n]?.props?.id;return null==t?null:Rn(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Pn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=vi.length>0&&!to(vi[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=Ct(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})}rr(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=Mn(n,i),s=new ResizeObserver(i);return s.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l(),s.disconnect()}},[Uo,sl,$o,ci,zo,Co,Ut?.props.id]);const dl=Uo?.document??null,al=Uo?.window??null;Wn(()=>{const e=Ho.current;if(!e||!dl||!al)return;const n=[],t=()=>{const n=Rn(dl,`[data-easel-block="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&al.scrollTo({left:al.scrollX,top:al.scrollY+t,behavior:"instant"}),!0};return Ho.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[dl,al]);const cl=e=>{lr(V),wo.select({index:e}),yr.sectionPressed?.(vi[e]);const n=vi[e]?.props?.id;n&&l(n)},pl=e=>{const{floor:n,cap:t}=ki(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Ut&&ir.kind!==no?.kind?vi.findIndex(e=>e.props.id===Ut.props.id):-1;return o(r>=0?r+1:t)},ul=(e,n)=>{const{floor:t,cap:o}=ki(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(wo.reorderComponent(Oe,e,i),wo.select({index:i}),{moved:!0,dest:i})},fl=(e,n,t,o)=>{lr(V),wo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),_r(lo.sectionAdded({name:t}))},hl=(e,n)=>{const t=pl(n),o=xr(e,{nodeDefaults:Mi,newNodeId:$e,sectionLabel:Ti,blockIsOffered:Cr}),r=o?wo.insertNode(Oe,t,o):wo.insertSection(e,t);return fl(t,r,Ti(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 Be(Xt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=zr(e.type,l,d.slice(d.lastIndexOf(":")+1),Or(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},ml=e=>gl(Oe,e),gl=(e,n)=>{Kr.current=document.activeElement??null,tr(null===n?null:{zone:e,index:n}),qo(!0),zo||(er.current=!0,Ht({type:"setUi",ui:{leftSideBarVisible:!0}}))},yl=()=>{qo(!1),tr(null),er.current&&Ht({type:"setUi",ui:{leftSideBarVisible:!1}}),er.current=!1},bl=(e,n)=>Nr.rowName?n?to(e)?Nr.rowName(e,"section",lo.header):oo(e)?Nr.rowName(e,"section",lo.footer):_t(e.type)?Nr.rowName(e,"section",Ei(e.type)):ji(e):Ki(e):n?Ti(e.type):Ei(e.type),vl=e=>n=>{e()},kl=(e,n,t)=>{if(jt)return null;const o=Ri(e)[n];return o&&!Ne(Xt,o.type).delete||o&&kr(o.type,o)?null:/* @__PURE__ */ht(Je,{kind:"delete",label:e===Oe&&o&&Gt.shared?.usedOn(o)?lo.shared.removeFromPage:lo.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Ri(e)[n]?.props?.id;null!=t&&Pi(String(t))})(e,n),children:/* @__PURE__ */ht(at,{size:15})})},Sl=e=>Nr.rowPreview?.(e)||void 0,wl=e=>Nr.rowMarks?.(e)??void 0,xl=(e,n,t)=>Nr.rowActions?.(e,n,t)??null,zl=(e,n,t,o)=>{if(jt)return null;if(kr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
15
+ return ht(Je,{kind:"eye",label:r?lo.showNamed({name:o}):lo.hideNamed({name:o}),onClick:()=>Ol(e,n,t),children:/* @__PURE__ */ht(r?ct:pt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},Cl=e=>id(Oe,e),Ol=(e,n,t)=>{wo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Nl=e=>Pe(Xt,e),Il=e=>Be(Xt,e),Bl=e=>vr.slotsOf?Di(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Ee(e,n.slot)})):[{slot:null,rung:null,kids:re(Xt,e)}],Pl=e=>vr.slotsOf?Bl(e).flatMap(e=>e.kids):re(Xt,e),$l=e=>Boolean(vr.slotsOf)&&Di(e).some(e=>e.rung),El=(e,n,t)=>zr(e.type,n,t??void 0,Or(e)),Ml=(e,n,t)=>{const o=Me(Xt,e.type,n)&&(t||Pl(e).length>0||$l(e));return{collapsible:o,folded:o&&Xr(String(e.props.id))}},Tl=(e,n,t)=>Bl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Ml(e,r,t(e.type)).collapsible?[String(e.props.id),...Tl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),jl=e=>Pl(e).length>0||$l(e)||Boolean(zr(e.type)),Ll=e=>Boolean(zr(e)),Al=(e,n,t,o)=>{if(lr(V),zr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),wo.select({index:n,zone:e}),l(t)}else wo.select({index:n,zone:e}),l(t)},Rl=(e,n,t,o,r)=>{const i=`${e}:${n}`;wo.insertComponent(i,t,o),zr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),wo.select({index:o,zone:i})}):wo.select({index:o,zone:i})},Fl=Fn(/* @__PURE__ */new Set);Wn(()=>{vi.forEach(e=>{const n=zr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Fl.current.has(t))return;Fl.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(Mi)).forEach((e,t)=>vo.seedChild(o,t,n.childType,e))})},[vi,vo,Mi]);const Dl=Fn(/* @__PURE__ */new Set);Wn(()=>{vi.forEach((e,n)=>{const t=e.props.id;if(Dl.current.has(t))return;const o=r(e,Nl(e.type));Dl.current.add(t),o&&vo.replaceComponent(Oe,n,{...e,props:o})})},[vi,vo]),_(vo,Xt);const Vl=vi.findIndex(oo),Wl=Vl>=0?vi[Vl]:null,Hl=ro?vi.findIndex(to):-1,Yl=Hl>=0?vi[Hl]:null,Ul=Gt.groupTab,Jl=Dn(()=>Ul?e=>_t(e.type):void 0,[Ul]),Xl=Boolean(Gt.groupBadge),Gl=Gt.sharedReach,Ql=e=>Gl?.(e)??void 0,Kl=Dn(()=>Gl?new Set(vi.filter(e=>Ql(e)).map(e=>String(e.props.id))):null,[vi,Gl]),Zl=Dn(()=>Kl?e=>Kl.has(e):void 0,[Kl]),_l=Gt.first?Gl?.({type:Gt.first,props:{id:""}})??void 0:void 0,ql=Gt.groupBadge?/* @__PURE__ */ht("span",{className:"es-tree-group-badge",children:/* @__PURE__ */ht(Gn,{tone:"info",size:"xs",children:Gt.groupBadge})}):void 0,es=vi.find(e=>e.type===Kt)??null,ns=vi.find(e=>e.type===Zt)??null,ts=Vl>=0?Vl:vi.length,os=[];vi.forEach(e=>{oo(e)||(jl(e)&&os.push(String(e.props.id)),os.push(...Tl(e,1,Ll)))}),Wl&&(os.push(String(Wl.props.id)),os.push(...Tl(Wl,1,Ll)));const rs=os.length>0&&os.every(e=>Dr.has(e)),is=e=>{const n=Nr.blockRowName(e,Ei);return Nr.rowName?Nr.rowName(e,"block",n):n},ls=(e,n,t,o)=>{const r=Ri(e)[t];if(!r)return;const i={...Cn(e),index:t},l={...Cn(n),index:Math.min(Math.max(o,0),Ri(n).length)},s=Sn(i,l);if(e!==n||s!==t)try{Ci.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Nn))throw e}},ss=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Il(e))n.add(r),t(o)};for(const t of Nl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},ds=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Li.get(n);if(!e)return null;if(e.zone===Oe)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},as=e=>{const n=e.slice(0,e.indexOf(":")),t=vi.find(e=>_t(e.type)&&String(e.props.id)===n);return t&&qt(n)===e?t:null},cs=(e,n)=>{const t=as(e);return!t||(!Gt.groupAccepts||Gt.groupAccepts(t.type,n,Ri(e).length))},ps=(e,n,t)=>{if(e.rung){const t=Fi(e.rung.nodeId),o=t?Di(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Ot&&n.index>=0&&n.index<=o}if(n.slot===Ot)return!1;if(e.add)return ms(e.add,n);const o=zn(n);if(_t(e.type))return!1;const r=as(o),i=as(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!cs(o,e.type))&&(n.index>=0&&n.index<=Ri(o).length));if(e.zone===Oe||o===Oe){if(e.zone!==o)return!1;const{floor:t,cap:r}=ki();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Ri(o).length)return!1;if(e.zone===o)return!0;const l=Wl&&!Gt.lastIsOpen?String(Wl.props.id):null;return(!l||ds(e.zone)!==l&&ds(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Ri(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Li.get(i),s=l?Ri(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ss(r).has(n))return!1;const d=zr(s.type,wr(Wt?.data,s.type,i),n.slice(n.lastIndexOf(":")+1),Or(s));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Ri(n),r))})(e.zone,o,e.index,t)},us=(e,n)=>{const t=zn(e.from),o=e.node;return t===zn(n)?cs(t,o.type):ps({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},fs=e=>{const n=e.slice(0,e.indexOf(":")),t=Li.get(n),o=t?Ri(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=zr(o.type,wr(Wt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1),Or(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:Ei(r.spec.childType)}]:[])),l=Vi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:bl(o,t.zone===Oe)}},hs=(e,n)=>{if("section"!==e.kind)return e;const t=zn(n);return t===Oe||as(t)?e:fs(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},ms=(e,n)=>{const t=hs(e,n),o=zn(n);if("shared"===t.kind){if(o!==Oe||!Gt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=ki();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(as(o)){if("preset"===t.kind)return!1;const e="section"===t.kind?t.type:t.template.node.type;return cs(o,e)&&n.index>=0&&n.index<=Ri(o).length}if(o!==Oe)return!1;const{floor:e,cap:r}=ki();return n.index>=e&&n.index<=r}if(o===Oe)return!1;const r=fs(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Ri(o))},gs=(e,n)=>{const t=hs(e,n);if("block"!==t.kind&&as(zn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&cs(n,o)){if("section"===e.kind)wo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;wo.insertNode(n,t,xi(e.template.node))}lr(V),wo.select({index:t,zone:n})}})(t,zn(n),n.index);if("section"===t.kind)return void hl(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=pl(t),r=wo.insertNode(Oe,o,n);fl(o,r,e)})(t.template.name,xi(t.template.node),n.index);if("preset"===t.kind)return void((e,n,t)=>{const o=n({nodeDefaults:Mi,newNodeId:$e,sectionLabel:Ti,blockIsOffered:Cr});if(!o)return;const r=pl(t),i=wo.insertNode(Oe,r,o);fl(r,i,e)})(t.preset.label,t.preset.insert,n.index);if("shared"===t.kind){const e=Gt.shared?.nodeOf(t.section);if(!e)return;const o=pl(n.index);return void(Ci.restore(e,{parentId:wn,slot:xn,index:o})&&fl(o,e.props.id,t.section.title))}const o=zn(n),r=fs(o);r&&(r.target.spec?Rl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{wo.insertComponent(e,n,t),lr(V),wo.select({index:t,zone:e})})(o,t.type,n.index))},ys=(e,n)=>{e.media?function(e){const n=ed();if(!n||!Zs)return;td(n).then(n=>{n&&function(e,n){if(!Zs)return;const t=Zs.create(e,{nodeDefaults:Mi,newNodeId:$e,sectionLabel:Ti,blockIsOffered:Cr}),o=zn(n);if(o===Oe){const e=pl(n.index),o=wo.insertNode(Oe,e,t);return void fl(e,o,Ti(t.type))}wo.insertNode(o,n.index,t),lr(V),wo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Xi(e.rung.nodeId,e.index,n.index):e.add?gs(e.add,n):e.zone===Oe?ul(e.index,n.index):ls(e.zone,zn(n),e.index,n.index)},[bs]=Vn(()=>vn()),vs=kn({keyOf:e=>e.id,readOnly:Boolean(jt),session:bs,canDrop:ps,onDrop:ys,onStep:(e,n)=>{e.rung?Xi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Oe?((e,n)=>{const t=Ti(vi[e]?.type??""),o=ul(e,n<0?e-1:e+2);if(!o.moved)return void _r(n<0?lo.sectionFirst({name:t}):lo.sectionLast({name:t}));const{floor:r,cap:i}=ki();_r(lo.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):ls(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),ks=Hn(e=>{const{floor:n,cap:t}=ki(),o=[];for(const r of e.nodes){const e=zn(r.place),i=Ri(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(to(i)||oo(i)||kr(i.type,i))continue;if(_t(i.type))continue;const l=Boolean(as(e)),s=e===Oe||l;e===Oe&&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?Ti(i.type):Ki(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=zn(e.list);if(n===Oe&&0===e.children.length)return[{...e,addLabel:lo.addSection,addAlways:!0}];const t=fs(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(as(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=zn(e.list),t=n===Oe||as(n)?null:fs(n);return t?.choices.length?mn(e,t.target.spec?.addLabel??lo.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Wt.data]),Ss=null==Ut?.props.id?null:String(Ut.props.id),ws=Un(Re),xs=ws?.selected()&&Uo?.document&&Ss?ws.selectedPart?.(Uo.document)??null:null,zs=xs&&Ss&&Fe(Wt.data,Xt,Ss,xs)?xs:null,Cs=zs?.label?{element:zs.element,label:zs.label}:null,Os=null!==zs,Ns=Hn(e=>{const n=Xt,t=e=>!e.item.rung&&null!==On(Wt.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(Ss);return i?Os?null:i:r(_e(Wt.data,n,o.item.id,Ss,Jl))??o},[Wt.data,Xt,Ss,Jl,Os]),[Is,Bs]=Vn(null),[Ps,$s]=Vn(null),Es=Boolean(Ul||Gl);En(Uo,"mouseover",e=>{if(!Es)return;const n=Tn(e.target),t=n?kt(Wt.data,Xt,n):null;t!==Is&&Bs(t)}),En(Uo,"mouseout",e=>{Es&&!e.relatedTarget&&Bs(null)});const Ms=e=>to(e)||oo(e)||_t(e.type),Ts=e=>{const n=_t(e.type)?Ei(e.type):to(e)?lo.header:oo(e)?lo.footer:null;return null===n?ji(e):Nr.rowName?Nr.rowName(e,"section",n):n},js=[];if(Es){const e=Ss?kt(Wt.data,Xt,Ss):null;for(const n of/* @__PURE__ */new Set([e,Is,Ps])){const e=n?vi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=to(e)||e.type===Kt,o=Ql(e);if(o){js.push({id:String(e.props.id),label:Ts(e),below:t,reach:o});continue}if(!Ul||!Ms(e))continue;const r=Ul(e);r&&js.push({id:String(e.props.id),label:r,below:t})}}const Ls=fe(),As=Fn(null);Wn(()=>{const e=Gt.changeNotice;if(!e)return;const n=JSON.stringify(vi.filter(Ms)),t=As.current;if(As.current={doc:Xn,bands:n,index:Yt.index},!t||t.doc!==Xn||t.bands===n)return;Yt.hasPast&&Yt.index>=t.index&&!vt.has(Ls)&&(vt.add(Ls),_r(e,"success",{action:{label:lo.bar.undo,onClick:()=>Yt.back()},duration:8e3}))},[vi]);const Rs=e=>{lr(V),wo.select(e.zone===Oe?{index:e.index}:{index:e.index,zone:e.zone})},Fs=q(),Ds=()=>({data:Wt.data,device:$o,ops:wo,inspector:gr}),Vs=Fs?.model,Ws=Dn(()=>Vs?e=>Vs(e,ks(e),Ds()):ks,[Vs,ks,$o]),Hs=Fs?.measure,Ys=Hs?(e,n)=>Hs(e,n,Ds()):void 0,Us=Fs?.canDrop,Js=Us?(e,n)=>Us(e,n,ps,Ds()):ps,Xs=Fs?.drop,Gs=Xs?(e,n)=>Xs(e,n,ys,Ds()):ys,Qs=Fs?.pick,Ks=Qs?e=>Qs(e,Rs,Ds()):Rs,Zs=Fs?.media??null,_s=Fn(null),qs=Dn(()=>Zs?{id:yt,zone:"",index:-1,type:Zs.adds.type,add:{kind:Zs.adds.kind,type:Zs.adds.type},media:!0}:null,[Zs]);Wn(()=>{if(!qs||jt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(rt))(e)&&(_s.current=null,bs.start({key:yt,item:qs}))},n=e=>{bs.get()?.item.media&&(_s.current=_n(e.dataTransfer))},t=()=>{bs.get()?.item.media&&bs.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,jt,bs]);const ed=()=>{const e=_s.current;return _s.current=null,e},nd=ce(),td=async e=>{if(!nd)return e;const n=await nd(e);return n?{...e,id:n.id,url:n.url}:null};const od=(e,n)=>{if(!Zs)return;const t=On(So.getState().appState.data,Si,n);if(!t)return;const o=t.node;wo.replaceComponent(zn(t.place),t.place.index,{...o,props:{...Zs.replace(o,e),id:o.props.id}})},rd=e=>{const n=zn(e),t=Vi(n);t&&Ui(t.node,t.slot,!1),gl(n,e.index)},id=(e,n)=>/* @__PURE__ */ht(Xe,{...jt?{}:vs.seam({place:{...Cn(e),index:n}})},`seam:${e}:${n}`),ld={rowClick:vl,isCollapsed:Xr,toggleCollapse:Gr},sd=e=>{const n=String(e.props.id),t=vi.findIndex(e=>String(e.props.id)===n),o=qt(n),r=Ri(o),i=Xr(n),l=Ei(e.type),s=Nr.rowName?Nr.rowName(e,"section",l):l,d=e=>id(o,e);/* @__PURE__ */
16
+ return mt(gt,{children:[
17
+ /* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:e.type,size:13}),name:s,preview:Sl(e),marks:wl(e),onSelect:()=>cl(t),nameSlot:_i(Oe,t,n,s),selected:sr===n,badge:Ql(e)?void 0:ql,shared:Ql(e),actions:xl(e,Oe,t)??void 0,rowProps:{"data-node-id":n,onClick:vl(()=>cl(t))},fold:{open:!i,label:"section",onToggle:()=>Gr(n)}}),!i&&/* @__PURE__ */mt(He,{children:[r.map((n,t)=>{const r=String(n.props.id),i=ji(n),l=jl(n),s=l&&Xr(r),a=()=>Al(o,t,r,e.type),{rowProps:c,...p}=vs.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Cn(o),index:t}},{"data-node-id":r,onClick:vl(a)});/* @__PURE__ */
18
+ return mt(Jn,{children:[d(t),
19
+ /* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:n.type,size:13}),name:i,preview:Sl(n),marks:wl(n),onSelect:a,nameSlot:_i(o,t,r,i),selected:sr===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Gr(r)}:void 0,actions:/* @__PURE__ */mt(gt,{children:[kl(o,t,i),xl(n,o,t),zl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */ht(He,{children:cd(n,2)})]},r)}),d(r.length)]})]})},dd=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=vs.dragging,d=!Xr(l)&&s?.rung?.nodeId!==i,a={...Cn(l),index:0},c=s&&!s.rung&&ps(s,a)?a:void 0,p=()=>Ui(e,n,!0),{rowProps:u,...f}=vs.row({item:{id:`rung:${l}`,zone:`${i}:${Ot}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Ot,index:t},into:c,canDrag:Boolean(vr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:vl(p)}),h=jt?null:vr.slotActions?.(e,n.slot);/* @__PURE__ */
20
+ return mt(Jn,{children:[n.heading,
21
+ /* @__PURE__ */ht(We,{words:so,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Wi===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Gr(l)},actions:h&&h.length>0?/* @__PURE__ */ht(gt,{children:h.map((t,o)=>/* @__PURE__ */ht(Je,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(jt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ji(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__ */ht(at,{size:15}):/* @__PURE__ */ht(ft,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */ht(He,{children:r})]},l)},ad=(e,n)=>{const t=Bl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
22
+ return ht(gt,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=El(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)=>id(e,n),p=/* @__PURE__ */mt(gt,{children:[i.map(({child:n,zone:t,index:o})=>{const r=sr===String(n.props.id),{collapsible:i,folded:s}=Ml(n,l,Ll(n.type)),d=String(n.props.id),a=is(n),p=()=>Al(t,o,d,e.type),{rowProps:u,...f}=vs.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Cn(t),index:o}},{"data-node-id":d,onClick:vl(p)});/* @__PURE__ */
23
+ return mt(Jn,{children:[0===o&&c(t,0),
24
+ /* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:n.type,size:13}),name:a,preview:Sl(n),marks:wl(n),onSelect:p,nameSlot:_i(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Gr(d)}:void 0,actions:/* @__PURE__ */mt(gt,{children:[kl(t,o,a),xl(n,t,o),zl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */ht(He,{children:ad(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?dd(e,t.rung,r++,o,p):/* @__PURE__ */ht(Jn,{children:p},t.slot??"")})})},cd=(e,n)=>{const t=wr(Wt?.data,e.type,String(e.props.id)),o=Bl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
25
+ return ht(gt,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=El(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)=>id(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),b=/* @__PURE__ */mt(gt,{children:[l.map(({child:n,zone:t,index:o})=>{const r=sr===String(n.props.id),i=Ki(n),l=String(n.props.id),{collapsible:d,folded:a}=Ml(n,s,Ll(n.type)),c=Nl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...Cn(p),index:Ri(p).length}:void 0,f=vs.dragging,h=u&&f&&ps(f,u)?u:void 0,g=()=>Al(t,o,l,e.type),{rowProps:y,...b}=vs.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Cn(t),index:o},into:h,canDrag:!kr(n.type,n)},{"data-node-id":l,onClick:vl(g)});/* @__PURE__ */
26
+ return mt(Jn,{children:[0===o&&m(t,0),
27
+ /* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:n.type,size:13}),name:i,preview:Sl(n),marks:wl(n),onSelect:g,nameSlot:_i(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...b,fold:d?{open:!a,label:"group",onToggle:()=>Gr(l)}:void 0,actions:kr(n.type,n)?xl(n,t,o)??void 0:/* @__PURE__ */mt(gt,{children:[kl(t,o,i),xl(n,t,o),zl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */ht(He,{children:cd(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
28
+ /* @__PURE__ */ht(z,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Rl(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?dd(e,o.rung,i++,r,b):/* @__PURE__ */ht(Jn,{children:b},o.slot??"")})})},pd=_o,ud=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:zo&&!pd&&br===e.id,onSelect:()=>yi(e.id)}:e,fd=[...(yr.railLead??[]).map(ud),{id:"sections",label:lo.layers,icon:/* @__PURE__ */ht(ge,{}),active:zo&&!pd&&"sections"===br,onSelect:()=>yi("sections")},...(yr.railTrail??[]).map(ud)],hd=To?{onPress:jo}:Ft?{onPress:()=>{x(Bn,{accept:"image/*",title:ho.mediaLibrary})}}:null,md={value:fd.find(e=>!0===e.active)?.id??"",press:e=>{const n=fd.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:fd.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */ht("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},gd=[...yr.railLead??[],...yr.railTrail??[]].find(e=>"panel"in e&&e.id===br),yd=Boolean(io?.foldable),bd=io?.label??(Dt?lo.pageSections:lo.templateSections),vd=yd&&Xr(It),kd=/* @__PURE__ */mt(gt,{children:[vi.map((e,n)=>{if(to(e)||oo(e)||_t(e.type))return null;const t=sr===String(e.props.id),o=Boolean(e.props._hidden);Il(e);const r=String(e.props.id),i=yr.hasOwnRows?.(e)??!1,l=jl(e)||i,s=l&&Xr(r),d=Nl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...Cn(a),index:Ri(a).length}:void 0,p=vs.dragging,u=c&&p&&ps(p,c)?c:void 0,{rowProps:f,...h}=vs.row({item:{id:r,zone:Oe,index:n,type:e.type},place:{...Cn(Oe),index:n},into:u,canDrag:!kr(e.type,e)},{"data-node-id":r,onClick:vl(()=>cl(n))});/* @__PURE__ */
29
+ return mt(Jn,{children:[n>0&&Cl(n),
30
+ /* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:e.type,size:13}),name:ji(e),preview:Sl(e),marks:wl(e),shared:Ql(e),onSelect:()=>cl(n),nameSlot:_i(Oe,n,r,ji(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Gr(r)}:void 0,actions:/* @__PURE__ */mt(gt,{children:[kl(Oe,n,ji(e)),xl(e,Oe,n),zl(Oe,n,e,ji(e))]}),rowProps:f}),jl(e)&&!s&&/* @__PURE__ */mt(He,{children:[cd(e,1),yr.partRows?.(e,ld)]}),i&&!s&&/* @__PURE__ */ht(He,{children:yr.ownRows?.(e,n,ld)})]},String(e.props.id??n))}),ts>0&&Cl(ts)]}),Sd=(e,n,t)=>{const o=String(e.props.id),r=Pl(e).length>0||$l(e)||Boolean(zr(e.type)),i=r&&Xr(o),l="header"===t?lo.header:lo.footer,s=Nr.rowName?Nr.rowName(e,"section",l):l;/* @__PURE__ */
31
+ return mt(gt,{children:[
32
+ /* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:t,size:13}),name:s,preview:Sl(e),marks:wl(e),badge:Ql(e)?void 0:ql,shared:Ql(e),onSelect:()=>cl(n),nameSlot:_i(Oe,n,o,s),selected:sr===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Gr(o)}:void 0,actions:xl(e,Oe,n)??void 0,rowProps:{"data-node-id":o,onClick:vl(()=>cl(n))}}),r&&!i&&/* @__PURE__ */ht(He,{children:ad(e,1)})]})};return(yr.wrap??(e=>e))(
33
+ /* @__PURE__ */ht(ee,{target:Uo,children:/* @__PURE__ */mt("div",{ref:Yo,className:"sf-editor es-editor",style:dn(Wr),onContextMenu:rl.onEditorContextMenu,...p(Bn),children:[
34
+ /* @__PURE__ */mt(qe,{children:[
35
+ /* @__PURE__ */mt("div",{className:"es-cluster es-cluster--left",children:[hd?/* @__PURE__ */ht(Qn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */ht(ye,{}),onClick:hd.onPress,children:lo.railMedia}):null,
36
+ /* @__PURE__ */ht(en,{label:lo.bar.undo,disabled:Boolean(jt)||!Yt.hasPast,onClick:()=>Yt.back(),children:/* @__PURE__ */ht(it,{})}),
37
+ /* @__PURE__ */ht(en,{label:lo.bar.redo,disabled:Boolean(jt)||!Yt.hasFuture,onClick:()=>Yt.forward(),children:/* @__PURE__ */ht(lt,{})})]}),
38
+ /* @__PURE__ */mt(nn,{children:[
39
+ /* @__PURE__ */ht(tn,{devices:Oo,value:$o,onChange:Eo}),
40
+ /* @__PURE__ */ht(en,{label:lo.bar.refresh,tip:lo.bar.refreshTip,onClick:()=>{Ho.current=(()=>{const e=Uo?.document;if(!e)return null;const n=vi.findIndex(oo),t=n>=0?n:vi.length;let o=null;for(let n=0;n<t;n++){const t=vi[n]?.props?.id;if(null==t)continue;const r=Rn(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=Ut?.props?.id??vi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Wo(e=>e+1)},children:/* @__PURE__ */ht(st,{})}),yr.barView?.()]}),
41
+ /* @__PURE__ */mt(nn,{kind:"right",style:{minWidth:300},children:[
42
+ /* @__PURE__ */ht(v,{input:Ko,words:lo.saveStatus}),jn?/* @__PURE__ */ht(jn,{}):null,yr.barLead?.(),yr.barTrail?.(),yr.mainAction||!yr.barMain?/* @__PURE__ */ht(k,{input:Ko,action:qr,readOnly:Boolean(jt),saveSwitch:At,onToggleAutoSave:$t,onSaveNow:Zo,bar:lo.bar,words:lo.saveStatus}):yr.barMain()]})]}),
43
+ /* @__PURE__ */ht(b,{}),
44
+ /* @__PURE__ */mt("div",{className:"sf-body",children:[zo?/* @__PURE__ */mt(gt,{children:[
45
+ /* @__PURE__ */mt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":lo.leftPanel,children:[
46
+ /* @__PURE__ */mt("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
47
+ /* @__PURE__ */ht(I,{side:"left",onHide:mi}),
48
+ /* @__PURE__ */ht("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
49
+ /* @__PURE__ */ht(Kn,{variant:"underline",block:!0,"aria-label":lo.bar.views,value:md.value,onChange:md.press,items:md.items})]}),_o?/* @__PURE__ */ht(C,{at:nr?{label:(e=>{const n=as(e.zone);if(n)return lo.add.addingTo({name:Nr.rowName?bl(n,!0):Ei(n.type)});if(e.zone===Oe){const n=vi[e.index];return n&&!oo(n)?lo.add.addingBefore({name:bl(n,!0)}):lo.add.addingAtEnd}const t=fs(e.zone);return t?lo.add.addingTo({name:t.parentName}):lo.add.addingHere})(nr),onClear:()=>tr(null)}:void 0,placeBlocks:nr&&nr.zone!==Oe?fs(nr.zone)?.choices:void 0,canTake:nr?e=>{if(!nr)return null;const n={...Cn(nr.zone),index:nr.index};if(ms(e,n))return null;if("shared"===e.kind&&nr.zone===Oe&&!Gt.shared?.nodeOf(e.section))return lo.shared.alreadyHere;const t=as(nr.zone);if(t)return lo.add.notInside({name:bl(t,!0)});if(nr.zone===Oe)return lo.add.onlySections;const o=fs(nr.zone);return o?lo.add.notInside({name:o.parentName}):lo.add.onlySections}:void 0,onPick:nr?e=>{if(!nr)return;const n={...Cn(nr.zone),index:nr.index};ms(e,n)&&(gs(e,n),yl())}:void 0,itemFor:e=>({id:`new:${e.kind}:${Nt(e)}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:Nt(e),add:e}),session:bs,siteWide:yr.addPanelRow?.(yl),onClose:yl,readOnly:Boolean(jt)}):gd?gd.panel({onHide:mi,notify:_r}):/* @__PURE__ */mt(gt,{children:[
50
+ /* @__PURE__ */ht(B,{icon:/* @__PURE__ */ht(ge,{}),title:lo.layers,context:mo,actions:/* @__PURE__ */mt(gt,{children:[!jt&&/* @__PURE__ */ht(on,{label:lo.add.title,onClick:()=>ml(null),children:/* @__PURE__ */ht(dt,{size:15})}),
51
+ /* @__PURE__ */ht(on,{label:rs?lo.expandAll:lo.collapseAll,title:0===os.length?lo.nothingToFold:void 0,disabled:0===os.length,onClick:()=>Vr(e=>{const n=new Set(os);return rs?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...os])}),children:/* @__PURE__ */ht(xt,{expand:rs})})]})}),
52
+ /* @__PURE__ */mt(Ye,{className:"sf-tree sf-scroll",words:so,children:[es&&/* @__PURE__ */mt(gt,{children:[!Xl&&/* @__PURE__ */ht(Ue,{children:lo.header}),sd(es)]}),Vt&&!(Xl&&es)&&/* @__PURE__ */mt(gt,{children:[!Xl&&/* @__PURE__ */ht(Ue,{children:lo.header}),!ro&&/* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:"header",size:13}),name:lo.header,badge:_l?void 0:ql,shared:_l,onSelect:bi,selected:ir.kind===no?.kind,rowProps:{onClick:vl(bi)}})]}),Yl&&!(Xl&&es)&&Sd(Yl,Hl,"header"),!yd&&/* @__PURE__ */ht(Ue,{children:bd}),yd?/* @__PURE__ */mt(gt,{children:[
53
+ /* @__PURE__ */ht(We,{words:so,icon:null,name:bd,fold:{open:!vd,label:bd,onToggle:()=>Gr(It)}}),!vd&&/* @__PURE__ */ht(He,{children:kd})]}):kd,Vt&&!Xl&&/* @__PURE__ */ht(Ue,{children:lo.footer}),Wl&&!(Xl&&ns)&&Sd(Wl,Vl,"footer"),ns&&sd(ns),yr.treeFoot?.()]})]})]}),
54
+ /* @__PURE__ */ht(rn,{side:"left",width:Wr.left,min:sn.left,max:ln,defaultWidth:h.left,label:lo.resizeLeftPanel,onResize:Ur})]}):/* @__PURE__ */ht(P,{side:"left",onShow:mi}),
55
+ /* @__PURE__ */mt("div",{ref:ni,className:"sf-center sf-scroll","data-sf-canvas-head":li?"":void 0,style:{overflowX:ui?"auto":"hidden",overflowY:"hidden"},children:[li&&/* @__PURE__ */ht("div",{ref:si,className:"sf-canvas-head",children:/* @__PURE__ */ht(li,{device:$o})}),
56
+ /* @__PURE__ */mt("div",{className:"sf-frame-scaler",style:fi,children:[
57
+ /* @__PURE__ */ht("div",{className:"sf-frame "+($o===Bo?"":`sf-frame--${$o}`),style:hi,children:/* @__PURE__ */mt("div",{className:"sf-preview-host",children:[
58
+ /* @__PURE__ */ht(De.Provider,{value:Jl,children:/* @__PURE__ */ht(Ve.Provider,{value:Zl,children:/* @__PURE__ */ht(go,{},Vo)})}),
59
+ /* @__PURE__ */ht(gn,{canvas:Uo,session:bs,model:Ws,measure:Ys,canDrop:Js,onDrop:Gs,choose:Ns,tag:Cs,onPick:Ks,dropOn:Zs?{accepts:(e,n)=>{if(!e.media||!Zs||n.item.rung)return!1;const t=On(Wt.data,Si,n.item.id);return null!==t&&Zs.takes(t.node)},onDrop:(e,n)=>(e=>{const n=ed();n&&Zs&&td(n).then(n=>{n&&od(n,e.item.id)})})(n),label:()=>lo.canvasReplaceImage}:void 0,onZoneAdd:rd,onSeamAdd:rd,zoneAddLabel:lo.canvasAddBlock,words:ao.canvas,readOnly:Boolean(jt),revision:Wt.data}),or.length>0&&!Jo&&/* @__PURE__ */ht("div",{className:"sf-preview-gaps",children:or.map(e=>
60
+ /* @__PURE__ */ht(yn,{index:e.index,label:lo.addSectionHere,onInsert:()=>ml(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))})]})}),Es?/* @__PURE__ */ht(wt,{canvas:Uo,tabs:js,onSelect:Yi,onPointer:$s}):null]})]}),Co?/* @__PURE__ */mt(gt,{children:[Ln?
61
+ /* @__PURE__ */ht("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:Ln}):/* @__PURE__ */ht(gt,{children:/* @__PURE__ */ht(u,{value:{selectChild:Al,addChild:Rl,childRowName:Ki,blockRowName:is},children:/* @__PURE__ */ht(yo,{mode:ir,onOpenWebsiteSettings:yr.openSettings??(()=>{}),onOpenSiteStyles:yr.openStyles,onOpenPageStyles:yr.openPageStyles,onSelectNode:Mr,onNotify:_r,onHidePanel:gi,nodeActions:Ut?Ne(Xt,Ut.type):Bt})})}),
62
+ /* @__PURE__ */ht(rn,{side:"right",width:Wr.right,min:sn.right,max:ln,defaultWidth:h.right,label:lo.resizeSettingsPanel,onResize:Jr})]}):
63
+ /* @__PURE__ */ht(P,{side:"right",onShow:gi})]}),rl.menu,
64
+ /* @__PURE__ */ht(ie,{}),Ni?/* @__PURE__ */ht(bt,{name:Ni.name,onMake:e=>(async(e,n)=>{const t=vi.find(n=>String(n.props.id)===e),o=Gt.shared;if(!t||!o)return;let r;try{r=await N(Oi).create(n,t)}catch{return void _r(lo.shared.makeFailed,"error")}o.adopt(t,r),Ii(null)})(Ni.id,e),onCancel:()=>Ii(null)}):null]})}))}export{$t as ScreenChrome};
@@ -1 +1 @@
1
- import{DEFAULT_LOCK_WORDS as e}from"./chunk-RE4LP46F.js";import{newId as n}from"./chunk-EUFDQ4KL.js";var t=e=>"editing"===e.kind;function r(e){return e?{kind:"checking"}:{kind:"editing"}}var c=e=>"blocked"===e.kind||"readonly"===e.kind||"takenover"===e.kind?e.holder:null;function s(e){if(!e||"object"!=typeof e)return null;const n=e;return"string"!=typeof n.holder_name?null:{name:n.holder_name,secondsSinceSeen:"number"==typeof n.seconds_since_seen?n.seconds_since_seen:0,secondsSinceHeld:"number"==typeof n.seconds_since_held?n.seconds_since_held:0}}var a=e=>e?{edit:!0,insert:!0,delete:!0,duplicate:!0,drag:!1}:{edit:!1,insert:!1,delete:!1,duplicate:!1,drag:!1};function o(n,t=e){if(!Number.isFinite(n)||n<45)return t.justNow;const r=Math.round(n/60);if(r<60)return t.minutesAgo({count:r});const c=Math.round(r/60);return t.hoursAgo({count:c})}var i=(n,t=e)=>n.trim()||t.someone;function d(){return n("tab").slice(0,64)}var u="edit_lock_taken";function l(e,n,r){return!(t(e)||!t(n))&&(r.pending&&r.autoSaveEnabled&&!r.saveConflict)}function f(e,n,r){return!(null===c(e)||!t(n))&&(!r.pending&&!r.saveConflict)}function k(e,n){return e!==n&&Date.parse(e)>=Date.parse(n)}async function h(e){if(!e.ours)return!1;const n=await e.stored().catch(()=>null);return!(!n||!k(n,e.ours)||e.hasPending())&&(e.reload(),!0)}var b=8e3,g=3e4;function _(e){if(e.cancelled())return!1;const n=e.currentAccess();if("checking"!==n.kind)return!1;const t={kind:"editing"};return e.setAccess(t),l(n,t,e.heldWrite())&&e.releaseHeldWrite(),!0}function m(e){const{readFailure:n,conflictCode:t}=e,r=e=>{const t=n(e);return t&&409===t.status?s(t.data):null},c=e=>{const n=r(e);return n?{kind:"blocked",holder:n}:{kind:"editing"}},a=(e,n)=>{const t=r(e);return t?{kind:"blocked",holder:t}:n},o=(e,n)=>{const t=r(e);return t?{kind:"takenover",holder:t}:n},i=e=>{const t=n(e);return null!==t&&(401===t.status||403===t.status)};return{accessAfterClaimFailure:c,accessAfterTakeoverFailure:a,accessAfterHeartbeatFailure:o,isAuthRejection:i,readSaveConflict:e=>{const r=n(e);if(!r||409!==r.status)return null;if(!r.data||"object"!=typeof r.data)return null;const c=r.data;return c.code!==t?null:{savedBy:"string"==typeof c.saved_by?c.saved_by:"",savedByYou:!0===c.saved_by_you,secondsAgo:"number"==typeof c.seconds_ago?c.seconds_ago:0}},readLockTaken:e=>{const t=n(e);return t&&409===t.status&&t.data&&"object"==typeof t.data?t.data.code!==u?null:s(t.data)??{name:"",secondsSinceSeen:0,secondsSinceHeld:0}:null},makeClaimBeat:e=>{let n=!1;return async t=>{let r,s;try{const c=await e.claim(t);if(e.cancelled())return;r=e.currentAccess(),s={kind:"editing"},!n&&c.heartbeat_seconds>0&&(n=!0,e.startHeartbeat(1e3*c.heartbeat_seconds))}catch(n){if(e.cancelled())return;r=e.currentAccess(),s=t?a(n,r):"checking"===r.kind?c(n):o(n,r),i(n)&&e.stopHeartbeat()}e.setAccess(s);const d=e.heldWrite();l(r,s,d)?e.releaseHeldWrite():t&&f(r,s,d)&&e.reloadIfMoved?.()}}}}export{b as CLAIM_FAIL_OPEN_MS,u as EDIT_LOCK_TAKEN,g as FAIL_OPEN_RETRY_MS,r as accessForNewDocument,t as canWriteDocument,m as createEditLock,o as describeAge,a as documentPermissions,k as documentVersionMoved,c as holderOf,i as nameOrSomeone,d as newEaselClientId,_ as openUnansweredClaim,s as readLockHolder,h as reloadIfVersionMoved,l as shouldReleaseHeldWrite,f as shouldReloadAfterTakeover};
1
+ import{DEFAULT_LOCK_WORDS as e}from"./chunk-RE4LP46F.js";import{newId as n}from"./chunk-YDTEYXQW.js";var t=e=>"editing"===e.kind;function r(e){return e?{kind:"checking"}:{kind:"editing"}}var c=e=>"blocked"===e.kind||"readonly"===e.kind||"takenover"===e.kind?e.holder:null;function s(e){if(!e||"object"!=typeof e)return null;const n=e;return"string"!=typeof n.holder_name?null:{name:n.holder_name,secondsSinceSeen:"number"==typeof n.seconds_since_seen?n.seconds_since_seen:0,secondsSinceHeld:"number"==typeof n.seconds_since_held?n.seconds_since_held:0}}var a=e=>e?{edit:!0,insert:!0,delete:!0,duplicate:!0,drag:!1}:{edit:!1,insert:!1,delete:!1,duplicate:!1,drag:!1};function o(n,t=e){if(!Number.isFinite(n)||n<45)return t.justNow;const r=Math.round(n/60);if(r<60)return t.minutesAgo({count:r});const c=Math.round(r/60);return t.hoursAgo({count:c})}var i=(n,t=e)=>n.trim()||t.someone;function d(){return n("tab").slice(0,64)}var u="edit_lock_taken";function l(e,n,r){return!(t(e)||!t(n))&&(r.pending&&r.autoSaveEnabled&&!r.saveConflict)}function f(e,n,r){return!(null===c(e)||!t(n))&&(!r.pending&&!r.saveConflict)}function k(e,n){return e!==n&&Date.parse(e)>=Date.parse(n)}async function h(e){if(!e.ours)return!1;const n=await e.stored().catch(()=>null);return!(!n||!k(n,e.ours)||e.hasPending())&&(e.reload(),!0)}var b=8e3,g=3e4;function _(e){if(e.cancelled())return!1;const n=e.currentAccess();if("checking"!==n.kind)return!1;const t={kind:"editing"};return e.setAccess(t),l(n,t,e.heldWrite())&&e.releaseHeldWrite(),!0}function m(e){const{readFailure:n,conflictCode:t}=e,r=e=>{const t=n(e);return t&&409===t.status?s(t.data):null},c=e=>{const n=r(e);return n?{kind:"blocked",holder:n}:{kind:"editing"}},a=(e,n)=>{const t=r(e);return t?{kind:"blocked",holder:t}:n},o=(e,n)=>{const t=r(e);return t?{kind:"takenover",holder:t}:n},i=e=>{const t=n(e);return null!==t&&(401===t.status||403===t.status)};return{accessAfterClaimFailure:c,accessAfterTakeoverFailure:a,accessAfterHeartbeatFailure:o,isAuthRejection:i,readSaveConflict:e=>{const r=n(e);if(!r||409!==r.status)return null;if(!r.data||"object"!=typeof r.data)return null;const c=r.data;return c.code!==t?null:{savedBy:"string"==typeof c.saved_by?c.saved_by:"",savedByYou:!0===c.saved_by_you,secondsAgo:"number"==typeof c.seconds_ago?c.seconds_ago:0}},readLockTaken:e=>{const t=n(e);return t&&409===t.status&&t.data&&"object"==typeof t.data?t.data.code!==u?null:s(t.data)??{name:"",secondsSinceSeen:0,secondsSinceHeld:0}:null},makeClaimBeat:e=>{let n=!1;return async t=>{let r,s;try{const c=await e.claim(t);if(e.cancelled())return;r=e.currentAccess(),s={kind:"editing"},!n&&c.heartbeat_seconds>0&&(n=!0,e.startHeartbeat(1e3*c.heartbeat_seconds))}catch(n){if(e.cancelled())return;r=e.currentAccess(),s=t?a(n,r):"checking"===r.kind?c(n):o(n,r),i(n)&&e.stopHeartbeat()}e.setAccess(s);const d=e.heldWrite();l(r,s,d)?e.releaseHeldWrite():t&&f(r,s,d)&&e.reloadIfMoved?.()}}}}export{b as CLAIM_FAIL_OPEN_MS,u as EDIT_LOCK_TAKEN,g as FAIL_OPEN_RETRY_MS,r as accessForNewDocument,t as canWriteDocument,m as createEditLock,o as describeAge,a as documentPermissions,k as documentVersionMoved,c as holderOf,i as nameOrSomeone,d as newEaselClientId,_ as openUnansweredClaim,s as readLockHolder,h as reloadIfVersionMoved,l as shouldReleaseHeldWrite,f as shouldReloadAfterTakeover};
@@ -0,0 +1,8 @@
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-MTWQYLJE.js";import{blockRuns as c}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as a,useScreenBlockRules as p,useScreenPinned as d}from"./chunk-TUIBPB77.js";import{useEaselSession as m}from"./chunk-YM4UEGBV.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-G2VZ4DET.js";import{useEasel as u}from"./chunk-L36E2WCO.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-SEC6NV6Y.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-TQ5Y6S2X.js";import{useState as b,useEffect as v,useMemo as j,useRef as C}from"react";import{SharedIcon as w,AddIcon as E}from"efficient-shell/icons/efficient";import{ContextMenu as O,toast as I,Dialog as T,Button as $}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=C(null);/* @__PURE__ */
2
+ return x(T,{open:!0,role:"alertdialog",size:"sm",title:r.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */F(G,{children:[
3
+ /* @__PURE__ */x($,{ref:s,variant:"secondary",onClick:o,children:r.cancel}),
4
+ /* @__PURE__ */x($,{variant:"danger",loading:l,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:r.deleteShared})]}),children:r.deleteMessage({count:t})})}var W=e=>`section:${e}`,B=e=>`block:${e}`,L=e=>`template:${e}`,Q=e=>`shared:${e}`,S=e=>`preset:${e}`;function D({at:C,placeBlocks:T,canTake:$,onPick:D,itemFor:H,session:N,siteWide:U,onClose:Y,onHide:z,readOnly:A}){const J=u(e=>e.config),V=a(),{labelAtLevel:P,categoryLabel:R,firstSection:Z,Icon:_,Thumbnail:X}=V,{blockIsOffered:q,canAddTo:K}=p(),ee=h("screen",f).add,te=h("drag",g).add,ne=m(),[oe,re]=b([]);v(()=>{let e=!1;const t=e=>q(e,ne);return r(ne).list().then(n=>{if(e)return;const r=J.components;re(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[J,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=>q(e,ne);return l(ne).list().then(n=>{if(e)return;const r=J.components;ce(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[J,ne,ae]);const[de,me]=b(null),[fe,ue]=b(null),ye=j(()=>e(J,V),[J]),he=e=>P(e,"section",J.components[e]?.label??e),ke=e=>({type:e.preset?S(e.preset.key):W(e.type),label:e.name,cover:/* @__PURE__ */x(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(_,{type:e,size:26})}),ve=j(()=>{const e=t(ye,Z),o=/* @__PURE__ */new Map,r=e=>{e.retired||o.has(e.type)||!q(e.type,ne)||o.set(e.type,e)};for(const t of e?[e]:ye.filter(e=>!e.preset)){const e=K(t.type)?.choices??[];e.forEach(r),e.forEach(e=>K(e.type,1)?.choices?.forEach(r))}T?.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:B(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:Q(e.id),label:e.title,cover:/* @__PURE__ */x(X,{type:e.node.type}),mark:/* @__PURE__ */x(w,{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:L(e.id),label:e.name,cover:/* @__PURE__ */x(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(J.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(J,t,R),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)})}),!$)return p;const u=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ge(e.type),n=t?$(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,J,ee,$,T,ne]);/* @__PURE__ */
5
+ return F(G,{children:[
6
+ /* @__PURE__ */x(i,{icon:/* @__PURE__ */x(E,{size:15}),title:ee.title,context:ee.contextAll,actions:/* @__PURE__ */x(s,{label:ee.done,description:ee.doneDescription,onClick:Y}),onHide:z}),
7
+ /* @__PURE__ */F("div",{className:"sf-addside sf-scroll",children:[
8
+ /* @__PURE__ */x(k,{groups:ve,session:N,itemFor:e=>H(ge(e)??{kind:"section",type:e}),onInsert:D?e=>{const t=ge(e);t&&D(t)}:void 0,onTileMenu:(e,t)=>{const n=ge(e);return"shared"===n?.kind&&!A&&(me({section:n.section,...t}),!0)},at:C,hint:ee.hint,searchLabel:ee.search,readOnly:A,words:te}),U??null]}),de?/* @__PURE__ */x(O,{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 I.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{D as AddSidePanel,B as blockKey,S as presetKey,W as sectionKey,Q as sharedKey,L as templateKey};
@@ -0,0 +1 @@
1
+ import{useSectionOps as o}from"./chunk-3FANFZ4D.js";import{SELECTION_MODE as e}from"./chunk-TUIBPB77.js";import{decodePartId as r,encodePartId as t}from"./chunk-R4AUZVA3.js";import{useEasel as n}from"./chunk-L36E2WCO.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),I=o(),{setSelectedPartId:f,setSelectHandler:k}=p(),l=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(()=>{k(l)},[k,l]);const h=s(m)?t(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>e);const r=u(o);r&&I.select(r)},[i,u,I]),openPartId:h}}export{m as usePartBridge};
@@ -1 +1 @@
1
- import{resolveMediaPick as e}from"./chunk-JIP5JNRB.js";function t(t){const r=t;switch(r?.type){case"storefront-editor:media-picked":{const r=t;return r.requestId&&e(r.requestId,r.media??null),!0}case"storefront-editor:media-pick-cancelled":{const r=t;return r.requestId&&e(r.requestId,null),!0}default:return!1}}export{t as routeSharedHostMessage};
1
+ import{resolveMediaPick as e}from"./chunk-5HYVOOH3.js";function t(t){const r=t;switch(r?.type){case"storefront-editor:media-picked":{const r=t;return r.requestId&&e(r.requestId,r.media??null),!0}case"storefront-editor:media-pick-cancelled":{const r=t;return r.requestId&&e(r.requestId,null),!0}default:return!1}}export{t as routeSharedHostMessage};
@@ -0,0 +1,19 @@
1
+ import{findCopy as e,repeatCopyWithWrapper as t}from"./chunk-XT75WETI.js";import{DEFAULT_CANVAS_WORDS as n}from"./chunk-TBY3DFKS.js";import{useResolvedFields as o}from"./chunk-LDHUPZBK.js";import{toItemSelector as r,fromItemSelector as l,useNodeOps as i,parentStep as s,clickPickPart as a,clickPick as c}from"./chunk-TF6NAIV7.js";import{selectionBox as u,placeWindow as d,offsetOrigin as p,colorRunOf as f,ColorWindow as h,startCanvasTyping as m,textMap as g,richLayout as y}from"./chunk-MNQDOSAX.js";import{DEFAULT_COPY_WORDS as v}from"./chunk-PMRN5Z3T.js";import{useWords as w}from"./chunk-MFIRYGHW.js";import{find as b,ROOT_ID as k,getList as S,remove as x,parseZoneKey as C,move as I,duplicate as E,replaceNode as A,createNode as D,insert as M,normalizeData as O,createResolveCache as $,slotsOf as P,deepEqual as j,ROOT_SLOT as z,resolveNodeData as R}from"./chunk-YDTEYXQW.js";import{topLevelSlotKeys as N,fieldsFrom as L,drawnBlockCount as V,defaultsFrom as B}from"./chunk-KXM6YRG2.js";import{CANVAS_TYPABLE_EVENT as T,onMotionEnd as K,CANVAS_TYPING_EVENT as Z}from"./chunk-6GJEOER4.js";import{setCanvasNonce as F,related as W,isTypingTarget as H,upsertCanvasStyle as q,removeCanvasStyle as Y,WORDS_CLEAR as X,frameRectToHost as U,drawnBox as G}from"./chunk-FR7EEKFF.js";import{queryAllCopies as Q}from"./chunk-7UFKEX72.js";import{createContext as J,useEffect as _,useContext as ee,useRef as te,useSyncExternalStore as ne,useState as oe,useReducer as re,useCallback as le,createElement as ie,useMemo as se,useLayoutEffect as ae}from"react";import{jsx as ce,jsxs as ue,Fragment as de}from"react/jsx-runtime";import{createPortal as pe}from"react-dom";import{registerModalEscapeInterceptor as fe,FloatingBar as he,TextToolbar as me,LinkPicker as ge}from"efficient-shell/ui";function ye(e){return!["setData","setUi","set"].includes(e.type)}var ve=(e,t,n,o)=>{const r=S(e,t,C(n));return r?.[o]??null},we=(e,t,n,o,r)=>{const l=ve(e,t,n,o);if(!l)throw new Error(`${r}: nothing at ${n}[${o}]`);return l};function be(e,t){const{selection:n}=e;return{...e.ui,itemSelector:r(e.data,t,n),selectedSlot:n&&"slot"===n.kind?{parentId:n.parentId,slot:n.slot}:null}}function ke(e,t,n){return n?"node"===n.kind?b(e,t,n.id)?n:null:n.parentId===k?S(e,t,n)?n:null:b(e,t,n.parentId)&&S(e,t,n)?n:null:null}function Se(e,t,n,o=!1){const{itemSelector:r,selectedSlot:i,...s}=n;let a=e.selection;var c;return"itemSelector"in n&&(a=l(e.data,t,r??null)),"selectedSlot"in n&&(i?a=(c=i)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:o?s:{...e.ui,...s}}}function xe(e,t,n){const o=Ce(e,t,n);if(o===e)return e;const r=ke(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function Ce(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return Se(e,n,"function"==typeof t.ui?t.ui(be(e,n)):t.ui);case"set":{const r={data:o,ui:be(e,n)},l="function"==typeof t.state?t.state(r):t.state;let i=l.data?{...e,data:l.data}:e;return l.ui&&(i=Se(i,n,l.ui,!0)),i}case"insert":{const r={...C(t.destinationZone),index:t.destinationIndex},l=D(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:M(o,n,r,l)}}case"replace":{const r=we(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:A(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=we(o,n,t.sourceZone,t.sourceIndex,"duplicate"),l=E(o,n,r.props.id),i=ve(l,n,t.sourceZone,t.sourceIndex+1);return{...e,data:l,selection:i?{kind:"node",id:i.props.id}:e.selection}}case"reorder":return Ce(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=ve(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const l={...C(t.destinationZone),index:t.destinationIndex};return{...e,data:I(o,n,r.props.id,l)}}case"remove":{const r=we(o,n,t.zone,t.index,"remove");return{...e,data:x(o,n,r.props.id)}}default:return e}}var Ie={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},Ee={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},Ae=0,De=()=>`history-${Ae+=1}`;function Me(e){let t=e.config;const n=e.now??(()=>Date.now()),o=e.historyCoalesceMs??250;let i=e.permissions??{};const s=O(e.data,t);let a=s,c={data:s,selection:null,ui:{...Ee}};if(e.ui){const{itemSelector:n,selectedSlot:o,...r}=e.ui;c={data:s,selection:o?{kind:"slot",...o}:l(s,t,n??null),ui:{...Ee,...r}}}let u=[{core:c,at:-1/0,sealed:!0,id:De()}],d=0;const p=e=>{const t=u[d],r=n();!e&&d===u.length-1&&d>0&&!t.sealed&&r-t.at<o?u=[...u.slice(0,d),{...t,core:c,at:r}]:(u=[...u.slice(0,d+1),{core:c,at:r,sealed:e,id:De()}],d=u.length-1)},f=/* @__PURE__ */new Set;let h=null,m=null,g=0,y=null,v=!1;const w=()=>{for(const e of[...f])e()},k=()=>{u=[...u.slice(0,d),{...u[d],core:c},...u.slice(d+1)]},x=(t,n)=>{g>0?v=v||n:(n?p(!1):c!==t&&k(),c.data!==t.data&&e.onChange?.(c.data),c!==t&&w())},C=e=>{const n=c;if(c=xe(c,e,t),c===n)return;const o=e.recordHistory??ye(e);x(n,o&&c.data!==n.data)},I=t=>{0===g&&(y=c,v=!1),g+=1;try{t()}catch(e){throw g-=1,0===g&&y&&(c=y,y=null),e}if(g-=1,g>0||!y)return;const n=y;y=null,v&&c.data!==n.data?p(!0):c!==n&&k(),c.data!==n.data&&e.onChange?.(c.data),c!==n&&w()},E=e=>{const n=c,o=ke(c.data,t,e);var r,l;(r=o,l=c.selection,r===l||r&&l&&r.kind===l.kind&&("node"===r.kind&&"node"===l.kind?r.id===l.id:"slot"===r.kind&&"slot"===l.kind&&r.parentId===l.parentId&&r.slot===l.slot))||(c={...c,selection:o},x(n,!1))},D=t=>{const n=c;d=t,c=u[d].core,c.data!==n.data&&e.onChange?.(c.data),c!==n&&w()},M=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...Ie,...i,...n}};let P=M();const j=$(),z={resolveCache:j,async resolveAll({trigger:e="load",metadata:n}={}){const o=c.data,r={type:"root",props:{...o.root.props??{}}},l=[...o.content,...Object.values(o.zones??{}).flat()],[i,...s]=await Promise.all([R(r,t,{cache:j,trigger:e,metadata:n}),...l.map(o=>R(o,t,{cache:j,trigger:e,metadata:n}))]);I(()=>{const n=c;let r=c.data;s.forEach((e,n)=>{if(!e.didChange)return;const i=l[n].props.id,s=b(r,t,i)?.node;s&&s===b(o,t,i)?.node&&(r=A(r,t,i,e.node))}),i.didChange&&r.root===o.root&&(r={...r,root:{...r.root,props:i.node.props,readOnly:i.node.readOnly??r.root.readOnly}}),r!==c.data&&("load"===e&&c.data===a&&(a=r),c={...c,data:r,selection:ke(r,t,c.selection)},x(n,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=b(c.data,t,e)?.node;if(!r)return!1;const l=await R(r,t,{cache:j,trigger:n,metadata:o});if(!l.didChange)return!1;let i=!1;return I(()=>{const n=c;if(b(c.data,t,e)?.node!==r)return;const o=A(c.data,t,e,l.node);o!==c.data&&(c={...c,data:o,selection:ke(o,t,c.selection)},x(n,!1),i=!0)}),i},get config(){return t},get loaded(){return a},getState(){if(h&&m===c)return h;const e=c,n={data:e.data,ui:be(e,t)},o="node"===e.selection?.kind?b(e.data,t,e.selection.id)?.node??null:null;return h={appState:n,selection:e.selection,selectedItem:o,config:t,dispatch:C,history:{back:()=>z.undo(),forward:()=>z.redo(),hasPast:d>0,hasFuture:d<u.length-1,histories:u.map(e=>({id:e.id,state:{data:e.core.data,ui:be(e.core,t)}})),index:d,setHistoryIndex:e=>{e>=0&&e<u.length&&e!==d&&D(e)}},getPermissions:P,getItemById:n=>b(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return S(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:n=>{const o=r(e.data,t,{kind:"node",id:n});return o?{index:o.index,zone:o.zone??"root:default-zone"}:void 0}},m=e,h},subscribe:e=>(f.add(e),()=>{f.delete(e)}),dispatch:C,batch:I,group:()=>{const e=d,t=u[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,u[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(u=[...u.slice(0,d),{...u[d],sealed:!0},...u.slice(d+1)]));const o=u[d];u=[...u.slice(0,e+1),{...o,sealed:!0},...u.slice(d+1)],d=e+1}}},select:e=>E(e?{kind:"node",id:e}:null),selectSlot:e=>E(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){I(()=>{const n=c,o=void 0===e.select?c.selection:e.select;c={...c,data:e.data,selection:ke(e.data,t,o)},x(n,e.data!==n.data)})},load(e,n={}){const o=c,r=O(e,t);c={...c,data:r,selection:ke(r,t,n.selection??c.selection)},a=r,n.keepHistory||(u=[{core:c,at:-1/0,sealed:!0,id:De()}],d=0),c!==o&&w()},undo(){d>0&&D(d-1)},redo(){d<u.length-1&&D(d+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,i)||(i=e,P=M(),h=null,w())},setConfig(e){e!==t&&(t=e,P=M(),h=null,w())}};return z}function Oe(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&H(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var $e=J(null),Pe=J(!0);function je({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return _(()=>{n&&e.resolveAll()},[e,n]),_(()=>{if(t&&"undefined"!=typeof document)return Oe(document,e)},[e,t]),/* @__PURE__ */ce($e.Provider,{value:e,children:/* @__PURE__ */ce(Pe.Provider,{value:t,children:o})})}function ze(){const e=ee($e);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function Re(e){const t=ze(),n=te({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const l=e(o);return r.has&&Object.is(r.value,l)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:l,has:!0},l)};return ne(t.subscribe,o,o)}function Ne(){return function(e){return Re(e)}}var Le=["--es-accent","--es-accent-tint","--es-accent-tint-strong","--es-accent-line","--es-accent-text","--es-accent-ring","--es-accent-shadow","--es-on-accent","--status-success-solid","--elevation-panel"],Ve="host-tokens";function Be(e,t){const n=function(e){const t=e.ownerDocument.defaultView;if(!t)return"";const n=t.getComputedStyle(e),o=[];for(const e of Le){const t=n.getPropertyValue(e).trim();t&&o.push(`${e}: ${t};`)}return o.length?`:root { ${o.join(" ")} }`:""}(e);n?q(t,Ve,n):Y(t,Ve)}var Te="data-easel-block",Ke="data-easel-dropzone",Ze={},Fe="data-es-mirror",We="undefined"==typeof window?_:ae;function He(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${Fe}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(Fe,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function qe({children:e,id:t="preview-frame",title:o,className:r,style:l,mirrorStyles:i=!0,onDocument:s,height:a="auto",nonce:c}){const u=w("canvas",n),d=te(null),[p,f]=oe(null);return We(()=>{const e=d.current,t=p?.ownerDocument.defaultView;if("auto"!==a||!e||!p||!t)return;const n=()=>{e.style.height=`${Math.ceil(p.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(p),()=>r?.disconnect()},[p,a]),We(()=>{let e=d.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=d.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-easel-entry",""),t.id="frame-root","fill"===a&&t.classList.add("es-frame-fill"),e.body.appendChild(t),F(e,c),f(t),s?.(e);let n=null;const o=d.current?.ownerDocument;if(i&&o){He(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>He(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}let r=null;const l=d.current;if(l&&o){Be(l,e);const t=o.defaultView;if(t&&"MutationObserver"in t){r=new t.MutationObserver(()=>Be(l,e)),r.observe(o.head,{childList:!0,subtree:!0,characterData:!0});const n={attributes:!0,attributeFilter:["class","style","data-theme"]};for(const e of[o.documentElement,o.body,l.closest(".es-editor")])e&&r.observe(e,n)}}return()=>{n?.disconnect(),r?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */ce("iframe",{ref:d,id:t,title:o??u.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:l,children:p?pe(e,p):null})}var Ye=J(null),Xe=J(Ze),Ue=[];function Ge({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:l=120}){const i=ze(),s=Re(n=>S(n.appState.data,i.config,{parentId:e,slot:t})??Ue),a=Re(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==k),c=Re(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),u=ee(Ye),d=["es-zone"];return s.length&&d.push("has-children"),e===k&&d.push("is-root"),(a||c)&&d.push("is-area-selected"),null!==u&&u===e&&e!==k&&d.push("is-hovering-area"),n&&d.push(n),/* @__PURE__ */ce("div",{className:d.join(" "),[Ke]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${l}px`},children:s.map(e=>/* @__PURE__ */ce(rt,{node:e},e.props.id))})}function Qe(e,t,n,o){const r=se(()=>{const n={};for(const o of N(L(e)))n[o]=Object.assign(function(e={}){/* @__PURE__ */
2
+ return ce(Ge,{parentId:t,slot:o,...e})},{blockCount:0});return n},[e,t]);for(const e of Object.keys(r))r[e].blockCount=V(n[e],o);return r}function Je(e){return se(()=>function({zone:t,...n}){/* @__PURE__ */
3
+ return ce(Ge,{parentId:e,slot:t,...n})},[e])}var _e=["top","bottom","zIndex"];function et(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function tt(e){const t=function(e){const t=e?.ownerDocument.defaultView?.getComputedStyle(e);if(!t||"sticky"!==t.position)return null;const n=e=>"auto"===e?"":e;return{top:n(t.top),bottom:n(t.bottom),zIndex:n(t.zIndex)}}(function(e){const t=e.ownerDocument.defaultView;let n=null;for(const o of Array.from(e.children))if("none"!==t?.getComputedStyle(o).display){if(n)return null;n=o}return n}(e));et(e,"position",t?"sticky":"relative");for(const n of _e)et(e,n,t?.[n]??"");return!!t}var nt="data-es-canvas-relative";function ot(e){e.hasAttribute(nt)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(nt));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(nt,"")),!1)}function rt({node:e}){const t=ze().config,n=t.components[e.type],o=e.props.id,r=te(null),l=function(e,t){return se(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(Te),o.removeAttribute("data-easel-dnd")),t.current=n,n&&(n.setAttribute(Te,e),n.setAttribute("data-easel-dnd",e),ot(n))},[e,t])}(o,r),i=te(null),s=!!n?.inline;!function(e,t){const n=te(!1),o=te(()=>{});o.current=()=>{const o=e(),l=n.current;n.current=!!o&&t(o),l!==n.current&&r.current()};const r=te(()=>{});We(()=>o.current()),We(()=>{const t=e(),l=t?.ownerDocument.defaultView;if(!t||!l)return;const i=()=>o.current();l.addEventListener("resize",i);const s=l.ResizeObserver,a=s?new s(i):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&l.MutationObserver&&(c=new l.MutationObserver(i),c.observe(e,{attributes:!0}))},r.current(),()=>{l.removeEventListener("resize",i),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>s?r.current:i.current,e=>s?ot(e):tt(e));const a=ee(Xe),c=Qe(n,o,e.props,t.components),u=Je(o);if(!n?.render)return null;const d=n.render,p={...B(n),...e.props,...c},f={renderDropZone:u,isEditing:!0,dragRef:n.inline?l:null,metadata:{...a,...n.metadata}};return n.inline?/* @__PURE__ */ce(d,{...p,editor:f,editMode:!0}):
4
+ /* @__PURE__ */ce("div",{ref:i,[Te]:o,"data-easel-dnd":o,style:{position:"relative"},children:/* @__PURE__ */ce(d,{...p,editor:f,editMode:!0})})}function lt({metadata:e}){const t=Re(e=>e.config),n=Re(e=>e.appState.data.root).props??{},o=t.root?.render,r=Qe(t.root,k,n,t.components),l=Je(k),i=/* @__PURE__ */ce(Ge,{parentId:k,slot:z}),s=o?/* @__PURE__ */ce(o,{id:"page-root",...n,...r,editor:{renderDropZone:l,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:i}):i;/* @__PURE__ */
5
+ return ce(Xe.Provider,{value:e??Ze,children:s})}var it=J(void 0),st=J(void 0);function at(e,t,n,o){const r=b(e,t,n);return!!r&&(P(r.node,t).length>0||!1===o.whole)}var ct=J(void 0),ut="data-es-chrome",dt=J(void 0);function pt(e){const t=e?.closest?.(`[${ut}]`)??null,n=t?.getAttribute(ut);return t&&n?{id:n,element:t}:null}function ft({element:e,clip:t=!1}){const n=te(null),o=gt(n,e?()=>e:null,e),r=ee(xt);/* @__PURE__ */
6
+ return ce("div",{ref:n,"aria-hidden":"true",className:"es-canvas-outline is-hover is-hover-part",style:o?{position:"absolute",top:o.top,left:o.left,width:o.width,height:o.height,clipPath:t?St(o,r):void 0}:{display:"none"}})}var ht={"--es-words-clear":`${X}px`};function mt({element:e,words:t=!1,clip:n=!1}){const o=te(null),r=gt(o,e?()=>e:null,e),l=ee(xt);/* @__PURE__ */
7
+ return ce("div",{ref:o,"aria-hidden":"true",className:"es-canvas-outline is-selected is-selected-part"+(t?" is-words":""),style:r?{position:"absolute",top:r.top,left:r.left,width:r.width,height:r.height,clipPath:n?St(r,l):void 0,...ht}:{display:"none"}})}function gt(e,t,n){return vt(e,t?e=>{const n=t(e);return n?[n]:[]}:null,n)[0]??null}var yt=[];function vt(e,t,n){const[o,r]=oe(yt),l=te(t);return l.current=t,We(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!l.current)return void r(yt);let o=0;const i=()=>{o=0;const n=e.current?.parentElement??null,i=(l.current?l.current(t):[]).map(e=>function(e,t){if(!e||!t)return null;const n=G(e),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(e,n)).filter(e=>null!==e);r(e=>{return(t=e)===(n=i)||t.length===n.length&&t.every((e,t)=>function(e,t){return e===t||!!e&&!!t&&e.top===t.top&&e.left===t.left&&e.width===t.width&&e.height===t.height}(e,n[t]))?e:i.length?i:yt;var t,n})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(i))};i();const a="MutationObserver"in n?new n.MutationObserver(s):null;a?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const c="ResizeObserver"in n?new n.ResizeObserver(s):null;c?.observe(t.documentElement),n.addEventListener("resize",s),n.addEventListener("scroll",s,{capture:!0,passive:!0});const u=K(n,s);return()=>{u(),a?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),n.removeEventListener("scroll",s,{capture:!0}),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}var wt=X+2,bt=wt+2,kt=1;function St(e,t){const n=e.left+e.width,o=e.top+e.height,r=t.map(t=>{const r=t.left+t.width,l=t.top+t.height;if(!(r>e.left-wt&&t.left<n+wt&&l>e.top-wt&&t.top<o+wt))return null;const i=Math.max(t.left<=e.left&&r>e.left?Math.min(t.left,e.left-kt):t.left,e.left-bt)-e.left,s=Math.max(t.top<=e.top&&l>e.top?Math.min(t.top,e.top-kt):t.top,e.top-bt)-e.top,a=Math.min(r>=n&&t.left<n?Math.max(r,n+kt):r,n+bt)-e.left,c=Math.min(l>=o&&t.top<o?Math.max(l,o+kt):l,o+bt)-e.top;return a>i&&c>s?{x:i,y:s,w:a-i,h:c-s}:null}).filter(e=>null!==e);if(!r.length)return;const l=function(e){if(e.length<2)return e;const t=Array.from(new Set(e.flatMap(e=>[e.x,e.x+e.w]))).sort((e,t)=>e-t),n=Array.from(new Set(e.flatMap(e=>[e.y,e.y+e.h]))).sort((e,t)=>e-t),o=[];for(let r=0;r<n.length-1;r++){const l=o=>e.some(e=>e.x<=t[o]&&t[o+1]<=e.x+e.w&&e.y<=n[r]&&n[r+1]<=e.y+e.h);for(let e=0;e<t.length-1;e++){if(!l(e))continue;let i=e+1;for(;i<t.length-1&&l(i);)i++;const s={x:t[e],y:n[r],w:t[i]-t[e],h:n[r+1]-n[r]},a=o.find(e=>e.x===s.x&&e.w===s.w&&e.y+e.h===s.y);a?a.h+=s.h:o.push(s),e=i-1}}return o}(r);return`path(evenodd, "${`M${-bt} ${-bt}h${e.width+2*bt}v${e.height+2*bt}h${-(e.width+2*bt)}z`}${l.map(e=>`M${e.x} ${e.y}h${e.w}v${e.h}h${-e.w}z`).join("")}")`}var xt=J([]);function Ct({children:e}){const t=te(null),n=ee(dt),o=vt(t,n?e=>Array.from(e.querySelectorAll(`[${ut}]`)):null,n?1:0);/* @__PURE__ */
8
+ return ue("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
9
+ /* @__PURE__ */ce("span",{ref:t,hidden:!0,"aria-hidden":"true"}),
10
+ /* @__PURE__ */ce(xt.Provider,{value:o,children:e})]})}function It({id:e,kind:t,overlay:n}){const o=te(null),r=ee(st),l=null!==e&&!0===r?.(e),i=vt(o,e?t=>Q(t,`[${Te}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),[s,...a]=i,c=ee(xt),u=`es-canvas-outline is-${t}${l?" is-shared":""}`,d=e=>({position:"absolute",top:e.top,left:e.left,width:e.width,height:e.height,clipPath:St(e,c)}),p=/* @__PURE__ */ue(de,{children:[
11
+ /* @__PURE__ */ce("div",{ref:o,"aria-hidden":"true",className:u,style:s?d(s):{display:"none"}}),a.map((e,t)=>/* @__PURE__ */ce("div",{"aria-hidden":"true",className:u,style:d(e)},t))]});return n&&e?/* @__PURE__ */ce(n,{componentId:e,kind:t,children:p}):p}function Et(e,n){return Array.from(e.querySelectorAll(`[${Te}]`)).find(o=>o.getAttribute(Te)===n&&t(o)?.wrapper===e)??null}function At(e,t,n){const o=g(e,n),r=o.text.length,l=e.ownerDocument;if(!t)return[r,r];let i=null;const s=l.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))i=o.at(s.offsetNode,s.offset);else{const n=l.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(i=o.at(n.startContainer,n.startOffset))}if(null===i)return[r,r];const a=o.text;let c=i,u=i;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;u<a.length&&!/\s/.test(a[u]);)u+=1;return[c,u]}function Dt(e,t){const n=t?.closest?.(`[${Te}]`)?.getAttribute(Te)??null;return!1===e.getPermissions(n?{item:e.getItemById(n)}:{root:!0}).edit}function Mt({s:e,element:t,toolbar:n,label:o,keys:r}){const l=w("copy",v),i=Re(e=>Dt(e,t())),s=e.pressed(),a=new Set(n.offered),c=n.colors&&n.colors.length>0?n.colors:null,m=te(null),[g,y]=oe(!1),[b,k]=oe(null),S=g||null!==b,x=()=>{e.hold(),y(!1),k({href:e.pressed().href})},C=()=>{y(!1),k(null),e.resume()};ae(()=>{r.current={escape:()=>!!S&&(C(),!0),link:()=>!!a.has("link")&&(x(),!0)}}),ae(()=>()=>{r.current=null},[r]);const I=te(C);I.current=C,_(()=>{if(g)return fe(e=>{const t=m.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(I.current(),!0)},()=>m.current?.querySelector(".es-copy-colors"))},[g]),_(()=>{const n=m.current;if(!S||!n)return;const o=/* @__PURE__ */new Set([n.ownerDocument]),r=t();r&&o.add(r.ownerDocument);const l=o=>{const r=o.target;if(r&&n.contains(r))return;y(!1),k(null);const l=t();r&&l&&l.contains(r)?e.release():e.stop("outside")};for(const e of o)e.addEventListener("pointerdown",l,!0);return()=>{for(const e of o)e.removeEventListener("pointerdown",l,!0)}},[S,e,t]),ae(()=>{const e=m.current,n=e?.querySelector(".rosh-tb-wrap > .es-copy-pop"),o=t();if(!(S&&e&&n&&o))return;const r=o.ownerDocument.defaultView?.getSelection()??null,l=r&&r.rangeCount>0&&o.contains(r.getRangeAt(0).startContainer)?r.getRangeAt(0):null,i=(l?u(l,o):null)??(()=>{const e=o.getBoundingClientRect();return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})(),s=o.ownerDocument.defaultView?.frameElement,a=s?U(s,{left:i.left,top:i.top,width:i.right-i.left,height:i.bottom-i.top}):{left:i.left,top:i.top,width:i.right-i.left,height:i.bottom-i.top},c=o.getBoundingClientRect(),f=s?U(s,{left:c.left,top:c.top,width:c.width,height:c.height}):{left:c.left,top:c.top,width:c.width,height:c.height},h=(e.closest("[data-floating-bar]")??e).getBoundingClientRect(),g={left:a.left,right:a.left+a.width,top:Math.min(a.top,f.top-6,h.top),bottom:Math.max(a.top+a.height,f.top+f.height+6,h.bottom)},y=e.ownerDocument.documentElement,v=(s??o.closest(".es-canvas")??o).getBoundingClientRect(),w={left:Math.max(0,v.left),top:Math.max(0,v.top),right:Math.min(y.clientWidth||v.right,v.right),bottom:Math.min(y.clientHeight||v.bottom,v.bottom)};if(w.right<=w.left||w.bottom<=w.top||0===n.offsetWidth)return;const b=d({anchor:g,size:{width:n.offsetWidth,height:n.offsetHeight},within:{left:v.left,top:v.top,right:v.right,bottom:v.bottom},clip:w,parent:p(n)});n.style.top=`${b.top}px`,n.style.left=`${b.left}px`,n.style.setProperty("--es-pop-point",`${b.point}px`),n.dataset.side=b.above?"above":"below"});const E=c?{run:f(s.color,c),open:g,onToggle:()=>{k(null),g?C():(e.hold(),y(!0))}}:void 0;/* @__PURE__ */
12
+ return ce(he,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?U(o,{left:n.left,top:n.top,width:n.width,height:n.height}):{left:n.left,top:n.top,width:n.width,height:n.height};return{left:r.left-6,top:r.top-6,right:r.left+r.width+6,bottom:r.top+r.height+6}},bounds:()=>{const e=t(),n=e?.ownerDocument.defaultView?.frameElement,o=(n??e?.closest(".es-canvas")??e)?.getBoundingClientRect();return o?{left:o.left,top:o.top,right:o.right,bottom:o.bottom}:{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},"aria-label":o,children:/* @__PURE__ */ce("div",{ref:m,children:/* @__PURE__ */ce(me,{layout:"row",offered:a,pressed:s.marks,onMark:t=>{"link"===t?x():e.press(t)},color:E,linkOpen:null!==b,list:{pressed:s.list,onList:t=>e.list(t)},clear:s.clearable?{onClear:()=>e.clear()}:void 0,alignment:n.alignment,letterCase:n.letterCase,last:n.lastTool?.({className:"rosh-tb-btn",disabled:i,selected:s.selected,keepCaret:t=>{t.preventDefault(),e.hold()},insert:t=>e.insert(t),style:s.style,applyStyle:t=>e.textStyle(t)}),windows:/* @__PURE__ */ue(de,{children:[g&&c?/* @__PURE__ */ce(h,{colors:c,current:s.color,words:l.colors??v.colors,onPick:t=>e.color(t)}):null,b?
13
+ /* @__PURE__ */ce(ge,{className:"es-copy-link es-copy-pop",value:b.href??"",onApply:t=>{k(null),e.link(t)},onRemove:null!==b.href?()=>{k(null),e.link(null)}:void 0,onCancel:C}):null]})})})})}function Ot({element:e,which:t}){const n=te(null),o=gt(n,()=>e(),t),r=ee(xt);/* @__PURE__ */
14
+ return ce("div",{ref:n,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:o?{position:"absolute",top:o.top,left:o.left,width:o.width,height:o.height,clipPath:St(o,r),...ht}:{display:"none"}})}function $t({frame:o=!0,className:r,style:l,metadata:i,mirrorStyles:u,onDocument:d,height:p,title:f,nonce:h,hotkeys:v,frameWrapper:k,overlay:S,children:x,typing:C,passThrough:I}){const E=ze(),A=ee(it),D=I??A,M=ee(Pe),O=w("canvas",n),$=v??M,[j,z]=oe(void 0),R=Re(e=>"node"===e.selection?.kind?e.selection.id:null),[N,L]=oe(null),[V,B]=oe(null),K=ee(ct),F=ee(dt),[H,q]=oe(null),[,Y]=re(e=>e+1,0),[,X]=re(e=>e+1,0),U=e=>{K?.select(e),X()},[G,Q]=oe(null),J=te(null),ne=Re(e=>!!G&&Dt(e,G()));_(()=>{ne&&J.current?.s.stop("stop")},[ne]);const le=te(null),[,ie]=oe(0),se=te(C);se.current=C;const ae=te(null),de=te(null),pe=()=>{if(!R)return null;const e=se.current?.atSelection?.()?.element()??null;if(!e)return null;const t=de.current?.ownerDocument;if(K){const n=K.selected()&&t?K.selectedPart?.(t)??null:null;return n&&W(n.element,e)?n.element:null}const n=b(E.getState().appState.data,E.config,R);return n&&0===P(n.node,E.config).length?e:null},fe=Re(e=>e.appState.data),he=K?.selected()??null;_(()=>{const e=de.current?.ownerDocument,t=e?.defaultView?.CustomEvent;if(!e||!t)return;const n=R&&!G&&se.current?.atSelection?.()?R:null,o=n?pe():null;e.dispatchEvent(new t(T,{detail:o?{id:n,words:o}:{id:n}}))},[R,G,fe,he]);const me=e=>{const t=de.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(Z,{detail:{typing:e}}))},ge=(e,t)=>{J.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=e.element,r=()=>Dt(E.getState(),o());if(r())return!1;const l=ye(e,n),i=l?.write??e.write,s=E.group(),a=m({element:o,value:l?.value??e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:At(n,t,e.skip),editable:()=>!r(),write:e=>{r()?queueMicrotask(()=>J.current?.s.stop("stop")):i(e)},remount:e.remount,onSelect:()=>ie(e=>e+1),onEscape:()=>ae.current?.escape()??!1,onLinkKey:()=>ae.current?.link()??!1,end:e=>{s.close(),J.current?.element===o&&(J.current=null),Q(null),me(!1),se.current?.onChange?.({typing:!1,why:e})}});if(!a)return s.close(),!1;const c=n.closest?.(`[${Te}]`)?.getAttribute(Te);return c&&E.select(c),J.current={s:a,element:o,target:e},Q(()=>o),L(null),me(!0),se.current?.onChange?.({typing:!0,element:n}),!0},ye=(e,n)=>{const o=e.key;if(!o||!se.current?.onCopyText)return null;const r=t(n),l=n.closest?.(`[${Te}]`),i=l?.getAttribute(Te);if(!r||!i||!r.wrapper.contains(l))return null;const{copy:s}=r,a=se.current.copyValue?.({...s,nodeId:i,key:o}),c=g(n,e.skip).text,u=a??(y(e.value,e.rules).text===c?e.value:c),d={ownerId:s.ownerId,slot:s.slot,index:s.index,...s.outer?{outer:s.outer}:{},nodeId:i,key:o};return{value:u,write:t=>{const n=se.current?.onCopyText;n&&!1!==n({...d,text:t})||e.write(t)}}};_(()=>()=>J.current?.s.stop("stop"),[]);const ve=e=>{const t=J.current?.element();return Boolean(t&&t.contains(e))},we=(e,t)=>at(E.getState().appState.data,E.config,e,t),be=e=>{const t=e.closest?.(`[${Te}]`)?.getAttribute(Te);if(!t)return;const n=E.getState(),o="node"===n.selection?.kind?n.selection.id:null,r=K?.partAt(e,t)??null;if(r){const e=a(n.appState.data,E.config,t,r.id,o,K?.selected()??null,D);if(e)return{node:e.node,part:e.part?r:null}}return{node:c(n.appState.data,E.config,t,o,D)??t,part:null}},ke=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(J.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=Se(),o=void 0===n?se.current?.atSelection?.():n;o&&ge(o,null)&&e.preventDefault()},Se=()=>{const t=se.current,n=le.current;if(!t?.onCopyText||!n?.copy||n.node!==R)return;const o=de.current,r=o?e(o,n.copy):null,l=r?Et(r,n.node):null;if(!l)return null;const i=t.atSelection?.()??null,s=i?.element()??null;if(!i||!s)return null;if(l.contains(s))return i;const a=function(e,t){const n=e.closest(`[${Te}]`);if(!n||n.getAttribute(Te)!==t.getAttribute(Te))return null;const o=[];for(let t=e;t!==n;t=t.parentElement)o.unshift(Array.prototype.indexOf.call(t.parentElement.children,t));let r=t;for(const e of o)r=r?.children[e];return r&&r.tagName===e.tagName?r:null}(s,l);return a?t.at(a):null},xe=(e,n)=>{if(!se.current?.onCopyText)return null;const o=t(e);return o&&Et(o.wrapper,n)?o.copy:null},Ce=de.current?.ownerDocument??null,Ie=K?.selected()&&Ce&&R?K.selectedPart?.(Ce)??null:null,Ee=Ie&&R&&we(R,Ie)?Ie.element:null,Ae=F?.selected()??null,De=Ae&&Ce?Array.from(Ce.querySelectorAll(`[${ut}]`)).find(e=>e.getAttribute(ut)===Ae)??null:null,Me=G?null:pe(),$e=/* @__PURE__ */ue("div",{ref:de,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),J.current){if(ve(t))return;J.current.s.stop("outside")}const n=t.ownerDocument?.getSelection?.();n&&n.rangeCount>0&&n.isCollapsed&&n.removeAllRanges();const o=F?pt(t):null;if(F&&o)return F.select(o.id),q(null),void Y();const r=be(t);if(le.current=void 0!==r?{node:r.node,copy:xe(t,r.node)}:null,void 0!==r)return E.select(r.node),void(K&&(r.part?.id??null)!==K.selected()&&U(r.part?.id??null));t.hasAttribute?.(Ke)||(E.select(null),K?.selected()&&U(null))},onDoubleClick:e=>{const t=se.current;if(!t||ve(e.target))return;const n=t.at(e.target);n&&ge(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>ke(e),onMouseOver:e=>{if(J.current)return;const t=F?pt(e.target):null;if(t?.element!==H?.element&&q(t),t)return null!==N&&L(null),void(null!==V&&B(null));const n=be(e.target),o=!!n?.part&&we(n.node,n.part),r=n?.part&&o&&n.part.id!==K?.selected()?n.part:null,l=!n||n.part&&o?null:n.node;l!==N&&L(l),r?.id===V?.id&&r?.element===V?.element||B(r)},onMouseLeave:()=>{L(null),B(null),q(null)},children:[
15
+ /* @__PURE__ */ce(Ye.Provider,{value:N,children:/* @__PURE__ */ce(lt,{metadata:i})}),
16
+ /* @__PURE__ */ue(Ct,{children:[
17
+ /* @__PURE__ */ce(It,{id:!G&&N&&N!==R?N:null,kind:"hover",overlay:S}),K?/* @__PURE__ */ce(ft,{clip:!0,element:G||!V||V.id===K.selected()?null:V.element}):null,Me||Ee?/* @__PURE__ */ce(mt,{clip:!0,element:G?null:Me??Ee,words:null!==Me}):null,F?/* @__PURE__ */ce(ft,{element:G||!H||H.element===De?null:H.element}):null,De?/* @__PURE__ */ce(mt,{element:G?null:De}):null,
18
+ /* @__PURE__ */ce(It,{id:G||Ee||Me||De?null:R,kind:"selected",overlay:S}),G?/* @__PURE__ */ce(Ot,{element:()=>{const e=G?.()??null;return e?Ie&&W(Ie.element,e)?Ie.element:e:null},which:Ie?.element??G}):null]}),x]}),je=k?/* @__PURE__ */ce(k,{document:j,children:$e}):$e;_(()=>{if(j&&$)return Oe(j,E)},[j,$,E]),_(()=>{if(!j)return;const e=e=>{if("Enter"===e.key)return void ke(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=E.getState();if("node"!==n.selection?.kind)return;if(K?.selected())return void U(null);const o=s(n.appState.data,E.config,n.selection);"node"===o?.kind&&E.select(o.id)};return j.addEventListener("keydown",e),()=>j.removeEventListener("keydown",e)},[j,E,K]);/* @__PURE__ */
19
+ return ue("div",{className:"es-canvas"+(r?` ${r}`:""),style:l,"data-easel-preview":"","data-es-typing":G?"":void 0,children:[G&&J.current?.target.toolbar?/* @__PURE__ */ce(Mt,{s:J.current.s,element:J.current.element,toolbar:J.current.target.toolbar,label:O.textTools,keys:ae}):null,o?/* @__PURE__ */ce(qe,{mirrorStyles:u,onDocument:e=>{z(e??void 0),d?.(e)},height:p,title:f,nonce:h,children:je}):/* @__PURE__ */ce("div",{id:"preview-frame","data-easel-entry":"",children:je})]})}function Pt(e={}){const t=ze(),n=Re(e=>e.appState.data);return i({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}var jt=/* @__PURE__ */new WeakMap,zt=[];function Rt(e){let t=jt.get(e);return t||(t={nodes:/* @__PURE__ */new Map,shown:/* @__PURE__ */new Map,listeners:/* @__PURE__ */new Set,lateListeners:/* @__PURE__ */new Set,settled:[]},jt.set(e,t)),t}function Nt(e,t){const n=e.nodes.get(t),o=n?[...n.running,...n.next]:zt;o.length?e.shown.set(t,o):e.shown.delete(t),e.listeners.forEach(e=>e())}function Lt(e,t,n,o){const r=Rt(e),l=r.nodes.get(t);l?l.next=[...l.next,n]:r.nodes.set(t,{running:zt,next:[n]}),Nt(r,t),l||Promise.resolve().then(()=>Vt(r,t,o))}function Vt(e,t,n){const o=e.nodes.get(t);if(!o)return;if(!o.next.length)return e.nodes.delete(t),Nt(e,t),void(e.nodes.size||e.settled.splice(0).forEach(e=>e()));const r=o.next;o.running=r,o.next=zt;let l=!0;const i=()=>{l=!1,clearTimeout(a),o.running=zt,Nt(e,t)};let s=!1;const a=setTimeout(()=>{s=!0,i();try{n.landWithoutAnswer(r)&&(e.lateListeners.forEach(e=>e()),Promise.reject(new Error(`A write to ${t} landed without its resolver's answer after 60000 ms.`)))}catch(e){Promise.reject(e)}Vt(e,t,n)},6e4);n.run(r,{live:()=>l,landing:i}).catch(e=>{if(!s)throw e}).finally(()=>{s||(l&&i(),Vt(e,t,n))})}function Bt(e){const t=Rt(e);return t.nodes.size?new Promise(e=>t.settled.push(e)):Promise.resolve()}function Tt(){const e=ze(),t=te([]),n=te(!1),[o,r]=oe(!1),[,l]=re(e=>e+1,0);_(()=>{t.current.splice(0).forEach(e=>e())});return{run:le(o=>{n.current||(n.current=!0,r(!0),Bt(e).then(()=>new Promise(e=>{t.current.push(e),l()})).then(()=>{n.current=!1,r(!1),o()}))},[e]),waiting:o}}function Kt(e){const t=Tt(),n=te(e);return n.current=e,{...e,busy:!0===e.busy||t.waiting,onPress:()=>t.run(()=>n.current.onPress())}}function Zt(e,t){const{lateListeners:n}=Rt(e);return n.add(t),()=>{n.delete(t)}}var Ft=e=>"object"==typeof e&&null!==e&&Object.getPrototypeOf(e)===Object.prototype;function Wt(e,t,n){if(t===e)return n;if(Array.isArray(e)&&Array.isArray(t)&&Array.isArray(n)){if(e.length!==n.length||e.some((e,t)=>n.includes(e)&&n[t]!==e))return t;const o=e.length===t.length&&1===t.filter((t,n)=>t!==e[n]).length;return t.map((t,r)=>{if(t===e[r])return n[r];const l=Ft(t)?e.indexOf(t):-1;return l>=0?n[l]:o?Wt(e[r],t,n[r]):t})}if(Ft(e)&&Ft(t)&&Ft(n)){const o={...n};for(const n of Object.keys(e))n in t||delete o[n];for(const r of Object.keys(t))o[r]=Wt(e[r],t[r],n[r]);return o}return t}function Ht(e,t){let n=null;for(const o of e){const e="function"==typeof o?o({...t,...n}):o;e&&(n={...n,...e})}return n}function qt(e,t){if(!e.length)return t;try{return{...t,...Ht(e,t)}}catch{return t}}function Yt(){return Jt(Re(e=>e.selectedItem))}function Xt(){const e=ee(Ut);try{return function(e){const t=Re(e=>e.selectedItem);return Jt("root"===e?null:t)}(e)}catch{return null}}var Ut=J("selected");function Gt({children:e}){return ie(Ut.Provider,{value:"root"},e)}function Qt(){return Jt(null)}function Jt(e){const t=ze(),n=Re(e=>e.config),r=t.resolveCache,l=Re(e=>e.appState.data.root),i=e?e.props.id:"root",s=l.props??{},a=se(()=>e||{type:"root",props:s},[e,s]),c=e?n.components[e.type]:n.root,u=t.getState(),d=e?b(u.appState.data,n,i):null,p=d&&"root"!==d.place.parentId?d.place.parentId:null,f=p?u.getItemById(p)??null:null,{fields:h}=o({id:i,node:a,block:c,parent:f,appState:u.appState}),m=Re(t=>!1===t.getPermissions(e?{item:e}:{root:!0}).edit),g=le(e=>{Lt(t,i,e,{landWithoutAnswer:e=>{const n=t.getState();if("root"===i){const o=n.appState.data.root.props??{},r=Ht(e,o);return!!r&&(t.dispatch({type:"replaceRoot",root:{props:{...o,...r},readOnly:n.appState.data.root.readOnly},recordHistory:!0}),!0)}const o=n.getItemById(i),r=n.getSelectorForId(i);if(!o||!r)return!1;const l=Ht(e,o.props);return!!l&&(t.dispatch({type:"replace",destinationZone:r.zone??"root:default-zone",destinationIndex:r.index,data:{...o,props:{...o.props,...l}}}),!0)},run:async(e,{live:n,landing:o})=>{for(let l=1;;l+=1){const s=t.getState(),a={...r,lastChange:Object.create(r.lastChange)},c=()=>{o(),Object.assign(r.lastChange,a.lastChange)};if("root"!==i){const o=s.getItemById(i);if(!o)return;const r=Ht(e,o.props);if(!r)return;const u={...o,props:{...o.props,...r}},{node:d}=await R(u,t.config,{cache:a,trigger:"replace"});if(!n())return;const p=t.getState(),f=p.getSelectorForId(i);if(!f)return;if(p.getItemById(i)!==o&&l<5)continue;return c(),void t.dispatch({type:"replace",destinationZone:f.zone??"root:default-zone",destinationIndex:f.index,data:d})}const u=s.appState.data.root.props??{},d=Ht(e,u);if(!d)return;const{node:p}=await R({type:"root",props:{...u,...d}},t.config,{cache:a,trigger:"replace"});if(!n())return;if(!(t.getState().appState.data.root.props!==s.appState.data.root.props&&l<5))return c(),void t.dispatch({type:"replaceRoot",root:{props:p.props,readOnly:p.readOnly},recordHistory:!0})}}})},[t,r,i]),y=le(e=>{const{listeners:n}=Rt(t);return n.add(e),()=>{n.delete(e)}},[t]),v=le(()=>Rt(t).shown.get(i)??zt,[t,i]),w=ne(y,v,v),k=se(()=>qt(w,a.props),[w,a.props]),S=te({id:i,values:k});S.current={id:i,values:k};const x=le((e,n)=>{const o=t.getState(),r=("root"===i?o.appState.data.root.props:o.getItemById(i)?.props)??{},l=qt(Rt(t).shown.get(i)??zt,r),s=S.current,a=(s.id===i?s.values:l)[e];j(n,a)&&!j(l[e],a)?g({[e]:n}):g(t=>({[e]:Wt(a,n,t[e])}))},[t,i,g]);return{id:i,node:a,fields:h,values:k,readOnly:m,onChange:x,onChangeMany:g}}export{ut as CHROME_ATTR,dt as CanvasChromeContext,qe as CanvasFrame,ct as CanvasPartsContext,it as CanvasPassThroughContext,st as CanvasSharedContext,Ee as DEFAULT_UI,$t as EaselCanvas,je as EaselProvider,lt as EditDocument,Gt as RootHostScope,Oe as bindUndoKeys,Me as createEasel,Ne as createUseEasel,at as partHasOwnBox,ye as recordsByDefault,xe as reduce,Zt as subscribeLateWrites,be as uiView,Re as useEasel,ze as useEaselApi,Pt as useEaselNodeOps,Qt as useRootFields,Yt as useSelectedFields,Xt as useSelectedHost,Kt as useSettledAction,Tt as useSettledPress,ke as validSelection,Bt as writesSettled};
@@ -0,0 +1 @@
1
+ import{styleFieldBuilders as e,keptByRow as s}from"./chunk-XESNAMI3.js";import{boxFieldBuilders as o,PHONE_KEY_ACCESS as l,phoneTwinFields as r,section as i}from"./chunk-WL57KM5C.js";import{deviceField as t}from"./chunk-ZNLODQD4.js";import{BUTTON_STYLE_KEYS as c,BUTTON_PAD_KEYS as n}from"./chunk-PLTTPHK5.js";import{TextColorIcon as u,GroundIcon as d}from"efficient-shell/icons/efficient";import{jsx as f}from"react/jsx-runtime";function a(a){const p=o(a.say),y=e(a.say),m=c,F=a.style,k=a.phone??l;return{...a.padding&&{_dSize:i("Size"),...p.sidesPaddingFields({keys:n,group:!1,...a.padding})},_dDesign:i("Design"),[m.fill]:y.colourField({key:m.fill,access:F,label:"Fill color",icon:/* @__PURE__ */f(d,{}),useFollows:a.follows.useFill,usePresets:a.usePresets,resetTo:a.resetTo,opacity:{key:m.fillOpacity,useUnset:a.follows.useFillOpacity}}),[m.fillOpacity]:s(m.fill),[m.border]:y.borderField({key:m.border,access:F,useFollows:a.follows.useBorder}),[m.text]:y.colourField({key:m.text,access:F,label:"Text color",icon:/* @__PURE__ */f(u,{}),useFollows:a.follows.useText,usePresets:a.usePresets,resetTo:a.resetTo}),[m.corners]:y.cornersField({key:m.corners,access:F,sidesKey:m.cornerSides,useFollows:a.follows.useCorners,useFollowsSides:a.follows.useCornerSides}),[m.cornerSides]:s(m.corners),_dLayout:i("Layout"),...r("align",p.blockAlignmentField({phone:!0},""),k),align:t("desktop",p.blockAlignmentField())}}export{a as buttonFieldSet};
@@ -1 +1 @@
1
- import{changedProps as e}from"./chunk-EUFDQ4KL.js";import{useState as t,useRef as r,useEffect as n}from"react";function i({id:i,node:l,block:d,parent:o=null,appState:a=null}){const u=d?.fields??{},[s,c]=t(()=>({id:i,fields:u,loading:!1})),p=r(null),f=r(null),g=r({parent:o,appState:a,id:i});return g.current={parent:o,appState:a,id:i},n(()=>{if(!l||!d)return;const t=f.current!==i;f.current=i;let r=s.fields;t&&(r=u,p.current=null,c({id:i,fields:u,loading:!1}));const n=d.resolveFields;if(!n)return void(t||c(e=>({...e,fields:u})));let o=!1;const a=p.current&&(p.current.props?.id??"root")===(l.props?.id??"root")?p.current:null,m=setTimeout(()=>{o||c(e=>e.id===i?{...e,loading:!0}:e)},50);return Promise.resolve(n(l,{changed:e(l,a),fields:u,lastFields:r,lastData:a,appState:g.current.appState,parent:g.current.parent})).then(e=>{clearTimeout(m),o||g.current.id!==i||(p.current=l,c({id:i,fields:e,loading:!1}))}),()=>{o=!0,clearTimeout(m)}},[i,l,d]),s.id===i?{fields:s.fields,loading:s.loading}:{fields:u,loading:!1}}export{i as useResolvedFields};
1
+ import{changedProps as e}from"./chunk-YDTEYXQW.js";import{useState as t,useRef as r,useEffect as n}from"react";function i({id:i,node:l,block:d,parent:o=null,appState:a=null}){const u=d?.fields??{},[s,c]=t(()=>({id:i,fields:u,loading:!1})),p=r(null),f=r(null),g=r({parent:o,appState:a,id:i});return g.current={parent:o,appState:a,id:i},n(()=>{if(!l||!d)return;const t=f.current!==i;f.current=i;let r=s.fields;t&&(r=u,p.current=null,c({id:i,fields:u,loading:!1}));const n=d.resolveFields;if(!n)return void(t||c(e=>({...e,fields:u})));let o=!1;const a=p.current&&(p.current.props?.id??"root")===(l.props?.id??"root")?p.current:null,m=setTimeout(()=>{o||c(e=>e.id===i?{...e,loading:!0}:e)},50);return Promise.resolve(n(l,{changed:e(l,a),fields:u,lastFields:r,lastData:a,appState:g.current.appState,parent:g.current.parent})).then(e=>{clearTimeout(m),o||g.current.id!==i||(p.current=l,c({id:i,fields:e,loading:!1}))}),()=>{o=!0,clearTimeout(m)}},[i,l,d]),s.id===i?{fields:s.fields,loading:s.loading}:{fields:u,loading:!1}}export{i as useResolvedFields};
@@ -1,4 +1,4 @@
1
- import{PanelToggleIcon as e}from"./chunk-UMDQ6CLQ.js";import{InspectorHead as n}from"./chunk-VBEVZZTV.js";import{DEFAULT_CHROME_WORDS as i}from"./chunk-AJSDWWJW.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{Tooltip as s,IconButton as t,Button as c}from"efficient-shell/ui";import{jsx as r,jsxs as l,Fragment as d}from"react/jsx-runtime";function a({icon:e,title:i,context:o,actions:s,side:t="left",onHide:c}){/* @__PURE__ */
1
+ import{PanelToggleIcon as e}from"./chunk-UMDQ6CLQ.js";import{InspectorHead as n}from"./chunk-VTY7OQB5.js";import{DEFAULT_CHROME_WORDS as i}from"./chunk-AJSDWWJW.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{Tooltip as s,IconButton as t,Button as c}from"efficient-shell/ui";import{jsx as r,jsxs as l,Fragment as d}from"react/jsx-runtime";function a({icon:e,title:i,context:o,actions:s,side:t="left",onHide:c}){/* @__PURE__ */
2
2
  return r(n,{icon:e,name:i,kind:o,actions:s||c?/* @__PURE__ */l(d,{children:[s,c?/* @__PURE__ */r(m,{side:t,onHide:c,divider:Boolean(s)}):null]}):void 0})}function m({side:n,onHide:c,divider:a=!1}){const m=o("chrome",i);/* @__PURE__ */
3
3
  return l(d,{children:[a?/* @__PURE__ */r("span",{className:"sf-head-divider","aria-hidden":"true"}):null,
4
4
  /* @__PURE__ */r(s,{content:m.hidePanel,side:"bottom",children:/* @__PURE__ */r(t,{className:"es-insp-iconbtn","aria-label":m.hidePanelLabel({side:n}),onClick:c,children:/* @__PURE__ */r(e,{side:n})})})]})}function h({side:n,onShow:c}){const l=o("chrome",i);/* @__PURE__ */