efficient-easel 2.1.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/README.md +17 -4
  2. package/dist/chrome/index.d.ts +2 -2
  3. package/dist/chrome/index.js +1 -1
  4. package/dist/{chunk-2JIWFFXA.js → chunk-42TMLDSQ.js} +1 -1
  5. package/dist/{chunk-6OY2THZH.js → chunk-4LD4KA27.js} +1 -1
  6. package/dist/chunk-53NZMIRT.js +1 -0
  7. package/dist/chunk-5SOSVTVI.js +5 -0
  8. package/dist/{chunk-7SQF6LZL.js → chunk-66LWADFP.js} +1 -1
  9. package/dist/chunk-7HGVGKWU.js +64 -0
  10. package/dist/{chunk-VB5LRSGJ.js → chunk-BVUPKIM3.js} +1 -1
  11. package/dist/chunk-CRPJGCSO.js +20 -0
  12. package/dist/{chunk-35Q5HMJZ.js → chunk-EF3YSWT5.js} +1 -1
  13. package/dist/chunk-EJ6QAWRH.js +5 -0
  14. package/dist/chunk-FFYXVAAL.js +1 -0
  15. package/dist/{chunk-OXYGFK2B.js → chunk-GTDLBUOC.js} +6 -6
  16. package/dist/chunk-JVUGLF5I.js +7 -0
  17. package/dist/chunk-JZDEIRH4.js +1 -0
  18. package/dist/{chunk-UAVNI3BU.js → chunk-LHZIMK3M.js} +1 -1
  19. package/dist/chunk-LYALMY55.js +1 -0
  20. package/dist/{chunk-ZV6OYSZ7.js → chunk-MYC3AVG2.js} +1 -1
  21. package/dist/{chunk-FOBGSFFS.js → chunk-OZ72A6MY.js} +7 -7
  22. package/dist/{chunk-ZNNATBDC.js → chunk-QMBB7SU5.js} +1 -1
  23. package/dist/chunk-TCNPQKY6.js +4 -0
  24. package/dist/{chunk-AAT3O7PK.js → chunk-TGF7KEO7.js} +1 -1
  25. package/dist/chunk-UV4D7CDX.js +5 -0
  26. package/dist/{chunk-ONRYLR2D.js → chunk-VGV5D667.js} +2 -2
  27. package/dist/chunk-VX5GDBRI.js +2 -0
  28. package/dist/chunk-Y2G7CU6A.js +1 -0
  29. package/dist/copy/copy.css +79 -82
  30. package/dist/copy/index.d.ts +9 -7
  31. package/dist/copy/index.js +21 -31
  32. package/dist/fields/fields.css +0 -28
  33. package/dist/fields/index.d.ts +2 -2
  34. package/dist/fields/index.js +1 -1
  35. package/dist/panel/index.d.ts +4 -222
  36. package/dist/panel/index.js +12 -15
  37. package/dist/panel/panel.css +0 -165
  38. package/dist/screen/components/AddBlockRow.js +1 -1
  39. package/dist/screen/components/AddSidePanel.js +1 -1
  40. package/dist/screen/components/MediaSidePanel.d.ts +1 -1
  41. package/dist/screen/components/MediaSidePanel.js +1 -1
  42. package/dist/screen/components/NodeContextMenu.d.ts +16 -14
  43. package/dist/screen/components/NodeContextMenu.js +1 -1
  44. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  45. package/dist/screen/components/ScreenChrome.js +1 -1
  46. package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
  47. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  48. package/dist/screen/components/ScreenMount.d.ts +1 -1
  49. package/dist/screen/components/ScreenMount.js +1 -1
  50. package/dist/screen/components/ScreenStoreProvider.d.ts +1 -1
  51. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  52. package/dist/screen/components/SectionScreenShell.js +16 -16
  53. package/dist/screen/components/SidePanelHead.js +1 -1
  54. package/dist/screen/components/UiIcon.js +1 -1
  55. package/dist/screen/components/panel-widths.js +1 -1
  56. package/dist/screen/components/usePartBridge.d.ts +1 -1
  57. package/dist/screen/components/usePartBridge.js +1 -1
  58. package/dist/screen/index.d.ts +1 -1
  59. package/dist/screen/index.js +1 -1
  60. package/dist/screen/lib/admin-bridge.d.ts +1 -1
  61. package/dist/screen/lib/document-addressing.d.ts +1 -1
  62. package/dist/screen/lib/host-chrome.d.ts +1 -1
  63. package/dist/screen/lib/host.d.ts +1 -1
  64. package/dist/screen/lib/links/link-filters.d.ts +1 -2
  65. package/dist/screen/lib/media-panel.d.ts +1 -1
  66. package/dist/screen/lib/media-picker.d.ts +1 -1
  67. package/dist/screen/lib/page-lock.d.ts +1 -1
  68. package/dist/screen/lib/puck/device-fields.js +1 -1
  69. package/dist/screen/lib/puck/style-clipboard.d.ts +8 -4
  70. package/dist/screen/lib/puck/style-clipboard.js +1 -1
  71. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  72. package/dist/screen/lib/screen-parts.d.ts +1 -1
  73. package/dist/screen/lib/screen-parts.js +1 -1
  74. package/dist/screen/lib/section-templates.d.ts +1 -1
  75. package/dist/screen/lib/session-context.d.ts +1 -1
  76. package/dist/screen/lib/session.d.ts +1 -1
  77. package/dist/screen/words.d.ts +123 -1
  78. package/dist/screen/words.js +1 -1
  79. package/dist/strings/catalogue.d.ts +3 -3
  80. package/dist/strings/catalogue.js +1 -1
  81. package/dist/strings/index.d.ts +3 -3
  82. package/dist/strings/index.js +1 -1
  83. package/dist/text-styles/index.js +11 -11
  84. package/dist/{words-AHHfiaRY.d.ts → words-C1U_dLBh.d.ts} +7 -0
  85. package/dist/{words-XH0TvZPg.d.ts → words-lpvYzf5U.d.ts} +4 -19
  86. package/dist/{words-D8kf071T.d.ts → words-vhnV8sM7.d.ts} +4 -26
  87. package/package.json +3 -3
  88. package/dist/LinkPicker-hPEr1MJx.d.ts +0 -113
  89. package/dist/chunk-4TMMEBAG.js +0 -4
  90. package/dist/chunk-5TRBCPRB.js +0 -5
  91. package/dist/chunk-BSSKAEFF.js +0 -5
  92. package/dist/chunk-E2O2MRZR.js +0 -1
  93. package/dist/chunk-FPOKPNO4.js +0 -1
  94. package/dist/chunk-HGTPLCTQ.js +0 -1
  95. package/dist/chunk-PWZOS45R.js +0 -2
  96. package/dist/chunk-RC6DD4XP.js +0 -7
  97. package/dist/chunk-TSQUEJZB.js +0 -5
  98. package/dist/chunk-UEM66O42.js +0 -64
  99. package/dist/chunk-UH7IGZKF.js +0 -1
  100. package/dist/chunk-VETFIYQR.js +0 -23
  101. package/dist/chunk-ZJEBF4NB.js +0 -1
