efficient-easel 5.0.0 → 5.0.1

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 (45) hide show
  1. package/dist/chrome/chrome.css +3 -3
  2. package/dist/chunk-3FZAGTQE.js +5 -0
  3. package/dist/{chunk-ETDRAF3O.js → chunk-5QSFLWAJ.js} +46 -46
  4. package/dist/{chunk-CRWFB7MU.js → chunk-7EWFXVDJ.js} +4 -4
  5. package/dist/chunk-7YMO6R3V.js +1 -0
  6. package/dist/{chunk-MTRFMGBO.js → chunk-F7BYSWRR.js} +1 -1
  7. package/dist/{chunk-XW4AV5N4.js → chunk-FUOZKV7A.js} +3 -3
  8. package/dist/{chunk-KJ2RODGT.js → chunk-G4OCSMYY.js} +1 -1
  9. package/dist/{chunk-C7ERK4DF.js → chunk-H6NYEMLS.js} +1 -1
  10. package/dist/{chunk-G5JILVHG.js → chunk-ITAQX3HT.js} +1 -1
  11. package/dist/{chunk-37DMJPHL.js → chunk-KEHLCWTG.js} +8 -8
  12. package/dist/chunk-PCMGFPFU.js +5 -0
  13. package/dist/{chunk-UQ6CD3K2.js → chunk-R5GKLOIP.js} +1 -1
  14. package/dist/chunk-SF4DL63U.js +1 -0
  15. package/dist/{chunk-VZGLBEAE.js → chunk-X2GNFJRC.js} +1 -1
  16. package/dist/{chunk-I7ER3P4U.js → chunk-XHHS6SDM.js} +1 -1
  17. package/dist/copy/copy.css +7 -7
  18. package/dist/copy/index.js +5 -5
  19. package/dist/drag/index.js +1 -1
  20. package/dist/easel/index.js +1 -1
  21. package/dist/fields/index.js +1 -1
  22. package/dist/panel/panel.css +4 -1
  23. package/dist/screen/components/AddBlockRow.js +1 -1
  24. package/dist/screen/components/AddSidePanel.js +1 -1
  25. package/dist/screen/components/MediaSidePanel.js +1 -1
  26. package/dist/screen/components/NodeContextMenu.js +1 -1
  27. package/dist/screen/components/ScreenChrome.js +1 -1
  28. package/dist/screen/components/ScreenMount.js +1 -1
  29. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  30. package/dist/screen/components/SectionScreenShell.js +14 -14
  31. package/dist/screen/components/usePartBridge.js +1 -1
  32. package/dist/screen/index.js +1 -1
  33. package/dist/screen/lib/key-scope.js +1 -1
  34. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  35. package/dist/screen/lib/screen-parts.js +1 -1
  36. package/dist/screen/screen.css +4 -4
  37. package/dist/strings/catalogue.js +1 -1
  38. package/dist/strings/index.js +1 -1
  39. package/dist/text-styles/index.js +11 -11
  40. package/dist/text-styles/text-styles.css +2 -2
  41. package/package.json +1 -1
  42. package/dist/chunk-3GX7XBAF.js +0 -5
  43. package/dist/chunk-KSTX646X.js +0 -5
  44. package/dist/chunk-RQWJOPRB.js +0 -1
  45. package/dist/chunk-Y324X4U4.js +0 -1
@@ -1,9 +1,9 @@
1
- import{DEFAULT_CANVAS_WORDS as e}from"./chunk-AELNNAFM.js";import{useResolvedFields as t}from"./chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as a,clickPick as i}from"./chunk-UK2FQOUT.js";import{useWords as s}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as d,isTypingTarget as l}from"./chunk-ZNCEOSXO.js";import{find as c,ROOT_ID as u,getList as p,remove as f,parseZoneKey as h,move as m,duplicate as v,replaceNode as g,createNode as y,insert as k,normalizeData as w,createResolveCache as S,resolveNodeData as b,ROOT_SLOT as I}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as C,fieldsFrom as E,defaultsFrom as O}from"./chunk-NKB3KVAB.js";import{createContext as x,useEffect as A,useContext as D,useRef as z,useSyncExternalStore as M,useState as Z,useMemo as N,useCallback as j,useLayoutEffect as P}from"react";import{jsx as $,jsxs as L}from"react/jsx-runtime";import{createPortal as R}from"react-dom";function B(e){return!["setData","setUi","set"].includes(e.type)}var K=(e,t,n,o)=>{const r=p(e,t,h(n));return r?.[o]??null},F=(e,t,n,o,r)=>{const a=K(e,t,n,o);if(!a)throw new Error(`${r}: nothing at ${n}[${o}]`);return a};function V(e,t){const{selection:o}=e;return{...e.ui,itemSelector:n(e.data,t,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function H(e,t,n){return n?"node"===n.kind?c(e,t,n.id)?n:null:n.parentId===u?p(e,t,n)?n:null:c(e,t,n.parentId)&&p(e,t,n)?n:null:null}function T(e,t,n,r=!1){const{itemSelector:a,selectedSlot:i,...s}=n;let d=e.selection;var l;return"itemSelector"in n&&(d=o(e.data,t,a??null)),"selectedSlot"in n&&(i?d=(l=i)?{kind:"slot",parentId:l.parentId,slot:l.slot}:null:"slot"===d?.kind&&(d=null)),{...e,selection:d,ui:r?s:{...e.ui,...s}}}function U(e,t,n){const o=q(e,t,n);if(o===e)return e;const r=H(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function q(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return T(e,n,"function"==typeof t.ui?t.ui(V(e,n)):t.ui);case"set":{const r={data:o,ui:V(e,n)},a="function"==typeof t.state?t.state(r):t.state;let i=a.data?{...e,data:a.data}:e;return a.ui&&(i=T(i,n,a.ui,!0)),i}case"insert":{const r={...h(t.destinationZone),index:t.destinationIndex},a=y(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:k(o,n,r,a)}}case"replace":{const r=F(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:g(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=F(o,n,t.sourceZone,t.sourceIndex,"duplicate"),a=v(o,n,r.props.id),i=K(a,n,t.sourceZone,t.sourceIndex+1);return{...e,data:a,selection:i?{kind:"node",id:i.props.id}:e.selection}}case"reorder":return q(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=K(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const a={...h(t.destinationZone),index:t.destinationIndex};return{...e,data:m(o,n,r.props.id,a)}}case"remove":{const r=F(o,n,t.zone,t.index,"remove");return{...e,data:f(o,n,r.props.id)}}default:return e}}var Y={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},W={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},X=0,Q=()=>`history-${X+=1}`;function G(e){let t=e.config;const r=e.now??(()=>Date.now()),a=e.historyCoalesceMs??250;let i=e.permissions??{};const s=w(e.data,t);let d={data:s,selection:null,ui:{...W}};if(e.ui){const{itemSelector:n,selectedSlot:r,...a}=e.ui;d={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...W,...a}}}let l=[{core:d,at:-1/0,sealed:!0,id:Q()}],u=0;const f=e=>{const t=l[u],n=r();!e&&u===l.length-1&&u>0&&!t.sealed&&n-t.at<a?l=[...l.slice(0,u),{...t,core:d,at:n}]:(l=[...l.slice(0,u+1),{core:d,at:n,sealed:e,id:Q()}],u=l.length-1)},h=/* @__PURE__ */new Set;let m=null,v=null,y=0,k=null,I=!1;const C=()=>{for(const e of[...h])e()},E=()=>{l=[...l.slice(0,u),{...l[u],core:d},...l.slice(u+1)]},O=(t,n)=>{y>0?I=I||n:(n?f(!1):d!==t&&E(),d.data!==t.data&&e.onChange?.(d.data),d!==t&&C())},x=e=>{const n=d;if(d=U(d,e,t),d===n)return;const o=e.recordHistory??B(e);O(n,o&&d.data!==n.data)},A=t=>{0===y&&(k=d,I=!1),y+=1;try{t()}catch(e){throw y-=1,0===y&&k&&(d=k,k=null),e}if(y-=1,y>0||!k)return;const n=k;k=null,I&&d.data!==n.data?f(!0):d!==n&&E(),d.data!==n.data&&e.onChange?.(d.data),d!==n&&C()},D=e=>{const n=d,o=H(d.data,t,e);var r,a;(r=o,a=d.selection,r===a||r&&a&&r.kind===a.kind&&("node"===r.kind&&"node"===a.kind?r.id===a.id:"slot"===r.kind&&"slot"===a.kind&&r.parentId===a.parentId&&r.slot===a.slot))||(d={...d,selection:o},O(n,!1))},z=t=>{const n=d;u=t,d=l[u].core,d.data!==n.data&&e.onChange?.(d.data),d!==n&&C()},M=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...Y,...i,...n}};let Z=M();const N=S(),j={resolveCache:N,async resolveAll({trigger:e="load",metadata:n}={}){const o=d.data,r={type:"root",props:{...o.root.props??{}}},a=[...o.content,...Object.values(o.zones??{}).flat()],[i,...s]=await Promise.all([b(r,t,{cache:N,trigger:e,metadata:n}),...a.map(o=>b(o,t,{cache:N,trigger:e,metadata:n}))]);A(()=>{const e=d;let n=d.data;s.forEach((e,r)=>{if(!e.didChange)return;const i=a[r].props.id,s=c(n,t,i)?.node;s&&s===c(o,t,i)?.node&&(n=g(n,t,i,e.node))}),i.didChange&&n.root===o.root&&(n={...n,root:{...n.root,props:i.node.props,readOnly:i.node.readOnly??n.root.readOnly}}),n!==d.data&&(d={...d,data:n,selection:H(n,t,d.selection)},O(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=c(d.data,t,e)?.node;if(!r)return!1;const a=await b(r,t,{cache:N,trigger:n,metadata:o});if(!a.didChange)return!1;let i=!1;return A(()=>{const n=d;if(c(d.data,t,e)?.node!==r)return;const o=g(d.data,t,e,a.node);o!==d.data&&(d={...d,data:o,selection:H(o,t,d.selection)},O(n,!1),i=!0)}),i},get config(){return t},getState(){if(m&&v===d)return m;const e=d,o={data:e.data,ui:V(e,t)},r="node"===e.selection?.kind?c(e.data,t,e.selection.id)?.node??null:null;return m={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:x,history:{back:()=>j.undo(),forward:()=>j.redo(),hasPast:u>0,hasFuture:u<l.length-1,histories:l.map(e=>({id:e.id,state:{data:e.core.data,ui:V(e.core,t)}})),index:u,setHistoryIndex:e=>{e>=0&&e<l.length&&e!==u&&z(e)}},getPermissions:Z,getItemById:n=>c(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return p(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},v=e,m},subscribe:e=>(h.add(e),()=>{h.delete(e)}),dispatch:x,batch:A,select:e=>D(e?{kind:"node",id:e}:null),selectSlot:e=>D(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){A(()=>{const n=d,o=void 0===e.select?d.selection:e.select;d={...d,data:e.data,selection:H(e.data,t,o)},O(n,e.data!==n.data)})},load(e,n={}){const o=d,r=w(e,t);d={...d,data:r,selection:H(r,t,n.selection??d.selection)},n.keepHistory||(l=[{core:d,at:-1/0,sealed:!0,id:Q()}],u=0),d!==o&&C()},undo(){u>0&&z(u-1)},redo(){u<l.length-1&&z(u+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,i)||(i=e,Z=M(),m=null,C())},setConfig(e){e!==t&&(t=e,Z=M(),m=null,C())}};return j}function J(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&l(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var _=x(null),ee=x(!0);function te({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return A(()=>{n&&e.resolveAll()},[e,n]),A(()=>{if(t&&"undefined"!=typeof document)return J(document,e)},[e,t]),/* @__PURE__ */$(_.Provider,{value:e,children:/* @__PURE__ */$(ee.Provider,{value:t,children:o})})}function ne(){const e=D(_);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function oe(e){const t=ne(),n=z({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const a=e(o);return r.has&&Object.is(r.value,a)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:a,has:!0},a)};return M(t.subscribe,o,o)}function re(){return function(e){return oe(e)}}var ae="data-puck-component",ie="data-puck-dropzone",se={},de="data-es-mirror",le="undefined"==typeof window?A:P;function ce(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${de}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(de,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function ue({children:t,id:n="preview-frame",title:o,className:r,style:a,mirrorStyles:i=!0,onDocument:l,height:c="auto",nonce:u}){const p=s("canvas",e),f=z(null),[h,m]=Z(null);return le(()=>{const e=f.current,t=h?.ownerDocument.defaultView;if("auto"!==c||!e||!h||!t)return;const n=()=>{e.style.height=`${Math.ceil(h.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(h),()=>r?.disconnect()},[h,c]),le(()=>{let e=f.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=f.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===c&&t.classList.add("es-frame-fill"),e.body.appendChild(t),d(e,u),m(t),l?.(e);let n=null;const o=f.current?.ownerDocument;if(i&&o){ce(o,e,u);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>ce(o,e,u)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),m(null),l?.(null)}},[]),/* @__PURE__ */$("iframe",{ref:f,id:n,title:o??p.frame,className:["es-canvas-frame","fill"===c?"is-fill":"",r??""].filter(Boolean).join(" "),style:a,children:h?R(t,h):null})}var pe=x(null),fe=x(se),he=[];function me({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128}){const a=ne(),i=oe(n=>p(n.appState.data,a.config,{parentId:e,slot:t})??he),s=oe(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==u),d=oe(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),l=D(pe),c=["es-zone"];return i.length&&c.push("has-children"),e===u&&c.push("is-root"),(s||d)&&c.push("is-area-selected"),null!==l&&l===e&&e!==u&&c.push("is-hovering-area"),n&&c.push(n),/* @__PURE__ */$("div",{className:c.join(" "),[ie]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`},children:i.map(e=>/* @__PURE__ */$(ye,{node:e},e.props.id))})}function ve(e,t,n,o){const r="root"===t?e.root:e.components[t],a={...o};for(const e of C(E(r)))a[e]=function(t={}){/* @__PURE__ */
1
+ import{DEFAULT_CANVAS_WORDS as e}from"./chunk-AELNNAFM.js";import{useResolvedFields as t}from"./chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as a,clickPick as i}from"./chunk-UK2FQOUT.js";import{useWords as s}from"./chunk-MFIRYGHW.js";import{find as d,ROOT_ID as l,getList as c,remove as u,parseZoneKey as p,move as f,duplicate as h,replaceNode as m,createNode as v,insert as g,normalizeData as y,createResolveCache as k,resolveNodeData as w,ROOT_SLOT as S}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as b,fieldsFrom as I,defaultsFrom as C}from"./chunk-NKB3KVAB.js";import{setCanvasNonce as E,isTypingTarget as O}from"./chunk-ZNCEOSXO.js";import{createContext as x,useEffect as A,useContext as D,useRef as z,useSyncExternalStore as M,useState as Z,useMemo as N,useCallback as j,useLayoutEffect as P}from"react";import{jsx as $,jsxs as L}from"react/jsx-runtime";import{createPortal as R}from"react-dom";function B(e){return!["setData","setUi","set"].includes(e.type)}var K=(e,t,n,o)=>{const r=c(e,t,p(n));return r?.[o]??null},F=(e,t,n,o,r)=>{const a=K(e,t,n,o);if(!a)throw new Error(`${r}: nothing at ${n}[${o}]`);return a};function V(e,t){const{selection:o}=e;return{...e.ui,itemSelector:n(e.data,t,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function H(e,t,n){return n?"node"===n.kind?d(e,t,n.id)?n:null:n.parentId===l?c(e,t,n)?n:null:d(e,t,n.parentId)&&c(e,t,n)?n:null:null}function T(e,t,n,r=!1){const{itemSelector:a,selectedSlot:i,...s}=n;let d=e.selection;var l;return"itemSelector"in n&&(d=o(e.data,t,a??null)),"selectedSlot"in n&&(i?d=(l=i)?{kind:"slot",parentId:l.parentId,slot:l.slot}:null:"slot"===d?.kind&&(d=null)),{...e,selection:d,ui:r?s:{...e.ui,...s}}}function U(e,t,n){const o=q(e,t,n);if(o===e)return e;const r=H(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function q(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return T(e,n,"function"==typeof t.ui?t.ui(V(e,n)):t.ui);case"set":{const r={data:o,ui:V(e,n)},a="function"==typeof t.state?t.state(r):t.state;let i=a.data?{...e,data:a.data}:e;return a.ui&&(i=T(i,n,a.ui,!0)),i}case"insert":{const r={...p(t.destinationZone),index:t.destinationIndex},a=v(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:g(o,n,r,a)}}case"replace":{const r=F(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:m(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=F(o,n,t.sourceZone,t.sourceIndex,"duplicate"),a=h(o,n,r.props.id),i=K(a,n,t.sourceZone,t.sourceIndex+1);return{...e,data:a,selection:i?{kind:"node",id:i.props.id}:e.selection}}case"reorder":return q(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=K(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const a={...p(t.destinationZone),index:t.destinationIndex};return{...e,data:f(o,n,r.props.id,a)}}case"remove":{const r=F(o,n,t.zone,t.index,"remove");return{...e,data:u(o,n,r.props.id)}}default:return e}}var Y={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},W={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},X=0,Q=()=>`history-${X+=1}`;function G(e){let t=e.config;const r=e.now??(()=>Date.now()),a=e.historyCoalesceMs??250;let i=e.permissions??{};const s=y(e.data,t);let l={data:s,selection:null,ui:{...W}};if(e.ui){const{itemSelector:n,selectedSlot:r,...a}=e.ui;l={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...W,...a}}}let u=[{core:l,at:-1/0,sealed:!0,id:Q()}],p=0;const f=e=>{const t=u[p],n=r();!e&&p===u.length-1&&p>0&&!t.sealed&&n-t.at<a?u=[...u.slice(0,p),{...t,core:l,at:n}]:(u=[...u.slice(0,p+1),{core:l,at:n,sealed:e,id:Q()}],p=u.length-1)},h=/* @__PURE__ */new Set;let v=null,g=null,S=0,b=null,I=!1;const C=()=>{for(const e of[...h])e()},E=()=>{u=[...u.slice(0,p),{...u[p],core:l},...u.slice(p+1)]},O=(t,n)=>{S>0?I=I||n:(n?f(!1):l!==t&&E(),l.data!==t.data&&e.onChange?.(l.data),l!==t&&C())},x=e=>{const n=l;if(l=U(l,e,t),l===n)return;const o=e.recordHistory??B(e);O(n,o&&l.data!==n.data)},A=t=>{0===S&&(b=l,I=!1),S+=1;try{t()}catch(e){throw S-=1,0===S&&b&&(l=b,b=null),e}if(S-=1,S>0||!b)return;const n=b;b=null,I&&l.data!==n.data?f(!0):l!==n&&E(),l.data!==n.data&&e.onChange?.(l.data),l!==n&&C()},D=e=>{const n=l,o=H(l.data,t,e);var r,a;(r=o,a=l.selection,r===a||r&&a&&r.kind===a.kind&&("node"===r.kind&&"node"===a.kind?r.id===a.id:"slot"===r.kind&&"slot"===a.kind&&r.parentId===a.parentId&&r.slot===a.slot))||(l={...l,selection:o},O(n,!1))},z=t=>{const n=l;p=t,l=u[p].core,l.data!==n.data&&e.onChange?.(l.data),l!==n&&C()},M=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...Y,...i,...n}};let Z=M();const N=k(),j={resolveCache:N,async resolveAll({trigger:e="load",metadata:n}={}){const o=l.data,r={type:"root",props:{...o.root.props??{}}},a=[...o.content,...Object.values(o.zones??{}).flat()],[i,...s]=await Promise.all([w(r,t,{cache:N,trigger:e,metadata:n}),...a.map(o=>w(o,t,{cache:N,trigger:e,metadata:n}))]);A(()=>{const e=l;let n=l.data;s.forEach((e,r)=>{if(!e.didChange)return;const i=a[r].props.id,s=d(n,t,i)?.node;s&&s===d(o,t,i)?.node&&(n=m(n,t,i,e.node))}),i.didChange&&n.root===o.root&&(n={...n,root:{...n.root,props:i.node.props,readOnly:i.node.readOnly??n.root.readOnly}}),n!==l.data&&(l={...l,data:n,selection:H(n,t,l.selection)},O(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=d(l.data,t,e)?.node;if(!r)return!1;const a=await w(r,t,{cache:N,trigger:n,metadata:o});if(!a.didChange)return!1;let i=!1;return A(()=>{const n=l;if(d(l.data,t,e)?.node!==r)return;const o=m(l.data,t,e,a.node);o!==l.data&&(l={...l,data:o,selection:H(o,t,l.selection)},O(n,!1),i=!0)}),i},get config(){return t},getState(){if(v&&g===l)return v;const e=l,o={data:e.data,ui:V(e,t)},r="node"===e.selection?.kind?d(e.data,t,e.selection.id)?.node??null:null;return v={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:x,history:{back:()=>j.undo(),forward:()=>j.redo(),hasPast:p>0,hasFuture:p<u.length-1,histories:u.map(e=>({id:e.id,state:{data:e.core.data,ui:V(e.core,t)}})),index:p,setHistoryIndex:e=>{e>=0&&e<u.length&&e!==p&&z(e)}},getPermissions:Z,getItemById:n=>d(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return c(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},g=e,v},subscribe:e=>(h.add(e),()=>{h.delete(e)}),dispatch:x,batch:A,select:e=>D(e?{kind:"node",id:e}:null),selectSlot:e=>D(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){A(()=>{const n=l,o=void 0===e.select?l.selection:e.select;l={...l,data:e.data,selection:H(e.data,t,o)},O(n,e.data!==n.data)})},load(e,n={}){const o=l,r=y(e,t);l={...l,data:r,selection:H(r,t,n.selection??l.selection)},n.keepHistory||(u=[{core:l,at:-1/0,sealed:!0,id:Q()}],p=0),l!==o&&C()},undo(){p>0&&z(p-1)},redo(){p<u.length-1&&z(p+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,Z=M(),v=null,C())},setConfig(e){e!==t&&(t=e,Z=M(),v=null,C())}};return j}function J(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&O(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var _=x(null),ee=x(!0);function te({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return A(()=>{n&&e.resolveAll()},[e,n]),A(()=>{if(t&&"undefined"!=typeof document)return J(document,e)},[e,t]),/* @__PURE__ */$(_.Provider,{value:e,children:/* @__PURE__ */$(ee.Provider,{value:t,children:o})})}function ne(){const e=D(_);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function oe(e){const t=ne(),n=z({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const a=e(o);return r.has&&Object.is(r.value,a)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:a,has:!0},a)};return M(t.subscribe,o,o)}function re(){return function(e){return oe(e)}}var ae="data-puck-component",ie="data-puck-dropzone",se={},de="data-es-mirror",le="undefined"==typeof window?A:P;function ce(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${de}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(de,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function ue({children:t,id:n="preview-frame",title:o,className:r,style:a,mirrorStyles:i=!0,onDocument:d,height:l="auto",nonce:c}){const u=s("canvas",e),p=z(null),[f,h]=Z(null);return le(()=>{const e=p.current,t=f?.ownerDocument.defaultView;if("auto"!==l||!e||!f||!t)return;const n=()=>{e.style.height=`${Math.ceil(f.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(f),()=>r?.disconnect()},[f,l]),le(()=>{let e=p.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=p.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===l&&t.classList.add("es-frame-fill"),e.body.appendChild(t),E(e,c),h(t),d?.(e);let n=null;const o=p.current?.ownerDocument;if(i&&o){ce(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>ce(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),h(null),d?.(null)}},[]),/* @__PURE__ */$("iframe",{ref:p,id:n,title:o??u.frame,className:["es-canvas-frame","fill"===l?"is-fill":"",r??""].filter(Boolean).join(" "),style:a,children:f?R(t,f):null})}var pe=x(null),fe=x(se),he=[];function me({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128}){const a=ne(),i=oe(n=>c(n.appState.data,a.config,{parentId:e,slot:t})??he),s=oe(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==l),d=oe(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),u=D(pe),p=["es-zone"];return i.length&&p.push("has-children"),e===l&&p.push("is-root"),(s||d)&&p.push("is-area-selected"),null!==u&&u===e&&e!==l&&p.push("is-hovering-area"),n&&p.push(n),/* @__PURE__ */$("div",{className:p.join(" "),[ie]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`},children:i.map(e=>/* @__PURE__ */$(ye,{node:e},e.props.id))})}function ve(e,t,n,o){const r="root"===t?e.root:e.components[t],a={...o};for(const e of b(I(r)))a[e]=function(t={}){/* @__PURE__ */
2
2
  return $(me,{parentId:n,slot:e,...t})};return a}function ge(e){return function({zone:t,...n}){/* @__PURE__ */
3
- return $(me,{parentId:e,slot:t,...n})}}function ye({node:e}){const t=ne().config,n=t.components[e.type],o=e.props.id,r=function(e){const t=z(null);return N(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(ae),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(ae,e),n.setAttribute("data-puck-dnd",e),n.style.position="relative")},[e])}(o),a=D(fe);if(!n?.render)return null;const i=n.render,s=ve(t,e.type,o,{...O(n),...e.props}),d={renderDropZone:ge(o),isEditing:!0,dragRef:n.inline?r:null,metadata:{...a,...n.metadata}};return n.inline?/* @__PURE__ */$(i,{...s,puck:d,editMode:!0}):/* @__PURE__ */$("div",{[ae]:o,"data-puck-dnd":o,style:{position:"relative"},children:/* @__PURE__ */$(i,{...s,puck:d,editMode:!0})})}function ke({metadata:e}){const t=oe(e=>e.config),n=oe(e=>e.appState.data.root).props??{},o=t.root?.render,r=/* @__PURE__ */$(me,{parentId:u,slot:I}),a=o?/* @__PURE__ */$(o,{id:"puck-root",...ve(t,"root",u,n),puck:{renderDropZone:ge(u),isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:r}):r;/* @__PURE__ */
3
+ return $(me,{parentId:e,slot:t,...n})}}function ye({node:e}){const t=ne().config,n=t.components[e.type],o=e.props.id,r=function(e){const t=z(null);return N(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(ae),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(ae,e),n.setAttribute("data-puck-dnd",e),n.style.position="relative")},[e])}(o),a=D(fe);if(!n?.render)return null;const i=n.render,s=ve(t,e.type,o,{...C(n),...e.props}),d={renderDropZone:ge(o),isEditing:!0,dragRef:n.inline?r:null,metadata:{...a,...n.metadata}};return n.inline?/* @__PURE__ */$(i,{...s,puck:d,editMode:!0}):/* @__PURE__ */$("div",{[ae]:o,"data-puck-dnd":o,style:{position:"relative"},children:/* @__PURE__ */$(i,{...s,puck:d,editMode:!0})})}function ke({metadata:e}){const t=oe(e=>e.config),n=oe(e=>e.appState.data.root).props??{},o=t.root?.render,r=/* @__PURE__ */$(me,{parentId:l,slot:S}),a=o?/* @__PURE__ */$(o,{id:"puck-root",...ve(t,"root",l,n),puck:{renderDropZone:ge(l),isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:r}):r;/* @__PURE__ */
4
4
  return $(fe.Provider,{value:e??se,children:a})}function we({id:e,kind:t,overlay:n}){const o=z(null),[r,a]=Z(null);le(()=>{const t=o.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!e)return void a(null);let r=0;const i=()=>{r=0;const i=function(e,t){if(!e||!t)return null;const n=e.getBoundingClientRect(),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(t.querySelector(`[${ae}="${n.CSS?.escape?n.CSS.escape(e):e}"]`),o.current?.parentElement??null);a(e=>{return(t=e)===(n=i)||t&&n&&t.top===n.top&&t.left===n.left&&t.width===n.width&&t.height===n.height?e:i;var t,n})},s=()=>{r||(r=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(i))};i();const d="MutationObserver"in n?new n.MutationObserver(s):null;d?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const l="ResizeObserver"in n?new n.ResizeObserver(s):null;return l?.observe(t.documentElement),n.addEventListener("resize",s),()=>{d?.disconnect(),l?.disconnect(),n.removeEventListener("resize",s),r&&(n.cancelAnimationFrame??n.clearTimeout)(r)}},[e]);const i=/* @__PURE__ */$("div",{ref:o,"aria-hidden":"true",className:`es-canvas-outline is-${t}`,style:r?{position:"absolute",top:r.top,left:r.left,width:r.width,height:r.height}:{display:"none"}});return n&&e?/* @__PURE__ */$(n,{componentId:e,kind:t,children:i}):i}function Se({frame:e=!0,className:t,style:n,metadata:o,mirrorStyles:r,onDocument:s,height:d,title:l,nonce:c,hotkeys:u,frameWrapper:p,overlay:f,children:h}){const m=ne(),v=D(ee),g=u??v,[y,k]=Z(void 0),w=oe(e=>"node"===e.selection?.kind?e.selection.id:null),[S,b]=Z(null),I=e=>{const t=e.closest?.(`[${ae}]`)?.getAttribute(ae);if(!t)return;const n=m.getState(),o="node"===n.selection?.kind?n.selection.id:null;return i(n.appState.data,m.config,t,o)??t},C=/* @__PURE__ */L("div",{className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;t.closest?.("a[href]")&&e.preventDefault();const n=I(t);void 0===n?t.hasAttribute?.(ie)||m.select(null):m.select(n)},onMouseOver:e=>{const t=I(e.target)??null;t!==S&&b(t)},onMouseLeave:()=>b(null),children:[
5
5
  /* @__PURE__ */$(pe.Provider,{value:S,children:/* @__PURE__ */$(ke,{metadata:o})}),
6
6
  /* @__PURE__ */L("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
7
7
  /* @__PURE__ */$(we,{id:S&&S!==w?S:null,kind:"hover",overlay:f}),
8
8
  /* @__PURE__ */$(we,{id:w,kind:"selected",overlay:f})]}),h]}),E=p?/* @__PURE__ */$(p,{document:y,children:C}):C;A(()=>{if(y&&g)return J(y,m)},[y,g,m]),A(()=>{if(!y)return;const e=e=>{if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=m.getState();if("node"!==n.selection?.kind)return;const o=a(n.appState.data,m.config,n.selection);"node"===o?.kind&&m.select(o.id)};return y.addEventListener("keydown",e),()=>y.removeEventListener("keydown",e)},[y,m]);/* @__PURE__ */
