efficient-easel 1.0.1 → 1.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 (43) hide show
  1. package/README.md +8 -1
  2. package/dist/chunk-2F6RZTR7.js +5 -0
  3. package/dist/{chunk-I64QM6DU.js → chunk-4OL6MRYY.js} +1 -1
  4. package/dist/chunk-7QWOAQQL.js +5 -0
  5. package/dist/{chunk-O5F46JWM.js → chunk-BEEJ63CT.js} +40 -40
  6. package/dist/{chunk-QRKKQGUO.js → chunk-JMIZ3FOV.js} +1 -1
  7. package/dist/{chunk-RG7PFKCA.js → chunk-KCE5RVVC.js} +3 -3
  8. package/dist/{chunk-QTPJMJOJ.js → chunk-NGT4DAHF.js} +1 -1
  9. package/dist/chunk-PJP46U5L.js +9 -0
  10. package/dist/chunk-Q6ETRSEA.js +24 -0
  11. package/dist/{chunk-GXFAQ7JN.js → chunk-RINSVAKA.js} +1 -1
  12. package/dist/{chunk-FER7FCAG.js → chunk-TJIXDXTV.js} +1 -1
  13. package/dist/{chunk-XWR5YVA7.js → chunk-UFY6RNMT.js} +2 -2
  14. package/dist/chunk-YNOZ5NXW.js +14 -0
  15. package/dist/copy/copy.css +16 -1
  16. package/dist/copy/index.js +31 -31
  17. package/dist/easel/index.d.ts +1 -1
  18. package/dist/fields/index.d.ts +37 -41
  19. package/dist/fields/index.js +1 -1
  20. package/dist/panel/index.js +14 -16
  21. package/dist/panel/panel.css +34 -22
  22. package/dist/screen/components/AddBlockRow.js +1 -1
  23. package/dist/screen/components/AddSidePanel.js +1 -1
  24. package/dist/screen/components/MediaSidePanel.js +1 -1
  25. package/dist/screen/components/ScreenChrome.js +1 -1
  26. package/dist/screen/components/ScreenMount.js +1 -1
  27. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  28. package/dist/screen/components/SectionScreenShell.js +16 -16
  29. package/dist/screen/components/usePartBridge.js +1 -1
  30. package/dist/screen/index.js +1 -1
  31. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  32. package/dist/screen/lib/screen-parts.js +1 -1
  33. package/dist/text-styles/index.js +33 -33
  34. package/dist/text-styles/text-styles.css +3 -3
  35. package/dist/tree/index.js +1 -1
  36. package/dist/tree/tree.css +9 -10
  37. package/dist/{types-VqL6t5HH.d.ts → types-DQp_i3dE.d.ts} +6 -2
  38. package/package.json +3 -3
  39. package/dist/chunk-4SWZAYKI.js +0 -5
  40. package/dist/chunk-NLRW4BGG.js +0 -8
  41. package/dist/chunk-Q27BB5ZC.js +0 -14
  42. package/dist/chunk-QFMJBBKM.js +0 -5
  43. package/dist/chunk-WDXPWSP7.js +0 -24
@@ -0,0 +1,14 @@
1
+ import{DEFAULT_PANEL_WORDS as e}from"./chunk-QTLAVDJE.js";import{SettingsSwitch as a}from"./chunk-QLD57GBB.js";import{Tabs as l,CountBadge as n}from"efficient-shell/ui";import{jsx as i,jsxs as s,Fragment as r}from"react/jsx-runtime";import{isValidElement as t,cloneElement as c}from"react";function d(e){const a=e[0];if(!a?.htmlId||!a.htmlId.endsWith(`-tab-${a.id}`))return;const l=a.htmlId.slice(0,-`-tab-${a.id}`.length);return e.every(e=>e.htmlId===`${l}-tab-${e.id}`)?l:void 0}function o({items:a,activeId:t,onSelect:c,ariaLabel:o=e.settings,idPrefix:u,className:h}){
2
+ /* @__PURE__ */
3
+ return i("div",{className:"es-tabs-fit",children:/* @__PURE__ */i(l,{variant:"pill","aria-label":o,idPrefix:u??d(a),className:h?`es-tabs ${h}`:"es-tabs",value:t,onChange:c,items:a.map(e=>{const a="number"==typeof e.badge&&e.badge>0?/* @__PURE__ */i(n,{count:e.badge,tone:"accent"}):null;return e.icon?{id:e.id,tooltip:e.label,label:/* @__PURE__ */s(r,{children:[
4
+ /* @__PURE__ */s("span",{className:"es-tab-tip",children:[
5
+ /* @__PURE__ */i("span",{className:"es-tab-icon","aria-hidden":"true",children:e.icon}),
6
+ /* @__PURE__ */i("span",{className:"es-tab-word has-icon",children:e.label})]}),a]})}:{id:e.id,label:/* @__PURE__ */s(r,{children:[
7
+ /* @__PURE__ */i("span",{className:"es-tab-word",children:e.label}),a]})}})})})}function u(e){return Array.isArray(e)?e.some(u):t(e)}function h(e,l,n){if(!t(e)||e.type!==a)return e;const i=e.props;return i.ariaLabel||i.ariaLabelledBy?e:c(e,n?{ariaLabelledBy:n}:{ariaLabel:l})}function m({label:e,labelId:a,icon:l,value:n,hint:t,changed:c,htmlFor:d,action:o,children:m,className:p}){const b=u(m),f=u(o);if(!b&&!f)return null;const N=["es-field"];b||N.push("is-inline"),c&&N.push("is-changed"),p&&N.push(p);const g=/* @__PURE__ */s(r,{children:[l?/* @__PURE__ */i("span",{className:"es-field-icon","aria-hidden":"true",children:l}):null,
8
+ /* @__PURE__ */i("span",{className:"es-field-label",id:a,children:e})]});/* @__PURE__ */
9
+ return s("div",{className:N.join(" "),children:[
10
+ /* @__PURE__ */s("div",{className:"es-field-head",children:[d?/* @__PURE__ */i("label",{className:"es-field-name",htmlFor:d,children:g}):/* @__PURE__ */i("span",{className:"es-field-name",children:g}),null!=n?/* @__PURE__ */i("span",{className:"es-field-value",children:n}):null,f?h(o,e,a):null]}),b?/* @__PURE__ */i("div",{className:"es-field-ctl",children:m}):null,t?/* @__PURE__ */i("p",{className:"es-field-hint",children:t}):null]})}function p({title:e,open:a,onToggle:l,count:n,id:r,children:t,className:c}){const d=r?`${r}-body`:void 0;/* @__PURE__ */
11
+ return s("div",{className:c?`es-group ${c}`:"es-group",children:[
12
+ /* @__PURE__ */s("button",{type:"button",id:r,"aria-expanded":a,"aria-controls":d,className:"es-group-head",onClick:()=>l(!a),children:[e,"number"==typeof n&&n>0?/* @__PURE__ */i("span",{className:"es-group-count",children:n}):null,
13
+ /* @__PURE__ */i("span",{className:"es-group-sign","aria-hidden":"true"})]}),
14
+ /* @__PURE__ */i("div",{id:d,className:"es-group-body",hidden:!a,children:t})]})}var b=Object.freeze(["Content","Style","Layout","Animation"]);export{b as SETTINGS_BUCKETS,m as SettingsField,p as SettingsGroup,o as SettingsTabs};
@@ -479,7 +479,8 @@
479
479
 
480
480
  /* A toolbar button is efficient-shell's IconButton look (harness UI-24): its
481
481
  ground, hover, focus ring, disabled fade and lit state are the kit's
482
- (`IconButton` from `aria-pressed`, else `iconButtonClasses({ pressed })`).
482
+ (`IconButton`, lit from `aria-pressed`, or from `pressed` for a radio and
483
+ a window's button).
483
484
  What stays is its size in the 9-column grid and the glyph inside. */
484
485
  .es-tb-btn {
485
486
  width: var(--es-tb-size);
@@ -606,3 +607,17 @@
606
607
  gap: var(--es-space-4, 4px);
607
608
  margin-bottom: var(--es-copy-gap);
608
609
  }
