jodit-pro 4.11.26 → 4.11.28

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 (335) hide show
  1. package/CHANGELOG.md +115 -1
  2. package/es2015/jodit.css +32 -1
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +6 -6
  5. package/es2015/jodit.js +39 -9
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +3 -3
  8. package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
  9. package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.js +105 -3
  10. package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.min.js +4 -4
  11. package/es2015/plugins/autocomplete/autocomplete.js +1 -1
  12. package/es2015/plugins/autocomplete/autocomplete.min.js +1 -1
  13. package/es2015/plugins/backup/backup.css +1 -1
  14. package/es2015/plugins/backup/backup.js +1 -1
  15. package/es2015/plugins/backup/backup.min.js +1 -1
  16. package/es2015/plugins/button-generator/button-generator.css +1 -1
  17. package/es2015/plugins/button-generator/button-generator.js +1 -1
  18. package/es2015/plugins/button-generator/button-generator.min.js +1 -1
  19. package/es2015/plugins/change-case/change-case.js +1 -1
  20. package/es2015/plugins/change-case/change-case.min.js +1 -1
  21. package/es2015/plugins/color-picker/color-picker.css +1 -1
  22. package/es2015/plugins/color-picker/color-picker.js +1 -1
  23. package/es2015/plugins/color-picker/color-picker.min.js +1 -1
  24. package/es2015/plugins/emoji/emoji.css +1 -1
  25. package/es2015/plugins/emoji/emoji.js +1 -1
  26. package/es2015/plugins/emoji/emoji.min.js +1 -1
  27. package/es2015/plugins/export-docs/export-docs.js +1 -1
  28. package/es2015/plugins/export-docs/export-docs.min.js +1 -1
  29. package/es2015/plugins/finder/finder.css +1 -1
  30. package/es2015/plugins/finder/finder.js +1 -1
  31. package/es2015/plugins/finder/finder.min.js +1 -1
  32. package/es2015/plugins/google-maps/google-maps.css +1 -1
  33. package/es2015/plugins/google-maps/google-maps.js +1 -1
  34. package/es2015/plugins/google-maps/google-maps.min.js +1 -1
  35. package/es2015/plugins/google-search/google-search.js +1 -1
  36. package/es2015/plugins/google-search/google-search.min.js +1 -1
  37. package/es2015/plugins/highlight-signature/highlight-signature.js +1 -1
  38. package/es2015/plugins/highlight-signature/highlight-signature.min.js +1 -1
  39. package/es2015/plugins/iframe-editor/iframe-editor.css +1 -1
  40. package/es2015/plugins/iframe-editor/iframe-editor.js +1 -1
  41. package/es2015/plugins/iframe-editor/iframe-editor.min.js +1 -1
  42. package/es2015/plugins/keyboard/keyboard.css +1 -1
  43. package/es2015/plugins/keyboard/keyboard.js +1 -1
  44. package/es2015/plugins/keyboard/keyboard.min.js +1 -1
  45. package/es2015/plugins/mobile-view/mobile-view.js +1 -1
  46. package/es2015/plugins/mobile-view/mobile-view.min.js +1 -1
  47. package/es2015/plugins/page-break/page-break.js +1 -1
  48. package/es2015/plugins/page-break/page-break.min.js +1 -1
  49. package/es2015/plugins/paste-code/paste-code.css +1 -1
  50. package/es2015/plugins/paste-code/paste-code.js +1 -1
  51. package/es2015/plugins/paste-code/paste-code.min.js +1 -1
  52. package/es2015/plugins/paste-from-word/paste-from-word.js +1 -1
  53. package/es2015/plugins/paste-from-word/paste-from-word.min.js +1 -1
  54. package/es2015/plugins/show-blocks/show-blocks.js +1 -1
  55. package/es2015/plugins/show-blocks/show-blocks.min.js +1 -1
  56. package/es2015/plugins/style/style.css +1 -1
  57. package/es2015/plugins/style/style.js +58 -7
  58. package/es2015/plugins/style/style.min.js +2 -2
  59. package/es2015/plugins/templates/templates.css +1 -1
  60. package/es2015/plugins/templates/templates.js +1 -1
  61. package/es2015/plugins/templates/templates.min.js +1 -1
  62. package/es2015/plugins/todo-list/todo-list.css +1 -1
  63. package/es2015/plugins/todo-list/todo-list.js +1 -1
  64. package/es2015/plugins/todo-list/todo-list.min.js +1 -1
  65. package/es2015/plugins/translate/translate.css +1 -1
  66. package/es2015/plugins/translate/translate.js +1 -1
  67. package/es2015/plugins/translate/translate.min.js +1 -1
  68. package/es2015/plugins/tune-block/tune-block.css +1 -1
  69. package/es2015/plugins/tune-block/tune-block.js +1 -1
  70. package/es2015/plugins/tune-block/tune-block.min.js +1 -1
  71. package/es2018/jodit.fat.min.css +1 -1
  72. package/es2018/jodit.fat.min.js +6 -6
  73. package/es2018/jodit.min.css +1 -1
  74. package/es2018/jodit.min.js +3 -3
  75. package/es2018/plugins/ai-assistant-pro/ai-assistant-pro.min.js +23 -23
  76. package/es2018/plugins/autocomplete/autocomplete.min.js +1 -1
  77. package/es2018/plugins/backup/backup.min.js +1 -1
  78. package/es2018/plugins/button-generator/button-generator.min.js +1 -1
  79. package/es2018/plugins/change-case/change-case.min.js +1 -1
  80. package/es2018/plugins/color-picker/color-picker.min.js +1 -1
  81. package/es2018/plugins/emoji/emoji.min.js +1 -1
  82. package/es2018/plugins/export-docs/export-docs.min.js +1 -1
  83. package/es2018/plugins/finder/finder.min.js +1 -1
  84. package/es2018/plugins/google-maps/google-maps.min.js +1 -1
  85. package/es2018/plugins/google-search/google-search.min.js +1 -1
  86. package/es2018/plugins/highlight-signature/highlight-signature.min.js +1 -1
  87. package/es2018/plugins/iframe-editor/iframe-editor.min.js +1 -1
  88. package/es2018/plugins/keyboard/keyboard.min.js +1 -1
  89. package/es2018/plugins/mobile-view/mobile-view.min.js +1 -1
  90. package/es2018/plugins/page-break/page-break.min.js +1 -1
  91. package/es2018/plugins/paste-code/paste-code.min.js +1 -1
  92. package/es2018/plugins/paste-from-word/paste-from-word.min.js +1 -1
  93. package/es2018/plugins/show-blocks/show-blocks.min.js +1 -1
  94. package/es2018/plugins/style/style.min.js +2 -2
  95. package/es2018/plugins/templates/templates.min.js +1 -1
  96. package/es2018/plugins/todo-list/todo-list.min.js +1 -1
  97. package/es2018/plugins/translate/translate.min.js +1 -1
  98. package/es2018/plugins/tune-block/tune-block.min.js +1 -1
  99. package/es2021/jodit.css +32 -1
  100. package/es2021/jodit.fat.min.css +1 -1
  101. package/es2021/jodit.fat.min.js +6 -6
  102. package/es2021/jodit.js +39 -8
  103. package/es2021/jodit.min.css +1 -1
  104. package/es2021/jodit.min.js +3 -3
  105. package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
  106. package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.js +105 -3
  107. package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.min.js +5 -5
  108. package/es2021/plugins/autocomplete/autocomplete.js +1 -1
  109. package/es2021/plugins/autocomplete/autocomplete.min.js +1 -1
  110. package/es2021/plugins/backup/backup.css +1 -1
  111. package/es2021/plugins/backup/backup.js +1 -1
  112. package/es2021/plugins/backup/backup.min.js +1 -1
  113. package/es2021/plugins/button-generator/button-generator.css +1 -1
  114. package/es2021/plugins/button-generator/button-generator.js +1 -1
  115. package/es2021/plugins/button-generator/button-generator.min.js +1 -1
  116. package/es2021/plugins/change-case/change-case.js +1 -1
  117. package/es2021/plugins/change-case/change-case.min.js +1 -1
  118. package/es2021/plugins/color-picker/color-picker.css +1 -1
  119. package/es2021/plugins/color-picker/color-picker.js +1 -1
  120. package/es2021/plugins/color-picker/color-picker.min.js +1 -1
  121. package/es2021/plugins/emoji/emoji.css +1 -1
  122. package/es2021/plugins/emoji/emoji.js +1 -1
  123. package/es2021/plugins/emoji/emoji.min.js +1 -1
  124. package/es2021/plugins/export-docs/export-docs.js +1 -1
  125. package/es2021/plugins/export-docs/export-docs.min.js +1 -1
  126. package/es2021/plugins/finder/finder.css +1 -1
  127. package/es2021/plugins/finder/finder.js +1 -1
  128. package/es2021/plugins/finder/finder.min.js +1 -1
  129. package/es2021/plugins/google-maps/google-maps.css +1 -1
  130. package/es2021/plugins/google-maps/google-maps.js +1 -1
  131. package/es2021/plugins/google-maps/google-maps.min.js +1 -1
  132. package/es2021/plugins/google-search/google-search.js +1 -1
  133. package/es2021/plugins/google-search/google-search.min.js +1 -1
  134. package/es2021/plugins/highlight-signature/highlight-signature.js +1 -1
  135. package/es2021/plugins/highlight-signature/highlight-signature.min.js +1 -1
  136. package/es2021/plugins/iframe-editor/iframe-editor.css +1 -1
  137. package/es2021/plugins/iframe-editor/iframe-editor.js +1 -1
  138. package/es2021/plugins/iframe-editor/iframe-editor.min.js +1 -1
  139. package/es2021/plugins/keyboard/keyboard.css +1 -1
  140. package/es2021/plugins/keyboard/keyboard.js +1 -1
  141. package/es2021/plugins/keyboard/keyboard.min.js +1 -1
  142. package/es2021/plugins/mobile-view/mobile-view.js +1 -1
  143. package/es2021/plugins/mobile-view/mobile-view.min.js +1 -1
  144. package/es2021/plugins/page-break/page-break.js +1 -1
  145. package/es2021/plugins/page-break/page-break.min.js +1 -1
  146. package/es2021/plugins/paste-code/paste-code.css +1 -1
  147. package/es2021/plugins/paste-code/paste-code.js +1 -1
  148. package/es2021/plugins/paste-code/paste-code.min.js +1 -1
  149. package/es2021/plugins/paste-from-word/paste-from-word.js +1 -1
  150. package/es2021/plugins/paste-from-word/paste-from-word.min.js +1 -1
  151. package/es2021/plugins/show-blocks/show-blocks.js +1 -1
  152. package/es2021/plugins/show-blocks/show-blocks.min.js +1 -1
  153. package/es2021/plugins/style/style.css +1 -1
  154. package/es2021/plugins/style/style.js +56 -5
  155. package/es2021/plugins/style/style.min.js +2 -2
  156. package/es2021/plugins/templates/templates.css +1 -1
  157. package/es2021/plugins/templates/templates.js +1 -1
  158. package/es2021/plugins/templates/templates.min.js +1 -1
  159. package/es2021/plugins/todo-list/todo-list.css +1 -1
  160. package/es2021/plugins/todo-list/todo-list.js +1 -1
  161. package/es2021/plugins/todo-list/todo-list.min.js +1 -1
  162. package/es2021/plugins/translate/translate.css +1 -1
  163. package/es2021/plugins/translate/translate.js +1 -1
  164. package/es2021/plugins/translate/translate.min.js +1 -1
  165. package/es2021/plugins/tune-block/tune-block.css +1 -1
  166. package/es2021/plugins/tune-block/tune-block.js +1 -1
  167. package/es2021/plugins/tune-block/tune-block.min.js +1 -1
  168. package/es2021.en/jodit.css +32 -1
  169. package/es2021.en/jodit.fat.min.css +1 -1
  170. package/es2021.en/jodit.fat.min.js +6 -6
  171. package/es2021.en/jodit.js +39 -8
  172. package/es2021.en/jodit.min.css +1 -1
  173. package/es2021.en/jodit.min.js +3 -3
  174. package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
  175. package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.js +105 -3
  176. package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.min.js +26 -26
  177. package/es2021.en/plugins/autocomplete/autocomplete.js +1 -1
  178. package/es2021.en/plugins/autocomplete/autocomplete.min.js +1 -1
  179. package/es2021.en/plugins/backup/backup.css +1 -1
  180. package/es2021.en/plugins/backup/backup.js +1 -1
  181. package/es2021.en/plugins/backup/backup.min.js +1 -1
  182. package/es2021.en/plugins/button-generator/button-generator.css +1 -1
  183. package/es2021.en/plugins/button-generator/button-generator.js +1 -1
  184. package/es2021.en/plugins/button-generator/button-generator.min.js +1 -1
  185. package/es2021.en/plugins/change-case/change-case.js +1 -1
  186. package/es2021.en/plugins/change-case/change-case.min.js +1 -1
  187. package/es2021.en/plugins/color-picker/color-picker.css +1 -1
  188. package/es2021.en/plugins/color-picker/color-picker.js +1 -1
  189. package/es2021.en/plugins/color-picker/color-picker.min.js +1 -1
  190. package/es2021.en/plugins/emoji/emoji.css +1 -1
  191. package/es2021.en/plugins/emoji/emoji.js +1 -1
  192. package/es2021.en/plugins/emoji/emoji.min.js +1 -1
  193. package/es2021.en/plugins/export-docs/export-docs.js +1 -1
  194. package/es2021.en/plugins/export-docs/export-docs.min.js +1 -1
  195. package/es2021.en/plugins/finder/finder.css +1 -1
  196. package/es2021.en/plugins/finder/finder.js +1 -1
  197. package/es2021.en/plugins/finder/finder.min.js +1 -1
  198. package/es2021.en/plugins/google-maps/google-maps.css +1 -1
  199. package/es2021.en/plugins/google-maps/google-maps.js +1 -1
  200. package/es2021.en/plugins/google-maps/google-maps.min.js +1 -1
  201. package/es2021.en/plugins/google-search/google-search.js +1 -1
  202. package/es2021.en/plugins/google-search/google-search.min.js +1 -1
  203. package/es2021.en/plugins/highlight-signature/highlight-signature.js +1 -1
  204. package/es2021.en/plugins/highlight-signature/highlight-signature.min.js +1 -1
  205. package/es2021.en/plugins/iframe-editor/iframe-editor.css +1 -1
  206. package/es2021.en/plugins/iframe-editor/iframe-editor.js +1 -1
  207. package/es2021.en/plugins/iframe-editor/iframe-editor.min.js +1 -1
  208. package/es2021.en/plugins/keyboard/keyboard.css +1 -1
  209. package/es2021.en/plugins/keyboard/keyboard.js +1 -1
  210. package/es2021.en/plugins/keyboard/keyboard.min.js +1 -1
  211. package/es2021.en/plugins/mobile-view/mobile-view.js +1 -1
  212. package/es2021.en/plugins/mobile-view/mobile-view.min.js +1 -1
  213. package/es2021.en/plugins/page-break/page-break.js +1 -1
  214. package/es2021.en/plugins/page-break/page-break.min.js +1 -1
  215. package/es2021.en/plugins/paste-code/paste-code.css +1 -1
  216. package/es2021.en/plugins/paste-code/paste-code.js +1 -1
  217. package/es2021.en/plugins/paste-code/paste-code.min.js +1 -1
  218. package/es2021.en/plugins/paste-from-word/paste-from-word.js +1 -1
  219. package/es2021.en/plugins/paste-from-word/paste-from-word.min.js +1 -1
  220. package/es2021.en/plugins/show-blocks/show-blocks.js +1 -1
  221. package/es2021.en/plugins/show-blocks/show-blocks.min.js +1 -1
  222. package/es2021.en/plugins/style/style.css +1 -1
  223. package/es2021.en/plugins/style/style.js +56 -5
  224. package/es2021.en/plugins/style/style.min.js +2 -2
  225. package/es2021.en/plugins/templates/templates.css +1 -1
  226. package/es2021.en/plugins/templates/templates.js +1 -1
  227. package/es2021.en/plugins/templates/templates.min.js +1 -1
  228. package/es2021.en/plugins/todo-list/todo-list.css +1 -1
  229. package/es2021.en/plugins/todo-list/todo-list.js +1 -1
  230. package/es2021.en/plugins/todo-list/todo-list.min.js +1 -1
  231. package/es2021.en/plugins/translate/translate.css +1 -1
  232. package/es2021.en/plugins/translate/translate.js +1 -1
  233. package/es2021.en/plugins/translate/translate.min.js +1 -1
  234. package/es2021.en/plugins/tune-block/tune-block.css +1 -1
  235. package/es2021.en/plugins/tune-block/tune-block.js +1 -1
  236. package/es2021.en/plugins/tune-block/tune-block.min.js +1 -1
  237. package/es5/jodit.css +37 -2
  238. package/es5/jodit.fat.min.css +1 -1
  239. package/es5/jodit.fat.min.js +2 -2
  240. package/es5/jodit.js +43 -9
  241. package/es5/jodit.min.css +3 -3
  242. package/es5/jodit.min.js +2 -2
  243. package/es5/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
  244. package/es5/plugins/ai-assistant-pro/ai-assistant-pro.js +169 -3
  245. package/es5/plugins/ai-assistant-pro/ai-assistant-pro.min.js +2 -2
  246. package/es5/plugins/autocomplete/autocomplete.js +1 -1
  247. package/es5/plugins/autocomplete/autocomplete.min.js +1 -1
  248. package/es5/plugins/backup/backup.css +1 -1
  249. package/es5/plugins/backup/backup.js +1 -1
  250. package/es5/plugins/backup/backup.min.js +1 -1
  251. package/es5/plugins/button-generator/button-generator.css +1 -1
  252. package/es5/plugins/button-generator/button-generator.js +1 -1
  253. package/es5/plugins/button-generator/button-generator.min.js +1 -1
  254. package/es5/plugins/change-case/change-case.js +1 -1
  255. package/es5/plugins/change-case/change-case.min.js +1 -1
  256. package/es5/plugins/color-picker/color-picker.css +1 -1
  257. package/es5/plugins/color-picker/color-picker.js +1 -1
  258. package/es5/plugins/color-picker/color-picker.min.js +1 -1
  259. package/es5/plugins/emoji/emoji.css +1 -1
  260. package/es5/plugins/emoji/emoji.js +1 -1
  261. package/es5/plugins/emoji/emoji.min.js +1 -1
  262. package/es5/plugins/export-docs/export-docs.js +1 -1
  263. package/es5/plugins/export-docs/export-docs.min.js +1 -1
  264. package/es5/plugins/finder/finder.css +1 -1
  265. package/es5/plugins/finder/finder.js +1 -1
  266. package/es5/plugins/finder/finder.min.js +1 -1
  267. package/es5/plugins/google-maps/google-maps.css +1 -1
  268. package/es5/plugins/google-maps/google-maps.js +1 -1
  269. package/es5/plugins/google-maps/google-maps.min.js +1 -1
  270. package/es5/plugins/google-search/google-search.js +1 -1
  271. package/es5/plugins/google-search/google-search.min.js +1 -1
  272. package/es5/plugins/highlight-signature/highlight-signature.js +1 -1
  273. package/es5/plugins/highlight-signature/highlight-signature.min.js +1 -1
  274. package/es5/plugins/iframe-editor/iframe-editor.css +1 -1
  275. package/es5/plugins/iframe-editor/iframe-editor.js +1 -1
  276. package/es5/plugins/iframe-editor/iframe-editor.min.js +1 -1
  277. package/es5/plugins/keyboard/keyboard.css +1 -1
  278. package/es5/plugins/keyboard/keyboard.js +1 -1
  279. package/es5/plugins/keyboard/keyboard.min.js +1 -1
  280. package/es5/plugins/mobile-view/mobile-view.js +1 -1
  281. package/es5/plugins/mobile-view/mobile-view.min.js +1 -1
  282. package/es5/plugins/page-break/page-break.js +1 -1
  283. package/es5/plugins/page-break/page-break.min.js +1 -1
  284. package/es5/plugins/paste-code/paste-code.css +1 -1
  285. package/es5/plugins/paste-code/paste-code.js +1 -1
  286. package/es5/plugins/paste-code/paste-code.min.js +1 -1
  287. package/es5/plugins/paste-from-word/paste-from-word.js +1 -1
  288. package/es5/plugins/paste-from-word/paste-from-word.min.js +1 -1
  289. package/es5/plugins/show-blocks/show-blocks.js +1 -1
  290. package/es5/plugins/show-blocks/show-blocks.min.js +1 -1
  291. package/es5/plugins/style/style.css +1 -1
  292. package/es5/plugins/style/style.js +114 -25
  293. package/es5/plugins/style/style.min.js +2 -2
  294. package/es5/plugins/templates/templates.css +1 -1
  295. package/es5/plugins/templates/templates.js +1 -1
  296. package/es5/plugins/templates/templates.min.js +1 -1
  297. package/es5/plugins/todo-list/todo-list.css +1 -1
  298. package/es5/plugins/todo-list/todo-list.js +1 -1
  299. package/es5/plugins/todo-list/todo-list.min.js +1 -1
  300. package/es5/plugins/translate/translate.css +1 -1
  301. package/es5/plugins/translate/translate.js +1 -1
  302. package/es5/plugins/translate/translate.min.js +1 -1
  303. package/es5/plugins/tune-block/tune-block.css +1 -1
  304. package/es5/plugins/tune-block/tune-block.js +1 -1
  305. package/es5/plugins/tune-block/tune-block.min.js +1 -1
  306. package/es5/polyfills.fat.min.js +1 -1
  307. package/es5/polyfills.js +1 -1
  308. package/es5/polyfills.min.js +1 -1
  309. package/esm/config.d.ts +2 -0
  310. package/esm/plugins/ai-assistant-pro/ai-assistant-pro.d.ts +3 -0
  311. package/esm/plugins/ai-assistant-pro/ai-assistant-pro.js +2 -2
  312. package/esm/plugins/ai-assistant-pro/config.js +1 -1
  313. package/esm/plugins/ai-assistant-pro/interface/options.d.ts +40 -0
  314. package/esm/plugins/ai-assistant-pro/providers/jodit-ai-adapter.js +1 -1
  315. package/esm/plugins/autocomplete/autocomplete.js +1 -1
  316. package/esm/plugins/autocomplete/config.d.ts +2 -1
  317. package/esm/plugins/autocomplete/config.js +1 -1
  318. package/esm/plugins/autocomplete/interface.d.ts +1 -0
  319. package/esm/plugins/autocomplete/ui/autocomplete.d.ts +3 -1
  320. package/esm/plugins/autocomplete/ui/autocomplete.js +1 -1
  321. package/esm/plugins/autocomplete/ui/item.d.ts +2 -0
  322. package/esm/plugins/autocomplete/ui/item.js +1 -1
  323. package/esm/plugins/style/helpers/apply-style.js +1 -1
  324. package/esm/plugins/style/helpers/detect-active-style.js +1 -1
  325. package/esm/plugins/style/interface.d.ts +2 -1
  326. package/esm/plugins/style/ui/style-popup.js +1 -1
  327. package/package.json +1 -1
  328. package/types/config.d.ts +2 -0
  329. package/types/plugins/ai-assistant-pro/ai-assistant-pro.d.ts +3 -0
  330. package/types/plugins/ai-assistant-pro/interface/options.d.ts +40 -0
  331. package/types/plugins/autocomplete/config.d.ts +2 -1
  332. package/types/plugins/autocomplete/interface.d.ts +1 -0
  333. package/types/plugins/autocomplete/ui/autocomplete.d.ts +3 -1
  334. package/types/plugins/autocomplete/ui/item.d.ts +2 -0
  335. package/types/plugins/style/interface.d.ts +2 -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.26