9
- return $("div",{className:"es-canvas"+(t?` ${t}`:""),style:n,"data-puck-preview":"",children:e?/* @__PURE__ */$(ue,{mirrorStyles:r,onDocument:e=>{k(e??void 0),s?.(e)},height:d,title:l,nonce:c,children:E}):/* @__PURE__ */$("div",{id:"preview-frame","data-puck-entry":"",children:E})})}function be(e={}){const t=ne(),n=oe(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function Ie(){const e=ne(),n=oe(e=>e.config),o=e.resolveCache,r=oe(e=>e.selectedItem),a=oe(e=>e.appState.data.root),i=r?r.props.id:"root",s=a.props??{},d=N(()=>r||{type:"root",props:s},[r,s]),l=r?n.components[r.type]:n.root,u=e.getState(),p=r?c(u.appState.data,n,i):null,f=p&&"root"!==p.place.parentId?p.place.parentId:null,h=f?u.getItemById(f)??null:null,{fields:m}=t({id:i,node:d,block:l,parent:h,appState:u.appState}),v=oe(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),g=j((t,r)=>{(async()=>{const a=e.getState();if("root"!==i){const s=a.getItemById(i),d=a.getSelectorForId(i);if(!s||!d)return;const l={...s,props:{...s.props,[t]:r}},{node:c}=await b(l,n,{cache:o,trigger:"replace"}),u=e.getState().getSelectorForId(i);if(!u)return;return void e.dispatch({type:"replace",destinationZone:u.zone??"root:default-zone",destinationIndex:u.index,data:c})}const s=a.appState.data.root.props??{},{node:d}=await b({type:"root",props:{...s,[t]:r}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:d.props,readOnly:d.readOnly},recordHistory:!0})})()},[e,n,o,i]);return{id:i,node:d,fields:m,values:d.props,readOnly:v,onChange:g}}export{ue as CanvasFrame,W as DEFAULT_UI,Se as EaselCanvas,te as EaselProvider,ke as EditDocument,J as bindUndoKeys,G as createEasel,re as createUseEasel,B as recordsByDefault,U as reduce,V as uiView,oe as useEasel,ne as useEaselApi,be as useEaselNodeOps,Ie as useSelectedFields,H as validSelection};
9
+ return $("div",{className:"es-canvas"+(t?` ${t}`:""),style:n,"data-puck-preview":"",children:e?/* @__PURE__ */$(ue,{mirrorStyles:r,onDocument:e=>{k(e??void 0),s?.(e)},height:d,title:l,nonce:c,children:E}):/* @__PURE__ */$("div",{id:"preview-frame","data-puck-entry":"",children:E})})}function be(e={}){const t=ne(),n=oe(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function Ie(){const e=ne(),n=oe(e=>e.config),o=e.resolveCache,r=oe(e=>e.selectedItem),a=oe(e=>e.appState.data.root),i=r?r.props.id:"root",s=a.props??{},l=N(()=>r||{type:"root",props:s},[r,s]),c=r?n.components[r.type]:n.root,u=e.getState(),p=r?d(u.appState.data,n,i):null,f=p&&"root"!==p.place.parentId?p.place.parentId:null,h=f?u.getItemById(f)??null:null,{fields:m}=t({id:i,node:l,block:c,parent:h,appState:u.appState}),v=oe(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),g=j((t,r)=>{(async()=>{const a=e.getState();if("root"!==i){const s=a.getItemById(i),d=a.getSelectorForId(i);if(!s||!d)return;const l={...s,props:{...s.props,[t]:r}},{node:c}=await w(l,n,{cache:o,trigger:"replace"}),u=e.getState().getSelectorForId(i);if(!u)return;return void e.dispatch({type:"replace",destinationZone:u.zone??"root:default-zone",destinationIndex:u.index,data:c})}const s=a.appState.data.root.props??{},{node:d}=await w({type:"root",props:{...s,[t]:r}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:d.props,readOnly:d.readOnly},recordHistory:!0})})()},[e,n,o,i]);return{id:i,node:l,fields:m,values:l.props,readOnly:v,onChange:g}}export{ue as CanvasFrame,W as DEFAULT_UI,Se as EaselCanvas,te as EaselProvider,ke as EditDocument,J as bindUndoKeys,G as createEasel,re as createUseEasel,B as recordsByDefault,U as reduce,V as uiView,oe as useEasel,ne as useEaselApi,be as useEaselNodeOps,Ie as useSelectedFields,H as validSelection};
@@ -1,4 +1,4 @@
1
- import{useScreenOwnerName as e}from"./chunk-KSTX646X.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-UB4TLWVJ.js";import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";function l({panel:l,pick:d,onHide:m}){const p=e();/* @__PURE__ */
1
+ import{useScreenOwnerName as e}from"./chunk-3FZAGTQE.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-UB4TLWVJ.js";import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";function l({panel:l,pick:d,onHide:m}){const p=e();/* @__PURE__ */
2
2
  return o(r,{children:[
3
3
  /* @__PURE__ */t(i,{context:p,pick:d?{kind:c(d.accept),field:d.title||void 0}:null,onCancel:()=>d&&n(d.requestId,null),onHide:m}),
4
4
  /* @__PURE__ */t("div",{className:"sf-media-panel",children:/* @__PURE__ */t(l,{pick:d,onPick:e=>d&&n(d.requestId,e)})})]})}export{l as MediaSidePanel};
