@forgedevstack/ink 1.1.7 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +9 -1
  3. package/bin/ink.const.mjs +26 -0
  4. package/bin/ink.mjs +58 -0
  5. package/dist/components/InkEditor/InkEditor.cjs +1 -1
  6. package/dist/components/InkEditor/InkEditor.d.ts.map +1 -1
  7. package/dist/components/InkEditor/InkEditor.js +1178 -834
  8. package/dist/components/InkEditor/components/AiPanel/AiPanel.cjs +1 -1
  9. package/dist/components/InkEditor/components/AiPanel/AiPanel.d.ts.map +1 -1
  10. package/dist/components/InkEditor/components/AiPanel/AiPanel.js +58 -52
  11. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.cjs +1 -0
  12. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.d.ts +4 -0
  13. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.d.ts.map +1 -0
  14. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.js +209 -0
  15. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.types.d.ts +10 -0
  16. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.types.d.ts.map +1 -0
  17. package/dist/components/InkEditor/components/ExcelSheetPanel/index.d.ts +3 -0
  18. package/dist/components/InkEditor/components/ExcelSheetPanel/index.d.ts.map +1 -0
  19. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.cjs +1 -0
  20. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.d.ts +4 -0
  21. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.d.ts.map +1 -0
  22. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.js +91 -0
  23. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.types.d.ts +11 -0
  24. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.types.d.ts.map +1 -0
  25. package/dist/components/InkEditor/components/GraphEditModal/index.d.ts +3 -0
  26. package/dist/components/InkEditor/components/GraphEditModal/index.d.ts.map +1 -0
  27. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.cjs +1 -0
  28. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.d.ts +4 -0
  29. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.d.ts.map +1 -0
  30. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.js +98 -0
  31. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.types.d.ts +10 -0
  32. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.types.d.ts.map +1 -0
  33. package/dist/components/InkEditor/components/GraphPicker/index.d.ts +3 -0
  34. package/dist/components/InkEditor/components/GraphPicker/index.d.ts.map +1 -0
  35. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.cjs +1 -0
  36. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.d.ts +4 -0
  37. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.d.ts.map +1 -0
  38. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.js +27 -0
  39. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.types.d.ts +7 -0
  40. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.types.d.ts.map +1 -0
  41. package/dist/components/InkEditor/components/HtmlSourcePanel/index.d.ts +3 -0
  42. package/dist/components/InkEditor/components/HtmlSourcePanel/index.d.ts.map +1 -0
  43. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.cjs +1 -1
  44. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.d.ts.map +1 -1
  45. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.js +17 -12
  46. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.types.d.ts +1 -0
  47. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.types.d.ts.map +1 -1
  48. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.cjs +1 -0
  49. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.cjs +1 -0
  50. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.d.ts +10 -0
  51. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.d.ts.map +1 -0
  52. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.js +18 -0
  53. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.d.ts +4 -0
  54. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.d.ts.map +1 -0
  55. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.js +95 -0
  56. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.types.d.ts +11 -0
  57. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.types.d.ts.map +1 -0
  58. package/dist/components/InkEditor/components/TableSizePicker/index.d.ts +3 -0
  59. package/dist/components/InkEditor/components/TableSizePicker/index.d.ts.map +1 -0
  60. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.cjs +1 -0
  61. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.d.ts +4 -0
  62. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.d.ts.map +1 -0
  63. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.js +81 -0
  64. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.types.d.ts +12 -0
  65. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.types.d.ts.map +1 -0
  66. package/dist/components/InkEditor/components/ThemePicker/index.d.ts +3 -0
  67. package/dist/components/InkEditor/components/ThemePicker/index.d.ts.map +1 -0
  68. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.cjs +1 -0
  69. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.d.ts +4 -0
  70. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.d.ts.map +1 -0
  71. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.js +79 -0
  72. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.types.d.ts +10 -0
  73. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.types.d.ts.map +1 -0
  74. package/dist/components/InkEditor/components/TitleGallery/index.d.ts +3 -0
  75. package/dist/components/InkEditor/components/TitleGallery/index.d.ts.map +1 -0
  76. package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.cjs +1 -1
  77. package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.d.ts.map +1 -1
  78. package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.js +41 -18
  79. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.cjs +1 -1
  80. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.d.ts.map +1 -1
  81. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.js +25 -23
  82. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.cjs +1 -1
  83. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.d.ts +1 -1
  84. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.d.ts.map +1 -1
  85. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.js +7 -7
  86. package/dist/components/InkEditor/components/index.d.ts +14 -0
  87. package/dist/components/InkEditor/components/index.d.ts.map +1 -1
  88. package/dist/components/InkEditor/helpers/format.utils.cjs +2 -2
  89. package/dist/components/InkEditor/helpers/format.utils.d.ts +1 -1
  90. package/dist/components/InkEditor/helpers/format.utils.d.ts.map +1 -1
  91. package/dist/components/InkEditor/helpers/format.utils.js +72 -72
  92. package/dist/constants/colorMode.const.cjs +1 -1
  93. package/dist/constants/colorMode.const.d.ts +1 -1
  94. package/dist/constants/colorMode.const.d.ts.map +1 -1
  95. package/dist/constants/colorMode.const.js +4 -4
  96. package/dist/constants/contextMenu.const.cjs +1 -1
  97. package/dist/constants/contextMenu.const.d.ts +2 -0
  98. package/dist/constants/contextMenu.const.d.ts.map +1 -1
  99. package/dist/constants/contextMenu.const.js +17 -15
  100. package/dist/constants/defaultIcons.cjs +1 -1
  101. package/dist/constants/defaultIcons.d.ts.map +1 -1
  102. package/dist/constants/defaultIcons.js +20 -13
  103. package/dist/constants/defaults.const.cjs +1 -1
  104. package/dist/constants/defaults.const.d.ts +48 -0
  105. package/dist/constants/defaults.const.d.ts.map +1 -1
  106. package/dist/constants/defaults.const.js +201 -102
  107. package/dist/constants/generals.const.cjs +1 -1
  108. package/dist/constants/generals.const.d.ts +48 -0
  109. package/dist/constants/generals.const.d.ts.map +1 -1
  110. package/dist/constants/generals.const.js +71 -28
  111. package/dist/constants/index.d.ts +1 -0
  112. package/dist/constants/index.d.ts.map +1 -1
  113. package/dist/constants/numbers.cjs +1 -1
  114. package/dist/constants/numbers.d.ts +14 -0
  115. package/dist/constants/numbers.d.ts.map +1 -1
  116. package/dist/constants/numbers.js +44 -30
  117. package/dist/constants/plugins.const.cjs +1 -0
  118. package/dist/constants/plugins.const.d.ts +13 -0
  119. package/dist/constants/plugins.const.d.ts.map +1 -0
  120. package/dist/constants/plugins.const.js +45 -0
  121. package/dist/constants/table.const.cjs +1 -1
  122. package/dist/constants/table.const.d.ts +4 -0
  123. package/dist/constants/table.const.d.ts.map +1 -1
  124. package/dist/constants/table.const.js +10 -6
  125. package/dist/constants/toolbar.const.cjs +1 -1
  126. package/dist/constants/toolbar.const.d.ts +7 -0
  127. package/dist/constants/toolbar.const.d.ts.map +1 -1
  128. package/dist/constants/toolbar.const.js +16 -9
  129. package/dist/constants/toolbarMenu.const.cjs +1 -1
  130. package/dist/constants/toolbarMenu.const.d.ts +2 -0
  131. package/dist/constants/toolbarMenu.const.d.ts.map +1 -1
  132. package/dist/constants/toolbarMenu.const.js +80 -19
  133. package/dist/hooks/index.d.ts +2 -0
  134. package/dist/hooks/index.d.ts.map +1 -0
  135. package/dist/hooks/useToolbarOverflow.cjs +1 -0
  136. package/dist/hooks/useToolbarOverflow.d.ts +8 -0
  137. package/dist/hooks/useToolbarOverflow.d.ts.map +1 -0
  138. package/dist/hooks/useToolbarOverflow.js +29 -0
  139. package/dist/index.cjs +1 -1
  140. package/dist/index.d.ts +5 -2
  141. package/dist/index.d.ts.map +1 -1
  142. package/dist/index.js +117 -86
  143. package/dist/plugins/excel/excel.utils.cjs +1 -0
  144. package/dist/plugins/excel/excel.utils.d.ts +13 -0
  145. package/dist/plugins/excel/excel.utils.d.ts.map +1 -0
  146. package/dist/plugins/excel/excel.utils.js +40 -0
  147. package/dist/plugins/excel/index.d.ts +3 -0
  148. package/dist/plugins/excel/index.d.ts.map +1 -0
  149. package/dist/plugins/graph/graph.const.cjs +1 -0
  150. package/dist/plugins/graph/graph.const.d.ts +14 -0
  151. package/dist/plugins/graph/graph.const.d.ts.map +1 -0
  152. package/dist/plugins/graph/graph.const.js +24 -0
  153. package/dist/plugins/graph/graph.types.d.ts +7 -0
  154. package/dist/plugins/graph/graph.types.d.ts.map +1 -0
  155. package/dist/plugins/graph/graph.utils.cjs +1 -0
  156. package/dist/plugins/graph/graph.utils.d.ts +11 -0
  157. package/dist/plugins/graph/graph.utils.d.ts.map +1 -0
  158. package/dist/plugins/graph/graph.utils.js +76 -0
  159. package/dist/plugins/graph/index.d.ts +4 -0
  160. package/dist/plugins/graph/index.d.ts.map +1 -0
  161. package/dist/plugins/host/index.d.ts +2 -0
  162. package/dist/plugins/host/index.d.ts.map +1 -0
  163. package/dist/plugins/host/inkPlugins.cjs +1 -0
  164. package/dist/plugins/host/inkPlugins.d.ts +16 -0
  165. package/dist/plugins/host/inkPlugins.d.ts.map +1 -0
  166. package/dist/plugins/host/inkPlugins.js +20 -0
  167. package/dist/plugins/index.d.ts +5 -0
  168. package/dist/plugins/index.d.ts.map +1 -0
  169. package/dist/plugins/theme/index.d.ts +4 -0
  170. package/dist/plugins/theme/index.d.ts.map +1 -0
  171. package/dist/plugins/theme/inkTheme.cjs +1 -0
  172. package/dist/plugins/theme/inkTheme.d.ts +5 -0
  173. package/dist/plugins/theme/inkTheme.d.ts.map +1 -0
  174. package/dist/plugins/theme/inkTheme.js +30 -0
  175. package/dist/plugins/theme/theme.const.cjs +1 -0
  176. package/dist/plugins/theme/theme.const.d.ts +9 -0
  177. package/dist/plugins/theme/theme.const.d.ts.map +1 -0
  178. package/dist/plugins/theme/theme.const.js +15 -0
  179. package/dist/plugins/theme/theme.types.d.ts +12 -0
  180. package/dist/plugins/theme/theme.types.d.ts.map +1 -0
  181. package/dist/plugins/titles/index.d.ts +4 -0
  182. package/dist/plugins/titles/index.d.ts.map +1 -0
  183. package/dist/plugins/titles/titles.const.cjs +1 -0
  184. package/dist/plugins/titles/titles.const.d.ts +4 -0
  185. package/dist/plugins/titles/titles.const.d.ts.map +1 -0
  186. package/dist/plugins/titles/titles.const.js +15 -0
  187. package/dist/plugins/titles/titles.types.d.ts +2 -0
  188. package/dist/plugins/titles/titles.types.d.ts.map +1 -0
  189. package/dist/plugins/titles/titles.utils.cjs +1 -0
  190. package/dist/plugins/titles/titles.utils.d.ts +3 -0
  191. package/dist/plugins/titles/titles.utils.d.ts.map +1 -0
  192. package/dist/plugins/titles/titles.utils.js +14 -0
  193. package/dist/styles.css +1 -1
  194. package/dist/types/features.types.d.ts +1 -1
  195. package/dist/types/features.types.d.ts.map +1 -1
  196. package/dist/types/index.d.ts +1 -0
  197. package/dist/types/index.d.ts.map +1 -1
  198. package/dist/types/ink.types.d.ts +6 -2
  199. package/dist/types/ink.types.d.ts.map +1 -1
  200. package/dist/types/plugin.types.d.ts +8 -0
  201. package/dist/types/plugin.types.d.ts.map +1 -0
  202. package/dist/types/premium.types.d.ts +1 -1
  203. package/dist/types/premium.types.d.ts.map +1 -1
  204. package/dist/utils/index.d.ts +1 -1
  205. package/dist/utils/index.d.ts.map +1 -1
  206. package/dist/utils/outline.utils.cjs +1 -1
  207. package/dist/utils/outline.utils.d.ts.map +1 -1
  208. package/dist/utils/outline.utils.js +32 -32
  209. package/dist/utils/table.utils.cjs +1 -1
  210. package/dist/utils/table.utils.d.ts +4 -0
  211. package/dist/utils/table.utils.d.ts.map +1 -1
  212. package/dist/utils/table.utils.js +84 -45
  213. package/package.json +7 -1
