jodit-pro 4.12.32 → 4.12.34

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 (333) hide show
  1. package/es2015/jodit.css +1 -1
  2. package/es2015/jodit.fat.min.css +1 -1
  3. package/es2015/jodit.fat.min.js +8 -8
  4. package/es2015/jodit.js +38 -2
  5. package/es2015/jodit.min.js +2 -2
  6. package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.css +34 -1
  7. package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.js +596 -44
  8. package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.min.css +1 -1
  9. package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.min.js +33 -33
  10. package/es2015/plugins/autocomplete/autocomplete.css +1 -1
  11. package/es2015/plugins/autocomplete/autocomplete.js +1 -1
  12. package/es2015/plugins/autocomplete/autocomplete.min.js +1 -1
  13. package/es2015/plugins/backup/backup.css +1 -1
  14. package/es2015/plugins/backup/backup.js +1 -1
  15. package/es2015/plugins/backup/backup.min.js +1 -1
  16. package/es2015/plugins/button-generator/button-generator.css +1 -1
  17. package/es2015/plugins/button-generator/button-generator.js +1 -1
  18. package/es2015/plugins/button-generator/button-generator.min.js +1 -1
  19. package/es2015/plugins/change-case/change-case.js +1 -1
  20. package/es2015/plugins/change-case/change-case.min.js +1 -1
  21. package/es2015/plugins/color-picker/color-picker.css +1 -1
  22. package/es2015/plugins/color-picker/color-picker.js +1 -1
  23. package/es2015/plugins/color-picker/color-picker.min.js +1 -1
  24. package/es2015/plugins/emoji/emoji.css +1 -1
  25. package/es2015/plugins/emoji/emoji.js +1 -1
  26. package/es2015/plugins/emoji/emoji.min.js +1 -1
  27. package/es2015/plugins/export-docs/export-docs.js +1 -1
  28. package/es2015/plugins/export-docs/export-docs.min.js +1 -1
  29. package/es2015/plugins/finder/finder.css +1 -1
  30. package/es2015/plugins/finder/finder.js +1 -1
  31. package/es2015/plugins/finder/finder.min.js +1 -1
  32. package/es2015/plugins/google-maps/google-maps.css +1 -1
  33. package/es2015/plugins/google-maps/google-maps.js +1 -1
  34. package/es2015/plugins/google-maps/google-maps.min.js +1 -1
  35. package/es2015/plugins/google-search/google-search.js +1 -1
  36. package/es2015/plugins/google-search/google-search.min.js +1 -1
  37. package/es2015/plugins/highlight-signature/highlight-signature.js +1 -1
  38. package/es2015/plugins/highlight-signature/highlight-signature.min.js +1 -1
  39. package/es2015/plugins/iframe-editor/iframe-editor.css +1 -1
  40. package/es2015/plugins/iframe-editor/iframe-editor.js +1 -1
  41. package/es2015/plugins/iframe-editor/iframe-editor.min.js +1 -1
  42. package/es2015/plugins/keyboard/keyboard.css +1 -1
  43. package/es2015/plugins/keyboard/keyboard.js +1 -1
  44. package/es2015/plugins/keyboard/keyboard.min.js +1 -1
  45. package/es2015/plugins/mobile-view/mobile-view.js +1 -1
  46. package/es2015/plugins/mobile-view/mobile-view.min.js +1 -1
  47. package/es2015/plugins/page-break/page-break.js +1 -1
  48. package/es2015/plugins/page-break/page-break.min.js +1 -1
  49. package/es2015/plugins/paste-code/paste-code.css +1 -1
  50. package/es2015/plugins/paste-code/paste-code.js +1 -1
  51. package/es2015/plugins/paste-code/paste-code.min.js +1 -1
  52. package/es2015/plugins/paste-from-word/paste-from-word.js +1 -1
  53. package/es2015/plugins/paste-from-word/paste-from-word.min.js +1 -1
  54. package/es2015/plugins/show-blocks/show-blocks.js +1 -1
  55. package/es2015/plugins/show-blocks/show-blocks.min.js +1 -1
  56. package/es2015/plugins/style/style.css +1 -1
  57. package/es2015/plugins/style/style.js +1 -1
  58. package/es2015/plugins/style/style.min.js +1 -1
  59. package/es2015/plugins/templates/templates.css +1 -1
  60. package/es2015/plugins/templates/templates.js +1 -1
  61. package/es2015/plugins/templates/templates.min.js +1 -1
  62. package/es2015/plugins/todo-list/todo-list.css +1 -1
  63. package/es2015/plugins/todo-list/todo-list.js +1 -1
  64. package/es2015/plugins/todo-list/todo-list.min.js +1 -1
  65. package/es2015/plugins/translate/translate.css +1 -1
  66. package/es2015/plugins/translate/translate.js +1 -1
  67. package/es2015/plugins/translate/translate.min.js +1 -1
  68. package/es2015/plugins/tune-block/tune-block.css +1 -1
  69. package/es2015/plugins/tune-block/tune-block.js +1 -1
  70. package/es2015/plugins/tune-block/tune-block.min.js +1 -1
  71. package/es2018/jodit.fat.min.css +1 -1
  72. package/es2018/jodit.fat.min.js +6 -6
  73. package/es2018/jodit.min.js +2 -2
  74. package/es2018/plugins/ai-assistant-pro/ai-assistant-pro.min.css +1 -1
  75. package/es2018/plugins/ai-assistant-pro/ai-assistant-pro.min.js +38 -38
  76. package/es2018/plugins/autocomplete/autocomplete.min.js +1 -1
  77. package/es2018/plugins/backup/backup.min.js +1 -1
  78. package/es2018/plugins/button-generator/button-generator.min.js +1 -1
  79. package/es2018/plugins/change-case/change-case.min.js +1 -1
  80. package/es2018/plugins/color-picker/color-picker.min.js +1 -1
  81. package/es2018/plugins/emoji/emoji.min.js +1 -1
  82. package/es2018/plugins/export-docs/export-docs.min.js +1 -1
  83. package/es2018/plugins/finder/finder.min.js +1 -1
  84. package/es2018/plugins/google-maps/google-maps.min.js +1 -1
  85. package/es2018/plugins/google-search/google-search.min.js +1 -1
  86. package/es2018/plugins/highlight-signature/highlight-signature.min.js +1 -1
  87. package/es2018/plugins/iframe-editor/iframe-editor.min.js +1 -1
  88. package/es2018/plugins/keyboard/keyboard.min.js +1 -1
  89. package/es2018/plugins/mobile-view/mobile-view.min.js +1 -1
  90. package/es2018/plugins/page-break/page-break.min.js +1 -1
  91. package/es2018/plugins/paste-code/paste-code.min.js +1 -1
  92. package/es2018/plugins/paste-from-word/paste-from-word.min.js +1 -1
  93. package/es2018/plugins/show-blocks/show-blocks.min.js +1 -1
  94. package/es2018/plugins/style/style.min.js +1 -1
  95. package/es2018/plugins/templates/templates.min.js +1 -1
  96. package/es2018/plugins/todo-list/todo-list.min.js +1 -1
  97. package/es2018/plugins/translate/translate.min.js +1 -1
  98. package/es2018/plugins/tune-block/tune-block.min.js +1 -1
  99. package/es2021/jodit.css +1 -1
  100. package/es2021/jodit.fat.min.css +1 -1
  101. package/es2021/jodit.fat.min.js +8 -8
  102. package/es2021/jodit.js +38 -2
  103. package/es2021/jodit.min.js +3 -3
  104. package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.css +34 -1
  105. package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.js +569 -42
  106. package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.min.css +1 -1
  107. package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.min.js +9 -9
  108. package/es2021/plugins/autocomplete/autocomplete.css +1 -1
  109. package/es2021/plugins/autocomplete/autocomplete.js +1 -1
  110. package/es2021/plugins/autocomplete/autocomplete.min.js +1 -1
  111. package/es2021/plugins/backup/backup.css +1 -1
  112. package/es2021/plugins/backup/backup.js +1 -1
  113. package/es2021/plugins/backup/backup.min.js +1 -1
  114. package/es2021/plugins/button-generator/button-generator.css +1 -1
  115. package/es2021/plugins/button-generator/button-generator.js +1 -1
  116. package/es2021/plugins/button-generator/button-generator.min.js +1 -1
  117. package/es2021/plugins/change-case/change-case.js +1 -1
  118. package/es2021/plugins/change-case/change-case.min.js +1 -1
  119. package/es2021/plugins/color-picker/color-picker.css +1 -1
  120. package/es2021/plugins/color-picker/color-picker.js +1 -1
  121. package/es2021/plugins/color-picker/color-picker.min.js +1 -1
  122. package/es2021/plugins/emoji/emoji.css +1 -1
  123. package/es2021/plugins/emoji/emoji.js +1 -1
  124. package/es2021/plugins/emoji/emoji.min.js +1 -1
  125. package/es2021/plugins/export-docs/export-docs.js +1 -1
  126. package/es2021/plugins/export-docs/export-docs.min.js +1 -1
  127. package/es2021/plugins/finder/finder.css +1 -1
  128. package/es2021/plugins/finder/finder.js +1 -1
  129. package/es2021/plugins/finder/finder.min.js +1 -1
  130. package/es2021/plugins/google-maps/google-maps.css +1 -1
  131. package/es2021/plugins/google-maps/google-maps.js +1 -1
  132. package/es2021/plugins/google-maps/google-maps.min.js +1 -1
  133. package/es2021/plugins/google-search/google-search.js +1 -1
  134. package/es2021/plugins/google-search/google-search.min.js +1 -1
  135. package/es2021/plugins/highlight-signature/highlight-signature.js +1 -1
  136. package/es2021/plugins/highlight-signature/highlight-signature.min.js +1 -1
  137. package/es2021/plugins/iframe-editor/iframe-editor.css +1 -1
  138. package/es2021/plugins/iframe-editor/iframe-editor.js +1 -1
  139. package/es2021/plugins/iframe-editor/iframe-editor.min.js +1 -1
  140. package/es2021/plugins/keyboard/keyboard.css +1 -1
  141. package/es2021/plugins/keyboard/keyboard.js +1 -1
  142. package/es2021/plugins/keyboard/keyboard.min.js +1 -1
  143. package/es2021/plugins/mobile-view/mobile-view.js +1 -1
  144. package/es2021/plugins/mobile-view/mobile-view.min.js +1 -1
  145. package/es2021/plugins/page-break/page-break.js +1 -1
  146. package/es2021/plugins/page-break/page-break.min.js +1 -1
  147. package/es2021/plugins/paste-code/paste-code.css +1 -1
  148. package/es2021/plugins/paste-code/paste-code.js +1 -1
  149. package/es2021/plugins/paste-code/paste-code.min.js +1 -1
  150. package/es2021/plugins/paste-from-word/paste-from-word.js +1 -1
  151. package/es2021/plugins/paste-from-word/paste-from-word.min.js +1 -1
  152. package/es2021/plugins/show-blocks/show-blocks.js +1 -1
  153. package/es2021/plugins/show-blocks/show-blocks.min.js +1 -1
  154. package/es2021/plugins/style/style.css +1 -1
  155. package/es2021/plugins/style/style.js +1 -1
  156. package/es2021/plugins/style/style.min.js +1 -1
  157. package/es2021/plugins/templates/templates.css +1 -1
  158. package/es2021/plugins/templates/templates.js +1 -1
  159. package/es2021/plugins/templates/templates.min.js +1 -1
  160. package/es2021/plugins/todo-list/todo-list.css +1 -1
  161. package/es2021/plugins/todo-list/todo-list.js +1 -1
  162. package/es2021/plugins/todo-list/todo-list.min.js +1 -1
  163. package/es2021/plugins/translate/translate.css +1 -1
  164. package/es2021/plugins/translate/translate.js +1 -1
  165. package/es2021/plugins/translate/translate.min.js +1 -1
  166. package/es2021/plugins/tune-block/tune-block.css +1 -1
  167. package/es2021/plugins/tune-block/tune-block.js +1 -1
  168. package/es2021/plugins/tune-block/tune-block.min.js +1 -1
  169. package/es2021.en/jodit.css +1 -1
  170. package/es2021.en/jodit.fat.min.css +1 -1
  171. package/es2021.en/jodit.fat.min.js +25 -25
  172. package/es2021.en/jodit.js +38 -2
  173. package/es2021.en/jodit.min.js +3 -3
  174. package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.css +34 -1
  175. package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.js +569 -42
  176. package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.min.css +1 -1
  177. package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.min.js +9 -9
  178. package/es2021.en/plugins/autocomplete/autocomplete.css +1 -1
  179. package/es2021.en/plugins/autocomplete/autocomplete.js +1 -1
  180. package/es2021.en/plugins/autocomplete/autocomplete.min.js +1 -1
  181. package/es2021.en/plugins/backup/backup.css +1 -1
  182. package/es2021.en/plugins/backup/backup.js +1 -1
  183. package/es2021.en/plugins/backup/backup.min.js +1 -1
  184. package/es2021.en/plugins/button-generator/button-generator.css +1 -1
  185. package/es2021.en/plugins/button-generator/button-generator.js +1 -1
  186. package/es2021.en/plugins/button-generator/button-generator.min.js +1 -1
  187. package/es2021.en/plugins/change-case/change-case.js +1 -1
  188. package/es2021.en/plugins/change-case/change-case.min.js +1 -1
  189. package/es2021.en/plugins/color-picker/color-picker.css +1 -1
  190. package/es2021.en/plugins/color-picker/color-picker.js +1 -1
  191. package/es2021.en/plugins/color-picker/color-picker.min.js +1 -1
  192. package/es2021.en/plugins/emoji/emoji.css +1 -1
  193. package/es2021.en/plugins/emoji/emoji.js +1 -1
  194. package/es2021.en/plugins/emoji/emoji.min.js +1 -1
  195. package/es2021.en/plugins/export-docs/export-docs.js +1 -1
  196. package/es2021.en/plugins/export-docs/export-docs.min.js +1 -1
  197. package/es2021.en/plugins/finder/finder.css +1 -1
  198. package/es2021.en/plugins/finder/finder.js +1 -1
  199. package/es2021.en/plugins/finder/finder.min.js +1 -1
  200. package/es2021.en/plugins/google-maps/google-maps.css +1 -1
  201. package/es2021.en/plugins/google-maps/google-maps.js +1 -1
  202. package/es2021.en/plugins/google-maps/google-maps.min.js +1 -1
  203. package/es2021.en/plugins/google-search/google-search.js +1 -1
  204. package/es2021.en/plugins/google-search/google-search.min.js +1 -1
  205. package/es2021.en/plugins/highlight-signature/highlight-signature.js +1 -1
  206. package/es2021.en/plugins/highlight-signature/highlight-signature.min.js +1 -1
  207. package/es2021.en/plugins/iframe-editor/iframe-editor.css +1 -1
  208. package/es2021.en/plugins/iframe-editor/iframe-editor.js +1 -1
  209. package/es2021.en/plugins/iframe-editor/iframe-editor.min.js +1 -1
  210. package/es2021.en/plugins/keyboard/keyboard.css +1 -1
  211. package/es2021.en/plugins/keyboard/keyboard.js +1 -1
  212. package/es2021.en/plugins/keyboard/keyboard.min.js +1 -1
  213. package/es2021.en/plugins/mobile-view/mobile-view.js +1 -1
  214. package/es2021.en/plugins/mobile-view/mobile-view.min.js +1 -1
  215. package/es2021.en/plugins/page-break/page-break.js +1 -1
  216. package/es2021.en/plugins/page-break/page-break.min.js +1 -1
  217. package/es2021.en/plugins/paste-code/paste-code.css +1 -1
  218. package/es2021.en/plugins/paste-code/paste-code.js +1 -1
  219. package/es2021.en/plugins/paste-code/paste-code.min.js +1 -1
  220. package/es2021.en/plugins/paste-from-word/paste-from-word.js +1 -1
  221. package/es2021.en/plugins/paste-from-word/paste-from-word.min.js +1 -1
  222. package/es2021.en/plugins/show-blocks/show-blocks.js +1 -1
  223. package/es2021.en/plugins/show-blocks/show-blocks.min.js +1 -1
  224. package/es2021.en/plugins/style/style.css +1 -1
  225. package/es2021.en/plugins/style/style.js +1 -1
  226. package/es2021.en/plugins/style/style.min.js +1 -1
  227. package/es2021.en/plugins/templates/templates.css +1 -1
  228. package/es2021.en/plugins/templates/templates.js +1 -1
  229. package/es2021.en/plugins/templates/templates.min.js +1 -1
  230. package/es2021.en/plugins/todo-list/todo-list.css +1 -1
  231. package/es2021.en/plugins/todo-list/todo-list.js +1 -1
  232. package/es2021.en/plugins/todo-list/todo-list.min.js +1 -1
  233. package/es2021.en/plugins/translate/translate.css +1 -1
  234. package/es2021.en/plugins/translate/translate.js +1 -1
  235. package/es2021.en/plugins/translate/translate.min.js +1 -1
  236. package/es2021.en/plugins/tune-block/tune-block.css +1 -1
  237. package/es2021.en/plugins/tune-block/tune-block.js +1 -1
  238. package/es2021.en/plugins/tune-block/tune-block.min.js +1 -1
  239. package/es5/jodit.css +2 -2
  240. package/es5/jodit.fat.min.css +1 -1
  241. package/es5/jodit.fat.min.js +2 -2
  242. package/es5/jodit.js +38 -2
  243. package/es5/jodit.min.css +2 -2
  244. package/es5/jodit.min.js +2 -2
  245. package/es5/plugins/ai-assistant-pro/ai-assistant-pro.css +34 -1
  246. package/es5/plugins/ai-assistant-pro/ai-assistant-pro.js +734 -44
  247. package/es5/plugins/ai-assistant-pro/ai-assistant-pro.min.css +1 -1
  248. package/es5/plugins/ai-assistant-pro/ai-assistant-pro.min.js +2 -2
  249. package/es5/plugins/autocomplete/autocomplete.css +1 -1
  250. package/es5/plugins/autocomplete/autocomplete.js +1 -1
  251. package/es5/plugins/autocomplete/autocomplete.min.js +1 -1
  252. package/es5/plugins/backup/backup.css +1 -1
  253. package/es5/plugins/backup/backup.js +1 -1
  254. package/es5/plugins/backup/backup.min.js +1 -1
  255. package/es5/plugins/button-generator/button-generator.css +1 -1
  256. package/es5/plugins/button-generator/button-generator.js +1 -1
  257. package/es5/plugins/button-generator/button-generator.min.js +1 -1
  258. package/es5/plugins/change-case/change-case.js +1 -1
  259. package/es5/plugins/change-case/change-case.min.js +1 -1
  260. package/es5/plugins/color-picker/color-picker.css +1 -1
  261. package/es5/plugins/color-picker/color-picker.js +1 -1
  262. package/es5/plugins/color-picker/color-picker.min.js +1 -1
  263. package/es5/plugins/emoji/emoji.css +1 -1
  264. package/es5/plugins/emoji/emoji.js +1 -1
  265. package/es5/plugins/emoji/emoji.min.js +1 -1
  266. package/es5/plugins/export-docs/export-docs.js +1 -1
  267. package/es5/plugins/export-docs/export-docs.min.js +1 -1
  268. package/es5/plugins/finder/finder.css +1 -1
  269. package/es5/plugins/finder/finder.js +1 -1
  270. package/es5/plugins/finder/finder.min.js +1 -1
  271. package/es5/plugins/google-maps/google-maps.css +1 -1
  272. package/es5/plugins/google-maps/google-maps.js +1 -1
  273. package/es5/plugins/google-maps/google-maps.min.js +1 -1
  274. package/es5/plugins/google-search/google-search.js +1 -1
  275. package/es5/plugins/google-search/google-search.min.js +1 -1
  276. package/es5/plugins/highlight-signature/highlight-signature.js +1 -1
  277. package/es5/plugins/highlight-signature/highlight-signature.min.js +1 -1
  278. package/es5/plugins/iframe-editor/iframe-editor.css +1 -1
  279. package/es5/plugins/iframe-editor/iframe-editor.js +1 -1
  280. package/es5/plugins/iframe-editor/iframe-editor.min.js +1 -1
  281. package/es5/plugins/keyboard/keyboard.css +1 -1
  282. package/es5/plugins/keyboard/keyboard.js +1 -1
  283. package/es5/plugins/keyboard/keyboard.min.js +1 -1
  284. package/es5/plugins/mobile-view/mobile-view.js +1 -1
  285. package/es5/plugins/mobile-view/mobile-view.min.js +1 -1
  286. package/es5/plugins/page-break/page-break.js +1 -1
  287. package/es5/plugins/page-break/page-break.min.js +1 -1
  288. package/es5/plugins/paste-code/paste-code.css +1 -1
  289. package/es5/plugins/paste-code/paste-code.js +1 -1
  290. package/es5/plugins/paste-code/paste-code.min.js +1 -1
  291. package/es5/plugins/paste-from-word/paste-from-word.js +1 -1
  292. package/es5/plugins/paste-from-word/paste-from-word.min.js +1 -1
  293. package/es5/plugins/show-blocks/show-blocks.js +1 -1
  294. package/es5/plugins/show-blocks/show-blocks.min.js +1 -1
  295. package/es5/plugins/style/style.css +1 -1
  296. package/es5/plugins/style/style.js +1 -1
  297. package/es5/plugins/style/style.min.js +1 -1
  298. package/es5/plugins/templates/templates.css +1 -1
  299. package/es5/plugins/templates/templates.js +1 -1
  300. package/es5/plugins/templates/templates.min.js +1 -1
  301. package/es5/plugins/todo-list/todo-list.css +1 -1
  302. package/es5/plugins/todo-list/todo-list.js +1 -1
  303. package/es5/plugins/todo-list/todo-list.min.js +1 -1
  304. package/es5/plugins/translate/translate.css +1 -1
  305. package/es5/plugins/translate/translate.js +1 -1
  306. package/es5/plugins/translate/translate.min.js +1 -1
  307. package/es5/plugins/tune-block/tune-block.css +1 -1
  308. package/es5/plugins/tune-block/tune-block.js +1 -1
  309. package/es5/plugins/tune-block/tune-block.min.js +1 -1
  310. package/es5/polyfills.fat.min.js +1 -1
  311. package/es5/polyfills.js +1 -1
  312. package/es5/polyfills.min.js +1 -1
  313. package/esm/plugins/ai-assistant-pro/config.js +1 -1
  314. package/esm/plugins/ai-assistant-pro/icons/microphone.svg.js +1 -0
  315. package/esm/plugins/ai-assistant-pro/interface/options.d.ts +35 -0
  316. package/esm/plugins/ai-assistant-pro/providers/jodit-ai-adapter.js +1 -1
  317. package/esm/plugins/ai-assistant-pro/ui/input-area/input-area.d.ts +20 -0
  318. package/esm/plugins/ai-assistant-pro/ui/input-area/input-area.js +2 -2
  319. package/esm/plugins/ai-assistant-pro/voice/microphone-streamer.d.ts +26 -0
  320. package/esm/plugins/ai-assistant-pro/voice/microphone-streamer.js +1 -0
  321. package/esm/plugins/ai-assistant-pro/voice/voice-engine.d.ts +36 -0
  322. package/esm/plugins/ai-assistant-pro/voice/voice-engine.js +0 -0
  323. package/esm/plugins/ai-assistant-pro/voice/voice-input-button.d.ts +85 -0
  324. package/esm/plugins/ai-assistant-pro/voice/voice-input-button.js +1 -0
  325. package/esm/plugins/ai-assistant-pro/voice/voice-transcriber.d.ts +55 -0
  326. package/esm/plugins/ai-assistant-pro/voice/voice-transcriber.js +1 -0
  327. package/package.json +1 -1
  328. package/types/plugins/ai-assistant-pro/interface/options.d.ts +35 -0
  329. package/types/plugins/ai-assistant-pro/ui/input-area/input-area.d.ts +20 -0
  330. package/types/plugins/ai-assistant-pro/voice/microphone-streamer.d.ts +26 -0
  331. package/types/plugins/ai-assistant-pro/voice/voice-engine.d.ts +36 -0
  332. package/types/plugins/ai-assistant-pro/voice/voice-input-button.d.ts +85 -0
  333. package/types/plugins/ai-assistant-pro/voice/voice-transcriber.d.ts +55 -0
