efficient-easel 6.0.0 → 6.2.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 (32) hide show
  1. package/dist/chunk-2DHJC5YS.js +5 -0
  2. package/dist/{chunk-3CS5BQMF.js → chunk-3I6DVDUR.js} +1 -1
  3. package/dist/{chunk-RAFTHQVR.js → chunk-4XIIBGDO.js} +1 -1
  4. package/dist/{chunk-ATVN7L2J.js → chunk-7EKLESDL.js} +34 -34
  5. package/dist/{chunk-RSDDVLT7.js → chunk-EYRQ4XGN.js} +1 -1
  6. package/dist/{chunk-AL65NE2M.js → chunk-G3D2HWEO.js} +1 -1
  7. package/dist/chunk-MHU7S7JL.js +1 -0
  8. package/dist/{chunk-7YFUG75W.js → chunk-QBW3RJG5.js} +1 -1
  9. package/dist/{chunk-SQM6APQW.js → chunk-RKXIB5BN.js} +1 -1
  10. package/dist/chunk-YFK74XOM.js +5 -0
  11. package/dist/{chunk-74A4LGYT.js → chunk-ZTG2K3NL.js} +3 -3
  12. package/dist/copy/index.d.ts +118 -16
  13. package/dist/copy/index.js +11 -11
  14. package/dist/easel/index.d.ts +11 -0
  15. package/dist/easel/index.js +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/screen/components/AddBlockRow.js +1 -1
  18. package/dist/screen/components/AddSidePanel.js +1 -1
  19. package/dist/screen/components/MediaSidePanel.js +1 -1
  20. package/dist/screen/components/ScreenChrome.js +1 -1
  21. package/dist/screen/components/ScreenMount.js +1 -1
  22. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  23. package/dist/screen/components/SectionScreenShell.js +16 -16
  24. package/dist/screen/components/usePartBridge.js +1 -1
  25. package/dist/screen/index.js +1 -1
  26. package/dist/screen/lib/key-scope.js +1 -1
  27. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  28. package/dist/screen/lib/screen-parts.js +1 -1
  29. package/package.json +1 -1
  30. package/dist/chunk-CVBKSCAY.js +0 -5
  31. package/dist/chunk-LNKCGJYU.js +0 -1
  32. package/dist/chunk-SYDZ5YWX.js +0 -5
@@ -397,9 +397,27 @@ interface CopyBoxProps {
397
397
 
398
398
  declare function CopyBox({ value, onChange, onCommit, onCancel, multiline, placeholder, ariaLabel, className, readOnly, rules, tools, writeMark, actions, align, glyphs, barLabel, renderFooter, inputRef, barShows, richText, defaultShowMarks, toolbar, colors, cells, letterCase, lastTool, }: CopyBoxProps): react.JSX.Element;
399
399
 
400
- /** The clipboard type a copy from this box carries, so a paste back in keeps
400
+ interface PasteData {
401
+ /** The clipboard's `text/html`, when there is one. */
402
+ html?: string;
403
+ /** The clipboard's `text/plain`. */
404
+ text?: string;
405
+ }
406
+ interface PasteOptions {
407
+ /** The document the box lives in — the HTML is read in an inert template
408
+ * of it. */
409
+ doc: Document;
410
+ /** A one-line box joins every line with a space. */
411
+ multiline: boolean;
412
+ /** The host's rules, which the result must read back under. */
413
+ rules?: readonly InlineRule[];
414
+ }
415
+ /** Turn a clipboard's contents into the grammar, filtered. */
416
+ declare function pasteToMarkup(data: PasteData, opts: PasteOptions): string;
417
+ /** The clipboard type a copy from a text box (the panel's, or words typed on the canvas) carries, so a paste back in keeps
401
418
  * every mark (the HTML filter keeps only bold, italic and links). */
402
419
  declare const MARKUP_CLIPBOARD_TYPE = "application/x-efficient-markup";
420
+
403
421
  /** What the host can ask of the box, in SAVED offsets. */
