efficient-easel 5.1.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import{MARKUP_TOOLS as e,MARK_PLACEHOLDERS as t}from"./chunk-546BBOPE.js";var r={formatting:"Formatting",alignment:"Alignment",align:{left:"Left",center:"Center",right:"Right",justify:"Justify"},marks:{...Object.fromEntries(e.map(e=>[e.style,{name:e.name??e.title,title:e.title}])),underline:{name:"Underline",title:"Underline · [words]{underline}"},sup:{name:"Superscript",title:"Superscript · [words]{sup}"},sub:{name:"Subscript",title:"Subscript · [words]{sub}"}},placeholders:t,showMarks:"Show marks",clearStyle:"Clear style",clearStyleEmpty:"Select words first",colors:{title:"Color",theme:"Theme colors",remove:"Remove",any:"Any color",square:"Saturation and brightness",hue:"Hue",hex:"Hex color"},cells:{fontSize:"Font size",lineHeight:"Line spacing",letterSpacing:"Letter spacing",paragraphSpacing:"Paragraph spacing",tip:({name:e,step:t,unit:r})=>`${e} · step ${t} ${r} · Shift ×10`}};export{r as DEFAULT_COPY_WORDS};
@@ -1 +1 @@
1
- import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-M6F6LS3H.js";import{DEFAULT_PICK_WORDS as r}from"./chunk-ZAOM6PFH.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-MCHMF32I.js";import{DEFAULT_CANVAS_WORDS as n}from"./chunk-AELNNAFM.js";import{DEFAULT_TREE_WORDS as c}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as s}from"./chunk-KFV7N2DJ.js";import{DEFAULT_NODE_MENU_WORDS as f}from"./chunk-WK3AFPXY.js";import{DEFAULT_SAVE_WORDS as p}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as e,DEFAULT_NOTICE_WORDS as i}from"./chunk-Y2G7CU6A.js";import{DEFAULT_LOCK_WORDS as u}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as k}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as j}from"./chunk-JZDEIRH4.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-FFYXVAAL.js";import{DEFAULT_DRAG_WORDS as l}from"./chunk-O2NLQBFX.js";var F={notice:i,lock:u,save:p,chrome:e,rail:k,tree:c,panel:s,fields:h,pick:r,drag:l,menu:f,styleClipboard:t,copy:j,canvas:n,textStyles:o,screen:m},a=o=>"object"==typeof o&&null!==o;function A(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:a(n)?t[m]=a(c)?A(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function y(o,r){return r?A(o,r):o}export{F as DEFAULT_EASEL_STRINGS,y as mergeEaselStrings};
1
+ import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-M6F6LS3H.js";import{DEFAULT_PICK_WORDS as r}from"./chunk-ZAOM6PFH.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-MCHMF32I.js";import{DEFAULT_CANVAS_WORDS as n}from"./chunk-AELNNAFM.js";import{DEFAULT_TREE_WORDS as c}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as s}from"./chunk-KFV7N2DJ.js";import{DEFAULT_NODE_MENU_WORDS as f}from"./chunk-WK3AFPXY.js";import{DEFAULT_SAVE_WORDS as p}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as e,DEFAULT_NOTICE_WORDS as i}from"./chunk-Y2G7CU6A.js";import{DEFAULT_LOCK_WORDS as u}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as k}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as j}from"./chunk-AUT242JK.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-FFYXVAAL.js";import{DEFAULT_DRAG_WORDS as l}from"./chunk-O2NLQBFX.js";var F={notice:i,lock:u,save:p,chrome:e,rail:k,tree:c,panel:s,fields:h,pick:r,drag:l,menu:f,styleClipboard:t,copy:j,canvas:n,textStyles:o,screen:m},A=o=>"object"==typeof o&&null!==o;function a(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:A(n)?t[m]=A(c)?a(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function y(o,r){return r?a(o,r):o}export{F as DEFAULT_EASEL_STRINGS,y as mergeEaselStrings};
@@ -370,144 +370,18 @@
370
370
  /* — the final toolbar (E5b, design final 2026-10-06) — */
371
371
 
372
372
  /*
373
- * TWO ROWS ON ONE 9-COLUMN GRID, flush to the box at both ends: in two full
374
- * rows every button sits under the one above it. The size is react-os-shell's
375
- * IconButton md (`--es-copy-mark-size`, 32px), the size the design draws in a
376
- * 320px panel.
377
- *
378
- * NO BLANK CELLS (Lewis 2026-10-13): a tool the host does not offer is not
379
- * drawn. The row keeps its explicit tracks, so the tools it has fill the first
380
- * tracks: packed from the row's start, at a full row's size and gap, never
381
- * stretched to the far end. A row with no tool is not drawn (TextToolbar).
373
+ * The toolbar is efficient-shell's `TextToolbar` (S4/E2, harness UI-24): its
374
+ * grid, its sizes, its narrow step and its colour fill are the shell's sheet
375
+ * (`.rosh-tb-*` in ui.css), held by the shell's own specs. Its wrapper is the
376
+ * size container; its direct children carry `--rosh-tb-size`,
377
+ * `--rosh-tb-steps`, `--rosh-tb-color-col` and `--rosh-tb-link-col`, and the
378
+ * two windows below are drawn among them, so they read those. What stays here
379
+ * is the toolbar's place in the box: the gap under it.
382
380
  */
