efficient-easel 10.3.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +11 -6
  2. package/dist/{chunk-FCLW4LEN.js → chunk-47RGVCPH.js} +7 -7
  3. package/dist/{chunk-YMEN4KVE.js → chunk-6FFSDH62.js} +1 -1
  4. package/dist/chunk-77DQCEEF.js +5 -0
  5. package/dist/chunk-7LP3OD2E.js +56 -0
  6. package/dist/{chunk-P4CL4YQI.js → chunk-AFSSKGTD.js} +1 -1
  7. package/dist/{chunk-74ZFATLG.js → chunk-BGY4Q2SL.js} +1 -1
  8. package/dist/{chunk-OGCROOTI.js → chunk-DGAXQTDW.js} +1 -1
  9. package/dist/{chunk-JSPZU7X2.js → chunk-FAAZZXIS.js} +1 -1
  10. package/dist/chunk-GCCBEY2W.js +2 -0
  11. package/dist/chunk-GG4FGBFR.js +1 -0
  12. package/dist/{chunk-ERA3XM2U.js → chunk-GJC6SNQC.js} +1 -1
  13. package/dist/{chunk-BRDCD4LK.js → chunk-IFS5P7CO.js} +1 -1
  14. package/dist/{chunk-A5OEGP7B.js → chunk-ISZI4T6A.js} +4 -4
  15. package/dist/{chunk-IZ2QRXSE.js → chunk-JTOZJXD7.js} +1 -1
  16. package/dist/{chunk-M32O2WRM.js → chunk-PE6ZY5IW.js} +11 -11
  17. package/dist/chunk-PPHUWGLZ.js +1 -0
  18. package/dist/{chunk-TROOTMAD.js → chunk-PZHQVOTU.js} +1 -1
  19. package/dist/chunk-QOYOE5CU.js +1 -0
  20. package/dist/{chunk-IL6QCPO6.js → chunk-TJ6NRHYF.js} +1 -1
  21. package/dist/chunk-VWXUMVCD.js +1 -0
  22. package/dist/chunk-XZDHQ4DN.js +5 -0
  23. package/dist/copy/index.js +12 -12
  24. package/dist/drag/drag.css +11 -1
  25. package/dist/drag/index.d.ts +9 -3
  26. package/dist/drag/index.js +1 -1
  27. package/dist/easel/index.js +1 -1
  28. package/dist/screen/components/AddBlockRow.js +1 -1
  29. package/dist/screen/components/AddChildRow.js +4 -1
  30. package/dist/screen/components/AddSidePanel.d.ts +13 -17
  31. package/dist/screen/components/AddSidePanel.js +1 -1
  32. package/dist/screen/components/MediaSidePanel.js +1 -1
  33. package/dist/screen/components/NodeContextMenu.d.ts +3 -15
  34. package/dist/screen/components/NodeContextMenu.js +1 -1
  35. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  36. package/dist/screen/components/ScreenChrome.js +1 -1
  37. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  38. package/dist/screen/components/ScreenMount.js +1 -1
  39. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  40. package/dist/screen/components/SectionScreenShell.js +16 -16
  41. package/dist/screen/components/usePartBridge.js +1 -1
  42. package/dist/screen/index.d.ts +1 -1
  43. package/dist/screen/index.js +1 -1
  44. package/dist/screen/lib/key-scope.js +1 -1
  45. package/dist/screen/lib/puck/device-fields.js +1 -1
  46. package/dist/screen/lib/puck/style-clipboard.js +1 -1
  47. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  48. package/dist/screen/lib/screen-parts.d.ts +6 -62
  49. package/dist/screen/lib/screen-parts.js +1 -1
  50. package/dist/screen/screen.css +2 -8
  51. package/dist/screen/words.d.ts +16 -23
  52. package/dist/screen/words.js +1 -1
  53. package/dist/strings/catalogue.js +1 -1
  54. package/dist/strings/index.js +1 -1
  55. package/package.json +1 -1
  56. package/dist/chunk-5545A3PC.js +0 -4
  57. package/dist/chunk-7O6MDCDU.js +0 -5
  58. package/dist/chunk-D6N77AOS.js +0 -1
  59. package/dist/chunk-FJ3ZJJ5Z.js +0 -57
  60. package/dist/chunk-ICN6COBK.js +0 -5
  61. package/dist/chunk-JTUUIVBZ.js +0 -1
  62. package/dist/chunk-O2NLQBFX.js +0 -1
  63. package/dist/chunk-OWK7DGWG.js +0 -1
  64. package/dist/chunk-THZ46DC5.js +0 -2
@@ -0,0 +1 @@
1
+ import{styleMenuItems as e}from"./chunk-V7U33NF2.js";import{useEaselSession as n}from"./chunk-O7Q4DDJT.js";import{ROOT_ZONE as t}from"./chunk-PLVEGYK6.js";import{useHostEscape as o}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as l}from"./chunk-VWXUMVCD.js";import{EaselMenuItems as r,menuLabel as i}from"./chunk-EA2HTX37.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as a}from"./chunk-WK3AFPXY.js";import{isTypingTarget as u,useCanvasEvent as d,framePointToHost as p}from"./chunk-ILXP5VX5.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as h}from"./chunk-KRXQM65X.js";import{useState as y,useCallback as k,useRef as b,useEffect as v}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,SettingsIcon as z,LayersIcon as P,CopyIcon as O}from"efficient-shell/icons/efficient";import{jsx as A}from"react/jsx-runtime";function D(e,n){const o=[],l=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||l.has(n.props.id))break;if(l.add(n.props.id),o.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===t)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<o.length-1;e+=1)o[e].parentType=o[e+1].node.type;return o}var X=c(),K=/* @__PURE__ */new WeakMap;function j(e){if(e.claimsPage)return X;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",c);let t=K.get(n);return t||(t=c(),K.set(n,t)),t}function M(){return j(n())}function S(e,n,o){if(n===t){const{floor:n,cap:t}=e.sectionBand();return{parentId:h,slot:m,index:Math.min(Math.max(o,n),t)}}const l=n.lastIndexOf(":");return{parentId:n.slice(0,l),slot:n.slice(l+1),index:o}}function T(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function V(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?S(e,t.zone,t.index+1):null;for(const l of D(e,t)){const t=S(e,l.zone,l.index+1);if(o(n,t))return t}return null}function E(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(u(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key||"Backspace"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function L(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=T(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:V(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function I(n,o){const{zone:l,index:r}=o,i=n.nodeAt(l,r);if(!i)return[];const c=i.props.id,a=n.labelOf(i.type,l),u=Boolean(i.props._hidden),d=n.nodeOps,p=n.isPinned(i,l),f=n.isLocked(i),m=!p&&!f&&!n.duplicateBlocked(i),h=n.permits?.(i)??{duplicate:!0,delete:!0},y=T(n,i,l),k=D(n,o),b=d.held,v=b&&!p?V(n,b,o):null,g=!n.readOnly,w=n.style?e({held:g?n.style.held():null,canCopy:n.style.canCopy(i,l),onCopy:()=>n.style?.copy(i,l),onPaste:()=>n.style?.paste(l,r,i),words:n.words?.styleClipboard}):[];return s({title:a,words:n.words?.menu,layer:{group:"pick",items:k.flatMap((e,o)=>{const l={label:n.rowNameOf(e.node,e.zone),checked:0===o,onClick:()=>n.selectAt(e.zone,e.index,e.node.props.id,e.parentType)},r=e.zone===t?null:n.slotRung?.(e.zone)??null;return r?[l,{label:r.label,checked:!1,onClick:r.select}]:[l]})},actions:{duplicate:g&&m&&h.duplicate?()=>d.duplicate(c):void 0,moveUp:g&&d.canStep(c,-1)?()=>d.step(c,-1):void 0,moveDown:g&&d.canStep(c,1)?()=>d.step(c,1):void 0,copy:y.copy?()=>d.copy(c,a):void 0,cut:g&&y.cut?()=>d.cut(c,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&n.renamePropOf(i,l)?()=>n.beginRename(l,r):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(c):void 0},style:w,extras:n.menuRows?.(i,l,r)??void 0,pinnedLine:p?R(n).pinned:void 0})}var R=e=>e.words?.screen??l.menu;function U(e){const n=R(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */A(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */A(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=[],c=e.nodeOps.held,s=S(e,t,e.sectionBand().cap);if(o&&c&&(e.canPasteAt?e.canPasteAt(c,s):f(c.from)===t)){const n=s,t=e.words?.menu??a;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[r,i,[{label:e.pageSettingsLabel??l.pageSettings,icon:/* @__PURE__ */A(z,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */A(P,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function B(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??a,c=R(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */A(O,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */A(O,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[s,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function Y(e){return e.shiftKey}function N(e,n){const[t,l]=y(null),r=k(()=>l(null),[]);o(null!==t,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=E(e);if(!o)return;const l=t.selected();if(!l)return;const r=L(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;v(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),d(n,"keydown",c);const a=k(n=>{if(Y(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);d(n,"contextmenu",t=>{if(Y(t)||!n)return;const o=t.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;t.preventDefault();const c=p(n.frame,t.clientX,t.clientY),s=n.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),d(n,"mousedown",r),d(n,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:t?/* @__PURE__ */A(F,{host:e,target:t,onClose:r}):null,closeMenu:r}}function F({host:e,target:n,onClose:t}){const o="node"===n.kind?I(e,n):"input"===n.kind?B(e,n.el):U(e);return 0===o.length?null:/* @__PURE__ */A(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":i(o),children:/* @__PURE__ */A(r,{items:o,onClose:t})})}export{X as EASEL_NODE_CLIPBOARD,D as ancestorChain,j as nodeClipboardOf,T as nodeClipboardRules,I as nodeMenuItems,E as nodeShortcut,U as pageMenuItems,V as pastePlace,L as runNodeShortcut,B as textMenuItems,M as useNodeClipboard,N as useNodeContextMenu};
@@ -1,4 +1,4 @@
1
- import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-7O6MDCDU.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-JTUUIVBZ.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-77DQCEEF.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-VWXUMVCD.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-GJC6SNQC.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-77DQCEEF.js";import{useEasel as p}from"./chunk-PE6ZY5IW.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:I}){const{getSelectorForId:a}=p(o=>o),u=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}),I?.(t)):i(o=>"part"===o.kind?n:o)},[i,I]);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=a(o);e&&u.select(e)},[i,a,u]),openPartId:h}}export{m as usePartBridge};
@@ -1 +1 @@
1
- import{STANDARD_MARKUP as t,writeMarkedLines as e,sameMarks as n,markedLines as r,spanFor as l,marksIn as o,toggleMark as i,listIn as s,setList as a,isSafeLinkHref as c}from"./chunk-546BBOPE.js";var u=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),d=/* @__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 h(l,o){const i=o.rules??t,s=l.html&&""!==l.html.trim()?function(t,l,o){const i=l.createElement("template");i.innerHTML=t;const s=[[]],a=()=>s[s.length-1],h=()=>{const t=a();for(;t.length>0&&" "===t[t.length-1].ch;)t.pop();t.length>0&&s.push([])},p=(t,e,n,r)=>{if(3===t.nodeType){for(const l of t.textContent??""){const t=/\s/.test(l)?" ":l,o=a();" "===t&&(0===o.length&&s.length>1||" "===o[o.length-1]?.ch)||o.push({ch:t,bold:e,italic:n,href:r})}return}if(1!==t.nodeType&&11!==t.nodeType)return;const l=t,o=1===t.nodeType?l.localName:"";if(u.has(o))return;if("br"===o)return void s.push([]);let i=e,f=n,m=r;if("b"!==o&&"strong"!==o||(i=!0),"i"!==o&&"em"!==o||(f=!0),"a"===o){const t=(l.getAttribute("href")??"").trim();m=c(t)?t:null}const g=1===t.nodeType?l.style:null;if(g){const t=g.fontWeight;"bold"===t||"bolder"===t||Number(t)>=600?i=!0:("normal"===t||"lighter"===t||""!==t&&Number(t)<600)&&(i=!1),"italic"===g.fontStyle||"oblique"===g.fontStyle?f=!0:"normal"===g.fontStyle&&(f=!1)}const b=d.has(o);b&&h();for(const e of[...t.childNodes])p(e,i,f,m);b&&h()};p(i.content,!1,!1,null);for(;s.length>1&&0===s[s.length-1].length;)s.pop();return s.map(t=>function(t,l){const o=e=>t.map((n,r)=>n[e]&&(" "!==n.ch||Boolean(t[r-1]?.[e])&&Boolean(t[r+1]?.[e]))),i=[{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 s of i){const i=f(t,s.bold?o("bold"):null,s.italic?o("italic"):null,s.links),a=e([i]).text;if(n([i],r(a,l)))return a}return t.map(t=>t.ch).join("")}(t,o))}(l.html,o.doc,i):(l.text??"").replace(/\r\n?/g,"\n").split("\n");return o.multiline?s.join("\n"):1===s.length?s[0]:s.map(t=>t.trim()).filter(t=>""!==t).join(" ")}function f(t,e,n,r){let o=0,i=null,s=null,a=null;return{bullet:!1,chars:t.map((t,c)=>{const u=r?t.href:null;return i=null===u?null:i&&i.href===u?i:l(++o,"link",u),s=e?.[c]?s??l(++o,"bold"):null,a=n?.[c]?a??l(++o,"italic"):null,{ch:t.ch,at:-1,marks:[i,s,a].filter(t=>null!==t)}})}}var p="application/x-efficient-markup",m=/^([0-9]{1,3})\. $/;function g(t,e){const n=t.split("\n"),l=r(t,e);let o=0,i=0;const s=l.map((t,e)=>{const r=!t.bullet&&null==t.number&&"- "===n[e],l=null!=t.number||t.bullet?null:m.exec(n[e]),s=t.bullet||r,a=l?l[1]:t.number??null,c=r||l?[]:t.chars,u=c.map(t=>t.ch).join(""),d=null!=a?a.length+2:s?2:0,h={bullet:s,number:a,chars:c,start:o,src:o+d,vis:i,text:u};return o+=n[e].length+1,i+=u.length+1,h});return{lines:s,text:s.map(t=>t.text).join("\n")}}function b(t,e){const{lines:n}=t;for(let t=0;t<n.length;t+=1){const r=n[t];if(e<=r.vis+r.text.length||t===n.length-1)return[r,Math.max(0,Math.min(e-r.vis,r.text.length)),t]}return[n[0],0,0]}function k(t,e){const[n,r]=b(t,e);if(0===r)return n.src;let l=0;for(const t of n.chars){if(r<=l+t.ch.length)return t.at+(r-l);l+=t.ch.length}return n.src}function x(t,e){const[n,r]=b(t,e);let l=0;for(const t of n.chars){if(r===l)return t.at;l+=t.ch.length}return k(t,e)}function v(t,e){const{lines:n}=t;let r=n[0];for(const t of n)e>=t.start&&(r=t);let l=0;for(const t of r.chars){if(!(e>=t.at+t.ch.length)){e>t.at&&(l+=e-t.at);break}l+=t.ch.length}return r.vis+l}function y(t,e,n){return[v(t,e),v(t,n)]}function w(t,e,n){return e===n?[k(t,e),k(t,e)]:[x(t,e),k(t,n)]}function D(t,e){let n=0;for(let r=0;r<t.chars.length;r+=1){if(n>=e)return r;n+=t.chars[r].ch.length}return t.chars.length}function T(t,o,i,s,a){const c=g(t,o),[u,d,h]=b(c,Math.min(i,s)),[f,p,m]=b(c,Math.max(i,s)),k=D(u,d),x=D(f,p),v=u.chars.slice(0,k),y=f.chars.slice(x),w=i!==s&&u.chars[k]&&(h!==m||k<x)?u.chars[k].marks:function(t,e){const n=t.chars[e-1],r=t.chars[e],l=(t,e)=>{const n=t.findIndex(t=>"link"===t.kind);return-1===n||e?t:t.slice(0,n)};if(n){const t=n.marks.find(t=>"link"===t.kind),e=Boolean(t&&r?.marks.some(e=>e.id===t.id));return l(n.marks,e)}return r?l(r.marks,!1):[]}(u,k);let T=(A=c.lines,Math.max(0,...A.flatMap(t=>t.chars.flatMap(t=>t.marks.map(t=>t.id))))+1);var A;const S=t=>{let e;if(void 0!==a.markup){const t=T;e=r(a.markup,o).map(e=>({bullet:e.bullet,number:e.number??null,chars:e.chars.map(e=>({...e,at:-1,marks:e.marks.map(e=>({...e,id:e.id+t}))}))}))}else{let n=u.number??null;e=(a.text??"").split("\n").map((e,r)=>(r>0&&null!=n&&(n=function(t){return String(Number(t)+1).padStart(t.length,"0")}(n)),{bullet:u.bullet,number:n,chars:[...e].map(e=>({ch:e,at:-1,marks:t??[]}))}))}const n=e.map(t=>t.chars.map(t=>t.ch).join("")).join("\n"),l={bullet:u.bullet,number:u.number??null,chars:[...v,...e[0].chars]},i=e.slice(1);if(i.length>0){const t=i[i.length-1];i[i.length-1]={...t,chars:[...t.chars,...y]}}else l.chars.push(...y);return{lines:[...c.lines.slice(0,h).map(({bullet:t,number:e,chars:n})=>({bullet:t,number:e,chars:n})),l,...i,...c.lines.slice(m+1).map(({bullet:t,number:e,chars:n})=>({bullet:t,number:e,chars:n}))],shown:n}},E=void 0!==a.markup?[null]:[(t=>{let e=t.filter(t=>!a.drop?.some(e=>t.kind===e||"highlight"===e&&"accent"===t.kind));for(const t of a.add??[]){if(e.some(e=>e.kind===t))continue;const n=l(T++,t);n&&(e=[...e,n])}if(void 0!==a.color){e=e.filter(t=>"color"!==t.kind);const t=null===a.color?null:l(T++,"color",a.color);t&&(e=[...e,t])}return e})(w),w,[]];let M="",N="";for(const t of E){const r=S(t),l=e(r.lines).text;if(M=l,N=r.shown,n(r.lines,g(l,o).lines))break}return{text:M,caret:Math.min(i,s)+N.length}}function A(t,e,n,r){const l=g(t,e),[o,,i]=b(l,n);return n!==r||!o.bullet&&null==o.number||""!==o.text?T(t,e,n,r,{text:"\n"}):S(t,e,i,!1,n)}function S(t,n,r,l,o){const i=g(t,n).lines.map(({bullet:t,number:e,chars:n},o)=>o===r?{bullet:l,number:null,chars:n}:{bullet:t,number:e,chars:n});return{text:e(i).text,caret:o}}function E(t,n,r,l){const o=g(t,n),[i,s,a]=b(o,Math.min(r,l)),[c,u,d]=b(o,Math.max(r,l)),h=o.lines.slice(a,d+1).map(({bullet:t,number:e,chars:n},r)=>{const l=0===r?D(i,s):0,o=r===d-a?D(c,u):n.length;return{bullet:t,number:e,chars:n.slice(l,o)}});return e(h).text}function M(t,e,n){if(n<0){const n=t.charCodeAt(e-1);return e-(n>=56320&&n<=57343&&e>=2?2:1)}const r=t.charCodeAt(e);return e+(r>=55296&&r<=56319?2:1)}function N(t){const{value:e,rules:n,multiline:r,inputType:l,pending:o}=t;let[i,s]=t.sel;t.target&&t.target[0]!==t.target[1]&&l.startsWith("delete")&&([i,s]=t.target);const a=[i,s];if("historyUndo"===l||"historyRedo"===l)return{kind:"history",dir:"historyUndo"===l?"undo":"redo"};if("formatBold"===l||"formatItalic"===l||"formatStrikeThrough"===l)return{kind:"format",style:"formatBold"===l?"bold":"formatItalic"===l?"italic":"strike"};if("insertParagraph"===l||"insertLineBreak"===l)return r?{kind:"edit",edit:A(e,n,i,s),range:a}:null;if(l.startsWith("insert")){if("insertTranspose"===l)return null;let c=t.data??"";if("insertFromDrop"===l||"insertFromPaste"===l){const l=h({html:t.html??void 0,text:c},{doc:t.doc,multiline:r,rules:n});return{kind:"edit",edit:T(e,n,i,s,{markup:l}),range:a}}return r||(c=c.replace(/\s*\r?\n\s*/g," ")),{kind:"type",edit:T(e,n,i,s,{text:c,add:o?.add,drop:o?.drop,color:o?.color}),range:a}}if(l.startsWith("delete")){const t=g(e,n),r=t.text;if(i===s){const o=l.includes("Backward"),c=t.lines.findIndex(t=>i>=t.vis&&i<=t.vis+t.text.length),u=t.lines[c];if(o&&u&&i===u.vis&&(u.bullet||null!=u.number))return{kind:"edit",edit:S(e,n,c,!1,i),range:a};if(o?0===i:i===r.length)return null;o?i=M(r,i,-1):s=M(r,s,1)}return{kind:"type",edit:T(e,n,i,s,{text:""}),range:[i,s]}}return null}var B=1e3;function C(t=200){let e=[],n=[],r=null,l=0;return{record(o,i,s){const a="type"===i&&"type"===r&&s-l<1e3;r=i,l=s,n=[],a||(e.push(o),e.length>t&&e.shift())},undo(t){const l=e.pop();return l?(n.push(t),r=null,l):null},redo(t){const l=n.pop();return l?(e.push(t),r=null,l):null},reset(){e=[],n=[],r=null}}}var j={sup:"sub",sub:"sup"};function q(t){const{value:e,rules:n,start:r,end:l,style:s,pending:a}=t,c=j[s];if(r===l){const t=o(e,r,l,n),i=a&&a.at===r?a:null,u=t.has(s),d=!!i?.add.includes(s)||!i?.drop.includes(s)&&u;let h=(i?.add??[]).filter(t=>t!==s),f=(i?.drop??[]).filter(t=>t!==s);return d&&u?f.push(s):d||u||h.push(s),!d&&c&&(h=h.filter(t=>t!==c),t.has(c)&&(f=[...f.filter(t=>t!==c),c])),{kind:"pending",pending:h.length||f.length||void 0!==i?.color?{add:h,drop:f,color:i?.color,at:r}:null}}let u=e,d=r,h=l;if(c&&!o(u,d,h,n).has(s)&&o(u,d,h,n).has(c)){const t=i(u,d,h,c,n);({text:u,selectionStart:d,selectionEnd:h}=t)}return{kind:"edit",result:i(u,d,h,s,n)}}var F=/^(block|list-item|flex|grid|table|flow-root)$/;function L(t){const e=t.ownerDocument.defaultView;return!!e&&F.test(e.getComputedStyle(t).display)}function O(t,e){const n=[],r=/* @__PURE__ */new Map,l=/* @__PURE__ */new Map;let o="",i=!1;const s=()=>{i&&(o+="\n",i=!1)},a=t=>{for(const c of Array.from(t.childNodes)){if(3===c.nodeType){c.data.length>0&&s(),r.set(c,o.length),n.push({node:c,start:o.length,length:c.data.length}),o+=c.data,l.set(c,o.length);continue}if(1!==c.nodeType)continue;const t=c;if(e&&t.matches(e)){r.set(t,o.length),l.set(t,o.length);continue}if("BR"===t.tagName){s(),r.set(t,o.length),o+="\n",l.set(t,o.length);continue}const u=L(t);u&&((i||o.length>0&&!o.endsWith("\n"))&&(o+="\n"),i=!1),r.set(t,o.length);const d=o.length;a(t),u&&o.length===d&&!i&&n.push({node:t,start:d,length:0}),l.set(t,o.length),u&&(i=!0)}};r.set(t,0),a(t),l.set(t,o.length);return{text:o,at:(t,e)=>{if(3===t.nodeType)return(r.get(t)??0)+Math.min(e,t.data.length);const n=t.childNodes;return e<n.length?r.get(n[e])??l.get(t)??0:l.get(t)??o.length},dom:e=>{for(let t=0;t<n.length;t+=1){const r=n[t],l=r.start+r.length;if(e<r.start)return[r.node,0];if(e<l||e===l&&(t===n.length-1||n[t+1].start>e))return 3===r.node.nodeType?[r.node,e-r.start]:[r.node,0]}const r=n[n.length-1];return r?3===r.node.nodeType?[r.node,r.length]:[r.node,0]:[t,0]}}}function P(t){const e=t.element();if(!e)return null;let n=t.value;const r=t.rules;if(O(e,t.skip).text!==g(n,r).text)return null;const l=t.now??(()=>Date.now()),i=C();let c=e,u=!1,d=null,f=null,m=[t.caret[0],t.caret[1]],b=null,k=!1;const x=()=>t.onSelect?.(),v={contenteditable:e.getAttribute("contenteditable"),spellcheck:e.getAttribute("spellcheck")},D=()=>c.ownerDocument,A=()=>D().defaultView?.getSelection()??null,S=()=>{if(!f)return!0;Q();const e=O(c,t.skip);if(e.text!==g(n,r).text)return!1;const[l,o]=f,[i,s]=e.dom(l),[a,u]=e.dom(o);return D().activeElement!==c&&c.focus({preventScroll:!0}),A()?.setBaseAndExtent(i,s,a,u),m=f,M=f,f=null,x(),!0};let M=null;const B=()=>{if(!M)return!1;const t=A(),e=t?.anchorNode??null;return!(e&&e.isConnected&&c.contains(e))||e===c&&0===t.anchorOffset&&(0!==M[0]||0!==M[1])},j=()=>{f=M,S()},F=()=>{S(),D().activeElement===c&&B()&&j();const e=A();if(!(e&&e.anchorNode&&e.focusNode&&c.contains(e.anchorNode)&&c.contains(e.focusNode)))return m;const n=O(c,t.skip),r=n.at(e.anchorNode,e.anchorOffset),l=n.at(e.focusNode,e.focusOffset);return m=r<=l?[r,l]:[l,r],m},L=t=>{const e=D().defaultView;t<=0||!e?M=null:e.requestAnimationFrame(()=>{u||f||(Q(),D().activeElement===c?(B()&&(j(),x()),L(t-1)):M=null)})},P=(t,e)=>{f=[t,e];const n=t=>{if(u)return;if(S())return void L(3);const e=D().defaultView;t>0&&e&&e.requestAnimationFrame(()=>n(t-1))};n(30)},V=(e,r,o)=>{e.text!==n?(i.record({text:n,start:r[0],end:r[1]},o,l()),n=e.text,t.write(n),P(e.caret,e.caret),x()):P(e.caret,e.caret)},W=t=>w(g(n,r),t[0],t[1]),I=(e,o)=>{if(e.text===n)return;i.record({text:n,start:o[0],end:o[1]},"edit",l()),n=e.text,t.write(n);const[s,a]=y(g(n,r),e.selectionStart,e.selectionEnd);P(s,a),x()},K=t=>{if(u)return;const e=F(),[l,o]=W(e),i=q({value:n,rules:r,start:l,end:o,style:t,pending:b});if("pending"===i.kind)return b=i.pending,void x();I(i.result,e)},R=e=>{n=e.text,t.write(n),P(e.start,e.end)},U=e=>{u||(u=!0,X.removeEventListener("selectionchange",Y),J(c),t.end(e))},$=(t,e)=>{const l=F();!u&&l[0]!==l[1]&&t.clipboardData&&(t.preventDefault(),t.clipboardData.setData("text/plain",g(n,r).text.slice(l[0],l[1])),t.clipboardData.setData(p,E(n,r,l[0],l[1])),e&&V(T(n,r,l[0],l[1],{text:""}),l,"edit"))},z=t=>t.preventDefault(),H=()=>{t.remount?.()},Z=[["keydown",t=>{if(u||t.isComposing)return;const e=t.metaKey||t.ctrlKey;if("Escape"===t.key)return t.preventDefault(),t.stopPropagation(),void U("escape");if("Enter"===t.key&&(!t.shiftKey||e))return t.preventDefault(),t.stopPropagation(),void U("enter");if(e&&("z"===t.key||"Z"===t.key||"y"===t.key)){t.preventDefault(),t.stopPropagation();const e=F(),r={text:n,start:e[0],end:e[1]},l="y"===t.key||t.shiftKey?i.redo(r):i.undo(r);l&&R(l)}}],["beforeinput",e=>{if(u)return;if("insertCompositionText"===e.inputType)return;e.preventDefault();const l=F(),o=O(c,t.skip),s="function"==typeof e.getTargetRanges?e.getTargetRanges()[0]:void 0,a=s&&!s.collapsed?[o.at(s.startContainer,s.startOffset),o.at(s.endContainer,s.endOffset)]:null,d=N({value:n,rules:r,multiline:t.multiline,inputType:e.inputType,data:e.data??e.dataTransfer?.getData("text/plain")??"",html:e.dataTransfer?.getData("text/html"),doc:D(),sel:l,target:a,pending:b&&b.at===W(l)[0]?b:null});if(d){if("type"!==d.kind&&"edit"!==d.kind||(b=null),"history"===d.kind){const t={text:n,start:l[0],end:l[1]},e="undo"===d.dir?i.undo(t):i.redo(t);return void(e&&R(e))}"format"!==d.kind?V(d.edit,d.range,d.kind):K(d.style)}}],["compositionstart",()=>{d=F()}],["compositionend",e=>{const o=d;if(d=null,!u&&o)if(e.data){const s=T(n,r,o[0],o[1],{text:e.data});i.record({text:n,start:o[0],end:o[1]},"type",l()),n=s.text,t.write(n),H(),P(s.caret,s.caret)}else H(),P(o[0],o[0])}],["paste",e=>{if(u)return;e.preventDefault();const l=F(),o=e.clipboardData,i=o?.getData(p)??"",s=i?t.multiline?i:i.replace(/\s*\r?\n\s*/g," "):h({html:o?.getData("text/html")??"",text:o?.getData("text/plain")??""},{doc:D(),multiline:t.multiline,rules:r});V(T(n,r,l[0],l[1],{markup:s}),l,"edit")}],["copy",t=>$(t,!1)],["cut",t=>$(t,!0)],["drop",z],["dragstart",z],["blur",e=>{if(u||null!==d||k)return;const n=e.target,r=n.ownerDocument.defaultView,l=()=>{u||(n.isConnected&&n===t.element()?k||n.ownerDocument.activeElement===n||U("blur"):P(m[0],m[1]))};r?.requestAnimationFrame?r.requestAnimationFrame(l):setTimeout(l,0)}],["focus",()=>{k=!1}]];function G(t){t.setAttribute("contenteditable","true"),t.setAttribute("spellcheck","false"),t.setAttribute("data-es-typing","");for(const[e,n]of Z)t.addEventListener(e,n)}function J(t){for(const[e,n]of Z)t.removeEventListener(e,n);null===v.contenteditable?t.removeAttribute("contenteditable"):t.setAttribute("contenteditable",v.contenteditable),null===v.spellcheck?t.removeAttribute("spellcheck"):t.setAttribute("spellcheck",v.spellcheck),t.removeAttribute("data-es-typing")}function Q(){const e=t.element();e&&e!==c&&(J(c),c=e,G(c))}const X=c.ownerDocument;function Y(){u||x()}return X.addEventListener("selectionchange",Y),G(c),c.focus({preventScroll:!0}),P(t.caret[0],t.caret[1]),{get value(){return n},update(t){if(t===n)return;const e=g(t,r).text.length,[l,o]=F();n=t,i.reset(),P(Math.min(l,e),Math.min(o,e))},stop(t="stop"){U(t)},pressed(){const[t,e]=W(F()),l=o(n,t,e,r),i={};for(const e of["bold","italic","underline","strike","sup","sub","link"]){const n=l.has(e),r=b&&b.at===t?b:null;i[e]=!!r?.add.includes(e)||!r?.drop.includes(e)&&n}return{marks:i,list:s(n,t,e,r),selected:e>t}},press:K,insert(t){if(u)return;k=!1;const e=F(),[r,l]=W(e),o=r+t.length;I({text:n.slice(0,r)+t+n.slice(l),selectionStart:o,selectionEnd:o},e),Q(),c.focus({preventScroll:!0})},hold(){u||(k=!0)},list(e){if(u||!t.multiline)return;const l=F(),[o,i]=W(l),c=s(n,o,i,r);I(a(n,o,i,c===e?null:e,r),l)}}}export{p as MARKUP_CLIPBOARD_TYPE,B as TYPING_BURST_MS,C as createHistory,T as editVisible,q as markPress,E as markupOfRange,A as newLine,h as pasteToMarkup,N as richInput,g as richLayout,w as selectionToSource,y as selectionToVisible,S as setBullet,P as startCanvasTyping,O as textMap,k as toSource,x as toSourceStart,v as toVisible};
1
+ import{STANDARD_MARKUP as t,writeMarkedLines as e,sameMarks as n,markedLines as r,spanFor as l,marksIn as o,toggleMark as i,listIn as s,setList as a,isSafeLinkHref as c}from"./chunk-546BBOPE.js";var u=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),d=/* @__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 h(l,o){const i=o.rules??t,s=l.html&&""!==l.html.trim()?function(t,l,o){const i=l.createElement("template");i.innerHTML=t;const s=[[]],a=()=>s[s.length-1],h=()=>{const t=a();for(;t.length>0&&" "===t[t.length-1].ch;)t.pop();t.length>0&&s.push([])},p=(t,e,n,r)=>{if(3===t.nodeType){for(const l of t.textContent??""){const t=/\s/.test(l)?" ":l,o=a();" "===t&&(0===o.length&&s.length>1||" "===o[o.length-1]?.ch)||o.push({ch:t,bold:e,italic:n,href:r})}return}if(1!==t.nodeType&&11!==t.nodeType)return;const l=t,o=1===t.nodeType?l.localName:"";if(u.has(o))return;if("br"===o)return void s.push([]);let i=e,f=n,m=r;if("b"!==o&&"strong"!==o||(i=!0),"i"!==o&&"em"!==o||(f=!0),"a"===o){const t=(l.getAttribute("href")??"").trim();m=c(t)?t:null}const g=1===t.nodeType?l.style:null;if(g){const t=g.fontWeight;"bold"===t||"bolder"===t||Number(t)>=600?i=!0:("normal"===t||"lighter"===t||""!==t&&Number(t)<600)&&(i=!1),"italic"===g.fontStyle||"oblique"===g.fontStyle?f=!0:"normal"===g.fontStyle&&(f=!1)}const b=d.has(o);b&&h();for(const e of[...t.childNodes])p(e,i,f,m);b&&h()};p(i.content,!1,!1,null);for(;s.length>1&&0===s[s.length-1].length;)s.pop();return s.map(t=>function(t,l){const o=e=>t.map((n,r)=>n[e]&&(" "!==n.ch||Boolean(t[r-1]?.[e])&&Boolean(t[r+1]?.[e]))),i=[{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 s of i){const i=f(t,s.bold?o("bold"):null,s.italic?o("italic"):null,s.links),a=e([i]).text;if(n([i],r(a,l)))return a}return t.map(t=>t.ch).join("")}(t,o))}(l.html,o.doc,i):(l.text??"").replace(/\r\n?/g,"\n").split("\n");return o.multiline?s.join("\n"):1===s.length?s[0]:s.map(t=>t.trim()).filter(t=>""!==t).join(" ")}function f(t,e,n,r){let o=0,i=null,s=null,a=null;return{bullet:!1,chars:t.map((t,c)=>{const u=r?t.href:null;return i=null===u?null:i&&i.href===u?i:l(++o,"link",u),s=e?.[c]?s??l(++o,"bold"):null,a=n?.[c]?a??l(++o,"italic"):null,{ch:t.ch,at:-1,marks:[i,s,a].filter(t=>null!==t)}})}}var p="application/x-efficient-markup",m=/^([0-9]{1,3})\. $/;function g(t,e){const n=t.split("\n"),l=r(t,e);let o=0,i=0;const s=l.map((t,e)=>{const r=!t.bullet&&null==t.number&&"- "===n[e],l=null!=t.number||t.bullet?null:m.exec(n[e]),s=t.bullet||r,a=l?l[1]:t.number??null,c=r||l?[]:t.chars,u=c.map(t=>t.ch).join(""),d=null!=a?a.length+2:s?2:0,h={bullet:s,number:a,chars:c,start:o,src:o+d,vis:i,text:u};return o+=n[e].length+1,i+=u.length+1,h});return{lines:s,text:s.map(t=>t.text).join("\n")}}function b(t,e){const{lines:n}=t;for(let t=0;t<n.length;t+=1){const r=n[t];if(e<=r.vis+r.text.length||t===n.length-1)return[r,Math.max(0,Math.min(e-r.vis,r.text.length)),t]}return[n[0],0,0]}function k(t,e){const[n,r]=b(t,e);if(0===r)return n.src;let l=0;for(const t of n.chars){if(r<=l+t.ch.length)return t.at+(r-l);l+=t.ch.length}return n.src}function x(t,e){const[n,r]=b(t,e);let l=0;for(const t of n.chars){if(r===l)return t.at;l+=t.ch.length}return k(t,e)}function v(t,e){const{lines:n}=t;let r=n[0];for(const t of n)e>=t.start&&(r=t);let l=0;for(const t of r.chars){if(!(e>=t.at+t.ch.length)){e>t.at&&(l+=e-t.at);break}l+=t.ch.length}return r.vis+l}function y(t,e,n){return[v(t,e),v(t,n)]}function w(t,e,n){return e===n?[k(t,e),k(t,e)]:[x(t,e),k(t,n)]}function D(t,e){let n=0;for(let r=0;r<t.chars.length;r+=1){if(n>=e)return r;n+=t.chars[r].ch.length}return t.chars.length}function T(t,o,i,s,a){const c=g(t,o),[u,d,h]=b(c,Math.min(i,s)),[f,p,m]=b(c,Math.max(i,s)),k=D(u,d),x=D(f,p),v=u.chars.slice(0,k),y=f.chars.slice(x),w=i!==s&&u.chars[k]&&(h!==m||k<x)?u.chars[k].marks:function(t,e){const n=t.chars[e-1],r=t.chars[e],l=(t,e)=>{const n=t.findIndex(t=>"link"===t.kind);return-1===n||e?t:t.slice(0,n)};if(n){const t=n.marks.find(t=>"link"===t.kind),e=Boolean(t&&r?.marks.some(e=>e.id===t.id));return l(n.marks,e)}return r?l(r.marks,!1):[]}(u,k);let T=(A=c.lines,Math.max(0,...A.flatMap(t=>t.chars.flatMap(t=>t.marks.map(t=>t.id))))+1);var A;const S=t=>{let e;if(void 0!==a.markup){const t=T;e=r(a.markup,o).map(e=>({bullet:e.bullet,number:e.number??null,chars:e.chars.map(e=>({...e,at:-1,marks:e.marks.map(e=>({...e,id:e.id+t}))}))}))}else{let n=u.number??null;e=(a.text??"").split("\n").map((e,r)=>(r>0&&null!=n&&(n=function(t){return String(Number(t)+1).padStart(t.length,"0")}(n)),{bullet:u.bullet,number:n,chars:[...e].map(e=>({ch:e,at:-1,marks:t??[]}))}))}const n=e.map(t=>t.chars.map(t=>t.ch).join("")).join("\n"),l={bullet:u.bullet,number:u.number??null,chars:[...v,...e[0].chars]},i=e.slice(1);if(i.length>0){const t=i[i.length-1];i[i.length-1]={...t,chars:[...t.chars,...y]}}else l.chars.push(...y);return{lines:[...c.lines.slice(0,h).map(({bullet:t,number:e,chars:n})=>({bullet:t,number:e,chars:n})),l,...i,...c.lines.slice(m+1).map(({bullet:t,number:e,chars:n})=>({bullet:t,number:e,chars:n}))],shown:n}},E=void 0!==a.markup?[null]:[(t=>{let e=t.filter(t=>!a.drop?.some(e=>t.kind===e||"highlight"===e&&"accent"===t.kind));for(const t of a.add??[]){if(e.some(e=>e.kind===t))continue;const n=l(T++,t);n&&(e=[...e,n])}if(void 0!==a.color){e=e.filter(t=>"color"!==t.kind);const t=null===a.color?null:l(T++,"color",a.color);t&&(e=[...e,t])}return e})(w),w,[]];let M="",N="";for(const t of E){const r=S(t),l=e(r.lines).text;if(M=l,N=r.shown,n(r.lines,g(l,o).lines))break}return{text:M,caret:Math.min(i,s)+N.length}}function A(t,e,n,r){const l=g(t,e),[o,,i]=b(l,n);return n!==r||!o.bullet&&null==o.number||""!==o.text?T(t,e,n,r,{text:"\n"}):S(t,e,i,!1,n)}function S(t,n,r,l,o){const i=g(t,n).lines.map(({bullet:t,number:e,chars:n},o)=>o===r?{bullet:l,number:null,chars:n}:{bullet:t,number:e,chars:n});return{text:e(i).text,caret:o}}function E(t,n,r,l){const o=g(t,n),[i,s,a]=b(o,Math.min(r,l)),[c,u,d]=b(o,Math.max(r,l)),h=o.lines.slice(a,d+1).map(({bullet:t,number:e,chars:n},r)=>{const l=0===r?D(i,s):0,o=r===d-a?D(c,u):n.length;return{bullet:t,number:e,chars:n.slice(l,o)}});return e(h).text}function M(t,e,n){if(n<0){const n=t.charCodeAt(e-1);return e-(n>=56320&&n<=57343&&e>=2?2:1)}const r=t.charCodeAt(e);return e+(r>=55296&&r<=56319?2:1)}function N(t){const{value:e,rules:n,multiline:r,inputType:l,pending:o}=t;let[i,s]=t.sel;t.target&&t.target[0]!==t.target[1]&&l.startsWith("delete")&&([i,s]=t.target);const a=[i,s];if("historyUndo"===l||"historyRedo"===l)return{kind:"history",dir:"historyUndo"===l?"undo":"redo"};if("formatBold"===l||"formatItalic"===l||"formatStrikeThrough"===l)return{kind:"format",style:"formatBold"===l?"bold":"formatItalic"===l?"italic":"strike"};if("insertParagraph"===l||"insertLineBreak"===l)return r?{kind:"edit",edit:A(e,n,i,s),range:a}:null;if(l.startsWith("insert")){if("insertTranspose"===l)return null;let c=t.data??"";if("insertFromDrop"===l||"insertFromPaste"===l){const l=h({html:t.html??void 0,text:c},{doc:t.doc,multiline:r,rules:n});return{kind:"edit",edit:T(e,n,i,s,{markup:l}),range:a}}return r||(c=c.replace(/\s*\r?\n\s*/g," ")),{kind:"type",edit:T(e,n,i,s,{text:c,add:o?.add,drop:o?.drop,color:o?.color}),range:a}}if(l.startsWith("delete")){const t=g(e,n),r=t.text;if(i===s){const o=l.includes("Backward"),c=t.lines.findIndex(t=>i>=t.vis&&i<=t.vis+t.text.length),u=t.lines[c];if(o&&u&&i===u.vis&&(u.bullet||null!=u.number))return{kind:"edit",edit:S(e,n,c,!1,i),range:a};if(o?0===i:i===r.length)return null;o?i=M(r,i,-1):s=M(r,s,1)}return{kind:"type",edit:T(e,n,i,s,{text:""}),range:[i,s]}}return null}var B=1e3;function C(t=200){let e=[],n=[],r=null,l=0;return{record(o,i,s){const a="type"===i&&"type"===r&&s-l<1e3;r=i,l=s,n=[],a||(e.push(o),e.length>t&&e.shift())},undo(t){const l=e.pop();return l?(n.push(t),r=null,l):null},redo(t){const l=n.pop();return l?(e.push(t),r=null,l):null},reset(){e=[],n=[],r=null}}}var j={sup:"sub",sub:"sup"};function q(t){const{value:e,rules:n,start:r,end:l,style:s,pending:a}=t,c=j[s];if(r===l){const t=o(e,r,l,n),i=a&&a.at===r?a:null,u=t.has(s),d=!!i?.add.includes(s)||!i?.drop.includes(s)&&u;let h=(i?.add??[]).filter(t=>t!==s),f=(i?.drop??[]).filter(t=>t!==s);return d&&u?f.push(s):d||u||h.push(s),!d&&c&&(h=h.filter(t=>t!==c),t.has(c)&&(f=[...f.filter(t=>t!==c),c])),{kind:"pending",pending:h.length||f.length||void 0!==i?.color?{add:h,drop:f,color:i?.color,at:r}:null}}let u=e,d=r,h=l;if(c&&!o(u,d,h,n).has(s)&&o(u,d,h,n).has(c)){const t=i(u,d,h,c,n);({text:u,selectionStart:d,selectionEnd:h}=t)}return{kind:"edit",result:i(u,d,h,s,n)}}var F=/^(block|list-item|flex|grid|table|flow-root)$/;function L(t){const e=t.ownerDocument.defaultView;return!!e&&F.test(e.getComputedStyle(t).display)}function O(t,e){const n=[],r=/* @__PURE__ */new Map,l=/* @__PURE__ */new Map;let o="",i=!1;const s=()=>{i&&(o+="\n",i=!1)},a=t=>{for(const c of Array.from(t.childNodes)){if(3===c.nodeType){c.data.length>0&&s(),r.set(c,o.length),n.push({node:c,start:o.length,length:c.data.length}),o+=c.data,l.set(c,o.length);continue}if(1!==c.nodeType)continue;const t=c;if(e&&t.matches(e)){r.set(t,o.length),l.set(t,o.length);continue}if("BR"===t.tagName){s(),r.set(t,o.length),o+="\n",l.set(t,o.length);continue}const u=L(t);u&&((i||o.length>0&&!o.endsWith("\n"))&&(o+="\n"),i=!1),r.set(t,o.length);const d=o.length;a(t),u&&o.length===d&&!i&&n.push({node:t,start:d,length:0}),l.set(t,o.length),u&&(i=!0)}};r.set(t,0),a(t),l.set(t,o.length);return{text:o,at:(t,e)=>{if(3===t.nodeType)return(r.get(t)??0)+Math.min(e,t.data.length);const n=t.childNodes;return e<n.length?r.get(n[e])??l.get(t)??0:l.get(t)??o.length},dom:e=>{for(let t=0;t<n.length;t+=1){const r=n[t],l=r.start+r.length;if(e<r.start)return[r.node,0];if(e<l||e===l&&(t===n.length-1||n[t+1].start>e))return 3===r.node.nodeType?[r.node,e-r.start]:[r.node,0]}const r=n[n.length-1];return r?3===r.node.nodeType?[r.node,r.length]:[r.node,0]:[t,0]}}}function P(t){const e=t.element();if(!e)return null;let n=t.value;const r=t.rules;if(O(e,t.skip).text!==g(n,r).text)return null;const l=t.now??(()=>Date.now()),i=C();let c=e,u=!1,d=null,f=null,m=[t.caret[0],t.caret[1]],b=null,k=!1;const x=()=>t.onSelect?.(),v={contenteditable:e.getAttribute("contenteditable"),spellcheck:e.getAttribute("spellcheck")},D=()=>c.ownerDocument,A=()=>D().defaultView?.getSelection()??null,S=()=>{if(!f)return!0;Q();const e=O(c,t.skip);if(e.text!==g(n,r).text)return!1;const[l,o]=f,[i,s]=e.dom(l),[a,u]=e.dom(o);return D().activeElement!==c&&c.focus({preventScroll:!0}),A()?.setBaseAndExtent(i,s,a,u),m=f,M=f,f=null,x(),!0};let M=null;const B=()=>{if(!M)return!1;const t=A(),e=t?.anchorNode??null;return!(e&&e.isConnected&&c.contains(e))||e===c&&0===t.anchorOffset&&(0!==M[0]||0!==M[1])},j=()=>{f=M,S()},F=()=>{S(),D().activeElement===c&&B()&&j();const e=A();if(!(e&&e.anchorNode&&e.focusNode&&c.contains(e.anchorNode)&&c.contains(e.focusNode)))return m;const n=O(c,t.skip),r=n.at(e.anchorNode,e.anchorOffset),l=n.at(e.focusNode,e.focusOffset);return m=r<=l?[r,l]:[l,r],m},L=t=>{const e=D().defaultView;t<=0||!e?M=null:e.requestAnimationFrame(()=>{u||f||(Q(),D().activeElement===c?(B()&&(j(),x()),L(t-1)):M=null)})},P=(t,e)=>{f=[t,e];const n=t=>{if(u)return;if(S())return void L(3);const e=D().defaultView;t>0&&e&&e.requestAnimationFrame(()=>n(t-1))};n(30)},V=(e,r,o)=>{e.text!==n?(i.record({text:n,start:r[0],end:r[1]},o,l()),n=e.text,t.write(n),P(e.caret,e.caret),x()):P(e.caret,e.caret)},W=t=>w(g(n,r),t[0],t[1]),I=(e,o)=>{if(e.text===n)return;i.record({text:n,start:o[0],end:o[1]},"edit",l()),n=e.text,t.write(n);const[s,a]=y(g(n,r),e.selectionStart,e.selectionEnd);P(s,a),x()},K=t=>{if(u)return;const e=F(),[l,o]=W(e),i=q({value:n,rules:r,start:l,end:o,style:t,pending:b});if("pending"===i.kind)return b=i.pending,void x();I(i.result,e)},R=e=>{n=e.text,t.write(n),P(e.start,e.end)},U=e=>{u||(u=!0,X.removeEventListener("selectionchange",Y),J(c),t.end(e))},$=(t,e)=>{const l=F();!u&&l[0]!==l[1]&&t.clipboardData&&(t.preventDefault(),t.clipboardData.setData("text/plain",g(n,r).text.slice(l[0],l[1])),t.clipboardData.setData(p,E(n,r,l[0],l[1])),e&&V(T(n,r,l[0],l[1],{text:""}),l,"edit"))},z=t=>t.preventDefault(),H=()=>{t.remount?.()},Z=[["keydown",t=>{if(u||t.isComposing)return;const e=t.metaKey||t.ctrlKey;if("Escape"===t.key)return t.preventDefault(),t.stopPropagation(),void U("escape");if("Enter"===t.key&&(!t.shiftKey||e))return t.preventDefault(),t.stopPropagation(),void U("enter");if(e&&("z"===t.key||"Z"===t.key||"y"===t.key)){t.preventDefault(),t.stopPropagation();const e=F(),r={text:n,start:e[0],end:e[1]},l="y"===t.key||t.shiftKey?i.redo(r):i.undo(r);l&&R(l)}}],["beforeinput",e=>{if(u)return;if("insertCompositionText"===e.inputType)return;e.preventDefault();const l=F(),o=O(c,t.skip),s="function"==typeof e.getTargetRanges?e.getTargetRanges()[0]:void 0,a=s&&!s.collapsed?[o.at(s.startContainer,s.startOffset),o.at(s.endContainer,s.endOffset)]:null,d=N({value:n,rules:r,multiline:t.multiline,inputType:e.inputType,data:e.data??e.dataTransfer?.getData("text/plain")??"",html:e.dataTransfer?.getData("text/html"),doc:D(),sel:l,target:a,pending:b&&b.at===W(l)[0]?b:null});if(d){if("type"!==d.kind&&"edit"!==d.kind||(b=null),"history"===d.kind){const t={text:n,start:l[0],end:l[1]},e="undo"===d.dir?i.undo(t):i.redo(t);return void(e&&R(e))}"format"!==d.kind?V(d.edit,d.range,d.kind):K(d.style)}}],["compositionstart",()=>{d=F()}],["compositionend",e=>{const o=d;if(d=null,!u&&o)if(e.data){const s=T(n,r,o[0],o[1],{text:e.data});i.record({text:n,start:o[0],end:o[1]},"type",l()),n=s.text,t.write(n),H(),P(s.caret,s.caret)}else H(),P(o[0],o[0])}],["paste",e=>{if(u)return;e.preventDefault();const l=F(),o=e.clipboardData,i=o?.getData(p)??"",s=i?t.multiline?i:i.replace(/\s*\r?\n\s*/g," "):h({html:o?.getData("text/html")??"",text:o?.getData("text/plain")??""},{doc:D(),multiline:t.multiline,rules:r});V(T(n,r,l[0],l[1],{markup:s}),l,"edit")}],["copy",t=>$(t,!1)],["cut",t=>$(t,!0)],["drop",z],["dragstart",z],["blur",e=>{if(u||null!==d||k)return;const n=e.target,r=n.ownerDocument.defaultView,l=()=>{u||(n.isConnected&&n===t.element()?k||n.ownerDocument.activeElement===n||U("blur"):P(m[0],m[1]))};r?.requestAnimationFrame?r.requestAnimationFrame(l):setTimeout(l,0)}],["focus",()=>{k=!1}]];function G(t){t.setAttribute("contenteditable","true"),t.setAttribute("spellcheck","false"),t.setAttribute("data-es-typing","");for(const[e,n]of Z)t.addEventListener(e,n)}function J(t){for(const[e,n]of Z)t.removeEventListener(e,n);null===v.contenteditable?t.removeAttribute("contenteditable"):t.setAttribute("contenteditable",v.contenteditable),null===v.spellcheck?t.removeAttribute("spellcheck"):t.setAttribute("spellcheck",v.spellcheck),t.removeAttribute("data-es-typing")}function Q(){const e=t.element();e&&e!==c&&(J(c),c=e,G(c))}const X=c.ownerDocument;function Y(){u||x()}return X.addEventListener("selectionchange",Y),G(c),c.focus({preventScroll:!0}),P(t.caret[0],t.caret[1]),{get value(){return n},update(t){if(t===n)return;const e=g(t,r).text.length,[l,o]=F();n=t,i.reset(),P(Math.min(l,e),Math.min(o,e))},stop(t="stop"){U(t)},pressed(){const[t,e]=W(F()),l=o(n,t,e,r),i={};for(const e of["bold","italic","underline","strike","sup","sub","link"]){const n=l.has(e),r=b&&b.at===t?b:null;i[e]=!!r?.add.includes(e)||!r?.drop.includes(e)&&n}return{marks:i,list:s(n,t,e,r),selected:e>t}},press:K,insert(t){if(u)return;k=!1;const e=F(),[r,l]=W(e),o=r+t.length;I({text:n.slice(0,r)+t+n.slice(l),selectionStart:o,selectionEnd:o},e),Q(),c.focus({preventScroll:!0})},hold(){u||(F(),k=!0)},list(e){if(u||!t.multiline)return;const l=F(),[o,i]=W(l),c=s(n,o,i,r);I(a(n,o,i,c===e?null:e,r),l)}}}export{p as MARKUP_CLIPBOARD_TYPE,B as TYPING_BURST_MS,C as createHistory,T as editVisible,q as markPress,E as markupOfRange,A as newLine,h as pasteToMarkup,N as richInput,g as richLayout,w as selectionToSource,y as selectionToVisible,S as setBullet,P as startCanvasTyping,O as textMap,k as toSource,x as toSourceStart,v as toVisible};
@@ -0,0 +1 @@
1
+ var e={title:"Add",contextAll:"Sections and blocks",done:"Done",doneDescription:"Close Add and go back",templates:"Your templates",tile:({name:e})=>`Add ${e}`,hint:"Drag onto the page.",search:"Search",onlySections:"Only sections go here",notInside:({name:e})=>`Cannot go inside ${e}`,addingTo:({name:e})=>`Adding to ${e}`,addingBefore:({name:e})=>`Adding before ${e}`,addingAtEnd:"Adding at the end of the page",addingHere:"Adding here"};var a={savedAgo:function({seconds:e}){const a=Math.max(0,Math.floor(e));if(a<1)return"Saved just now";if(a<60)return`Saved ${a} second${1===a?"":"s"} ago`;const o=Math.floor(a/60);if(o<60)return`Saved ${o} minute${1===o?"":"s"} ago`;const n=Math.floor(o/60);return`Saved ${n} hour${1===n?"":"s"} ago`},saved:"All changes saved",saving:"Saving",pending:"Changes not saved yet — saving in a moment",failedIn:({seconds:e})=>`Not saved — trying again in ${e} s`,failedSoon:"Not saved — trying again soon",offline:"You’re offline — we’ll save when you’re back",pausedHeld:"Auto-save is off — changes not saved",paused:"Auto-save is off",locked:({editing:e})=>`Not saving — ${e}`,blockedOffline:"You’re offline. Try again when you’re back online.",blockedFailed:"Your last changes are not saved yet. Try again when they are.",blockedConflict:"Your last save was refused. See the notice below."},o={loading:"Loading…",waitingForAuthorization:"Waiting for editor authorization…",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:e})=>`No page with slug "${e}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:e})=>`Could not load the document — ${e}`,noun:"page",pageSettings:"Page settings",header:"Header",footer:"Footer",pageSections:"Page",templateSections:"Template",addSection:"Add section",addSectionHere:"Add section here",done:"Done",copied:({name:e})=>`Copied ${e}`,pasteRefused:({name:e})=>`${e} can’t be pasted here.`,add:e,canvasAddBlock:"Add block",railMedia:"Media library",leftPanel:"Left panel",resizeLeftPanel:"Resize left panel",leave:{title:"Unsaved changes",body:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them.",cancel:"Cancel",discard:"Discard & leave",save:"Save & leave",saving:"Saving…"},bar:{undo:"Undo",redo:"Redo",refresh:"Reload the preview",refreshTip:"Reload the preview (keeps your place)",notSaving:"Not saving — see the notice below",retry:"Retry now",autoSaveOff:"Auto-save is off — click to turn it back on (saves your held edits)",autoSaveOn:"Auto-save is on — click to pause it",views:"Left panel views",saveOptions:"Save options",autoSave:"Auto-save",saveNow:"Save now"},saveStatus:a,menu:{undo:"Undo",redo:"Redo",collapseAll:"Collapse all layers",selectAll:"Select all",pinned:"Pinned — can’t be moved or deleted",clipboardRefused:"Your browser won’t let us read the clipboard — press ⌘V"},layers:"Layers",expandAll:"Expand all sections",collapseAll:"Collapse all sections",nothingToFold:"Nothing to fold on this page",editFooter:"Edit the site footer",rename:"Rename",deleteNamed:({name:e})=>`Delete ${e}`,hideNamed:({name:e})=>`Hide ${e}`,showNamed:({name:e})=>`Show ${e}`,addBlockHere:"Add block here",sectionFirst:({name:e})=>`“${e}” is already first`,sectionLast:({name:e})=>`“${e}” is already last`,sectionMoved:({name:e,n:a,total:o})=>`Moved “${e}” to position ${a} of ${o}`,sectionAdded:({name:e})=>`Added “${e}” section`,deleted:({name:e})=>`Deleted “${e}”`,resizeSettingsPanel:"Resize settings panel",sectionSettings:({name:e})=>`${e} settings`,headerSettings:"Header settings",addBlockMenu:"Add block",deviceNote:{tablet:"Tablet uses the desktop settings.",mobile:"Showing the phone settings for this section."}};export{e as DEFAULT_SCREEN_ADD_WORDS,a as DEFAULT_SCREEN_SAVE_STATUS_WORDS,o as DEFAULT_SCREEN_WORDS};
@@ -0,0 +1,5 @@
1
+ import{buildPaletteSections as e,pinnedSection as t,categoryLabel as o}from"./chunk-PA3PNTVV.js";import{blockTypesIn as n}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as i,PanelModeExit as r}from"./chunk-PPL7GB7D.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as c}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as a,useScreenBlockRules as p}from"./chunk-77DQCEEF.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-VWXUMVCD.js";import{useEasel as d}from"./chunk-PE6ZY5IW.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{AddPanel as y}from"./chunk-47RGVCPH.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-GG4FGBFR.js";import{useState as u,useEffect as k,useMemo as b}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as j,jsxs as v,Fragment as E}from"react/jsx-runtime";var V=e=>`section:${e}`,B=e=>`block:${e}`,P=e=>`template:${e}`;function $({at:$,placeBlocks:w,canTake:C,onPick:D,itemFor:F,session:G,siteWide:I,onClose:O,onHide:R,readOnly:x}){const H=d(e=>e.config),L=a(),{labelAtLevel:T,categoryLabel:W,firstSection:A,Icon:N,Thumbnail:M}=L,{blockIsOffered:Q,canAddTo:Y}=p(),z=f("screen",m).add,S=f("drag",h).add,Z=l(),[J,K]=u([]);k(()=>{let e=!1;const t=e=>Q(e,Z);return s(Z).list().then(o=>{if(e)return;const s=H.components;K(o.filter(e=>e.node?.type&&s[e.node.type]&&n(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[H,Z]);const U=b(()=>e(H,L),[H]),X=e=>({type:V(e.type),label:e.name,cover:/* @__PURE__ */j(M,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:z.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),q=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=J.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null},_=e=>/* @__PURE__ */j("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */j(N,{type:e,size:26})}),ee=b(()=>{const e=t(U,A),n=/* @__PURE__ */new Map,s=e=>{!n.has(e.type)&&Q(e.type,Z)&&n.set(e.type,e)};for(const t of e?[e]:U){const e=Y(t.type)?.choices??[];e.forEach(s),e.forEach(e=>Y(e.type,1)?.choices?.forEach(s))}w?.forEach(s);const i=new Set(U.map(e=>e.type)),r=[...n.values()].filter(e=>!i.has(e.type)),l=e=>({type:B(e.type),label:e.label,cover:_(e.type),title:z.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>n.has(e.type)?{...X(e),cover:_(e.type)}:X(e),p=[];J.length>0&&p.push({key:"templates",title:z.templates,tiles:J.map(e=>{return{type:P(e.id),label:e.name,cover:/* @__PURE__ */j(M,{type:e.node.type}),keywords:[(t=e.node.type,T(t,"section",H.components[t]?.label??t)),e.node.type]};var t})});const m=r.filter(e=>!e.group);let d=!1;for(const t of Object.keys(H.categories??{})){const n=U.filter(e=>e.cat===t);if(0===n.length)continue;const s=e&&n.some(t=>t.type===e.type)?e:null,i=(s?[s,...n.filter(e=>e.type!==s.type)]:n).map(a);s&&!d&&(i.splice(1,0,...m.map(l)),d=!0),p.push({key:`category:${t}`,title:o(H,t,W),tiles:i})}const f=p.find(e=>e.key?.startsWith("category:"));if(!d&&f&&m.length>0&&(f.tiles=[...f.tiles,...m.map(l)],d=!0),c(r.filter(e=>e.group||!d)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(l)})}),!C)return p;const y=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=q(e.type),o=t?C(t):null;return o?{...e,disabled:!0,disabledReason:o}:e})})),h=e=>e.tiles.some(e=>!e.disabled);return[...y.filter(h),...y.filter(e=>!h(e))]},[J,U,H,z,C,w,Z]);/* @__PURE__ */
2
+ return v(E,{children:[
3
+ /* @__PURE__ */j(i,{icon:/* @__PURE__ */j(g,{size:15}),title:z.title,context:z.contextAll,actions:/* @__PURE__ */j(r,{label:z.done,description:z.doneDescription,onClick:O}),onHide:R}),
4
+ /* @__PURE__ */v("div",{className:"sf-addside sf-scroll",children:[
5
+ /* @__PURE__ */j(y,{groups:ee,session:G,itemFor:e=>F(q(e)??{kind:"section",type:e}),onInsert:D?e=>{const t=q(e);t&&D(t)}:void 0,at:$,hint:z.hint,searchLabel:z.search,readOnly:x,words:S}),I??null]})]})}export{$ as AddSidePanel,B as blockKey,V as sectionKey,P as templateKey};
@@ -1,25 +1,25 @@
1
- import{DEFAULT_COPY_WORDS as e}from"../chunk-Q6AM43CA.js";import{selectionToVisible as t,selectionToSource as n,richLayout as r,createHistory as l,markPress as o,pasteToMarkup as a,richInput as s,editVisible as i,MARKUP_CLIPBOARD_TYPE as c,markupOfRange as u}from"../chunk-IL6QCPO6.js";export{MARKUP_CLIPBOARD_TYPE,TYPING_BURST_MS,createHistory,editVisible,markupOfRange,newLine,pasteToMarkup,richInput,richLayout,selectionToSource,selectionToVisible,setBullet,startCanvasTyping,textMap,toSource,toSourceStart,toVisible}from"../chunk-IL6QCPO6.js";import{FieldNumber as d}from"../chunk-66LWADFP.js";import{FieldSelect as p}from"../chunk-65Z5FSAW.js";import{SettingsSegmented as h,SettingsSwitch as f,SettingsField as m}from"../chunk-XJCMEEBH.js";import"../chunk-FFYXVAAL.js";import{GoldTextInput as g}from"../chunk-2FZJWH24.js";import{RETIRED_MARKS as y,applyMark as v,markupTools as b,marksIn as w,STANDARD_MARKUP as k,findLink as S,markedAt as x,listIn as C,colorIn as E,spanFor as D,clearStyle as N,toggleMark as L,colorOver as T,setList as O,unlinkAt as M,removeLink as P,linkOver as R,writeLink as z}from"../chunk-546BBOPE.js";import{useWords as B}from"../chunk-MFIRYGHW.js";import{withTip as F}from"../chunk-P2VEMZH5.js";import{Tooltip as $,ColorSwatch as H,ColorPickerPanel as K,Button as j,IconButton as V,registerModalEscapeInterceptor as W,textToolbarRows as A,TextToolbar as I,LinkPicker as U}from"efficient-shell/ui";export{TextToolbar}from"efficient-shell/ui";import{useRef as q,useState as Y,useLayoutEffect as Z,useEffect as _,useId as Q}from"react";import{AlignJustifyIcon as X,AlignRightIcon as G,AlignCenterIcon as J,AlignLeftIcon as ee,ParagraphSpacingIcon as te,LetterSpacingIcon as ne,LineSpacingIcon as re,TextSizeIcon as le,ClearMarksIcon as oe,StylesIcon as ae,TypeIcon as se,AlignmentIcon as ie,ListFormatIcon as ce,CaseIcon as ue,ItalicIcon as de,LinkIcon as pe,QuietIcon as he,EmphasisIcon as fe,StrikeIcon as me,BoldIcon as ge,NumberedListIcon as ye,ListIcon as ve,ListNoneIcon as be,CaseLowerIcon as we,CaseCapitalizedIcon as ke,CaseUpperIcon as Se,CaseNormalIcon as xe}from"efficient-shell/icons/efficient";import{jsx as Ce,jsxs as Ee,Fragment as De}from"react/jsx-runtime";var Ne=["left","center","right","justify"],Le=e.align,Te={left:/* @__PURE__ */Ce(ee,{}),center:/* @__PURE__ */Ce(J,{}),right:/* @__PURE__ */Ce(G,{}),justify:/* @__PURE__ */Ce(X,{})},Oe={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function Me(e,t=Le){return Ne.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:Te[e],title:t[e]}))}var Pe=/[\u1100-\u11ff\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/;function Re(e){if(e.every(e=>e.label===Le[e.id]))return e.length>3?Oe.four:Oe.three;const t=e.map(e=>[...e.label].reduce((e,t)=>e+(Pe.test(t)?13:8),0));return{labelsPx:t.reduce((e,t)=>e+t,0),widestLabelPx:Math.max(0,...t)}}function ze(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function Be(e,t,n,r=v){const{start:l,end:o}=ze(e,n);return r(e,l,o,t)}function Fe(e,t,n){const{start:r,end:l}=ze(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}function $e(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 He(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 Ke(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 je({value:e,rules:l,multiline:o,readOnly:d=!1,placeholder:p,ariaLabel:h,handle:f,onEdit:m,onSelect:g,onHistory:y,onFormat:v,pending:b,onCommit:w,onCancel:k}){const S=q(null),x=q(null),C=q(null),E=q(null),D=q(null),N=q(e),[L,T]=Y(0),O=q({value:e,rules:l,multiline:o,readOnly:d,pending:b,onEdit:m,onHistory:y,onFormat:v});O.current={value:e,rules:l,multiline:o,readOnly:d,pending:b,onEdit:m,onHistory:y,onFormat:v};const M=()=>{const e=S.current,t=x.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=He(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?He(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},P=(e,t)=>{const n=S.current,r=x.current;if(!n||!r)return;const[l,o]=Ke(r,e),[a,s]=Ke(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};f.current={getSource(){const e=M(),t=x.current;if(!e||!t)return null;const[r,l]=n(t.layout,e[0],e[1]);return{start:r,end:l}},setSource(e,t,n){E.current={text:n,src:[e,t]},T(e=>e+1)},focus(){S.current?.focus()},rangeOf(e,n){const r=S.current,l=x.current;if(!r||!l)return null;const[o,a]=t(l.layout,e,n),[s,i]=Ke(l,o),[c,u]=Ke(l,a),d=r.ownerDocument.createRange();return d.setStart(s,i),d.setEnd(c,u),d}},Z(()=>{const n=S.current;if(!n||D.current)return;const o=E.current?null:M();x.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=$e(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,r(e,l)),C.current=e;const a=E.current;if(!a||a.text!==e)return void(o&&n.ownerDocument.activeElement===n&&P(o[0],Math.min(o[1],x.current.layout.text.length)));E.current=null;const s=x.current.layout,[i,c]=a.vis??t(s,a.src[0],a.src[1]);n.ownerDocument.activeElement!==n&&n.focus(),P(i,c)},[e,l,L]);const R=(e,t,r)=>{const l=x.current,[o,a]=n(l.layout,t[0],t[1]);E.current={text:e.text,vis:[e.caret,e.caret]},e.text!==O.current.value?O.current.onEdit(e.text,{start:o,end:a},r):T(e=>e+1)};_(()=>{const e=S.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:a}=O.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const i=x.current,c=M();if(!i||!c)return;const u="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0,d=u&&!u.collapsed?[He(i,e,u.startContainer,u.startOffset),He(i,e,u.endContainer,u.endOffset)]:null,p=s({value:n,rules:r,multiline:l,inputType:t.inputType,data:t.data??t.dataTransfer?.getData("text/plain")??"",html:t.dataTransfer?.getData("text/html"),doc:e.ownerDocument,sel:c,target:d,pending:a});p&&("history"!==p.kind?"format"!==p.kind?R(p.edit,p.range,p.kind):O.current.onFormat(p.style):O.current.onHistory(p.dir))},n=()=>{D.current||T(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),_(()=>{const e=S.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=f.current?.getSource();e&&g(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const z=(t,n=!1)=>{const r=M();if(!r||r[0]===r[1])return;t.preventDefault();const o=x.current;t.clipboardData.setData("text/plain",o.layout.text.slice(r[0],r[1])),t.clipboardData.setData(c,u(e,l,r[0],r[1])),n&&!d&&R(i(e,l,r[0],r[1],{text:""}),r,"edit")};/* @__PURE__ */
1
+ import{DEFAULT_COPY_WORDS as e}from"../chunk-Q6AM43CA.js";import{selectionToVisible as t,selectionToSource as n,richLayout as r,createHistory as l,markPress as o,pasteToMarkup as a,richInput as s,editVisible as i,MARKUP_CLIPBOARD_TYPE as c,markupOfRange as u}from"../chunk-TJ6NRHYF.js";export{MARKUP_CLIPBOARD_TYPE,TYPING_BURST_MS,createHistory,editVisible,markupOfRange,newLine,pasteToMarkup,richInput,richLayout,selectionToSource,selectionToVisible,setBullet,startCanvasTyping,textMap,toSource,toSourceStart,toVisible}from"../chunk-TJ6NRHYF.js";import{FieldNumber as d}from"../chunk-66LWADFP.js";import{FieldSelect as p}from"../chunk-65Z5FSAW.js";import{SettingsSegmented as h,SettingsSwitch as f,SettingsField as m}from"../chunk-XJCMEEBH.js";import"../chunk-FFYXVAAL.js";import{GoldTextInput as g}from"../chunk-2FZJWH24.js";import{RETIRED_MARKS as y,applyMark as v,markupTools as b,marksIn as w,STANDARD_MARKUP as k,findLink as S,markedAt as x,listIn as C,colorIn as E,spanFor as D,clearStyle as N,toggleMark as L,colorOver as T,setList as M,unlinkAt as O,removeLink as R,linkOver as z,writeLink as P}from"../chunk-546BBOPE.js";import{useWords as B}from"../chunk-MFIRYGHW.js";import{withTip as F}from"../chunk-P2VEMZH5.js";import{Tooltip as H,ColorSwatch as $,ColorPickerPanel as K,Button as j,IconButton as V,registerModalEscapeInterceptor as W,textToolbarRows as A,TextToolbar as U,LinkPicker as I}from"efficient-shell/ui";export{TextToolbar}from"efficient-shell/ui";import{useRef as Y,useState as q,useLayoutEffect as J,useEffect as Z,useId as _}from"react";import{AlignJustifyIcon as X,AlignRightIcon as G,AlignCenterIcon as Q,AlignLeftIcon as ee,ParagraphSpacingIcon as te,LetterSpacingIcon as ne,LineSpacingIcon as re,TextSizeIcon as le,ClearMarksIcon as oe,StylesIcon as ae,TypeIcon as se,AlignmentIcon as ie,ListFormatIcon as ce,CaseIcon as ue,ItalicIcon as de,LinkIcon as pe,QuietIcon as he,EmphasisIcon as fe,StrikeIcon as me,BoldIcon as ge,NumberedListIcon as ye,ListIcon as ve,ListNoneIcon as be,CaseLowerIcon as we,CaseCapitalizedIcon as ke,CaseUpperIcon as Se,CaseNormalIcon as xe}from"efficient-shell/icons/efficient";import{jsx as Ce,jsxs as Ee,Fragment as De}from"react/jsx-runtime";var Ne=["left","center","right","justify"],Le=e.align,Te={left:/* @__PURE__ */Ce(ee,{}),center:/* @__PURE__ */Ce(Q,{}),right:/* @__PURE__ */Ce(G,{}),justify:/* @__PURE__ */Ce(X,{})},Me={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function Oe(e,t=Le){return Ne.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:Te[e],title:t[e]}))}var Re=/[\u1100-\u11ff\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/;function ze(e){if(e.every(e=>e.label===Le[e.id]))return e.length>3?Me.four:Me.three;const t=e.map(e=>[...e.label].reduce((e,t)=>e+(Re.test(t)?13:8),0));return{labelsPx:t.reduce((e,t)=>e+t,0),widestLabelPx:Math.max(0,...t)}}function Pe(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function Be(e,t,n,r=v){const{start:l,end:o}=Pe(e,n);return r(e,l,o,t)}function Fe(e,t,n){const{start:r,end:l}=Pe(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}function He(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 $e(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 Ke(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 je({value:e,rules:l,multiline:o,readOnly:d=!1,placeholder:p,ariaLabel:h,handle:f,onEdit:m,onSelect:g,onHistory:y,onFormat:v,pending:b,onCommit:w,onCancel:k}){const S=Y(null),x=Y(null),C=Y(null),E=Y(null),D=Y(null),N=Y(e),[L,T]=q(0),M=Y({value:e,rules:l,multiline:o,readOnly:d,pending:b,onEdit:m,onHistory:y,onFormat:v});M.current={value:e,rules:l,multiline:o,readOnly:d,pending:b,onEdit:m,onHistory:y,onFormat:v};const O=()=>{const e=S.current,t=x.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=$e(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?$e(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},R=(e,t)=>{const n=S.current,r=x.current;if(!n||!r)return;const[l,o]=Ke(r,e),[a,s]=Ke(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};f.current={getSource(){const e=O(),t=x.current;if(!e||!t)return null;const[r,l]=n(t.layout,e[0],e[1]);return{start:r,end:l}},setSource(e,t,n){E.current={text:n,src:[e,t]},T(e=>e+1)},focus(){S.current?.focus()},rangeOf(e,n){const r=S.current,l=x.current;if(!r||!l)return null;const[o,a]=t(l.layout,e,n),[s,i]=Ke(l,o),[c,u]=Ke(l,a),d=r.ownerDocument.createRange();return d.setStart(s,i),d.setEnd(c,u),d}},J(()=>{const n=S.current;if(!n||D.current)return;const o=E.current?null:O();x.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=He(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,r(e,l)),C.current=e;const a=E.current;if(!a||a.text!==e)return void(o&&n.ownerDocument.activeElement===n&&R(o[0],Math.min(o[1],x.current.layout.text.length)));E.current=null;const s=x.current.layout,[i,c]=a.vis??t(s,a.src[0],a.src[1]);n.ownerDocument.activeElement!==n&&n.focus(),R(i,c)},[e,l,L]);const z=(e,t,r)=>{const l=x.current,[o,a]=n(l.layout,t[0],t[1]);E.current={text:e.text,vis:[e.caret,e.caret]},e.text!==M.current.value?M.current.onEdit(e.text,{start:o,end:a},r):T(e=>e+1)};Z(()=>{const e=S.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:a}=M.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const i=x.current,c=O();if(!i||!c)return;const u="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0,d=u&&!u.collapsed?[$e(i,e,u.startContainer,u.startOffset),$e(i,e,u.endContainer,u.endOffset)]:null,p=s({value:n,rules:r,multiline:l,inputType:t.inputType,data:t.data??t.dataTransfer?.getData("text/plain")??"",html:t.dataTransfer?.getData("text/html"),doc:e.ownerDocument,sel:c,target:d,pending:a});p&&("history"!==p.kind?"format"!==p.kind?z(p.edit,p.range,p.kind):M.current.onFormat(p.style):M.current.onHistory(p.dir))},n=()=>{D.current||T(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),Z(()=>{const e=S.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=f.current?.getSource();e&&g(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const P=(t,n=!1)=>{const r=O();if(!r||r[0]===r[1])return;t.preventDefault();const o=x.current;t.clipboardData.setData("text/plain",o.layout.text.slice(r[0],r[1])),t.clipboardData.setData(c,u(e,l,r[0],r[1])),n&&!d&&z(i(e,l,r[0],r[1],{text:""}),r,"edit")};/* @__PURE__ */
2
2
  return Ee("div",{className:"es-rich-wrap",children:[p&&""===e?/* @__PURE__ */Ce("div",{className:"es-rich-placeholder","aria-hidden":"true",children:p}):null,
3
- /* @__PURE__ */Ce("div",{ref:S,className:`es-rich${o?" is-multiline":" is-single"}${d?" is-off":""}`,contentEditable:!d,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":o,"aria-label":h,"aria-readonly":d||void 0,"aria-placeholder":p,tabIndex:d?-1:0,spellCheck:!0,onFocus:()=>{N.current=e},onBlur:()=>{e!==N.current&&w?.(e),N.current=e},onKeyDown:t=>{if("Escape"===t.key)return t.preventDefault(),k?.(N.current),void(N.current=e);"Enter"!==t.key||o||(t.preventDefault(),e!==N.current&&w?.(e),N.current=e)},onCompositionStart:()=>{const e=M()??[0,0];D.current={from:e[0],to:e[1]}},onCompositionEnd:e=>{const t=D.current;if(D.current=null,!t)return;const{value:n,rules:r,pending:l}=O.current;e.data?R(i(n,r,t.from,t.to,{text:e.data,add:l?.add,drop:l?.drop,color:l?.color}),[t.from,t.to],"type"):T(e=>e+1)},onCopy:e=>z(e),onCut:e=>z(e,!0),onPaste:t=>{if(t.preventDefault(),d)return;const n=M();if(!n)return;const r=t.clipboardData.getData(c),s=r?o?r:r.replace(/\s*\r?\n\s*/g," "):a({html:t.clipboardData.getData("text/html"),text:t.clipboardData.getData("text/plain")},{doc:t.currentTarget.ownerDocument,multiline:o,rules:l});R(i(e,l,n[0],n[1],{markup:s}),n,"edit")}})]})}var Ve={fontSize:{key:"fontSize",nameKey:"fontSize",icon:/* @__PURE__ */Ce(le,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */Ce(re,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */Ce(ne,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */Ce(te,{}),unit:"px",step:1,shiftStep:10,min:0}};function We(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function Ae({cells:t,words:n,readOnly:r=!1}){const l=n??e.cells,o=Q();/* @__PURE__ */
3
+ /* @__PURE__ */Ce("div",{ref:S,className:`es-rich${o?" is-multiline":" is-single"}${d?" is-off":""}`,contentEditable:!d,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":o,"aria-label":h,"aria-readonly":d||void 0,"aria-placeholder":p,tabIndex:d?-1:0,spellCheck:!0,onFocus:()=>{N.current=e},onBlur:()=>{e!==N.current&&w?.(e),N.current=e},onKeyDown:t=>{if("Escape"===t.key)return t.preventDefault(),k?.(N.current),void(N.current=e);"Enter"!==t.key||o||(t.preventDefault(),e!==N.current&&w?.(e),N.current=e)},onCompositionStart:()=>{const e=O()??[0,0];D.current={from:e[0],to:e[1]}},onCompositionEnd:e=>{const t=D.current;if(D.current=null,!t)return;const{value:n,rules:r,pending:l}=M.current;e.data?z(i(n,r,t.from,t.to,{text:e.data,add:l?.add,drop:l?.drop,color:l?.color}),[t.from,t.to],"type"):T(e=>e+1)},onCopy:e=>P(e),onCut:e=>P(e,!0),onPaste:t=>{if(t.preventDefault(),d)return;const n=O();if(!n)return;const r=t.clipboardData.getData(c),s=r?o?r:r.replace(/\s*\r?\n\s*/g," "):a({html:t.clipboardData.getData("text/html"),text:t.clipboardData.getData("text/plain")},{doc:t.currentTarget.ownerDocument,multiline:o,rules:l});z(i(e,l,n[0],n[1],{markup:s}),n,"edit")}})]})}var Ve={fontSize:{key:"fontSize",nameKey:"fontSize",icon:/* @__PURE__ */Ce(le,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */Ce(re,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */Ce(ne,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */Ce(te,{}),unit:"px",step:1,shiftStep:10,min:0}};function We(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function Ae({cells:t,words:n,readOnly:r=!1}){const l=n??e.cells,o=_();/* @__PURE__ */
4
4
  return Ce("div",{className:"es-copy-cells-fit",children:/* @__PURE__ */Ce("div",{className:"es-copy-cells",children:t.map(e=>{const t=e.scale??1,n=e.name??(e.nameKey?l[e.nameKey]:e.key),a=e.unit??"",s=e.step??1,i=`${o}-${e.key}`;/* @__PURE__ */
5
5
  return Ee("div",{className:"es-copy-cell",children:[
6
6
  /* @__PURE__ */Ce("label",{className:"es-field-label es-copy-cell-name",htmlFor:i,children:n}),
7
- /* @__PURE__ */Ce(d,{id:i,value:We(e.value,t),styleValue:We(e.styleValue,t),onChange:n=>e.onChange(void 0===n?void 0:Number((n/t).toFixed(6))),min:e.min,max:e.max,step:s,shiftStep:e.shiftStep,icon:e.icon,unit:a||void 0,steppers:"compact",readOnly:r,ariaLabel:n,title:l.tip({name:n,step:s,unit:a})})]},e.key)})})})}var Ie=e=>e.preventDefault();function Ue({colors:e,current:t,words:n,onPick:r}){const l=null===t?null:t.startsWith("#")?t.toLowerCase():e.find(e=>e.name===t)?.value.toLowerCase()??null;/* @__PURE__ */
7
+ /* @__PURE__ */Ce(d,{id:i,value:We(e.value,t),styleValue:We(e.styleValue,t),onChange:n=>e.onChange(void 0===n?void 0:Number((n/t).toFixed(6))),min:e.min,max:e.max,step:s,shiftStep:e.shiftStep,icon:e.icon,unit:a||void 0,steppers:"compact",readOnly:r,ariaLabel:n,title:l.tip({name:n,step:s,unit:a})})]},e.key)})})})}var Ue=e=>e.preventDefault();function Ie({colors:e,current:t,words:n,onPick:r}){const l=null===t?null:t.startsWith("#")?t.toLowerCase():e.find(e=>e.name===t)?.value.toLowerCase()??null;/* @__PURE__ */
8
8
  return Ee("div",{className:"es-copy-pop es-copy-colors",role:"dialog","aria-label":n.title,onMouseDown:e=>{"INPUT"!==e.target.tagName&&e.preventDefault()},children:[
9
9
  /* @__PURE__ */Ce("span",{className:"es-copy-pop-label",children:n.theme}),
10
- /* @__PURE__ */Ce("div",{className:"es-copy-theme",role:"group","aria-label":n.theme,children:e.map(e=>/* @__PURE__ */Ce($,{content:`${e.label} · ${e.value.toUpperCase()}`,children:/* @__PURE__ */Ce(H,{color:e.value,size:"sm",className:"es-copy-theme-swatch","data-color":e.name,"aria-label":e.label,selected:t===e.name,onMouseDown:Ie,onClick:()=>r(e.name)})},e.name))}),
10
+ /* @__PURE__ */Ce("div",{className:"es-copy-theme",role:"group","aria-label":n.theme,children:e.map(e=>/* @__PURE__ */Ce(H,{content:`${e.label} · ${e.value.toUpperCase()}`,children:/* @__PURE__ */Ce($,{color:e.value,size:"sm",className:"es-copy-theme-swatch","data-color":e.name,"aria-label":e.label,selected:t===e.name,onMouseDown:Ue,onClick:()=>r(e.name)})},e.name))}),
11
11
  /* @__PURE__ */Ce("span",{className:"es-copy-pop-label",children:n.any}),
12
12
  /* @__PURE__ */Ce(K,{className:"es-copy-any",value:l??"",onChange:e=>{e!==t&&r(e)},label:n.title,dragWrites:"end"}),
13
- /* @__PURE__ */Ce("div",{className:"es-copy-pop-foot",children:/* @__PURE__ */Ce(j,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onMouseDown:Ie,onClick:()=>r(null),children:n.remove})})]})}var qe=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n));var Ye=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom});function Ze(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 _e(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 Qe=/* @__PURE__ */new Set([...y,"clear"]),Xe={bold:/* @__PURE__ */Ce(ge,{size:16}),italic:/* @__PURE__ */Ce(de,{size:16}),strike:/* @__PURE__ */Ce(me,{size:16}),highlight:/* @__PURE__ */Ce(fe,{size:16}),quiet:/* @__PURE__ */Ce(he,{size:16}),link:/* @__PURE__ */Ce(pe,{size:16}),clear:/* @__PURE__ */Ce(oe,{size:16})};function Ge(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 Je={bold:"is-bold",italic:"is-italic",strike:"is-strike"};function et({tools:t,onApply:n,disabled:r=!1,actions:l,align:o,glyphs:a,ariaLabel:s,pressed:i,open:c=null}){const u=B("copy",e),d=("string"==typeof t[0]?b(t).map(e=>({...e,...u.marks[e.style]})):t).filter(e=>!Qe.has(e.style));return 0!==d.length||l||o?/* @__PURE__ */Ee("div",{className:"es-copy-bar",role:"group","aria-label":s??u.formatting,children:[d.map(e=>{const t=a?.[e.style]??Xe[e.style],l=c===e.style||Boolean(i?.[e.style]),o="link"===e.style&&Boolean(i);return F(e.title,/* @__PURE__ */Ce(V,{onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.style),disabled:r,"aria-label":e.name??e.title,"aria-keyshortcuts":Ge(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":Je[e.style]?` ${Je[e.style]}`:""}${l?" is-active":""}`,children:t??e.label},e.style))}),l?/* @__PURE__ */Ee(De,{children:[
14
- /* @__PURE__ */Ce("span",{className:"es-copy-bar-split","aria-hidden":"true"}),l]}):null,o?/* @__PURE__ */Ce("span",{className:"es-copy-bar-end",children:o}):null]}):null}function tt({target:e,onChange:t}){const n=q(null);return Z(()=>{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 nt=["bold","italic","underline","strike","sup","sub"];function rt({value:t,onChange:n,onCommit:r,onCancel:s,multiline:i=!1,placeholder:c,ariaLabel:u,className:d,readOnly:p=!1,rules:m,tools:y=[],writeMark:$,actions:H,align:K,glyphs:V,barLabel:X,renderFooter:G,inputRef:J,barShows:ee="always",richText:te=!0,defaultShowMarks:ne=!1,toolbar:re="final",colors:le,cells:ae,letterCase:se,lastTool:ie}){const ce="final"===re,ue=B("copy",e),de=q(null),pe=J??de,[he,fe]=Y(!1),[me,ge]=Y(null),ye=q(l()).current,ve=q(null);_(()=>{const e=ve.current;e&&t===e.to?ve.current=null:e&&t===e.from||(ve.current=null,ye.reset())},[t,ye]);const be=e=>{ve.current={from:ve.current?.from??t,to:e},n(e)},we=e=>({text:t,start:e?.selectionStart??me?.start??t.length,end:e?.selectionEnd??me?.end??t.length}),[ke,Se]=Y(ne),xe=te&&!(i&&ke),Ne=q(null),Le=Q(),[Te,Oe]=Y(null),[Pe,ze]=Y(!1),$e=()=>{if(!xe)return pe.current;const e=Ne.current?.getSource()??me;return e?{selectionStart:e.start,selectionEnd:e.end}:null},He=tt({target:pe,onChange:be}),Ke=e=>(ge({start:e.selectionStart,end:e.selectionEnd}),e),Ve=(e,n)=>{if(!xe)return void He(t=>(n&&ye.record(we(t),"edit",Date.now()),Ke(e(t))));const r=$e(),l=Ke(e(r));n&&ye.record(we(r),"edit",Date.now()),Oe(null),l.text!==t&&be(l.text),Ne.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},We=e=>Ve(e,!0),Ie=e=>Ve(t=>{const n=we(t),r=ye[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),Xe=q(null);Z(()=>{const e=Xe.current;e&&(Xe.current=null,xe?Ne.current?.setSource(e.start,e.end,t):(pe.current?.focus(),pe.current?.setSelectionRange(e.start,e.end),ge(e)))},[xe]);const[Ge,Je]=Y(null),rt=m??k,lt=("string"==typeof y[0]?b(y):y).filter(e=>!Qe.has(e.style)),ot=ce?("string"==typeof y[0]?y:y.map(e=>e.style)).filter(e=>!Qe.has(e)):lt.map(e=>e.style),at={};if(me&&(xe||ce)){const e=w(t,me.start,me.end,rt);for(const t of ot){const n=e.has(t)||"highlight"===t&&e.has("accent");at[t]=!!Te?.add.includes(t)||!Te?.drop.includes(t)&&n}ce&&(at.link=e.has("link"))}else if(me)for(const e of ot)at[e]="link"===e?null!==S(t,me.start,me.end):x(t,me.start,me.end,e);const st=()=>{const e=$e(),n=e?.selectionStart??t.length;return{start:n,end:e?.selectionEnd??n}},it=e=>{if(ce&&"link"!==e&&D(0,e)){const{start:n,end:r}=st();if(n===r&&!xe)return void We(n=>Be(t,e,n,(e,t,n,r)=>v(e,t,n,r,rt,ue.placeholders)));const l=o({value:t,rules:rt,start:n,end:r,style:e,pending:Te});return void("pending"===l.kind?Oe(l.pending):We(()=>l.result))}if("clear"===e)return void We(n=>Be(t,e,n,(e,t,n)=>v(e,t,n,"clear",rt)));if("link"!==e&&xe&&D(0,e)){const n=$e(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;if(r===l){const n=w(t,r,l,rt),o=n.has(e)||"highlight"===e&&n.has("accent"),a=Te&&Te.at===r?Te: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 Oe(i.length||c.length?{add:i,drop:c,at:r}:null)}return void We(n=>L(t,n?.selectionStart??r,n?.selectionEnd??l,e,rt))}if("link"!==e){const n=$??((e,t,n,r)=>v(e,t,n,r,k,ue.placeholders));return void We(r=>Be(t,e,r,n))}const n=$e(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;ze(!1),Je({start:r,end:l,link:S(t,r,l)})},ct=Boolean(me&&me.start!==me.end),ut=me?C(t,me.start,me.end,rt):null,dt=me?Te&&void 0!==Te.color&&Te.at===me.start?Te.color:E(t,me.start,me.end,rt):null,pt=dt?dt.startsWith("#")?dt:le?.find(e=>e.name===dt)?.value:void 0,ht=e=>{xe?e?Ne.current?.setSource(e.start,e.end,t):Ne.current?.focus():(pe.current?.focus(),e&&pe.current?.setSelectionRange(e.start,e.end))},ft=()=>{const e=Ge;Je(null),ht(e?{start:e.start,end:e.end}:me)},mt=()=>{const e=yt.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));ze(!1),t&&ht(me)},gt=q(mt);gt.current=mt,_(()=>{if(Pe)return W(e=>{const t=yt.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(gt.current(),!0)},()=>yt.current?.querySelector(".es-copy-colors"))},[Pe]);const yt=q(null),vt=Pe||null!==Ge;_(()=>{const e=yt.current;if(!vt||!e)return;const t=e.ownerDocument,n=()=>{ze(!1),Je(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 bt=Ge??(Pe?me??{start:t.length,end:t.length}:null),wt=q(()=>{});wt.current=()=>{const e=yt.current,t=e?.querySelector(".rosh-tb-wrap > .es-copy-pop");if(!e||!t||!bt)return;const n=xe?null:e.querySelector(".es-gold-layer"),r=xe?Ne.current?.rangeOf(bt.start,bt.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,bt.start,bt.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?Ye(t):Ye(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=qe(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),p=d?e.top-o-t.height:e.bottom+o,h=e.left+Math.min((e.right-e.left)/2,10),f=qe(h-5-i,10,t.width-10-10);return{top:p-l.top,left:i-l.left,above:d,point:f}}({anchor:a,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:Ze(e),parent:_e(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"},Z(()=>{const e=yt.current;if(!vt||!e)return;const t=()=>wt.current();t();const n=e.ownerDocument.defaultView;n?.addEventListener("resize",t);const r=e.querySelector(".rosh-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,Pe,Ge,bt?.start,bt?.end,xe]);const kt=e=>Ge&&/* @__PURE__ */Ce(U,{className:e?"es-copy-link es-copy-pop":"es-copy-link",value:Ge.link?.href??"",onApply:e=>{const n=Ge;Je(null),We(()=>xe?R(t,n.start,n.end,e,rt):z(t,n.start,n.end,e))},onRemove:Ge.link?()=>{const e=Ge.link,n=Ge;Je(null),e&&We(()=>xe?M(t,n.start,n.end,rt):P(t,e))}:void 0,onCancel:ft}),St=K?Me(K.allow,ue.align):[],xt="always"===ee||he||null!==Ge||Pe,Ct=le&&le.length>0?{run:pt,open:Pe,onToggle:()=>{Je(null),Pe?mt():ze(!0)}}:void 0,Et=xt&&ce&&ie?ie({className:"rosh-tb-btn",disabled:p,selected:ct,keepCaret:e=>e.preventDefault(),insert:e=>We(n=>Fe(t,e,n))}):void 0,Dt=new Set(ot),Nt=K?{value:K.value,allow:K.allow,onChange:K.onChange,disabled:K.disabled}:void 0,Lt={pressed:ut,onList:e=>{const{start:n,end:r}=st(),l=C(t,n,r,rt);We(()=>O(t,n,r,l===e?null:e,rt))}},Tt=A({offered:Dt,color:Ct,last:Et,alignment:Nt,list:Lt,letterCase:se}),Ot=ce&&xt&&(nt.some(e=>Dt.has(e))||Boolean(Ct));/* @__PURE__ */
15
- return Ee("div",{ref:yt,className:"es-copy"+(d?` ${d}`:""),onFocus:()=>fe(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||fe(!1)},onKeyDown:e=>{const t=e.target===pe.current||Boolean(e.target.closest?.(".es-rich"));if(p||!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 Ie(l||e.shiftKey?"redo":"undo");const o=`${e.shiftKey?"shift+":""}${n}`;if(ce){const t={b:"bold",i:"italic",u:"underline",k:"link"}[o];if(!t||!ot.includes(t))return;return e.preventDefault(),e.stopPropagation(),void it(t)}const a=lt.find(e=>e.shortcut===o);a&&(e.preventDefault(),e.stopPropagation(),it(a.style))},onPaste:e=>{const n=pe.current;if(p||!n||e.target!==n)return;e.preventDefault();const r=a({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:i,rules:rt});We(e=>Fe(t,r,e))},style:le&&le.length>0?Object.fromEntries(le.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const e=pe.current;e&&e.ownerDocument.activeElement===e&&ge({start:e.selectionStart??t.length,end:e.selectionEnd??t.length})},children:[xt&&ce&&(Tt.words||Tt.paragraph)?
16
- /* @__PURE__ */Ce(I,{className:"es-copy-toolbar","aria-label":X??ue.formatting,offered:Dt,pressed:at,onMark:e=>it(e),color:Ct,linkOpen:null!==Ge,last:Et,alignment:Nt,list:Lt,letterCase:se,disabled:p,windows:/* @__PURE__ */Ee(De,{children:[Pe&&le&&le.length>0?/* @__PURE__ */Ce(Ue,{colors:le,current:dt,words:ue.colors??e.colors,onPick:e=>{const{start:n,end:r}=st();if(n!==r)We(()=>T(t,n,r,e,rt));else{if(!xe)return;Oe({add:Te?.add??[],drop:Te?.drop??[],color:e,at:n})}}}):null,Ge?kt(!0):null]})}):null,ce&&ae&&ae.length>0?/* @__PURE__ */Ce(Ae,{cells:ae,words:ue.cells??e.cells,readOnly:p}):null,xt&&!ce?/* @__PURE__ */Ce(et,{tools:y,disabled:p,actions:H,glyphs:V,ariaLabel:X,pressed:at,open:Ge?"link":null,onApply:it,align:K?/* @__PURE__ */Ce(h,{options:St,value:K.value,onChange:K.onChange,ariaLabel:ue.alignment,disabled:p||K.disabled,fit:Re(St)}):null}):null,xe?/* @__PURE__ */Ce(je,{value:t,rules:rt,multiline:i,readOnly:p,placeholder:c,ariaLabel:u,handle:Ne,pending:Te??void 0,onEdit:(e,n,r)=>{ye.record({text:t,start:n.start,end:n.end},r,Date.now()),Oe(null),be(e)},onSelect:e=>{ge(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Te||e.start===Te.at&&e.end===Te.at||Oe(null)},onHistory:Ie,onFormat:e=>{ot.includes(e)&&it(e)},onCommit:r,onCancel:s}):/* @__PURE__ */Ce(g,{value:t,onInput:e=>{ye.record(we(null),"type",Date.now()),be(e)},onCommit:r,onCancel:s,multiline:i,placeholder:c,ariaLabel:u,rules:m,disabled:p,inputRef:pe,className:"es-copy-box"}),Ge&&!ce?kt(!1):null,G?G({focused:he,insert:e=>We(n=>Fe(t,e,n))}):null,te&&i||Ot?
13
+ /* @__PURE__ */Ce("div",{className:"es-copy-pop-foot",children:/* @__PURE__ */Ce(j,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onMouseDown:Ue,onClick:()=>r(null),children:n.remove})})]})}var Ye=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n));var qe=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom});function Je(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 Ze(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 _e=/* @__PURE__ */new Set([...y,"clear"]),Xe={bold:/* @__PURE__ */Ce(ge,{size:16}),italic:/* @__PURE__ */Ce(de,{size:16}),strike:/* @__PURE__ */Ce(me,{size:16}),highlight:/* @__PURE__ */Ce(fe,{size:16}),quiet:/* @__PURE__ */Ce(he,{size:16}),link:/* @__PURE__ */Ce(pe,{size:16}),clear:/* @__PURE__ */Ce(oe,{size:16})};function Ge(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 Qe={bold:"is-bold",italic:"is-italic",strike:"is-strike"};function et({tools:t,onApply:n,disabled:r=!1,actions:l,align:o,glyphs:a,ariaLabel:s,pressed:i,open:c=null}){const u=B("copy",e),d=("string"==typeof t[0]?b(t).map(e=>({...e,...u.marks[e.style]})):t).filter(e=>!_e.has(e.style));return 0!==d.length||l||o?/* @__PURE__ */Ee("div",{className:"es-copy-bar",role:"group","aria-label":s??u.formatting,children:[d.map(e=>{const t=a?.[e.style]??Xe[e.style],l=c===e.style||Boolean(i?.[e.style]),o="link"===e.style&&Boolean(i);return F(e.title,/* @__PURE__ */Ce(V,{onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.style),disabled:r,"aria-label":e.name??e.title,"aria-keyshortcuts":Ge(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":Qe[e.style]?` ${Qe[e.style]}`:""}${l?" is-active":""}`,children:t??e.label},e.style))}),l?/* @__PURE__ */Ee(De,{children:[
14
+ /* @__PURE__ */Ce("span",{className:"es-copy-bar-split","aria-hidden":"true"}),l]}):null,o?/* @__PURE__ */Ce("span",{className:"es-copy-bar-end",children:o}):null]}):null}function tt({target:e,onChange:t}){const n=Y(null);return J(()=>{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 nt=["bold","italic","underline","strike","sup","sub"];function rt({value:t,onChange:n,onCommit:r,onCancel:s,multiline:i=!1,placeholder:c,ariaLabel:u,className:d,readOnly:p=!1,rules:m,tools:y=[],writeMark:H,actions:$,align:K,glyphs:V,barLabel:X,renderFooter:G,inputRef:Q,barShows:ee="always",richText:te=!0,defaultShowMarks:ne=!1,toolbar:re="final",colors:le,cells:ae,letterCase:se,lastTool:ie}){const ce="final"===re,ue=B("copy",e),de=Y(null),pe=Q??de,[he,fe]=q(!1),[me,ge]=q(null),ye=Y(l()).current,ve=Y(null);Z(()=>{const e=ve.current;e&&t===e.to?ve.current=null:e&&t===e.from||(ve.current=null,ye.reset())},[t,ye]);const be=e=>{ve.current={from:ve.current?.from??t,to:e},n(e)},we=e=>({text:t,start:e?.selectionStart??me?.start??t.length,end:e?.selectionEnd??me?.end??t.length}),[ke,Se]=q(ne),xe=te&&!(i&&ke),Ne=Y(null),Le=_(),[Te,Me]=q(null),[Re,Pe]=q(!1),He=()=>{if(!xe)return pe.current;const e=Ne.current?.getSource()??me;return e?{selectionStart:e.start,selectionEnd:e.end}:null},$e=tt({target:pe,onChange:be}),Ke=e=>(ge({start:e.selectionStart,end:e.selectionEnd}),e),Ve=(e,n)=>{if(!xe)return void $e(t=>(n&&ye.record(we(t),"edit",Date.now()),Ke(e(t))));const r=He(),l=Ke(e(r));n&&ye.record(we(r),"edit",Date.now()),Me(null),l.text!==t&&be(l.text),Ne.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},We=e=>Ve(e,!0),Ue=e=>Ve(t=>{const n=we(t),r=ye[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),Xe=Y(null);J(()=>{const e=Xe.current;e&&(Xe.current=null,xe?Ne.current?.setSource(e.start,e.end,t):(pe.current?.focus(),pe.current?.setSelectionRange(e.start,e.end),ge(e)))},[xe]);const[Ge,Qe]=q(null),rt=m??k,lt=("string"==typeof y[0]?b(y):y).filter(e=>!_e.has(e.style)),ot=ce?("string"==typeof y[0]?y:y.map(e=>e.style)).filter(e=>!_e.has(e)):lt.map(e=>e.style),at={};if(me&&(xe||ce)){const e=w(t,me.start,me.end,rt);for(const t of ot){const n=e.has(t)||"highlight"===t&&e.has("accent");at[t]=!!Te?.add.includes(t)||!Te?.drop.includes(t)&&n}ce&&(at.link=e.has("link"))}else if(me)for(const e of ot)at[e]="link"===e?null!==S(t,me.start,me.end):x(t,me.start,me.end,e);const st=()=>{const e=He(),n=e?.selectionStart??t.length;return{start:n,end:e?.selectionEnd??n}},it=e=>{if(ce&&"link"!==e&&D(0,e)){const{start:n,end:r}=st();if(n===r&&!xe)return void We(n=>Be(t,e,n,(e,t,n,r)=>v(e,t,n,r,rt,ue.placeholders)));const l=o({value:t,rules:rt,start:n,end:r,style:e,pending:Te});return void("pending"===l.kind?Me(l.pending):We(()=>l.result))}if("clear"===e)return void We(n=>Be(t,e,n,(e,t,n)=>v(e,t,n,"clear",rt)));if("link"!==e&&xe&&D(0,e)){const n=He(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;if(r===l){const n=w(t,r,l,rt),o=n.has(e)||"highlight"===e&&n.has("accent"),a=Te&&Te.at===r?Te: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 Me(i.length||c.length?{add:i,drop:c,at:r}:null)}return void We(n=>L(t,n?.selectionStart??r,n?.selectionEnd??l,e,rt))}if("link"!==e){const n=H??((e,t,n,r)=>v(e,t,n,r,k,ue.placeholders));return void We(r=>Be(t,e,r,n))}const n=He(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;Pe(!1),Qe({start:r,end:l,link:S(t,r,l)})},ct=Boolean(me&&me.start!==me.end),ut=me?C(t,me.start,me.end,rt):null,dt=me?Te&&void 0!==Te.color&&Te.at===me.start?Te.color:E(t,me.start,me.end,rt):null,pt=dt?dt.startsWith("#")?dt:le?.find(e=>e.name===dt)?.value:void 0,ht=e=>{xe?e?Ne.current?.setSource(e.start,e.end,t):Ne.current?.focus():(pe.current?.focus(),e&&pe.current?.setSelectionRange(e.start,e.end))},ft=()=>{const e=Ge;Qe(null),ht(e?{start:e.start,end:e.end}:me)},mt=()=>{const e=yt.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));Pe(!1),t&&ht(me)},gt=Y(mt);gt.current=mt,Z(()=>{if(Re)return W(e=>{const t=yt.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(gt.current(),!0)},()=>yt.current?.querySelector(".es-copy-colors"))},[Re]);const yt=Y(null),vt=Re||null!==Ge;Z(()=>{const e=yt.current;if(!vt||!e)return;const t=e.ownerDocument,n=()=>{Pe(!1),Qe(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 bt=Ge??(Re?me??{start:t.length,end:t.length}:null),wt=Y(()=>{});wt.current=()=>{const e=yt.current,t=e?.querySelector(".rosh-tb-wrap > .es-copy-pop");if(!e||!t||!bt)return;const n=xe?null:e.querySelector(".es-gold-layer"),r=xe?Ne.current?.rangeOf(bt.start,bt.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,bt.start,bt.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?qe(t):qe(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=Ye(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),p=d?e.top-o-t.height:e.bottom+o,h=e.left+Math.min((e.right-e.left)/2,10),f=Ye(h-5-i,10,t.width-10-10);return{top:p-l.top,left:i-l.left,above:d,point:f}}({anchor:a,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:Je(e),parent:Ze(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"},J(()=>{const e=yt.current;if(!vt||!e)return;const t=()=>wt.current();t();const n=e.ownerDocument.defaultView;n?.addEventListener("resize",t);const r=e.querySelector(".rosh-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,Re,Ge,bt?.start,bt?.end,xe]);const kt=e=>Ge&&/* @__PURE__ */Ce(I,{className:e?"es-copy-link es-copy-pop":"es-copy-link",value:Ge.link?.href??"",onApply:e=>{const n=Ge;Qe(null),We(()=>xe?z(t,n.start,n.end,e,rt):P(t,n.start,n.end,e))},onRemove:Ge.link?()=>{const e=Ge.link,n=Ge;Qe(null),e&&We(()=>xe?O(t,n.start,n.end,rt):R(t,e))}:void 0,onCancel:ft}),St=K?Oe(K.allow,ue.align):[],xt="always"===ee||he||null!==Ge||Re,Ct=le&&le.length>0?{run:pt,open:Re,onToggle:()=>{Qe(null),Re?mt():Pe(!0)}}:void 0,Et=xt&&ce&&ie?ie({className:"rosh-tb-btn",disabled:p,selected:ct,keepCaret:e=>e.preventDefault(),insert:e=>We(n=>Fe(t,e,n))}):void 0,Dt=new Set(ot),Nt=K?{value:K.value,allow:K.allow,onChange:K.onChange,disabled:K.disabled}:void 0,Lt={pressed:ut,onList:e=>{const{start:n,end:r}=st(),l=C(t,n,r,rt);We(()=>M(t,n,r,l===e?null:e,rt))}},Tt=A({offered:Dt,color:Ct,last:Et,alignment:Nt,list:Lt,letterCase:se}),Mt=ce&&xt&&(nt.some(e=>Dt.has(e))||Boolean(Ct));/* @__PURE__ */
15
+ return Ee("div",{ref:yt,className:"es-copy"+(d?` ${d}`:""),onFocus:()=>fe(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||fe(!1)},onKeyDown:e=>{const t=e.target===pe.current||Boolean(e.target.closest?.(".es-rich"));if(p||!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 Ue(l||e.shiftKey?"redo":"undo");const o=`${e.shiftKey?"shift+":""}${n}`;if(ce){const t={b:"bold",i:"italic",u:"underline",k:"link"}[o];if(!t||!ot.includes(t))return;return e.preventDefault(),e.stopPropagation(),void it(t)}const a=lt.find(e=>e.shortcut===o);a&&(e.preventDefault(),e.stopPropagation(),it(a.style))},onPaste:e=>{const n=pe.current;if(p||!n||e.target!==n)return;e.preventDefault();const r=a({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:i,rules:rt});We(e=>Fe(t,r,e))},style:le&&le.length>0?Object.fromEntries(le.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const e=pe.current;e&&e.ownerDocument.activeElement===e&&ge({start:e.selectionStart??t.length,end:e.selectionEnd??t.length})},children:[xt&&ce&&(Tt.words||Tt.paragraph)?
16
+ /* @__PURE__ */Ce(U,{className:"es-copy-toolbar","aria-label":X??ue.formatting,offered:Dt,pressed:at,onMark:e=>it(e),color:Ct,linkOpen:null!==Ge,last:Et,alignment:Nt,list:Lt,letterCase:se,disabled:p,windows:/* @__PURE__ */Ee(De,{children:[Re&&le&&le.length>0?/* @__PURE__ */Ce(Ie,{colors:le,current:dt,words:ue.colors??e.colors,onPick:e=>{const{start:n,end:r}=st();if(n!==r)We(()=>T(t,n,r,e,rt));else{if(!xe)return;Me({add:Te?.add??[],drop:Te?.drop??[],color:e,at:n})}}}):null,Ge?kt(!0):null]})}):null,ce&&ae&&ae.length>0?/* @__PURE__ */Ce(Ae,{cells:ae,words:ue.cells??e.cells,readOnly:p}):null,xt&&!ce?/* @__PURE__ */Ce(et,{tools:y,disabled:p,actions:$,glyphs:V,ariaLabel:X,pressed:at,open:Ge?"link":null,onApply:it,align:K?/* @__PURE__ */Ce(h,{options:St,value:K.value,onChange:K.onChange,ariaLabel:ue.alignment,disabled:p||K.disabled,fit:ze(St)}):null}):null,xe?/* @__PURE__ */Ce(je,{value:t,rules:rt,multiline:i,readOnly:p,placeholder:c,ariaLabel:u,handle:Ne,pending:Te??void 0,onEdit:(e,n,r)=>{ye.record({text:t,start:n.start,end:n.end},r,Date.now()),Me(null),be(e)},onSelect:e=>{ge(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Te||e.start===Te.at&&e.end===Te.at||Me(null)},onHistory:Ue,onFormat:e=>{ot.includes(e)&&it(e)},onCommit:r,onCancel:s}):/* @__PURE__ */Ce(g,{value:t,onInput:e=>{ye.record(we(null),"type",Date.now()),be(e)},onCommit:r,onCancel:s,multiline:i,placeholder:c,ariaLabel:u,rules:m,disabled:p,inputRef:pe,className:"es-copy-box"}),Ge&&!ce?kt(!1):null,G?G({focused:he,insert:e=>We(n=>Fe(t,e,n))}):null,te&&i||Mt?
17
17
  /* @__PURE__ */Ee("div",{className:"es-copy-marks",children:[te&&i?/* @__PURE__ */Ee(De,{children:[
18
- /* @__PURE__ */Ce(f,{checked:ke,onChange:()=>{const e=$e();Xe.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:me,Oe(null),Se(e=>!e)},ariaLabelledBy:Le,disabled:p}),
19
- /* @__PURE__ */Ce("span",{id:Le,className:"es-copy-marks-label",children:ue.showMarks??"Show marks"})]}):null,Ot?F(ct?void 0:ue.clearStyleEmpty??"Select words first",/* @__PURE__ */Ee(j,{variant:"secondary",size:"sm",className:"es-copy-clear",disabled:p||!ct,onMouseDown:e=>e.preventDefault(),onClick:()=>{const{start:e,end:n}=st();if(e===n)return;const r=N(t,e,n,rt);r.text!==t&&We(()=>r)},children:[
18
+ /* @__PURE__ */Ce(f,{checked:ke,onChange:()=>{const e=He();Xe.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:me,Me(null),Se(e=>!e)},ariaLabelledBy:Le,disabled:p}),
19
+ /* @__PURE__ */Ce("span",{id:Le,className:"es-copy-marks-label",children:ue.showMarks??"Show marks"})]}):null,Mt?F(ct?void 0:ue.clearStyleEmpty??"Select words first",/* @__PURE__ */Ee(j,{variant:"secondary",size:"sm",className:"es-copy-clear",disabled:p||!ct,onMouseDown:e=>e.preventDefault(),onClick:()=>{const{start:e,end:n}=st();if(e===n)return;const r=N(t,e,n,rt);r.text!==t&&We(()=>r)},children:[
20
20
  /* @__PURE__ */Ce(oe,{size:16}),ue.clearStyle??e.clearStyle]})):null]}):null]})}var lt=["none","bullet","number"],ot=["none","upper","capitalize","lower"],at={none:/* @__PURE__ */Ce(be,{}),bullet:/* @__PURE__ */Ce(ve,{}),number:/* @__PURE__ */Ce(ye,{})},st={none:/* @__PURE__ */Ce(xe,{}),upper:/* @__PURE__ */Ce(Se,{}),capitalize:/* @__PURE__ */Ce(ke,{}),lower:/* @__PURE__ */Ce(we,{})};function it({label:e,icon:t,answers:n,names:r,glyphs:l,row:o,readOnly:a}){const s=o.value||o.styleValue||"";/* @__PURE__ */
21
- return Ce(m,{label:e,icon:t,children:/* @__PURE__ */Ce(h,{ariaLabel:e,value:s,disabled:a,onChange:e=>{a||o.onChange(function(e,t){return t===e.value||""===e.value&&t===e.styleValue?"":t}(o,e))},options:n.map(e=>({id:e,label:l[e],title:r[e]}))})})}function ct({kept:t,keptHint:n,readOnly:r=!1,style:l,font:o,italic:a,cells:s,align:i,list:c,letterCase:u}){const d=B("copy",e),h={...e.panel,...d.panel},f=d.clearStyle??e.clearStyle,g=l&&!r?[l.onClearChanges&&{label:f,onSelect:l.onClearChanges},l.onEditStyles&&{label:h.editStyles,onSelect:l.onEditStyles},l.onUpdateStyle&&{label:h.updateStyle,onSelect:l.onUpdateStyle}].filter(e=>!!e):[],y=!!a&&(a.value??a.styleValue??!1),v=a?/* @__PURE__ */Ce($,{content:h.italic,children:/* @__PURE__ */Ce(V,{size:"sm",variant:"ghost","aria-label":h.italic,"aria-pressed":y,disabled:r,onClick:()=>{if(r)return;const e=!y;a.onChange(e===(a.styleValue??!1)?void 0:e)},children:/* @__PURE__ */Ce(de,{})})}):null;/* @__PURE__ */
21
+ return Ce(m,{label:e,icon:t,children:/* @__PURE__ */Ce(h,{ariaLabel:e,value:s,disabled:a,onChange:e=>{a||o.onChange(function(e,t){return t===e.value||""===e.value&&t===e.styleValue?"":t}(o,e))},options:n.map(e=>({id:e,label:l[e],title:r[e]}))})})}function ct({kept:t,keptHint:n,readOnly:r=!1,style:l,font:o,italic:a,cells:s,align:i,list:c,letterCase:u}){const d=B("copy",e),h={...e.panel,...d.panel},f=d.clearStyle??e.clearStyle,g=l&&!r?[l.onClearChanges&&{label:f,onSelect:l.onClearChanges},l.onEditStyles&&{label:h.editStyles,onSelect:l.onEditStyles},l.onUpdateStyle&&{label:h.updateStyle,onSelect:l.onUpdateStyle}].filter(e=>!!e):[],y=!!a&&(a.value??a.styleValue??!1),v=a?/* @__PURE__ */Ce(H,{content:h.italic,children:/* @__PURE__ */Ce(V,{size:"sm",variant:"ghost","aria-label":h.italic,"aria-pressed":y,disabled:r,onClick:()=>{if(r)return;const e=!y;a.onChange(e===(a.styleValue??!1)?void 0:e)},children:/* @__PURE__ */Ce(de,{})})}):null;/* @__PURE__ */
22
22
  return Ee("div",{className:"es-tpp",children:[t?/* @__PURE__ */Ee("div",{className:"es-tpp-kept",children:[
23
23
  /* @__PURE__ */Ce(rt,{...t,readOnly:r||t.readOnly}),n?/* @__PURE__ */Ce("p",{className:"es-field-hint",children:n}):null]}):null,l?/* @__PURE__ */Ce(m,{label:h.style,icon:/* @__PURE__ */Ce(ae,{}),children:/* @__PURE__ */Ce(p,{ariaLabel:h.style,value:l.value,options:l.options,onChange:l.onChange,changed:l.changed,footer:g,readOnly:r})}):null,o?/* @__PURE__ */Ce(m,{label:h.font,icon:/* @__PURE__ */Ce(se,{}),children:/* @__PURE__ */Ee("div",{className:"es-tpp-font",children:[
24
24
  /* @__PURE__ */Ce("div",{className:"es-tpp-font-select",children:/* @__PURE__ */Ce(p,{ariaLabel:h.font,value:o.value||void 0,placeholder:o.styleValue,options:o.options,onChange:o.onChange,searchable:o.searchable,readOnly:r})}),v]})}):v?
25
- /* @__PURE__ */Ce(m,{label:h.italic,icon:/* @__PURE__ */Ce(se,{}),children:/* @__PURE__ */Ce("div",{className:"es-tpp-font",children:v})}):null,s?.length?/* @__PURE__ */Ce(Ae,{cells:s,words:d.cells,readOnly:r}):null,i?/* @__PURE__ */Ce(it,{label:d.alignment,icon:/* @__PURE__ */Ce(ie,{}),answers:Ne.filter(e=>!i.allow||i.allow.includes(e)),names:d.align,glyphs:Te,row:i,readOnly:r}):null,c?/* @__PURE__ */Ce(it,{label:h.list,icon:/* @__PURE__ */Ce(ce,{}),answers:lt,names:h.lists,glyphs:at,row:c,readOnly:r}):null,u?/* @__PURE__ */Ce(it,{label:h.capitalization,icon:/* @__PURE__ */Ce(ue,{}),answers:ot,names:h.cases,glyphs:st,row:u,readOnly:r}):null]})}export{Ne as COPY_ALIGNS,Oe as COPY_ALIGN_FIT,Te as COPY_ALIGN_GLYPHS,Le as COPY_ALIGN_LABELS,Ve as COPY_CELLS,Ue as ColorWindow,rt as CopyBox,Ae as CopyCells,et as MarkBar,je as RichBox,ct as TextPartPanel,Ge as ariaShortcut,Me as copyAlignOptions,Fe as insertSelection,Be as markSelection,tt as useCaretEdit};
25
+ /* @__PURE__ */Ce(m,{label:h.italic,icon:/* @__PURE__ */Ce(se,{}),children:/* @__PURE__ */Ce("div",{className:"es-tpp-font",children:v})}):null,s?.length?/* @__PURE__ */Ce(Ae,{cells:s,words:d.cells,readOnly:r}):null,i?/* @__PURE__ */Ce(it,{label:d.alignment,icon:/* @__PURE__ */Ce(ie,{}),answers:Ne.filter(e=>!i.allow||i.allow.includes(e)),names:d.align,glyphs:Te,row:i,readOnly:r}):null,c?/* @__PURE__ */Ce(it,{label:h.list,icon:/* @__PURE__ */Ce(ce,{}),answers:lt,names:h.lists,glyphs:at,row:c,readOnly:r}):null,u?/* @__PURE__ */Ce(it,{label:h.capitalization,icon:/* @__PURE__ */Ce(ue,{}),answers:ot,names:h.cases,glyphs:st,row:u,readOnly:r}):null]})}export{Ne as COPY_ALIGNS,Me as COPY_ALIGN_FIT,Te as COPY_ALIGN_GLYPHS,Le as COPY_ALIGN_LABELS,Ve as COPY_CELLS,Ie as ColorWindow,rt as CopyBox,Ae as CopyCells,et as MarkBar,je as RichBox,ct as TextPartPanel,Ge as ariaShortcut,Oe as copyAlignOptions,Fe as insertSelection,Be as markSelection,tt as useCaretEdit};
@@ -339,7 +339,9 @@
339
339
  /* Cards (0.80.0): a group whose tiles all carry a cover — two across, the
340
340
  picture above the name, so a section is chosen by how it looks. */
341
341
  .es-add-grid.is-cards {
342
- grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
342
+ /* ONE card size for every tile (11.0.0, the Add picker Lewis approved
343
+ 2026-10-16): three across at the left panel's 288px, two at its 220px. */
344
+ grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
343
345
  gap: 8px;
344
346
  }
345
347
  .es-add-tile.has-cover {
@@ -366,6 +368,14 @@
366
368
  width: 100%;
367
369
  height: 100%;
368
370
  }
371
+ /* A block's cover is its glyph, centred on the cover's ground, so a block is
372
+ the same card as a section beside it (11.0.0). */
373
+ .es-add-tile-cover > .es-add-glyph-cover {
374
+ display: flex;
375
+ align-items: center;
376
+ justify-content: center;
377
+ color: var(--es-icon);
378
+ }
369
379
  .es-add-tile.has-cover .es-add-tile-label {
370
380
  padding: 0 2px;
371
381
  }
@@ -221,14 +221,20 @@ type AddPanelProps<I> = {
221
221
  session: DragSession<I>;
222
222
  /** The drag item for a new block of `type`. */
223
223
  itemFor: (type: string) => I;
224
- /** A tile clicked: add one — at the place the panel was opened for, or the host's default. */
225
- onInsert: (type: string) => void;
224
+ /**
225
+ * A tile pressed (a click, or Enter on a focused tile): add one at the place
226
+ * the panel was opened for. Left out, a press adds nothing and the tile is
227
+ * only dragged (11.0.0) — the owner's two ways to add (ruling A1,
228
+ * 2026-10-14): drag a tile to its place, or press one after opening the
229
+ * panel AT a place. A host hands it only while the panel has a place.
230
+ */
231
+ onInsert?: (type: string) => void;
226
232
  /** The panel was opened at a place — "Adding to Column 2" — and can stop being. */
227
233
  at?: {
228
234
  label: string;
229
235
  onClear: () => void;
230
236
  };
231
- /** The line under the title. Default "Drag onto the page, or click to add." */
237
+ /** The line under the title. Default "Drag onto the page." */
232
238
  hint?: string;
233
239
  /** The search field's name. Default "Search blocks". */
234
240
  searchLabel?: string;
@@ -1 +1 @@
1
- export{AddPanel,CanvasDragLayer,CanvasInsert,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,insertSeams,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-FCLW4LEN.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-ILXP5VX5.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
1
+ export{AddPanel,CanvasDragLayer,CanvasInsert,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,insertSeams,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-47RGVCPH.js";import"../chunk-GG4FGBFR.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-ILXP5VX5.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{CanvasFrame,CanvasPassThroughContext,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,bindUndoKeys,createEasel,createUseEasel,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useSelectedFields,validSelection}from"../chunk-M32O2WRM.js";import"../chunk-TBY3DFKS.js";import"../chunk-YRLPFZW3.js";import"../chunk-ECM5F6JJ.js";import"../chunk-IL6QCPO6.js";import"../chunk-546BBOPE.js";import"../chunk-MFIRYGHW.js";import"../chunk-ILXP5VX5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
1
+ export{CanvasFrame,CanvasPassThroughContext,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,bindUndoKeys,createEasel,createUseEasel,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useSelectedFields,validSelection}from"../chunk-PE6ZY5IW.js";import"../chunk-TBY3DFKS.js";import"../chunk-YRLPFZW3.js";import"../chunk-ECM5F6JJ.js";import"../chunk-TJ6NRHYF.js";import"../chunk-546BBOPE.js";import"../chunk-MFIRYGHW.js";import"../chunk-ILXP5VX5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{AddBlockRow as default}from"../../chunk-TROOTMAD.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-7O6MDCDU.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-JTUUIVBZ.js";import"../../chunk-M32O2WRM.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-26GHWMNN.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-RC25EGHD.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-IL6QCPO6.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{AddBlockRow as default}from"../../chunk-PZHQVOTU.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-77DQCEEF.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-VWXUMVCD.js";import"../../chunk-PE6ZY5IW.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-26GHWMNN.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-RC25EGHD.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-TJ6NRHYF.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1,4 @@
1
- export{AddChildRow as default}from"../../chunk-5545A3PC.js";
1
+ import{Tooltip as e}from"efficient-shell/ui";import{useId as s}from"react";import{jsxs as l,Fragment as i,jsx as a}from"react/jsx-runtime";function r({label:r,blocked:d,onAdd:n,small:t=!1}){const c=null!==d,o=s(),m=/* @__PURE__ */l("button",{type:"button",className:"sf-add-card","aria-disabled":c||void 0,"aria-describedby":c?o:void 0,onClick:c?void 0:n,children:[
2
+ /* @__PURE__ */a("span",{className:t?"sf-plus sf-plus--sm":"sf-plus",children:"+"}),r]});return c?/* @__PURE__ */l(i,{children:[
3
+ /* @__PURE__ */a(e,{content:d,children:m}),
4
+ /* @__PURE__ */a("span",{id:o,className:"es-vh",children:d})]}):m}export{r as default};
@@ -21,31 +21,27 @@ declare const sectionKey: (type: string) => string;
21
21
  declare const blockKey: (type: string) => string;
22
22
  declare const templateKey: (id: string) => string;
23
23
  type AddSidePanelProps<I> = {
24
- /** The blocks a target container takes — the slot the panel was opened at,
25
- * or the selected container — or null. */
26
- blocks: {
27
- parentName: string;
28
- choices: BlockChoice[];
29
- } | null;
30
- /** Opened at a slot: only that slot's blocks are offered. */
31
- blocksOnly: boolean;
32
24
  /** Where the next thing goes, when the panel was opened at a place. */
33
25
  at?: {
34
26
  label: string;
35
27
  onClear: () => void;
36
28
  };
37
- /** Which sections and saved sections are offered, by the section's type
38
- * (8.3.0): opened at a group's list, only what the group takes. Absent:
39
- * every section. */
40
- sectionAccepts?: (sectionType: string) => boolean;
41
- /** Add what a tile names. */
42
- onAdd: (key: AddKey) => void;
29
+ /** At a place in a list of blocks: the blocks that list takes. They are in
30
+ * the one list whatever the catalogue holds, so a place can always be
31
+ * filled from it. */
32
+ placeBlocks?: readonly BlockChoice[];
33
+ /** At a place: may what a tile names go there? Null when it may, else why
34
+ * not, in the panel's words — the tile is then dimmed and says so. Absent
35
+ * (no place): every tile is offered, to drag. */
36
+ canTake?: (key: AddKey) => string | null;
37
+ /** At a place: put what a pressed tile names there. Absent (no place): a
38
+ * press adds nothing, and a tile is only dragged. */
39
+ onPick?: (key: AddKey) => void;
43
40
  /** The drag item for what a tile names — a drag in the editor's session. */
44
41
  itemFor: (key: AddKey) => I;
45
42
  session: DragSession<I>;
46
43
  /** A row under the tiles for something that is not a block, drawn by the
47
- * layer that owns it (the website: the Live chat bubble). Not shown where
48
- * only a slot's blocks are offered. */
44
+ * layer that owns it (the website: the Live chat bubble). */
49
45
  siteWide?: ReactNode;
50
46
  /** Leave Add — back to the view underneath (the head's "Done"). */
51
47
  onClose: () => void;
@@ -53,6 +49,6 @@ type AddSidePanelProps<I> = {
53
49
  onHide?: () => void;
54
50
  readOnly?: boolean;
55
51
  };
56
- declare function AddSidePanel<I>({ blocks, blocksOnly, at, sectionAccepts, onAdd, itemFor, session, siteWide, onClose, onHide, readOnly, }: AddSidePanelProps<I>): react.JSX.Element;
52
+ declare function AddSidePanel<I>({ at, placeBlocks, canTake, onPick, itemFor, session, siteWide, onClose, onHide, readOnly, }: AddSidePanelProps<I>): react.JSX.Element;
57
53
 
58
54
  export { type AddKey, type AddSidePanelProps, blockKey, AddSidePanel as default, sectionKey, templateKey };
@@ -1 +1 @@
1
- export{blockKey,AddSidePanel as default,sectionKey,templateKey}from"../../chunk-ICN6COBK.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-BVN33R76.js";import"../../chunk-PPL7GB7D.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-7O6MDCDU.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-JTUUIVBZ.js";import"../../chunk-M32O2WRM.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-26GHWMNN.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-RC25EGHD.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-IL6QCPO6.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-FCLW4LEN.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{blockKey,AddSidePanel as default,sectionKey,templateKey}from"../../chunk-XZDHQ4DN.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-BVN33R76.js";import"../../chunk-PPL7GB7D.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-77DQCEEF.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-VWXUMVCD.js";import"../../chunk-PE6ZY5IW.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-26GHWMNN.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-RC25EGHD.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-TJ6NRHYF.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-47RGVCPH.js";import"../../chunk-GG4FGBFR.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{MediaSidePanel as default}from"../../chunk-YMEN4KVE.js";import"../../chunk-7O6MDCDU.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-M32O2WRM.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-26GHWMNN.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-RC25EGHD.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-IL6QCPO6.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{MediaSidePanel as default}from"../../chunk-6FFSDH62.js";import"../../chunk-77DQCEEF.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-PE6ZY5IW.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-26GHWMNN.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-RC25EGHD.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-TJ6NRHYF.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -7,12 +7,9 @@ import { StyleSnapshot } from '../../style-clipboard/index.js';
7
7
  import { S as StyleClipboardWords } from '../../words-CnnHb9jo.js';
8
8
  import { ScreenMenuWords } from '../words.js';
9
9
  import { C as CanvasTarget } from '../../watch-BTYOJpQU.js';
10
- import { AddTarget } from '../lib/puck/add-target-types.js';
11
10
  import { ScreenMenuRows } from '../lib/screen-parts.js';
12
11
  import { EaselSession } from '../lib/session.js';
13
12
  import '../../plan-CGREINRO.js';
14
- import '../lib/puck/block-choice.js';
15
- import '../lib/puck/slot-section-spec.js';
16
13
  import '../../blocks/index.js';
17
14
  import '../../types-NQozKWEz.js';
18
15
  import '../../data/index.js';
@@ -30,6 +27,7 @@ import '../../words-Cl9xMUYY.js';
30
27
  import './AddSidePanel.js';
31
28
  import '../lib/section-template-types.js';
32
29
  import '../lib/puck/content-tree.js';
30
+ import '../lib/puck/block-choice.js';
33
31
  import '../../host-Ud6rLpph.js';
34
32
  import '../lib/document-contract.js';
35
33
  import '../lib/document-switch.js';
@@ -38,6 +36,8 @@ import '../lib/admin-bridge.js';
38
36
  import '../lib/host-chrome.js';
39
37
  import '../lib/links/link-filters.js';
40
38
  import 'efficient-shell/ui';
39
+ import '../lib/puck/add-target-types.js';
40
+ import '../lib/puck/slot-section-spec.js';
41
41
  import '../lib/backend-error.js';
42
42
  import '../lib/document-hooks.js';
43
43
 
@@ -157,8 +157,6 @@ type NodeMenuHost = {
157
157
  back: () => void;
158
158
  forward: () => void;
159
159
  };
160
- /** Open the Add door with nothing preselected — a new top-level section. */
161
- openAddSection: () => void;
162
160
  /** Put the panel on the page's own settings. */
163
161
  openPageSettings: () => void;
164
162
  /**
@@ -267,13 +265,6 @@ type NodeMenuHost = {
267
265
  duplicate: boolean;
268
266
  delete: boolean;
269
267
  };
270
- /**
271
- * What may be added inside a node of this type, or null for one that takes
272
- * no children — the ONE add lookup, the host's (its block rules), for the
273
- * reason the two above are handed in. Only whether there is an answer is
274
- * read: a node with none has no "Add block inside" row.
275
- */
276
- canAddTo: (nodeType: string) => AddTarget | null;
277
268
  /**
278
269
  * The BLOCK OPERATIONS — `efficient-easel/node-ops`' `useNodeOps`, hosted by
279
270
  * the chrome (blueprint step 2.4b). Every row that changes the document
@@ -343,9 +334,6 @@ type NodeMenuHost = {
343
334
  label: string;
344
335
  select: () => void;
345
336
  } | null;
346
- /** Open the Add door for a parent that can take children. The chrome owns
347
- * WHERE a new node lands (`placementIndex`); this only asks it to open. */
348
- openAddInside: (zone: string, index: number) => void;
349
337
  /**
350
338
  * Turn a `data-puck-component` id into an address.
351
339
  *
@@ -1 +1 @@
1
- export{EASEL_NODE_CLIPBOARD,ancestorChain,nodeClipboardOf,nodeClipboardRules,nodeMenuItems,nodeShortcut,pageMenuItems,pastePlace,runNodeShortcut,textMenuItems,useNodeClipboard,useNodeContextMenu}from"../../chunk-D6N77AOS.js";import"../../chunk-V7U33NF2.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-JTUUIVBZ.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{EASEL_NODE_CLIPBOARD,ancestorChain,nodeClipboardOf,nodeClipboardRules,nodeMenuItems,nodeShortcut,pageMenuItems,pastePlace,runNodeShortcut,textMenuItems,useNodeClipboard,useNodeContextMenu}from"../../chunk-PPHUWGLZ.js";import"../../chunk-V7U33NF2.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-VWXUMVCD.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{PageEditGuardNotices as default}from"../../chunk-P4CL4YQI.js";import"../../chunk-THZ46DC5.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-JTUUIVBZ.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-MFIRYGHW.js";
1
+ export{PageEditGuardNotices as default}from"../../chunk-AFSSKGTD.js";import"../../chunk-GCCBEY2W.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-VWXUMVCD.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-MFIRYGHW.js";