4
+ * Version: v4.11.28
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
@@ -200,6 +200,12 @@ function addExtraClasses(editor, def) {
200
200
  }
201
201
  function buildCommitStyleOptions(def) {
202
202
  var _def_classes;
203
+ if (def.attributes) {
204
+ return {
205
+ element: def.element,
206
+ attributes: def.attributes
207
+ };
208
+ }
203
209
  var firstClass = (_def_classes = def.classes) === null || _def_classes === void 0 ? void 0 : _def_classes.filter(Boolean)[0];
204
210
  if (firstClass) {
205
211
  return {
@@ -217,13 +223,17 @@ function applyStyle(editor, def, definitions) {
217
223
  var active = (0,_detect_active_style__WEBPACK_IMPORTED_MODULE_0__.detectActiveStyle)(editor, definitions);
218
224
  if (active) {
219
225
  editor.s.commitStyle(buildCommitStyleOptions(active));
220
- cleanupExtraClasses(editor, active);
226
+ if (!active.attributes) {
227
+ cleanupExtraClasses(editor, active);
228
+ }
221
229
  if (active === def) {
222
230
  return;
223
231
  }
224
232
  }
225
233
  editor.s.commitStyle(buildCommitStyleOptions(def));
226
- addExtraClasses(editor, def);
234
+ if (!def.attributes) {
235
+ addExtraClasses(editor, def);
236
+ }
227
237
  }
228
238
 
229
239
 
@@ -295,19 +305,92 @@ function classifyDefinitions(definitions) {
295
305
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
296
306
  /* harmony export */ detectActiveStyle: function() { return /* binding */ detectActiveStyle; }
297
307
  /* harmony export */ });
298
- /* harmony import */ var jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82758);
299
- /* harmony import */ var jodit_esm_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2748);
308
+ /* harmony import */ var _swc_helpers_sliced_to_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(43284);
309
+ /* harmony import */ var _swc_helpers_type_of__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(61200);
310
+ /* harmony import */ var jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(82758);
311
+ /* harmony import */ var jodit_esm_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2748);
312
+ /* harmony import */ var jodit_esm_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29960);
313
+ /* harmony import */ var jodit_esm_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(41180);
300
314
  /*!
301
315
  * Jodit Editor PRO (https://xdsoft.net/jodit/)
302
316
  * See LICENSE.md in the project root for license information.
303
317
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/
304
318
  */