@@ -1,1238 +1,1582 @@
1
- import { jsxs as D, jsx as l, Fragment as qo } from "react/jsx-runtime";
2
- import { useRef as k, useState as a, useEffect as A } from "react";
3
- import { INK_MIN_HEIGHT as $o, NUMBER_ZERO as f, NUMBER_ONE as xt, INK_DEFAULT_TEXT_COLOR as Zo, INK_DEFAULT_HIGHLIGHT_COLOR as Qo } from "../../constants/numbers.js";
4
- import { EMPTY_STRING as ue, INK_FOOTER_WORDS_LABEL as Jo, INK_FOOTER_DOT as er, INK_FOOTER_CHARS_LABEL as tr, INK_FOOTER_LINE_LABEL as nr, INK_FOOTER_COL_LABEL as or, INK_FOOTER_SYNCED_LABEL as rr, INK_CODE_LABEL as lr, INK_AI_PILL_LABEL as Xe } from "../../constants/generals.const.js";
5
- import { TOOLBAR_OPTION_FONT_DROPDOWN as Xt, TOOLBAR_OPTION_LIST_DROPDOWN as Wt, TOOLBAR_OPTION_CHECKLIST as de, TOOLBAR_OPTION_SIGNATURE as Vt, TOOLBAR_OPTION_FIND_REPLACE as Gt, TOOLBAR_OPTION_FIND_REPLACE_DROPDOWN as Yt, TOOLBAR_OPTION_HORIZONTAL_RULE as zt } from "../../constants/toolbar.const.js";
6
- import { TOOLBAR_SHOW_CONTROL_LABEL as ir, TOOLBAR_SHOW_CONTROL_ARIA_LABEL as cr, AGENT_BAR_PLACEHOLDER as sr, CONTEXT_MENU_LABEL_SHOW_TOOLBAR as ar, CONTEXT_MENU_ID_SHOW_TOOLBAR as ur, TOOLBAR_CONTEXT_MENU_LABEL_CUSTOMIZE as dr, TOOLBAR_CONTEXT_MENU_ID_CUSTOMIZE as _r, TOOLBAR_CONTEXT_MENU_LABEL_HIDE as fr, TOOLBAR_CONTEXT_MENU_ID_HIDE as mr, TOOLBAR_OPTION_DIVIDER as jt } from "../../constants/toolbarMenu.const.js";
7
- import { INK_DEFAULT_COLOR_MODE as Tr, COLOR_MODE_SYSTEM as Er } from "../../constants/colorMode.const.js";
8
- import { KEY_TAB as pr, KEY_ENTER as Or, KEY_ESCAPE as Cr, KEY_K as Lr, KEY_Z as Nr } from "../../constants/keyboard.const.js";
9
- import { FONT_VALUE_SYSTEM as Ir, INK_FONT_OPTIONS as Ar, FONT_DROPDOWN_TITLE as hr } from "../../constants/fonts.const.js";
10
- import { LIST_VALUE_BULLET as gr, INK_LIST_OPTIONS as br, LIST_DROPDOWN_TITLE as Rr } from "../../constants/lists.const.js";
11
- import { FIND_REPLACE_FOCUS_FIND as _e, INK_FIND_REPLACE_OPTIONS as Dr, FIND_REPLACE_DROPDOWN_TITLE as Br, FIND_REPLACE_FOCUS_REPLACE as Sr, FIND_REPLACE_VALUE_REPLACE as Mr } from "../../constants/findReplaceMenu.const.js";
12
- import { BLOCK_DROP_POSITION_BEFORE as kr, DIR_LTR as Ur, DIR_RTL as Hr } from "../../constants/blocks.const.js";
13
- import { INK_PLACEHOLDER_DEFAULT as Pr, INK_DEFAULT_VARIANT as wr, INK_DEFAULT_CHROME as yr, INK_DEFAULT_AUTHOR as Fr, INK_TABLE_DEFAULT_ROWS as Kr, INK_TABLE_DEFAULT_COLS as vr, INK_DEFAULT_FEATURES as xr, INK_CHROME_TOOLBAR as Xr, INK_DEFAULT_TOOLBAR as Wr, INK_CLASS_TOOLBAR_SHOW as Vr, INK_CLASS_TOOLBAR as Gr, INK_CLASS_SHELL as Yr, INK_CLASS_BODY as zr, INK_CLASS_CONTENT as jr, INK_CLASS_FOOTER as qr, INK_CLASS_FOOTER_META as $r, INK_VARIANT_DOCUMENT as qt, INK_CLASS_DIVIDER as Zr, INK_HEADING_OPTIONS as Qr, INK_BUTTON_CONFIG as We, INK_CLASS_BUTTON_WIDE as Jr, INK_CLASS_BUTTON_LABEL as el, INK_CLASS_AI_PILL as tl, INK_CLASS_AI_PILL_DOT as nl, INK_CLASS_BLOCK_ACTIVE as ol, INK_CHECKLIST_HTML as $t, INK_CALLOUT_HTML as rl, INK_FORMAT_BLOCK_PRE as ll, INK_FORMAT_BLOCK_QUOTE as il, INK_FORMAT_BLOCK_P as cl, INK_FORMAT_BLOCK_H3 as sl, INK_FORMAT_BLOCK_H2 as al, INK_FORMAT_BLOCK_H1 as ul, INK_CLASS_ROOT as dl } from "../../constants/defaults.const.js";
14
- import { INK_AI_DEMO_PROVIDER_ID as _l } from "../../constants/aiModels.const.js";
1
+ import { jsxs as S, jsx as r, Fragment as sl } from "react/jsx-runtime";
2
+ import { useRef as B, useState as c, useEffect as b } from "react";
3
+ import { INK_MIN_HEIGHT as al, NUMBER_ZERO as p, NUMBER_ONE as mn, INK_DEFAULT_TEXT_COLOR as ul, INK_DEFAULT_HIGHLIGHT_COLOR as _l, INK_TABLE_COL_RESIZE_EDGE_PX as pn } from "../../constants/numbers.js";
4
+ import { EMPTY_STRING as D, INK_TOOLBAR_MORE_TITLE as Ln, CONTEXT_MENU_LABEL_GRAPH_BAR as dl, CONTEXT_MENU_ID_GRAPH_BAR as Tl, CONTEXT_MENU_LABEL_GRAPH_LINE as El, CONTEXT_MENU_ID_GRAPH_LINE as fl, CONTEXT_MENU_LABEL_GRAPH_PIE as ml, CONTEXT_MENU_ID_GRAPH_PIE as pl, CONTEXT_MENU_LABEL_GRAPH_EDIT as Ll, CONTEXT_MENU_ID_GRAPH_EDIT as Ol, CONTEXT_MENU_LABEL_GRAPH_COLORS as Cl, CONTEXT_MENU_ID_GRAPH_COLORS as Nl, CONTEXT_MENU_LABEL_GRAPH_AI as Il, CONTEXT_MENU_ID_GRAPH_AI as Al, INK_FOOTER_WORDS_LABEL as hl, INK_FOOTER_DOT as gl, INK_FOOTER_CHARS_LABEL as Rl, INK_FOOTER_LINE_LABEL as bl, INK_FOOTER_COL_LABEL as Sl, INK_FOOTER_SYNCED_LABEL as Bl, INK_FULLSCREEN_EXIT_TITLE as Dl, INK_FULLSCREEN_TITLE as Ml, INK_OUTLINE_TOGGLE_TITLE as Hl, INK_HTML_SOURCE_TITLE as kl, INK_HTML_SOURCE_LABEL as Pl, INK_CODE_LABEL as Ul, INK_AI_PILL_LABEL as st, INK_TITLES_DEFAULT_TEXT as On, INK_LINK_PROMPT as vl, INK_LINK_PROMPT_DEFAULT as wl } from "../../constants/generals.const.js";
5
+ import { TOOLBAR_OPTION_FONT_DROPDOWN as Cn, TOOLBAR_OPTION_LIST_DROPDOWN as Nn, TOOLBAR_OPTION_CHECKLIST as ge, TOOLBAR_OPTION_TITLES as In, TOOLBAR_OPTION_EXCEL as An, TOOLBAR_OPTION_GRAPH as hn, TOOLBAR_OPTION_THEME as gn, TOOLBAR_OPTION_FULLSCREEN as Rn, TOOLBAR_OPTION_OUTLINE as bn, TOOLBAR_OPTION_HTML_SOURCE as Sn, TOOLBAR_OPTION_SIGNATURE as Bn, TOOLBAR_OPTION_FIND_REPLACE as Dn, TOOLBAR_OPTION_FIND_REPLACE_DROPDOWN as Mn, TOOLBAR_OPTION_HORIZONTAL_RULE as Hn } from "../../constants/toolbar.const.js";
6
+ import { TOOLBAR_SHOW_CONTROL_LABEL as Kl, TOOLBAR_SHOW_CONTROL_ARIA_LABEL as Fl, AGENT_BAR_PLACEHOLDER as yl, CONTEXT_MENU_LABEL_SHOW_TOOLBAR as xl, CONTEXT_MENU_ID_SHOW_TOOLBAR as Xl, TOOLBAR_CONTEXT_MENU_LABEL_CUSTOMIZE as Gl, TOOLBAR_CONTEXT_MENU_ID_CUSTOMIZE as Wl, TOOLBAR_CONTEXT_MENU_LABEL_HIDE as Vl, TOOLBAR_CONTEXT_MENU_ID_HIDE as Yl, TOOLBAR_OPTION_HINTS as O, TOOLBAR_OPTION_DIVIDER as kn } from "../../constants/toolbarMenu.const.js";
7
+ import { INK_DEFAULT_COLOR_MODE as zl, COLOR_MODE_SYSTEM as $l } from "../../constants/colorMode.const.js";
8
+ import { KEY_TAB as ql, KEY_ENTER as jl, KEY_ESCAPE as Zl, KEY_K as Ql, KEY_Z as Jl } from "../../constants/keyboard.const.js";
9
+ import { FONT_VALUE_SYSTEM as ei, INK_FONT_OPTIONS as ti, FONT_DROPDOWN_TITLE as ni } from "../../constants/fonts.const.js";
10
+ import { LIST_VALUE_BULLET as oi, INK_LIST_OPTIONS as ri, LIST_DROPDOWN_TITLE as li } from "../../constants/lists.const.js";
11
+ import { FIND_REPLACE_FOCUS_FIND as Re, INK_FIND_REPLACE_OPTIONS as ii, FIND_REPLACE_DROPDOWN_TITLE as ci, FIND_REPLACE_FOCUS_REPLACE as si, FIND_REPLACE_VALUE_REPLACE as ai } from "../../constants/findReplaceMenu.const.js";
12
+ import { BLOCK_DROP_POSITION_BEFORE as ui, DIR_LTR as _i, DIR_RTL as di } from "../../constants/blocks.const.js";
13
+ import { INK_PLACEHOLDER_DEFAULT as Ti, INK_DEFAULT_VARIANT as Ei, INK_DEFAULT_CHROME as fi, INK_DEFAULT_AUTHOR as mi, INK_TABLE_DEFAULT_ROWS as pi, INK_TABLE_DEFAULT_COLS as Li, INK_DEFAULT_FEATURES as Oi, INK_CHROME_TOOLBAR as Ci, INK_DEFAULT_TOOLBAR as Ni, INK_VARIANT_DOCUMENT as Pn, INK_CLASS_TOOLBAR_SHOW as Ii, INK_CLASS_TOOLBAR as Ai, INK_CLASS_TOOLBAR_MEASURE as hi, INK_CLASS_TOOLBAR_ROW as gi, INK_ATTR_MORE as Ri, INK_CLASS_TOOLBAR_OVERFLOW as bi, INK_CLASS_TOOLBAR_HINT as Si, INK_CLASS_SHELL as Bi, INK_CLASS_BODY as Di, INK_CLASS_CONTENT as Un, INK_CLASS_CONTENT_HIDDEN as Mi, INK_CLASS_FOOTER as Hi, INK_CLASS_FOOTER_META as ki, INK_CLASS_TABLE_RESIZE as de, INK_CLASS_DIVIDER as Pi, INK_HEADING_OPTIONS as Ui, INK_CLASS_BUTTON_WIDE as vn, INK_CLASS_BUTTON_LABEL as wn, INK_BUTTON_CONFIG as at, INK_CLASS_AI_PILL as Kn, INK_CLASS_AI_PILL_INSTALLED as vi, INK_CLASS_AI_PILL_DOT as wi, INK_ATTR_GRAPH as Ki, INK_CLASS_BLOCK_ACTIVE as Fi, INK_ATTR_GRAPH_POINTS as Fn, INK_ATTR_GRAPH_COLORS as yi, INK_CHECKLIST_HTML as yn, INK_CALLOUT_HTML as xi, INK_FORMAT_BLOCK_PRE as Xi, INK_FORMAT_BLOCK_QUOTE as Gi, INK_FORMAT_BLOCK_P as Wi, INK_FORMAT_BLOCK_H3 as Vi, INK_FORMAT_BLOCK_H2 as Yi, INK_FORMAT_BLOCK_H1 as zi, INK_CLASS_ROOT as $i } from "../../constants/defaults.const.js";
14
+ import { INK_AI_DEMO_PROVIDER_ID as qi } from "../../constants/aiModels.const.js";
15
15
  import "../../constants/openai.const.js";