@@ -1,19 +1,19 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.12.32
4
+ * Version: v4.12.34
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
8
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var s=t();for(var i in s)("object"==typeof exports?exports:e)[i]=s[i]}}(self,function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[830],{94668:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> \x3c!-- Plus icon with document/context --\x3e <path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 14h-3v3h-2v-3H8v-2h3v-3h2v3h3v2zm-3-7V3.5L18.5 9H13z"/> </svg>'},86428:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> \x3c!-- Background rounded rect --\x3e <rect x="1" y="1" width="22" height="22" rx="3"/> \x3c!-- Letter A - outer shape --\x3e <polygon points="8,5 2,19 5,19 6.5,16 11.5,16 13,19 16,19 10,5" fill="white"/> \x3c!-- Letter A - inner triangle (hole) --\x3e <polygon points="9,9 7.5,13 10.5,13" fill="currentColor"/> \x3c!-- Letter I --\x3e <rect x="17" y="5" width="3" height="14" fill="white"/> </svg>'},75966:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> \x3c!-- Wand handle - diagonal line --\x3e <rect x="12" y="10" width="13" height="3.5" rx="0.5" transform="rotate(45 12 12)"/> \x3c!-- Wand tip - diamond --\x3e <rect x="3" y="3" width="6" height="6" rx="1" transform="rotate(45 6 6)"/> \x3c!-- Large sparkle - top --\x3e <polygon points="15,0 16,4 15,8 14,4"/> <polygon points="11,4 15,5 19,4 15,3"/> \x3c!-- Medium sparkle - left --\x3e <polygon points="1,11 2,14 1,17 0,14"/> <polygon points="-2,14 1,15 4,14 1,13"/> \x3c!-- Small sparkle - middle --\x3e <polygon points="8,14 8.5,16 8,18 7.5,16"/> <polygon points="6,16 8,16.5 10,16 8,15.5"/> </svg>'},83207:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M9 18l6-6-6-6"/> </svg>'},99219:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <line x1="22" y1="2" x2="11" y2="13"></line> <polygon points="22 2 15 22 11 13 2 9 22 2"></polygon> </svg>'},63674:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/> </svg>'},4133:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M13 2L4 14h6l-1 8 9-12h-6z"/> </svg>'},62357:function(e,t,s){"use strict";s.d(t,{UIRange:function(){return l}});var i=s(82749),n=s(31635),r=s(65478),a=s(21537),o=s(67510);class l extends o.UIInput{className(){return"UIRange"}appendUIRange(){let e=this.j.create.div(this.getFullElName("slider"));this.container.appendChild(e);let t=this.j.create.div(this.getFullElName("handle"));e.appendChild(t);let s=this.j.create.div(this.getFullElName("log")),i=this.getElm("label");i&&i.appendChild(s)}onDragStart(e){this.startValue=parseFloat(this.value)||0,this.startX=e.clientX;let t=this.getElm("slider");(0,a.assert)(null!=t,"slider element does not exists"),this.width=t.offsetWidth,this.j.e.on(this.j.ow,"mousemove",this.onDrag)}onDrag(e){let{min:t,max:s,step:i=1}=this.state,n=(e.clientX-this.startX)/this.width*(this.state.max-this.state.min),r=this.startValue+n;r<t&&(r=t),r>s&&(r=s),r=Math.round(r/i)*i,this.value=r.toFixed(10)}onDragEnd(){this.j.e.off(this.j.ow,"mousemove",this.onDrag)}onChangeSelfValue(){let e=this.getElm("handle"),t=parseFloat(this.value)||0;(0,a.assert)(null!=e,"Handle element does not exist"),(0,a.css)(e,{left:(t-this.state.min)/(this.state.max-this.state.min)*100+"%"});let s=this.getElm("log");(0,a.assert)(null!=s,"log element does not exist"),s.innerText=t.toString()}destruct(){return this.onDragEnd(),super.destruct()}constructor(e,t){super(e,{...t,type:"hidden"}),(0,i._)(this,"state",{...o.UIInput.defaultState,min:0,max:100,step:1}),(0,i._)(this,"startValue",0),(0,i._)(this,"startX",0),(0,i._)(this,"width",100),Object.assign(this.state,t),this.appendUIRange(),this.onChangeSelfValue()}}(0,n.__decorate)([(0,r.watch)(["handle:mousedown","handle:touchstart"])],l.prototype,"onDragStart",null),(0,n.__decorate)([r.autobind],l.prototype,"onDrag",null),(0,n.__decorate)([(0,r.watch)(["j.ow:mouseup","j.ow:touchend"])],l.prototype,"onDragEnd",null),(0,n.__decorate)([(0,r.watch)(":change")],l.prototype,"onChangeSelfValue",null),l=(0,n.__decorate)([r.component],l)},41810:function(e,t,s){"use strict";s.r(t),s.d(t,{aiAssistantPro:function(){return y}});var i=s(82749),n=s(31635);s(66645);var r=s(86449),a=s(21020),o=s(46166),l=s(62895),c=s(55487),h=s(27769),u=s(58579),d=s(63805),p=s(82758),g=s(65478),m=s(580),f=s(21537),v=s(50911),C=s(2692),w=s(18549),x=s(54747);class y extends v.Plugin{get state(){return this.stateManager.state}get toolRegistry(){return new c.ToolRegistry(this.j)}get permissionManager(){return new a.PermissionManager(this.j,this.toolRegistry)}get apiClient(){return new r.APIClient(this.j,this.toolRegistry)}get storage(){let{storage:e,storageKey:t,maxConversations:s}=this.j.o.aiAssistantPro;if("string"==typeof e){let i=(0,l.createStorageProvider)(e,t);return new l.WebStorageConversationStorage(i,s)}return e}get stateManager(){return new o.StateManager(this.j)}get mainPanel(){return new h.UIMainPanel(this.j,this.stateManager.state,this.j.o.aiAssistantPro,e=>{let t=this.stateManager.getCurrentConversation();t&&this.stateManager.setCurrentConversation({...t,...e})})}get dialog(){let e=this.j.dlg({resizable:this.j.o.aiAssistantPro.resizable,eventEmmiter:this.j.e});return e.e.on(e,"afterClose",()=>{this.j.e.fire("closeAIAssistantPro.ai-assistant-pro")}),e}setupTextAutocomplete(){let{textAutocompleteEnabled:e,textAutocompleteApiRequest:t,textAutocompleteMinQueryLength:s,textAutocompleteMaxSuggestions:i,textAutocompleteDebounceMs:n,textAutocompleteCacheTTL:r,textAutocompleteCacheMaxSize:a}=this.j.o.aiAssistantPro;if(!e||!t)return;this.j.o.autocomplete={...this.j.o.autocomplete,displayMode:"inline"};let o=this.textAutocompleteCache,l=null;this.textAutocompleteSource=e=>{if(e.length<s)return[];let c=`${e}:${i}`;if(r>0){let e=o.get(c);if(e&&Date.now()-e.ts<r)return e.data.map(e=>({value:e,title:e}))}l&&clearTimeout(l);let h=new AbortController;return new Promise(s=>{l=setTimeout(async()=>{try{let n=await t(e,i,h.signal);if(Array.isArray(n)){let e=n.slice(0,i);if(r>0){if(o.size>=a){let e=o.keys().next().value;null!=e&&o.delete(e)}o.set(c,{ts:Date.now(),data:e})}s(e.map(e=>({value:e,title:e})));return}s([])}catch{s([])}},n)})},this.j.e.fire("registerAutocompleteSource",this.textAutocompleteSource)}afterInit(){(0,m.extendLang)(d),this.setupEventListeners(),this.setupTextAutocomplete(),this.j.async.promise(e=>{let{initiallyOpened:t,persistOpenState:s}=this.j.o.aiAssistantPro,i=t;s?this.storage.getGlobalSettings().then(e=>{if(e?.isOpen!=null&&(i=e.isOpen),i)return this.openAssistant()}).catch(()=>null).finally(()=>e(void 0)):e(void 0)}).catch(()=>null)}__loadData(){return this.__initedPromise?this.__initedPromise:this.isDestructed?Promise.reject():(this.__initedPromise=this.j.async.promise(e=>{this.loadInitialData().then(e)}).catch(()=>null),this.__initedPromise)}async loadInitialData(){this.mainPanel.setMod("ready",!0),await (0,u.loadInitialData)(this.j,this.storage,this.stateManager),await this.restorePendingToolCalls()}async restorePendingToolCalls(){let e=this.stateManager.getCurrentConversation();if(!e)return;let t=(0,u.findMessagesWithPendingToolCalls)(e);if(0!==t.length)for(let e of t)await this.handleToolCalls(e.id)}setupEventListeners(){this.j.e.on("selectConversation.ai-assistant-pro",async e=>{try{await this.__loadData(),await (0,u.handleConversationSelect)(e,this.storage,this.stateManager)}catch(e){p.IS_PROD}}),this.j.e.on("newConversation.ai-assistant-pro",async()=>{await this.__loadData();let e=(0,u.createNewConversation)(this.j,this.state.defaultModel,this.state.defaultTemperature);this.stateManager.setCurrentConversation(e)}),this.j.e.on("deleteConversation.ai-assistant-pro",async e=>{await this.__loadData(),await this.deleteConversation(e)}),this.j.e.on("renameConversation.ai-assistant-pro",async(e,t)=>{await this.__loadData(),await this.renameConversation(e,t)}),this.j.e.on("backToList.ai-assistant-pro",async()=>{await this.__loadData(),await (0,u.handleBackToList)(this.storage,this.stateManager)}),this.j.e.on("removeContext.ai-assistant-pro",async e=>{await this.__loadData(),this.stateManager.removeSelectionContext(e)}),this.j.e.on("approveToolCall.ai-assistant-pro",async(e,t)=>{try{await this.__loadData();let s=await (0,u.handleToolApproval)(e,t,this.stateManager,this.permissionManager,this.storage);if(s){let e=this.stateManager.getCurrentConversation();if(!e)return;let t=e.messages.find(e=>e.toolCalls?.some(e=>e.id===s.id));if(!t)return;await this.executeToolCall(t.id,s)}}catch(e){if((0,f.isAbortError)(e))return;this.stateManager.setError(e instanceof Error?e.message:e+"")}}),this.j.e.on("denyToolCall.ai-assistant-pro",async e=>{await this.__loadData(),await (0,u.handleToolDenial)(this.j,e,this.stateManager,this.storage)}),this.j.e.on("abortRequest.ai-assistant-pro",async()=>{await this.__loadData(),this.apiClient.abort(),this.stateManager.setLoading(!1)})}__applyTheme(){(0,u.applyTheme)(this.j,this.stateManager.state.theme,this.stateManager.state.displayMode,this.mainPanel.container,this.dialog)}async openAssistant(){if(this.stateManager.isOpen()){this.stateManager.close(),await this.__closeInContainer();return}await this.__loadData(),this.isDestructed||(this.stateManager.open(),await this.__openInContainer(),this.j.o.aiAssistantPro.includeSelectionByDefault&&!this.j.s.isCollapsed()&&this.addCurrentSelectionToContext())}async __openInContainer(){let{resizable:e,allowClose:t,flightPanelHeight:s}=this.j.o.aiAssistantPro,{displayMode:i="right",panelWidth:n,panelHeight:r}=this.stateManager.state;switch(this.__applyTheme(),this.mainPanel.setMod("displayMode",i),this.mainPanel.setMod("allowClose",t),this.mainPanel.setParentView("dialog"===i||"flight"===i?this.dialog:this.j),this.__openedMode=i,i){case"dialog":this.dialog.setSize(n,r).open().setContent(this.mainPanel.container);break;case"flight":w.UIFlightPosition.install(this.mainPanel,this.j.container,{panelHeight:s,containerClassName:this.getFullElName("flight-container")});break;default:e&&(x.UIResize.remove(this.mainPanel),x.UIResize.install(this.mainPanel,(0,u.invertMode)(i),{handleClassName:this.getFullElName("ai-assistent-resize-handle"),onResize:({newSize:e})=>{let t="left"===i||"right"===i?e:n,s="top"===i||"bottom"===i?e:r;return this.stateManager.state.panelWidth=t,this.stateManager.state.panelHeight=s,!0}})),this.j.currentPlace.slots[i].appendChild(this.mainPanel.container),(0,u.resizeInPanelView)(this.j,i,n,r)}}__onResizeInPanelView(){let{displayMode:e,panelWidth:t,panelHeight:s}=this.stateManager.state;(0,u.resizeInPanelView)(this.j,e,t,s)}async __closeInContainer(){let{displayMode:e}=await this.stateManager.state;switch(this.__openedMode!==e&&"dialog"===this.__openedMode&&this.dialog.close(),this.__openedMode!==e&&"flight"===this.__openedMode&&this.__closeFlightMode(),e){case"dialog":this.dialog.close();break;case"flight":this.__closeFlightMode();break;default:this.mainPanel.container.remove()}}__closeFlightMode(){w.UIFlightPosition.remove(this.mainPanel)}__onSavedStateChange(){let e=this.stateManager.state;return this.storage.saveGlobalSettings({displayMode:e.displayMode,panelWidth:e.panelWidth,panelHeight:e.panelHeight,theme:e.theme,defaultModel:e.defaultModel,defaultTemperature:e.defaultTemperature,currentConversationId:e.currentConversation?.id,...this.j.o.aiAssistantPro.persistOpenState?{isOpen:e.isOpen}:{}})}async closeAssistant(){this.stateManager.isOpen()&&(await this.__loadData(),this.stateManager.close(),this.__closeInContainer())}async addCurrentSelectionToContext(){await this.__loadData();let e=(0,u.getCurrentSelectionContext)(this.j);e&&this.stateManager.addSelectionContext(e)}async executeQuickCommand(e){let t,{quickCommandsSilentMode:s,quickCommandsDisplayMode:i}=this.j.o.aiAssistantPro,n=this.j.o.aiAssistant;if(n&&n[e]&&(0,f.isString)(n[e])&&(t=n[e]),!t)return void this.j.e.fire("error","Command not found: "+e);let r=this.j.s.isCollapsed()?this.j.value:this.j.s.html;if(!r)return;let a=n?.aiCommonPrefixPrompt||"",o=n?.aiCommonSuffixPrompt||"",l=`${a}${t}${o}
8
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var s=t();for(var i in s)("object"==typeof exports?exports:e)[i]=s[i]}}(self,function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[830],{94668:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> \x3c!-- Plus icon with document/context --\x3e <path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 14h-3v3h-2v-3H8v-2h3v-3h2v3h3v2zm-3-7V3.5L18.5 9H13z"/> </svg>'},86428:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> \x3c!-- Background rounded rect --\x3e <rect x="1" y="1" width="22" height="22" rx="3"/> \x3c!-- Letter A - outer shape --\x3e <polygon points="8,5 2,19 5,19 6.5,16 11.5,16 13,19 16,19 10,5" fill="white"/> \x3c!-- Letter A - inner triangle (hole) --\x3e <polygon points="9,9 7.5,13 10.5,13" fill="currentColor"/> \x3c!-- Letter I --\x3e <rect x="17" y="5" width="3" height="14" fill="white"/> </svg>'},75966:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> \x3c!-- Wand handle - diagonal line --\x3e <rect x="12" y="10" width="13" height="3.5" rx="0.5" transform="rotate(45 12 12)"/> \x3c!-- Wand tip - diamond --\x3e <rect x="3" y="3" width="6" height="6" rx="1" transform="rotate(45 6 6)"/> \x3c!-- Large sparkle - top --\x3e <polygon points="15,0 16,4 15,8 14,4"/> <polygon points="11,4 15,5 19,4 15,3"/> \x3c!-- Medium sparkle - left --\x3e <polygon points="1,11 2,14 1,17 0,14"/> <polygon points="-2,14 1,15 4,14 1,13"/> \x3c!-- Small sparkle - middle --\x3e <polygon points="8,14 8.5,16 8,18 7.5,16"/> <polygon points="6,16 8,16.5 10,16 8,15.5"/> </svg>'},83207:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M9 18l6-6-6-6"/> </svg>'},99293:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <rect x="9" y="2" width="6" height="12" rx="3"></rect> <path d="M5 10v1a7 7 0 0 0 14 0v-1" fill="none"></path> <line x1="12" y1="18" x2="12" y2="22"></line> <line x1="8" y1="22" x2="16" y2="22"></line> </svg>'},99219:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <line x1="22" y1="2" x2="11" y2="13"></line> <polygon points="22 2 15 22 11 13 2 9 22 2"></polygon> </svg>'},63674:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/> </svg>'},4133:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M13 2L4 14h6l-1 8 9-12h-6z"/> </svg>'},62357:function(e,t,s){"use strict";s.d(t,{UIRange:function(){return l}});var i=s(82749),n=s(31635),r=s(65478),a=s(21537),o=s(67510);class l extends o.UIInput{className(){return"UIRange"}appendUIRange(){let e=this.j.create.div(this.getFullElName("slider"));this.container.appendChild(e);let t=this.j.create.div(this.getFullElName("handle"));e.appendChild(t);let s=this.j.create.div(this.getFullElName("log")),i=this.getElm("label");i&&i.appendChild(s)}onDragStart(e){this.startValue=parseFloat(this.value)||0,this.startX=e.clientX;let t=this.getElm("slider");(0,a.assert)(null!=t,"slider element does not exists"),this.width=t.offsetWidth,this.j.e.on(this.j.ow,"mousemove",this.onDrag)}onDrag(e){let{min:t,max:s,step:i=1}=this.state,n=(e.clientX-this.startX)/this.width*(this.state.max-this.state.min),r=this.startValue+n;r<t&&(r=t),r>s&&(r=s),r=Math.round(r/i)*i,this.value=r.toFixed(10)}onDragEnd(){this.j.e.off(this.j.ow,"mousemove",this.onDrag)}onChangeSelfValue(){let e=this.getElm("handle"),t=parseFloat(this.value)||0;(0,a.assert)(null!=e,"Handle element does not exist"),(0,a.css)(e,{left:(t-this.state.min)/(this.state.max-this.state.min)*100+"%"});let s=this.getElm("log");(0,a.assert)(null!=s,"log element does not exist"),s.innerText=t.toString()}destruct(){return this.onDragEnd(),super.destruct()}constructor(e,t){super(e,{...t,type:"hidden"}),(0,i._)(this,"state",{...o.UIInput.defaultState,min:0,max:100,step:1}),(0,i._)(this,"startValue",0),(0,i._)(this,"startX",0),(0,i._)(this,"width",100),Object.assign(this.state,t),this.appendUIRange(),this.onChangeSelfValue()}}(0,n.__decorate)([(0,r.watch)(["handle:mousedown","handle:touchstart"])],l.prototype,"onDragStart",null),(0,n.__decorate)([r.autobind],l.prototype,"onDrag",null),(0,n.__decorate)([(0,r.watch)(["j.ow:mouseup","j.ow:touchend"])],l.prototype,"onDragEnd",null),(0,n.__decorate)([(0,r.watch)(":change")],l.prototype,"onChangeSelfValue",null),l=(0,n.__decorate)([r.component],l)},41810:function(e,t,s){"use strict";s.r(t),s.d(t,{aiAssistantPro:function(){return y}});var i=s(82749),n=s(31635);s(66645);var r=s(86449),a=s(21020),o=s(46166),l=s(62895),c=s(55487),h=s(27769),u=s(58579),d=s(63805),p=s(82758),g=s(65478),m=s(580),f=s(21537),v=s(50911),w=s(2692),x=s(18549),C=s(54747);class y extends v.Plugin{get state(){return this.stateManager.state}get toolRegistry(){return new c.ToolRegistry(this.j)}get permissionManager(){return new a.PermissionManager(this.j,this.toolRegistry)}get apiClient(){return new r.APIClient(this.j,this.toolRegistry)}get storage(){let{storage:e,storageKey:t,maxConversations:s}=this.j.o.aiAssistantPro;if("string"==typeof e){let i=(0,l.createStorageProvider)(e,t);return new l.WebStorageConversationStorage(i,s)}return e}get stateManager(){return new o.StateManager(this.j)}get mainPanel(){return new h.UIMainPanel(this.j,this.stateManager.state,this.j.o.aiAssistantPro,e=>{let t=this.stateManager.getCurrentConversation();t&&this.stateManager.setCurrentConversation({...t,...e})})}get dialog(){let e=this.j.dlg({resizable:this.j.o.aiAssistantPro.resizable,eventEmmiter:this.j.e});return e.e.on(e,"afterClose",()=>{this.j.e.fire("closeAIAssistantPro.ai-assistant-pro")}),e}setupTextAutocomplete(){let{textAutocompleteEnabled:e,textAutocompleteApiRequest:t,textAutocompleteMinQueryLength:s,textAutocompleteMaxSuggestions:i,textAutocompleteDebounceMs:n,textAutocompleteCacheTTL:r,textAutocompleteCacheMaxSize:a}=this.j.o.aiAssistantPro;if(!e||!t)return;this.j.o.autocomplete={...this.j.o.autocomplete,displayMode:"inline"};let o=this.textAutocompleteCache,l=null;this.textAutocompleteSource=e=>{if(e.length<s)return[];let c=`${e}:${i}`;if(r>0){let e=o.get(c);if(e&&Date.now()-e.ts<r)return e.data.map(e=>({value:e,title:e}))}l&&clearTimeout(l);let h=new AbortController;return new Promise(s=>{l=setTimeout(async()=>{try{let n=await t(e,i,h.signal);if(Array.isArray(n)){let e=n.slice(0,i);if(r>0){if(o.size>=a){let e=o.keys().next().value;null!=e&&o.delete(e)}o.set(c,{ts:Date.now(),data:e})}s(e.map(e=>({value:e,title:e})));return}s([])}catch{s([])}},n)})},this.j.e.fire("registerAutocompleteSource",this.textAutocompleteSource)}afterInit(){(0,m.extendLang)(d),this.setupEventListeners(),this.setupTextAutocomplete(),this.j.async.promise(e=>{let{initiallyOpened:t,persistOpenState:s}=this.j.o.aiAssistantPro,i=t;s?this.storage.getGlobalSettings().then(e=>{if(e?.isOpen!=null&&(i=e.isOpen),i)return this.openAssistant()}).catch(()=>null).finally(()=>e(void 0)):e(void 0)}).catch(()=>null)}__loadData(){return this.__initedPromise?this.__initedPromise:this.isDestructed?Promise.reject():(this.__initedPromise=this.j.async.promise(e=>{this.loadInitialData().then(e)}).catch(()=>null),this.__initedPromise)}async loadInitialData(){this.mainPanel.setMod("ready",!0),await (0,u.loadInitialData)(this.j,this.storage,this.stateManager),await this.restorePendingToolCalls()}async restorePendingToolCalls(){let e=this.stateManager.getCurrentConversation();if(!e)return;let t=(0,u.findMessagesWithPendingToolCalls)(e);if(0!==t.length)for(let e of t)await this.handleToolCalls(e.id)}setupEventListeners(){this.j.e.on("selectConversation.ai-assistant-pro",async e=>{try{await this.__loadData(),await (0,u.handleConversationSelect)(e,this.storage,this.stateManager)}catch(e){p.IS_PROD}}),this.j.e.on("newConversation.ai-assistant-pro",async()=>{await this.__loadData();let e=(0,u.createNewConversation)(this.j,this.state.defaultModel,this.state.defaultTemperature);this.stateManager.setCurrentConversation(e)}),this.j.e.on("deleteConversation.ai-assistant-pro",async e=>{await this.__loadData(),await this.deleteConversation(e)}),this.j.e.on("renameConversation.ai-assistant-pro",async(e,t)=>{await this.__loadData(),await this.renameConversation(e,t)}),this.j.e.on("backToList.ai-assistant-pro",async()=>{await this.__loadData(),await (0,u.handleBackToList)(this.storage,this.stateManager)}),this.j.e.on("removeContext.ai-assistant-pro",async e=>{await this.__loadData(),this.stateManager.removeSelectionContext(e)}),this.j.e.on("approveToolCall.ai-assistant-pro",async(e,t)=>{try{await this.__loadData();let s=await (0,u.handleToolApproval)(e,t,this.stateManager,this.permissionManager,this.storage);if(s){let e=this.stateManager.getCurrentConversation();if(!e)return;let t=e.messages.find(e=>e.toolCalls?.some(e=>e.id===s.id));if(!t)return;await this.executeToolCall(t.id,s)}}catch(e){if((0,f.isAbortError)(e))return;this.stateManager.setError(e instanceof Error?e.message:e+"")}}),this.j.e.on("denyToolCall.ai-assistant-pro",async e=>{await this.__loadData(),await (0,u.handleToolDenial)(this.j,e,this.stateManager,this.storage)}),this.j.e.on("abortRequest.ai-assistant-pro",async()=>{await this.__loadData(),this.apiClient.abort(),this.stateManager.setLoading(!1)})}__applyTheme(){(0,u.applyTheme)(this.j,this.stateManager.state.theme,this.stateManager.state.displayMode,this.mainPanel.container,this.dialog)}async openAssistant(){if(this.stateManager.isOpen()){this.stateManager.close(),await this.__closeInContainer();return}await this.__loadData(),this.isDestructed||(this.stateManager.open(),await this.__openInContainer(),this.j.o.aiAssistantPro.includeSelectionByDefault&&!this.j.s.isCollapsed()&&this.addCurrentSelectionToContext())}async __openInContainer(){let{resizable:e,allowClose:t,flightPanelHeight:s}=this.j.o.aiAssistantPro,{displayMode:i="right",panelWidth:n,panelHeight:r}=this.stateManager.state;switch(this.__applyTheme(),this.mainPanel.setMod("displayMode",i),this.mainPanel.setMod("allowClose",t),this.mainPanel.setParentView("dialog"===i||"flight"===i?this.dialog:this.j),this.__openedMode=i,i){case"dialog":this.dialog.setSize(n,r).open().setContent(this.mainPanel.container);break;case"flight":x.UIFlightPosition.install(this.mainPanel,this.j.container,{panelHeight:s,containerClassName:this.getFullElName("flight-container")});break;default:e&&(C.UIResize.remove(this.mainPanel),C.UIResize.install(this.mainPanel,(0,u.invertMode)(i),{handleClassName:this.getFullElName("ai-assistent-resize-handle"),onResize:({newSize:e})=>{let t="left"===i||"right"===i?e:n,s="top"===i||"bottom"===i?e:r;return this.stateManager.state.panelWidth=t,this.stateManager.state.panelHeight=s,!0}})),this.j.currentPlace.slots[i].appendChild(this.mainPanel.container),(0,u.resizeInPanelView)(this.j,i,n,r)}}__onResizeInPanelView(){let{displayMode:e,panelWidth:t,panelHeight:s}=this.stateManager.state;(0,u.resizeInPanelView)(this.j,e,t,s)}async __closeInContainer(){let{displayMode:e}=await this.stateManager.state;switch(this.__openedMode!==e&&"dialog"===this.__openedMode&&this.dialog.close(),this.__openedMode!==e&&"flight"===this.__openedMode&&this.__closeFlightMode(),e){case"dialog":this.dialog.close();break;case"flight":this.__closeFlightMode();break;default:this.mainPanel.container.remove()}}__closeFlightMode(){x.UIFlightPosition.remove(this.mainPanel)}__onSavedStateChange(){let e=this.stateManager.state;return this.storage.saveGlobalSettings({displayMode:e.displayMode,panelWidth:e.panelWidth,panelHeight:e.panelHeight,theme:e.theme,defaultModel:e.defaultModel,defaultTemperature:e.defaultTemperature,currentConversationId:e.currentConversation?.id,...this.j.o.aiAssistantPro.persistOpenState?{isOpen:e.isOpen}:{}})}async closeAssistant(){this.stateManager.isOpen()&&(await this.__loadData(),this.stateManager.close(),this.__closeInContainer())}async addCurrentSelectionToContext(){await this.__loadData();let e=(0,u.getCurrentSelectionContext)(this.j);e&&this.stateManager.addSelectionContext(e)}async executeQuickCommand(e){let t,{quickCommandsSilentMode:s,quickCommandsDisplayMode:i}=this.j.o.aiAssistantPro,n=this.j.o.aiAssistant;if(n&&n[e]&&(0,f.isString)(n[e])&&(t=n[e]),!t)return void this.j.e.fire("error","Command not found: "+e);let r=this.j.s.isCollapsed()?this.j.value:this.j.s.html;if(!r)return;let a=n?.aiCommonPrefixPrompt||"",o=n?.aiCommonSuffixPrompt||"",l=`${a}${t}${o}
9
9
 
10
- ${r}`.trim();s?await this.__executeQuickCommandSilent(l,r):await this.__executeQuickCommandWithPanel(l,i)}async __executeQuickCommandSilent(e,t){await this.__loadData(),this.j.progressbar.show().progress(100);try{let t=(0,u.createUserMessage)(e),s=(0,u.createNewConversation)(this.j,this.state.defaultModel,this.state.defaultTemperature,[t]),i=await this.apiClient.sendRequest(s.id,s.messages,null,[],s.options);if("final"===i.mode){let e=i.response.content;e&&this.j.s.insertHTML(e)}}catch(e){(0,f.isAbortError)(e)||this.j.e.fire("error",e)}finally{this.j.progressbar.hide()}}async __executeQuickCommandWithPanel(e,t){await this.__loadData();let s=this.stateManager.state.displayMode;this.stateManager.state.displayMode=t;let i=(0,u.getCurrentSelectionContext)(this.j);i&&this.stateManager.addSelectionContext(i),this.stateManager.isOpen()||await this.openAssistant(),await this.sendMessage(e),this.stateManager.state.displayMode=s}async sendMessage(e){await this.__loadData();let t=this.stateManager.getCurrentConversation(),s=this.stateManager.getEditingMessageId();if(s&&t){let e=t.messages.findIndex(e=>e.id===s);if(-1!==e){let s=t.messages.slice(0,e),i={...t,messages:s,updatedAt:Date.now()};this.stateManager.setCurrentConversation(i),await this.storage.save(i),this.stateManager.clearEditingMessage(),t=i}}t||(t=(0,u.createNewConversation)(this.j,this.state.defaultModel,this.state.defaultTemperature),this.stateManager.setCurrentConversation(t));let i=null;e.trim()&&(i=(0,u.createUserMessage)(e),t.title||(t={...t,title:e}),t={...t,updated:Date.now(),messages:[...t.messages,i]}),this.stateManager.setCurrentConversation({...t}),i&&this.j.e.fire("messageSent.ai-assistant-pro",i),this.stateManager.setLoading(!0),this.stateManager.clearError();try{await this.sendRequestToAI(0),this.stateManager.clearSelectionContexts()}catch(e){if((0,f.isAbortError)(e))return;this.stateManager.setError(e instanceof Error?e.message:e+"")}finally{this.stateManager.setLoading(!1)}}async sendRequestToAI(e=0){let t,s,i=this.j.o.aiAssistantPro.maxRecursionToolCallDepth;if(e>=i)throw Error(`Max recursion depth ${i} reached for tool calls`);let n=this.stateManager.getCurrentConversation();if(!n)return;let r=(0,u.findParentMessageId)(n),[a]=await Promise.all([this.apiClient.sendRequest(n.id,n.messages,r,this.stateManager.getSelectionContexts(),n.options),this.storage.save(n)]);if("stream"===a.mode){let e=await (0,u.processStreamingResponse)(this.stateManager,a,n);t=e.aiMessage,s=e.index,n=e.conversation}else{let e=(0,u.processFinalResponse)(a,n);t=e.aiMessage,s=e.index,n=e.conversation}n=await (0,u.processArtifacts)(this.j,t,n,s),this.j.e.fire("messageReceived.ai-assistant-pro",t),this.stateManager.setCurrentConversation({...n}),await this.storage.save(n),await this.handleToolCalls(t.id,e)}async deleteConversation(e){await this.__loadData(),await (0,u.deleteConversationWithCleanup)(this.j,e,this.storage,this.stateManager,this.permissionManager)}async renameConversation(e,t){let s=await this.storage.get(e);if(!s)return;let i={...s,title:t,updated:Date.now()};await this.storage.save(i),this.state.currentConversation?.id===e&&this.stateManager.setCurrentConversation(i);let n=await this.storage.list();this.stateManager.setConversations(n)}async searchConversations(e){await this.__loadData(),await (0,u.handleConversationSearch)(e,this.storage,this.stateManager)}async handleToolCalls(e,t=0){let s=this.stateManager.getCurrentConversation();if(!s)return;let i=s.messages.find(t=>t.id===e);if(!i)return;let n=i.toolCalls;if(!n||0===n.length)return;let r=n.filter(e=>!(0,u.isTerminalToolCallStatus)(e.status));if(0===r.length)return;let{approved:a,needsPermission:o}=this.permissionManager.filterToolCalls(r,s.permissions);for(let s of(this.stateManager.setPendingToolCalls(o),a))await this.executeToolCall(e,s,t)}async executeToolCall(e,t,s=0){let i=this.stateManager.getCurrentConversation();if(!i)return;let n=await (0,u.executeToolCall)(this.j,t,this.toolRegistry),r=i.messages.findIndex(t=>t.id===e);if(-1===r)return;let a=i.messages[r],o=i.messages.slice();o[r]=(0,u.updateToolCallInMessage)(a,n),i={...i,messages:o,updated:Date.now()},this.stateManager.setCurrentConversation(i),(0,u.areAllToolCallsExecuted)(i)&&await this.sendRequestToAI(s+1)}async copyMessage(e){let t=this.stateManager.getCurrentConversation();if(!t)return;let s=t.messages.find(t=>t.id===e);if(s)try{await navigator.clipboard.writeText(s.content),this.j.message.success("Message copied to clipboard")}catch(e){this.j.e.fire("error",Error("Failed to copy message"))}}async restartFromMessage(e){let t=this.stateManager.getCurrentConversation();if(!t)return;let s=t.messages.findIndex(t=>t.id===e);if(-1===s)return;let i=t.messages[s];if("user"!==i.role)return;await this.__loadData();let n=t.messages.slice(0,s),r={...t,messages:n,updatedAt:Date.now()};this.stateManager.setCurrentConversation(r),await this.storage.save(r),await this.sendMessage(i.content)}async editMessage(e){let t=this.stateManager.getCurrentConversation();if(!t)return;let s=t.messages.find(t=>t.id===e);s&&"user"===s.role&&(this.stateManager.setEditingMessageId(e),this.mainPanel.inputArea.setValue(s.content),this.mainPanel.inputArea.focus())}cancelEditMessage(){this.stateManager.isEditingMessage()&&(this.stateManager.clearEditingMessage(),this.mainPanel.inputArea.setValue(""))}async deleteMessage(e){await this.__loadData();let t=this.stateManager.getCurrentConversation();if(!t||-1===t.messages.findIndex(t=>t.id===e))return;let s=t.messages.filter(t=>t.id!==e),i={...t,messages:s,updatedAt:Date.now()};this.stateManager.setCurrentConversation(i),await this.storage.save(i)}beforeDestruct(){this.textAutocompleteSource&&(this.j.e.fire("unregisterAutocompleteSource",this.textAutocompleteSource),this.textAutocompleteSource=null),this.textAutocompleteCache.clear(),this.__closeFlightMode(),(0,g.cached)(this,"toolRegistry")?.destruct(),(0,g.cached)(this,"permissionManager")?.destruct(),(0,g.cached)(this,"apiClient")?.destruct(),(0,g.cached)(this,"stateManager")?.destruct(),(0,g.cached)(this,"mainPanel")?.destruct(),(0,g.cached)(this,"dialog")?.destruct(),(0,g.cached)(this,"storage")?.close?.()}constructor(...e){super(...e),(0,i._)(this,"buttons",[{name:"aiAssistantPro",group:"insert"},{name:"aiCommandsPro",group:"insert"}]),(0,i._)(this,"textAutocompleteSource",null),(0,i._)(this,"textAutocompleteCache",new Map),(0,i._)(this,"__initedPromise",null),(0,i._)(this,"__openedMode",null)}}(0,i._)(y,"requires",["license","autocomplete"]),(0,n.__decorate)([g.cache],y.prototype,"toolRegistry",null),(0,n.__decorate)([g.cache],y.prototype,"permissionManager",null),(0,n.__decorate)([g.cache],y.prototype,"apiClient",null),(0,n.__decorate)([g.cache],y.prototype,"storage",null),(0,n.__decorate)([g.cache],y.prototype,"stateManager",null),(0,n.__decorate)([g.cache],y.prototype,"mainPanel",null),(0,n.__decorate)([g.cache],y.prototype,"dialog",null),(0,n.__decorate)([(0,g.watch)("state.theme")],y.prototype,"__applyTheme",null),(0,n.__decorate)([(0,g.watch)(":openAIAssistantPro.ai-assistant-pro")],y.prototype,"openAssistant",null),(0,n.__decorate)([(0,g.watch)([":resize","state.panelWidth","state.panelHeight"])],y.prototype,"__onResizeInPanelView",null),(0,n.__decorate)([(0,g.watch)(["state.isOpen","state.displayMode","state.panelWidth","state.panelHeight","state.theme","state.defaultModel","state.defaultTemperature","state.currentConversation"]),(0,g.debounce)()],y.prototype,"__onSavedStateChange",null),(0,n.__decorate)([(0,g.watch)(":closeAIAssistantPro.ai-assistant-pro")],y.prototype,"closeAssistant",null),(0,n.__decorate)([(0,g.watch)(":addContextToAIAssistant.ai-assistant-pro")],y.prototype,"addCurrentSelectionToContext",null),(0,n.__decorate)([(0,g.watch)(":executeQuickCommand.ai-assistant-pro")],y.prototype,"executeQuickCommand",null),(0,n.__decorate)([(0,g.watch)(":sendMessage.ai-assistant-pro")],y.prototype,"sendMessage",null),(0,n.__decorate)([(0,g.watch)(":searchConversations.ai-assistant-pro")],y.prototype,"searchConversations",null),(0,n.__decorate)([(0,g.watch)(":copyMessage.ai-assistant-pro")],y.prototype,"copyMessage",null),(0,n.__decorate)([(0,g.watch)(":restartFromMessage.ai-assistant-pro")],y.prototype,"restartFromMessage",null),(0,n.__decorate)([(0,g.watch)(":editMessage.ai-assistant-pro")],y.prototype,"editMessage",null),(0,n.__decorate)([(0,g.watch)(":cancelEditMessage.ai-assistant-pro")],y.prototype,"cancelEditMessage",null),(0,n.__decorate)([(0,g.watch)(":deleteMessage.ai-assistant-pro")],y.prototype,"deleteMessage",null),y=(0,n.__decorate)([g.component],y),C.JoditPro.plugins.add("aiAssistantPro",y)},66645:function(e,t,s){"use strict";var i=s(47373),n=s(94668),r=s.n(n),a=s(86428),o=s.n(a),l=s(75966),c=s.n(l),h=s(83207),u=s.n(h),d=s(99219),p=s.n(d),g=s(63674),m=s.n(g),f=s(4133),v=s.n(f),C=s(94454),w=s(53835),x=s(6441),y=s(12153),k=s(31974),b=s(72573);y.Icon.set("ai-assistant-pro",o()).set("ai-commands-pro",c()).set("ai-add-context",r()).set("send",p()).set("tool-bolt",v()).set("chevron-right",u()).set("shield",m()),x.Config.prototype.aiAssistantPro={displayMode:"right",panelWidth:400,panelHeight:500,flightPanelHeight:250,dialogFullSize:!1,resizable:!0,apiMode:"incremental",apiRequest:null,maxRetries:3,requestTimeout:3e5,retryDelay:1e3,maxRecursionToolCallDepth:1e3,enabledTools:(0,w.getToolNames)(),customTools:[],toolPermissions:{},autoApproveTools:["readDocument","readBlocks","readSelection","insertHTML","addHTML"],alwaysDenyTools:[],defaultPermissionScope:"conversation",storage:"indexedDB",maxConversations:50,storageKey:"jodit-ai-assistant-pro",showConversationList:!0,enableMarkdown:!0,enableCodeHighlight:!0,maxMessageHeight:400,placeholderText:"Ask AI assistant...",sendShortcut:"Ctrl+Enter",showTimestamps:!0,formatTimestamp(e,t){let s=new Date(e),i=new Date().getTime()-s.getTime();return i<6e4?t("Just now"):i<36e5?t("%dm ago",Math.floor(i/6e4)):i<864e5?t("%dh ago",Math.floor(i/36e5)):s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})},formatMessageContent:(e,t)=>b.marked.parse(e,{breaks:!0,gfm:!0}),showAvatars:!0,showTypingIndicator:!0,includeSelectionByDefault:!0,maxContextRanges:5,showContextPreview:!0,sendOnEnter:!0,instructions:void 0,includeEditorMetadata:!1,autoOpen:!0,rememberLastConversation:!0,autoFocusInput:!0,closeAfterInsert:!1,enableSoundNotifications:!1,debug:!1,textAutocompleteEnabled:!1,textAutocompleteApiRequest:null,textAutocompleteMinQueryLength:3,textAutocompleteMaxSuggestions:3,textAutocompleteDebounceMs:500,textAutocompleteCacheTTL:3e4,textAutocompleteCacheMaxSize:50,quickCommandsSilentMode:!1,quickCommandsDisplayMode:"flight",showCopyMessageAction:!0,showRestartMessageAction:!0,showEditMessageAction:!0,showDeleteMessageAction:!0,dialogSettings:{},allowEditDialogSettings:!1,allowEditDisplayMode:!0,allowEditPanelWidth:!0,initiallyOpened:!1,allowClose:!0,persistOpenState:!0,theme:"parent",allowEditTheme:!0,async uploadBase64Artifact(e,t){if("image"===e.type&&e.data&&"base64"===e.data.kind)try{let s=(0,i.base64ToFile)(e.data.base64,e.id,e.mimeType),n=await t.uploader.upload([s]);return{...e,data:{kind:"url",url:n.baseurl+n.files[0]},metadata:{...e.metadata,filename:n.files[0]}}}catch(e){t.e.fire("error",e)}return e},getAIProviderOptions:(e,t)=>(0,C.getAIProviderOptions)(e,t),registerAIProvider(e,t){(0,C.registerAIProvider)(e,t)}},x.Config.prototype.controls.aiAssistantPro={icon:"ai-assistant-pro",tooltip:"AI Assistant",hotkeys:["ctrl+shift+a","cmd+shift+a"],exec(e){e.e.fire("openAIAssistantPro.ai-assistant-pro")},isDisabled:e=>!e.o.aiAssistantPro.apiRequest,getLabel:e=>e.o.aiAssistantPro.apiRequest?"AI Assistant":"AI Assistant (not configured)"},x.Config.prototype.controls.aiAddContext={icon:"ai-add-context",tooltip:"Add to AI Context",exec(e){e.e.fire("addContextToAIAssistant")},isDisabled:e=>!e.o.aiAssistantPro.apiRequest||e.s.isCollapsed()},x.Config.prototype.controls.aiCommandsPro={icon:"ai-commands-pro",tooltip:"AI Commands",isDisabled:e=>!e.o.aiAssistantPro.apiRequest,list:k.aiAssitentCommands,exec(e,t,{control:s}){e.e.fire("executeQuickCommand.ai-assistant-pro",s.name)}};let _=x.Config.prototype.tuneBlock?.popup||{},S={};["p","h1","h2","h3","h4","h5","h6","div","section","article","pre","blockquote","ul","ol","li","table","tr","td","th","img","figure"].forEach(e=>{let t=_[e]||["tune.up","tune.remove","tune.down"];S[e]=[...t,"|","aiAddContext"]}),x.Config.prototype.tuneBlock&&(x.Config.prototype.tuneBlock.popup={..._,...S})},6689:function(e,t,s){"use strict";s.d(t,{throwIfAborted:function(){return n}});var i=s(93661);function n(e){if(e.aborted)throw(0,i.abort)()}},61872:function(e,t,s){"use strict";s.d(t,{processArtifacts:function(){return a},processFinalResponse:function(){return r},processStreamingResponse:function(){return n}});var i=s(61558);async function n(e,t,s){let n=(0,i.createAIMessage)(),r=-1;for await(let a of t.stream){switch(a.type){case"created":n={...n,id:a.response.responseId,content:""},r=s.messages.length;break;case"text-delta":n={...n,content:n.content+a.delta};break;case"completed":n={...n,id:a.response.responseId,toolCalls:a.response.toolCalls||[],artifacts:a.response.artifacts||[]};break;case"error":{let e=(0,i.createErrorMessage)(a.error);n={...n,id:e.id,content:e.content}}}if(n.id){let t=s.messages.slice();t[r>=0?r:s.messages.length]=n,s={...s,messages:t,updated:Date.now()},e.setCurrentConversation(s)}}return{aiMessage:n,index:r,conversation:s}}function r(e,t){let s={...(0,i.createAIMessage)(),id:e.response.responseId,content:e.response.content,toolCalls:e.response.toolCalls||[],artifacts:e.response.artifacts||[]},n=t.messages.slice();return n.push(s),{aiMessage:s,index:(t={...t,messages:n,updated:Date.now()}).messages.length-1,conversation:t}}async function a(e,t,s,n){if(t.artifacts&&t.artifacts.length>0){let r=s.messages.slice();return r[n]={...r[n],artifacts:await (0,i.uploadArtifacts)(e,t.artifacts)},{...s,messages:r,updated:Date.now()}}return s}},49459:function(e,t,s){"use strict";function i(e,t,s={}){let n=e[t];if("string"!=typeof n||!s.allowEmpty&&""===n)throw Error(`Parameter "${t}" is required and must be a${s.allowEmpty?"":" non-empty"} string`);return n}s.d(t,{requireString:function(){return i}})},44526:function(e,t,s){"use strict";s.d(t,{resolveBlock:function(){return n}});var i=s(22732);function n(e,{selector:t,index:s,requireExactlyOne:r=!1}={}){let a=null!=t&&""!==t.trim(),o=null!=s;if(r&&a===o)throw Error("Either index or selector must be provided, but not both");if(!a&&!o)throw Error("Block identifier is required");if(a){if("string"!=typeof t)throw Error("Selector must be a string");let s=e.editor.querySelector(t);if(!s)throw Error(`No element found matching selector "${t}"`);if(!i.Dom.isElement(s))throw Error(`Selector "${t}" does not point to an element node`);return{element:s,identifier:`with selector "${t}"`}}if("number"!=typeof s)throw Error("Block index must be a number");let l=Array.from(e.editor.children);if(s<0||s>=l.length)throw Error(`Block index ${s} is out of range. Document has ${l.length} blocks`);let c=l[s];if(!i.Dom.isElement(c))throw Error(`Block at index ${s} is not a valid element`);return{element:c,identifier:"at index "+s}}},70308:function(e,t,s){"use strict";s.d(t,{areAllToolCallsExecuted:function(){return l},createNewConversation:function(){return n},findMessagesWithPendingToolCalls:function(){return c},findParentMessageId:function(){return r},isTerminalToolCallStatus:function(){return o}});var i=s(21064);function n(e,t,s,r=[]){let a=e.o.aiAssistantPro,o={id:(0,i.generateConversationId)(),created:Date.now(),updated:Date.now(),messages:r,permissions:[],options:{model:t??a.defaultModel,temperature:s??a.defaultTemperature}};return e.e.fire("conversationCreated.ai-assistant-pro",o),o}function r(e){for(let t=e.messages.length-1;t>=0;t--){let s=e.messages[t];if("assistant"===s.role&&!s.id.startsWith("error_"))return s.id}return null}let a=new Set(["executed","denied","error"]);function o(e){return a.has(e)}function l(e){let t=e.messages[e.messages.length-1];return!!t?.toolCalls&&t.toolCalls.every(e=>o(e.status))}function c(e){return e.messages.filter(e=>e.toolCalls&&e.toolCalls.length>0&&e.toolCalls.some(e=>!o(e.status)))}},473:function(e,t,s){"use strict";s.d(t,{handleBackToList:function(){return l},handleConversationSearch:function(){return c},handleConversationSelect:function(){return o},handleToolApproval:function(){return r},handleToolDenial:function(){return a}});var i=s(79078),n=s(82758);async function r(e,t,s,i,n){let r=s.getPendingToolCalls().find(t=>t.id===e);if(!r)return null;let a=i.grantPermission(r.name,t),o=s.getCurrentConversation();return o&&(o.permissions.push(a),await n.save(o)),s.removePendingToolCall(e),{...r,status:"approved"}}async function a(e,t,s,n){let r=s.getPendingToolCalls().find(e=>e.id===t);if(!r)return;let a=s.getCurrentConversation();if(!a)return;let o=a.messages.findIndex(e=>e.toolCalls?.find(e=>e.id===t));if(-1===o)return;let l=a.messages[o],c={...r,result:{error:"Tool call denied by user."},status:"denied"},h=(0,i.updateToolCallInMessage)(l,c),u=[...a.messages];u[o]=h,a={...a,messages:u,updated:Date.now()},s.setCurrentConversation(a),await n.save(a),e.e.fire("toolCallDenied.ai-assistant-pro",r),s.removePendingToolCall(t)}async function o(e,t,s){try{s.setLoading(!0);let i=await t.get(e);if(!i)throw Error("Conversation not found: "+e);s.setCurrentConversation({...i})}catch(e){n.IS_PROD}finally{s.setLoading(!1)}}async function l(e,t){t.setView("conversationList");try{t.setLoading(!0);let s=await e.list().catch(()=>[]);t.setConversations(s)}finally{t.setLoading(!1)}}async function c(e,t,s){s.setLoading(!0);try{let i=await t.list(e||void 0);s.setConversations(i),s.setView("conversationList")}finally{s.setLoading(!1)}}},58579:function(e,t,s){"use strict";s.d(t,{applyTheme:function(){return h.applyTheme},areAllToolCallsExecuted:function(){return n.areAllToolCallsExecuted},createNewConversation:function(){return n.createNewConversation},createUserMessage:function(){return a.createUserMessage},deleteConversationWithCleanup:function(){return c.deleteConversationWithCleanup},executeToolCall:function(){return u.executeToolCall},findMessagesWithPendingToolCalls:function(){return n.findMessagesWithPendingToolCalls},findParentMessageId:function(){return n.findParentMessageId},getCurrentSelectionContext:function(){return l.getCurrentSelectionContext},handleBackToList:function(){return r.handleBackToList},handleConversationSearch:function(){return r.handleConversationSearch},handleConversationSelect:function(){return r.handleConversationSelect},handleToolApproval:function(){return r.handleToolApproval},handleToolDenial:function(){return r.handleToolDenial},invertMode:function(){return o.invertMode},isTerminalToolCallStatus:function(){return n.isTerminalToolCallStatus},loadInitialData:function(){return c.loadInitialData},processArtifacts:function(){return i.processArtifacts},processFinalResponse:function(){return i.processFinalResponse},processStreamingResponse:function(){return i.processStreamingResponse},resizeInPanelView:function(){return o.resizeInPanelView},updateToolCallInMessage:function(){return u.updateToolCallInMessage}});var i=s(61872),n=s(70308),r=s(473),a=s(61558),o=s(71050),l=s(15927),c=s(56110),h=s(53014),u=s(79078)},61558:function(e,t,s){"use strict";s.d(t,{createAIMessage:function(){return r},createErrorMessage:function(){return a},createUserMessage:function(){return n},uploadArtifacts:function(){return o}});var i=s(21064);function n(e){return{id:(0,i.generateMessageId)(),role:"user",content:e,timestamp:Date.now()}}function r(){return{id:"",role:"assistant",content:"",artifacts:[],timestamp:Date.now(),toolCalls:[]}}function a(e){return{id:"error_"+(0,i.generateMessageId)(),role:"assistant",content:"❌ Error: "+e.message,timestamp:Date.now(),toolCalls:[],artifacts:[]}}async function o(e,t){if(!t||0===t.length)return t;let s=e.o.aiAssistantPro.uploadBase64Artifact;return s?Promise.all(t.map(async t=>s(t,e)??t)):t}},71050:function(e,t,s){"use strict";s.d(t,{invertMode:function(){return n},resizeInPanelView:function(){return r}});var i=s(41180);function n(e){switch(e){case"left":return"right";case"right":return"left";case"top":return"bottom";case"bottom":return"top"}}function r(e,t,s,r){if("dialog"===t||"flight"===t)return;("left"===t||"right"===t)&&(e.currentPlace.slots[n(t)]?.style.setProperty(`--jd-slot-${n(t)}-width`,"auto"),e.currentPlace.slots[t]?.style.setProperty(`--jd-slot-${t}-width`,`${s}px`));let a=(0,i.css)(e.currentPlace.workplace,"height")??0;e.currentPlace.slots[t]?.style.setProperty("min-height",`${Math.min(a,r)}px`)}},15927:function(e,t,s){"use strict";function i(e){if(e.s.isCollapsed())return null;let t=e.s.html,s=e.s.range;return{html:t,rangeInfo:{startContainer:s.startContainer.nodeName,startOffset:s.startOffset,endContainer:s.endContainer.nodeName,endOffset:s.endOffset}}}s.d(t,{getCurrentSelectionContext:function(){return i}})},56110:function(e,t,s){"use strict";s.d(t,{deleteConversationWithCleanup:function(){return n},loadInitialData:function(){return r}});var i=s(82758);async function n(e,t,s,i,n){try{i.setLoading(!0),await s.delete(t),i.removeConversation(t),n.clearConversationPermissions(t);let r=i.getCurrentConversation();r?.id===t&&i.setCurrentConversation(null);let a=await s.list();i.setConversations(a),i.setView(0===a.length?"welcome":"conversationList"),e.e.fire("conversationDeleted.ai-assistant-pro",t)}catch(t){e.alert(e.i18n("Failed to delete conversation")+": "+(t?.message||"Unknown error"))}finally{i.setLoading(!1)}}async function r(e,t,s){s.setLoading(!0);try{let[i,n]=await Promise.all([t.list().catch(()=>[]),t.getGlobalSettings().catch(()=>null)]);if(s.setConversations(i),n&&s.setSavedState(n),0===i.length)s.setView("welcome");else if(e.o.aiAssistantPro.rememberLastConversation&&n?.currentConversationId){let e=i.find(e=>e.id===n.currentConversationId)??i[0],r=await t.get(e.id);r?s.setCurrentConversation(r):s.setView("conversationList")}else s.setView("conversationList")}catch(e){i.IS_PROD,s.setView("welcome")}finally{s.setLoading(!1)}}},53014:function(e,t,s){"use strict";s.d(t,{applyTheme:function(){return r}});let i=["jodit_theme_dark","jodit-ai-assistant-pro_theme_dark","jodit-dialog_theme_dark"],n=["jodit_theme_light","jodit-ai-assistant-pro_theme_light","jodit-dialog_theme_light"];function r(e,t,s,r,a){let o;if(r?.classList.remove(...i),r?.classList.remove(...n),"dialog"===s){let e=a?.container;e?.classList.remove(...i),e?.classList.remove(...n)}if(o="dark"===t?i:n,r?.classList.add(...o),"dialog"===s){let e=a?.container;e?.classList.add(...o)}}},79078:function(e,t,s){"use strict";async function i(e,t,s){let i;try{let e=new AbortController().signal,n=await s.executeTool(t.name,t.arguments,e);i={...t,result:{result:n},status:"executed"}}catch(s){i={...t,result:{error:s instanceof Error?s.message:s+""},status:"error"},e.e.fire("toolCallFailed.ai-assistant-pro",i)}return e.e.fire("toolCallExecuted.ai-assistant-pro",i,{toolCallId:i.id,result:i.result}),i}function n(e,t){let s=e.toolCalls?.findIndex(e=>e.id===t.id);if(null==s||-1===s)return e;let i=[...e?.toolCalls??[]];return i[s]=t,{...e,toolCalls:i}}s.d(t,{executeToolCall:function(){return i},updateToolCallInMessage:function(){return n}})},86449:function(e,t,s){"use strict";s.d(t,{APIClient:function(){return a}});var i=s(82749),n=s(82758),r=s(21537);class a{async sendRequest(e,t,s,i,a){let{apiRequest:o,requestTimeout:l,maxRetries:c}=this.jodit.o.aiAssistantPro;if(!o)throw Error("AI Assistant Pro callback is not configured");let h=new AbortController;this.abortControllers.add(h);try{let u=this.buildRequestContext(e,t,s,i,a),d=null;for(let e=0;c>=e;e++)try{if(h.signal.aborted)throw(0,r.abort)();let e=setTimeout(()=>{h.abort()},l);try{let t=await o(u,h.signal);return clearTimeout(e),this.validateResponse(t),t}catch(t){throw clearTimeout(e),t}}catch(t){if(d=t,n.IS_PROD,c>e){let t=this.calculateRetryDelay(e);await this.sleep(t)}else throw t}throw d||Error("API request failed after all retries")}finally{this.abortControllers.delete(h)}}abort(){this.abortControllers.forEach(e=>{e.abort()}),this.abortControllers.clear()}isInProgress(){return this.abortControllers.size>0}buildRequestContext(e,t,s,i,n){let r,{apiMode:a,instructions:o}=this.jodit.o.aiAssistantPro,l={mode:a,conversationId:e,tools:this.toolRegistry.getAllTools(),selectionContexts:i,conversationOptions:n,instructions:o};if("full"===a)r=t;else if(s){let e=t.findIndex(e=>e.id===s);r=-1!==e?t.slice(e+1):t,l={...l,parentMessageId:s}}else r=t;return{...l,messages:this.expandToolMessages(r,t.find(e=>e.id===s))}}expandToolMessages(e,t){let s=[];for(let t of e)s.push(t),this.expandToolResultsMessage(t,s);return t&&this.expandToolResultsMessage(t,s),s}expandToolResultsMessage(e,t){if(e.toolCalls&&e.toolCalls.length>0)for(let s of e.toolCalls){let i=s.result??{error:"result not found"};if(t.find(e=>e.id===`${s.id}-result`))continue;let n={id:`${s.id}-result`,role:"tool",content:i.error?"Error: "+i.error:JSON.stringify(i.result),timestamp:e.timestamp,toolResults:[{toolCallId:s.id,result:i}]};t.push(n)}}validateResponse(e){if("final"!==e.mode)return;let t=e.response;if(!t)throw Error("API returned empty response");if(!t.responseId)throw Error("API response missing responseId");if(void 0===t.content)throw Error("API response missing content");if(void 0===t.finished)throw Error("API response missing finished flag");if(t.toolCalls){if(!Array.isArray(t.toolCalls))throw Error("API response toolCalls must be an array");t.toolCalls.forEach((e,t)=>{if(!e.id)throw Error(`Tool call at index ${t} is missing id`);if(!e.name)throw Error(`Tool call at index ${t} is missing name`);if(!e.arguments||"object"!=typeof e.arguments)throw Error(`Tool call at index ${t} has invalid arguments`)})}}calculateRetryDelay(e){let{retryDelay:t}=this.jodit.o.aiAssistantPro;return t*Math.pow(2,e)+Math.random()*t}sleep(e){return new Promise(t=>setTimeout(t,e))}destruct(){this.abort()}constructor(e,t){(0,i._)(this,"jodit",void 0),(0,i._)(this,"toolRegistry",void 0),(0,i._)(this,"abortControllers",void 0),this.jodit=e,this.toolRegistry=t,this.abortControllers=new Set}}},47373:function(e,t,s){"use strict";function i(e,t,s="image/png"){let n=atob(e),r=n.length,a=new Uint8Array(r);for(let e=0;r>e;e++)a[e]=n.charCodeAt(e);return new File([new Blob([a],{type:s})],t,{type:s})}s.d(t,{base64ToFile:function(){return i}})},21020:function(e,t,s){"use strict";s.d(t,{PermissionManager:function(){return n}});var i=s(82749);class n{requiresPermission(e){let{autoApproveTools:t,alwaysDenyTools:s}=this.jodit.o.aiAssistantPro;if(s.includes(e))return!0;if(t.includes(e))return!1;let i=this.toolRegistry.getTool(e);return!i||i.requiresPermission}isAutoDenied(e){let{alwaysDenyTools:t}=this.jodit.o.aiAssistantPro;return t.includes(e)}isAutoApproved(e){let{autoApproveTools:t}=this.jodit.o.aiAssistantPro;return t.includes(e)}checkPermission(e,t){if(this.isAutoApproved(e))return{toolName:e,granted:!0,grantedAt:Date.now(),scope:"once"};if(this.isAutoDenied(e))return null;let s=this.permanentPermissions.get(e);return s&&s.granted?s:t.find(t=>t.toolName===e&&t.granted)||null}grantPermission(e,t){let s={toolName:e,granted:!0,grantedAt:Date.now(),scope:t};return"forever"===t&&(this.permanentPermissions.set(e,s),this.savePermanentPermissions()),s}denyPermission(e){return{toolName:e,granted:!1,grantedAt:Date.now(),scope:"once"}}filterToolCalls(e,t){let s=[],i=[],n=[];for(let r of e){if(this.isAutoDenied(r.name)){n.push({...r,status:"denied"});continue}if(this.isAutoApproved(r.name)){s.push({...r,status:"approved"});continue}let e=this.checkPermission(r.name,t);e&&e.granted?s.push({...r,status:"approved"}):this.requiresPermission(r.name)?(this.jodit.e.fire("permissionRequested.ai-assistant-pro",r.name),i.push({...r,status:"pending"})):s.push({...r,status:"approved"})}return{approved:s,needsPermission:i,denied:n}}clearConversationPermissions(e){}loadPermanentPermissions(){try{let e=localStorage.getItem(this.PERMANENT_PERMISSIONS_KEY);e&&JSON.parse(e).forEach(e=>{"forever"===e.scope&&e.granted&&this.permanentPermissions.set(e.toolName,e)})}catch(e){}}savePermanentPermissions(){try{let e=Array.from(this.permanentPermissions.values());localStorage.setItem(this.PERMANENT_PERMISSIONS_KEY,JSON.stringify(e))}catch(e){}}clearPermanentPermissions(){this.permanentPermissions.clear(),localStorage.removeItem(this.PERMANENT_PERMISSIONS_KEY)}getPermanentPermissions(){return Array.from(this.permanentPermissions.values())}revokePermanentPermission(e){this.permanentPermissions.delete(e),this.savePermanentPermissions()}destruct(){this.permanentPermissions.clear()}constructor(e,t){(0,i._)(this,"jodit",void 0),(0,i._)(this,"toolRegistry",void 0),(0,i._)(this,"permanentPermissions",void 0),(0,i._)(this,"PERMANENT_PERMISSIONS_KEY",void 0),this.jodit=e,this.toolRegistry=t,this.permanentPermissions=new Map,this.PERMANENT_PERMISSIONS_KEY="jodit-permissions.ai-assistant-pro",this.loadPermanentPermissions()}}},46166:function(e,t,s){"use strict";s.d(t,{StateManager:function(){return n}});var i=s(82749);class n{createInitialState(){return{isOpen:!1,currentView:"welcome",currentConversation:null,conversations:[],isLoading:!1,error:null,pendingToolCalls:[],selectionContexts:[],abortController:null,editingMessageId:null,theme:this.jodit.o.aiAssistantPro.theme||"parent",displayMode:this.jodit.o.aiAssistantPro.displayMode,panelWidth:this.jodit.o.aiAssistantPro.panelWidth,panelHeight:this.jodit.o.aiAssistantPro.panelHeight,defaultModel:this.jodit.o.aiAssistantPro.defaultModel,defaultTemperature:this.jodit.o.aiAssistantPro.defaultTemperature}}open(){this.state.isOpen=!0,this.jodit.e.fire("open.ai-assistant-pro",this.state.currentConversation)}close(){this.state.isOpen=!1,this.jodit.e.fire("close.ai-assistant-pro")}isOpen(){return this.state.isOpen}setView(e){this.state.currentView=e,this.jodit.e.fire("viewChanged.ai-assistant-pro",e)}getView(){return this.state.currentView}setConversations(e){this.state.conversations=e}setSavedState(e){e.theme&&(this.state.theme=e.theme),e.displayMode&&(this.state.displayMode=e.displayMode),e.panelWidth&&(this.state.panelWidth=e.panelWidth),e.panelHeight&&(this.state.panelHeight=e.panelHeight),e.defaultModel&&(this.state.defaultModel=e.defaultModel),e.defaultTemperature&&(this.state.defaultTemperature=e.defaultTemperature)}getConversations(){return this.state.conversations}setCurrentConversation(e){if(this.state.currentConversation===e)throw Error("Conversation is already current");this.state.currentConversation=e||null,e&&(this.setView("conversation"),this.jodit.e.fire("conversationSwitched.ai-assistant-pro",e))}getCurrentConversation(){return this.state.currentConversation}removeConversation(e){let t=this.state.conversations.filter(t=>t.id!==e);this.setConversations(t)}setLoading(e){this.state.isLoading=e}isLoading(){return this.state.isLoading}setError(e){this.state.error=e,e&&this.jodit.e.fire("error.ai-assistant-pro",Error(e))}getError(){return this.state.error}clearError(){this.setError(null)}setPendingToolCalls(e){this.state.pendingToolCalls=e}getPendingToolCalls(){return this.state.pendingToolCalls}addPendingToolCall(e){let t=[...this.state.pendingToolCalls,e];this.setPendingToolCalls(t)}removePendingToolCall(e){let t=this.state.pendingToolCalls.filter(t=>t.id!==e);this.setPendingToolCalls(t)}updateToolCallStatus(e,t){let s=this.state.pendingToolCalls.map(s=>s.id===e?{...s,status:t}:s);this.setPendingToolCalls(s)}setSelectionContexts(e){this.state.selectionContexts=e}getSelectionContexts(){return this.state.selectionContexts}addSelectionContext(e){let{maxContextRanges:t}=this.jodit.o.aiAssistantPro,s=[...this.state.selectionContexts,e];s.length>t&&(s=s.slice(-t)),this.setSelectionContexts(s),this.jodit.e.fire("contextAdded.ai-assistant-pro",e)}removeSelectionContext(e){let t=this.state.selectionContexts.filter((t,s)=>s!==e);this.setSelectionContexts(t),this.jodit.e.fire("contextRemoved.ai-assistant-pro",e)}clearSelectionContexts(){this.setSelectionContexts([])}setAbortController(e){this.state.abortController=e}getAbortController(){return this.state.abortController}setEditingMessageId(e){this.state.editingMessageId=e}getEditingMessageId(){return this.state.editingMessageId}isEditingMessage(){return null!=this.state.editingMessageId}clearEditingMessage(){this.setEditingMessageId(null)}reset(){this.state=this.createInitialState()}destruct(){this.state.abortController&&this.state.abortController.abort(),this.reset()}constructor(e){(0,i._)(this,"jodit",void 0),(0,i._)(this,"state",void 0),this.jodit=e,this.state=this.createInitialState()}}},62895:function(e,t,s){"use strict";s.d(t,{WebStorageConversationStorage:function(){return i.WebStorageConversationStorage},createStorageProvider:function(){return i.createStorageProvider}});var i=s(21064)},21064:function(e,t,s){"use strict";s.d(t,{WebStorageConversationStorage:function(){return r},createStorageProvider:function(){return a},generateConversationId:function(){return o},generateMessageId:function(){return l}});var i=s(82749),n=s(97333);class r{close(){return this.storage.close()}getConversationKey(e){return"conv:"+e}async getAllKeys(){let e=await this.storage.get("__conversation_index__");return e&&Array.isArray(e)?e:[]}async updateIndex(e){await this.storage.set("__conversation_index__",e)}async addToIndex(e){let t=await this.getAllKeys();t.includes(e)||(t.push(e),await this.updateIndex(t))}async removeFromIndex(e){let t=(await this.getAllKeys()).filter(t=>t!==e);await this.updateIndex(t)}async list(e){try{let t=await this.getAllKeys(),s=[],i=e?.toLowerCase().trim();for(let e of t){let t=await this.get(e);if(t){if(i){let e=t.title?.toLowerCase().includes(i),s=!e&&t.messages.some(e=>e.content.toLowerCase().includes(i));if(!e&&!s)continue}s.push({id:t.id,title:t.title??"",created:t.created,updated:t.updated,messageCount:t.messages.length})}}return s.sort((e,t)=>t.updated-e.updated),s}catch(e){return[]}}async get(e){try{let t=this.getConversationKey(e);return await this.storage.get(t)||null}catch(e){return null}}async save(e){try{if(0===e.messages.length)throw Error("Conversation must have at least one message.");let t=await this.getAllKeys();t.length>=this.maxConversations&&!t.includes(e.id)&&await this.evictOldest();let s=this.getConversationKey(e.id);await this.storage.set(s,e),await this.addToIndex(e.id)}catch(t){if(t?.name==="QuotaExceededError"||t?.code===22||t?.code===1014){await this.evictOldest();try{let t=this.getConversationKey(e.id);await this.storage.set(t,e),await this.addToIndex(e.id)}catch{throw Error("Storage quota exceeded. Please delete some conversations.")}}else throw Error("Failed to save conversation: "+(t?.message||"Unknown error"))}}async delete(e){try{let t=this.getConversationKey(e);await this.storage.delete(t),await this.removeFromIndex(e)}catch(e){}}async clear(){try{for(let e of(await this.getAllKeys())){let t=this.getConversationKey(e);await this.storage.delete(t)}await this.updateIndex([])}catch(e){}}async evictOldest(){try{let e=await this.list();if(0===e.length)return;e.sort((e,t)=>e.updated-t.updated);let t=e[0];await this.delete(t.id)}catch(e){}}async getGlobalSettings(){try{return await this.storage.get("global-settings")||null}catch(e){return null}}async saveGlobalSettings(e){try{let t={...await this.getGlobalSettings(),...e};await this.storage.set("global-settings",t)}catch{throw Error("Failed to save global settings")}}constructor(e,t){(0,i._)(this,"storage",void 0),(0,i._)(this,"maxConversations",void 0),this.storage=e,this.maxConversations=t}}function a(e,t){return n.AsyncStorage.makeStorage(e,t)}function o(){return`conv_${Date.now()}_${Math.random().toString(36).substring(2,11)}`}function l(){return`msg_${Date.now()}_${Math.random().toString(36).substring(2,11)}`}},55487:function(e,t,s){"use strict";s.d(t,{ToolRegistry:function(){return r}});var i=s(82749),n=s(53835);class r{registerBuiltInTools(e){e.forEach(e=>{let t=n.BUILT_IN_TOOLS[e];t&&this.tools.set(e,t)})}registerCustomTools(e){e.forEach(e=>{this.validateToolDefinition(e),this.tools.set(e.name,e)})}validateToolDefinition(e){if(!e.name||"string"!=typeof e.name)throw Error("Tool must have a valid name");if(!e.description||"string"!=typeof e.description)throw Error(`Tool "${e.name}" must have a description`);if(!Array.isArray(e.parameters))throw Error(`Tool "${e.name}" must have a parameters array`);if("function"!=typeof e.execute)throw Error(`Tool "${e.name}" must have an execute function`);e.parameters.forEach(t=>{if(!t.name||"string"!=typeof t.name)throw Error(`Tool "${e.name}" has a parameter without a valid name`);if(!t.type)throw Error(`Tool "${e.name}" parameter "${t.name}" must have a type`);if("boolean"!=typeof t.required)throw Error(`Tool "${e.name}" parameter "${t.name}" must specify if it's required`)})}getAllTools(){return Array.from(this.tools.values())}getTool(e){return this.tools.get(e)}hasTool(e){return this.tools.has(e)}getToolNames(){return Array.from(this.tools.keys())}async executeTool(e,t,s){let i=this.getTool(e);if(!i)throw Error(`Tool "${e}" not found`);let n=this.applyDefaults(i,t);this.validateArguments(i,n);try{return await i.execute(this.jodit,n,s)}catch(e){if(e?.name==="AbortError"||s.aborted)throw Error("Tool execution was aborted");throw e}}validateArguments(e,t){let s=Object.keys(t);for(let t of e.parameters.filter(e=>e.required).map(e=>e.name))if(!s.includes(t))throw Error(`Tool "${e.name}" requires parameter "${t}"`);for(let[s,i]of Object.entries(t)){let t=e.parameters.find(e=>e.name===s);if(!t){this.jodit.o.aiAssistantPro.debug;continue}let n=Array.isArray(i)?"array":"object"==typeof i&&null!=i?"object":typeof i;if(t.type!==n&&!("number"===t.type&&"string"===n&&!isNaN(Number(i))))throw Error(`Tool "${e.name}" parameter "${s}" expects type "${t.type}" but got "${n}"`);if(t.enum&&t.enum.length>0&&!t.enum.includes(i))throw Error(`Tool "${e.name}" parameter "${s}" must be one of: ${t.enum.join(", ")}`)}}applyDefaults(e,t){let s={...t};for(let t of e.parameters)void 0===s[t.name]&&void 0!==t.default&&(s[t.name]=t.default);return s}destruct(){this.tools.clear()}constructor(e){(0,i._)(this,"jodit",void 0),(0,i._)(this,"tools",void 0),this.jodit=e,this.tools=new Map,this.registerBuiltInTools(e.o.aiAssistantPro.enabledTools||[]),this.registerCustomTools(e.o.aiAssistantPro.customTools||[])}}},26612:function(e){e.exports={"AI Assistant":"AI Assistant","AI Assistant Pro":"AI Assistant Pro","Welcome to AI Assistant":"Welcome to AI Assistant","Start your first conversation":"Start your first conversation","Tip: Select text in editor to add context":"Tip: Select text in editor to add context","New Chat":"New Chat","Search conversations...":"Search conversations...","No conversations yet":"No conversations yet","Ask me anything...":"Ask me anything...","Ask a follow-up...":"Ask a follow-up...","Reply...":"Reply...","Type your message...":"Type your message...",Send:"Send",Cancel:"Cancel",Retry:"Retry",Insert:"Insert",Copy:"Copy",Edit:"Edit",Delete:"Delete",New:"New",Back:"Back","Permission Required":"Permission Required",Approve:"Approve",Deny:"Deny",Once:"Once","This conversation":"This conversation",Always:"Always","The AI wants to execute:":"The AI wants to execute:","This will modify your document content.":"This will modify your document content.","Executing...":"Executing...","Completed successfully":"Completed successfully",Failed:"Failed","Pending approval":"Pending approval","Denied by user":"Denied by user","Tool Result":"Tool Result","Tool Execution Error":"Tool Execution Error",Context:"Context",Contexts:"Contexts","Add to AI Context":"Add to AI Context",Remove:"Remove","Clear all":"Clear all","An error occurred":"An error occurred","Request failed":"Request failed","Connection error":"Connection error","AI Assistant is not configured":"AI Assistant is not configured","Thinking...":"Thinking...","Generating response...":"Generating response...",insertHTML:"Insert HTML",readDocument:"Read Document",readBlock:"Read Block",replaceInDocument:"Replace in Document",replaceInBlock:"Replace in Block",getSelection:"Get Selection","Just now":"Just now",Conversation:"Conversation","New Conversation":"New Conversation",Yesterday:"Yesterday","Delete conversation":"Delete conversation","Are you sure you want to delete this conversation?":"Are you sure you want to delete this conversation?","Failed to delete conversation":"Failed to delete conversation"}},63805:function(e,t,s){"use strict";s.r(t),s.d(t,{en:function(){return n.a},ru:function(){return a.a}});var i=s(26612),n=s.n(i),r=s(55790),a=s.n(r)},55790:function(e){e.exports={"AI Assistant":"AI Ассистент","AI Assistant Pro":"AI Ассистент Pro","Welcome to AI Assistant":"Добро пожаловать в AI Ассистент","Start your first conversation":"Начните первый диалог","Tip: Select text in editor to add context":"Подсказка: Выделите текст в редакторе для добавления контекста","New chat":"Новый чат","Search conversations...":"Поиск диалогов...","No conversations yet":"Пока нет диалогов","Ask me anything...":"Спросите меня о чем угодно...","Ask a follow-up...":"Задайте дополнительный вопрос...","Reply...":"Ответить...","Type your message...":"Введите ваше сообщение...",Send:"Отправить",Cancel:"Отмена",Retry:"Повторить",Insert:"Вставить",Copy:"Копировать",Edit:"Редактировать",Delete:"Удалить",New:"Новый",Back:"Назад","Permission Required":"Требуется разрешение",Approve:"Разрешить",Deny:"Отклонить",Once:"Один раз","This conversation":"Этот диалог",Always:"Всегда","The AI wants to execute:":"AI хочет выполнить:","This will modify your document content.":"Это изменит содержимое вашего документа.","Executing...":"Выполняется...","Completed successfully":"Успешно выполнено",Failed:"Ошибка","Pending approval":"Ожидает разрешения","Denied by user":"Отклонено пользователем","Tool Result":"Результат инструмента","Tool Execution Error":"Ошибка выполнения инструмента",Context:"Контекст",Contexts:"Контексты","Add to AI Context":"Добавить в контекст AI",Remove:"Удалить","Clear all":"Очистить все","An error occurred":"Произошла ошибка","Request failed":"Запрос не выполнен","Connection error":"Ошибка соединения","AI Assistant is not configured":"AI Ассистент не настроен","Thinking...":"Думаю...","Generating response...":"Генерирую ответ...",insertHTML:"Вставить HTML",readDocument:"Прочитать документ",readBlock:"Прочитать блок",replaceInDocument:"Заменить в документе",replaceInBlock:"Заменить в блоке",getSelection:"Получить выделение","Just now":"Только что",Conversation:"Диалог","New Conversation":"Новый диалог",Yesterday:"Вчера","Delete conversation":"Удалить диалог","Are you sure you want to delete this conversation?":"Вы уверены, что хотите удалить этот диалог?","Failed to delete conversation":"Не удалось удалить диалог",Settings:"Настройки","General Settings":"Общие настройки","Conversation Settings":"Настройки диалога","Display Mode":"Режим отображения","Panel Width":"Ширина панели",Theme:"Тема",Model:"Модель",Temperature:"Температура",Close:"Закрыть",Dialog:"Модальное окно",Left:"Левая панель",Right:"Правая панель",Top:"Верхняя панель",Bottom:"Нижняя панель",Inherit:"Наследовать от редактора",Light:"Светлая тема",Dark:"Тёмная тема","%dm ago":"%dм назад","%dh ago":"%dч назад"}},94454:function(e,t,s){"use strict";s.d(t,{getAIProviderOptions:function(){return i.getAIProviderOptions},registerAIProvider:function(){return i.registerAIProvider}}),s(82923);var i=s(58211)},82923:function(e,t,s){"use strict";var i=s(58211),n=s(54079);(0,i.registerAIProvider)("jodit-ai-adapter",e=>{let t=e.url.replace(/\/+$/,""),s=e.provider??"openai",i=!1!==e.stream;return{apiMode:"incremental",maxRetries:0,textAutocompleteEnabled:!0,async textAutocompleteApiRequest(i,r,a){let o=new n.Ajax({url:`${t}/ai/autocomplete?query=${encodeURIComponent(i)}&key=${encodeURIComponent(e.apiKey)}`,method:"POST",contentType:"application/json",data:{provider:s,context:{maxSuggestions:r}}});a.addEventListener("abort",()=>o.abort(),{once:!0});let l=await o.send(),c=await l.json();return c.success&&c.result?.suggestions?c.result.suggestions:[]},async apiRequest(r,a){let o=new n.Ajax({url:`${t}/ai/request?key=${encodeURIComponent(e.apiKey)}`,method:"POST",contentType:"application/json",data:{provider:s,context:i?{...r,metadata:{...r.metadata,stream:!0}}:r}});if(a&&a.addEventListener("abort",()=>o.abort(),{once:!0}),!i){let e=await o.send();return{mode:"final",response:(await e.json()).result}}let l=o.stream();return{mode:"stream",stream:async function*(){for await(let e of l)yield JSON.parse(e)}()}}}})},58211:function(e,t,s){"use strict";s.d(t,{getAIProviderOptions:function(){return n},registerAIProvider:function(){return r}});let i=new Map;function n(e,t){let s=i.get(e);if(!s)throw Error(`AI provider "${e}" is not registered. Available providers: `+[...i.keys()].join(", "));return s(t)}function r(e,t){i.set(e,t)}},65374:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="addHTML",n="Add HTML content to the beginning or end of the document",r=[{name:"html",type:"string",description:"HTML content to add",required:!0},{name:"position",type:"string",description:'Where to add: "start" adds at the beginning of the document, "end" appends to the end',required:!1,default:"end"}],a=!0},686:function(e,t,s){"use strict";s.d(t,{execute:function(){return a}});var i=s(6689),n=s(49459),r=s(22732);async function a(e,t,s){let a=(0,n.requireString)(t,"html",{allowEmpty:!0}),{position:o="end"}=t;if(!a.trim())return{success:!0,message:"Nothing to add: HTML is empty"};(0,i.throwIfAborted)(s);try{let t=e.createInside.fragment(),s=e.createInside.div();for(s.innerHTML=a;s.firstChild;)t.appendChild(s.firstChild);return"start"===o?r.Dom.prepend(e.editor,t):r.Dom.append(e.editor,t),e.synchronizeValues(),{success:!0,message:`Added ${a.length} characters of HTML at the ${"start"===o?"beginning":"end"} of the document`}}catch(e){throw Error("Failed to add HTML: "+(e?.message||"Unknown error"))}}},78907:function(e,t,s){"use strict";var i=s(65374),n=s(686);t.default={...i,execute:n.execute}},73943:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="applyFormat",n="Apply or remove inline formatting to the current selection (bold, italic, underline, etc.) or to a specific block",r=[{name:"element",type:"string",description:'HTML element to wrap selection (e.g., "strong", "em", "u", "span")',required:!1},{name:"attributes",type:"object",description:'Attributes to apply (e.g., {"className": "highlight"}, {"style": {"color": "red"}})',required:!1},{name:"remove",type:"boolean",description:"If true, remove the formatting instead of applying it",required:!1,default:!1},{name:"blockIndex",type:"number",description:"Zero-based index of the block to format (if not using current selection)",required:!1},{name:"selector",type:"string",description:"CSS selector to find the block to format (if not using current selection)",required:!1}],a=!0},19127:function(e,t,s){"use strict";s.d(t,{execute:function(){return r}});var i=s(6689),n=s(44526);async function r(e,t,s){let{element:r,attributes:a,remove:o,blockIndex:l,selector:c}=t;if((0,i.throwIfAborted)(s),!r&&!a)throw Error('Either "element" or "attributes" must be provided');if(e.s.restore(),void 0!==l||c){let{element:t}=(0,n.resolveBlock)(e,{selector:c,index:l});e.s.select(t)}if(e.s.isCollapsed())throw Error("No selection found. Please select text to format");try{let t={};return r&&(t.element=r),a&&(t.attributes=a),o?e.s.commitStyle({...t,mode:"remove"}):e.s.commitStyle(t),e.synchronizeValues(),{success:!0,message:o?"Formatting removed successfully":"Formatting applied successfully"}}catch(e){throw Error(`Failed to ${o?"remove":"apply"} formatting: ${e.message}`)}}},39296:function(e,t,s){"use strict";var i=s(73943),n=s(19127);t.default={...i,execute:n.execute}},53835:function(e,t,s){"use strict";s.d(t,{BUILT_IN_TOOLS:function(){return p},getToolNames:function(){return g}});var i=s(78907),n=s(39296),r=s(16745),a=s(78717),o=s(5618),l=s(90991),c=s(2020),h=s(12570),u=s(95323),d=s(97603);let p={readDocument:o.default,readBlocks:a.default,readSelection:l.default,writeDocument:d.default,replaceSelection:u.default,replaceBlock:c.default,replaceInDocument:h.default,insertHTML:r.default,addHTML:i.default,applyFormat:n.default};function g(){return Object.keys(p)}},56732:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="insertHTML",n="Insert or replace HTML content at the current cursor position in the editor",r=[{name:"html",type:"string",description:"HTML content to insert",required:!0},{name:"replace",type:"boolean",description:"If true, replaces current selection. If false, inserts at cursor",required:!1,default:!1}],a=!0},39592:function(e,t,s){"use strict";s.d(t,{execute:function(){return r}});var i=s(6689),n=s(49459);async function r(e,t,s){let r=(0,n.requireString)(t,"html",{allowEmpty:!0}),{replace:a}=t;if(!r.trim())return{success:!0,message:"Nothing to insert: HTML is empty"};(0,i.throwIfAborted)(s);try{return e.s.focus(),a&&!e.s.isCollapsed()&&e.s.remove(),e.s.insertHTML(r),e.synchronizeValues(),{success:!0,message:`Inserted ${r.length} characters of HTML`}}catch(e){throw Error("Failed to insert HTML: "+(e?.message||"Unknown error"))}}},16745:function(e,t,s){"use strict";var i=s(56732),n=s(39592);t.default={...i,execute:n.execute}},75352:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="readBlocks",n="Read blocks from the editor with optional filtering and pagination",r=[{name:"offset",type:"number",description:"Number of blocks to skip from the beginning (default: 0)",required:!1,default:0},{name:"limit",type:"number",description:"Maximum number of blocks to return (default: all)",required:!1},{name:"query",type:"string",description:"Filter blocks by text content",required:!1}],a=!1},91140:function(e,t,s){"use strict";s.d(t,{execute:function(){return r}});var i=s(6689),n=s(22732);async function r(e,t,s){let{offset:r,limit:a,query:o}=t;(0,i.throwIfAborted)(s);let l=[];Array.from(e.editor.children).forEach((e,t)=>{n.Dom.isElement(e)&&l.push({blockIndex:t,tagName:e.tagName.toLowerCase(),content:e.innerHTML,textContent:e.textContent||"",classList:Array.from(e.classList)})});let c=l;if(o&&"string"==typeof o){let e=o.toLowerCase();c=l.filter(t=>t.textContent.toLowerCase().includes(e)||t.tagName.includes(e)||t.content.toLowerCase().includes(e))}let h=Math.max(0,Math.min("number"==typeof r?r:0,c.length)),u=void 0!==a?Math.min(h+a,c.length):c.length;return{blocks:c.slice(h,u),total:l.length,offset:h,limit:void 0!==a?a:void 0}}},78717:function(e,t,s){"use strict";var i=s(75352),n=s(91140);t.default={...i,execute:n.execute}},93809:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="readDocument",n="Read the entire content of the editor document in HTML format",r=[{name:"start",type:"number",description:"Start character position (default: 0)",required:!1,default:0},{name:"end",type:"number",description:"End character position (default: length of document)",required:!1},{name:"aroundSelection",type:"boolean",description:"If true, return only the maximum block around the current selection",required:!1,default:!1}],a=!1},28157:function(e,t,s){"use strict";s.d(t,{execute:function(){return r}});var i=s(6689),n=s(22732);async function r(e,t,s){let{start:r,end:a,aroundSelection:o}=t;(0,i.throwIfAborted)(s);let l=e.value,c=l.length;if(o&&!e.s.isCollapsed()){let t=e.s.range.commonAncestorContainer;for(;t&&t!==e.editor;){if(n.Dom.isElement(t)&&t.parentNode===e.editor){l=t.outerHTML;break}t=t.parentNode}return{html:l,length:c}}let h=void 0!==a?Math.min(a,c):c,u=Math.max(0,Math.min("number"==typeof r?r:0,c));return(u>0||c>h)&&(l=l.substring(u,h)),{html:l,length:c,start:u,end:h}}},5618:function(e,t,s){"use strict";var i=s(93809),n=s(28157);t.default={...i,execute:n.execute}},52826:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="readSelection",n="Get information about the current selection including HTML content and optional context",r=[{name:"contextCharsBefore",type:"number",description:"Number of characters to include before the selection",required:!1,default:0},{name:"contextCharsAfter",type:"number",description:"Number of characters to include after the selection",required:!1,default:0}],a=!1},85130:function(e,t,s){"use strict";s.d(t,{execute:function(){return n}});var i=s(6689);async function n(e,t,s){let{contextCharsBefore:n,contextCharsAfter:r}=t;if((0,i.throwIfAborted)(s),e.s.restore(),e.s.isCollapsed())return{hasSelection:!1};let a=e.s.html,o=e.s.range,l=o.toString(),c={hasSelection:!0,html:a,text:l,startContainer:o.startContainer.nodeName,endContainer:o.endContainer.nodeName};if(n>0||r>0){let t=e.editor.textContent||"",s=t.substring(0,t.indexOf(l)),i=t.substring(t.indexOf(l)+l.length);n>0&&(c.contextBefore=s.slice(-n)),r>0&&(c.contextAfter=i.slice(0,r))}return c}},90991:function(e,t,s){"use strict";var i=s(52826),n=s(85130);t.default={...i,execute:n.execute}},96675:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="replaceBlock",n="Replace a specific block in the document by its index or CSS selector with new HTML content",r=[{name:"index",type:"number",description:"Zero-based index of the block to replace (use either index or selector, not both)",required:!1},{name:"selector",type:"string",description:'CSS selector to find the block to replace (e.g., "h1", ".my-class", "#my-id"). Use either selector or index, not both',required:!1},{name:"html",type:"string",description:"HTML content for the new block",required:!0}],a=!0},3091:function(e,t,s){"use strict";s.d(t,{execute:function(){return o}});var i=s(6689),n=s(49459),r=s(44526),a=s(22732);async function o(e,t,s){let{index:o,selector:l}=t,c=(0,n.requireString)(t,"html");if((0,i.throwIfAborted)(s),void 0===o&&!l||void 0!==o&&l)throw Error("Either index or selector must be provided, but not both");let{element:h,identifier:u}=(0,r.resolveBlock)(e,{selector:l,index:o,requireExactlyOne:!0});try{let t=e.createInside.div();t.innerHTML=c;let s=t.firstChild;if(!s||!a.Dom.isElement(s))throw Error("Invalid HTML: must contain at least one element");return h.parentNode?.replaceChild(s,h),e.synchronizeValues(),{success:!0,message:`Block ${u} replaced successfully`}}catch(e){throw Error(`Failed to replace block ${u}: ${e.message}`)}}},2020:function(e,t,s){"use strict";var i=s(96675),n=s(3091);t.default={...i,execute:n.execute}},62553:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="replaceInDocument",n="Find and replace text or HTML patterns throughout the entire document",r=[{name:"search",type:"string",description:"Text or pattern to search for",required:!0},{name:"replace",type:"string",description:"Replacement text or HTML",required:!0},{name:"useRegex",type:"boolean",description:"If true, treats search as a regular expression",required:!1,default:!1},{name:"useSelector",type:"string",description:"CSS selector to narrow down the search scope to specific elements",required:!1}],a=!0},56293:function(e,t,s){"use strict";s.d(t,{execute:function(){return r}});var i=s(6689),n=s(49459);async function r(e,t,s){let r=(0,n.requireString)(t,"search"),a=(0,n.requireString)(t,"replace",{allowEmpty:!0}),{useRegex:o,useSelector:l}=t;(0,i.throwIfAborted)(s);try{let t;e.s.focus(),e.s.save();let n=0;if(l){let c=function(e,t,s,n,r,a){let o=e.editor.querySelectorAll(r);if(0===o.length)return{replacements:0,message:`No elements found matching selector "${r}"`};let l=0;return o.forEach(e=>{(0,i.throwIfAborted)(a);let r=e.innerHTML,o=r;if(n)try{let e=RegExp(t,"g");r=r.replace(e,()=>(l++,s))}catch(e){throw Error("Invalid regex pattern: "+(e?.message||"Unknown error"))}else{let e=t.length,n=0;for(;-1!==(n=r.indexOf(t,n));)(0,i.throwIfAborted)(a),r=r.substring(0,n)+s+r.substring(n+e),n+=s.length,l++}r!==o&&(e.innerHTML=r)}),l>0&&(e.synchronizeValues(),e.s.restore()),{replacements:l}}(e,r,a,o,l,s);n=c.replacements,t=c.message}else n=function(e,t,s,n,r,a){let o=0,l=t;if(r)try{let e=RegExp(s,"g");l=l.replace(e,()=>(o++,n))}catch(e){throw Error("Invalid regex pattern: "+(e?.message||"Unknown error"))}else{let e=s.length,t=0;for(;-1!==(t=l.indexOf(s,t));)(0,i.throwIfAborted)(a),l=l.substring(0,t)+n+l.substring(t+e),t+=n.length,o++}return o>0&&(e.value=l,e.s.restore(),e.synchronizeValues()),o}(e,e.value,r,a,o,s);return{replacements:n,message:t||(n>0?`Replaced ${n} occurrence(s)`:"No matches found")}}catch(t){throw e.s.restore(),Error("Failed to replace in document: "+(t?.message||"Unknown error"))}}},12570:function(e,t,s){"use strict";var i=s(62553),n=s(56293);t.default={...i,execute:n.execute}},70750:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="replaceSelection",n="Replace the current selection with new HTML content",r=[{name:"html",type:"string",description:"HTML content to insert in place of the selection",required:!0},{name:"collapseToEnd",type:"boolean",description:"Move cursor to the end of the inserted content",required:!1,default:!0}],a=!0},36142:function(e,t,s){"use strict";s.d(t,{execute:function(){return r}});var i=s(6689),n=s(49459);async function r(e,t,s){let r=(0,n.requireString)(t,"html"),{collapseToEnd:a}=t;(0,i.throwIfAborted)(s);try{if(e.s.restore(),e.s.insertHTML(r),a){let t=e.s.range;t.collapse(!1),e.s.selectRange(t)}return e.e.fire("change"),{success:!0,message:"Selection replaced successfully"}}catch(e){throw Error("Failed to replace selection: "+e.message)}}},95323:function(e,t,s){"use strict";var i=s(70750),n=s(36142);t.default={...i,execute:n.execute}},90022:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="writeDocument",n="Write (replace) the entire document content with new HTML",r=[{name:"html",type:"string",description:"HTML content to set as the document",required:!0}],a=!0},79766:function(e,t,s){"use strict";s.d(t,{execute:function(){return r}});var i=s(6689),n=s(49459);async function r(e,t,s){let r=(0,n.requireString)(t,"html",{allowEmpty:!0});(0,i.throwIfAborted)(s);try{return e.s.focus(),e.value=r,e.synchronizeValues(),{success:!0,message:`Document content was replaced with provided HTML(${r.length} characters)`}}catch(e){throw Error("Failed to replace HTML: "+(e?.message||"Unknown error"))}}},97603:function(e,t,s){"use strict";var i=s(90022),n=s(79766);t.default={...i,execute:n.execute}},80453:function(e,t,s){"use strict";s.d(t,{UIConversationListItem:function(){return c}});var i=s(82749),n=s(31635),r=s(65478),a=s(67510),o=s(62843),l=s(80870);class c extends a.UIElement{className(){return"UIConversationListItem"}render(){return'<div class="jodit-ui-conversation-list__item"></div>'}setActive(e){this.isActive=e,this.updateContent()}updateContent(){let e=this.container;e.innerHTML="",e.setAttribute("data-id",this.conversation.id),this.isActive?e.classList.add("jodit-ui-conversation-list__item_active"):e.classList.remove("jodit-ui-conversation-list__item_active");let t=this.j.c.div("jodit-ui-conversation-list__item-avatar");t.textContent="AI",e.appendChild(t);let s=this.j.c.div("jodit-ui-conversation-list__item-wrapper"),i=this.j.c.div("jodit-ui-conversation-list__item-content"),n=this.j.c.div("jodit-ui-conversation-list__item-title");if(n.textContent=this.conversation.title,this.titleElement=n,i.appendChild(n),this.opts.showTimestamps){let e=this.j.c.div("jodit-ui-conversation-list__item-meta");e.textContent=this.opts.formatTimestamp(this.conversation.updated,this.j.i18n.bind(this.j)),i.appendChild(e)}if(s.appendChild(i),this.conversation.messageCount>0){let e=this.j.c.div("jodit-ui-conversation-list__item-badge");e.textContent=this.conversation.messageCount+"",s.appendChild(e)}e.appendChild(s),this.actionsButton||(this.actionsButton=new o.UIButton(this.j,{icon:{name:"dots"},tooltip:"Actions",name:"conversationActions",size:"tiny"}),this.actionsButton.container.classList.add("jodit-ui-conversation-list__item-actions"),this.actionsButton.onAction(e=>{e.stopPropagation(),this.showActionsMenu(e)})),e.appendChild(this.actionsButton.container)}onClick(){this.isRenaming||this.j.e.fire("selectConversation.ai-assistant-pro",this.conversation.id)}showActionsMenu(e){if(!this.contextMenu||!this.actionsButton)return;let t=this.actionsButton.container.getBoundingClientRect();this.contextMenu.show(t.left,t.bottom,[{title:"Rename",icon:"pencil",exec:()=>{this.startInlineRename()}},{title:"Delete",icon:"bin",exec:()=>{this.onDelete()}}]),e.stopPropagation()}startInlineRename(){if(this.isRenaming||!this.titleElement)return;this.isRenaming=!0;let e=this.titleElement,t=this.conversation.title,s=this.j.c.element("input");s.type="text",s.value=t,s.className="jodit-ui-conversation-list__item-title-input",e.textContent="",e.appendChild(s),s.focus(),s.select();let i=()=>{if(!this.isRenaming)return;let i=s.value.trim();this.isRenaming=!1,i&&i!==t?(e.textContent=i,this.j.e.fire("renameConversation.ai-assistant-pro",this.conversation.id,i)):e.textContent=t};this.j.e.on(s,"blur",i),this.j.e.on(s,"keydown",i=>{"Enter"===i.key&&(i.preventDefault(),s.blur()),"Escape"===i.key&&(this.isRenaming=!1,e.textContent=t)}),this.j.e.on(s,"click",e=>{e.stopPropagation()})}onDelete(){this.j.e.fire("deleteConversation.ai-assistant-pro",this.conversation.id)}destruct(){this.actionsButton?.destruct(),this.contextMenu?.destruct(),super.destruct()}constructor(e,t,s=!1,n){super(e),(0,i._)(this,"opts",void 0),(0,i._)(this,"conversation",void 0),(0,i._)(this,"isActive",void 0),(0,i._)(this,"actionsButton",void 0),(0,i._)(this,"contextMenu",void 0),(0,i._)(this,"titleElement",void 0),(0,i._)(this,"isRenaming",void 0),this.opts=n,this.actionsButton=null,this.contextMenu=null,this.titleElement=null,this.isRenaming=!1,this.conversation=t,this.isActive=s,this.contextMenu=new l.ContextMenu(this.j),this.updateContent()}}(0,n.__decorate)([(0,r.watch)("container:click")],c.prototype,"onClick",null),(0,n.__decorate)([r.autobind],c.prototype,"showActionsMenu",null),(0,n.__decorate)([r.autobind],c.prototype,"startInlineRename",null),(0,n.__decorate)([r.autobind],c.prototype,"onDelete",null),c=(0,n.__decorate)([r.component],c)},68365:function(e,t,s){"use strict";s.d(t,{UIConversationList:function(){return h}});var i=s(82749),n=s(31635),r=s(31356),a=s(80453),o=s(65478),l=s(80256),c=s(62405);class h extends c.UIGroup{className(){return"UIConversationList"}render(){return`<div class="&__container">
10
+ ${r}`.trim();s?await this.__executeQuickCommandSilent(l,r):await this.__executeQuickCommandWithPanel(l,i)}async __executeQuickCommandSilent(e,t){await this.__loadData(),this.j.progressbar.show().progress(100);try{let t=(0,u.createUserMessage)(e),s=(0,u.createNewConversation)(this.j,this.state.defaultModel,this.state.defaultTemperature,[t]),i=await this.apiClient.sendRequest(s.id,s.messages,null,[],s.options);if("final"===i.mode){let e=i.response.content;e&&this.j.s.insertHTML(e)}}catch(e){(0,f.isAbortError)(e)||this.j.e.fire("error",e)}finally{this.j.progressbar.hide()}}async __executeQuickCommandWithPanel(e,t){await this.__loadData();let s=this.stateManager.state.displayMode;this.stateManager.state.displayMode=t;let i=(0,u.getCurrentSelectionContext)(this.j);i&&this.stateManager.addSelectionContext(i),this.stateManager.isOpen()||await this.openAssistant(),await this.sendMessage(e),this.stateManager.state.displayMode=s}async sendMessage(e){await this.__loadData();let t=this.stateManager.getCurrentConversation(),s=this.stateManager.getEditingMessageId();if(s&&t){let e=t.messages.findIndex(e=>e.id===s);if(-1!==e){let s=t.messages.slice(0,e),i={...t,messages:s,updatedAt:Date.now()};this.stateManager.setCurrentConversation(i),await this.storage.save(i),this.stateManager.clearEditingMessage(),t=i}}t||(t=(0,u.createNewConversation)(this.j,this.state.defaultModel,this.state.defaultTemperature),this.stateManager.setCurrentConversation(t));let i=null;e.trim()&&(i=(0,u.createUserMessage)(e),t.title||(t={...t,title:e}),t={...t,updated:Date.now(),messages:[...t.messages,i]}),this.stateManager.setCurrentConversation({...t}),i&&this.j.e.fire("messageSent.ai-assistant-pro",i),this.stateManager.setLoading(!0),this.stateManager.clearError();try{await this.sendRequestToAI(0),this.stateManager.clearSelectionContexts()}catch(e){if((0,f.isAbortError)(e))return;this.stateManager.setError(e instanceof Error?e.message:e+"")}finally{this.stateManager.setLoading(!1)}}async sendRequestToAI(e=0){let t,s,i=this.j.o.aiAssistantPro.maxRecursionToolCallDepth;if(e>=i)throw Error(`Max recursion depth ${i} reached for tool calls`);let n=this.stateManager.getCurrentConversation();if(!n)return;let r=(0,u.findParentMessageId)(n),[a]=await Promise.all([this.apiClient.sendRequest(n.id,n.messages,r,this.stateManager.getSelectionContexts(),n.options),this.storage.save(n)]);if("stream"===a.mode){let e=await (0,u.processStreamingResponse)(this.stateManager,a,n);t=e.aiMessage,s=e.index,n=e.conversation}else{let e=(0,u.processFinalResponse)(a,n);t=e.aiMessage,s=e.index,n=e.conversation}n=await (0,u.processArtifacts)(this.j,t,n,s),this.j.e.fire("messageReceived.ai-assistant-pro",t),this.stateManager.setCurrentConversation({...n}),await this.storage.save(n),await this.handleToolCalls(t.id,e)}async deleteConversation(e){await this.__loadData(),await (0,u.deleteConversationWithCleanup)(this.j,e,this.storage,this.stateManager,this.permissionManager)}async renameConversation(e,t){let s=await this.storage.get(e);if(!s)return;let i={...s,title:t,updated:Date.now()};await this.storage.save(i),this.state.currentConversation?.id===e&&this.stateManager.setCurrentConversation(i);let n=await this.storage.list();this.stateManager.setConversations(n)}async searchConversations(e){await this.__loadData(),await (0,u.handleConversationSearch)(e,this.storage,this.stateManager)}async handleToolCalls(e,t=0){let s=this.stateManager.getCurrentConversation();if(!s)return;let i=s.messages.find(t=>t.id===e);if(!i)return;let n=i.toolCalls;if(!n||0===n.length)return;let r=n.filter(e=>!(0,u.isTerminalToolCallStatus)(e.status));if(0===r.length)return;let{approved:a,needsPermission:o}=this.permissionManager.filterToolCalls(r,s.permissions);for(let s of(this.stateManager.setPendingToolCalls(o),a))await this.executeToolCall(e,s,t)}async executeToolCall(e,t,s=0){let i=this.stateManager.getCurrentConversation();if(!i)return;let n=await (0,u.executeToolCall)(this.j,t,this.toolRegistry),r=i.messages.findIndex(t=>t.id===e);if(-1===r)return;let a=i.messages[r],o=i.messages.slice();o[r]=(0,u.updateToolCallInMessage)(a,n),i={...i,messages:o,updated:Date.now()},this.stateManager.setCurrentConversation(i),(0,u.areAllToolCallsExecuted)(i)&&await this.sendRequestToAI(s+1)}async copyMessage(e){let t=this.stateManager.getCurrentConversation();if(!t)return;let s=t.messages.find(t=>t.id===e);if(s)try{await navigator.clipboard.writeText(s.content),this.j.message.success("Message copied to clipboard")}catch(e){this.j.e.fire("error",Error("Failed to copy message"))}}async restartFromMessage(e){let t=this.stateManager.getCurrentConversation();if(!t)return;let s=t.messages.findIndex(t=>t.id===e);if(-1===s)return;let i=t.messages[s];if("user"!==i.role)return;await this.__loadData();let n=t.messages.slice(0,s),r={...t,messages:n,updatedAt:Date.now()};this.stateManager.setCurrentConversation(r),await this.storage.save(r),await this.sendMessage(i.content)}async editMessage(e){let t=this.stateManager.getCurrentConversation();if(!t)return;let s=t.messages.find(t=>t.id===e);s&&"user"===s.role&&(this.stateManager.setEditingMessageId(e),this.mainPanel.inputArea.setValue(s.content),this.mainPanel.inputArea.focus())}cancelEditMessage(){this.stateManager.isEditingMessage()&&(this.stateManager.clearEditingMessage(),this.mainPanel.inputArea.setValue(""))}async deleteMessage(e){await this.__loadData();let t=this.stateManager.getCurrentConversation();if(!t||-1===t.messages.findIndex(t=>t.id===e))return;let s=t.messages.filter(t=>t.id!==e),i={...t,messages:s,updatedAt:Date.now()};this.stateManager.setCurrentConversation(i),await this.storage.save(i)}beforeDestruct(){this.textAutocompleteSource&&(this.j.e.fire("unregisterAutocompleteSource",this.textAutocompleteSource),this.textAutocompleteSource=null),this.textAutocompleteCache.clear(),this.__closeFlightMode(),(0,g.cached)(this,"toolRegistry")?.destruct(),(0,g.cached)(this,"permissionManager")?.destruct(),(0,g.cached)(this,"apiClient")?.destruct(),(0,g.cached)(this,"stateManager")?.destruct(),(0,g.cached)(this,"mainPanel")?.destruct(),(0,g.cached)(this,"dialog")?.destruct(),(0,g.cached)(this,"storage")?.close?.()}constructor(...e){super(...e),(0,i._)(this,"buttons",[{name:"aiAssistantPro",group:"insert"},{name:"aiCommandsPro",group:"insert"}]),(0,i._)(this,"textAutocompleteSource",null),(0,i._)(this,"textAutocompleteCache",new Map),(0,i._)(this,"__initedPromise",null),(0,i._)(this,"__openedMode",null)}}(0,i._)(y,"requires",["license","autocomplete"]),(0,n.__decorate)([g.cache],y.prototype,"toolRegistry",null),(0,n.__decorate)([g.cache],y.prototype,"permissionManager",null),(0,n.__decorate)([g.cache],y.prototype,"apiClient",null),(0,n.__decorate)([g.cache],y.prototype,"storage",null),(0,n.__decorate)([g.cache],y.prototype,"stateManager",null),(0,n.__decorate)([g.cache],y.prototype,"mainPanel",null),(0,n.__decorate)([g.cache],y.prototype,"dialog",null),(0,n.__decorate)([(0,g.watch)("state.theme")],y.prototype,"__applyTheme",null),(0,n.__decorate)([(0,g.watch)(":openAIAssistantPro.ai-assistant-pro")],y.prototype,"openAssistant",null),(0,n.__decorate)([(0,g.watch)([":resize","state.panelWidth","state.panelHeight"])],y.prototype,"__onResizeInPanelView",null),(0,n.__decorate)([(0,g.watch)(["state.isOpen","state.displayMode","state.panelWidth","state.panelHeight","state.theme","state.defaultModel","state.defaultTemperature","state.currentConversation"]),(0,g.debounce)()],y.prototype,"__onSavedStateChange",null),(0,n.__decorate)([(0,g.watch)(":closeAIAssistantPro.ai-assistant-pro")],y.prototype,"closeAssistant",null),(0,n.__decorate)([(0,g.watch)(":addContextToAIAssistant.ai-assistant-pro")],y.prototype,"addCurrentSelectionToContext",null),(0,n.__decorate)([(0,g.watch)(":executeQuickCommand.ai-assistant-pro")],y.prototype,"executeQuickCommand",null),(0,n.__decorate)([(0,g.watch)(":sendMessage.ai-assistant-pro")],y.prototype,"sendMessage",null),(0,n.__decorate)([(0,g.watch)(":searchConversations.ai-assistant-pro")],y.prototype,"searchConversations",null),(0,n.__decorate)([(0,g.watch)(":copyMessage.ai-assistant-pro")],y.prototype,"copyMessage",null),(0,n.__decorate)([(0,g.watch)(":restartFromMessage.ai-assistant-pro")],y.prototype,"restartFromMessage",null),(0,n.__decorate)([(0,g.watch)(":editMessage.ai-assistant-pro")],y.prototype,"editMessage",null),(0,n.__decorate)([(0,g.watch)(":cancelEditMessage.ai-assistant-pro")],y.prototype,"cancelEditMessage",null),(0,n.__decorate)([(0,g.watch)(":deleteMessage.ai-assistant-pro")],y.prototype,"deleteMessage",null),y=(0,n.__decorate)([g.component],y),w.JoditPro.plugins.add("aiAssistantPro",y)},66645:function(e,t,s){"use strict";var i=s(47373),n=s(94668),r=s.n(n),a=s(86428),o=s.n(a),l=s(75966),c=s.n(l),h=s(83207),u=s.n(h),d=s(99293),p=s.n(d),g=s(99219),m=s.n(g),f=s(63674),v=s.n(f),w=s(4133),x=s.n(w),C=s(94454),y=s(53835),b=s(6441),k=s(12153),_=s(31974),S=s(72573);k.Icon.set("ai-assistant-pro",o()).set("ai-commands-pro",c()).set("ai-add-context",r()).set("send",m()).set("microphone",p()).set("tool-bolt",x()).set("chevron-right",u()).set("shield",v()),b.Config.prototype.aiAssistantPro={displayMode:"right",panelWidth:400,panelHeight:500,flightPanelHeight:250,dialogFullSize:!1,resizable:!0,apiMode:"incremental",apiRequest:null,maxRetries:3,requestTimeout:3e5,retryDelay:1e3,maxRecursionToolCallDepth:1e3,enabledTools:(0,y.getToolNames)(),customTools:[],toolPermissions:{},autoApproveTools:["readDocument","readBlocks","readSelection","insertHTML","addHTML"],alwaysDenyTools:[],defaultPermissionScope:"conversation",storage:"indexedDB",maxConversations:50,storageKey:"jodit-ai-assistant-pro",showConversationList:!0,enableMarkdown:!0,enableCodeHighlight:!0,maxMessageHeight:400,placeholderText:"Ask AI assistant...",sendShortcut:"Ctrl+Enter",showTimestamps:!0,formatTimestamp(e,t){let s=new Date(e),i=new Date().getTime()-s.getTime();return i<6e4?t("Just now"):i<36e5?t("%dm ago",Math.floor(i/6e4)):i<864e5?t("%dh ago",Math.floor(i/36e5)):s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})},formatMessageContent:(e,t)=>S.marked.parse(e,{breaks:!0,gfm:!0}),showAvatars:!0,showTypingIndicator:!0,includeSelectionByDefault:!0,maxContextRanges:5,showContextPreview:!0,sendOnEnter:!0,instructions:void 0,includeEditorMetadata:!1,autoOpen:!0,rememberLastConversation:!0,autoFocusInput:!0,voiceInputEnabled:!1,closeAfterInsert:!1,enableSoundNotifications:!1,debug:!1,textAutocompleteEnabled:!1,textAutocompleteApiRequest:null,textAutocompleteMinQueryLength:3,textAutocompleteMaxSuggestions:3,textAutocompleteDebounceMs:500,textAutocompleteCacheTTL:3e4,textAutocompleteCacheMaxSize:50,quickCommandsSilentMode:!1,quickCommandsDisplayMode:"flight",showCopyMessageAction:!0,showRestartMessageAction:!0,showEditMessageAction:!0,showDeleteMessageAction:!0,dialogSettings:{},allowEditDialogSettings:!1,allowEditDisplayMode:!0,allowEditPanelWidth:!0,initiallyOpened:!1,allowClose:!0,persistOpenState:!0,theme:"parent",allowEditTheme:!0,async uploadBase64Artifact(e,t){if("image"===e.type&&e.data&&"base64"===e.data.kind)try{let s=(0,i.base64ToFile)(e.data.base64,e.id,e.mimeType),n=await t.uploader.upload([s]);return{...e,data:{kind:"url",url:n.baseurl+n.files[0]},metadata:{...e.metadata,filename:n.files[0]}}}catch(e){t.e.fire("error",e)}return e},getAIProviderOptions:(e,t)=>(0,C.getAIProviderOptions)(e,t),registerAIProvider(e,t){(0,C.registerAIProvider)(e,t)}},b.Config.prototype.controls.aiAssistantPro={icon:"ai-assistant-pro",tooltip:"AI Assistant",hotkeys:["ctrl+shift+a","cmd+shift+a"],exec(e){e.e.fire("openAIAssistantPro.ai-assistant-pro")},isDisabled:e=>!e.o.aiAssistantPro.apiRequest,getLabel:e=>e.o.aiAssistantPro.apiRequest?"AI Assistant":"AI Assistant (not configured)"},b.Config.prototype.controls.aiAddContext={icon:"ai-add-context",tooltip:"Add to AI Context",exec(e){e.e.fire("addContextToAIAssistant")},isDisabled:e=>!e.o.aiAssistantPro.apiRequest||e.s.isCollapsed()},b.Config.prototype.controls.aiCommandsPro={icon:"ai-commands-pro",tooltip:"AI Commands",isDisabled:e=>!e.o.aiAssistantPro.apiRequest,list:_.aiAssitentCommands,exec(e,t,{control:s}){e.e.fire("executeQuickCommand.ai-assistant-pro",s.name)}};let A=b.Config.prototype.tuneBlock?.popup||{},I={};["p","h1","h2","h3","h4","h5","h6","div","section","article","pre","blockquote","ul","ol","li","table","tr","td","th","img","figure"].forEach(e=>{let t=A[e]||["tune.up","tune.remove","tune.down"];I[e]=[...t,"|","aiAddContext"]}),b.Config.prototype.tuneBlock&&(b.Config.prototype.tuneBlock.popup={...A,...I})},6689:function(e,t,s){"use strict";s.d(t,{throwIfAborted:function(){return n}});var i=s(93661);function n(e){if(e.aborted)throw(0,i.abort)()}},61872:function(e,t,s){"use strict";s.d(t,{processArtifacts:function(){return a},processFinalResponse:function(){return r},processStreamingResponse:function(){return n}});var i=s(61558);async function n(e,t,s){let n=(0,i.createAIMessage)(),r=-1;for await(let a of t.stream){switch(a.type){case"created":n={...n,id:a.response.responseId,content:""},r=s.messages.length;break;case"text-delta":n={...n,content:n.content+a.delta};break;case"completed":n={...n,id:a.response.responseId,toolCalls:a.response.toolCalls||[],artifacts:a.response.artifacts||[]};break;case"error":{let e=(0,i.createErrorMessage)(a.error);n={...n,id:e.id,content:e.content}}}if(n.id){let t=s.messages.slice();t[r>=0?r:s.messages.length]=n,s={...s,messages:t,updated:Date.now()},e.setCurrentConversation(s)}}return{aiMessage:n,index:r,conversation:s}}function r(e,t){let s={...(0,i.createAIMessage)(),id:e.response.responseId,content:e.response.content,toolCalls:e.response.toolCalls||[],artifacts:e.response.artifacts||[]},n=t.messages.slice();return n.push(s),{aiMessage:s,index:(t={...t,messages:n,updated:Date.now()}).messages.length-1,conversation:t}}async function a(e,t,s,n){if(t.artifacts&&t.artifacts.length>0){let r=s.messages.slice();return r[n]={...r[n],artifacts:await (0,i.uploadArtifacts)(e,t.artifacts)},{...s,messages:r,updated:Date.now()}}return s}},49459:function(e,t,s){"use strict";function i(e,t,s={}){let n=e[t];if("string"!=typeof n||!s.allowEmpty&&""===n)throw Error(`Parameter "${t}" is required and must be a${s.allowEmpty?"":" non-empty"} string`);return n}s.d(t,{requireString:function(){return i}})},44526:function(e,t,s){"use strict";s.d(t,{resolveBlock:function(){return n}});var i=s(22732);function n(e,{selector:t,index:s,requireExactlyOne:r=!1}={}){let a=null!=t&&""!==t.trim(),o=null!=s;if(r&&a===o)throw Error("Either index or selector must be provided, but not both");if(!a&&!o)throw Error("Block identifier is required");if(a){if("string"!=typeof t)throw Error("Selector must be a string");let s=e.editor.querySelector(t);if(!s)throw Error(`No element found matching selector "${t}"`);if(!i.Dom.isElement(s))throw Error(`Selector "${t}" does not point to an element node`);return{element:s,identifier:`with selector "${t}"`}}if("number"!=typeof s)throw Error("Block index must be a number");let l=Array.from(e.editor.children);if(s<0||s>=l.length)throw Error(`Block index ${s} is out of range. Document has ${l.length} blocks`);let c=l[s];if(!i.Dom.isElement(c))throw Error(`Block at index ${s} is not a valid element`);return{element:c,identifier:"at index "+s}}},70308:function(e,t,s){"use strict";s.d(t,{areAllToolCallsExecuted:function(){return l},createNewConversation:function(){return n},findMessagesWithPendingToolCalls:function(){return c},findParentMessageId:function(){return r},isTerminalToolCallStatus:function(){return o}});var i=s(21064);function n(e,t,s,r=[]){let a=e.o.aiAssistantPro,o={id:(0,i.generateConversationId)(),created:Date.now(),updated:Date.now(),messages:r,permissions:[],options:{model:t??a.defaultModel,temperature:s??a.defaultTemperature}};return e.e.fire("conversationCreated.ai-assistant-pro",o),o}function r(e){for(let t=e.messages.length-1;t>=0;t--){let s=e.messages[t];if("assistant"===s.role&&!s.id.startsWith("error_"))return s.id}return null}let a=new Set(["executed","denied","error"]);function o(e){return a.has(e)}function l(e){let t=e.messages[e.messages.length-1];return!!t?.toolCalls&&t.toolCalls.every(e=>o(e.status))}function c(e){return e.messages.filter(e=>e.toolCalls&&e.toolCalls.length>0&&e.toolCalls.some(e=>!o(e.status)))}},473:function(e,t,s){"use strict";s.d(t,{handleBackToList:function(){return l},handleConversationSearch:function(){return c},handleConversationSelect:function(){return o},handleToolApproval:function(){return r},handleToolDenial:function(){return a}});var i=s(79078),n=s(82758);async function r(e,t,s,i,n){let r=s.getPendingToolCalls().find(t=>t.id===e);if(!r)return null;let a=i.grantPermission(r.name,t),o=s.getCurrentConversation();return o&&(o.permissions.push(a),await n.save(o)),s.removePendingToolCall(e),{...r,status:"approved"}}async function a(e,t,s,n){let r=s.getPendingToolCalls().find(e=>e.id===t);if(!r)return;let a=s.getCurrentConversation();if(!a)return;let o=a.messages.findIndex(e=>e.toolCalls?.find(e=>e.id===t));if(-1===o)return;let l=a.messages[o],c={...r,result:{error:"Tool call denied by user."},status:"denied"},h=(0,i.updateToolCallInMessage)(l,c),u=[...a.messages];u[o]=h,a={...a,messages:u,updated:Date.now()},s.setCurrentConversation(a),await n.save(a),e.e.fire("toolCallDenied.ai-assistant-pro",r),s.removePendingToolCall(t)}async function o(e,t,s){try{s.setLoading(!0);let i=await t.get(e);if(!i)throw Error("Conversation not found: "+e);s.setCurrentConversation({...i})}catch(e){n.IS_PROD}finally{s.setLoading(!1)}}async function l(e,t){t.setView("conversationList");try{t.setLoading(!0);let s=await e.list().catch(()=>[]);t.setConversations(s)}finally{t.setLoading(!1)}}async function c(e,t,s){s.setLoading(!0);try{let i=await t.list(e||void 0);s.setConversations(i),s.setView("conversationList")}finally{s.setLoading(!1)}}},58579:function(e,t,s){"use strict";s.d(t,{applyTheme:function(){return h.applyTheme},areAllToolCallsExecuted:function(){return n.areAllToolCallsExecuted},createNewConversation:function(){return n.createNewConversation},createUserMessage:function(){return a.createUserMessage},deleteConversationWithCleanup:function(){return c.deleteConversationWithCleanup},executeToolCall:function(){return u.executeToolCall},findMessagesWithPendingToolCalls:function(){return n.findMessagesWithPendingToolCalls},findParentMessageId:function(){return n.findParentMessageId},getCurrentSelectionContext:function(){return l.getCurrentSelectionContext},handleBackToList:function(){return r.handleBackToList},handleConversationSearch:function(){return r.handleConversationSearch},handleConversationSelect:function(){return r.handleConversationSelect},handleToolApproval:function(){return r.handleToolApproval},handleToolDenial:function(){return r.handleToolDenial},invertMode:function(){return o.invertMode},isTerminalToolCallStatus:function(){return n.isTerminalToolCallStatus},loadInitialData:function(){return c.loadInitialData},processArtifacts:function(){return i.processArtifacts},processFinalResponse:function(){return i.processFinalResponse},processStreamingResponse:function(){return i.processStreamingResponse},resizeInPanelView:function(){return o.resizeInPanelView},updateToolCallInMessage:function(){return u.updateToolCallInMessage}});var i=s(61872),n=s(70308),r=s(473),a=s(61558),o=s(71050),l=s(15927),c=s(56110),h=s(53014),u=s(79078)},61558:function(e,t,s){"use strict";s.d(t,{createAIMessage:function(){return r},createErrorMessage:function(){return a},createUserMessage:function(){return n},uploadArtifacts:function(){return o}});var i=s(21064);function n(e){return{id:(0,i.generateMessageId)(),role:"user",content:e,timestamp:Date.now()}}function r(){return{id:"",role:"assistant",content:"",artifacts:[],timestamp:Date.now(),toolCalls:[]}}function a(e){return{id:"error_"+(0,i.generateMessageId)(),role:"assistant",content:"❌ Error: "+e.message,timestamp:Date.now(),toolCalls:[],artifacts:[]}}async function o(e,t){if(!t||0===t.length)return t;let s=e.o.aiAssistantPro.uploadBase64Artifact;return s?Promise.all(t.map(async t=>s(t,e)??t)):t}},71050:function(e,t,s){"use strict";s.d(t,{invertMode:function(){return n},resizeInPanelView:function(){return r}});var i=s(41180);function n(e){switch(e){case"left":return"right";case"right":return"left";case"top":return"bottom";case"bottom":return"top"}}function r(e,t,s,r){if("dialog"===t||"flight"===t)return;("left"===t||"right"===t)&&(e.currentPlace.slots[n(t)]?.style.setProperty(`--jd-slot-${n(t)}-width`,"auto"),e.currentPlace.slots[t]?.style.setProperty(`--jd-slot-${t}-width`,`${s}px`));let a=(0,i.css)(e.currentPlace.workplace,"height")??0;e.currentPlace.slots[t]?.style.setProperty("min-height",`${Math.min(a,r)}px`)}},15927:function(e,t,s){"use strict";function i(e){if(e.s.isCollapsed())return null;let t=e.s.html,s=e.s.range;return{html:t,rangeInfo:{startContainer:s.startContainer.nodeName,startOffset:s.startOffset,endContainer:s.endContainer.nodeName,endOffset:s.endOffset}}}s.d(t,{getCurrentSelectionContext:function(){return i}})},56110:function(e,t,s){"use strict";s.d(t,{deleteConversationWithCleanup:function(){return n},loadInitialData:function(){return r}});var i=s(82758);async function n(e,t,s,i,n){try{i.setLoading(!0),await s.delete(t),i.removeConversation(t),n.clearConversationPermissions(t);let r=i.getCurrentConversation();r?.id===t&&i.setCurrentConversation(null);let a=await s.list();i.setConversations(a),i.setView(0===a.length?"welcome":"conversationList"),e.e.fire("conversationDeleted.ai-assistant-pro",t)}catch(t){e.alert(e.i18n("Failed to delete conversation")+": "+(t?.message||"Unknown error"))}finally{i.setLoading(!1)}}async function r(e,t,s){s.setLoading(!0);try{let[i,n]=await Promise.all([t.list().catch(()=>[]),t.getGlobalSettings().catch(()=>null)]);if(s.setConversations(i),n&&s.setSavedState(n),0===i.length)s.setView("welcome");else if(e.o.aiAssistantPro.rememberLastConversation&&n?.currentConversationId){let e=i.find(e=>e.id===n.currentConversationId)??i[0],r=await t.get(e.id);r?s.setCurrentConversation(r):s.setView("conversationList")}else s.setView("conversationList")}catch(e){i.IS_PROD,s.setView("welcome")}finally{s.setLoading(!1)}}},53014:function(e,t,s){"use strict";s.d(t,{applyTheme:function(){return r}});let i=["jodit_theme_dark","jodit-ai-assistant-pro_theme_dark","jodit-dialog_theme_dark"],n=["jodit_theme_light","jodit-ai-assistant-pro_theme_light","jodit-dialog_theme_light"];function r(e,t,s,r,a){let o;if(r?.classList.remove(...i),r?.classList.remove(...n),"dialog"===s){let e=a?.container;e?.classList.remove(...i),e?.classList.remove(...n)}if(o="dark"===t?i:n,r?.classList.add(...o),"dialog"===s){let e=a?.container;e?.classList.add(...o)}}},79078:function(e,t,s){"use strict";async function i(e,t,s){let i;try{let e=new AbortController().signal,n=await s.executeTool(t.name,t.arguments,e);i={...t,result:{result:n},status:"executed"}}catch(s){i={...t,result:{error:s instanceof Error?s.message:s+""},status:"error"},e.e.fire("toolCallFailed.ai-assistant-pro",i)}return e.e.fire("toolCallExecuted.ai-assistant-pro",i,{toolCallId:i.id,result:i.result}),i}function n(e,t){let s=e.toolCalls?.findIndex(e=>e.id===t.id);if(null==s||-1===s)return e;let i=[...e?.toolCalls??[]];return i[s]=t,{...e,toolCalls:i}}s.d(t,{executeToolCall:function(){return i},updateToolCallInMessage:function(){return n}})},86449:function(e,t,s){"use strict";s.d(t,{APIClient:function(){return a}});var i=s(82749),n=s(82758),r=s(21537);class a{async sendRequest(e,t,s,i,a){let{apiRequest:o,requestTimeout:l,maxRetries:c}=this.jodit.o.aiAssistantPro;if(!o)throw Error("AI Assistant Pro callback is not configured");let h=new AbortController;this.abortControllers.add(h);try{let u=this.buildRequestContext(e,t,s,i,a),d=null;for(let e=0;c>=e;e++)try{if(h.signal.aborted)throw(0,r.abort)();let e=setTimeout(()=>{h.abort()},l);try{let t=await o(u,h.signal);return clearTimeout(e),this.validateResponse(t),t}catch(t){throw clearTimeout(e),t}}catch(t){if(d=t,n.IS_PROD,c>e){let t=this.calculateRetryDelay(e);await this.sleep(t)}else throw t}throw d||Error("API request failed after all retries")}finally{this.abortControllers.delete(h)}}abort(){this.abortControllers.forEach(e=>{e.abort()}),this.abortControllers.clear()}isInProgress(){return this.abortControllers.size>0}buildRequestContext(e,t,s,i,n){let r,{apiMode:a,instructions:o}=this.jodit.o.aiAssistantPro,l={mode:a,conversationId:e,tools:this.toolRegistry.getAllTools(),selectionContexts:i,conversationOptions:n,instructions:o};if("full"===a)r=t;else if(s){let e=t.findIndex(e=>e.id===s);r=-1!==e?t.slice(e+1):t,l={...l,parentMessageId:s}}else r=t;return{...l,messages:this.expandToolMessages(r,t.find(e=>e.id===s))}}expandToolMessages(e,t){let s=[];for(let t of e)s.push(t),this.expandToolResultsMessage(t,s);return t&&this.expandToolResultsMessage(t,s),s}expandToolResultsMessage(e,t){if(e.toolCalls&&e.toolCalls.length>0)for(let s of e.toolCalls){let i=s.result??{error:"result not found"};if(t.find(e=>e.id===`${s.id}-result`))continue;let n={id:`${s.id}-result`,role:"tool",content:i.error?"Error: "+i.error:JSON.stringify(i.result),timestamp:e.timestamp,toolResults:[{toolCallId:s.id,result:i}]};t.push(n)}}validateResponse(e){if("final"!==e.mode)return;let t=e.response;if(!t)throw Error("API returned empty response");if(!t.responseId)throw Error("API response missing responseId");if(void 0===t.content)throw Error("API response missing content");if(void 0===t.finished)throw Error("API response missing finished flag");if(t.toolCalls){if(!Array.isArray(t.toolCalls))throw Error("API response toolCalls must be an array");t.toolCalls.forEach((e,t)=>{if(!e.id)throw Error(`Tool call at index ${t} is missing id`);if(!e.name)throw Error(`Tool call at index ${t} is missing name`);if(!e.arguments||"object"!=typeof e.arguments)throw Error(`Tool call at index ${t} has invalid arguments`)})}}calculateRetryDelay(e){let{retryDelay:t}=this.jodit.o.aiAssistantPro;return t*Math.pow(2,e)+Math.random()*t}sleep(e){return new Promise(t=>setTimeout(t,e))}destruct(){this.abort()}constructor(e,t){(0,i._)(this,"jodit",void 0),(0,i._)(this,"toolRegistry",void 0),(0,i._)(this,"abortControllers",void 0),this.jodit=e,this.toolRegistry=t,this.abortControllers=new Set}}},47373:function(e,t,s){"use strict";function i(e,t,s="image/png"){let n=atob(e),r=n.length,a=new Uint8Array(r);for(let e=0;r>e;e++)a[e]=n.charCodeAt(e);return new File([new Blob([a],{type:s})],t,{type:s})}s.d(t,{base64ToFile:function(){return i}})},21020:function(e,t,s){"use strict";s.d(t,{PermissionManager:function(){return n}});var i=s(82749);class n{requiresPermission(e){let{autoApproveTools:t,alwaysDenyTools:s}=this.jodit.o.aiAssistantPro;if(s.includes(e))return!0;if(t.includes(e))return!1;let i=this.toolRegistry.getTool(e);return!i||i.requiresPermission}isAutoDenied(e){let{alwaysDenyTools:t}=this.jodit.o.aiAssistantPro;return t.includes(e)}isAutoApproved(e){let{autoApproveTools:t}=this.jodit.o.aiAssistantPro;return t.includes(e)}checkPermission(e,t){if(this.isAutoApproved(e))return{toolName:e,granted:!0,grantedAt:Date.now(),scope:"once"};if(this.isAutoDenied(e))return null;let s=this.permanentPermissions.get(e);return s&&s.granted?s:t.find(t=>t.toolName===e&&t.granted)||null}grantPermission(e,t){let s={toolName:e,granted:!0,grantedAt:Date.now(),scope:t};return"forever"===t&&(this.permanentPermissions.set(e,s),this.savePermanentPermissions()),s}denyPermission(e){return{toolName:e,granted:!1,grantedAt:Date.now(),scope:"once"}}filterToolCalls(e,t){let s=[],i=[],n=[];for(let r of e){if(this.isAutoDenied(r.name)){n.push({...r,status:"denied"});continue}if(this.isAutoApproved(r.name)){s.push({...r,status:"approved"});continue}let e=this.checkPermission(r.name,t);e&&e.granted?s.push({...r,status:"approved"}):this.requiresPermission(r.name)?(this.jodit.e.fire("permissionRequested.ai-assistant-pro",r.name),i.push({...r,status:"pending"})):s.push({...r,status:"approved"})}return{approved:s,needsPermission:i,denied:n}}clearConversationPermissions(e){}loadPermanentPermissions(){try{let e=localStorage.getItem(this.PERMANENT_PERMISSIONS_KEY);e&&JSON.parse(e).forEach(e=>{"forever"===e.scope&&e.granted&&this.permanentPermissions.set(e.toolName,e)})}catch(e){}}savePermanentPermissions(){try{let e=Array.from(this.permanentPermissions.values());localStorage.setItem(this.PERMANENT_PERMISSIONS_KEY,JSON.stringify(e))}catch(e){}}clearPermanentPermissions(){this.permanentPermissions.clear(),localStorage.removeItem(this.PERMANENT_PERMISSIONS_KEY)}getPermanentPermissions(){return Array.from(this.permanentPermissions.values())}revokePermanentPermission(e){this.permanentPermissions.delete(e),this.savePermanentPermissions()}destruct(){this.permanentPermissions.clear()}constructor(e,t){(0,i._)(this,"jodit",void 0),(0,i._)(this,"toolRegistry",void 0),(0,i._)(this,"permanentPermissions",void 0),(0,i._)(this,"PERMANENT_PERMISSIONS_KEY",void 0),this.jodit=e,this.toolRegistry=t,this.permanentPermissions=new Map,this.PERMANENT_PERMISSIONS_KEY="jodit-permissions.ai-assistant-pro",this.loadPermanentPermissions()}}},46166:function(e,t,s){"use strict";s.d(t,{StateManager:function(){return n}});var i=s(82749);class n{createInitialState(){return{isOpen:!1,currentView:"welcome",currentConversation:null,conversations:[],isLoading:!1,error:null,pendingToolCalls:[],selectionContexts:[],abortController:null,editingMessageId:null,theme:this.jodit.o.aiAssistantPro.theme||"parent",displayMode:this.jodit.o.aiAssistantPro.displayMode,panelWidth:this.jodit.o.aiAssistantPro.panelWidth,panelHeight:this.jodit.o.aiAssistantPro.panelHeight,defaultModel:this.jodit.o.aiAssistantPro.defaultModel,defaultTemperature:this.jodit.o.aiAssistantPro.defaultTemperature}}open(){this.state.isOpen=!0,this.jodit.e.fire("open.ai-assistant-pro",this.state.currentConversation)}close(){this.state.isOpen=!1,this.jodit.e.fire("close.ai-assistant-pro")}isOpen(){return this.state.isOpen}setView(e){this.state.currentView=e,this.jodit.e.fire("viewChanged.ai-assistant-pro",e)}getView(){return this.state.currentView}setConversations(e){this.state.conversations=e}setSavedState(e){e.theme&&(this.state.theme=e.theme),e.displayMode&&(this.state.displayMode=e.displayMode),e.panelWidth&&(this.state.panelWidth=e.panelWidth),e.panelHeight&&(this.state.panelHeight=e.panelHeight),e.defaultModel&&(this.state.defaultModel=e.defaultModel),e.defaultTemperature&&(this.state.defaultTemperature=e.defaultTemperature)}getConversations(){return this.state.conversations}setCurrentConversation(e){if(this.state.currentConversation===e)throw Error("Conversation is already current");this.state.currentConversation=e||null,e&&(this.setView("conversation"),this.jodit.e.fire("conversationSwitched.ai-assistant-pro",e))}getCurrentConversation(){return this.state.currentConversation}removeConversation(e){let t=this.state.conversations.filter(t=>t.id!==e);this.setConversations(t)}setLoading(e){this.state.isLoading=e}isLoading(){return this.state.isLoading}setError(e){this.state.error=e,e&&this.jodit.e.fire("error.ai-assistant-pro",Error(e))}getError(){return this.state.error}clearError(){this.setError(null)}setPendingToolCalls(e){this.state.pendingToolCalls=e}getPendingToolCalls(){return this.state.pendingToolCalls}addPendingToolCall(e){let t=[...this.state.pendingToolCalls,e];this.setPendingToolCalls(t)}removePendingToolCall(e){let t=this.state.pendingToolCalls.filter(t=>t.id!==e);this.setPendingToolCalls(t)}updateToolCallStatus(e,t){let s=this.state.pendingToolCalls.map(s=>s.id===e?{...s,status:t}:s);this.setPendingToolCalls(s)}setSelectionContexts(e){this.state.selectionContexts=e}getSelectionContexts(){return this.state.selectionContexts}addSelectionContext(e){let{maxContextRanges:t}=this.jodit.o.aiAssistantPro,s=[...this.state.selectionContexts,e];s.length>t&&(s=s.slice(-t)),this.setSelectionContexts(s),this.jodit.e.fire("contextAdded.ai-assistant-pro",e)}removeSelectionContext(e){let t=this.state.selectionContexts.filter((t,s)=>s!==e);this.setSelectionContexts(t),this.jodit.e.fire("contextRemoved.ai-assistant-pro",e)}clearSelectionContexts(){this.setSelectionContexts([])}setAbortController(e){this.state.abortController=e}getAbortController(){return this.state.abortController}setEditingMessageId(e){this.state.editingMessageId=e}getEditingMessageId(){return this.state.editingMessageId}isEditingMessage(){return null!=this.state.editingMessageId}clearEditingMessage(){this.setEditingMessageId(null)}reset(){this.state=this.createInitialState()}destruct(){this.state.abortController&&this.state.abortController.abort(),this.reset()}constructor(e){(0,i._)(this,"jodit",void 0),(0,i._)(this,"state",void 0),this.jodit=e,this.state=this.createInitialState()}}},62895:function(e,t,s){"use strict";s.d(t,{WebStorageConversationStorage:function(){return i.WebStorageConversationStorage},createStorageProvider:function(){return i.createStorageProvider}});var i=s(21064)},21064:function(e,t,s){"use strict";s.d(t,{WebStorageConversationStorage:function(){return r},createStorageProvider:function(){return a},generateConversationId:function(){return o},generateMessageId:function(){return l}});var i=s(82749),n=s(97333);class r{close(){return this.storage.close()}getConversationKey(e){return"conv:"+e}async getAllKeys(){let e=await this.storage.get("__conversation_index__");return e&&Array.isArray(e)?e:[]}async updateIndex(e){await this.storage.set("__conversation_index__",e)}async addToIndex(e){let t=await this.getAllKeys();t.includes(e)||(t.push(e),await this.updateIndex(t))}async removeFromIndex(e){let t=(await this.getAllKeys()).filter(t=>t!==e);await this.updateIndex(t)}async list(e){try{let t=await this.getAllKeys(),s=[],i=e?.toLowerCase().trim();for(let e of t){let t=await this.get(e);if(t){if(i){let e=t.title?.toLowerCase().includes(i),s=!e&&t.messages.some(e=>e.content.toLowerCase().includes(i));if(!e&&!s)continue}s.push({id:t.id,title:t.title??"",created:t.created,updated:t.updated,messageCount:t.messages.length})}}return s.sort((e,t)=>t.updated-e.updated),s}catch(e){return[]}}async get(e){try{let t=this.getConversationKey(e);return await this.storage.get(t)||null}catch(e){return null}}async save(e){try{if(0===e.messages.length)throw Error("Conversation must have at least one message.");let t=await this.getAllKeys();t.length>=this.maxConversations&&!t.includes(e.id)&&await this.evictOldest();let s=this.getConversationKey(e.id);await this.storage.set(s,e),await this.addToIndex(e.id)}catch(t){if(t?.name==="QuotaExceededError"||t?.code===22||t?.code===1014){await this.evictOldest();try{let t=this.getConversationKey(e.id);await this.storage.set(t,e),await this.addToIndex(e.id)}catch{throw Error("Storage quota exceeded. Please delete some conversations.")}}else throw Error("Failed to save conversation: "+(t?.message||"Unknown error"))}}async delete(e){try{let t=this.getConversationKey(e);await this.storage.delete(t),await this.removeFromIndex(e)}catch(e){}}async clear(){try{for(let e of(await this.getAllKeys())){let t=this.getConversationKey(e);await this.storage.delete(t)}await this.updateIndex([])}catch(e){}}async evictOldest(){try{let e=await this.list();if(0===e.length)return;e.sort((e,t)=>e.updated-t.updated);let t=e[0];await this.delete(t.id)}catch(e){}}async getGlobalSettings(){try{return await this.storage.get("global-settings")||null}catch(e){return null}}async saveGlobalSettings(e){try{let t={...await this.getGlobalSettings(),...e};await this.storage.set("global-settings",t)}catch{throw Error("Failed to save global settings")}}constructor(e,t){(0,i._)(this,"storage",void 0),(0,i._)(this,"maxConversations",void 0),this.storage=e,this.maxConversations=t}}function a(e,t){return n.AsyncStorage.makeStorage(e,t)}function o(){return`conv_${Date.now()}_${Math.random().toString(36).substring(2,11)}`}function l(){return`msg_${Date.now()}_${Math.random().toString(36).substring(2,11)}`}},55487:function(e,t,s){"use strict";s.d(t,{ToolRegistry:function(){return r}});var i=s(82749),n=s(53835);class r{registerBuiltInTools(e){e.forEach(e=>{let t=n.BUILT_IN_TOOLS[e];t&&this.tools.set(e,t)})}registerCustomTools(e){e.forEach(e=>{this.validateToolDefinition(e),this.tools.set(e.name,e)})}validateToolDefinition(e){if(!e.name||"string"!=typeof e.name)throw Error("Tool must have a valid name");if(!e.description||"string"!=typeof e.description)throw Error(`Tool "${e.name}" must have a description`);if(!Array.isArray(e.parameters))throw Error(`Tool "${e.name}" must have a parameters array`);if("function"!=typeof e.execute)throw Error(`Tool "${e.name}" must have an execute function`);e.parameters.forEach(t=>{if(!t.name||"string"!=typeof t.name)throw Error(`Tool "${e.name}" has a parameter without a valid name`);if(!t.type)throw Error(`Tool "${e.name}" parameter "${t.name}" must have a type`);if("boolean"!=typeof t.required)throw Error(`Tool "${e.name}" parameter "${t.name}" must specify if it's required`)})}getAllTools(){return Array.from(this.tools.values())}getTool(e){return this.tools.get(e)}hasTool(e){return this.tools.has(e)}getToolNames(){return Array.from(this.tools.keys())}async executeTool(e,t,s){let i=this.getTool(e);if(!i)throw Error(`Tool "${e}" not found`);let n=this.applyDefaults(i,t);this.validateArguments(i,n);try{return await i.execute(this.jodit,n,s)}catch(e){if(e?.name==="AbortError"||s.aborted)throw Error("Tool execution was aborted");throw e}}validateArguments(e,t){let s=Object.keys(t);for(let t of e.parameters.filter(e=>e.required).map(e=>e.name))if(!s.includes(t))throw Error(`Tool "${e.name}" requires parameter "${t}"`);for(let[s,i]of Object.entries(t)){let t=e.parameters.find(e=>e.name===s);if(!t){this.jodit.o.aiAssistantPro.debug;continue}let n=Array.isArray(i)?"array":"object"==typeof i&&null!=i?"object":typeof i;if(t.type!==n&&!("number"===t.type&&"string"===n&&!isNaN(Number(i))))throw Error(`Tool "${e.name}" parameter "${s}" expects type "${t.type}" but got "${n}"`);if(t.enum&&t.enum.length>0&&!t.enum.includes(i))throw Error(`Tool "${e.name}" parameter "${s}" must be one of: ${t.enum.join(", ")}`)}}applyDefaults(e,t){let s={...t};for(let t of e.parameters)void 0===s[t.name]&&void 0!==t.default&&(s[t.name]=t.default);return s}destruct(){this.tools.clear()}constructor(e){(0,i._)(this,"jodit",void 0),(0,i._)(this,"tools",void 0),this.jodit=e,this.tools=new Map,this.registerBuiltInTools(e.o.aiAssistantPro.enabledTools||[]),this.registerCustomTools(e.o.aiAssistantPro.customTools||[])}}},26612:function(e){e.exports={"AI Assistant":"AI Assistant","AI Assistant Pro":"AI Assistant Pro","Welcome to AI Assistant":"Welcome to AI Assistant","Start your first conversation":"Start your first conversation","Tip: Select text in editor to add context":"Tip: Select text in editor to add context","New Chat":"New Chat","Search conversations...":"Search conversations...","No conversations yet":"No conversations yet","Ask me anything...":"Ask me anything...","Ask a follow-up...":"Ask a follow-up...","Reply...":"Reply...","Type your message...":"Type your message...",Send:"Send",Cancel:"Cancel",Retry:"Retry",Insert:"Insert",Copy:"Copy",Edit:"Edit",Delete:"Delete",New:"New",Back:"Back","Permission Required":"Permission Required",Approve:"Approve",Deny:"Deny",Once:"Once","This conversation":"This conversation",Always:"Always","The AI wants to execute:":"The AI wants to execute:","This will modify your document content.":"This will modify your document content.","Executing...":"Executing...","Completed successfully":"Completed successfully",Failed:"Failed","Pending approval":"Pending approval","Denied by user":"Denied by user","Tool Result":"Tool Result","Tool Execution Error":"Tool Execution Error",Context:"Context",Contexts:"Contexts","Add to AI Context":"Add to AI Context",Remove:"Remove","Clear all":"Clear all","An error occurred":"An error occurred","Request failed":"Request failed","Connection error":"Connection error","AI Assistant is not configured":"AI Assistant is not configured","Thinking...":"Thinking...","Generating response...":"Generating response...",insertHTML:"Insert HTML",readDocument:"Read Document",readBlock:"Read Block",replaceInDocument:"Replace in Document",replaceInBlock:"Replace in Block",getSelection:"Get Selection","Just now":"Just now",Conversation:"Conversation","New Conversation":"New Conversation",Yesterday:"Yesterday","Delete conversation":"Delete conversation","Are you sure you want to delete this conversation?":"Are you sure you want to delete this conversation?","Failed to delete conversation":"Failed to delete conversation"}},63805:function(e,t,s){"use strict";s.r(t),s.d(t,{en:function(){return n.a},ru:function(){return a.a}});var i=s(26612),n=s.n(i),r=s(55790),a=s.n(r)},55790:function(e){e.exports={"AI Assistant":"AI Ассистент","AI Assistant Pro":"AI Ассистент Pro","Welcome to AI Assistant":"Добро пожаловать в AI Ассистент","Start your first conversation":"Начните первый диалог","Tip: Select text in editor to add context":"Подсказка: Выделите текст в редакторе для добавления контекста","New chat":"Новый чат","Search conversations...":"Поиск диалогов...","No conversations yet":"Пока нет диалогов","Ask me anything...":"Спросите меня о чем угодно...","Ask a follow-up...":"Задайте дополнительный вопрос...","Reply...":"Ответить...","Type your message...":"Введите ваше сообщение...",Send:"Отправить",Cancel:"Отмена",Retry:"Повторить",Insert:"Вставить",Copy:"Копировать",Edit:"Редактировать",Delete:"Удалить",New:"Новый",Back:"Назад","Permission Required":"Требуется разрешение",Approve:"Разрешить",Deny:"Отклонить",Once:"Один раз","This conversation":"Этот диалог",Always:"Всегда","The AI wants to execute:":"AI хочет выполнить:","This will modify your document content.":"Это изменит содержимое вашего документа.","Executing...":"Выполняется...","Completed successfully":"Успешно выполнено",Failed:"Ошибка","Pending approval":"Ожидает разрешения","Denied by user":"Отклонено пользователем","Tool Result":"Результат инструмента","Tool Execution Error":"Ошибка выполнения инструмента",Context:"Контекст",Contexts:"Контексты","Add to AI Context":"Добавить в контекст AI",Remove:"Удалить","Clear all":"Очистить все","An error occurred":"Произошла ошибка","Request failed":"Запрос не выполнен","Connection error":"Ошибка соединения","AI Assistant is not configured":"AI Ассистент не настроен","Thinking...":"Думаю...","Generating response...":"Генерирую ответ...",insertHTML:"Вставить HTML",readDocument:"Прочитать документ",readBlock:"Прочитать блок",replaceInDocument:"Заменить в документе",replaceInBlock:"Заменить в блоке",getSelection:"Получить выделение","Just now":"Только что",Conversation:"Диалог","New Conversation":"Новый диалог",Yesterday:"Вчера","Delete conversation":"Удалить диалог","Are you sure you want to delete this conversation?":"Вы уверены, что хотите удалить этот диалог?","Failed to delete conversation":"Не удалось удалить диалог",Settings:"Настройки","General Settings":"Общие настройки","Conversation Settings":"Настройки диалога","Display Mode":"Режим отображения","Panel Width":"Ширина панели",Theme:"Тема",Model:"Модель",Temperature:"Температура",Close:"Закрыть",Dialog:"Модальное окно",Left:"Левая панель",Right:"Правая панель",Top:"Верхняя панель",Bottom:"Нижняя панель",Inherit:"Наследовать от редактора",Light:"Светлая тема",Dark:"Тёмная тема","%dm ago":"%dм назад","%dh ago":"%dч назад"}},94454:function(e,t,s){"use strict";s.d(t,{getAIProviderOptions:function(){return i.getAIProviderOptions},registerAIProvider:function(){return i.registerAIProvider}}),s(82923);var i=s(58211)},82923:function(e,t,s){"use strict";var i=s(58211),n=s(54079);(0,i.registerAIProvider)("jodit-ai-adapter",e=>{let t=e.url.replace(/\/+$/,""),s=e.provider??"openai",i=!1!==e.stream;return{apiMode:"incremental",maxRetries:0,voiceInputEnabled:!0,voiceInputUrl:`${t.replace(/^http/,"ws")}/v1/ai/transcribe`,voiceInputApiKey:e.apiKey,textAutocompleteEnabled:!0,async textAutocompleteApiRequest(i,r,a){let o=new n.Ajax({url:`${t}/ai/autocomplete?query=${encodeURIComponent(i)}&key=${encodeURIComponent(e.apiKey)}`,method:"POST",contentType:"application/json",data:{provider:s,context:{maxSuggestions:r}}});a.addEventListener("abort",()=>o.abort(),{once:!0});let l=await o.send(),c=await l.json();return c.success&&c.result?.suggestions?c.result.suggestions:[]},async apiRequest(r,a){let o=new n.Ajax({url:`${t}/ai/request?key=${encodeURIComponent(e.apiKey)}`,method:"POST",contentType:"application/json",data:{provider:s,context:i?{...r,metadata:{...r.metadata,stream:!0}}:r}});if(a&&a.addEventListener("abort",()=>o.abort(),{once:!0}),!i){let e=await o.send();return{mode:"final",response:(await e.json()).result}}let l=o.stream();return{mode:"stream",stream:async function*(){for await(let e of l)yield JSON.parse(e)}()}}}})},58211:function(e,t,s){"use strict";s.d(t,{getAIProviderOptions:function(){return n},registerAIProvider:function(){return r}});let i=new Map;function n(e,t){let s=i.get(e);if(!s)throw Error(`AI provider "${e}" is not registered. Available providers: `+[...i.keys()].join(", "));return s(t)}function r(e,t){i.set(e,t)}},65374:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="addHTML",n="Add HTML content to the beginning or end of the document",r=[{name:"html",type:"string",description:"HTML content to add",required:!0},{name:"position",type:"string",description:'Where to add: "start" adds at the beginning of the document, "end" appends to the end',required:!1,default:"end"}],a=!0},686:function(e,t,s){"use strict";s.d(t,{execute:function(){return a}});var i=s(6689),n=s(49459),r=s(22732);async function a(e,t,s){let a=(0,n.requireString)(t,"html",{allowEmpty:!0}),{position:o="end"}=t;if(!a.trim())return{success:!0,message:"Nothing to add: HTML is empty"};(0,i.throwIfAborted)(s);try{let t=e.createInside.fragment(),s=e.createInside.div();for(s.innerHTML=a;s.firstChild;)t.appendChild(s.firstChild);return"start"===o?r.Dom.prepend(e.editor,t):r.Dom.append(e.editor,t),e.synchronizeValues(),{success:!0,message:`Added ${a.length} characters of HTML at the ${"start"===o?"beginning":"end"} of the document`}}catch(e){throw Error("Failed to add HTML: "+(e?.message||"Unknown error"))}}},78907:function(e,t,s){"use strict";var i=s(65374),n=s(686);t.default={...i,execute:n.execute}},73943:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="applyFormat",n="Apply or remove inline formatting to the current selection (bold, italic, underline, etc.) or to a specific block",r=[{name:"element",type:"string",description:'HTML element to wrap selection (e.g., "strong", "em", "u", "span")',required:!1},{name:"attributes",type:"object",description:'Attributes to apply (e.g., {"className": "highlight"}, {"style": {"color": "red"}})',required:!1},{name:"remove",type:"boolean",description:"If true, remove the formatting instead of applying it",required:!1,default:!1},{name:"blockIndex",type:"number",description:"Zero-based index of the block to format (if not using current selection)",required:!1},{name:"selector",type:"string",description:"CSS selector to find the block to format (if not using current selection)",required:!1}],a=!0},19127:function(e,t,s){"use strict";s.d(t,{execute:function(){return r}});var i=s(6689),n=s(44526);async function r(e,t,s){let{element:r,attributes:a,remove:o,blockIndex:l,selector:c}=t;if((0,i.throwIfAborted)(s),!r&&!a)throw Error('Either "element" or "attributes" must be provided');if(e.s.restore(),void 0!==l||c){let{element:t}=(0,n.resolveBlock)(e,{selector:c,index:l});e.s.select(t)}if(e.s.isCollapsed())throw Error("No selection found. Please select text to format");try{let t={};return r&&(t.element=r),a&&(t.attributes=a),o?e.s.commitStyle({...t,mode:"remove"}):e.s.commitStyle(t),e.synchronizeValues(),{success:!0,message:o?"Formatting removed successfully":"Formatting applied successfully"}}catch(e){throw Error(`Failed to ${o?"remove":"apply"} formatting: ${e.message}`)}}},39296:function(e,t,s){"use strict";var i=s(73943),n=s(19127);t.default={...i,execute:n.execute}},53835:function(e,t,s){"use strict";s.d(t,{BUILT_IN_TOOLS:function(){return p},getToolNames:function(){return g}});var i=s(78907),n=s(39296),r=s(16745),a=s(78717),o=s(5618),l=s(90991),c=s(2020),h=s(12570),u=s(95323),d=s(97603);let p={readDocument:o.default,readBlocks:a.default,readSelection:l.default,writeDocument:d.default,replaceSelection:u.default,replaceBlock:c.default,replaceInDocument:h.default,insertHTML:r.default,addHTML:i.default,applyFormat:n.default};function g(){return Object.keys(p)}},56732:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="insertHTML",n="Insert or replace HTML content at the current cursor position in the editor",r=[{name:"html",type:"string",description:"HTML content to insert",required:!0},{name:"replace",type:"boolean",description:"If true, replaces current selection. If false, inserts at cursor",required:!1,default:!1}],a=!0},39592:function(e,t,s){"use strict";s.d(t,{execute:function(){return r}});var i=s(6689),n=s(49459);async function r(e,t,s){let r=(0,n.requireString)(t,"html",{allowEmpty:!0}),{replace:a}=t;if(!r.trim())return{success:!0,message:"Nothing to insert: HTML is empty"};(0,i.throwIfAborted)(s);try{return e.s.focus(),a&&!e.s.isCollapsed()&&e.s.remove(),e.s.insertHTML(r),e.synchronizeValues(),{success:!0,message:`Inserted ${r.length} characters of HTML`}}catch(e){throw Error("Failed to insert HTML: "+(e?.message||"Unknown error"))}}},16745:function(e,t,s){"use strict";var i=s(56732),n=s(39592);t.default={...i,execute:n.execute}},75352:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="readBlocks",n="Read blocks from the editor with optional filtering and pagination",r=[{name:"offset",type:"number",description:"Number of blocks to skip from the beginning (default: 0)",required:!1,default:0},{name:"limit",type:"number",description:"Maximum number of blocks to return (default: all)",required:!1},{name:"query",type:"string",description:"Filter blocks by text content",required:!1}],a=!1},91140:function(e,t,s){"use strict";s.d(t,{execute:function(){return r}});var i=s(6689),n=s(22732);async function r(e,t,s){let{offset:r,limit:a,query:o}=t;(0,i.throwIfAborted)(s);let l=[];Array.from(e.editor.children).forEach((e,t)=>{n.Dom.isElement(e)&&l.push({blockIndex:t,tagName:e.tagName.toLowerCase(),content:e.innerHTML,textContent:e.textContent||"",classList:Array.from(e.classList)})});let c=l;if(o&&"string"==typeof o){let e=o.toLowerCase();c=l.filter(t=>t.textContent.toLowerCase().includes(e)||t.tagName.includes(e)||t.content.toLowerCase().includes(e))}let h=Math.max(0,Math.min("number"==typeof r?r:0,c.length)),u=void 0!==a?Math.min(h+a,c.length):c.length;return{blocks:c.slice(h,u),total:l.length,offset:h,limit:void 0!==a?a:void 0}}},78717:function(e,t,s){"use strict";var i=s(75352),n=s(91140);t.default={...i,execute:n.execute}},93809:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="readDocument",n="Read the entire content of the editor document in HTML format",r=[{name:"start",type:"number",description:"Start character position (default: 0)",required:!1,default:0},{name:"end",type:"number",description:"End character position (default: length of document)",required:!1},{name:"aroundSelection",type:"boolean",description:"If true, return only the maximum block around the current selection",required:!1,default:!1}],a=!1},28157:function(e,t,s){"use strict";s.d(t,{execute:function(){return r}});var i=s(6689),n=s(22732);async function r(e,t,s){let{start:r,end:a,aroundSelection:o}=t;(0,i.throwIfAborted)(s);let l=e.value,c=l.length;if(o&&!e.s.isCollapsed()){let t=e.s.range.commonAncestorContainer;for(;t&&t!==e.editor;){if(n.Dom.isElement(t)&&t.parentNode===e.editor){l=t.outerHTML;break}t=t.parentNode}return{html:l,length:c}}let h=void 0!==a?Math.min(a,c):c,u=Math.max(0,Math.min("number"==typeof r?r:0,c));return(u>0||c>h)&&(l=l.substring(u,h)),{html:l,length:c,start:u,end:h}}},5618:function(e,t,s){"use strict";var i=s(93809),n=s(28157);t.default={...i,execute:n.execute}},52826:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="readSelection",n="Get information about the current selection including HTML content and optional context",r=[{name:"contextCharsBefore",type:"number",description:"Number of characters to include before the selection",required:!1,default:0},{name:"contextCharsAfter",type:"number",description:"Number of characters to include after the selection",required:!1,default:0}],a=!1},85130:function(e,t,s){"use strict";s.d(t,{execute:function(){return n}});var i=s(6689);async function n(e,t,s){let{contextCharsBefore:n,contextCharsAfter:r}=t;if((0,i.throwIfAborted)(s),e.s.restore(),e.s.isCollapsed())return{hasSelection:!1};let a=e.s.html,o=e.s.range,l=o.toString(),c={hasSelection:!0,html:a,text:l,startContainer:o.startContainer.nodeName,endContainer:o.endContainer.nodeName};if(n>0||r>0){let t=e.editor.textContent||"",s=t.substring(0,t.indexOf(l)),i=t.substring(t.indexOf(l)+l.length);n>0&&(c.contextBefore=s.slice(-n)),r>0&&(c.contextAfter=i.slice(0,r))}return c}},90991:function(e,t,s){"use strict";var i=s(52826),n=s(85130);t.default={...i,execute:n.execute}},96675:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="replaceBlock",n="Replace a specific block in the document by its index or CSS selector with new HTML content",r=[{name:"index",type:"number",description:"Zero-based index of the block to replace (use either index or selector, not both)",required:!1},{name:"selector",type:"string",description:'CSS selector to find the block to replace (e.g., "h1", ".my-class", "#my-id"). Use either selector or index, not both',required:!1},{name:"html",type:"string",description:"HTML content for the new block",required:!0}],a=!0},3091:function(e,t,s){"use strict";s.d(t,{execute:function(){return o}});var i=s(6689),n=s(49459),r=s(44526),a=s(22732);async function o(e,t,s){let{index:o,selector:l}=t,c=(0,n.requireString)(t,"html");if((0,i.throwIfAborted)(s),void 0===o&&!l||void 0!==o&&l)throw Error("Either index or selector must be provided, but not both");let{element:h,identifier:u}=(0,r.resolveBlock)(e,{selector:l,index:o,requireExactlyOne:!0});try{let t=e.createInside.div();t.innerHTML=c;let s=t.firstChild;if(!s||!a.Dom.isElement(s))throw Error("Invalid HTML: must contain at least one element");return h.parentNode?.replaceChild(s,h),e.synchronizeValues(),{success:!0,message:`Block ${u} replaced successfully`}}catch(e){throw Error(`Failed to replace block ${u}: ${e.message}`)}}},2020:function(e,t,s){"use strict";var i=s(96675),n=s(3091);t.default={...i,execute:n.execute}},62553:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="replaceInDocument",n="Find and replace text or HTML patterns throughout the entire document",r=[{name:"search",type:"string",description:"Text or pattern to search for",required:!0},{name:"replace",type:"string",description:"Replacement text or HTML",required:!0},{name:"useRegex",type:"boolean",description:"If true, treats search as a regular expression",required:!1,default:!1},{name:"useSelector",type:"string",description:"CSS selector to narrow down the search scope to specific elements",required:!1}],a=!0},56293:function(e,t,s){"use strict";s.d(t,{execute:function(){return r}});var i=s(6689),n=s(49459);async function r(e,t,s){let r=(0,n.requireString)(t,"search"),a=(0,n.requireString)(t,"replace",{allowEmpty:!0}),{useRegex:o,useSelector:l}=t;(0,i.throwIfAborted)(s);try{let t;e.s.focus(),e.s.save();let n=0;if(l){let c=function(e,t,s,n,r,a){let o=e.editor.querySelectorAll(r);if(0===o.length)return{replacements:0,message:`No elements found matching selector "${r}"`};let l=0;return o.forEach(e=>{(0,i.throwIfAborted)(a);let r=e.innerHTML,o=r;if(n)try{let e=RegExp(t,"g");r=r.replace(e,()=>(l++,s))}catch(e){throw Error("Invalid regex pattern: "+(e?.message||"Unknown error"))}else{let e=t.length,n=0;for(;-1!==(n=r.indexOf(t,n));)(0,i.throwIfAborted)(a),r=r.substring(0,n)+s+r.substring(n+e),n+=s.length,l++}r!==o&&(e.innerHTML=r)}),l>0&&(e.synchronizeValues(),e.s.restore()),{replacements:l}}(e,r,a,o,l,s);n=c.replacements,t=c.message}else n=function(e,t,s,n,r,a){let o=0,l=t;if(r)try{let e=RegExp(s,"g");l=l.replace(e,()=>(o++,n))}catch(e){throw Error("Invalid regex pattern: "+(e?.message||"Unknown error"))}else{let e=s.length,t=0;for(;-1!==(t=l.indexOf(s,t));)(0,i.throwIfAborted)(a),l=l.substring(0,t)+n+l.substring(t+e),t+=n.length,o++}return o>0&&(e.value=l,e.s.restore(),e.synchronizeValues()),o}(e,e.value,r,a,o,s);return{replacements:n,message:t||(n>0?`Replaced ${n} occurrence(s)`:"No matches found")}}catch(t){throw e.s.restore(),Error("Failed to replace in document: "+(t?.message||"Unknown error"))}}},12570:function(e,t,s){"use strict";var i=s(62553),n=s(56293);t.default={...i,execute:n.execute}},70750:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="replaceSelection",n="Replace the current selection with new HTML content",r=[{name:"html",type:"string",description:"HTML content to insert in place of the selection",required:!0},{name:"collapseToEnd",type:"boolean",description:"Move cursor to the end of the inserted content",required:!1,default:!0}],a=!0},36142:function(e,t,s){"use strict";s.d(t,{execute:function(){return r}});var i=s(6689),n=s(49459);async function r(e,t,s){let r=(0,n.requireString)(t,"html"),{collapseToEnd:a}=t;(0,i.throwIfAborted)(s);try{if(e.s.restore(),e.s.insertHTML(r),a){let t=e.s.range;t.collapse(!1),e.s.selectRange(t)}return e.e.fire("change"),{success:!0,message:"Selection replaced successfully"}}catch(e){throw Error("Failed to replace selection: "+e.message)}}},95323:function(e,t,s){"use strict";var i=s(70750),n=s(36142);t.default={...i,execute:n.execute}},90022:function(e,t,s){"use strict";s.r(t),s.d(t,{description:function(){return n},name:function(){return i},parameters:function(){return r},requiresPermission:function(){return a}});let i="writeDocument",n="Write (replace) the entire document content with new HTML",r=[{name:"html",type:"string",description:"HTML content to set as the document",required:!0}],a=!0},79766:function(e,t,s){"use strict";s.d(t,{execute:function(){return r}});var i=s(6689),n=s(49459);async function r(e,t,s){let r=(0,n.requireString)(t,"html",{allowEmpty:!0});(0,i.throwIfAborted)(s);try{return e.s.focus(),e.value=r,e.synchronizeValues(),{success:!0,message:`Document content was replaced with provided HTML(${r.length} characters)`}}catch(e){throw Error("Failed to replace HTML: "+(e?.message||"Unknown error"))}}},97603:function(e,t,s){"use strict";var i=s(90022),n=s(79766);t.default={...i,execute:n.execute}},80453:function(e,t,s){"use strict";s.d(t,{UIConversationListItem:function(){return c}});var i=s(82749),n=s(31635),r=s(65478),a=s(67510),o=s(62843),l=s(80870);class c extends a.UIElement{className(){return"UIConversationListItem"}render(){return'<div class="jodit-ui-conversation-list__item"></div>'}setActive(e){this.isActive=e,this.updateContent()}updateContent(){let e=this.container;e.innerHTML="",e.setAttribute("data-id",this.conversation.id),this.isActive?e.classList.add("jodit-ui-conversation-list__item_active"):e.classList.remove("jodit-ui-conversation-list__item_active");let t=this.j.c.div("jodit-ui-conversation-list__item-avatar");t.textContent="AI",e.appendChild(t);let s=this.j.c.div("jodit-ui-conversation-list__item-wrapper"),i=this.j.c.div("jodit-ui-conversation-list__item-content"),n=this.j.c.div("jodit-ui-conversation-list__item-title");if(n.textContent=this.conversation.title,this.titleElement=n,i.appendChild(n),this.opts.showTimestamps){let e=this.j.c.div("jodit-ui-conversation-list__item-meta");e.textContent=this.opts.formatTimestamp(this.conversation.updated,this.j.i18n.bind(this.j)),i.appendChild(e)}if(s.appendChild(i),this.conversation.messageCount>0){let e=this.j.c.div("jodit-ui-conversation-list__item-badge");e.textContent=this.conversation.messageCount+"",s.appendChild(e)}e.appendChild(s),this.actionsButton||(this.actionsButton=new o.UIButton(this.j,{icon:{name:"dots"},tooltip:"Actions",name:"conversationActions",size:"tiny"}),this.actionsButton.container.classList.add("jodit-ui-conversation-list__item-actions"),this.actionsButton.onAction(e=>{e.stopPropagation(),this.showActionsMenu(e)})),e.appendChild(this.actionsButton.container)}onClick(){this.isRenaming||this.j.e.fire("selectConversation.ai-assistant-pro",this.conversation.id)}showActionsMenu(e){if(!this.contextMenu||!this.actionsButton)return;let t=this.actionsButton.container.getBoundingClientRect();this.contextMenu.show(t.left,t.bottom,[{title:"Rename",icon:"pencil",exec:()=>{this.startInlineRename()}},{title:"Delete",icon:"bin",exec:()=>{this.onDelete()}}]),e.stopPropagation()}startInlineRename(){if(this.isRenaming||!this.titleElement)return;this.isRenaming=!0;let e=this.titleElement,t=this.conversation.title,s=this.j.c.element("input");s.type="text",s.value=t,s.className="jodit-ui-conversation-list__item-title-input",e.textContent="",e.appendChild(s),s.focus(),s.select();let i=()=>{if(!this.isRenaming)return;let i=s.value.trim();this.isRenaming=!1,i&&i!==t?(e.textContent=i,this.j.e.fire("renameConversation.ai-assistant-pro",this.conversation.id,i)):e.textContent=t};this.j.e.on(s,"blur",i),this.j.e.on(s,"keydown",i=>{"Enter"===i.key&&(i.preventDefault(),s.blur()),"Escape"===i.key&&(this.isRenaming=!1,e.textContent=t)}),this.j.e.on(s,"click",e=>{e.stopPropagation()})}onDelete(){this.j.e.fire("deleteConversation.ai-assistant-pro",this.conversation.id)}destruct(){this.actionsButton?.destruct(),this.contextMenu?.destruct(),super.destruct()}constructor(e,t,s=!1,n){super(e),(0,i._)(this,"opts",void 0),(0,i._)(this,"conversation",void 0),(0,i._)(this,"isActive",void 0),(0,i._)(this,"actionsButton",void 0),(0,i._)(this,"contextMenu",void 0),(0,i._)(this,"titleElement",void 0),(0,i._)(this,"isRenaming",void 0),this.opts=n,this.actionsButton=null,this.contextMenu=null,this.titleElement=null,this.isRenaming=!1,this.conversation=t,this.isActive=s,this.contextMenu=new l.ContextMenu(this.j),this.updateContent()}}(0,n.__decorate)([(0,r.watch)("container:click")],c.prototype,"onClick",null),(0,n.__decorate)([r.autobind],c.prototype,"showActionsMenu",null),(0,n.__decorate)([r.autobind],c.prototype,"startInlineRename",null),(0,n.__decorate)([r.autobind],c.prototype,"onDelete",null),c=(0,n.__decorate)([r.component],c)},68365:function(e,t,s){"use strict";s.d(t,{UIConversationList:function(){return h}});var i=s(82749),n=s(31635),r=s(31356),a=s(80453),o=s(65478),l=s(80256),c=s(62405);class h extends c.UIGroup{className(){return"UIConversationList"}render(){return`<div class="&__container">
11
11
  <div class="&__header"></div>
12
12
  <div class="&__search">
13
13
  <div class="&__search-loader"></div>
14
14
  </div>
15
15
  <div class="&__list"></div>
16
- </div>`}afterRender(){this.createControls(),this.listContainer=this.getElm("list")}appendChildToContainer(e){this.listContainer&&this.listContainer.appendChild(e)}createControls(){let e=this.getElm("search");this.searchInput=new l.UIInput(this.j,{name:"search",placeholder:"Search conversations...",icon:"search",clearButton:!0}),this.j.e.on(this.searchInput.nativeInput,"input",this.onSearch),e.appendChild(this.searchInput.container)}setConversations(e){this.buildList(e)}setActiveConversation(e){this.activeConversationId=e,this.elements.forEach(t=>{t.setActive(t.conversation.id===e)})}onSearch(){let e=this.searchInput.value.trim();this.j.e.fire("searchConversations.ai-assistant-pro",e)}buildList(e){let t=this.elements.map(e=>e.conversation),s=r.ListReconciler.reconcile(t,e,{getId:e=>e.id,isEqual:(e,t)=>e.id===t.id&&e.updated===t.updated,preserveOrder:!0});s.toRemove.forEach(e=>{let t=this.conversationItems.get(e.id);t&&(-1!==this.elements.indexOf(t)&&(this.remove(t),t.destruct()),this.conversationItems.delete(e.id))}),s.toUpdate.forEach(({newItem:e,index:t})=>{let s=this.conversationItems.get(e.id);if(s){let i=e.id===this.activeConversationId;s.setActive(i),this.elements.indexOf(s)!==t&&t<this.elements.length&&(this.remove(s),this.append(s,t))}}),s.toCreate.forEach(t=>{let s=t.id===this.activeConversationId,i=new a.UIConversationListItem(this.j,t,s,this.opts);this.conversationItems.set(t.id,i);let n=e.indexOf(t);this.append(i,n)}),s.unchanged.forEach(e=>{let t=this.conversationItems.get(e.id);if(t){let s=e.id===this.activeConversationId;t.setActive(s)}})}setLoading(e){this.setMod("loading",e)}setParentView(e){return this.searchInput?.setParentView(e),super.setParentView(e)}destruct(){this.searchInput?.destruct(),super.destruct()}constructor(e,t){super(e),(0,i._)(this,"opts",void 0),(0,i._)(this,"searchInput",void 0),(0,i._)(this,"activeConversationId",void 0),(0,i._)(this,"listContainer",void 0),(0,i._)(this,"conversationItems",void 0),this.opts=t,this.searchInput=null,this.activeConversationId=null,this.conversationItems=new Map}}(0,n.__decorate)([(0,o.hook)("ready")],h.prototype,"afterRender",null),(0,n.__decorate)([(0,o.debounce)()],h.prototype,"onSearch",null),h=(0,n.__decorate)([o.component],h)},63227:function(e,t,s){"use strict";s.d(t,{UIInputArea:function(){return h}});var i=s(82749),n=s(31635),r=s(65478),a=s(38837),o=s(67510),l=s(62843),c=s(85120);class h extends o.UIElement{className(){return"UIInputArea"}setParentView(e){return this.textarea?.setParentView(e),this.sendButton?.setParentView(e),this.stopButton?.setParentView(e),super.setParentView(e)}render(){return`<div class="&__container">
16
+ </div>`}afterRender(){this.createControls(),this.listContainer=this.getElm("list")}appendChildToContainer(e){this.listContainer&&this.listContainer.appendChild(e)}createControls(){let e=this.getElm("search");this.searchInput=new l.UIInput(this.j,{name:"search",placeholder:"Search conversations...",icon:"search",clearButton:!0}),this.j.e.on(this.searchInput.nativeInput,"input",this.onSearch),e.appendChild(this.searchInput.container)}setConversations(e){this.buildList(e)}setActiveConversation(e){this.activeConversationId=e,this.elements.forEach(t=>{t.setActive(t.conversation.id===e)})}onSearch(){let e=this.searchInput.value.trim();this.j.e.fire("searchConversations.ai-assistant-pro",e)}buildList(e){let t=this.elements.map(e=>e.conversation),s=r.ListReconciler.reconcile(t,e,{getId:e=>e.id,isEqual:(e,t)=>e.id===t.id&&e.updated===t.updated,preserveOrder:!0});s.toRemove.forEach(e=>{let t=this.conversationItems.get(e.id);t&&(-1!==this.elements.indexOf(t)&&(this.remove(t),t.destruct()),this.conversationItems.delete(e.id))}),s.toUpdate.forEach(({newItem:e,index:t})=>{let s=this.conversationItems.get(e.id);if(s){let i=e.id===this.activeConversationId;s.setActive(i),this.elements.indexOf(s)!==t&&t<this.elements.length&&(this.remove(s),this.append(s,t))}}),s.toCreate.forEach(t=>{let s=t.id===this.activeConversationId,i=new a.UIConversationListItem(this.j,t,s,this.opts);this.conversationItems.set(t.id,i);let n=e.indexOf(t);this.append(i,n)}),s.unchanged.forEach(e=>{let t=this.conversationItems.get(e.id);if(t){let s=e.id===this.activeConversationId;t.setActive(s)}})}setLoading(e){this.setMod("loading",e)}setParentView(e){return this.searchInput?.setParentView(e),super.setParentView(e)}destruct(){this.searchInput?.destruct(),super.destruct()}constructor(e,t){super(e),(0,i._)(this,"opts",void 0),(0,i._)(this,"searchInput",void 0),(0,i._)(this,"activeConversationId",void 0),(0,i._)(this,"listContainer",void 0),(0,i._)(this,"conversationItems",void 0),this.opts=t,this.searchInput=null,this.activeConversationId=null,this.conversationItems=new Map}}(0,n.__decorate)([(0,o.hook)("ready")],h.prototype,"afterRender",null),(0,n.__decorate)([(0,o.debounce)()],h.prototype,"onSearch",null),h=(0,n.__decorate)([o.component],h)},63227:function(e,t,s){"use strict";s.d(t,{UIInputArea:function(){return u}});var i=s(82749),n=s(31635),r=s(66330),a=s(65478),o=s(38837),l=s(67510),c=s(62843),h=s(85120);class u extends l.UIElement{className(){return"UIInputArea"}setParentView(e){return this.textarea?.setParentView(e),this.sendButton?.setParentView(e),this.stopButton?.setParentView(e),this.voiceButton?.setParentView(e),super.setParentView(e)}render(){return`<div class="&__container">
17
17
  <div class="&__context-badges"></div>
18
18
  <div class="&__loading-indicator">
19
19
  <span class="&__loading-dot"></span>
@@ -24,7 +24,7 @@ ${r}`.trim();s?await this.__executeQuickCommandSilent(l,r):await this.__executeQ
24
24
  <div class="&__textarea-wrapper"></div>
25
25
  <div class="&__buttons"></div>
26
26
  </div>
27
- </div>`}onInputRowClick(){this.textarea!==this.j.od.activeElement&&this.textarea?.focus()}afterRender(){this.contextBadges=this.getElm("context-badges"),this.createControls(),this.attachHandlers()}createControls(){let e=this.getElm("textarea-wrapper"),t=this.getElm("buttons");this.textarea=new c.UITextArea(this.j,{name:"message",placeholder:this.options.placeholderText,resizable:!1}),e.appendChild(this.textarea.container),this.sendButton=new l.UIButton(this.j,{name:"send-message",icon:{name:"send"},variant:"initial",size:"middle"}),this.stopButton=new l.UIButton(this.j,{name:"abort-message",icon:{name:"cancel"},variant:"default",size:"middle"}),this.stopButton.container.style.display="none",t.appendChild(this.sendButton.container),t.appendChild(this.stopButton.container)}attachHandlers(){this.j.e.on(this.sendButton,"click",this.onSend),this.j.e.on(this.stopButton,"click",this.onStop),this.j.e.on(this.textarea.nativeInput,"keydown",e=>{let{sendShortcut:t,sendOnEnter:s}=this.options;if("Ctrl+Enter"===t&&e.ctrlKey&&"Enter"===e.key){e.preventDefault(),this.onSend();return}"Escape"===e.key?this.j.e.fire("cancelEditMessage.ai-assistant-pro"):"Enter"===e.key&&(s?e.shiftKey||(e.preventDefault(),this.onSend()):e.shiftKey&&(e.preventDefault(),this.onSend()))})}onSend(){let e=this.textarea?.value.trim();!e||this.isLoading||(this.j.e.fire("sendMessage.ai-assistant-pro",e),this.textarea&&(this.textarea.value="",this.textarea.nativeInput.focus()))}onStop(){this.j.e.fire("abortRequest.ai-assistant-pro")}setContexts(e){this.contexts=e,this.updateContextBadges()}updateContextBadges(){if(this.contextBadges.innerHTML="",0===this.contexts.length){this.contextBadges.style.display="none";return}this.contextBadges.style.display="",this.contexts.forEach((e,t)=>{let s=this.createContextBadge(e,t);this.contextBadges.appendChild(s)})}createContextBadge(e,t){let s=this.j.c.div(this.getFullElName("context-badge")),i=this.j.c.span(),n=e.html.replace(/<[^>]*>/g,"").substring(0,20);i.textContent=void 0!==e.blockIndex?`Block ${e.blockIndex}: ${n}...`:`${n}...`;let r=this.j.c.span(this.getFullElName("context-remove"));return r.textContent="×",r.setAttribute("data-index",t+""),this.j.e.on(r,"click",()=>{this.j.e.fire("removeContext.ai-assistant-pro",t)}),s.appendChild(i),s.appendChild(r),s}setLoading(e){this.isLoading=e;let{sendButton:t,stopButton:s,textarea:i}=this;(0,a.assert)(t&&s&&i,"Buttons must be initialized"),i.setMod("disabled",e),t.setMod("disabled",e),this.setMod("loading",e),e?(t.container.style.display="none",s.container.style.display=""):(t.container.style.display="",s.container.style.display="none")}focus(){this.textarea?.nativeInput.focus()}setValue(e){this.textarea&&(this.textarea.value=e)}getValue(){return this.textarea?.value.trim()||""}destruct(){this.textarea?.destruct(),this.sendButton?.destruct(),this.stopButton?.destruct(),super.destruct()}constructor(e,t){super(e),(0,i._)(this,"options",void 0),(0,i._)(this,"textarea",void 0),(0,i._)(this,"sendButton",void 0),(0,i._)(this,"stopButton",void 0),(0,i._)(this,"contextBadges",void 0),(0,i._)(this,"contexts",void 0),(0,i._)(this,"isLoading",void 0),this.options=t,this.textarea=null,this.sendButton=null,this.stopButton=null,this.contexts=[],this.isLoading=!1}}(0,n.__decorate)([(0,r.watch)("input-row:click")],h.prototype,"onInputRowClick",null),(0,n.__decorate)([(0,r.hook)("ready")],h.prototype,"afterRender",null),(0,n.__decorate)([r.autobind],h.prototype,"onSend",null),(0,n.__decorate)([r.autobind],h.prototype,"onStop",null),h=(0,n.__decorate)([r.component],h)},27769:function(e,t,s){"use strict";s.d(t,{UIMainPanel:function(){return i.UIMainPanel}});var i=s(51251)},51251:function(e,t,s){"use strict";s.d(t,{UIMainPanel:function(){return f}});var i=s(82749),n=s(31635),r=s(68365),a=s(63227),o=s(86563),l=s(93677),c=s(48705),h=s(55885),u=s(65478),d=s(2748),p=s(67510),g=s(62843),m=s(80870);class f extends p.UIElement{className(){return"UIMainPanel"}setParentView(e){return this.welcomeScreen?.setParentView(e),this.conversationList?.setParentView(e),this.messageList?.setParentView(e),this.inputArea?.setParentView(e),this.permissionRequest?.setParentView(e),this.settingsButton?.setParentView(e),super.setParentView(e)}render(){return`<div class="&__container">
27
+ </div>`}onInputRowClick(){this.textarea!==this.j.od.activeElement&&this.textarea?.focus()}afterRender(){this.contextBadges=this.getElm("context-badges"),this.createControls(),this.attachHandlers(),this.autosize()}autosize(){let e=this.textarea?.nativeInput;e&&(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,160)}px`,e.style.overflowY=e.scrollHeight>160?"auto":"hidden")}createControls(){let e=this.getElm("textarea-wrapper"),t=this.getElm("buttons");this.textarea=new h.UITextArea(this.j,{name:"message",placeholder:this.options.placeholderText,resizable:!1}),e.appendChild(this.textarea.container),this.sendButton=new c.UIButton(this.j,{name:"send-message",icon:{name:"send"},variant:"initial",size:"middle"}),this.stopButton=new c.UIButton(this.j,{name:"abort-message",icon:{name:"cancel"},variant:"default",size:"middle"}),this.stopButton.container.style.display="none",this.options.voiceInputEnabled&&(this.voiceButton=new r.VoiceInputButton(this.j,{url:this.options.voiceInputUrl,apiKey:this.options.voiceInputApiKey,defaultModel:this.options.voiceInputDefaultModel,language:this.options.voiceInputLanguage,silenceTimeoutMs:this.options.voiceInputSilenceTimeoutMs,autoSendSilenceMs:this.options.voiceInputAutoSendSilenceMs,api:this.options.voiceInputApi},{getValue:()=>this.textarea?.nativeInput.value??"",setValue:(e,t)=>{if(this.textarea){if(this.textarea.value=e,void 0!==t){let e=this.textarea.nativeInput;e.selectionStart=t,e.selectionEnd=t}this.autosize()}},getSelection:()=>{let e=this.textarea?.nativeInput;if(!e)return{start:0,end:0};let t=e.value.length;return{start:e.selectionStart??t,end:e.selectionEnd??t}},focus:()=>this.focus(),send:()=>this.onSend()}),t.appendChild(this.voiceButton.container)),t.appendChild(this.sendButton.container),t.appendChild(this.stopButton.container)}attachHandlers(){this.j.e.on(this.sendButton,"click",this.onSend),this.j.e.on(this.stopButton,"click",this.onStop),this.j.e.on(this.textarea.nativeInput,"input",()=>this.autosize()),this.j.e.on(this.textarea.nativeInput,"keydown",e=>{let{sendShortcut:t,sendOnEnter:s}=this.options;if("Ctrl+Enter"===t&&e.ctrlKey&&"Enter"===e.key){e.preventDefault(),this.onSend();return}"Escape"===e.key?this.j.e.fire("cancelEditMessage.ai-assistant-pro"):"Enter"===e.key&&(s?e.shiftKey||(e.preventDefault(),this.onSend()):e.shiftKey&&(e.preventDefault(),this.onSend()))})}onSend(){let e=this.textarea?.value.trim();!e||this.isLoading||(this.j.e.fire("sendMessage.ai-assistant-pro",e),this.textarea&&(this.textarea.value="",this.autosize(),this.textarea.nativeInput.focus()))}onStop(){this.j.e.fire("abortRequest.ai-assistant-pro")}setContexts(e){this.contexts=e,this.updateContextBadges()}updateContextBadges(){if(this.contextBadges.innerHTML="",0===this.contexts.length){this.contextBadges.style.display="none";return}this.contextBadges.style.display="",this.contexts.forEach((e,t)=>{let s=this.createContextBadge(e,t);this.contextBadges.appendChild(s)})}createContextBadge(e,t){let s=this.j.c.div(this.getFullElName("context-badge")),i=this.j.c.span(),n=e.html.replace(/<[^>]*>/g,"").substring(0,20);i.textContent=void 0!==e.blockIndex?`Block ${e.blockIndex}: ${n}...`:`${n}...`;let r=this.j.c.span(this.getFullElName("context-remove"));return r.textContent="×",r.setAttribute("data-index",t+""),this.j.e.on(r,"click",()=>{this.j.e.fire("removeContext.ai-assistant-pro",t)}),s.appendChild(i),s.appendChild(r),s}setLoading(e){this.isLoading=e;let{sendButton:t,stopButton:s,textarea:i}=this;(0,o.assert)(t&&s&&i,"Buttons must be initialized"),i.setMod("disabled",e),t.setMod("disabled",e),this.setMod("loading",e),e?(t.container.style.display="none",s.container.style.display=""):(t.container.style.display="",s.container.style.display="none")}focus(){this.textarea?.nativeInput.focus()}setValue(e){this.textarea&&(this.textarea.value=e,this.autosize())}getValue(){return this.textarea?.value.trim()||""}destruct(){this.textarea?.destruct(),this.sendButton?.destruct(),this.stopButton?.destruct(),this.voiceButton?.destruct(),super.destruct()}constructor(e,t){super(e),(0,i._)(this,"options",void 0),(0,i._)(this,"textarea",void 0),(0,i._)(this,"sendButton",void 0),(0,i._)(this,"stopButton",void 0),(0,i._)(this,"voiceButton",void 0),(0,i._)(this,"contextBadges",void 0),(0,i._)(this,"contexts",void 0),(0,i._)(this,"isLoading",void 0),this.options=t,this.textarea=null,this.sendButton=null,this.stopButton=null,this.voiceButton=null,this.contexts=[],this.isLoading=!1}}(0,n.__decorate)([(0,a.watch)("input-row:click")],u.prototype,"onInputRowClick",null),(0,n.__decorate)([(0,a.hook)("ready")],u.prototype,"afterRender",null),(0,n.__decorate)([a.autobind],u.prototype,"onSend",null),(0,n.__decorate)([a.autobind],u.prototype,"onStop",null),u=(0,n.__decorate)([a.component],u)},27769:function(e,t,s){"use strict";s.d(t,{UIMainPanel:function(){return i.UIMainPanel}});var i=s(51251)},51251:function(e,t,s){"use strict";s.d(t,{UIMainPanel:function(){return f}});var i=s(82749),n=s(31635),r=s(68365),a=s(63227),o=s(86563),l=s(93677),c=s(48705),h=s(55885),u=s(65478),d=s(2748),p=s(67510),g=s(62843),m=s(80870);class f extends p.UIElement{className(){return"UIMainPanel"}setParentView(e){return this.welcomeScreen?.setParentView(e),this.conversationList?.setParentView(e),this.messageList?.setParentView(e),this.inputArea?.setParentView(e),this.permissionRequest?.setParentView(e),this.settingsButton?.setParentView(e),super.setParentView(e)}render(){return`<div class="&__container">
28
28
  <div class="&__header">
29
29
  <div class="&__header-left"></div>
30
30
  <div class="&__header-title"></div>
@@ -59,8 +59,8 @@ ${r}`.trim();s?await this.__executeQuickCommandSilent(l,r):await this.__executeQ
59
59
  <div class="&__title">~Welcome to AI Assistant~</div>
60
60
  <div class="&__subtitle">~Start your first conversation~</div>
61
61
  <div class="&__tip">~Tip: Select text in editor to add context~</div>
62
- </div>`}}a=(0,i.__decorate)([n.component],a)},18549:function(e,t,s){"use strict";s.d(t,{UIFlightPosition:function(){return r}});var i=s(2748);let n=new WeakMap;class r{static install(e,t,s={}){this.remove(e);let{panelHeight:i=250,containerClassName:r,toolbarSelector:a=".jodit-toolbar__box",gap:o=16}=s,l=e.j.c.div("jodit-flight-position");r&&l.classList.add(r),l.style.setProperty("--flight-panel-height",`${i}px`),l.appendChild(e.container),document.body.appendChild(l);let c={toolbarSelector:a,gap:o},h=()=>{this.updatePosition(l,t,c)},u=new ResizeObserver(h);u.observe(t),window.addEventListener("scroll",h,{passive:!0}),window.addEventListener("resize",h,{passive:!0}),n.set(e,{container:l,anchor:t,onScroll:h,resizeObserver:u,options:c}),this.updatePosition(l,t,c)}static updatePosition(e,t,s){let{toolbarSelector:i,gap:n}=s,r=t.getBoundingClientRect(),a=window.innerHeight,o=e.offsetHeight||250;e.style.left=`${r.left}px`,e.style.width=`${r.width}px`;let l=t.querySelector(i),c=l?l.getBoundingClientRect().bottom:r.top,h=r.bottom-c,u=r.bottom<=a;o<=h?u?(e.style.top="auto",e.style.bottom=`${a-r.bottom+n}px`):(e.style.top="auto",e.style.bottom=`${n}px`):(e.style.bottom="auto",e.style.top=`${c}px`)}static remove(e){let t=n.get(e);t&&(window.removeEventListener("scroll",t.onScroll),window.removeEventListener("resize",t.onScroll),t.resizeObserver.disconnect(),e.container.parentNode===t.container&&t.container.parentNode?.insertBefore(e.container,t.container),i.Dom.safeRemove(t.container),n.delete(e))}static isInstalled(e){return n.has(e)}static setPanelHeight(e,t){let s=n.get(e);s&&s.container.style.setProperty("--flight-panel-height",`${t}px`)}static refresh(e){let t=n.get(e);t&&this.updatePosition(t.container,t.anchor,t.options)}}},54747:function(e,t,s){"use strict";s.d(t,{UIResize:function(){return r}});var i=s(2748),n=s(41180);class r{static remove(e){e.container.classList.remove("jodit-ui-resize"),i.Dom.safeRemove(e.container.querySelector(".jodit-ui-resize__handle"))}static install(e,t,s={}){e.container.classList.add("jodit-ui-resize"),"static"===(0,n.css)(e.container,"position")&&(0,n.css)(e.container,"position","relative");let i=e.j.c.div("jodit-ui-resize__handle");i.classList.add("jodit-ui-resize__handle_type_"+t),s.handleClassName&&i.classList.add(s.handleClassName),e.container.appendChild(i),e.j.e.on(i,"mousedown touchstart",this.onStartResize.bind(this,e,t,s.onResize??(()=>void 0)))}static onStartResize(e,t,s,i){let n={x:i.clientX,y:i.clientY,w:e.container.offsetWidth,h:e.container.offsetHeight,direction:t},r=e.j.async.throttle(this.onResize.bind(this,e,n,s),e.j.defaultTimeout/10);e.j.lock(),e.j.e.on(e.j.ow,"mousemove touchmove",r).one(e.j.ow,"mouseup touchend",this.onEndResize.bind(this,e,r))}static onResize(e,t,s,i){let r,a=["left","right"].includes(t.direction),o=e.container.parentElement;o&&(r=a?t.w+(i.clientX-t.x)*("right"===t.direction?1:-1):t.h+(i.clientY-t.y)*("top"===t.direction?-1:1),!0!==s?.({newSize:r})&&(0,n.css)(e.container,a?"width":"height",r/(a?o.offsetWidth:o.offsetHeight)*100+"%"))}static onEndResize(e,t,s){e.j.e.off(e.j.ow,"mousemove touchmove",t),e.j.unlock()}}},72573:function(e,t,s){"use strict";function i(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function n(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}s.d(t,{marked:function(){return ey}});var r,a=n(),o={exec:()=>null};function l(e,t=""){let s="string"==typeof e?e:e.source,i={replace(e,t){let n="string"==typeof t?t:t.source;return n=n.replace(h.caret,"$1"),s=s.replace(e,n),i},getRegex:()=>new RegExp(s,t)};return i}var c=(()=>{try{return!!RegExp("(?<=1)(?<!1)")}catch{return!1}})(),h={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}>`)},u=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,d=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,p=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,g=l(p).replace(/bull/g,d).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),m=l(p).replace(/bull/g,d).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),f=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,v=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,C=l(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",v).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),w=l(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,d).getRegex(),x="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",y=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,k=l("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",y).replace("tag",x).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),b=l(f).replace("hr",u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",x).getRegex(),_={blockquote:l(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",b).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:C,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:u,html:k,lheading:g,list:w,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:b,table:o,text:/^[^\n]+/},S=l("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",x).getRegex(),A={..._,lheading:m,table:S,paragraph:l(f).replace("hr",u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",S).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",x).getRegex()},I={..._,html:l("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",y).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:o,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:l(f).replace("hr",u).replace("heading",` *#{1,6} *[^
63
- ]`).replace("lheading",g).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},M=/^( {2,}|\\)\n(?!\s*$)/,T=/[\p{P}\p{S}]/u,P=/[\s\p{P}\p{S}]/u,E=/[^\s\p{P}\p{S}]/u,j=l(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,P).getRegex(),R=/(?!~)[\p{P}\p{S}]/u,L=/(?![*_])[\p{P}\p{S}]/u,D=l(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",c?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),$=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,B=l($,"u").replace(/punct/g,T).getRegex(),N=l($,"u").replace(/punct/g,R).getRegex(),q="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",z=l(q,"gu").replace(/notPunctSpace/g,E).replace(/punctSpace/g,P).replace(/punct/g,T).getRegex(),F=l(q,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,R).getRegex(),U=l("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,E).replace(/punctSpace/g,P).replace(/punct/g,T).getRegex(),O=l(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,L).getRegex(),H=l("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)","gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|[*_])/u).replace(/punctSpace/g,/(?![*_])[\s\p{P}\p{S}]/u).replace(/punct/g,L).getRegex(),V=l(/\\(punct)/,"gu").replace(/punct/g,T).getRegex(),W=l(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),G=l(y).replace("(?:--\x3e|$)","--\x3e").getRegex(),Q=l("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",G).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Z=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,K=l(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Z).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),J=l(/^!?\[(label)\]\[(ref)\]/).replace("label",Z).replace("ref",v).getRegex(),X=l(/^!?\[(ref)\](?:\[\])?/).replace("ref",v).getRegex(),Y=l("reflink|nolink(?!\\()","g").replace("reflink",J).replace("nolink",X).getRegex(),ee=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,et={_backpedal:o,anyPunctuation:V,autolink:W,blockSkip:D,br:M,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:o,delLDelim:o,delRDelim:o,emStrongLDelim:B,emStrongRDelimAst:z,emStrongRDelimUnd:U,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:K,nolink:X,punctuation:j,reflink:J,reflinkSearch:Y,tag:Q,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:o},es={...et,link:l(/^!?\[(label)\]\((.*?)\)/).replace("label",Z).getRegex(),reflink:l(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Z).getRegex()},ei={...et,emStrongRDelimAst:F,emStrongLDelim:N,delLDelim:O,delRDelim:H,url:l(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ee).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:l(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ee).getRegex()},en={...ei,br:l(M).replace("{2,}","*").getRegex(),text:l(ei.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},er={normal:_,gfm:A,pedantic:I},ea={normal:et,gfm:ei,breaks:en,pedantic:es},eo={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},el=e=>eo[e];function ec(e,t){if(t){if(h.escapeTest.test(e))return e.replace(h.escapeReplace,el)}else if(h.escapeTestNoEncode.test(e))return e.replace(h.escapeReplaceNoEncode,el);return e}function eh(e){try{e=encodeURI(e).replace(h.percentDecode,"%")}catch{return null}return e}function eu(e,t){let s=e.replace(h.findPipe,(e,t,s)=>{let i=!1,n=t;for(;--n>=0&&"\\"===s[n];)i=!i;return i?"|":" |"}).split(h.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(h.slashPipe,"|");return s}function ed(e,t,s){let i=e.length;if(0===i)return"";let n=0;for(;n<i;){let r=e.charAt(i-n-1);if(r!==t||s)if(r!==t&&s)n++;else break;else n++}return e.slice(0,i-n)}function ep(e,t,s,i,n){let r=t.href,a=t.title||null,o=e[1].replace(n.other.outputLinkReplace,"$1");i.state.inLink=!0;let l={type:"!"===e[0].charAt(0)?"image":"link",raw:s,href:r,title:a,text:o,tokens:i.inlineTokens(o)};return i.state.inLink=!1,l}var eg=class{space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:ed(e,`
62
+ </div>`}}a=(0,i.__decorate)([n.component],a)},88710:function(e,t,s){"use strict";s.d(t,{MicrophoneStreamer:function(){return n}});var i=s(82749);class n{async start(){if(this.running=!0,this.stream=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}}),!this.running)return void this.stopTracks();let e=new AudioContext;if("suspended"===e.state&&await e.resume(),!this.running)return void e.close();let t=e.createMediaStreamSource(this.stream),s=e.createScriptProcessor(4096,1,1),i=e.createGain();i.gain.value=0,s.onaudioprocess=e=>{if(!this.running)return;let t=function(e){let t=new Int16Array(e.length);for(let s=0;s<e.length;s++){let i=Math.max(-1,Math.min(1,e[s]));t[s]=i<0?32768*i:32767*i}return t}(function(e,t){if(24e3>=t)return e;let s=t/24e3,i=Math.round(e.length/s),n=new Float32Array(i);for(let t=0;i>t;t++)n[t]=e[Math.min(Math.round(t*s),e.length-1)];return n}(e.inputBuffer.getChannelData(0),e.inputBuffer.sampleRate));this.onFrame(t)},t.connect(s),s.connect(i),i.connect(e.destination),this.audioCtx=e,this.source=t,this.processor=s,this.zeroGain=i}stop(){this.running=!1,this.processor&&(this.processor.onaudioprocess=null,this.processor.disconnect(),this.processor=null),this.zeroGain?.disconnect(),this.source?.disconnect(),this.zeroGain=null,this.source=null,this.audioCtx&&(this.audioCtx.close(),this.audioCtx=null),this.stopTracks()}stopTracks(){this.stream?.getTracks().forEach(e=>e.stop()),this.stream=null}constructor(e){(0,i._)(this,"onFrame",void 0),(0,i._)(this,"stream",void 0),(0,i._)(this,"audioCtx",void 0),(0,i._)(this,"processor",void 0),(0,i._)(this,"source",void 0),(0,i._)(this,"zeroGain",void 0),(0,i._)(this,"running",void 0),this.onFrame=e,this.stream=null,this.audioCtx=null,this.processor=null,this.source=null,this.zeroGain=null,this.running=!1}}},66330:function(e,t,s){"use strict";s.d(t,{VoiceInputButton:function(){return a}});var i=s(82749),n=s(20466),r=s(62843);class a{get container(){return this.button.container}setParentView(e){this.button.setParentView(e)}start(){let e,t={onInterim:e=>{this.clearAutoSend(),this.insertPhrase(e)},onFinal:e=>{this.insertPhrase(e),this.phraseActive=!1,this.scheduleAutoSend()},onError:()=>this.reset(),onEnd:()=>this.reset()};if(this.config.api)e=this.config.api(t);else{let{url:s,apiKey:i}=this.config;if(!s||!i)return;e=new n.VoiceTranscriber({url:s,apiKey:i,model:this.config.defaultModel,language:this.config.language,silenceMs:this.config.silenceTimeoutMs,...t})}this.phraseActive=!1,this.engine=e,this.listening=!0,this.setActive(!0),e.start()}reset(){this.clearAutoSend(),this.setActive(!1),this.phraseActive=!1,this.listening=!1,this.engine=null,this.io.focus()}scheduleAutoSend(){this.clearAutoSend();let e=this.config.autoSendSilenceMs;null!=e&&(this.autoSendTimer=this.jodit.async.setTimeout(()=>{this.autoSendTimer=0,this.io.send()},e))}clearAutoSend(){this.autoSendTimer&&(this.jodit.async.clearTimeout(this.autoSendTimer),this.autoSendTimer=0)}setActive(e){this.button.container.classList.toggle("jodit-ai-voice-active",e)}insertPhrase(e){if(!this.phraseActive){this.phraseActive=!0;let{start:e,end:t}=this.io.getSelection(),s=this.io.getValue();this.before=s.slice(0,e),this.after=s.slice(t)}let t=(this.before.length>0&&!/\s$/.test(this.before)?" ":"")+e,s=this.before.length+t.length;this.io.setValue(this.before+t+this.after,s)}destruct(){this.clearAutoSend(),this.jodit.e.off("sendMessage.ai-assistant-pro",this.onPromptSent),this.engine?.stop(),this.engine=null,this.button.destruct()}constructor(e,t,s){(0,i._)(this,"jodit",void 0),(0,i._)(this,"config",void 0),(0,i._)(this,"io",void 0),(0,i._)(this,"button",void 0),(0,i._)(this,"engine",void 0),(0,i._)(this,"listening",void 0),(0,i._)(this,"phraseActive",void 0),(0,i._)(this,"before",void 0),(0,i._)(this,"after",void 0),(0,i._)(this,"autoSendTimer",void 0),(0,i._)(this,"onPromptSent",void 0),(0,i._)(this,"toggle",void 0),this.jodit=e,this.config=t,this.io=s,this.engine=null,this.listening=!1,this.phraseActive=!1,this.before="",this.after="",this.autoSendTimer=0,this.onPromptSent=()=>{this.phraseActive=!1},this.toggle=()=>{if(this.listening){this.engine?.stop(),this.reset();return}this.start()},this.button=new r.UIButton(e,{name:"voice-input",icon:{name:"microphone"},variant:"initial",size:"middle"}),this.button.container.setAttribute("title","Dictate"),this.button.container.setAttribute("data-ref","voiceInputButton"),this.jodit.e.on(this.button,"click",this.toggle),this.jodit.e.on("sendMessage.ai-assistant-pro",this.onPromptSent)}}},20466:function(e,t,s){"use strict";s.d(t,{VoiceTranscriber:function(){return r}});var i=s(82749),n=s(88710);class r{get isActive(){return this.running}start(){let e;if(this.running)return;this.running=!0;try{let t=new URL(this.options.url);t.searchParams.set("key",this.options.apiKey),this.options.model&&t.searchParams.set("model",this.options.model),this.options.language&&t.searchParams.set("language",this.options.language),void 0!==this.options.silenceMs&&t.searchParams.set("silence",this.options.silenceMs+""),e=t.toString()}catch{this.fail("Invalid transcription URL");return}let t=new WebSocket(e);t.binaryType="arraybuffer",this.ws=t,t.addEventListener("message",e=>this.onMessage(e)),t.addEventListener("error",()=>this.fail("Transcription connection error")),t.addEventListener("close",()=>this.finish())}stop(){this.running&&(this.running=!1,this.streamer?.stop(),this.streamer=null,this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING)&&this.ws.close())}onMessage(e){let t;if("string"==typeof e.data){try{t=JSON.parse(e.data)}catch{return}switch(t.type){case"ready":this.options.onReady?.(),this.startAudio();break;case"delta":t.text&&this.options.onInterim?.(t.text);break;case"final":t.text&&this.options.onFinal?.(t.text);break;case"error":this.fail(t.message??"Transcription error")}}}startAudio(){if(!this.running||this.streamer)return;let e=new n.MicrophoneStreamer(e=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send(e)});this.streamer=e,e.start().catch(()=>{this.fail("Microphone access denied")})}fail(e){this.options.onError?.(e),this.stop()}finish(){let e=this.running;this.running=!1,this.streamer?.stop(),this.streamer=null,e&&this.options.onEnd?.()}constructor(e){(0,i._)(this,"options",void 0),(0,i._)(this,"ws",void 0),(0,i._)(this,"streamer",void 0),(0,i._)(this,"running",void 0),this.options=e,this.ws=null,this.streamer=null,this.running=!1}}},18549:function(e,t,s){"use strict";s.d(t,{UIFlightPosition:function(){return r}});var i=s(2748);let n=new WeakMap;class r{static install(e,t,s={}){this.remove(e);let{panelHeight:i=250,containerClassName:r,toolbarSelector:a=".jodit-toolbar__box",gap:o=16}=s,l=e.j.c.div("jodit-flight-position");r&&l.classList.add(r),l.style.setProperty("--flight-panel-height",`${i}px`),l.appendChild(e.container),document.body.appendChild(l);let c={toolbarSelector:a,gap:o},h=()=>{this.updatePosition(l,t,c)},u=new ResizeObserver(h);u.observe(t),window.addEventListener("scroll",h,{passive:!0}),window.addEventListener("resize",h,{passive:!0}),n.set(e,{container:l,anchor:t,onScroll:h,resizeObserver:u,options:c}),this.updatePosition(l,t,c)}static updatePosition(e,t,s){let{toolbarSelector:i,gap:n}=s,r=t.getBoundingClientRect(),a=window.innerHeight,o=e.offsetHeight||250;e.style.left=`${r.left}px`,e.style.width=`${r.width}px`;let l=t.querySelector(i),c=l?l.getBoundingClientRect().bottom:r.top,h=r.bottom-c,u=r.bottom<=a;o<=h?u?(e.style.top="auto",e.style.bottom=`${a-r.bottom+n}px`):(e.style.top="auto",e.style.bottom=`${n}px`):(e.style.bottom="auto",e.style.top=`${c}px`)}static remove(e){let t=n.get(e);t&&(window.removeEventListener("scroll",t.onScroll),window.removeEventListener("resize",t.onScroll),t.resizeObserver.disconnect(),e.container.parentNode===t.container&&t.container.parentNode?.insertBefore(e.container,t.container),i.Dom.safeRemove(t.container),n.delete(e))}static isInstalled(e){return n.has(e)}static setPanelHeight(e,t){let s=n.get(e);s&&s.container.style.setProperty("--flight-panel-height",`${t}px`)}static refresh(e){let t=n.get(e);t&&this.updatePosition(t.container,t.anchor,t.options)}}},54747:function(e,t,s){"use strict";s.d(t,{UIResize:function(){return r}});var i=s(2748),n=s(41180);class r{static remove(e){e.container.classList.remove("jodit-ui-resize"),i.Dom.safeRemove(e.container.querySelector(".jodit-ui-resize__handle"))}static install(e,t,s={}){e.container.classList.add("jodit-ui-resize"),"static"===(0,n.css)(e.container,"position")&&(0,n.css)(e.container,"position","relative");let i=e.j.c.div("jodit-ui-resize__handle");i.classList.add("jodit-ui-resize__handle_type_"+t),s.handleClassName&&i.classList.add(s.handleClassName),e.container.appendChild(i),e.j.e.on(i,"mousedown touchstart",this.onStartResize.bind(this,e,t,s.onResize??(()=>void 0)))}static onStartResize(e,t,s,i){let n={x:i.clientX,y:i.clientY,w:e.container.offsetWidth,h:e.container.offsetHeight,direction:t},r=e.j.async.throttle(this.onResize.bind(this,e,n,s),e.j.defaultTimeout/10);e.j.lock(),e.j.e.on(e.j.ow,"mousemove touchmove",r).one(e.j.ow,"mouseup touchend",this.onEndResize.bind(this,e,r))}static onResize(e,t,s,i){let r,a=["left","right"].includes(t.direction),o=e.container.parentElement;o&&(r=a?t.w+(i.clientX-t.x)*("right"===t.direction?1:-1):t.h+(i.clientY-t.y)*("top"===t.direction?-1:1),!0!==s?.({newSize:r})&&(0,n.css)(e.container,a?"width":"height",r/(a?o.offsetWidth:o.offsetHeight)*100+"%"))}static onEndResize(e,t,s){e.j.e.off(e.j.ow,"mousemove touchmove",t),e.j.unlock()}}},72573:function(e,t,s){"use strict";function i(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function n(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}s.d(t,{marked:function(){return ey}});var r,a=n(),o={exec:()=>null};function l(e,t=""){let s="string"==typeof e?e:e.source,i={replace(e,t){let n="string"==typeof t?t:t.source;return n=n.replace(h.caret,"$1"),s=s.replace(e,n),i},getRegex:()=>new RegExp(s,t)};return i}var c=(()=>{try{return!!RegExp("(?<=1)(?<!1)")}catch{return!1}})(),h={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}>`)},u=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,d=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,p=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,g=l(p).replace(/bull/g,d).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),m=l(p).replace(/bull/g,d).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),f=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,v=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,w=l(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",v).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),x=l(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,d).getRegex(),C="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",y=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,b=l("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",y).replace("tag",C).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),k=l(f).replace("hr",u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",C).getRegex(),_={blockquote:l(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",k).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:w,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:u,html:b,lheading:g,list:x,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:k,table:o,text:/^[^\n]+/},S=l("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",C).getRegex(),A={..._,lheading:m,table:S,paragraph:l(f).replace("hr",u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",S).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",C).getRegex()},I={..._,html:l("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",y).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:o,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:l(f).replace("hr",u).replace("heading",` *#{1,6} *[^
63
+ ]`).replace("lheading",g).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},M=/^( {2,}|\\)\n(?!\s*$)/,T=/[\p{P}\p{S}]/u,P=/[\s\p{P}\p{S}]/u,E=/[^\s\p{P}\p{S}]/u,j=l(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,P).getRegex(),R=/(?!~)[\p{P}\p{S}]/u,L=/(?![*_])[\p{P}\p{S}]/u,B=l(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",c?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),D=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,$=l(D,"u").replace(/punct/g,T).getRegex(),N=l(D,"u").replace(/punct/g,R).getRegex(),z="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",q=l(z,"gu").replace(/notPunctSpace/g,E).replace(/punctSpace/g,P).replace(/punct/g,T).getRegex(),F=l(z,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,R).getRegex(),U=l("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,E).replace(/punctSpace/g,P).replace(/punct/g,T).getRegex(),O=l(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,L).getRegex(),H=l("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)","gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|[*_])/u).replace(/punctSpace/g,/(?![*_])[\s\p{P}\p{S}]/u).replace(/punct/g,L).getRegex(),V=l(/\\(punct)/,"gu").replace(/punct/g,T).getRegex(),W=l(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),G=l(y).replace("(?:--\x3e|$)","--\x3e").getRegex(),K=l("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",G).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Q=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Z=l(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Q).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),J=l(/^!?\[(label)\]\[(ref)\]/).replace("label",Q).replace("ref",v).getRegex(),X=l(/^!?\[(ref)\](?:\[\])?/).replace("ref",v).getRegex(),Y=l("reflink|nolink(?!\\()","g").replace("reflink",J).replace("nolink",X).getRegex(),ee=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,et={_backpedal:o,anyPunctuation:V,autolink:W,blockSkip:B,br:M,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:o,delLDelim:o,delRDelim:o,emStrongLDelim:$,emStrongRDelimAst:q,emStrongRDelimUnd:U,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:Z,nolink:X,punctuation:j,reflink:J,reflinkSearch:Y,tag:K,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:o},es={...et,link:l(/^!?\[(label)\]\((.*?)\)/).replace("label",Q).getRegex(),reflink:l(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Q).getRegex()},ei={...et,emStrongRDelimAst:F,emStrongLDelim:N,delLDelim:O,delRDelim:H,url:l(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ee).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:l(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ee).getRegex()},en={...ei,br:l(M).replace("{2,}","*").getRegex(),text:l(ei.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},er={normal:_,gfm:A,pedantic:I},ea={normal:et,gfm:ei,breaks:en,pedantic:es},eo={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},el=e=>eo[e];function ec(e,t){if(t){if(h.escapeTest.test(e))return e.replace(h.escapeReplace,el)}else if(h.escapeTestNoEncode.test(e))return e.replace(h.escapeReplaceNoEncode,el);return e}function eh(e){try{e=encodeURI(e).replace(h.percentDecode,"%")}catch{return null}return e}function eu(e,t){let s=e.replace(h.findPipe,(e,t,s)=>{let i=!1,n=t;for(;--n>=0&&"\\"===s[n];)i=!i;return i?"|":" |"}).split(h.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(h.slashPipe,"|");return s}function ed(e,t,s){let i=e.length;if(0===i)return"";let n=0;for(;n<i;){let r=e.charAt(i-n-1);if(r!==t||s)if(r!==t&&s)n++;else break;else n++}return e.slice(0,i-n)}function ep(e,t,s,i,n){let r=t.href,a=t.title||null,o=e[1].replace(n.other.outputLinkReplace,"$1");i.state.inLink=!0;let l={type:"!"===e[0].charAt(0)?"image":"link",raw:s,href:r,title:a,text:o,tokens:i.inlineTokens(o)};return i.state.inLink=!1,l}var eg=class{space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:ed(e,`
64
64
  `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],s=function(e,t,s){let i=e.match(s.other.indentCodeCompensation);if(null===i)return t;let n=i[1];return t.split(`