@@ -1,4 +1,4 @@
1
- import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as r}from"./chunk-G5JILVHG.js";import{ScreenChrome as e}from"./chunk-ETDRAF3O.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-WZMU646D.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.js";import{documentPermissions as o}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t}from"react";import{Dialog as d,Button as l}from"efficient-shell/ui";import{jsx as m,jsxs as g,Fragment as h}from"react/jsx-runtime";var f=n(r),v=n(e);function p({saving:n,onCancel:r,onDiscard:e,onSave:i}){const a=c("screen",s).leave;/* @__PURE__ */
1
+ import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as r}from"./chunk-ITAQX3HT.js";import{ScreenChrome as e}from"./chunk-5QSFLWAJ.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-WZMU646D.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.js";import{documentPermissions as o}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t}from"react";import{Dialog as d,Button as l}from"efficient-shell/ui";import{jsx as m,jsxs as g,Fragment as h}from"react/jsx-runtime";var f=n(r),v=n(e);function p({saving:n,onCancel:r,onDiscard:e,onSave:i}){const a=c("screen",s).leave;/* @__PURE__ */
2
2
  return m(d,{open:!0,role:"alertdialog",size:"sm",title:a.title,onClose:r,footer:/* @__PURE__ */g(h,{children:[
3
3
  /* @__PURE__ */m(l,{variant:"secondary",onClick:r,children:a.cancel}),
4
4
  /* @__PURE__ */m(l,{variant:"ghost-danger",onClick:e,children:a.discard}),
@@ -1,2 +1,2 @@
1
- import{ScreenPartsProvider as t}from"./chunk-KSTX646X.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-XW4AV5N4.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
1
+ import{ScreenPartsProvider as t}from"./chunk-3FZAGTQE.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-FUOZKV7A.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
2
2
  return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(t,{parts:f,children:u})})}export{a as ScreenStoreProvider};
@@ -1,14 +1,14 @@
1
- import{DEFAULT_DRAG_WORDS as e}from"./chunk-O2NLQBFX.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as r,isNoOpDrop as a}from"./chunk-67GNT6PF.js";import{useCanvasLayout as o,useCanvasEvent as s}from"./chunk-PAELDYYS.js";import{framePointToHost as i,elementScale as c,frameRectToLayer as d,clientPointToLayer as u}from"./chunk-ZNCEOSXO.js";import{withTip as h}from"./chunk-P2VEMZH5.js";import{parseZoneKey as f}from"./chunk-KRXQM65X.js";import{useRef as p,useEffect as m,useState as g,useCallback as b,useMemo as y,useSyncExternalStore as v,useId as x,useLayoutEffect as k}from"react";import{Tooltip as w,Input as N,IconButton as A}from"efficient-shell/ui";import{jsxs as z,jsx as D}from"react/jsx-runtime";import{CloseIcon as T,SearchIcon as C}from"efficient-shell/icons/efficient";var S=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,E=e=>e.width*e.height;function $(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>S(e.box,t,n)).sort((e,t)=>E(t.s.box)-E(e.s.box)||e.at-t.at).map(({s:e})=>e)}function L(e,t,n){return $(e,t,n).at(-1)??null}function j(e,t,n){const l="x"===e.axis?t:n;let r=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(r+=1)}return r}function M(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],r=n[t],a=l&&r?(l.left+l.width+r.left)/2:l?l.left+l.width:r?r.left:e.box.left,o=r??l??e.box;return{left:a-1,top:o.top,width:2,height:o.height}}const l=n[t-1],r=n[t],a=l&&r?(l.top+l.height+r.top)/2:l?l.top+l.height:r?r.top:e.box.top;return{left:e.box.left,top:a-1,width:e.box.width,height:2}}function B(e,t,n,l,r=()=>!1,a=()=>!0){const o=e.filter(e=>S(e.box,t,n)).sort((e,t)=>E(e.box)-E(t.box));for(const e of o){const o=j(e,t,n),s={...e.list,index:o};if(r(s))return null;if(l(s))return{zone:e,to:s,line:M(e,o)};if(!a(s))return null}return null}function O(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const r=e.children[l-1],a=e.children[l],o=r.top+r.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:o,width:e.box.width,height:Math.max(a.top-o,0)}})}return n}var K={nodes:[],zones:[]},X="data-puck-dropzone",q="data-puck-component";function P(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function Y(e,t){const{frame:n,document:l}=e,r=e=>d(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),a=[],o=[];for(const e of l.querySelectorAll(`[${X}]`)){const t=e.getAttribute(X)??"";let n;try{n=f(t)}catch{continue}const l=[...e.querySelectorAll(`[${q}]`)].filter(t=>t.parentElement?.closest(`[${X}]`)===e),s=l.map(r);o.push({key:t,list:n,box:r(e),axis:P(s,e),children:s}),l.forEach((e,t)=>{const l=e.getAttribute(q);l&&a.push({id:l,place:{...n,index:t},box:s[t]})})}return{nodes:a,zones:o}}var Z="data-es-empty-cell",F="data-puck-dropzone",R=140;var I=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function Q(d){const{canvas:h,session:f,readOnly:x,words:N=e.canvas}=d,A=p(d);m(()=>{A.current=d});const T=p(null),C=o(h),[S,E]=g(0),L=b(()=>E(e=>e+1),[]),[j,M]=g(K);m(()=>{const e=T.current;h&&e&&M((A.current.measure??Y)(h,e))},[h,C,d.revision,S]);const O=d.model,X=y(()=>O(j),[O,j]),q=v(f.subscribe,f.shown,f.shown),P=d.choose,R=(e,t)=>{const n=$(X.sources,e,t);return 0===n.length?null:P?P(n):n[n.length-1]},[Q,V]=g(null),[G,H]=g(null),W=p(null),J=()=>{W.current&&clearTimeout(W.current),W.current=null},U=()=>{J(),W.current=setTimeout(()=>{f.get()||V(null)},140)};m(()=>J,[]);const _=p(null);s(h,"mousemove",e=>{const t=T.current;if(!h||!t)return;const n=i(h.frame,e.clientX,e.clientY,t),l=c(t),r={x:n.x/l,y:n.y/l};if(_.current=r,A.current.readOnly||f.get())return;J();const a=R(r.x,r.y);V(e=>e?.key===a?.key&&e?.box===a?.box?e:a)}),s(h,"mouseout",e=>{e.relatedTarget||(_.current=null,U())}),s(h,"mouseover",e=>{e.relatedTarget||L()});const ee=p(null),te=b(()=>{ee.current?.(),ee.current=null,H(null)},[]);m(()=>f.subscribe(()=>{f.get()?L():te()}),[f,te,L]),m(()=>te,[te]),("undefined"==typeof document?m:k)(()=>{if(f.get())return;const e=_.current;V(t=>x?null:e?R(e.x,e.y):t?X.sources.find(e=>e.key===t.key)??null:null)},[X,q,f,x,P]);const ne=e=>{const t=f.get(),n=T.current;if(!t||!n)return null;const l=u(n,e.clientX,e.clientY);_.current=l;const r=B(X.zones,l.x,l.y,e=>A.current.canDrop(t.item,e),e=>!!t.from&&a(t.from,e),e=>A.current.fallThrough?.(t.item,e,t.from)??!0);return r?{h:t,t:r}:null},le={onDragEnter:e=>{if(ee.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),a=h?l(h.document):null,o=[];t&&o.push(r(t)),a&&h&&o.push(r(a,h.frame)),ee.current=o.length?()=>o.forEach(e=>e()):null},onDragOver:e=>{const n=ne(e);if(!n)return void H(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const l={zoneKey:n.t.zone.key,line:n.t.line,axis:n.t.zone.axis};H(e=>e&&e.zoneKey===l.zoneKey&&e.line.left===l.line.left&&e.line.top===l.line.top?e:l)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(_.current=null,H(null))},onDrop:e=>{const t=ne(e);t&&(e.preventDefault(),f.end(),te(),A.current.onDrop(t.h.item,t.t.to))}},re={draggable:!x&&!!Q,onMouseEnter:J,onMouseLeave:()=>!f.get()&&U(),onDragStart:e=>{if(Q&&!x){f.start({key:Q.key,item:Q.item,from:Q.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",Q.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{f.end(),te()},onClick:()=>{Q&&!x&&A.current.onPick?.(Q.item)}},{seams:ae=[]}=X,oe=X.zones.filter(e=>0===e.children.length),se=d.onZoneAdd&&!x?oe:[],ie=se.map(e=>e.key).join("\n");return m(()=>{const e=h?.document;if(!e)return;const t=new Set(ie?ie.split("\n"):[]);for(const n of e.querySelectorAll(`[${F}]`))n.toggleAttribute(Z,t.has(n.getAttribute(F)??""));return()=>{for(const t of e.querySelectorAll(`[${Z}]`))t.removeAttribute(Z)}},[h,ie,j,C,S]),/* @__PURE__ */z("div",{ref:T,className:"es-canvas-layer",children:[q||!d.onSeamAdd||x?null:ae.map(e=>/* @__PURE__ */D("div",{className:"es-canvas-seam",style:{left:e.box.left,top:e.box.top+e.box.height/2-8,width:e.box.width,height:16},children:/* @__PURE__ */D("button",{type:"button",className:"es-canvas-seam-add",onClick:()=>d.onSeamAdd?.(e.place),children:N.addButton({label:d.seamLabel??N.addSection})})},e.key)),se.length?se.map(e=>/* @__PURE__ */D("button",{type:"button",className:G?.zoneKey===e.key?"es-canvas-empty is-over":"es-canvas-empty",style:I(e.box),onClick:()=>d.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */D("span",{className:"es-canvas-empty-add",children:N.addButton({label:d.zoneAddLabel??N.addBlock})})},e.key)):null,q?/* @__PURE__ */D("div",{className:"es-canvas-catch",...le}):null,G&&!oe.some(e=>e.key===G.zoneKey)?/* @__PURE__ */D("div",{className:`es-canvas-line is-${G.axis}`,style:I(G.line)}):null,
1
+ import{DEFAULT_DRAG_WORDS as e}from"./chunk-O2NLQBFX.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as r,isNoOpDrop as a}from"./chunk-67GNT6PF.js";import{useCanvasLayout as o,useCanvasEvent as s}from"./chunk-PAELDYYS.js";import{withTip as i}from"./chunk-P2VEMZH5.js";import{parseZoneKey as c}from"./chunk-KRXQM65X.js";import{framePointToHost as d,elementScale as u,frameRectToLayer as h,clientPointToLayer as f}from"./chunk-ZNCEOSXO.js";import{useRef as p,useEffect as m,useState as g,useCallback as b,useMemo as y,useSyncExternalStore as v,useId as x,useLayoutEffect as k}from"react";import{Tooltip as w,Input as N,IconButton as A}from"efficient-shell/ui";import{jsxs as z,jsx as D}from"react/jsx-runtime";import{CloseIcon as T,SearchIcon as C}from"efficient-shell/icons/efficient";var S=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,E=e=>e.width*e.height;function $(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>S(e.box,t,n)).sort((e,t)=>E(t.s.box)-E(e.s.box)||e.at-t.at).map(({s:e})=>e)}function L(e,t,n){return $(e,t,n).at(-1)??null}function j(e,t,n){const l="x"===e.axis?t:n;let r=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(r+=1)}return r}function M(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],r=n[t],a=l&&r?(l.left+l.width+r.left)/2:l?l.left+l.width:r?r.left:e.box.left,o=r??l??e.box;return{left:a-1,top:o.top,width:2,height:o.height}}const l=n[t-1],r=n[t],a=l&&r?(l.top+l.height+r.top)/2:l?l.top+l.height:r?r.top:e.box.top;return{left:e.box.left,top:a-1,width:e.box.width,height:2}}function B(e,t,n,l,r=()=>!1,a=()=>!0){const o=e.filter(e=>S(e.box,t,n)).sort((e,t)=>E(e.box)-E(t.box));for(const e of o){const o=j(e,t,n),s={...e.list,index:o};if(r(s))return null;if(l(s))return{zone:e,to:s,line:M(e,o)};if(!a(s))return null}return null}function O(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const r=e.children[l-1],a=e.children[l],o=r.top+r.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:o,width:e.box.width,height:Math.max(a.top-o,0)}})}return n}var K={nodes:[],zones:[]},X="data-puck-dropzone",q="data-puck-component";function P(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function Y(e,t){const{frame:n,document:l}=e,r=e=>h(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),a=[],o=[];for(const e of l.querySelectorAll(`[${X}]`)){const t=e.getAttribute(X)??"";let n;try{n=c(t)}catch{continue}const l=[...e.querySelectorAll(`[${q}]`)].filter(t=>t.parentElement?.closest(`[${X}]`)===e),s=l.map(r);o.push({key:t,list:n,box:r(e),axis:P(s,e),children:s}),l.forEach((e,t)=>{const l=e.getAttribute(q);l&&a.push({id:l,place:{...n,index:t},box:s[t]})})}return{nodes:a,zones:o}}var Z="data-es-empty-cell",F="data-puck-dropzone",R=140;var I=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function Q(i){const{canvas:c,session:h,readOnly:x,words:N=e.canvas}=i,A=p(i);m(()=>{A.current=i});const T=p(null),C=o(c),[S,E]=g(0),L=b(()=>E(e=>e+1),[]),[j,M]=g(K);m(()=>{const e=T.current;c&&e&&M((A.current.measure??Y)(c,e))},[c,C,i.revision,S]);const O=i.model,X=y(()=>O(j),[O,j]),q=v(h.subscribe,h.shown,h.shown),P=i.choose,R=(e,t)=>{const n=$(X.sources,e,t);return 0===n.length?null:P?P(n):n[n.length-1]},[Q,V]=g(null),[G,H]=g(null),W=p(null),J=()=>{W.current&&clearTimeout(W.current),W.current=null},U=()=>{J(),W.current=setTimeout(()=>{h.get()||V(null)},140)};m(()=>J,[]);const _=p(null);s(c,"mousemove",e=>{const t=T.current;if(!c||!t)return;const n=d(c.frame,e.clientX,e.clientY,t),l=u(t),r={x:n.x/l,y:n.y/l};if(_.current=r,A.current.readOnly||h.get())return;J();const a=R(r.x,r.y);V(e=>e?.key===a?.key&&e?.box===a?.box?e:a)}),s(c,"mouseout",e=>{e.relatedTarget||(_.current=null,U())}),s(c,"mouseover",e=>{e.relatedTarget||L()});const ee=p(null),te=b(()=>{ee.current?.(),ee.current=null,H(null)},[]);m(()=>h.subscribe(()=>{h.get()?L():te()}),[h,te,L]),m(()=>te,[te]),("undefined"==typeof document?m:k)(()=>{if(h.get())return;const e=_.current;V(t=>x?null:e?R(e.x,e.y):t?X.sources.find(e=>e.key===t.key)??null:null)},[X,q,h,x,P]);const ne=e=>{const t=h.get(),n=T.current;if(!t||!n)return null;const l=f(n,e.clientX,e.clientY);_.current=l;const r=B(X.zones,l.x,l.y,e=>A.current.canDrop(t.item,e),e=>!!t.from&&a(t.from,e),e=>A.current.fallThrough?.(t.item,e,t.from)??!0);return r?{h:t,t:r}:null},le={onDragEnter:e=>{if(ee.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),a=c?l(c.document):null,o=[];t&&o.push(r(t)),a&&c&&o.push(r(a,c.frame)),ee.current=o.length?()=>o.forEach(e=>e()):null},onDragOver:e=>{const n=ne(e);if(!n)return void H(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const l={zoneKey:n.t.zone.key,line:n.t.line,axis:n.t.zone.axis};H(e=>e&&e.zoneKey===l.zoneKey&&e.line.left===l.line.left&&e.line.top===l.line.top?e:l)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(_.current=null,H(null))},onDrop:e=>{const t=ne(e);t&&(e.preventDefault(),h.end(),te(),A.current.onDrop(t.h.item,t.t.to))}},re={draggable:!x&&!!Q,onMouseEnter:J,onMouseLeave:()=>!h.get()&&U(),onDragStart:e=>{if(Q&&!x){h.start({key:Q.key,item:Q.item,from:Q.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",Q.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{h.end(),te()},onClick:()=>{Q&&!x&&A.current.onPick?.(Q.item)}},{seams:ae=[]}=X,oe=X.zones.filter(e=>0===e.children.length),se=i.onZoneAdd&&!x?oe:[],ie=se.map(e=>e.key).join("\n");return m(()=>{const e=c?.document;if(!e)return;const t=new Set(ie?ie.split("\n"):[]);for(const n of e.querySelectorAll(`[${F}]`))n.toggleAttribute(Z,t.has(n.getAttribute(F)??""));return()=>{for(const t of e.querySelectorAll(`[${Z}]`))t.removeAttribute(Z)}},[c,ie,j,C,S]),/* @__PURE__ */z("div",{ref:T,className:"es-canvas-layer",children:[q||!i.onSeamAdd||x?null:ae.map(e=>/* @__PURE__ */D("div",{className:"es-canvas-seam",style:{left:e.box.left,top:e.box.top+e.box.height/2-8,width:e.box.width,height:16},children:/* @__PURE__ */D("button",{type:"button",className:"es-canvas-seam-add",onClick:()=>i.onSeamAdd?.(e.place),children:N.addButton({label:i.seamLabel??N.addSection})})},e.key)),se.length?se.map(e=>/* @__PURE__ */D("button",{type:"button",className:G?.zoneKey===e.key?"es-canvas-empty is-over":"es-canvas-empty",style:I(e.box),onClick:()=>i.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */D("span",{className:"es-canvas-empty-add",children:N.addButton({label:i.zoneAddLabel??N.addBlock})})},e.key)):null,q?/* @__PURE__ */D("div",{className:"es-canvas-catch",...le}):null,G&&!oe.some(e=>e.key===G.zoneKey)?/* @__PURE__ */D("div",{className:`es-canvas-line is-${G.axis}`,style:I(G.line)}):null,
2
2
  /* @__PURE__ */D("div",{className:"es-canvas-handle-spot",style:Q?{"--es-handle-x":`${Q.box.left+2}px`,"--es-handle-y":`${Math.max(Q.box.top-11,0)}px`}:void 0,children:/* @__PURE__ */D(w,{className:"es-canvas-handle-tip",side:"top",content:!Q||x||q?null:Q.title??N.handle({label:Q.label}),children:/* @__PURE__ */z("div",{className:["es-canvas-handle",Q&&!x?"is-shown":"",q?"is-dragging":""].filter(Boolean).join(" "),...re,children:[
3
- /* @__PURE__ */D("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),Q?.label]})})})]})}var V=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function G({groups:t,session:n,itemFor:l,onInsert:r,at:a,hint:o,searchLabel:s,readOnly:i,words:c=e.add}){const d=o??c.hint,u=s??c.search,[f,p]=g(""),m=x(),b=f.trim().toLowerCase(),y=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),v=t.map((e,t)=>({...e,key:y[t],tiles:b?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,b)):e.tiles})).filter(e=>e.tiles.length>0),k=(e,t)=>r=>{if(t)r.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),r.dataTransfer.effectAllowed="copy";try{r.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
3
+ /* @__PURE__ */D("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),Q?.label]})})})]})}var V=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function G({groups:t,session:n,itemFor:l,onInsert:r,at:a,hint:o,searchLabel:s,readOnly:c,words:d=e.add}){const u=o??d.hint,h=s??d.search,[f,p]=g(""),m=x(),b=f.trim().toLowerCase(),y=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),v=t.map((e,t)=>({...e,key:y[t],tiles:b?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,b)):e.tiles})).filter(e=>e.tiles.length>0),k=(e,t)=>r=>{if(t)r.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),r.dataTransfer.effectAllowed="copy";try{r.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
4
4
  return z("div",{className:"es-add",children:[a?/* @__PURE__ */z("div",{className:"es-add-at",role:"status",children:[
5
- /* @__PURE__ */D("span",{children:a.label}),h(c.stop,/* @__PURE__ */D("button",{type:"button",className:"es-add-at-clear","aria-label":c.stop,onClick:a.onClear,children:/* @__PURE__ */D(T,{size:12,"aria-hidden":"true"})}))]}):null,
6
- /* @__PURE__ */D("p",{className:"es-add-hint",children:d}),
7
- /* @__PURE__ */D("div",{className:"es-add-find",children:/* @__PURE__ */D(N,{id:m,type:"search","aria-label":u,placeholder:c.searchPlaceholder({label:u}),value:f,onChange:e=>p(e.target.value),leftIcon:/* @__PURE__ */D(C,{size:16,"aria-hidden":"true"}),rightAdornment:f?/* @__PURE__ */D(A,{size:"sm","aria-label":c.clearSearch,onClick:()=>p(""),children:/* @__PURE__ */D(T,{size:12,"aria-hidden":"true"})}):void 0})}),0===v.length?/* @__PURE__ */z("div",{className:"es-add-empty",role:"status",children:[
8
- /* @__PURE__ */D("div",{className:"es-add-empty-title",children:c.nothing({query:f.trim()})}),
9
- /* @__PURE__ */D("div",{className:"es-add-empty-sub",children:c.tryAnother})]}):v.map(e=>/* @__PURE__ */z("section",{className:"es-add-group","aria-label":e.title,children:[
5
+ /* @__PURE__ */D("span",{children:a.label}),i(d.stop,/* @__PURE__ */D("button",{type:"button",className:"es-add-at-clear","aria-label":d.stop,onClick:a.onClear,children:/* @__PURE__ */D(T,{size:12,"aria-hidden":"true"})}))]}):null,
6
+ /* @__PURE__ */D("p",{className:"es-add-hint",children:u}),
7
+ /* @__PURE__ */D("div",{className:"es-add-find",children:/* @__PURE__ */D(N,{id:m,type:"search","aria-label":h,placeholder:d.searchPlaceholder({label:h}),value:f,onChange:e=>p(e.target.value),leftIcon:/* @__PURE__ */D(C,{size:16,"aria-hidden":"true"}),rightAdornment:f?/* @__PURE__ */D(A,{size:"sm","aria-label":d.clearSearch,onClick:()=>p(""),children:/* @__PURE__ */D(T,{size:12,"aria-hidden":"true"})}):void 0})}),0===v.length?/* @__PURE__ */z("div",{className:"es-add-empty",role:"status",children:[
8
+ /* @__PURE__ */D("div",{className:"es-add-empty-title",children:d.nothing({query:f.trim()})}),
9
+ /* @__PURE__ */D("div",{className:"es-add-empty-sub",children:d.tryAnother})]}):v.map(e=>/* @__PURE__ */z("section",{className:"es-add-group","aria-label":e.title,children:[
10
10
  /* @__PURE__ */z("div",{className:"es-add-group-head",children:[
11
11
  /* @__PURE__ */D("span",{className:"es-add-group-title",children:e.title}),
12
12
  /* @__PURE__ */D("span",{className:"es-add-group-count",children:e.tiles.length})]}),
13
- /* @__PURE__ */D("div",{className:V(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(i||e.disabled),l=i?void 0:e.disabled?e.disabledReason:e.title??c.tile({label:e.label});return h(l,/* @__PURE__ */z("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":c.tile({label:e.label}),onDragStart:k(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&r(e.type),children:[null!=e.cover?/* @__PURE__ */D("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */D("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
13
+ /* @__PURE__ */D("div",{className:V(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(c||e.disabled),l=c?void 0:e.disabled?e.disabledReason:e.title??d.tile({label:e.label});return i(l,/* @__PURE__ */z("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":d.tile({label:e.label}),onDragStart:k(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&r(e.type),children:[null!=e.cover?/* @__PURE__ */D("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */D("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
14
14
  /* @__PURE__ */D("span",{className:"es-add-tile-label",children:e.label})]},e.type))})})]},e.key))]})}export{G as AddPanel,Q as CanvasDragLayer,K as EMPTY_MEASURE,R as HANDLE_GRACE_MS,B as canvasTarget,S as contains,j as gapInZone,M as gapLine,Y as measureCanvas,L as pickSource,O as seamsBetween,$ as sourcesAt};
@@ -0,0 +1,5 @@
1
+ import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as i}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-PFNIVZPN.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-3FZAGTQE.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-MCHMF32I.js";import{AddPanel as f}from"./chunk-KEHLCWTG.js";import{DEFAULT_DRAG_WORDS as u}from"./chunk-O2NLQBFX.js";import{useEasel as k}from"./chunk-FUOZKV7A.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as $,jsxs as O,Fragment as B}from"react/jsx-runtime";var F=e=>`section:${e}`,v=e=>`block:${e}`,I=e=>`template:${e}`;function N({blocks:N,blocksOnly:V,at:x,onAdd:A,itemFor:H,session:L,siteWide:C,onClose:T,onHide:P,readOnly:Q}){const Z=k(e=>e.config),w=p(),{labelAtLevel:D,categoryLabel:E,firstSection:G,Icon:K,Thumbnail:M}=w,{blockIsOffered:R}=m(),W=h("screen",d).add,z=h("drag",u).add,S=l(),[Y,J]=y([]);b(()=>{let t=!1;const o=e=>R(e,S);return s(S).list().then(n=>{if(t)return;const i=Z.components;J(n.filter(t=>t.node?.type&&i[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[Z,S]);const U=j(()=>t(Z,w),[Z]),X=e=>({type:F(e.type),label:e.name,cover:/* @__PURE__ */$(M,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:W.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),q=j(()=>{const e=[];if(N&&N.choices.length>0&&a(N.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${W.inside({name:N.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:v(e.type),label:e.label,icon:/* @__PURE__ */$(K,{type:e.type,size:18}),title:W.tile({name:e.label})}))})}),V)return e;const t=o(U,G);t&&e.push({key:"start",title:W.startBlank,tiles:[X(t)]}),Y.length>0&&e.push({key:"templates",title:W.templates,tiles:Y.map(e=>{return{type:I(e.id),label:e.name,cover:/* @__PURE__ */$(M,{type:e.node.type}),keywords:[(t=e.node.type,D(t,"section",Z.components[t]?.label??t)),e.node.type]};var t})});const s=n(U,G);for(const t of Object.keys(Z.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:i(Z,t,E),tiles:o.map(X)})}return e},[N,V,Y,U,Z,W]),_=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=Y.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
2
+ return O(B,{children:[
3
+ /* @__PURE__ */$(r,{icon:/* @__PURE__ */$(g,{size:15}),title:W.title,context:V?W.contextBlocks:W.contextAll,actions:/* @__PURE__ */$(c,{label:W.done,description:W.doneDescription,onClick:T}),onHide:P}),
4
+ /* @__PURE__ */O("div",{className:"sf-addside sf-scroll",children:[
5
+ /* @__PURE__ */$(f,{groups:q,session:L,itemFor:e=>H(_(e)??{kind:"section",type:e}),onInsert:e=>{const t=_(e);t&&A(t)},at:x,hint:V?W.hintBlocks:W.hint,searchLabel:V?W.searchBlocks:W.searchSections,readOnly:Q,words:z}),C&&!V?C:null]})]})}export{N as AddSidePanel,v as blockKey,F as sectionKey,I as templateKey};
@@ -1,4 +1,4 @@
1
- import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-KSTX646X.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{DropdownMenu as n}from"efficient-shell/ui";import{jsxs as c,Fragment as i,jsx as o}from"react/jsx-runtime";function l({choices:l,onPick:p}){const{Icon:a}=r(),m=t("screen",s),u=e(l).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */c(i,{children:[e.group," ",
1
+ import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-3FZAGTQE.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{DropdownMenu as n}from"efficient-shell/ui";import{jsxs as c,Fragment as i,jsx as o}from"react/jsx-runtime";function l({choices:l,onPick:p}){const{Icon:a}=r(),m=t("screen",s),u=e(l).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */c(i,{children:[e.group," ",
2
2
  /* @__PURE__ */o("span",{className:"sf-menugroup-count",children:e.items.length})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */o("span",{className:"sf-chip",children:/* @__PURE__ */o(a,{type:e.type,size:13})}),onSelect:()=>p(e.type)}))]);/* @__PURE__ */
3
3
  return o(n,{align:"start",triggerClassName:"sf-add-card",items:u,trigger:/* @__PURE__ */c(i,{children:[
4
4
  /* @__PURE__ */o("span",{className:"sf-plus sf-plus--sm",children:"+"}),m.addBlockMenu]})})}export{l as AddBlockRow};
@@ -0,0 +1 @@
1
+ import{useSectionOps as o}from"./chunk-XHHS6SDM.js";import{decodePartId as e,encodePartId as r}from"./chunk-IYT6NN2J.js";import{usePreviewParts as t}from"./chunk-I54UCYOU.js";import{SELECTION_MODE as n}from"./chunk-3FZAGTQE.js";import{useEasel as p}from"./chunk-FUOZKV7A.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=p(o=>o),I=o(),{setSelectedPartId:f,setSelectHandler:k}=t(),l=d(o=>{const r=e(o);if(!r)return;const{nodeId:t,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===t&&o.propKey===p?o:{kind:"part",nodeId:t,propKey:p}),a?.(t)):i(o=>"part"===o.kind?n:o)},[i,a]);c(()=>{k(l)},[k,l]);const h=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>n);const e=u(o);e&&I.select(e)},[i,u,I]),openPartId:h}}export{m as usePartBridge};
@@ -1 +1 @@
1
- import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as o,bindUndoKeys as t}from"./chunk-XW4AV5N4.js";import{useState as e,useEffect as u}from"react";function r(o){const t=n(),[r,c]=e(null);return u(()=>c(o.current),[o]),t.ownsDocument?"undefined"==typeof document?null:document:r}function c(e,c){const m=n(),i=o(),f=r(e);u(()=>{if(!m.ownsDocument&&f)return t(f,i,{leaveTyping:!0})},[m,i,f]);const s=c?.document??null;u(()=>{if(!m.ownsDocument&&s)return t(s,i,{leaveTyping:!0})},[m,i,s])}function m(n){return n.ownsDocument?{}:{tabIndex:-1}}export{m as editorRootFocus,r as useEaselKeyTarget,c as useEaselUndoKeys};
1
+ import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as o,bindUndoKeys as t}from"./chunk-FUOZKV7A.js";import{useState as e,useEffect as u}from"react";function r(o){const t=n(),[r,c]=e(null);return u(()=>c(o.current),[o]),t.ownsDocument?"undefined"==typeof document?null:document:r}function c(e,c){const m=n(),i=o(),f=r(e);u(()=>{if(!m.ownsDocument&&f)return t(f,i,{leaveTyping:!0})},[m,i,f]);const s=c?.document??null;u(()=>{if(!m.ownsDocument&&s)return t(s,i,{leaveTyping:!0})},[m,i,s])}function m(n){return n.ownsDocument?{}:{tabIndex:-1}}export{m as editorRootFocus,r as useEaselKeyTarget,c as useEaselUndoKeys};
@@ -1 +1 @@
1
- import{useScreenBlockRules as e}from"./chunk-KSTX646X.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-XW4AV5N4.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-3FZAGTQE.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-FUOZKV7A.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};
@@ -17,7 +17,7 @@
17
17
  .es-copy {
18
18
  --es-copy-gap: var(--es-space-8, 8px);
19
19
  /* efficient-shell's IconButton at its default size, md (design v5, 0.94.0). */
20
- --es-copy-mark-size: 32px;
20
+ --es-copy-mark-size: var(--control-height-md, 32px);
21
21
  --es-copy-rule: var(--es-border, var(--line));
22
22
  --es-copy-field-border: var(--es-field-border, var(--line-strong));
23
23
  --es-copy-field-bg: var(--es-field-bg, var(--surface));
@@ -341,7 +341,7 @@
341
341
  /* Words never break inside: in a narrow box (a 220px panel) Clear style
342
342
  moves to a line of its own, still at the right end. */
343
343
  .es-copy-marks-label {
344
- font-size: 13px;
344
+ font-size: 14px;
345
345
  white-space: nowrap;
346
346
  color: var(--es-text-secondary, var(--ink));
347
347
  }
@@ -499,7 +499,7 @@
499
499
  */
500
500
  @container (width < 268px) {
501
501
  .es-tb-wrap {
502
- --es-tb-size: min(24px, calc(100cqw / 9));
502
+ --es-tb-size: min(var(--control-height-sm, 24px), calc(100cqw / 9));
503
503
  }
504
504
 
505
505
  .es-tb-btn svg {
@@ -515,14 +515,14 @@
515
515
  * words being coloured). `CopyBox` measures that and writes `top`, `left`,
516
516
  * `--es-pop-point` and `data-side` on the window (./place). The `top` here is
517
517
  * only the unmeasured fallback: under the first row, as first drawn.
518
- * DatePicker's popover: 288px, 12px corners, a 12px inset, react-os-shell's
519
- * shadow; never wider than the box.
518
+ * DatePicker's popover: 288px, the shell's popup corners (16), a 12px inset,
519
+ * react-os-shell's shadow; never wider than the box.
520
520
  */
521
521
  .es-copy-pop {
522
522
  position: absolute;
523
523
  z-index: 5;
524
524
  left: 0;
525
- top: calc(var(--es-tb-size) + 6px);
525
+ top: calc(var(--es-tb-size) + var(--es-space-8));
526
526
  box-sizing: border-box;
527
527
  width: 288px;
528
528
  max-width: 100%;
@@ -532,7 +532,7 @@
532
532
  gap: var(--es-space-8, 8px);
533
533
  padding: 12px;
534
534
  border: 1px solid var(--es-border, var(--line));
535
- border-radius: var(--radius-xl);
535
+ border-radius: var(--radius-popup);
536
536
  background: var(--es-raised, var(--surface));
537
537
  box-shadow: var(--rosh-glass-solid-shadow);
538
538
  }
@@ -1,4 +1,4 @@
1
- import{DEFAULT_COPY_WORDS as e}from"../chunk-JZDEIRH4.js";import{FieldNumber as t}from"../chunk-66LWADFP.js";import{SettingsSegmented as n,SettingsSwitch as r}from"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import{GoldTextInput as l}from"../chunk-2FZJWH24.js";import{RETIRED_MARKS as o,applyMark as a,STANDARD_MARKUP as s,writeMarkedLines as i,sameMarks as c,markedLines as u,spanFor as d,markupTools as h,marksIn as p,findLink as f,markedAt as m,listIn as g,colorIn as b,clearStyle as v,isSafeLinkHref as y,toggleMark as k,colorOver as w,setList as x,unlinkAt as C,removeLink as D,linkOver as S,writeLink as E}from"../chunk-546BBOPE.js";import{useWords as N}from"../chunk-MFIRYGHW.js";import{withTip as M}from"../chunk-P2VEMZH5.js";import{Tooltip as L,ColorSwatch as T,ColorPickerPanel as B,Button as R,IconButton as j,registerModalEscapeInterceptor as P,LinkPicker as z}from"efficient-shell/ui";import{useRef as O,useState as F,useLayoutEffect as K,useEffect as W,useId as $}from"react";import{AlignJustifyIcon as H,AlignRightIcon as A,AlignCenterIcon as I,AlignLeftIcon as U,ParagraphSpacingIcon as q,LetterSpacingIcon as V,TextLinesIcon as Y,TextSizeIcon as Z,CaseNormalIcon as G,CaseUpperIcon as J,CaseLowerIcon as X,TextColorIcon as Q,ListIcon as _,NumberedListIcon as ee,ClearMarksIcon as te,BoldIcon as ne,ItalicIcon as re,UnderlineIcon as le,StrikeIcon as oe,LinkIcon as ae,SuperscriptIcon as se,SubscriptIcon as ie,QuietIcon as ce,EmphasisIcon as ue}from"efficient-shell/icons/efficient";import{jsx as de,jsxs as he,Fragment as pe}from"react/jsx-runtime";var fe=["left","center","right","justify"],me=e.align,ge={left:/* @__PURE__ */de(U,{}),center:/* @__PURE__ */de(I,{}),right:/* @__PURE__ */de(A,{}),justify:/* @__PURE__ */de(H,{})},be={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function ve(e,t=me){return fe.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:ge[e],title:t[e]}))}var ye=/[\u1100-\u11ff\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/;function ke(e){if(e.every(e=>e.label===me[e.id]))return e.length>3?be.four:be.three;const t=e.map(e=>[...e.label].reduce((e,t)=>e+(ye.test(t)?13:8),0));return{labelsPx:t.reduce((e,t)=>e+t,0),widestLabelPx:Math.max(0,...t)}}function we(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function xe(e,t,n,r=a){const{start:l,end:o}=we(e,n);return r(e,l,o,t)}function Ce(e,t,n){const{start:r,end:l}=we(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}var De=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),Se=/* @__PURE__ */new Set(["p","div","li","ul","ol","dl","dt","dd","h1","h2","h3","h4","h5","h6","blockquote","pre","table","thead","tbody","tfoot","tr","section","article","header","footer","aside","nav","figure","figcaption","address","hr"]);function Ee(e,t){const n=t.rules??s,r=e.html&&""!==e.html.trim()?function(e,t,n){const r=t.createElement("template");r.innerHTML=e;const l=[[]],o=()=>l[l.length-1],a=()=>{const e=o();for(;e.length>0&&" "===e[e.length-1].ch;)e.pop();e.length>0&&l.push([])},s=(e,t,n,r)=>{if(3===e.nodeType){for(const a of e.textContent??""){const e=/\s/.test(a)?" ":a,s=o();" "===e&&(0===s.length&&l.length>1||" "===s[s.length-1]?.ch)||s.push({ch:e,bold:t,italic:n,href:r})}return}if(1!==e.nodeType&&11!==e.nodeType)return;const i=e,c=1===e.nodeType?i.localName:"";if(De.has(c))return;if("br"===c)return void l.push([]);let u=t,d=n,h=r;if("b"!==c&&"strong"!==c||(u=!0),"i"!==c&&"em"!==c||(d=!0),"a"===c){const e=(i.getAttribute("href")??"").trim();h=y(e)?e:null}const p=1===e.nodeType?i.style:null;if(p){const e=p.fontWeight;"bold"===e||"bolder"===e||Number(e)>=600?u=!0:("normal"===e||"lighter"===e||""!==e&&Number(e)<600)&&(u=!1),"italic"===p.fontStyle||"oblique"===p.fontStyle?d=!0:"normal"===p.fontStyle&&(d=!1)}const f=Se.has(c);f&&a();for(const t of[...e.childNodes])s(t,u,d,h);f&&a()};s(r.content,!1,!1,null);for(;l.length>1&&0===l[l.length-1].length;)l.pop();return l.map(e=>function(e,t){const n=t=>e.map((n,r)=>n[t]&&(" "!==n.ch||Boolean(e[r-1]?.[t])&&Boolean(e[r+1]?.[t]))),r=[{bold:!0,italic:!0,links:!0},{bold:!0,italic:!1,links:!0},{bold:!1,italic:!1,links:!0},{bold:!1,italic:!1,links:!1}];for(const l of r){const r=Ne(e,l.bold?n("bold"):null,l.italic?n("italic"):null,l.links),o=i([r]).text;if(c([r],u(o,t)))return o}return e.map(e=>e.ch).join("")}(e,n))}(e.html,t.doc,n):(e.text??"").replace(/\r\n?/g,"\n").split("\n");return t.multiline?r.join("\n"):1===r.length?r[0]:r.map(e=>e.trim()).filter(e=>""!==e).join(" ")}function Ne(e,t,n,r){let l=0,o=null,a=null,s=null;return{bullet:!1,chars:e.map((e,i)=>{const c=r?e.href:null;return o=null===c?null:o&&o.href===c?o:d(++l,"link",c),a=t?.[i]?a??d(++l,"bold"):null,s=n?.[i]?s??d(++l,"italic"):null,{ch:e.ch,at:-1,marks:[o,a,s].filter(e=>null!==e)}})}}var Me=/^([0-9]{1,3})\. $/;function Le(e,t){const n=e.split("\n"),r=u(e,t);let l=0,o=0;const a=r.map((e,t)=>{const r=!e.bullet&&null==e.number&&"- "===n[t],a=null!=e.number||e.bullet?null:Me.exec(n[t]),s=e.bullet||r,i=a?a[1]:e.number??null,c=r||a?[]:e.chars,u=c.map(e=>e.ch).join(""),d=null!=i?i.length+2:s?2:0,h={bullet:s,number:i,chars:c,start:l,src:l+d,vis:o,text:u};return l+=n[t].length+1,o+=u.length+1,h});return{lines:a,text:a.map(e=>e.text).join("\n")}}function Te(e,t){const{lines:n}=e;for(let e=0;e<n.length;e+=1){const r=n[e];if(t<=r.vis+r.text.length||e===n.length-1)return[r,Math.max(0,Math.min(t-r.vis,r.text.length)),e]}return[n[0],0,0]}function Be(e,t){const[n,r]=Te(e,t);if(0===r)return n.src;let l=0;for(const e of n.chars){if(r<=l+e.ch.length)return e.at+(r-l);l+=e.ch.length}return n.src}function Re(e,t){const[n,r]=Te(e,t);let l=0;for(const e of n.chars){if(r===l)return e.at;l+=e.ch.length}return Be(e,t)}function je(e,t){const{lines:n}=e;let r=n[0];for(const e of n)t>=e.start&&(r=e);let l=0;for(const e of r.chars){if(!(t>=e.at+e.ch.length)){t>e.at&&(l+=t-e.at);break}l+=e.ch.length}return r.vis+l}function Pe(e,t,n){return[je(e,t),je(e,n)]}function ze(e,t,n){return t===n?[Be(e,t),Be(e,t)]:[Re(e,t),Be(e,n)]}function Oe(e,t){let n=0;for(let r=0;r<e.chars.length;r+=1){if(n>=t)return r;n+=e.chars[r].ch.length}return e.chars.length}function Fe(e,t,n,r,l){const o=Le(e,t),[a,s,h]=Te(o,Math.min(n,r)),[p,f,m]=Te(o,Math.max(n,r)),g=Oe(a,s),b=Oe(p,f),v=a.chars.slice(0,g),y=p.chars.slice(b),k=n!==r&&a.chars[g]&&(h!==m||g<b)?a.chars[g].marks:function(e,t){const n=e.chars[t-1],r=e.chars[t],l=(e,t)=>{const n=e.findIndex(e=>"link"===e.kind);return-1===n||t?e:e.slice(0,n)};if(n){const e=n.marks.find(e=>"link"===e.kind),t=Boolean(e&&r?.marks.some(t=>t.id===e.id));return l(n.marks,t)}return r?l(r.marks,!1):[]}(a,g);let w=(x=o.lines,Math.max(0,...x.flatMap(e=>e.chars.flatMap(e=>e.marks.map(e=>e.id))))+1);var x;const C=e=>{let n;if(void 0!==l.markup){const e=w;n=u(l.markup,t).map(t=>({bullet:t.bullet,number:t.number??null,chars:t.chars.map(t=>({...t,at:-1,marks:t.marks.map(t=>({...t,id:t.id+e}))}))}))}else{let t=a.number??null;n=(l.text??"").split("\n").map((n,r)=>(r>0&&null!=t&&(t=function(e){return String(Number(e)+1).padStart(e.length,"0")}(t)),{bullet:a.bullet,number:t,chars:[...n].map(t=>({ch:t,at:-1,marks:e??[]}))}))}const r=n.map(e=>e.chars.map(e=>e.ch).join("")).join("\n"),s={bullet:a.bullet,number:a.number??null,chars:[...v,...n[0].chars]},i=n.slice(1);if(i.length>0){const e=i[i.length-1];i[i.length-1]={...e,chars:[...e.chars,...y]}}else s.chars.push(...y);return{lines:[...o.lines.slice(0,h).map(({bullet:e,number:t,chars:n})=>({bullet:e,number:t,chars:n})),s,...i,...o.lines.slice(m+1).map(({bullet:e,number:t,chars:n})=>({bullet:e,number:t,chars:n}))],shown:r}},D=void 0!==l.markup?[null]:[(e=>{let t=e.filter(e=>!l.drop?.some(t=>e.kind===t||"highlight"===t&&"accent"===e.kind));for(const e of l.add??[]){if(t.some(t=>t.kind===e))continue;const n=d(w++,e);n&&(t=[...t,n])}if(void 0!==l.color){t=t.filter(e=>"color"!==e.kind);const e=null===l.color?null:d(w++,"color",l.color);e&&(t=[...t,e])}return t})(k),k,[]];let S="",E="";for(const e of D){const n=C(e),r=i(n.lines).text;if(S=r,E=n.shown,c(n.lines,Le(r,t).lines))break}return{text:S,caret:Math.min(n,r)+E.length}}function Ke(e,t,n,r){const l=Le(e,t),[o,,a]=Te(l,n);return n!==r||!o.bullet&&null==o.number||""!==o.text?Fe(e,t,n,r,{text:"\n"}):We(e,t,a,!1,n)}function We(e,t,n,r,l){const o=Le(e,t).lines.map(({bullet:e,number:t,chars:l},o)=>o===n?{bullet:r,number:null,chars:l}:{bullet:e,number:t,chars:l});return{text:i(o).text,caret:l}}function $e(e,t,n,r){const l=Le(e,t),[o,a,s]=Te(l,Math.min(n,r)),[c,u,d]=Te(l,Math.max(n,r)),h=l.lines.slice(s,d+1).map(({bullet:e,number:t,chars:n},r)=>{const l=0===r?Oe(o,a):0,i=r===d-s?Oe(c,u):n.length;return{bullet:e,number:t,chars:n.slice(l,i)}});return i(h).text}var He="application/x-efficient-markup";function Ae(e,t,n,r){switch(t){case"bold":return e.createElement("strong");case"italic":return e.createElement("em");case"strike":return e.createElement("s");case"underline":return e.createElement("u");case"sup":return e.createElement("sup");case"sub":return e.createElement("sub");case"color":{const t=e.createElement("span");return t.className="es-rich-color",r&&(t.dataset.color=r,t.title=r.startsWith("#")?r.toUpperCase():r,t.style.color=r.startsWith("#")?r:`var(--es-color-${r}, inherit)`),t}case"link":{const t=e.createElement("a");return t.className="es-rich-link",n&&(t.title=n),t}default:{const n=e.createElement("span");return n.className="highlight"===t||"accent"===t?"es-rich-emphasis":`es-rich-${t}`,n}}}function Ie(e,t,n,r){const l=e.layout.lines;if(n===t)return r>=e.lines.length?e.layout.text.length:l[r].vis;const o=e.lines.findIndex(e=>e===n||e.contains(n));if(-1===o)return 0;const a=t.ownerDocument.createRange();a.setStart(e.lines[o],0);try{a.setEnd(n,r)}catch{return l[o].vis}return l[o].vis+Math.min(a.toString().length,l[o].text.length)}function Ue(e,t){const n=e.layout.lines;let r=n.length-1;for(let e=0;e<n.length;e+=1)if(t<=n[e].vis+n[e].text.length){r=e;break}let l=Math.max(0,t-n[r].vis);const o=e.lines[r].ownerDocument.createTreeWalker(e.lines[r],4);let a=o.nextNode(),s=null;for(;a;){if(l<=a.data.length)return[a,l];l-=a.data.length,s=a,a=o.nextNode()}return s?[s,s.data.length]:[e.lines[r],0]}function qe(e,t,n){if(n<0){const n=e.charCodeAt(t-1);return t-(n>=56320&&n<=57343&&t>=2?2:1)}const r=e.charCodeAt(t);return t+(r>=55296&&r<=56319?2:1)}function Ve({value:e,rules:t,multiline:n,readOnly:r=!1,placeholder:l,ariaLabel:o,handle:a,onEdit:s,onSelect:i,onHistory:c,onFormat:u,pending:d,onCommit:h,onCancel:p}){const f=O(null),m=O(null),g=O(null),b=O(null),v=O(null),y=O(e),[k,w]=F(0),x=O({value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u});x.current={value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u};const C=()=>{const e=f.current,t=m.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=Ie(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?Ie(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},D=(e,t)=>{const n=f.current,r=m.current;if(!n||!r)return;const[l,o]=Ue(r,e),[a,s]=Ue(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};a.current={getSource(){const e=C(),t=m.current;if(!e||!t)return null;const[n,r]=ze(t.layout,e[0],e[1]);return{start:n,end:r}},setSource(e,t,n){b.current={text:n,src:[e,t]},w(e=>e+1)},focus(){f.current?.focus()},rangeOf(e,t){const n=f.current,r=m.current;if(!n||!r)return null;const[l,o]=Pe(r.layout,e,t),[a,s]=Ue(r,l),[i,c]=Ue(r,o),u=n.ownerDocument.createRange();return u.setStart(a,s),u.setEnd(i,c),u}},K(()=>{const n=f.current;if(!n||v.current)return;const r=b.current?null:C();m.current=function(e,t){const n=e.ownerDocument;e.replaceChildren();const r=t.lines.map(t=>{const r=n.createElement("div");r.className=null!=t.number?"es-rich-line is-numbered":t.bullet?"es-rich-line is-bullet":"es-rich-line",null!=t.number&&(r.dataset.number=t.number);const l=[],o=()=>l.length?l[l.length-1].el:r;let a=null;for(const e of t.chars){let t=0;for(;t<l.length&&t<e.marks.length&&l[t].id===e.marks[t].id;)t+=1;(l.length>t||e.marks.length>t)&&(a=null),l.length=t;for(let r=t;r<e.marks.length;r+=1){const t=Ae(n,e.marks[r].kind,e.marks[r].href,e.marks[r].color);o().appendChild(t),l.push({id:e.marks[r].id,el:t})}a||(a=n.createTextNode(""),o().appendChild(a)),a.data+=e.ch}return 0===t.chars.length&&r.appendChild(n.createElement("br")),e.appendChild(r),r});return{layout:t,lines:r}}(n,Le(e,t)),g.current=e;const l=b.current;if(!l||l.text!==e)return void(r&&n.ownerDocument.activeElement===n&&D(r[0],Math.min(r[1],m.current.layout.text.length)));b.current=null;const o=m.current.layout,[a,s]=l.vis??Pe(o,l.src[0],l.src[1]);n.ownerDocument.activeElement!==n&&n.focus(),D(a,s)},[e,t,k]);const S=(e,t,n)=>{const r=m.current,[l,o]=ze(r.layout,t[0],t[1]);b.current={text:e.text,vis:[e.caret,e.caret]},e.text!==x.current.value?x.current.onEdit(e.text,{start:l,end:o},n):w(e=>e+1)};W(()=>{const e=f.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:a}=x.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const s=m.current,i=C();if(!s||!i)return;let[c,u]=i;const d="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0;d&&!d.collapsed&&t.inputType.startsWith("delete")&&(c=Ie(s,e,d.startContainer,d.startOffset),u=Ie(s,e,d.endContainer,d.endOffset));const h=s.layout.text,p=t.inputType;if("historyUndo"!==p&&"historyRedo"!==p)if("formatBold"!==p&&"formatItalic"!==p&&"formatStrikeThrough"!==p)if("insertParagraph"!==p&&"insertLineBreak"!==p){if(p.startsWith("insert")){let o=t.data??t.dataTransfer?.getData("text/plain")??"";if("insertFromDrop"===p||"insertFromPaste"===p){const a=Ee({html:t.dataTransfer?.getData("text/html"),text:o},{doc:e.ownerDocument,multiline:l,rules:r});return void S(Fe(n,r,c,u,{markup:a}),[c,u],"edit")}return l||(o=o.replace(/\s*\r?\n\s*/g," ")),void S(Fe(n,r,c,u,{text:o,add:a?.add,drop:a?.drop,color:a?.color}),[c,u],"type")}if(p.startsWith("delete")){if(c===u){const e=p.includes("Backward"),t=s.layout.lines.findIndex(e=>c>=e.vis&&c<=e.vis+e.text.length),l=s.layout.lines[t];if(e&&l&&c===l.vis&&(l.bullet||null!=l.number))return void S(We(n,r,t,!1,c),[c,u],"edit");if(e?0===c:c===h.length)return;e?c=qe(h,c,-1):u=qe(h,u,1)}S(Fe(n,r,c,u,{text:""}),[c,u],"type")}}else l&&S(Ke(n,r,c,u),[c,u],"edit");else x.current.onFormat("formatBold"===p?"bold":"formatItalic"===p?"italic":"strike");else x.current.onHistory("historyUndo"===p?"undo":"redo")},n=()=>{v.current||w(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),W(()=>{const e=f.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=a.current?.getSource();e&&i(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const E=(n,l=!1)=>{const o=C();if(!o||o[0]===o[1])return;n.preventDefault();const a=m.current;n.clipboardData.setData("text/plain",a.layout.text.slice(o[0],o[1])),n.clipboardData.setData(He,$e(e,t,o[0],o[1])),l&&!r&&S(Fe(e,t,o[0],o[1],{text:""}),o,"edit")};/* @__PURE__ */
1
+ import{DEFAULT_COPY_WORDS as e}from"../chunk-JZDEIRH4.js";import{FieldNumber as t}from"../chunk-66LWADFP.js";import{SettingsSegmented as n,SettingsSwitch as r}from"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import{GoldTextInput as l}from"../chunk-2FZJWH24.js";import{RETIRED_MARKS as o,applyMark as a,STANDARD_MARKUP as s,writeMarkedLines as i,sameMarks as c,markedLines as u,spanFor as d,markupTools as h,marksIn as p,findLink as f,markedAt as m,listIn as g,colorIn as b,clearStyle as v,isSafeLinkHref as y,toggleMark as k,colorOver as w,setList as x,unlinkAt as C,removeLink as D,linkOver as S,writeLink as E}from"../chunk-546BBOPE.js";import{withTip as N}from"../chunk-P2VEMZH5.js";import{useWords as M}from"../chunk-MFIRYGHW.js";import{Tooltip as L,ColorSwatch as T,ColorPickerPanel as B,Button as R,IconButton as j,registerModalEscapeInterceptor as P,LinkPicker as z}from"efficient-shell/ui";import{useRef as O,useState as F,useLayoutEffect as K,useEffect as W,useId as $}from"react";import{AlignJustifyIcon as H,AlignRightIcon as A,AlignCenterIcon as I,AlignLeftIcon as U,ParagraphSpacingIcon as q,LetterSpacingIcon as V,TextLinesIcon as Y,TextSizeIcon as Z,CaseNormalIcon as G,CaseUpperIcon as J,CaseLowerIcon as X,TextColorIcon as Q,ListIcon as _,NumberedListIcon as ee,ClearMarksIcon as te,BoldIcon as ne,ItalicIcon as re,UnderlineIcon as le,StrikeIcon as oe,LinkIcon as ae,SuperscriptIcon as se,SubscriptIcon as ie,QuietIcon as ce,EmphasisIcon as ue}from"efficient-shell/icons/efficient";import{jsx as de,jsxs as he,Fragment as pe}from"react/jsx-runtime";var fe=["left","center","right","justify"],me=e.align,ge={left:/* @__PURE__ */de(U,{}),center:/* @__PURE__ */de(I,{}),right:/* @__PURE__ */de(A,{}),justify:/* @__PURE__ */de(H,{})},be={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function ve(e,t=me){return fe.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:ge[e],title:t[e]}))}var ye=/[\u1100-\u11ff\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/;function ke(e){if(e.every(e=>e.label===me[e.id]))return e.length>3?be.four:be.three;const t=e.map(e=>[...e.label].reduce((e,t)=>e+(ye.test(t)?13:8),0));return{labelsPx:t.reduce((e,t)=>e+t,0),widestLabelPx:Math.max(0,...t)}}function we(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function xe(e,t,n,r=a){const{start:l,end:o}=we(e,n);return r(e,l,o,t)}function Ce(e,t,n){const{start:r,end:l}=we(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}var De=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),Se=/* @__PURE__ */new Set(["p","div","li","ul","ol","dl","dt","dd","h1","h2","h3","h4","h5","h6","blockquote","pre","table","thead","tbody","tfoot","tr","section","article","header","footer","aside","nav","figure","figcaption","address","hr"]);function Ee(e,t){const n=t.rules??s,r=e.html&&""!==e.html.trim()?function(e,t,n){const r=t.createElement("template");r.innerHTML=e;const l=[[]],o=()=>l[l.length-1],a=()=>{const e=o();for(;e.length>0&&" "===e[e.length-1].ch;)e.pop();e.length>0&&l.push([])},s=(e,t,n,r)=>{if(3===e.nodeType){for(const a of e.textContent??""){const e=/\s/.test(a)?" ":a,s=o();" "===e&&(0===s.length&&l.length>1||" "===s[s.length-1]?.ch)||s.push({ch:e,bold:t,italic:n,href:r})}return}if(1!==e.nodeType&&11!==e.nodeType)return;const i=e,c=1===e.nodeType?i.localName:"";if(De.has(c))return;if("br"===c)return void l.push([]);let u=t,d=n,h=r;if("b"!==c&&"strong"!==c||(u=!0),"i"!==c&&"em"!==c||(d=!0),"a"===c){const e=(i.getAttribute("href")??"").trim();h=y(e)?e:null}const p=1===e.nodeType?i.style:null;if(p){const e=p.fontWeight;"bold"===e||"bolder"===e||Number(e)>=600?u=!0:("normal"===e||"lighter"===e||""!==e&&Number(e)<600)&&(u=!1),"italic"===p.fontStyle||"oblique"===p.fontStyle?d=!0:"normal"===p.fontStyle&&(d=!1)}const f=Se.has(c);f&&a();for(const t of[...e.childNodes])s(t,u,d,h);f&&a()};s(r.content,!1,!1,null);for(;l.length>1&&0===l[l.length-1].length;)l.pop();return l.map(e=>function(e,t){const n=t=>e.map((n,r)=>n[t]&&(" "!==n.ch||Boolean(e[r-1]?.[t])&&Boolean(e[r+1]?.[t]))),r=[{bold:!0,italic:!0,links:!0},{bold:!0,italic:!1,links:!0},{bold:!1,italic:!1,links:!0},{bold:!1,italic:!1,links:!1}];for(const l of r){const r=Ne(e,l.bold?n("bold"):null,l.italic?n("italic"):null,l.links),o=i([r]).text;if(c([r],u(o,t)))return o}return e.map(e=>e.ch).join("")}(e,n))}(e.html,t.doc,n):(e.text??"").replace(/\r\n?/g,"\n").split("\n");return t.multiline?r.join("\n"):1===r.length?r[0]:r.map(e=>e.trim()).filter(e=>""!==e).join(" ")}function Ne(e,t,n,r){let l=0,o=null,a=null,s=null;return{bullet:!1,chars:e.map((e,i)=>{const c=r?e.href:null;return o=null===c?null:o&&o.href===c?o:d(++l,"link",c),a=t?.[i]?a??d(++l,"bold"):null,s=n?.[i]?s??d(++l,"italic"):null,{ch:e.ch,at:-1,marks:[o,a,s].filter(e=>null!==e)}})}}var Me=/^([0-9]{1,3})\. $/;function Le(e,t){const n=e.split("\n"),r=u(e,t);let l=0,o=0;const a=r.map((e,t)=>{const r=!e.bullet&&null==e.number&&"- "===n[t],a=null!=e.number||e.bullet?null:Me.exec(n[t]),s=e.bullet||r,i=a?a[1]:e.number??null,c=r||a?[]:e.chars,u=c.map(e=>e.ch).join(""),d=null!=i?i.length+2:s?2:0,h={bullet:s,number:i,chars:c,start:l,src:l+d,vis:o,text:u};return l+=n[t].length+1,o+=u.length+1,h});return{lines:a,text:a.map(e=>e.text).join("\n")}}function Te(e,t){const{lines:n}=e;for(let e=0;e<n.length;e+=1){const r=n[e];if(t<=r.vis+r.text.length||e===n.length-1)return[r,Math.max(0,Math.min(t-r.vis,r.text.length)),e]}return[n[0],0,0]}function Be(e,t){const[n,r]=Te(e,t);if(0===r)return n.src;let l=0;for(const e of n.chars){if(r<=l+e.ch.length)return e.at+(r-l);l+=e.ch.length}return n.src}function Re(e,t){const[n,r]=Te(e,t);let l=0;for(const e of n.chars){if(r===l)return e.at;l+=e.ch.length}return Be(e,t)}function je(e,t){const{lines:n}=e;let r=n[0];for(const e of n)t>=e.start&&(r=e);let l=0;for(const e of r.chars){if(!(t>=e.at+e.ch.length)){t>e.at&&(l+=t-e.at);break}l+=e.ch.length}return r.vis+l}function Pe(e,t,n){return[je(e,t),je(e,n)]}function ze(e,t,n){return t===n?[Be(e,t),Be(e,t)]:[Re(e,t),Be(e,n)]}function Oe(e,t){let n=0;for(let r=0;r<e.chars.length;r+=1){if(n>=t)return r;n+=e.chars[r].ch.length}return e.chars.length}function Fe(e,t,n,r,l){const o=Le(e,t),[a,s,h]=Te(o,Math.min(n,r)),[p,f,m]=Te(o,Math.max(n,r)),g=Oe(a,s),b=Oe(p,f),v=a.chars.slice(0,g),y=p.chars.slice(b),k=n!==r&&a.chars[g]&&(h!==m||g<b)?a.chars[g].marks:function(e,t){const n=e.chars[t-1],r=e.chars[t],l=(e,t)=>{const n=e.findIndex(e=>"link"===e.kind);return-1===n||t?e:e.slice(0,n)};if(n){const e=n.marks.find(e=>"link"===e.kind),t=Boolean(e&&r?.marks.some(t=>t.id===e.id));return l(n.marks,t)}return r?l(r.marks,!1):[]}(a,g);let w=(x=o.lines,Math.max(0,...x.flatMap(e=>e.chars.flatMap(e=>e.marks.map(e=>e.id))))+1);var x;const C=e=>{let n;if(void 0!==l.markup){const e=w;n=u(l.markup,t).map(t=>({bullet:t.bullet,number:t.number??null,chars:t.chars.map(t=>({...t,at:-1,marks:t.marks.map(t=>({...t,id:t.id+e}))}))}))}else{let t=a.number??null;n=(l.text??"").split("\n").map((n,r)=>(r>0&&null!=t&&(t=function(e){return String(Number(e)+1).padStart(e.length,"0")}(t)),{bullet:a.bullet,number:t,chars:[...n].map(t=>({ch:t,at:-1,marks:e??[]}))}))}const r=n.map(e=>e.chars.map(e=>e.ch).join("")).join("\n"),s={bullet:a.bullet,number:a.number??null,chars:[...v,...n[0].chars]},i=n.slice(1);if(i.length>0){const e=i[i.length-1];i[i.length-1]={...e,chars:[...e.chars,...y]}}else s.chars.push(...y);return{lines:[...o.lines.slice(0,h).map(({bullet:e,number:t,chars:n})=>({bullet:e,number:t,chars:n})),s,...i,...o.lines.slice(m+1).map(({bullet:e,number:t,chars:n})=>({bullet:e,number:t,chars:n}))],shown:r}},D=void 0!==l.markup?[null]:[(e=>{let t=e.filter(e=>!l.drop?.some(t=>e.kind===t||"highlight"===t&&"accent"===e.kind));for(const e of l.add??[]){if(t.some(t=>t.kind===e))continue;const n=d(w++,e);n&&(t=[...t,n])}if(void 0!==l.color){t=t.filter(e=>"color"!==e.kind);const e=null===l.color?null:d(w++,"color",l.color);e&&(t=[...t,e])}return t})(k),k,[]];let S="",E="";for(const e of D){const n=C(e),r=i(n.lines).text;if(S=r,E=n.shown,c(n.lines,Le(r,t).lines))break}return{text:S,caret:Math.min(n,r)+E.length}}function Ke(e,t,n,r){const l=Le(e,t),[o,,a]=Te(l,n);return n!==r||!o.bullet&&null==o.number||""!==o.text?Fe(e,t,n,r,{text:"\n"}):We(e,t,a,!1,n)}function We(e,t,n,r,l){const o=Le(e,t).lines.map(({bullet:e,number:t,chars:l},o)=>o===n?{bullet:r,number:null,chars:l}:{bullet:e,number:t,chars:l});return{text:i(o).text,caret:l}}function $e(e,t,n,r){const l=Le(e,t),[o,a,s]=Te(l,Math.min(n,r)),[c,u,d]=Te(l,Math.max(n,r)),h=l.lines.slice(s,d+1).map(({bullet:e,number:t,chars:n},r)=>{const l=0===r?Oe(o,a):0,i=r===d-s?Oe(c,u):n.length;return{bullet:e,number:t,chars:n.slice(l,i)}});return i(h).text}var He="application/x-efficient-markup";function Ae(e,t,n,r){switch(t){case"bold":return e.createElement("strong");case"italic":return e.createElement("em");case"strike":return e.createElement("s");case"underline":return e.createElement("u");case"sup":return e.createElement("sup");case"sub":return e.createElement("sub");case"color":{const t=e.createElement("span");return t.className="es-rich-color",r&&(t.dataset.color=r,t.title=r.startsWith("#")?r.toUpperCase():r,t.style.color=r.startsWith("#")?r:`var(--es-color-${r}, inherit)`),t}case"link":{const t=e.createElement("a");return t.className="es-rich-link",n&&(t.title=n),t}default:{const n=e.createElement("span");return n.className="highlight"===t||"accent"===t?"es-rich-emphasis":`es-rich-${t}`,n}}}function Ie(e,t,n,r){const l=e.layout.lines;if(n===t)return r>=e.lines.length?e.layout.text.length:l[r].vis;const o=e.lines.findIndex(e=>e===n||e.contains(n));if(-1===o)return 0;const a=t.ownerDocument.createRange();a.setStart(e.lines[o],0);try{a.setEnd(n,r)}catch{return l[o].vis}return l[o].vis+Math.min(a.toString().length,l[o].text.length)}function Ue(e,t){const n=e.layout.lines;let r=n.length-1;for(let e=0;e<n.length;e+=1)if(t<=n[e].vis+n[e].text.length){r=e;break}let l=Math.max(0,t-n[r].vis);const o=e.lines[r].ownerDocument.createTreeWalker(e.lines[r],4);let a=o.nextNode(),s=null;for(;a;){if(l<=a.data.length)return[a,l];l-=a.data.length,s=a,a=o.nextNode()}return s?[s,s.data.length]:[e.lines[r],0]}function qe(e,t,n){if(n<0){const n=e.charCodeAt(t-1);return t-(n>=56320&&n<=57343&&t>=2?2:1)}const r=e.charCodeAt(t);return t+(r>=55296&&r<=56319?2:1)}function Ve({value:e,rules:t,multiline:n,readOnly:r=!1,placeholder:l,ariaLabel:o,handle:a,onEdit:s,onSelect:i,onHistory:c,onFormat:u,pending:d,onCommit:h,onCancel:p}){const f=O(null),m=O(null),g=O(null),b=O(null),v=O(null),y=O(e),[k,w]=F(0),x=O({value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u});x.current={value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u};const C=()=>{const e=f.current,t=m.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=Ie(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?Ie(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},D=(e,t)=>{const n=f.current,r=m.current;if(!n||!r)return;const[l,o]=Ue(r,e),[a,s]=Ue(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};a.current={getSource(){const e=C(),t=m.current;if(!e||!t)return null;const[n,r]=ze(t.layout,e[0],e[1]);return{start:n,end:r}},setSource(e,t,n){b.current={text:n,src:[e,t]},w(e=>e+1)},focus(){f.current?.focus()},rangeOf(e,t){const n=f.current,r=m.current;if(!n||!r)return null;const[l,o]=Pe(r.layout,e,t),[a,s]=Ue(r,l),[i,c]=Ue(r,o),u=n.ownerDocument.createRange();return u.setStart(a,s),u.setEnd(i,c),u}},K(()=>{const n=f.current;if(!n||v.current)return;const r=b.current?null:C();m.current=function(e,t){const n=e.ownerDocument;e.replaceChildren();const r=t.lines.map(t=>{const r=n.createElement("div");r.className=null!=t.number?"es-rich-line is-numbered":t.bullet?"es-rich-line is-bullet":"es-rich-line",null!=t.number&&(r.dataset.number=t.number);const l=[],o=()=>l.length?l[l.length-1].el:r;let a=null;for(const e of t.chars){let t=0;for(;t<l.length&&t<e.marks.length&&l[t].id===e.marks[t].id;)t+=1;(l.length>t||e.marks.length>t)&&(a=null),l.length=t;for(let r=t;r<e.marks.length;r+=1){const t=Ae(n,e.marks[r].kind,e.marks[r].href,e.marks[r].color);o().appendChild(t),l.push({id:e.marks[r].id,el:t})}a||(a=n.createTextNode(""),o().appendChild(a)),a.data+=e.ch}return 0===t.chars.length&&r.appendChild(n.createElement("br")),e.appendChild(r),r});return{layout:t,lines:r}}(n,Le(e,t)),g.current=e;const l=b.current;if(!l||l.text!==e)return void(r&&n.ownerDocument.activeElement===n&&D(r[0],Math.min(r[1],m.current.layout.text.length)));b.current=null;const o=m.current.layout,[a,s]=l.vis??Pe(o,l.src[0],l.src[1]);n.ownerDocument.activeElement!==n&&n.focus(),D(a,s)},[e,t,k]);const S=(e,t,n)=>{const r=m.current,[l,o]=ze(r.layout,t[0],t[1]);b.current={text:e.text,vis:[e.caret,e.caret]},e.text!==x.current.value?x.current.onEdit(e.text,{start:l,end:o},n):w(e=>e+1)};W(()=>{const e=f.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:a}=x.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const s=m.current,i=C();if(!s||!i)return;let[c,u]=i;const d="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0;d&&!d.collapsed&&t.inputType.startsWith("delete")&&(c=Ie(s,e,d.startContainer,d.startOffset),u=Ie(s,e,d.endContainer,d.endOffset));const h=s.layout.text,p=t.inputType;if("historyUndo"!==p&&"historyRedo"!==p)if("formatBold"!==p&&"formatItalic"!==p&&"formatStrikeThrough"!==p)if("insertParagraph"!==p&&"insertLineBreak"!==p){if(p.startsWith("insert")){let o=t.data??t.dataTransfer?.getData("text/plain")??"";if("insertFromDrop"===p||"insertFromPaste"===p){const a=Ee({html:t.dataTransfer?.getData("text/html"),text:o},{doc:e.ownerDocument,multiline:l,rules:r});return void S(Fe(n,r,c,u,{markup:a}),[c,u],"edit")}return l||(o=o.replace(/\s*\r?\n\s*/g," ")),void S(Fe(n,r,c,u,{text:o,add:a?.add,drop:a?.drop,color:a?.color}),[c,u],"type")}if(p.startsWith("delete")){if(c===u){const e=p.includes("Backward"),t=s.layout.lines.findIndex(e=>c>=e.vis&&c<=e.vis+e.text.length),l=s.layout.lines[t];if(e&&l&&c===l.vis&&(l.bullet||null!=l.number))return void S(We(n,r,t,!1,c),[c,u],"edit");if(e?0===c:c===h.length)return;e?c=qe(h,c,-1):u=qe(h,u,1)}S(Fe(n,r,c,u,{text:""}),[c,u],"type")}}else l&&S(Ke(n,r,c,u),[c,u],"edit");else x.current.onFormat("formatBold"===p?"bold":"formatItalic"===p?"italic":"strike");else x.current.onHistory("historyUndo"===p?"undo":"redo")},n=()=>{v.current||w(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),W(()=>{const e=f.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=a.current?.getSource();e&&i(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const E=(n,l=!1)=>{const o=C();if(!o||o[0]===o[1])return;n.preventDefault();const a=m.current;n.clipboardData.setData("text/plain",a.layout.text.slice(o[0],o[1])),n.clipboardData.setData(He,$e(e,t,o[0],o[1])),l&&!r&&S(Fe(e,t,o[0],o[1],{text:""}),o,"edit")};/* @__PURE__ */
2
2
  return he("div",{className:"es-rich-wrap",children:[l&&""===e?/* @__PURE__ */de("div",{className:"es-rich-placeholder","aria-hidden":"true",children:l}):null,
3
3
  /* @__PURE__ */de("div",{ref:f,className:`es-rich${n?" is-multiline":" is-single"}${r?" is-off":""}`,contentEditable:!r,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":n,"aria-label":o,"aria-readonly":r||void 0,"aria-placeholder":l,tabIndex:r?-1:0,spellCheck:!0,onFocus:()=>{y.current=e},onBlur:()=>{e!==y.current&&h?.(e),y.current=e},onKeyDown:t=>{if("Escape"===t.key)return t.preventDefault(),p?.(y.current),void(y.current=e);"Enter"!==t.key||n||(t.preventDefault(),e!==y.current&&h?.(e),y.current=e)},onCompositionStart:()=>{const e=C()??[0,0];v.current={from:e[0],to:e[1]}},onCompositionEnd:e=>{const t=v.current;if(v.current=null,!t)return;const{value:n,rules:r,pending:l}=x.current;e.data?S(Fe(n,r,t.from,t.to,{text:e.data,add:l?.add,drop:l?.drop,color:l?.color}),[t.from,t.to],"type"):w(e=>e+1)},onCopy:e=>E(e),onCut:e=>E(e,!0),onPaste:l=>{if(l.preventDefault(),r)return;const o=C();if(!o)return;const a=l.clipboardData.getData(He),s=a?n?a:a.replace(/\s*\r?\n\s*/g," "):Ee({html:l.clipboardData.getData("text/html"),text:l.clipboardData.getData("text/plain")},{doc:l.currentTarget.ownerDocument,multiline:n,rules:t});S(Fe(e,t,o[0],o[1],{markup:s}),o,"edit")}})]})}var Ye=1e3;function Ze(e=200){let t=[],n=[],r=null,l=0;return{record(o,a,s){const i="type"===a&&"type"===r&&s-l<1e3;r=a,l=s,n=[],i||(t.push(o),t.length>e&&t.shift())},undo(e){const l=t.pop();return l?(n.push(e),r=null,l):null},redo(e){const l=n.pop();return l?(t.push(e),r=null,l):null},reset(){t=[],n=[],r=null}}}var Ge={fontSize:{key:"fontSize",nameKey:"fontSize",icon:/* @__PURE__ */de(Z,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */de(Y,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */de(V,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */de(q,{}),unit:"px",step:1,shiftStep:10,min:0}};function Je(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function Xe({cells:n,words:r,readOnly:l=!1}){const o=r??e.cells;/* @__PURE__ */
4
4
  return de("div",{className:"es-copy-cells",children:n.map(e=>{const n=e.scale??1,r=e.name??(e.nameKey?o[e.nameKey]:e.key),a=e.unit??"",s=e.step??1;/* @__PURE__ */
@@ -8,14 +8,14 @@ return he("div",{className:"es-copy-pop es-copy-colors",role:"dialog","aria-labe
8
8
  /* @__PURE__ */de("div",{className:"es-copy-theme",role:"group","aria-label":n.theme,children:e.map(e=>/* @__PURE__ */de(L,{content:`${e.label} · ${e.value.toUpperCase()}`,children:/* @__PURE__ */de(T,{color:e.value,size:"sm",className:"es-copy-theme-swatch","data-color":e.name,"aria-label":e.label,selected:t===e.name,onMouseDown:Qe,onClick:()=>r(e.name)})},e.name))}),
9
9
  /* @__PURE__ */de("span",{className:"es-copy-pop-label",children:n.any}),
10
10
  /* @__PURE__ */de(B,{className:"es-copy-any",value:l??"",onChange:e=>{e!==t&&r(e)},label:n.title,dragWrites:"end"}),
11
- /* @__PURE__ */de("div",{className:"es-copy-pop-foot",children:/* @__PURE__ */de(R,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onMouseDown:Qe,onClick:()=>r(null),children:n.remove})})]})}var et=e=>e.preventDefault();function tt(e,t,n){const r={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1,Home:"first",End:"last"}[e.key];if(void 0===r||0===t.length)return;const l=[...e.currentTarget.querySelectorAll('[role="radio"]')],o=l.findIndex(t=>t===e.target||t.contains(e.target));if(o<0)return;e.preventDefault();const a=l.length,s="first"===r?0:"last"===r?a-1:(o+r+a)%a;l[s].disabled||(n(t[s]),l[s].focus())}var nt=["bold","italic","underline","strike","link","sup","sub"],rt=["left","center","right","justify"],lt=e=>null!=e&&!1!==e;function ot({offered:e,color:t,last:n,alignment:r,list:l,letterCase:o}){const a=nt.filter(t=>e.has(t)).length+(t?1:0)+(lt(n)?1:0),s=(r?rt.filter(e=>r.allow.includes(e)).length:0)+(l&&e.has("bullet")?1:0)+(l&&e.has("number")?1:0)+(o?3:0);return{words:a>0,paragraph:s>0,oneRow:a>0&&s>0&&a+1+s<=9,flow:a>0&&s>0&&a+1+s>9&&a<=7}}function at({words:e,align:t,alignmentLabel:n,offered:r,pressed:l,onMark:o,color:a,linkOpen:s,last:i,alignment:c,list:u,letterCase:d,disabled:h=!1,ariaLabel:p="Formatting"}){const f=e=>"es-tb-cell es-tb-btn"+(e?" is-on":""),m=(e,t,n,a)=>r.has(e)?M(t,/* @__PURE__ */de(j,"link"===e?{pressed:Boolean(s),className:f(Boolean(s)),"aria-label":t,"aria-haspopup":"dialog","aria-expanded":s,"aria-keyshortcuts":a,disabled:h,onMouseDown:et,onClick:()=>o(e),children:n}:{className:"es-tb-cell es-tb-btn"+(l[e]?" is-on":""),"aria-label":t,"aria-pressed":Boolean(l[e]),"aria-keyshortcuts":a,disabled:h,onMouseDown:et,onClick:()=>o(e),children:n},e)):null,g=ot({offered:r,color:a,last:i,alignment:c,list:u,letterCase:d});if(!g.words&&!g.paragraph)return null;const b=[["left",/* @__PURE__ */de(U,{},"l")],["center",/* @__PURE__ */de(I,{},"c")],["right",/* @__PURE__ */de(A,{},"r")],["justify",/* @__PURE__ */de(H,{},"j")]],v=c?rt.filter(e=>c.allow.includes(e)):[],y=c&&v.includes(c.value)?c.value:v[0],k=[["none",e.caseNone,/* @__PURE__ */de(G,{},"n")],["upper",e.caseUpper,/* @__PURE__ */de(J,{},"u")],["lower",e.caseLower,/* @__PURE__ */de(X,{},"w")]],w=/* @__PURE__ */he(pe,{children:[m("bold",e.bold,/* @__PURE__ */de(ne,{}),"Meta+B"),m("italic",e.italic,/* @__PURE__ */de(re,{}),"Meta+I"),m("underline",e.underline,/* @__PURE__ */de(le,{}),"Meta+U"),m("strike",e.strike,/* @__PURE__ */de(oe,{})),a?M(e.color,/* @__PURE__ */de(j,{pressed:a.open,className:`${f(a.open)} es-tb-color`,"aria-label":e.color,"aria-haspopup":"dialog","aria-expanded":a.open,disabled:h,style:a.run?{"--es-tb-run":a.run}:void 0,onMouseDown:et,onClick:a.onToggle,children:/* @__PURE__ */de(Q,{})},"color")):null,m("link",e.link,/* @__PURE__ */de(ae,{}),"Meta+K"),m("sup",e.sup,/* @__PURE__ */de(se,{})),m("sub",e.sub,/* @__PURE__ */de(ie,{})),lt(i)?i:null]}),x=/* @__PURE__ */he(pe,{children:[c&&b.some(([e])=>c.allow.includes(e))?/* @__PURE__ */de("div",{className:"es-tb-group",role:"radiogroup","aria-label":n,onKeyDown:e=>tt(e,v,e=>c.onChange(e)),children:b.map(([e,n])=>c&&c.allow.includes(e)?M(t[e],/* @__PURE__ */de(j,{role:"radio",pressed:c.value===e,className:f(c.value===e),"aria-checked":c.value===e,"aria-label":t[e],tabIndex:e===y?0:-1,disabled:h||c.disabled,onMouseDown:et,onClick:()=>c.onChange(e),children:n},e)):null)}):null,u&&r.has("bullet")?M(e.bullet,/* @__PURE__ */de(j,{className:"es-tb-cell es-tb-btn"+("bullet"===u.pressed?" is-on":""),"aria-label":e.bullet,"aria-pressed":"bullet"===u.pressed,disabled:h,onMouseDown:et,onClick:()=>u.onList("bullet"),children:/* @__PURE__ */de(_,{})})):null,u&&r.has("number")?M(e.number,/* @__PURE__ */de(j,{className:"es-tb-cell es-tb-btn"+("number"===u.pressed?" is-on":""),"aria-label":e.number,"aria-pressed":"number"===u.pressed,disabled:h,onMouseDown:et,onClick:()=>u.onList("number"),children:/* @__PURE__ */de(ee,{})})):null,d?/* @__PURE__ */de("div",{className:"es-tb-group",role:"radiogroup","aria-label":e.letterCase,onKeyDown:e=>tt(e,k.map(([e])=>e),e=>d.onChange(e)),children:k.map(([e,t,n])=>M(t,/* @__PURE__ */de(j,{role:"radio",pressed:d.value===e,className:f(d.value===e),"aria-checked":d.value===e,"aria-label":t,tabIndex:e===(d.value||"none")?0:-1,disabled:h||d.disabled,onMouseDown:et,onClick:()=>d.onChange(d.value===e?"":e),children:n},e)))}):null]});return g.flow?/* @__PURE__ */de("div",{className:"es-tb",role:"toolbar","aria-label":p,children:/* @__PURE__ */he("div",{className:"es-tb-row is-flow",children:[w,
11
+ /* @__PURE__ */de("div",{className:"es-copy-pop-foot",children:/* @__PURE__ */de(R,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onMouseDown:Qe,onClick:()=>r(null),children:n.remove})})]})}var et=e=>e.preventDefault();function tt(e,t,n){const r={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1,Home:"first",End:"last"}[e.key];if(void 0===r||0===t.length)return;const l=[...e.currentTarget.querySelectorAll('[role="radio"]')],o=l.findIndex(t=>t===e.target||t.contains(e.target));if(o<0)return;e.preventDefault();const a=l.length,s="first"===r?0:"last"===r?a-1:(o+r+a)%a;l[s].disabled||(n(t[s]),l[s].focus())}var nt=["bold","italic","underline","strike","link","sup","sub"],rt=["left","center","right","justify"],lt=e=>null!=e&&!1!==e;function ot({offered:e,color:t,last:n,alignment:r,list:l,letterCase:o}){const a=nt.filter(t=>e.has(t)).length+(t?1:0)+(lt(n)?1:0),s=(r?rt.filter(e=>r.allow.includes(e)).length:0)+(l&&e.has("bullet")?1:0)+(l&&e.has("number")?1:0)+(o?3:0);return{words:a>0,paragraph:s>0,oneRow:a>0&&s>0&&a+1+s<=9,flow:a>0&&s>0&&a+1+s>9&&a<=7}}function at({words:e,align:t,alignmentLabel:n,offered:r,pressed:l,onMark:o,color:a,linkOpen:s,last:i,alignment:c,list:u,letterCase:d,disabled:h=!1,ariaLabel:p="Formatting"}){const f=e=>"es-tb-cell es-tb-btn"+(e?" is-on":""),m=(e,t,n,a)=>r.has(e)?N(t,/* @__PURE__ */de(j,"link"===e?{pressed:Boolean(s),className:f(Boolean(s)),"aria-label":t,"aria-haspopup":"dialog","aria-expanded":s,"aria-keyshortcuts":a,disabled:h,onMouseDown:et,onClick:()=>o(e),children:n}:{className:"es-tb-cell es-tb-btn"+(l[e]?" is-on":""),"aria-label":t,"aria-pressed":Boolean(l[e]),"aria-keyshortcuts":a,disabled:h,onMouseDown:et,onClick:()=>o(e),children:n},e)):null,g=ot({offered:r,color:a,last:i,alignment:c,list:u,letterCase:d});if(!g.words&&!g.paragraph)return null;const b=[["left",/* @__PURE__ */de(U,{},"l")],["center",/* @__PURE__ */de(I,{},"c")],["right",/* @__PURE__ */de(A,{},"r")],["justify",/* @__PURE__ */de(H,{},"j")]],v=c?rt.filter(e=>c.allow.includes(e)):[],y=c&&v.includes(c.value)?c.value:v[0],k=[["none",e.caseNone,/* @__PURE__ */de(G,{},"n")],["upper",e.caseUpper,/* @__PURE__ */de(J,{},"u")],["lower",e.caseLower,/* @__PURE__ */de(X,{},"w")]],w=/* @__PURE__ */he(pe,{children:[m("bold",e.bold,/* @__PURE__ */de(ne,{}),"Meta+B"),m("italic",e.italic,/* @__PURE__ */de(re,{}),"Meta+I"),m("underline",e.underline,/* @__PURE__ */de(le,{}),"Meta+U"),m("strike",e.strike,/* @__PURE__ */de(oe,{})),a?N(e.color,/* @__PURE__ */de(j,{pressed:a.open,className:`${f(a.open)} es-tb-color`,"aria-label":e.color,"aria-haspopup":"dialog","aria-expanded":a.open,disabled:h,style:a.run?{"--es-tb-run":a.run}:void 0,onMouseDown:et,onClick:a.onToggle,children:/* @__PURE__ */de(Q,{})},"color")):null,m("link",e.link,/* @__PURE__ */de(ae,{}),"Meta+K"),m("sup",e.sup,/* @__PURE__ */de(se,{})),m("sub",e.sub,/* @__PURE__ */de(ie,{})),lt(i)?i:null]}),x=/* @__PURE__ */he(pe,{children:[c&&b.some(([e])=>c.allow.includes(e))?/* @__PURE__ */de("div",{className:"es-tb-group",role:"radiogroup","aria-label":n,onKeyDown:e=>tt(e,v,e=>c.onChange(e)),children:b.map(([e,n])=>c&&c.allow.includes(e)?N(t[e],/* @__PURE__ */de(j,{role:"radio",pressed:c.value===e,className:f(c.value===e),"aria-checked":c.value===e,"aria-label":t[e],tabIndex:e===y?0:-1,disabled:h||c.disabled,onMouseDown:et,onClick:()=>c.onChange(e),children:n},e)):null)}):null,u&&r.has("bullet")?N(e.bullet,/* @__PURE__ */de(j,{className:"es-tb-cell es-tb-btn"+("bullet"===u.pressed?" is-on":""),"aria-label":e.bullet,"aria-pressed":"bullet"===u.pressed,disabled:h,onMouseDown:et,onClick:()=>u.onList("bullet"),children:/* @__PURE__ */de(_,{})})):null,u&&r.has("number")?N(e.number,/* @__PURE__ */de(j,{className:"es-tb-cell es-tb-btn"+("number"===u.pressed?" is-on":""),"aria-label":e.number,"aria-pressed":"number"===u.pressed,disabled:h,onMouseDown:et,onClick:()=>u.onList("number"),children:/* @__PURE__ */de(ee,{})})):null,d?/* @__PURE__ */de("div",{className:"es-tb-group",role:"radiogroup","aria-label":e.letterCase,onKeyDown:e=>tt(e,k.map(([e])=>e),e=>d.onChange(e)),children:k.map(([e,t,n])=>N(t,/* @__PURE__ */de(j,{role:"radio",pressed:d.value===e,className:f(d.value===e),"aria-checked":d.value===e,"aria-label":t,tabIndex:e===(d.value||"none")?0:-1,disabled:h||d.disabled,onMouseDown:et,onClick:()=>d.onChange(d.value===e?"":e),children:n},e)))}):null]});return g.flow?/* @__PURE__ */de("div",{className:"es-tb",role:"toolbar","aria-label":p,children:/* @__PURE__ */he("div",{className:"es-tb-row is-flow",children:[w,
12
12
  /* @__PURE__ */de("span",{className:"es-tb-flowgap","aria-hidden":"true"}),x]})}):g.oneRow?/* @__PURE__ */de("div",{className:"es-tb",role:"toolbar","aria-label":p,children:/* @__PURE__ */he("div",{className:"es-tb-row is-one-row",children:[
13
13
  /* @__PURE__ */de("div",{className:"es-tb-words",children:w}),
14
- /* @__PURE__ */de("div",{className:"es-tb-para",children:x})]})}):/* @__PURE__ */he("div",{className:"es-tb",role:"toolbar","aria-label":p,children:[g.words?/* @__PURE__ */de("div",{className:"es-tb-row"+(void 0===i?" is-eight":""),children:w}):null,g.paragraph?/* @__PURE__ */de("div",{className:"es-tb-row",children:x}):null]})}var st=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n));var it=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom});function ct(e){const t=e.ownerDocument,n=t.documentElement,r={left:0,top:0,right:n.clientWidth,bottom:n.clientHeight},l=t.defaultView?.getComputedStyle.bind(t.defaultView);for(let o=e.parentElement;o&&o!==n&&o!==t.body;o=o.parentElement){const e=l?.(o);if(!e||"visible"===e.overflowX&&"visible"===e.overflowY)continue;const t=o.getBoundingClientRect();if(0===t.width&&0===t.height)continue;const n=t.left+o.clientLeft,a=t.top+o.clientTop;r.left=Math.max(r.left,n),r.top=Math.max(r.top,a),r.right=Math.min(r.right,n+(o.clientWidth||t.width)),r.bottom=Math.min(r.bottom,a+(o.clientHeight||t.height))}return r}function ut(e){const t=e.offsetParent??e.parentElement;if(!t)return{left:0,top:0};const n=t.getBoundingClientRect();return{left:n.left+t.clientLeft-t.scrollLeft,top:n.top+t.clientTop-t.scrollTop}}var dt=/* @__PURE__ */new Set([...o,"clear"]),ht={bold:/* @__PURE__ */de(ne,{size:16}),italic:/* @__PURE__ */de(re,{size:16}),strike:/* @__PURE__ */de(oe,{size:16}),highlight:/* @__PURE__ */de(ue,{size:16}),quiet:/* @__PURE__ */de(ce,{size:16}),link:/* @__PURE__ */de(ae,{size:16}),clear:/* @__PURE__ */de(te,{size:16})};function pt(e){if(!e)return;const t=e.split("+"),n=t.pop().toUpperCase();return["Meta",...t.map(e=>e[0].toUpperCase()+e.slice(1)),n].join("+")}var ft={bold:"is-bold",italic:"is-italic",strike:"is-strike"};function mt({tools:t,onApply:n,disabled:r=!1,actions:l,align:o,glyphs:a,ariaLabel:s,pressed:i,open:c=null}){const u=N("copy",e),d=("string"==typeof t[0]?h(t).map(e=>({...e,...u.marks[e.style]})):t).filter(e=>!dt.has(e.style));return 0!==d.length||l||o?/* @__PURE__ */he("div",{className:"es-copy-bar",role:"group","aria-label":s??u.formatting,children:[d.map(e=>{const t=a?.[e.style]??ht[e.style],l=c===e.style||Boolean(i?.[e.style]),o="link"===e.style&&Boolean(i);return M(e.title,/* @__PURE__ */de(j,{onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.style),disabled:r,"aria-label":e.name??e.title,"aria-keyshortcuts":pt(e.shortcut),"aria-pressed":o||!i&&!c?void 0:l,pressed:o?l:void 0,"aria-haspopup":o?"dialog":void 0,"aria-expanded":o?"link"===c:void 0,className:`es-copy-mark${t?" has-glyph":ft[e.style]?` ${ft[e.style]}`:""}${l?" is-active":""}`,children:t??e.label},e.style))}),l?/* @__PURE__ */he(pe,{children:[
15
- /* @__PURE__ */de("span",{className:"es-copy-bar-split","aria-hidden":"true"}),l]}):null,o?/* @__PURE__ */de("span",{className:"es-copy-bar-end",children:o}):null]}):null}function gt({target:e,onChange:t}){const n=O(null);return K(()=>{const t=n.current,r=e.current;t&&r&&r.value===t.text&&(n.current=null,r.focus(),r.setSelectionRange(t.start,t.end))}),r=>{const l=r(e.current);t(l.text),n.current={start:l.selectionStart,end:l.selectionEnd,text:l.text}}}var bt=["bold","italic","underline","strike","sup","sub"];function vt({value:t,onChange:o,onCommit:i,onCancel:c,multiline:u=!1,placeholder:y,ariaLabel:L,className:T,readOnly:B=!1,rules:j,tools:H=[],writeMark:A,actions:I,align:U,glyphs:q,barLabel:V,renderFooter:Y,inputRef:Z,barShows:G="always",richText:J=!0,defaultShowMarks:X=!1,toolbar:Q="final",colors:_,cells:ee,letterCase:ne,lastTool:re}){const le="final"===Q,oe=N("copy",e),ae=O(null),se=Z??ae,[ie,ce]=F(!1),[ue,fe]=F(null),me=O(Ze()).current,ge=O(null);W(()=>{const e=ge.current;e&&t===e.to?ge.current=null:e&&t===e.from||(ge.current=null,me.reset())},[t,me]);const be=e=>{ge.current={from:ge.current?.from??t,to:e},o(e)},ye=e=>({text:t,start:e?.selectionStart??ue?.start??t.length,end:e?.selectionEnd??ue?.end??t.length}),[we,De]=F(X),Se=J&&!(u&&we),Ne=O(null),Me=$(),[Le,Te]=F(null),[Be,Re]=F(!1),je=()=>{if(!Se)return se.current;const e=Ne.current?.getSource()??ue;return e?{selectionStart:e.start,selectionEnd:e.end}:null},Pe=gt({target:se,onChange:be}),ze=e=>(fe({start:e.selectionStart,end:e.selectionEnd}),e),Oe=(e,n)=>{if(!Se)return void Pe(t=>(n&&me.record(ye(t),"edit",Date.now()),ze(e(t))));const r=je(),l=ze(e(r));n&&me.record(ye(r),"edit",Date.now()),Te(null),l.text!==t&&be(l.text),Ne.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},Fe=e=>Oe(e,!0),Ke=e=>Oe(t=>{const n=ye(t),r=me[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),We=O(null);K(()=>{const e=We.current;e&&(We.current=null,Se?Ne.current?.setSource(e.start,e.end,t):(se.current?.focus(),se.current?.setSelectionRange(e.start,e.end),fe(e)))},[Se]);const[$e,He]=F(null),Ae=j??s,Ie=("string"==typeof H[0]?h(H):H).filter(e=>!dt.has(e.style)),Ue=le?("string"==typeof H[0]?H:H.map(e=>e.style)).filter(e=>!dt.has(e)):Ie.map(e=>e.style),qe={};if(ue&&(Se||le)){const e=p(t,ue.start,ue.end,Ae);for(const t of Ue){const n=e.has(t)||"highlight"===t&&e.has("accent");qe[t]=!!Le?.add.includes(t)||!Le?.drop.includes(t)&&n}le&&(qe.link=e.has("link"))}else if(ue)for(const e of Ue)qe[e]="link"===e?null!==f(t,ue.start,ue.end):m(t,ue.start,ue.end,e);const Ye=()=>{const e=je(),n=e?.selectionStart??t.length;return{start:n,end:e?.selectionEnd??n}},Ge={sup:"sub",sub:"sup"},Je=e=>{if(le&&"link"!==e&&d(0,e)){const{start:n,end:r}=Ye(),l=Ge[e];if(n===r){if(!Se)return void Fe(n=>xe(t,e,n,(e,t,n,r)=>a(e,t,n,r,Ae,oe.placeholders)));const o=p(t,n,r,Ae),s=Le&&Le.at===n?Le:null,i=o.has(e),c=!!s?.add.includes(e)||!s?.drop.includes(e)&&i;let u=(s?.add??[]).filter(t=>t!==e),d=(s?.drop??[]).filter(t=>t!==e);return c&&i?d.push(e):c||i||u.push(e),!c&&l&&(u=u.filter(e=>e!==l),o.has(l)&&(d=[...d.filter(e=>e!==l),l])),void Te(u.length||d.length||void 0!==s?.color?{add:u,drop:d,color:s?.color,at:n}:null)}return void Fe(()=>{let o=t,a=n,s=r;if(l&&!p(o,a,s,Ae).has(e)&&p(o,a,s,Ae).has(l)){const e=k(o,a,s,l,Ae);({text:o,selectionStart:a,selectionEnd:s}=e)}return k(o,a,s,e,Ae)})}if("clear"===e)return void Fe(n=>xe(t,e,n,(e,t,n)=>a(e,t,n,"clear",Ae)));if("link"!==e&&Se&&d(0,e)){const n=je(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;if(r===l){const n=p(t,r,l,Ae),o=n.has(e)||"highlight"===e&&n.has("accent"),a=Le&&Le.at===r?Le:null,s=!!a?.add.includes(e)||!a?.drop.includes(e)&&o,i=(a?.add??[]).filter(t=>t!==e),c=(a?.drop??[]).filter(t=>t!==e);return s&&o?c.push(e):s||o||i.push(e),void Te(i.length||c.length?{add:i,drop:c,at:r}:null)}return void Fe(n=>k(t,n?.selectionStart??r,n?.selectionEnd??l,e,Ae))}if("link"!==e){const n=A??((e,t,n,r)=>a(e,t,n,r,s,oe.placeholders));return void Fe(r=>xe(t,e,r,n))}const n=je(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;Re(!1),He({start:r,end:l,link:f(t,r,l)})},Qe=Boolean(ue&&ue.start!==ue.end),et=ue?g(t,ue.start,ue.end,Ae):null,tt=ue?Le&&void 0!==Le.color&&Le.at===ue.start?Le.color:b(t,ue.start,ue.end,Ae):null,nt=tt?tt.startsWith("#")?tt:_?.find(e=>e.name===tt)?.value:void 0,rt=e=>{Se?e?Ne.current?.setSource(e.start,e.end,t):Ne.current?.focus():(se.current?.focus(),e&&se.current?.setSelectionRange(e.start,e.end))},lt=()=>{const e=$e;He(null),rt(e?{start:e.start,end:e.end}:ue)},ht=()=>{const e=ft.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));Re(!1),t&&rt(ue)},pt=O(ht);pt.current=ht,W(()=>{if(Be)return P(e=>{const t=ft.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(pt.current(),!0)},()=>ft.current?.querySelector(".es-copy-colors"))},[Be]);const ft=O(null),vt=Be||null!==$e;W(()=>{const e=ft.current;if(!vt||!e)return;const t=e.ownerDocument,n=()=>{Re(!1),He(null)},r=t=>{e.contains(t.target)||n()};let l;const o=r=>{const o=r.relatedTarget;o?e.contains(o)||n():(clearTimeout(l),l=setTimeout(()=>{const r=t.activeElement;t.hasFocus()&&r&&r!==t.body&&!e.contains(r)&&n()},0))};return t.addEventListener("pointerdown",r,!0),e.addEventListener("focusout",o),()=>{clearTimeout(l),t.removeEventListener("pointerdown",r,!0),e.removeEventListener("focusout",o)}},[vt]);const yt=$e??(Be?ue??{start:t.length,end:t.length}:null),kt=O(()=>{});kt.current=()=>{const e=ft.current,t=e?.querySelector(".es-tb-wrap > .es-copy-pop");if(!e||!t||!yt)return;const n=Se?null:e.querySelector(".es-gold-layer"),r=Se?Ne.current?.rangeOf(yt.start,yt.end)??null:n?function(e,t,n){const r=e.ownerDocument,l=r.createTreeWalker(e,4),o=e=>{let t=e,n=null;for(let e=l.nextNode();e;e=l.nextNode()){if(t<=e.data.length)return[e,t];t-=e.data.length,n=e}return n?[n,n.data.length]:null},a=o(t);l.currentNode=e;const s=o(n);if(!a||!s)return null;const i=r.createRange();return i.setStart(a[0],a[1]),i.setEnd(s[0],s[1]),i}(n,yt.start,yt.end):null,l=r?.endContainer,o=l?1===l.nodeType?l:l.parentElement:null,a=r?function(e,t){const n=("function"==typeof e.getClientRects?[...e.getClientRects()]:[]).filter(e=>e.height>0);if(n.length>0){const t="function"==typeof e.getBoundingClientRect?e.getBoundingClientRect():n[0];return t.height>0?it(t):it(n[0])}if(!t)return null;const r=t.getBoundingClientRect();return{left:r.left,top:r.top,right:r.left,bottom:r.bottom}}(r,o?.closest(".es-rich-line, .es-gold-layer")??null):null;if(!a)return;const s=function({anchor:e,size:t,within:n,clip:r,parent:l,gap:o=8}){const a=Math.max(n.left,r.left),s=Math.min(n.right,r.right)-t.width,i=st(e.left,a,s),c=r.bottom-(e.bottom+o),u=e.top-o-r.top,d=t.height>c&&(t.height<=u||u>c),h=d?e.top-o-t.height:e.bottom+o,p=e.left+Math.min((e.right-e.left)/2,10),f=st(p-5-i,10,t.width-10-10);return{top:h-l.top,left:i-l.left,above:d,point:f}}({anchor:a,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:ct(e),parent:ut(t)});t.style.top=`${s.top}px`,t.style.left=`${s.left}px`,t.style.setProperty("--es-pop-point",`${s.point}px`),t.dataset.side=s.above?"above":"below"},K(()=>{const e=ft.current;if(!vt||!e)return;const t=()=>kt.current();t();const n=e.ownerDocument.defaultView;n?.addEventListener("resize",t);const r=e.querySelector(".es-tb-wrap > .es-copy-pop"),l=n?.ResizeObserver,o=l&&r?new l(t):null;return o&&r&&o.observe(r),()=>{n?.removeEventListener("resize",t),o?.disconnect()}},[vt,Be,$e,yt?.start,yt?.end,Se]);const wt=e=>$e&&/* @__PURE__ */de(z,{className:e?"es-copy-link es-copy-pop":"es-copy-link",value:$e.link?.href??"",onApply:e=>{const n=$e;He(null),Fe(()=>Se?S(t,n.start,n.end,e,Ae):E(t,n.start,n.end,e))},onRemove:$e.link?()=>{const e=$e.link,n=$e;He(null),e&&Fe(()=>Se?C(t,n.start,n.end,Ae):D(t,e))}:void 0,onCancel:lt}),xt=U?ve(U.allow,oe.align):[],Ct="always"===G||ie||null!==$e||Be,Dt=_&&_.length>0?{run:nt,open:Be,onToggle:()=>{He(null),Be?ht():Re(!0)}}:void 0,St=Ct&&le&&re?re({className:"es-tb-cell es-tb-btn",disabled:B,selected:Qe,keepCaret:e=>e.preventDefault(),insert:e=>Fe(n=>Ce(t,e,n))}):void 0,Et=new Set(Ue),Nt=U?{value:U.value,allow:U.allow,onChange:U.onChange,disabled:U.disabled}:void 0,Mt={pressed:et,onList:e=>{const{start:n,end:r}=Ye(),l=g(t,n,r,Ae);Fe(()=>x(t,n,r,l===e?null:e,Ae))}},Lt=ot({offered:Et,color:Dt,last:St,alignment:Nt,list:Mt,letterCase:ne}),Tt=function(e,t){const n=["bold","italic","underline","strike"].filter(t=>e.has(t)).length;return{color:n,link:n+(t?1:0)}}(Et,Boolean(Dt)),Bt=le&&Ct&&(bt.some(e=>Et.has(e))||Boolean(Dt));/* @__PURE__ */
14
+ /* @__PURE__ */de("div",{className:"es-tb-para",children:x})]})}):/* @__PURE__ */he("div",{className:"es-tb",role:"toolbar","aria-label":p,children:[g.words?/* @__PURE__ */de("div",{className:"es-tb-row"+(void 0===i?" is-eight":""),children:w}):null,g.paragraph?/* @__PURE__ */de("div",{className:"es-tb-row",children:x}):null]})}var st=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n));var it=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom});function ct(e){const t=e.ownerDocument,n=t.documentElement,r={left:0,top:0,right:n.clientWidth,bottom:n.clientHeight},l=t.defaultView?.getComputedStyle.bind(t.defaultView);for(let o=e.parentElement;o&&o!==n&&o!==t.body;o=o.parentElement){const e=l?.(o);if(!e||"visible"===e.overflowX&&"visible"===e.overflowY)continue;const t=o.getBoundingClientRect();if(0===t.width&&0===t.height)continue;const n=t.left+o.clientLeft,a=t.top+o.clientTop;r.left=Math.max(r.left,n),r.top=Math.max(r.top,a),r.right=Math.min(r.right,n+(o.clientWidth||t.width)),r.bottom=Math.min(r.bottom,a+(o.clientHeight||t.height))}return r}function ut(e){const t=e.offsetParent??e.parentElement;if(!t)return{left:0,top:0};const n=t.getBoundingClientRect();return{left:n.left+t.clientLeft-t.scrollLeft,top:n.top+t.clientTop-t.scrollTop}}var dt=/* @__PURE__ */new Set([...o,"clear"]),ht={bold:/* @__PURE__ */de(ne,{size:16}),italic:/* @__PURE__ */de(re,{size:16}),strike:/* @__PURE__ */de(oe,{size:16}),highlight:/* @__PURE__ */de(ue,{size:16}),quiet:/* @__PURE__ */de(ce,{size:16}),link:/* @__PURE__ */de(ae,{size:16}),clear:/* @__PURE__ */de(te,{size:16})};function pt(e){if(!e)return;const t=e.split("+"),n=t.pop().toUpperCase();return["Meta",...t.map(e=>e[0].toUpperCase()+e.slice(1)),n].join("+")}var ft={bold:"is-bold",italic:"is-italic",strike:"is-strike"};function mt({tools:t,onApply:n,disabled:r=!1,actions:l,align:o,glyphs:a,ariaLabel:s,pressed:i,open:c=null}){const u=M("copy",e),d=("string"==typeof t[0]?h(t).map(e=>({...e,...u.marks[e.style]})):t).filter(e=>!dt.has(e.style));return 0!==d.length||l||o?/* @__PURE__ */he("div",{className:"es-copy-bar",role:"group","aria-label":s??u.formatting,children:[d.map(e=>{const t=a?.[e.style]??ht[e.style],l=c===e.style||Boolean(i?.[e.style]),o="link"===e.style&&Boolean(i);return N(e.title,/* @__PURE__ */de(j,{onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.style),disabled:r,"aria-label":e.name??e.title,"aria-keyshortcuts":pt(e.shortcut),"aria-pressed":o||!i&&!c?void 0:l,pressed:o?l:void 0,"aria-haspopup":o?"dialog":void 0,"aria-expanded":o?"link"===c:void 0,className:`es-copy-mark${t?" has-glyph":ft[e.style]?` ${ft[e.style]}`:""}${l?" is-active":""}`,children:t??e.label},e.style))}),l?/* @__PURE__ */he(pe,{children:[
15
+ /* @__PURE__ */de("span",{className:"es-copy-bar-split","aria-hidden":"true"}),l]}):null,o?/* @__PURE__ */de("span",{className:"es-copy-bar-end",children:o}):null]}):null}function gt({target:e,onChange:t}){const n=O(null);return K(()=>{const t=n.current,r=e.current;t&&r&&r.value===t.text&&(n.current=null,r.focus(),r.setSelectionRange(t.start,t.end))}),r=>{const l=r(e.current);t(l.text),n.current={start:l.selectionStart,end:l.selectionEnd,text:l.text}}}var bt=["bold","italic","underline","strike","sup","sub"];function vt({value:t,onChange:o,onCommit:i,onCancel:c,multiline:u=!1,placeholder:y,ariaLabel:L,className:T,readOnly:B=!1,rules:j,tools:H=[],writeMark:A,actions:I,align:U,glyphs:q,barLabel:V,renderFooter:Y,inputRef:Z,barShows:G="always",richText:J=!0,defaultShowMarks:X=!1,toolbar:Q="final",colors:_,cells:ee,letterCase:ne,lastTool:re}){const le="final"===Q,oe=M("copy",e),ae=O(null),se=Z??ae,[ie,ce]=F(!1),[ue,fe]=F(null),me=O(Ze()).current,ge=O(null);W(()=>{const e=ge.current;e&&t===e.to?ge.current=null:e&&t===e.from||(ge.current=null,me.reset())},[t,me]);const be=e=>{ge.current={from:ge.current?.from??t,to:e},o(e)},ye=e=>({text:t,start:e?.selectionStart??ue?.start??t.length,end:e?.selectionEnd??ue?.end??t.length}),[we,De]=F(X),Se=J&&!(u&&we),Ne=O(null),Me=$(),[Le,Te]=F(null),[Be,Re]=F(!1),je=()=>{if(!Se)return se.current;const e=Ne.current?.getSource()??ue;return e?{selectionStart:e.start,selectionEnd:e.end}:null},Pe=gt({target:se,onChange:be}),ze=e=>(fe({start:e.selectionStart,end:e.selectionEnd}),e),Oe=(e,n)=>{if(!Se)return void Pe(t=>(n&&me.record(ye(t),"edit",Date.now()),ze(e(t))));const r=je(),l=ze(e(r));n&&me.record(ye(r),"edit",Date.now()),Te(null),l.text!==t&&be(l.text),Ne.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},Fe=e=>Oe(e,!0),Ke=e=>Oe(t=>{const n=ye(t),r=me[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),We=O(null);K(()=>{const e=We.current;e&&(We.current=null,Se?Ne.current?.setSource(e.start,e.end,t):(se.current?.focus(),se.current?.setSelectionRange(e.start,e.end),fe(e)))},[Se]);const[$e,He]=F(null),Ae=j??s,Ie=("string"==typeof H[0]?h(H):H).filter(e=>!dt.has(e.style)),Ue=le?("string"==typeof H[0]?H:H.map(e=>e.style)).filter(e=>!dt.has(e)):Ie.map(e=>e.style),qe={};if(ue&&(Se||le)){const e=p(t,ue.start,ue.end,Ae);for(const t of Ue){const n=e.has(t)||"highlight"===t&&e.has("accent");qe[t]=!!Le?.add.includes(t)||!Le?.drop.includes(t)&&n}le&&(qe.link=e.has("link"))}else if(ue)for(const e of Ue)qe[e]="link"===e?null!==f(t,ue.start,ue.end):m(t,ue.start,ue.end,e);const Ye=()=>{const e=je(),n=e?.selectionStart??t.length;return{start:n,end:e?.selectionEnd??n}},Ge={sup:"sub",sub:"sup"},Je=e=>{if(le&&"link"!==e&&d(0,e)){const{start:n,end:r}=Ye(),l=Ge[e];if(n===r){if(!Se)return void Fe(n=>xe(t,e,n,(e,t,n,r)=>a(e,t,n,r,Ae,oe.placeholders)));const o=p(t,n,r,Ae),s=Le&&Le.at===n?Le:null,i=o.has(e),c=!!s?.add.includes(e)||!s?.drop.includes(e)&&i;let u=(s?.add??[]).filter(t=>t!==e),d=(s?.drop??[]).filter(t=>t!==e);return c&&i?d.push(e):c||i||u.push(e),!c&&l&&(u=u.filter(e=>e!==l),o.has(l)&&(d=[...d.filter(e=>e!==l),l])),void Te(u.length||d.length||void 0!==s?.color?{add:u,drop:d,color:s?.color,at:n}:null)}return void Fe(()=>{let o=t,a=n,s=r;if(l&&!p(o,a,s,Ae).has(e)&&p(o,a,s,Ae).has(l)){const e=k(o,a,s,l,Ae);({text:o,selectionStart:a,selectionEnd:s}=e)}return k(o,a,s,e,Ae)})}if("clear"===e)return void Fe(n=>xe(t,e,n,(e,t,n)=>a(e,t,n,"clear",Ae)));if("link"!==e&&Se&&d(0,e)){const n=je(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;if(r===l){const n=p(t,r,l,Ae),o=n.has(e)||"highlight"===e&&n.has("accent"),a=Le&&Le.at===r?Le:null,s=!!a?.add.includes(e)||!a?.drop.includes(e)&&o,i=(a?.add??[]).filter(t=>t!==e),c=(a?.drop??[]).filter(t=>t!==e);return s&&o?c.push(e):s||o||i.push(e),void Te(i.length||c.length?{add:i,drop:c,at:r}:null)}return void Fe(n=>k(t,n?.selectionStart??r,n?.selectionEnd??l,e,Ae))}if("link"!==e){const n=A??((e,t,n,r)=>a(e,t,n,r,s,oe.placeholders));return void Fe(r=>xe(t,e,r,n))}const n=je(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;Re(!1),He({start:r,end:l,link:f(t,r,l)})},Qe=Boolean(ue&&ue.start!==ue.end),et=ue?g(t,ue.start,ue.end,Ae):null,tt=ue?Le&&void 0!==Le.color&&Le.at===ue.start?Le.color:b(t,ue.start,ue.end,Ae):null,nt=tt?tt.startsWith("#")?tt:_?.find(e=>e.name===tt)?.value:void 0,rt=e=>{Se?e?Ne.current?.setSource(e.start,e.end,t):Ne.current?.focus():(se.current?.focus(),e&&se.current?.setSelectionRange(e.start,e.end))},lt=()=>{const e=$e;He(null),rt(e?{start:e.start,end:e.end}:ue)},ht=()=>{const e=ft.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));Re(!1),t&&rt(ue)},pt=O(ht);pt.current=ht,W(()=>{if(Be)return P(e=>{const t=ft.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(pt.current(),!0)},()=>ft.current?.querySelector(".es-copy-colors"))},[Be]);const ft=O(null),vt=Be||null!==$e;W(()=>{const e=ft.current;if(!vt||!e)return;const t=e.ownerDocument,n=()=>{Re(!1),He(null)},r=t=>{e.contains(t.target)||n()};let l;const o=r=>{const o=r.relatedTarget;o?e.contains(o)||n():(clearTimeout(l),l=setTimeout(()=>{const r=t.activeElement;t.hasFocus()&&r&&r!==t.body&&!e.contains(r)&&n()},0))};return t.addEventListener("pointerdown",r,!0),e.addEventListener("focusout",o),()=>{clearTimeout(l),t.removeEventListener("pointerdown",r,!0),e.removeEventListener("focusout",o)}},[vt]);const yt=$e??(Be?ue??{start:t.length,end:t.length}:null),kt=O(()=>{});kt.current=()=>{const e=ft.current,t=e?.querySelector(".es-tb-wrap > .es-copy-pop");if(!e||!t||!yt)return;const n=Se?null:e.querySelector(".es-gold-layer"),r=Se?Ne.current?.rangeOf(yt.start,yt.end)??null:n?function(e,t,n){const r=e.ownerDocument,l=r.createTreeWalker(e,4),o=e=>{let t=e,n=null;for(let e=l.nextNode();e;e=l.nextNode()){if(t<=e.data.length)return[e,t];t-=e.data.length,n=e}return n?[n,n.data.length]:null},a=o(t);l.currentNode=e;const s=o(n);if(!a||!s)return null;const i=r.createRange();return i.setStart(a[0],a[1]),i.setEnd(s[0],s[1]),i}(n,yt.start,yt.end):null,l=r?.endContainer,o=l?1===l.nodeType?l:l.parentElement:null,a=r?function(e,t){const n=("function"==typeof e.getClientRects?[...e.getClientRects()]:[]).filter(e=>e.height>0);if(n.length>0){const t="function"==typeof e.getBoundingClientRect?e.getBoundingClientRect():n[0];return t.height>0?it(t):it(n[0])}if(!t)return null;const r=t.getBoundingClientRect();return{left:r.left,top:r.top,right:r.left,bottom:r.bottom}}(r,o?.closest(".es-rich-line, .es-gold-layer")??null):null;if(!a)return;const s=function({anchor:e,size:t,within:n,clip:r,parent:l,gap:o=8}){const a=Math.max(n.left,r.left),s=Math.min(n.right,r.right)-t.width,i=st(e.left,a,s),c=r.bottom-(e.bottom+o),u=e.top-o-r.top,d=t.height>c&&(t.height<=u||u>c),h=d?e.top-o-t.height:e.bottom+o,p=e.left+Math.min((e.right-e.left)/2,10),f=st(p-5-i,10,t.width-10-10);return{top:h-l.top,left:i-l.left,above:d,point:f}}({anchor:a,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:ct(e),parent:ut(t)});t.style.top=`${s.top}px`,t.style.left=`${s.left}px`,t.style.setProperty("--es-pop-point",`${s.point}px`),t.dataset.side=s.above?"above":"below"},K(()=>{const e=ft.current;if(!vt||!e)return;const t=()=>kt.current();t();const n=e.ownerDocument.defaultView;n?.addEventListener("resize",t);const r=e.querySelector(".es-tb-wrap > .es-copy-pop"),l=n?.ResizeObserver,o=l&&r?new l(t):null;return o&&r&&o.observe(r),()=>{n?.removeEventListener("resize",t),o?.disconnect()}},[vt,Be,$e,yt?.start,yt?.end,Se]);const wt=e=>$e&&/* @__PURE__ */de(z,{className:e?"es-copy-link es-copy-pop":"es-copy-link",value:$e.link?.href??"",onApply:e=>{const n=$e;He(null),Fe(()=>Se?S(t,n.start,n.end,e,Ae):E(t,n.start,n.end,e))},onRemove:$e.link?()=>{const e=$e.link,n=$e;He(null),e&&Fe(()=>Se?C(t,n.start,n.end,Ae):D(t,e))}:void 0,onCancel:lt}),xt=U?ve(U.allow,oe.align):[],Ct="always"===G||ie||null!==$e||Be,Dt=_&&_.length>0?{run:nt,open:Be,onToggle:()=>{He(null),Be?ht():Re(!0)}}:void 0,St=Ct&&le&&re?re({className:"es-tb-cell es-tb-btn",disabled:B,selected:Qe,keepCaret:e=>e.preventDefault(),insert:e=>Fe(n=>Ce(t,e,n))}):void 0,Et=new Set(Ue),Nt=U?{value:U.value,allow:U.allow,onChange:U.onChange,disabled:U.disabled}:void 0,Mt={pressed:et,onList:e=>{const{start:n,end:r}=Ye(),l=g(t,n,r,Ae);Fe(()=>x(t,n,r,l===e?null:e,Ae))}},Lt=ot({offered:Et,color:Dt,last:St,alignment:Nt,list:Mt,letterCase:ne}),Tt=function(e,t){const n=["bold","italic","underline","strike"].filter(t=>e.has(t)).length;return{color:n,link:n+(t?1:0)}}(Et,Boolean(Dt)),Bt=le&&Ct&&(bt.some(e=>Et.has(e))||Boolean(Dt));/* @__PURE__ */
16
16
  return he("div",{ref:ft,className:"es-copy"+(T?` ${T}`:""),onFocus:()=>ce(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||ce(!1)},onKeyDown:e=>{const t=e.target===se.current||Boolean(e.target.closest?.(".es-rich"));if(B||!t)return;if(e.altKey||e.metaKey===e.ctrlKey)return;const n=e.key.toLowerCase(),r="KeyZ"===e.code||"z"===n,l=("KeyY"===e.code||"y"===n)&&!e.shiftKey;if(r||l)return e.preventDefault(),e.stopPropagation(),void Ke(l||e.shiftKey?"redo":"undo");const o=`${e.shiftKey?"shift+":""}${n}`;if(le){const t={b:"bold",i:"italic",u:"underline",k:"link"}[o];if(!t||!Ue.includes(t))return;return e.preventDefault(),e.stopPropagation(),void Je(t)}const a=Ie.find(e=>e.shortcut===o);a&&(e.preventDefault(),e.stopPropagation(),Je(a.style))},onPaste:e=>{const n=se.current;if(B||!n||e.target!==n)return;e.preventDefault();const r=Ee({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:u,rules:Ae});Fe(e=>Ce(t,r,e))},style:_&&_.length>0?Object.fromEntries(_.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const e=se.current;e&&e.ownerDocument.activeElement===e&&fe({start:e.selectionStart??t.length,end:e.selectionEnd??t.length})},children:[Ct&&le&&(Lt.words||Lt.paragraph)?/* @__PURE__ */he("div",{className:"es-tb-wrap"+(Lt.oneRow?" is-one-row":Lt.flow?" is-flow":re?"":" is-eight"),style:{"--es-tb-color-col":Tt.color,"--es-tb-link-col":Tt.link},children:[
17
17
  /* @__PURE__ */de(at,{words:oe.toolbar??e.toolbar,align:oe.align,alignmentLabel:oe.alignment,ariaLabel:V??oe.formatting,offered:Et,pressed:qe,onMark:e=>Je(e),color:Dt,linkOpen:null!==$e,last:St,alignment:Nt,list:Mt,letterCase:ne,disabled:B}),Be&&_&&_.length>0?/* @__PURE__ */de(_e,{colors:_,current:tt,words:oe.colors??e.colors,onPick:e=>{const{start:n,end:r}=Ye();if(n!==r)Fe(()=>w(t,n,r,e,Ae));else{if(!Se)return;Te({add:Le?.add??[],drop:Le?.drop??[],color:e,at:n})}}}):null,$e?wt(!0):null]}):null,le&&ee&&ee.length>0?/* @__PURE__ */de(Xe,{cells:ee,words:oe.cells??e.cells,readOnly:B}):null,Ct&&!le?/* @__PURE__ */de(mt,{tools:H,disabled:B,actions:I,glyphs:q,ariaLabel:V,pressed:qe,open:$e?"link":null,onApply:Je,align:U?/* @__PURE__ */de(n,{options:xt,value:U.value,onChange:U.onChange,ariaLabel:oe.alignment,disabled:B||U.disabled,fit:ke(xt)}):null}):null,Se?/* @__PURE__ */de(Ve,{value:t,rules:Ae,multiline:u,readOnly:B,placeholder:y,ariaLabel:L,handle:Ne,pending:Le??void 0,onEdit:(e,n,r)=>{me.record({text:t,start:n.start,end:n.end},r,Date.now()),Te(null),be(e)},onSelect:e=>{fe(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Le||e.start===Le.at&&e.end===Le.at||Te(null)},onHistory:Ke,onFormat:e=>{Ue.includes(e)&&Je(e)},onCommit:i,onCancel:c}):/* @__PURE__ */de(l,{value:t,onInput:e=>{me.record(ye(null),"type",Date.now()),be(e)},onCommit:i,onCancel:c,multiline:u,placeholder:y,ariaLabel:L,rules:j,disabled:B,inputRef:se,className:"es-copy-box"}),$e&&!le?wt(!1):null,Y?Y({focused:ie,insert:e=>Fe(n=>Ce(t,e,n))}):null,J&&u||Bt?
18
18
  /* @__PURE__ */he("div",{className:"es-copy-marks",children:[J&&u?/* @__PURE__ */he(pe,{children:[
19
19
  /* @__PURE__ */de(r,{checked:we,onChange:()=>{const e=je();We.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:ue,Te(null),De(e=>!e)},ariaLabelledBy:Me,disabled:B}),
20
- /* @__PURE__ */de("span",{id:Me,className:"es-copy-marks-label",children:oe.showMarks??"Show marks"})]}):null,Bt?M(Qe?void 0:oe.clearStyleEmpty??"Select words first",/* @__PURE__ */he(R,{variant:"secondary",size:"sm",className:"es-copy-clear",disabled:B||!Qe,onMouseDown:e=>e.preventDefault(),onClick:()=>{const{start:e,end:n}=Ye();if(e===n)return;const r=v(t,e,n,Ae);r.text!==t&&Fe(()=>r)},children:[
20
+ /* @__PURE__ */de("span",{id:Me,className:"es-copy-marks-label",children:oe.showMarks??"Show marks"})]}):null,Bt?N(Qe?void 0:oe.clearStyleEmpty??"Select words first",/* @__PURE__ */he(R,{variant:"secondary",size:"sm",className:"es-copy-clear",disabled:B||!Qe,onMouseDown:e=>e.preventDefault(),onClick:()=>{const{start:e,end:n}=Ye();if(e===n)return;const r=v(t,e,n,Ae);r.text!==t&&Fe(()=>r)},children:[
21
21
  /* @__PURE__ */de(te,{size:16}),oe.clearStyle??"Clear style"]})):null]}):null]})}export{fe as COPY_ALIGNS,be as COPY_ALIGN_FIT,ge as COPY_ALIGN_GLYPHS,me as COPY_ALIGN_LABELS,Ge as COPY_CELLS,_e as ColorWindow,vt as CopyBox,Xe as CopyCells,He as MARKUP_CLIPBOARD_TYPE,mt as MarkBar,Ve as RichBox,Ye as TYPING_BURST_MS,at as TextToolbar,pt as ariaShortcut,ve as copyAlignOptions,Ze as createHistory,Fe as editVisible,Ce as insertSelection,xe as markSelection,$e as markupOfRange,Ke as newLine,Ee as pasteToMarkup,Le as richLayout,ze as selectionToSource,Pe as selectionToVisible,We as setBullet,Be as toSource,Re as toSourceStart,je as toVisible,gt as useCaretEdit};
@@ -1 +1 @@
1
- export{AddPanel,CanvasDragLayer,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-37DMJPHL.js";import"../chunk-O2NLQBFX.js";export{AUTO_SCROLL_EDGE,AUTO_SCROLL_MAX_SPEED,autoScrollDelta,autoScrollSpeed,createDragSession,dropEffectFor,dropOnRow,frameScrollBox,gapToMoveIndex,isNoOpDrop,scrollBoxOf,scrollParent,startAutoScroll,stepGap,useTreeDrag}from"../chunk-67GNT6PF.js";import"../chunk-PAELDYYS.js";import"../chunk-ZNCEOSXO.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
1
+ export{AddPanel,CanvasDragLayer,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-KEHLCWTG.js";import"../chunk-O2NLQBFX.js";export{AUTO_SCROLL_EDGE,AUTO_SCROLL_MAX_SPEED,autoScrollDelta,autoScrollSpeed,createDragSession,dropEffectFor,dropOnRow,frameScrollBox,gapToMoveIndex,isNoOpDrop,scrollBoxOf,scrollParent,startAutoScroll,stepGap,useTreeDrag}from"../chunk-67GNT6PF.js";import"../chunk-PAELDYYS.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";import"../chunk-ZNCEOSXO.js";
@@ -1 +1 @@
1
- export{CanvasFrame,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,bindUndoKeys,createEasel,createUseEasel,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useSelectedFields,validSelection}from"../chunk-XW4AV5N4.js";import"../chunk-AELNNAFM.js";import"../chunk-YRLPFZW3.js";import"../chunk-UK2FQOUT.js";import"../chunk-MFIRYGHW.js";import"../chunk-ZNCEOSXO.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
1
+ export{CanvasFrame,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,bindUndoKeys,createEasel,createUseEasel,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useSelectedFields,validSelection}from"../chunk-FUOZKV7A.js";import"../chunk-AELNNAFM.js";import"../chunk-YRLPFZW3.js";import"../chunk-UK2FQOUT.js";import"../chunk-MFIRYGHW.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";import"../chunk-ZNCEOSXO.js";
@@ -1 +1 @@
1
- export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-CRWFB7MU.js";export{FieldSelect,FieldSlider,optionFor}from"../chunk-OZ72A6MY.js";import"../chunk-4JSBIW5H.js";import"../chunk-3ZJSLHHI.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";export{useResolvedFields}from"../chunk-YRLPFZW3.js";import"../chunk-EA2HTX37.js";export{FieldNumber}from"../chunk-66LWADFP.js";import"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import"../chunk-MFIRYGHW.js";import"../chunk-67GNT6PF.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
1
+ export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-7EWFXVDJ.js";export{FieldSelect,FieldSlider,optionFor}from"../chunk-OZ72A6MY.js";import"../chunk-4JSBIW5H.js";import"../chunk-3ZJSLHHI.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-EA2HTX37.js";export{FieldNumber}from"../chunk-66LWADFP.js";import"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import"../chunk-67GNT6PF.js";import"../chunk-P2VEMZH5.js";export{useResolvedFields}from"../chunk-YRLPFZW3.js";import"../chunk-MFIRYGHW.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -605,6 +605,9 @@
605
605
  color: var(--es-text);
606
606
  background: var(--es-hover);
607
607
  border-radius: var(--es-row-radius);
608
+ /* A menu row tall (Lewis's row heights, 2026-10-12): 36, whatever the
609
+ words' line height. */
610
+ min-height: var(--row-height-menu, 36px);
608
611
  /* Its words start where a tree row's do: the shell's `TreeRow` pads `px-2`,
609
612
  two of the shell's `--spacing` steps, and so does this (the Layers panel
610
613
  drew a heading at 12px over rows at 8px: two text columns). */
@@ -752,7 +755,7 @@ button.es-group-head:hover { background: var(--es-chip-bg); }
752
755
 
753
756
  .es-field-label {
754
757
  font-size: 11px;
755
- font-weight: 600;
758
+ font-weight: 500;
756
759
  color: var(--es-muted);
757
760
  }
758
761
 
@@ -1 +1 @@
1
- export{AddBlockRow as default}from"../../chunk-UQ6CD3K2.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-KSTX646X.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-MCHMF32I.js";import"../../chunk-XW4AV5N4.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{AddBlockRow as default}from"../../chunk-R5GKLOIP.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-3FZAGTQE.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-MCHMF32I.js";import"../../chunk-7EWFXVDJ.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-EA2HTX37.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-FUOZKV7A.js";import"../../chunk-AELNNAFM.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import"../../chunk-ZNCEOSXO.js";
@@ -1 +1 @@
1
- export{blockKey,AddSidePanel as default,sectionKey,templateKey}from"../../chunk-3GX7XBAF.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-KSTX646X.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-MCHMF32I.js";import"../../chunk-XW4AV5N4.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-37DMJPHL.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{blockKey,AddSidePanel as default,sectionKey,templateKey}from"../../chunk-PCMGFPFU.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-3FZAGTQE.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-MCHMF32I.js";import"../../chunk-7EWFXVDJ.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-KEHLCWTG.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-FUOZKV7A.js";import"../../chunk-AELNNAFM.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import"../../chunk-ZNCEOSXO.js";