383
- .es-tb-wrap {
384
- /*
385
- * The button size: react-os-shell's IconButton md (32px) — but never more
386
- * than a ninth of the row, so the row is FLUSH to the box at both ends. A
387
- * 320px panel's box is 286px (its 1px border takes two), and nine 32px
388
- * buttons would overrun it by 2px; here they are 31.8px. On the WRAPPER, so
389
- * the two windows, which sit beside the toolbar, read it too.
390
- */
391
- --es-tb-size: min(var(--es-copy-mark-size), calc(100cqw / 9));
392
- /* The gaps across row 1, for the windows' points (below). */
393
- --es-tb-steps: 8;
394
- position: relative;
381
+ .es-copy-toolbar {
395
382
  margin-bottom: var(--es-copy-gap);
396
383
  }
397
384
 
398
- .es-tb {
399
- display: flex;
400
- flex-direction: column;
401
- gap: var(--es-space-4, 4px);
402
- }
403
-
404
- .es-tb-row {
405
- display: grid;
406
- grid-template-columns: repeat(9, var(--es-tb-size));
407
- justify-content: space-between;
408
- }
409
-
410
- /* Row 1 with no host control in its 9th cell (owner ruling 2026-10-07):
411
- eight buttons spread over the same width, not eight and a hole. The
412
- wrapper carries it too, so the windows' points follow the buttons. */
413
- .es-tb-row.is-eight {
414
- grid-template-columns: repeat(8, var(--es-tb-size));
415
- }
416
-
417
- .es-tb-wrap.is-eight {
418
- --es-tb-steps: 7;
419
- }
420
-
421
- /*
422
- * ONE ROW (Lewis 2026-10-13, on the phone paragraph: "can't they go up?").
423
- * When the word tools, one gap cell and the paragraph tools fit the nine
424
- * cells (TextToolbar's `toolbarRows`), both groups share ONE row: the words,
425
- * then the group gap, then the paragraph tools. The gap is the toolbar gap
426
- * token (8px, the 2026-10-12 spacing roles), owned by the row (UI-23). Inside
427
- * each group the buttons keep the nine-cell grid's size and pitch, packed
428
- * from the start, never stretched to the far end. The windows' points use
429
- * that pitch: eight steps across nine cells.
430
- */
431
- .es-tb-row.is-one-row {
432
- display: flex;
433
- justify-content: flex-start;
434
- column-gap: var(--es-space-8, 8px);
435
- }
436
-
437
- .es-tb-words,
438
- .es-tb-para {
439
- display: flex;
440
- column-gap: calc((100cqw - 9 * var(--es-tb-size)) / 8);
441
- }
442
-
443
- .es-tb-wrap.is-one-row {
444
- --es-tb-steps: 8;
445
- }
446
-
447
- /*
448
- * FLOW-FILL (Lewis 2026-10-13: "If there is a second row, the first row must
449
- * not leave blank space"; "The second row does not need to be filled. Just
450
- * let it run in natural order."). When the tools do not fit one row, the
451
- * toolbar is ONE grid of nine cells a line: the word tools, one cell for the
452
- * group gap (`.es-tb-flowgap`), then the paragraph tools. Line 1 is always
453
- * nine cells, flush to the box at both ends; the rest run on in line 2 from
454
- * its start, in the same nine tracks, so at the normal pitch and never
455
- * spread. The lines are the toolbar's 4px apart. The windows' points use the
456
- * nine-cell pitch.
457
- */
458
- .es-tb-row.is-flow {
459
- row-gap: var(--es-space-4, 4px);
460
- }
461
-
462
- .es-tb-wrap.is-flow {
463
- --es-tb-steps: 8;
464
- }
465
-
466
- /* The alignment and case groups are radiogroups for a screen reader and
467
- nothing for the grid: their buttons are cells of the row. */
468
- .es-tb-group {
469
- display: contents;
470
- }
471
-
472
- /* A toolbar button is efficient-shell's IconButton look (harness UI-24): its
473
- ground, hover, focus ring, disabled fade and lit state are the kit's
474
- (`IconButton`, lit from `aria-pressed`, or from `pressed` for a radio and
475
- a window's button).
476
- What stays is its size in the 9-column grid and the glyph inside. */
477
- .es-tb-btn {
478
- width: var(--es-tb-size);
479
- height: var(--es-tb-size);
480
- }
481
-
482
- .es-tb-btn svg {
483
- width: 16px;
484
- height: 16px;
485
- }
486
-
487
- /* The letter A is filled with the colour the selected words wear: the
488
- glyph's `data-part="swatch"` (efficient-shell 7.4.0, #414). No fallback:
489
- with no colour the A stays hollow, so "no colour" is not black. */
490
- .es-tb-color [data-part="swatch"] {
491
- fill: var(--es-tb-run);
492
- }
493
-
494
- /*
495
- * A NARROW BOX keeps both rows and shrinks the buttons a little — never wraps.
496
- * The design: under a 300px panel, the shell's next size down (24px), and no
497
- * wider than a ninth of the row. A 300px panel less its two 16px gutters is a
498
- * 268px box: `.es-copy` is the container that measures it.
499
- */
500
- @container (width < 268px) {
501
- .es-tb-wrap {
502
- --es-tb-size: min(var(--control-height-sm, 24px), calc(100cqw / 9));
503
- }
504
-
505
- .es-tb-btn svg {
506
- width: 14px;
507
- height: 14px;
508
- }
509
- }
510
-
511
385
  /*
512
386
  * THE TWO WINDOWS (colour, link) float, pushing nothing down. They open just
513
387
  * BELOW the words they act on, left-aligned to them, or ABOVE them with no
@@ -522,7 +396,7 @@
522
396
  position: absolute;
523
397
  z-index: 5;
524
398
  left: 0;
525
- top: calc(var(--es-tb-size) + var(--es-space-8));
399
+ top: calc(var(--rosh-tb-size) + var(--es-space-8));
526
400
  box-sizing: border-box;
527
401
  width: 288px;
528
402
  max-width: 100%;
@@ -538,10 +412,10 @@
538
412
  }
539
413
 
540
414
  /* The point, aimed at its button: column k of row 1 across the box (100cqw),
541
- whose cells are `--es-tb-steps` + 1 (nine, or eight with no host control).
415
+ whose cells are `--rosh-tb-steps` + 1 (nine, or eight with no host control).
542
416
  Row 1 draws only what the host offers, so k is the button's column as
543
- drawn: CopyBox writes `--es-tb-color-col` and `--es-tb-link-col` on the
544
- wrapper (TextToolbar's `windowColumns`), never a fixed 4 or 5. */
417
+ drawn: the shell's toolbar writes `--rosh-tb-color-col` and `--rosh-tb-link-col` on
418
+ its wrapper (`textToolbarWindowColumns`), never a fixed 4 or 5. */
545
419
  .es-copy-pop::before {
546
420
  content: '';
547
421
  position: absolute;
@@ -556,11 +430,11 @@
556
430
 
557
431
  /* Aimed at the words (measured), or — unmeasured — at its button, as above. */
558
432
  .es-copy-colors::before {
559
- left: var(--es-pop-point, calc(var(--es-tb-color-col) * (100cqw - var(--es-tb-size)) / var(--es-tb-steps) + var(--es-tb-size) / 2 - 6px));
433
+ left: var(--es-pop-point, calc(var(--rosh-tb-color-col) * (100cqw - var(--rosh-tb-size)) / var(--rosh-tb-steps) + var(--rosh-tb-size) / 2 - 6px));
560
434
  }
561
435
 
562
436
  .es-copy-link.es-copy-pop::before {
563
- left: var(--es-pop-point, calc(var(--es-tb-link-col) * (100cqw - var(--es-tb-size)) / var(--es-tb-steps) + var(--es-tb-size) / 2 - 6px));
437
+ left: var(--es-pop-point, calc(var(--rosh-tb-link-col) * (100cqw - var(--rosh-tb-size)) / var(--rosh-tb-steps) + var(--rosh-tb-size) / 2 - 6px));
564
438
  }
565
439
 
566
440
  /* Opened above the words: the point is on the bottom edge, aimed down. */
@@ -1,8 +1,10 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { MarkStyle, MarkupTool, WrapResult, InlineRule, MarkedLine } from '../markup/index.js';
4
- import { C as CopyWords, a as CopyAlign } from '../words-lpvYzf5U.js';
5
- export { b as COPY_ALIGNS, c as COPY_ALIGN_FIT, d as COPY_ALIGN_GLYPHS, e as COPY_ALIGN_LABELS, f as copyAlignOptions } from '../words-lpvYzf5U.js';
4
+ import { C as CopyWords, a as CopyAlign } from '../words-BAnsDT16.js';
5
+ export { b as COPY_ALIGNS, c as COPY_ALIGN_FIT, d as COPY_ALIGN_GLYPHS, e as COPY_ALIGN_LABELS, f as copyAlignOptions } from '../words-BAnsDT16.js';
6
+ import { TextToolbarCase, TextToolbarMark } from 'efficient-shell/ui';
7
+ export { TextToolbar, TextToolbarProps } from 'efficient-shell/ui';
6
8
 
7
9
  type CellWords = NonNullable<CopyWords['cells']>;
8
10
  interface CopyCell {
@@ -60,51 +62,6 @@ declare function ColorWindow({ colors, current, words, onPick, }: {
60
62
  onPick: (color: string | null) => void;
61
63
  }): react.JSX.Element;
62
64
 
63
- /** The marks row 1 can carry, in the order drawn. */
64
- type ToolbarMark = 'bold' | 'italic' | 'underline' | 'strike' | 'link' | 'sup' | 'sub';
65
- /** A letter case the toolbar sets on the host's field. */
66
- type CopyCase = 'none' | 'upper' | 'lower';
67
- interface TextToolbarProps {
68
- words: NonNullable<CopyWords['toolbar']>;
69
- align: Record<CopyAlign, string>;
70
- /** The alignment group's accessible name (`copy.alignment`). */
71
- alignmentLabel: string;
72
- /** The marks the host offers. */
73
- offered: ReadonlySet<string>;
74
- /** The marks the selection wears (or a pending press set). */
75
- pressed: Partial<Record<string, boolean>>;
76
- onMark: (style: ToolbarMark) => void;
77
- /** The colour button, when the host hands colours. `run` fills the A (the glyph's `data-part="swatch"`). */
78
- color?: {
79
- run?: string;
80
- open: boolean;
81
- onToggle: () => void;
82
- };
83
- linkOpen: boolean;
84
- /** The host's own control for row 1's 9th cell. Left out: row 1 is eight
85
- * buttons, spread over the row. */
86
- last?: ReactNode;
87
- alignment?: {
88
- value: CopyAlign | '';
89
- allow: readonly CopyAlign[];
90
- onChange: (next: CopyAlign) => void;
91
- disabled?: boolean;
92
- };
93
- /** The list the selection's lines are in, and the presses. */
94
- list?: {
95
- pressed: 'bullet' | 'number' | null;
96
- onList: (kind: 'bullet' | 'number') => void;
97
- };
98
- letterCase?: {
99
- value: CopyCase | '';
100
- onChange: (next: CopyCase | '') => void;
101
- disabled?: boolean;
102
- };
103
- disabled?: boolean;
104
- ariaLabel?: string;
105
- }
106
- declare function TextToolbar({ words, align: alignWords, alignmentLabel, offered, pressed, onMark, color, linkOpen, last, alignment, list, letterCase, disabled, ariaLabel, }: TextToolbarProps): react.JSX.Element | null;
107
-
108
65
  /** `'b'` → `Meta+B`, `'shift+x'` → `Meta+Shift+X` — the ARIA spelling of a
109
66
  * shortcut. Meta is what the tooltips promise (⌘); Ctrl works too. */
110
67
  declare function ariaShortcut(shortcut: string | undefined): string | undefined;
@@ -221,6 +178,10 @@ declare function markSelection(value: string, style: MarkStyle, el: SelectionSou
221
178
  */
222
179
  declare function insertSelection(value: string, text: string, el: SelectionSource): WrapResult;
223
180
 
181
+ /** A letter case the toolbar sets on the host's field: the shell toolbar's. */
182
+ type CopyCase = TextToolbarCase;
183
+ /** The marks row 1 of the toolbar carries: the shell toolbar's. */
184
+ type ToolbarMark = TextToolbarMark;
224
185
  /**
225
186
  * A handle on the box's textarea.
226
187
  *
@@ -630,4 +591,4 @@ interface CaretEdit {
630
591
  */
631
592
  declare function useCaretEdit({ target, onChange }: CaretEdit): (edit: (el: HTMLInputElement | HTMLTextAreaElement | null) => WrapResult) => void;
632
593
 
633
- 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, TextToolbar, type TextToolbarProps, type ToolbarMark, ariaShortcut, createHistory, editVisible, insertSelection, markSelection, markupOfRange, newLine, pasteToMarkup, richLayout, selectionToSource, selectionToVisible, setBullet, toSource, toSourceStart, toVisible, useCaretEdit };
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 };
@@ -1,21 +1,18 @@
1
- import{DEFAULT_COPY_WORDS as e}from"../chunk-JZDEIRH4.js";import{FieldNumber as t}from"../chunk-66LWADFP.js";import{SettingsSegmented as n,SettingsSwitch as r}from"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import{GoldTextInput as l}from"../chunk-2FZJWH24.js";import{RETIRED_MARKS as o,applyMark as a,STANDARD_MARKUP as s,writeMarkedLines as i,sameMarks as c,markedLines as u,spanFor as d,markupTools as h,marksIn as p,findLink as f,markedAt as m,listIn as g,colorIn as b,clearStyle as v,isSafeLinkHref as y,toggleMark as k,colorOver as w,setList as x,unlinkAt as C,removeLink as D,linkOver as S,writeLink as E}from"../chunk-546BBOPE.js";import{useWords as N}from"../chunk-MFIRYGHW.js";import{withTip as M}from"../chunk-P2VEMZH5.js";import{Tooltip as L,ColorSwatch as T,ColorPickerPanel as B,Button as R,IconButton as j,registerModalEscapeInterceptor as P,LinkPicker as z}from"efficient-shell/ui";import{useRef as O,useState as F,useLayoutEffect as K,useEffect as W,useId as $}from"react";import{AlignJustifyIcon as H,AlignRightIcon as A,AlignCenterIcon as I,AlignLeftIcon as U,ParagraphSpacingIcon as q,LetterSpacingIcon as V,TextLinesIcon as Y,TextSizeIcon as Z,CaseNormalIcon as G,CaseUpperIcon as J,CaseLowerIcon as X,TextColorIcon as Q,ListIcon as _,NumberedListIcon as ee,ClearMarksIcon as te,BoldIcon as ne,ItalicIcon as re,UnderlineIcon as le,StrikeIcon as oe,LinkIcon as ae,SuperscriptIcon as se,SubscriptIcon as ie,QuietIcon as ce,EmphasisIcon as ue}from"efficient-shell/icons/efficient";import{jsx as de,jsxs as he,Fragment as pe}from"react/jsx-runtime";var fe=["left","center","right","justify"],me=e.align,ge={left:/* @__PURE__ */de(U,{}),center:/* @__PURE__ */de(I,{}),right:/* @__PURE__ */de(A,{}),justify:/* @__PURE__ */de(H,{})},be={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function ve(e,t=me){return fe.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:ge[e],title:t[e]}))}var ye=/[\u1100-\u11ff\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/;function ke(e){if(e.every(e=>e.label===me[e.id]))return e.length>3?be.four:be.three;const t=e.map(e=>[...e.label].reduce((e,t)=>e+(ye.test(t)?13:8),0));return{labelsPx:t.reduce((e,t)=>e+t,0),widestLabelPx:Math.max(0,...t)}}function we(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function xe(e,t,n,r=a){const{start:l,end:o}=we(e,n);return r(e,l,o,t)}function Ce(e,t,n){const{start:r,end:l}=we(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}var De=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),Se=/* @__PURE__ */new Set(["p","div","li","ul","ol","dl","dt","dd","h1","h2","h3","h4","h5","h6","blockquote","pre","table","thead","tbody","tfoot","tr","section","article","header","footer","aside","nav","figure","figcaption","address","hr"]);function Ee(e,t){const n=t.rules??s,r=e.html&&""!==e.html.trim()?function(e,t,n){const r=t.createElement("template");r.innerHTML=e;const l=[[]],o=()=>l[l.length-1],a=()=>{const e=o();for(;e.length>0&&" "===e[e.length-1].ch;)e.pop();e.length>0&&l.push([])},s=(e,t,n,r)=>{if(3===e.nodeType){for(const a of e.textContent??""){const e=/\s/.test(a)?" ":a,s=o();" "===e&&(0===s.length&&l.length>1||" "===s[s.length-1]?.ch)||s.push({ch:e,bold:t,italic:n,href:r})}return}if(1!==e.nodeType&&11!==e.nodeType)return;const i=e,c=1===e.nodeType?i.localName:"";if(De.has(c))return;if("br"===c)return void l.push([]);let u=t,d=n,h=r;if("b"!==c&&"strong"!==c||(u=!0),"i"!==c&&"em"!==c||(d=!0),"a"===c){const e=(i.getAttribute("href")??"").trim();h=y(e)?e:null}const p=1===e.nodeType?i.style:null;if(p){const e=p.fontWeight;"bold"===e||"bolder"===e||Number(e)>=600?u=!0:("normal"===e||"lighter"===e||""!==e&&Number(e)<600)&&(u=!1),"italic"===p.fontStyle||"oblique"===p.fontStyle?d=!0:"normal"===p.fontStyle&&(d=!1)}const f=Se.has(c);f&&a();for(const t of[...e.childNodes])s(t,u,d,h);f&&a()};s(r.content,!1,!1,null);for(;l.length>1&&0===l[l.length-1].length;)l.pop();return l.map(e=>function(e,t){const n=t=>e.map((n,r)=>n[t]&&(" "!==n.ch||Boolean(e[r-1]?.[t])&&Boolean(e[r+1]?.[t]))),r=[{bold:!0,italic:!0,links:!0},{bold:!0,italic:!1,links:!0},{bold:!1,italic:!1,links:!0},{bold:!1,italic:!1,links:!1}];for(const l of r){const r=Ne(e,l.bold?n("bold"):null,l.italic?n("italic"):null,l.links),o=i([r]).text;if(c([r],u(o,t)))return o}return e.map(e=>e.ch).join("")}(e,n))}(e.html,t.doc,n):(e.text??"").replace(/\r\n?/g,"\n").split("\n");return t.multiline?r.join("\n"):1===r.length?r[0]:r.map(e=>e.trim()).filter(e=>""!==e).join(" ")}function Ne(e,t,n,r){let l=0,o=null,a=null,s=null;return{bullet:!1,chars:e.map((e,i)=>{const c=r?e.href:null;return o=null===c?null:o&&o.href===c?o:d(++l,"link",c),a=t?.[i]?a??d(++l,"bold"):null,s=n?.[i]?s??d(++l,"italic"):null,{ch:e.ch,at:-1,marks:[o,a,s].filter(e=>null!==e)}})}}var Me=/^([0-9]{1,3})\. $/;function Le(e,t){const n=e.split("\n"),r=u(e,t);let l=0,o=0;const a=r.map((e,t)=>{const r=!e.bullet&&null==e.number&&"- "===n[t],a=null!=e.number||e.bullet?null:Me.exec(n[t]),s=e.bullet||r,i=a?a[1]:e.number??null,c=r||a?[]:e.chars,u=c.map(e=>e.ch).join(""),d=null!=i?i.length+2:s?2:0,h={bullet:s,number:i,chars:c,start:l,src:l+d,vis:o,text:u};return l+=n[t].length+1,o+=u.length+1,h});return{lines:a,text:a.map(e=>e.text).join("\n")}}function Te(e,t){const{lines:n}=e;for(let e=0;e<n.length;e+=1){const r=n[e];if(t<=r.vis+r.text.length||e===n.length-1)return[r,Math.max(0,Math.min(t-r.vis,r.text.length)),e]}return[n[0],0,0]}function Be(e,t){const[n,r]=Te(e,t);if(0===r)return n.src;let l=0;for(const e of n.chars){if(r<=l+e.ch.length)return e.at+(r-l);l+=e.ch.length}return n.src}function Re(e,t){const[n,r]=Te(e,t);let l=0;for(const e of n.chars){if(r===l)return e.at;l+=e.ch.length}return Be(e,t)}function je(e,t){const{lines:n}=e;let r=n[0];for(const e of n)t>=e.start&&(r=e);let l=0;for(const e of r.chars){if(!(t>=e.at+e.ch.length)){t>e.at&&(l+=t-e.at);break}l+=e.ch.length}return r.vis+l}function Pe(e,t,n){return[je(e,t),je(e,n)]}function ze(e,t,n){return t===n?[Be(e,t),Be(e,t)]:[Re(e,t),Be(e,n)]}function Oe(e,t){let n=0;for(let r=0;r<e.chars.length;r+=1){if(n>=t)return r;n+=e.chars[r].ch.length}return e.chars.length}function Fe(e,t,n,r,l){const o=Le(e,t),[a,s,h]=Te(o,Math.min(n,r)),[p,f,m]=Te(o,Math.max(n,r)),g=Oe(a,s),b=Oe(p,f),v=a.chars.slice(0,g),y=p.chars.slice(b),k=n!==r&&a.chars[g]&&(h!==m||g<b)?a.chars[g].marks:function(e,t){const n=e.chars[t-1],r=e.chars[t],l=(e,t)=>{const n=e.findIndex(e=>"link"===e.kind);return-1===n||t?e:e.slice(0,n)};if(n){const e=n.marks.find(e=>"link"===e.kind),t=Boolean(e&&r?.marks.some(t=>t.id===e.id));return l(n.marks,t)}return r?l(r.marks,!1):[]}(a,g);let w=(x=o.lines,Math.max(0,...x.flatMap(e=>e.chars.flatMap(e=>e.marks.map(e=>e.id))))+1);var x;const C=e=>{let n;if(void 0!==l.markup){const e=w;n=u(l.markup,t).map(t=>({bullet:t.bullet,number:t.number??null,chars:t.chars.map(t=>({...t,at:-1,marks:t.marks.map(t=>({...t,id:t.id+e}))}))}))}else{let t=a.number??null;n=(l.text??"").split("\n").map((n,r)=>(r>0&&null!=t&&(t=function(e){return String(Number(e)+1).padStart(e.length,"0")}(t)),{bullet:a.bullet,number:t,chars:[...n].map(t=>({ch:t,at:-1,marks:e??[]}))}))}const r=n.map(e=>e.chars.map(e=>e.ch).join("")).join("\n"),s={bullet:a.bullet,number:a.number??null,chars:[...v,...n[0].chars]},i=n.slice(1);if(i.length>0){const e=i[i.length-1];i[i.length-1]={...e,chars:[...e.chars,...y]}}else s.chars.push(...y);return{lines:[...o.lines.slice(0,h).map(({bullet:e,number:t,chars:n})=>({bullet:e,number:t,chars:n})),s,...i,...o.lines.slice(m+1).map(({bullet:e,number:t,chars:n})=>({bullet:e,number:t,chars:n}))],shown:r}},D=void 0!==l.markup?[null]:[(e=>{let t=e.filter(e=>!l.drop?.some(t=>e.kind===t||"highlight"===t&&"accent"===e.kind));for(const e of l.add??[]){if(t.some(t=>t.kind===e))continue;const n=d(w++,e);n&&(t=[...t,n])}if(void 0!==l.color){t=t.filter(e=>"color"!==e.kind);const e=null===l.color?null:d(w++,"color",l.color);e&&(t=[...t,e])}return t})(k),k,[]];let S="",E="";for(const e of D){const n=C(e),r=i(n.lines).text;if(S=r,E=n.shown,c(n.lines,Le(r,t).lines))break}return{text:S,caret:Math.min(n,r)+E.length}}function Ke(e,t,n,r){const l=Le(e,t),[o,,a]=Te(l,n);return n!==r||!o.bullet&&null==o.number||""!==o.text?Fe(e,t,n,r,{text:"\n"}):We(e,t,a,!1,n)}function We(e,t,n,r,l){const o=Le(e,t).lines.map(({bullet:e,number:t,chars:l},o)=>o===n?{bullet:r,number:null,chars:l}:{bullet:e,number:t,chars:l});return{text:i(o).text,caret:l}}function $e(e,t,n,r){const l=Le(e,t),[o,a,s]=Te(l,Math.min(n,r)),[c,u,d]=Te(l,Math.max(n,r)),h=l.lines.slice(s,d+1).map(({bullet:e,number:t,chars:n},r)=>{const l=0===r?Oe(o,a):0,i=r===d-s?Oe(c,u):n.length;return{bullet:e,number:t,chars:n.slice(l,i)}});return i(h).text}var He="application/x-efficient-markup";function Ae(e,t,n,r){switch(t){case"bold":return e.createElement("strong");case"italic":return e.createElement("em");case"strike":return e.createElement("s");case"underline":return e.createElement("u");case"sup":return e.createElement("sup");case"sub":return e.createElement("sub");case"color":{const t=e.createElement("span");return t.className="es-rich-color",r&&(t.dataset.color=r,t.title=r.startsWith("#")?r.toUpperCase():r,t.style.color=r.startsWith("#")?r:`var(--es-color-${r}, inherit)`),t}case"link":{const t=e.createElement("a");return t.className="es-rich-link",n&&(t.title=n),t}default:{const n=e.createElement("span");return n.className="highlight"===t||"accent"===t?"es-rich-emphasis":`es-rich-${t}`,n}}}function Ie(e,t,n,r){const l=e.layout.lines;if(n===t)return r>=e.lines.length?e.layout.text.length:l[r].vis;const o=e.lines.findIndex(e=>e===n||e.contains(n));if(-1===o)return 0;const a=t.ownerDocument.createRange();a.setStart(e.lines[o],0);try{a.setEnd(n,r)}catch{return l[o].vis}return l[o].vis+Math.min(a.toString().length,l[o].text.length)}function Ue(e,t){const n=e.layout.lines;let r=n.length-1;for(let e=0;e<n.length;e+=1)if(t<=n[e].vis+n[e].text.length){r=e;break}let l=Math.max(0,t-n[r].vis);const o=e.lines[r].ownerDocument.createTreeWalker(e.lines[r],4);let a=o.nextNode(),s=null;for(;a;){if(l<=a.data.length)return[a,l];l-=a.data.length,s=a,a=o.nextNode()}return s?[s,s.data.length]:[e.lines[r],0]}function qe(e,t,n){if(n<0){const n=e.charCodeAt(t-1);return t-(n>=56320&&n<=57343&&t>=2?2:1)}const r=e.charCodeAt(t);return t+(r>=55296&&r<=56319?2:1)}function Ve({value:e,rules:t,multiline:n,readOnly:r=!1,placeholder:l,ariaLabel:o,handle:a,onEdit:s,onSelect:i,onHistory:c,onFormat:u,pending:d,onCommit:h,onCancel:p}){const f=O(null),m=O(null),g=O(null),b=O(null),v=O(null),y=O(e),[k,w]=F(0),x=O({value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u});x.current={value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u};const C=()=>{const e=f.current,t=m.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=Ie(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?Ie(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},D=(e,t)=>{const n=f.current,r=m.current;if(!n||!r)return;const[l,o]=Ue(r,e),[a,s]=Ue(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};a.current={getSource(){const e=C(),t=m.current;if(!e||!t)return null;const[n,r]=ze(t.layout,e[0],e[1]);return{start:n,end:r}},setSource(e,t,n){b.current={text:n,src:[e,t]},w(e=>e+1)},focus(){f.current?.focus()},rangeOf(e,t){const n=f.current,r=m.current;if(!n||!r)return null;const[l,o]=Pe(r.layout,e,t),[a,s]=Ue(r,l),[i,c]=Ue(r,o),u=n.ownerDocument.createRange();return u.setStart(a,s),u.setEnd(i,c),u}},K(()=>{const n=f.current;if(!n||v.current)return;const r=b.current?null:C();m.current=function(e,t){const n=e.ownerDocument;e.replaceChildren();const r=t.lines.map(t=>{const r=n.createElement("div");r.className=null!=t.number?"es-rich-line is-numbered":t.bullet?"es-rich-line is-bullet":"es-rich-line",null!=t.number&&(r.dataset.number=t.number);const l=[],o=()=>l.length?l[l.length-1].el:r;let a=null;for(const e of t.chars){let t=0;for(;t<l.length&&t<e.marks.length&&l[t].id===e.marks[t].id;)t+=1;(l.length>t||e.marks.length>t)&&(a=null),l.length=t;for(let r=t;r<e.marks.length;r+=1){const t=Ae(n,e.marks[r].kind,e.marks[r].href,e.marks[r].color);o().appendChild(t),l.push({id:e.marks[r].id,el:t})}a||(a=n.createTextNode(""),o().appendChild(a)),a.data+=e.ch}return 0===t.chars.length&&r.appendChild(n.createElement("br")),e.appendChild(r),r});return{layout:t,lines:r}}(n,Le(e,t)),g.current=e;const l=b.current;if(!l||l.text!==e)return void(r&&n.ownerDocument.activeElement===n&&D(r[0],Math.min(r[1],m.current.layout.text.length)));b.current=null;const o=m.current.layout,[a,s]=l.vis??Pe(o,l.src[0],l.src[1]);n.ownerDocument.activeElement!==n&&n.focus(),D(a,s)},[e,t,k]);const S=(e,t,n)=>{const r=m.current,[l,o]=ze(r.layout,t[0],t[1]);b.current={text:e.text,vis:[e.caret,e.caret]},e.text!==x.current.value?x.current.onEdit(e.text,{start:l,end:o},n):w(e=>e+1)};W(()=>{const e=f.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:a}=x.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const s=m.current,i=C();if(!s||!i)return;let[c,u]=i;const d="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0;d&&!d.collapsed&&t.inputType.startsWith("delete")&&(c=Ie(s,e,d.startContainer,d.startOffset),u=Ie(s,e,d.endContainer,d.endOffset));const h=s.layout.text,p=t.inputType;if("historyUndo"!==p&&"historyRedo"!==p)if("formatBold"!==p&&"formatItalic"!==p&&"formatStrikeThrough"!==p)if("insertParagraph"!==p&&"insertLineBreak"!==p){if(p.startsWith("insert")){let o=t.data??t.dataTransfer?.getData("text/plain")??"";if("insertFromDrop"===p||"insertFromPaste"===p){const a=Ee({html:t.dataTransfer?.getData("text/html"),text:o},{doc:e.ownerDocument,multiline:l,rules:r});return void S(Fe(n,r,c,u,{markup:a}),[c,u],"edit")}return l||(o=o.replace(/\s*\r?\n\s*/g," ")),void S(Fe(n,r,c,u,{text:o,add:a?.add,drop:a?.drop,color:a?.color}),[c,u],"type")}if(p.startsWith("delete")){if(c===u){const e=p.includes("Backward"),t=s.layout.lines.findIndex(e=>c>=e.vis&&c<=e.vis+e.text.length),l=s.layout.lines[t];if(e&&l&&c===l.vis&&(l.bullet||null!=l.number))return void S(We(n,r,t,!1,c),[c,u],"edit");if(e?0===c:c===h.length)return;e?c=qe(h,c,-1):u=qe(h,u,1)}S(Fe(n,r,c,u,{text:""}),[c,u],"type")}}else l&&S(Ke(n,r,c,u),[c,u],"edit");else x.current.onFormat("formatBold"===p?"bold":"formatItalic"===p?"italic":"strike");else x.current.onHistory("historyUndo"===p?"undo":"redo")},n=()=>{v.current||w(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),W(()=>{const e=f.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=a.current?.getSource();e&&i(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const E=(n,l=!1)=>{const o=C();if(!o||o[0]===o[1])return;n.preventDefault();const a=m.current;n.clipboardData.setData("text/plain",a.layout.text.slice(o[0],o[1])),n.clipboardData.setData(He,$e(e,t,o[0],o[1])),l&&!r&&S(Fe(e,t,o[0],o[1],{text:""}),o,"edit")};/* @__PURE__ */
2
- return he("div",{className:"es-rich-wrap",children:[l&&""===e?/* @__PURE__ */de("div",{className:"es-rich-placeholder","aria-hidden":"true",children:l}):null,
3
- /* @__PURE__ */de("div",{ref:f,className:`es-rich${n?" is-multiline":" is-single"}${r?" is-off":""}`,contentEditable:!r,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":n,"aria-label":o,"aria-readonly":r||void 0,"aria-placeholder":l,tabIndex:r?-1:0,spellCheck:!0,onFocus:()=>{y.current=e},onBlur:()=>{e!==y.current&&h?.(e),y.current=e},onKeyDown:t=>{if("Escape"===t.key)return t.preventDefault(),p?.(y.current),void(y.current=e);"Enter"!==t.key||n||(t.preventDefault(),e!==y.current&&h?.(e),y.current=e)},onCompositionStart:()=>{const e=C()??[0,0];v.current={from:e[0],to:e[1]}},onCompositionEnd:e=>{const t=v.current;if(v.current=null,!t)return;const{value:n,rules:r,pending:l}=x.current;e.data?S(Fe(n,r,t.from,t.to,{text:e.data,add:l?.add,drop:l?.drop,color:l?.color}),[t.from,t.to],"type"):w(e=>e+1)},onCopy:e=>E(e),onCut:e=>E(e,!0),onPaste:l=>{if(l.preventDefault(),r)return;const o=C();if(!o)return;const a=l.clipboardData.getData(He),s=a?n?a:a.replace(/\s*\r?\n\s*/g," "):Ee({html:l.clipboardData.getData("text/html"),text:l.clipboardData.getData("text/plain")},{doc:l.currentTarget.ownerDocument,multiline:n,rules:t});S(Fe(e,t,o[0],o[1],{markup:s}),o,"edit")}})]})}var Ye=1e3;function Ze(e=200){let t=[],n=[],r=null,l=0;return{record(o,a,s){const i="type"===a&&"type"===r&&s-l<1e3;r=a,l=s,n=[],i||(t.push(o),t.length>e&&t.shift())},undo(e){const l=t.pop();return l?(n.push(e),r=null,l):null},redo(e){const l=n.pop();return l?(t.push(e),r=null,l):null},reset(){t=[],n=[],r=null}}}var Ge={fontSize:{key:"fontSize",nameKey:"fontSize",icon:/* @__PURE__ */de(Z,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */de(Y,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */de(V,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */de(q,{}),unit:"px",step:1,shiftStep:10,min:0}};function Je(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function Xe({cells:n,words:r,readOnly:l=!1}){const o=r??e.cells;/* @__PURE__ */
4
- return de("div",{className:"es-copy-cells",children:n.map(e=>{const n=e.scale??1,r=e.name??(e.nameKey?o[e.nameKey]:e.key),a=e.unit??"",s=e.step??1;/* @__PURE__ */
5
- return de(t,{value:Je(e.value,n),styleValue:Je(e.styleValue,n),onChange:t=>e.onChange(void 0===t?void 0:Number((t/n).toFixed(6))),min:e.min,max:e.max,step:s,shiftStep:e.shiftStep,icon:e.icon,unit:a||void 0,steppers:"compact",readOnly:l,ariaLabel:r,title:o.tip({name:r,step:s,unit:a})},e.key)})})}var Qe=e=>e.preventDefault();function _e({colors:e,current:t,words:n,onPick:r}){const l=null===t?null:t.startsWith("#")?t.toLowerCase():e.find(e=>e.name===t)?.value.toLowerCase()??null;/* @__PURE__ */
6
- return he("div",{className:"es-copy-pop es-copy-colors",role:"dialog","aria-label":n.title,onMouseDown:e=>{"INPUT"!==e.target.tagName&&e.preventDefault()},children:[
7
- /* @__PURE__ */de("span",{className:"es-copy-pop-label",children:n.theme}),
8
- /* @__PURE__ */de("div",{className:"es-copy-theme",role:"group","aria-label":n.theme,children:e.map(e=>/* @__PURE__ */de(L,{content:`${e.label} · ${e.value.toUpperCase()}`,children:/* @__PURE__ */de(T,{color:e.value,size:"sm",className:"es-copy-theme-swatch","data-color":e.name,"aria-label":e.label,selected:t===e.name,onMouseDown:Qe,onClick:()=>r(e.name)})},e.name))}),
9
- /* @__PURE__ */de("span",{className:"es-copy-pop-label",children:n.any}),
10
- /* @__PURE__ */de(B,{className:"es-copy-any",value:l??"",onChange:e=>{e!==t&&r(e)},label:n.title,dragWrites:"end"}),
11
- /* @__PURE__ */de("div",{className:"es-copy-pop-foot",children:/* @__PURE__ */de(R,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onMouseDown:Qe,onClick:()=>r(null),children:n.remove})})]})}var et=e=>e.preventDefault();function tt(e,t,n){const r={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1,Home:"first",End:"last"}[e.key];if(void 0===r||0===t.length)return;const l=[...e.currentTarget.querySelectorAll('[role="radio"]')],o=l.findIndex(t=>t===e.target||t.contains(e.target));if(o<0)return;e.preventDefault();const a=l.length,s="first"===r?0:"last"===r?a-1:(o+r+a)%a;l[s].disabled||(n(t[s]),l[s].focus())}var nt=["bold","italic","underline","strike","link","sup","sub"],rt=["left","center","right","justify"],lt=e=>null!=e&&!1!==e;function ot({offered:e,color:t,last:n,alignment:r,list:l,letterCase:o}){const a=nt.filter(t=>e.has(t)).length+(t?1:0)+(lt(n)?1:0),s=(r?rt.filter(e=>r.allow.includes(e)).length:0)+(l&&e.has("bullet")?1:0)+(l&&e.has("number")?1:0)+(o?3:0);return{words:a>0,paragraph:s>0,oneRow:a>0&&s>0&&a+1+s<=9,flow:a>0&&s>0&&a+1+s>9&&a<=7}}function at({words:e,align:t,alignmentLabel:n,offered:r,pressed:l,onMark:o,color:a,linkOpen:s,last:i,alignment:c,list:u,letterCase:d,disabled:h=!1,ariaLabel:p="Formatting"}){const f=e=>"es-tb-cell es-tb-btn"+(e?" is-on":""),m=(e,t,n,a)=>r.has(e)?M(t,/* @__PURE__ */de(j,"link"===e?{pressed:Boolean(s),className:f(Boolean(s)),"aria-label":t,"aria-haspopup":"dialog","aria-expanded":s,"aria-keyshortcuts":a,disabled:h,onMouseDown:et,onClick:()=>o(e),children:n}:{className:"es-tb-cell es-tb-btn"+(l[e]?" is-on":""),"aria-label":t,"aria-pressed":Boolean(l[e]),"aria-keyshortcuts":a,disabled:h,onMouseDown:et,onClick:()=>o(e),children:n},e)):null,g=ot({offered:r,color:a,last:i,alignment:c,list:u,letterCase:d});if(!g.words&&!g.paragraph)return null;const b=[["left",/* @__PURE__ */de(U,{},"l")],["center",/* @__PURE__ */de(I,{},"c")],["right",/* @__PURE__ */de(A,{},"r")],["justify",/* @__PURE__ */de(H,{},"j")]],v=c?rt.filter(e=>c.allow.includes(e)):[],y=c&&v.includes(c.value)?c.value:v[0],k=[["none",e.caseNone,/* @__PURE__ */de(G,{},"n")],["upper",e.caseUpper,/* @__PURE__ */de(J,{},"u")],["lower",e.caseLower,/* @__PURE__ */de(X,{},"w")]],w=/* @__PURE__ */he(pe,{children:[m("bold",e.bold,/* @__PURE__ */de(ne,{}),"Meta+B"),m("italic",e.italic,/* @__PURE__ */de(re,{}),"Meta+I"),m("underline",e.underline,/* @__PURE__ */de(le,{}),"Meta+U"),m("strike",e.strike,/* @__PURE__ */de(oe,{})),a?M(e.color,/* @__PURE__ */de(j,{pressed:a.open,className:`${f(a.open)} es-tb-color`,"aria-label":e.color,"aria-haspopup":"dialog","aria-expanded":a.open,disabled:h,style:a.run?{"--es-tb-run":a.run}:void 0,onMouseDown:et,onClick:a.onToggle,children:/* @__PURE__ */de(Q,{})},"color")):null,m("link",e.link,/* @__PURE__ */de(ae,{}),"Meta+K"),m("sup",e.sup,/* @__PURE__ */de(se,{})),m("sub",e.sub,/* @__PURE__ */de(ie,{})),lt(i)?i:null]}),x=/* @__PURE__ */he(pe,{children:[c&&b.some(([e])=>c.allow.includes(e))?/* @__PURE__ */de("div",{className:"es-tb-group",role:"radiogroup","aria-label":n,onKeyDown:e=>tt(e,v,e=>c.onChange(e)),children:b.map(([e,n])=>c&&c.allow.includes(e)?M(t[e],/* @__PURE__ */de(j,{role:"radio",pressed:c.value===e,className:f(c.value===e),"aria-checked":c.value===e,"aria-label":t[e],tabIndex:e===y?0:-1,disabled:h||c.disabled,onMouseDown:et,onClick:()=>c.onChange(e),children:n},e)):null)}):null,u&&r.has("bullet")?M(e.bullet,/* @__PURE__ */de(j,{className:"es-tb-cell es-tb-btn"+("bullet"===u.pressed?" is-on":""),"aria-label":e.bullet,"aria-pressed":"bullet"===u.pressed,disabled:h,onMouseDown:et,onClick:()=>u.onList("bullet"),children:/* @__PURE__ */de(_,{})})):null,u&&r.has("number")?M(e.number,/* @__PURE__ */de(j,{className:"es-tb-cell es-tb-btn"+("number"===u.pressed?" is-on":""),"aria-label":e.number,"aria-pressed":"number"===u.pressed,disabled:h,onMouseDown:et,onClick:()=>u.onList("number"),children:/* @__PURE__ */de(ee,{})})):null,d?/* @__PURE__ */de("div",{className:"es-tb-group",role:"radiogroup","aria-label":e.letterCase,onKeyDown:e=>tt(e,k.map(([e])=>e),e=>d.onChange(e)),children:k.map(([e,t,n])=>M(t,/* @__PURE__ */de(j,{role:"radio",pressed:d.value===e,className:f(d.value===e),"aria-checked":d.value===e,"aria-label":t,tabIndex:e===(d.value||"none")?0:-1,disabled:h||d.disabled,onMouseDown:et,onClick:()=>d.onChange(d.value===e?"":e),children:n},e)))}):null]});return g.flow?/* @__PURE__ */de("div",{className:"es-tb",role:"toolbar","aria-label":p,children:/* @__PURE__ */he("div",{className:"es-tb-row is-flow",children:[w,
12
- /* @__PURE__ */de("span",{className:"es-tb-flowgap","aria-hidden":"true"}),x]})}):g.oneRow?/* @__PURE__ */de("div",{className:"es-tb",role:"toolbar","aria-label":p,children:/* @__PURE__ */he("div",{className:"es-tb-row is-one-row",children:[
13
- /* @__PURE__ */de("div",{className:"es-tb-words",children:w}),
14
- /* @__PURE__ */de("div",{className:"es-tb-para",children:x})]})}):/* @__PURE__ */he("div",{className:"es-tb",role:"toolbar","aria-label":p,children:[g.words?/* @__PURE__ */de("div",{className:"es-tb-row"+(void 0===i?" is-eight":""),children:w}):null,g.paragraph?/* @__PURE__ */de("div",{className:"es-tb-row",children:x}):null]})}var st=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n));var it=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom});function ct(e){const t=e.ownerDocument,n=t.documentElement,r={left:0,top:0,right:n.clientWidth,bottom:n.clientHeight},l=t.defaultView?.getComputedStyle.bind(t.defaultView);for(let o=e.parentElement;o&&o!==n&&o!==t.body;o=o.parentElement){const e=l?.(o);if(!e||"visible"===e.overflowX&&"visible"===e.overflowY)continue;const t=o.getBoundingClientRect();if(0===t.width&&0===t.height)continue;const n=t.left+o.clientLeft,a=t.top+o.clientTop;r.left=Math.max(r.left,n),r.top=Math.max(r.top,a),r.right=Math.min(r.right,n+(o.clientWidth||t.width)),r.bottom=Math.min(r.bottom,a+(o.clientHeight||t.height))}return r}function ut(e){const t=e.offsetParent??e.parentElement;if(!t)return{left:0,top:0};const n=t.getBoundingClientRect();return{left:n.left+t.clientLeft-t.scrollLeft,top:n.top+t.clientTop-t.scrollTop}}var dt=/* @__PURE__ */new Set([...o,"clear"]),ht={bold:/* @__PURE__ */de(ne,{size:16}),italic:/* @__PURE__ */de(re,{size:16}),strike:/* @__PURE__ */de(oe,{size:16}),highlight:/* @__PURE__ */de(ue,{size:16}),quiet:/* @__PURE__ */de(ce,{size:16}),link:/* @__PURE__ */de(ae,{size:16}),clear:/* @__PURE__ */de(te,{size:16})};function pt(e){if(!e)return;const t=e.split("+"),n=t.pop().toUpperCase();return["Meta",...t.map(e=>e[0].toUpperCase()+e.slice(1)),n].join("+")}var ft={bold:"is-bold",italic:"is-italic",strike:"is-strike"};function mt({tools:t,onApply:n,disabled:r=!1,actions:l,align:o,glyphs:a,ariaLabel:s,pressed:i,open:c=null}){const u=N("copy",e),d=("string"==typeof t[0]?h(t).map(e=>({...e,...u.marks[e.style]})):t).filter(e=>!dt.has(e.style));return 0!==d.length||l||o?/* @__PURE__ */he("div",{className:"es-copy-bar",role:"group","aria-label":s??u.formatting,children:[d.map(e=>{const t=a?.[e.style]??ht[e.style],l=c===e.style||Boolean(i?.[e.style]),o="link"===e.style&&Boolean(i);return M(e.title,/* @__PURE__ */de(j,{onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.style),disabled:r,"aria-label":e.name??e.title,"aria-keyshortcuts":pt(e.shortcut),"aria-pressed":o||!i&&!c?void 0:l,pressed:o?l:void 0,"aria-haspopup":o?"dialog":void 0,"aria-expanded":o?"link"===c:void 0,className:`es-copy-mark${t?" has-glyph":ft[e.style]?` ${ft[e.style]}`:""}${l?" is-active":""}`,children:t??e.label},e.style))}),l?/* @__PURE__ */he(pe,{children:[
15
- /* @__PURE__ */de("span",{className:"es-copy-bar-split","aria-hidden":"true"}),l]}):null,o?/* @__PURE__ */de("span",{className:"es-copy-bar-end",children:o}):null]}):null}function gt({target:e,onChange:t}){const n=O(null);return K(()=>{const t=n.current,r=e.current;t&&r&&r.value===t.text&&(n.current=null,r.focus(),r.setSelectionRange(t.start,t.end))}),r=>{const l=r(e.current);t(l.text),n.current={start:l.selectionStart,end:l.selectionEnd,text:l.text}}}var bt=["bold","italic","underline","strike","sup","sub"];function vt({value:t,onChange:o,onCommit:i,onCancel:c,multiline:u=!1,placeholder:y,ariaLabel:L,className:T,readOnly:B=!1,rules:j,tools:H=[],writeMark:A,actions:I,align:U,glyphs:q,barLabel:V,renderFooter:Y,inputRef:Z,barShows:G="always",richText:J=!0,defaultShowMarks:X=!1,toolbar:Q="final",colors:_,cells:ee,letterCase:ne,lastTool:re}){const le="final"===Q,oe=N("copy",e),ae=O(null),se=Z??ae,[ie,ce]=F(!1),[ue,fe]=F(null),me=O(Ze()).current,ge=O(null);W(()=>{const e=ge.current;e&&t===e.to?ge.current=null:e&&t===e.from||(ge.current=null,me.reset())},[t,me]);const be=e=>{ge.current={from:ge.current?.from??t,to:e},o(e)},ye=e=>({text:t,start:e?.selectionStart??ue?.start??t.length,end:e?.selectionEnd??ue?.end??t.length}),[we,De]=F(X),Se=J&&!(u&&we),Ne=O(null),Me=$(),[Le,Te]=F(null),[Be,Re]=F(!1),je=()=>{if(!Se)return se.current;const e=Ne.current?.getSource()??ue;return e?{selectionStart:e.start,selectionEnd:e.end}:null},Pe=gt({target:se,onChange:be}),ze=e=>(fe({start:e.selectionStart,end:e.selectionEnd}),e),Oe=(e,n)=>{if(!Se)return void Pe(t=>(n&&me.record(ye(t),"edit",Date.now()),ze(e(t))));const r=je(),l=ze(e(r));n&&me.record(ye(r),"edit",Date.now()),Te(null),l.text!==t&&be(l.text),Ne.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},Fe=e=>Oe(e,!0),Ke=e=>Oe(t=>{const n=ye(t),r=me[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),We=O(null);K(()=>{const e=We.current;e&&(We.current=null,Se?Ne.current?.setSource(e.start,e.end,t):(se.current?.focus(),se.current?.setSelectionRange(e.start,e.end),fe(e)))},[Se]);const[$e,He]=F(null),Ae=j??s,Ie=("string"==typeof H[0]?h(H):H).filter(e=>!dt.has(e.style)),Ue=le?("string"==typeof H[0]?H:H.map(e=>e.style)).filter(e=>!dt.has(e)):Ie.map(e=>e.style),qe={};if(ue&&(Se||le)){const e=p(t,ue.start,ue.end,Ae);for(const t of Ue){const n=e.has(t)||"highlight"===t&&e.has("accent");qe[t]=!!Le?.add.includes(t)||!Le?.drop.includes(t)&&n}le&&(qe.link=e.has("link"))}else if(ue)for(const e of Ue)qe[e]="link"===e?null!==f(t,ue.start,ue.end):m(t,ue.start,ue.end,e);const Ye=()=>{const e=je(),n=e?.selectionStart??t.length;return{start:n,end:e?.selectionEnd??n}},Ge={sup:"sub",sub:"sup"},Je=e=>{if(le&&"link"!==e&&d(0,e)){const{start:n,end:r}=Ye(),l=Ge[e];if(n===r){if(!Se)return void Fe(n=>xe(t,e,n,(e,t,n,r)=>a(e,t,n,r,Ae,oe.placeholders)));const o=p(t,n,r,Ae),s=Le&&Le.at===n?Le:null,i=o.has(e),c=!!s?.add.includes(e)||!s?.drop.includes(e)&&i;let u=(s?.add??[]).filter(t=>t!==e),d=(s?.drop??[]).filter(t=>t!==e);return c&&i?d.push(e):c||i||u.push(e),!c&&l&&(u=u.filter(e=>e!==l),o.has(l)&&(d=[...d.filter(e=>e!==l),l])),void Te(u.length||d.length||void 0!==s?.color?{add:u,drop:d,color:s?.color,at:n}:null)}return void Fe(()=>{let o=t,a=n,s=r;if(l&&!p(o,a,s,Ae).has(e)&&p(o,a,s,Ae).has(l)){const e=k(o,a,s,l,Ae);({text:o,selectionStart:a,selectionEnd:s}=e)}return k(o,a,s,e,Ae)})}if("clear"===e)return void Fe(n=>xe(t,e,n,(e,t,n)=>a(e,t,n,"clear",Ae)));if("link"!==e&&Se&&d(0,e)){const n=je(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;if(r===l){const n=p(t,r,l,Ae),o=n.has(e)||"highlight"===e&&n.has("accent"),a=Le&&Le.at===r?Le:null,s=!!a?.add.includes(e)||!a?.drop.includes(e)&&o,i=(a?.add??[]).filter(t=>t!==e),c=(a?.drop??[]).filter(t=>t!==e);return s&&o?c.push(e):s||o||i.push(e),void Te(i.length||c.length?{add:i,drop:c,at:r}:null)}return void Fe(n=>k(t,n?.selectionStart??r,n?.selectionEnd??l,e,Ae))}if("link"!==e){const n=A??((e,t,n,r)=>a(e,t,n,r,s,oe.placeholders));return void Fe(r=>xe(t,e,r,n))}const n=je(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;Re(!1),He({start:r,end:l,link:f(t,r,l)})},Qe=Boolean(ue&&ue.start!==ue.end),et=ue?g(t,ue.start,ue.end,Ae):null,tt=ue?Le&&void 0!==Le.color&&Le.at===ue.start?Le.color:b(t,ue.start,ue.end,Ae):null,nt=tt?tt.startsWith("#")?tt:_?.find(e=>e.name===tt)?.value:void 0,rt=e=>{Se?e?Ne.current?.setSource(e.start,e.end,t):Ne.current?.focus():(se.current?.focus(),e&&se.current?.setSelectionRange(e.start,e.end))},lt=()=>{const e=$e;He(null),rt(e?{start:e.start,end:e.end}:ue)},ht=()=>{const e=ft.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));Re(!1),t&&rt(ue)},pt=O(ht);pt.current=ht,W(()=>{if(Be)return P(e=>{const t=ft.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(pt.current(),!0)},()=>ft.current?.querySelector(".es-copy-colors"))},[Be]);const ft=O(null),vt=Be||null!==$e;W(()=>{const e=ft.current;if(!vt||!e)return;const t=e.ownerDocument,n=()=>{Re(!1),He(null)},r=t=>{e.contains(t.target)||n()};let l;const o=r=>{const o=r.relatedTarget;o?e.contains(o)||n():(clearTimeout(l),l=setTimeout(()=>{const r=t.activeElement;t.hasFocus()&&r&&r!==t.body&&!e.contains(r)&&n()},0))};return t.addEventListener("pointerdown",r,!0),e.addEventListener("focusout",o),()=>{clearTimeout(l),t.removeEventListener("pointerdown",r,!0),e.removeEventListener("focusout",o)}},[vt]);const yt=$e??(Be?ue??{start:t.length,end:t.length}:null),kt=O(()=>{});kt.current=()=>{const e=ft.current,t=e?.querySelector(".es-tb-wrap > .es-copy-pop");if(!e||!t||!yt)return;const n=Se?null:e.querySelector(".es-gold-layer"),r=Se?Ne.current?.rangeOf(yt.start,yt.end)??null:n?function(e,t,n){const r=e.ownerDocument,l=r.createTreeWalker(e,4),o=e=>{let t=e,n=null;for(let e=l.nextNode();e;e=l.nextNode()){if(t<=e.data.length)return[e,t];t-=e.data.length,n=e}return n?[n,n.data.length]:null},a=o(t);l.currentNode=e;const s=o(n);if(!a||!s)return null;const i=r.createRange();return i.setStart(a[0],a[1]),i.setEnd(s[0],s[1]),i}(n,yt.start,yt.end):null,l=r?.endContainer,o=l?1===l.nodeType?l:l.parentElement:null,a=r?function(e,t){const n=("function"==typeof e.getClientRects?[...e.getClientRects()]:[]).filter(e=>e.height>0);if(n.length>0){const t="function"==typeof e.getBoundingClientRect?e.getBoundingClientRect():n[0];return t.height>0?it(t):it(n[0])}if(!t)return null;const r=t.getBoundingClientRect();return{left:r.left,top:r.top,right:r.left,bottom:r.bottom}}(r,o?.closest(".es-rich-line, .es-gold-layer")??null):null;if(!a)return;const s=function({anchor:e,size:t,within:n,clip:r,parent:l,gap:o=8}){const a=Math.max(n.left,r.left),s=Math.min(n.right,r.right)-t.width,i=st(e.left,a,s),c=r.bottom-(e.bottom+o),u=e.top-o-r.top,d=t.height>c&&(t.height<=u||u>c),h=d?e.top-o-t.height:e.bottom+o,p=e.left+Math.min((e.right-e.left)/2,10),f=st(p-5-i,10,t.width-10-10);return{top:h-l.top,left:i-l.left,above:d,point:f}}({anchor:a,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:ct(e),parent:ut(t)});t.style.top=`${s.top}px`,t.style.left=`${s.left}px`,t.style.setProperty("--es-pop-point",`${s.point}px`),t.dataset.side=s.above?"above":"below"},K(()=>{const e=ft.current;if(!vt||!e)return;const t=()=>kt.current();t();const n=e.ownerDocument.defaultView;n?.addEventListener("resize",t);const r=e.querySelector(".es-tb-wrap > .es-copy-pop"),l=n?.ResizeObserver,o=l&&r?new l(t):null;return o&&r&&o.observe(r),()=>{n?.removeEventListener("resize",t),o?.disconnect()}},[vt,Be,$e,yt?.start,yt?.end,Se]);const wt=e=>$e&&/* @__PURE__ */de(z,{className:e?"es-copy-link es-copy-pop":"es-copy-link",value:$e.link?.href??"",onApply:e=>{const n=$e;He(null),Fe(()=>Se?S(t,n.start,n.end,e,Ae):E(t,n.start,n.end,e))},onRemove:$e.link?()=>{const e=$e.link,n=$e;He(null),e&&Fe(()=>Se?C(t,n.start,n.end,Ae):D(t,e))}:void 0,onCancel:lt}),xt=U?ve(U.allow,oe.align):[],Ct="always"===G||ie||null!==$e||Be,Dt=_&&_.length>0?{run:nt,open:Be,onToggle:()=>{He(null),Be?ht():Re(!0)}}:void 0,St=Ct&&le&&re?re({className:"es-tb-cell es-tb-btn",disabled:B,selected:Qe,keepCaret:e=>e.preventDefault(),insert:e=>Fe(n=>Ce(t,e,n))}):void 0,Et=new Set(Ue),Nt=U?{value:U.value,allow:U.allow,onChange:U.onChange,disabled:U.disabled}:void 0,Mt={pressed:et,onList:e=>{const{start:n,end:r}=Ye(),l=g(t,n,r,Ae);Fe(()=>x(t,n,r,l===e?null:e,Ae))}},Lt=ot({offered:Et,color:Dt,last:St,alignment:Nt,list:Mt,letterCase:ne}),Tt=function(e,t){const n=["bold","italic","underline","strike"].filter(t=>e.has(t)).length;return{color:n,link:n+(t?1:0)}}(Et,Boolean(Dt)),Bt=le&&Ct&&(bt.some(e=>Et.has(e))||Boolean(Dt));/* @__PURE__ */
16
- return he("div",{ref:ft,className:"es-copy"+(T?` ${T}`:""),onFocus:()=>ce(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||ce(!1)},onKeyDown:e=>{const t=e.target===se.current||Boolean(e.target.closest?.(".es-rich"));if(B||!t)return;if(e.altKey||e.metaKey===e.ctrlKey)return;const n=e.key.toLowerCase(),r="KeyZ"===e.code||"z"===n,l=("KeyY"===e.code||"y"===n)&&!e.shiftKey;if(r||l)return e.preventDefault(),e.stopPropagation(),void Ke(l||e.shiftKey?"redo":"undo");const o=`${e.shiftKey?"shift+":""}${n}`;if(le){const t={b:"bold",i:"italic",u:"underline",k:"link"}[o];if(!t||!Ue.includes(t))return;return e.preventDefault(),e.stopPropagation(),void Je(t)}const a=Ie.find(e=>e.shortcut===o);a&&(e.preventDefault(),e.stopPropagation(),Je(a.style))},onPaste:e=>{const n=se.current;if(B||!n||e.target!==n)return;e.preventDefault();const r=Ee({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:u,rules:Ae});Fe(e=>Ce(t,r,e))},style:_&&_.length>0?Object.fromEntries(_.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const e=se.current;e&&e.ownerDocument.activeElement===e&&fe({start:e.selectionStart??t.length,end:e.selectionEnd??t.length})},children:[Ct&&le&&(Lt.words||Lt.paragraph)?/* @__PURE__ */he("div",{className:"es-tb-wrap"+(Lt.oneRow?" is-one-row":Lt.flow?" is-flow":re?"":" is-eight"),style:{"--es-tb-color-col":Tt.color,"--es-tb-link-col":Tt.link},children:[
17
- /* @__PURE__ */de(at,{words:oe.toolbar??e.toolbar,align:oe.align,alignmentLabel:oe.alignment,ariaLabel:V??oe.formatting,offered:Et,pressed:qe,onMark:e=>Je(e),color:Dt,linkOpen:null!==$e,last:St,alignment:Nt,list:Mt,letterCase:ne,disabled:B}),Be&&_&&_.length>0?/* @__PURE__ */de(_e,{colors:_,current:tt,words:oe.colors??e.colors,onPick:e=>{const{start:n,end:r}=Ye();if(n!==r)Fe(()=>w(t,n,r,e,Ae));else{if(!Se)return;Te({add:Le?.add??[],drop:Le?.drop??[],color:e,at:n})}}}):null,$e?wt(!0):null]}):null,le&&ee&&ee.length>0?/* @__PURE__ */de(Xe,{cells:ee,words:oe.cells??e.cells,readOnly:B}):null,Ct&&!le?/* @__PURE__ */de(mt,{tools:H,disabled:B,actions:I,glyphs:q,ariaLabel:V,pressed:qe,open:$e?"link":null,onApply:Je,align:U?/* @__PURE__ */de(n,{options:xt,value:U.value,onChange:U.onChange,ariaLabel:oe.alignment,disabled:B||U.disabled,fit:ke(xt)}):null}):null,Se?/* @__PURE__ */de(Ve,{value:t,rules:Ae,multiline:u,readOnly:B,placeholder:y,ariaLabel:L,handle:Ne,pending:Le??void 0,onEdit:(e,n,r)=>{me.record({text:t,start:n.start,end:n.end},r,Date.now()),Te(null),be(e)},onSelect:e=>{fe(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Le||e.start===Le.at&&e.end===Le.at||Te(null)},onHistory:Ke,onFormat:e=>{Ue.includes(e)&&Je(e)},onCommit:i,onCancel:c}):/* @__PURE__ */de(l,{value:t,onInput:e=>{me.record(ye(null),"type",Date.now()),be(e)},onCommit:i,onCancel:c,multiline:u,placeholder:y,ariaLabel:L,rules:j,disabled:B,inputRef:se,className:"es-copy-box"}),$e&&!le?wt(!1):null,Y?Y({focused:ie,insert:e=>Fe(n=>Ce(t,e,n))}):null,J&&u||Bt?
18
- /* @__PURE__ */he("div",{className:"es-copy-marks",children:[J&&u?/* @__PURE__ */he(pe,{children:[
19
- /* @__PURE__ */de(r,{checked:we,onChange:()=>{const e=je();We.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:ue,Te(null),De(e=>!e)},ariaLabelledBy:Me,disabled:B}),
20
- /* @__PURE__ */de("span",{id:Me,className:"es-copy-marks-label",children:oe.showMarks??"Show marks"})]}):null,Bt?M(Qe?void 0:oe.clearStyleEmpty??"Select words first",/* @__PURE__ */he(R,{variant:"secondary",size:"sm",className:"es-copy-clear",disabled:B||!Qe,onMouseDown:e=>e.preventDefault(),onClick:()=>{const{start:e,end:n}=Ye();if(e===n)return;const r=v(t,e,n,Ae);r.text!==t&&Fe(()=>r)},children:[
21
- /* @__PURE__ */de(te,{size:16}),oe.clearStyle??"Clear style"]})):null]}):null]})}export{fe as COPY_ALIGNS,be as COPY_ALIGN_FIT,ge as COPY_ALIGN_GLYPHS,me as COPY_ALIGN_LABELS,Ge as COPY_CELLS,_e as ColorWindow,vt as CopyBox,Xe as CopyCells,He as MARKUP_CLIPBOARD_TYPE,mt as MarkBar,Ve as RichBox,Ye as TYPING_BURST_MS,at as TextToolbar,pt as ariaShortcut,ve as copyAlignOptions,Ze as createHistory,Fe as editVisible,Ce as insertSelection,xe as markSelection,$e as markupOfRange,Ke as newLine,Ee as pasteToMarkup,Le as richLayout,ze as selectionToSource,Pe as selectionToVisible,We as setBullet,Be as toSource,Re as toSourceStart,je as toVisible,gt as useCaretEdit};
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__ */
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__ */
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__ */
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
+ /* @__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))}),
9
+ /* @__PURE__ */le("span",{className:"es-copy-pop-label",children:n.any}),
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?
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};
@@ -1,6 +1,6 @@
1
1
  import { S as SaveWords } from '../words-CvFnwGSr.js';
2
2
  import { N as NoticeWords, C as ChromeWords } from '../words-C1U_dLBh.js';
3
- import { C as CopyWords } from '../words-lpvYzf5U.js';
3
+ import { C as CopyWords } from '../words-BAnsDT16.js';
4
4
  import { D as DragWords } from '../words-BDignMl_.js';
5
5
  import { LockWords } from '../edit-lock/index.js';
6
6
  import { F as FieldsWords } from '../words-vhnV8sM7.js';
@@ -1 +1 @@
1
- export{DEFAULT_EASEL_STRINGS,mergeEaselStrings}from"../chunk-Y324X4U4.js";import"../chunk-M6F6LS3H.js";import"../chunk-ZAOM6PFH.js";import"../chunk-6WY6ZXJG.js";import"../chunk-MCHMF32I.js";import"../chunk-AELNNAFM.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-WK3AFPXY.js";import"../chunk-H6DDIBQ4.js";import"../chunk-Y2G7CU6A.js";import"../chunk-RE4LP46F.js";import"../chunk-2OAZYSWJ.js";import"../chunk-JZDEIRH4.js";import"../chunk-FFYXVAAL.js";import"../chunk-546BBOPE.js";import"../chunk-O2NLQBFX.js";
1
+ export{DEFAULT_EASEL_STRINGS,mergeEaselStrings}from"../chunk-FXJBKKGI.js";import"../chunk-M6F6LS3H.js";import"../chunk-ZAOM6PFH.js";import"../chunk-6WY6ZXJG.js";import"../chunk-MCHMF32I.js";import"../chunk-AELNNAFM.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-WK3AFPXY.js";import"../chunk-H6DDIBQ4.js";import"../chunk-Y2G7CU6A.js";import"../chunk-RE4LP46F.js";import"../chunk-2OAZYSWJ.js";import"../chunk-AUT242JK.js";import"../chunk-FFYXVAAL.js";import"../chunk-546BBOPE.js";import"../chunk-O2NLQBFX.js";
@@ -3,7 +3,7 @@ export { CanvasWords, DEFAULT_EASEL_STRINGS, RailWords, mergeEaselStrings } from
3
3
  import * as react from 'react';
4
4
  import { ReactNode } from 'react';
5
5
  export { C as ChromeWords, N as NoticeWords } from '../words-C1U_dLBh.js';
6
- export { C as CopyWords } from '../words-lpvYzf5U.js';
6
+ export { C as CopyWords } from '../words-BAnsDT16.js';
7
7
  export { D as DragWords } from '../words-BDignMl_.js';
8
8
  export { F as FieldsWords } from '../words-vhnV8sM7.js';
9
9
  export { LockWords } from '../edit-lock/index.js';
@@ -1,2 +1,2 @@
1
- import{DEFAULT_EASEL_STRINGS as r,mergeEaselStrings as n}from"../chunk-Y324X4U4.js";export{DEFAULT_EASEL_STRINGS,mergeEaselStrings}from"../chunk-Y324X4U4.js";import"../chunk-M6F6LS3H.js";import"../chunk-ZAOM6PFH.js";import"../chunk-6WY6ZXJG.js";import"../chunk-MCHMF32I.js";import"../chunk-AELNNAFM.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-WK3AFPXY.js";import"../chunk-H6DDIBQ4.js";import"../chunk-Y2G7CU6A.js";import"../chunk-RE4LP46F.js";import"../chunk-2OAZYSWJ.js";import"../chunk-JZDEIRH4.js";import"../chunk-FFYXVAAL.js";import"../chunk-546BBOPE.js";import{stringsContext as o}from"../chunk-MFIRYGHW.js";import"../chunk-O2NLQBFX.js";import{useContext as t,useMemo as c}from"react";import{jsx as i}from"react/jsx-runtime";function s({value:s,locale:u,children:m}){const e=o(),p=t(e),h=p?.strings??r,j=u??p?.locale??"en",k=c(()=>({strings:n(h,s),locale:j}),[h,s,j]);/* @__PURE__ */
1
+ import{DEFAULT_EASEL_STRINGS as r,mergeEaselStrings as n}from"../chunk-FXJBKKGI.js";export{DEFAULT_EASEL_STRINGS,mergeEaselStrings}from"../chunk-FXJBKKGI.js";import"../chunk-M6F6LS3H.js";import"../chunk-ZAOM6PFH.js";import"../chunk-6WY6ZXJG.js";import"../chunk-MCHMF32I.js";import"../chunk-AELNNAFM.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-WK3AFPXY.js";import"../chunk-H6DDIBQ4.js";import"../chunk-Y2G7CU6A.js";import"../chunk-RE4LP46F.js";import"../chunk-2OAZYSWJ.js";import"../chunk-AUT242JK.js";import"../chunk-FFYXVAAL.js";import"../chunk-546BBOPE.js";import{stringsContext as o}from"../chunk-MFIRYGHW.js";import"../chunk-O2NLQBFX.js";import{useContext as t,useMemo as c}from"react";import{jsx as i}from"react/jsx-runtime";function s({value:s,locale:u,children:m}){const e=o(),p=t(e),h=p?.strings??r,j=u??p?.locale??"en",k=c(()=>({strings:n(h,s),locale:j}),[h,s,j]);/* @__PURE__ */
2
2
  return i(e.Provider,{value:k,children:m})}function u(){return t(o())?.strings??r}function m(){return t(o())?.locale??"en"}export{s as EaselStringsProvider,m as useEaselLocale,u as useEaselStrings};
@@ -133,28 +133,6 @@ type CopyWords = {
133
133
  * before still type; English when left out. */
134
134
  clearStyle?: string;
135
135
  clearStyleEmpty?: string;
136
- /**
137
- * The final toolbar's buttons (E5b, design final 2026-10-06): what each is
138
- * called — its accessible name and tooltip. No Undo since 2026-10-07
139
- * (owner ruling): ⌘Z still undoes and needs no word. Optional, like every
140
- * E5b word, so a host's words from before still type.
141
- */
142
- toolbar?: {
143
- bold: string;
144
- italic: string;
145
- underline: string;
146
- strike: string;
147
- color: string;
148
- link: string;
149
- sup: string;
150
- sub: string;
151
- bullet: string;
152
- number: string;
153
- letterCase: string;
154
- caseNone: string;
155
- caseUpper: string;
156
- caseLower: string;
157
- };
158
136
  /** The colour window: its name, the theme row's label, and Remove. */
159
137
  colors?: {
160
138
  title: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-easel",
3
- "version": "5.1.0",
3
+ "version": "6.0.0",
4
4
  "description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Efficient Pty Ltd",
@@ -517,7 +517,7 @@
517
517
  "dist"
518
518
  ],
519
519
  "peerDependencies": {
520
- "efficient-shell": "^7.21.0",
520
+ "efficient-shell": "^7.22.1",
521
521
  "react": ">=18",
522
522
  "react-dom": ">=18"
523
523
  },
@@ -527,7 +527,7 @@
527
527
  "@types/node": "^22.0.0",
528
528
  "@types/react": "^18.2.0",
529
529
  "@types/react-dom": "^18.2.0",
530
- "efficient-shell": "^7.21.0",
530
+ "efficient-shell": "^7.22.1",
531
531
  "esbuild": "^0.27.0",
532
532
  "jsdom": "^26.1.0",
533
533
  "react": "^18.2.0",
@@ -1 +0,0 @@
1
- import{MARKUP_TOOLS as e,MARK_PLACEHOLDERS as t}from"./chunk-546BBOPE.js";var r={formatting:"Formatting",alignment:"Alignment",align:{left:"Left",center:"Center",right:"Right",justify:"Justify"},marks:{...Object.fromEntries(e.map(e=>[e.style,{name:e.name??e.title,title:e.title}])),underline:{name:"Underline",title:"Underline · [words]{underline}"},sup:{name:"Superscript",title:"Superscript · [words]{sup}"},sub:{name:"Subscript",title:"Subscript · [words]{sub}"}},placeholders:t,showMarks:"Show marks",clearStyle:"Clear style",clearStyleEmpty:"Select words first",toolbar:{bold:"Bold",italic:"Italic",underline:"Underline",strike:"Strikethrough",color:"Color",link:"Link",sup:"Superscript",sub:"Subscript",bullet:"Bulleted list",number:"Numbered list",letterCase:"Letter case",caseNone:"Normal",caseUpper:"Uppercase",caseLower:"Lowercase"},colors:{title:"Color",theme:"Theme colors",remove:"Remove",any:"Any color",square:"Saturation and brightness",hue:"Hue",hex:"Hex color"},cells:{fontSize:"Font size",lineHeight:"Line spacing",letterSpacing:"Letter spacing",paragraphSpacing:"Paragraph spacing",tip:({name:e,step:t,unit:r})=>`${e} · step ${t} ${r} · Shift ×10`}};export{r as DEFAULT_COPY_WORDS};