610
+ /* The cells' compact arrows (efficient-shell 4.166.0's `steppers="compact"`)
611
+ stand in one 16px column at the box's end. The shell keeps the unit 24px in
612
+ and the number 48px in from that end, room for a unit of any width; a cell's
613
+ unit is "px" or "%", so here the unit sits just inside the arrows and the
614
+ number stops just before it. Measured in Chrome at a 220px panel (a 95px
615
+ cell, the glyph in front): 17px of number with the shell's room, 29px with
616
+ this — "160" fits. Layout only: the arrows, the unit's ink and the box are
617
+ the shell's. */
618
+ .es-copy-cells .es-fnum:has([data-steppers='compact']) input {
619
+ padding-right: calc(9 * var(--spacing));
620
+ }
621
+ .es-copy-cells .es-fnum:has([data-steppers='compact']) span:has(> .es-fnum-unit) {
622
+ right: calc(4.5 * var(--spacing));
623
+ }
@@ -1,31 +1,31 @@
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 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{AlignJustifyIcon as L,AlignRightIcon as T,AlignCenterIcon as B,AlignLeftIcon as j,ParagraphSpacingIcon as z,LetterSpacingIcon as P,TextLinesIcon as R,TextSizeIcon as K,CaseNormalIcon as O,CaseUpperIcon as F,CaseLowerIcon as $,TextColorIcon as H,ListIcon as W,NumberedListIcon as I,ClearMarksIcon as U,BoldIcon as A,ItalicIcon as q,UnderlineIcon as V,StrikeIcon as Z,LinkIcon as G,SuperscriptIcon as Y,SubscriptIcon as Q,QuietIcon as J,EmphasisIcon as X}from"../chunk-L5KW4HG5.js";import{useRef as _,useState as ee,useLayoutEffect as te,useEffect as ne,useId as re}from"react";import{jsx as le,jsxs as oe,Fragment as ae}from"react/jsx-runtime";import{Tooltip as se,ColorSwatch as ie,ColorPickerPanel as ce,Button as ue,IconButton as de,iconButtonClasses as he,Label as pe,Input as fe}from"efficient-shell/ui";var me=["left","center","right","justify"],ge=e.align,be={left:/* @__PURE__ */le(j,{}),center:/* @__PURE__ */le(B,{}),right:/* @__PURE__ */le(T,{}),justify:/* @__PURE__ */le(L,{})},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 De(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 Se=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),Ee=/* @__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(Se.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=Ee.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 Pe(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 Re(e,t,n){return[Pe(e,t),Pe(e,n)]}function Ke(e,t,n){return t===n?[je(e,t),je(e,t)]:[ze(e,t),je(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=Te(e,t),[a,s,h]=Be(o,Math.min(n,r)),[p,f,m]=Be(o,Math.max(n,r)),g=Oe(a,s),b=Oe(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}},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(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 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,Te(r,t).lines))break}return{text:S,caret:Math.min(n,r)+E.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?Fe(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?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 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 Ae(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 qe(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=_(null),m=_(null),g=_(null),b=_(null),y=_(null),v=_(e),[k,x]=ee(0),w=_({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=Ae(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?Ae(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]=qe(r,e),[a,s]=qe(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]=Ke(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]=Re(r.layout,e,t),[a,s]=qe(r,l),[i,c]=qe(r,o),u=n.ownerDocument.createRange();return u.setStart(a,s),u.setEnd(i,c),u}},te(()=>{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&&D(r[0],Math.min(r[1],m.current.layout.text.length)));b.current=null;const o=m.current.layout,[a,s]=l.vis??Re(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]=Ke(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)};ne(()=>{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=Ae(s,e,d.startContainer,d.startOffset),u=Ae(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 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(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)}S(Fe(n,r,c,u,{text:""}),[c,u],"type")}}else l&&S($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)}},[]),ne(()=>{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(Ie,We(e,t,o[0],o[1])),l&&!r&&S(Fe(e,t,o[0],o[1],{text:""}),o,"edit")};/* @__PURE__ */
2
- return oe("div",{className:"es-rich-wrap",children:[l&&""===e?/* @__PURE__ */le("div",{className:"es-rich-placeholder","aria-hidden":"true",children:l}):null,
3
- /* @__PURE__ */le("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?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"):x(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(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});S(Fe(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__ */le(K,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */le(R,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */le(P,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */le(z,{}),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 le("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 le(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,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 oe("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__ */le("span",{className:"es-copy-pop-label",children:n.theme}),
8
- /* @__PURE__ */le("div",{className:"es-copy-theme",role:"group","aria-label":n.theme,children:e.map(e=>/* @__PURE__ */le(se,{content:`${e.label} · ${e.value.toUpperCase()}`,children:/* @__PURE__ */le(ie,{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__ */le("span",{className:"es-copy-pop-label",children:n.any}),
10
- /* @__PURE__ */le(ce,{className:"es-copy-any",value:l??"",onChange:e=>{e!==t&&r(e)},label:n.title,dragWrites:"end"}),
11
- /* @__PURE__ */le("div",{className:"es-copy-pop-foot",children:/* @__PURE__ */le(ue,{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=re(),[c,u]=ee(t),[d,h]=ee(!1),p=_(null);ne(()=>{p.current?.focus(),p.current?.select()},[]);const f=()=>{const e=c.trim();v(e)?r(e):h(!0)};/* @__PURE__ */
12
- return oe("div",{role:"dialog","aria-label":s.title,className:"es-copy-link"+(a?" es-copy-pop":""),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),f()):"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),o())},children:[
13
- /* @__PURE__ */le(pe,{htmlFor:i,className:"es-copy-link-label",children:s.label}),
14
- /* @__PURE__ */le(fe,{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__ */le("p",{id:`${i}-why`,role:"alert",className:"es-copy-link-why",children:s.refused}):null,
15
- /* @__PURE__ */oe("div",{className:"es-copy-link-actions",children:[n?/* @__PURE__ */le(ue,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onClick:l,children:s.remove}):null,
16
- /* @__PURE__ */oe("span",{className:"es-copy-link-end",children:[
17
- /* @__PURE__ */le(ue,{variant:"secondary",size:"sm","data-window-action":"cancel",onClick:o,children:s.cancel??e.link.cancel}),
18
- /* @__PURE__ */le(ue,{variant:"primary",size:"sm","data-window-action":"apply",onClick:f,disabled:""===c.trim(),children:s.apply})]})]})]})}var nt=e=>e.preventDefault();function rt(){/* @__PURE__ */
19
- return le("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=>he({pressed:e,className:"es-tb-cell es-tb-btn"+(e?" is-on":"")}),m=(e,t,n,a)=>r.has(e)?M(t,"link"===e?/* @__PURE__ */le("button",{type:"button",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},e):/* @__PURE__ */le(de,{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__ */le(rt,{},e),g=[["left",/* @__PURE__ */le(j,{},"l")],["center",/* @__PURE__ */le(B,{},"c")],["right",/* @__PURE__ */le(T,{},"r")],["justify",/* @__PURE__ */le(L,{},"j")]],b=[["none",e.caseNone,/* @__PURE__ */le(O,{},"n")],["upper",e.caseUpper,/* @__PURE__ */le(F,{},"u")],["lower",e.caseLower,/* @__PURE__ */le($,{},"w")]];/* @__PURE__ */
20
- return oe("div",{className:"es-tb",role:"toolbar","aria-label":p,children:[
21
- /* @__PURE__ */oe("div",{className:"es-tb-row"+(void 0===i?" is-eight":""),children:[m("bold",e.bold,/* @__PURE__ */le(A,{}),"Meta+B"),m("italic",e.italic,/* @__PURE__ */le(q,{}),"Meta+I"),m("underline",e.underline,/* @__PURE__ */le(V,{}),"Meta+U"),m("strike",e.strike,/* @__PURE__ */le(Z,{})),a?M(e.color,/* @__PURE__ */le("button",{type:"button",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__ */le(H,{})},"color")):/* @__PURE__ */le(rt,{}),m("link",e.link,/* @__PURE__ */le(G,{}),"Meta+K"),m("sup",e.sup,/* @__PURE__ */le(Y,{})),m("sub",e.sub,/* @__PURE__ */le(Q,{})),void 0!==i?i??/* @__PURE__ */le(rt,{}):null]}),
22
- /* @__PURE__ */oe("div",{className:"es-tb-row",children:[
23
- /* @__PURE__ */le("div",{className:"es-tb-group",role:"radiogroup","aria-label":n,children:g.map(([e,n])=>c&&c.allow.includes(e)?M(t[e],/* @__PURE__ */le("button",{type:"button",role:"radio",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__ */le(rt,{},e))}),u&&r.has("bullet")?M(e.bullet,/* @__PURE__ */le(de,{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__ */le(W,{})})):/* @__PURE__ */le(rt,{}),u&&r.has("number")?M(e.number,/* @__PURE__ */le(de,{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__ */le(I,{})})):/* @__PURE__ */le(rt,{}),
24
- /* @__PURE__ */le("div",{className:"es-tb-group",role:"radiogroup","aria-label":e.letterCase,children:b.map(([e,t,n])=>d?M(t,/* @__PURE__ */le("button",{type:"button",role:"radio",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__ */le(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__ */le(A,{size:16}),italic:/* @__PURE__ */le(q,{size:16}),strike:/* @__PURE__ */le(Z,{size:16}),highlight:/* @__PURE__ */le(X,{size:16}),quiet:/* @__PURE__ */le(J,{size:16}),link:/* @__PURE__ */le(G,{size:16}),clear:/* @__PURE__ */le(U,{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__ */oe("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]);return M(e.title,/* @__PURE__ */le(de,{onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.style),disabled:r,"aria-label":e.name??e.title,"aria-keyshortcuts":dt(e.shortcut),"aria-pressed":i||c?l:void 0,"aria-haspopup":"link"===e.style&&i?"dialog":void 0,"aria-expanded":"link"===e.style&&i?"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__ */oe(ae,{children:[
25
- /* @__PURE__ */le("span",{className:"es-copy-bar-split","aria-hidden":"true"}),l]}):null,o?/* @__PURE__ */le("span",{className:"es-copy-bar-end",children:o}):null]}):null}function ft({target:e,onChange:t}){const n=_(null);return te(()=>{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:P,actions:R,align:K,glyphs:O,barLabel:F,renderFooter:$,inputRef:H,barShows:W="always",richText:I=!0,defaultShowMarks:A=!1,toolbar:q="final",colors:V,cells:Z,letterCase:G,lastTool:Y}){const Q="final"===q,J=N("copy",e),X=_(null),se=H??X,[ie,ce]=ee(!1),[ue,de]=ee(null),he=_(Ye()).current,pe=_(null);ne(()=>{const e=pe.current;e&&t===e.to?pe.current=null:e&&t===e.from||(pe.current=null,he.reset())},[t,he]);const fe=e=>{pe.current={from:pe.current?.from??t,to:e},o(e)},me=e=>({text:t,start:e?.selectionStart??ue?.start??t.length,end:e?.selectionEnd??ue?.end??t.length}),[ge,be]=ee(A),ye=I&&!(u&&ge),ke=_(null),we=re(),[Se,Ee]=ee(null),[Me,Le]=ee(!1),Te=()=>{if(!ye)return se.current;const e=ke.current?.getSource()??ue;return e?{selectionStart:e.start,selectionEnd:e.end}:null},Be=ft({target:se,onChange:fe}),je=e=>(de({start:e.selectionStart,end:e.selectionEnd}),e),ze=(e,n)=>{if(!ye)return void Be(t=>(n&&he.record(me(t),"edit",Date.now()),je(e(t))));const r=Te(),l=je(e(r));n&&he.record(me(r),"edit",Date.now()),Ee(null),l.text!==t&&fe(l.text),ke.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},Pe=e=>ze(e,!0),Re=e=>ze(t=>{const n=me(t),r=he[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),Ke=_(null);te(()=>{const e=Ke.current;e&&(Ke.current=null,ye?ke.current?.setSource(e.start,e.end,t):(se.current?.focus(),se.current?.setSelectionRange(e.start,e.end),de(e)))},[ye]);const[Oe,Fe]=ee(null),$e=j??s,He=("string"==typeof z[0]?h(z):z).filter(e=>!ct.has(e.style)),We=Q?("string"==typeof z[0]?z:z.map(e=>e.style)).filter(e=>!ct.has(e)):He.map(e=>e.style),Ie={};if(ue&&(ye||Q)){const e=p(t,ue.start,ue.end,$e);for(const t of We){const n=e.has(t)||"highlight"===t&&e.has("accent");Ie[t]=!!Se?.add.includes(t)||!Se?.drop.includes(t)&&n}Q&&(Ie.link=e.has("link"))}else if(ue)for(const e of We)Ie[e]="link"===e?null!==f(t,ue.start,ue.end):m(t,ue.start,ue.end,e);const Ue=()=>{const e=Te(),n=e?.selectionStart??t.length;return{start:n,end:e?.selectionEnd??n}},Ae={sup:"sub",sub:"sup"},qe=e=>{if(Q&&"link"!==e&&d(0,e)){const{start:n,end:r}=Ue(),l=Ae[e];if(n===r){if(!ye)return void Pe(n=>Ce(t,e,n,(e,t,n,r)=>a(e,t,n,r,$e,J.placeholders)));const o=p(t,n,r,$e),s=Se&&Se.at===n?Se: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 Ee(u.length||d.length||void 0!==s?.color?{add:u,drop:d,color:s?.color,at:n}:null)}return void Pe(()=>{let o=t,a=n,s=r;if(l&&!p(o,a,s,$e).has(e)&&p(o,a,s,$e).has(l)){const e=k(o,a,s,l,$e);({text:o,selectionStart:a,selectionEnd:s}=e)}return k(o,a,s,e,$e)})}if("clear"===e)return void Pe(n=>Ce(t,e,n,(e,t,n)=>a(e,t,n,"clear",$e)));if("link"!==e&&ye&&d(0,e)){const n=Te(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;if(r===l){const n=p(t,r,l,$e),o=n.has(e)||"highlight"===e&&n.has("accent"),a=Se&&Se.at===r?Se: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 Ee(i.length||c.length?{add:i,drop:c,at:r}:null)}return void Pe(n=>k(t,n?.selectionStart??r,n?.selectionEnd??l,e,$e))}if("link"!==e){const n=P??((e,t,n,r)=>a(e,t,n,r,s,J.placeholders));return void Pe(r=>Ce(t,e,r,n))}const n=Te(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;Le(!1),Fe({start:r,end:l,link:f(t,r,l)})},Ve=Boolean(ue&&ue.start!==ue.end),Ge=ue?g(t,ue.start,ue.end,$e):null,Qe=ue?Se&&void 0!==Se.color&&Se.at===ue.start?Se.color:b(t,ue.start,ue.end,$e):null,Je=Qe?Qe.startsWith("#")?Qe:V?.find(e=>e.name===Qe)?.value:void 0,_e=e=>{ye?e?ke.current?.setSource(e.start,e.end,t):ke.current?.focus():(se.current?.focus(),e&&se.current?.setSelectionRange(e.start,e.end))},nt=()=>{const e=Oe;Fe(null),_e(e?{start:e.start,end:e.end}:ue)},rt=()=>{const e=ut.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));Le(!1),t&&_e(ue)},ut=_(null),dt=Me||null!==Oe;ne(()=>{const e=ut.current;if(!dt||!e)return;const t=e.ownerDocument,n=()=>{Le(!1),Fe(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)}},[dt]);const ht=Oe??(Me?ue??{start:t.length,end:t.length}:null),mt=_(()=>{});mt.current=()=>{const e=ut.current,t=e?.querySelector(".es-tb-wrap > .es-copy-pop");if(!e||!t||!ht)return;const n=ye?null:e.querySelector(".es-gold-layer"),r=ye?ke.current?.rangeOf(ht.start,ht.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,ht.start,ht.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"},te(()=>{const e=ut.current;if(!dt||!e)return;const t=()=>mt.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()}},[dt,Me,Oe,ht?.start,ht?.end,ye]);const gt=e=>Oe&&/* @__PURE__ */le(tt,{floating:e,href:Oe.link?.href??"",editing:null!==Oe.link,onApply:e=>{const n=Oe;Fe(null),Pe(()=>ye?S(t,n.start,n.end,e,$e):E(t,n.start,n.end,e))},onRemove:()=>{const e=Oe.link,n=Oe;Fe(null),e&&Pe(()=>ye?C(t,n.start,n.end,$e):D(t,e))},onClose:nt}),bt=K?ve(K.allow,J.align):[],yt="always"===W||ie||null!==Oe||Me;/* @__PURE__ */
26
- return oe("div",{ref:ut,className:"es-copy"+(T?` ${T}`:""),onFocus:()=>ce(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||ce(!1)},onKeyDownCapture:e=>{Me&&"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),rt())},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 Re(l||e.shiftKey?"redo":"undo");const o=`${e.shiftKey?"shift+":""}${n}`;if(Q){const t={b:"bold",i:"italic",u:"underline",k:"link"}[o];if(!t||!We.includes(t))return;return e.preventDefault(),e.stopPropagation(),void qe(t)}const a=He.find(e=>e.shortcut===o);a&&(e.preventDefault(),e.stopPropagation(),qe(a.style))},onPaste:e=>{const n=se.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:$e});Pe(e=>De(t,r,e))},style:V&&V.length>0?Object.fromEntries(V.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const e=se.current;e&&e.ownerDocument.activeElement===e&&de({start:e.selectionStart??t.length,end:e.selectionEnd??t.length})},children:[yt&&Q?/* @__PURE__ */oe("div",{className:"es-tb-wrap"+(Y?"":" is-eight"),children:[
27
- /* @__PURE__ */le(lt,{words:J.toolbar??e.toolbar,align:J.align,alignmentLabel:J.alignment,ariaLabel:F??J.formatting,offered:new Set(We),pressed:Ie,onMark:e=>qe(e),color:V&&V.length>0?{run:Je,open:Me,onToggle:()=>{Fe(null),Me?rt():Le(!0)}}:void 0,linkOpen:null!==Oe,last:Y?Y({className:"es-tb-cell es-tb-btn",disabled:B,selected:Ve,keepCaret:e=>e.preventDefault(),insert:e=>Pe(n=>De(t,e,n))}):void 0,alignment:K?{value:K.value,allow:K.allow,onChange:K.onChange,disabled:K.disabled}:void 0,list:{pressed:Ge,onList:e=>{const{start:n,end:r}=Ue(),l=g(t,n,r,$e);Pe(()=>w(t,n,r,l===e?null:e,$e))}},letterCase:G,disabled:B}),Me&&V&&V.length>0?/* @__PURE__ */le(et,{colors:V,current:Qe,words:J.colors??e.colors,onPick:e=>{const{start:n,end:r}=Ue();if(n!==r)Pe(()=>x(t,n,r,e,$e));else{if(!ye)return;Ee({add:Se?.add??[],drop:Se?.drop??[],color:e,at:n})}}}):null,Oe?gt(!0):null]}):null,Q&&Z&&Z.length>0?/* @__PURE__ */le(Xe,{cells:Z,words:J.cells??e.cells,readOnly:B}):null,yt&&!Q?/* @__PURE__ */le(pt,{tools:z,disabled:B,actions:R,glyphs:O,ariaLabel:F,pressed:Ie,open:Oe?"link":null,onApply:qe,align:K?/* @__PURE__ */le(n,{options:bt,value:K.value,onChange:K.onChange,ariaLabel:J.alignment,disabled:B||K.disabled,fit:xe(bt)}):null}):null,ye?/* @__PURE__ */le(Ze,{value:t,rules:$e,multiline:u,readOnly:B,placeholder:v,ariaLabel:L,handle:ke,pending:Se??void 0,onEdit:(e,n,r)=>{he.record({text:t,start:n.start,end:n.end},r,Date.now()),Ee(null),fe(e)},onSelect:e=>{de(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Se||e.start===Se.at&&e.end===Se.at||Ee(null)},onHistory:Re,onFormat:e=>{We.includes(e)&&qe(e)},onCommit:i,onCancel:c}):/* @__PURE__ */le(l,{value:t,onInput:e=>{he.record(me(null),"type",Date.now()),fe(e)},onCommit:i,onCancel:c,multiline:u,placeholder:v,ariaLabel:L,rules:j,disabled:B,inputRef:se,className:"es-copy-box"}),Oe&&!Q?gt(!1):null,$?$({focused:ie,insert:e=>Pe(n=>De(t,e,n))}):null,I&&u||Q&&yt?
28
- /* @__PURE__ */oe("div",{className:"es-copy-marks",children:[I&&u?/* @__PURE__ */oe(ae,{children:[
29
- /* @__PURE__ */le(r,{checked:ge,onChange:()=>{const e=Te();Ke.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:ue,Ee(null),be(e=>!e)},ariaLabelledBy:we,disabled:B}),
30
- /* @__PURE__ */le("span",{id:we,className:"es-copy-marks-label",children:J.showMarks??"Show marks"})]}):null,Q&&yt?M(Ve?void 0:J.clearStyleEmpty??"Select words first",/* @__PURE__ */oe("button",{type:"button",className:"es-copy-clear",disabled:B||!Ve,onMouseDown:e=>e.preventDefault(),onClick:()=>{const{start:e,end:n}=Ue();if(e===n)return;const r=y(t,e,n,$e);r.text!==t&&Pe(()=>r)},children:[
31
- /* @__PURE__ */le(U,{size:16}),J.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,Fe as editVisible,De as insertSelection,Ce as markSelection,We as markupOfRange,$e as newLine,Ne as pasteToMarkup,Te as richLayout,Ke as selectionToSource,Re as selectionToVisible,He as setBullet,je as toSource,ze as toSourceStart,Pe as toVisible,ft as useCaretEdit};
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{AlignJustifyIcon as L,AlignRightIcon as T,AlignCenterIcon as B,AlignLeftIcon as j,ParagraphSpacingIcon as z,LetterSpacingIcon as R,TextLinesIcon as O,TextSizeIcon as K,CaseNormalIcon as P,CaseUpperIcon as F,CaseLowerIcon as $,TextColorIcon as H,ListIcon as W,NumberedListIcon as I,ClearMarksIcon as U,BoldIcon as q,ItalicIcon as A,UnderlineIcon as V,StrikeIcon as Z,LinkIcon as G,SuperscriptIcon as Y,SubscriptIcon as Q,QuietIcon as J,EmphasisIcon as X}from"../chunk-L5KW4HG5.js";import{Tooltip as _,ColorSwatch as ee,ColorPickerPanel as te,Button as ne,IconButton as re,registerModalEscapeInterceptor as le,Label as oe,Input as ae}from"efficient-shell/ui";import{useRef as se,useState as ie,useLayoutEffect as ce,useEffect as ue,useId as de}from"react";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(j,{}),center:/* @__PURE__ */he(B,{}),right:/* @__PURE__ */he(T,{}),justify:/* @__PURE__ */he(L,{})},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 Ke(e,t,n){return t===n?[je(e,t),je(e,t)]:[ze(e,t),je(e,n)]}function Pe(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=Te(e,t),[a,s,h]=Be(o,Math.min(n,r)),[p,f,m]=Be(o,Math.max(n,r)),g=Pe(a,s),b=Pe(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?Fe(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?Pe(o,a):0,i=r===d-s?Pe(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=se(null),m=se(null),g=se(null),b=se(null),y=se(null),v=se(e),[k,x]=ie(0),w=se({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]=Ke(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}},ce(()=>{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]=Ke(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)};ue(()=>{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(Fe(n,r,c,u,{markup:a}),[c,u],"edit")}return l||(o=o.replace(/\s*\r?\n\s*/g," ")),void E(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 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(Fe(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)}},[]),ue(()=>{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(Fe(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(Fe(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(Fe(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(K,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */he(O,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */he(R,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */he(z,{}),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(_,{content:`${e.label} · ${e.value.toUpperCase()}`,children:/* @__PURE__ */he(ee,{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(te,{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(ne,{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=de(),[c,u]=ie(t),[d,h]=ie(!1),p=se(null),f=se(null),m=se(o);m.current=o,ue(()=>le(e=>{const t=f.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(m.current(),!0)},()=>f.current),[]),ue(()=>{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(oe,{htmlFor:i,className:"es-copy-link-label",children:s.label}),
14
+ /* @__PURE__ */he(ae,{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(ne,{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(ne,{variant:"secondary",size:"sm","data-window-action":"cancel",onClick:o,children:s.cancel??e.link.cancel}),
18
+ /* @__PURE__ */he(ne,{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(re,"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(j,{},"l")],["center",/* @__PURE__ */he(B,{},"c")],["right",/* @__PURE__ */he(T,{},"r")],["justify",/* @__PURE__ */he(L,{},"j")]],b=[["none",e.caseNone,/* @__PURE__ */he(P,{},"n")],["upper",e.caseUpper,/* @__PURE__ */he(F,{},"u")],["lower",e.caseLower,/* @__PURE__ */he($,{},"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(q,{}),"Meta+B"),m("italic",e.italic,/* @__PURE__ */he(A,{}),"Meta+I"),m("underline",e.underline,/* @__PURE__ */he(V,{}),"Meta+U"),m("strike",e.strike,/* @__PURE__ */he(Z,{})),a?M(e.color,/* @__PURE__ */he(re,{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(H,{})},"color")):/* @__PURE__ */he(rt,{}),m("link",e.link,/* @__PURE__ */he(G,{}),"Meta+K"),m("sup",e.sup,/* @__PURE__ */he(Y,{})),m("sub",e.sub,/* @__PURE__ */he(Q,{})),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(re,{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(re,{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(W,{})})):/* @__PURE__ */he(rt,{}),u&&r.has("number")?M(e.number,/* @__PURE__ */he(re,{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(I,{})})):/* @__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(re,{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(q,{size:16}),italic:/* @__PURE__ */he(A,{size:16}),strike:/* @__PURE__ */he(Z,{size:16}),highlight:/* @__PURE__ */he(X,{size:16}),quiet:/* @__PURE__ */he(J,{size:16}),link:/* @__PURE__ */he(G,{size:16}),clear:/* @__PURE__ */he(U,{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(re,{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=se(null);return ce(()=>{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:R,actions:O,align:K,glyphs:P,barLabel:F,renderFooter:$,inputRef:H,barShows:W="always",richText:I=!0,defaultShowMarks:q=!1,toolbar:A="final",colors:V,cells:Z,letterCase:G,lastTool:Y}){const Q="final"===A,J=N("copy",e),X=se(null),_=H??X,[ee,te]=ie(!1),[ne,re]=ie(null),oe=se(Ye()).current,ae=se(null);ue(()=>{const e=ae.current;e&&t===e.to?ae.current=null:e&&t===e.from||(ae.current=null,oe.reset())},[t,oe]);const me=e=>{ae.current={from:ae.current?.from??t,to:e},o(e)},ge=e=>({text:t,start:e?.selectionStart??ne?.start??t.length,end:e?.selectionEnd??ne?.end??t.length}),[be,ye]=ie(q),ke=I&&!(u&&be),we=se(null),Ee=de(),[De,Me]=ie(null),[Le,Te]=ie(!1),Be=()=>{if(!ke)return _.current;const e=we.current?.getSource()??ne;return e?{selectionStart:e.start,selectionEnd:e.end}:null},je=ft({target:_,onChange:me}),ze=e=>(re({start:e.selectionStart,end:e.selectionEnd}),e),Re=(e,n)=>{if(!ke)return void je(t=>(n&&oe.record(ge(t),"edit",Date.now()),ze(e(t))));const r=Be(),l=ze(e(r));n&&oe.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),Ke=e=>Re(t=>{const n=ge(t),r=oe[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),Pe=se(null);ce(()=>{const e=Pe.current;e&&(Pe.current=null,ke?we.current?.setSource(e.start,e.end,t):(_.current?.focus(),_.current?.setSelectionRange(e.start,e.end),re(e)))},[ke]);const[Fe,$e]=ie(null),He=j??s,We=("string"==typeof z[0]?h(z):z).filter(e=>!ct.has(e.style)),Ie=Q?("string"==typeof z[0]?z:z.map(e=>e.style)).filter(e=>!ct.has(e)):We.map(e=>e.style),Ue={};if(ne&&(ke||Q)){const e=p(t,ne.start,ne.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}Q&&(Ue.link=e.has("link"))}else if(ne)for(const e of Ie)Ue[e]="link"===e?null!==f(t,ne.start,ne.end):m(t,ne.start,ne.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(Q&&"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,J.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=R??((e,t,n,r)=>a(e,t,n,r,s,J.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(ne&&ne.start!==ne.end),Qe=ne?g(t,ne.start,ne.end,He):null,Je=ne?De&&void 0!==De.color&&De.at===ne.start?De.color:b(t,ne.start,ne.end,He):null,_e=Je?Je.startsWith("#")?Je:V?.find(e=>e.name===Je)?.value:void 0,nt=e=>{ke?e?we.current?.setSource(e.start,e.end,t):we.current?.focus():(_.current?.focus(),e&&_.current?.setSelectionRange(e.start,e.end))},rt=()=>{const e=Fe;$e(null),nt(e?{start:e.start,end:e.end}:ne)},ut=()=>{const e=ht.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));Te(!1),t&&nt(ne)},dt=se(ut);dt.current=ut,ue(()=>{if(Le)return le(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=se(null),mt=Le||null!==Fe;ue(()=>{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=Fe??(Le?ne??{start:t.length,end:t.length}:null),bt=se(()=>{});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"},ce(()=>{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,Fe,gt?.start,gt?.end,ke]);const yt=e=>Fe&&/* @__PURE__ */he(tt,{floating:e,href:Fe.link?.href??"",editing:null!==Fe.link,onApply:e=>{const n=Fe;$e(null),Oe(()=>ke?E(t,n.start,n.end,e,He):D(t,n.start,n.end,e))},onRemove:()=>{const e=Fe.link,n=Fe;$e(null),e&&Oe(()=>ke?C(t,n.start,n.end,He):S(t,e))},onClose:rt}),vt=K?ve(K.allow,J.align):[],kt="always"===W||ee||null!==Fe||Le;/* @__PURE__ */
26
+ return pe("div",{ref:ht,className:"es-copy"+(T?` ${T}`:""),onFocus:()=>te(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||te(!1)},onKeyDown:e=>{const t=e.target===_.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(Q){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=_.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:V&&V.length>0?Object.fromEntries(V.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const e=_.current;e&&e.ownerDocument.activeElement===e&&re({start:e.selectionStart??t.length,end:e.selectionEnd??t.length})},children:[kt&&Q?/* @__PURE__ */pe("div",{className:"es-tb-wrap"+(Y?"":" is-eight"),children:[
27
+ /* @__PURE__ */he(lt,{words:J.toolbar??e.toolbar,align:J.align,alignmentLabel:J.alignment,ariaLabel:F??J.formatting,offered:new Set(Ie),pressed:Ue,onMark:e=>Ve(e),color:V&&V.length>0?{run:_e,open:Le,onToggle:()=>{$e(null),Le?ut():Te(!0)}}:void 0,linkOpen:null!==Fe,last:Y?Y({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:K?{value:K.value,allow:K.allow,onChange:K.onChange,disabled:K.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:G,disabled:B}),Le&&V&&V.length>0?/* @__PURE__ */he(et,{colors:V,current:Je,words:J.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,Fe?yt(!0):null]}):null,Q&&Z&&Z.length>0?/* @__PURE__ */he(Xe,{cells:Z,words:J.cells??e.cells,readOnly:B}):null,kt&&!Q?/* @__PURE__ */he(pt,{tools:z,disabled:B,actions:O,glyphs:P,ariaLabel:F,pressed:Ue,open:Fe?"link":null,onApply:Ve,align:K?/* @__PURE__ */he(n,{options:vt,value:K.value,onChange:K.onChange,ariaLabel:J.alignment,disabled:B||K.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)=>{oe.record({text:t,start:n.start,end:n.end},r,Date.now()),Me(null),me(e)},onSelect:e=>{re(t=>t&&t.start===e.start&&t.end===e.end?t:e),!De||e.start===De.at&&e.end===De.at||Me(null)},onHistory:Ke,onFormat:e=>{Ie.includes(e)&&Ve(e)},onCommit:i,onCancel:c}):/* @__PURE__ */he(l,{value:t,onInput:e=>{oe.record(ge(null),"type",Date.now()),me(e)},onCommit:i,onCancel:c,multiline:u,placeholder:v,ariaLabel:L,rules:j,disabled:B,inputRef:_,className:"es-copy-box"}),Fe&&!Q?yt(!1):null,$?$({focused:ee,insert:e=>Oe(n=>Se(t,e,n))}):null,I&&u||Q&&kt?
28
+ /* @__PURE__ */pe("div",{className:"es-copy-marks",children:[I&&u?/* @__PURE__ */pe(fe,{children:[
29
+ /* @__PURE__ */he(r,{checked:be,onChange:()=>{const e=Be();Pe.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:ne,Me(null),ye(e=>!e)},ariaLabelledBy:Ee,disabled:B}),
30
+ /* @__PURE__ */he("span",{id:Ee,className:"es-copy-marks-label",children:J.showMarks??"Show marks"})]}):null,Q&&kt?M(Ge?void 0:J.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(U,{size:16}),J.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,Fe as editVisible,Se as insertSelection,Ce as markSelection,We as markupOfRange,$e as newLine,Ne as pasteToMarkup,Te as richLayout,Ke as selectionToSource,Oe as selectionToVisible,He as setBullet,je as toSource,ze as toSourceStart,Re as toVisible,ft as useCaretEdit};
@@ -8,7 +8,7 @@ import { c as ResolveTrigger, a as ResolveCache, R as ResolvableItem } from '../
8
8
  import * as react from 'react';
9
9
  import { ReactNode, CSSProperties, ComponentType, ReactElement } from 'react';
10
10
  import { b as NodeOpsHost, C as ClipboardEntry } from '../useNodeOps-BF0fQsif.js';
11
- import { I as InspectorFields } from '../types-VqL6t5HH.js';
11
+ import { I as InspectorFields } from '../types-DQp_i3dE.js';
12
12
  import '../buckets-CuLM47h9.js';
13
13
 
14
14
  interface EaselOptions<C extends EaselConfig = EaselConfig> {
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { S as SettingsBucket } from '../buckets-CuLM47h9.js';
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-VqL6t5HH.js';
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-VqL6t5HH.js';
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-DQp_i3dE.js';
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-DQp_i3dE.js';
6
6
  import { R as ResolvableItem } from '../resolve-D68pb3Bx.js';
7
7
  export { F as FieldsWords } from '../words-D8kf071T.js';
8
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';
@@ -288,7 +288,8 @@ declare function FieldText({ id, value, onChange, placeholder, multiline, rows,
288
288
  * A number value (blueprint step 4.1; the cell, plan step E4): the shell's
289
289
  * `InputNumber` (harness UI-24, efficient-easel#199), at its small rung, with
290
290
  * an optional glyph in front, an optional unit and, with `steppers`, the
291
- * shell's two arrows inside its end. A `title` is the shell's `Tooltip`.
291
+ * shell's two arrows inside its end (side by side, or `'compact'`: stacked in
292
+ * one narrow column). A `title` is the shell's `Tooltip`.
292
293
  *
293
294
  * Everything a key, a typed character or an arrow does is the shell's since
294
295
  * efficient-shell 4.164.0, which took in what this cell used to do itself:
@@ -320,32 +321,25 @@ declare function FieldNumber({ id, value, onChange, min, max, step, shiftStep, s
320
321
  * The typed value may go past the slider's own travel (`sliderMin` /
321
322
  * `sliderMax`); only `min` / `max` hold it, and the slider then rests at its
322
323
  * end — the shell's `inputMin` / `inputMax`. A row that follows the style
323
- * has no number of its own: the shell's `null`, with the style's number as
324
- * the box's grey placeholder (`emptyLabel`), which the box steps from;
325
- * emptying the box writes `undefined`, back to the style, and Escape after
326
- * typing goes back to following it.
327
- *
328
- * SHELL GAP (named in efficient-easel#199 part C): the shell's Slider rests
329
- * its range at `min` while the value is `null`, and has no "inherited" number
330
- * for it to sit on, so a row that follows the style shows its number in the
331
- * box but not on the range. Handing the shell the style's number AS the value
332
- * would put the range right and make Escape write that number as the row's
333
- * own — a document change nobody asked for — so the range waits for the
334
- * shell.
324
+ * has no number of its own: the shell's `null` over the style's number, its
325
+ * `placeholderValue` (efficient-shell 4.166.0) — the range rests on it, the
326
+ * box shows it grey, and the first ↑↓ steps from it; it is never written, so
327
+ * Escape after typing goes back to following the style. Emptying the box
328
+ * writes `undefined`, back to the style.
335
329
  *
336
330
  * `auto` (plan step E6, Site styles) is the word for "no number: each section
337
331
  * draws its own". The design puts it ON the slider: one spot left of its
338
332
  * travel is Auto, the box reads the word, grey, with no unit, and the slider
339
333
  * announces the word. Dragged there, the row writes `undefined`; an emptied
340
- * box is Auto too.
334
+ * box is Auto too. ↑ from Auto starts at `sliderMin`, the slider's first
335
+ * number (the shell's `stepFrom`, from the Auto spot).
341
336
  *
342
- * THE BOX'S KEYS ARE THE SHELL'S (efficient-shell 4.164.0): ↑↓ step from the
343
- * number shown, Shift by ten steps, Enter commits — snapped to `step` and held
344
- * to `min` / `max` — and Escape puts back the value the box had when it was
345
- * entered. The key-capture wrapper this row kept round the shell's box until
346
- * then is gone; what differs from it is listed in the 1.0.0 notes.
337
+ * THE KEYS ARE THE SHELL'S: ↑↓ step, Shift by the host's `shiftStep` (ten
338
+ * steps unless it says) on the range and in the box, Enter commits — snapped
339
+ * to `step` and held to `min` / `max` — and Escape puts back the value the
340
+ * box had when it was entered.
347
341
  */
348
- declare function FieldSlider({ id, label, value, onChange, min, max, step, styleValue, unit, sliderMin, sliderMax, auto, readOnly, }: FieldSliderProps): react.JSX.Element;
342
+ declare function FieldSlider({ id, label, value, onChange, min, max, step, shiftStep, styleValue, unit, sliderMin, sliderMax, auto, readOnly, }: FieldSliderProps): react.JSX.Element;
349
343
 
350
344
  /** The option a stored value names: equal by `Object.is`, so `0`, `false` and `''` are values too. */
351
345
  declare function optionFor<V>(options: readonly FieldOption<V>[], value: V | undefined): FieldOption<V> | undefined;
@@ -353,35 +347,37 @@ declare function optionFor<V>(options: readonly FieldOption<V>[], value: V | und
353
347
  * One of a fixed set (blueprint step 4.1) — or several (`multiple`), or one of
354
348
  * a long list with a search box (`searchable`). It is the SHELL's list
355
349
  * (harness UI-24, efficient-easel#199): `Select` for a set, `SearchableSelect`
356
- * for a searchable one. Since efficient-shell 4.164.0 `Select` takes option
357
- * groups, several values and a drawn row, and names its open list, and
358
- * `SearchableSelect` is named and walked as a listbox — the gaps this field
359
- * drew its own list for until then. What is left here is the mapping from the
360
- * editors' options to the shell's:
350
+ * for a searchable one. What is left here is the mapping from the editors'
351
+ * options to the shell's:
361
352
  *
362
- * group each RUN of options with the same `group` is one
363
- * `SelectOptionGroup`, in the order the options come — what
364
- * `<optgroup>` did. `groupCount` puts the run's size after its
365
- * heading.
353
+ * group each RUN of options with the same `group` is one option
354
+ * group, in the order the options come — what `<optgroup>`
355
+ * did — in both lists. `groupCount` puts the run's size after
356
+ * its heading.
357
+ * disabled shown and skipped, in both lists.
366
358
  * thumb, meta drawn into the row by the shell's `renderOption`: a picture
367
359
  * column (one option with a `thumb` key gives every row one)
368
- * and a quiet fact at the end that a screen reader skips.
360
+ * and a quiet fact at the end that a screen reader skips (a
361
+ * searchable list's second line).
369
362
  * renderOption the host's drawing of a row (each style in its own face),
370
363
  * inside the same row.
371
- * readOnly the shell's `disabled`: the list cannot open.
364
+ * renderValue the host's drawing of the CLOSED field (a face in itself):
365
+ * `Select`'s `renderValue` (efficient-shell 4.166.0), given
366
+ * the chosen option(s). The label stays what a screen reader
367
+ * reads. Not called while nothing is chosen (the placeholder
368
+ * shows), nor by a searchable list, whose field is its search.
369
+ * readOnly `Select`'s `readOnly`: the read-only ground, focusable, never
370
+ * opens. A searchable list has no read-only form: `disabled`.
371
+ *
372
+ * A one-of-a-set field always holds one, so the searchable list offers no
373
+ * "×" (`clearable={false}`).
372
374
  *
373
375
  * NAMES. `ariaLabelledBy`, else `ariaLabel`, names the control and its open
374
376
  * list; with neither, the shell names the list by its trigger, which the row's
375
377
  * `<label for>` names.
376
378
  *
377
- * WHAT THE SHELL'S LISTS DO NOT TAKE (named for efficient-shell, not drawn
378
- * here): `SearchableSelect` has no option groups, no several values and no
379
- * disabled options — a searchable list shows a group as its option's quiet
380
- * second line, ticks are a plain `Select`'s, and a disabled option is left out
381
- * of a searchable list; `Select` draws no closed value of the host's
382
- * (`renderValue` is ignored: the chosen label shows); and neither list opens
383
- * in the panel's flow (`inline` is ignored — the shell's list is placed over
384
- * the page, so a panel that scrolls no longer clips it).
379
+ * Neither list opens in the panel's flow (`inline` is ignored — the shell's
380
+ * list is placed over the page, so a panel that scrolls no longer clips it).
385
381
  */
386
382
  declare function FieldSelect<V>(props: FieldSelectManyProps<V>): ReactNode;
387
383
  declare function FieldSelect<V>(props: FieldSelectOneProps<V>): ReactNode;
@@ -1 +1 @@
1
- export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-WDXPWSP7.js";export{FieldSelect,FieldSlider,optionFor}from"../chunk-NLRW4BGG.js";import"../chunk-XWR5YVA7.js";import"../chunk-Q27BB5ZC.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-L5KW4HG5.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-Q6ETRSEA.js";export{FieldSelect,FieldSlider,optionFor}from"../chunk-PJP46U5L.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-L5KW4HG5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -1,17 +1,15 @@
1
- export{SETTINGS_BUCKETS,SettingsField,SettingsGroup,SettingsTabs}from"../chunk-Q27BB5ZC.js";import{DEFAULT_PANEL_WORDS as e}from"../chunk-QTLAVDJE.js";export{SettingsSegmented,SettingsSwitch}from"../chunk-QLD57GBB.js";import{withTip as a}from"../chunk-P2VEMZH5.js";import{RevertIcon as l}from"../chunk-L5KW4HG5.js";import{jsx as s,jsxs as i}from"react/jsx-runtime";import{Tooltip as n,IconButton as t}from"efficient-shell/ui";function r({title:e,level:a=3,id:l,className:i}){/* @__PURE__ */
2
- return s(`h${a}`,{id:l,className:i?`es-group-head ${i}`:"es-group-head",children:e})}function c({title:e,level:a=4,id:l,className:i}){/* @__PURE__ */
3
- return s(`h${a}`,{id:l,className:i?`es-group-sub ${i}`:"es-group-sub",children:e})}function d({label:i,changed:n,onReset:t,detail:r,disabled:c,defaultAction:d,words:p,className:h}){const b={...e,...p},f=["es-default-reset"];if(n&&f.push("is-changed"),h&&f.push(h),!n&&d)return f.push("is-pressable"),a(d.title,/* @__PURE__ */s("button",{type:"button",className:f.join(" "),"aria-label":d.title,disabled:c,onClick:d.onPress,children:d.icon}));if(!n)/* @__PURE__ */
4
- return s("span",{className:f.join(" "),"aria-hidden":"true"});const v=b.resetName({label:i});return a(r?b.resetTitle({label:i,detail:r}):v,/* @__PURE__ */s("button",{type:"button",className:f.join(" "),"aria-label":v,"aria-description":r||void 0,disabled:c,onClick:e=>{t(),function(e){const a=e.currentTarget,l=a.closest(".es-field");let s=l?.querySelector(u(".es-field-ctl"))??l?.querySelector(u(".es-field-head"))??null,i=l?null:a.parentElement;for(let e=0;!s&&i&&e<m;e+=1,i=i.parentElement)s=[...i.querySelectorAll(o)].find(e=>e!==a)??null;s?.focus()}(e)},children:/* @__PURE__ */s(l,{size:15})}))}var o=['input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])","button:not([disabled]):not(.es-default-reset)",'[tabindex]:not([tabindex="-1"])'].join(", "),u=e=>o.split(", ").map(a=>`${e} ${a}`).join(", "),m=4;function p({name:e,preview:a,offPage:l,status:n,onOpen:t,id:r,className:c}){const d=null!=a;/* @__PURE__ */
5
- return i("button",{type:"button",id:r,className:c?`es-drill ${c}`:"es-drill",onClick:t,children:[
1
+ export{SETTINGS_BUCKETS,SettingsField,SettingsGroup,SettingsTabs}from"../chunk-YNOZ5NXW.js";import{DEFAULT_PANEL_WORDS as e}from"../chunk-QTLAVDJE.js";export{SettingsSegmented,SettingsSwitch}from"../chunk-QLD57GBB.js";import{withTip as a}from"../chunk-P2VEMZH5.js";import{RevertIcon as l}from"../chunk-L5KW4HG5.js";import{jsx as s,jsxs as i}from"react/jsx-runtime";import{IconButton as n,Tooltip as t}from"efficient-shell/ui";function r({title:e,level:a=3,id:l,className:i}){/* @__PURE__ */
2
+ return s(`h${a}`,{id:l,className:i?`es-group-head ${i}`:"es-group-head",children:e})}function o({title:e,level:a=4,id:l,className:i}){/* @__PURE__ */
3
+ return s(`h${a}`,{id:l,className:i?`es-group-sub ${i}`:"es-group-sub",children:e})}function c({label:i,changed:n,onReset:t,detail:r,disabled:o,defaultAction:c,words:p,className:b}){const h={...e,...p},f=["es-default-reset"];if(n&&f.push("is-changed"),b&&f.push(b),!n&&c)return f.push("is-pressable"),a(c.title,/* @__PURE__ */s("button",{type:"button",className:f.join(" "),"aria-label":c.title,disabled:o,onClick:c.onPress,children:c.icon}));if(!n)/* @__PURE__ */
4
+ return s("span",{className:f.join(" "),"aria-hidden":"true"});const N=h.resetName({label:i});return a(r?h.resetTitle({label:i,detail:r}):N,/* @__PURE__ */s("button",{type:"button",className:f.join(" "),"aria-label":N,"aria-description":r||void 0,disabled:o,onClick:e=>{t(),function(e){const a=e.currentTarget,l=a.closest(".es-field");let s=l?.querySelector(u(".es-field-ctl"))??l?.querySelector(u(".es-field-head"))??null,i=l?null:a.parentElement;for(let e=0;!s&&i&&e<m;e+=1,i=i.parentElement)s=[...i.querySelectorAll(d)].find(e=>e!==a)??null;s?.focus()}(e)},children:/* @__PURE__ */s(l,{size:15})}))}var d=['input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])","button:not([disabled]):not(.es-default-reset)",'[tabindex]:not([tabindex="-1"])'].join(", "),u=e=>d.split(", ").map(a=>`${e} ${a}`).join(", "),m=4;function p({name:e,preview:a,offPage:l,status:n,onOpen:t,id:r,className:o}){const c=null!=a;/* @__PURE__ */
5
+ return i("button",{type:"button",id:r,className:o?`es-drill ${o}`:"es-drill",onClick:t,children:[
6
6
  /* @__PURE__ */i("span",{className:"es-drill-text",children:[
7
- /* @__PURE__ */s("span",{className:"es-drill-name",children:e}),d?/* @__PURE__ */s("span",{className:l?"es-drill-preview is-offpage":"es-drill-preview",children:a}):null]}),n?/* @__PURE__ */s("span",{className:"es-drill-status",children:n}):null,
8
- /* @__PURE__ */s("span",{className:"es-drill-chev","aria-hidden":"true"})]})}function h({label:e,value:a,points:l,onChange:r,id:c,className:d}){const o=c??`es-placement-${e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;/* @__PURE__ */
9
- return i("div",{id:c,className:"es-placement"+(d?` ${d}`:""),role:"radiogroup","aria-label":e,children:[l.map(e=>{const l=a===e.value,i=!0===e.disabled,c=i&&e.title?`${o}-${e.value}-why`:void 0;/* @__PURE__ */
10
- return s(n,{content:e.title??e.label,children:/* @__PURE__ */s(t,{size:"sm",role:"radio","aria-checked":l,"aria-label":e.label,"aria-disabled":i||void 0,"aria-describedby":c,className:`es-placement-cell${l?" is-active":""}${i?" is-off":""}`,onClick:()=>{i||r(e.value)},children:e.icon?/* @__PURE__ */s("span",{className:"es-placement-icon","aria-hidden":"true",children:e.icon}):/* @__PURE__ */s("span",{className:"es-placement-dot"})})},e.value)}),l.map(e=>!0===e.disabled&&e.title?/* @__PURE__ */s("span",{id:`${o}-${e.value}-why`,className:"es-vh",children:e.title},`${e.value}-why`):null)]})}function b({label:e,value:a,corners:l,onChange:r,id:c,className:d}){const o=c??`es-corners-${e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;/* @__PURE__ */
11
- return i("div",{id:c,className:"es-corners"+(d?` ${d}`:""),role:"group","aria-label":e,children:[
12
- /* @__PURE__ */s("span",{className:"es-corners-frame","aria-hidden":"true"}),l.map(e=>{const l=a.includes(e.value),i=!0===e.disabled,c=i&&e.title?`${o}-${e.value}-why`:void 0;/* @__PURE__ */
13
- return s(n,{content:e.title??e.label,children:/* @__PURE__ */s(t,{size:"sm","aria-pressed":l,"aria-label":e.label,"aria-disabled":i||void 0,"aria-describedby":c,className:`es-corners-cell es-corners-${e.value}${l?" is-on":""}${i?" is-off":""}`,onClick:()=>{i||r(l?a.filter(a=>a!==e.value):[...a,e.value])},children:/* @__PURE__ */s("span",{className:"es-corners-mark","aria-hidden":"true"})})},e.value)}),l.map(e=>!0===e.disabled&&e.title?/* @__PURE__ */s("span",{id:`${o}-${e.value}-why`,className:"es-vh",children:e.title},`${e.value}-why`):null)]})}function f({label:e,onPress:a,disabled:l,note:n,done:t,doneLabel:r,icon:c,id:d,className:o}){const u=void 0===r?e:r,m=t?u:e,p=null!=n,h=p&&d?`${d}-note`:void 0;/* @__PURE__ */
14
- return i("div",{className:o?`es-action-wrap ${o}`:"es-action-wrap",children:[
15
- /* @__PURE__ */i("button",{type:"button",id:d,className:t?"es-action is-done":"es-action",disabled:l,"aria-describedby":h,onClick:a,children:[c?/* @__PURE__ */s("span",{className:"es-action-icon","aria-hidden":"true",children:c}):null,
16
- /* @__PURE__ */s("span",{className:"es-action-label",children:m})]}),p?/* @__PURE__ */s("p",{id:h,className:"es-action-note",children:n}):null,
17
- /* @__PURE__ */s("span",{className:"es-action-live",role:"status","aria-live":"polite",children:t?u:null})]})}export{f as SettingsAction,b as SettingsCorners,d as SettingsDefaultReset,p as SettingsDrill,r as SettingsGroupHead,c as SettingsGroupSub,h as SettingsPlacement};
7
+ /* @__PURE__ */s("span",{className:"es-drill-name",children:e}),c?/* @__PURE__ */s("span",{className:l?"es-drill-preview is-offpage":"es-drill-preview",children:a}):null]}),n?/* @__PURE__ */s("span",{className:"es-drill-status",children:n}):null,
8
+ /* @__PURE__ */s("span",{className:"es-drill-chev","aria-hidden":"true"})]})}function b({label:e,value:a,points:l,onChange:i,id:r,className:o}){/* @__PURE__ */
9
+ return s("div",{id:r,className:"es-placement"+(o?` ${o}`:""),role:"radiogroup","aria-label":e,children:l.map(e=>{const l=a===e.value,r=!0===e.disabled,o=r&&e.title?e.title:void 0,c=/* @__PURE__ */s(n,{size:"sm",role:"radio","aria-checked":l,"aria-label":e.label,"aria-disabled":r||void 0,disabledReason:o,className:`es-placement-cell${l?" is-active":""}${r?" is-off":""}`,onClick:()=>{r||i(e.value)},children:e.icon?/* @__PURE__ */s("span",{className:"es-placement-icon","aria-hidden":"true",children:e.icon}):/* @__PURE__ */s("span",{className:"es-placement-dot"})},e.value);return o?c:/* @__PURE__ */s(t,{content:e.title??e.label,children:c},e.value)})})}function h({label:e,value:a,corners:l,onChange:r,id:o,className:c}){/* @__PURE__ */
10
+ return i("div",{id:o,className:"es-corners"+(c?` ${c}`:""),role:"group","aria-label":e,children:[
11
+ /* @__PURE__ */s("span",{className:"es-corners-frame","aria-hidden":"true"}),l.map(e=>{const l=a.includes(e.value),i=!0===e.disabled,o=i&&e.title?e.title:void 0,c=/* @__PURE__ */s(n,{size:"sm","aria-pressed":l,"aria-label":e.label,"aria-disabled":i||void 0,disabledReason:o,className:`es-corners-cell es-corners-${e.value}${l?" is-on":""}${i?" is-off":""}`,onClick:()=>{i||r(l?a.filter(a=>a!==e.value):[...a,e.value])},children:/* @__PURE__ */s("span",{className:"es-corners-mark","aria-hidden":"true"})},e.value);return o?c:/* @__PURE__ */s(t,{content:e.title??e.label,children:c},e.value)})]})}function f({label:e,onPress:a,disabled:l,note:n,done:t,doneLabel:r,icon:o,id:c,className:d}){const u=void 0===r?e:r,m=t?u:e,p=null!=n,b=p&&c?`${c}-note`:void 0;/* @__PURE__ */
12
+ return i("div",{className:d?`es-action-wrap ${d}`:"es-action-wrap",children:[
13
+ /* @__PURE__ */i("button",{type:"button",id:c,className:t?"es-action is-done":"es-action",disabled:l,"aria-describedby":b,onClick:a,children:[o?/* @__PURE__ */s("span",{className:"es-action-icon","aria-hidden":"true",children:o}):null,
14
+ /* @__PURE__ */s("span",{className:"es-action-label",children:m})]}),p?/* @__PURE__ */s("p",{id:b,className:"es-action-note",children:n}):null,
15
+ /* @__PURE__ */s("span",{className:"es-action-live",role:"status","aria-live":"polite",children:t?u:null})]})}export{f as SettingsAction,h as SettingsCorners,c as SettingsDefaultReset,p as SettingsDrill,r as SettingsGroupHead,o as SettingsGroupSub,b as SettingsPlacement};