404
422
  interface RichHandle {
405
423
  /** The selection, or null when it is not in the box. */
@@ -451,6 +469,52 @@ interface RichBoxProps {
451
469
  }
452
470
  declare function RichBox({ value, rules, multiline, readOnly, placeholder, ariaLabel, handle, onEdit, onSelect, onHistory, onFormat, pending, onCommit, onCancel, }: RichBoxProps): react.JSX.Element;
453
471
 
472
+ interface TextMap {
473
+ /** The words as drawn: text in order, a `<br>` or a new block line as `\n`. */
474
+ text: string;
475
+ /** The visible offset of a DOM point inside the root. */
476
+ at: (node: Node, offset: number) => number;
477
+ /** The DOM point of a visible offset. */
478
+ dom: (v: number) => [Node, number];
479
+ }
480
+ /**
481
+ * Read the words a renderer drew, whatever its markup: text nodes in order;
482
+ * a `<br>` is a line break, and so is the start of a block-level child after
483
+ * some words (a line the renderer drew as its own block).
484
+ */
485
+ declare function textMap(root: HTMLElement): TextMap;
486
+ /** Why typing ended. */
487
+ type CanvasTypingEnd = 'escape' | 'enter' | 'blur' | 'outside' | 'stop';
488
+ interface CanvasTypingOptions {
489
+ /** The element the page drew the words in. Read again after every redraw:
490
+ * a host that draws them afresh may hand back a new one. */
491
+ element: () => HTMLElement | null;
492
+ /** The saved string. */
493
+ value: string;
494
+ rules: readonly InlineRule[];
495
+ /** The field has lines: Shift+Enter makes one. */
496
+ multiline: boolean;
497
+ /** The visible selection to start with. */
498
+ caret: [number, number];
499
+ /** The host's ONE writer — the same the panel's text box writes through. */
500
+ write: (next: string) => void;
501
+ /** Typing ended; the words are what was last written. */
502
+ end: (why: CanvasTypingEnd) => void;
503
+ /** The browser wrote into the words (a composition): draw them afresh. */
504
+ remount?: () => void;
505
+ now?: () => number;
506
+ }
507
+ interface CanvasTypingSession {
508
+ /** The string as the session last wrote or was told. */
509
+ readonly value: string;
510
+ /** The host wrote the string from elsewhere (the panel's text box). */
511
+ update: (next: string) => void;
512
+ /** End typing. Once: a second call does nothing. */
513
+ stop: (why?: CanvasTypingEnd) => void;
514
+ }
515
+ /** Start typing in the words `element()` drew, or `null` where they are not the string's. */
516
+ declare function startCanvasTyping(o: CanvasTypingOptions): CanvasTypingSession | null;
517
+
454
518
  /** One line of the rich view. `src` is where its words start in the saved
455
519
  * string (after a `- `), `start` where the line itself starts, `vis` where
456
520
  * its words start in the visible text. */
@@ -520,23 +584,61 @@ declare function setBullet(value: string, rules: readonly InlineRule[], index: n
520
584
  /** The words `vs..ve` as markup, marks and bullets included — for a copy. */
521
585
  declare function markupOfRange(value: string, rules: readonly InlineRule[], vs: number, ve: number): string;
522
586
 
523
- interface PasteData {
524
- /** The clipboard's `text/html`, when there is one. */
525
- html?: string;
526
- /** The clipboard's `text/plain`. */
527
- text?: string;
587
+ /**
588
+ * `richInput` — what one `beforeinput` does to the saved string, written once.
589
+ *
590
+ * Two places let a person type the same string: the panel's text box
591
+ * (`RichBox`) and the words on the editor's canvas (card [DESIGN] Typing On
592
+ * The Canvas, Lewis 2026-10-14). Both cancel every `beforeinput` — the browser
593
+ * is used for the caret and the selection and for nothing else — and make the
594
+ * edit on the string with ./rich-model. This is that decision, as a pure
595
+ * function: given the string, the visible selection and the event's
596
+ * `inputType` and data, the edit to apply (and whether it is typing, which
597
+ * joins an undo burst, or an edit, which does not), a history or format key to
598
+ * hand back to the host, or `null` for nothing — an input the grammar cannot
599
+ * say is refused.
600
+ *
601
+ * Moved out of `RichBox` unchanged; its specs (tests/copy-rich.test.tsx) hold
602
+ * that it behaves as it did.
603
+ */
604
+
605
+ /** Marks pressed with nothing selected, and a pending colour: the next typed words take them. */
606
+ interface RichPending {
607
+ add?: readonly MarkStyle[];
608
+ drop?: readonly string[];
609
+ color?: string | null;
528
610
  }
529
- interface PasteOptions {
530
- /** The document the box lives in — the HTML is read in an inert template
531
- * of it. */
532
- doc: Document;
533
- /** A one-line box joins every line with a space. */
611
+ type RichInputResult = {
612
+ kind: 'type' | 'edit';
613
+ edit: RichEdit;
614
+ range: [number, number];
615
+ } | {
616
+ kind: 'history';
617
+ dir: 'undo' | 'redo';
618
+ } | {
619
+ kind: 'format';
620
+ style: 'bold' | 'italic' | 'strike';
621
+ } | null;
622
+ interface RichInputEvent {
623
+ value: string;
624
+ rules: readonly InlineRule[];
625
+ /** A many-line box: Enter makes a new line. A one-line box takes none. */
534
626
  multiline: boolean;
535
- /** The host's rules, which the result must read back under. */
536
- rules?: readonly InlineRule[];
627
+ /** The event's `inputType`. */
628
+ inputType: string;
629
+ /** The event's `data`, or its plain-text `dataTransfer`. */
630
+ data?: string | null;
631
+ /** The pasted or dropped HTML, when there is some. */
632
+ html?: string | null;
633
+ /** The document a paste is parsed in. */
634
+ doc: Document;
635
+ /** The visible selection. */
636
+ sel: [number, number];
637
+ /** The range a delete names for itself (`getTargetRanges`), in visible offsets. */
638
+ target?: [number, number] | null;
639
+ pending?: RichPending | null;
537
640
  }
538
- /** Turn a clipboard's contents into the grammar, filtered. */
539
- declare function pasteToMarkup(data: PasteData, opts: PasteOptions): string;
641
+ declare function richInput(e: RichInputEvent): RichInputResult;
540
642
 
541
643
  /**
542
644
  * THE BOX'S OWN UNDO (0.94.0) — what ⌘Z and ⇧⌘Z step through while a copy
@@ -591,4 +693,4 @@ interface CaretEdit {
591
693
  */
592
694
  declare function useCaretEdit({ target, onChange }: CaretEdit): (edit: (el: HTMLInputElement | HTMLTextAreaElement | null) => WrapResult) => void;
593
695
 
594
- export { COPY_CELLS, type CaretEdit, ColorWindow, CopyAlign, CopyBox, type CopyBoxAlign, type CopyBoxFooter, type CopyBoxLastTool, type CopyBoxProps, type CopyCase, type CopyCell, type CopyCellPreset, CopyCells, type CopyThemeColor, CopyWords, type History, MARKUP_CLIPBOARD_TYPE, MarkBar, type MarkBarProps, type MarkWriter, type PasteData, type PasteOptions, RichBox, type RichBoxProps, type RichEdit, type RichHandle, type RichInsert, type RichLayout, type RichLine, type SelectionSource, type Snapshot, TYPING_BURST_MS, type TextAreaHandle, type TextBoxHandle, type ToolbarMark, ariaShortcut, createHistory, editVisible, insertSelection, markSelection, markupOfRange, newLine, pasteToMarkup, richLayout, selectionToSource, selectionToVisible, setBullet, toSource, toSourceStart, toVisible, useCaretEdit };
696
+ export { COPY_CELLS, type CanvasTypingEnd, type CanvasTypingOptions, type CanvasTypingSession, type CaretEdit, ColorWindow, CopyAlign, CopyBox, type CopyBoxAlign, type CopyBoxFooter, type CopyBoxLastTool, type CopyBoxProps, type CopyCase, type CopyCell, type CopyCellPreset, CopyCells, type CopyThemeColor, CopyWords, type History, MARKUP_CLIPBOARD_TYPE, MarkBar, type MarkBarProps, type MarkWriter, type PasteData, type PasteOptions, RichBox, type RichBoxProps, type RichEdit, type RichHandle, type RichInputEvent, type RichInputResult, type RichInsert, type RichLayout, type RichLine, type RichPending, type SelectionSource, type Snapshot, TYPING_BURST_MS, type TextAreaHandle, type TextBoxHandle, type TextMap, type ToolbarMark, ariaShortcut, createHistory, editVisible, insertSelection, markSelection, markupOfRange, newLine, pasteToMarkup, richInput, richLayout, selectionToSource, selectionToVisible, setBullet, startCanvasTyping, textMap, toSource, toSourceStart, toVisible, useCaretEdit };
@@ -1,18 +1,18 @@
1
- import{DEFAULT_COPY_WORDS as e}from"../chunk-AUT242JK.js";import{FieldNumber as t}from"../chunk-66LWADFP.js";import{SettingsSegmented as n,SettingsSwitch as r}from"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import{GoldTextInput as l}from"../chunk-2FZJWH24.js";import{RETIRED_MARKS as o,applyMark as a,STANDARD_MARKUP as s,writeMarkedLines as i,sameMarks as c,markedLines as u,spanFor as d,markupTools as h,marksIn as p,findLink as f,markedAt as m,listIn as g,colorIn as b,clearStyle as y,isSafeLinkHref as v,toggleMark as k,colorOver as x,setList as w,unlinkAt as S,removeLink as E,linkOver as C,writeLink as D}from"../chunk-546BBOPE.js";import{useWords as N}from"../chunk-MFIRYGHW.js";import{withTip as L}from"../chunk-P2VEMZH5.js";import{Tooltip as M,ColorSwatch as T,ColorPickerPanel as B,Button as R,IconButton as j,registerModalEscapeInterceptor as P,textToolbarRows as z,TextToolbar as O,LinkPicker as F}from"efficient-shell/ui";export{TextToolbar}from"efficient-shell/ui";import{useRef as W,useState as K,useLayoutEffect as $,useEffect as H,useId as A}from"react";import{AlignJustifyIcon as I,AlignRightIcon as q,AlignCenterIcon as U,AlignLeftIcon as V,ParagraphSpacingIcon as Y,LetterSpacingIcon as Z,TextLinesIcon as G,TextSizeIcon as J,ClearMarksIcon as X,LinkIcon as Q,QuietIcon as _,EmphasisIcon as ee,StrikeIcon as te,ItalicIcon as ne,BoldIcon as re}from"efficient-shell/icons/efficient";import{jsx as le,jsxs as oe,Fragment as ae}from"react/jsx-runtime";var se=["left","center","right","justify"],ie=e.align,ce={left:/* @__PURE__ */le(V,{}),center:/* @__PURE__ */le(U,{}),right:/* @__PURE__ */le(q,{}),justify:/* @__PURE__ */le(I,{})},ue={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function de(e,t=ie){return se.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:ce[e],title:t[e]}))}var he=/[\u1100-\u11ff\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/;function pe(e){if(e.every(e=>e.label===ie[e.id]))return e.length>3?ue.four:ue.three;const t=e.map(e=>[...e.label].reduce((e,t)=>e+(he.test(t)?13:8),0));return{labelsPx:t.reduce((e,t)=>e+t,0),widestLabelPx:Math.max(0,...t)}}function fe(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function me(e,t,n,r=a){const{start:l,end:o}=fe(e,n);return r(e,l,o,t)}function ge(e,t,n){const{start:r,end:l}=fe(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}var be=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),ye=/* @__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 ve(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(be.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=ye.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=ke(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 ke(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 xe=/^([0-9]{1,3})\. $/;function we(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:xe.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 Se(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 Ee(e,t){const[n,r]=Se(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 Ce(e,t){const[n,r]=Se(e,t);let l=0;for(const e of n.chars){if(r===l)return e.at;l+=e.ch.length}return Ee(e,t)}function De(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 Ne(e,t,n){return[De(e,t),De(e,n)]}function Le(e,t,n){return t===n?[Ee(e,t),Ee(e,t)]:[Ce(e,t),Ee(e,n)]}function Me(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 Te(e,t,n,r,l){const o=we(e,t),[a,s,h]=Se(o,Math.min(n,r)),[p,f,m]=Se(o,Math.max(n,r)),g=Me(a,s),b=Me(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 S=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}},E=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 C="",D="";for(const e of E){const n=S(e),r=i(n.lines).text;if(C=r,D=n.shown,c(n.lines,we(r,t).lines))break}return{text:C,caret:Math.min(n,r)+D.length}}function Be(e,t,n,r){const l=we(e,t),[o,,a]=Se(l,n);return n!==r||!o.bullet&&null==o.number||""!==o.text?Te(e,t,n,r,{text:"\n"}):Re(e,t,a,!1,n)}function Re(e,t,n,r,l){const o=we(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 je(e,t,n,r){const l=we(e,t),[o,a,s]=Se(l,Math.min(n,r)),[c,u,d]=Se(l,Math.max(n,r)),h=l.lines.slice(s,d+1).map(({bullet:e,number:t,chars:n},r)=>{const l=0===r?Me(o,a):0,i=r===d-s?Me(c,u):n.length;return{bullet:e,number:t,chars:n.slice(l,i)}});return i(h).text}var Pe="application/x-efficient-markup";function ze(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 Oe(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 Fe(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 We(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 Ke({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=W(null),m=W(null),g=W(null),b=W(null),y=W(null),v=W(e),[k,x]=K(0),w=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 S=()=>{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=Oe(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?Oe(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},E=(e,t)=>{const n=f.current,r=m.current;if(!n||!r)return;const[l,o]=Fe(r,e),[a,s]=Fe(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};a.current={getSource(){const e=S(),t=m.current;if(!e||!t)return null;const[n,r]=Le(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]=Ne(r.layout,e,t),[a,s]=Fe(r,l),[i,c]=Fe(r,o),u=n.ownerDocument.createRange();return u.setStart(a,s),u.setEnd(i,c),u}},$(()=>{const n=f.current;if(!n||y.current)return;const r=b.current?null:S();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=ze(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,we(e,t)),g.current=e;const l=b.current;if(!l||l.text!==e)return void(r&&n.ownerDocument.activeElement===n&&E(r[0],Math.min(r[1],m.current.layout.text.length)));b.current=null;const o=m.current.layout,[a,s]=l.vis??Ne(o,l.src[0],l.src[1]);n.ownerDocument.activeElement!==n&&n.focus(),E(a,s)},[e,t,k]);const C=(e,t,n)=>{const r=m.current,[l,o]=Le(r.layout,t[0],t[1]);b.current={text:e.text,vis:[e.caret,e.caret]},e.text!==w.current.value?w.current.onEdit(e.text,{start:l,end:o},n):x(e=>e+1)};H(()=>{const e=f.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:a}=w.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const s=m.current,i=S();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=Oe(s,e,d.startContainer,d.startOffset),u=Oe(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=ve({html:t.dataTransfer?.getData("text/html"),text:o},{doc:e.ownerDocument,multiline:l,rules:r});return void C(Te(n,r,c,u,{markup:a}),[c,u],"edit")}return l||(o=o.replace(/\s*\r?\n\s*/g," ")),void C(Te(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 C(Re(n,r,t,!1,c),[c,u],"edit");if(e?0===c:c===h.length)return;e?c=We(h,c,-1):u=We(h,u,1)}C(Te(n,r,c,u,{text:""}),[c,u],"type")}}else l&&C(Be(n,r,c,u),[c,u],"edit");else w.current.onFormat("formatBold"===p?"bold":"formatItalic"===p?"italic":"strike");else w.current.onHistory("historyUndo"===p?"undo":"redo")},n=()=>{y.current||x(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),H(()=>{const e=f.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=a.current?.getSource();e&&i(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const D=(n,l=!1)=>{const o=S();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(Pe,je(e,t,o[0],o[1])),l&&!r&&C(Te(e,t,o[0],o[1],{text:""}),o,"edit")};/* @__PURE__ */
1
+ import{DEFAULT_COPY_WORDS as e}from"../chunk-AUT242JK.js";import{FieldNumber as t}from"../chunk-66LWADFP.js";import{SettingsSegmented as n,SettingsSwitch as r}from"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import{GoldTextInput as l}from"../chunk-2FZJWH24.js";import{RETIRED_MARKS as o,applyMark as a,STANDARD_MARKUP as s,writeMarkedLines as i,sameMarks as c,markedLines as u,spanFor as d,markupTools as h,marksIn as f,findLink as p,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 D,removeLink as S,linkOver as E,writeLink as C}from"../chunk-546BBOPE.js";import{useWords as N}from"../chunk-MFIRYGHW.js";import{withTip as T}from"../chunk-P2VEMZH5.js";import{Tooltip as M,ColorSwatch as L,ColorPickerPanel as B,Button as A,IconButton as R,registerModalEscapeInterceptor as P,textToolbarRows as O,TextToolbar as j,LinkPicker as z}from"efficient-shell/ui";export{TextToolbar}from"efficient-shell/ui";import{useRef as F,useState as K,useLayoutEffect as W,useEffect as $,useId as H}from"react";import{AlignJustifyIcon as q,AlignRightIcon as V,AlignCenterIcon as I,AlignLeftIcon as U,ParagraphSpacingIcon as Y,LetterSpacingIcon as Z,TextLinesIcon as G,TextSizeIcon as J,ClearMarksIcon as X,LinkIcon as Q,QuietIcon as _,EmphasisIcon as ee,StrikeIcon as te,ItalicIcon as ne,BoldIcon as re}from"efficient-shell/icons/efficient";import{jsx as le,jsxs as oe,Fragment as ae}from"react/jsx-runtime";var se=["left","center","right","justify"],ie=e.align,ce={left:/* @__PURE__ */le(U,{}),center:/* @__PURE__ */le(I,{}),right:/* @__PURE__ */le(V,{}),justify:/* @__PURE__ */le(q,{})},ue={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function de(e,t=ie){return se.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:ce[e],title:t[e]}))}var he=/[\u1100-\u11ff\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/;function fe(e){if(e.every(e=>e.label===ie[e.id]))return e.length>3?ue.four:ue.three;const t=e.map(e=>[...e.label].reduce((e,t)=>e+(he.test(t)?13:8),0));return{labelsPx:t.reduce((e,t)=>e+t,0),widestLabelPx:Math.max(0,...t)}}function pe(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function me(e,t,n,r=a){const{start:l,end:o}=pe(e,n);return r(e,l,o,t)}function ge(e,t,n){const{start:r,end:l}=pe(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}var be=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),ye=/* @__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 ve(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(be.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 f=1===e.nodeType?i.style:null;if(f){const e=f.fontWeight;"bold"===e||"bolder"===e||Number(e)>=600?u=!0:("normal"===e||"lighter"===e||""!==e&&Number(e)<600)&&(u=!1),"italic"===f.fontStyle||"oblique"===f.fontStyle?d=!0:"normal"===f.fontStyle&&(d=!1)}const p=ye.has(c);p&&a();for(const t of[...e.childNodes])s(t,u,d,h);p&&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=ke(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 ke(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 xe="application/x-efficient-markup",we=/^([0-9]{1,3})\. $/;function De(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:we.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 Se(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 Ee(e,t){const[n,r]=Se(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 Ce(e,t){const[n,r]=Se(e,t);let l=0;for(const e of n.chars){if(r===l)return e.at;l+=e.ch.length}return Ee(e,t)}function Ne(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 Te(e,t,n){return[Ne(e,t),Ne(e,n)]}function Me(e,t,n){return t===n?[Ee(e,t),Ee(e,t)]:[Ce(e,t),Ee(e,n)]}function Le(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 Be(e,t,n,r,l){const o=De(e,t),[a,s,h]=Se(o,Math.min(n,r)),[f,p,m]=Se(o,Math.max(n,r)),g=Le(a,s),b=Le(f,p),y=a.chars.slice(0,g),v=f.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 D=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="",C="";for(const e of S){const n=D(e),r=i(n.lines).text;if(E=r,C=n.shown,c(n.lines,De(r,t).lines))break}return{text:E,caret:Math.min(n,r)+C.length}}function Ae(e,t,n,r){const l=De(e,t),[o,,a]=Se(l,n);return n!==r||!o.bullet&&null==o.number||""!==o.text?Be(e,t,n,r,{text:"\n"}):Re(e,t,a,!1,n)}function Re(e,t,n,r,l){const o=De(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 Pe(e,t,n,r){const l=De(e,t),[o,a,s]=Se(l,Math.min(n,r)),[c,u,d]=Se(l,Math.max(n,r)),h=l.lines.slice(s,d+1).map(({bullet:e,number:t,chars:n},r)=>{const l=0===r?Le(o,a):0,i=r===d-s?Le(c,u):n.length;return{bullet:e,number:t,chars:n.slice(l,i)}});return i(h).text}function Oe(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 je(e){const{value:t,rules:n,multiline:r,inputType:l,pending:o}=e;let[a,s]=e.sel;e.target&&e.target[0]!==e.target[1]&&l.startsWith("delete")&&([a,s]=e.target);const i=[a,s];if("historyUndo"===l||"historyRedo"===l)return{kind:"history",dir:"historyUndo"===l?"undo":"redo"};if("formatBold"===l||"formatItalic"===l||"formatStrikeThrough"===l)return{kind:"format",style:"formatBold"===l?"bold":"formatItalic"===l?"italic":"strike"};if("insertParagraph"===l||"insertLineBreak"===l)return r?{kind:"edit",edit:Ae(t,n,a,s),range:i}:null;if(l.startsWith("insert")){if("insertTranspose"===l)return null;let c=e.data??"";if("insertFromDrop"===l||"insertFromPaste"===l){const l=ve({html:e.html??void 0,text:c},{doc:e.doc,multiline:r,rules:n});return{kind:"edit",edit:Be(t,n,a,s,{markup:l}),range:i}}return r||(c=c.replace(/\s*\r?\n\s*/g," ")),{kind:"type",edit:Be(t,n,a,s,{text:c,add:o?.add,drop:o?.drop,color:o?.color}),range:i}}if(l.startsWith("delete")){const e=De(t,n),r=e.text;if(a===s){const o=l.includes("Backward"),c=e.lines.findIndex(e=>a>=e.vis&&a<=e.vis+e.text.length),u=e.lines[c];if(o&&u&&a===u.vis&&(u.bullet||null!=u.number))return{kind:"edit",edit:Re(t,n,c,!1,a),range:i};if(o?0===a:a===r.length)return null;o?a=Oe(r,a,-1):s=Oe(r,s,1)}return{kind:"type",edit:Be(t,n,a,s,{text:""}),range:[a,s]}}return null}function ze(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 Fe(e,t,n,r){const l=e.layout.lines;if(n===t)return r>=e.lines.length?e.layout.text.length:l[r].vis;const o=e.lines.findIndex(e=>e===n||e.contains(n));if(-1===o)return 0;const a=t.ownerDocument.createRange();a.setStart(e.lines[o],0);try{a.setEnd(n,r)}catch{return l[o].vis}return l[o].vis+Math.min(a.toString().length,l[o].text.length)}function Ke(e,t){const n=e.layout.lines;let r=n.length-1;for(let e=0;e<n.length;e+=1)if(t<=n[e].vis+n[e].text.length){r=e;break}let l=Math.max(0,t-n[r].vis);const o=e.lines[r].ownerDocument.createTreeWalker(e.lines[r],4);let a=o.nextNode(),s=null;for(;a;){if(l<=a.data.length)return[a,l];l-=a.data.length,s=a,a=o.nextNode()}return s?[s,s.data.length]:[e.lines[r],0]}function We({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:f}){const p=F(null),m=F(null),g=F(null),b=F(null),y=F(null),v=F(e),[k,x]=K(0),w=F({value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u});w.current={value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u};const D=()=>{const e=p.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=Fe(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?Fe(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},S=(e,t)=>{const n=p.current,r=m.current;if(!n||!r)return;const[l,o]=Ke(r,e),[a,s]=Ke(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};a.current={getSource(){const e=D(),t=m.current;if(!e||!t)return null;const[n,r]=Me(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(){p.current?.focus()},rangeOf(e,t){const n=p.current,r=m.current;if(!n||!r)return null;const[l,o]=Te(r.layout,e,t),[a,s]=Ke(r,l),[i,c]=Ke(r,o),u=n.ownerDocument.createRange();return u.setStart(a,s),u.setEnd(i,c),u}},W(()=>{const n=p.current;if(!n||y.current)return;const r=b.current?null:D();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=ze(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,De(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??Te(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]=Me(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)};$(()=>{const e=p.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=D();if(!s||!i)return;const c="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0,u=c&&!c.collapsed?[Fe(s,e,c.startContainer,c.startOffset),Fe(s,e,c.endContainer,c.endOffset)]:null,d=je({value:n,rules:r,multiline:l,inputType:t.inputType,data:t.data??t.dataTransfer?.getData("text/plain")??"",html:t.dataTransfer?.getData("text/html"),doc:e.ownerDocument,sel:i,target:u,pending:a});d&&("history"!==d.kind?"format"!==d.kind?E(d.edit,d.range,d.kind):w.current.onFormat(d.style):w.current.onHistory(d.dir))},n=()=>{y.current||x(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),$(()=>{const e=p.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 C=(n,l=!1)=>{const o=D();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(xe,Pe(e,t,o[0],o[1])),l&&!r&&E(Be(e,t,o[0],o[1],{text:""}),o,"edit")};/* @__PURE__ */
2
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=S()??[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?C(Te(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=S();if(!o)return;const a=l.clipboardData.getData(Pe),s=a?n?a:a.replace(/\s*\r?\n\s*/g," "):ve({html:l.clipboardData.getData("text/html"),text:l.clipboardData.getData("text/plain")},{doc:l.currentTarget.ownerDocument,multiline:n,rules:t});C(Te(e,t,o[0],o[1],{markup:s}),o,"edit")}})]})}var $e=1e3;function He(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 Ae={fontSize:{key:"fontSize",nameKey:"fontSize",icon:/* @__PURE__ */le(J,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */le(G,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */le(Z,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */le(Y,{}),unit:"px",step:1,shiftStep:10,min:0}};function Ie(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function qe({cells:n,words:r,readOnly:l=!1}){const o=r??e.cells;/* @__PURE__ */
3
+ /* @__PURE__ */le("div",{ref:p,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(),f?.(v.current),void(v.current=e);"Enter"!==t.key||n||(t.preventDefault(),e!==v.current&&h?.(e),v.current=e)},onCompositionStart:()=>{const e=D()??[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(Be(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=>C(e),onCut:e=>C(e,!0),onPaste:l=>{if(l.preventDefault(),r)return;const o=D();if(!o)return;const a=l.clipboardData.getData(xe),s=a?n?a:a.replace(/\s*\r?\n\s*/g," "):ve({html:l.clipboardData.getData("text/html"),text:l.clipboardData.getData("text/plain")},{doc:l.currentTarget.ownerDocument,multiline:n,rules:t});E(Be(e,t,o[0],o[1],{markup:s}),o,"edit")}})]})}var $e=1e3;function He(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(J,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */le(G,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */le(Z,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */le(Y,{}),unit:"px",step:1,shiftStep:10,min:0}};function Ve(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function Ie({cells:n,words:r,readOnly:l=!1}){const o=r??e.cells;/* @__PURE__ */
4
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:Ie(e.value,n),styleValue:Ie(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 Ue=e=>e.preventDefault();function Ve({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__ */
5
+ return le(t,{value:Ve(e.value,n),styleValue:Ve(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 Ue=e=>e.preventDefault();function Ye({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
6
  return oe("div",{className:"es-copy-pop es-copy-colors",role:"dialog","aria-label":n.title,onMouseDown:e=>{"INPUT"!==e.target.tagName&&e.preventDefault()},children:[
7
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(M,{content:`${e.label} · ${e.value.toUpperCase()}`,children:/* @__PURE__ */le(T,{color:e.value,size:"sm",className:"es-copy-theme-swatch","data-color":e.name,"aria-label":e.label,selected:t===e.name,onMouseDown:Ue,onClick:()=>r(e.name)})},e.name))}),
8
+ /* @__PURE__ */le("div",{className:"es-copy-theme",role:"group","aria-label":n.theme,children:e.map(e=>/* @__PURE__ */le(M,{content:`${e.label} · ${e.value.toUpperCase()}`,children:/* @__PURE__ */le(L,{color:e.value,size:"sm",className:"es-copy-theme-swatch","data-color":e.name,"aria-label":e.label,selected:t===e.name,onMouseDown:Ue,onClick:()=>r(e.name)})},e.name))}),
9
9
  /* @__PURE__ */le("span",{className:"es-copy-pop-label",children:n.any}),
10
10
  /* @__PURE__ */le(B,{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(R,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onMouseDown:Ue,onClick:()=>r(null),children:n.remove})})]})}var Ye=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n));var Ze=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom});function Ge(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 Je(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 Xe=/* @__PURE__ */new Set([...o,"clear"]),Qe={bold:/* @__PURE__ */le(re,{size:16}),italic:/* @__PURE__ */le(ne,{size:16}),strike:/* @__PURE__ */le(te,{size:16}),highlight:/* @__PURE__ */le(ee,{size:16}),quiet:/* @__PURE__ */le(_,{size:16}),link:/* @__PURE__ */le(Q,{size:16}),clear:/* @__PURE__ */le(X,{size:16})};function _e(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 et={bold:"is-bold",italic:"is-italic",strike:"is-strike"};function tt({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=>!Xe.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]??Qe[e.style],l=c===e.style||Boolean(i?.[e.style]),o="link"===e.style&&Boolean(i);return L(e.title,/* @__PURE__ */le(j,{onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.style),disabled:r,"aria-label":e.name??e.title,"aria-keyshortcuts":_e(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":et[e.style]?` ${et[e.style]}`:""}${l?" is-active":""}`,children:t??e.label},e.style))}),l?/* @__PURE__ */oe(ae,{children:[
12
- /* @__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 nt({target:e,onChange:t}){const n=W(null);return $(()=>{const t=n.current,r=e.current;t&&r&&r.value===t.text&&(n.current=null,r.focus(),r.setSelectionRange(t.start,t.end))}),r=>{const l=r(e.current);t(l.text),n.current={start:l.selectionStart,end:l.selectionEnd,text:l.text}}}var rt=["bold","italic","underline","strike","sup","sub"];function lt({value:t,onChange:o,onCommit:i,onCancel:c,multiline:u=!1,placeholder:v,ariaLabel:M,className:T,readOnly:B=!1,rules:j,tools:I=[],writeMark:q,actions:U,align:V,glyphs:Y,barLabel:Z,renderFooter:G,inputRef:J,barShows:Q="always",richText:_=!0,defaultShowMarks:ee=!1,toolbar:te="final",colors:ne,cells:re,letterCase:se,lastTool:ie}){const ce="final"===te,ue=N("copy",e),he=W(null),fe=J??he,[be,ye]=K(!1),[ke,xe]=K(null),we=W(He()).current,Se=W(null);H(()=>{const e=Se.current;e&&t===e.to?Se.current=null:e&&t===e.from||(Se.current=null,we.reset())},[t,we]);const Ee=e=>{Se.current={from:Se.current?.from??t,to:e},o(e)},Ce=e=>({text:t,start:e?.selectionStart??ke?.start??t.length,end:e?.selectionEnd??ke?.end??t.length}),[De,Ne]=K(ee),Le=_&&!(u&&De),Me=W(null),Te=A(),[Be,Re]=K(null),[je,Pe]=K(!1),ze=()=>{if(!Le)return fe.current;const e=Me.current?.getSource()??ke;return e?{selectionStart:e.start,selectionEnd:e.end}:null},Oe=nt({target:fe,onChange:Ee}),Fe=e=>(xe({start:e.selectionStart,end:e.selectionEnd}),e),We=(e,n)=>{if(!Le)return void Oe(t=>(n&&we.record(Ce(t),"edit",Date.now()),Fe(e(t))));const r=ze(),l=Fe(e(r));n&&we.record(Ce(r),"edit",Date.now()),Re(null),l.text!==t&&Ee(l.text),Me.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},$e=e=>We(e,!0),Ae=e=>We(t=>{const n=Ce(t),r=we[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),Ie=W(null);$(()=>{const e=Ie.current;e&&(Ie.current=null,Le?Me.current?.setSource(e.start,e.end,t):(fe.current?.focus(),fe.current?.setSelectionRange(e.start,e.end),xe(e)))},[Le]);const[Ue,Qe]=K(null),_e=j??s,et=("string"==typeof I[0]?h(I):I).filter(e=>!Xe.has(e.style)),lt=ce?("string"==typeof I[0]?I:I.map(e=>e.style)).filter(e=>!Xe.has(e)):et.map(e=>e.style),ot={};if(ke&&(Le||ce)){const e=p(t,ke.start,ke.end,_e);for(const t of lt){const n=e.has(t)||"highlight"===t&&e.has("accent");ot[t]=!!Be?.add.includes(t)||!Be?.drop.includes(t)&&n}ce&&(ot.link=e.has("link"))}else if(ke)for(const e of lt)ot[e]="link"===e?null!==f(t,ke.start,ke.end):m(t,ke.start,ke.end,e);const at=()=>{const e=ze(),n=e?.selectionStart??t.length;return{start:n,end:e?.selectionEnd??n}},st={sup:"sub",sub:"sup"},it=e=>{if(ce&&"link"!==e&&d(0,e)){const{start:n,end:r}=at(),l=st[e];if(n===r){if(!Le)return void $e(n=>me(t,e,n,(e,t,n,r)=>a(e,t,n,r,_e,ue.placeholders)));const o=p(t,n,r,_e),s=Be&&Be.at===n?Be: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 Re(u.length||d.length||void 0!==s?.color?{add:u,drop:d,color:s?.color,at:n}:null)}return void $e(()=>{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 $e(n=>me(t,e,n,(e,t,n)=>a(e,t,n,"clear",_e)));if("link"!==e&&Le&&d(0,e)){const n=ze(),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=Be&&Be.at===r?Be: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 Re(i.length||c.length?{add:i,drop:c,at:r}:null)}return void $e(n=>k(t,n?.selectionStart??r,n?.selectionEnd??l,e,_e))}if("link"!==e){const n=q??((e,t,n,r)=>a(e,t,n,r,s,ue.placeholders));return void $e(r=>me(t,e,r,n))}const n=ze(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;Pe(!1),Qe({start:r,end:l,link:f(t,r,l)})},ct=Boolean(ke&&ke.start!==ke.end),ut=ke?g(t,ke.start,ke.end,_e):null,dt=ke?Be&&void 0!==Be.color&&Be.at===ke.start?Be.color:b(t,ke.start,ke.end,_e):null,ht=dt?dt.startsWith("#")?dt:ne?.find(e=>e.name===dt)?.value:void 0,pt=e=>{Le?e?Me.current?.setSource(e.start,e.end,t):Me.current?.focus():(fe.current?.focus(),e&&fe.current?.setSelectionRange(e.start,e.end))},ft=()=>{const e=Ue;Qe(null),pt(e?{start:e.start,end:e.end}:ke)},mt=()=>{const e=bt.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));Pe(!1),t&&pt(ke)},gt=W(mt);gt.current=mt,H(()=>{if(je)return P(e=>{const t=bt.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(gt.current(),!0)},()=>bt.current?.querySelector(".es-copy-colors"))},[je]);const bt=W(null),yt=je||null!==Ue;H(()=>{const e=bt.current;if(!yt||!e)return;const t=e.ownerDocument,n=()=>{Pe(!1),Qe(null)},r=t=>{e.contains(t.target)||n()};let l;const o=r=>{const o=r.relatedTarget;o?e.contains(o)||n():(clearTimeout(l),l=setTimeout(()=>{const r=t.activeElement;t.hasFocus()&&r&&r!==t.body&&!e.contains(r)&&n()},0))};return t.addEventListener("pointerdown",r,!0),e.addEventListener("focusout",o),()=>{clearTimeout(l),t.removeEventListener("pointerdown",r,!0),e.removeEventListener("focusout",o)}},[yt]);const vt=Ue??(je?ke??{start:t.length,end:t.length}:null),kt=W(()=>{});kt.current=()=>{const e=bt.current,t=e?.querySelector(".rosh-tb-wrap > .es-copy-pop");if(!e||!t||!vt)return;const n=Le?null:e.querySelector(".es-gold-layer"),r=Le?Me.current?.rangeOf(vt.start,vt.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,vt.start,vt.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?Ze(t):Ze(n[0])}if(!t)return null;const r=t.getBoundingClientRect();return{left:r.left,top:r.top,right:r.left,bottom:r.bottom}}(r,o?.closest(".es-rich-line, .es-gold-layer")??null):null;if(!a)return;const s=function({anchor:e,size:t,within:n,clip:r,parent:l,gap:o=8}){const a=Math.max(n.left,r.left),s=Math.min(n.right,r.right)-t.width,i=Ye(e.left,a,s),c=r.bottom-(e.bottom+o),u=e.top-o-r.top,d=t.height>c&&(t.height<=u||u>c),h=d?e.top-o-t.height:e.bottom+o,p=e.left+Math.min((e.right-e.left)/2,10),f=Ye(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:Ge(e),parent:Je(t)});t.style.top=`${s.top}px`,t.style.left=`${s.left}px`,t.style.setProperty("--es-pop-point",`${s.point}px`),t.dataset.side=s.above?"above":"below"},$(()=>{const e=bt.current;if(!yt||!e)return;const t=()=>kt.current();t();const n=e.ownerDocument.defaultView;n?.addEventListener("resize",t);const r=e.querySelector(".rosh-tb-wrap > .es-copy-pop"),l=n?.ResizeObserver,o=l&&r?new l(t):null;return o&&r&&o.observe(r),()=>{n?.removeEventListener("resize",t),o?.disconnect()}},[yt,je,Ue,vt?.start,vt?.end,Le]);const xt=e=>Ue&&/* @__PURE__ */le(F,{className:e?"es-copy-link es-copy-pop":"es-copy-link",value:Ue.link?.href??"",onApply:e=>{const n=Ue;Qe(null),$e(()=>Le?C(t,n.start,n.end,e,_e):D(t,n.start,n.end,e))},onRemove:Ue.link?()=>{const e=Ue.link,n=Ue;Qe(null),e&&$e(()=>Le?S(t,n.start,n.end,_e):E(t,e))}:void 0,onCancel:ft}),wt=V?de(V.allow,ue.align):[],St="always"===Q||be||null!==Ue||je,Et=ne&&ne.length>0?{run:ht,open:je,onToggle:()=>{Qe(null),je?mt():Pe(!0)}}:void 0,Ct=St&&ce&&ie?ie({className:"rosh-tb-btn",disabled:B,selected:ct,keepCaret:e=>e.preventDefault(),insert:e=>$e(n=>ge(t,e,n))}):void 0,Dt=new Set(lt),Nt=V?{value:V.value,allow:V.allow,onChange:V.onChange,disabled:V.disabled}:void 0,Lt={pressed:ut,onList:e=>{const{start:n,end:r}=at(),l=g(t,n,r,_e);$e(()=>w(t,n,r,l===e?null:e,_e))}},Mt=z({offered:Dt,color:Et,last:Ct,alignment:Nt,list:Lt,letterCase:se}),Tt=ce&&St&&(rt.some(e=>Dt.has(e))||Boolean(Et));/* @__PURE__ */
13
- return oe("div",{ref:bt,className:"es-copy"+(T?` ${T}`:""),onFocus:()=>ye(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||ye(!1)},onKeyDown:e=>{const t=e.target===fe.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 Ae(l||e.shiftKey?"redo":"undo");const o=`${e.shiftKey?"shift+":""}${n}`;if(ce){const t={b:"bold",i:"italic",u:"underline",k:"link"}[o];if(!t||!lt.includes(t))return;return e.preventDefault(),e.stopPropagation(),void it(t)}const a=et.find(e=>e.shortcut===o);a&&(e.preventDefault(),e.stopPropagation(),it(a.style))},onPaste:e=>{const n=fe.current;if(B||!n||e.target!==n)return;e.preventDefault();const r=ve({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:u,rules:_e});$e(e=>ge(t,r,e))},style:ne&&ne.length>0?Object.fromEntries(ne.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const e=fe.current;e&&e.ownerDocument.activeElement===e&&xe({start:e.selectionStart??t.length,end:e.selectionEnd??t.length})},children:[St&&ce&&(Mt.words||Mt.paragraph)?
14
- /* @__PURE__ */le(O,{className:"es-copy-toolbar","aria-label":Z??ue.formatting,offered:Dt,pressed:ot,onMark:e=>it(e),color:Et,linkOpen:null!==Ue,last:Ct,alignment:Nt,list:Lt,letterCase:se,disabled:B,windows:/* @__PURE__ */oe(ae,{children:[je&&ne&&ne.length>0?/* @__PURE__ */le(Ve,{colors:ne,current:dt,words:ue.colors??e.colors,onPick:e=>{const{start:n,end:r}=at();if(n!==r)$e(()=>x(t,n,r,e,_e));else{if(!Le)return;Re({add:Be?.add??[],drop:Be?.drop??[],color:e,at:n})}}}):null,Ue?xt(!0):null]})}):null,ce&&re&&re.length>0?/* @__PURE__ */le(qe,{cells:re,words:ue.cells??e.cells,readOnly:B}):null,St&&!ce?/* @__PURE__ */le(tt,{tools:I,disabled:B,actions:U,glyphs:Y,ariaLabel:Z,pressed:ot,open:Ue?"link":null,onApply:it,align:V?/* @__PURE__ */le(n,{options:wt,value:V.value,onChange:V.onChange,ariaLabel:ue.alignment,disabled:B||V.disabled,fit:pe(wt)}):null}):null,Le?/* @__PURE__ */le(Ke,{value:t,rules:_e,multiline:u,readOnly:B,placeholder:v,ariaLabel:M,handle:Me,pending:Be??void 0,onEdit:(e,n,r)=>{we.record({text:t,start:n.start,end:n.end},r,Date.now()),Re(null),Ee(e)},onSelect:e=>{xe(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Be||e.start===Be.at&&e.end===Be.at||Re(null)},onHistory:Ae,onFormat:e=>{lt.includes(e)&&it(e)},onCommit:i,onCancel:c}):/* @__PURE__ */le(l,{value:t,onInput:e=>{we.record(Ce(null),"type",Date.now()),Ee(e)},onCommit:i,onCancel:c,multiline:u,placeholder:v,ariaLabel:M,rules:j,disabled:B,inputRef:fe,className:"es-copy-box"}),Ue&&!ce?xt(!1):null,G?G({focused:be,insert:e=>$e(n=>ge(t,e,n))}):null,_&&u||Tt?
11
+ /* @__PURE__ */le("div",{className:"es-copy-pop-foot",children:/* @__PURE__ */le(A,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onMouseDown:Ue,onClick:()=>r(null),children:n.remove})})]})}var Ze=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n));var Ge=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom});function Je(e){const t=e.ownerDocument,n=t.documentElement,r={left:0,top:0,right:n.clientWidth,bottom:n.clientHeight},l=t.defaultView?.getComputedStyle.bind(t.defaultView);for(let o=e.parentElement;o&&o!==n&&o!==t.body;o=o.parentElement){const e=l?.(o);if(!e||"visible"===e.overflowX&&"visible"===e.overflowY)continue;const t=o.getBoundingClientRect();if(0===t.width&&0===t.height)continue;const n=t.left+o.clientLeft,a=t.top+o.clientTop;r.left=Math.max(r.left,n),r.top=Math.max(r.top,a),r.right=Math.min(r.right,n+(o.clientWidth||t.width)),r.bottom=Math.min(r.bottom,a+(o.clientHeight||t.height))}return r}function Xe(e){const t=e.offsetParent??e.parentElement;if(!t)return{left:0,top:0};const n=t.getBoundingClientRect();return{left:n.left+t.clientLeft-t.scrollLeft,top:n.top+t.clientTop-t.scrollTop}}var Qe=/* @__PURE__ */new Set([...o,"clear"]),_e={bold:/* @__PURE__ */le(re,{size:16}),italic:/* @__PURE__ */le(ne,{size:16}),strike:/* @__PURE__ */le(te,{size:16}),highlight:/* @__PURE__ */le(ee,{size:16}),quiet:/* @__PURE__ */le(_,{size:16}),link:/* @__PURE__ */le(Q,{size:16}),clear:/* @__PURE__ */le(X,{size:16})};function et(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 tt={bold:"is-bold",italic:"is-italic",strike:"is-strike"};function nt({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=>!Qe.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]??_e[e.style],l=c===e.style||Boolean(i?.[e.style]),o="link"===e.style&&Boolean(i);return T(e.title,/* @__PURE__ */le(R,{onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.style),disabled:r,"aria-label":e.name??e.title,"aria-keyshortcuts":et(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":tt[e.style]?` ${tt[e.style]}`:""}${l?" is-active":""}`,children:t??e.label},e.style))}),l?/* @__PURE__ */oe(ae,{children:[
12
+ /* @__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 rt({target:e,onChange:t}){const n=F(null);return W(()=>{const t=n.current,r=e.current;t&&r&&r.value===t.text&&(n.current=null,r.focus(),r.setSelectionRange(t.start,t.end))}),r=>{const l=r(e.current);t(l.text),n.current={start:l.selectionStart,end:l.selectionEnd,text:l.text}}}var lt=["bold","italic","underline","strike","sup","sub"];function ot({value:t,onChange:o,onCommit:i,onCancel:c,multiline:u=!1,placeholder:v,ariaLabel:M,className:L,readOnly:B=!1,rules:R,tools:q=[],writeMark:V,actions:I,align:U,glyphs:Y,barLabel:Z,renderFooter:G,inputRef:J,barShows:Q="always",richText:_=!0,defaultShowMarks:ee=!1,toolbar:te="final",colors:ne,cells:re,letterCase:se,lastTool:ie}){const ce="final"===te,ue=N("copy",e),he=F(null),pe=J??he,[be,ye]=K(!1),[ke,xe]=K(null),we=F(He()).current,De=F(null);$(()=>{const e=De.current;e&&t===e.to?De.current=null:e&&t===e.from||(De.current=null,we.reset())},[t,we]);const Se=e=>{De.current={from:De.current?.from??t,to:e},o(e)},Ee=e=>({text:t,start:e?.selectionStart??ke?.start??t.length,end:e?.selectionEnd??ke?.end??t.length}),[Ce,Ne]=K(ee),Te=_&&!(u&&Ce),Me=F(null),Le=H(),[Be,Ae]=K(null),[Re,Pe]=K(!1),Oe=()=>{if(!Te)return pe.current;const e=Me.current?.getSource()??ke;return e?{selectionStart:e.start,selectionEnd:e.end}:null},je=rt({target:pe,onChange:Se}),ze=e=>(xe({start:e.selectionStart,end:e.selectionEnd}),e),Fe=(e,n)=>{if(!Te)return void je(t=>(n&&we.record(Ee(t),"edit",Date.now()),ze(e(t))));const r=Oe(),l=ze(e(r));n&&we.record(Ee(r),"edit",Date.now()),Ae(null),l.text!==t&&Se(l.text),Me.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},Ke=e=>Fe(e,!0),$e=e=>Fe(t=>{const n=Ee(t),r=we[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),qe=F(null);W(()=>{const e=qe.current;e&&(qe.current=null,Te?Me.current?.setSource(e.start,e.end,t):(pe.current?.focus(),pe.current?.setSelectionRange(e.start,e.end),xe(e)))},[Te]);const[Ve,Ue]=K(null),_e=R??s,et=("string"==typeof q[0]?h(q):q).filter(e=>!Qe.has(e.style)),tt=ce?("string"==typeof q[0]?q:q.map(e=>e.style)).filter(e=>!Qe.has(e)):et.map(e=>e.style),ot={};if(ke&&(Te||ce)){const e=f(t,ke.start,ke.end,_e);for(const t of tt){const n=e.has(t)||"highlight"===t&&e.has("accent");ot[t]=!!Be?.add.includes(t)||!Be?.drop.includes(t)&&n}ce&&(ot.link=e.has("link"))}else if(ke)for(const e of tt)ot[e]="link"===e?null!==p(t,ke.start,ke.end):m(t,ke.start,ke.end,e);const at=()=>{const e=Oe(),n=e?.selectionStart??t.length;return{start:n,end:e?.selectionEnd??n}},st={sup:"sub",sub:"sup"},it=e=>{if(ce&&"link"!==e&&d(0,e)){const{start:n,end:r}=at(),l=st[e];if(n===r){if(!Te)return void Ke(n=>me(t,e,n,(e,t,n,r)=>a(e,t,n,r,_e,ue.placeholders)));const o=f(t,n,r,_e),s=Be&&Be.at===n?Be: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 Ae(u.length||d.length||void 0!==s?.color?{add:u,drop:d,color:s?.color,at:n}:null)}return void Ke(()=>{let o=t,a=n,s=r;if(l&&!f(o,a,s,_e).has(e)&&f(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 Ke(n=>me(t,e,n,(e,t,n)=>a(e,t,n,"clear",_e)));if("link"!==e&&Te&&d(0,e)){const n=Oe(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;if(r===l){const n=f(t,r,l,_e),o=n.has(e)||"highlight"===e&&n.has("accent"),a=Be&&Be.at===r?Be: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 Ae(i.length||c.length?{add:i,drop:c,at:r}:null)}return void Ke(n=>k(t,n?.selectionStart??r,n?.selectionEnd??l,e,_e))}if("link"!==e){const n=V??((e,t,n,r)=>a(e,t,n,r,s,ue.placeholders));return void Ke(r=>me(t,e,r,n))}const n=Oe(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;Pe(!1),Ue({start:r,end:l,link:p(t,r,l)})},ct=Boolean(ke&&ke.start!==ke.end),ut=ke?g(t,ke.start,ke.end,_e):null,dt=ke?Be&&void 0!==Be.color&&Be.at===ke.start?Be.color:b(t,ke.start,ke.end,_e):null,ht=dt?dt.startsWith("#")?dt:ne?.find(e=>e.name===dt)?.value:void 0,ft=e=>{Te?e?Me.current?.setSource(e.start,e.end,t):Me.current?.focus():(pe.current?.focus(),e&&pe.current?.setSelectionRange(e.start,e.end))},pt=()=>{const e=Ve;Ue(null),ft(e?{start:e.start,end:e.end}:ke)},mt=()=>{const e=bt.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));Pe(!1),t&&ft(ke)},gt=F(mt);gt.current=mt,$(()=>{if(Re)return P(e=>{const t=bt.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(gt.current(),!0)},()=>bt.current?.querySelector(".es-copy-colors"))},[Re]);const bt=F(null),yt=Re||null!==Ve;$(()=>{const e=bt.current;if(!yt||!e)return;const t=e.ownerDocument,n=()=>{Pe(!1),Ue(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)}},[yt]);const vt=Ve??(Re?ke??{start:t.length,end:t.length}:null),kt=F(()=>{});kt.current=()=>{const e=bt.current,t=e?.querySelector(".rosh-tb-wrap > .es-copy-pop");if(!e||!t||!vt)return;const n=Te?null:e.querySelector(".es-gold-layer"),r=Te?Me.current?.rangeOf(vt.start,vt.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,vt.start,vt.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?Ge(t):Ge(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=Ze(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,f=e.left+Math.min((e.right-e.left)/2,10),p=Ze(f-5-i,10,t.width-10-10);return{top:h-l.top,left:i-l.left,above:d,point:p}}({anchor:a,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:Je(e),parent:Xe(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"},W(()=>{const e=bt.current;if(!yt||!e)return;const t=()=>kt.current();t();const n=e.ownerDocument.defaultView;n?.addEventListener("resize",t);const r=e.querySelector(".rosh-tb-wrap > .es-copy-pop"),l=n?.ResizeObserver,o=l&&r?new l(t):null;return o&&r&&o.observe(r),()=>{n?.removeEventListener("resize",t),o?.disconnect()}},[yt,Re,Ve,vt?.start,vt?.end,Te]);const xt=e=>Ve&&/* @__PURE__ */le(z,{className:e?"es-copy-link es-copy-pop":"es-copy-link",value:Ve.link?.href??"",onApply:e=>{const n=Ve;Ue(null),Ke(()=>Te?E(t,n.start,n.end,e,_e):C(t,n.start,n.end,e))},onRemove:Ve.link?()=>{const e=Ve.link,n=Ve;Ue(null),e&&Ke(()=>Te?D(t,n.start,n.end,_e):S(t,e))}:void 0,onCancel:pt}),wt=U?de(U.allow,ue.align):[],Dt="always"===Q||be||null!==Ve||Re,St=ne&&ne.length>0?{run:ht,open:Re,onToggle:()=>{Ue(null),Re?mt():Pe(!0)}}:void 0,Et=Dt&&ce&&ie?ie({className:"rosh-tb-btn",disabled:B,selected:ct,keepCaret:e=>e.preventDefault(),insert:e=>Ke(n=>ge(t,e,n))}):void 0,Ct=new Set(tt),Nt=U?{value:U.value,allow:U.allow,onChange:U.onChange,disabled:U.disabled}:void 0,Tt={pressed:ut,onList:e=>{const{start:n,end:r}=at(),l=g(t,n,r,_e);Ke(()=>w(t,n,r,l===e?null:e,_e))}},Mt=O({offered:Ct,color:St,last:Et,alignment:Nt,list:Tt,letterCase:se}),Lt=ce&&Dt&&(lt.some(e=>Ct.has(e))||Boolean(St));/* @__PURE__ */
13
+ return oe("div",{ref:bt,className:"es-copy"+(L?` ${L}`:""),onFocus:()=>ye(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||ye(!1)},onKeyDown:e=>{const t=e.target===pe.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 $e(l||e.shiftKey?"redo":"undo");const o=`${e.shiftKey?"shift+":""}${n}`;if(ce){const t={b:"bold",i:"italic",u:"underline",k:"link"}[o];if(!t||!tt.includes(t))return;return e.preventDefault(),e.stopPropagation(),void it(t)}const a=et.find(e=>e.shortcut===o);a&&(e.preventDefault(),e.stopPropagation(),it(a.style))},onPaste:e=>{const n=pe.current;if(B||!n||e.target!==n)return;e.preventDefault();const r=ve({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:u,rules:_e});Ke(e=>ge(t,r,e))},style:ne&&ne.length>0?Object.fromEntries(ne.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const e=pe.current;e&&e.ownerDocument.activeElement===e&&xe({start:e.selectionStart??t.length,end:e.selectionEnd??t.length})},children:[Dt&&ce&&(Mt.words||Mt.paragraph)?
14
+ /* @__PURE__ */le(j,{className:"es-copy-toolbar","aria-label":Z??ue.formatting,offered:Ct,pressed:ot,onMark:e=>it(e),color:St,linkOpen:null!==Ve,last:Et,alignment:Nt,list:Tt,letterCase:se,disabled:B,windows:/* @__PURE__ */oe(ae,{children:[Re&&ne&&ne.length>0?/* @__PURE__ */le(Ye,{colors:ne,current:dt,words:ue.colors??e.colors,onPick:e=>{const{start:n,end:r}=at();if(n!==r)Ke(()=>x(t,n,r,e,_e));else{if(!Te)return;Ae({add:Be?.add??[],drop:Be?.drop??[],color:e,at:n})}}}):null,Ve?xt(!0):null]})}):null,ce&&re&&re.length>0?/* @__PURE__ */le(Ie,{cells:re,words:ue.cells??e.cells,readOnly:B}):null,Dt&&!ce?/* @__PURE__ */le(nt,{tools:q,disabled:B,actions:I,glyphs:Y,ariaLabel:Z,pressed:ot,open:Ve?"link":null,onApply:it,align:U?/* @__PURE__ */le(n,{options:wt,value:U.value,onChange:U.onChange,ariaLabel:ue.alignment,disabled:B||U.disabled,fit:fe(wt)}):null}):null,Te?/* @__PURE__ */le(We,{value:t,rules:_e,multiline:u,readOnly:B,placeholder:v,ariaLabel:M,handle:Me,pending:Be??void 0,onEdit:(e,n,r)=>{we.record({text:t,start:n.start,end:n.end},r,Date.now()),Ae(null),Se(e)},onSelect:e=>{xe(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Be||e.start===Be.at&&e.end===Be.at||Ae(null)},onHistory:$e,onFormat:e=>{tt.includes(e)&&it(e)},onCommit:i,onCancel:c}):/* @__PURE__ */le(l,{value:t,onInput:e=>{we.record(Ee(null),"type",Date.now()),Se(e)},onCommit:i,onCancel:c,multiline:u,placeholder:v,ariaLabel:M,rules:R,disabled:B,inputRef:pe,className:"es-copy-box"}),Ve&&!ce?xt(!1):null,G?G({focused:be,insert:e=>Ke(n=>ge(t,e,n))}):null,_&&u||Lt?
15
15
  /* @__PURE__ */oe("div",{className:"es-copy-marks",children:[_&&u?/* @__PURE__ */oe(ae,{children:[
16
- /* @__PURE__ */le(r,{checked:De,onChange:()=>{const e=ze();Ie.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:ke,Re(null),Ne(e=>!e)},ariaLabelledBy:Te,disabled:B}),
17
- /* @__PURE__ */le("span",{id:Te,className:"es-copy-marks-label",children:ue.showMarks??"Show marks"})]}):null,Tt?L(ct?void 0:ue.clearStyleEmpty??"Select words first",/* @__PURE__ */oe(R,{variant:"secondary",size:"sm",className:"es-copy-clear",disabled:B||!ct,onMouseDown:e=>e.preventDefault(),onClick:()=>{const{start:e,end:n}=at();if(e===n)return;const r=y(t,e,n,_e);r.text!==t&&$e(()=>r)},children:[
18
- /* @__PURE__ */le(X,{size:16}),ue.clearStyle??"Clear style"]})):null]}):null]})}export{se as COPY_ALIGNS,ue as COPY_ALIGN_FIT,ce as COPY_ALIGN_GLYPHS,ie as COPY_ALIGN_LABELS,Ae as COPY_CELLS,Ve as ColorWindow,lt as CopyBox,qe as CopyCells,Pe as MARKUP_CLIPBOARD_TYPE,tt as MarkBar,Ke as RichBox,$e as TYPING_BURST_MS,_e as ariaShortcut,de as copyAlignOptions,He as createHistory,Te as editVisible,ge as insertSelection,me as markSelection,je as markupOfRange,Be as newLine,ve as pasteToMarkup,we as richLayout,Le as selectionToSource,Ne as selectionToVisible,Re as setBullet,Ee as toSource,Ce as toSourceStart,De as toVisible,nt as useCaretEdit};
16
+ /* @__PURE__ */le(r,{checked:Ce,onChange:()=>{const e=Oe();qe.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:ke,Ae(null),Ne(e=>!e)},ariaLabelledBy:Le,disabled:B}),
17
+ /* @__PURE__ */le("span",{id:Le,className:"es-copy-marks-label",children:ue.showMarks??"Show marks"})]}):null,Lt?T(ct?void 0:ue.clearStyleEmpty??"Select words first",/* @__PURE__ */oe(A,{variant:"secondary",size:"sm",className:"es-copy-clear",disabled:B||!ct,onMouseDown:e=>e.preventDefault(),onClick:()=>{const{start:e,end:n}=at();if(e===n)return;const r=y(t,e,n,_e);r.text!==t&&Ke(()=>r)},children:[
18
+ /* @__PURE__ */le(X,{size:16}),ue.clearStyle??"Clear style"]})):null]}):null]})}var at=/^(block|list-item|flex|grid|table|flow-root)$/;function st(e){const t=e.ownerDocument.defaultView;return!!t&&at.test(t.getComputedStyle(e).display)}function it(e){const t=[],n=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;let l="",o=!1;const a=()=>{o&&(l+="\n",o=!1)},s=e=>{for(const i of Array.from(e.childNodes)){if(3===i.nodeType){i.data.length>0&&a(),n.set(i,l.length),t.push({node:i,start:l.length,length:i.data.length}),l+=i.data,r.set(i,l.length);continue}if(1!==i.nodeType)continue;const e=i;if("BR"===e.tagName){a(),n.set(e,l.length),l+="\n",r.set(e,l.length);continue}const c=st(e);c&&((o||l.length>0&&!l.endsWith("\n"))&&(l+="\n"),o=!1),n.set(e,l.length);const u=l.length;s(e),c&&l.length===u&&!o&&t.push({node:e,start:u,length:0}),r.set(e,l.length),c&&(o=!0)}};n.set(e,0),s(e),r.set(e,l.length);return{text:l,at:(e,t)=>{if(3===e.nodeType)return(n.get(e)??0)+Math.min(t,e.data.length);const o=e.childNodes;return t<o.length?n.get(o[t])??r.get(e)??0:r.get(e)??l.length},dom:n=>{for(let e=0;e<t.length;e+=1){const r=t[e],l=r.start+r.length;if(n<r.start)return[r.node,0];if(n<l||n===l&&(e===t.length-1||t[e+1].start>n))return 3===r.node.nodeType?[r.node,n-r.start]:[r.node,0]}const r=t[t.length-1];return r?3===r.node.nodeType?[r.node,r.length]:[r.node,0]:[e,0]}}}function ct(e){const t=e.element();if(!t)return null;let n=e.value;const r=e.rules;if(it(t).text!==De(n,r).text)return null;const l=e.now??(()=>Date.now()),o=He();let a=t,s=!1,i=null,c=null,u=[e.caret[0],e.caret[1]];const d={contenteditable:t.getAttribute("contenteditable"),spellcheck:t.getAttribute("spellcheck")},h=()=>a.ownerDocument,f=()=>h().defaultView?.getSelection()??null,p=()=>{if(!c)return!0;!function(){const t=e.element();if(!t||t===a)return;C(a),a=t,E(a)}();const t=it(a);if(t.text!==De(n,r).text)return!1;const[l,o]=c,[s,i]=t.dom(l),[d,p]=t.dom(o);return h().activeElement!==a&&a.focus({preventScroll:!0}),f()?.setBaseAndExtent(s,i,d,p),u=c,c=null,!0},m=()=>{p();const e=f();if(!(e&&e.anchorNode&&e.focusNode&&a.contains(e.anchorNode)&&a.contains(e.focusNode)))return u;const t=it(a),n=t.at(e.anchorNode,e.anchorOffset),r=t.at(e.focusNode,e.focusOffset);return u=n<=r?[n,r]:[r,n],u},g=(e,t)=>{c=[e,t];const n=e=>{if(s||p())return;const t=h().defaultView;e>0&&t&&t.requestAnimationFrame(()=>n(e-1))};n(30)},b=(t,r,a)=>{t.text!==n?(o.record({text:n,start:r[0],end:r[1]},a,l()),n=t.text,e.write(n),g(t.caret,t.caret)):g(t.caret,t.caret)},y=t=>{n=t.text,e.write(n),g(t.start,t.end)},v=t=>{s||(s=!0,C(a),e.end(t))},x=(e,t)=>{const l=m();!s&&l[0]!==l[1]&&e.clipboardData&&(e.preventDefault(),e.clipboardData.setData("text/plain",De(n,r).text.slice(l[0],l[1])),e.clipboardData.setData(xe,Pe(n,r,l[0],l[1])),t&&b(Be(n,r,l[0],l[1],{text:""}),l,"edit"))},w=e=>e.preventDefault(),D=()=>{e.remount?.()},S=[["keydown",e=>{if(s||e.isComposing)return;const t=e.metaKey||e.ctrlKey;if("Escape"===e.key)return e.preventDefault(),e.stopPropagation(),void v("escape");if("Enter"===e.key&&(!e.shiftKey||t))return e.preventDefault(),e.stopPropagation(),void v("enter");if(t&&("z"===e.key||"Z"===e.key||"y"===e.key)){e.preventDefault(),e.stopPropagation();const t=m(),r={text:n,start:t[0],end:t[1]},l="y"===e.key||e.shiftKey?o.redo(r):o.undo(r);l&&y(l)}}],["beforeinput",t=>{if(s)return;if("insertCompositionText"===t.inputType)return;t.preventDefault();const i=m(),c=it(a),u="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0,d=u&&!u.collapsed?[c.at(u.startContainer,u.startOffset),c.at(u.endContainer,u.endOffset)]:null,f=je({value:n,rules:r,multiline:e.multiline,inputType:t.inputType,data:t.data??t.dataTransfer?.getData("text/plain")??"",html:t.dataTransfer?.getData("text/html"),doc:h(),sel:i,target:d});if(f){if("history"===f.kind){const e={text:n,start:i[0],end:i[1]},t="undo"===f.dir?o.undo(e):o.redo(e);return void(t&&y(t))}if("format"===f.kind){const t=De(n,r),[a,s]=Me(t,i[0],i[1]),c=k(n,a,s,f.style,r);if(c.text===n)return;o.record({text:n,start:i[0],end:i[1]},"edit",l()),n=c.text,e.write(n);const[u,d]=Te(De(n,r),c.selectionStart,c.selectionEnd);return void g(u,d)}b(f.edit,f.range,f.kind)}}],["compositionstart",()=>{i=m()}],["compositionend",t=>{const a=i;if(i=null,!s&&a)if(t.data){const s=Be(n,r,a[0],a[1],{text:t.data});o.record({text:n,start:a[0],end:a[1]},"type",l()),n=s.text,e.write(n),D(),g(s.caret,s.caret)}else D(),g(a[0],a[0])}],["paste",t=>{if(s)return;t.preventDefault();const l=m(),o=t.clipboardData,a=o?.getData(xe)??"",i=a?e.multiline?a:a.replace(/\s*\r?\n\s*/g," "):ve({html:o?.getData("text/html")??"",text:o?.getData("text/plain")??""},{doc:h(),multiline:e.multiline,rules:r});b(Be(n,r,l[0],l[1],{markup:i}),l,"edit")}],["copy",e=>x(e,!1)],["cut",e=>x(e,!0)],["drop",w],["dragstart",w],["blur",t=>{if(s||null!==i)return;const n=t.target,r=n.ownerDocument.defaultView,l=()=>{s||(n.isConnected&&n===e.element()?n.ownerDocument.activeElement!==n&&v("blur"):g(u[0],u[1]))};r?.requestAnimationFrame?r.requestAnimationFrame(l):setTimeout(l,0)}]];function E(e){e.setAttribute("contenteditable","true"),e.setAttribute("spellcheck","false"),e.setAttribute("data-es-typing","");for(const[t,n]of S)e.addEventListener(t,n)}function C(e){for(const[t,n]of S)e.removeEventListener(t,n);null===d.contenteditable?e.removeAttribute("contenteditable"):e.setAttribute("contenteditable",d.contenteditable),null===d.spellcheck?e.removeAttribute("spellcheck"):e.setAttribute("spellcheck",d.spellcheck),e.removeAttribute("data-es-typing")}return E(a),a.focus({preventScroll:!0}),g(e.caret[0],e.caret[1]),{get value(){return n},update(e){if(e===n)return;const t=De(e,r).text.length,[l,a]=m();n=e,o.reset(),g(Math.min(l,t),Math.min(a,t))},stop(e="stop"){v(e)}}}export{se as COPY_ALIGNS,ue as COPY_ALIGN_FIT,ce as COPY_ALIGN_GLYPHS,ie as COPY_ALIGN_LABELS,qe as COPY_CELLS,Ye as ColorWindow,ot as CopyBox,Ie as CopyCells,xe as MARKUP_CLIPBOARD_TYPE,nt as MarkBar,We as RichBox,$e as TYPING_BURST_MS,et as ariaShortcut,de as copyAlignOptions,He as createHistory,Be as editVisible,ge as insertSelection,me as markSelection,Pe as markupOfRange,Ae as newLine,ve as pasteToMarkup,je as richInput,De as richLayout,Me as selectionToSource,Te as selectionToVisible,Re as setBullet,ct as startCanvasTyping,it as textMap,Ee as toSource,Ce as toSourceStart,Ne as toVisible,rt as useCaretEdit};
@@ -62,6 +62,17 @@ interface Easel<C extends EaselConfig = EaselConfig> {
62
62
  * records.
63
63
  */
64
64
  batch: (fn: () => void) => void;
65
+ /**
66
+ * Open a group: every recorded change from now until `close()` becomes ONE
67
+ * undo step, however far apart the changes are — where `batch` is one
68
+ * synchronous call, a group spans time. A typing session on the canvas
69
+ * writes on every key and is one edit to undo. A group with no change in it
70
+ * adds no step; the step after a closed group is its own; `close()` again
71
+ * does nothing.
72
+ */
73
+ group: () => {
74
+ close: () => void;
75
+ };
65
76
  /** Select a node by id, or nothing. Selection is not an undo step. */
66
77
  select: (id: string | null) => void;
67
78
  /** Select a slot — a column — or nothing. */
@@ -1 +1 @@
1
- export{CanvasFrame,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,bindUndoKeys,createEasel,createUseEasel,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useSelectedFields,validSelection}from"../chunk-RAFTHQVR.js";import"../chunk-AELNNAFM.js";import"../chunk-YRLPFZW3.js";import"../chunk-UK2FQOUT.js";import"../chunk-MFIRYGHW.js";import"../chunk-ZNCEOSXO.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
1
+ export{CanvasFrame,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,bindUndoKeys,createEasel,createUseEasel,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useSelectedFields,validSelection}from"../chunk-4XIIBGDO.js";import"../chunk-AELNNAFM.js";import"../chunk-YRLPFZW3.js";import"../chunk-UK2FQOUT.js";import"../chunk-MFIRYGHW.js";import"../chunk-ZNCEOSXO.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{AddIcon,LayersIcon,MediaIcon,PageIcon as PagesIcon,SitemapIcon,StylesIcon,railCssVars,railTokens}from"./chunk-4VJATVVR.js";export{SPACING_SCALE,shellCssVars,shellDarkTokens,shellTokens}from"./chunk-HMXIAMCU.js";export{EaselRail,EaselRailButton}from"./chunk-MJM6SFD3.js";import"./chunk-2OAZYSWJ.js";
1
+ export{SPACING_SCALE,shellCssVars,shellDarkTokens,shellTokens}from"./chunk-HMXIAMCU.js";export{AddIcon,LayersIcon,MediaIcon,PageIcon as PagesIcon,SitemapIcon,StylesIcon,railCssVars,railTokens}from"./chunk-4VJATVVR.js";export{EaselRail,EaselRailButton}from"./chunk-MJM6SFD3.js";import"./chunk-2OAZYSWJ.js";
@@ -1 +1 @@
1
- export{AddBlockRow as default}from"../../chunk-AL65NE2M.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-CVBKSCAY.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-MCHMF32I.js";import"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{AddBlockRow as default}from"../../chunk-G3D2HWEO.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-YFK74XOM.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-MCHMF32I.js";import"../../chunk-4XIIBGDO.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{blockKey,AddSidePanel as default,sectionKey,templateKey}from"../../chunk-SYDZ5YWX.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-CVBKSCAY.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-MCHMF32I.js";import"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-MOCX5MQ7.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{blockKey,AddSidePanel as default,sectionKey,templateKey}from"../../chunk-2DHJC5YS.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-YFK74XOM.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-MCHMF32I.js";import"../../chunk-4XIIBGDO.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-MOCX5MQ7.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{MediaSidePanel as default}from"../../chunk-3CS5BQMF.js";import"../../chunk-CVBKSCAY.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{MediaSidePanel as default}from"../../chunk-3I6DVDUR.js";import"../../chunk-YFK74XOM.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-4XIIBGDO.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{ScreenChrome as default}from"../../chunk-ATVN7L2J.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-BXQBCW3P.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-PAM3NLFL.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-SQM6APQW.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-6TOYXESC.js";import"../../chunk-LNKCGJYU.js";import"../../chunk-RSDDVLT7.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-MTRFMGBO.js";import"../../chunk-HQWQLDCB.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-WZMU646D.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-V7U33NF2.js";import"../../chunk-5545A3PC.js";import"../../chunk-SYDZ5YWX.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-3CS5BQMF.js";import"../../chunk-CVBKSCAY.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-MCHMF32I.js";import"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-4VJATVVR.js";import"../../chunk-BDTITTMW.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-MOCX5MQ7.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{ScreenChrome as default}from"../../chunk-7EKLESDL.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-BXQBCW3P.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-PAM3NLFL.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-RKXIB5BN.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-6TOYXESC.js";import"../../chunk-MHU7S7JL.js";import"../../chunk-EYRQ4XGN.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-MTRFMGBO.js";import"../../chunk-HQWQLDCB.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-WZMU646D.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-V7U33NF2.js";import"../../chunk-5545A3PC.js";import"../../chunk-2DHJC5YS.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-3I6DVDUR.js";import"../../chunk-YFK74XOM.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-MCHMF32I.js";import"../../chunk-4XIIBGDO.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-4VJATVVR.js";import"../../chunk-BDTITTMW.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-MOCX5MQ7.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{DocumentScreen,ScreenMount as default}from"../../chunk-74A4LGYT.js";import"../../chunk-GXQCZJOP.js";import"../../chunk-7YFUG75W.js";import"../../chunk-ATVN7L2J.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-BXQBCW3P.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-PAM3NLFL.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-SQM6APQW.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-6TOYXESC.js";import"../../chunk-LNKCGJYU.js";import"../../chunk-RSDDVLT7.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-MTRFMGBO.js";import"../../chunk-HQWQLDCB.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-WZMU646D.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-V7U33NF2.js";import"../../chunk-5545A3PC.js";import"../../chunk-SYDZ5YWX.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-3CS5BQMF.js";import"../../chunk-CVBKSCAY.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-MCHMF32I.js";import"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-4VJATVVR.js";import"../../chunk-BDTITTMW.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-MOCX5MQ7.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{DocumentScreen,ScreenMount as default}from"../../chunk-ZTG2K3NL.js";import"../../chunk-GXQCZJOP.js";import"../../chunk-QBW3RJG5.js";import"../../chunk-7EKLESDL.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-BXQBCW3P.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-PAM3NLFL.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-RKXIB5BN.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-6TOYXESC.js";import"../../chunk-MHU7S7JL.js";import"../../chunk-EYRQ4XGN.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-MTRFMGBO.js";import"../../chunk-HQWQLDCB.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-WZMU646D.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-V7U33NF2.js";import"../../chunk-5545A3PC.js";import"../../chunk-2DHJC5YS.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-PFNIVZPN.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-3I6DVDUR.js";import"../../chunk-YFK74XOM.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-MCHMF32I.js";import"../../chunk-4XIIBGDO.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-4VJATVVR.js";import"../../chunk-BDTITTMW.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-MOCX5MQ7.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{ScreenStoreProvider as default}from"../../chunk-7YFUG75W.js";import"../../chunk-CVBKSCAY.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{ScreenStoreProvider as default}from"../../chunk-QBW3RJG5.js";import"../../chunk-YFK74XOM.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-4XIIBGDO.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";