16
- import { INK_DEFAULT_ICONS as Zt } from "../../constants/defaultIcons.js";
17
- import { CONTEXT_MENU_LABEL_TABLE_ROW_ABOVE as fl, CONTEXT_MENU_ID_TABLE_ROW_ABOVE as ml, CONTEXT_MENU_LABEL_TABLE_ROW_BELOW as Tl, CONTEXT_MENU_ID_TABLE_ROW_BELOW as El, CONTEXT_MENU_LABEL_TABLE_COL_LEFT as pl, CONTEXT_MENU_ID_TABLE_COL_LEFT as Ol, CONTEXT_MENU_LABEL_TABLE_COL_RIGHT as Cl, CONTEXT_MENU_ID_TABLE_COL_RIGHT as Ll, CONTEXT_MENU_LABEL_TABLE_DELETE_ROW as Nl, CONTEXT_MENU_ID_TABLE_DELETE_ROW as Il, CONTEXT_MENU_LABEL_TABLE_DELETE_COL as Al, CONTEXT_MENU_ID_TABLE_DELETE_COL as hl, CONTEXT_MENU_LABEL_BOLD as gl, CONTEXT_MENU_ID_BOLD as bl, CONTEXT_MENU_LABEL_ITALIC as Rl, CONTEXT_MENU_ID_ITALIC as Dl, CONTEXT_MENU_LABEL_UNDERLINE as Bl, CONTEXT_MENU_ID_UNDERLINE as Sl, CONTEXT_MENU_LABEL_STRIKE as Ml, CONTEXT_MENU_ID_STRIKE as kl, CONTEXT_MENU_LABEL_HEADING as Ul, CONTEXT_MENU_ID_HEADING as Hl, CONTEXT_MENU_LABEL_BULLET as Pl, CONTEXT_MENU_ID_BULLET as wl, CONTEXT_MENU_LABEL_ORDERED as yl, CONTEXT_MENU_ID_ORDERED as Fl, CONTEXT_MENU_LABEL_LINK as Kl, CONTEXT_MENU_ID_LINK as vl, CONTEXT_MENU_LABEL_CLEAR as xl, CONTEXT_MENU_ID_CLEAR as Xl, CONTEXT_MENU_LABEL_FIND as Wl, CONTEXT_MENU_ID_FIND as Vl, CONTEXT_MENU_LABEL_SIGNATURE as Gl, CONTEXT_MENU_ID_SIGNATURE as Yl, CONTEXT_MENU_LABEL_COMMENT as zl, CONTEXT_MENU_ID_COMMENT as jl } from "../../constants/contextMenu.const.js";
18
- import { cn as ql } from "../../utils/cn.utils.js";
19
- import { applyTypoAutoFix as $l } from "../../utils/typo.utils.js";
20
- import { createInkId as Qt } from "../../utils/id.utils.js";
21
- import { getTableCellFromSelection as Jt, buildTableHtml as Zl, insertTableRow as en, insertTableColumn as tn, deleteTableRow as Ql, deleteTableColumn as Jl } from "../../utils/table.utils.js";
22
- import { getBlockElement as te, clearBlockDragClasses as Ve, markActiveBlock as nn, markDraggingBlock as ei, moveBlock as ti, resolveDropPosition as on, reorderBlockBefore as ni, reorderBlockAfter as oi, markDropTarget as rn } from "../../utils/blocks.utils.js";
23
- import { createTrackChange as Ge, rejectTrackChangeInHtml as ri, acceptTrackChangeInHtml as li, wrapInsertHtml as ln, wrapDeleteHtml as ii } from "../../utils/trackChanges.utils.js";
24
- import { removeCommentMark as ci, wrapSelectionAsComment as si, createCommentThread as ai } from "../../utils/comments.utils.js";
25
- import { InkHistoryStack as Ye } from "../../utils/history.utils.js";
26
- import { extractSlashQuery as ui, filterSlashCommands as di } from "../../utils/slash.utils.js";
27
- import { countWords as _i } from "../../utils/words.utils.js";
28
- import { scrollOutlineHeading as fi, getCaretLineCol as cn, collectOutlineItems as sn } from "../../utils/outline.utils.js";
29
- import { resolveInkPremium as mi, hasInkPremiumFeature as ne, themeTokensToStyle as Ti } from "../../utils/premium.utils.js";
30
- import { extractClipboardHtml as Ei, sanitizePastedHtml as pi, extractClipboardText as Oi } from "../../utils/paste.utils.js";
31
- import { readInkMemory as Ci, writeInkMemory as Li } from "../../utils/memory.utils.js";
32
- import { replaceInHtml as Ni } from "../../utils/findReplace.utils.js";
33
- import { withPreservedSelection as ze } from "../../utils/selection.utils.js";
34
- import { readToolbarItems as Ii, readToolbarHidden as Ai, listCustomizableToolbarOptions as hi, writeToolbarHidden as gi, buildVisibleToolbarItems as bi, writeToolbarItems as Ri } from "../../utils/toolbarStorage.utils.js";
35
- import { Button as Di } from "../../common-components/Button/Button.js";
36
- import { ContextMenu as an } from "../../common-components/ContextMenu/ContextMenu.js";
37
- import { insertImage as je, insertHTML as I, setTextColor as Bi, setHighlightColor as Si, getActiveFormats as Mi, queryCommandValue as ki, detectListType as Ui, tryConvertMarkdownListPrefix as Hi, execCommand as p, insertLink as Pi, applyFontFamily as wi, applyListType as yi, clearFormatDeep as Fi, setBlockDirection as un, fileToDataUrl as Ki } from "./helpers/format.utils.js";
38
- import { inkAi as vi } from "../../plugins/ai/aiPlugin.js";
39
- import { ToolbarButton as O } from "./components/ToolbarButton/ToolbarButton.js";
40
- import { ToolbarDropdown as fe } from "./components/ToolbarDropdown/ToolbarDropdown.js";
41
- import { ToolbarColorPicker as dn } from "./components/ToolbarColorPicker/ToolbarColorPicker.js";
42
- import { CommentsPanel as xi } from "./components/CommentsPanel/CommentsPanel.js";
43
- import { AiPanel as Xi } from "./components/AiPanel/AiPanel.js";
44
- import { AiAutocomplete as Wi } from "./components/AiAutocomplete/AiAutocomplete.js";
45
- import { AI_AUTOCOMPLETE_DEBOUNCE_MS as Vi, AI_AUTOCOMPLETE_COMMAND_INSERT_TEXT as Gi } from "./components/AiAutocomplete/AiAutocomplete.const.js";
46
- import { getTextBeforeCaret as Yi, getCaretPositionInRoot as _n } from "./components/AiAutocomplete/AiAutocomplete.utils.js";
47
- import { BlockHandles as zi } from "./components/BlockHandles/BlockHandles.js";
48
- import { BLOCK_HANDLES_DRAG_MIME as ji, BLOCK_HANDLES_DRAG_PAYLOAD as qi, BLOCK_HANDLES_DRAG_EFFECT_MOVE as fn } from "./components/BlockHandles/BlockHandles.const.js";
49
- import { InlineToolbar as $i } from "./components/InlineToolbar/InlineToolbar.js";
50
- import { INLINE_TOOLBAR_EDGE_PADDING_PX as Zi, INLINE_TOOLBAR_ESTIMATED_WIDTH_PX as Qi, INLINE_TOOLBAR_ESTIMATED_HEIGHT_PX as Ji, INLINE_TOOLBAR_GAP_PX as ec } from "./components/InlineToolbar/InlineToolbar.const.js";
51
- import { selectionIsInsideElement as tc, clampInlineToolbarPosition as nc } from "./components/InlineToolbar/InlineToolbar.utils.js";
52
- import { SlashMenu as oc } from "./components/SlashMenu/SlashMenu.js";
53
- import { OutlineRail as rc } from "./components/OutlineRail/OutlineRail.js";
54
- import { TrackChangesBar as lc } from "./components/TrackChangesBar/TrackChangesBar.js";
55
- import { SignPad as ic } from "./components/SignPad/SignPad.js";
56
- import { FindReplace as cc } from "./components/FindReplace/FindReplace.js";
57
- import { ToolbarCustomize as sc } from "./components/ToolbarCustomize/ToolbarCustomize.js";
58
- const qe = () => {
59
- const h = window.getSelection();
60
- if (!h || h.rangeCount === f) return "";
61
- const C = h.getRangeAt(f), g = document.createElement("div");
62
- return g.appendChild(C.cloneContents()), g.innerHTML;
63
- }, E = (h) => {
64
- h == null || h.focus({ preventScroll: !0 });
65
- }, fs = (h) => {
66
- var Ft;
16
+ import { INK_DEFAULT_ICONS as xn } from "../../constants/defaultIcons.js";
17
+ import { CONTEXT_MENU_LABEL_TABLE_ROW_ABOVE as ji, CONTEXT_MENU_ID_TABLE_ROW_ABOVE as Zi, CONTEXT_MENU_LABEL_TABLE_ROW_BELOW as Qi, CONTEXT_MENU_ID_TABLE_ROW_BELOW as Ji, CONTEXT_MENU_LABEL_TABLE_COL_LEFT as ec, CONTEXT_MENU_ID_TABLE_COL_LEFT as tc, CONTEXT_MENU_LABEL_TABLE_COL_RIGHT as nc, CONTEXT_MENU_ID_TABLE_COL_RIGHT as oc, CONTEXT_MENU_LABEL_TABLE_DELETE_ROW as rc, CONTEXT_MENU_ID_TABLE_DELETE_ROW as lc, CONTEXT_MENU_LABEL_TABLE_DELETE_COL as ic, CONTEXT_MENU_ID_TABLE_DELETE_COL as cc, CONTEXT_MENU_LABEL_TABLE_HEADER as sc, CONTEXT_MENU_ID_TABLE_HEADER as ac, CONTEXT_MENU_LABEL_BOLD as uc, CONTEXT_MENU_ID_BOLD as _c, CONTEXT_MENU_LABEL_ITALIC as dc, CONTEXT_MENU_ID_ITALIC as Tc, CONTEXT_MENU_LABEL_UNDERLINE as Ec, CONTEXT_MENU_ID_UNDERLINE as fc, CONTEXT_MENU_LABEL_STRIKE as mc, CONTEXT_MENU_ID_STRIKE as pc, CONTEXT_MENU_LABEL_HEADING as Lc, CONTEXT_MENU_ID_HEADING as Oc, CONTEXT_MENU_LABEL_BULLET as Cc, CONTEXT_MENU_ID_BULLET as Nc, CONTEXT_MENU_LABEL_ORDERED as Ic, CONTEXT_MENU_ID_ORDERED as Ac, CONTEXT_MENU_LABEL_LINK as hc, CONTEXT_MENU_ID_LINK as gc, CONTEXT_MENU_LABEL_CLEAR as Rc, CONTEXT_MENU_ID_CLEAR as bc, CONTEXT_MENU_LABEL_FIND as Sc, CONTEXT_MENU_ID_FIND as Bc, CONTEXT_MENU_LABEL_SIGNATURE as Dc, CONTEXT_MENU_ID_SIGNATURE as Mc, CONTEXT_MENU_LABEL_COMMENT as Hc, CONTEXT_MENU_ID_COMMENT as kc } from "../../constants/contextMenu.const.js";
18
+ import { TABLE_CELL_SELECTOR as Xn, TABLE_TAG as ut } from "../../constants/table.const.js";
19
+ import { cn as Pc } from "../../utils/cn.utils.js";
20
+ import { applyTypoAutoFix as Uc } from "../../utils/typo.utils.js";
21
+ import { createInkId as Gn } from "../../utils/id.utils.js";
22
+ import { getColumnResizeIndex as Wn, getTableCellFromSelection as Vn, setTableColumnWidth as vc, buildTableHtml as wc, insertTableRow as Yn, insertTableColumn as zn, deleteTableRow as Kc, deleteTableColumn as Fc, toggleTableHeaderRow as yc } from "../../utils/table.utils.js";
23
+ import { getBlockElement as Te, clearBlockDragClasses as _t, markActiveBlock as $n, markDraggingBlock as xc, moveBlock as Xc, resolveDropPosition as qn, reorderBlockBefore as Gc, reorderBlockAfter as Wc, markDropTarget as jn } from "../../utils/blocks.utils.js";
24
+ import { createTrackChange as dt, rejectTrackChangeInHtml as Vc, acceptTrackChangeInHtml as Yc, wrapInsertHtml as Zn, wrapDeleteHtml as zc } from "../../utils/trackChanges.utils.js";
25
+ import { removeCommentMark as $c, wrapSelectionAsComment as qc, createCommentThread as jc } from "../../utils/comments.utils.js";
26
+ import { InkHistoryStack as Tt } from "../../utils/history.utils.js";
27
+ import { extractSlashQuery as Zc, filterSlashCommands as Qc } from "../../utils/slash.utils.js";
28
+ import { countWords as Jc } from "../../utils/words.utils.js";
29
+ import { collectOutlineItems as J, scrollOutlineHeading as es, getCaretLineCol as Qn } from "../../utils/outline.utils.js";
30
+ import { resolveInkPremium as ts, hasInkPremiumFeature as Ee, themeTokensToStyle as ns } from "../../utils/premium.utils.js";
31
+ import { extractClipboardHtml as os, sanitizePastedHtml as rs, extractClipboardText as ls } from "../../utils/paste.utils.js";
32
+ import { readInkMemory as is, writeInkMemory as cs } from "../../utils/memory.utils.js";
33
+ import { replaceInHtml as ss } from "../../utils/findReplace.utils.js";
34
+ import { withPreservedSelection as Et, captureSelectionInRoot as as, restoreSelectionInRoot as us } from "../../utils/selection.utils.js";
35
+ import { readToolbarItems as _s, readToolbarHidden as ds, listCustomizableToolbarOptions as Ts, writeToolbarHidden as Es, buildVisibleToolbarItems as fs, writeToolbarItems as ms } from "../../utils/toolbarStorage.utils.js";
36
+ import { TITLE_STYLE_DEFAULT as ps } from "../../plugins/titles/titles.const.js";
37
+ import { buildTitleHtml as Jn } from "../../plugins/titles/titles.utils.js";
38
+ import { excelGridToTableHtml as Ls, createEmptyExcelGrid as Os } from "../../plugins/excel/excel.utils.js";
39
+ import { GRAPH_SAMPLE as be, GRAPH_KIND_DEFAULT as eo } from "../../plugins/graph/graph.const.js";
40
+ import { parseGraphColors as to, replaceGraphBlock as no, getGraphBlock as Cs, buildGraphHtml as Ns, parseGraphPoints as oo } from "../../plugins/graph/graph.utils.js";
41
+ import { THEME_DEFAULT as Is } from "../../plugins/theme/theme.const.js";
42
+ import { applyInkTheme as As } from "../../plugins/theme/inkTheme.js";
43
+ import { inkPlugins as fe } from "../../plugins/host/inkPlugins.js";
44
+ import { useToolbarOverflow as hs } from "../../hooks/useToolbarOverflow.js";
45
+ import { Button as gs } from "../../common-components/Button/Button.js";
46
+ import { ContextMenu as ro } from "../../common-components/ContextMenu/ContextMenu.js";
47
+ import { insertImage as ft, insertHTML as A, setTextColor as Rs, setHighlightColor as bs, getActiveFormats as Ss, queryCommandValue as Bs, detectListType as Ds, tryConvertMarkdownListPrefix as Ms, execCommand as h, insertLink as Hs, applyFontFamily as ks, applyListType as Ps, clearFormatDeep as Us, setBlockDirection as lo, fileToDataUrl as vs } from "./helpers/format.utils.js";
48
+ import { inkAi as ws } from "../../plugins/ai/aiPlugin.js";
49
+ import { ToolbarButton as N } from "./components/ToolbarButton/ToolbarButton.js";
50
+ import { ToolbarDropdown as Se } from "./components/ToolbarDropdown/ToolbarDropdown.js";
51
+ import { ToolbarColorPicker as io } from "./components/ToolbarColorPicker/ToolbarColorPicker.js";
52
+ import { CommentsPanel as Ks } from "./components/CommentsPanel/CommentsPanel.js";
53
+ import { AiPanel as Fs } from "./components/AiPanel/AiPanel.js";
54
+ import { AiAutocomplete as ys } from "./components/AiAutocomplete/AiAutocomplete.js";
55
+ import { AI_AUTOCOMPLETE_DEBOUNCE_MS as xs, AI_AUTOCOMPLETE_COMMAND_INSERT_TEXT as Xs } from "./components/AiAutocomplete/AiAutocomplete.const.js";
56
+ import { getTextBeforeCaret as Gs, getCaretPositionInRoot as co } from "./components/AiAutocomplete/AiAutocomplete.utils.js";
57
+ import { BlockHandles as Ws } from "./components/BlockHandles/BlockHandles.js";
58
+ import { BLOCK_HANDLES_DRAG_MIME as Vs, BLOCK_HANDLES_DRAG_PAYLOAD as Ys, BLOCK_HANDLES_DRAG_EFFECT_MOVE as so } from "./components/BlockHandles/BlockHandles.const.js";
59
+ import { InlineToolbar as zs } from "./components/InlineToolbar/InlineToolbar.js";
60
+ import { INLINE_TOOLBAR_EDGE_PADDING_PX as $s, INLINE_TOOLBAR_ESTIMATED_WIDTH_PX as qs, INLINE_TOOLBAR_ESTIMATED_HEIGHT_PX as js, INLINE_TOOLBAR_GAP_PX as Zs } from "./components/InlineToolbar/InlineToolbar.const.js";
61
+ import { selectionIsInsideElement as Qs, clampInlineToolbarPosition as Js } from "./components/InlineToolbar/InlineToolbar.utils.js";
62
+ import { SlashMenu as ea } from "./components/SlashMenu/SlashMenu.js";
63
+ import { OutlineRail as ta } from "./components/OutlineRail/OutlineRail.js";
64
+ import { TrackChangesBar as na } from "./components/TrackChangesBar/TrackChangesBar.js";
65
+ import { SignPad as oa } from "./components/SignPad/SignPad.js";
66
+ import { FindReplace as ra } from "./components/FindReplace/FindReplace.js";
67
+ import { ToolbarCustomize as la } from "./components/ToolbarCustomize/ToolbarCustomize.js";
68
+ import { HtmlSourcePanel as ia } from "./components/HtmlSourcePanel/HtmlSourcePanel.js";
69
+ import { TableSizePicker as ca } from "./components/TableSizePicker/TableSizePicker.js";
70
+ import { TitleGallery as sa } from "./components/TitleGallery/TitleGallery.js";
71
+ import { ExcelSheetPanel as aa } from "./components/ExcelSheetPanel/ExcelSheetPanel.js";
72
+ import { GraphPicker as ua } from "./components/GraphPicker/GraphPicker.js";
73
+ import { GraphEditModal as _a } from "./components/GraphEditModal/GraphEditModal.js";
74
+ import { ThemePicker as da } from "./components/ThemePicker/ThemePicker.js";
75
+ const mt = () => {
76
+ const M = window.getSelection();
77
+ if (!M || M.rangeCount === p) return "";
78
+ const g = M.getRangeAt(p), H = document.createElement("div");
79
+ return H.appendChild(g.cloneContents()), H.innerHTML;
80
+ }, I = (M) => {
81
+ M == null || M.focus({ preventScroll: !0 });
82
+ }, Pu = (M) => {
83
+ var En;
67
84
  const {
68
- value: C,
69
- defaultValue: g = "",
70
- onChange: b,
71
- placeholder: $e = Pr,
85
+ value: g,
86
+ defaultValue: H = "",
87
+ onChange: k,
88
+ placeholder: pt = Ti,
72
89
  disabled: i = !1,
73
- readOnly: c = !1,
74
- minHeight: me = $o,
75
- maxHeight: Te,
76
- toolbar: mn,
77
- className: Tn = "",
78
- testId: En,
79
- allowImagePaste: Ze = !0,
80
- showCharCount: Qe = !1,
81
- charCountMax: Je,
82
- typoAutoFix: pn = !0,
83
- variant: oe = wr,
84
- chrome: On = yr,
85
- colorMode: et = Tr,
86
- features: Cn,
87
- author: w = Fr,
88
- trackChanges: Y,
89
- onTrackChangesChange: Ee,
90
- trackChangesEnabled: re,
91
- onTrackChangesEnabledChange: pe,
92
- comments: z,
93
- onCommentsChange: Oe,
94
- showCommentsPanel: j,
95
- onShowCommentsPanelChange: Ce,
96
- ai: _,
97
- slashCommands: Ln,
98
- tableRows: Nn = Kr,
99
- tableCols: In = vr,
100
- premium: An,
101
- theme: hn,
102
- icons: tt,
103
- pasteMode: gn = "plain",
104
- onImageUpload: nt,
105
- wysiwyg: bn = !1,
106
- keepInMemory: y = !1,
107
- memoryKey: F,
108
- onToolbarChange: Le,
109
- toolbarHidden: K,
110
- onToolbarHiddenChange: Ne,
111
- showOutline: Rn,
112
- style: Dn,
113
- ...Bn
114
- } = h, le = mn ?? (oe === qt ? Xr : Wr), d = { ...xr, ...Cn }, v = mi(An), Sn = ne(v, "icons"), Mn = ne(v, "theme"), kn = ne(v, "richPaste"), Un = ne(v, "imageUpload"), Hn = ne(v, "wysiwyg") && bn, m = Sn && tt ? { ...Zt, ...tt } : Zt, Pn = Mn ? Ti(hn) : {}, wn = kn && gn === "rich", n = k(null), q = k(new Ye(C ?? g)), x = k(null), U = k(null), [Ie, yn] = a(/* @__PURE__ */ new Set()), [Fn, ot] = a("p"), [Kn, vn] = a(f), [xn, Xn] = a(f), [Wn, rt] = a(xt), [Vn, lt] = a(xt), [Gn, it] = a([]), [Yn, zn] = a(f), [jn, Ae] = a(ue), [qn, $n] = a(Zo), [Zn, Qn] = a(Qo), [X, ct] = a(re ?? !1), [Jn, st] = a(Y ?? []), [eo, at] = a(z ?? []), [to, ut] = a(j ?? !1), [dt, ie] = a(!!(_ != null && _.enabled && _.openOnInit)), [ce, no] = a(!1), _t = k(!1), [B, $] = a({
90
+ readOnly: s = !1,
91
+ minHeight: Be = al,
92
+ maxHeight: De,
93
+ toolbar: ao,
94
+ className: uo = "",
95
+ testId: _o,
96
+ allowImagePaste: Lt = !0,
97
+ showCharCount: Ot = !1,
98
+ charCountMax: Ct,
99
+ typoAutoFix: To = !0,
100
+ variant: me = Ei,
101
+ chrome: Eo = fi,
102
+ colorMode: Nt = zl,
103
+ features: fo,
104
+ author: x = mi,
105
+ trackChanges: ee,
106
+ onTrackChangesChange: Me,
107
+ trackChangesEnabled: pe,
108
+ onTrackChangesEnabledChange: He,
109
+ comments: te,
110
+ onCommentsChange: ke,
111
+ showCommentsPanel: ne,
112
+ onShowCommentsPanelChange: Pe,
113
+ ai: E,
114
+ slashCommands: mo,
115
+ tableRows: po = pi,
116
+ tableCols: Lo = Li,
117
+ premium: Oo,
118
+ theme: Co,
119
+ icons: It,
120
+ pasteMode: No = "plain",
121
+ onImageUpload: At,
122
+ wysiwyg: Io = !1,
123
+ keepInMemory: X = !1,
124
+ memoryKey: G,
125
+ onToolbarChange: Ue,
126
+ toolbarHidden: W,
127
+ onToolbarHiddenChange: ve,
128
+ showOutline: Ao,
129
+ onOutlineChange: we,
130
+ style: ho,
131
+ ...go
132
+ } = M, Le = ao ?? (me === Pn ? Ci : Ni), a = { ...Oi, ...fo }, V = ts(Oo), Ro = Ee(V, "icons"), bo = Ee(V, "theme"), So = Ee(V, "richPaste"), Bo = Ee(V, "imageUpload"), Do = Ee(V, "wysiwyg") && Io, f = Ro && It ? { ...xn, ...It } : xn, Mo = bo ? ns(Co) : {}, Ho = So && No === "rich", o = B(null), Oe = B(null), oe = B(new Tt(g ?? H)), Y = B(null), K = B(null), Ce = B(D), [Ke, ko] = c(/* @__PURE__ */ new Set()), [Po, ht] = c("p"), [Uo, vo] = c(p), [wo, Ko] = c(p), [Fo, gt] = c(mn), [yo, Rt] = c(mn), [xo, z] = c([]), [Xo, Go] = c(p), [Wo, Fe] = c(D), [Vo, Yo] = c(ul), [zo, $o] = c(_l), [$, bt] = c(pe ?? !1), [qo, St] = c(ee ?? []), [jo, Bt] = c(te ?? []), [Zo, Dt] = c(ne ?? !1), [Mt, re] = c(!!(E != null && E.enabled && E.openOnInit)), [Ne, Qo] = c(!1), Ht = B(!1), [U, le] = c({
115
133
  visible: !1,
116
134
  suggestion: "",
117
- top: f,
118
- left: f
119
- }), Z = k(null), W = k(f), [ft, oo] = a(""), [ro, lo] = a(0), [io, mt] = a(!1), [co, se] = a([]), [Tt, so] = a({ top: 0, left: 0 }), [Et, he] = a(!1), [ge, ae] = a(!1), [ao, uo] = a(_e), [_o, fo] = a(Ir), [mo, pt] = a(gr), [To, Eo] = a(_e), [be, Re] = a({ open: !1, x: f, y: f }), [po, Ot] = a(!1), [De, Be] = a({
135
+ top: p,
136
+ left: p
137
+ }), ie = B(null), q = B(p), [kt, Jo] = c(""), [er, tr] = c(0), [nr, Pt] = c(!1), [or, Ie] = c([]), [Ut, rr] = c({ top: 0, left: 0 }), [vt, ye] = c(!1), [xe, Ae] = c(!1), [ce, wt] = c(!1), [Kt, Ft] = c(D), [lr, ir] = c(Re), [cr, sr] = c(ei), [ar, yt] = c(oi), [ur, _r] = c(Re), [Xe, Ge] = c({ open: !1, x: p, y: p }), [dr, xt] = c(!1), [We, Ve] = c({
120
138
  open: !1,
121
- x: f,
122
- y: f
123
- }), [Se, V] = a({
139
+ x: p,
140
+ y: p
141
+ }), [Ye, j] = c({
124
142
  open: !1,
125
- top: f,
126
- left: f
127
- }), [Me, Ct] = a(
128
- () => Ii(y, F) ?? le
129
- ), [Oo, Lt] = a(() => K !== void 0 ? K : Ai(y, F) ?? !1), [Co, Nt] = a(!1), It = k(!0), Lo = le.join(","), S = Y ?? Jn, Q = z ?? eo, ke = j ?? to, At = Ln ?? d.slash, Ue = Rn ?? oe === qt, ht = K ?? Oo, gt = le, No = hi(gt), He = et === Er ? void 0 : et, Pe = !!(d.ai && (_ != null && _.enabled) && _.autocomplete !== !1 && !i && !c), we = () => {
130
- Z.current !== null && (window.clearTimeout(Z.current), Z.current = null);
131
- }, R = () => {
132
- we(), W.current += 1, $(
133
- (e) => e.visible || e.suggestion ? { visible: !1, suggestion: "", top: f, left: f } : e
143
+ top: p,
144
+ left: p
145
+ }), [Z, Xt] = c(
146
+ () => _s(X, G) ?? Le
147
+ ), [Tr, Gt] = c(() => W !== void 0 ? W : ds(X, G) ?? !1), [Er, Wt] = c(!1), Vt = B(!0), fr = Le.join(","), v = ee ?? qo, se = te ?? jo, ze = ne ?? Zo, Yt = mo ?? a.slash, [$e, mr] = c(
148
+ () => Ao ?? me === Pn
149
+ ), [zt, m] = c(D), [pr, Lr] = c(!1), Q = B(null), [Or, qe] = c(!1), [Cr, Nr] = c("values"), [Ir, Ar] = c(be), [hr, gr] = c(() => to(null)), [Rr, br] = c(Is), [$t, Sr] = c(!1), Br = !!(a.outline && $e), F = hs(Z.length), qt = W ?? Tr, jt = Le, Dr = Ts(jt), je = Nt === $l ? void 0 : Nt, Ze = !!(a.ai && (E != null && E.enabled) && E.autocomplete !== !1 && !i && !s), Qe = () => {
150
+ ie.current !== null && (window.clearTimeout(ie.current), ie.current = null);
151
+ }, P = () => {
152
+ Qe(), q.current += 1, le(
153
+ (e) => e.visible || e.suggestion ? { visible: !1, suggestion: "", top: p, left: p } : e
134
154
  );
135
- }, Io = () => {
136
- if (!Pe || ce || !n.current) {
137
- R();
155
+ }, Mr = () => {
156
+ if (!Ze || Ne || !o.current) {
157
+ P();
138
158
  return;
139
159
  }
140
160
  const e = window.getSelection();
141
161
  if (!e || !e.isCollapsed) {
142
- R();
162
+ P();
143
163
  return;
144
164
  }
145
- we(), $(
146
- (o) => o.visible || o.suggestion ? { ...o, visible: !1, suggestion: "" } : o
165
+ Qe(), le(
166
+ (n) => n.visible || n.suggestion ? { ...n, visible: !1, suggestion: "" } : n
147
167
  );
148
- const t = (_ == null ? void 0 : _.providerId) || _l;
149
- Z.current = window.setTimeout(() => {
150
- if (Z.current = null, !n.current || _t.current) return;
151
- const o = window.getSelection();
152
- if (!o || !o.isCollapsed) return;
153
- const r = Yi(n.current), s = _n(n.current);
154
- if (!r.trim() || !s) return;
155
- const T = W.current + 1;
156
- W.current = T;
157
- const N = n.current.innerHTML;
158
- vi.runProvider(t, {
168
+ const t = (E == null ? void 0 : E.providerId) || qi;
169
+ ie.current = window.setTimeout(() => {
170
+ if (ie.current = null, !o.current || Ht.current) return;
171
+ const n = window.getSelection();
172
+ if (!n || !n.isCollapsed) return;
173
+ const l = Gs(o.current), u = co(o.current);
174
+ if (!l.trim() || !u) return;
175
+ const T = q.current + 1;
176
+ q.current = T;
177
+ const L = o.current.innerHTML;
178
+ ws.runProvider(t, {
159
179
  capability: "autocomplete",
160
- html: N,
161
- prompt: r,
162
- modelId: _ == null ? void 0 : _.modelId
163
- }).then((P) => {
164
- var vt;
165
- if (T !== W.current) return;
166
- const M = ((vt = P.text) == null ? void 0 : vt.trim()) || "";
167
- if (!M) {
168
- $({
180
+ html: L,
181
+ prompt: l,
182
+ modelId: E == null ? void 0 : E.modelId
183
+ }).then((d) => {
184
+ var _e;
185
+ if (T !== q.current) return;
186
+ const C = ((_e = d.text) == null ? void 0 : _e.trim()) || "";
187
+ if (!C) {
188
+ le({
169
189
  visible: !1,
170
190
  suggestion: "",
171
- top: f,
172
- left: f
191
+ top: p,
192
+ left: p
173
193
  });
174
194
  return;
175
195
  }
176
- const Kt = n.current && _n(n.current) || s;
177
- $({
196
+ const he = o.current && co(o.current) || u;
197
+ le({
178
198
  visible: !0,
179
- suggestion: M,
180
- top: Kt.top,
181
- left: Kt.left
199
+ suggestion: C,
200
+ top: he.top,
201
+ left: he.left
182
202
  });
183
203
  }).catch(() => {
184
- T === W.current && $({
204
+ T === q.current && le({
185
205
  visible: !1,
186
206
  suggestion: "",
187
- top: f,
188
- left: f
207
+ top: p,
208
+ left: p
189
209
  });
190
210
  });
191
- }, Vi);
211
+ }, xs);
192
212
  };
193
- A(() => () => {
194
- we(), W.current += 1;
195
- }, []), A(() => {
196
- _t.current = ce, ce && R();
197
- }, [ce]), A(() => {
198
- re !== void 0 && ct(re);
199
- }, [re]), A(() => {
200
- Y && st(Y);
201
- }, [Y]), A(() => {
202
- z && at(z);
203
- }, [z]), A(() => {
204
- j !== void 0 && ut(j);
205
- }, [j]), A(() => {
206
- K !== void 0 && Lt(K);
207
- }, [K]), A(() => {
208
- if (It.current) {
209
- It.current = !1;
213
+ b(() => () => {
214
+ Qe(), q.current += 1;
215
+ }, []), b(() => {
216
+ Ht.current = Ne, Ne && P();
217
+ }, [Ne]), b(() => {
218
+ pe !== void 0 && bt(pe);
219
+ }, [pe]), b(() => {
220
+ ee && St(ee);
221
+ }, [ee]), b(() => {
222
+ te && Bt(te);
223
+ }, [te]), b(() => {
224
+ ne !== void 0 && Dt(ne);
225
+ }, [ne]), b(() => {
226
+ W !== void 0 && Gt(W);
227
+ }, [W]), b(() => {
228
+ if (Vt.current) {
229
+ Vt.current = !1;
210
230
  return;
211
231
  }
212
- Ct(le);
213
- }, [Lo]), A(() => {
214
- if (!n.current || C === void 0 || C === x.current) return;
215
- if (n.current.innerHTML === C) {
216
- x.current = C;
232
+ Xt(Le);
233
+ }, [fr]), b(() => {
234
+ if (!o.current || g === void 0 || g === Y.current) return;
235
+ if (o.current.innerHTML === g) {
236
+ Y.current = g;
217
237
  return;
218
238
  }
219
- const e = document.activeElement === n.current;
220
- ze(e ? n.current : null, () => {
221
- n.current && (n.current.innerHTML = C);
222
- }), x.current = C;
223
- }, [C]), A(() => {
224
- if (!n.current) return;
225
- const e = y ? Ci(F) : "";
239
+ const e = document.activeElement === o.current;
240
+ Et(e ? o.current : null, () => {
241
+ o.current && (o.current.innerHTML = g);
242
+ }), Y.current = g;
243
+ }, [g]), b(() => {
244
+ if (!o.current) return;
245
+ const e = X ? is(G) : "";
226
246
  if (e) {
227
- n.current.innerHTML = e, x.current = e, q.current = new Ye(e), b == null || b(e);
247
+ o.current.innerHTML = e, Y.current = e, oe.current = new Tt(e), k == null || k(e), a.outline && z(J(o.current));
228
248
  return;
229
249
  }
230
- C === void 0 && g && (n.current.innerHTML = g, x.current = g, q.current = new Ye(g), b == null || b(g));
250
+ if (g !== void 0) {
251
+ a.outline && z(J(o.current));
252
+ return;
253
+ }
254
+ H && (o.current.innerHTML = H, Y.current = H, oe.current = new Tt(H), k == null || k(H), a.outline && z(J(o.current)));
255
+ }, []), b(() => {
256
+ const e = () => {
257
+ Sr(document.fullscreenElement === Oe.current);
258
+ };
259
+ return document.addEventListener("fullscreenchange", e), () => document.removeEventListener("fullscreenchange", e);
231
260
  }, []);
232
- const ye = (e) => {
233
- if (q.current.push(e), x.current = e, b == null || b(e), y && Li(e, F), Qe && n.current) {
234
- const o = n.current.textContent ?? ue;
235
- vn(o.length), Xn(_i(o));
261
+ const Je = (e) => {
262
+ if (oe.current.push(e), Y.current = e, k == null || k(e), X && cs(e, G), Ot && o.current) {
263
+ const n = o.current.textContent ?? D;
264
+ vo(n.length), Ko(Jc(n));
236
265
  }
237
- Ue && it(sn(n.current));
238
- const t = cn(n.current);
239
- rt(t.line), lt(t.col);
240
- }, H = (e) => {
241
- n.current && (ze(n.current, () => {
242
- n.current && (n.current.innerHTML = e);
243
- }), ye(e));
244
- }, Fe = (e) => {
245
- Lt(e), Ne == null || Ne(e), gi(e, y, F);
246
- }, Ao = (e) => {
247
- Ct(e), Le == null || Le(e), Ri(e, y, F);
248
- }, ho = (e, t) => {
249
- if (e === jt) return;
250
- const o = new Set(
251
- Me.filter((r) => r !== jt)
266
+ a.outline && z(J(o.current));
267
+ const t = Qn(o.current);
268
+ gt(t.line), Rt(t.col);
269
+ }, w = (e) => {
270
+ o.current && (Et(o.current, () => {
271
+ o.current && (o.current.innerHTML = e);
272
+ }), Je(e));
273
+ }, et = (e) => {
274
+ Gt(e), ve == null || ve(e), Es(e, X, G);
275
+ }, Hr = (e) => {
276
+ Xt(e), Ue == null || Ue(e), ms(e, X, G);
277
+ }, kr = (e, t) => {
278
+ if (e === kn) return;
279
+ const n = new Set(
280
+ Z.filter((l) => l !== kn)
252
281
  );
253
- t ? o.add(e) : o.delete(e), Ao(bi(gt, o));
254
- }, J = (e) => {
255
- st(e), Ee == null || Ee(e);
256
- }, Ke = (e) => {
257
- at(e), Oe == null || Oe(e);
258
- }, ve = (e) => {
259
- ut(e), Ce == null || Ce(e);
260
- }, go = (e) => {
261
- ct(e), pe == null || pe(e);
262
- }, bo = () => {
263
- if (i || c) {
264
- V((s) => s.open ? { ...s, open: !1 } : s);
282
+ t ? n.add(e) : n.delete(e), Hr(fs(jt, n));
283
+ }, ae = (e) => {
284
+ St(e), Me == null || Me(e);
285
+ }, tt = (e) => {
286
+ Bt(e), ke == null || ke(e);
287
+ }, nt = (e) => {
288
+ Dt(e), Pe == null || Pe(e);
289
+ }, Pr = (e) => {
290
+ bt(e), He == null || He(e);
291
+ }, Ur = () => {
292
+ if (i || s) {
293
+ j((u) => u.open ? { ...u, open: !1 } : u);
265
294
  return;
266
295
  }
267
296
  const e = window.getSelection();
268
- if (!e || e.isCollapsed || e.rangeCount === 0 || !tc(e, n.current)) {
269
- V((s) => s.open ? { ...s, open: !1 } : s);
297
+ if (!e || e.isCollapsed || e.rangeCount === 0 || !Qs(e, o.current)) {
298
+ j((u) => u.open ? { ...u, open: !1 } : u);
270
299
  return;
271
300
  }
272
- const o = e.getRangeAt(0).getBoundingClientRect();
273
- if (o.width === 0 && o.height === 0) {
274
- V((s) => s.open ? { ...s, open: !1 } : s);
301
+ const n = e.getRangeAt(0).getBoundingClientRect();
302
+ if (n.width === 0 && n.height === 0) {
303
+ j((u) => u.open ? { ...u, open: !1 } : u);
275
304
  return;
276
305
  }
277
- const r = nc({
278
- selectionRect: o,
279
- toolbarWidth: Qi,
280
- toolbarHeight: Ji,
306
+ const l = Js({
307
+ selectionRect: n,
308
+ toolbarWidth: qs,
309
+ toolbarHeight: js,
281
310
  viewport: { width: window.innerWidth, height: window.innerHeight },
282
- gap: ec,
283
- edgePadding: Zi
311
+ gap: Zs,
312
+ edgePadding: $s
284
313
  });
285
- V({ open: !0, top: r.top, left: r.left });
286
- }, ee = () => {
287
- yn(Mi());
288
- const e = ki("formatBlock");
289
- e && ot(e.toLowerCase().replace(/[<>]/g, "")), pt(Ui()), oo(qe()), bo();
290
- const t = cn(n.current);
291
- if (rt(t.line), lt(t.col), Ue && it(sn(n.current)), !n.current || !d.blocks) return;
292
- const o = window.getSelection(), r = (o == null ? void 0 : o.anchorNode) ?? null, s = te(r, n.current);
293
- if (nn(n.current, s), s) {
294
- const T = n.current.getBoundingClientRect(), N = s.getBoundingClientRect();
295
- lo(N.top - T.top + n.current.scrollTop), mt(!0);
314
+ j({ open: !0, top: l.top, left: l.left });
315
+ }, ue = () => {
316
+ var L;
317
+ ko(Ss());
318
+ const e = Bs("formatBlock");
319
+ e && ht(e.toLowerCase().replace(/[<>]/g, "")), yt(Ds()), Jo(mt());
320
+ const t = (L = window.getSelection()) == null ? void 0 : L.toString().trim();
321
+ t && (Ce.current = t), Ur();
322
+ const n = Qn(o.current);
323
+ if (gt(n.line), Rt(n.col), a.outline && z(J(o.current)), !o.current || !a.blocks) return;
324
+ const l = window.getSelection(), u = (l == null ? void 0 : l.anchorNode) ?? null, T = Te(u, o.current);
325
+ if ($n(o.current, T), T) {
326
+ const d = o.current.getBoundingClientRect(), C = T.getBoundingClientRect();
327
+ tr(C.top - d.top + o.current.scrollTop), Pt(!0);
296
328
  } else
297
- mt(!1);
298
- }, u = () => {
299
- var t, o, r;
300
- if (!n.current) return;
301
- let e = n.current.innerHTML;
302
- if (X && d.trackChanges) {
303
- const s = window.getSelection();
304
- if (s && !s.isCollapsed) {
305
- const T = qe();
329
+ Pt(!1);
330
+ }, _ = () => {
331
+ var t, n, l;
332
+ if (!o.current) return;
333
+ let e = o.current.innerHTML;
334
+ if ($ && a.trackChanges) {
335
+ const u = window.getSelection();
336
+ if (u && !u.isCollapsed) {
337
+ const T = mt();
306
338
  if (T) {
307
- const N = Ge("delete", T, w);
308
- J([...S, N]), Ro(N.id), e = n.current.innerHTML;
339
+ const L = dt("delete", T, x);
340
+ ae([...v, L]), vr(L.id), e = o.current.innerHTML;
309
341
  }
310
342
  }
311
343
  }
312
- if (ye(e), ee(), At && n.current) {
313
- const s = ((o = (t = window.getSelection()) == null ? void 0 : t.anchorNode) == null ? void 0 : o.textContent) ?? "", T = ui(s);
344
+ if (Je(e), ue(), Yt && o.current) {
345
+ const u = ((n = (t = window.getSelection()) == null ? void 0 : t.anchorNode) == null ? void 0 : n.textContent) ?? "", T = Zc(u);
314
346
  if (T !== null) {
315
- Ae(T), se(di(T));
316
- const N = (r = window.getSelection()) == null ? void 0 : r.getRangeAt(0);
317
- if (N && n.current) {
318
- const P = N.getBoundingClientRect(), M = n.current.getBoundingClientRect();
319
- so({
320
- top: P.bottom - M.top + 8,
321
- left: P.left - M.left
347
+ Fe(T), Ie(Qc(T));
348
+ const L = (l = window.getSelection()) == null ? void 0 : l.getRangeAt(0);
349
+ if (L && o.current) {
350
+ const d = L.getBoundingClientRect(), C = o.current.getBoundingClientRect();
351
+ rr({
352
+ top: d.bottom - C.top + 8,
353
+ left: d.left - C.left
322
354
  });
323
355
  }
324
356
  } else
325
- Ae(ue), se([]);
357
+ Fe(D), Ie([]);
326
358
  }
327
- Pe ? Io() : R();
328
- }, bt = () => {
329
- const e = B.suggestion;
359
+ Ze ? Mr() : P();
360
+ };
361
+ b(() => {
362
+ const e = o.current;
363
+ if (!e || i || s || !a.table) return;
364
+ const t = (l) => {
365
+ const u = l.target;
366
+ if (!(u instanceof Element)) return;
367
+ const T = u.closest(Xn);
368
+ if (!T || !e.contains(T)) return;
369
+ const L = T.closest(ut);
370
+ if (!L) return;
371
+ const d = Wn(l.clientX, T, pn);
372
+ if (d === null) return;
373
+ l.preventDefault();
374
+ const C = l.clientX, he = T.getBoundingClientRect().width;
375
+ L.classList.add(de);
376
+ const _e = (cl) => {
377
+ vc(L, d, he + (cl.clientX - C));
378
+ }, fn = () => {
379
+ L.classList.remove(de), document.removeEventListener("pointermove", _e), document.removeEventListener("pointerup", fn), _();
380
+ };
381
+ document.addEventListener("pointermove", _e), document.addEventListener("pointerup", fn);
382
+ }, n = (l) => {
383
+ const u = l.target;
384
+ if (!(u instanceof Element)) return;
385
+ const T = u.closest(Xn);
386
+ if (e.querySelectorAll(ut).forEach((C) => {
387
+ C.classList.contains(de) || C.classList.remove(de);
388
+ }), !T || !e.contains(T)) return;
389
+ const d = T.closest(ut);
390
+ d && Wn(l.clientX, T, pn) !== null && d.classList.add(de);
391
+ };
392
+ return e.addEventListener("pointerdown", t), e.addEventListener("pointermove", n), () => {
393
+ e.removeEventListener("pointerdown", t), e.removeEventListener("pointermove", n);
394
+ };
395
+ }, [i, s, a.table]);
396
+ const Zt = () => {
397
+ const e = U.suggestion;
330
398
  if (!e) {
331
- R();
399
+ P();
332
400
  return;
333
401
  }
334
- E(n.current), p(Gi, e), R(), u();
335
- }, Ro = (e) => {
402
+ I(o.current), h(Xs, e), P(), _();
403
+ }, vr = (e) => {
336
404
  const t = window.getSelection();
337
405
  if (!t || t.rangeCount === 0) return;
338
- const o = qe();
339
- o && I(ii(o, e));
340
- }, Do = () => {
341
- if (!n.current || !pn || !d.typoAutoFix || i || c) return;
342
- const e = n.current.innerHTML, t = $l(e);
343
- t.html !== e && (ze(n.current, () => {
344
- n.current && (n.current.innerHTML = t.html);
345
- }), ye(t.html));
346
- }, L = (e) => {
347
- if (i || c) return;
348
- if (E(n.current), e === "clearFormat") {
349
- Fi(), u();
406
+ const n = mt();
407
+ n && A(zc(n, e));
408
+ }, wr = () => {
409
+ if (!o.current || !To || !a.typoAutoFix || i || s) return;
410
+ const e = o.current.innerHTML, t = Uc(e);
411
+ t.html !== e && (Et(o.current, () => {
412
+ o.current && (o.current.innerHTML = t.html);
413
+ }), Je(t.html));
414
+ }, R = (e) => {
415
+ if (i || s) return;
416
+ if (I(o.current), e === "clearFormat") {
417
+ Us(), _();
350
418
  return;
351
419
  }
352
- if (e === "directionLtr" && n.current) {
353
- un(n.current, Ur), u();
420
+ if (e === "directionLtr" && o.current) {
421
+ lo(o.current, _i), _();
354
422
  return;
355
423
  }
356
- if (e === "directionRtl" && n.current) {
357
- un(n.current, Hr), u();
424
+ if (e === "directionRtl" && o.current) {
425
+ lo(o.current, di), _();
358
426
  return;
359
427
  }
360
- if (e === de) {
361
- I($t), u();
428
+ if (e === ge) {
429
+ A(yn), _();
362
430
  return;
363
431
  }
364
- const t = We[e];
365
- t && (t.value ? p(t.command, t.value) : p(t.command), u());
366
- }, Bo = (e) => {
367
- i || c || (E(n.current), p("formatBlock", e), ot(e), u());
368
- }, So = (e) => {
369
- i || c || (E(n.current), wi(e), fo(e), u());
370
- }, Mo = (e) => {
371
- i || c || (E(n.current), yi(e), pt(e), u());
372
- }, Rt = (e) => {
373
- uo(e), Eo(e), ae(!0);
374
- }, ko = (e) => {
375
- if (i || c) return;
376
- Rt(e === Mr ? Sr : _e);
377
- }, xe = () => {
378
- if (i || c) return;
379
- const e = window.prompt("Enter URL:", "https://");
380
- e && (E(n.current), Pi(e), u());
381
- }, Dt = async (e) => Un && nt ? nt(e) : Ki(e), Bt = async () => {
382
- if (i || c) return;
432
+ const t = at[e];
433
+ t && (t.value ? h(t.command, t.value) : h(t.command), _());
434
+ }, Kr = (e) => {
435
+ i || s || (I(o.current), h("formatBlock", e), ht(e), _());
436
+ }, Fr = (e) => {
437
+ i || s || (I(o.current), ks(e), sr(e), _());
438
+ }, yr = (e) => {
439
+ i || s || (I(o.current), Ps(e), yt(e), _());
440
+ }, Qt = (e) => {
441
+ ir(e), _r(e), Ae(!0);
442
+ }, xr = (e) => {
443
+ if (i || s) return;
444
+ Qt(e === ai ? si : Re);
445
+ }, ot = () => {
446
+ var l;
447
+ if (i || s) return;
448
+ const e = as(o.current), t = ((l = window.getSelection()) == null ? void 0 : l.toString().trim()) || Ce.current, n = window.prompt(vl, wl);
449
+ n && (I(o.current), us(o.current, e), Hs(n, t), _());
450
+ }, rt = (e) => {
451
+ i || s || (I(o.current), A(e), _());
452
+ }, Xr = (e) => {
453
+ var n;
454
+ const t = ((n = window.getSelection()) == null ? void 0 : n.toString().trim()) || Ce.current;
455
+ rt(Jn(e, t || On));
456
+ }, Jt = async (e) => Bo && At ? At(e) : vs(e), en = async () => {
457
+ if (i || s) return;
383
458
  const e = document.createElement("input");
384
459
  e.type = "file", e.accept = "image/*", e.onchange = async () => {
385
- var r;
386
- const t = (r = e.files) == null ? void 0 : r[0];
460
+ var l;
461
+ const t = (l = e.files) == null ? void 0 : l[0];
387
462
  if (!t) return;
388
- const o = await Dt(t);
389
- E(n.current), je(o, t.name), u();
463
+ const n = await Jt(t);
464
+ I(o.current), ft(n, t.name), _();
390
465
  }, e.click();
391
- }, St = () => {
392
- if (i || c || !d.table) return;
393
- E(n.current);
394
- const e = Zl(Nn, In);
395
- if (X && d.trackChanges) {
396
- const t = Ge("insert", e, w);
397
- J([...S, t]), I(ln(e, t.id));
466
+ }, tn = (e = po, t = Lo) => {
467
+ if (i || s || !a.table) return;
468
+ I(o.current);
469
+ const n = wc(e, t);
470
+ if ($ && a.trackChanges) {
471
+ const l = dt("insert", n, x);
472
+ ae([...v, l]), A(Zn(n, l.id));
398
473
  } else
399
- I(e);
400
- u();
401
- }, Mt = () => {
402
- const e = q.current.undo();
403
- if (e === null || !n.current) {
404
- p("undo"), u();
474
+ A(n);
475
+ _();
476
+ }, nn = () => {
477
+ const e = oe.current.undo();
478
+ if (e === null || !o.current) {
479
+ h("undo"), _();
405
480
  return;
406
481
  }
407
- H(e);
408
- }, kt = () => {
409
- const e = q.current.redo();
410
- if (e === null || !n.current) {
411
- p("redo"), u();
482
+ w(e);
483
+ }, on = () => {
484
+ const e = oe.current.redo();
485
+ if (e === null || !o.current) {
486
+ h("redo"), _();
412
487
  return;
413
488
  }
414
- H(e);
415
- }, Uo = (e) => {
416
- i || c || (e.preventDefault(), Be((t) => t.open ? { ...t, open: !1 } : t), Ot(!!(d.table && Jt())), Re({ open: !0, x: e.clientX, y: e.clientY }));
417
- }, Ho = (e) => {
418
- i || c || (e.preventDefault(), Re((t) => t.open ? { ...t, open: !1 } : t), Be({ open: !0, x: e.clientX, y: e.clientY }));
419
- }, Ut = () => {
420
- if (i || c || !d.comments) return;
489
+ w(e);
490
+ }, Gr = (e) => {
491
+ if (i || s) return;
492
+ e.preventDefault(), Ve((n) => n.open ? { ...n, open: !1 } : n);
493
+ const t = a.graph ? Cs(e.target) : null;
494
+ Q.current = t, Lr(!!t), xt(!!(a.table && Vn())), Ge({ open: !0, x: e.clientX, y: e.clientY });
495
+ }, lt = (e) => {
496
+ const t = Q.current;
497
+ if (!t) return;
498
+ const n = oo(t.getAttribute(Fn));
499
+ no(t, e, n.length ? n : be), Q.current = null, _();
500
+ }, rn = (e) => {
501
+ const t = Q.current;
502
+ if (!t) return;
503
+ const n = oo(t.getAttribute(Fn));
504
+ Ar(n.length ? n : be), gr(to(t.getAttribute(yi))), Nr(e), qe(!0);
505
+ }, Wr = (e, t) => {
506
+ const n = Q.current;
507
+ if (!n) return;
508
+ const l = n.getAttribute(Ki) ?? eo;
509
+ no(n, l, e, t), qe(!1), _();
510
+ }, ln = () => {
511
+ const e = Oe.current;
512
+ if (!(!e || !a.fullscreen)) {
513
+ if (document.fullscreenElement) {
514
+ document.exitFullscreen();
515
+ return;
516
+ }
517
+ e.requestFullscreen();
518
+ }
519
+ }, Vr = () => {
520
+ const e = Q.current;
521
+ if (e) {
522
+ const t = document.createRange();
523
+ t.selectNodeContents(e);
524
+ const n = window.getSelection();
525
+ n == null || n.removeAllRanges(), n == null || n.addRange(t);
526
+ }
527
+ re(!0);
528
+ }, cn = () => {
529
+ const e = !$e;
530
+ mr(e), e && o.current && z(J(o.current)), we == null || we(e);
531
+ }, Yr = (e) => {
532
+ i || s || (e.preventDefault(), Ge((t) => t.open ? { ...t, open: !1 } : t), Ve({ open: !0, x: e.clientX, y: e.clientY }));
533
+ }, sn = () => {
534
+ if (i || s || !a.comments) return;
421
535
  const e = window.prompt("Comment:");
422
536
  if (!(e != null && e.trim())) return;
423
- const t = Qt("hl");
424
- if (E(n.current), !si(t)) return;
425
- const r = ai(w, e.trim(), t);
426
- Ke([r, ...Q]), ve(!0), u();
427
- }, Po = [
537
+ const t = Gn("hl");
538
+ if (I(o.current), !qc(t)) return;
539
+ const l = jc(x, e.trim(), t);
540
+ tt([l, ...se]), nt(!0), _();
541
+ }, zr = [
542
+ {
543
+ id: Wl,
544
+ label: Gl,
545
+ onSelect: () => Wt(!0)
546
+ },
547
+ {
548
+ id: Yl,
549
+ label: Vl,
550
+ onSelect: () => et(!0)
551
+ }
552
+ ], y = (e) => {
553
+ const t = Vn();
554
+ !t || !a.table || e(t) && _();
555
+ }, $r = a.table && dr ? [
556
+ {
557
+ id: Zi,
558
+ label: ji,
559
+ onSelect: () => y((e) => Yn(e, "before"))
560
+ },
561
+ {
562
+ id: Ji,
563
+ label: Qi,
564
+ onSelect: () => y((e) => Yn(e, "after"))
565
+ },
566
+ {
567
+ id: tc,
568
+ label: ec,
569
+ onSelect: () => y((e) => zn(e, "before"))
570
+ },
571
+ {
572
+ id: oc,
573
+ label: nc,
574
+ onSelect: () => y((e) => zn(e, "after"))
575
+ },
576
+ {
577
+ id: lc,
578
+ label: rc,
579
+ onSelect: () => y((e) => Kc(e))
580
+ },
428
581
  {
429
- id: _r,
430
- label: dr,
431
- onSelect: () => Nt(!0)
582
+ id: cc,
583
+ label: ic,
584
+ onSelect: () => y((e) => Fc(e))
432
585
  },
433
586
  {
434
- id: mr,
435
- label: fr,
436
- onSelect: () => Fe(!0)
587
+ id: ac,
588
+ label: sc,
589
+ onSelect: () => y((e) => yc(e))
437
590
  }
438
- ], G = (e) => {
439
- const t = Jt();
440
- !t || !d.table || e(t) && u();
441
- }, wo = [
442
- ...d.table && po ? [
591
+ ] : [], qr = [
592
+ ...a.graph && pr ? [
443
593
  {
444
- id: ml,
445
- label: fl,
446
- onSelect: () => G((e) => en(e, "before"))
594
+ id: Tl,
595
+ label: dl,
596
+ onSelect: () => lt("bar")
447
597
  },
448
598
  {
449
- id: El,
450
- label: Tl,
451
- onSelect: () => G((e) => en(e, "after"))
599
+ id: fl,
600
+ label: El,
601
+ onSelect: () => lt("line")
452
602
  },
453
603
  {
454
- id: Ol,
455
- label: pl,
456
- onSelect: () => G((e) => tn(e, "before"))
604
+ id: pl,
605
+ label: ml,
606
+ onSelect: () => lt("pie")
457
607
  },
458
608
  {
459
- id: Ll,
460
- label: Cl,
461
- onSelect: () => G((e) => tn(e, "after"))
609
+ id: Ol,
610
+ label: Ll,
611
+ onSelect: () => rn("values")
462
612
  },
463
613
  {
464
- id: Il,
465
- label: Nl,
466
- onSelect: () => G((e) => Ql(e))
614
+ id: Nl,
615
+ label: Cl,
616
+ onSelect: () => rn("colors")
467
617
  },
468
618
  {
469
- id: hl,
470
- label: Al,
471
- onSelect: () => G((e) => Jl(e))
619
+ id: Al,
620
+ label: Il,
621
+ onSelect: Vr
472
622
  }
473
623
  ] : [],
624
+ ...$r,
474
625
  {
475
- id: bl,
476
- label: gl,
477
- onSelect: () => L("bold")
626
+ id: _c,
627
+ label: uc,
628
+ onSelect: () => R("bold")
478
629
  },
479
630
  {
480
- id: Dl,
481
- label: Rl,
482
- onSelect: () => L("italic")
631
+ id: Tc,
632
+ label: dc,
633
+ onSelect: () => R("italic")
483
634
  },
484
635
  {
485
- id: Sl,
486
- label: Bl,
487
- onSelect: () => L("underline")
636
+ id: fc,
637
+ label: Ec,
638
+ onSelect: () => R("underline")
488
639
  },
489
640
  {
490
- id: kl,
491
- label: Ml,
492
- onSelect: () => L("strikethrough")
641
+ id: pc,
642
+ label: mc,
643
+ onSelect: () => R("strikethrough")
493
644
  },
494
645
  {
495
- id: Hl,
496
- label: Ul,
497
- onSelect: () => L("heading2")
646
+ id: Oc,
647
+ label: Lc,
648
+ onSelect: () => R("heading2")
498
649
  },
499
650
  {
500
- id: wl,
501
- label: Pl,
502
- onSelect: () => L("bulletList")
651
+ id: Nc,
652
+ label: Cc,
653
+ onSelect: () => R("bulletList")
503
654
  },
504
655
  {
505
- id: Fl,
506
- label: yl,
507
- onSelect: () => L("orderedList")
656
+ id: Ac,
657
+ label: Ic,
658
+ onSelect: () => R("orderedList")
508
659
  },
509
660
  {
510
- id: vl,
511
- label: Kl,
512
- onSelect: () => xe()
661
+ id: gc,
662
+ label: hc,
663
+ onSelect: () => ot()
513
664
  },
514
665
  {
515
- id: Xl,
516
- label: xl,
517
- onSelect: () => L("clearFormat")
666
+ id: bc,
667
+ label: Rc,
668
+ onSelect: () => R("clearFormat")
518
669
  },
519
670
  {
520
- id: Vl,
521
- label: Wl,
522
- disabled: !d.findReplace,
523
- onSelect: () => ae(!0)
671
+ id: Bc,
672
+ label: Sc,
673
+ disabled: !a.findReplace,
674
+ onSelect: () => Ae(!0)
524
675
  },
525
676
  {
526
- id: Yl,
527
- label: Gl,
528
- disabled: !d.signature,
529
- onSelect: () => he(!0)
677
+ id: Mc,
678
+ label: Dc,
679
+ disabled: !a.signature,
680
+ onSelect: () => ye(!0)
530
681
  },
531
682
  {
532
- id: jl,
533
- label: zl,
534
- disabled: !d.comments,
535
- onSelect: () => Ut()
683
+ id: kc,
684
+ label: Hc,
685
+ disabled: !a.comments,
686
+ onSelect: () => sn()
536
687
  },
537
- ...ht ? [
688
+ ...qt ? [
538
689
  {
539
- id: ur,
540
- label: ar,
541
- onSelect: () => Fe(!1)
690
+ id: Xl,
691
+ label: xl,
692
+ onSelect: () => et(!1)
542
693
  }
543
694
  ] : []
544
- ], Ht = (e) => {
545
- if (!n.current) return;
546
- const t = li(n.current.innerHTML, e);
547
- H(t), J(
548
- S.map((o) => o.id === e ? { ...o, accepted: !0 } : o)
695
+ ], an = (e) => {
696
+ if (!o.current) return;
697
+ const t = Yc(o.current.innerHTML, e);
698
+ w(t), ae(
699
+ v.map((n) => n.id === e ? { ...n, accepted: !0 } : n)
549
700
  );
550
- }, Pt = (e) => {
551
- if (!n.current) return;
552
- const t = ri(n.current.innerHTML, e);
553
- H(t), J(
554
- S.map((o) => o.id === e ? { ...o, rejected: !0 } : o)
701
+ }, un = (e) => {
702
+ if (!o.current) return;
703
+ const t = Vc(o.current.innerHTML, e);
704
+ w(t), ae(
705
+ v.map((n) => n.id === e ? { ...n, rejected: !0 } : n)
555
706
  );
556
- }, wt = async (e) => {
557
- const t = await Dt(e), o = `<img src="${t}" alt="" style="max-width:100%;height:auto;" />`;
558
- if (X && d.trackChanges) {
559
- const r = Ge("insert", o, w);
560
- J([...S, r]), I(ln(o, r.id));
707
+ }, _n = async (e) => {
708
+ const t = await Jt(e), n = `<img src="${t}" alt="" style="max-width:100%;height:auto;" />`;
709
+ if ($ && a.trackChanges) {
710
+ const l = dt("insert", n, x);
711
+ ae([...v, l]), A(Zn(n, l.id));
561
712
  } else
562
- je(t);
563
- u();
564
- }, yo = async (e) => {
565
- if (i || c) return;
713
+ ft(t);
714
+ _();
715
+ }, jr = async (e) => {
716
+ if (i || s) return;
566
717
  const t = e.clipboardData;
567
718
  if (!t) return;
568
- if (wn) {
569
- const r = Ei(t);
570
- if (r) {
719
+ if (Ho) {
720
+ const l = os(t);
721
+ if (l) {
571
722
  e.preventDefault();
572
- const T = pi(r);
573
- T && (I(T), u());
574
- const N = t.items;
575
- if (Ze && N)
576
- for (const P of Array.from(N)) {
577
- if (!P.type.startsWith("image/")) continue;
578
- const M = P.getAsFile();
579
- M && await wt(M);
723
+ const T = rs(l);
724
+ T && (A(T), _());
725
+ const L = t.items;
726
+ if (Lt && L)
727
+ for (const d of Array.from(L)) {
728
+ if (!d.type.startsWith("image/")) continue;
729
+ const C = d.getAsFile();
730
+ C && await _n(C);
580
731
  }
581
732
  return;
582
733
  }
583
- const s = Oi(t);
584
- if (s) {
585
- e.preventDefault(), I(s.replace(/\n/g, "<br />")), u();
734
+ const u = ls(t);
735
+ if (u) {
736
+ e.preventDefault(), A(u.replace(/\n/g, "<br />")), _();
586
737
  return;
587
738
  }
588
739
  }
589
- if (!Ze) return;
590
- const o = t.items;
591
- if (o)
592
- for (const r of Array.from(o)) {
593
- if (!r.type.startsWith("image/")) continue;
740
+ if (!Lt) return;
741
+ const n = t.items;
742
+ if (n)
743
+ for (const l of Array.from(n)) {
744
+ if (!l.type.startsWith("image/")) continue;
594
745
  e.preventDefault();
595
- const s = r.getAsFile();
596
- s && await wt(s);
746
+ const u = l.getAsFile();
747
+ u && await _n(u);
597
748
  }
598
- }, Fo = (e) => {
599
- L(e);
600
- }, Ko = (e) => {
601
- if (e.key === pr && B.visible && B.suggestion) {
602
- e.preventDefault(), bt();
749
+ }, Zr = (e) => {
750
+ R(e);
751
+ }, Qr = (e) => {
752
+ if (e.key === ql && U.visible && U.suggestion) {
753
+ e.preventDefault(), Zt();
603
754
  return;
604
755
  }
605
- if (e.key === Or) {
606
- R();
756
+ if (e.key === jl) {
757
+ P();
607
758
  return;
608
759
  }
609
- if (Hi(e.nativeEvent)) {
610
- u();
760
+ if (Ms(e.nativeEvent)) {
761
+ _();
611
762
  return;
612
763
  }
613
- if (e.key === Cr) {
614
- if (B.visible) {
615
- e.preventDefault(), R();
764
+ if (e.key === Zl) {
765
+ if (U.visible) {
766
+ e.preventDefault(), P();
616
767
  return;
617
768
  }
618
- se([]), V((t) => t.open ? { ...t, open: !1 } : t);
769
+ Ie([]), j((t) => t.open ? { ...t, open: !1 } : t);
619
770
  }
620
- if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === Lr) {
621
- e.preventDefault(), d.ai && (_ != null && _.enabled) && ie(!0);
771
+ if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === Ql) {
772
+ e.preventDefault(), a.ai && (E != null && E.enabled) && re(!0);
622
773
  return;
623
774
  }
624
- (e.metaKey || e.ctrlKey) && e.key === Nr && (e.preventDefault(), e.shiftKey ? kt() : Mt());
625
- }, vo = (e) => {
626
- var o;
627
- E(n.current);
775
+ (e.metaKey || e.ctrlKey) && e.key === Jl && (e.preventDefault(), e.shiftKey ? on() : nn());
776
+ }, Jr = (e) => {
777
+ var n;
778
+ I(o.current);
628
779
  const t = window.getSelection();
629
- if ((o = t == null ? void 0 : t.anchorNode) != null && o.textContent) {
630
- const s = t.anchorNode.textContent.replace(/(?:^|\s)\/[^\s]*$/, " ");
631
- t.anchorNode.nodeType === Node.TEXT_NODE && (t.anchorNode.textContent = s);
780
+ if ((n = t == null ? void 0 : t.anchorNode) != null && n.textContent) {
781
+ const u = t.anchorNode.textContent.replace(/(?:^|\s)\/[^\s]*$/, " ");
782
+ t.anchorNode.nodeType === Node.TEXT_NODE && (t.anchorNode.textContent = u);
632
783
  }
633
- switch (Ae(ue), se([]), e.insert) {
784
+ switch (Fe(D), Ie([]), e.insert) {
634
785
  case "heading1":
635
- p("formatBlock", ul);
786
+ h("formatBlock", zi);
636
787
  break;
637
788
  case "heading2":
638
- p("formatBlock", al);
789
+ h("formatBlock", Yi);
639
790
  break;
640
791
  case "heading3":
641
- p("formatBlock", sl);
792
+ h("formatBlock", Vi);
642
793
  break;
643
794
  case "paragraph":
644
- p("formatBlock", cl);
795
+ h("formatBlock", Wi);
645
796
  break;
646
797
  case "bulletList":
647
- p("insertUnorderedList");
798
+ h("insertUnorderedList");
648
799
  break;
649
800
  case "orderedList":
650
- p("insertOrderedList");
801
+ h("insertOrderedList");
651
802
  break;
652
803
  case "checklist":
653
- I($t);
804
+ A(yn);
654
805
  break;
655
806
  case "quote":
656
- p("formatBlock", il);
807
+ h("formatBlock", Gi);
657
808
  break;
658
809
  case "code":
659
- p("formatBlock", ll);
810
+ h("formatBlock", Xi);
660
811
  break;
661
812
  case "callout":
662
- I(rl);
813
+ A(xi);
663
814
  break;
664
815
  case "table":
665
- St();
816
+ tn();
666
817
  return;
667
818
  case "image":
668
- Bt();
819
+ en();
669
820
  return;
670
821
  case "ai":
671
- ie(!0);
822
+ re(!0);
823
+ break;
824
+ case "titles":
825
+ A(Jn(ps, Ce.current || On));
826
+ break;
827
+ case "excel":
828
+ A(Ls(Os()));
829
+ break;
830
+ case "graph":
831
+ A(Ns(eo, be));
672
832
  break;
673
833
  }
674
- u();
675
- }, yt = (e) => {
676
- if (!n.current) return;
677
- const t = window.getSelection(), o = te((t == null ? void 0 : t.anchorNode) ?? null, n.current);
678
- o && ti(o, e) && (u(), ee());
679
- }, xo = (e) => {
680
- if (!n.current) return;
681
- const t = window.getSelection(), o = te((t == null ? void 0 : t.anchorNode) ?? null, n.current), r = n.current.querySelector(`.${ol}`), s = o ?? (r instanceof HTMLElement ? r : null);
682
- if (!s) {
834
+ _();
835
+ }, dn = (e) => {
836
+ if (!o.current) return;
837
+ const t = window.getSelection(), n = Te((t == null ? void 0 : t.anchorNode) ?? null, o.current);
838
+ n && Xc(n, e) && (_(), ue());
839
+ }, el = (e) => {
840
+ if (!o.current) return;
841
+ const t = window.getSelection(), n = Te((t == null ? void 0 : t.anchorNode) ?? null, o.current), l = o.current.querySelector(`.${Fi}`), u = n ?? (l instanceof HTMLElement ? l : null);
842
+ if (!u) {
683
843
  e.preventDefault();
684
844
  return;
685
845
  }
686
- U.current = s, Ve(n.current), nn(n.current, s), ei(s), e.dataTransfer.setData(ji, qi), e.dataTransfer.effectAllowed = fn;
687
- }, Xo = (e) => {
688
- if (!n.current || !U.current) return;
689
- e.preventDefault(), e.dataTransfer.dropEffect = fn;
690
- const t = te(e.target, n.current);
691
- if (!t || t === U.current) {
692
- rn(n.current, null, null);
846
+ K.current = u, _t(o.current), $n(o.current, u), xc(u), e.dataTransfer.setData(Vs, Ys), e.dataTransfer.effectAllowed = so;
847
+ }, tl = (e) => {
848
+ if (!o.current || !K.current) return;
849
+ e.preventDefault(), e.dataTransfer.dropEffect = so;
850
+ const t = Te(e.target, o.current);
851
+ if (!t || t === K.current) {
852
+ jn(o.current, null, null);
693
853
  return;
694
854
  }
695
- const o = on(e.clientY, t);
696
- rn(n.current, t, o);
697
- }, Wo = (e) => {
698
- if (!n.current || !U.current) return;
855
+ const n = qn(e.clientY, t);
856
+ jn(o.current, t, n);
857
+ }, nl = (e) => {
858
+ if (!o.current || !K.current) return;
699
859
  e.preventDefault();
700
- const t = te(e.target, n.current), o = U.current;
701
- t && t !== o && (on(e.clientY, t) === kr ? ni(o, t) : oi(o, t)) && (u(), ee()), Ve(n.current), U.current = null;
702
- }, Vo = () => {
703
- n.current && Ve(n.current), U.current = null;
704
- }, Go = (e, t) => {
860
+ const t = Te(e.target, o.current), n = K.current;
861
+ t && t !== n && (qn(e.clientY, t) === ui ? Gc(n, t) : Wc(n, t)) && (_(), ue()), _t(o.current), K.current = null;
862
+ }, ol = () => {
863
+ o.current && _t(o.current), K.current = null;
864
+ }, it = (e, t) => {
865
+ var l, u, T, L;
705
866
  if (e === "divider")
706
- return /* @__PURE__ */ l("span", { className: Zr }, `divider-${t}`);
867
+ return /* @__PURE__ */ r("span", { className: Pi }, `divider-${t}`);
707
868
  if (e === "headingDropdown")
708
- return /* @__PURE__ */ l(
709
- fe,
869
+ return /* @__PURE__ */ r(
870
+ Se,
710
871
  {
711
872
  title: "Heading",
712
- options: Qr,
713
- value: Fn || "p",
714
- disabled: i || c,
715
- onChange: Bo
873
+ options: Ui,
874
+ value: Po || "p",
875
+ disabled: i || s,
876
+ onChange: Kr
716
877
  },
717
878
  "heading"
718
879
  );
719
- if (e === Xt)
720
- return /* @__PURE__ */ l(
721
- fe,
880
+ if (e === Cn)
881
+ return /* @__PURE__ */ r(
882
+ Se,
722
883
  {
723
- title: hr,
724
- options: Ar,
725
- value: _o,
726
- disabled: i || c,
727
- onChange: So
884
+ title: ni,
885
+ options: ti,
886
+ value: cr,
887
+ disabled: i || s,
888
+ onChange: Fr
728
889
  },
729
- Xt
890
+ Cn
730
891
  );
731
- if (e === Wt)
732
- return /* @__PURE__ */ l(
733
- fe,
892
+ if (e === Nn)
893
+ return /* @__PURE__ */ r(
894
+ Se,
734
895
  {
735
- title: Rr,
736
- options: br,
737
- value: mo,
738
- disabled: i || c,
739
- onChange: Mo
896
+ title: li,
897
+ options: ri,
898
+ value: ar,
899
+ disabled: i || s,
900
+ onChange: yr
740
901
  },
741
- Wt
902
+ Nn
742
903
  );
743
904
  if (e === "textColor")
744
- return /* @__PURE__ */ l(
745
- dn,
905
+ return /* @__PURE__ */ r(
906
+ io,
746
907
  {
747
908
  title: "Text color",
748
909
  type: "text",
749
- value: qn,
750
- disabled: i || c,
751
- onChange: (r) => {
752
- E(n.current), Bi(r), $n(r), u();
910
+ value: Vo,
911
+ disabled: i || s,
912
+ onChange: (d) => {
913
+ I(o.current), Rs(d), Yo(d), _();
753
914
  }
754
915
  },
755
916
  "textColor"
756
917
  );
757
918
  if (e === "highlightColor")
758
- return /* @__PURE__ */ l(
759
- dn,
919
+ return /* @__PURE__ */ r(
920
+ io,
760
921
  {
761
922
  title: "Highlight color",
762
923
  type: "highlight",
763
- value: Zn,
764
- disabled: i || c,
765
- onChange: (r) => {
766
- E(n.current), Si(r), Qn(r), u();
924
+ value: zo,
925
+ disabled: i || s,
926
+ onChange: (d) => {
927
+ I(o.current), bs(d), $o(d), _();
767
928
  }
768
929
  },
769
930
  "highlightColor"
770
931
  );
771
932
  if (e === "link")
772
- return /* @__PURE__ */ l(
773
- O,
933
+ return /* @__PURE__ */ r(
934
+ N,
774
935
  {
775
- icon: m.link,
936
+ icon: f.link,
776
937
  title: "Insert link",
777
- disabled: i || c,
778
- onClick: xe
938
+ hint: O.link,
939
+ onHint: m,
940
+ disabled: i || s,
941
+ onClick: ot
779
942
  },
780
943
  "link"
781
944
  );
782
945
  if (e === "image")
783
- return /* @__PURE__ */ l(
784
- O,
946
+ return /* @__PURE__ */ r(
947
+ N,
785
948
  {
786
- icon: m.image,
949
+ hint: O.image,
950
+ onHint: m,
951
+ icon: f.image,
787
952
  title: "Insert image",
788
- disabled: i || c,
953
+ disabled: i || s,
789
954
  onClick: () => {
790
- Bt();
955
+ en();
791
956
  }
792
957
  },
793
958
  "image"
794
959
  );
795
- if (e === de)
796
- return /* @__PURE__ */ l(
797
- O,
960
+ if (e === ge)
961
+ return /* @__PURE__ */ r(
962
+ N,
798
963
  {
799
- icon: m.checklist,
964
+ icon: f.checklist,
800
965
  title: "Checklist",
801
- disabled: i || c,
802
- onClick: () => L(de)
966
+ hint: O.checklist,
967
+ onHint: m,
968
+ disabled: i || s,
969
+ onClick: () => R(ge)
803
970
  },
804
- de
971
+ ge
805
972
  );
806
973
  if (e === "table")
807
- return d.table ? /* @__PURE__ */ l(
808
- O,
974
+ return a.table ? /* @__PURE__ */ r(
975
+ ca,
809
976
  {
810
- icon: m.table,
811
- title: "Insert table",
812
- disabled: i || c,
813
- onClick: St
977
+ icon: f.table,
978
+ disabled: i || s,
979
+ onSelect: tn
814
980
  },
815
981
  "table"
816
982
  ) : null;
817
- if (e === Vt)
818
- return d.signature ? /* @__PURE__ */ l(
819
- O,
983
+ if (e === In)
984
+ return a.titles ? /* @__PURE__ */ r(
985
+ sa,
986
+ {
987
+ icon: f.titles,
988
+ disabled: i || s,
989
+ pluginColor: (l = fe.get("titles")) == null ? void 0 : l.color,
990
+ hint: O.titles,
991
+ onHint: m,
992
+ onSelect: Xr
993
+ },
994
+ In
995
+ ) : null;
996
+ if (e === An)
997
+ return a.excel ? /* @__PURE__ */ r(
998
+ aa,
999
+ {
1000
+ icon: f.excel,
1001
+ disabled: i || s,
1002
+ pluginColor: (u = fe.get("excel")) == null ? void 0 : u.color,
1003
+ hint: O.excel,
1004
+ onHint: m,
1005
+ onInsert: rt
1006
+ },
1007
+ An
1008
+ ) : null;
1009
+ if (e === hn)
1010
+ return a.graph ? /* @__PURE__ */ r(
1011
+ ua,
1012
+ {
1013
+ icon: f.graph,
1014
+ disabled: i || s,
1015
+ pluginColor: (T = fe.get("graph")) == null ? void 0 : T.color,
1016
+ hint: O.graph,
1017
+ onHint: m,
1018
+ onInsert: rt
1019
+ },
1020
+ hn
1021
+ ) : null;
1022
+ if (e === gn)
1023
+ return a.theme ? /* @__PURE__ */ r(
1024
+ da,
1025
+ {
1026
+ icon: f.theme,
1027
+ disabled: i,
1028
+ pluginColor: (L = fe.get("theme")) == null ? void 0 : L.color,
1029
+ hint: O.theme,
1030
+ onHint: m,
1031
+ value: Rr,
1032
+ onChange: (d) => {
1033
+ br(d), As(Oe.current, d);
1034
+ }
1035
+ },
1036
+ gn
1037
+ ) : null;
1038
+ if (e === Rn)
1039
+ return a.fullscreen ? /* @__PURE__ */ r(
1040
+ N,
1041
+ {
1042
+ icon: f.fullscreen,
1043
+ title: $t ? Dl : Ml,
1044
+ hint: O.fullscreen,
1045
+ onHint: m,
1046
+ active: $t,
1047
+ disabled: i,
1048
+ onClick: ln
1049
+ },
1050
+ Rn
1051
+ ) : null;
1052
+ if (e === bn)
1053
+ return a.outline ? /* @__PURE__ */ r(
1054
+ N,
820
1055
  {
821
- icon: m.signature,
1056
+ icon: f.outline,
1057
+ title: Hl,
1058
+ hint: O.outline,
1059
+ onHint: m,
1060
+ active: $e,
1061
+ disabled: i,
1062
+ onClick: cn
1063
+ },
1064
+ bn
1065
+ ) : null;
1066
+ if (e === Sn)
1067
+ return a.htmlSource ? /* @__PURE__ */ r(
1068
+ N,
1069
+ {
1070
+ className: vn,
1071
+ icon: /* @__PURE__ */ r("span", { className: wn, children: Pl }),
1072
+ title: kl,
1073
+ hint: O.htmlSource,
1074
+ onHint: m,
1075
+ active: ce,
1076
+ disabled: i,
1077
+ onClick: () => {
1078
+ var d;
1079
+ if (ce) {
1080
+ s || w(Kt), wt(!1);
1081
+ return;
1082
+ }
1083
+ Ft(((d = o.current) == null ? void 0 : d.innerHTML) ?? g ?? D), wt(!0);
1084
+ }
1085
+ },
1086
+ Sn
1087
+ ) : null;
1088
+ if (e === Bn)
1089
+ return a.signature ? /* @__PURE__ */ r(
1090
+ N,
1091
+ {
1092
+ icon: f.signature,
822
1093
  title: "Sign pad",
823
- active: Et,
824
- disabled: i || c,
825
- onClick: () => he(!0)
1094
+ hint: O.signature,
1095
+ onHint: m,
1096
+ active: vt,
1097
+ disabled: i || s,
1098
+ onClick: () => ye(!0)
826
1099
  },
827
- Vt
1100
+ Bn
828
1101
  ) : null;
829
- if (e === Gt)
830
- return d.findReplace ? /* @__PURE__ */ l(
831
- O,
1102
+ if (e === Dn)
1103
+ return a.findReplace ? /* @__PURE__ */ r(
1104
+ N,
832
1105
  {
833
- icon: m.findReplace,
1106
+ icon: f.findReplace,
834
1107
  title: "Find and replace",
835
- active: ge,
836
- disabled: i || c,
1108
+ hint: O.findReplace,
1109
+ onHint: m,
1110
+ active: xe,
1111
+ disabled: i || s,
837
1112
  onClick: () => {
838
- ge ? ae(!1) : Rt(_e);
1113
+ xe ? Ae(!1) : Qt(Re);
839
1114
  }
840
1115
  },
841
- Gt
1116
+ Dn
842
1117
  ) : null;
843
- if (e === Yt)
844
- return d.findReplace ? /* @__PURE__ */ l(
845
- fe,
1118
+ if (e === Mn)
1119
+ return a.findReplace ? /* @__PURE__ */ r(
1120
+ Se,
846
1121
  {
847
- title: Br,
848
- options: Dr,
849
- value: To,
850
- disabled: i || c,
851
- onChange: ko
1122
+ title: ci,
1123
+ options: ii,
1124
+ value: ur,
1125
+ disabled: i || s,
1126
+ onChange: xr
852
1127
  },
853
- Yt
1128
+ Mn
854
1129
  ) : null;
855
- if (e === zt)
856
- return d.horizontalRule ? /* @__PURE__ */ l(
857
- O,
1130
+ if (e === Hn)
1131
+ return a.horizontalRule ? /* @__PURE__ */ r(
1132
+ N,
858
1133
  {
859
- icon: m.horizontalRule,
1134
+ icon: f.horizontalRule,
860
1135
  title: "Horizontal rule",
861
- disabled: i || c,
1136
+ hint: O.horizontalRule,
1137
+ onHint: m,
1138
+ disabled: i || s,
862
1139
  onClick: () => {
863
- E(n.current), I("<hr />"), u();
1140
+ I(o.current), A("<hr />"), _();
864
1141
  }
865
1142
  },
866
- zt
1143
+ Hn
867
1144
  ) : null;
868
1145
  if (e === "undo")
869
- return /* @__PURE__ */ l(
870
- O,
1146
+ return /* @__PURE__ */ r(
1147
+ N,
871
1148
  {
872
- icon: m.undo,
1149
+ icon: f.undo,
873
1150
  title: "Undo",
874
- disabled: i || c,
875
- onClick: Mt
1151
+ hint: O.undo,
1152
+ onHint: m,
1153
+ disabled: i || s,
1154
+ onClick: nn
876
1155
  },
877
1156
  "undo"
878
1157
  );
879
1158
  if (e === "redo")
880
- return /* @__PURE__ */ l(
881
- O,
1159
+ return /* @__PURE__ */ r(
1160
+ N,
882
1161
  {
883
- icon: m.redo,
1162
+ icon: f.redo,
884
1163
  title: "Redo",
885
- disabled: i || c,
886
- onClick: kt
1164
+ hint: O.redo,
1165
+ onHint: m,
1166
+ disabled: i || s,
1167
+ onClick: on
887
1168
  },
888
1169
  "redo"
889
1170
  );
890
1171
  if (e === "trackChanges")
891
- return d.trackChanges ? /* @__PURE__ */ l(
892
- O,
1172
+ return a.trackChanges ? /* @__PURE__ */ r(
1173
+ N,
893
1174
  {
894
- icon: m.trackChanges,
1175
+ icon: f.trackChanges,
895
1176
  title: "Track changes",
896
- active: X,
897
- disabled: i || c,
898
- onClick: () => go(!X)
1177
+ hint: O.trackChanges,
1178
+ onHint: m,
1179
+ active: $,
1180
+ disabled: i || s,
1181
+ onClick: () => Pr(!$)
899
1182
  },
900
1183
  "trackChanges"
901
1184
  ) : null;
902
1185
  if (e === "comments")
903
- return d.comments ? /* @__PURE__ */ l(
904
- O,
1186
+ return a.comments ? /* @__PURE__ */ r(
1187
+ N,
905
1188
  {
906
- icon: m.comments,
1189
+ icon: f.comments,
907
1190
  title: "Comments",
908
- active: ke,
909
- disabled: i || c,
1191
+ hint: O.comments,
1192
+ onHint: m,
1193
+ active: ze,
1194
+ disabled: i || s,
910
1195
  onClick: () => {
911
- ke ? ve(!1) : Ut();
1196
+ ze ? nt(!1) : sn();
912
1197
  }
913
1198
  },
914
1199
  "comments"
915
1200
  ) : null;
916
1201
  if (e === "code") {
917
- const r = We.code;
918
- return /* @__PURE__ */ l(
919
- O,
1202
+ const d = at.code;
1203
+ return /* @__PURE__ */ r(
1204
+ N,
920
1205
  {
921
- className: Jr,
922
- icon: /* @__PURE__ */ D(qo, { children: [
923
- m.code,
924
- /* @__PURE__ */ l("span", { className: el, children: lr })
1206
+ className: vn,
1207
+ icon: /* @__PURE__ */ S(sl, { children: [
1208
+ f.code,
1209
+ /* @__PURE__ */ r("span", { className: wn, children: Ul })
925
1210
  ] }),
926
- title: r.title,
927
- active: Ie.has(e),
928
- disabled: i || c,
929
- onClick: () => L(e)
1211
+ title: d.title,
1212
+ hint: O.code,
1213
+ onHint: m,
1214
+ active: Ke.has(e),
1215
+ disabled: i || s,
1216
+ onClick: () => R(e)
930
1217
  },
931
1218
  "code"
932
1219
  );
933
1220
  }
934
- if (e === "ai")
935
- return !d.ai || !(_ != null && _.enabled) ? null : /* @__PURE__ */ D(
1221
+ if (e === "ai") {
1222
+ if (!a.ai || !(E != null && E.enabled)) return null;
1223
+ const d = fe.get("ai");
1224
+ return /* @__PURE__ */ S(
936
1225
  "button",
937
1226
  {
938
1227
  type: "button",
939
- className: tl,
940
- title: Xe,
941
- "aria-label": Xe,
942
- "aria-pressed": dt,
943
- disabled: i || c,
944
- onMouseDown: (r) => {
945
- r.preventDefault();
1228
+ className: d ? `${Kn} ${vi}` : Kn,
1229
+ title: st,
1230
+ style: d ? { "--ink-plugin-color": d.color } : void 0,
1231
+ "aria-label": st,
1232
+ "aria-pressed": Mt,
1233
+ disabled: i || s,
1234
+ onMouseEnter: () => m(O.ai),
1235
+ onMouseLeave: () => m(D),
1236
+ onMouseDown: (C) => {
1237
+ C.preventDefault();
946
1238
  },
947
- onClick: () => ie((r) => !r),
1239
+ onClick: () => re((C) => !C),
948
1240
  children: [
949
- /* @__PURE__ */ l("span", { className: nl, "aria-hidden": "true" }),
950
- Xe
1241
+ /* @__PURE__ */ r("span", { className: wi, "aria-hidden": "true" }),
1242
+ st
951
1243
  ]
952
1244
  },
953
1245
  "ai"
954
1246
  );
955
- const o = We[e];
956
- return o ? /* @__PURE__ */ l(
957
- O,
1247
+ }
1248
+ const n = at[e];
1249
+ return n ? /* @__PURE__ */ r(
1250
+ N,
958
1251
  {
959
- icon: m[e] ?? e.slice(0, 1).toUpperCase(),
960
- title: o.title,
961
- active: Ie.has(e),
962
- disabled: i || c,
963
- onClick: () => L(e)
1252
+ icon: f[e] ?? e.slice(0, 1).toUpperCase(),
1253
+ title: n.title,
1254
+ hint: O[e],
1255
+ onHint: m,
1256
+ active: Ke.has(e),
1257
+ disabled: i || s,
1258
+ onClick: () => R(e)
964
1259
  },
965
1260
  e
966
1261
  ) : null;
967
- }, Yo = typeof me == "number" ? `${me}px` : me, zo = typeof Te == "number" ? `${Te}px` : Te, jo = !!(_ != null && _.enabled && dt);
968
- return /* @__PURE__ */ D(
1262
+ }, Tn = typeof Be == "number" ? `${Be}px` : Be, rl = typeof De == "number" ? `${De}px` : De, ll = !!(E != null && E.enabled && Mt), il = Z.slice(p, F.fitCount), ct = Z.slice(F.fitCount);
1263
+ return /* @__PURE__ */ S(
969
1264
  "div",
970
1265
  {
971
- className: ql(dl, Tn),
972
- "data-testid": En,
1266
+ ref: Oe,
1267
+ className: Pc($i, uo),
1268
+ "data-testid": _o,
973
1269
  "data-disabled": i || void 0,
974
- "data-variant": oe,
975
- "data-chrome": On,
976
- "data-color-mode": He,
977
- "data-premium": v.active || void 0,
978
- "data-wysiwyg": Hn || void 0,
979
- style: { ...Pn, ...Dn },
980
- ...Bn,
1270
+ "data-variant": me,
1271
+ "data-chrome": Eo,
1272
+ "data-color-mode": je,
1273
+ "data-premium": V.active || void 0,
1274
+ "data-wysiwyg": Do || void 0,
1275
+ style: { ...Mo, ...ho },
1276
+ ...go,
981
1277
  children: [
982
- ht ? /* @__PURE__ */ l("div", { className: Vr, children: /* @__PURE__ */ l(
983
- Di,
1278
+ qt ? /* @__PURE__ */ r("div", { className: Ii, children: /* @__PURE__ */ r(
1279
+ gs,
984
1280
  {
985
1281
  type: "button",
986
- "aria-label": cr,
987
- onClick: () => Fe(!1),
988
- children: ir
1282
+ "aria-label": Fl,
1283
+ onClick: () => et(!1),
1284
+ children: Kl
989
1285
  }
990
- ) }) : /* @__PURE__ */ l(
1286
+ ) }) : /* @__PURE__ */ S(
991
1287
  "div",
992
1288
  {
993
- className: Gr,
1289
+ className: Ai,
994
1290
  role: "toolbar",
995
1291
  "aria-label": "Ink formatting toolbar",
996
- onContextMenu: Ho,
997
- children: Me.map(Go)
1292
+ onContextMenu: Yr,
1293
+ onDoubleClick: ln,
1294
+ onMouseOver: (e) => {
1295
+ const t = e.target.closest("button");
1296
+ if (!(t instanceof HTMLElement)) return;
1297
+ const n = t.getAttribute("title") || t.getAttribute("aria-label") || D;
1298
+ n && m(n);
1299
+ },
1300
+ onMouseLeave: () => m(D),
1301
+ children: [
1302
+ /* @__PURE__ */ r("div", { className: hi, ref: F.measureRef, "aria-hidden": !0, children: Z.map(it) }),
1303
+ /* @__PURE__ */ S("div", { className: gi, ref: F.rowRef, children: [
1304
+ il.map(it),
1305
+ ct.length > p ? /* @__PURE__ */ r("span", { [Ri]: "", children: /* @__PURE__ */ r(
1306
+ N,
1307
+ {
1308
+ icon: "⋯",
1309
+ title: Ln,
1310
+ hint: Ln,
1311
+ onHint: m,
1312
+ active: F.overflowOpen,
1313
+ disabled: i,
1314
+ onClick: () => F.setOverflowOpen((e) => !e)
1315
+ }
1316
+ ) }) : null
1317
+ ] }),
1318
+ F.overflowOpen && ct.length > p ? /* @__PURE__ */ r("div", { className: bi, children: ct.map(it) }) : null,
1319
+ zt ? /* @__PURE__ */ r("p", { className: Si, children: zt }) : null
1320
+ ]
1321
+ }
1322
+ ),
1323
+ /* @__PURE__ */ r(
1324
+ la,
1325
+ {
1326
+ open: Er,
1327
+ options: Dr,
1328
+ visibleItems: Z,
1329
+ onToggle: kr,
1330
+ onClose: () => Wt(!1)
998
1331
  }
999
1332
  ),
1000
- /* @__PURE__ */ l(
1001
- sc,
1333
+ /* @__PURE__ */ r(
1334
+ _a,
1002
1335
  {
1003
- open: Co,
1004
- options: No,
1005
- visibleItems: Me,
1006
- onToggle: ho,
1007
- onClose: () => Nt(!1)
1336
+ open: Or,
1337
+ mode: Cr,
1338
+ points: Ir,
1339
+ colors: hr,
1340
+ onClose: () => qe(!1),
1341
+ onApply: Wr
1008
1342
  }
1009
1343
  ),
1010
- /* @__PURE__ */ l(
1011
- ic,
1344
+ /* @__PURE__ */ r(
1345
+ oa,
1012
1346
  {
1013
- open: Et,
1014
- onClose: () => he(!1),
1347
+ open: vt,
1348
+ onClose: () => ye(!1),
1015
1349
  onConfirm: (e) => {
1016
- E(n.current), je(e), u();
1350
+ I(o.current), ft(e), _();
1017
1351
  }
1018
1352
  }
1019
1353
  ),
1020
- /* @__PURE__ */ l(
1021
- cc,
1354
+ /* @__PURE__ */ r(
1355
+ ra,
1022
1356
  {
1023
- open: ge,
1024
- focusField: ao,
1025
- onClose: () => ae(!1),
1026
- onReplace: (e, t, o) => {
1027
- if (!n.current) return;
1028
- const r = Ni(n.current.innerHTML, e, t, o);
1029
- H(r);
1357
+ open: xe,
1358
+ focusField: lr,
1359
+ onClose: () => Ae(!1),
1360
+ onReplace: (e, t, n) => {
1361
+ if (!o.current) return;
1362
+ const l = ss(o.current.innerHTML, e, t, n);
1363
+ w(l);
1030
1364
  }
1031
1365
  }
1032
1366
  ),
1033
- X && d.trackChanges ? /* @__PURE__ */ l(
1034
- lc,
1367
+ $ && a.trackChanges ? /* @__PURE__ */ r(
1368
+ na,
1035
1369
  {
1036
- changes: S,
1037
- onAccept: Ht,
1038
- onReject: Pt,
1039
- onAcceptAll: () => S.forEach((e) => Ht(e.id)),
1040
- onRejectAll: () => S.forEach((e) => Pt(e.id))
1370
+ changes: v,
1371
+ onAccept: an,
1372
+ onReject: un,
1373
+ onAcceptAll: () => v.forEach((e) => an(e.id)),
1374
+ onRejectAll: () => v.forEach((e) => un(e.id))
1041
1375
  }
1042
1376
  ) : null,
1043
- oe === "agent" ? /* @__PURE__ */ l("div", { className: "Ink-Editor__agent-bar", role: "status", children: sr }) : null,
1044
- /* @__PURE__ */ D("div", { className: Yr, children: [
1045
- Ue ? /* @__PURE__ */ l(
1046
- rc,
1377
+ me === "agent" ? /* @__PURE__ */ r("div", { className: "Ink-Editor__agent-bar", role: "status", children: yl }) : null,
1378
+ /* @__PURE__ */ S("div", { className: Bi, children: [
1379
+ Br ? /* @__PURE__ */ r(
1380
+ ta,
1047
1381
  {
1048
- items: Gn,
1049
- activeIndex: Yn,
1382
+ items: xo,
1383
+ activeIndex: Xo,
1384
+ onHide: cn,
1050
1385
  onSelect: (e) => {
1051
- n.current && (fi(n.current, e), zn(e));
1386
+ o.current && (es(o.current, e), Go(e));
1052
1387
  }
1053
1388
  }
1054
1389
  ) : null,
1055
- /* @__PURE__ */ D("div", { className: zr, children: [
1056
- d.blocks ? /* @__PURE__ */ l(
1057
- zi,
1390
+ /* @__PURE__ */ S("div", { className: Di, children: [
1391
+ a.blocks ? /* @__PURE__ */ r(
1392
+ Ws,
1058
1393
  {
1059
- visible: io && !i && !c,
1060
- top: ro,
1061
- onMoveUp: () => yt("up"),
1062
- onMoveDown: () => yt("down"),
1063
- onDragStart: xo
1394
+ visible: nr && !i && !s,
1395
+ top: er,
1396
+ onMoveUp: () => dn("up"),
1397
+ onMoveDown: () => dn("down"),
1398
+ onDragStart: el
1064
1399
  }
1065
1400
  ) : null,
1066
- /* @__PURE__ */ l(
1401
+ /* @__PURE__ */ r(
1067
1402
  "div",
1068
1403
  {
1069
- ref: n,
1070
- className: jr,
1071
- contentEditable: !i && !c,
1404
+ ref: o,
1405
+ className: ce ? `${Un} ${Mi}` : Un,
1406
+ contentEditable: !i && !s && !ce,
1072
1407
  role: "textbox",
1073
1408
  "aria-multiline": "true",
1074
- "aria-placeholder": $e,
1075
- "data-placeholder": $e,
1409
+ "aria-placeholder": pt,
1410
+ "data-placeholder": pt,
1076
1411
  suppressContentEditableWarning: !0,
1077
- style: { minHeight: Yo, maxHeight: zo },
1078
- onInput: u,
1079
- onBlur: Do,
1080
- onKeyUp: ee,
1081
- onKeyDown: Ko,
1082
- onMouseUp: ee,
1083
- onContextMenu: Uo,
1084
- onDragOver: Xo,
1085
- onDrop: Wo,
1086
- onDragEnd: Vo,
1412
+ style: { minHeight: Tn, maxHeight: rl },
1413
+ onInput: _,
1414
+ onBlur: wr,
1415
+ onKeyUp: ue,
1416
+ onKeyDown: Qr,
1417
+ onMouseUp: ue,
1418
+ onContextMenu: Gr,
1419
+ onDragOver: tl,
1420
+ onDrop: nl,
1421
+ onDragEnd: ol,
1087
1422
  onPaste: (e) => {
1088
- yo(e);
1423
+ jr(e);
1089
1424
  }
1090
1425
  }
1091
1426
  ),
1092
- At ? /* @__PURE__ */ l(
1093
- oc,
1427
+ ce ? /* @__PURE__ */ r(
1428
+ ia,
1429
+ {
1430
+ value: Kt,
1431
+ onChange: Ft,
1432
+ disabled: i || s,
1433
+ minHeight: Tn
1434
+ }
1435
+ ) : null,
1436
+ Yt ? /* @__PURE__ */ r(
1437
+ ea,
1094
1438
  {
1095
- items: co,
1096
- top: Tt.top,
1097
- left: Tt.left,
1098
- query: jn,
1099
- onSelect: vo
1439
+ items: or,
1440
+ top: Ut.top,
1441
+ left: Ut.left,
1442
+ query: Wo,
1443
+ onSelect: Jr
1100
1444
  }
1101
1445
  ) : null,
1102
- Pe ? /* @__PURE__ */ l(
1103
- Wi,
1446
+ Ze ? /* @__PURE__ */ r(
1447
+ ys,
1104
1448
  {
1105
- suggestion: B.suggestion,
1106
- position: { top: B.top, left: B.left },
1107
- visible: B.visible,
1108
- onAccept: bt,
1109
- onDismiss: R
1449
+ suggestion: U.suggestion,
1450
+ position: { top: U.top, left: U.left },
1451
+ visible: U.visible,
1452
+ onAccept: Zt,
1453
+ onDismiss: P
1110
1454
  }
1111
1455
  ) : null,
1112
- /* @__PURE__ */ l(
1113
- $i,
1456
+ /* @__PURE__ */ r(
1457
+ zs,
1114
1458
  {
1115
- open: Se.open,
1116
- top: Se.top,
1117
- left: Se.left,
1459
+ open: Ye.open,
1460
+ top: Ye.top,
1461
+ left: Ye.left,
1118
1462
  icons: {
1119
- bold: m.bold,
1120
- italic: m.italic,
1121
- underline: m.underline,
1122
- code: m.code,
1123
- link: m.link,
1124
- clearFormat: m.clearFormat
1463
+ bold: f.bold,
1464
+ italic: f.italic,
1465
+ underline: f.underline,
1466
+ code: f.code,
1467
+ link: f.link,
1468
+ clearFormat: f.clearFormat
1125
1469
  },
1126
- activeFormats: Ie,
1127
- disabled: i || c,
1128
- onFormat: Fo,
1129
- onLink: xe,
1130
- onClose: () => V((e) => ({ ...e, open: !1 }))
1470
+ activeFormats: Ke,
1471
+ disabled: i || s,
1472
+ onFormat: Zr,
1473
+ onLink: ot,
1474
+ onClose: () => j((e) => ({ ...e, open: !1 }))
1131
1475
  }
1132
1476
  ),
1133
- /* @__PURE__ */ l(
1134
- an,
1477
+ /* @__PURE__ */ r(
1478
+ ro,
1135
1479
  {
1136
- open: be.open,
1137
- x: be.x,
1138
- y: be.y,
1139
- items: wo,
1140
- colorMode: He,
1480
+ open: Xe.open,
1481
+ x: Xe.x,
1482
+ y: Xe.y,
1483
+ items: qr,
1484
+ colorMode: je,
1141
1485
  onClose: () => {
1142
- Ot(!1), Re((e) => ({ ...e, open: !1 }));
1486
+ xt(!1), Ge((e) => ({ ...e, open: !1 }));
1143
1487
  }
1144
1488
  }
1145
1489
  ),
1146
- /* @__PURE__ */ l(
1147
- an,
1490
+ /* @__PURE__ */ r(
1491
+ ro,
1148
1492
  {
1149
- open: De.open,
1150
- x: De.x,
1151
- y: De.y,
1152
- items: Po,
1153
- colorMode: He,
1154
- onClose: () => Be((e) => ({ ...e, open: !1 }))
1493
+ open: We.open,
1494
+ x: We.x,
1495
+ y: We.y,
1496
+ items: zr,
1497
+ colorMode: je,
1498
+ onClose: () => Ve((e) => ({ ...e, open: !1 }))
1155
1499
  }
1156
1500
  )
1157
1501
  ] }),
1158
- ke && d.comments ? /* @__PURE__ */ l(
1159
- xi,
1502
+ ze && a.comments ? /* @__PURE__ */ r(
1503
+ Ks,
1160
1504
  {
1161
- comments: Q,
1162
- author: w,
1163
- onClose: () => ve(!1),
1505
+ comments: se,
1506
+ author: x,
1507
+ onClose: () => nt(!1),
1164
1508
  onResolve: (e) => {
1165
- const t = Q.find((o) => o.id === e);
1166
- Ke(
1167
- Q.map(
1168
- (o) => o.id === e ? { ...o, resolved: !0 } : o
1509
+ const t = se.find((n) => n.id === e);
1510
+ tt(
1511
+ se.map(
1512
+ (n) => n.id === e ? { ...n, resolved: !0 } : n
1169
1513
  )
1170
- ), t && n.current && H(ci(n.current.innerHTML, t.highlightId));
1514
+ ), t && o.current && w($c(o.current.innerHTML, t.highlightId));
1171
1515
  },
1172
1516
  onAddReply: (e, t) => {
1173
- Ke(
1174
- Q.map(
1175
- (o) => o.id === e ? {
1176
- ...o,
1517
+ tt(
1518
+ se.map(
1519
+ (n) => n.id === e ? {
1520
+ ...n,
1177
1521
  replies: [
1178
- ...o.replies,
1522
+ ...n.replies,
1179
1523
  {
1180
- id: Qt("reply"),
1181
- author: w,
1524
+ id: Gn("reply"),
1525
+ author: x,
1182
1526
  body: t,
1183
1527
  timestamp: Date.now()
1184
1528
  }
1185
1529
  ]
1186
- } : o
1530
+ } : n
1187
1531
  )
1188
1532
  );
1189
1533
  }
1190
1534
  }
1191
1535
  ) : null,
1192
- jo && _ ? /* @__PURE__ */ l(
1193
- Xi,
1536
+ ll && E ? /* @__PURE__ */ r(
1537
+ Fs,
1194
1538
  {
1195
- config: _,
1196
- documentHtml: ((Ft = n.current) == null ? void 0 : Ft.innerHTML) ?? C ?? "",
1197
- selectionHtml: ft,
1198
- onBusyChange: no,
1199
- onClose: () => ie(!1),
1539
+ config: E,
1540
+ documentHtml: ((En = o.current) == null ? void 0 : En.innerHTML) ?? g ?? "",
1541
+ selectionHtml: kt,
1542
+ onBusyChange: Qo,
1543
+ onClose: () => re(!1),
1200
1544
  onApplyHtml: (e) => {
1201
- if (E(n.current), ft)
1202
- I(e);
1545
+ if (I(o.current), kt)
1546
+ A(e);
1203
1547
  else {
1204
- H(e);
1548
+ w(e);
1205
1549
  return;
1206
1550
  }
1207
- u();
1551
+ _();
1208
1552
  }
1209
1553
  }
1210
1554
  ) : null
1211
1555
  ] }),
1212
- Qe ? /* @__PURE__ */ D("div", { className: qr, children: [
1213
- /* @__PURE__ */ D("span", { children: [
1214
- xn,
1556
+ Ot ? /* @__PURE__ */ S("div", { className: Hi, children: [
1557
+ /* @__PURE__ */ S("span", { children: [
1558
+ wo,
1215
1559
  " ",
1216
- Jo,
1560
+ hl,
1217
1561
  " ",
1218
- er,
1562
+ gl,
1219
1563
  " ",
1220
- Kn,
1221
- Je ? ` / ${Je}` : "",
1564
+ Uo,
1565
+ Ct ? ` / ${Ct}` : "",
1222
1566
  " ",
1223
- tr
1567
+ Rl
1224
1568
  ] }),
1225
- /* @__PURE__ */ D("span", { className: $r, children: [
1226
- /* @__PURE__ */ D("span", { children: [
1227
- nr,
1569
+ /* @__PURE__ */ S("span", { className: ki, children: [
1570
+ /* @__PURE__ */ S("span", { children: [
1571
+ bl,
1228
1572
  " ",
1229
- Wn,
1573
+ Fo,
1230
1574
  ", ",
1231
- or,
1575
+ Sl,
1232
1576
  " ",
1233
- Vn
1577
+ yo
1234
1578
  ] }),
1235
- /* @__PURE__ */ l("span", { className: "Ink-Editor__footer-sync", children: rr })
1579
+ /* @__PURE__ */ r("span", { className: "Ink-Editor__footer-sync", children: Bl })
1236
1580
  ] })
1237
1581
  ] }) : null
1238
1582
  ]
@@ -1240,5 +1584,5 @@ const qe = () => {
1240
1584
  );
1241
1585
  };
1242
1586
  export {
1243
- fs as InkEditor
1587
+ Pu as InkEditor
1244
1588
  };