jodit-pro 4.11.22 → 4.11.23

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 (300) hide show
  1. package/es2015/jodit.css +1 -1
  2. package/es2015/jodit.fat.min.js +3 -3
  3. package/es2015/jodit.js +190 -2
  4. package/es2015/jodit.min.js +2 -2
  5. package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
  6. package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.js +2 -2
  7. package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.min.js +2 -2
  8. package/es2015/plugins/autocomplete/autocomplete.js +1 -1
  9. package/es2015/plugins/autocomplete/autocomplete.min.js +1 -1
  10. package/es2015/plugins/backup/backup.css +1 -1
  11. package/es2015/plugins/backup/backup.js +1 -1
  12. package/es2015/plugins/backup/backup.min.js +1 -1
  13. package/es2015/plugins/button-generator/button-generator.css +1 -1
  14. package/es2015/plugins/button-generator/button-generator.js +1 -1
  15. package/es2015/plugins/button-generator/button-generator.min.js +1 -1
  16. package/es2015/plugins/change-case/change-case.js +1 -1
  17. package/es2015/plugins/change-case/change-case.min.js +1 -1
  18. package/es2015/plugins/color-picker/color-picker.css +1 -1
  19. package/es2015/plugins/color-picker/color-picker.js +1 -1
  20. package/es2015/plugins/color-picker/color-picker.min.js +1 -1
  21. package/es2015/plugins/emoji/emoji.css +1 -1
  22. package/es2015/plugins/emoji/emoji.js +1 -1
  23. package/es2015/plugins/emoji/emoji.min.js +1 -1
  24. package/es2015/plugins/export-docs/export-docs.js +1 -1
  25. package/es2015/plugins/export-docs/export-docs.min.js +1 -1
  26. package/es2015/plugins/finder/finder.css +1 -1
  27. package/es2015/plugins/finder/finder.js +1 -1
  28. package/es2015/plugins/finder/finder.min.js +1 -1
  29. package/es2015/plugins/google-maps/google-maps.css +1 -1
  30. package/es2015/plugins/google-maps/google-maps.js +1 -1
  31. package/es2015/plugins/google-maps/google-maps.min.js +1 -1
  32. package/es2015/plugins/google-search/google-search.js +1 -1
  33. package/es2015/plugins/google-search/google-search.min.js +1 -1
  34. package/es2015/plugins/highlight-signature/highlight-signature.js +1 -1
  35. package/es2015/plugins/highlight-signature/highlight-signature.min.js +1 -1
  36. package/es2015/plugins/iframe-editor/iframe-editor.css +1 -1
  37. package/es2015/plugins/iframe-editor/iframe-editor.js +1 -1
  38. package/es2015/plugins/iframe-editor/iframe-editor.min.js +1 -1
  39. package/es2015/plugins/keyboard/keyboard.css +1 -1
  40. package/es2015/plugins/keyboard/keyboard.js +1 -1
  41. package/es2015/plugins/keyboard/keyboard.min.js +1 -1
  42. package/es2015/plugins/mobile-view/mobile-view.js +1 -1
  43. package/es2015/plugins/mobile-view/mobile-view.min.js +1 -1
  44. package/es2015/plugins/page-break/page-break.js +1 -1
  45. package/es2015/plugins/page-break/page-break.min.js +1 -1
  46. package/es2015/plugins/paste-code/paste-code.css +1 -1
  47. package/es2015/plugins/paste-code/paste-code.js +1 -1
  48. package/es2015/plugins/paste-code/paste-code.min.js +1 -1
  49. package/es2015/plugins/paste-from-word/paste-from-word.js +1 -1
  50. package/es2015/plugins/paste-from-word/paste-from-word.min.js +1 -1
  51. package/es2015/plugins/show-blocks/show-blocks.js +1 -1
  52. package/es2015/plugins/show-blocks/show-blocks.min.js +1 -1
  53. package/es2015/plugins/style/style.css +1 -1
  54. package/es2015/plugins/style/style.js +1 -1
  55. package/es2015/plugins/style/style.min.js +1 -1
  56. package/es2015/plugins/templates/templates.css +1 -1
  57. package/es2015/plugins/templates/templates.js +1 -1
  58. package/es2015/plugins/templates/templates.min.js +1 -1
  59. package/es2015/plugins/todo-list/todo-list.css +1 -1
  60. package/es2015/plugins/todo-list/todo-list.js +1 -1
  61. package/es2015/plugins/todo-list/todo-list.min.js +1 -1
  62. package/es2015/plugins/translate/translate.css +1 -1
  63. package/es2015/plugins/translate/translate.js +1 -1
  64. package/es2015/plugins/translate/translate.min.js +1 -1
  65. package/es2015/plugins/tune-block/tune-block.css +1 -1
  66. package/es2015/plugins/tune-block/tune-block.js +1 -1
  67. package/es2015/plugins/tune-block/tune-block.min.js +1 -1
  68. package/es2018/jodit.fat.min.js +3 -3
  69. package/es2018/jodit.min.js +2 -2
  70. package/es2018/plugins/ai-assistant-pro/ai-assistant-pro.min.js +2 -2
  71. package/es2018/plugins/autocomplete/autocomplete.min.js +1 -1
  72. package/es2018/plugins/backup/backup.min.js +1 -1
  73. package/es2018/plugins/button-generator/button-generator.min.js +1 -1
  74. package/es2018/plugins/change-case/change-case.min.js +1 -1
  75. package/es2018/plugins/color-picker/color-picker.min.js +1 -1
  76. package/es2018/plugins/emoji/emoji.min.js +1 -1
  77. package/es2018/plugins/export-docs/export-docs.min.js +1 -1
  78. package/es2018/plugins/finder/finder.min.js +1 -1
  79. package/es2018/plugins/google-maps/google-maps.min.js +1 -1
  80. package/es2018/plugins/google-search/google-search.min.js +1 -1
  81. package/es2018/plugins/highlight-signature/highlight-signature.min.js +1 -1
  82. package/es2018/plugins/iframe-editor/iframe-editor.min.js +1 -1
  83. package/es2018/plugins/keyboard/keyboard.min.js +1 -1
  84. package/es2018/plugins/mobile-view/mobile-view.min.js +1 -1
  85. package/es2018/plugins/page-break/page-break.min.js +1 -1
  86. package/es2018/plugins/paste-code/paste-code.min.js +1 -1
  87. package/es2018/plugins/paste-from-word/paste-from-word.min.js +1 -1
  88. package/es2018/plugins/show-blocks/show-blocks.min.js +1 -1
  89. package/es2018/plugins/style/style.min.js +1 -1
  90. package/es2018/plugins/templates/templates.min.js +1 -1
  91. package/es2018/plugins/todo-list/todo-list.min.js +1 -1
  92. package/es2018/plugins/translate/translate.min.js +1 -1
  93. package/es2018/plugins/tune-block/tune-block.min.js +1 -1
  94. package/es2021/jodit.css +1 -1
  95. package/es2021/jodit.fat.min.js +8 -4
  96. package/es2021/jodit.js +102 -2
  97. package/es2021/jodit.min.js +7 -3
  98. package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
  99. package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.js +2 -2
  100. package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.min.js +2 -2
  101. package/es2021/plugins/autocomplete/autocomplete.js +1 -1
  102. package/es2021/plugins/autocomplete/autocomplete.min.js +1 -1
  103. package/es2021/plugins/backup/backup.css +1 -1
  104. package/es2021/plugins/backup/backup.js +1 -1
  105. package/es2021/plugins/backup/backup.min.js +1 -1
  106. package/es2021/plugins/button-generator/button-generator.css +1 -1
  107. package/es2021/plugins/button-generator/button-generator.js +1 -1
  108. package/es2021/plugins/button-generator/button-generator.min.js +1 -1
  109. package/es2021/plugins/change-case/change-case.js +1 -1
  110. package/es2021/plugins/change-case/change-case.min.js +1 -1
  111. package/es2021/plugins/color-picker/color-picker.css +1 -1
  112. package/es2021/plugins/color-picker/color-picker.js +1 -1
  113. package/es2021/plugins/color-picker/color-picker.min.js +1 -1
  114. package/es2021/plugins/emoji/emoji.css +1 -1
  115. package/es2021/plugins/emoji/emoji.js +1 -1
  116. package/es2021/plugins/emoji/emoji.min.js +1 -1
  117. package/es2021/plugins/export-docs/export-docs.js +1 -1
  118. package/es2021/plugins/export-docs/export-docs.min.js +1 -1
  119. package/es2021/plugins/finder/finder.css +1 -1
  120. package/es2021/plugins/finder/finder.js +1 -1
  121. package/es2021/plugins/finder/finder.min.js +1 -1
  122. package/es2021/plugins/google-maps/google-maps.css +1 -1
  123. package/es2021/plugins/google-maps/google-maps.js +1 -1
  124. package/es2021/plugins/google-maps/google-maps.min.js +1 -1
  125. package/es2021/plugins/google-search/google-search.js +1 -1
  126. package/es2021/plugins/google-search/google-search.min.js +1 -1
  127. package/es2021/plugins/highlight-signature/highlight-signature.js +1 -1
  128. package/es2021/plugins/highlight-signature/highlight-signature.min.js +1 -1
  129. package/es2021/plugins/iframe-editor/iframe-editor.css +1 -1
  130. package/es2021/plugins/iframe-editor/iframe-editor.js +1 -1
  131. package/es2021/plugins/iframe-editor/iframe-editor.min.js +1 -1
  132. package/es2021/plugins/keyboard/keyboard.css +1 -1
  133. package/es2021/plugins/keyboard/keyboard.js +1 -1
  134. package/es2021/plugins/keyboard/keyboard.min.js +1 -1
  135. package/es2021/plugins/mobile-view/mobile-view.js +1 -1
  136. package/es2021/plugins/mobile-view/mobile-view.min.js +1 -1
  137. package/es2021/plugins/page-break/page-break.js +1 -1
  138. package/es2021/plugins/page-break/page-break.min.js +1 -1
  139. package/es2021/plugins/paste-code/paste-code.css +1 -1
  140. package/es2021/plugins/paste-code/paste-code.js +1 -1
  141. package/es2021/plugins/paste-code/paste-code.min.js +1 -1
  142. package/es2021/plugins/paste-from-word/paste-from-word.js +1 -1
  143. package/es2021/plugins/paste-from-word/paste-from-word.min.js +1 -1
  144. package/es2021/plugins/show-blocks/show-blocks.js +1 -1
  145. package/es2021/plugins/show-blocks/show-blocks.min.js +1 -1
  146. package/es2021/plugins/style/style.css +1 -1
  147. package/es2021/plugins/style/style.js +1 -1
  148. package/es2021/plugins/style/style.min.js +1 -1
  149. package/es2021/plugins/templates/templates.css +1 -1
  150. package/es2021/plugins/templates/templates.js +1 -1
  151. package/es2021/plugins/templates/templates.min.js +1 -1
  152. package/es2021/plugins/todo-list/todo-list.css +1 -1
  153. package/es2021/plugins/todo-list/todo-list.js +1 -1
  154. package/es2021/plugins/todo-list/todo-list.min.js +1 -1
  155. package/es2021/plugins/translate/translate.css +1 -1
  156. package/es2021/plugins/translate/translate.js +1 -1
  157. package/es2021/plugins/translate/translate.min.js +1 -1
  158. package/es2021/plugins/tune-block/tune-block.css +1 -1
  159. package/es2021/plugins/tune-block/tune-block.js +1 -1
  160. package/es2021/plugins/tune-block/tune-block.min.js +1 -1
  161. package/es2021.en/jodit.css +1 -1
  162. package/es2021.en/jodit.fat.min.js +9 -5
  163. package/es2021.en/jodit.js +102 -2
  164. package/es2021.en/jodit.min.js +11 -7
  165. package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
  166. package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.js +2 -2
  167. package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.min.js +2 -2
  168. package/es2021.en/plugins/autocomplete/autocomplete.js +1 -1
  169. package/es2021.en/plugins/autocomplete/autocomplete.min.js +1 -1
  170. package/es2021.en/plugins/backup/backup.css +1 -1
  171. package/es2021.en/plugins/backup/backup.js +1 -1
  172. package/es2021.en/plugins/backup/backup.min.js +1 -1
  173. package/es2021.en/plugins/button-generator/button-generator.css +1 -1
  174. package/es2021.en/plugins/button-generator/button-generator.js +1 -1
  175. package/es2021.en/plugins/button-generator/button-generator.min.js +1 -1
  176. package/es2021.en/plugins/change-case/change-case.js +1 -1
  177. package/es2021.en/plugins/change-case/change-case.min.js +1 -1
  178. package/es2021.en/plugins/color-picker/color-picker.css +1 -1
  179. package/es2021.en/plugins/color-picker/color-picker.js +1 -1
  180. package/es2021.en/plugins/color-picker/color-picker.min.js +1 -1
  181. package/es2021.en/plugins/emoji/emoji.css +1 -1
  182. package/es2021.en/plugins/emoji/emoji.js +1 -1
  183. package/es2021.en/plugins/emoji/emoji.min.js +1 -1
  184. package/es2021.en/plugins/export-docs/export-docs.js +1 -1
  185. package/es2021.en/plugins/export-docs/export-docs.min.js +1 -1
  186. package/es2021.en/plugins/finder/finder.css +1 -1
  187. package/es2021.en/plugins/finder/finder.js +1 -1
  188. package/es2021.en/plugins/finder/finder.min.js +1 -1
  189. package/es2021.en/plugins/google-maps/google-maps.css +1 -1
  190. package/es2021.en/plugins/google-maps/google-maps.js +1 -1
  191. package/es2021.en/plugins/google-maps/google-maps.min.js +1 -1
  192. package/es2021.en/plugins/google-search/google-search.js +1 -1
  193. package/es2021.en/plugins/google-search/google-search.min.js +1 -1
  194. package/es2021.en/plugins/highlight-signature/highlight-signature.js +1 -1
  195. package/es2021.en/plugins/highlight-signature/highlight-signature.min.js +1 -1
  196. package/es2021.en/plugins/iframe-editor/iframe-editor.css +1 -1
  197. package/es2021.en/plugins/iframe-editor/iframe-editor.js +1 -1
  198. package/es2021.en/plugins/iframe-editor/iframe-editor.min.js +1 -1
  199. package/es2021.en/plugins/keyboard/keyboard.css +1 -1
  200. package/es2021.en/plugins/keyboard/keyboard.js +1 -1
  201. package/es2021.en/plugins/keyboard/keyboard.min.js +1 -1
  202. package/es2021.en/plugins/mobile-view/mobile-view.js +1 -1
  203. package/es2021.en/plugins/mobile-view/mobile-view.min.js +1 -1
  204. package/es2021.en/plugins/page-break/page-break.js +1 -1
  205. package/es2021.en/plugins/page-break/page-break.min.js +1 -1
  206. package/es2021.en/plugins/paste-code/paste-code.css +1 -1
  207. package/es2021.en/plugins/paste-code/paste-code.js +1 -1
  208. package/es2021.en/plugins/paste-code/paste-code.min.js +1 -1
  209. package/es2021.en/plugins/paste-from-word/paste-from-word.js +1 -1
  210. package/es2021.en/plugins/paste-from-word/paste-from-word.min.js +1 -1
  211. package/es2021.en/plugins/show-blocks/show-blocks.js +1 -1
  212. package/es2021.en/plugins/show-blocks/show-blocks.min.js +1 -1
  213. package/es2021.en/plugins/style/style.css +1 -1
  214. package/es2021.en/plugins/style/style.js +1 -1
  215. package/es2021.en/plugins/style/style.min.js +1 -1
  216. package/es2021.en/plugins/templates/templates.css +1 -1
  217. package/es2021.en/plugins/templates/templates.js +1 -1
  218. package/es2021.en/plugins/templates/templates.min.js +1 -1
  219. package/es2021.en/plugins/todo-list/todo-list.css +1 -1
  220. package/es2021.en/plugins/todo-list/todo-list.js +1 -1
  221. package/es2021.en/plugins/todo-list/todo-list.min.js +1 -1
  222. package/es2021.en/plugins/translate/translate.css +1 -1
  223. package/es2021.en/plugins/translate/translate.js +1 -1
  224. package/es2021.en/plugins/translate/translate.min.js +1 -1
  225. package/es2021.en/plugins/tune-block/tune-block.css +1 -1
  226. package/es2021.en/plugins/tune-block/tune-block.js +1 -1
  227. package/es2021.en/plugins/tune-block/tune-block.min.js +1 -1
  228. package/es5/jodit.css +2 -2
  229. package/es5/jodit.fat.min.js +2 -2
  230. package/es5/jodit.js +293 -2
  231. package/es5/jodit.min.css +2 -2
  232. package/es5/jodit.min.js +2 -2
  233. package/es5/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
  234. package/es5/plugins/ai-assistant-pro/ai-assistant-pro.js +2 -2
  235. package/es5/plugins/ai-assistant-pro/ai-assistant-pro.min.js +2 -2
  236. package/es5/plugins/autocomplete/autocomplete.js +1 -1
  237. package/es5/plugins/autocomplete/autocomplete.min.js +1 -1
  238. package/es5/plugins/backup/backup.css +1 -1
  239. package/es5/plugins/backup/backup.js +1 -1
  240. package/es5/plugins/backup/backup.min.js +1 -1
  241. package/es5/plugins/button-generator/button-generator.css +1 -1
  242. package/es5/plugins/button-generator/button-generator.js +1 -1
  243. package/es5/plugins/button-generator/button-generator.min.js +1 -1
  244. package/es5/plugins/change-case/change-case.js +1 -1
  245. package/es5/plugins/change-case/change-case.min.js +1 -1
  246. package/es5/plugins/color-picker/color-picker.css +1 -1
  247. package/es5/plugins/color-picker/color-picker.js +1 -1
  248. package/es5/plugins/color-picker/color-picker.min.js +1 -1
  249. package/es5/plugins/emoji/emoji.css +1 -1
  250. package/es5/plugins/emoji/emoji.js +1 -1
  251. package/es5/plugins/emoji/emoji.min.js +1 -1
  252. package/es5/plugins/export-docs/export-docs.js +1 -1
  253. package/es5/plugins/export-docs/export-docs.min.js +1 -1
  254. package/es5/plugins/finder/finder.css +1 -1
  255. package/es5/plugins/finder/finder.js +1 -1
  256. package/es5/plugins/finder/finder.min.js +1 -1
  257. package/es5/plugins/google-maps/google-maps.css +1 -1
  258. package/es5/plugins/google-maps/google-maps.js +1 -1
  259. package/es5/plugins/google-maps/google-maps.min.js +1 -1
  260. package/es5/plugins/google-search/google-search.js +1 -1
  261. package/es5/plugins/google-search/google-search.min.js +1 -1
  262. package/es5/plugins/highlight-signature/highlight-signature.js +1 -1
  263. package/es5/plugins/highlight-signature/highlight-signature.min.js +1 -1
  264. package/es5/plugins/iframe-editor/iframe-editor.css +1 -1
  265. package/es5/plugins/iframe-editor/iframe-editor.js +1 -1
  266. package/es5/plugins/iframe-editor/iframe-editor.min.js +1 -1
  267. package/es5/plugins/keyboard/keyboard.css +1 -1
  268. package/es5/plugins/keyboard/keyboard.js +1 -1
  269. package/es5/plugins/keyboard/keyboard.min.js +1 -1
  270. package/es5/plugins/mobile-view/mobile-view.js +1 -1
  271. package/es5/plugins/mobile-view/mobile-view.min.js +1 -1
  272. package/es5/plugins/page-break/page-break.js +1 -1
  273. package/es5/plugins/page-break/page-break.min.js +1 -1
  274. package/es5/plugins/paste-code/paste-code.css +1 -1
  275. package/es5/plugins/paste-code/paste-code.js +1 -1
  276. package/es5/plugins/paste-code/paste-code.min.js +1 -1
  277. package/es5/plugins/paste-from-word/paste-from-word.js +1 -1
  278. package/es5/plugins/paste-from-word/paste-from-word.min.js +1 -1
  279. package/es5/plugins/show-blocks/show-blocks.js +1 -1
  280. package/es5/plugins/show-blocks/show-blocks.min.js +1 -1
  281. package/es5/plugins/style/style.css +1 -1
  282. package/es5/plugins/style/style.js +1 -1
  283. package/es5/plugins/style/style.min.js +1 -1
  284. package/es5/plugins/templates/templates.css +1 -1
  285. package/es5/plugins/templates/templates.js +1 -1
  286. package/es5/plugins/templates/templates.min.js +1 -1
  287. package/es5/plugins/todo-list/todo-list.css +1 -1
  288. package/es5/plugins/todo-list/todo-list.js +1 -1
  289. package/es5/plugins/todo-list/todo-list.min.js +1 -1
  290. package/es5/plugins/translate/translate.css +1 -1
  291. package/es5/plugins/translate/translate.js +1 -1
  292. package/es5/plugins/translate/translate.min.js +1 -1
  293. package/es5/plugins/tune-block/tune-block.css +1 -1
  294. package/es5/plugins/tune-block/tune-block.js +1 -1
  295. package/es5/plugins/tune-block/tune-block.min.js +1 -1
  296. package/es5/polyfills.fat.min.js +1 -1
  297. package/es5/polyfills.js +1 -1
  298. package/es5/polyfills.min.js +1 -1
  299. package/esm/plugins/ai-assistant-pro/core/block-utils.js +1 -1
  300. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1618,7 +1618,7 @@ if (jodit_esm_config__WEBPACK_IMPORTED_MODULE_12__.Config.prototype.tuneBlock) {
1618
1618
  * Resolve block element either by selector or by index within the editor root.
1619
1619
  * Throws descriptive errors for invalid input or missing elements.
1620
1620
  */ function resolveBlock(jodit, { selector, index, requireExactlyOne = false } = {}) {
1621
- const hasSelector = selector != null;
1621
+ const hasSelector = selector != null && selector.trim() !== '';
1622
1622
  const hasIndex = index != null;
1623
1623
  if (requireExactlyOne && hasSelector === hasIndex) {
1624
1624
  throw new Error('Either index or selector must be provided, but not both');
@@ -1,13 +1,13 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
8
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 u=t();for(var n in u)("object"==typeof exports?exports:e)[n]=u[n]}}(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,u){"use strict";u.d(t,{UIRange:function(){return F}});var n=u(82749),s=u(56075),i=u(11886),r=u(31635),o=u(65478),a=u(21537),l=u(67510);class F extends l.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 u=this.j.create.div(this.getFullElName("log")),n=this.getElm("label");n&&n.appendChild(u)}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:u,step:n=1}=this.state,s=(e.clientX-this.startX)/this.width*(this.state.max-this.state.min),i=this.startValue+s;i<t&&(i=t),i>u&&(i=u),i=Math.round(i/n)*n,this.value=i.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 u=this.getElm("log");(0,a.assert)(null!=u,"log element does not exist"),u.innerText=t.toString()}destruct(){return this.onDragEnd(),super.destruct()}constructor(e,t){super(e,(0,i._)((0,s._)({},t),{type:"hidden"})),(0,n._)(this,"state",(0,i._)((0,s._)({},l.UIInput.defaultState),{min:0,max:100,step:1})),(0,n._)(this,"startValue",0),(0,n._)(this,"startX",0),(0,n._)(this,"width",100),Object.assign(this.state,t),this.appendUIRange(),this.onChangeSelfValue()}}(0,r.__decorate)([(0,o.watch)(["handle:mousedown","handle:touchstart"])],F.prototype,"onDragStart",null),(0,r.__decorate)([o.autobind],F.prototype,"onDrag",null),(0,r.__decorate)([(0,o.watch)(["j.ow:mouseup","j.ow:touchend"])],F.prototype,"onDragEnd",null),(0,r.__decorate)([(0,o.watch)(":change")],F.prototype,"onChangeSelfValue",null),F=(0,r.__decorate)([o.component],F)},41810:function(e,t,u){"use strict";u.r(t),u.d(t,{aiAssistantPro:function(){return x}});var n=u(77688),s=u(82749),i=u(56075),r=u(11886),o=u(31635);u(66645);var a=u(86449),l=u(21020),F=u(46166),c=u(62895),h=u(55487),d=u(27769),p=u(58579),A=u(63805),C=u(82758),E=u(65478),D=u(580),g=u(21537),B=u(50911),f=u(2692),m=u(18549),v=u(54747);class x extends B.Plugin{get state(){return this.stateManager.state}get toolRegistry(){return new h.ToolRegistry(this.j)}get permissionManager(){return new l.PermissionManager(this.j,this.toolRegistry)}get apiClient(){return new a.APIClient(this.j,this.toolRegistry)}get storage(){let{storage:e,storageKey:t,maxConversations:u}=this.j.o.aiAssistantPro;if("string"==typeof e){let n=(0,c.createStorageProvider)(e,t);return new c.WebStorageConversationStorage(n,u)}return e}get stateManager(){return new F.StateManager(this.j)}get mainPanel(){return new d.UIMainPanel(this.j,this.stateManager.state,this.j.o.aiAssistantPro,e=>{let t=this.stateManager.getCurrentConversation();t&&this.stateManager.setCurrentConversation((0,i._)({},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}afterInit(){(0,D.extendLang)(A),this.setupEventListeners(),this.j.async.promise(e=>{let{initiallyOpened:t,persistOpenState:u}=this.j.o.aiAssistantPro,n=t;u?this.storage.getGlobalSettings().then(e=>{if((null==e?void 0:e.isOpen)!=null&&(n=e.isOpen),n)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)}loadInitialData(){return(0,n._)(function*(){this.mainPanel.setMod("ready",!0),yield(0,p.loadInitialData)(this.j,this.storage,this.stateManager),yield this.restorePendingToolCalls()}).call(this)}restorePendingToolCalls(){return(0,n._)(function*(){let e=this.stateManager.getCurrentConversation();if(!e)return;let t=(0,p.findMessagesWithPendingToolCalls)(e);if(0!==t.length)for(let e of t)yield this.handleToolCalls(e.id)}).call(this)}setupEventListeners(){this.j.e.on("selectConversation.ai-assistant-pro",e=>(0,n._)(function*(){try{yield this.__loadData(),yield(0,p.handleConversationSelect)(e,this.storage,this.stateManager)}catch(e){C.IS_PROD}}).call(this)),this.j.e.on("newConversation.ai-assistant-pro",()=>(0,n._)(function*(){yield this.__loadData();let e=(0,p.createNewConversation)(this.j,this.state.defaultModel,this.state.defaultTemperature);this.stateManager.setCurrentConversation(e)}).call(this)),this.j.e.on("deleteConversation.ai-assistant-pro",e=>(0,n._)(function*(){yield this.__loadData(),yield this.deleteConversation(e)}).call(this)),this.j.e.on("renameConversation.ai-assistant-pro",(e,t)=>(0,n._)(function*(){yield this.__loadData(),yield this.renameConversation(e,t)}).call(this)),this.j.e.on("backToList.ai-assistant-pro",()=>(0,n._)(function*(){yield this.__loadData(),yield(0,p.handleBackToList)(this.storage,this.stateManager)}).call(this)),this.j.e.on("removeContext.ai-assistant-pro",e=>(0,n._)(function*(){yield this.__loadData(),this.stateManager.removeSelectionContext(e)}).call(this)),this.j.e.on("approveToolCall.ai-assistant-pro",(e,t)=>(0,n._)(function*(){try{yield this.__loadData();let u=yield(0,p.handleToolApproval)(e,t,this.stateManager,this.permissionManager,this.storage);if(u){let e=this.stateManager.getCurrentConversation();if(!e)return;let t=e.messages.find(e=>{var t;return null==(t=e.toolCalls)?void 0:t.some(e=>e.id===u.id)});if(!t)return;yield this.executeToolCall(t.id,u)}}catch(e){if((0,g.isAbortError)(e))return;this.stateManager.setError(e instanceof Error?e.message:String(e))}}).call(this)),this.j.e.on("denyToolCall.ai-assistant-pro",e=>(0,n._)(function*(){yield this.__loadData(),yield(0,p.handleToolDenial)(this.j,e,this.stateManager,this.storage)}).call(this)),this.j.e.on("abortRequest.ai-assistant-pro",()=>(0,n._)(function*(){yield this.__loadData(),this.apiClient.abort(),this.stateManager.setLoading(!1)}).call(this))}__applyTheme(){(0,p.applyTheme)(this.j,this.stateManager.state.theme,this.stateManager.state.displayMode,this.mainPanel.container,this.dialog)}openAssistant(){return(0,n._)(function*(){if(this.stateManager.isOpen()){this.stateManager.close(),yield this.__closeInContainer();return}yield this.__loadData(),this.isDestructed||(this.stateManager.open(),yield this.__openInContainer(),this.j.o.aiAssistantPro.includeSelectionByDefault&&!this.j.s.isCollapsed()&&this.addCurrentSelectionToContext())}).call(this)}__openInContainer(){return(0,n._)(function*(){let{resizable:e,allowClose:t,flightPanelHeight:u}=this.j.o.aiAssistantPro,{displayMode:n="right",panelWidth:s,panelHeight:i}=this.stateManager.state;switch(this.__applyTheme(),this.mainPanel.setMod("displayMode",n),this.mainPanel.setMod("allowClose",t),this.mainPanel.setParentView("dialog"===n||"flight"===n?this.dialog:this.j),this.__openedMode=n,n){case"dialog":this.dialog.setSize(s,i).open().setContent(this.mainPanel.container);break;case"flight":m.UIFlightPosition.install(this.mainPanel,this.j.container,{panelHeight:u,containerClassName:this.getFullElName("flight-container")});break;default:e&&(v.UIResize.remove(this.mainPanel),v.UIResize.install(this.mainPanel,(0,p.invertMode)(n),{handleClassName:this.getFullElName("ai-assistent-resize-handle"),onResize:({newSize:e})=>{let t="left"===n||"right"===n?e:s,u="top"===n||"bottom"===n?e:i;return this.stateManager.state.panelWidth=t,this.stateManager.state.panelHeight=u,!0}})),this.j.currentPlace.slots[n].appendChild(this.mainPanel.container),(0,p.resizeInPanelView)(this.j,n,s,i)}}).call(this)}__onResizeInPanelView(){let{displayMode:e,panelWidth:t,panelHeight:u}=this.stateManager.state;(0,p.resizeInPanelView)(this.j,e,t,u)}__closeInContainer(){return(0,n._)(function*(){let{displayMode:e}=yield 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()}}).call(this)}__closeFlightMode(){m.UIFlightPosition.remove(this.mainPanel)}__onSavedStateChange(){var e;let t=this.stateManager.state;return this.storage.saveGlobalSettings((0,i._)({displayMode:t.displayMode,panelWidth:t.panelWidth,panelHeight:t.panelHeight,theme:t.theme,defaultModel:t.defaultModel,defaultTemperature:t.defaultTemperature,currentConversationId:null==(e=t.currentConversation)?void 0:e.id},this.j.o.aiAssistantPro.persistOpenState?{isOpen:t.isOpen}:{}))}closeAssistant(){return(0,n._)(function*(){this.stateManager.isOpen()&&(yield this.__loadData(),this.stateManager.close(),this.__closeInContainer())}).call(this)}addCurrentSelectionToContext(){return(0,n._)(function*(){yield this.__loadData();let e=(0,p.getCurrentSelectionContext)(this.j);e&&this.stateManager.addSelectionContext(e)}).call(this)}executeQuickCommand(e){return(0,n._)(function*(){let t,{quickCommandsSilentMode:u,quickCommandsDisplayMode:n}=this.j.o.aiAssistantPro,s=this.j.o.aiAssistant;if(s&&s[e]&&(0,g.isString)(s[e])&&(t=s[e]),!t)return void this.j.e.fire("error",`Command not found: ${e}`);let i=this.j.s.isCollapsed()?this.j.value:this.j.s.html;if(!i)return;let r=(null==s?void 0:s.aiCommonPrefixPrompt)||"",o=(null==s?void 0:s.aiCommonSuffixPrompt)||"",a=`${r}${t}${o}
9
9
 
10
- ${i}`.trim();u?yield this.__executeQuickCommandSilent(a,i):yield this.__executeQuickCommandWithPanel(a,n)}).call(this)}__executeQuickCommandSilent(e,t){return(0,n._)(function*(){yield this.__loadData(),this.j.progressbar.show().progress(100);try{let t=(0,p.createUserMessage)(e),u=(0,p.createNewConversation)(this.j,this.state.defaultModel,this.state.defaultTemperature,[t]),n=yield this.apiClient.sendRequest(u.id,u.messages,null,[],u.options);if("final"===n.mode){let e=n.response.content;e&&this.j.s.insertHTML(e)}}catch(e){(0,g.isAbortError)(e)||this.j.e.fire("error",e)}finally{this.j.progressbar.hide()}}).call(this)}__executeQuickCommandWithPanel(e,t){return(0,n._)(function*(){yield this.__loadData();let u=this.stateManager.state.displayMode;this.stateManager.state.displayMode=t;let n=(0,p.getCurrentSelectionContext)(this.j);n&&this.stateManager.addSelectionContext(n),this.stateManager.isOpen()||(yield this.openAssistant()),yield this.sendMessage(e),this.stateManager.state.displayMode=u}).call(this)}sendMessage(e){return(0,n._)(function*(){yield this.__loadData();let t=this.stateManager.getCurrentConversation(),u=this.stateManager.getEditingMessageId();if(u&&t){let e=t.messages.findIndex(e=>e.id===u);if(-1!==e){let u=t.messages.slice(0,e),n=(0,r._)((0,i._)({},t),{messages:u,updatedAt:Date.now()});this.stateManager.setCurrentConversation(n),yield this.storage.save(n),this.stateManager.clearEditingMessage(),t=n}}t||(t=(0,p.createNewConversation)(this.j,this.state.defaultModel,this.state.defaultTemperature),this.stateManager.setCurrentConversation(t));let n=null;e.trim()&&(n=(0,p.createUserMessage)(e),t.title||(t=(0,r._)((0,i._)({},t),{title:e})),t=(0,r._)((0,i._)({},t),{updated:Date.now(),messages:[...t.messages,n]})),this.stateManager.setCurrentConversation((0,i._)({},t)),n&&this.j.e.fire("messageSent.ai-assistant-pro",n),this.stateManager.setLoading(!0),this.stateManager.clearError();try{yield this.sendRequestToAI(0),this.stateManager.clearSelectionContexts()}catch(e){if((0,g.isAbortError)(e))return;this.stateManager.setError(e instanceof Error?e.message:String(e))}finally{this.stateManager.setLoading(!1)}}).call(this)}sendRequestToAI(e=0){return(0,n._)(function*(){let t,u,n=this.j.o.aiAssistantPro.maxRecursionToolCallDepth;if(e>=n)throw Error(`Max recursion depth ${n} reached for tool calls`);let s=this.stateManager.getCurrentConversation();if(!s)return;let r=(0,p.findParentMessageId)(s),[o]=yield Promise.all([this.apiClient.sendRequest(s.id,s.messages,r,this.stateManager.getSelectionContexts(),s.options),this.storage.save(s)]);if("stream"===o.mode){let e=yield(0,p.processStreamingResponse)(this.stateManager,o,s);t=e.aiMessage,u=e.index,s=e.conversation}else{let e=(0,p.processFinalResponse)(o,s);t=e.aiMessage,u=e.index,s=e.conversation}s=yield(0,p.processArtifacts)(this.j,t,s,u),this.j.e.fire("messageReceived.ai-assistant-pro",t),this.stateManager.setCurrentConversation((0,i._)({},s)),yield this.storage.save(s),yield this.handleToolCalls(t.id,e)}).call(this)}deleteConversation(e){return(0,n._)(function*(){yield this.__loadData(),yield(0,p.deleteConversationWithCleanup)(this.j,e,this.storage,this.stateManager,this.permissionManager)}).call(this)}renameConversation(e,t){return(0,n._)(function*(){var u;let n=yield this.storage.get(e);if(!n)return;let s=(0,r._)((0,i._)({},n),{title:t,updated:Date.now()});yield this.storage.save(s),(null==(u=this.state.currentConversation)?void 0:u.id)===e&&this.stateManager.setCurrentConversation(s);let o=yield this.storage.list();this.stateManager.setConversations(o)}).call(this)}searchConversations(e){return(0,n._)(function*(){yield this.__loadData(),yield(0,p.handleConversationSearch)(e,this.storage,this.stateManager)}).call(this)}handleToolCalls(e,t=0){return(0,n._)(function*(){let u=this.stateManager.getCurrentConversation();if(!u)return;let n=u.messages.find(t=>t.id===e);if(!n)return;let s=n.toolCalls;if(!s||0===s.length)return;let i=s.filter(e=>!(0,p.isTerminalToolCallStatus)(e.status));if(0===i.length)return;let{approved:r,needsPermission:o}=this.permissionManager.filterToolCalls(i,u.permissions);for(let u of(this.stateManager.setPendingToolCalls(o),r))yield this.executeToolCall(e,u,t)}).call(this)}executeToolCall(e,t,u=0){return(0,n._)(function*(){let n=this.stateManager.getCurrentConversation();if(!n)return;let s=yield(0,p.executeToolCall)(this.j,t,this.toolRegistry),o=n.messages.findIndex(t=>t.id===e);if(-1===o)return;let a=n.messages[o],l=n.messages.slice();l[o]=(0,p.updateToolCallInMessage)(a,s),n=(0,r._)((0,i._)({},n),{messages:l,updated:Date.now()}),this.stateManager.setCurrentConversation(n),(0,p.areAllToolCallsExecuted)(n)&&(yield this.sendRequestToAI(u+1))}).call(this)}copyMessage(e){return(0,n._)(function*(){let t=this.stateManager.getCurrentConversation();if(!t)return;let u=t.messages.find(t=>t.id===e);if(u)try{yield navigator.clipboard.writeText(u.content),this.j.message.success("Message copied to clipboard")}catch(e){this.j.e.fire("error",Error("Failed to copy message"))}}).call(this)}restartFromMessage(e){return(0,n._)(function*(){let t=this.stateManager.getCurrentConversation();if(!t)return;let u=t.messages.findIndex(t=>t.id===e);if(-1===u)return;let n=t.messages[u];if("user"!==n.role)return;yield this.__loadData();let s=t.messages.slice(0,u),o=(0,r._)((0,i._)({},t),{messages:s,updatedAt:Date.now()});this.stateManager.setCurrentConversation(o),yield this.storage.save(o),yield this.sendMessage(n.content)}).call(this)}editMessage(e){return(0,n._)(function*(){let t=this.stateManager.getCurrentConversation();if(!t)return;let u=t.messages.find(t=>t.id===e);u&&"user"===u.role&&(this.stateManager.setEditingMessageId(e),this.mainPanel.inputArea.setValue(u.content),this.mainPanel.inputArea.focus())}).call(this)}cancelEditMessage(){this.stateManager.isEditingMessage()&&(this.stateManager.clearEditingMessage(),this.mainPanel.inputArea.setValue(""))}deleteMessage(e){return(0,n._)(function*(){yield this.__loadData();let t=this.stateManager.getCurrentConversation();if(!t||-1===t.messages.findIndex(t=>t.id===e))return;let u=t.messages.filter(t=>t.id!==e),n=(0,r._)((0,i._)({},t),{messages:u,updatedAt:Date.now()});this.stateManager.setCurrentConversation(n),yield this.storage.save(n)}).call(this)}beforeDestruct(){var e,t,u,n,s,i,r,o;this.__closeFlightMode(),null==(e=(0,E.cached)(this,"toolRegistry"))||e.destruct(),null==(t=(0,E.cached)(this,"permissionManager"))||t.destruct(),null==(u=(0,E.cached)(this,"apiClient"))||u.destruct(),null==(n=(0,E.cached)(this,"stateManager"))||n.destruct(),null==(s=(0,E.cached)(this,"mainPanel"))||s.destruct(),null==(i=(0,E.cached)(this,"dialog"))||i.destruct(),null==(o=(0,E.cached)(this,"storage"))||null==(r=o.close)||r.call(o)}constructor(...e){super(...e),(0,s._)(this,"buttons",[{name:"aiAssistantPro",group:"insert"},{name:"aiCommandsPro",group:"insert"}]),(0,s._)(this,"__initedPromise",null),(0,s._)(this,"__openedMode",null)}}(0,s._)(x,"requires",["license"]),(0,o.__decorate)([E.cache],x.prototype,"toolRegistry",null),(0,o.__decorate)([E.cache],x.prototype,"permissionManager",null),(0,o.__decorate)([E.cache],x.prototype,"apiClient",null),(0,o.__decorate)([E.cache],x.prototype,"storage",null),(0,o.__decorate)([E.cache],x.prototype,"stateManager",null),(0,o.__decorate)([E.cache],x.prototype,"mainPanel",null),(0,o.__decorate)([E.cache],x.prototype,"dialog",null),(0,o.__decorate)([(0,E.watch)("state.theme")],x.prototype,"__applyTheme",null),(0,o.__decorate)([(0,E.watch)(":openAIAssistantPro.ai-assistant-pro")],x.prototype,"openAssistant",null),(0,o.__decorate)([(0,E.watch)([":resize","state.panelWidth","state.panelHeight"])],x.prototype,"__onResizeInPanelView",null),(0,o.__decorate)([(0,E.watch)(["state.isOpen","state.displayMode","state.panelWidth","state.panelHeight","state.theme","state.defaultModel","state.defaultTemperature","state.currentConversation"]),(0,E.debounce)()],x.prototype,"__onSavedStateChange",null),(0,o.__decorate)([(0,E.watch)(":closeAIAssistantPro.ai-assistant-pro")],x.prototype,"closeAssistant",null),(0,o.__decorate)([(0,E.watch)(":addContextToAIAssistant.ai-assistant-pro")],x.prototype,"addCurrentSelectionToContext",null),(0,o.__decorate)([(0,E.watch)(":executeQuickCommand.ai-assistant-pro")],x.prototype,"executeQuickCommand",null),(0,o.__decorate)([(0,E.watch)(":sendMessage.ai-assistant-pro")],x.prototype,"sendMessage",null),(0,o.__decorate)([(0,E.watch)(":searchConversations.ai-assistant-pro")],x.prototype,"searchConversations",null),(0,o.__decorate)([(0,E.watch)(":copyMessage.ai-assistant-pro")],x.prototype,"copyMessage",null),(0,o.__decorate)([(0,E.watch)(":restartFromMessage.ai-assistant-pro")],x.prototype,"restartFromMessage",null),(0,o.__decorate)([(0,E.watch)(":editMessage.ai-assistant-pro")],x.prototype,"editMessage",null),(0,o.__decorate)([(0,E.watch)(":cancelEditMessage.ai-assistant-pro")],x.prototype,"cancelEditMessage",null),(0,o.__decorate)([(0,E.watch)(":deleteMessage.ai-assistant-pro")],x.prototype,"deleteMessage",null),x=(0,o.__decorate)([E.component],x),f.JoditPro.plugins.add("aiAssistantPro",x)},66645:function(e,t,u){"use strict";var n,s=u(77688),i=u(56075),r=u(11886),o=u(47373),a=u(94668),l=u.n(a),F=u(86428),c=u.n(F),h=u(75966),d=u.n(h),p=u(83207),A=u.n(p),C=u(99219),E=u.n(C),D=u(63674),g=u.n(D),B=u(4133),f=u.n(B),m=u(53835),v=u(6441),x=u(12153),y=u(31974),_=u(72573);x.Icon.set("ai-assistant-pro",c()).set("ai-commands-pro",d()).set("ai-add-context",l()).set("send",E()).set("tool-bolt",f()).set("chevron-right",A()).set("shield",g()),v.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,m.getToolNames)(),customTools:[],toolPermissions:{},autoApproveTools:["readDocument","readBlocks","readSelection","insertHTML"],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 u=new Date(e),n=new Date().getTime()-u.getTime();return n<6e4?t("Just now"):n<36e5?t("%dm ago",Math.floor(n/6e4)):n<864e5?t("%dh ago",Math.floor(n/36e5)):u.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})},formatMessageContent:(e,t)=>_.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,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,uploadBase64Artifact(e,t){return(0,s._)(function*(){if("image"===e.type&&e.data&&"base64"===e.data.kind)try{let u=(0,o.base64ToFile)(e.data.base64,e.id,e.mimeType),n=yield t.uploader.upload([u]);return(0,r._)((0,i._)({},e),{data:{kind:"url",url:n.baseurl+n.files[0]},metadata:(0,r._)((0,i._)({},e.metadata),{filename:n.files[0]})})}catch(e){t.e.fire("error",e)}return e})()}},v.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){return!e.o.aiAssistantPro.apiRequest},getLabel(e){return e.o.aiAssistantPro.apiRequest?"AI Assistant":"AI Assistant (not configured)"}},v.Config.prototype.controls.aiAddContext={icon:"ai-add-context",tooltip:"Add to AI Context",exec(e){e.e.fire("addContextToAIAssistant")},isDisabled(e){return!e.o.aiAssistantPro.apiRequest||e.s.isCollapsed()}},v.Config.prototype.controls.aiCommandsPro={icon:"ai-commands-pro",tooltip:"AI Commands",isDisabled(e){return!e.o.aiAssistantPro.apiRequest},list:y.aiAssitentCommands,exec(e,t,{control:u}){e.e.fire("executeQuickCommand.ai-assistant-pro",u.name)}};let w=(null==(n=v.Config.prototype.tuneBlock)?void 0:n.popup)||{},b={};["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=w[e]||["tune.up","tune.remove","tune.down"];b[e]=[...t,"|","aiAddContext"]}),v.Config.prototype.tuneBlock&&(v.Config.prototype.tuneBlock.popup=(0,i._)({},w,b))},6689:function(e,t,u){"use strict";u.d(t,{throwIfAborted:function(){return s}});var n=u(93661);function s(e){if(e.aborted)throw(0,n.abort)()}},61872:function(e,t,u){"use strict";u.d(t,{processArtifacts:function(){return F},processFinalResponse:function(){return l},processStreamingResponse:function(){return a}});var n=u(89929),s=u(77688),i=u(56075),r=u(11886),o=u(61558);function a(e,t,u){return(0,s._)(function*(){let s=(0,o.createAIMessage)(),a=-1;var l,F=!1,c=!1;try{for(var h,d=(0,n._)(t.stream);F=!(h=yield d.next()).done;F=!1){let t=h.value;switch(t.type){case"created":s=(0,r._)((0,i._)({},s),{id:t.response.responseId,content:""}),a=u.messages.length;break;case"text-delta":s=(0,r._)((0,i._)({},s),{content:s.content+t.delta});break;case"completed":s=(0,r._)((0,i._)({},s),{id:t.response.responseId,toolCalls:t.response.toolCalls||[],artifacts:t.response.artifacts||[]});break;case"error":{let e=(0,o.createErrorMessage)(t.error);s=(0,r._)((0,i._)({},s),{id:e.id,content:e.content})}}if(s.id){let t=u.messages.slice();t[a>=0?a:u.messages.length]=s,u=(0,r._)((0,i._)({},u),{messages:t,updated:Date.now()}),e.setCurrentConversation(u)}}}catch(e){c=!0,l=e}finally{try{F&&null!=d.return&&(yield d.return())}finally{if(c)throw l}}return{aiMessage:s,index:a,conversation:u}})()}function l(e,t){let u=(0,r._)((0,i._)({},(0,o.createAIMessage)()),{id:e.response.responseId,content:e.response.content,toolCalls:e.response.toolCalls||[],artifacts:e.response.artifacts||[]}),n=t.messages.slice();return n.push(u),{aiMessage:u,index:(t=(0,r._)((0,i._)({},t),{messages:n,updated:Date.now()})).messages.length-1,conversation:t}}function F(e,t,u,n){return(0,s._)(function*(){if(t.artifacts&&t.artifacts.length>0){let s=u.messages.slice();return s[n]=(0,r._)((0,i._)({},s[n]),{artifacts:yield(0,o.uploadArtifacts)(e,t.artifacts)}),(0,r._)((0,i._)({},u),{messages:s,updated:Date.now()})}return u})()}},49459:function(e,t,u){"use strict";function n(e,t,u={}){let s=e[t];if("string"!=typeof s||!u.allowEmpty&&""===s)throw Error(`Parameter "${t}" is required and must be a${u.allowEmpty?"":" non-empty"} string`);return s}u.d(t,{requireString:function(){return n}})},44526:function(e,t,u){"use strict";u.d(t,{resolveBlock:function(){return s}});var n=u(22732);function s(e,{selector:t,index:u,requireExactlyOne:i=!1}={}){let r=null!=t,o=null!=u;if(i&&r===o)throw Error("Either index or selector must be provided, but not both");if(!r&&!o)throw Error("Block identifier is required");if(r){if("string"!=typeof t)throw Error("Selector must be a string");let u=e.editor.querySelector(t);if(!u)throw Error(`No element found matching selector "${t}"`);if(!n.Dom.isElement(u))throw Error(`Selector "${t}" does not point to an element node`);return{element:u,identifier:`with selector "${t}"`}}if("number"!=typeof u)throw Error("Block index must be a number");let a=Array.from(e.editor.children);if(u<0||u>=a.length)throw Error(`Block index ${u} is out of range. Document has ${a.length} blocks`);let l=a[u];if(!n.Dom.isElement(l))throw Error(`Block at index ${u} is not a valid element`);return{element:l,identifier:`at index ${u}`}}},70308:function(e,t,u){"use strict";u.d(t,{areAllToolCallsExecuted:function(){return a},createNewConversation:function(){return s},findMessagesWithPendingToolCalls:function(){return l},findParentMessageId:function(){return i},isTerminalToolCallStatus:function(){return o}});var n=u(21064);function s(e,t,u,i=[]){let r=e.o.aiAssistantPro,o={id:(0,n.generateConversationId)(),created:Date.now(),updated:Date.now(),messages:i,permissions:[],options:{model:null!=t?t:r.defaultModel,temperature:null!=u?u:r.defaultTemperature}};return e.e.fire("conversationCreated.ai-assistant-pro",o),o}function i(e){for(let t=e.messages.length-1;t>=0;t--){let u=e.messages[t];if("assistant"===u.role&&!u.id.startsWith("error_"))return u.id}return null}let r=new Set(["executed","denied","error"]);function o(e){return r.has(e)}function a(e){let t=e.messages[e.messages.length-1];return!!(null==t?void 0:t.toolCalls)&&t.toolCalls.every(e=>o(e.status))}function l(e){return e.messages.filter(e=>e.toolCalls&&e.toolCalls.length>0&&e.toolCalls.some(e=>!o(e.status)))}},473:function(e,t,u){"use strict";u.d(t,{handleBackToList:function(){return c},handleConversationSearch:function(){return h},handleConversationSelect:function(){return F},handleToolApproval:function(){return a},handleToolDenial:function(){return l}});var n=u(77688),s=u(56075),i=u(11886),r=u(79078),o=u(82758);function a(e,t,u,r,o){return(0,n._)(function*(){let n=u.getPendingToolCalls().find(t=>t.id===e);if(!n)return null;let a=r.grantPermission(n.name,t),l=u.getCurrentConversation();return l&&(l.permissions.push(a),yield o.save(l)),u.removePendingToolCall(e),(0,i._)((0,s._)({},n),{status:"approved"})})()}function l(e,t,u,o){return(0,n._)(function*(){let n=u.getPendingToolCalls().find(e=>e.id===t);if(!n)return;let a=u.getCurrentConversation();if(!a)return;let l=a.messages.findIndex(e=>{var u;return null==(u=e.toolCalls)?void 0:u.find(e=>e.id===t)});if(-1===l)return;let F=a.messages[l],c=(0,i._)((0,s._)({},n),{result:{error:"Tool call denied by user."},status:"denied"}),h=(0,r.updateToolCallInMessage)(F,c),d=[...a.messages];d[l]=h,a=(0,i._)((0,s._)({},a),{messages:d,updated:Date.now()}),u.setCurrentConversation(a),yield o.save(a),e.e.fire("toolCallDenied.ai-assistant-pro",n),u.removePendingToolCall(t)})()}function F(e,t,u){return(0,n._)(function*(){try{u.setLoading(!0);let n=yield t.get(e);if(!n)throw Error("Conversation not found: "+e);u.setCurrentConversation((0,s._)({},n))}catch(e){o.IS_PROD}finally{u.setLoading(!1)}})()}function c(e,t){return(0,n._)(function*(){t.setView("conversationList");try{t.setLoading(!0);let u=yield e.list().catch(()=>[]);t.setConversations(u)}finally{t.setLoading(!1)}})()}function h(e,t,u){return(0,n._)(function*(){u.setLoading(!0);try{let n=yield t.list(e||void 0);u.setConversations(n),u.setView("conversationList")}finally{u.setLoading(!1)}})()}},58579:function(e,t,u){"use strict";u.d(t,{applyTheme:function(){return F.applyTheme},areAllToolCallsExecuted:function(){return s.areAllToolCallsExecuted},createNewConversation:function(){return s.createNewConversation},createUserMessage:function(){return r.createUserMessage},deleteConversationWithCleanup:function(){return l.deleteConversationWithCleanup},executeToolCall:function(){return c.executeToolCall},findMessagesWithPendingToolCalls:function(){return s.findMessagesWithPendingToolCalls},findParentMessageId:function(){return s.findParentMessageId},getCurrentSelectionContext:function(){return a.getCurrentSelectionContext},handleBackToList:function(){return i.handleBackToList},handleConversationSearch:function(){return i.handleConversationSearch},handleConversationSelect:function(){return i.handleConversationSelect},handleToolApproval:function(){return i.handleToolApproval},handleToolDenial:function(){return i.handleToolDenial},invertMode:function(){return o.invertMode},isTerminalToolCallStatus:function(){return s.isTerminalToolCallStatus},loadInitialData:function(){return l.loadInitialData},processArtifacts:function(){return n.processArtifacts},processFinalResponse:function(){return n.processFinalResponse},processStreamingResponse:function(){return n.processStreamingResponse},resizeInPanelView:function(){return o.resizeInPanelView},updateToolCallInMessage:function(){return c.updateToolCallInMessage}});var n=u(61872),s=u(70308),i=u(473),r=u(61558),o=u(71050),a=u(15927),l=u(56110),F=u(53014),c=u(79078)},61558:function(e,t,u){"use strict";u.d(t,{createAIMessage:function(){return r},createErrorMessage:function(){return o},createUserMessage:function(){return i},uploadArtifacts:function(){return a}});var n=u(77688),s=u(21064);function i(e){return{id:(0,s.generateMessageId)(),role:"user",content:e,timestamp:Date.now()}}function r(){return{id:"",role:"assistant",content:"",artifacts:[],timestamp:Date.now(),toolCalls:[]}}function o(e){return{id:"error_"+(0,s.generateMessageId)(),role:"assistant",content:`❌ Error: ${e.message}`,timestamp:Date.now(),toolCalls:[],artifacts:[]}}function a(e,t){return(0,n._)(function*(){if(!t||0===t.length)return t;let u=e.o.aiAssistantPro.uploadBase64Artifact;return u?Promise.all(t.map(t=>(0,n._)(function*(){var n;return null!=(n=u(t,e))?n:t})())):t})()}},71050:function(e,t,u){"use strict";u.d(t,{invertMode:function(){return s},resizeInPanelView:function(){return i}});var n=u(41180);function s(e){switch(e){case"left":return"right";case"right":return"left";case"top":return"bottom";case"bottom":return"top"}}function i(e,t,u,i){var r,o,a,l;if("dialog"===t||"flight"===t)return;("left"===t||"right"===t)&&(null==(a=e.currentPlace.slots[s(t)])||a.style.setProperty(`--jd-slot-${s(t)}-width`,"auto"),null==(l=e.currentPlace.slots[t])||l.style.setProperty(`--jd-slot-${t}-width`,`${u}px`));let F=null!=(r=(0,n.css)(e.currentPlace.workplace,"height"))?r:0;null==(o=e.currentPlace.slots[t])||o.style.setProperty("min-height",`${Math.min(F,i)}px`)}},15927:function(e,t,u){"use strict";function n(e){if(e.s.isCollapsed())return null;let t=e.s.html,u=e.s.range;return{html:t,rangeInfo:{startContainer:u.startContainer.nodeName,startOffset:u.startOffset,endContainer:u.endContainer.nodeName,endOffset:u.endOffset}}}u.d(t,{getCurrentSelectionContext:function(){return n}})},56110:function(e,t,u){"use strict";u.d(t,{deleteConversationWithCleanup:function(){return i},loadInitialData:function(){return r}});var n=u(77688),s=u(82758);function i(e,t,u,s,i){return(0,n._)(function*(){try{s.setLoading(!0),yield u.delete(t),s.removeConversation(t),i.clearConversationPermissions(t);let n=s.getCurrentConversation();(null==n?void 0:n.id)===t&&s.setCurrentConversation(null);let r=yield u.list();s.setConversations(r),s.setView(0===r.length?"welcome":"conversationList"),e.e.fire("conversationDeleted.ai-assistant-pro",t)}catch(t){e.alert(e.i18n("Failed to delete conversation")+": "+((null==t?void 0:t.message)||"Unknown error"))}finally{s.setLoading(!1)}})()}function r(e,t,u){return(0,n._)(function*(){u.setLoading(!0);try{let[s,i]=yield Promise.all([t.list().catch(()=>[]),t.getGlobalSettings().catch(()=>null)]);if(u.setConversations(s),i&&u.setSavedState(i),0===s.length)u.setView("welcome");else if(e.o.aiAssistantPro.rememberLastConversation&&(null==i?void 0:i.currentConversationId)){var n;let e=null!=(n=s.find(e=>e.id===i.currentConversationId))?n:s[0],r=yield t.get(e.id);r?u.setCurrentConversation(r):u.setView("conversationList")}else u.setView("conversationList")}catch(e){s.IS_PROD,u.setView("welcome")}finally{u.setLoading(!1)}})()}},53014:function(e,t,u){"use strict";u.d(t,{applyTheme:function(){return i}});let n=["jodit_theme_dark","jodit-ai-assistant-pro_theme_dark","jodit-dialog_theme_dark"],s=["jodit_theme_light","jodit-ai-assistant-pro_theme_light","jodit-dialog_theme_light"];function i(e,t,u,i,r){let o;if(null==i||i.classList.remove(...n),null==i||i.classList.remove(...s),"dialog"===u){let e=null==r?void 0:r.container;null==e||e.classList.remove(...n),null==e||e.classList.remove(...s)}if(o="dark"===t?n:s,null==i||i.classList.add(...o),"dialog"===u){let e=null==r?void 0:r.container;null==e||e.classList.add(...o)}}},79078:function(e,t,u){"use strict";u.d(t,{executeToolCall:function(){return r},updateToolCallInMessage:function(){return o}});var n=u(77688),s=u(56075),i=u(11886);function r(e,t,u){return(0,n._)(function*(){let n;try{let e=new AbortController().signal,r=yield u.executeTool(t.name,t.arguments,e);n=(0,i._)((0,s._)({},t),{result:{result:r},status:"executed"})}catch(u){n=(0,i._)((0,s._)({},t),{result:{error:u instanceof Error?u.message:String(u)},status:"error"}),e.e.fire("toolCallFailed.ai-assistant-pro",n)}return e.e.fire("toolCallExecuted.ai-assistant-pro",n,{toolCallId:n.id,result:n.result}),n})()}function o(e,t){var u,n;let r=null==(n=e.toolCalls)?void 0:n.findIndex(e=>e.id===t.id);if(null==r||-1===r)return e;let o=[...null!=(u=null==e?void 0:e.toolCalls)?u:[]];return o[r]=t,(0,i._)((0,s._)({},e),{toolCalls:o})}},86449:function(e,t,u){"use strict";u.d(t,{APIClient:function(){return l}});var n=u(77688),s=u(82749),i=u(56075),r=u(11886),o=u(82758),a=u(21537);class l{sendRequest(e,t,u,s,i){return(0,n._)(function*(){let{apiRequest:n,requestTimeout:r,maxRetries:l}=this.jodit.o.aiAssistantPro;if(!n)throw Error("AI Assistant Pro callback is not configured");let F=new AbortController;this.abortControllers.add(F);try{let c=this.buildRequestContext(e,t,u,s,i),h=null;for(let e=0;l>=e;e++)try{if(F.signal.aborted)throw(0,a.abort)();let e=setTimeout(()=>{F.abort()},r);try{let t=yield n(c,F.signal);return clearTimeout(e),this.validateResponse(t),t}catch(t){throw clearTimeout(e),t}}catch(t){if(h=t,o.IS_PROD,l>e){let t=this.calculateRetryDelay(e);yield this.sleep(t)}else throw t}throw h||Error("API request failed after all retries")}finally{this.abortControllers.delete(F)}}).call(this)}abort(){this.abortControllers.forEach(e=>{e.abort()}),this.abortControllers.clear()}isInProgress(){return this.abortControllers.size>0}buildRequestContext(e,t,u,n,s){let o,{apiMode:a,instructions:l}=this.jodit.o.aiAssistantPro,F={mode:a,conversationId:e,tools:this.toolRegistry.getAllTools(),selectionContexts:n,conversationOptions:s,instructions:l};if("full"===a)o=t;else if(u){let e=t.findIndex(e=>e.id===u);o=-1!==e?t.slice(e+1):t,F=(0,r._)((0,i._)({},F),{parentMessageId:u})}else o=t;return(0,r._)((0,i._)({},F),{messages:this.expandToolMessages(o,t.find(e=>e.id===u))})}expandToolMessages(e,t){let u=[];for(let t of e)u.push(t),this.expandToolResultsMessage(t,u);return t&&this.expandToolResultsMessage(t,u),u}expandToolResultsMessage(e,t){if(e.toolCalls&&e.toolCalls.length>0)for(let n of e.toolCalls){var u;let s=null!=(u=n.result)?u:{error:"result not found"};if(t.find(e=>e.id===`${n.id}-result`))continue;let i={id:`${n.id}-result`,role:"tool",content:s.error?`Error: ${s.error}`:JSON.stringify(s.result),timestamp:e.timestamp,toolResults:[{toolCallId:n.id,result:s}]};t.push(i)}}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,s._)(this,"jodit",void 0),(0,s._)(this,"toolRegistry",void 0),(0,s._)(this,"abortControllers",void 0),this.jodit=e,this.toolRegistry=t,this.abortControllers=new Set}}},47373:function(e,t,u){"use strict";function n(e,t,u="image/png"){let s=atob(e),i=s.length,r=new Uint8Array(i);for(let e=0;i>e;e++)r[e]=s.charCodeAt(e);return new File([new Blob([r],{type:u})],t,{type:u})}u.d(t,{base64ToFile:function(){return n}})},21020:function(e,t,u){"use strict";u.d(t,{PermissionManager:function(){return r}});var n=u(82749),s=u(56075),i=u(11886);class r{requiresPermission(e){let{autoApproveTools:t,alwaysDenyTools:u}=this.jodit.o.aiAssistantPro;if(u.includes(e))return!0;if(t.includes(e))return!1;let n=this.toolRegistry.getTool(e);return!n||n.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 u=this.permanentPermissions.get(e);return u&&u.granted?u:t.find(t=>t.toolName===e&&t.granted)||null}grantPermission(e,t){let u={toolName:e,granted:!0,grantedAt:Date.now(),scope:t};return"forever"===t&&(this.permanentPermissions.set(e,u),this.savePermanentPermissions()),u}denyPermission(e){return{toolName:e,granted:!1,grantedAt:Date.now(),scope:"once"}}filterToolCalls(e,t){let u=[],n=[],r=[];for(let o of e){if(this.isAutoDenied(o.name)){r.push((0,i._)((0,s._)({},o),{status:"denied"}));continue}if(this.isAutoApproved(o.name)){u.push((0,i._)((0,s._)({},o),{status:"approved"}));continue}let e=this.checkPermission(o.name,t);e&&e.granted?u.push((0,i._)((0,s._)({},o),{status:"approved"})):this.requiresPermission(o.name)?(this.jodit.e.fire("permissionRequested.ai-assistant-pro",o.name),n.push((0,i._)((0,s._)({},o),{status:"pending"}))):u.push((0,i._)((0,s._)({},o),{status:"approved"}))}return{approved:u,needsPermission:n,denied:r}}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,n._)(this,"jodit",void 0),(0,n._)(this,"toolRegistry",void 0),(0,n._)(this,"permanentPermissions",void 0),(0,n._)(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,u){"use strict";u.d(t,{StateManager:function(){return r}});var n=u(82749),s=u(56075),i=u(11886);class r{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 u=this.state.pendingToolCalls.map(u=>u.id===e?(0,i._)((0,s._)({},u),{status:t}):u);this.setPendingToolCalls(u)}setSelectionContexts(e){this.state.selectionContexts=e}getSelectionContexts(){return this.state.selectionContexts}addSelectionContext(e){let{maxContextRanges:t}=this.jodit.o.aiAssistantPro,u=[...this.state.selectionContexts,e];u.length>t&&(u=u.slice(-t)),this.setSelectionContexts(u),this.jodit.e.fire("contextAdded.ai-assistant-pro",e)}removeSelectionContext(e){let t=this.state.selectionContexts.filter((t,u)=>u!==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,n._)(this,"jodit",void 0),(0,n._)(this,"state",void 0),this.jodit=e,this.state=this.createInitialState()}}},62895:function(e,t,u){"use strict";u.d(t,{WebStorageConversationStorage:function(){return n.WebStorageConversationStorage},createStorageProvider:function(){return n.createStorageProvider}});var n=u(21064)},21064:function(e,t,u){"use strict";u.d(t,{WebStorageConversationStorage:function(){return o},createStorageProvider:function(){return a},generateConversationId:function(){return l},generateMessageId:function(){return F}});var n=u(77688),s=u(82749),i=u(56075),r=u(97333);class o{close(){return this.storage.close()}getConversationKey(e){return`conv:${e}`}getAllKeys(){return(0,n._)(function*(){let e=yield this.storage.get("__conversation_index__");return e&&Array.isArray(e)?e:[]}).call(this)}updateIndex(e){return(0,n._)(function*(){yield this.storage.set("__conversation_index__",e)}).call(this)}addToIndex(e){return(0,n._)(function*(){let t=yield this.getAllKeys();t.includes(e)||(t.push(e),yield this.updateIndex(t))}).call(this)}removeFromIndex(e){return(0,n._)(function*(){let t=(yield this.getAllKeys()).filter(t=>t!==e);yield this.updateIndex(t)}).call(this)}list(e){return(0,n._)(function*(){try{let n=yield this.getAllKeys(),s=[],i=null==e?void 0:e.toLowerCase().trim();for(let e of n){var t,u;let n=yield this.get(e);if(n){if(i){let e=null==(u=n.title)?void 0:u.toLowerCase().includes(i),t=!e&&n.messages.some(e=>e.content.toLowerCase().includes(i));if(!e&&!t)continue}s.push({id:n.id,title:null!=(t=n.title)?t:"",created:n.created,updated:n.updated,messageCount:n.messages.length})}}return s.sort((e,t)=>t.updated-e.updated),s}catch(e){return[]}}).call(this)}get(e){return(0,n._)(function*(){try{let t=this.getConversationKey(e);return(yield this.storage.get(t))||null}catch(e){return null}}).call(this)}save(e){return(0,n._)(function*(){try{if(0===e.messages.length)throw Error("Conversation must have at least one message.");let t=yield this.getAllKeys();t.length>=this.maxConversations&&!t.includes(e.id)&&(yield this.evictOldest());let u=this.getConversationKey(e.id);yield this.storage.set(u,e),yield this.addToIndex(e.id)}catch(t){if((null==t?void 0:t.name)==="QuotaExceededError"||(null==t?void 0:t.code)===22||(null==t?void 0:t.code)===1014){yield this.evictOldest();try{let t=this.getConversationKey(e.id);yield this.storage.set(t,e),yield this.addToIndex(e.id)}catch(e){throw Error("Storage quota exceeded. Please delete some conversations.")}}else throw Error(`Failed to save conversation: ${(null==t?void 0:t.message)||"Unknown error"}`)}}).call(this)}delete(e){return(0,n._)(function*(){try{let t=this.getConversationKey(e);yield this.storage.delete(t),yield this.removeFromIndex(e)}catch(e){}}).call(this)}clear(){return(0,n._)(function*(){try{for(let e of yield this.getAllKeys()){let t=this.getConversationKey(e);yield this.storage.delete(t)}yield this.updateIndex([])}catch(e){}}).call(this)}evictOldest(){return(0,n._)(function*(){try{let e=yield this.list();if(0===e.length)return;e.sort((e,t)=>e.updated-t.updated);let t=e[0];yield this.delete(t.id)}catch(e){}}).call(this)}getGlobalSettings(){return(0,n._)(function*(){try{return(yield this.storage.get("global-settings"))||null}catch(e){return null}}).call(this)}saveGlobalSettings(e){return(0,n._)(function*(){try{let t=yield this.getGlobalSettings(),u=(0,i._)({},t,e);yield this.storage.set("global-settings",u)}catch(e){throw Error("Failed to save global settings")}}).call(this)}constructor(e,t){(0,s._)(this,"storage",void 0),(0,s._)(this,"maxConversations",void 0),this.storage=e,this.maxConversations=t}}function a(e,t){return r.AsyncStorage.makeStorage(e,t)}function l(){return`conv_${Date.now()}_${Math.random().toString(36).substring(2,11)}`}function F(){return`msg_${Date.now()}_${Math.random().toString(36).substring(2,11)}`}},55487:function(e,t,u){"use strict";u.d(t,{ToolRegistry:function(){return o}});var n=u(77688),s=u(82749),i=u(56075),r=u(53835);class o{registerBuiltInTools(e){e.forEach(e=>{let t=r.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())}executeTool(e,t,u){return(0,n._)(function*(){let n=this.getTool(e);if(!n)throw Error(`Tool "${e}" not found`);let s=this.applyDefaults(n,t);this.validateArguments(n,s);try{return yield n.execute(this.jodit,s,u)}catch(e){if((null==e?void 0:e.name)==="AbortError"||u.aborted)throw Error("Tool execution was aborted");throw e}}).call(this)}validateArguments(e,t){let u=Object.keys(t);for(let t of e.parameters.filter(e=>e.required).map(e=>e.name))if(!u.includes(t))throw Error(`Tool "${e.name}" requires parameter "${t}"`);for(let[u,n]of Object.entries(t)){let t=e.parameters.find(e=>e.name===u);if(!t){this.jodit.o.aiAssistantPro.debug;continue}let s=Array.isArray(n)?"array":"object"==typeof n&&null!=n?"object":typeof n;if(t.type!==s&&!("number"===t.type&&"string"===s&&!isNaN(Number(n))))throw Error(`Tool "${e.name}" parameter "${u}" expects type "${t.type}" but got "${s}"`);if(t.enum&&t.enum.length>0&&!t.enum.includes(n))throw Error(`Tool "${e.name}" parameter "${u}" must be one of: ${t.enum.join(", ")}`)}}applyDefaults(e,t){let u=(0,i._)({},t);for(let t of e.parameters)void 0===u[t.name]&&void 0!==t.default&&(u[t.name]=t.default);return u}destruct(){this.tools.clear()}constructor(e){(0,s._)(this,"jodit",void 0),(0,s._)(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,u){"use strict";u.r(t),u.d(t,{en:function(){return s.a},ru:function(){return r.a}});var n=u(26612),s=u.n(n),i=u(55790),r=u.n(i)},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ч назад"}},73943:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="applyFormat",s="Apply or remove inline formatting to the current selection (bold, italic, underline, etc.) or to a specific block",i=[{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}],r=!0},19127:function(e,t,u){"use strict";u.d(t,{execute:function(){return a}});var n=u(77688),s=u(56075),i=u(11886),r=u(6689),o=u(44526);function a(e,t,u){return(0,n._)(function*(){let{element:n,attributes:a,remove:l,blockIndex:F,selector:c}=t;if((0,r.throwIfAborted)(u),!n&&!a)throw Error('Either "element" or "attributes" must be provided');if(e.s.restore(),void 0!==F||c){let{element:t}=(0,o.resolveBlock)(e,{selector:c,index:F});e.s.select(t)}if(e.s.isCollapsed())throw Error("No selection found. Please select text to format");try{let t={};return n&&(t.element=n),a&&(t.attributes=a),l?e.s.commitStyle((0,i._)((0,s._)({},t),{mode:"remove"})):e.s.commitStyle(t),e.synchronizeValues(),{success:!0,message:l?"Formatting removed successfully":"Formatting applied successfully"}}catch(e){throw Error(`Failed to ${l?"remove":"apply"} formatting: ${e.message}`)}})()}},39296:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(73943),r=u(19127);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},53835:function(e,t,u){"use strict";u.d(t,{BUILT_IN_TOOLS:function(){return h},getToolNames:function(){return d}});var n=u(39296),s=u(16745),i=u(78717),r=u(5618),o=u(90991),a=u(2020),l=u(12570),F=u(95323),c=u(97603);let h={readDocument:r.default,readBlocks:i.default,readSelection:o.default,writeDocument:c.default,replaceSelection:F.default,replaceBlock:a.default,replaceInDocument:l.default,insertHTML:s.default,applyFormat:n.default};function d(){return Object.keys(h)}},56732:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="insertHTML",s="Insert or replace HTML content at the current cursor position in the editor",i=[{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}],r=!0},39592:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(49459);function r(e,t,u){return(0,n._)(function*(){let n=(0,i.requireString)(t,"html",{allowEmpty:!0}),{replace:r}=t;if(!n.trim())return{success:!0,message:"Nothing to insert: HTML is empty"};(0,s.throwIfAborted)(u);try{return e.s.focus(),r&&!e.s.isCollapsed()&&e.s.remove(),e.s.insertHTML(n),e.synchronizeValues(),{success:!0,message:`Inserted ${n.length} characters of HTML`}}catch(e){throw Error(`Failed to insert HTML: ${(null==e?void 0:e.message)||"Unknown error"}`)}})()}},16745:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(56732),r=u(39592);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},75352:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="readBlocks",s="Read blocks from the editor with optional filtering and pagination",i=[{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}],r=!1},91140:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(22732);function r(e,t,u){return(0,n._)(function*(){let{offset:n,limit:r,query:o}=t;(0,s.throwIfAborted)(u);let a=[];Array.from(e.editor.children).forEach((e,t)=>{i.Dom.isElement(e)&&a.push({blockIndex:t,tagName:e.tagName.toLowerCase(),content:e.innerHTML,textContent:e.textContent||"",classList:Array.from(e.classList)})});let l=a;if(o&&"string"==typeof o){let e=o.toLowerCase();l=a.filter(t=>t.textContent.toLowerCase().includes(e))}let F=Math.max(0,Math.min("number"==typeof n?n:0,l.length)),c=void 0!==r?Math.min(F+r,l.length):l.length;return{blocks:l.slice(F,c),total:a.length,offset:F,limit:void 0!==r?r:void 0}})()}},78717:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(75352),r=u(91140);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},93809:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="readDocument",s="Read the entire content of the editor document in HTML format",i=[{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}],r=!1},28157:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(22732);function r(e,t,u){return(0,n._)(function*(){let{start:n,end:r,aroundSelection:o}=t;(0,s.throwIfAborted)(u);let a=e.value,l=a.length;if(o&&!e.s.isCollapsed()){let t=e.s.range.commonAncestorContainer;for(;t&&t!==e.editor;){if(i.Dom.isElement(t)&&t.parentNode===e.editor){a=t.outerHTML;break}t=t.parentNode}return{html:a,length:l}}let F=void 0!==r?Math.min(r,l):l,c=Math.max(0,Math.min("number"==typeof n?n:0,l));return(c>0||l>F)&&(a=a.substring(c,F)),{html:a,length:l,start:c,end:F}})()}},5618:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(93809),r=u(28157);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},52826:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="readSelection",s="Get information about the current selection including HTML content and optional context",i=[{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}],r=!1},85130:function(e,t,u){"use strict";u.d(t,{execute:function(){return i}});var n=u(77688),s=u(6689);function i(e,t,u){return(0,n._)(function*(){let{contextCharsBefore:n,contextCharsAfter:i}=t;if((0,s.throwIfAborted)(u),e.s.restore(),e.s.isCollapsed())return{hasSelection:!1};let r=e.s.html,o=e.s.range,a=o.toString(),l={hasSelection:!0,html:r,text:a,startContainer:o.startContainer.nodeName,endContainer:o.endContainer.nodeName};if(n>0||i>0){let t=e.editor.textContent||"",u=t.substring(0,t.indexOf(a)),s=t.substring(t.indexOf(a)+a.length);n>0&&(l.contextBefore=u.slice(-n)),i>0&&(l.contextAfter=s.slice(0,i))}return l})()}},90991:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(52826),r=u(85130);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},96675:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="replaceBlock",s="Replace a specific block in the document by its index or CSS selector with new HTML content",i=[{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}],r=!0},3091:function(e,t,u){"use strict";u.d(t,{execute:function(){return a}});var n=u(77688),s=u(6689),i=u(49459),r=u(44526),o=u(22732);function a(e,t,u){return(0,n._)(function*(){let{index:n,selector:a}=t,l=(0,i.requireString)(t,"html");if((0,s.throwIfAborted)(u),void 0===n&&!a||void 0!==n&&a)throw Error("Either index or selector must be provided, but not both");let{element:F,identifier:c}=(0,r.resolveBlock)(e,{selector:a,index:n,requireExactlyOne:!0});try{var h;let t=e.createInside.div();t.innerHTML=l;let u=t.firstChild;if(!u||!o.Dom.isElement(u))throw Error("Invalid HTML: must contain at least one element");return null==(h=F.parentNode)||h.replaceChild(u,F),e.synchronizeValues(),{success:!0,message:`Block ${c} replaced successfully`}}catch(e){throw Error(`Failed to replace block ${c}: ${e.message}`)}})()}},2020:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(96675),r=u(3091);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},62553:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="replaceInDocument",s="Find and replace text or HTML patterns throughout the entire document",i=[{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}],r=!0},56293:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(49459);function r(e,t,u){return(0,n._)(function*(){let n=(0,i.requireString)(t,"search"),r=(0,i.requireString)(t,"replace",{allowEmpty:!0}),{useRegex:o,useSelector:a}=t;(0,s.throwIfAborted)(u);try{let t;e.s.focus(),e.s.save();let i=0;if(a){let l=function(e,t,u,n,i,r){let o=e.editor.querySelectorAll(i);if(0===o.length)return{replacements:0,message:`No elements found matching selector "${i}"`};let a=0;return o.forEach(e=>{(0,s.throwIfAborted)(r);let i=e.innerHTML,o=i;if(n)try{let e=RegExp(t,"g");i=i.replace(e,()=>(a++,u))}catch(e){throw Error(`Invalid regex pattern: ${(null==e?void 0:e.message)||"Unknown error"}`)}else{let e=t.length,n=0;for(;-1!==(n=i.indexOf(t,n));)(0,s.throwIfAborted)(r),i=i.substring(0,n)+u+i.substring(n+e),n+=u.length,a++}i!==o&&(e.innerHTML=i)}),a>0&&(e.synchronizeValues(),e.s.restore()),{replacements:a}}(e,n,r,o,a,u);i=l.replacements,t=l.message}else i=function(e,t,u,n,i,r){let o=0,a=t;if(i)try{let e=RegExp(u,"g");a=a.replace(e,()=>(o++,n))}catch(e){throw Error(`Invalid regex pattern: ${(null==e?void 0:e.message)||"Unknown error"}`)}else{let e=u.length,t=0;for(;-1!==(t=a.indexOf(u,t));)(0,s.throwIfAborted)(r),a=a.substring(0,t)+n+a.substring(t+e),t+=n.length,o++}return o>0&&(e.value=a,e.s.restore(),e.synchronizeValues()),o}(e,e.value,n,r,o,u);return{replacements:i,message:t||(i>0?`Replaced ${i} occurrence(s)`:"No matches found")}}catch(t){throw e.s.restore(),Error(`Failed to replace in document: ${(null==t?void 0:t.message)||"Unknown error"}`)}})()}},12570:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(62553),r=u(56293);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},70750:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="replaceSelection",s="Replace the current selection with new HTML content",i=[{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}],r=!0},36142:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(49459);function r(e,t,u){return(0,n._)(function*(){let n=(0,i.requireString)(t,"html"),{collapseToEnd:r}=t;(0,s.throwIfAborted)(u);try{if(e.s.restore(),e.s.insertHTML(n),r){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,u){"use strict";var n=u(56075),s=u(11886),i=u(70750),r=u(36142);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},90022:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="writeDocument",s="Write (replace) the entire document content with new HTML",i=[{name:"html",type:"string",description:"HTML content to set as the document",required:!0}],r=!0},79766:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(49459);function r(e,t,u){return(0,n._)(function*(){let n=(0,i.requireString)(t,"html",{allowEmpty:!0});(0,s.throwIfAborted)(u);try{return e.s.focus(),e.value=n,e.synchronizeValues(),{success:!0,message:`Document content was replaced with provided HTML(${n.length} characters)`}}catch(e){throw Error(`Failed to replace HTML: ${(null==e?void 0:e.message)||"Unknown error"}`)}})()}},97603:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(90022),r=u(79766);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},80453:function(e,t,u){"use strict";u.d(t,{UIConversationListItem:function(){return l}});var n=u(82749),s=u(31635),i=u(65478),r=u(67510),o=u(62843),a=u(80870);class l extends r.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 u=this.j.c.div("jodit-ui-conversation-list__item-wrapper"),n=this.j.c.div("jodit-ui-conversation-list__item-content"),s=this.j.c.div("jodit-ui-conversation-list__item-title");if(s.textContent=this.conversation.title,this.titleElement=s,n.appendChild(s),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)),n.appendChild(e)}if(u.appendChild(n),this.conversation.messageCount>0){let e=this.j.c.div("jodit-ui-conversation-list__item-badge");e.textContent=String(this.conversation.messageCount),u.appendChild(e)}e.appendChild(u),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,u=this.j.c.element("input");u.type="text",u.value=t,u.className="jodit-ui-conversation-list__item-title-input",e.textContent="",e.appendChild(u),u.focus(),u.select();let n=()=>{if(!this.isRenaming)return;let n=u.value.trim();this.isRenaming=!1,n&&n!==t?(e.textContent=n,this.j.e.fire("renameConversation.ai-assistant-pro",this.conversation.id,n)):e.textContent=t};this.j.e.on(u,"blur",n),this.j.e.on(u,"keydown",n=>{"Enter"===n.key&&(n.preventDefault(),u.blur()),"Escape"===n.key&&(this.isRenaming=!1,e.textContent=t)}),this.j.e.on(u,"click",e=>{e.stopPropagation()})}onDelete(){this.j.e.fire("deleteConversation.ai-assistant-pro",this.conversation.id)}destruct(){var e,t;null==(e=this.actionsButton)||e.destruct(),null==(t=this.contextMenu)||t.destruct(),super.destruct()}constructor(e,t,u=!1,s){super(e),(0,n._)(this,"opts",void 0),(0,n._)(this,"conversation",void 0),(0,n._)(this,"isActive",void 0),(0,n._)(this,"actionsButton",void 0),(0,n._)(this,"contextMenu",void 0),(0,n._)(this,"titleElement",void 0),(0,n._)(this,"isRenaming",void 0),this.opts=s,this.actionsButton=null,this.contextMenu=null,this.titleElement=null,this.isRenaming=!1,this.conversation=t,this.isActive=u,this.contextMenu=new a.ContextMenu(this.j),this.updateContent()}}(0,s.__decorate)([(0,i.watch)("container:click")],l.prototype,"onClick",null),(0,s.__decorate)([i.autobind],l.prototype,"showActionsMenu",null),(0,s.__decorate)([i.autobind],l.prototype,"startInlineRename",null),(0,s.__decorate)([i.autobind],l.prototype,"onDelete",null),l=(0,s.__decorate)([i.component],l)},68365:function(e,t,u){"use strict";u.d(t,{UIConversationList:function(){return F}});var n=u(82749),s=u(31635),i=u(31356),r=u(80453),o=u(65478),a=u(80256),l=u(62405);class F extends l.UIGroup{className(){return"UIConversationList"}render(){return`<div class="&__container">
10
+ ${i}`.trim();u?yield this.__executeQuickCommandSilent(a,i):yield this.__executeQuickCommandWithPanel(a,n)}).call(this)}__executeQuickCommandSilent(e,t){return(0,n._)(function*(){yield this.__loadData(),this.j.progressbar.show().progress(100);try{let t=(0,p.createUserMessage)(e),u=(0,p.createNewConversation)(this.j,this.state.defaultModel,this.state.defaultTemperature,[t]),n=yield this.apiClient.sendRequest(u.id,u.messages,null,[],u.options);if("final"===n.mode){let e=n.response.content;e&&this.j.s.insertHTML(e)}}catch(e){(0,g.isAbortError)(e)||this.j.e.fire("error",e)}finally{this.j.progressbar.hide()}}).call(this)}__executeQuickCommandWithPanel(e,t){return(0,n._)(function*(){yield this.__loadData();let u=this.stateManager.state.displayMode;this.stateManager.state.displayMode=t;let n=(0,p.getCurrentSelectionContext)(this.j);n&&this.stateManager.addSelectionContext(n),this.stateManager.isOpen()||(yield this.openAssistant()),yield this.sendMessage(e),this.stateManager.state.displayMode=u}).call(this)}sendMessage(e){return(0,n._)(function*(){yield this.__loadData();let t=this.stateManager.getCurrentConversation(),u=this.stateManager.getEditingMessageId();if(u&&t){let e=t.messages.findIndex(e=>e.id===u);if(-1!==e){let u=t.messages.slice(0,e),n=(0,r._)((0,i._)({},t),{messages:u,updatedAt:Date.now()});this.stateManager.setCurrentConversation(n),yield this.storage.save(n),this.stateManager.clearEditingMessage(),t=n}}t||(t=(0,p.createNewConversation)(this.j,this.state.defaultModel,this.state.defaultTemperature),this.stateManager.setCurrentConversation(t));let n=null;e.trim()&&(n=(0,p.createUserMessage)(e),t.title||(t=(0,r._)((0,i._)({},t),{title:e})),t=(0,r._)((0,i._)({},t),{updated:Date.now(),messages:[...t.messages,n]})),this.stateManager.setCurrentConversation((0,i._)({},t)),n&&this.j.e.fire("messageSent.ai-assistant-pro",n),this.stateManager.setLoading(!0),this.stateManager.clearError();try{yield this.sendRequestToAI(0),this.stateManager.clearSelectionContexts()}catch(e){if((0,g.isAbortError)(e))return;this.stateManager.setError(e instanceof Error?e.message:String(e))}finally{this.stateManager.setLoading(!1)}}).call(this)}sendRequestToAI(e=0){return(0,n._)(function*(){let t,u,n=this.j.o.aiAssistantPro.maxRecursionToolCallDepth;if(e>=n)throw Error(`Max recursion depth ${n} reached for tool calls`);let s=this.stateManager.getCurrentConversation();if(!s)return;let r=(0,p.findParentMessageId)(s),[o]=yield Promise.all([this.apiClient.sendRequest(s.id,s.messages,r,this.stateManager.getSelectionContexts(),s.options),this.storage.save(s)]);if("stream"===o.mode){let e=yield(0,p.processStreamingResponse)(this.stateManager,o,s);t=e.aiMessage,u=e.index,s=e.conversation}else{let e=(0,p.processFinalResponse)(o,s);t=e.aiMessage,u=e.index,s=e.conversation}s=yield(0,p.processArtifacts)(this.j,t,s,u),this.j.e.fire("messageReceived.ai-assistant-pro",t),this.stateManager.setCurrentConversation((0,i._)({},s)),yield this.storage.save(s),yield this.handleToolCalls(t.id,e)}).call(this)}deleteConversation(e){return(0,n._)(function*(){yield this.__loadData(),yield(0,p.deleteConversationWithCleanup)(this.j,e,this.storage,this.stateManager,this.permissionManager)}).call(this)}renameConversation(e,t){return(0,n._)(function*(){var u;let n=yield this.storage.get(e);if(!n)return;let s=(0,r._)((0,i._)({},n),{title:t,updated:Date.now()});yield this.storage.save(s),(null==(u=this.state.currentConversation)?void 0:u.id)===e&&this.stateManager.setCurrentConversation(s);let o=yield this.storage.list();this.stateManager.setConversations(o)}).call(this)}searchConversations(e){return(0,n._)(function*(){yield this.__loadData(),yield(0,p.handleConversationSearch)(e,this.storage,this.stateManager)}).call(this)}handleToolCalls(e,t=0){return(0,n._)(function*(){let u=this.stateManager.getCurrentConversation();if(!u)return;let n=u.messages.find(t=>t.id===e);if(!n)return;let s=n.toolCalls;if(!s||0===s.length)return;let i=s.filter(e=>!(0,p.isTerminalToolCallStatus)(e.status));if(0===i.length)return;let{approved:r,needsPermission:o}=this.permissionManager.filterToolCalls(i,u.permissions);for(let u of(this.stateManager.setPendingToolCalls(o),r))yield this.executeToolCall(e,u,t)}).call(this)}executeToolCall(e,t,u=0){return(0,n._)(function*(){let n=this.stateManager.getCurrentConversation();if(!n)return;let s=yield(0,p.executeToolCall)(this.j,t,this.toolRegistry),o=n.messages.findIndex(t=>t.id===e);if(-1===o)return;let a=n.messages[o],l=n.messages.slice();l[o]=(0,p.updateToolCallInMessage)(a,s),n=(0,r._)((0,i._)({},n),{messages:l,updated:Date.now()}),this.stateManager.setCurrentConversation(n),(0,p.areAllToolCallsExecuted)(n)&&(yield this.sendRequestToAI(u+1))}).call(this)}copyMessage(e){return(0,n._)(function*(){let t=this.stateManager.getCurrentConversation();if(!t)return;let u=t.messages.find(t=>t.id===e);if(u)try{yield navigator.clipboard.writeText(u.content),this.j.message.success("Message copied to clipboard")}catch(e){this.j.e.fire("error",Error("Failed to copy message"))}}).call(this)}restartFromMessage(e){return(0,n._)(function*(){let t=this.stateManager.getCurrentConversation();if(!t)return;let u=t.messages.findIndex(t=>t.id===e);if(-1===u)return;let n=t.messages[u];if("user"!==n.role)return;yield this.__loadData();let s=t.messages.slice(0,u),o=(0,r._)((0,i._)({},t),{messages:s,updatedAt:Date.now()});this.stateManager.setCurrentConversation(o),yield this.storage.save(o),yield this.sendMessage(n.content)}).call(this)}editMessage(e){return(0,n._)(function*(){let t=this.stateManager.getCurrentConversation();if(!t)return;let u=t.messages.find(t=>t.id===e);u&&"user"===u.role&&(this.stateManager.setEditingMessageId(e),this.mainPanel.inputArea.setValue(u.content),this.mainPanel.inputArea.focus())}).call(this)}cancelEditMessage(){this.stateManager.isEditingMessage()&&(this.stateManager.clearEditingMessage(),this.mainPanel.inputArea.setValue(""))}deleteMessage(e){return(0,n._)(function*(){yield this.__loadData();let t=this.stateManager.getCurrentConversation();if(!t||-1===t.messages.findIndex(t=>t.id===e))return;let u=t.messages.filter(t=>t.id!==e),n=(0,r._)((0,i._)({},t),{messages:u,updatedAt:Date.now()});this.stateManager.setCurrentConversation(n),yield this.storage.save(n)}).call(this)}beforeDestruct(){var e,t,u,n,s,i,r,o;this.__closeFlightMode(),null==(e=(0,E.cached)(this,"toolRegistry"))||e.destruct(),null==(t=(0,E.cached)(this,"permissionManager"))||t.destruct(),null==(u=(0,E.cached)(this,"apiClient"))||u.destruct(),null==(n=(0,E.cached)(this,"stateManager"))||n.destruct(),null==(s=(0,E.cached)(this,"mainPanel"))||s.destruct(),null==(i=(0,E.cached)(this,"dialog"))||i.destruct(),null==(o=(0,E.cached)(this,"storage"))||null==(r=o.close)||r.call(o)}constructor(...e){super(...e),(0,s._)(this,"buttons",[{name:"aiAssistantPro",group:"insert"},{name:"aiCommandsPro",group:"insert"}]),(0,s._)(this,"__initedPromise",null),(0,s._)(this,"__openedMode",null)}}(0,s._)(x,"requires",["license"]),(0,o.__decorate)([E.cache],x.prototype,"toolRegistry",null),(0,o.__decorate)([E.cache],x.prototype,"permissionManager",null),(0,o.__decorate)([E.cache],x.prototype,"apiClient",null),(0,o.__decorate)([E.cache],x.prototype,"storage",null),(0,o.__decorate)([E.cache],x.prototype,"stateManager",null),(0,o.__decorate)([E.cache],x.prototype,"mainPanel",null),(0,o.__decorate)([E.cache],x.prototype,"dialog",null),(0,o.__decorate)([(0,E.watch)("state.theme")],x.prototype,"__applyTheme",null),(0,o.__decorate)([(0,E.watch)(":openAIAssistantPro.ai-assistant-pro")],x.prototype,"openAssistant",null),(0,o.__decorate)([(0,E.watch)([":resize","state.panelWidth","state.panelHeight"])],x.prototype,"__onResizeInPanelView",null),(0,o.__decorate)([(0,E.watch)(["state.isOpen","state.displayMode","state.panelWidth","state.panelHeight","state.theme","state.defaultModel","state.defaultTemperature","state.currentConversation"]),(0,E.debounce)()],x.prototype,"__onSavedStateChange",null),(0,o.__decorate)([(0,E.watch)(":closeAIAssistantPro.ai-assistant-pro")],x.prototype,"closeAssistant",null),(0,o.__decorate)([(0,E.watch)(":addContextToAIAssistant.ai-assistant-pro")],x.prototype,"addCurrentSelectionToContext",null),(0,o.__decorate)([(0,E.watch)(":executeQuickCommand.ai-assistant-pro")],x.prototype,"executeQuickCommand",null),(0,o.__decorate)([(0,E.watch)(":sendMessage.ai-assistant-pro")],x.prototype,"sendMessage",null),(0,o.__decorate)([(0,E.watch)(":searchConversations.ai-assistant-pro")],x.prototype,"searchConversations",null),(0,o.__decorate)([(0,E.watch)(":copyMessage.ai-assistant-pro")],x.prototype,"copyMessage",null),(0,o.__decorate)([(0,E.watch)(":restartFromMessage.ai-assistant-pro")],x.prototype,"restartFromMessage",null),(0,o.__decorate)([(0,E.watch)(":editMessage.ai-assistant-pro")],x.prototype,"editMessage",null),(0,o.__decorate)([(0,E.watch)(":cancelEditMessage.ai-assistant-pro")],x.prototype,"cancelEditMessage",null),(0,o.__decorate)([(0,E.watch)(":deleteMessage.ai-assistant-pro")],x.prototype,"deleteMessage",null),x=(0,o.__decorate)([E.component],x),f.JoditPro.plugins.add("aiAssistantPro",x)},66645:function(e,t,u){"use strict";var n,s=u(77688),i=u(56075),r=u(11886),o=u(47373),a=u(94668),l=u.n(a),F=u(86428),c=u.n(F),h=u(75966),d=u.n(h),p=u(83207),A=u.n(p),C=u(99219),E=u.n(C),D=u(63674),g=u.n(D),B=u(4133),f=u.n(B),m=u(53835),v=u(6441),x=u(12153),y=u(31974),_=u(72573);x.Icon.set("ai-assistant-pro",c()).set("ai-commands-pro",d()).set("ai-add-context",l()).set("send",E()).set("tool-bolt",f()).set("chevron-right",A()).set("shield",g()),v.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,m.getToolNames)(),customTools:[],toolPermissions:{},autoApproveTools:["readDocument","readBlocks","readSelection","insertHTML"],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 u=new Date(e),n=new Date().getTime()-u.getTime();return n<6e4?t("Just now"):n<36e5?t("%dm ago",Math.floor(n/6e4)):n<864e5?t("%dh ago",Math.floor(n/36e5)):u.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})},formatMessageContent:(e,t)=>_.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,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,uploadBase64Artifact(e,t){return(0,s._)(function*(){if("image"===e.type&&e.data&&"base64"===e.data.kind)try{let u=(0,o.base64ToFile)(e.data.base64,e.id,e.mimeType),n=yield t.uploader.upload([u]);return(0,r._)((0,i._)({},e),{data:{kind:"url",url:n.baseurl+n.files[0]},metadata:(0,r._)((0,i._)({},e.metadata),{filename:n.files[0]})})}catch(e){t.e.fire("error",e)}return e})()}},v.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){return!e.o.aiAssistantPro.apiRequest},getLabel(e){return e.o.aiAssistantPro.apiRequest?"AI Assistant":"AI Assistant (not configured)"}},v.Config.prototype.controls.aiAddContext={icon:"ai-add-context",tooltip:"Add to AI Context",exec(e){e.e.fire("addContextToAIAssistant")},isDisabled(e){return!e.o.aiAssistantPro.apiRequest||e.s.isCollapsed()}},v.Config.prototype.controls.aiCommandsPro={icon:"ai-commands-pro",tooltip:"AI Commands",isDisabled(e){return!e.o.aiAssistantPro.apiRequest},list:y.aiAssitentCommands,exec(e,t,{control:u}){e.e.fire("executeQuickCommand.ai-assistant-pro",u.name)}};let w=(null==(n=v.Config.prototype.tuneBlock)?void 0:n.popup)||{},b={};["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=w[e]||["tune.up","tune.remove","tune.down"];b[e]=[...t,"|","aiAddContext"]}),v.Config.prototype.tuneBlock&&(v.Config.prototype.tuneBlock.popup=(0,i._)({},w,b))},6689:function(e,t,u){"use strict";u.d(t,{throwIfAborted:function(){return s}});var n=u(93661);function s(e){if(e.aborted)throw(0,n.abort)()}},61872:function(e,t,u){"use strict";u.d(t,{processArtifacts:function(){return F},processFinalResponse:function(){return l},processStreamingResponse:function(){return a}});var n=u(89929),s=u(77688),i=u(56075),r=u(11886),o=u(61558);function a(e,t,u){return(0,s._)(function*(){let s=(0,o.createAIMessage)(),a=-1;var l,F=!1,c=!1;try{for(var h,d=(0,n._)(t.stream);F=!(h=yield d.next()).done;F=!1){let t=h.value;switch(t.type){case"created":s=(0,r._)((0,i._)({},s),{id:t.response.responseId,content:""}),a=u.messages.length;break;case"text-delta":s=(0,r._)((0,i._)({},s),{content:s.content+t.delta});break;case"completed":s=(0,r._)((0,i._)({},s),{id:t.response.responseId,toolCalls:t.response.toolCalls||[],artifacts:t.response.artifacts||[]});break;case"error":{let e=(0,o.createErrorMessage)(t.error);s=(0,r._)((0,i._)({},s),{id:e.id,content:e.content})}}if(s.id){let t=u.messages.slice();t[a>=0?a:u.messages.length]=s,u=(0,r._)((0,i._)({},u),{messages:t,updated:Date.now()}),e.setCurrentConversation(u)}}}catch(e){c=!0,l=e}finally{try{F&&null!=d.return&&(yield d.return())}finally{if(c)throw l}}return{aiMessage:s,index:a,conversation:u}})()}function l(e,t){let u=(0,r._)((0,i._)({},(0,o.createAIMessage)()),{id:e.response.responseId,content:e.response.content,toolCalls:e.response.toolCalls||[],artifacts:e.response.artifacts||[]}),n=t.messages.slice();return n.push(u),{aiMessage:u,index:(t=(0,r._)((0,i._)({},t),{messages:n,updated:Date.now()})).messages.length-1,conversation:t}}function F(e,t,u,n){return(0,s._)(function*(){if(t.artifacts&&t.artifacts.length>0){let s=u.messages.slice();return s[n]=(0,r._)((0,i._)({},s[n]),{artifacts:yield(0,o.uploadArtifacts)(e,t.artifacts)}),(0,r._)((0,i._)({},u),{messages:s,updated:Date.now()})}return u})()}},49459:function(e,t,u){"use strict";function n(e,t,u={}){let s=e[t];if("string"!=typeof s||!u.allowEmpty&&""===s)throw Error(`Parameter "${t}" is required and must be a${u.allowEmpty?"":" non-empty"} string`);return s}u.d(t,{requireString:function(){return n}})},44526:function(e,t,u){"use strict";u.d(t,{resolveBlock:function(){return s}});var n=u(22732);function s(e,{selector:t,index:u,requireExactlyOne:i=!1}={}){let r=null!=t&&""!==t.trim(),o=null!=u;if(i&&r===o)throw Error("Either index or selector must be provided, but not both");if(!r&&!o)throw Error("Block identifier is required");if(r){if("string"!=typeof t)throw Error("Selector must be a string");let u=e.editor.querySelector(t);if(!u)throw Error(`No element found matching selector "${t}"`);if(!n.Dom.isElement(u))throw Error(`Selector "${t}" does not point to an element node`);return{element:u,identifier:`with selector "${t}"`}}if("number"!=typeof u)throw Error("Block index must be a number");let a=Array.from(e.editor.children);if(u<0||u>=a.length)throw Error(`Block index ${u} is out of range. Document has ${a.length} blocks`);let l=a[u];if(!n.Dom.isElement(l))throw Error(`Block at index ${u} is not a valid element`);return{element:l,identifier:`at index ${u}`}}},70308:function(e,t,u){"use strict";u.d(t,{areAllToolCallsExecuted:function(){return a},createNewConversation:function(){return s},findMessagesWithPendingToolCalls:function(){return l},findParentMessageId:function(){return i},isTerminalToolCallStatus:function(){return o}});var n=u(21064);function s(e,t,u,i=[]){let r=e.o.aiAssistantPro,o={id:(0,n.generateConversationId)(),created:Date.now(),updated:Date.now(),messages:i,permissions:[],options:{model:null!=t?t:r.defaultModel,temperature:null!=u?u:r.defaultTemperature}};return e.e.fire("conversationCreated.ai-assistant-pro",o),o}function i(e){for(let t=e.messages.length-1;t>=0;t--){let u=e.messages[t];if("assistant"===u.role&&!u.id.startsWith("error_"))return u.id}return null}let r=new Set(["executed","denied","error"]);function o(e){return r.has(e)}function a(e){let t=e.messages[e.messages.length-1];return!!(null==t?void 0:t.toolCalls)&&t.toolCalls.every(e=>o(e.status))}function l(e){return e.messages.filter(e=>e.toolCalls&&e.toolCalls.length>0&&e.toolCalls.some(e=>!o(e.status)))}},473:function(e,t,u){"use strict";u.d(t,{handleBackToList:function(){return c},handleConversationSearch:function(){return h},handleConversationSelect:function(){return F},handleToolApproval:function(){return a},handleToolDenial:function(){return l}});var n=u(77688),s=u(56075),i=u(11886),r=u(79078),o=u(82758);function a(e,t,u,r,o){return(0,n._)(function*(){let n=u.getPendingToolCalls().find(t=>t.id===e);if(!n)return null;let a=r.grantPermission(n.name,t),l=u.getCurrentConversation();return l&&(l.permissions.push(a),yield o.save(l)),u.removePendingToolCall(e),(0,i._)((0,s._)({},n),{status:"approved"})})()}function l(e,t,u,o){return(0,n._)(function*(){let n=u.getPendingToolCalls().find(e=>e.id===t);if(!n)return;let a=u.getCurrentConversation();if(!a)return;let l=a.messages.findIndex(e=>{var u;return null==(u=e.toolCalls)?void 0:u.find(e=>e.id===t)});if(-1===l)return;let F=a.messages[l],c=(0,i._)((0,s._)({},n),{result:{error:"Tool call denied by user."},status:"denied"}),h=(0,r.updateToolCallInMessage)(F,c),d=[...a.messages];d[l]=h,a=(0,i._)((0,s._)({},a),{messages:d,updated:Date.now()}),u.setCurrentConversation(a),yield o.save(a),e.e.fire("toolCallDenied.ai-assistant-pro",n),u.removePendingToolCall(t)})()}function F(e,t,u){return(0,n._)(function*(){try{u.setLoading(!0);let n=yield t.get(e);if(!n)throw Error("Conversation not found: "+e);u.setCurrentConversation((0,s._)({},n))}catch(e){o.IS_PROD}finally{u.setLoading(!1)}})()}function c(e,t){return(0,n._)(function*(){t.setView("conversationList");try{t.setLoading(!0);let u=yield e.list().catch(()=>[]);t.setConversations(u)}finally{t.setLoading(!1)}})()}function h(e,t,u){return(0,n._)(function*(){u.setLoading(!0);try{let n=yield t.list(e||void 0);u.setConversations(n),u.setView("conversationList")}finally{u.setLoading(!1)}})()}},58579:function(e,t,u){"use strict";u.d(t,{applyTheme:function(){return F.applyTheme},areAllToolCallsExecuted:function(){return s.areAllToolCallsExecuted},createNewConversation:function(){return s.createNewConversation},createUserMessage:function(){return r.createUserMessage},deleteConversationWithCleanup:function(){return l.deleteConversationWithCleanup},executeToolCall:function(){return c.executeToolCall},findMessagesWithPendingToolCalls:function(){return s.findMessagesWithPendingToolCalls},findParentMessageId:function(){return s.findParentMessageId},getCurrentSelectionContext:function(){return a.getCurrentSelectionContext},handleBackToList:function(){return i.handleBackToList},handleConversationSearch:function(){return i.handleConversationSearch},handleConversationSelect:function(){return i.handleConversationSelect},handleToolApproval:function(){return i.handleToolApproval},handleToolDenial:function(){return i.handleToolDenial},invertMode:function(){return o.invertMode},isTerminalToolCallStatus:function(){return s.isTerminalToolCallStatus},loadInitialData:function(){return l.loadInitialData},processArtifacts:function(){return n.processArtifacts},processFinalResponse:function(){return n.processFinalResponse},processStreamingResponse:function(){return n.processStreamingResponse},resizeInPanelView:function(){return o.resizeInPanelView},updateToolCallInMessage:function(){return c.updateToolCallInMessage}});var n=u(61872),s=u(70308),i=u(473),r=u(61558),o=u(71050),a=u(15927),l=u(56110),F=u(53014),c=u(79078)},61558:function(e,t,u){"use strict";u.d(t,{createAIMessage:function(){return r},createErrorMessage:function(){return o},createUserMessage:function(){return i},uploadArtifacts:function(){return a}});var n=u(77688),s=u(21064);function i(e){return{id:(0,s.generateMessageId)(),role:"user",content:e,timestamp:Date.now()}}function r(){return{id:"",role:"assistant",content:"",artifacts:[],timestamp:Date.now(),toolCalls:[]}}function o(e){return{id:"error_"+(0,s.generateMessageId)(),role:"assistant",content:`❌ Error: ${e.message}`,timestamp:Date.now(),toolCalls:[],artifacts:[]}}function a(e,t){return(0,n._)(function*(){if(!t||0===t.length)return t;let u=e.o.aiAssistantPro.uploadBase64Artifact;return u?Promise.all(t.map(t=>(0,n._)(function*(){var n;return null!=(n=u(t,e))?n:t})())):t})()}},71050:function(e,t,u){"use strict";u.d(t,{invertMode:function(){return s},resizeInPanelView:function(){return i}});var n=u(41180);function s(e){switch(e){case"left":return"right";case"right":return"left";case"top":return"bottom";case"bottom":return"top"}}function i(e,t,u,i){var r,o,a,l;if("dialog"===t||"flight"===t)return;("left"===t||"right"===t)&&(null==(a=e.currentPlace.slots[s(t)])||a.style.setProperty(`--jd-slot-${s(t)}-width`,"auto"),null==(l=e.currentPlace.slots[t])||l.style.setProperty(`--jd-slot-${t}-width`,`${u}px`));let F=null!=(r=(0,n.css)(e.currentPlace.workplace,"height"))?r:0;null==(o=e.currentPlace.slots[t])||o.style.setProperty("min-height",`${Math.min(F,i)}px`)}},15927:function(e,t,u){"use strict";function n(e){if(e.s.isCollapsed())return null;let t=e.s.html,u=e.s.range;return{html:t,rangeInfo:{startContainer:u.startContainer.nodeName,startOffset:u.startOffset,endContainer:u.endContainer.nodeName,endOffset:u.endOffset}}}u.d(t,{getCurrentSelectionContext:function(){return n}})},56110:function(e,t,u){"use strict";u.d(t,{deleteConversationWithCleanup:function(){return i},loadInitialData:function(){return r}});var n=u(77688),s=u(82758);function i(e,t,u,s,i){return(0,n._)(function*(){try{s.setLoading(!0),yield u.delete(t),s.removeConversation(t),i.clearConversationPermissions(t);let n=s.getCurrentConversation();(null==n?void 0:n.id)===t&&s.setCurrentConversation(null);let r=yield u.list();s.setConversations(r),s.setView(0===r.length?"welcome":"conversationList"),e.e.fire("conversationDeleted.ai-assistant-pro",t)}catch(t){e.alert(e.i18n("Failed to delete conversation")+": "+((null==t?void 0:t.message)||"Unknown error"))}finally{s.setLoading(!1)}})()}function r(e,t,u){return(0,n._)(function*(){u.setLoading(!0);try{let[s,i]=yield Promise.all([t.list().catch(()=>[]),t.getGlobalSettings().catch(()=>null)]);if(u.setConversations(s),i&&u.setSavedState(i),0===s.length)u.setView("welcome");else if(e.o.aiAssistantPro.rememberLastConversation&&(null==i?void 0:i.currentConversationId)){var n;let e=null!=(n=s.find(e=>e.id===i.currentConversationId))?n:s[0],r=yield t.get(e.id);r?u.setCurrentConversation(r):u.setView("conversationList")}else u.setView("conversationList")}catch(e){s.IS_PROD,u.setView("welcome")}finally{u.setLoading(!1)}})()}},53014:function(e,t,u){"use strict";u.d(t,{applyTheme:function(){return i}});let n=["jodit_theme_dark","jodit-ai-assistant-pro_theme_dark","jodit-dialog_theme_dark"],s=["jodit_theme_light","jodit-ai-assistant-pro_theme_light","jodit-dialog_theme_light"];function i(e,t,u,i,r){let o;if(null==i||i.classList.remove(...n),null==i||i.classList.remove(...s),"dialog"===u){let e=null==r?void 0:r.container;null==e||e.classList.remove(...n),null==e||e.classList.remove(...s)}if(o="dark"===t?n:s,null==i||i.classList.add(...o),"dialog"===u){let e=null==r?void 0:r.container;null==e||e.classList.add(...o)}}},79078:function(e,t,u){"use strict";u.d(t,{executeToolCall:function(){return r},updateToolCallInMessage:function(){return o}});var n=u(77688),s=u(56075),i=u(11886);function r(e,t,u){return(0,n._)(function*(){let n;try{let e=new AbortController().signal,r=yield u.executeTool(t.name,t.arguments,e);n=(0,i._)((0,s._)({},t),{result:{result:r},status:"executed"})}catch(u){n=(0,i._)((0,s._)({},t),{result:{error:u instanceof Error?u.message:String(u)},status:"error"}),e.e.fire("toolCallFailed.ai-assistant-pro",n)}return e.e.fire("toolCallExecuted.ai-assistant-pro",n,{toolCallId:n.id,result:n.result}),n})()}function o(e,t){var u,n;let r=null==(n=e.toolCalls)?void 0:n.findIndex(e=>e.id===t.id);if(null==r||-1===r)return e;let o=[...null!=(u=null==e?void 0:e.toolCalls)?u:[]];return o[r]=t,(0,i._)((0,s._)({},e),{toolCalls:o})}},86449:function(e,t,u){"use strict";u.d(t,{APIClient:function(){return l}});var n=u(77688),s=u(82749),i=u(56075),r=u(11886),o=u(82758),a=u(21537);class l{sendRequest(e,t,u,s,i){return(0,n._)(function*(){let{apiRequest:n,requestTimeout:r,maxRetries:l}=this.jodit.o.aiAssistantPro;if(!n)throw Error("AI Assistant Pro callback is not configured");let F=new AbortController;this.abortControllers.add(F);try{let c=this.buildRequestContext(e,t,u,s,i),h=null;for(let e=0;l>=e;e++)try{if(F.signal.aborted)throw(0,a.abort)();let e=setTimeout(()=>{F.abort()},r);try{let t=yield n(c,F.signal);return clearTimeout(e),this.validateResponse(t),t}catch(t){throw clearTimeout(e),t}}catch(t){if(h=t,o.IS_PROD,l>e){let t=this.calculateRetryDelay(e);yield this.sleep(t)}else throw t}throw h||Error("API request failed after all retries")}finally{this.abortControllers.delete(F)}}).call(this)}abort(){this.abortControllers.forEach(e=>{e.abort()}),this.abortControllers.clear()}isInProgress(){return this.abortControllers.size>0}buildRequestContext(e,t,u,n,s){let o,{apiMode:a,instructions:l}=this.jodit.o.aiAssistantPro,F={mode:a,conversationId:e,tools:this.toolRegistry.getAllTools(),selectionContexts:n,conversationOptions:s,instructions:l};if("full"===a)o=t;else if(u){let e=t.findIndex(e=>e.id===u);o=-1!==e?t.slice(e+1):t,F=(0,r._)((0,i._)({},F),{parentMessageId:u})}else o=t;return(0,r._)((0,i._)({},F),{messages:this.expandToolMessages(o,t.find(e=>e.id===u))})}expandToolMessages(e,t){let u=[];for(let t of e)u.push(t),this.expandToolResultsMessage(t,u);return t&&this.expandToolResultsMessage(t,u),u}expandToolResultsMessage(e,t){if(e.toolCalls&&e.toolCalls.length>0)for(let n of e.toolCalls){var u;let s=null!=(u=n.result)?u:{error:"result not found"};if(t.find(e=>e.id===`${n.id}-result`))continue;let i={id:`${n.id}-result`,role:"tool",content:s.error?`Error: ${s.error}`:JSON.stringify(s.result),timestamp:e.timestamp,toolResults:[{toolCallId:n.id,result:s}]};t.push(i)}}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,s._)(this,"jodit",void 0),(0,s._)(this,"toolRegistry",void 0),(0,s._)(this,"abortControllers",void 0),this.jodit=e,this.toolRegistry=t,this.abortControllers=new Set}}},47373:function(e,t,u){"use strict";function n(e,t,u="image/png"){let s=atob(e),i=s.length,r=new Uint8Array(i);for(let e=0;i>e;e++)r[e]=s.charCodeAt(e);return new File([new Blob([r],{type:u})],t,{type:u})}u.d(t,{base64ToFile:function(){return n}})},21020:function(e,t,u){"use strict";u.d(t,{PermissionManager:function(){return r}});var n=u(82749),s=u(56075),i=u(11886);class r{requiresPermission(e){let{autoApproveTools:t,alwaysDenyTools:u}=this.jodit.o.aiAssistantPro;if(u.includes(e))return!0;if(t.includes(e))return!1;let n=this.toolRegistry.getTool(e);return!n||n.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 u=this.permanentPermissions.get(e);return u&&u.granted?u:t.find(t=>t.toolName===e&&t.granted)||null}grantPermission(e,t){let u={toolName:e,granted:!0,grantedAt:Date.now(),scope:t};return"forever"===t&&(this.permanentPermissions.set(e,u),this.savePermanentPermissions()),u}denyPermission(e){return{toolName:e,granted:!1,grantedAt:Date.now(),scope:"once"}}filterToolCalls(e,t){let u=[],n=[],r=[];for(let o of e){if(this.isAutoDenied(o.name)){r.push((0,i._)((0,s._)({},o),{status:"denied"}));continue}if(this.isAutoApproved(o.name)){u.push((0,i._)((0,s._)({},o),{status:"approved"}));continue}let e=this.checkPermission(o.name,t);e&&e.granted?u.push((0,i._)((0,s._)({},o),{status:"approved"})):this.requiresPermission(o.name)?(this.jodit.e.fire("permissionRequested.ai-assistant-pro",o.name),n.push((0,i._)((0,s._)({},o),{status:"pending"}))):u.push((0,i._)((0,s._)({},o),{status:"approved"}))}return{approved:u,needsPermission:n,denied:r}}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,n._)(this,"jodit",void 0),(0,n._)(this,"toolRegistry",void 0),(0,n._)(this,"permanentPermissions",void 0),(0,n._)(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,u){"use strict";u.d(t,{StateManager:function(){return r}});var n=u(82749),s=u(56075),i=u(11886);class r{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 u=this.state.pendingToolCalls.map(u=>u.id===e?(0,i._)((0,s._)({},u),{status:t}):u);this.setPendingToolCalls(u)}setSelectionContexts(e){this.state.selectionContexts=e}getSelectionContexts(){return this.state.selectionContexts}addSelectionContext(e){let{maxContextRanges:t}=this.jodit.o.aiAssistantPro,u=[...this.state.selectionContexts,e];u.length>t&&(u=u.slice(-t)),this.setSelectionContexts(u),this.jodit.e.fire("contextAdded.ai-assistant-pro",e)}removeSelectionContext(e){let t=this.state.selectionContexts.filter((t,u)=>u!==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,n._)(this,"jodit",void 0),(0,n._)(this,"state",void 0),this.jodit=e,this.state=this.createInitialState()}}},62895:function(e,t,u){"use strict";u.d(t,{WebStorageConversationStorage:function(){return n.WebStorageConversationStorage},createStorageProvider:function(){return n.createStorageProvider}});var n=u(21064)},21064:function(e,t,u){"use strict";u.d(t,{WebStorageConversationStorage:function(){return o},createStorageProvider:function(){return a},generateConversationId:function(){return l},generateMessageId:function(){return F}});var n=u(77688),s=u(82749),i=u(56075),r=u(97333);class o{close(){return this.storage.close()}getConversationKey(e){return`conv:${e}`}getAllKeys(){return(0,n._)(function*(){let e=yield this.storage.get("__conversation_index__");return e&&Array.isArray(e)?e:[]}).call(this)}updateIndex(e){return(0,n._)(function*(){yield this.storage.set("__conversation_index__",e)}).call(this)}addToIndex(e){return(0,n._)(function*(){let t=yield this.getAllKeys();t.includes(e)||(t.push(e),yield this.updateIndex(t))}).call(this)}removeFromIndex(e){return(0,n._)(function*(){let t=(yield this.getAllKeys()).filter(t=>t!==e);yield this.updateIndex(t)}).call(this)}list(e){return(0,n._)(function*(){try{let n=yield this.getAllKeys(),s=[],i=null==e?void 0:e.toLowerCase().trim();for(let e of n){var t,u;let n=yield this.get(e);if(n){if(i){let e=null==(u=n.title)?void 0:u.toLowerCase().includes(i),t=!e&&n.messages.some(e=>e.content.toLowerCase().includes(i));if(!e&&!t)continue}s.push({id:n.id,title:null!=(t=n.title)?t:"",created:n.created,updated:n.updated,messageCount:n.messages.length})}}return s.sort((e,t)=>t.updated-e.updated),s}catch(e){return[]}}).call(this)}get(e){return(0,n._)(function*(){try{let t=this.getConversationKey(e);return(yield this.storage.get(t))||null}catch(e){return null}}).call(this)}save(e){return(0,n._)(function*(){try{if(0===e.messages.length)throw Error("Conversation must have at least one message.");let t=yield this.getAllKeys();t.length>=this.maxConversations&&!t.includes(e.id)&&(yield this.evictOldest());let u=this.getConversationKey(e.id);yield this.storage.set(u,e),yield this.addToIndex(e.id)}catch(t){if((null==t?void 0:t.name)==="QuotaExceededError"||(null==t?void 0:t.code)===22||(null==t?void 0:t.code)===1014){yield this.evictOldest();try{let t=this.getConversationKey(e.id);yield this.storage.set(t,e),yield this.addToIndex(e.id)}catch(e){throw Error("Storage quota exceeded. Please delete some conversations.")}}else throw Error(`Failed to save conversation: ${(null==t?void 0:t.message)||"Unknown error"}`)}}).call(this)}delete(e){return(0,n._)(function*(){try{let t=this.getConversationKey(e);yield this.storage.delete(t),yield this.removeFromIndex(e)}catch(e){}}).call(this)}clear(){return(0,n._)(function*(){try{for(let e of yield this.getAllKeys()){let t=this.getConversationKey(e);yield this.storage.delete(t)}yield this.updateIndex([])}catch(e){}}).call(this)}evictOldest(){return(0,n._)(function*(){try{let e=yield this.list();if(0===e.length)return;e.sort((e,t)=>e.updated-t.updated);let t=e[0];yield this.delete(t.id)}catch(e){}}).call(this)}getGlobalSettings(){return(0,n._)(function*(){try{return(yield this.storage.get("global-settings"))||null}catch(e){return null}}).call(this)}saveGlobalSettings(e){return(0,n._)(function*(){try{let t=yield this.getGlobalSettings(),u=(0,i._)({},t,e);yield this.storage.set("global-settings",u)}catch(e){throw Error("Failed to save global settings")}}).call(this)}constructor(e,t){(0,s._)(this,"storage",void 0),(0,s._)(this,"maxConversations",void 0),this.storage=e,this.maxConversations=t}}function a(e,t){return r.AsyncStorage.makeStorage(e,t)}function l(){return`conv_${Date.now()}_${Math.random().toString(36).substring(2,11)}`}function F(){return`msg_${Date.now()}_${Math.random().toString(36).substring(2,11)}`}},55487:function(e,t,u){"use strict";u.d(t,{ToolRegistry:function(){return o}});var n=u(77688),s=u(82749),i=u(56075),r=u(53835);class o{registerBuiltInTools(e){e.forEach(e=>{let t=r.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())}executeTool(e,t,u){return(0,n._)(function*(){let n=this.getTool(e);if(!n)throw Error(`Tool "${e}" not found`);let s=this.applyDefaults(n,t);this.validateArguments(n,s);try{return yield n.execute(this.jodit,s,u)}catch(e){if((null==e?void 0:e.name)==="AbortError"||u.aborted)throw Error("Tool execution was aborted");throw e}}).call(this)}validateArguments(e,t){let u=Object.keys(t);for(let t of e.parameters.filter(e=>e.required).map(e=>e.name))if(!u.includes(t))throw Error(`Tool "${e.name}" requires parameter "${t}"`);for(let[u,n]of Object.entries(t)){let t=e.parameters.find(e=>e.name===u);if(!t){this.jodit.o.aiAssistantPro.debug;continue}let s=Array.isArray(n)?"array":"object"==typeof n&&null!=n?"object":typeof n;if(t.type!==s&&!("number"===t.type&&"string"===s&&!isNaN(Number(n))))throw Error(`Tool "${e.name}" parameter "${u}" expects type "${t.type}" but got "${s}"`);if(t.enum&&t.enum.length>0&&!t.enum.includes(n))throw Error(`Tool "${e.name}" parameter "${u}" must be one of: ${t.enum.join(", ")}`)}}applyDefaults(e,t){let u=(0,i._)({},t);for(let t of e.parameters)void 0===u[t.name]&&void 0!==t.default&&(u[t.name]=t.default);return u}destruct(){this.tools.clear()}constructor(e){(0,s._)(this,"jodit",void 0),(0,s._)(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,u){"use strict";u.r(t),u.d(t,{en:function(){return s.a},ru:function(){return r.a}});var n=u(26612),s=u.n(n),i=u(55790),r=u.n(i)},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ч назад"}},73943:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="applyFormat",s="Apply or remove inline formatting to the current selection (bold, italic, underline, etc.) or to a specific block",i=[{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}],r=!0},19127:function(e,t,u){"use strict";u.d(t,{execute:function(){return a}});var n=u(77688),s=u(56075),i=u(11886),r=u(6689),o=u(44526);function a(e,t,u){return(0,n._)(function*(){let{element:n,attributes:a,remove:l,blockIndex:F,selector:c}=t;if((0,r.throwIfAborted)(u),!n&&!a)throw Error('Either "element" or "attributes" must be provided');if(e.s.restore(),void 0!==F||c){let{element:t}=(0,o.resolveBlock)(e,{selector:c,index:F});e.s.select(t)}if(e.s.isCollapsed())throw Error("No selection found. Please select text to format");try{let t={};return n&&(t.element=n),a&&(t.attributes=a),l?e.s.commitStyle((0,i._)((0,s._)({},t),{mode:"remove"})):e.s.commitStyle(t),e.synchronizeValues(),{success:!0,message:l?"Formatting removed successfully":"Formatting applied successfully"}}catch(e){throw Error(`Failed to ${l?"remove":"apply"} formatting: ${e.message}`)}})()}},39296:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(73943),r=u(19127);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},53835:function(e,t,u){"use strict";u.d(t,{BUILT_IN_TOOLS:function(){return h},getToolNames:function(){return d}});var n=u(39296),s=u(16745),i=u(78717),r=u(5618),o=u(90991),a=u(2020),l=u(12570),F=u(95323),c=u(97603);let h={readDocument:r.default,readBlocks:i.default,readSelection:o.default,writeDocument:c.default,replaceSelection:F.default,replaceBlock:a.default,replaceInDocument:l.default,insertHTML:s.default,applyFormat:n.default};function d(){return Object.keys(h)}},56732:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="insertHTML",s="Insert or replace HTML content at the current cursor position in the editor",i=[{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}],r=!0},39592:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(49459);function r(e,t,u){return(0,n._)(function*(){let n=(0,i.requireString)(t,"html",{allowEmpty:!0}),{replace:r}=t;if(!n.trim())return{success:!0,message:"Nothing to insert: HTML is empty"};(0,s.throwIfAborted)(u);try{return e.s.focus(),r&&!e.s.isCollapsed()&&e.s.remove(),e.s.insertHTML(n),e.synchronizeValues(),{success:!0,message:`Inserted ${n.length} characters of HTML`}}catch(e){throw Error(`Failed to insert HTML: ${(null==e?void 0:e.message)||"Unknown error"}`)}})()}},16745:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(56732),r=u(39592);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},75352:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="readBlocks",s="Read blocks from the editor with optional filtering and pagination",i=[{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}],r=!1},91140:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(22732);function r(e,t,u){return(0,n._)(function*(){let{offset:n,limit:r,query:o}=t;(0,s.throwIfAborted)(u);let a=[];Array.from(e.editor.children).forEach((e,t)=>{i.Dom.isElement(e)&&a.push({blockIndex:t,tagName:e.tagName.toLowerCase(),content:e.innerHTML,textContent:e.textContent||"",classList:Array.from(e.classList)})});let l=a;if(o&&"string"==typeof o){let e=o.toLowerCase();l=a.filter(t=>t.textContent.toLowerCase().includes(e))}let F=Math.max(0,Math.min("number"==typeof n?n:0,l.length)),c=void 0!==r?Math.min(F+r,l.length):l.length;return{blocks:l.slice(F,c),total:a.length,offset:F,limit:void 0!==r?r:void 0}})()}},78717:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(75352),r=u(91140);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},93809:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="readDocument",s="Read the entire content of the editor document in HTML format",i=[{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}],r=!1},28157:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(22732);function r(e,t,u){return(0,n._)(function*(){let{start:n,end:r,aroundSelection:o}=t;(0,s.throwIfAborted)(u);let a=e.value,l=a.length;if(o&&!e.s.isCollapsed()){let t=e.s.range.commonAncestorContainer;for(;t&&t!==e.editor;){if(i.Dom.isElement(t)&&t.parentNode===e.editor){a=t.outerHTML;break}t=t.parentNode}return{html:a,length:l}}let F=void 0!==r?Math.min(r,l):l,c=Math.max(0,Math.min("number"==typeof n?n:0,l));return(c>0||l>F)&&(a=a.substring(c,F)),{html:a,length:l,start:c,end:F}})()}},5618:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(93809),r=u(28157);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},52826:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="readSelection",s="Get information about the current selection including HTML content and optional context",i=[{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}],r=!1},85130:function(e,t,u){"use strict";u.d(t,{execute:function(){return i}});var n=u(77688),s=u(6689);function i(e,t,u){return(0,n._)(function*(){let{contextCharsBefore:n,contextCharsAfter:i}=t;if((0,s.throwIfAborted)(u),e.s.restore(),e.s.isCollapsed())return{hasSelection:!1};let r=e.s.html,o=e.s.range,a=o.toString(),l={hasSelection:!0,html:r,text:a,startContainer:o.startContainer.nodeName,endContainer:o.endContainer.nodeName};if(n>0||i>0){let t=e.editor.textContent||"",u=t.substring(0,t.indexOf(a)),s=t.substring(t.indexOf(a)+a.length);n>0&&(l.contextBefore=u.slice(-n)),i>0&&(l.contextAfter=s.slice(0,i))}return l})()}},90991:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(52826),r=u(85130);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},96675:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="replaceBlock",s="Replace a specific block in the document by its index or CSS selector with new HTML content",i=[{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}],r=!0},3091:function(e,t,u){"use strict";u.d(t,{execute:function(){return a}});var n=u(77688),s=u(6689),i=u(49459),r=u(44526),o=u(22732);function a(e,t,u){return(0,n._)(function*(){let{index:n,selector:a}=t,l=(0,i.requireString)(t,"html");if((0,s.throwIfAborted)(u),void 0===n&&!a||void 0!==n&&a)throw Error("Either index or selector must be provided, but not both");let{element:F,identifier:c}=(0,r.resolveBlock)(e,{selector:a,index:n,requireExactlyOne:!0});try{var h;let t=e.createInside.div();t.innerHTML=l;let u=t.firstChild;if(!u||!o.Dom.isElement(u))throw Error("Invalid HTML: must contain at least one element");return null==(h=F.parentNode)||h.replaceChild(u,F),e.synchronizeValues(),{success:!0,message:`Block ${c} replaced successfully`}}catch(e){throw Error(`Failed to replace block ${c}: ${e.message}`)}})()}},2020:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(96675),r=u(3091);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},62553:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="replaceInDocument",s="Find and replace text or HTML patterns throughout the entire document",i=[{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}],r=!0},56293:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(49459);function r(e,t,u){return(0,n._)(function*(){let n=(0,i.requireString)(t,"search"),r=(0,i.requireString)(t,"replace",{allowEmpty:!0}),{useRegex:o,useSelector:a}=t;(0,s.throwIfAborted)(u);try{let t;e.s.focus(),e.s.save();let i=0;if(a){let l=function(e,t,u,n,i,r){let o=e.editor.querySelectorAll(i);if(0===o.length)return{replacements:0,message:`No elements found matching selector "${i}"`};let a=0;return o.forEach(e=>{(0,s.throwIfAborted)(r);let i=e.innerHTML,o=i;if(n)try{let e=RegExp(t,"g");i=i.replace(e,()=>(a++,u))}catch(e){throw Error(`Invalid regex pattern: ${(null==e?void 0:e.message)||"Unknown error"}`)}else{let e=t.length,n=0;for(;-1!==(n=i.indexOf(t,n));)(0,s.throwIfAborted)(r),i=i.substring(0,n)+u+i.substring(n+e),n+=u.length,a++}i!==o&&(e.innerHTML=i)}),a>0&&(e.synchronizeValues(),e.s.restore()),{replacements:a}}(e,n,r,o,a,u);i=l.replacements,t=l.message}else i=function(e,t,u,n,i,r){let o=0,a=t;if(i)try{let e=RegExp(u,"g");a=a.replace(e,()=>(o++,n))}catch(e){throw Error(`Invalid regex pattern: ${(null==e?void 0:e.message)||"Unknown error"}`)}else{let e=u.length,t=0;for(;-1!==(t=a.indexOf(u,t));)(0,s.throwIfAborted)(r),a=a.substring(0,t)+n+a.substring(t+e),t+=n.length,o++}return o>0&&(e.value=a,e.s.restore(),e.synchronizeValues()),o}(e,e.value,n,r,o,u);return{replacements:i,message:t||(i>0?`Replaced ${i} occurrence(s)`:"No matches found")}}catch(t){throw e.s.restore(),Error(`Failed to replace in document: ${(null==t?void 0:t.message)||"Unknown error"}`)}})()}},12570:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(62553),r=u(56293);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},70750:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="replaceSelection",s="Replace the current selection with new HTML content",i=[{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}],r=!0},36142:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(49459);function r(e,t,u){return(0,n._)(function*(){let n=(0,i.requireString)(t,"html"),{collapseToEnd:r}=t;(0,s.throwIfAborted)(u);try{if(e.s.restore(),e.s.insertHTML(n),r){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,u){"use strict";var n=u(56075),s=u(11886),i=u(70750),r=u(36142);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},90022:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="writeDocument",s="Write (replace) the entire document content with new HTML",i=[{name:"html",type:"string",description:"HTML content to set as the document",required:!0}],r=!0},79766:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(49459);function r(e,t,u){return(0,n._)(function*(){let n=(0,i.requireString)(t,"html",{allowEmpty:!0});(0,s.throwIfAborted)(u);try{return e.s.focus(),e.value=n,e.synchronizeValues(),{success:!0,message:`Document content was replaced with provided HTML(${n.length} characters)`}}catch(e){throw Error(`Failed to replace HTML: ${(null==e?void 0:e.message)||"Unknown error"}`)}})()}},97603:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(90022),r=u(79766);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},80453:function(e,t,u){"use strict";u.d(t,{UIConversationListItem:function(){return l}});var n=u(82749),s=u(31635),i=u(65478),r=u(67510),o=u(62843),a=u(80870);class l extends r.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 u=this.j.c.div("jodit-ui-conversation-list__item-wrapper"),n=this.j.c.div("jodit-ui-conversation-list__item-content"),s=this.j.c.div("jodit-ui-conversation-list__item-title");if(s.textContent=this.conversation.title,this.titleElement=s,n.appendChild(s),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)),n.appendChild(e)}if(u.appendChild(n),this.conversation.messageCount>0){let e=this.j.c.div("jodit-ui-conversation-list__item-badge");e.textContent=String(this.conversation.messageCount),u.appendChild(e)}e.appendChild(u),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,u=this.j.c.element("input");u.type="text",u.value=t,u.className="jodit-ui-conversation-list__item-title-input",e.textContent="",e.appendChild(u),u.focus(),u.select();let n=()=>{if(!this.isRenaming)return;let n=u.value.trim();this.isRenaming=!1,n&&n!==t?(e.textContent=n,this.j.e.fire("renameConversation.ai-assistant-pro",this.conversation.id,n)):e.textContent=t};this.j.e.on(u,"blur",n),this.j.e.on(u,"keydown",n=>{"Enter"===n.key&&(n.preventDefault(),u.blur()),"Escape"===n.key&&(this.isRenaming=!1,e.textContent=t)}),this.j.e.on(u,"click",e=>{e.stopPropagation()})}onDelete(){this.j.e.fire("deleteConversation.ai-assistant-pro",this.conversation.id)}destruct(){var e,t;null==(e=this.actionsButton)||e.destruct(),null==(t=this.contextMenu)||t.destruct(),super.destruct()}constructor(e,t,u=!1,s){super(e),(0,n._)(this,"opts",void 0),(0,n._)(this,"conversation",void 0),(0,n._)(this,"isActive",void 0),(0,n._)(this,"actionsButton",void 0),(0,n._)(this,"contextMenu",void 0),(0,n._)(this,"titleElement",void 0),(0,n._)(this,"isRenaming",void 0),this.opts=s,this.actionsButton=null,this.contextMenu=null,this.titleElement=null,this.isRenaming=!1,this.conversation=t,this.isActive=u,this.contextMenu=new a.ContextMenu(this.j),this.updateContent()}}(0,s.__decorate)([(0,i.watch)("container:click")],l.prototype,"onClick",null),(0,s.__decorate)([i.autobind],l.prototype,"showActionsMenu",null),(0,s.__decorate)([i.autobind],l.prototype,"startInlineRename",null),(0,s.__decorate)([i.autobind],l.prototype,"onDelete",null),l=(0,s.__decorate)([i.component],l)},68365:function(e,t,u){"use strict";u.d(t,{UIConversationList:function(){return F}});var n=u(82749),s=u(31635),i=u(31356),r=u(80453),o=u(65478),a=u(80256),l=u(62405);class F extends l.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>
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.22
4
+ * Version: v4.11.23
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */