@forgedevstack/ink 1.1.8 → 1.2.0

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