305
319
 
320
+
321
+
322
+
323
+
324
+ function attributesMatch(el, attrs) {
325
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
326
+ try {
327
+ for(var _iterator = Object.entries(attrs)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
328
+ var _step_value = (0,_swc_helpers_sliced_to_array__WEBPACK_IMPORTED_MODULE_0__._)(_step.value, 2), key = _step_value[0], value = _step_value[1];
329
+ if (value == null) {
330
+ continue;
331
+ }
332
+ if (key === 'class') {
333
+ if (typeof value === 'string' && !el.classList.contains(value)) {
334
+ return false;
335
+ }
336
+ } else if (key === 'style') {
337
+ if ((typeof value === "undefined" ? "undefined" : (0,_swc_helpers_type_of__WEBPACK_IMPORTED_MODULE_1__._)(value)) === 'object' && value != null) {
338
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
339
+ try {
340
+ for(var _iterator1 = Object.entries(value)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
341
+ var _step_value1 = (0,_swc_helpers_sliced_to_array__WEBPACK_IMPORTED_MODULE_0__._)(_step1.value, 2), prop = _step_value1[0], styleValue = _step_value1[1];
342
+ if (styleValue == null) {
343
+ continue;
344
+ }
345
+ if ((0,jodit_esm_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__.css)(el, prop, true) !== String(styleValue)) {
346
+ return false;
347
+ }
348
+ }
349
+ } catch (err) {
350
+ _didIteratorError1 = true;
351
+ _iteratorError1 = err;
352
+ } finally{
353
+ try {
354
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
355
+ _iterator1.return();
356
+ }
357
+ } finally{
358
+ if (_didIteratorError1) {
359
+ throw _iteratorError1;
360
+ }
361
+ }
362
+ }
363
+ }
364
+ } else {
365
+ if ((0,jodit_esm_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_4__.attr)(el, key) !== String(value)) {
366
+ return false;
367
+ }
368
+ }
369
+ }
370
+ } catch (err) {
371
+ _didIteratorError = true;
372
+ _iteratorError = err;
373
+ } finally{
374
+ try {
375
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
376
+ _iterator.return();
377
+ }
378
+ } finally{
379
+ if (_didIteratorError) {
380
+ throw _iteratorError;
381
+ }
382
+ }
383
+ }
384
+ return true;
385
+ }
306
386
  function elementMatchesDefinition(el, def) {
307
387
  var _def_classes;
308
388
  if (el.nodeName.toLowerCase() !== def.element) {
309
389
  return false;
310
390
  }
391
+ if (def.attributes) {
392
+ return attributesMatch(el, def.attributes);
393
+ }
311
394
  var classes = (_def_classes = def.classes) === null || _def_classes === void 0 ? void 0 : _def_classes.filter(Boolean);
312
395
  if (!(classes === null || classes === void 0 ? void 0 : classes.length)) {
313
396
  return true;
@@ -325,15 +408,15 @@ function detectActiveStyle(editor, definitions) {
325
408
  try {
326
409
  for(var _iterator = definitions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
327
410
  var def = _step.value;
328
- if (jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_BLOCK.test(def.element)) {
329
- var block = jodit_esm_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(current, jodit_esm_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock, editor.editor);
411
+ if (jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_BLOCK.test(def.element)) {
412
+ var block = jodit_esm_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.closest(current, jodit_esm_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isBlock, editor.editor);
330
413
  if (block && elementMatchesDefinition(block, def)) {
331
414
  return def;
332
415
  }
333
416
  } else {
334
- var node = jodit_esm_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(current) ? current : current.parentNode;
417
+ var node = jodit_esm_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isElement(current) ? current : current.parentNode;
335
418
  while(node && node !== editor.editor){
336
- if (jodit_esm_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) && elementMatchesDefinition(node, def)) {
419
+ if (jodit_esm_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isElement(node) && elementMatchesDefinition(node, def)) {
337
420
  return def;
338
421
  }
339
422
  node = node.parentNode;
@@ -435,6 +518,7 @@ jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_8__.JoditPro.plugins.add('style', s
435
518
  /* harmony import */ var _helpers_apply_style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31105);
436
519
  /* harmony import */ var _helpers_classify_definitions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8060);
437
520
  /* harmony import */ var _helpers_detect_active_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(69341);
521
+ /* harmony import */ var jodit_esm_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29960);
438
522
  /*!
439
523
  * Jodit Editor PRO (https://xdsoft.net/jodit/)
440
524
  * See LICENSE.md in the project root for license information.
@@ -442,6 +526,7 @@ jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_8__.JoditPro.plugins.add('style', s
442
526
  */
443
527
 
444
528
 
529
+
445
530
  var CLASS_NAME = 'jodit-style-popup';
446
531
  function buildStylePopup(editor, definitions, close) {
447
532
  var groups = (0,_helpers_classify_definitions__WEBPACK_IMPORTED_MODULE_1__.classifyDefinitions)(definitions);
@@ -459,31 +544,35 @@ function buildStylePopup(editor, definitions, close) {
459
544
  try {
460
545
  var _loop = function() {
461
546
  var def = _step1.value;
462
- var _ref;
463
- var _def_classes;
464
547
  var card = editor.c.element('button');
465
548
  card.type = 'button';
466
549
  var isActive = active === def;
467
550
  card.className = "".concat(CLASS_NAME, "__card") + (isActive ? " ".concat(CLASS_NAME, "__card_active_true") : '');
468
551
  var preview = editor.c.div("".concat(CLASS_NAME, "__card-preview"));
469
552
  var previewEl = editor.c.element(def.element);
470
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
471
- try {
472
- for(var _iterator = ((_ref = (_def_classes = def.classes) === null || _def_classes === void 0 ? void 0 : _def_classes.filter(Boolean)) !== null && _ref !== void 0 ? _ref : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
473
- var cls = _step.value;
474
- previewEl.classList.add(cls);
475
- }
476
- } catch (err) {
477
- _didIteratorError = true;
478
- _iteratorError = err;
479
- } finally{
553
+ if (def.attributes) {
554
+ (0,jodit_esm_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_3__.attr)(previewEl, def.attributes);
555
+ } else {
556
+ var _ref;
557
+ var _def_classes;
558
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
480
559
  try {
481
- if (!_iteratorNormalCompletion && _iterator.return != null) {
482
- _iterator.return();
560
+ for(var _iterator = ((_ref = (_def_classes = def.classes) === null || _def_classes === void 0 ? void 0 : _def_classes.filter(Boolean)) !== null && _ref !== void 0 ? _ref : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
561
+ var cls = _step.value;
562
+ previewEl.classList.add(cls);
483
563
  }
564
+ } catch (err) {
565
+ _didIteratorError = true;
566
+ _iteratorError = err;
484
567
  } finally{
485
- if (_didIteratorError) {
486
- throw _iteratorError;
568
+ try {
569
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
570
+ _iterator.return();
571
+ }
572
+ } finally{
573
+ if (_didIteratorError) {
574
+ throw _iteratorError;
575
+ }
487
576
  }
488
577
  }
489
578
  }
@@ -1,8 +1,8 @@
1
1
  /*!
2
2
  * jodit-pro - PRO Version of Jodit Editor
3
3
  * Author: Chupurnov Valerii <chupurnov@gmail.com>
4
- * Version: v4.11.26
4
+ * Version: v4.11.28
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
8
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(self,function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[850],{78955:function(t){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="1.5"> <rect x="2" y="3.5" width="9" height="9" rx="1.5" fill="none"/> <rect x="2" y="14.5" width="9" height="9" rx="1.5" fill="none"/> <rect x="13" y="14.5" width="9" height="9" rx="1.5" fill="none"/> <rect x="13" y="3.5" width="9" height="9" rx="1.5" fill="currentColor" transform="rotate(45 17.5 8)"/> </svg>'},28609:function(t,e,n){"use strict";var r=n(69341),o=n(5440),i=n(78955),l=n.n(i),s=n(6441);s.Config.prototype.customStyles={definitions:[]},s.Config.prototype.controls.style={tooltip:"Styles",icon:l(),isDisabled:function(t){return!t.o.customStyles.definitions.length},isActive:function(t){var e=t.o.customStyles.definitions;return!!e.length&&null!=(0,r.detectActiveStyle)(t,e)},update:function(t,e){var n,o=t.o.customStyles.definitions;if(o.length){var i=(0,r.detectActiveStyle)(t,o),l=(null==(n=e.control)?void 0:n.component)==="select";(t.o.textIcons||l)&&(i?e.state.text=i.name:e.state.text=l?t.i18n("Styles"):"")}},exec:function(){return!1},popup:function(t,e,n){var r=t.o.customStyles.definitions;if(!r.length)return!1;t.s.current()||t.s.focus(),t.s.save();var i=(0,o.buildStylePopup)(t,r,function(){t.s.restore(),n()});return t.e.one("beforePopupClose",function(){t.s.restore()}),i}}},31105:function(t,e,n){"use strict";n.d(e,{applyStyle:function(){return u}});var r=n(69341),o=n(82758),i=n(2748);function l(t,e){var n=t.s.current();if(!n)return null;if(o.IS_BLOCK.test(e.element))return i.Dom.closest(n,i.Dom.isBlock,t.editor);for(var r=i.Dom.isElement(n)?n:n.parentNode;r&&r!==t.editor;){if(i.Dom.isElement(r)&&r.nodeName.toLowerCase()===e.element)return r;r=r.parentNode}return null}function s(t,e){var n=!0,r=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(n=(i=l.next()).done);n=!0){var s=i.value;t.classList.remove(s)}}catch(t){r=!0,o=t}finally{try{n||null==l.return||l.return()}finally{if(r)throw o}}""===t.className&&t.removeAttribute("class")}function a(t){var e,n=null==(e=t.classes)?void 0:e.filter(Boolean)[0];return n?{element:t.element,attributes:{class:n}}:{element:t.element}}function u(t,e,n){var u=(0,r.detectActiveStyle)(t,n);u&&(t.s.commitStyle(a(u)),!function(t,e){var n,r=null==(n=e.classes)?void 0:n.filter(Boolean);if(r&&!(r.length<=1)){var a=t.s.current();if(a)if(o.IS_BLOCK.test(e.element)){var u=i.Dom.closest(a,i.Dom.isBlock,t.editor);u&&s(u,r.slice(1))}else{var c=l(t,e);c&&(s(c,r.slice(1)),"span"!==c.nodeName.toLowerCase()||c.attributes.length||i.Dom.unwrap(c))}}}(t,u),u===e)||(t.s.commitStyle(a(e)),function(t,e){var n,r=null==(n=e.classes)?void 0:n.filter(Boolean);if(r&&!(r.length<=1)){var o=l(t,e);if(o)for(var i=1;i<r.length;i++)o.classList.add(r[i])}}(t,e))}},8060:function(t,e,n){"use strict";n.d(e,{classifyDefinitions:function(){return o}});var r=n(82758);function o(t){var e=[],n=[],o=!0,i=!1,l=void 0;try{for(var s,a=t[Symbol.iterator]();!(o=(s=a.next()).done);o=!0){var u=s.value;r.IS_BLOCK.test(u.element)?e.push(u):n.push(u)}}catch(t){i=!0,l=t}finally{try{o||null==a.return||a.return()}finally{if(i)throw l}}var c=[];return e.length&&c.push({title:"Block styles",definitions:e}),n.length&&c.push({title:"Text styles",definitions:n}),c}},69341:function(t,e,n){"use strict";n.d(e,{detectActiveStyle:function(){return l}});var r=n(82758),o=n(2748);function i(t,e){if(t.nodeName.toLowerCase()!==e.element)return!1;var n,r=null==(n=e.classes)?void 0:n.filter(Boolean);return null==r||!r.length||r.every(function(e){return t.classList.contains(e)})}function l(t,e){var n=t.s.current();if(!n)return null;var l=!0,s=!1,a=void 0;try{for(var u,c=e[Symbol.iterator]();!(l=(u=c.next()).done);l=!0){var f=u.value;if(r.IS_BLOCK.test(f.element)){var d=o.Dom.closest(n,o.Dom.isBlock,t.editor);if(d&&i(d,f))return f}else for(var v=o.Dom.isElement(n)?n:n.parentNode;v&&v!==t.editor;){if(o.Dom.isElement(v)&&i(v,f))return f;v=v.parentNode}}}catch(t){s=!0,a=t}finally{try{l||null==c.return||c.return()}finally{if(s)throw a}}return null}},75554:function(t,e,n){"use strict";n.r(e),n.d(e,{style:function(){return f}});var r=n(80294),o=n(20616),i=n(67709),l=n(82749),s=n(18766),a=n(23078);n(28609);var u=n(50911),c=n(2692),f=function(t){function e(){var t;return(0,o._)(this,e),t=(0,r._)(this,e,arguments),(0,l._)(t,"buttons",[{name:"style",group:"font"}]),t}return(0,s._)(e,t),(0,i._)(e,[{key:"afterInit",value:function(t){}},{key:"beforeDestruct",value:function(t){}}]),e}((0,a._)(u.Plugin));(0,l._)(f,"requires",["license"]),c.JoditPro.plugins.add("style",f)},5440:function(t,e,n){"use strict";n.d(e,{buildStylePopup:function(){return s}});var r=n(31105),o=n(8060),i=n(69341),l="jodit-style-popup";function s(t,e,n){var s=(0,o.classifyDefinitions)(e),a=(0,i.detectActiveStyle)(t,e),u=t.c.div(l),c=!0,f=!1,d=void 0;try{for(var v,y=s[Symbol.iterator]();!(c=(v=y.next()).done);c=!0){var p=v.value,m=t.c.div("".concat(l,"__group-title"));m.textContent=t.i18n(p.title),u.appendChild(m);var h=t.c.div("".concat(l,"__grid")),x=!0,S=!1,g=void 0;try{for(var _,w=p.definitions[Symbol.iterator]();!(x=(_=w.next()).done);x=!0)!function(){var o=_.value,i=t.c.element("button");i.type="button";var s=a===o;i.className="".concat(l,"__card")+(s?" ".concat(l,"__card_active_true"):"");var u=t.c.div("".concat(l,"__card-preview")),c=t.c.element(o.element),f=!0,d=!1,v=void 0;try{for(var y,p,m,x=(null!=(y=null==(p=o.classes)?void 0:p.filter(Boolean))?y:[])[Symbol.iterator]();!(f=(m=x.next()).done);f=!0){var S=m.value;c.classList.add(S)}}catch(t){d=!0,v=t}finally{try{f||null==x.return||x.return()}finally{if(d)throw v}}c.textContent=o.name,u.appendChild(c),i.appendChild(u);var g=t.c.div("".concat(l,"__card-label"));g.textContent=o.name,i.appendChild(g),t.e.on(i,"click",function(){t.s.focus(),(0,r.applyStyle)(t,o,e),t.synchronizeValues(),n()}),h.appendChild(i)}()}catch(t){S=!0,g=t}finally{try{x||null==w.return||w.return()}finally{if(S)throw g}}u.appendChild(h)}}catch(t){f=!0,d=t}finally{try{c||null==y.return||y.return()}finally{if(f)throw d}}return u}}},function(t){return t(t.s=75554)}])});
8
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(self,function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[850],{78955:function(t){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="1.5"> <rect x="2" y="3.5" width="9" height="9" rx="1.5" fill="none"/> <rect x="2" y="14.5" width="9" height="9" rx="1.5" fill="none"/> <rect x="13" y="14.5" width="9" height="9" rx="1.5" fill="none"/> <rect x="13" y="3.5" width="9" height="9" rx="1.5" fill="currentColor" transform="rotate(45 17.5 8)"/> </svg>'},28609:function(t,e,r){"use strict";var n=r(69341),i=r(5440),o=r(78955),l=r.n(o),s=r(6441);s.Config.prototype.customStyles={definitions:[]},s.Config.prototype.controls.style={tooltip:"Styles",icon:l(),isDisabled:function(t){return!t.o.customStyles.definitions.length},isActive:function(t){var e=t.o.customStyles.definitions;return!!e.length&&null!=(0,n.detectActiveStyle)(t,e)},update:function(t,e){var r,i=t.o.customStyles.definitions;if(i.length){var o=(0,n.detectActiveStyle)(t,i),l=(null==(r=e.control)?void 0:r.component)==="select";(t.o.textIcons||l)&&(o?e.state.text=o.name:e.state.text=l?t.i18n("Styles"):"")}},exec:function(){return!1},popup:function(t,e,r){var n=t.o.customStyles.definitions;if(!n.length)return!1;t.s.current()||t.s.focus(),t.s.save();var o=(0,i.buildStylePopup)(t,n,function(){t.s.restore(),r()});return t.e.one("beforePopupClose",function(){t.s.restore()}),o}}},31105:function(t,e,r){"use strict";r.d(e,{applyStyle:function(){return u}});var n=r(69341),i=r(82758),o=r(2748);function l(t,e){var r=t.s.current();if(!r)return null;if(i.IS_BLOCK.test(e.element))return o.Dom.closest(r,o.Dom.isBlock,t.editor);for(var n=o.Dom.isElement(r)?r:r.parentNode;n&&n!==t.editor;){if(o.Dom.isElement(n)&&n.nodeName.toLowerCase()===e.element)return n;n=n.parentNode}return null}function s(t,e){var r=!0,n=!1,i=void 0;try{for(var o,l=e[Symbol.iterator]();!(r=(o=l.next()).done);r=!0){var s=o.value;t.classList.remove(s)}}catch(t){n=!0,i=t}finally{try{r||null==l.return||l.return()}finally{if(n)throw i}}""===t.className&&t.removeAttribute("class")}function a(t){if(t.attributes)return{element:t.element,attributes:t.attributes};var e,r=null==(e=t.classes)?void 0:e.filter(Boolean)[0];return r?{element:t.element,attributes:{class:r}}:{element:t.element}}function u(t,e,r){var u=(0,n.detectActiveStyle)(t,r);(!u||(t.s.commitStyle(a(u)),u.attributes||function(t,e){var r,n=null==(r=e.classes)?void 0:r.filter(Boolean);if(n&&!(n.length<=1)){var a=t.s.current();if(a)if(i.IS_BLOCK.test(e.element)){var u=o.Dom.closest(a,o.Dom.isBlock,t.editor);u&&s(u,n.slice(1))}else{var c=l(t,e);c&&(s(c,n.slice(1)),"span"!==c.nodeName.toLowerCase()||c.attributes.length||o.Dom.unwrap(c))}}}(t,u),u!==e))&&(t.s.commitStyle(a(e)),e.attributes||function(t,e){var r,n=null==(r=e.classes)?void 0:r.filter(Boolean);if(n&&!(n.length<=1)){var i=l(t,e);if(i)for(var o=1;o<n.length;o++)i.classList.add(n[o])}}(t,e))}},8060:function(t,e,r){"use strict";r.d(e,{classifyDefinitions:function(){return i}});var n=r(82758);function i(t){var e=[],r=[],i=!0,o=!1,l=void 0;try{for(var s,a=t[Symbol.iterator]();!(i=(s=a.next()).done);i=!0){var u=s.value;n.IS_BLOCK.test(u.element)?e.push(u):r.push(u)}}catch(t){o=!0,l=t}finally{try{i||null==a.return||a.return()}finally{if(o)throw l}}var c=[];return e.length&&c.push({title:"Block styles",definitions:e}),r.length&&c.push({title:"Text styles",definitions:r}),c}},69341:function(t,e,r){"use strict";r.d(e,{detectActiveStyle:function(){return c}});var n=r(43284),i=r(61200),o=r(82758),l=r(2748),s=r(29960),a=r(41180);function u(t,e){if(t.nodeName.toLowerCase()!==e.element)return!1;if(e.attributes)return function(t,e){var r=!0,o=!1,l=void 0;try{for(var u,c=Object.entries(e)[Symbol.iterator]();!(r=(u=c.next()).done);r=!0){var f=(0,n._)(u.value,2),v=f[0],d=f[1];if(null!=d){if("class"===v){if("string"==typeof d&&!t.classList.contains(d))return!1}else if("style"===v){if((void 0===d?"undefined":(0,i._)(d))==="object"&&null!=d){var y=!0,p=!1,m=void 0;try{for(var h,b=Object.entries(d)[Symbol.iterator]();!(y=(h=b.next()).done);y=!0){var S=(0,n._)(h.value,2),x=S[0],g=S[1];if(null!=g&&(0,a.css)(t,x,!0)!==String(g))return!1}}catch(t){p=!0,m=t}finally{try{y||null==b.return||b.return()}finally{if(p)throw m}}}}else if((0,s.attr)(t,v)!==String(d))return!1}}}catch(t){o=!0,l=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw l}}return!0}(t,e.attributes);var r,o=null==(r=e.classes)?void 0:r.filter(Boolean);return null==o||!o.length||o.every(function(e){return t.classList.contains(e)})}function c(t,e){var r=t.s.current();if(!r)return null;var n=!0,i=!1,s=void 0;try{for(var a,c=e[Symbol.iterator]();!(n=(a=c.next()).done);n=!0){var f=a.value;if(o.IS_BLOCK.test(f.element)){var v=l.Dom.closest(r,l.Dom.isBlock,t.editor);if(v&&u(v,f))return f}else for(var d=l.Dom.isElement(r)?r:r.parentNode;d&&d!==t.editor;){if(l.Dom.isElement(d)&&u(d,f))return f;d=d.parentNode}}}catch(t){i=!0,s=t}finally{try{n||null==c.return||c.return()}finally{if(i)throw s}}return null}},75554:function(t,e,r){"use strict";r.r(e),r.d(e,{style:function(){return f}});var n=r(80294),i=r(20616),o=r(67709),l=r(82749),s=r(18766),a=r(23078);r(28609);var u=r(50911),c=r(2692),f=function(t){function e(){var t;return(0,i._)(this,e),t=(0,n._)(this,e,arguments),(0,l._)(t,"buttons",[{name:"style",group:"font"}]),t}return(0,s._)(e,t),(0,o._)(e,[{key:"afterInit",value:function(t){}},{key:"beforeDestruct",value:function(t){}}]),e}((0,a._)(u.Plugin));(0,l._)(f,"requires",["license"]),c.JoditPro.plugins.add("style",f)},5440:function(t,e,r){"use strict";r.d(e,{buildStylePopup:function(){return a}});var n=r(31105),i=r(8060),o=r(69341),l=r(29960),s="jodit-style-popup";function a(t,e,r){var a=(0,i.classifyDefinitions)(e),u=(0,o.detectActiveStyle)(t,e),c=t.c.div(s),f=!0,v=!1,d=void 0;try{for(var y,p=a[Symbol.iterator]();!(f=(y=p.next()).done);f=!0){var m=y.value,h=t.c.div("".concat(s,"__group-title"));h.textContent=t.i18n(m.title),c.appendChild(h);var b=t.c.div("".concat(s,"__grid")),S=!0,x=!1,g=void 0;try{for(var _,w=m.definitions[Symbol.iterator]();!(S=(_=w.next()).done);S=!0)!function(){var i=_.value,o=t.c.element("button");o.type="button";var a=u===i;o.className="".concat(s,"__card")+(a?" ".concat(s,"__card_active_true"):"");var c=t.c.div("".concat(s,"__card-preview")),f=t.c.element(i.element);if(i.attributes)(0,l.attr)(f,i.attributes);else{var v=!0,d=!1,y=void 0;try{for(var p,m,h,S=(null!=(p=null==(m=i.classes)?void 0:m.filter(Boolean))?p:[])[Symbol.iterator]();!(v=(h=S.next()).done);v=!0){var x=h.value;f.classList.add(x)}}catch(t){d=!0,y=t}finally{try{v||null==S.return||S.return()}finally{if(d)throw y}}}f.textContent=i.name,c.appendChild(f),o.appendChild(c);var g=t.c.div("".concat(s,"__card-label"));g.textContent=i.name,o.appendChild(g),t.e.on(o,"click",function(){t.s.focus(),(0,n.applyStyle)(t,i,e),t.synchronizeValues(),r()}),b.appendChild(o)}()}catch(t){x=!0,g=t}finally{try{S||null==w.return||w.return()}finally{if(x)throw g}}c.appendChild(b)}}catch(t){v=!0,d=t}finally{try{f||null==p.return||p.return()}finally{if(v)throw d}}return c}}},function(t){return t(t.s=75554)}])});
@@ -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.26
4
+ * Version: v4.11.28
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.26
4
+ * Version: v4.11.28
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.26
4
+ * Version: v4.11.28
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.26
4
+ * Version: v4.11.28
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.26
4
+ * Version: v4.11.28
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.26
4
+ * Version: v4.11.28
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.26
4
+ * Version: v4.11.28
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.26
4
+ * Version: v4.11.28
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.26
4
+ * Version: v4.11.28
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.26
4
+ * Version: v4.11.28
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.26
4
+ * Version: v4.11.28
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.26
4
+ * Version: v4.11.28
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.26
4
+ * Version: v4.11.28
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
package/es5/polyfills.js CHANGED
@@ -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.26
4
+ * Version: v4.11.28
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.26
4
+ * Version: v4.11.28
5
5
  * Url: https://xdsoft.net/jodit/pro/
6
6
  * License(s): SEE LICENSE IN LICENSE.md
7
7
  */
package/esm/config.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { IAIAssistantProOptions } from "./plugins/ai-assistant-pro/interface/index";
2
+ import type { AutoCompleteDisplayMode } from "./plugins/autocomplete/interface";
2
3
  import type { IAutoCompleteItem } from "./plugins/autocomplete/interface";
3
4
  import type { AutoCompleteSource } from "./plugins/autocomplete/interface";
4
5
  import type { ISnapshotStorage } from "./plugins/backup/interface";
@@ -39,6 +40,7 @@ interface Config {
39
40
  }
40
41
  interface Config {
41
42
  autocomplete: {
43
+ displayMode: AutoCompleteDisplayMode;
42
44
  maxItems: number;
43
45
  isMatchedQuery: (query: string, value: string) => boolean;
44
46
  itemRenderer: <T = any>(item: IAutoCompleteItem<T>) => string | HTMLElement;
@@ -18,6 +18,9 @@ export declare class aiAssistantPro extends Plugin {
18
18
  * Get or create dialog
19
19
  */
20
20
  private get dialog();
21
+ private textAutocompleteSource;
22
+ private textAutocompleteCache;
23
+ private setupTextAutocomplete;
21
24
  protected afterInit(): void;
22
25
  private __initedPromise;
23
26
  private __loadData;
@@ -1,3 +1,3 @@
1
- var j=Object.defineProperty;var f=(m,t)=>j(m,"name",{value:t,configurable:!0});var u,h=function(m,t,e,a){var s=arguments.length,i=s<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,e):a,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(m,t,e,a);else for(var o=m.length-1;o>=0;o--)(n=m[o])&&(i=(s<3?n(i):s>3?n(t,e,i):n(t,e))||i);return s>3&&i&&Object.defineProperty(t,e,i),i};import"./config.js";import{APIClient as x}from"./helpers/api-client.js";import{PermissionManager as T}from"./helpers/permission-manager.js";import{StateManager as A}from"./helpers/state-manager.js";import{createStorageProvider as D,WebStorageConversationStorage as I}from"./helpers/storage/index.js";import{ToolRegistry as S}from"./helpers/tool-registry.js";import{UIMainPanel as b}from"./ui/main-panel/index.js";import{applyTheme as R,areAllToolCallsExecuted as E,createNewConversation as M,createUserMessage as v,deleteConversationWithCleanup as O,executeToolCall as k,findMessagesWithPendingToolCalls as W,findParentMessageId as F,getCurrentSelectionContext as _,handleBackToList as z,handleConversationSearch as H,handleConversationSelect as q,handleToolApproval as L,handleToolDenial as Q,invertMode as V,isTerminalToolCallStatus as $,loadInitialData as N,processArtifacts as U,processFinalResponse as B,processStreamingResponse as G,resizeInPanelView as y,updateToolCallInMessage as J}from"./core/index.js";import*as X from"./langs/index.js";import{IS_PROD as Y}from"jodit/esm/core/constants.js";import{cache as c,cached as p,component as Z,debounce as K,watch as d}from"jodit/esm/core/decorators/index.js";import{extendLang as tt}from"jodit/esm/core/global.js";import{isAbortError as C,isString as et}from"jodit/esm/core/helpers/index.js";import{Plugin as st}from"jodit/esm/core/plugin/index.js";import{JoditPro as at}from"../../jodit-pro.js";import{UIFlightPosition as w}from"../../traits/flight-position/flight-position.js";import{UIResize as P}from"../../traits/resize/resize.js";let r=(u=class extends st{constructor(){super(...arguments),this.buttons=[{name:"aiAssistantPro",group:"insert"},{name:"aiCommandsPro",group:"insert"}],this.__initedPromise=null,this.__openedMode=null}get state(){return this.stateManager.state}get toolRegistry(){return new S(this.j)}get permissionManager(){return new T(this.j,this.toolRegistry)}get apiClient(){return new x(this.j,this.toolRegistry)}get storage(){const{storage:t,storageKey:e,maxConversations:a}=this.j.o.aiAssistantPro;if(typeof t=="string"){const s=D(t,e);return new I(s,a)}return t}get stateManager(){return new A(this.j)}get mainPanel(){return new b(this.j,this.stateManager.state,this.j.o.aiAssistantPro,t=>{const e=this.stateManager.getCurrentConversation();e&&this.stateManager.setCurrentConversation({...e,...t})})}get dialog(){const t=this.j.dlg({resizable:this.j.o.aiAssistantPro.resizable,eventEmmiter:this.j.e});return t.e.on(t,"afterClose",()=>{this.j.e.fire("closeAIAssistantPro.ai-assistant-pro")}),t}afterInit(){tt(X),this.setupEventListeners(),this.j.async.promise(t=>{const{initiallyOpened:e,persistOpenState:a}=this.j.o.aiAssistantPro;let s=e;if(a){this.storage.getGlobalSettings().then(i=>{if(i?.isOpen!=null&&(s=i.isOpen),s)return this.openAssistant()}).catch(()=>null).finally(()=>t(void 0));return}t(void 0)}).catch(()=>null)}__loadData(){return this.__initedPromise?this.__initedPromise:this.isDestructed?Promise.reject():(this.__initedPromise=this.j.async.promise(t=>{this.loadInitialData().then(t)}).catch(()=>null),this.__initedPromise)}async loadInitialData(){this.mainPanel.setMod("ready",!0),await N(this.j,this.storage,this.stateManager),await this.restorePendingToolCalls()}async restorePendingToolCalls(){const t=this.stateManager.getCurrentConversation();if(!t)return;const e=W(t);if(e.length!==0)for(const a of e)await this.handleToolCalls(a.id)}setupEventListeners(){this.j.e.on("selectConversation.ai-assistant-pro",async t=>{try{await this.__loadData(),await q(t,this.storage,this.stateManager)}catch(e){Y||console.log(e)}}),this.j.e.on("newConversation.ai-assistant-pro",async()=>{await this.__loadData();const t=M(this.j,this.state.defaultModel,this.state.defaultTemperature);this.stateManager.setCurrentConversation(t)}),this.j.e.on("deleteConversation.ai-assistant-pro",async t=>{await this.__loadData(),await this.deleteConversation(t)}),this.j.e.on("renameConversation.ai-assistant-pro",async(t,e)=>{await this.__loadData(),await this.renameConversation(t,e)}),this.j.e.on("backToList.ai-assistant-pro",async()=>{await this.__loadData(),await z(this.storage,this.stateManager)}),this.j.e.on("removeContext.ai-assistant-pro",async t=>{await this.__loadData(),this.stateManager.removeSelectionContext(t)}),this.j.e.on("approveToolCall.ai-assistant-pro",async(t,e)=>{try{await this.__loadData();const a=await L(t,e,this.stateManager,this.permissionManager,this.storage);if(a){const s=this.stateManager.getCurrentConversation();if(!s)return;const i=s.messages.find(n=>{var o;return(o=n.toolCalls)===null||o===void 0?void 0:o.some(l=>l.id===a.id)});if(!i)return;await this.executeToolCall(i.id,a)}}catch(a){if(C(a))return;this.stateManager.setError(a instanceof Error?a.message:String(a))}}),this.j.e.on("denyToolCall.ai-assistant-pro",async t=>{await this.__loadData(),await Q(this.j,t,this.stateManager,this.storage)}),this.j.e.on("abortRequest.ai-assistant-pro",async()=>{await this.__loadData(),this.apiClient.abort(),this.stateManager.setLoading(!1)})}__applyTheme(){R(this.j,this.stateManager.state.theme,this.stateManager.state.displayMode,this.mainPanel.container,this.dialog)}async openAssistant(){if(this.stateManager.isOpen()){this.stateManager.close(),await this.__closeInContainer();return}await this.__loadData(),!this.isDestructed&&(this.stateManager.open(),await this.__openInContainer(),this.j.o.aiAssistantPro.includeSelectionByDefault&&!this.j.s.isCollapsed()&&this.addCurrentSelectionToContext())}async __openInContainer(){const{resizable:t,allowClose:e,flightPanelHeight:a}=this.j.o.aiAssistantPro,{displayMode:s="right",panelWidth:i,panelHeight:n}=this.stateManager.state;switch(this.__applyTheme(),this.mainPanel.setMod("displayMode",s),this.mainPanel.setMod("allowClose",e),this.mainPanel.setParentView(s==="dialog"||s==="flight"?this.dialog:this.j),this.__openedMode=s,s){case"dialog":{this.dialog.setSize(i,n).open().setContent(this.mainPanel.container);break}case"flight":{w.install(this.mainPanel,this.j.container,{panelHeight:a,containerClassName:this.getFullElName("flight-container")});break}default:{t&&(P.remove(this.mainPanel),P.install(this.mainPanel,V(s),{handleClassName:this.getFullElName("ai-assistent-resize-handle"),onResize:f(({newSize:o})=>{const l=s==="left"||s==="right"?o:i,g=s==="top"||s==="bottom"?o:n;return this.stateManager.state.panelWidth=l,this.stateManager.state.panelHeight=g,!0},"onResize")})),this.j.currentPlace.slots[s].appendChild(this.mainPanel.container),y(this.j,s,i,n);break}}}__onResizeInPanelView(){const{displayMode:t,panelWidth:e,panelHeight:a}=this.stateManager.state;y(this.j,t,e,a)}async __closeInContainer(){const{displayMode:t}=await this.stateManager.state;switch(this.__openedMode!==t&&this.__openedMode==="dialog"&&this.dialog.close(),this.__openedMode!==t&&this.__openedMode==="flight"&&this.__closeFlightMode(),t){case"dialog":{this.dialog.close();break}case"flight":{this.__closeFlightMode();break}default:{this.mainPanel.container.remove();break}}}__closeFlightMode(){w.remove(this.mainPanel)}__onSavedStateChange(){var t;const e=this.stateManager.state;return this.storage.saveGlobalSettings({displayMode:e.displayMode,panelWidth:e.panelWidth,panelHeight:e.panelHeight,theme:e.theme,defaultModel:e.defaultModel,defaultTemperature:e.defaultTemperature,currentConversationId:(t=e.currentConversation)===null||t===void 0?void 0:t.id,...this.j.o.aiAssistantPro.persistOpenState?{isOpen:e.isOpen}:{}})}async closeAssistant(){this.stateManager.isOpen()&&(await this.__loadData(),this.stateManager.close(),this.__closeInContainer())}async addCurrentSelectionToContext(){await this.__loadData();const t=_(this.j);t&&this.stateManager.addSelectionContext(t)}async executeQuickCommand(t){const{quickCommandsSilentMode:e,quickCommandsDisplayMode:a}=this.j.o.aiAssistantPro,s=this.j.o.aiAssistant;let i;if(s&&s[t]&&et(s[t])&&(i=s[t]),!i){this.j.e.fire("error",`Command not found: ${t}`);return}const n=this.j.s.isCollapsed()?this.j.value:this.j.s.html;if(!n)return;const o=s?.aiCommonPrefixPrompt||"",l=s?.aiCommonSuffixPrompt||"",g=`${o}${i}${l}
1
+ var b=Object.defineProperty;var _=(M,t)=>b(M,"name",{value:t,configurable:!0});var f,h=function(M,t,e,a){var s=arguments.length,i=s<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,e):a,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(M,t,e,a);else for(var o=M.length-1;o>=0;o--)(n=M[o])&&(i=(s<3?n(i):s>3?n(t,e,i):n(t,e))||i);return s>3&&i&&Object.defineProperty(t,e,i),i};import"./config.js";import{APIClient as R}from"./helpers/api-client.js";import{PermissionManager as E}from"./helpers/permission-manager.js";import{StateManager as O}from"./helpers/state-manager.js";import{createStorageProvider as k,WebStorageConversationStorage as W}from"./helpers/storage/index.js";import{ToolRegistry as z}from"./helpers/tool-registry.js";import{UIMainPanel as F}from"./ui/main-panel/index.js";import{applyTheme as L,areAllToolCallsExecuted as H,createNewConversation as y,createUserMessage as j,deleteConversationWithCleanup as q,executeToolCall as Q,findMessagesWithPendingToolCalls as $,findParentMessageId as V,getCurrentSelectionContext as A,handleBackToList as N,handleConversationSearch as U,handleConversationSelect as B,handleToolApproval as G,handleToolDenial as J,invertMode as X,isTerminalToolCallStatus as Y,loadInitialData as Z,processArtifacts as K,processFinalResponse as tt,processStreamingResponse as et,resizeInPanelView as T,updateToolCallInMessage as st}from"./core/index.js";import*as at from"./langs/index.js";import{IS_PROD as it}from"jodit/esm/core/constants.js";import{cache as u,cached as p,component as nt,debounce as ot,watch as d}from"jodit/esm/core/decorators/index.js";import{extendLang as rt}from"jodit/esm/core/global.js";import{isAbortError as w,isString as lt}from"jodit/esm/core/helpers/index.js";import{Plugin as ht}from"jodit/esm/core/plugin/index.js";import{JoditPro as ct}from"../../jodit-pro.js";import{UIFlightPosition as D}from"../../traits/flight-position/flight-position.js";import{UIResize as S}from"../../traits/resize/resize.js";let l=(f=class extends ht{constructor(){super(...arguments),this.buttons=[{name:"aiAssistantPro",group:"insert"},{name:"aiCommandsPro",group:"insert"}],this.textAutocompleteSource=null,this.textAutocompleteCache=new Map,this.__initedPromise=null,this.__openedMode=null}get state(){return this.stateManager.state}get toolRegistry(){return new z(this.j)}get permissionManager(){return new E(this.j,this.toolRegistry)}get apiClient(){return new R(this.j,this.toolRegistry)}get storage(){const{storage:t,storageKey:e,maxConversations:a}=this.j.o.aiAssistantPro;if(typeof t=="string"){const s=k(t,e);return new W(s,a)}return t}get stateManager(){return new O(this.j)}get mainPanel(){return new F(this.j,this.stateManager.state,this.j.o.aiAssistantPro,t=>{const e=this.stateManager.getCurrentConversation();e&&this.stateManager.setCurrentConversation({...e,...t})})}get dialog(){const t=this.j.dlg({resizable:this.j.o.aiAssistantPro.resizable,eventEmmiter:this.j.e});return t.e.on(t,"afterClose",()=>{this.j.e.fire("closeAIAssistantPro.ai-assistant-pro")}),t}setupTextAutocomplete(){const{textAutocompleteEnabled:t,textAutocompleteApiRequest:e,textAutocompleteMinQueryLength:a,textAutocompleteMaxSuggestions:s,textAutocompleteDebounceMs:i,textAutocompleteCacheTTL:n,textAutocompleteCacheMaxSize:o}=this.j.o.aiAssistantPro;if(!t||!e)return;this.j.o.autocomplete={...this.j.o.autocomplete,displayMode:"inline"};const r=this.textAutocompleteCache;let c=null;this.textAutocompleteSource=v=>{if(v.length<a)return[];const P=`${v}:${s}`;if(n>0){const g=r.get(P);if(g&&Date.now()-g.ts<n)return g.data.map(m=>({value:m,title:m}))}c&&clearTimeout(c);const I=new AbortController;return new Promise(g=>{c=setTimeout(async()=>{try{const m=await e(v,s,I.signal);if(Array.isArray(m)){const x=m.slice(0,s);if(n>0){if(r.size>=o){const C=r.keys().next().value;C!=null&&r.delete(C)}r.set(P,{ts:Date.now(),data:x})}g(x.map(C=>({value:C,title:C})));return}g([])}catch{g([])}},i)})},this.j.e.fire("registerAutocompleteSource",this.textAutocompleteSource)}afterInit(){rt(at),this.setupEventListeners(),this.setupTextAutocomplete(),this.j.async.promise(t=>{const{initiallyOpened:e,persistOpenState:a}=this.j.o.aiAssistantPro;let s=e;if(a){this.storage.getGlobalSettings().then(i=>{if(i?.isOpen!=null&&(s=i.isOpen),s)return this.openAssistant()}).catch(()=>null).finally(()=>t(void 0));return}t(void 0)}).catch(()=>null)}__loadData(){return this.__initedPromise?this.__initedPromise:this.isDestructed?Promise.reject():(this.__initedPromise=this.j.async.promise(t=>{this.loadInitialData().then(t)}).catch(()=>null),this.__initedPromise)}async loadInitialData(){this.mainPanel.setMod("ready",!0),await Z(this.j,this.storage,this.stateManager),await this.restorePendingToolCalls()}async restorePendingToolCalls(){const t=this.stateManager.getCurrentConversation();if(!t)return;const e=$(t);if(e.length!==0)for(const a of e)await this.handleToolCalls(a.id)}setupEventListeners(){this.j.e.on("selectConversation.ai-assistant-pro",async t=>{try{await this.__loadData(),await B(t,this.storage,this.stateManager)}catch(e){it||console.log(e)}}),this.j.e.on("newConversation.ai-assistant-pro",async()=>{await this.__loadData();const t=y(this.j,this.state.defaultModel,this.state.defaultTemperature);this.stateManager.setCurrentConversation(t)}),this.j.e.on("deleteConversation.ai-assistant-pro",async t=>{await this.__loadData(),await this.deleteConversation(t)}),this.j.e.on("renameConversation.ai-assistant-pro",async(t,e)=>{await this.__loadData(),await this.renameConversation(t,e)}),this.j.e.on("backToList.ai-assistant-pro",async()=>{await this.__loadData(),await N(this.storage,this.stateManager)}),this.j.e.on("removeContext.ai-assistant-pro",async t=>{await this.__loadData(),this.stateManager.removeSelectionContext(t)}),this.j.e.on("approveToolCall.ai-assistant-pro",async(t,e)=>{try{await this.__loadData();const a=await G(t,e,this.stateManager,this.permissionManager,this.storage);if(a){const s=this.stateManager.getCurrentConversation();if(!s)return;const i=s.messages.find(n=>{var o;return(o=n.toolCalls)===null||o===void 0?void 0:o.some(r=>r.id===a.id)});if(!i)return;await this.executeToolCall(i.id,a)}}catch(a){if(w(a))return;this.stateManager.setError(a instanceof Error?a.message:String(a))}}),this.j.e.on("denyToolCall.ai-assistant-pro",async t=>{await this.__loadData(),await J(this.j,t,this.stateManager,this.storage)}),this.j.e.on("abortRequest.ai-assistant-pro",async()=>{await this.__loadData(),this.apiClient.abort(),this.stateManager.setLoading(!1)})}__applyTheme(){L(this.j,this.stateManager.state.theme,this.stateManager.state.displayMode,this.mainPanel.container,this.dialog)}async openAssistant(){if(this.stateManager.isOpen()){this.stateManager.close(),await this.__closeInContainer();return}await this.__loadData(),!this.isDestructed&&(this.stateManager.open(),await this.__openInContainer(),this.j.o.aiAssistantPro.includeSelectionByDefault&&!this.j.s.isCollapsed()&&this.addCurrentSelectionToContext())}async __openInContainer(){const{resizable:t,allowClose:e,flightPanelHeight:a}=this.j.o.aiAssistantPro,{displayMode:s="right",panelWidth:i,panelHeight:n}=this.stateManager.state;switch(this.__applyTheme(),this.mainPanel.setMod("displayMode",s),this.mainPanel.setMod("allowClose",e),this.mainPanel.setParentView(s==="dialog"||s==="flight"?this.dialog:this.j),this.__openedMode=s,s){case"dialog":{this.dialog.setSize(i,n).open().setContent(this.mainPanel.container);break}case"flight":{D.install(this.mainPanel,this.j.container,{panelHeight:a,containerClassName:this.getFullElName("flight-container")});break}default:{t&&(S.remove(this.mainPanel),S.install(this.mainPanel,X(s),{handleClassName:this.getFullElName("ai-assistent-resize-handle"),onResize:_(({newSize:o})=>{const r=s==="left"||s==="right"?o:i,c=s==="top"||s==="bottom"?o:n;return this.stateManager.state.panelWidth=r,this.stateManager.state.panelHeight=c,!0},"onResize")})),this.j.currentPlace.slots[s].appendChild(this.mainPanel.container),T(this.j,s,i,n);break}}}__onResizeInPanelView(){const{displayMode:t,panelWidth:e,panelHeight:a}=this.stateManager.state;T(this.j,t,e,a)}async __closeInContainer(){const{displayMode:t}=await this.stateManager.state;switch(this.__openedMode!==t&&this.__openedMode==="dialog"&&this.dialog.close(),this.__openedMode!==t&&this.__openedMode==="flight"&&this.__closeFlightMode(),t){case"dialog":{this.dialog.close();break}case"flight":{this.__closeFlightMode();break}default:{this.mainPanel.container.remove();break}}}__closeFlightMode(){D.remove(this.mainPanel)}__onSavedStateChange(){var t;const e=this.stateManager.state;return this.storage.saveGlobalSettings({displayMode:e.displayMode,panelWidth:e.panelWidth,panelHeight:e.panelHeight,theme:e.theme,defaultModel:e.defaultModel,defaultTemperature:e.defaultTemperature,currentConversationId:(t=e.currentConversation)===null||t===void 0?void 0:t.id,...this.j.o.aiAssistantPro.persistOpenState?{isOpen:e.isOpen}:{}})}async closeAssistant(){this.stateManager.isOpen()&&(await this.__loadData(),this.stateManager.close(),this.__closeInContainer())}async addCurrentSelectionToContext(){await this.__loadData();const t=A(this.j);t&&this.stateManager.addSelectionContext(t)}async executeQuickCommand(t){const{quickCommandsSilentMode:e,quickCommandsDisplayMode:a}=this.j.o.aiAssistantPro,s=this.j.o.aiAssistant;let i;if(s&&s[t]&&lt(s[t])&&(i=s[t]),!i){this.j.e.fire("error",`Command not found: ${t}`);return}const n=this.j.s.isCollapsed()?this.j.value:this.j.s.html;if(!n)return;const o=s?.aiCommonPrefixPrompt||"",r=s?.aiCommonSuffixPrompt||"",c=`${o}${i}${r}
2
2
 
3
- ${n}`.trim();e?await this.__executeQuickCommandSilent(g,n):await this.__executeQuickCommandWithPanel(g,a)}async __executeQuickCommandSilent(t,e){await this.__loadData(),this.j.progressbar.show().progress(100);try{const a=v(t),s=M(this.j,this.state.defaultModel,this.state.defaultTemperature,[a]),i=await this.apiClient.sendRequest(s.id,s.messages,null,[],s.options);if(i.mode==="final"){const n=i.response.content;n&&this.j.s.insertHTML(n)}}catch(a){C(a)||this.j.e.fire("error",a)}finally{this.j.progressbar.hide()}}async __executeQuickCommandWithPanel(t,e){await this.__loadData();const a=this.stateManager.state.displayMode;this.stateManager.state.displayMode=e;const s=_(this.j);s&&this.stateManager.addSelectionContext(s),this.stateManager.isOpen()||await this.openAssistant(),await this.sendMessage(t),this.stateManager.state.displayMode=a}async sendMessage(t){await this.__loadData();let e=this.stateManager.getCurrentConversation();const a=this.stateManager.getEditingMessageId();if(a&&e){const i=e.messages.findIndex(n=>n.id===a);if(i!==-1){const n=e.messages.slice(0,i),o={...e,messages:n,updatedAt:Date.now()};this.stateManager.setCurrentConversation(o),await this.storage.save(o),this.stateManager.clearEditingMessage(),e=o}}e||(e=M(this.j,this.state.defaultModel,this.state.defaultTemperature),this.stateManager.setCurrentConversation(e));let s=null;t.trim()&&(s=v(t),e.title||(e={...e,title:t}),e={...e,updated:Date.now(),messages:[...e.messages,s]}),this.stateManager.setCurrentConversation({...e}),s&&this.j.e.fire("messageSent.ai-assistant-pro",s),this.stateManager.setLoading(!0),this.stateManager.clearError();try{await this.sendRequestToAI(0),this.stateManager.clearSelectionContexts()}catch(i){if(C(i))return;this.stateManager.setError(i instanceof Error?i.message:String(i))}finally{this.stateManager.setLoading(!1)}}async sendRequestToAI(t=0){const e=this.j.o.aiAssistantPro.maxRecursionToolCallDepth;if(t>=e)throw Error(`Max recursion depth ${e} reached for tool calls`);let a=this.stateManager.getCurrentConversation();if(!a)return;const s=F(a),[i]=await Promise.all([this.apiClient.sendRequest(a.id,a.messages,s,this.stateManager.getSelectionContexts(),a.options),this.storage.save(a)]);let n,o;if(i.mode==="stream"){const l=await G(this.stateManager,i,a);n=l.aiMessage,o=l.index,a=l.conversation}else{const l=B(i,a);n=l.aiMessage,o=l.index,a=l.conversation}a=await U(this.j,n,a,o),this.j.e.fire("messageReceived.ai-assistant-pro",n),this.stateManager.setCurrentConversation({...a}),await this.storage.save(a),await this.handleToolCalls(n.id,t)}async deleteConversation(t){await this.__loadData(),await O(this.j,t,this.storage,this.stateManager,this.permissionManager)}async renameConversation(t,e){var a;const s=await this.storage.get(t);if(!s)return;const i={...s,title:e,updated:Date.now()};await this.storage.save(i),((a=this.state.currentConversation)===null||a===void 0?void 0:a.id)===t&&this.stateManager.setCurrentConversation(i);const n=await this.storage.list();this.stateManager.setConversations(n)}async searchConversations(t){await this.__loadData(),await H(t,this.storage,this.stateManager)}async handleToolCalls(t,e=0){const a=this.stateManager.getCurrentConversation();if(!a)return;const s=a.messages.find(g=>g.id===t);if(!s)return;const i=s.toolCalls;if(!i||i.length===0)return;const n=i.filter(g=>!$(g.status));if(n.length===0)return;const{approved:o,needsPermission:l}=this.permissionManager.filterToolCalls(n,a.permissions);this.stateManager.setPendingToolCalls(l);for(const g of o)await this.executeToolCall(t,g,e)}async executeToolCall(t,e,a=0){let s=this.stateManager.getCurrentConversation();if(!s)return;const i=await k(this.j,e,this.toolRegistry),n=s.messages.findIndex(g=>g.id===t);if(n===-1)return;const o=s.messages[n],l=s.messages.slice();l[n]=J(o,i),s={...s,messages:l,updated:Date.now()},this.stateManager.setCurrentConversation(s),E(s)&&await this.sendRequestToAI(a+1)}async copyMessage(t){const e=this.stateManager.getCurrentConversation();if(!e)return;const a=e.messages.find(s=>s.id===t);if(a)try{await navigator.clipboard.writeText(a.content),this.j.message.success("Message copied to clipboard")}catch{this.j.e.fire("error",new Error("Failed to copy message"))}}async restartFromMessage(t){const e=this.stateManager.getCurrentConversation();if(!e)return;const a=e.messages.findIndex(o=>o.id===t);if(a===-1)return;const s=e.messages[a];if(s.role!=="user")return;await this.__loadData();const i=e.messages.slice(0,a),n={...e,messages:i,updatedAt:Date.now()};this.stateManager.setCurrentConversation(n),await this.storage.save(n),await this.sendMessage(s.content)}async editMessage(t){const e=this.stateManager.getCurrentConversation();if(!e)return;const a=e.messages.find(s=>s.id===t);!a||a.role!=="user"||(this.stateManager.setEditingMessageId(t),this.mainPanel.inputArea.setValue(a.content),this.mainPanel.inputArea.focus())}cancelEditMessage(){this.stateManager.isEditingMessage()&&(this.stateManager.clearEditingMessage(),this.mainPanel.inputArea.setValue(""))}async deleteMessage(t){await this.__loadData();const e=this.stateManager.getCurrentConversation();if(!e||e.messages.findIndex(n=>n.id===t)===-1)return;const s=e.messages.filter(n=>n.id!==t),i={...e,messages:s,updatedAt:Date.now()};this.stateManager.setCurrentConversation(i),await this.storage.save(i)}beforeDestruct(){var t,e,a,s,i,n,o,l;this.__closeFlightMode(),(t=p(this,"toolRegistry"))===null||t===void 0||t.destruct(),(e=p(this,"permissionManager"))===null||e===void 0||e.destruct(),(a=p(this,"apiClient"))===null||a===void 0||a.destruct(),(s=p(this,"stateManager"))===null||s===void 0||s.destruct(),(i=p(this,"mainPanel"))===null||i===void 0||i.destruct(),(n=p(this,"dialog"))===null||n===void 0||n.destruct(),(l=(o=p(this,"storage"))===null||o===void 0?void 0:o.close)===null||l===void 0||l.call(o)}},f(u,"aiAssistantPro"),u);r.requires=["license"],h([c],r.prototype,"toolRegistry",null),h([c],r.prototype,"permissionManager",null),h([c],r.prototype,"apiClient",null),h([c],r.prototype,"storage",null),h([c],r.prototype,"stateManager",null),h([c],r.prototype,"mainPanel",null),h([c],r.prototype,"dialog",null),h([d("state.theme")],r.prototype,"__applyTheme",null),h([d(":openAIAssistantPro.ai-assistant-pro")],r.prototype,"openAssistant",null),h([d([":resize","state.panelWidth","state.panelHeight"])],r.prototype,"__onResizeInPanelView",null),h([d(["state.isOpen","state.displayMode","state.panelWidth","state.panelHeight","state.theme","state.defaultModel","state.defaultTemperature","state.currentConversation"]),K()],r.prototype,"__onSavedStateChange",null),h([d(":closeAIAssistantPro.ai-assistant-pro")],r.prototype,"closeAssistant",null),h([d(":addContextToAIAssistant.ai-assistant-pro")],r.prototype,"addCurrentSelectionToContext",null),h([d(":executeQuickCommand.ai-assistant-pro")],r.prototype,"executeQuickCommand",null),h([d(":sendMessage.ai-assistant-pro")],r.prototype,"sendMessage",null),h([d(":searchConversations.ai-assistant-pro")],r.prototype,"searchConversations",null),h([d(":copyMessage.ai-assistant-pro")],r.prototype,"copyMessage",null),h([d(":restartFromMessage.ai-assistant-pro")],r.prototype,"restartFromMessage",null),h([d(":editMessage.ai-assistant-pro")],r.prototype,"editMessage",null),h([d(":cancelEditMessage.ai-assistant-pro")],r.prototype,"cancelEditMessage",null),h([d(":deleteMessage.ai-assistant-pro")],r.prototype,"deleteMessage",null),r=h([Z],r);at.plugins.add("aiAssistantPro",r);export{r as aiAssistantPro};
3
+ ${n}`.trim();e?await this.__executeQuickCommandSilent(c,n):await this.__executeQuickCommandWithPanel(c,a)}async __executeQuickCommandSilent(t,e){await this.__loadData(),this.j.progressbar.show().progress(100);try{const a=j(t),s=y(this.j,this.state.defaultModel,this.state.defaultTemperature,[a]),i=await this.apiClient.sendRequest(s.id,s.messages,null,[],s.options);if(i.mode==="final"){const n=i.response.content;n&&this.j.s.insertHTML(n)}}catch(a){w(a)||this.j.e.fire("error",a)}finally{this.j.progressbar.hide()}}async __executeQuickCommandWithPanel(t,e){await this.__loadData();const a=this.stateManager.state.displayMode;this.stateManager.state.displayMode=e;const s=A(this.j);s&&this.stateManager.addSelectionContext(s),this.stateManager.isOpen()||await this.openAssistant(),await this.sendMessage(t),this.stateManager.state.displayMode=a}async sendMessage(t){await this.__loadData();let e=this.stateManager.getCurrentConversation();const a=this.stateManager.getEditingMessageId();if(a&&e){const i=e.messages.findIndex(n=>n.id===a);if(i!==-1){const n=e.messages.slice(0,i),o={...e,messages:n,updatedAt:Date.now()};this.stateManager.setCurrentConversation(o),await this.storage.save(o),this.stateManager.clearEditingMessage(),e=o}}e||(e=y(this.j,this.state.defaultModel,this.state.defaultTemperature),this.stateManager.setCurrentConversation(e));let s=null;t.trim()&&(s=j(t),e.title||(e={...e,title:t}),e={...e,updated:Date.now(),messages:[...e.messages,s]}),this.stateManager.setCurrentConversation({...e}),s&&this.j.e.fire("messageSent.ai-assistant-pro",s),this.stateManager.setLoading(!0),this.stateManager.clearError();try{await this.sendRequestToAI(0),this.stateManager.clearSelectionContexts()}catch(i){if(w(i))return;this.stateManager.setError(i instanceof Error?i.message:String(i))}finally{this.stateManager.setLoading(!1)}}async sendRequestToAI(t=0){const e=this.j.o.aiAssistantPro.maxRecursionToolCallDepth;if(t>=e)throw Error(`Max recursion depth ${e} reached for tool calls`);let a=this.stateManager.getCurrentConversation();if(!a)return;const s=V(a),[i]=await Promise.all([this.apiClient.sendRequest(a.id,a.messages,s,this.stateManager.getSelectionContexts(),a.options),this.storage.save(a)]);let n,o;if(i.mode==="stream"){const r=await et(this.stateManager,i,a);n=r.aiMessage,o=r.index,a=r.conversation}else{const r=tt(i,a);n=r.aiMessage,o=r.index,a=r.conversation}a=await K(this.j,n,a,o),this.j.e.fire("messageReceived.ai-assistant-pro",n),this.stateManager.setCurrentConversation({...a}),await this.storage.save(a),await this.handleToolCalls(n.id,t)}async deleteConversation(t){await this.__loadData(),await q(this.j,t,this.storage,this.stateManager,this.permissionManager)}async renameConversation(t,e){var a;const s=await this.storage.get(t);if(!s)return;const i={...s,title:e,updated:Date.now()};await this.storage.save(i),((a=this.state.currentConversation)===null||a===void 0?void 0:a.id)===t&&this.stateManager.setCurrentConversation(i);const n=await this.storage.list();this.stateManager.setConversations(n)}async searchConversations(t){await this.__loadData(),await U(t,this.storage,this.stateManager)}async handleToolCalls(t,e=0){const a=this.stateManager.getCurrentConversation();if(!a)return;const s=a.messages.find(c=>c.id===t);if(!s)return;const i=s.toolCalls;if(!i||i.length===0)return;const n=i.filter(c=>!Y(c.status));if(n.length===0)return;const{approved:o,needsPermission:r}=this.permissionManager.filterToolCalls(n,a.permissions);this.stateManager.setPendingToolCalls(r);for(const c of o)await this.executeToolCall(t,c,e)}async executeToolCall(t,e,a=0){let s=this.stateManager.getCurrentConversation();if(!s)return;const i=await Q(this.j,e,this.toolRegistry),n=s.messages.findIndex(c=>c.id===t);if(n===-1)return;const o=s.messages[n],r=s.messages.slice();r[n]=st(o,i),s={...s,messages:r,updated:Date.now()},this.stateManager.setCurrentConversation(s),H(s)&&await this.sendRequestToAI(a+1)}async copyMessage(t){const e=this.stateManager.getCurrentConversation();if(!e)return;const a=e.messages.find(s=>s.id===t);if(a)try{await navigator.clipboard.writeText(a.content),this.j.message.success("Message copied to clipboard")}catch{this.j.e.fire("error",new Error("Failed to copy message"))}}async restartFromMessage(t){const e=this.stateManager.getCurrentConversation();if(!e)return;const a=e.messages.findIndex(o=>o.id===t);if(a===-1)return;const s=e.messages[a];if(s.role!=="user")return;await this.__loadData();const i=e.messages.slice(0,a),n={...e,messages:i,updatedAt:Date.now()};this.stateManager.setCurrentConversation(n),await this.storage.save(n),await this.sendMessage(s.content)}async editMessage(t){const e=this.stateManager.getCurrentConversation();if(!e)return;const a=e.messages.find(s=>s.id===t);!a||a.role!=="user"||(this.stateManager.setEditingMessageId(t),this.mainPanel.inputArea.setValue(a.content),this.mainPanel.inputArea.focus())}cancelEditMessage(){this.stateManager.isEditingMessage()&&(this.stateManager.clearEditingMessage(),this.mainPanel.inputArea.setValue(""))}async deleteMessage(t){await this.__loadData();const e=this.stateManager.getCurrentConversation();if(!e||e.messages.findIndex(n=>n.id===t)===-1)return;const s=e.messages.filter(n=>n.id!==t),i={...e,messages:s,updatedAt:Date.now()};this.stateManager.setCurrentConversation(i),await this.storage.save(i)}beforeDestruct(){var t,e,a,s,i,n,o,r;this.textAutocompleteSource&&(this.j.e.fire("unregisterAutocompleteSource",this.textAutocompleteSource),this.textAutocompleteSource=null),this.textAutocompleteCache.clear(),this.__closeFlightMode(),(t=p(this,"toolRegistry"))===null||t===void 0||t.destruct(),(e=p(this,"permissionManager"))===null||e===void 0||e.destruct(),(a=p(this,"apiClient"))===null||a===void 0||a.destruct(),(s=p(this,"stateManager"))===null||s===void 0||s.destruct(),(i=p(this,"mainPanel"))===null||i===void 0||i.destruct(),(n=p(this,"dialog"))===null||n===void 0||n.destruct(),(r=(o=p(this,"storage"))===null||o===void 0?void 0:o.close)===null||r===void 0||r.call(o)}},_(f,"aiAssistantPro"),f);l.requires=["license","autocomplete"],h([u],l.prototype,"toolRegistry",null),h([u],l.prototype,"permissionManager",null),h([u],l.prototype,"apiClient",null),h([u],l.prototype,"storage",null),h([u],l.prototype,"stateManager",null),h([u],l.prototype,"mainPanel",null),h([u],l.prototype,"dialog",null),h([d("state.theme")],l.prototype,"__applyTheme",null),h([d(":openAIAssistantPro.ai-assistant-pro")],l.prototype,"openAssistant",null),h([d([":resize","state.panelWidth","state.panelHeight"])],l.prototype,"__onResizeInPanelView",null),h([d(["state.isOpen","state.displayMode","state.panelWidth","state.panelHeight","state.theme","state.defaultModel","state.defaultTemperature","state.currentConversation"]),ot()],l.prototype,"__onSavedStateChange",null),h([d(":closeAIAssistantPro.ai-assistant-pro")],l.prototype,"closeAssistant",null),h([d(":addContextToAIAssistant.ai-assistant-pro")],l.prototype,"addCurrentSelectionToContext",null),h([d(":executeQuickCommand.ai-assistant-pro")],l.prototype,"executeQuickCommand",null),h([d(":sendMessage.ai-assistant-pro")],l.prototype,"sendMessage",null),h([d(":searchConversations.ai-assistant-pro")],l.prototype,"searchConversations",null),h([d(":copyMessage.ai-assistant-pro")],l.prototype,"copyMessage",null),h([d(":restartFromMessage.ai-assistant-pro")],l.prototype,"restartFromMessage",null),h([d(":editMessage.ai-assistant-pro")],l.prototype,"editMessage",null),h([d(":cancelEditMessage.ai-assistant-pro")],l.prototype,"cancelEditMessage",null),h([d(":deleteMessage.ai-assistant-pro")],l.prototype,"deleteMessage",null),l=h([nt],l);ct.plugins.add("aiAssistantPro",l);export{l as aiAssistantPro};
@@ -1 +1 @@
1
- var u=Object.defineProperty;var a=(e,t)=>u(e,"name",{value:t,configurable:!0});var n;import{base64ToFile as p}from"../ai-assistant-pro/helpers/base64tofile.js";import m from"./icons/add-context.svg.js";import c from"./icons/ai-assistant.svg.js";import f from"./icons/ai-commands.svg.js";import g from"./icons/chevron-right.svg.js";import h from"./icons/send.svg.js";import A from"./icons/shield.svg.js";import y from"./icons/tool-bolt.svg.js";import{getAIProviderOptions as C,registerAIProvider as w}from"./providers/index.js";import{getToolNames as I}from"./tools/index.js";import{Config as s}from"jodit/esm/config.js";import{Icon as x}from"jodit/esm/core/ui/icon.js";import{aiAssitentCommands as T}from"jodit/esm/plugins/ai-assistant/config.js";import{marked as b}from"marked";x.set("ai-assistant-pro",c).set("ai-commands-pro",f).set("ai-add-context",m).set("send",h).set("tool-bolt",y).set("chevron-right",g).set("shield",A),s.prototype.aiAssistantPro={displayMode:"right",panelWidth:400,panelHeight:500,flightPanelHeight:250,dialogFullSize:!1,resizable:!0,apiMode:"incremental",apiRequest:null,maxRetries:3,requestTimeout:6e4*5,retryDelay:1e3,maxRecursionToolCallDepth:1e3,enabledTools:I(),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:a((e,t)=>{const o=new Date(e),i=new Date().getTime()-o.getTime();return i<6e4?t("Just now"):i<36e5?t("%dm ago",Math.floor(i/6e4)):i<864e5?t("%dh ago",Math.floor(i/36e5)):o.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})},"formatTimestamp"),formatMessageContent:a((e,t)=>b.parse(e,{breaks:!0,gfm:!0}),"formatMessageContent"),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,async uploadBase64Artifact(e,t){if(e.type==="image"&&e.data&&e.data.kind==="base64")try{const o=p(e.data.base64,e.id,e.mimeType),r=await t.uploader.upload([o]);return{...e,data:{kind:"url",url:r.baseurl+r.files[0]},metadata:{...e.metadata,filename:r.files[0]}}}catch(o){t.e.fire("error",o)}return e},getAIProviderOptions(e,t){return C(e,t)},registerAIProvider(e,t){w(e,t)}},s.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)"}},s.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():!0}},s.prototype.controls.aiCommandsPro={icon:"ai-commands-pro",tooltip:"AI Commands",isDisabled(e){return!e.o.aiAssistantPro.apiRequest},list:T,exec(e,t,{control:o}){e.e.fire("executeQuickCommand.ai-assistant-pro",o.name)}};const l=((n=s.prototype.tuneBlock)===null||n===void 0?void 0:n.popup)||{},d={},v=["p","h1","h2","h3","h4","h5","h6","div","section","article","pre","blockquote","ul","ol","li","table","tr","td","th","img","figure"];v.forEach(e=>{const t=l[e]||["tune.up","tune.remove","tune.down"];d[e]=[...t,"|","aiAddContext"]}),s.prototype.tuneBlock&&(s.prototype.tuneBlock.popup={...l,...d});
1
+ var d=Object.defineProperty;var r=(e,t)=>d(e,"name",{value:t,configurable:!0});var n;import{base64ToFile as p}from"../ai-assistant-pro/helpers/base64tofile.js";import m from"./icons/add-context.svg.js";import c from"./icons/ai-assistant.svg.js";import f from"./icons/ai-commands.svg.js";import g from"./icons/chevron-right.svg.js";import h from"./icons/send.svg.js";import A from"./icons/shield.svg.js";import x from"./icons/tool-bolt.svg.js";import{getAIProviderOptions as C,registerAIProvider as y}from"./providers/index.js";import{getToolNames as w}from"./tools/index.js";import{Config as s}from"jodit/esm/config.js";import{Icon as I}from"jodit/esm/core/ui/icon.js";import{aiAssitentCommands as T}from"jodit/esm/plugins/ai-assistant/config.js";import{marked as b}from"marked";I.set("ai-assistant-pro",c).set("ai-commands-pro",f).set("ai-add-context",m).set("send",h).set("tool-bolt",x).set("chevron-right",g).set("shield",A),s.prototype.aiAssistantPro={displayMode:"right",panelWidth:400,panelHeight:500,flightPanelHeight:250,dialogFullSize:!1,resizable:!0,apiMode:"incremental",apiRequest:null,maxRetries:3,requestTimeout:6e4*5,retryDelay:1e3,maxRecursionToolCallDepth:1e3,enabledTools:w(),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:r((e,t)=>{const o=new Date(e),i=new Date().getTime()-o.getTime();return i<6e4?t("Just now"):i<36e5?t("%dm ago",Math.floor(i/6e4)):i<864e5?t("%dh ago",Math.floor(i/36e5)):o.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})},"formatTimestamp"),formatMessageContent:r((e,t)=>b.parse(e,{breaks:!0,gfm:!0}),"formatMessageContent"),showAvatars:!0,showTypingIndicator:!0,includeSelectionByDefault:!0,maxContextRanges:5,showContextPreview:!0,sendOnEnter:!0,instructions:void 0,includeEditorMetadata:!1,autoOpen:!0,rememberLastConversation:!0,autoFocusInput:!0,closeAfterInsert:!1,enableSoundNotifications:!1,debug:!1,textAutocompleteEnabled:!1,textAutocompleteApiRequest:null,textAutocompleteMinQueryLength:3,textAutocompleteMaxSuggestions:3,textAutocompleteDebounceMs:500,textAutocompleteCacheTTL:3e4,textAutocompleteCacheMaxSize:50,quickCommandsSilentMode:!1,quickCommandsDisplayMode:"flight",showCopyMessageAction:!0,showRestartMessageAction:!0,showEditMessageAction:!0,showDeleteMessageAction:!0,dialogSettings:{},allowEditDialogSettings:!1,allowEditDisplayMode:!0,allowEditPanelWidth:!0,initiallyOpened:!1,allowClose:!0,persistOpenState:!0,theme:"parent",allowEditTheme:!0,async uploadBase64Artifact(e,t){if(e.type==="image"&&e.data&&e.data.kind==="base64")try{const o=p(e.data.base64,e.id,e.mimeType),a=await t.uploader.upload([o]);return{...e,data:{kind:"url",url:a.baseurl+a.files[0]},metadata:{...e.metadata,filename:a.files[0]}}}catch(o){t.e.fire("error",o)}return e},getAIProviderOptions(e,t){return C(e,t)},registerAIProvider(e,t){y(e,t)}},s.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)"}},s.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():!0}},s.prototype.controls.aiCommandsPro={icon:"ai-commands-pro",tooltip:"AI Commands",isDisabled(e){return!e.o.aiAssistantPro.apiRequest},list:T,exec(e,t,{control:o}){e.e.fire("executeQuickCommand.ai-assistant-pro",o.name)}};const l=((n=s.prototype.tuneBlock)===null||n===void 0?void 0:n.popup)||{},u={},M=["p","h1","h2","h3","h4","h5","h6","div","section","article","pre","blockquote","ul","ol","li","table","tr","td","th","img","figure"];M.forEach(e=>{const t=l[e]||["tune.up","tune.remove","tune.down"];u[e]=[...t,"|","aiAddContext"]}),s.prototype.tuneBlock&&(s.prototype.tuneBlock.popup={...l,...u});