@@ -1,31 +1,21 @@
1
- import{DEFAULT_COPY_WORDS as e}from"../chunk-UH7IGZKF.js";import{FieldNumber as t}from"../chunk-7SQF6LZL.js";import{SettingsSegmented as n,SettingsSwitch as r}from"../chunk-QLD57GBB.js";import"../chunk-FPOKPNO4.js";import{GoldTextInput as l}from"../chunk-2FZJWH24.js";import{RETIRED_MARKS as o,applyMark as a,STANDARD_MARKUP as s,writeMarkedLines as i,sameMarks as c,markedLines as u,spanFor as d,markupTools as h,marksIn as p,findLink as f,markedAt as m,listIn as g,colorIn as b,clearStyle as y,isSafeLinkHref as v,toggleMark as k,colorOver as x,setList as w,unlinkAt as C,removeLink as S,linkOver as E,writeLink as D}from"../chunk-546BBOPE.js";import{useWords as N}from"../chunk-MFIRYGHW.js";import{withTip as M}from"../chunk-P2VEMZH5.js";import{Tooltip as L,ColorSwatch as T,ColorPickerPanel as B,Button as j,IconButton as z,registerModalEscapeInterceptor as R,Label as O,Input as P}from"efficient-shell/ui";import{useRef as F,useState as K,useLayoutEffect as $,useEffect as H,useId as W}from"react";import{AlignJustifyIcon as I,AlignRightIcon as U,AlignCenterIcon as q,AlignLeftIcon as A,ParagraphSpacingIcon as V,LetterSpacingIcon as Z,TextLinesIcon as G,TextSizeIcon as Y,CaseNormalIcon as Q,CaseUpperIcon as J,CaseLowerIcon as X,TextColorIcon as _,ListIcon as ee,NumberedListIcon as te,ClearMarksIcon as ne,BoldIcon as re,ItalicIcon as le,UnderlineIcon as oe,StrikeIcon as ae,LinkIcon as se,SuperscriptIcon as ie,SubscriptIcon as ce,QuietIcon as ue,EmphasisIcon as de}from"efficient-shell/icons/efficient";import{jsx as he,jsxs as pe,Fragment as fe}from"react/jsx-runtime";var me=["left","center","right","justify"],ge=e.align,be={left:/* @__PURE__ */he(A,{}),center:/* @__PURE__ */he(q,{}),right:/* @__PURE__ */he(U,{}),justify:/* @__PURE__ */he(I,{})},ye={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function ve(e,t=ge){return me.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:be[e],title:t[e]}))}var ke=/[\u1100-\u11ff\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/;function xe(e){if(e.every(e=>e.label===ge[e.id]))return e.length>3?ye.four:ye.three;const t=e.map(e=>[...e.label].reduce((e,t)=>e+(ke.test(t)?13:8),0));return{labelsPx:t.reduce((e,t)=>e+t,0),widestLabelPx:Math.max(0,...t)}}function we(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function Ce(e,t,n,r=a){const{start:l,end:o}=we(e,n);return r(e,l,o,t)}function Se(e,t,n){const{start:r,end:l}=we(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}var Ee=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),De=/* @__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 Ne(e,t){const n=t.rules??s,r=e.html&&""!==e.html.trim()?function(e,t,n){const r=t.createElement("template");r.innerHTML=e;const l=[[]],o=()=>l[l.length-1],a=()=>{const e=o();for(;e.length>0&&" "===e[e.length-1].ch;)e.pop();e.length>0&&l.push([])},s=(e,t,n,r)=>{if(3===e.nodeType){for(const a of e.textContent??""){const e=/\s/.test(a)?" ":a,s=o();" "===e&&(0===s.length&&l.length>1||" "===s[s.length-1]?.ch)||s.push({ch:e,bold:t,italic:n,href:r})}return}if(1!==e.nodeType&&11!==e.nodeType)return;const i=e,c=1===e.nodeType?i.localName:"";if(Ee.has(c))return;if("br"===c)return void l.push([]);let u=t,d=n,h=r;if("b"!==c&&"strong"!==c||(u=!0),"i"!==c&&"em"!==c||(d=!0),"a"===c){const e=(i.getAttribute("href")??"").trim();h=v(e)?e:null}const p=1===e.nodeType?i.style:null;if(p){const e=p.fontWeight;"bold"===e||"bolder"===e||Number(e)>=600?u=!0:("normal"===e||"lighter"===e||""!==e&&Number(e)<600)&&(u=!1),"italic"===p.fontStyle||"oblique"===p.fontStyle?d=!0:"normal"===p.fontStyle&&(d=!1)}const f=De.has(c);f&&a();for(const t of[...e.childNodes])s(t,u,d,h);f&&a()};s(r.content,!1,!1,null);for(;l.length>1&&0===l[l.length-1].length;)l.pop();return l.map(e=>function(e,t){const n=t=>e.map((n,r)=>n[t]&&(" "!==n.ch||Boolean(e[r-1]?.[t])&&Boolean(e[r+1]?.[t]))),r=[{bold:!0,italic:!0,links:!0},{bold:!0,italic:!1,links:!0},{bold:!1,italic:!1,links:!0},{bold:!1,italic:!1,links:!1}];for(const l of r){const r=Me(e,l.bold?n("bold"):null,l.italic?n("italic"):null,l.links),o=i([r]).text;if(c([r],u(o,t)))return o}return e.map(e=>e.ch).join("")}(e,n))}(e.html,t.doc,n):(e.text??"").replace(/\r\n?/g,"\n").split("\n");return t.multiline?r.join("\n"):1===r.length?r[0]:r.map(e=>e.trim()).filter(e=>""!==e).join(" ")}function Me(e,t,n,r){let l=0,o=null,a=null,s=null;return{bullet:!1,chars:e.map((e,i)=>{const c=r?e.href:null;return o=null===c?null:o&&o.href===c?o:d(++l,"link",c),a=t?.[i]?a??d(++l,"bold"):null,s=n?.[i]?s??d(++l,"italic"):null,{ch:e.ch,at:-1,marks:[o,a,s].filter(e=>null!==e)}})}}var Le=/^([0-9]{1,3})\. $/;function Te(e,t){const n=e.split("\n"),r=u(e,t);let l=0,o=0;const a=r.map((e,t)=>{const r=!e.bullet&&null==e.number&&"- "===n[t],a=null!=e.number||e.bullet?null:Le.exec(n[t]),s=e.bullet||r,i=a?a[1]:e.number??null,c=r||a?[]:e.chars,u=c.map(e=>e.ch).join(""),d=null!=i?i.length+2:s?2:0,h={bullet:s,number:i,chars:c,start:l,src:l+d,vis:o,text:u};return l+=n[t].length+1,o+=u.length+1,h});return{lines:a,text:a.map(e=>e.text).join("\n")}}function Be(e,t){const{lines:n}=e;for(let e=0;e<n.length;e+=1){const r=n[e];if(t<=r.vis+r.text.length||e===n.length-1)return[r,Math.max(0,Math.min(t-r.vis,r.text.length)),e]}return[n[0],0,0]}function je(e,t){const[n,r]=Be(e,t);if(0===r)return n.src;let l=0;for(const e of n.chars){if(r<=l+e.ch.length)return e.at+(r-l);l+=e.ch.length}return n.src}function ze(e,t){const[n,r]=Be(e,t);let l=0;for(const e of n.chars){if(r===l)return e.at;l+=e.ch.length}return je(e,t)}function Re(e,t){const{lines:n}=e;let r=n[0];for(const e of n)t>=e.start&&(r=e);let l=0;for(const e of r.chars){if(!(t>=e.at+e.ch.length)){t>e.at&&(l+=t-e.at);break}l+=e.ch.length}return r.vis+l}function Oe(e,t,n){return[Re(e,t),Re(e,n)]}function Pe(e,t,n){return t===n?[je(e,t),je(e,t)]:[ze(e,t),je(e,n)]}function Fe(e,t){let n=0;for(let r=0;r<e.chars.length;r+=1){if(n>=t)return r;n+=e.chars[r].ch.length}return e.chars.length}function Ke(e,t,n,r,l){const o=Te(e,t),[a,s,h]=Be(o,Math.min(n,r)),[p,f,m]=Be(o,Math.max(n,r)),g=Fe(a,s),b=Fe(p,f),y=a.chars.slice(0,g),v=p.chars.slice(b),k=n!==r&&a.chars[g]&&(h!==m||g<b)?a.chars[g].marks:function(e,t){const n=e.chars[t-1],r=e.chars[t],l=(e,t)=>{const n=e.findIndex(e=>"link"===e.kind);return-1===n||t?e:e.slice(0,n)};if(n){const e=n.marks.find(e=>"link"===e.kind),t=Boolean(e&&r?.marks.some(t=>t.id===e.id));return l(n.marks,t)}return r?l(r.marks,!1):[]}(a,g);let x=(w=o.lines,Math.max(0,...w.flatMap(e=>e.chars.flatMap(e=>e.marks.map(e=>e.id))))+1);var w;const C=e=>{let n;if(void 0!==l.markup){const e=x;n=u(l.markup,t).map(t=>({bullet:t.bullet,number:t.number??null,chars:t.chars.map(t=>({...t,at:-1,marks:t.marks.map(t=>({...t,id:t.id+e}))}))}))}else{let t=a.number??null;n=(l.text??"").split("\n").map((n,r)=>(r>0&&null!=t&&(t=function(e){return String(Number(e)+1).padStart(e.length,"0")}(t)),{bullet:a.bullet,number:t,chars:[...n].map(t=>({ch:t,at:-1,marks:e??[]}))}))}const r=n.map(e=>e.chars.map(e=>e.ch).join("")).join("\n"),s={bullet:a.bullet,number:a.number??null,chars:[...y,...n[0].chars]},i=n.slice(1);if(i.length>0){const e=i[i.length-1];i[i.length-1]={...e,chars:[...e.chars,...v]}}else s.chars.push(...v);return{lines:[...o.lines.slice(0,h).map(({bullet:e,number:t,chars:n})=>({bullet:e,number:t,chars:n})),s,...i,...o.lines.slice(m+1).map(({bullet:e,number:t,chars:n})=>({bullet:e,number:t,chars:n}))],shown:r}},S=void 0!==l.markup?[null]:[(e=>{let t=e.filter(e=>!l.drop?.some(t=>e.kind===t||"highlight"===t&&"accent"===e.kind));for(const e of l.add??[]){if(t.some(t=>t.kind===e))continue;const n=d(x++,e);n&&(t=[...t,n])}if(void 0!==l.color){t=t.filter(e=>"color"!==e.kind);const e=null===l.color?null:d(x++,"color",l.color);e&&(t=[...t,e])}return t})(k),k,[]];let E="",D="";for(const e of S){const n=C(e),r=i(n.lines).text;if(E=r,D=n.shown,c(n.lines,Te(r,t).lines))break}return{text:E,caret:Math.min(n,r)+D.length}}function $e(e,t,n,r){const l=Te(e,t),[o,,a]=Be(l,n);return n!==r||!o.bullet&&null==o.number||""!==o.text?Ke(e,t,n,r,{text:"\n"}):He(e,t,a,!1,n)}function He(e,t,n,r,l){const o=Te(e,t).lines.map(({bullet:e,number:t,chars:l},o)=>o===n?{bullet:r,number:null,chars:l}:{bullet:e,number:t,chars:l});return{text:i(o).text,caret:l}}function We(e,t,n,r){const l=Te(e,t),[o,a,s]=Be(l,Math.min(n,r)),[c,u,d]=Be(l,Math.max(n,r)),h=l.lines.slice(s,d+1).map(({bullet:e,number:t,chars:n},r)=>{const l=0===r?Fe(o,a):0,i=r===d-s?Fe(c,u):n.length;return{bullet:e,number:t,chars:n.slice(l,i)}});return i(h).text}var Ie="application/x-efficient-markup";function Ue(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 qe(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 Ae(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 Ve(e,t,n){if(n<0){const n=e.charCodeAt(t-1);return t-(n>=56320&&n<=57343&&t>=2?2:1)}const r=e.charCodeAt(t);return t+(r>=55296&&r<=56319?2:1)}function Ze({value:e,rules:t,multiline:n,readOnly:r=!1,placeholder:l,ariaLabel:o,handle:a,onEdit:s,onSelect:i,onHistory:c,onFormat:u,pending:d,onCommit:h,onCancel:p}){const f=F(null),m=F(null),g=F(null),b=F(null),y=F(null),v=F(e),[k,x]=K(0),w=F({value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u});w.current={value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u};const C=()=>{const e=f.current,t=m.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=qe(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?qe(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},S=(e,t)=>{const n=f.current,r=m.current;if(!n||!r)return;const[l,o]=Ae(r,e),[a,s]=Ae(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};a.current={getSource(){const e=C(),t=m.current;if(!e||!t)return null;const[n,r]=Pe(t.layout,e[0],e[1]);return{start:n,end:r}},setSource(e,t,n){b.current={text:n,src:[e,t]},x(e=>e+1)},focus(){f.current?.focus()},rangeOf(e,t){const n=f.current,r=m.current;if(!n||!r)return null;const[l,o]=Oe(r.layout,e,t),[a,s]=Ae(r,l),[i,c]=Ae(r,o),u=n.ownerDocument.createRange();return u.setStart(a,s),u.setEnd(i,c),u}},$(()=>{const n=f.current;if(!n||y.current)return;const r=b.current?null:C();m.current=function(e,t){const n=e.ownerDocument;e.replaceChildren();const r=t.lines.map(t=>{const r=n.createElement("div");r.className=null!=t.number?"es-rich-line is-numbered":t.bullet?"es-rich-line is-bullet":"es-rich-line",null!=t.number&&(r.dataset.number=t.number);const l=[],o=()=>l.length?l[l.length-1].el:r;let a=null;for(const e of t.chars){let t=0;for(;t<l.length&&t<e.marks.length&&l[t].id===e.marks[t].id;)t+=1;(l.length>t||e.marks.length>t)&&(a=null),l.length=t;for(let r=t;r<e.marks.length;r+=1){const t=Ue(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,Te(e,t)),g.current=e;const l=b.current;if(!l||l.text!==e)return void(r&&n.ownerDocument.activeElement===n&&S(r[0],Math.min(r[1],m.current.layout.text.length)));b.current=null;const o=m.current.layout,[a,s]=l.vis??Oe(o,l.src[0],l.src[1]);n.ownerDocument.activeElement!==n&&n.focus(),S(a,s)},[e,t,k]);const E=(e,t,n)=>{const r=m.current,[l,o]=Pe(r.layout,t[0],t[1]);b.current={text:e.text,vis:[e.caret,e.caret]},e.text!==w.current.value?w.current.onEdit(e.text,{start:l,end:o},n):x(e=>e+1)};H(()=>{const e=f.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:a}=w.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const s=m.current,i=C();if(!s||!i)return;let[c,u]=i;const d="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0;d&&!d.collapsed&&t.inputType.startsWith("delete")&&(c=qe(s,e,d.startContainer,d.startOffset),u=qe(s,e,d.endContainer,d.endOffset));const h=s.layout.text,p=t.inputType;if("historyUndo"!==p&&"historyRedo"!==p)if("formatBold"!==p&&"formatItalic"!==p&&"formatStrikeThrough"!==p)if("insertParagraph"!==p&&"insertLineBreak"!==p){if(p.startsWith("insert")){let o=t.data??t.dataTransfer?.getData("text/plain")??"";if("insertFromDrop"===p||"insertFromPaste"===p){const a=Ne({html:t.dataTransfer?.getData("text/html"),text:o},{doc:e.ownerDocument,multiline:l,rules:r});return void E(Ke(n,r,c,u,{markup:a}),[c,u],"edit")}return l||(o=o.replace(/\s*\r?\n\s*/g," ")),void E(Ke(n,r,c,u,{text:o,add:a?.add,drop:a?.drop,color:a?.color}),[c,u],"type")}if(p.startsWith("delete")){if(c===u){const e=p.includes("Backward"),t=s.layout.lines.findIndex(e=>c>=e.vis&&c<=e.vis+e.text.length),l=s.layout.lines[t];if(e&&l&&c===l.vis&&(l.bullet||null!=l.number))return void E(He(n,r,t,!1,c),[c,u],"edit");if(e?0===c:c===h.length)return;e?c=Ve(h,c,-1):u=Ve(h,u,1)}E(Ke(n,r,c,u,{text:""}),[c,u],"type")}}else l&&E($e(n,r,c,u),[c,u],"edit");else w.current.onFormat("formatBold"===p?"bold":"formatItalic"===p?"italic":"strike");else w.current.onHistory("historyUndo"===p?"undo":"redo")},n=()=>{y.current||x(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),H(()=>{const e=f.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=a.current?.getSource();e&&i(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const D=(n,l=!1)=>{const o=C();if(!o||o[0]===o[1])return;n.preventDefault();const a=m.current;n.clipboardData.setData("text/plain",a.layout.text.slice(o[0],o[1])),n.clipboardData.setData(Ie,We(e,t,o[0],o[1])),l&&!r&&E(Ke(e,t,o[0],o[1],{text:""}),o,"edit")};/* @__PURE__ */
2
- return pe("div",{className:"es-rich-wrap",children:[l&&""===e?/* @__PURE__ */he("div",{className:"es-rich-placeholder","aria-hidden":"true",children:l}):null,
3
- /* @__PURE__ */he("div",{ref:f,className:`es-rich${n?" is-multiline":" is-single"}${r?" is-off":""}`,contentEditable:!r,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":n,"aria-label":o,"aria-readonly":r||void 0,"aria-placeholder":l,tabIndex:r?-1:0,spellCheck:!0,onFocus:()=>{v.current=e},onBlur:()=>{e!==v.current&&h?.(e),v.current=e},onKeyDown:t=>{if("Escape"===t.key)return t.preventDefault(),p?.(v.current),void(v.current=e);"Enter"!==t.key||n||(t.preventDefault(),e!==v.current&&h?.(e),v.current=e)},onCompositionStart:()=>{const e=C()??[0,0];y.current={from:e[0],to:e[1]}},onCompositionEnd:e=>{const t=y.current;if(y.current=null,!t)return;const{value:n,rules:r,pending:l}=w.current;e.data?E(Ke(n,r,t.from,t.to,{text:e.data,add:l?.add,drop:l?.drop,color:l?.color}),[t.from,t.to],"type"):x(e=>e+1)},onCopy:e=>D(e),onCut:e=>D(e,!0),onPaste:l=>{if(l.preventDefault(),r)return;const o=C();if(!o)return;const a=l.clipboardData.getData(Ie),s=a?n?a:a.replace(/\s*\r?\n\s*/g," "):Ne({html:l.clipboardData.getData("text/html"),text:l.clipboardData.getData("text/plain")},{doc:l.currentTarget.ownerDocument,multiline:n,rules:t});E(Ke(e,t,o[0],o[1],{markup:s}),o,"edit")}})]})}var Ge=1e3;function Ye(e=200){let t=[],n=[],r=null,l=0;return{record(o,a,s){const i="type"===a&&"type"===r&&s-l<1e3;r=a,l=s,n=[],i||(t.push(o),t.length>e&&t.shift())},undo(e){const l=t.pop();return l?(n.push(e),r=null,l):null},redo(e){const l=n.pop();return l?(t.push(e),r=null,l):null},reset(){t=[],n=[],r=null}}}var Qe={fontSize:{key:"fontSize",nameKey:"fontSize",icon:/* @__PURE__ */he(Y,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */he(G,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */he(Z,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */he(V,{}),unit:"px",step:1,shiftStep:10,min:0}};function Je(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function Xe({cells:n,words:r,readOnly:l=!1}){const o=r??e.cells;/* @__PURE__ */
4
- return he("div",{className:"es-copy-cells",children:n.map(e=>{const n=e.scale??1,r=e.name??(e.nameKey?o[e.nameKey]:e.key),a=e.unit??"",s=e.step??1;/* @__PURE__ */
5
- return he(t,{value:Je(e.value,n),styleValue:Je(e.styleValue,n),onChange:t=>e.onChange(void 0===t?void 0:Number((t/n).toFixed(6))),min:e.min,max:e.max,step:s,shiftStep:e.shiftStep,icon:e.icon,unit:a||void 0,steppers:"compact",readOnly:l,ariaLabel:r,title:o.tip({name:r,step:s,unit:a})},e.key)})})}var _e=e=>e.preventDefault();function et({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__ */
6
- return pe("div",{className:"es-copy-pop es-copy-colors",role:"dialog","aria-label":n.title,onMouseDown:e=>{e.target instanceof HTMLInputElement||e.preventDefault()},children:[
7
- /* @__PURE__ */he("span",{className:"es-copy-pop-label",children:n.theme}),
8
- /* @__PURE__ */he("div",{className:"es-copy-theme",role:"group","aria-label":n.theme,children:e.map(e=>/* @__PURE__ */he(L,{content:`${e.label} · ${e.value.toUpperCase()}`,children:/* @__PURE__ */he(T,{color:e.value,size:"sm",className:"es-copy-theme-swatch","data-color":e.name,"aria-label":e.label,selected:t===e.name,onMouseDown:_e,onClick:()=>r(e.name)})},e.name))}),
9
- /* @__PURE__ */he("span",{className:"es-copy-pop-label",children:n.any}),
10
- /* @__PURE__ */he(B,{className:"es-copy-any",value:l??"",onChange:e=>{e!==t&&r(e)},label:n.title,dragWrites:"end"}),
11
- /* @__PURE__ */he("div",{className:"es-copy-pop-foot",children:/* @__PURE__ */he(j,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onMouseDown:_e,onClick:()=>r(null),children:n.remove})})]})}function tt({href:t,editing:n,onApply:r,onRemove:l,onClose:o,floating:a=!1}){const s=N("copy",e).link,i=W(),[c,u]=K(t),[d,h]=K(!1),p=F(null),f=F(null),m=F(o);m.current=o,H(()=>R(e=>{const t=f.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(m.current(),!0)},()=>f.current),[]),H(()=>{p.current?.focus(),p.current?.select()},[]);const g=()=>{const e=c.trim();v(e)?r(e):h(!0)};/* @__PURE__ */
12
- return pe("div",{ref:f,role:"dialog","aria-label":s.title,className:"es-copy-link"+(a?" es-copy-pop":""),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),g())},children:[
13
- /* @__PURE__ */he(O,{htmlFor:i,className:"es-copy-link-label",children:s.label}),
14
- /* @__PURE__ */he(P,{ref:p,id:i,size:"sm",type:"text",value:c,placeholder:s.placeholder,spellCheck:!1,autoComplete:"off",invalid:d,"aria-describedby":d?`${i}-why`:void 0,onChange:e=>{u(e.target.value),h(!1)}}),d?/* @__PURE__ */he("p",{id:`${i}-why`,role:"alert",className:"es-copy-link-why",children:s.refused}):null,
15
- /* @__PURE__ */pe("div",{className:"es-copy-link-actions",children:[n?/* @__PURE__ */he(j,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onClick:l,children:s.remove}):null,
16
- /* @__PURE__ */pe("span",{className:"es-copy-link-end",children:[
17
- /* @__PURE__ */he(j,{variant:"secondary",size:"sm","data-window-action":"cancel",onClick:o,children:s.cancel??e.link.cancel}),
18
- /* @__PURE__ */he(j,{variant:"primary",size:"sm","data-window-action":"apply",onClick:g,disabled:""===c.trim(),children:s.apply})]})]})]})}var nt=e=>e.preventDefault();function rt(){/* @__PURE__ */
19
- return he("span",{className:"es-tb-cell is-empty","aria-hidden":"true"})}function lt({words:e,align:t,alignmentLabel:n,offered:r,pressed:l,onMark:o,color:a,linkOpen:s,last:i,alignment:c,list:u,letterCase:d,disabled:h=!1,ariaLabel:p="Formatting"}){const f=e=>"es-tb-cell es-tb-btn"+(e?" is-on":""),m=(e,t,n,a)=>r.has(e)?M(t,/* @__PURE__ */he(z,"link"===e?{pressed:Boolean(s),className:f(Boolean(s)),"aria-label":t,"aria-haspopup":"dialog","aria-expanded":s,"aria-keyshortcuts":a,disabled:h,onMouseDown:nt,onClick:()=>o(e),children:n}:{className:"es-tb-cell es-tb-btn"+(l[e]?" is-on":""),"aria-label":t,"aria-pressed":Boolean(l[e]),"aria-keyshortcuts":a,disabled:h,onMouseDown:nt,onClick:()=>o(e),children:n},e)):/* @__PURE__ */he(rt,{},e),g=[["left",/* @__PURE__ */he(A,{},"l")],["center",/* @__PURE__ */he(q,{},"c")],["right",/* @__PURE__ */he(U,{},"r")],["justify",/* @__PURE__ */he(I,{},"j")]],b=[["none",e.caseNone,/* @__PURE__ */he(Q,{},"n")],["upper",e.caseUpper,/* @__PURE__ */he(J,{},"u")],["lower",e.caseLower,/* @__PURE__ */he(X,{},"w")]];/* @__PURE__ */
20
- return pe("div",{className:"es-tb",role:"toolbar","aria-label":p,children:[
21
- /* @__PURE__ */pe("div",{className:"es-tb-row"+(void 0===i?" is-eight":""),children:[m("bold",e.bold,/* @__PURE__ */he(re,{}),"Meta+B"),m("italic",e.italic,/* @__PURE__ */he(le,{}),"Meta+I"),m("underline",e.underline,/* @__PURE__ */he(oe,{}),"Meta+U"),m("strike",e.strike,/* @__PURE__ */he(ae,{})),a?M(e.color,/* @__PURE__ */he(z,{pressed:a.open,className:`${f(a.open)} es-tb-color`,"aria-label":e.color,"aria-haspopup":"dialog","aria-expanded":a.open,disabled:h,style:a.run?{"--es-tb-run":a.run}:void 0,onMouseDown:nt,onClick:a.onToggle,children:/* @__PURE__ */he(_,{})},"color")):/* @__PURE__ */he(rt,{}),m("link",e.link,/* @__PURE__ */he(se,{}),"Meta+K"),m("sup",e.sup,/* @__PURE__ */he(ie,{})),m("sub",e.sub,/* @__PURE__ */he(ce,{})),void 0!==i?i??/* @__PURE__ */he(rt,{}):null]}),
22
- /* @__PURE__ */pe("div",{className:"es-tb-row",children:[
23
- /* @__PURE__ */he("div",{className:"es-tb-group",role:"radiogroup","aria-label":n,children:g.map(([e,n])=>c&&c.allow.includes(e)?M(t[e],/* @__PURE__ */he(z,{role:"radio",pressed:c.value===e,className:f(c.value===e),"aria-checked":c.value===e,"aria-label":t[e],disabled:h||c.disabled,onMouseDown:nt,onClick:()=>c.onChange(e),children:n},e)):/* @__PURE__ */he(rt,{},e))}),u&&r.has("bullet")?M(e.bullet,/* @__PURE__ */he(z,{className:"es-tb-cell es-tb-btn"+("bullet"===u.pressed?" is-on":""),"aria-label":e.bullet,"aria-pressed":"bullet"===u.pressed,disabled:h,onMouseDown:nt,onClick:()=>u.onList("bullet"),children:/* @__PURE__ */he(ee,{})})):/* @__PURE__ */he(rt,{}),u&&r.has("number")?M(e.number,/* @__PURE__ */he(z,{className:"es-tb-cell es-tb-btn"+("number"===u.pressed?" is-on":""),"aria-label":e.number,"aria-pressed":"number"===u.pressed,disabled:h,onMouseDown:nt,onClick:()=>u.onList("number"),children:/* @__PURE__ */he(te,{})})):/* @__PURE__ */he(rt,{}),
24
- /* @__PURE__ */he("div",{className:"es-tb-group",role:"radiogroup","aria-label":e.letterCase,children:b.map(([e,t,n])=>d?M(t,/* @__PURE__ */he(z,{role:"radio",pressed:d.value===e,className:f(d.value===e),"aria-checked":d.value===e,"aria-label":t,disabled:h||d.disabled,onMouseDown:nt,onClick:()=>d.onChange(d.value===e?"":e),children:n},e)):/* @__PURE__ */he(rt,{},e))})]})]})}var ot=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n));var at=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom});function st(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 it(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 ct=/* @__PURE__ */new Set([...o,"clear"]),ut={bold:/* @__PURE__ */he(re,{size:16}),italic:/* @__PURE__ */he(le,{size:16}),strike:/* @__PURE__ */he(ae,{size:16}),highlight:/* @__PURE__ */he(de,{size:16}),quiet:/* @__PURE__ */he(ue,{size:16}),link:/* @__PURE__ */he(se,{size:16}),clear:/* @__PURE__ */he(ne,{size:16})};function dt(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 ht={bold:"is-bold",italic:"is-italic",strike:"is-strike"};function pt({tools:t,onApply:n,disabled:r=!1,actions:l,align:o,glyphs:a,ariaLabel:s,pressed:i,open:c=null}){const u=N("copy",e),d=("string"==typeof t[0]?h(t).map(e=>({...e,...u.marks[e.style]})):t).filter(e=>!ct.has(e.style));return 0!==d.length||l||o?/* @__PURE__ */pe("div",{className:"es-copy-bar",role:"group","aria-label":s??u.formatting,children:[d.map(e=>{const t=a?.[e.style]??ut[e.style],l=c===e.style||Boolean(i?.[e.style]),o="link"===e.style&&Boolean(i);return M(e.title,/* @__PURE__ */he(z,{onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.style),disabled:r,"aria-label":e.name??e.title,"aria-keyshortcuts":dt(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":ht[e.style]?` ${ht[e.style]}`:""}${l?" is-active":""}`,children:t??e.label},e.style))}),l?/* @__PURE__ */pe(fe,{children:[
25
- /* @__PURE__ */he("span",{className:"es-copy-bar-split","aria-hidden":"true"}),l]}):null,o?/* @__PURE__ */he("span",{className:"es-copy-bar-end",children:o}):null]}):null}function ft({target:e,onChange:t}){const n=F(null);return $(()=>{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}}}function mt({value:t,onChange:o,onCommit:i,onCancel:c,multiline:u=!1,placeholder:v,ariaLabel:L,className:T,readOnly:B=!1,rules:j,tools:z=[],writeMark:O,actions:P,align:I,glyphs:U,barLabel:q,renderFooter:A,inputRef:V,barShows:Z="always",richText:G=!0,defaultShowMarks:Y=!1,toolbar:Q="final",colors:J,cells:X,letterCase:_,lastTool:ee}){const te="final"===Q,re=N("copy",e),le=F(null),oe=V??le,[ae,se]=K(!1),[ie,ce]=K(null),ue=F(Ye()).current,de=F(null);H(()=>{const e=de.current;e&&t===e.to?de.current=null:e&&t===e.from||(de.current=null,ue.reset())},[t,ue]);const me=e=>{de.current={from:de.current?.from??t,to:e},o(e)},ge=e=>({text:t,start:e?.selectionStart??ie?.start??t.length,end:e?.selectionEnd??ie?.end??t.length}),[be,ye]=K(Y),ke=G&&!(u&&be),we=F(null),Ee=W(),[De,Me]=K(null),[Le,Te]=K(!1),Be=()=>{if(!ke)return oe.current;const e=we.current?.getSource()??ie;return e?{selectionStart:e.start,selectionEnd:e.end}:null},je=ft({target:oe,onChange:me}),ze=e=>(ce({start:e.selectionStart,end:e.selectionEnd}),e),Re=(e,n)=>{if(!ke)return void je(t=>(n&&ue.record(ge(t),"edit",Date.now()),ze(e(t))));const r=Be(),l=ze(e(r));n&&ue.record(ge(r),"edit",Date.now()),Me(null),l.text!==t&&me(l.text),we.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},Oe=e=>Re(e,!0),Pe=e=>Re(t=>{const n=ge(t),r=ue[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),Fe=F(null);$(()=>{const e=Fe.current;e&&(Fe.current=null,ke?we.current?.setSource(e.start,e.end,t):(oe.current?.focus(),oe.current?.setSelectionRange(e.start,e.end),ce(e)))},[ke]);const[Ke,$e]=K(null),He=j??s,We=("string"==typeof z[0]?h(z):z).filter(e=>!ct.has(e.style)),Ie=te?("string"==typeof z[0]?z:z.map(e=>e.style)).filter(e=>!ct.has(e)):We.map(e=>e.style),Ue={};if(ie&&(ke||te)){const e=p(t,ie.start,ie.end,He);for(const t of Ie){const n=e.has(t)||"highlight"===t&&e.has("accent");Ue[t]=!!De?.add.includes(t)||!De?.drop.includes(t)&&n}te&&(Ue.link=e.has("link"))}else if(ie)for(const e of Ie)Ue[e]="link"===e?null!==f(t,ie.start,ie.end):m(t,ie.start,ie.end,e);const qe=()=>{const e=Be(),n=e?.selectionStart??t.length;return{start:n,end:e?.selectionEnd??n}},Ae={sup:"sub",sub:"sup"},Ve=e=>{if(te&&"link"!==e&&d(0,e)){const{start:n,end:r}=qe(),l=Ae[e];if(n===r){if(!ke)return void Oe(n=>Ce(t,e,n,(e,t,n,r)=>a(e,t,n,r,He,re.placeholders)));const o=p(t,n,r,He),s=De&&De.at===n?De:null,i=o.has(e),c=!!s?.add.includes(e)||!s?.drop.includes(e)&&i;let u=(s?.add??[]).filter(t=>t!==e),d=(s?.drop??[]).filter(t=>t!==e);return c&&i?d.push(e):c||i||u.push(e),!c&&l&&(u=u.filter(e=>e!==l),o.has(l)&&(d=[...d.filter(e=>e!==l),l])),void Me(u.length||d.length||void 0!==s?.color?{add:u,drop:d,color:s?.color,at:n}:null)}return void Oe(()=>{let o=t,a=n,s=r;if(l&&!p(o,a,s,He).has(e)&&p(o,a,s,He).has(l)){const e=k(o,a,s,l,He);({text:o,selectionStart:a,selectionEnd:s}=e)}return k(o,a,s,e,He)})}if("clear"===e)return void Oe(n=>Ce(t,e,n,(e,t,n)=>a(e,t,n,"clear",He)));if("link"!==e&&ke&&d(0,e)){const n=Be(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;if(r===l){const n=p(t,r,l,He),o=n.has(e)||"highlight"===e&&n.has("accent"),a=De&&De.at===r?De: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 Oe(n=>k(t,n?.selectionStart??r,n?.selectionEnd??l,e,He))}if("link"!==e){const n=O??((e,t,n,r)=>a(e,t,n,r,s,re.placeholders));return void Oe(r=>Ce(t,e,r,n))}const n=Be(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;Te(!1),$e({start:r,end:l,link:f(t,r,l)})},Ge=Boolean(ie&&ie.start!==ie.end),Qe=ie?g(t,ie.start,ie.end,He):null,Je=ie?De&&void 0!==De.color&&De.at===ie.start?De.color:b(t,ie.start,ie.end,He):null,_e=Je?Je.startsWith("#")?Je:J?.find(e=>e.name===Je)?.value:void 0,nt=e=>{ke?e?we.current?.setSource(e.start,e.end,t):we.current?.focus():(oe.current?.focus(),e&&oe.current?.setSelectionRange(e.start,e.end))},rt=()=>{const e=Ke;$e(null),nt(e?{start:e.start,end:e.end}:ie)},ut=()=>{const e=ht.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));Te(!1),t&&nt(ie)},dt=F(ut);dt.current=ut,H(()=>{if(Le)return R(e=>{const t=ht.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(dt.current(),!0)},()=>ht.current?.querySelector(".es-copy-colors"))},[Le]);const ht=F(null),mt=Le||null!==Ke;H(()=>{const e=ht.current;if(!mt||!e)return;const t=e.ownerDocument,n=()=>{Te(!1),$e(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)}},[mt]);const gt=Ke??(Le?ie??{start:t.length,end:t.length}:null),bt=F(()=>{});bt.current=()=>{const e=ht.current,t=e?.querySelector(".es-tb-wrap > .es-copy-pop");if(!e||!t||!gt)return;const n=ke?null:e.querySelector(".es-gold-layer"),r=ke?we.current?.rangeOf(gt.start,gt.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,gt.start,gt.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?at(t):at(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=ot(e.left,a,s),c=r.bottom-(e.bottom+o),u=e.top-o-r.top,d=t.height>c&&(t.height<=u||u>c),h=d?e.top-o-t.height:e.bottom+o,p=e.left+Math.min((e.right-e.left)/2,10),f=ot(p-5-i,10,t.width-10-10);return{top:h-l.top,left:i-l.left,above:d,point:f}}({anchor:a,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:st(e),parent:it(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"},$(()=>{const e=ht.current;if(!mt||!e)return;const t=()=>bt.current();t();const n=e.ownerDocument.defaultView;n?.addEventListener("resize",t);const r=e.querySelector(".es-tb-wrap > .es-copy-pop"),l=n?.ResizeObserver,o=l&&r?new l(t):null;return o&&r&&o.observe(r),()=>{n?.removeEventListener("resize",t),o?.disconnect()}},[mt,Le,Ke,gt?.start,gt?.end,ke]);const yt=e=>Ke&&/* @__PURE__ */he(tt,{floating:e,href:Ke.link?.href??"",editing:null!==Ke.link,onApply:e=>{const n=Ke;$e(null),Oe(()=>ke?E(t,n.start,n.end,e,He):D(t,n.start,n.end,e))},onRemove:()=>{const e=Ke.link,n=Ke;$e(null),e&&Oe(()=>ke?C(t,n.start,n.end,He):S(t,e))},onClose:rt}),vt=I?ve(I.allow,re.align):[],kt="always"===Z||ae||null!==Ke||Le;/* @__PURE__ */
26
- return pe("div",{ref:ht,className:"es-copy"+(T?` ${T}`:""),onFocus:()=>se(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||se(!1)},onKeyDown:e=>{const t=e.target===oe.current||Boolean(e.target.closest?.(".es-rich"));if(B||!t)return;if(e.altKey||e.metaKey===e.ctrlKey)return;const n=e.key.toLowerCase(),r="KeyZ"===e.code||"z"===n,l=("KeyY"===e.code||"y"===n)&&!e.shiftKey;if(r||l)return e.preventDefault(),e.stopPropagation(),void Pe(l||e.shiftKey?"redo":"undo");const o=`${e.shiftKey?"shift+":""}${n}`;if(te){const t={b:"bold",i:"italic",u:"underline",k:"link"}[o];if(!t||!Ie.includes(t))return;return e.preventDefault(),e.stopPropagation(),void Ve(t)}const a=We.find(e=>e.shortcut===o);a&&(e.preventDefault(),e.stopPropagation(),Ve(a.style))},onPaste:e=>{const n=oe.current;if(B||!n||e.target!==n)return;e.preventDefault();const r=Ne({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:u,rules:He});Oe(e=>Se(t,r,e))},style:J&&J.length>0?Object.fromEntries(J.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const e=oe.current;e&&e.ownerDocument.activeElement===e&&ce({start:e.selectionStart??t.length,end:e.selectionEnd??t.length})},children:[kt&&te?/* @__PURE__ */pe("div",{className:"es-tb-wrap"+(ee?"":" is-eight"),children:[
27
- /* @__PURE__ */he(lt,{words:re.toolbar??e.toolbar,align:re.align,alignmentLabel:re.alignment,ariaLabel:q??re.formatting,offered:new Set(Ie),pressed:Ue,onMark:e=>Ve(e),color:J&&J.length>0?{run:_e,open:Le,onToggle:()=>{$e(null),Le?ut():Te(!0)}}:void 0,linkOpen:null!==Ke,last:ee?ee({className:"es-tb-cell es-tb-btn",disabled:B,selected:Ge,keepCaret:e=>e.preventDefault(),insert:e=>Oe(n=>Se(t,e,n))}):void 0,alignment:I?{value:I.value,allow:I.allow,onChange:I.onChange,disabled:I.disabled}:void 0,list:{pressed:Qe,onList:e=>{const{start:n,end:r}=qe(),l=g(t,n,r,He);Oe(()=>w(t,n,r,l===e?null:e,He))}},letterCase:_,disabled:B}),Le&&J&&J.length>0?/* @__PURE__ */he(et,{colors:J,current:Je,words:re.colors??e.colors,onPick:e=>{const{start:n,end:r}=qe();if(n!==r)Oe(()=>x(t,n,r,e,He));else{if(!ke)return;Me({add:De?.add??[],drop:De?.drop??[],color:e,at:n})}}}):null,Ke?yt(!0):null]}):null,te&&X&&X.length>0?/* @__PURE__ */he(Xe,{cells:X,words:re.cells??e.cells,readOnly:B}):null,kt&&!te?/* @__PURE__ */he(pt,{tools:z,disabled:B,actions:P,glyphs:U,ariaLabel:q,pressed:Ue,open:Ke?"link":null,onApply:Ve,align:I?/* @__PURE__ */he(n,{options:vt,value:I.value,onChange:I.onChange,ariaLabel:re.alignment,disabled:B||I.disabled,fit:xe(vt)}):null}):null,ke?/* @__PURE__ */he(Ze,{value:t,rules:He,multiline:u,readOnly:B,placeholder:v,ariaLabel:L,handle:we,pending:De??void 0,onEdit:(e,n,r)=>{ue.record({text:t,start:n.start,end:n.end},r,Date.now()),Me(null),me(e)},onSelect:e=>{ce(t=>t&&t.start===e.start&&t.end===e.end?t:e),!De||e.start===De.at&&e.end===De.at||Me(null)},onHistory:Pe,onFormat:e=>{Ie.includes(e)&&Ve(e)},onCommit:i,onCancel:c}):/* @__PURE__ */he(l,{value:t,onInput:e=>{ue.record(ge(null),"type",Date.now()),me(e)},onCommit:i,onCancel:c,multiline:u,placeholder:v,ariaLabel:L,rules:j,disabled:B,inputRef:oe,className:"es-copy-box"}),Ke&&!te?yt(!1):null,A?A({focused:ae,insert:e=>Oe(n=>Se(t,e,n))}):null,G&&u||te&&kt?
28
- /* @__PURE__ */pe("div",{className:"es-copy-marks",children:[G&&u?/* @__PURE__ */pe(fe,{children:[
29
- /* @__PURE__ */he(r,{checked:be,onChange:()=>{const e=Be();Fe.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:ie,Me(null),ye(e=>!e)},ariaLabelledBy:Ee,disabled:B}),
30
- /* @__PURE__ */he("span",{id:Ee,className:"es-copy-marks-label",children:re.showMarks??"Show marks"})]}):null,te&&kt?M(Ge?void 0:re.clearStyleEmpty??"Select words first",/* @__PURE__ */pe("button",{type:"button",className:"es-copy-clear",disabled:B||!Ge,onMouseDown:e=>e.preventDefault(),onClick:()=>{const{start:e,end:n}=qe();if(e===n)return;const r=y(t,e,n,He);r.text!==t&&Oe(()=>r)},children:[
31
- /* @__PURE__ */he(ne,{size:16}),re.clearStyle??"Clear style"]})):null]}):null]})}export{me as COPY_ALIGNS,ye as COPY_ALIGN_FIT,be as COPY_ALIGN_GLYPHS,ge as COPY_ALIGN_LABELS,Qe as COPY_CELLS,et as ColorWindow,mt as CopyBox,Xe as CopyCells,Ie as MARKUP_CLIPBOARD_TYPE,pt as MarkBar,Ze as RichBox,Ge as TYPING_BURST_MS,lt as TextToolbar,dt as ariaShortcut,ve as copyAlignOptions,Ye as createHistory,Ke as editVisible,Se as insertSelection,Ce as markSelection,We as markupOfRange,$e as newLine,Ne as pasteToMarkup,Te as richLayout,Pe as selectionToSource,Oe as selectionToVisible,He as setBullet,je as toSource,ze as toSourceStart,Re as toVisible,ft as useCaretEdit};
1
+ import{DEFAULT_COPY_WORDS as e}from"../chunk-JZDEIRH4.js";import{FieldNumber as t}from"../chunk-66LWADFP.js";import{SettingsSegmented as n,SettingsSwitch as r}from"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import{GoldTextInput as l}from"../chunk-2FZJWH24.js";import{RETIRED_MARKS as o,applyMark as a,STANDARD_MARKUP as s,writeMarkedLines as i,sameMarks as c,markedLines as u,spanFor as d,markupTools as h,marksIn as p,findLink as f,markedAt as m,listIn as g,colorIn as b,clearStyle as v,isSafeLinkHref as y,toggleMark as k,colorOver as w,setList as x,unlinkAt as C,removeLink as D,linkOver as S,writeLink as E}from"../chunk-546BBOPE.js";import{useWords as N}from"../chunk-MFIRYGHW.js";import{withTip as M}from"../chunk-P2VEMZH5.js";import{Tooltip as L,ColorSwatch as T,ColorPickerPanel as B,Button as R,IconButton as j,registerModalEscapeInterceptor as P,LinkPicker as z}from"efficient-shell/ui";import{useRef as O,useState as F,useLayoutEffect as K,useEffect as W,useId as $}from"react";import{AlignJustifyIcon as H,AlignRightIcon as A,AlignCenterIcon as I,AlignLeftIcon as U,ParagraphSpacingIcon as q,LetterSpacingIcon as V,TextLinesIcon as Y,TextSizeIcon as Z,CaseNormalIcon as G,CaseUpperIcon as J,CaseLowerIcon as X,TextColorIcon as Q,ListIcon as _,NumberedListIcon as ee,ClearMarksIcon as te,BoldIcon as ne,ItalicIcon as re,UnderlineIcon as le,StrikeIcon as oe,LinkIcon as ae,SuperscriptIcon as se,SubscriptIcon as ie,QuietIcon as ce,EmphasisIcon as ue}from"efficient-shell/icons/efficient";import{jsx as de,jsxs as he,Fragment as pe}from"react/jsx-runtime";var fe=["left","center","right","justify"],me=e.align,ge={left:/* @__PURE__ */de(U,{}),center:/* @__PURE__ */de(I,{}),right:/* @__PURE__ */de(A,{}),justify:/* @__PURE__ */de(H,{})},be={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function ve(e,t=me){return fe.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:ge[e],title:t[e]}))}var ye=/[\u1100-\u11ff\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/;function ke(e){if(e.every(e=>e.label===me[e.id]))return e.length>3?be.four:be.three;const t=e.map(e=>[...e.label].reduce((e,t)=>e+(ye.test(t)?13:8),0));return{labelsPx:t.reduce((e,t)=>e+t,0),widestLabelPx:Math.max(0,...t)}}function we(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function xe(e,t,n,r=a){const{start:l,end:o}=we(e,n);return r(e,l,o,t)}function Ce(e,t,n){const{start:r,end:l}=we(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}var De=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),Se=/* @__PURE__ */new Set(["p","div","li","ul","ol","dl","dt","dd","h1","h2","h3","h4","h5","h6","blockquote","pre","table","thead","tbody","tfoot","tr","section","article","header","footer","aside","nav","figure","figcaption","address","hr"]);function Ee(e,t){const n=t.rules??s,r=e.html&&""!==e.html.trim()?function(e,t,n){const r=t.createElement("template");r.innerHTML=e;const l=[[]],o=()=>l[l.length-1],a=()=>{const e=o();for(;e.length>0&&" "===e[e.length-1].ch;)e.pop();e.length>0&&l.push([])},s=(e,t,n,r)=>{if(3===e.nodeType){for(const a of e.textContent??""){const e=/\s/.test(a)?" ":a,s=o();" "===e&&(0===s.length&&l.length>1||" "===s[s.length-1]?.ch)||s.push({ch:e,bold:t,italic:n,href:r})}return}if(1!==e.nodeType&&11!==e.nodeType)return;const i=e,c=1===e.nodeType?i.localName:"";if(De.has(c))return;if("br"===c)return void l.push([]);let u=t,d=n,h=r;if("b"!==c&&"strong"!==c||(u=!0),"i"!==c&&"em"!==c||(d=!0),"a"===c){const e=(i.getAttribute("href")??"").trim();h=y(e)?e:null}const p=1===e.nodeType?i.style:null;if(p){const e=p.fontWeight;"bold"===e||"bolder"===e||Number(e)>=600?u=!0:("normal"===e||"lighter"===e||""!==e&&Number(e)<600)&&(u=!1),"italic"===p.fontStyle||"oblique"===p.fontStyle?d=!0:"normal"===p.fontStyle&&(d=!1)}const f=Se.has(c);f&&a();for(const t of[...e.childNodes])s(t,u,d,h);f&&a()};s(r.content,!1,!1,null);for(;l.length>1&&0===l[l.length-1].length;)l.pop();return l.map(e=>function(e,t){const n=t=>e.map((n,r)=>n[t]&&(" "!==n.ch||Boolean(e[r-1]?.[t])&&Boolean(e[r+1]?.[t]))),r=[{bold:!0,italic:!0,links:!0},{bold:!0,italic:!1,links:!0},{bold:!1,italic:!1,links:!0},{bold:!1,italic:!1,links:!1}];for(const l of r){const r=Ne(e,l.bold?n("bold"):null,l.italic?n("italic"):null,l.links),o=i([r]).text;if(c([r],u(o,t)))return o}return e.map(e=>e.ch).join("")}(e,n))}(e.html,t.doc,n):(e.text??"").replace(/\r\n?/g,"\n").split("\n");return t.multiline?r.join("\n"):1===r.length?r[0]:r.map(e=>e.trim()).filter(e=>""!==e).join(" ")}function Ne(e,t,n,r){let l=0,o=null,a=null,s=null;return{bullet:!1,chars:e.map((e,i)=>{const c=r?e.href:null;return o=null===c?null:o&&o.href===c?o:d(++l,"link",c),a=t?.[i]?a??d(++l,"bold"):null,s=n?.[i]?s??d(++l,"italic"):null,{ch:e.ch,at:-1,marks:[o,a,s].filter(e=>null!==e)}})}}var Me=/^([0-9]{1,3})\. $/;function Le(e,t){const n=e.split("\n"),r=u(e,t);let l=0,o=0;const a=r.map((e,t)=>{const r=!e.bullet&&null==e.number&&"- "===n[t],a=null!=e.number||e.bullet?null:Me.exec(n[t]),s=e.bullet||r,i=a?a[1]:e.number??null,c=r||a?[]:e.chars,u=c.map(e=>e.ch).join(""),d=null!=i?i.length+2:s?2:0,h={bullet:s,number:i,chars:c,start:l,src:l+d,vis:o,text:u};return l+=n[t].length+1,o+=u.length+1,h});return{lines:a,text:a.map(e=>e.text).join("\n")}}function Te(e,t){const{lines:n}=e;for(let e=0;e<n.length;e+=1){const r=n[e];if(t<=r.vis+r.text.length||e===n.length-1)return[r,Math.max(0,Math.min(t-r.vis,r.text.length)),e]}return[n[0],0,0]}function Be(e,t){const[n,r]=Te(e,t);if(0===r)return n.src;let l=0;for(const e of n.chars){if(r<=l+e.ch.length)return e.at+(r-l);l+=e.ch.length}return n.src}function Re(e,t){const[n,r]=Te(e,t);let l=0;for(const e of n.chars){if(r===l)return e.at;l+=e.ch.length}return Be(e,t)}function je(e,t){const{lines:n}=e;let r=n[0];for(const e of n)t>=e.start&&(r=e);let l=0;for(const e of r.chars){if(!(t>=e.at+e.ch.length)){t>e.at&&(l+=t-e.at);break}l+=e.ch.length}return r.vis+l}function Pe(e,t,n){return[je(e,t),je(e,n)]}function ze(e,t,n){return t===n?[Be(e,t),Be(e,t)]:[Re(e,t),Be(e,n)]}function Oe(e,t){let n=0;for(let r=0;r<e.chars.length;r+=1){if(n>=t)return r;n+=e.chars[r].ch.length}return e.chars.length}function Fe(e,t,n,r,l){const o=Le(e,t),[a,s,h]=Te(o,Math.min(n,r)),[p,f,m]=Te(o,Math.max(n,r)),g=Oe(a,s),b=Oe(p,f),v=a.chars.slice(0,g),y=p.chars.slice(b),k=n!==r&&a.chars[g]&&(h!==m||g<b)?a.chars[g].marks:function(e,t){const n=e.chars[t-1],r=e.chars[t],l=(e,t)=>{const n=e.findIndex(e=>"link"===e.kind);return-1===n||t?e:e.slice(0,n)};if(n){const e=n.marks.find(e=>"link"===e.kind),t=Boolean(e&&r?.marks.some(t=>t.id===e.id));return l(n.marks,t)}return r?l(r.marks,!1):[]}(a,g);let w=(x=o.lines,Math.max(0,...x.flatMap(e=>e.chars.flatMap(e=>e.marks.map(e=>e.id))))+1);var x;const C=e=>{let n;if(void 0!==l.markup){const e=w;n=u(l.markup,t).map(t=>({bullet:t.bullet,number:t.number??null,chars:t.chars.map(t=>({...t,at:-1,marks:t.marks.map(t=>({...t,id:t.id+e}))}))}))}else{let t=a.number??null;n=(l.text??"").split("\n").map((n,r)=>(r>0&&null!=t&&(t=function(e){return String(Number(e)+1).padStart(e.length,"0")}(t)),{bullet:a.bullet,number:t,chars:[...n].map(t=>({ch:t,at:-1,marks:e??[]}))}))}const r=n.map(e=>e.chars.map(e=>e.ch).join("")).join("\n"),s={bullet:a.bullet,number:a.number??null,chars:[...v,...n[0].chars]},i=n.slice(1);if(i.length>0){const e=i[i.length-1];i[i.length-1]={...e,chars:[...e.chars,...y]}}else s.chars.push(...y);return{lines:[...o.lines.slice(0,h).map(({bullet:e,number:t,chars:n})=>({bullet:e,number:t,chars:n})),s,...i,...o.lines.slice(m+1).map(({bullet:e,number:t,chars:n})=>({bullet:e,number:t,chars:n}))],shown:r}},D=void 0!==l.markup?[null]:[(e=>{let t=e.filter(e=>!l.drop?.some(t=>e.kind===t||"highlight"===t&&"accent"===e.kind));for(const e of l.add??[]){if(t.some(t=>t.kind===e))continue;const n=d(w++,e);n&&(t=[...t,n])}if(void 0!==l.color){t=t.filter(e=>"color"!==e.kind);const e=null===l.color?null:d(w++,"color",l.color);e&&(t=[...t,e])}return t})(k),k,[]];let S="",E="";for(const e of D){const n=C(e),r=i(n.lines).text;if(S=r,E=n.shown,c(n.lines,Le(r,t).lines))break}return{text:S,caret:Math.min(n,r)+E.length}}function Ke(e,t,n,r){const l=Le(e,t),[o,,a]=Te(l,n);return n!==r||!o.bullet&&null==o.number||""!==o.text?Fe(e,t,n,r,{text:"\n"}):We(e,t,a,!1,n)}function We(e,t,n,r,l){const o=Le(e,t).lines.map(({bullet:e,number:t,chars:l},o)=>o===n?{bullet:r,number:null,chars:l}:{bullet:e,number:t,chars:l});return{text:i(o).text,caret:l}}function $e(e,t,n,r){const l=Le(e,t),[o,a,s]=Te(l,Math.min(n,r)),[c,u,d]=Te(l,Math.max(n,r)),h=l.lines.slice(s,d+1).map(({bullet:e,number:t,chars:n},r)=>{const l=0===r?Oe(o,a):0,i=r===d-s?Oe(c,u):n.length;return{bullet:e,number:t,chars:n.slice(l,i)}});return i(h).text}var He="application/x-efficient-markup";function Ae(e,t,n,r){switch(t){case"bold":return e.createElement("strong");case"italic":return e.createElement("em");case"strike":return e.createElement("s");case"underline":return e.createElement("u");case"sup":return e.createElement("sup");case"sub":return e.createElement("sub");case"color":{const t=e.createElement("span");return t.className="es-rich-color",r&&(t.dataset.color=r,t.title=r.startsWith("#")?r.toUpperCase():r,t.style.color=r.startsWith("#")?r:`var(--es-color-${r}, inherit)`),t}case"link":{const t=e.createElement("a");return t.className="es-rich-link",n&&(t.title=n),t}default:{const n=e.createElement("span");return n.className="highlight"===t||"accent"===t?"es-rich-emphasis":`es-rich-${t}`,n}}}function Ie(e,t,n,r){const l=e.layout.lines;if(n===t)return r>=e.lines.length?e.layout.text.length:l[r].vis;const o=e.lines.findIndex(e=>e===n||e.contains(n));if(-1===o)return 0;const a=t.ownerDocument.createRange();a.setStart(e.lines[o],0);try{a.setEnd(n,r)}catch{return l[o].vis}return l[o].vis+Math.min(a.toString().length,l[o].text.length)}function Ue(e,t){const n=e.layout.lines;let r=n.length-1;for(let e=0;e<n.length;e+=1)if(t<=n[e].vis+n[e].text.length){r=e;break}let l=Math.max(0,t-n[r].vis);const o=e.lines[r].ownerDocument.createTreeWalker(e.lines[r],4);let a=o.nextNode(),s=null;for(;a;){if(l<=a.data.length)return[a,l];l-=a.data.length,s=a,a=o.nextNode()}return s?[s,s.data.length]:[e.lines[r],0]}function qe(e,t,n){if(n<0){const n=e.charCodeAt(t-1);return t-(n>=56320&&n<=57343&&t>=2?2:1)}const r=e.charCodeAt(t);return t+(r>=55296&&r<=56319?2:1)}function Ve({value:e,rules:t,multiline:n,readOnly:r=!1,placeholder:l,ariaLabel:o,handle:a,onEdit:s,onSelect:i,onHistory:c,onFormat:u,pending:d,onCommit:h,onCancel:p}){const f=O(null),m=O(null),g=O(null),b=O(null),v=O(null),y=O(e),[k,w]=F(0),x=O({value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u});x.current={value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u};const C=()=>{const e=f.current,t=m.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=Ie(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?Ie(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},D=(e,t)=>{const n=f.current,r=m.current;if(!n||!r)return;const[l,o]=Ue(r,e),[a,s]=Ue(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};a.current={getSource(){const e=C(),t=m.current;if(!e||!t)return null;const[n,r]=ze(t.layout,e[0],e[1]);return{start:n,end:r}},setSource(e,t,n){b.current={text:n,src:[e,t]},w(e=>e+1)},focus(){f.current?.focus()},rangeOf(e,t){const n=f.current,r=m.current;if(!n||!r)return null;const[l,o]=Pe(r.layout,e,t),[a,s]=Ue(r,l),[i,c]=Ue(r,o),u=n.ownerDocument.createRange();return u.setStart(a,s),u.setEnd(i,c),u}},K(()=>{const n=f.current;if(!n||v.current)return;const r=b.current?null:C();m.current=function(e,t){const n=e.ownerDocument;e.replaceChildren();const r=t.lines.map(t=>{const r=n.createElement("div");r.className=null!=t.number?"es-rich-line is-numbered":t.bullet?"es-rich-line is-bullet":"es-rich-line",null!=t.number&&(r.dataset.number=t.number);const l=[],o=()=>l.length?l[l.length-1].el:r;let a=null;for(const e of t.chars){let t=0;for(;t<l.length&&t<e.marks.length&&l[t].id===e.marks[t].id;)t+=1;(l.length>t||e.marks.length>t)&&(a=null),l.length=t;for(let r=t;r<e.marks.length;r+=1){const t=Ae(n,e.marks[r].kind,e.marks[r].href,e.marks[r].color);o().appendChild(t),l.push({id:e.marks[r].id,el:t})}a||(a=n.createTextNode(""),o().appendChild(a)),a.data+=e.ch}return 0===t.chars.length&&r.appendChild(n.createElement("br")),e.appendChild(r),r});return{layout:t,lines:r}}(n,Le(e,t)),g.current=e;const l=b.current;if(!l||l.text!==e)return void(r&&n.ownerDocument.activeElement===n&&D(r[0],Math.min(r[1],m.current.layout.text.length)));b.current=null;const o=m.current.layout,[a,s]=l.vis??Pe(o,l.src[0],l.src[1]);n.ownerDocument.activeElement!==n&&n.focus(),D(a,s)},[e,t,k]);const S=(e,t,n)=>{const r=m.current,[l,o]=ze(r.layout,t[0],t[1]);b.current={text:e.text,vis:[e.caret,e.caret]},e.text!==x.current.value?x.current.onEdit(e.text,{start:l,end:o},n):w(e=>e+1)};W(()=>{const e=f.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:a}=x.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const s=m.current,i=C();if(!s||!i)return;let[c,u]=i;const d="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0;d&&!d.collapsed&&t.inputType.startsWith("delete")&&(c=Ie(s,e,d.startContainer,d.startOffset),u=Ie(s,e,d.endContainer,d.endOffset));const h=s.layout.text,p=t.inputType;if("historyUndo"!==p&&"historyRedo"!==p)if("formatBold"!==p&&"formatItalic"!==p&&"formatStrikeThrough"!==p)if("insertParagraph"!==p&&"insertLineBreak"!==p){if(p.startsWith("insert")){let o=t.data??t.dataTransfer?.getData("text/plain")??"";if("insertFromDrop"===p||"insertFromPaste"===p){const a=Ee({html:t.dataTransfer?.getData("text/html"),text:o},{doc:e.ownerDocument,multiline:l,rules:r});return void S(Fe(n,r,c,u,{markup:a}),[c,u],"edit")}return l||(o=o.replace(/\s*\r?\n\s*/g," ")),void S(Fe(n,r,c,u,{text:o,add:a?.add,drop:a?.drop,color:a?.color}),[c,u],"type")}if(p.startsWith("delete")){if(c===u){const e=p.includes("Backward"),t=s.layout.lines.findIndex(e=>c>=e.vis&&c<=e.vis+e.text.length),l=s.layout.lines[t];if(e&&l&&c===l.vis&&(l.bullet||null!=l.number))return void S(We(n,r,t,!1,c),[c,u],"edit");if(e?0===c:c===h.length)return;e?c=qe(h,c,-1):u=qe(h,u,1)}S(Fe(n,r,c,u,{text:""}),[c,u],"type")}}else l&&S(Ke(n,r,c,u),[c,u],"edit");else x.current.onFormat("formatBold"===p?"bold":"formatItalic"===p?"italic":"strike");else x.current.onHistory("historyUndo"===p?"undo":"redo")},n=()=>{v.current||w(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),W(()=>{const e=f.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=a.current?.getSource();e&&i(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const E=(n,l=!1)=>{const o=C();if(!o||o[0]===o[1])return;n.preventDefault();const a=m.current;n.clipboardData.setData("text/plain",a.layout.text.slice(o[0],o[1])),n.clipboardData.setData(He,$e(e,t,o[0],o[1])),l&&!r&&S(Fe(e,t,o[0],o[1],{text:""}),o,"edit")};/* @__PURE__ */
2
+ return he("div",{className:"es-rich-wrap",children:[l&&""===e?/* @__PURE__ */de("div",{className:"es-rich-placeholder","aria-hidden":"true",children:l}):null,
3
+ /* @__PURE__ */de("div",{ref:f,className:`es-rich${n?" is-multiline":" is-single"}${r?" is-off":""}`,contentEditable:!r,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":n,"aria-label":o,"aria-readonly":r||void 0,"aria-placeholder":l,tabIndex:r?-1:0,spellCheck:!0,onFocus:()=>{y.current=e},onBlur:()=>{e!==y.current&&h?.(e),y.current=e},onKeyDown:t=>{if("Escape"===t.key)return t.preventDefault(),p?.(y.current),void(y.current=e);"Enter"!==t.key||n||(t.preventDefault(),e!==y.current&&h?.(e),y.current=e)},onCompositionStart:()=>{const e=C()??[0,0];v.current={from:e[0],to:e[1]}},onCompositionEnd:e=>{const t=v.current;if(v.current=null,!t)return;const{value:n,rules:r,pending:l}=x.current;e.data?S(Fe(n,r,t.from,t.to,{text:e.data,add:l?.add,drop:l?.drop,color:l?.color}),[t.from,t.to],"type"):w(e=>e+1)},onCopy:e=>E(e),onCut:e=>E(e,!0),onPaste:l=>{if(l.preventDefault(),r)return;const o=C();if(!o)return;const a=l.clipboardData.getData(He),s=a?n?a:a.replace(/\s*\r?\n\s*/g," "):Ee({html:l.clipboardData.getData("text/html"),text:l.clipboardData.getData("text/plain")},{doc:l.currentTarget.ownerDocument,multiline:n,rules:t});S(Fe(e,t,o[0],o[1],{markup:s}),o,"edit")}})]})}var Ye=1e3;function Ze(e=200){let t=[],n=[],r=null,l=0;return{record(o,a,s){const i="type"===a&&"type"===r&&s-l<1e3;r=a,l=s,n=[],i||(t.push(o),t.length>e&&t.shift())},undo(e){const l=t.pop();return l?(n.push(e),r=null,l):null},redo(e){const l=n.pop();return l?(t.push(e),r=null,l):null},reset(){t=[],n=[],r=null}}}var Ge={fontSize:{key:"fontSize",nameKey:"fontSize",icon:/* @__PURE__ */de(Z,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */de(Y,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */de(V,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */de(q,{}),unit:"px",step:1,shiftStep:10,min:0}};function Je(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function Xe({cells:n,words:r,readOnly:l=!1}){const o=r??e.cells;/* @__PURE__ */
4
+ return de("div",{className:"es-copy-cells",children:n.map(e=>{const n=e.scale??1,r=e.name??(e.nameKey?o[e.nameKey]:e.key),a=e.unit??"",s=e.step??1;/* @__PURE__ */
5
+ return de(t,{value:Je(e.value,n),styleValue:Je(e.styleValue,n),onChange:t=>e.onChange(void 0===t?void 0:Number((t/n).toFixed(6))),min:e.min,max:e.max,step:s,shiftStep:e.shiftStep,icon:e.icon,unit:a||void 0,steppers:"compact",readOnly:l,ariaLabel:r,title:o.tip({name:r,step:s,unit:a})},e.key)})})}var Qe=e=>e.preventDefault();function _e({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__ */
6
+ return he("div",{className:"es-copy-pop es-copy-colors",role:"dialog","aria-label":n.title,onMouseDown:e=>{"INPUT"!==e.target.tagName&&e.preventDefault()},children:[
7
+ /* @__PURE__ */de("span",{className:"es-copy-pop-label",children:n.theme}),
8
+ /* @__PURE__ */de("div",{className:"es-copy-theme",role:"group","aria-label":n.theme,children:e.map(e=>/* @__PURE__ */de(L,{content:`${e.label} · ${e.value.toUpperCase()}`,children:/* @__PURE__ */de(T,{color:e.value,size:"sm",className:"es-copy-theme-swatch","data-color":e.name,"aria-label":e.label,selected:t===e.name,onMouseDown:Qe,onClick:()=>r(e.name)})},e.name))}),
9
+ /* @__PURE__ */de("span",{className:"es-copy-pop-label",children:n.any}),
10
+ /* @__PURE__ */de(B,{className:"es-copy-any",value:l??"",onChange:e=>{e!==t&&r(e)},label:n.title,dragWrites:"end"}),
11
+ /* @__PURE__ */de("div",{className:"es-copy-pop-foot",children:/* @__PURE__ */de(R,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onMouseDown:Qe,onClick:()=>r(null),children:n.remove})})]})}var et=e=>e.preventDefault();function tt(e,t,n){const r={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1,Home:"first",End:"last"}[e.key];if(void 0===r||0===t.length)return;const l=[...e.currentTarget.querySelectorAll('[role="radio"]')],o=l.findIndex(t=>t===e.target||t.contains(e.target));if(o<0)return;e.preventDefault();const a=l.length,s="first"===r?0:"last"===r?a-1:(o+r+a)%a;l[s].disabled||(n(t[s]),l[s].focus())}var nt=["bold","italic","underline","strike","link","sup","sub"],rt=["left","center","right","justify"],lt=e=>null!=e&&!1!==e;function ot({offered:e,color:t,last:n,alignment:r,list:l,letterCase:o}){const a=nt.filter(t=>e.has(t)).length+(t?1:0)+(lt(n)?1:0),s=(r?rt.filter(e=>r.allow.includes(e)).length:0)+(l&&e.has("bullet")?1:0)+(l&&e.has("number")?1:0)+(o?3:0);return{words:a>0,paragraph:s>0,oneRow:a>0&&s>0&&a+1+s<=9,flow:a>0&&s>0&&a+1+s>9&&a<=7}}function at({words:e,align:t,alignmentLabel:n,offered:r,pressed:l,onMark:o,color:a,linkOpen:s,last:i,alignment:c,list:u,letterCase:d,disabled:h=!1,ariaLabel:p="Formatting"}){const f=e=>"es-tb-cell es-tb-btn"+(e?" is-on":""),m=(e,t,n,a)=>r.has(e)?M(t,/* @__PURE__ */de(j,"link"===e?{pressed:Boolean(s),className:f(Boolean(s)),"aria-label":t,"aria-haspopup":"dialog","aria-expanded":s,"aria-keyshortcuts":a,disabled:h,onMouseDown:et,onClick:()=>o(e),children:n}:{className:"es-tb-cell es-tb-btn"+(l[e]?" is-on":""),"aria-label":t,"aria-pressed":Boolean(l[e]),"aria-keyshortcuts":a,disabled:h,onMouseDown:et,onClick:()=>o(e),children:n},e)):null,g=ot({offered:r,color:a,last:i,alignment:c,list:u,letterCase:d});if(!g.words&&!g.paragraph)return null;const b=[["left",/* @__PURE__ */de(U,{},"l")],["center",/* @__PURE__ */de(I,{},"c")],["right",/* @__PURE__ */de(A,{},"r")],["justify",/* @__PURE__ */de(H,{},"j")]],v=c?rt.filter(e=>c.allow.includes(e)):[],y=c&&v.includes(c.value)?c.value:v[0],k=[["none",e.caseNone,/* @__PURE__ */de(G,{},"n")],["upper",e.caseUpper,/* @__PURE__ */de(J,{},"u")],["lower",e.caseLower,/* @__PURE__ */de(X,{},"w")]],w=/* @__PURE__ */he(pe,{children:[m("bold",e.bold,/* @__PURE__ */de(ne,{}),"Meta+B"),m("italic",e.italic,/* @__PURE__ */de(re,{}),"Meta+I"),m("underline",e.underline,/* @__PURE__ */de(le,{}),"Meta+U"),m("strike",e.strike,/* @__PURE__ */de(oe,{})),a?M(e.color,/* @__PURE__ */de(j,{pressed:a.open,className:`${f(a.open)} es-tb-color`,"aria-label":e.color,"aria-haspopup":"dialog","aria-expanded":a.open,disabled:h,style:a.run?{"--es-tb-run":a.run}:void 0,onMouseDown:et,onClick:a.onToggle,children:/* @__PURE__ */de(Q,{})},"color")):null,m("link",e.link,/* @__PURE__ */de(ae,{}),"Meta+K"),m("sup",e.sup,/* @__PURE__ */de(se,{})),m("sub",e.sub,/* @__PURE__ */de(ie,{})),lt(i)?i:null]}),x=/* @__PURE__ */he(pe,{children:[c&&b.some(([e])=>c.allow.includes(e))?/* @__PURE__ */de("div",{className:"es-tb-group",role:"radiogroup","aria-label":n,onKeyDown:e=>tt(e,v,e=>c.onChange(e)),children:b.map(([e,n])=>c&&c.allow.includes(e)?M(t[e],/* @__PURE__ */de(j,{role:"radio",pressed:c.value===e,className:f(c.value===e),"aria-checked":c.value===e,"aria-label":t[e],tabIndex:e===y?0:-1,disabled:h||c.disabled,onMouseDown:et,onClick:()=>c.onChange(e),children:n},e)):null)}):null,u&&r.has("bullet")?M(e.bullet,/* @__PURE__ */de(j,{className:"es-tb-cell es-tb-btn"+("bullet"===u.pressed?" is-on":""),"aria-label":e.bullet,"aria-pressed":"bullet"===u.pressed,disabled:h,onMouseDown:et,onClick:()=>u.onList("bullet"),children:/* @__PURE__ */de(_,{})})):null,u&&r.has("number")?M(e.number,/* @__PURE__ */de(j,{className:"es-tb-cell es-tb-btn"+("number"===u.pressed?" is-on":""),"aria-label":e.number,"aria-pressed":"number"===u.pressed,disabled:h,onMouseDown:et,onClick:()=>u.onList("number"),children:/* @__PURE__ */de(ee,{})})):null,d?/* @__PURE__ */de("div",{className:"es-tb-group",role:"radiogroup","aria-label":e.letterCase,onKeyDown:e=>tt(e,k.map(([e])=>e),e=>d.onChange(e)),children:k.map(([e,t,n])=>M(t,/* @__PURE__ */de(j,{role:"radio",pressed:d.value===e,className:f(d.value===e),"aria-checked":d.value===e,"aria-label":t,tabIndex:e===(d.value||"none")?0:-1,disabled:h||d.disabled,onMouseDown:et,onClick:()=>d.onChange(d.value===e?"":e),children:n},e)))}):null]});return g.flow?/* @__PURE__ */de("div",{className:"es-tb",role:"toolbar","aria-label":p,children:/* @__PURE__ */he("div",{className:"es-tb-row is-flow",children:[w,
12
+ /* @__PURE__ */de("span",{className:"es-tb-flowgap","aria-hidden":"true"}),x]})}):g.oneRow?/* @__PURE__ */de("div",{className:"es-tb",role:"toolbar","aria-label":p,children:/* @__PURE__ */he("div",{className:"es-tb-row is-one-row",children:[
13
+ /* @__PURE__ */de("div",{className:"es-tb-words",children:w}),
14
+ /* @__PURE__ */de("div",{className:"es-tb-para",children:x})]})}):/* @__PURE__ */he("div",{className:"es-tb",role:"toolbar","aria-label":p,children:[g.words?/* @__PURE__ */de("div",{className:"es-tb-row"+(void 0===i?" is-eight":""),children:w}):null,g.paragraph?/* @__PURE__ */de("div",{className:"es-tb-row",children:x}):null]})}var st=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n));var it=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom});function ct(e){const t=e.ownerDocument,n=t.documentElement,r={left:0,top:0,right:n.clientWidth,bottom:n.clientHeight},l=t.defaultView?.getComputedStyle.bind(t.defaultView);for(let o=e.parentElement;o&&o!==n&&o!==t.body;o=o.parentElement){const e=l?.(o);if(!e||"visible"===e.overflowX&&"visible"===e.overflowY)continue;const t=o.getBoundingClientRect();if(0===t.width&&0===t.height)continue;const n=t.left+o.clientLeft,a=t.top+o.clientTop;r.left=Math.max(r.left,n),r.top=Math.max(r.top,a),r.right=Math.min(r.right,n+(o.clientWidth||t.width)),r.bottom=Math.min(r.bottom,a+(o.clientHeight||t.height))}return r}function ut(e){const t=e.offsetParent??e.parentElement;if(!t)return{left:0,top:0};const n=t.getBoundingClientRect();return{left:n.left+t.clientLeft-t.scrollLeft,top:n.top+t.clientTop-t.scrollTop}}var dt=/* @__PURE__ */new Set([...o,"clear"]),ht={bold:/* @__PURE__ */de(ne,{size:16}),italic:/* @__PURE__ */de(re,{size:16}),strike:/* @__PURE__ */de(oe,{size:16}),highlight:/* @__PURE__ */de(ue,{size:16}),quiet:/* @__PURE__ */de(ce,{size:16}),link:/* @__PURE__ */de(ae,{size:16}),clear:/* @__PURE__ */de(te,{size:16})};function pt(e){if(!e)return;const t=e.split("+"),n=t.pop().toUpperCase();return["Meta",...t.map(e=>e[0].toUpperCase()+e.slice(1)),n].join("+")}var ft={bold:"is-bold",italic:"is-italic",strike:"is-strike"};function mt({tools:t,onApply:n,disabled:r=!1,actions:l,align:o,glyphs:a,ariaLabel:s,pressed:i,open:c=null}){const u=N("copy",e),d=("string"==typeof t[0]?h(t).map(e=>({...e,...u.marks[e.style]})):t).filter(e=>!dt.has(e.style));return 0!==d.length||l||o?/* @__PURE__ */he("div",{className:"es-copy-bar",role:"group","aria-label":s??u.formatting,children:[d.map(e=>{const t=a?.[e.style]??ht[e.style],l=c===e.style||Boolean(i?.[e.style]),o="link"===e.style&&Boolean(i);return M(e.title,/* @__PURE__ */de(j,{onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.style),disabled:r,"aria-label":e.name??e.title,"aria-keyshortcuts":pt(e.shortcut),"aria-pressed":o||!i&&!c?void 0:l,pressed:o?l:void 0,"aria-haspopup":o?"dialog":void 0,"aria-expanded":o?"link"===c:void 0,className:`es-copy-mark${t?" has-glyph":ft[e.style]?` ${ft[e.style]}`:""}${l?" is-active":""}`,children:t??e.label},e.style))}),l?/* @__PURE__ */he(pe,{children:[
15
+ /* @__PURE__ */de("span",{className:"es-copy-bar-split","aria-hidden":"true"}),l]}):null,o?/* @__PURE__ */de("span",{className:"es-copy-bar-end",children:o}):null]}):null}function gt({target:e,onChange:t}){const n=O(null);return K(()=>{const t=n.current,r=e.current;t&&r&&r.value===t.text&&(n.current=null,r.focus(),r.setSelectionRange(t.start,t.end))}),r=>{const l=r(e.current);t(l.text),n.current={start:l.selectionStart,end:l.selectionEnd,text:l.text}}}var bt=["bold","italic","underline","strike","sup","sub"];function vt({value:t,onChange:o,onCommit:i,onCancel:c,multiline:u=!1,placeholder:y,ariaLabel:L,className:T,readOnly:B=!1,rules:j,tools:H=[],writeMark:A,actions:I,align:U,glyphs:q,barLabel:V,renderFooter:Y,inputRef:Z,barShows:G="always",richText:J=!0,defaultShowMarks:X=!1,toolbar:Q="final",colors:_,cells:ee,letterCase:ne,lastTool:re}){const le="final"===Q,oe=N("copy",e),ae=O(null),se=Z??ae,[ie,ce]=F(!1),[ue,fe]=F(null),me=O(Ze()).current,ge=O(null);W(()=>{const e=ge.current;e&&t===e.to?ge.current=null:e&&t===e.from||(ge.current=null,me.reset())},[t,me]);const be=e=>{ge.current={from:ge.current?.from??t,to:e},o(e)},ye=e=>({text:t,start:e?.selectionStart??ue?.start??t.length,end:e?.selectionEnd??ue?.end??t.length}),[we,De]=F(X),Se=J&&!(u&&we),Ne=O(null),Me=$(),[Le,Te]=F(null),[Be,Re]=F(!1),je=()=>{if(!Se)return se.current;const e=Ne.current?.getSource()??ue;return e?{selectionStart:e.start,selectionEnd:e.end}:null},Pe=gt({target:se,onChange:be}),ze=e=>(fe({start:e.selectionStart,end:e.selectionEnd}),e),Oe=(e,n)=>{if(!Se)return void Pe(t=>(n&&me.record(ye(t),"edit",Date.now()),ze(e(t))));const r=je(),l=ze(e(r));n&&me.record(ye(r),"edit",Date.now()),Te(null),l.text!==t&&be(l.text),Ne.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},Fe=e=>Oe(e,!0),Ke=e=>Oe(t=>{const n=ye(t),r=me[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),We=O(null);K(()=>{const e=We.current;e&&(We.current=null,Se?Ne.current?.setSource(e.start,e.end,t):(se.current?.focus(),se.current?.setSelectionRange(e.start,e.end),fe(e)))},[Se]);const[$e,He]=F(null),Ae=j??s,Ie=("string"==typeof H[0]?h(H):H).filter(e=>!dt.has(e.style)),Ue=le?("string"==typeof H[0]?H:H.map(e=>e.style)).filter(e=>!dt.has(e)):Ie.map(e=>e.style),qe={};if(ue&&(Se||le)){const e=p(t,ue.start,ue.end,Ae);for(const t of Ue){const n=e.has(t)||"highlight"===t&&e.has("accent");qe[t]=!!Le?.add.includes(t)||!Le?.drop.includes(t)&&n}le&&(qe.link=e.has("link"))}else if(ue)for(const e of Ue)qe[e]="link"===e?null!==f(t,ue.start,ue.end):m(t,ue.start,ue.end,e);const Ye=()=>{const e=je(),n=e?.selectionStart??t.length;return{start:n,end:e?.selectionEnd??n}},Ge={sup:"sub",sub:"sup"},Je=e=>{if(le&&"link"!==e&&d(0,e)){const{start:n,end:r}=Ye(),l=Ge[e];if(n===r){if(!Se)return void Fe(n=>xe(t,e,n,(e,t,n,r)=>a(e,t,n,r,Ae,oe.placeholders)));const o=p(t,n,r,Ae),s=Le&&Le.at===n?Le:null,i=o.has(e),c=!!s?.add.includes(e)||!s?.drop.includes(e)&&i;let u=(s?.add??[]).filter(t=>t!==e),d=(s?.drop??[]).filter(t=>t!==e);return c&&i?d.push(e):c||i||u.push(e),!c&&l&&(u=u.filter(e=>e!==l),o.has(l)&&(d=[...d.filter(e=>e!==l),l])),void Te(u.length||d.length||void 0!==s?.color?{add:u,drop:d,color:s?.color,at:n}:null)}return void Fe(()=>{let o=t,a=n,s=r;if(l&&!p(o,a,s,Ae).has(e)&&p(o,a,s,Ae).has(l)){const e=k(o,a,s,l,Ae);({text:o,selectionStart:a,selectionEnd:s}=e)}return k(o,a,s,e,Ae)})}if("clear"===e)return void Fe(n=>xe(t,e,n,(e,t,n)=>a(e,t,n,"clear",Ae)));if("link"!==e&&Se&&d(0,e)){const n=je(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;if(r===l){const n=p(t,r,l,Ae),o=n.has(e)||"highlight"===e&&n.has("accent"),a=Le&&Le.at===r?Le:null,s=!!a?.add.includes(e)||!a?.drop.includes(e)&&o,i=(a?.add??[]).filter(t=>t!==e),c=(a?.drop??[]).filter(t=>t!==e);return s&&o?c.push(e):s||o||i.push(e),void Te(i.length||c.length?{add:i,drop:c,at:r}:null)}return void Fe(n=>k(t,n?.selectionStart??r,n?.selectionEnd??l,e,Ae))}if("link"!==e){const n=A??((e,t,n,r)=>a(e,t,n,r,s,oe.placeholders));return void Fe(r=>xe(t,e,r,n))}const n=je(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;Re(!1),He({start:r,end:l,link:f(t,r,l)})},Qe=Boolean(ue&&ue.start!==ue.end),et=ue?g(t,ue.start,ue.end,Ae):null,tt=ue?Le&&void 0!==Le.color&&Le.at===ue.start?Le.color:b(t,ue.start,ue.end,Ae):null,nt=tt?tt.startsWith("#")?tt:_?.find(e=>e.name===tt)?.value:void 0,rt=e=>{Se?e?Ne.current?.setSource(e.start,e.end,t):Ne.current?.focus():(se.current?.focus(),e&&se.current?.setSelectionRange(e.start,e.end))},lt=()=>{const e=$e;He(null),rt(e?{start:e.start,end:e.end}:ue)},ht=()=>{const e=ft.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));Re(!1),t&&rt(ue)},pt=O(ht);pt.current=ht,W(()=>{if(Be)return P(e=>{const t=ft.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(pt.current(),!0)},()=>ft.current?.querySelector(".es-copy-colors"))},[Be]);const ft=O(null),vt=Be||null!==$e;W(()=>{const e=ft.current;if(!vt||!e)return;const t=e.ownerDocument,n=()=>{Re(!1),He(null)},r=t=>{e.contains(t.target)||n()};let l;const o=r=>{const o=r.relatedTarget;o?e.contains(o)||n():(clearTimeout(l),l=setTimeout(()=>{const r=t.activeElement;t.hasFocus()&&r&&r!==t.body&&!e.contains(r)&&n()},0))};return t.addEventListener("pointerdown",r,!0),e.addEventListener("focusout",o),()=>{clearTimeout(l),t.removeEventListener("pointerdown",r,!0),e.removeEventListener("focusout",o)}},[vt]);const yt=$e??(Be?ue??{start:t.length,end:t.length}:null),kt=O(()=>{});kt.current=()=>{const e=ft.current,t=e?.querySelector(".es-tb-wrap > .es-copy-pop");if(!e||!t||!yt)return;const n=Se?null:e.querySelector(".es-gold-layer"),r=Se?Ne.current?.rangeOf(yt.start,yt.end)??null:n?function(e,t,n){const r=e.ownerDocument,l=r.createTreeWalker(e,4),o=e=>{let t=e,n=null;for(let e=l.nextNode();e;e=l.nextNode()){if(t<=e.data.length)return[e,t];t-=e.data.length,n=e}return n?[n,n.data.length]:null},a=o(t);l.currentNode=e;const s=o(n);if(!a||!s)return null;const i=r.createRange();return i.setStart(a[0],a[1]),i.setEnd(s[0],s[1]),i}(n,yt.start,yt.end):null,l=r?.endContainer,o=l?1===l.nodeType?l:l.parentElement:null,a=r?function(e,t){const n=("function"==typeof e.getClientRects?[...e.getClientRects()]:[]).filter(e=>e.height>0);if(n.length>0){const t="function"==typeof e.getBoundingClientRect?e.getBoundingClientRect():n[0];return t.height>0?it(t):it(n[0])}if(!t)return null;const r=t.getBoundingClientRect();return{left:r.left,top:r.top,right:r.left,bottom:r.bottom}}(r,o?.closest(".es-rich-line, .es-gold-layer")??null):null;if(!a)return;const s=function({anchor:e,size:t,within:n,clip:r,parent:l,gap:o=8}){const a=Math.max(n.left,r.left),s=Math.min(n.right,r.right)-t.width,i=st(e.left,a,s),c=r.bottom-(e.bottom+o),u=e.top-o-r.top,d=t.height>c&&(t.height<=u||u>c),h=d?e.top-o-t.height:e.bottom+o,p=e.left+Math.min((e.right-e.left)/2,10),f=st(p-5-i,10,t.width-10-10);return{top:h-l.top,left:i-l.left,above:d,point:f}}({anchor:a,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:ct(e),parent:ut(t)});t.style.top=`${s.top}px`,t.style.left=`${s.left}px`,t.style.setProperty("--es-pop-point",`${s.point}px`),t.dataset.side=s.above?"above":"below"},K(()=>{const e=ft.current;if(!vt||!e)return;const t=()=>kt.current();t();const n=e.ownerDocument.defaultView;n?.addEventListener("resize",t);const r=e.querySelector(".es-tb-wrap > .es-copy-pop"),l=n?.ResizeObserver,o=l&&r?new l(t):null;return o&&r&&o.observe(r),()=>{n?.removeEventListener("resize",t),o?.disconnect()}},[vt,Be,$e,yt?.start,yt?.end,Se]);const wt=e=>$e&&/* @__PURE__ */de(z,{className:e?"es-copy-link es-copy-pop":"es-copy-link",value:$e.link?.href??"",onApply:e=>{const n=$e;He(null),Fe(()=>Se?S(t,n.start,n.end,e,Ae):E(t,n.start,n.end,e))},onRemove:$e.link?()=>{const e=$e.link,n=$e;He(null),e&&Fe(()=>Se?C(t,n.start,n.end,Ae):D(t,e))}:void 0,onCancel:lt}),xt=U?ve(U.allow,oe.align):[],Ct="always"===G||ie||null!==$e||Be,Dt=_&&_.length>0?{run:nt,open:Be,onToggle:()=>{He(null),Be?ht():Re(!0)}}:void 0,St=Ct&&le&&re?re({className:"es-tb-cell es-tb-btn",disabled:B,selected:Qe,keepCaret:e=>e.preventDefault(),insert:e=>Fe(n=>Ce(t,e,n))}):void 0,Et=new Set(Ue),Nt=U?{value:U.value,allow:U.allow,onChange:U.onChange,disabled:U.disabled}:void 0,Mt={pressed:et,onList:e=>{const{start:n,end:r}=Ye(),l=g(t,n,r,Ae);Fe(()=>x(t,n,r,l===e?null:e,Ae))}},Lt=ot({offered:Et,color:Dt,last:St,alignment:Nt,list:Mt,letterCase:ne}),Tt=function(e,t){const n=["bold","italic","underline","strike"].filter(t=>e.has(t)).length;return{color:n,link:n+(t?1:0)}}(Et,Boolean(Dt)),Bt=le&&Ct&&(bt.some(e=>Et.has(e))||Boolean(Dt));/* @__PURE__ */
16
+ return he("div",{ref:ft,className:"es-copy"+(T?` ${T}`:""),onFocus:()=>ce(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||ce(!1)},onKeyDown:e=>{const t=e.target===se.current||Boolean(e.target.closest?.(".es-rich"));if(B||!t)return;if(e.altKey||e.metaKey===e.ctrlKey)return;const n=e.key.toLowerCase(),r="KeyZ"===e.code||"z"===n,l=("KeyY"===e.code||"y"===n)&&!e.shiftKey;if(r||l)return e.preventDefault(),e.stopPropagation(),void Ke(l||e.shiftKey?"redo":"undo");const o=`${e.shiftKey?"shift+":""}${n}`;if(le){const t={b:"bold",i:"italic",u:"underline",k:"link"}[o];if(!t||!Ue.includes(t))return;return e.preventDefault(),e.stopPropagation(),void Je(t)}const a=Ie.find(e=>e.shortcut===o);a&&(e.preventDefault(),e.stopPropagation(),Je(a.style))},onPaste:e=>{const n=se.current;if(B||!n||e.target!==n)return;e.preventDefault();const r=Ee({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:u,rules:Ae});Fe(e=>Ce(t,r,e))},style:_&&_.length>0?Object.fromEntries(_.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const e=se.current;e&&e.ownerDocument.activeElement===e&&fe({start:e.selectionStart??t.length,end:e.selectionEnd??t.length})},children:[Ct&&le&&(Lt.words||Lt.paragraph)?/* @__PURE__ */he("div",{className:"es-tb-wrap"+(Lt.oneRow?" is-one-row":Lt.flow?" is-flow":re?"":" is-eight"),style:{"--es-tb-color-col":Tt.color,"--es-tb-link-col":Tt.link},children:[
17
+ /* @__PURE__ */de(at,{words:oe.toolbar??e.toolbar,align:oe.align,alignmentLabel:oe.alignment,ariaLabel:V??oe.formatting,offered:Et,pressed:qe,onMark:e=>Je(e),color:Dt,linkOpen:null!==$e,last:St,alignment:Nt,list:Mt,letterCase:ne,disabled:B}),Be&&_&&_.length>0?/* @__PURE__ */de(_e,{colors:_,current:tt,words:oe.colors??e.colors,onPick:e=>{const{start:n,end:r}=Ye();if(n!==r)Fe(()=>w(t,n,r,e,Ae));else{if(!Se)return;Te({add:Le?.add??[],drop:Le?.drop??[],color:e,at:n})}}}):null,$e?wt(!0):null]}):null,le&&ee&&ee.length>0?/* @__PURE__ */de(Xe,{cells:ee,words:oe.cells??e.cells,readOnly:B}):null,Ct&&!le?/* @__PURE__ */de(mt,{tools:H,disabled:B,actions:I,glyphs:q,ariaLabel:V,pressed:qe,open:$e?"link":null,onApply:Je,align:U?/* @__PURE__ */de(n,{options:xt,value:U.value,onChange:U.onChange,ariaLabel:oe.alignment,disabled:B||U.disabled,fit:ke(xt)}):null}):null,Se?/* @__PURE__ */de(Ve,{value:t,rules:Ae,multiline:u,readOnly:B,placeholder:y,ariaLabel:L,handle:Ne,pending:Le??void 0,onEdit:(e,n,r)=>{me.record({text:t,start:n.start,end:n.end},r,Date.now()),Te(null),be(e)},onSelect:e=>{fe(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Le||e.start===Le.at&&e.end===Le.at||Te(null)},onHistory:Ke,onFormat:e=>{Ue.includes(e)&&Je(e)},onCommit:i,onCancel:c}):/* @__PURE__ */de(l,{value:t,onInput:e=>{me.record(ye(null),"type",Date.now()),be(e)},onCommit:i,onCancel:c,multiline:u,placeholder:y,ariaLabel:L,rules:j,disabled:B,inputRef:se,className:"es-copy-box"}),$e&&!le?wt(!1):null,Y?Y({focused:ie,insert:e=>Fe(n=>Ce(t,e,n))}):null,J&&u||Bt?
18
+ /* @__PURE__ */he("div",{className:"es-copy-marks",children:[J&&u?/* @__PURE__ */he(pe,{children:[
19
+ /* @__PURE__ */de(r,{checked:we,onChange:()=>{const e=je();We.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:ue,Te(null),De(e=>!e)},ariaLabelledBy:Me,disabled:B}),
20
+ /* @__PURE__ */de("span",{id:Me,className:"es-copy-marks-label",children:oe.showMarks??"Show marks"})]}):null,Bt?M(Qe?void 0:oe.clearStyleEmpty??"Select words first",/* @__PURE__ */he(R,{variant:"secondary",size:"sm",className:"es-copy-clear",disabled:B||!Qe,onMouseDown:e=>e.preventDefault(),onClick:()=>{const{start:e,end:n}=Ye();if(e===n)return;const r=v(t,e,n,Ae);r.text!==t&&Fe(()=>r)},children:[
21
+ /* @__PURE__ */de(te,{size:16}),oe.clearStyle??"Clear style"]})):null]}):null]})}export{fe as COPY_ALIGNS,be as COPY_ALIGN_FIT,ge as COPY_ALIGN_GLYPHS,me as COPY_ALIGN_LABELS,Ge as COPY_CELLS,_e as ColorWindow,vt as CopyBox,Xe as CopyCells,He as MARKUP_CLIPBOARD_TYPE,mt as MarkBar,Ve as RichBox,Ye as TYPING_BURST_MS,at as TextToolbar,pt as ariaShortcut,ve as copyAlignOptions,Ze as createHistory,Fe as editVisible,Ce as insertSelection,xe as markSelection,$e as markupOfRange,Ke as newLine,Ee as pasteToMarkup,Le as richLayout,ze as selectionToSource,Pe as selectionToVisible,We as setBullet,Be as toSource,Re as toSourceStart,je as toVisible,gt as useCaretEdit};
@@ -203,31 +203,3 @@ span:has(> .es-fnum) { display: flex; min-width: 0; }
203
203
 
204
204
  /* Read out after a move; never seen. */
205
205
  .es-list-said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
206
-
207
- /* ── the link picker (LinkPicker, [MERGE] One Link Picker For Both Editors) ──
208
- The mockup's stack (owner, 2026-10-06): Link type, the target, and on the
209
- listing Filter and Value — one box under the next, the whole width of the
210
- row, 8px apart (the spacing scale). The same stack at 320px and at 220px:
211
- nothing beside anything, so nothing is cut off mid-word in the narrow
212
- panel. Every box is the shell's Select, SearchableSelect or Input; this adds
213
- only the stack and the two quiet lines under it. */
214
- .es-flink {
215
- display: flex;
216
- flex-direction: column;
217
- gap: 8px;
218
- min-width: 0;
219
- }
220
- /* Inside a SettingsField the slot is a flex ROW, and a column box written for
221
- a block row sizes to its own content there (291px became 117px in the shop
222
- when its link stack sat in the slot). Fill the slot instead. */
223
- .es-field-ctl > .es-flink {
224
- flex: 1 1 auto;
225
- }
226
- .es-flink-error,
227
- .es-flink-hint {
228
- margin: 0;
229
- font-size: 11px;
230
- line-height: 1.45;
231
- }
232
- .es-flink-error { color: var(--es-danger); }
233
- .es-flink-hint { color: var(--es-muted); }
@@ -4,8 +4,8 @@ import { S as SettingsBucket } from '../buckets-CuLM47h9.js';
4
4
  import { I as InspectorFields, a as InspectorFieldDef, F as FieldRenderer, b as FieldTextProps, c as FieldNumberProps, d as FieldSliderProps, e as FieldSelectManyProps, f as FieldSelectOneProps, g as FieldOption } from '../types-CWxUxPGO.js';
5
5
  export { A as ArrayFieldDef, C as CustomFieldDef, h as CustomFieldRenderProps, i as FieldSelectProps, N as NumberFieldDef, O as ObjectFieldDef, R as RadioFieldDef, S as SelectFieldDef, j as SlotFieldDef, T as TextFieldDef, k as TextareaFieldDef } from '../types-CWxUxPGO.js';
6
6
  import { R as ResolvableItem } from '../resolve-D68pb3Bx.js';
7
- export { F as FieldsWords } from '../words-D8kf071T.js';
8
- export { b as LinkFilter, a as LinkFilterField, c as LinkKindChoice, L as LinkOption, d as LinkOptionGroup, e as LinkPicker, f as LinkPickerProps, g as LinkRules, h as LinkTarget } from '../LinkPicker-hPEr1MJx.js';
7
+ export { F as FieldsWords } from '../words-vhnV8sM7.js';
8
+ export { LinkFilter, LinkFilterField, LinkKindChoice, LinkOption, LinkOptionGroup, LinkPicker, LinkPickerProps, LinkRules, LinkTarget } from 'efficient-shell/ui';
9
9
  import '../types-41704JE4.js';
10
10
 
11
11
  interface InspectorProps {
@@ -1 +1 @@
1
- export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-VETFIYQR.js";export{FieldSelect,FieldSlider,optionFor}from"../chunk-FOBGSFFS.js";import"../chunk-UFY6RNMT.js";import"../chunk-YNOZ5NXW.js";import"../chunk-K56YDHYQ.js";import"../chunk-QTLAVDJE.js";export{useResolvedFields}from"../chunk-YRLPFZW3.js";import"../chunk-EA2HTX37.js";export{FieldNumber}from"../chunk-7SQF6LZL.js";import"../chunk-QLD57GBB.js";import"../chunk-FPOKPNO4.js";import"../chunk-MFIRYGHW.js";import"../chunk-67GNT6PF.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
1
+ export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-CRPJGCSO.js";export{FieldSelect,FieldSlider,optionFor}from"../chunk-OZ72A6MY.js";import"../chunk-UFY6RNMT.js";import"../chunk-YNOZ5NXW.js";import"../chunk-K56YDHYQ.js";import"../chunk-QTLAVDJE.js";export{useResolvedFields}from"../chunk-YRLPFZW3.js";import"../chunk-EA2HTX37.js";export{FieldNumber}from"../chunk-66LWADFP.js";import"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import"../chunk-MFIRYGHW.js";import"../chunk-67GNT6PF.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -2,6 +2,7 @@ import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { W as WordFit } from '../wordFit-7XpmhcaW.js';
4
4
  import { P as PanelWords } from '../words-BGrHZAJJ.js';
5
+ export { CornerOption as SettingsCornerPoint, CornersInput as SettingsCorners, CornersInputProps as SettingsCornersProps, AlignmentGrid as SettingsPlacement, AlignmentPoint as SettingsPlacementPoint, AlignmentGridProps as SettingsPlacementProps } from 'efficient-shell/ui';
5
6
  export { a as SETTINGS_BUCKETS, S as SettingsBucket } from '../buckets-CuLM47h9.js';
6
7
 
7
8
  /**
@@ -505,104 +506,6 @@ interface SettingsDrillProps {
505
506
  id?: string;
506
507
  className?: string;
507
508
  }
508
- /** One of the nine positions {@link SettingsPlacementProps} offers. */
509
- interface SettingsPlacementPoint {
510
- /** What the host stores when this cell is pressed. Also the React key, so
511
- * the nine must be distinct. */
512
- value: string;
513
- /** The cell's accessible name — "Top left", "Centre". Read aloud on its own,
514
- * so it names the POSITION and never the value behind it. */
515
- label: string;
516
- /**
517
- * This position cannot be chosen. The caller's arithmetic decides it (a
518
- * position that already holds all it can draw), never this component.
519
- * Disabled rather than absent: nine squares that became eight would read as
520
- * a control that had broken.
521
- */
522
- disabled?: boolean;
523
- /** Why, on hover. Falls back to {@link label}, so a plain cell still has a
524
- * tooltip and a closed one explains itself. */
525
- title?: string;
526
- /**
527
- * Drawn IN PLACE OF the cell's dot, not beside it.
528
- *
529
- * The grid's default mark is a dot, because nine positions are answered by
530
- * "which square", and a dot is the smallest thing that can say "this one".
531
- * One control asks a different question with the same nine squares: the
532
- * Scrolling Bar's `Scroll direction`, where four live cells mean a direction
533
- * of TRAVEL and a dot cannot say which way. Those cells take an arrow.
534
- *
535
- * ⚠️ IT REPLACES THE DOT. A cell drawing both would put an arrow beside a dot
536
- * inside a 26.67px square, and the dot would read as a second control. Leave
537
- * it off and the cell renders exactly what it has always rendered — which is
538
- * what keeps the five existing call sites byte-identical.
539
- *
540
- * Silent: the slot is `aria-hidden`, because the button around it already
541
- * names the position and two voices in one cell is worse than one.
542
- */
543
- icon?: ReactNode;
544
- }
545
- /** One of the four corners {@link SettingsCornersProps} offers. */
546
- interface SettingsCornerPoint {
547
- /** What the host stores when this corner is on. Also the React key and half
548
- * of the cell's class name, so the four must be distinct and CSS-safe. */
549
- value: string;
550
- /** The cell's accessible name — "Top left". Read aloud on its own, so it
551
- * names the CORNER and never the value behind it. */
552
- label: string;
553
- /**
554
- * This corner cannot be chosen. The caller's arithmetic decides it (a box
555
- * whose neighbour already rounds that edge), never this component. Disabled
556
- * rather than absent: four cells that became three would read as a control
557
- * that had broken.
558
- */
559
- disabled?: boolean;
560
- /** Why, on hover. Falls back to {@link label}, so a plain cell still has a
561
- * tooltip and a closed one explains itself. */
562
- title?: string;
563
- }
564
- interface SettingsCornersProps {
565
- /** The group's accessible name. NOT drawn — the visible label belongs to the
566
- * `SettingsField` row around it, the same split `SettingsSwitch` makes. */
567
- label: string;
568
- /**
569
- * The corners that are ON, already resolved by the host: this component has
570
- * no opinion about what an absent or empty value means. An empty array is a
571
- * real answer (every corner square), so a host that reads absence as "all
572
- * four" resolves that before handing this in.
573
- */
574
- value: readonly string[];
575
- /**
576
- * The four cells. No default: a component that invented four corner values
577
- * would be answering a question only the host can answer, and the order it
578
- * stores them in is the host's too.
579
- */
580
- corners: readonly SettingsCornerPoint[];
581
- /** The new set, in the order the cells were pressed. The host normalises. */
582
- onChange: (next: string[]) => void;
583
- /** A DOM id for the group, so a host can point a label at it. */
584
- id?: string;
585
- className?: string;
586
- }
587
- interface SettingsPlacementProps {
588
- /** The radiogroup's accessible name. NOT drawn — the visible label belongs to
589
- * the `SettingsField` row around it, the same split `SettingsSwitch` makes. */
590
- label: string;
591
- /** The chosen position, already resolved by the host: this component has no
592
- * opinion about what an absent value means. */
593
- value: string;
594
- /**
595
- * The nine cells, in reading order — top-left first, bottom-right last. No
596
- * default: a component that invented nine positions would be answering a
597
- * question only the host can answer, and the two callers ask different ones
598
- * (a picture's focal point, a block's anchor).
599
- */
600
- points: readonly SettingsPlacementPoint[];
601
- onChange: (next: string) => void;
602
- /** A DOM id for the radiogroup, so a host can point a label at it. */
603
- id?: string;
604
- className?: string;
605
- }
606
509
  /**
607
510
  * A FULL-WIDTH ACTION BUTTON that sits under a group's rows and COMMITS.
608
511
  *
@@ -618,8 +521,8 @@ interface SettingsPlacementProps {
618
521
  interface SettingsActionBaseProps {
619
522
  /**
620
523
  * What the button says — "Apply to all cards". The package supplies NO
621
- * default, the way `SettingsCorners` invents no corner names: the words belong
622
- * to the section that knows what it is about to rewrite.
524
+ * default, the way the shell's `CornersInput` invents no corner names: the
525
+ * words belong to the section that knows what it is about to rewrite.
623
526
  */
624
527
  label: ReactNode;
625
528
  /** Pressed. The write is the host's; this component performs none of it. */
@@ -964,127 +867,6 @@ declare function SettingsDefaultReset({ label, changed, onReset, detail, disable
964
867
  */
965
868
  declare function SettingsDrill({ name, preview, offPage, status, onOpen, id, className, }: SettingsDrillProps): react.JSX.Element;
966
869
 
967
- /**
968
- * A 3×3 grid of positions, one of them lit — "which of these nine?".
969
- *
970
- * ONE CONTROL, TWO QUESTIONS THAT ARE THE SAME QUESTION. A merchant asks it of
971
- * an image ("which part of this crop stays in view?") and of a block ("where on
972
- * the thing behind it does this sit?"). Both are one of nine positions, both
973
- * want the merchant to PRESS THE CORNER rather than read nine words out of a
974
- * dropdown, and drawing them as two controls would be two things to keep
975
- * looking alike for ever.
976
- *
977
- * ── WHY IT IS HERE NOW, AND WHY IT WAS NOT BEFORE ───────────────────────────
978
- *
979
- * It lived in `efficient-storefront` as `FocalPicker`, and its own comment recorded
980
- * the rule for moving it: card 66189 said *"the day a second section wants it,
981
- * that is the card that promotes it"*. Card 66214 was that second caller and
982
- * deliberately declined — the control was days old and had already changed
983
- * signature once, so freezing its shape in a released package would have been
984
- * early. That was right then.
985
- *
986
- * It is not right now: the shape has not moved since, and the sections that
987
- * hold boxes take it past six call sites. A local copy with that many callers
988
- * is the shape that becomes a second source, so it comes here — the rule its
989
- * own author wrote, applied on the day it fires.
990
- *
991
- * ── WHAT IT DOES NOT DO ─────────────────────────────────────────────────────
992
- *
993
- * It renders the CONTROL only. The row around it — the glyph, the label, the
994
- * caption — is `SettingsField`'s, exactly as `SettingsSwitch` splits. `label`
995
- * is the radiogroup's accessible name, never a visible one.
996
- *
997
- * ── A CELL MAY DRAW A GLYPH INSTEAD OF ITS DOT ──────────────────────────────
998
- *
999
- * Nine positions are answered by "which square", and a dot is the smallest mark
1000
- * that says "this one". ONE control asks a different question with the same
1001
- * nine squares: the Scrolling Bar's `Scroll direction`, where four live cells
1002
- * mean a direction of TRAVEL — and a dot cannot say which way. Those cells pass
1003
- * an `icon` on the point, and it is drawn in place of the dot.
1004
- *
1005
- * THE GLYPH COMES FROM THE ICON LIBRARY, never from in here. `efficient-easel/icons`
1006
- * holds `direction-left`, `direction-right`, `direction-up` and `direction-down`
1007
- * for exactly this control. A shape drawn inside this component would be the
1008
- * second source of truth the whole package exists to prevent — the same rule
1009
- * that stops a panel drawing its own glyph one level up.
1010
- *
1011
- * It also holds no opinion about what a position MEANS. The host hands nine
1012
- * values and gets one back; whether that value becomes a CSS `object-position`
1013
- * or a grid anchor is the host's business, and keeping it that way is what lets
1014
- * one control answer both questions.
1015
- *
1016
- * ── AN EDITOR'S COMPOSITE, OF THE SHELL'S PARTS (UI-24 §2) ─────────────────
1017
- *
1018
- * The shell has a `RadioGroup` of labelled rows and no grid of positions, so
1019
- * this picture of nine squares stays the editor's — but every cell is the
1020
- * shell's `IconButton` (a `role="radio"`), its name the shell's `Tooltip`,
1021
- * and the sheet draws only the picture: the track, the dot, the chosen cell.
1022
- *
1023
- * Controlled and hook-free, like every primitive here, so a Next server
1024
- * component can import this module.
1025
- */
1026
- declare function SettingsPlacement({ label, value, points, onChange, id, className, }: SettingsPlacementProps): react.JSX.Element;
1027
-
1028
- /**
1029
- * Four corners of a box, any number of them lit — "which of these corners?".
1030
- *
1031
- * ── WHY IT IS NOT {@link SettingsPlacement} WITH FOUR CELLS ──────────────────
1032
- *
1033
- * The nine-square asks WHICH ONE and gets one answer back; a radiogroup, and
1034
- * pressing a second cell releases the first. This asks WHICH ONES and gets a
1035
- * set: a merchant rounding a stack of boxes turns on the top two of the box at
1036
- * the top and the bottom two of the box at the bottom, so the run reads as one
1037
- * shape. Those are different questions with different keyboards — a radiogroup
1038
- * moves with the arrows and admits exactly one, a set is toggled with Space and
1039
- * admits any number — so they are two controls rather than one control with a
1040
- * `multiple` flag that changes what its own ARIA means.
1041
- *
1042
- * They still look like siblings, because a merchant meeting the second one
1043
- * should already know how to press it: the same track, the same chip, the same
1044
- * "the chosen thing is the darkest thing here" reading the placement grid and
1045
- * the segmented strip already share.
1046
- *
1047
- * ── THE CELL DRAWS THE ANSWER, NOT A DOT ────────────────────────────────────
1048
- *
1049
- * The placement grid's cell holds a dot, because a POSITION has no shape of its
1050
- * own to show. A corner does: each cell here holds a small square whose matching
1051
- * corner is rounded when the corner is on, and square when it is off. So the
1052
- * control is a picture of what the setting does rather than four labels a
1053
- * merchant has to hold in their head — and it stays readable for someone who
1054
- * cannot separate the accent from the ground, because the SHAPE carries the
1055
- * state as well as the fill.
1056
- *
1057
- * ── WHAT IT DOES NOT DO ─────────────────────────────────────────────────────
1058
- *
1059
- * It renders the CONTROL only. The row around it — the glyph, the label, the
1060
- * caption — is `SettingsField`'s, the same split `SettingsSwitch` and
1061
- * `SettingsPlacement` make. `label` is the group's accessible name, never a
1062
- * visible one.
1063
- *
1064
- * It also holds no opinion about what a corner MEANS. The host hands the four
1065
- * corners it wants offered and gets a set back; whether that set becomes a
1066
- * `border-radius` shorthand, four custom properties or a stored preset is the
1067
- * host's business, and keeping it that way is what lets one control serve a
1068
- * section box, a card and whatever asks next.
1069
- *
1070
- * ⚠️ IT HAS NO OPINION ABOUT "ALL FOUR" EITHER. An empty set is a real answer
1071
- * (every corner square) and so is a full one; a host that treats absence as
1072
- * "all four" resolves that BEFORE handing `value` in, exactly as the placement
1073
- * grid requires its value already resolved. A control that invented the default
1074
- * would be answering a question only the host can answer.
1075
- *
1076
- * ── AN EDITOR'S COMPOSITE, OF THE SHELL'S PARTS (UI-24 §2) ─────────────────
1077
- *
1078
- * The shell's `Segmented` answers ONE of a set, and it has no set of toggles,
1079
- * so the four corners stay the editor's picture — but every cell is the
1080
- * shell's `IconButton` (`aria-pressed`), its name the shell's `Tooltip`, and
1081
- * the sheet draws only the picture: the track, the frame and the marks.
1082
- *
1083
- * Controlled and hook-free, like every primitive here, so a Next server
1084
- * component can import this module.
1085
- */
1086
- declare function SettingsCorners({ label, value, corners, onChange, id, className, }: SettingsCornersProps): react.JSX.Element;
1087
-
1088
870
  /**
1089
871
  * A FULL-WIDTH BUTTON UNDER A GROUP'S ROWS THAT COMMITS A CHANGE.
1090
872
  *
@@ -1138,4 +920,4 @@ declare function SettingsCorners({ label, value, corners, onChange, id, classNam
1138
920
  */
1139
921
  declare function SettingsAction({ label, onPress, disabled, note, done, doneLabel, icon, id, className, }: SettingsActionProps): react.JSX.Element;
1140
922
 
1141
- export { SettingsAction, type SettingsActionBaseProps, type SettingsActionNote, type SettingsActionProps, type SettingsCornerPoint, SettingsCorners, type SettingsCornersProps, SettingsDefaultReset, type SettingsDefaultResetProps, SettingsDrill, type SettingsDrillProps, SettingsField, type SettingsFieldProps, SettingsGroup, SettingsGroupHead, type SettingsGroupHeadProps, type SettingsGroupProps, SettingsGroupSub, type SettingsGroupSubProps, SettingsPlacement, type SettingsPlacementPoint, type SettingsPlacementProps, SettingsSegmented, type SettingsSegmentedFit, type SettingsSegmentedOption, type SettingsSegmentedProps, SettingsSwitch, type SettingsSwitchBaseProps, type SettingsSwitchLabel, type SettingsSwitchProps, type SettingsTabItem, SettingsTabs, type SettingsTabsProps };
923
+ export { SettingsAction, type SettingsActionBaseProps, type SettingsActionNote, type SettingsActionProps, SettingsDefaultReset, type SettingsDefaultResetProps, SettingsDrill, type SettingsDrillProps, SettingsField, type SettingsFieldProps, SettingsGroup, SettingsGroupHead, type SettingsGroupHeadProps, type SettingsGroupProps, SettingsGroupSub, type SettingsGroupSubProps, SettingsSegmented, type SettingsSegmentedFit, type SettingsSegmentedOption, type SettingsSegmentedProps, SettingsSwitch, type SettingsSwitchBaseProps, type SettingsSwitchLabel, type SettingsSwitchProps, type SettingsTabItem, SettingsTabs, type SettingsTabsProps };