65
65
  `).map(e=>{let t=e.match(s.other.beginningSpace);if(null===t)return e;let[i]=t;return i.length>=n.length?e.slice(n.length):e}).join(`
66
66
  `)}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=ed(e,"#");(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:ed(t[0],`
@@ -116,5 +116,5 @@ ${this.parser.parse(e)}</blockquote>
116
116
  `}tablerow({text:e}){return`<tr>
117
117
  ${e}</tr>
118
118
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),s=e.header?"th":"td";return(e.align?`<${s} align="${e.align}">`:`<${s}>`)+t+`</${s}>
119
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${ec(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:s}){let i=this.parser.parseInline(s),n=eh(e);if(null===n)return i;let r='<a href="'+(e=n)+'"';return t&&(r+=' title="'+ec(t)+'"'),r+=">"+i+"</a>"}image({href:e,title:t,text:s,tokens:i}){i&&(s=this.parser.parseInline(i,this.parser.textRenderer));let n=eh(e);if(null===n)return ec(s);e=n;let r=`<img src="${e}" alt="${ec(s)}"`;return t&&(r+=` title="${ec(t)}"`),r+=">"}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:ec(e.text)}constructor(e){i(this,"options",void 0),i(this,"parser",void 0),this.options=e||a}},ev=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},eC=class e{static parse(t,s){return new e(s).parse(t)}static parseInline(t,s){return new e(s).parseInline(t)}parse(e){let t="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==e||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(i.type)){t+=e||"";continue}}switch(i.type){case"space":t+=this.renderer.space(i);break;case"hr":t+=this.renderer.hr(i);break;case"heading":t+=this.renderer.heading(i);break;case"code":t+=this.renderer.code(i);break;case"table":t+=this.renderer.table(i);break;case"blockquote":t+=this.renderer.blockquote(i);break;case"list":t+=this.renderer.list(i);break;case"checkbox":t+=this.renderer.checkbox(i);break;case"html":t+=this.renderer.html(i);break;case"def":t+=this.renderer.def(i);break;case"paragraph":t+=this.renderer.paragraph(i);break;case"text":t+=this.renderer.text(i);break;default:{let e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return"";throw Error(e)}}}return t}parseInline(e,t=this.renderer){let s="";for(let i=0;i<e.length;i++){let n=e[i];if(this.options.extensions?.renderers?.[n.type]){let e=this.options.extensions.renderers[n.type].call({parser:this},n);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){s+=e||"";continue}}switch(n.type){case"escape":case"text":s+=t.text(n);break;case"html":s+=t.html(n);break;case"link":s+=t.link(n);break;case"image":s+=t.image(n);break;case"checkbox":s+=t.checkbox(n);break;case"strong":s+=t.strong(n);break;case"em":s+=t.em(n);break;case"codespan":s+=t.codespan(n);break;case"br":s+=t.br(n);break;case"del":s+=t.del(n);break;default:{let e='Token with "'+n.type+'" type was not found.';if(this.options.silent)return"";throw Error(e)}}}return s}constructor(e){i(this,"options",void 0),i(this,"renderer",void 0),i(this,"textRenderer",void 0),this.options=e||a,this.options.renderer=this.options.renderer||new ef,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ev}},ew=(r=class{preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?em.lex:em.lexInline}provideParser(){return this.block?eC.parse:eC.parseInline}constructor(e){i(this,"options",void 0),i(this,"block",void 0),this.options=e||a}},i(r,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),i(r,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),r),ex=new class{walkTokens(e,t){let s=[];for(let i of e)switch(s=s.concat(t.call(this,i)),i.type){case"table":for(let e of i.header)s=s.concat(this.walkTokens(e.tokens,t));for(let e of i.rows)for(let i of e)s=s.concat(this.walkTokens(i.tokens,t));break;case"list":s=s.concat(this.walkTokens(i.items,t));break;default:{let e=i;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(i=>{let n=e[i].flat(1/0);s=s.concat(this.walkTokens(n,t))}):e.tokens&&(s=s.concat(this.walkTokens(e.tokens,t)))}}return s}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let s={...e};if(s.async=this.defaults.async||s.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error("extension name required");if("renderer"in e){let s=t.renderers[e.name];s?t.renderers[e.name]=function(...t){let i=e.renderer.apply(this,t);return!1===i&&(i=s.apply(this,t)),i}:t.renderers[e.name]=e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw Error("extension level must be 'block' or 'inline'");let s=t[e.level];s?s.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),s.extensions=t),e.renderer){let t=this.defaults.renderer||new ef(this.defaults);for(let s in e.renderer){if(!(s in t))throw Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let i=e.renderer[s],n=t[s];t[s]=(...e)=>{let s=i.apply(t,e);return!1===s&&(s=n.apply(t,e)),s||""}}s.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new eg(this.defaults);for(let s in e.tokenizer){if(!(s in t))throw Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let i=e.tokenizer[s],n=t[s];t[s]=(...e)=>{let s=i.apply(t,e);return!1===s&&(s=n.apply(t,e)),s}}s.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new ew;for(let s in e.hooks){if(!(s in t))throw Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let i=e.hooks[s],n=t[s];ew.passThroughHooks.has(s)?t[s]=e=>{if(this.defaults.async&&ew.passThroughHooksRespectAsync.has(s))return(async()=>{let s=await i.call(t,e);return n.call(t,s)})();let r=i.call(t,e);return n.call(t,r)}:t[s]=(...e)=>{if(this.defaults.async)return(async()=>{let s=await i.apply(t,e);return!1===s&&(s=await n.apply(t,e)),s})();let s=i.apply(t,e);return!1===s&&(s=n.apply(t,e)),s}}s.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,i=e.walkTokens;s.walkTokens=function(e){let s=[];return s.push(i.call(this,e)),t&&(s=s.concat(t.call(this,e))),s}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return em.lex(e,t??this.defaults)}parser(e,t){return eC.parse(e,t??this.defaults)}parseMarkdown(e){return(t,s)=>{let i={...s},n={...this.defaults,...i},r=this.onError(!!n.silent,!!n.async);if(!0===this.defaults.async&&!1===i.async)return r(Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||null===t)return r(Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return r(Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=e),n.async)return(async()=>{let s=n.hooks?await n.hooks.preprocess(t):t,i=await (n.hooks?await n.hooks.provideLexer():e?em.lex:em.lexInline)(s,n),r=n.hooks?await n.hooks.processAllTokens(i):i;n.walkTokens&&await Promise.all(this.walkTokens(r,n.walkTokens));let a=await (n.hooks?await n.hooks.provideParser():e?eC.parse:eC.parseInline)(r,n);return n.hooks?await n.hooks.postprocess(a):a})().catch(r);try{n.hooks&&(t=n.hooks.preprocess(t));let s=(n.hooks?n.hooks.provideLexer():e?em.lex:em.lexInline)(t,n);n.hooks&&(s=n.hooks.processAllTokens(s)),n.walkTokens&&this.walkTokens(s,n.walkTokens);let i=(n.hooks?n.hooks.provideParser():e?eC.parse:eC.parseInline)(s,n);return n.hooks&&(i=n.hooks.postprocess(i)),i}catch(e){return r(e)}}}onError(e,t){return s=>{if(s.message+=`
120
- Please report this to https://github.com/markedjs/marked.`,e){let e="<p>An error occurred:</p><pre>"+ec(s.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(s);throw s}}constructor(...e){i(this,"defaults",n()),i(this,"options",this.setOptions),i(this,"parse",this.parseMarkdown(!0)),i(this,"parseInline",this.parseMarkdown(!1)),i(this,"Parser",eC),i(this,"Renderer",ef),i(this,"TextRenderer",ev),i(this,"Lexer",em),i(this,"Tokenizer",eg),i(this,"Hooks",ew),this.use(...e)}};function ey(e,t){return ex.parse(e,t)}ey.options=ey.setOptions=function(e){return ex.setOptions(e),ey.defaults=ex.defaults,a=ey.defaults,ey},ey.getDefaults=n,ey.defaults=a,ey.use=function(...e){return ex.use(...e),ey.defaults=ex.defaults,a=ey.defaults,ey},ey.walkTokens=function(e,t){return ex.walkTokens(e,t)},ey.parseInline=ex.parseInline,ey.Parser=eC,ey.parser=eC.parse,ey.Renderer=ef,ey.TextRenderer=ev,ey.Lexer=em,ey.lexer=em.lex,ey.Tokenizer=eg,ey.Hooks=ew,ey.parse=ey,ey.options,ey.setOptions,ey.use,ey.walkTokens,ey.parseInline,eC.parse,em.lex}},function(e){return e(e.s=41810)}])});
119
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${ec(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:s}){let i=this.parser.parseInline(s),n=eh(e);if(null===n)return i;let r='<a href="'+(e=n)+'"';return t&&(r+=' title="'+ec(t)+'"'),r+=">"+i+"</a>"}image({href:e,title:t,text:s,tokens:i}){i&&(s=this.parser.parseInline(i,this.parser.textRenderer));let n=eh(e);if(null===n)return ec(s);e=n;let r=`<img src="${e}" alt="${ec(s)}"`;return t&&(r+=` title="${ec(t)}"`),r+=">"}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:ec(e.text)}constructor(e){i(this,"options",void 0),i(this,"parser",void 0),this.options=e||a}},ev=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},ew=class e{static parse(t,s){return new e(s).parse(t)}static parseInline(t,s){return new e(s).parseInline(t)}parse(e){let t="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==e||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(i.type)){t+=e||"";continue}}switch(i.type){case"space":t+=this.renderer.space(i);break;case"hr":t+=this.renderer.hr(i);break;case"heading":t+=this.renderer.heading(i);break;case"code":t+=this.renderer.code(i);break;case"table":t+=this.renderer.table(i);break;case"blockquote":t+=this.renderer.blockquote(i);break;case"list":t+=this.renderer.list(i);break;case"checkbox":t+=this.renderer.checkbox(i);break;case"html":t+=this.renderer.html(i);break;case"def":t+=this.renderer.def(i);break;case"paragraph":t+=this.renderer.paragraph(i);break;case"text":t+=this.renderer.text(i);break;default:{let e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return"";throw Error(e)}}}return t}parseInline(e,t=this.renderer){let s="";for(let i=0;i<e.length;i++){let n=e[i];if(this.options.extensions?.renderers?.[n.type]){let e=this.options.extensions.renderers[n.type].call({parser:this},n);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){s+=e||"";continue}}switch(n.type){case"escape":case"text":s+=t.text(n);break;case"html":s+=t.html(n);break;case"link":s+=t.link(n);break;case"image":s+=t.image(n);break;case"checkbox":s+=t.checkbox(n);break;case"strong":s+=t.strong(n);break;case"em":s+=t.em(n);break;case"codespan":s+=t.codespan(n);break;case"br":s+=t.br(n);break;case"del":s+=t.del(n);break;default:{let e='Token with "'+n.type+'" type was not found.';if(this.options.silent)return"";throw Error(e)}}}return s}constructor(e){i(this,"options",void 0),i(this,"renderer",void 0),i(this,"textRenderer",void 0),this.options=e||a,this.options.renderer=this.options.renderer||new ef,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ev}},ex=(r=class{preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?em.lex:em.lexInline}provideParser(){return this.block?ew.parse:ew.parseInline}constructor(e){i(this,"options",void 0),i(this,"block",void 0),this.options=e||a}},i(r,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),i(r,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),r),eC=new class{walkTokens(e,t){let s=[];for(let i of e)switch(s=s.concat(t.call(this,i)),i.type){case"table":for(let e of i.header)s=s.concat(this.walkTokens(e.tokens,t));for(let e of i.rows)for(let i of e)s=s.concat(this.walkTokens(i.tokens,t));break;case"list":s=s.concat(this.walkTokens(i.items,t));break;default:{let e=i;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(i=>{let n=e[i].flat(1/0);s=s.concat(this.walkTokens(n,t))}):e.tokens&&(s=s.concat(this.walkTokens(e.tokens,t)))}}return s}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let s={...e};if(s.async=this.defaults.async||s.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error("extension name required");if("renderer"in e){let s=t.renderers[e.name];s?t.renderers[e.name]=function(...t){let i=e.renderer.apply(this,t);return!1===i&&(i=s.apply(this,t)),i}:t.renderers[e.name]=e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw Error("extension level must be 'block' or 'inline'");let s=t[e.level];s?s.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),s.extensions=t),e.renderer){let t=this.defaults.renderer||new ef(this.defaults);for(let s in e.renderer){if(!(s in t))throw Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let i=e.renderer[s],n=t[s];t[s]=(...e)=>{let s=i.apply(t,e);return!1===s&&(s=n.apply(t,e)),s||""}}s.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new eg(this.defaults);for(let s in e.tokenizer){if(!(s in t))throw Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let i=e.tokenizer[s],n=t[s];t[s]=(...e)=>{let s=i.apply(t,e);return!1===s&&(s=n.apply(t,e)),s}}s.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new ex;for(let s in e.hooks){if(!(s in t))throw Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let i=e.hooks[s],n=t[s];ex.passThroughHooks.has(s)?t[s]=e=>{if(this.defaults.async&&ex.passThroughHooksRespectAsync.has(s))return(async()=>{let s=await i.call(t,e);return n.call(t,s)})();let r=i.call(t,e);return n.call(t,r)}:t[s]=(...e)=>{if(this.defaults.async)return(async()=>{let s=await i.apply(t,e);return!1===s&&(s=await n.apply(t,e)),s})();let s=i.apply(t,e);return!1===s&&(s=n.apply(t,e)),s}}s.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,i=e.walkTokens;s.walkTokens=function(e){let s=[];return s.push(i.call(this,e)),t&&(s=s.concat(t.call(this,e))),s}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return em.lex(e,t??this.defaults)}parser(e,t){return ew.parse(e,t??this.defaults)}parseMarkdown(e){return(t,s)=>{let i={...s},n={...this.defaults,...i},r=this.onError(!!n.silent,!!n.async);if(!0===this.defaults.async&&!1===i.async)return r(Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||null===t)return r(Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return r(Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=e),n.async)return(async()=>{let s=n.hooks?await n.hooks.preprocess(t):t,i=await (n.hooks?await n.hooks.provideLexer():e?em.lex:em.lexInline)(s,n),r=n.hooks?await n.hooks.processAllTokens(i):i;n.walkTokens&&await Promise.all(this.walkTokens(r,n.walkTokens));let a=await (n.hooks?await n.hooks.provideParser():e?ew.parse:ew.parseInline)(r,n);return n.hooks?await n.hooks.postprocess(a):a})().catch(r);try{n.hooks&&(t=n.hooks.preprocess(t));let s=(n.hooks?n.hooks.provideLexer():e?em.lex:em.lexInline)(t,n);n.hooks&&(s=n.hooks.processAllTokens(s)),n.walkTokens&&this.walkTokens(s,n.walkTokens);let i=(n.hooks?n.hooks.provideParser():e?ew.parse:ew.parseInline)(s,n);return n.hooks&&(i=n.hooks.postprocess(i)),i}catch(e){return r(e)}}}onError(e,t){return s=>{if(s.message+=`
120
+ Please report this to https://github.com/markedjs/marked.`,e){let e="<p>An error occurred:</p><pre>"+ec(s.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(s);throw s}}constructor(...e){i(this,"defaults",n()),i(this,"options",this.setOptions),i(this,"parse",this.parseMarkdown(!0)),i(this,"parseInline",this.parseMarkdown(!1)),i(this,"Parser",ew),i(this,"Renderer",ef),i(this,"TextRenderer",ev),i(this,"Lexer",em),i(this,"Tokenizer",eg),i(this,"Hooks",ex),this.use(...e)}};function ey(e,t){return eC.parse(e,t)}ey.options=ey.setOptions=function(e){return eC.setOptions(e),ey.defaults=eC.defaults,a=ey.defaults,ey},ey.getDefaults=n,ey.defaults=a,ey.use=function(...e){return eC.use(...e),ey.defaults=eC.defaults,a=ey.defaults,ey},ey.walkTokens=function(e,t){return eC.walkTokens(e,t)},ey.parseInline=eC.parseInline,ey.Parser=ew,ey.parser=ew.parse,ey.Renderer=ef,ey.TextRenderer=ev,ey.Lexer=em,ey.lexer=em.lex,ey.Tokenizer=eg,ey.Hooks=ex,ey.parse=ey,ey.options,ey.setOptions,ey.use,ey.walkTokens,ey.parseInline,ew.parse,em.lex}},function(e){return e(e.s=41810)}])});