@ckeditor/ckeditor5-ai 40.1.0 → 41.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/LICENSE.md +14 -6
  2. package/README.md +10 -11
  3. package/build/ai.js +78 -3
  4. package/build/translations/af.js +1 -1
  5. package/build/translations/ar.js +1 -1
  6. package/build/translations/bg.js +1 -1
  7. package/build/translations/bn.js +1 -1
  8. package/build/translations/bs.js +1 -1
  9. package/build/translations/ca.js +1 -1
  10. package/build/translations/cs.js +1 -1
  11. package/build/translations/da.js +1 -1
  12. package/build/translations/de-ch.js +1 -1
  13. package/build/translations/de.js +1 -1
  14. package/build/translations/el.js +1 -1
  15. package/build/translations/en-au.js +1 -1
  16. package/build/translations/es-co.js +1 -1
  17. package/build/translations/es.js +1 -1
  18. package/build/translations/et.js +1 -1
  19. package/build/translations/fa.js +1 -1
  20. package/build/translations/fi.js +1 -1
  21. package/build/translations/fr.js +1 -1
  22. package/build/translations/gl.js +1 -1
  23. package/build/translations/he.js +1 -1
  24. package/build/translations/hi.js +1 -1
  25. package/build/translations/hr.js +1 -1
  26. package/build/translations/hu.js +1 -1
  27. package/build/translations/id.js +1 -1
  28. package/build/translations/it.js +1 -1
  29. package/build/translations/ja.js +1 -1
  30. package/build/translations/jv.js +1 -1
  31. package/build/translations/ko.js +1 -1
  32. package/build/translations/lt.js +1 -1
  33. package/build/translations/lv.js +1 -1
  34. package/build/translations/ms.js +1 -1
  35. package/build/translations/nl.js +1 -1
  36. package/build/translations/no.js +1 -1
  37. package/build/translations/pl.js +1 -1
  38. package/build/translations/pt-br.js +1 -1
  39. package/build/translations/pt.js +1 -1
  40. package/build/translations/ro.js +1 -1
  41. package/build/translations/ru.js +1 -1
  42. package/build/translations/sk.js +1 -1
  43. package/build/translations/sr-latn.js +1 -1
  44. package/build/translations/sr.js +1 -1
  45. package/build/translations/sv.js +1 -1
  46. package/build/translations/th.js +1 -1
  47. package/build/translations/tk.js +1 -1
  48. package/build/translations/tr.js +1 -1
  49. package/build/translations/ug.js +1 -1
  50. package/build/translations/uk.js +1 -1
  51. package/build/translations/ur.js +1 -1
  52. package/build/translations/uz.js +1 -1
  53. package/build/translations/vi.js +1 -1
  54. package/build/translations/zh-cn.js +1 -1
  55. package/build/translations/zh.js +1 -1
  56. package/ckeditor5-metadata.json +2 -2
  57. package/lang/contexts.json +6 -4
  58. package/lang/translations/af.po +14 -6
  59. package/lang/translations/ar.po +15 -7
  60. package/lang/translations/bg.po +15 -7
  61. package/lang/translations/bn.po +15 -7
  62. package/lang/translations/bs.po +14 -6
  63. package/lang/translations/ca.po +15 -7
  64. package/lang/translations/cs.po +15 -7
  65. package/lang/translations/da.po +15 -7
  66. package/lang/translations/de-ch.po +14 -6
  67. package/lang/translations/de.po +15 -7
  68. package/lang/translations/el.po +15 -7
  69. package/lang/translations/en-au.po +14 -6
  70. package/lang/translations/en.po +15 -7
  71. package/lang/translations/es-co.po +14 -6
  72. package/lang/translations/es.po +15 -7
  73. package/lang/translations/et.po +15 -7
  74. package/lang/translations/fa.po +14 -6
  75. package/lang/translations/fi.po +15 -7
  76. package/lang/translations/fr.po +15 -7
  77. package/lang/translations/gl.po +62 -54
  78. package/lang/translations/he.po +15 -7
  79. package/lang/translations/hi.po +15 -7
  80. package/lang/translations/hr.po +14 -6
  81. package/lang/translations/hu.po +15 -7
  82. package/lang/translations/id.po +15 -7
  83. package/lang/translations/it.po +15 -7
  84. package/lang/translations/ja.po +15 -7
  85. package/lang/translations/jv.po +14 -6
  86. package/lang/translations/ko.po +15 -7
  87. package/lang/translations/lt.po +15 -7
  88. package/lang/translations/lv.po +15 -7
  89. package/lang/translations/ms.po +15 -7
  90. package/lang/translations/nl.po +15 -7
  91. package/lang/translations/no.po +15 -7
  92. package/lang/translations/pl.po +15 -7
  93. package/lang/translations/pt-br.po +15 -7
  94. package/lang/translations/pt.po +15 -7
  95. package/lang/translations/ro.po +15 -7
  96. package/lang/translations/ru.po +15 -7
  97. package/lang/translations/sk.po +15 -7
  98. package/lang/translations/sr-latn.po +62 -54
  99. package/lang/translations/sr.po +15 -7
  100. package/lang/translations/sv.po +15 -7
  101. package/lang/translations/th.po +15 -7
  102. package/lang/translations/tk.po +14 -6
  103. package/lang/translations/tr.po +15 -7
  104. package/lang/translations/ug.po +26 -18
  105. package/lang/translations/uk.po +15 -7
  106. package/lang/translations/ur.po +14 -6
  107. package/lang/translations/uz.po +14 -6
  108. package/lang/translations/vi.po +15 -7
  109. package/lang/translations/zh-cn.po +15 -7
  110. package/lang/translations/zh.po +15 -7
  111. package/package.json +8 -5
  112. package/src/adapters/aiadapter.d.ts +48 -0
  113. package/src/adapters/aiadapter.js +23 -0
  114. package/src/adapters/aitextadapter.d.ts +146 -0
  115. package/src/adapters/aitextadapter.js +23 -0
  116. package/src/adapters/awstextadapter.d.ts +178 -0
  117. package/src/adapters/awstextadapter.js +23 -0
  118. package/src/adapters/openaitextadapter.d.ts +181 -0
  119. package/src/adapters/openaitextadapter.js +23 -0
  120. package/src/aiassistant.d.ts +49 -121
  121. package/src/aiassistant.js +2 -2
  122. package/src/aiassistantediting.d.ts +13 -12
  123. package/src/aiassistantediting.js +2 -2
  124. package/src/aiassistantui.d.ts +16 -8
  125. package/src/aiassistantui.js +2 -2
  126. package/src/aiconfig.d.ts +69 -0
  127. package/src/aiconfig.js +23 -0
  128. package/src/augmentation.d.ts +10 -9
  129. package/src/augmentation.js +1 -1
  130. package/src/index.d.ts +7 -3
  131. package/src/index.js +2 -2
  132. package/src/ui/aiassistantcontroller.d.ts +40 -27
  133. package/src/ui/aiassistantcontroller.js +2 -2
  134. package/src/ui/dropdown/aicommandslistview.d.ts +2 -2
  135. package/src/ui/dropdown/aicommandslistview.js +2 -2
  136. package/src/ui/dropdown/buttonlabelwithhighlightview.d.ts +2 -2
  137. package/src/ui/dropdown/buttonlabelwithhighlightview.js +2 -2
  138. package/src/ui/dropdown/labelwithhighlightview.d.ts +2 -2
  139. package/src/ui/dropdown/labelwithhighlightview.js +2 -2
  140. package/src/ui/form/aiformcontentarea.d.ts +3 -3
  141. package/src/ui/form/aiformcontentarea.js +2 -2
  142. package/src/ui/form/aiformerrorview.d.ts +3 -3
  143. package/src/ui/form/aiformerrorview.js +2 -2
  144. package/src/ui/form/aiformpromptview.d.ts +3 -3
  145. package/src/ui/form/aiformpromptview.js +2 -2
  146. package/src/ui/form/aiformtoolbarview.d.ts +12 -8
  147. package/src/ui/form/aiformtoolbarview.js +2 -2
  148. package/src/ui/form/aiformview.d.ts +13 -14
  149. package/src/ui/form/aiformview.js +2 -2
  150. package/src/ui/form/aihistorylistitemview.d.ts +3 -3
  151. package/src/ui/form/aihistorylistitemview.js +2 -2
  152. package/src/ui/form/aihistorylistview.d.ts +3 -3
  153. package/src/ui/form/aihistorylistview.js +2 -2
  154. package/src/ui/form/prompthistory.d.ts +2 -2
  155. package/src/ui/form/prompthistory.js +2 -2
  156. package/src/ui/showaiassistantcommand.d.ts +8 -5
  157. package/src/ui/showaiassistantcommand.js +2 -2
  158. package/src/utils/common-translations.d.ts +2 -2
  159. package/src/utils/common-translations.js +2 -2
  160. package/theme/ai-dropdown.css +1 -1
  161. package/theme/ai-form.css +16 -4
  162. package/theme/ai.css +17 -4
  163. package/src/aiconnector.d.ts +0 -45
  164. package/src/aiconnector.js +0 -23
  165. package/theme/icons/robot-pencil.svg +0 -1
@@ -1,28 +1,28 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module ai/aiassistant
7
7
  * @publicApi
8
8
  */
9
- import { type Locale } from 'ckeditor5/src/utils';
10
- import { Plugin, type Editor } from 'ckeditor5/src/core';
11
- import AIAssistantUI from './aiassistantui';
12
- import AIAssistantEditing from './aiassistantediting';
13
- import AIConnector from './aiconnector';
14
- /**
15
- * A function that returns the list of default AI commands definitions in the given localization context.
16
- */
17
- export declare const getDefaultCommands: (locale: Locale) => Array<GroupDefinition>;
9
+ import { type Locale } from 'ckeditor5/src/utils.js';
10
+ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
11
+ import AIAssistantUI from './aiassistantui.js';
12
+ import AIAssistantEditing from './aiassistantediting.js';
18
13
  /**
19
14
  * AI assistant plugin that allows you to use external AI models to generate content or improve existing content.
15
+ *
16
+ * The feature uses following {@link module:ai/adapters/aitextadapter~AITextAdapterRequestData#actionId `actionId`} values:
17
+ *
18
+ * * `aiAssistant:command:<commandId>` for the predefined commands, where `<commandId>` is the ID of the predefined command,
19
+ * * `aiAssistant:custom` for custom queries provided by the user.
20
20
  */
21
21
  export default class AIAssistant extends Plugin {
22
22
  /**
23
23
  * @inheritDoc
24
24
  */
25
- static get requires(): readonly [typeof AIAssistantUI, typeof AIAssistantEditing, typeof AIConnector];
25
+ static get requires(): readonly [typeof AIAssistantUI, typeof AIAssistantEditing];
26
26
  /**
27
27
  * @inheritDoc
28
28
  */
@@ -41,80 +41,48 @@ export default class AIAssistant extends Plugin {
41
41
  destroy(): void;
42
42
  }
43
43
  /**
44
- * The configuration of the AI assistant feature.
44
+ * A function that returns the list of the default AI commands definitions in the given localization context.
45
+ */
46
+ export declare function getDefaultCommands(locale: Locale): Array<GroupDefinition>;
47
+ /**
48
+ * The configuration of the AI Assistant feature.
49
+ *
50
+ * The properties defined in this config are set in the `config.ai.aiAssistant` namespace.
45
51
  *
46
52
  * ```ts
47
53
  * ClassicEditor
48
54
  * .create( editorElement, {
49
- * aiAssistant: ... // AI assistant options.
55
+ * ai: {
56
+ * aiAssistant: {
57
+ * // AI Assistant configuration.
58
+ * }
59
+ * }
50
60
  * } )
51
61
  * .then( ... )
52
62
  * .catch( ... );
53
63
  * ```
54
64
  *
65
+ * See {@link module:ai/aiconfig~AIConfig the full AI configuration}.
66
+ *
55
67
  * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
56
68
  */
57
69
  export interface AIAssistantConfig {
58
- /**
59
- * The URL to which the API request will be sent.
60
- *
61
- * Defaults to `'https://api.openai.com/v1/chat/completions'`.
62
- */
63
- apiUrl?: string;
64
- /**
65
- * A key used to authorize the request to the AI service.
66
- *
67
- * If you are connecting directly to the OpenAI API, use your OpenAI API key as `authKey`.
68
- *
69
- * **Important: use your API key ONLY in a development environment or for testing purposes!**
70
- * In the production environment, {@glink features/ai-assistant#using-proxy-endpoint pass your request through a proxy}.
71
- *
72
- * If you are using a proxy service to send requests to the AI service, `authKey` can be used to implement authorization for your
73
- * requests.
74
- *
75
- * If the key is provided, it is added to the `Authorization` header of the request call, using the bearer scheme:
76
- *
77
- * ```
78
- * Authorization: Bearer <authKey>
79
- * ```
80
- *
81
- * If the provided value is a `string`, it is simply used as provided.
82
- *
83
- * If the provided value is a function, it should be a function that returns a `Promise` which resolves with the authorization token.
84
- * This way, you can perform an authorization request to your application and receive the authorization token (and also implement
85
- * any custom logic that you need). The authorization token is then used to make the actual call to the AI service.
86
- *
87
- * ```js
88
- * {
89
- * aiAssistant: {
90
- * authKey: async () => {
91
- * return await fetch( 'https://example.com/jwt-endpoint' );
92
- * }
93
- * // ...
94
- * }
95
- * }
96
- * ```
97
- *
98
- * If the authorization request fails, the promise should be rejected. In this case, the feature will display an error notification.
99
- */
100
- authKey?: string | (() => Promise<string>);
101
70
  /**
102
71
  * A list of all AI commands groups definitions to be displayed in the `'aiCommands'` UI dropdown.
103
72
  *
104
73
  * Setting this property will overwrite the default list of predefined commands.
105
74
  *
106
- * The default configuration is as follows:
75
+ * The default configuration is as follows. It can be obtained through {@link ~getDefaultCommands}:
107
76
  *
108
77
  * ```json
109
- * {
78
+ * [ {
110
79
  * groupId: 'editOrReview',
111
80
  * groupLabel: 'Edit or review',
112
81
  * commands: [
113
82
  * {
114
83
  * id: 'improveWriting',
115
84
  * label: 'Improve writing',
116
- * prompt: 'Rewrite this content with no spelling mistakes, proper grammar, ' +
117
- * 'and with more descriptive language, using best writing practices without losing the original meaning.'
85
+ * prompt: 'Fix spelling mistakes, use proper grammar and apply good writing practices. Do not lose the original meaning.'
118
86
  * },
119
87
  * {
120
88
  * id: 'makeShorter',
@@ -125,14 +93,13 @@ export interface AIAssistantConfig {
125
93
  * {
126
94
  * id: 'makeLonger',
127
95
  * label: 'Make longer',
128
- * prompt: 'Expand upon this content with descriptive language and more detailed explanations, ' +
129
- * 'to make the writing easier to understand and increase the length of the content.'
96
+ * prompt: 'Improve this content by using descriptive language and inserting more information and more detailed explanations.'
130
97
  * },
131
98
  * {
132
99
  * id: 'simplifyLanguage',
133
100
  * label: 'Simplify language',
134
- * prompt: 'Rewrite this content with simplified language ' +
135
- * 'and reduce the complexity of the writing, so that the content is easier to understand.'
101
+ * prompt: 'Simplify the writing style of this content ' +
102
+ * 'and reduce the complexity, so that the content is easy to understand.'
136
103
  * }
137
104
  * ]
138
105
  * },
@@ -143,12 +110,12 @@ export interface AIAssistantConfig {
143
110
  * {
144
111
  * id: 'summarize',
145
112
  * label: 'Summarize',
146
- * prompt: 'Provide the key points and concepts in this content in a succinct summary.'
113
+ * prompt: 'Summarize this content into one paragraph of text. Include only the key ideas and conclusions. Keep it short. '
147
114
  * },
148
115
  * {
149
116
  * id: 'continue',
150
117
  * label: 'Continue',
151
- * prompt: 'Continue this text.'
118
+ * prompt: 'Start with the provided content and write at the end of it continuing this topic. Keep the added part short.'
152
119
  * }
153
120
  * ]
154
121
  * },
@@ -159,28 +126,28 @@ export interface AIAssistantConfig {
159
126
  * {
160
127
  * id: 'professional',
161
128
  * label: 'Professional',
162
- * prompt: 'Rewrite this content using polished, formal, and respectful language ' +
129
+ * prompt: 'Improve using polished, formal, and respectful language ' +
163
130
  * 'to convey professional expertise and competence.'
164
131
  * },
165
132
  * {
166
133
  * id: 'casual',
167
134
  * label: 'Casual',
168
- * prompt: 'Rewrite this content with casual, informal language to convey a casual conversation with a real person.'
135
+ * prompt: 'Improve using casual, informal language to convey a casual conversation with a real person.'
169
136
  * },
170
137
  * {
171
138
  * id: 'direct',
172
139
  * label: 'Direct',
173
- * prompt: 'Rewrite this content with direct language using only the essential information.'
140
+ * prompt: 'Improve using direct language using only the essential information.'
174
141
  * },
175
142
  * {
176
143
  * id: 'confident',
177
144
  * label: 'Confident',
178
- * prompt: 'Rewrite this content using compelling, optimistic language to convey confidence in the writing.'
145
+ * prompt: 'Improve using compelling, optimistic language to convey confidence in the writing.'
179
146
  * },
180
147
  * {
181
148
  * id: 'friendly',
182
149
  * label: 'Friendly',
183
- * prompt: 'Rewrite this content using friendly, comforting language, to convey understanding and empathy.'
150
+ * prompt: 'Improve using friendly, comforting language, to convey understanding and empathy.'
184
151
  * }
185
152
  * ]
186
153
  * },
@@ -217,45 +184,45 @@ export interface AIAssistantConfig {
217
184
  * {
218
185
  * id: 'translateEnglish',
219
186
  * label: 'Translate to English',
220
- * prompt: 'Translate to English language.'
187
+ * prompt: 'Translate the content to English language.'
221
188
  * },
222
189
  * {
223
190
  * id: 'translateSpanish',
224
191
  * label: 'Translate to Spanish',
225
- * prompt: 'Translate to Spanish language.'
192
+ * prompt: 'Translate the content to Spanish language.'
226
193
  * },
227
194
  * {
228
195
  * id: 'translatePortuguese',
229
196
  * label: 'Translate to Portuguese',
230
- * prompt: 'Translate to Portuguese language.'
197
+ * prompt: 'Translate the content to Portuguese language.'
231
198
  * },
232
199
  * {
233
200
  * id: 'translateGerman',
234
201
  * label: 'Translate to German',
235
- * prompt: 'Translate to German language.'
202
+ * prompt: 'Translate the content to German language.'
236
203
  * },
237
204
  * {
238
205
  * id: 'translateFrench',
239
206
  * label: 'Translate to French',
240
- * prompt: 'Translate to French language.'
207
+ * prompt: 'Translate the content to French language.'
241
208
  * },
242
209
  * {
243
210
  * id: 'translateChinese',
244
211
  * label: 'Translate to Simplified Chinese',
245
- * prompt: 'Translate to Simplified Chinese language.'
212
+ * prompt: 'Translate the content to Simplified Chinese language.'
246
213
  * },
247
214
  * {
248
215
  * id: 'translateHindi',
249
216
  * label: 'Translate to Hindi',
250
- * prompt: 'Translate to Hindi language.'
217
+ * prompt: 'Translate the content to Hindi language.'
251
218
  * },
252
219
  * {
253
220
  * id: 'translateArabic',
254
221
  * label: 'Translate to Arabic',
255
- * prompt: 'Translate to Arabic language.'
222
+ * prompt: 'Translate the content to Arabic language.'
256
223
  * }
257
224
  * ]
258
- * }
225
+ * } ]
259
226
  * ```
260
227
  */
261
228
  commands?: Array<GroupDefinition>;
@@ -304,6 +271,7 @@ export interface AIAssistantConfig {
304
271
  * ],
305
272
  * // ...
306
273
  * }
274
+ * }
307
275
  * ```
308
276
  */
309
277
  extraCommandGroups?: Array<GroupDefinition>;
@@ -323,20 +291,10 @@ export interface AIAssistantConfig {
323
291
  * ],
324
292
  * // ...
325
293
  * }
294
+ * }
326
295
  * ```
327
296
  */
328
297
  removeCommands?: Array<string>;
329
- /**
330
- * Enables or disables the AI assistant UI theme.
331
- *
332
- * * Leaving this property unset will preserve the default theme on AI Assistant UI elements.
333
- * * Setting this property to **`false`** will remove the default theme from AI assistant UI elements.
334
- *
335
- * {@glink features/ai-assistant#ui-customization Learn more about AI assistant UI customization.}
336
- *
337
- * @default true
338
- */
339
- useTheme?: boolean;
340
298
  /**
341
299
  * An additional CSS class name (or names) added to the AI assistant content area (model response area).
342
300
  *
@@ -345,23 +303,6 @@ export interface AIAssistantConfig {
345
303
  * styles.
346
304
  */
347
305
  contentAreaCssClass?: string;
348
- /**
349
- * Additional configuration parameters for the AI request. Use it to customize how the AI service generates responses.
350
- *
351
- * See [OpenAI API reference](https://platform.openai.com/docs/api-reference/chat/create) to learn more.
352
- *
353
- * Defaults to:
354
- *
355
- * ```json
356
- * {
357
- * model: 'gpt-3.5-turbo',
358
- * max_tokens: 2000,
359
- * temperature: 1,
360
- * top_p: 1
361
- * }
362
- * ```
363
- */
364
- requestParameters?: RequestParameters;
365
306
  /**
366
307
  * The AI assistant feature will be disabled if the document selection includes any of these elements.
367
308
  *
@@ -443,16 +384,3 @@ export type CommandDefinition = {
443
384
  */
444
385
  order?: number;
445
386
  };
446
- /**
447
- * OpenAI request parameters that will influence how the response is generated.
448
- *
449
- * See OpenAI API reference to learn more.
450
- */
451
- export type RequestParameters = {
452
- model?: string;
453
- max_tokens?: number;
454
- temperature?: number;
455
- top_p?: number;
456
- user?: string;
457
- stream?: boolean;
458
- };
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  *
4
4
  *
5
5
  *
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x2076=['Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.','Change\x20tone','Translate\x20the\x20content\x20to\x20Spanish\x20language.','confident','Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.','translatePortuguese','Journalism','Legal','aiLicenseKeyValid','Simplify\x20language','Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.','Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.','changeTone','poetic','push','aiAssistant.commands','Professional','translateGerman','Generate\x20from\x20selection','improveWriting','translateFrench','_licenseKeyCheckInterval','Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.','translateChinese','Poetic','German','French','config','Casual','filter','continue','ai-invalid-license-key','Translate\x20the\x20content\x20to\x20German\x20language.','editOrReview','define','Direct','makeShorter','Arabic','aiAssistant.extraCommandGroups','Translate\x20the\x20content\x20to\x20English\x20language.','Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.','Translate\x20the\x20content\x20to\x20French\x20language.','translateSpanish','Spanish','init','Change\x20style','casual','info','Edit\x20or\x20review','makeLonger','Hindi','aiLicenseKeyInvalid','professional','Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.','ai-trial-license-key-reached-limit-changes','aiAssistant.removeCommands','translateEnglish','Translate\x20the\x20content\x20to\x20Portuguese\x20language.','Simplified\x20Chinese','journalism','Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.','translateHindi','Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.','translate','locale','destroy','legal','generate','licenseKey','requires','Portuguese','Translate\x20to\x20%0','Improve\x20writing','friendly','simplifyLanguage','Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.','aiLicenseKeyTrial','Summarize','Friendly','get','English','Continue','Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.','Make\x20longer','commands','includes','Translate','business','summarize','aiLicenseKeyTrialLimit:operations','Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.','groupId','Translate\x20the\x20content\x20to\x20Arabic\x20language.','translateArabic','Confident','Translate\x20the\x20content\x20to\x20Hindi\x20language.','Business'];(function(_0x282cf1,_0x20760a){const _0x376ca6=function(_0x436f8e){while(--_0x436f8e){_0x282cf1['push'](_0x282cf1['shift']());}};_0x376ca6(++_0x20760a);}(_0x2076,0x10c));const _0x376c=function(_0x282cf1,_0x20760a){_0x282cf1=_0x282cf1-0x0;let _0x376ca6=_0x2076[_0x282cf1];return _0x376ca6;};import{CKEditorError as _0x2a14ef}from'ckeditor5/src/utils';import{Plugin as _0x425378}from'ckeditor5/src/core';import _0x893417 from'./aiassistantui';import _0x2657d7 from'./aiassistantediting';import _0x14f7e0 from'./aiconnector';import{getTranslation as _0x45c5cd}from'./utils/common-translations';export const getDefaultCommands=_0x14bf34=>[{'groupId':_0x376c('0x38'),'groupLabel':_0x45c5cd(_0x14bf34,_0x376c('0x47')),'commands':[{'id':_0x376c('0x2a'),'label':_0x45c5cd(_0x14bf34,_0x376c('0x5f')),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':_0x376c('0x3b'),'label':_0x45c5cd(_0x14bf34,'Make\x20shorter'),'prompt':'Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.'},{'id':'makeLonger','label':_0x45c5cd(_0x14bf34,_0x376c('0x9')),'prompt':_0x376c('0x1b')},{'id':'simplifyLanguage','label':_0x45c5cd(_0x14bf34,_0x376c('0x20')),'prompt':_0x376c('0x10')}]},{'groupId':'generate','groupLabel':_0x45c5cd(_0x14bf34,_0x376c('0x29')),'commands':[{'id':_0x376c('0xe'),'label':_0x45c5cd(_0x14bf34,_0x376c('0x3')),'prompt':_0x376c('0x2d')},{'id':_0x376c('0x35'),'label':_0x45c5cd(_0x14bf34,_0x376c('0x7')),'prompt':_0x376c('0x21')}]},{'groupId':_0x376c('0x23'),'groupLabel':_0x45c5cd(_0x14bf34,_0x376c('0x18')),'commands':[{'id':'professional','label':_0x45c5cd(_0x14bf34,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':_0x376c('0x45'),'label':_0x45c5cd(_0x14bf34,_0x376c('0x33')),'prompt':_0x376c('0x17')},{'id':'direct','label':_0x45c5cd(_0x14bf34,_0x376c('0x3a')),'prompt':_0x376c('0x4c')},{'id':_0x376c('0x1a'),'label':_0x45c5cd(_0x14bf34,_0x376c('0x14')),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':_0x376c('0x60'),'label':_0x45c5cd(_0x14bf34,_0x376c('0x4')),'prompt':_0x376c('0x55')}]},{'groupId':'changeStyle','groupLabel':_0x45c5cd(_0x14bf34,_0x376c('0x44')),'commands':[{'id':_0x376c('0xd'),'label':_0x45c5cd(_0x14bf34,_0x376c('0x16')),'prompt':_0x376c('0x53')},{'id':'legal','label':_0x45c5cd(_0x14bf34,_0x376c('0x1e')),'prompt':_0x376c('0x8')},{'id':_0x376c('0x52'),'label':_0x45c5cd(_0x14bf34,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':_0x376c('0x24'),'label':_0x45c5cd(_0x14bf34,_0x376c('0x2f')),'prompt':_0x376c('0x3f')}]},{'groupId':'translate','groupLabel':_0x45c5cd(_0x14bf34,_0x376c('0xc')),'commands':[{'id':_0x376c('0x4f'),'label':_0x45c5cd(_0x14bf34,'Translate\x20to\x20%0',[_0x45c5cd(_0x14bf34,_0x376c('0x6'))]),'prompt':_0x376c('0x3e')},{'id':_0x376c('0x41'),'label':_0x45c5cd(_0x14bf34,_0x376c('0x5e'),[_0x45c5cd(_0x14bf34,_0x376c('0x42'))]),'prompt':_0x376c('0x19')},{'id':'translatePortuguese','label':_0x45c5cd(_0x14bf34,'Translate\x20to\x20%0',[_0x45c5cd(_0x14bf34,_0x376c('0x5d'))]),'prompt':_0x376c('0x50')},{'id':_0x376c('0x28'),'label':_0x45c5cd(_0x14bf34,_0x376c('0x5e'),[_0x45c5cd(_0x14bf34,_0x376c('0x30'))]),'prompt':_0x376c('0x37')},{'id':_0x376c('0x2b'),'label':_0x45c5cd(_0x14bf34,_0x376c('0x5e'),[_0x45c5cd(_0x14bf34,'French')]),'prompt':_0x376c('0x40')},{'id':_0x376c('0x2e'),'label':_0x45c5cd(_0x14bf34,'Translate\x20to\x20%0',[_0x45c5cd(_0x14bf34,'Simplified\x20Chinese')]),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':_0x376c('0x54'),'label':_0x45c5cd(_0x14bf34,_0x376c('0x5e'),[_0x45c5cd(_0x14bf34,_0x376c('0x49'))]),'prompt':_0x376c('0x15')},{'id':'translateArabic','label':_0x45c5cd(_0x14bf34,_0x376c('0x5e'),[_0x45c5cd(_0x14bf34,_0x376c('0x3c'))]),'prompt':_0x376c('0x12')}]}];export default class l extends _0x425378{static get[_0x376c('0x5c')](){return[_0x893417,_0x2657d7,_0x14f7e0];}static get['pluginName'](){return'AIAssistant';}constructor(_0x3c38d6){super(_0x3c38d6);const _0x12ede1=_0x3c38d6[_0x376c('0x32')];var _0x45a972;_0x12ede1[_0x376c('0x39')](_0x376c('0x26'),(_0x45a972=_0x3c38d6[_0x376c('0x57')],[{'groupId':'editOrReview','groupLabel':_0x45c5cd(_0x45a972,_0x376c('0x47')),'commands':[{'id':'improveWriting','label':_0x45c5cd(_0x45a972,_0x376c('0x5f')),'prompt':_0x376c('0x22')},{'id':_0x376c('0x3b'),'label':_0x45c5cd(_0x45a972,'Make\x20shorter'),'prompt':'Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.'},{'id':_0x376c('0x48'),'label':_0x45c5cd(_0x45a972,'Make\x20longer'),'prompt':_0x376c('0x1b')},{'id':_0x376c('0x0'),'label':_0x45c5cd(_0x45a972,_0x376c('0x20')),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':_0x376c('0x5a'),'groupLabel':_0x45c5cd(_0x45a972,_0x376c('0x29')),'commands':[{'id':'summarize','label':_0x45c5cd(_0x45a972,_0x376c('0x3')),'prompt':_0x376c('0x2d')},{'id':_0x376c('0x35'),'label':_0x45c5cd(_0x45a972,'Continue'),'prompt':'Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.'}]},{'groupId':_0x376c('0x23'),'groupLabel':_0x45c5cd(_0x45a972,_0x376c('0x18')),'commands':[{'id':_0x376c('0x4b'),'label':_0x45c5cd(_0x45a972,_0x376c('0x27')),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':_0x376c('0x45'),'label':_0x45c5cd(_0x45a972,'Casual'),'prompt':_0x376c('0x17')},{'id':'direct','label':_0x45c5cd(_0x45a972,_0x376c('0x3a')),'prompt':_0x376c('0x4c')},{'id':_0x376c('0x1a'),'label':_0x45c5cd(_0x45a972,_0x376c('0x14')),'prompt':_0x376c('0x1')},{'id':_0x376c('0x60'),'label':_0x45c5cd(_0x45a972,_0x376c('0x4')),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':_0x45c5cd(_0x45a972,'Change\x20style'),'commands':[{'id':_0x376c('0xd'),'label':_0x45c5cd(_0x45a972,_0x376c('0x16')),'prompt':_0x376c('0x53')},{'id':_0x376c('0x59'),'label':_0x45c5cd(_0x45a972,'Legal'),'prompt':_0x376c('0x8')},{'id':_0x376c('0x52'),'label':_0x45c5cd(_0x45a972,_0x376c('0x1d')),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':_0x376c('0x24'),'label':_0x45c5cd(_0x45a972,_0x376c('0x2f')),'prompt':_0x376c('0x3f')}]},{'groupId':_0x376c('0x56'),'groupLabel':_0x45c5cd(_0x45a972,_0x376c('0xc')),'commands':[{'id':'translateEnglish','label':_0x45c5cd(_0x45a972,'Translate\x20to\x20%0',[_0x45c5cd(_0x45a972,_0x376c('0x6'))]),'prompt':_0x376c('0x3e')},{'id':_0x376c('0x41'),'label':_0x45c5cd(_0x45a972,_0x376c('0x5e'),[_0x45c5cd(_0x45a972,'Spanish')]),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':_0x376c('0x1c'),'label':_0x45c5cd(_0x45a972,_0x376c('0x5e'),[_0x45c5cd(_0x45a972,_0x376c('0x5d'))]),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':_0x376c('0x28'),'label':_0x45c5cd(_0x45a972,_0x376c('0x5e'),[_0x45c5cd(_0x45a972,_0x376c('0x30'))]),'prompt':_0x376c('0x37')},{'id':_0x376c('0x2b'),'label':_0x45c5cd(_0x45a972,_0x376c('0x5e'),[_0x45c5cd(_0x45a972,_0x376c('0x31'))]),'prompt':_0x376c('0x40')},{'id':_0x376c('0x2e'),'label':_0x45c5cd(_0x45a972,_0x376c('0x5e'),[_0x45c5cd(_0x45a972,_0x376c('0x51'))]),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':_0x376c('0x54'),'label':_0x45c5cd(_0x45a972,_0x376c('0x5e'),[_0x45c5cd(_0x45a972,_0x376c('0x49'))]),'prompt':_0x376c('0x15')},{'id':_0x376c('0x13'),'label':_0x45c5cd(_0x45a972,'Translate\x20to\x20%0',[_0x45c5cd(_0x45a972,_0x376c('0x3c'))]),'prompt':_0x376c('0x12')}]}])),_0x12ede1[_0x376c('0x39')](_0x376c('0x3d'),[]),_0x12ede1[_0x376c('0x39')](_0x376c('0x4e'),[]);const _0x5c03e0=_0x12ede1[_0x376c('0x5')]('aiAssistant.commands'),_0x312fda=_0x12ede1[_0x376c('0x5')](_0x376c('0x3d')),_0x5e00ad=_0x12ede1['get'](_0x376c('0x4e'));_0x312fda['forEach'](_0x2b1614=>{const _0x59d016=_0x5c03e0['find'](_0x458b38=>_0x458b38[_0x376c('0x11')]===_0x2b1614['groupId']);_0x59d016?_0x59d016[_0x376c('0xa')]=_0x59d016[_0x376c('0xa')]['concat'](_0x2b1614[_0x376c('0xa')]):_0x5c03e0[_0x376c('0x25')](_0x2b1614);}),_0x5c03e0['forEach'](_0x3baee2=>{_0x3baee2[_0x376c('0xa')]=_0x3baee2[_0x376c('0xa')][_0x376c('0x34')](_0xe838c5=>!_0x5e00ad[_0x376c('0xb')](_0xe838c5['id']));}),_0x12ede1['set'](_0x376c('0x26'),_0x5c03e0);}[_0x376c('0x43')](){const _0x3f4551=this['editor'];this[_0x376c('0x5b')]=_0x3f4551[_0x376c('0x32')][_0x376c('0x5')](_0x376c('0x5b')),this[_0x376c('0x2c')]=setInterval(()=>{let _0x3caed6;for(const _0x34d57f in _0x3f4551){const _0xa43076=_0x34d57f,_0x157299=_0x3f4551[_0xa43076];if('aiLicenseKeyTrial'===_0x157299||'aiLicenseKeyInvalid'===_0x157299||_0x376c('0x1f')===_0x157299||'aiLicenseKeyTrialLimit:operations'===_0x157299){delete _0x3f4551[_0xa43076],_0x3caed6=_0x157299;break;}}if(_0x376c('0x4a')===_0x3caed6)throw clearInterval(this[_0x376c('0x2c')]),new _0x2a14ef(_0x376c('0x36'),null);if(_0x376c('0x2')===_0x3caed6&&console[_0x376c('0x46')]('You\x20are\x20using\x20the\x20trial\x20version\x20of\x20CKEditor\x205\x20ai\x20plugin\x20with\x20limited\x20usage.\x20Make\x20sure\x20you\x20will\x20not\x20use\x20it\x20in\x20the\x20production\x20environment.'),_0x376c('0xf')===_0x3caed6)throw clearInterval(this[_0x376c('0x2c')]),new _0x2a14ef(_0x376c('0x4d'),null);_0x376c('0x1f')===_0x3caed6&&clearInterval(this[_0x376c('0x2c')]);},0x3e8);}[_0x376c('0x58')](){this['_licenseKeyCheckInterval']&&clearInterval(this[_0x376c('0x2c')]);}}
23
+ const _0x18e6=['legal','aiLicenseKeyInvalid','concat','Portuguese','Professional','friendly','English','Translate\x20the\x20content\x20to\x20Arabic\x20language.','groupId','licenseKey','ai.aiAssistant.commands','Friendly','aiLicenseKeyTrial','makeLonger','set','Business','Translate\x20to\x20%0','translateHindi','ai-invalid-license-key','editOrReview','init','Improve\x20writing','poetic','Arabic','Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.','ai.aiAssistant.removeCommands','filter','Make\x20longer','direct','Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.','_licenseKeyCheckInterval','improveWriting','define','Simplified\x20Chinese','Translate\x20the\x20content\x20to\x20Hindi\x20language.','Make\x20shorter','confident','French','Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.','Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.','ai.aiAssistant.extraCommandGroups','continue','casual','translateGerman','Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.','get','Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.','Translate\x20the\x20content\x20to\x20German\x20language.','Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.','generate','requires','Translate\x20the\x20content\x20to\x20English\x20language.','includes','Summarize','editor','translateSpanish','aiLicenseKeyTrialLimit:operations','translateEnglish','Change\x20style','ai-trial-license-key-reached-limit-changes','Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.','simplifyLanguage','push','commands','config','changeTone','translate','Journalism','German','Direct','Hindi','summarize','Confident','Translate\x20the\x20content\x20to\x20Portuguese\x20language.','Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.','translateChinese','translateFrench','Translate\x20the\x20content\x20to\x20Spanish\x20language.','aiLicenseKeyValid','makeShorter','Simplify\x20language','Translate','Translate\x20the\x20content\x20to\x20French\x20language.','destroy','AIAssistant','You\x20are\x20using\x20the\x20trial\x20version\x20of\x20CKEditor\x205\x20ai\x20plugin\x20with\x20limited\x20usage.\x20Make\x20sure\x20you\x20will\x20not\x20use\x20it\x20in\x20the\x20production\x20environment.','Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.','forEach','Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.','Poetic','info'];(function(_0x13ea68,_0x18e6b7){const _0x4dc72d=function(_0x580391){while(--_0x580391){_0x13ea68['push'](_0x13ea68['shift']());}};_0x4dc72d(++_0x18e6b7);}(_0x18e6,0xb7));const _0x4dc7=function(_0x13ea68,_0x18e6b7){_0x13ea68=_0x13ea68-0x0;let _0x4dc72d=_0x18e6[_0x13ea68];return _0x4dc72d;};import{CKEditorError as _0x23b3f4}from'ckeditor5/src/utils.js';import{Plugin as _0x5829c2}from'ckeditor5/src/core.js';import _0x157fa1 from'./aiassistantui.js';import _0x4743f6 from'./aiassistantediting.js';import{getTranslation as _0x20eb35}from'./utils/common-translations.js';export default class r extends _0x5829c2{static get[_0x4dc7('0x31')](){return[_0x157fa1,_0x4743f6];}static get['pluginName'](){return _0x4dc7('0x53');}constructor(_0x10508f){super(_0x10508f);const _0x59ca3b=_0x10508f[_0x4dc7('0x3f')];_0x59ca3b['define'](_0x4dc7('0x9'),getDefaultCommands(_0x10508f['locale'])),_0x59ca3b['define'](_0x4dc7('0x27'),[]),_0x59ca3b[_0x4dc7('0x1f')](_0x4dc7('0x18'),[]);const _0x1d01f7=_0x59ca3b[_0x4dc7('0x2c')](_0x4dc7('0x9')),_0x4dc7d0=_0x59ca3b[_0x4dc7('0x2c')](_0x4dc7('0x27')),_0xe17525=_0x59ca3b[_0x4dc7('0x2c')]('ai.aiAssistant.removeCommands');_0x4dc7d0['forEach'](_0x2f321b=>{const _0xdb69ef=_0x1d01f7['find'](_0xf35ddf=>_0xf35ddf['groupId']===_0x2f321b[_0x4dc7('0x7')]);_0xdb69ef?_0xdb69ef[_0x4dc7('0x3e')]=_0xdb69ef['commands'][_0x4dc7('0x1')](_0x2f321b['commands']):_0x1d01f7[_0x4dc7('0x3d')](_0x2f321b);}),_0x1d01f7[_0x4dc7('0x56')](_0x3137af=>{_0x3137af[_0x4dc7('0x3e')]=_0x3137af[_0x4dc7('0x3e')][_0x4dc7('0x19')](_0x1179a7=>!_0xe17525[_0x4dc7('0x33')](_0x1179a7['id']));}),_0x59ca3b[_0x4dc7('0xd')](_0x4dc7('0x9'),_0x1d01f7);}[_0x4dc7('0x13')](){const _0xf317c1=this[_0x4dc7('0x35')];this[_0x4dc7('0x8')]=_0xf317c1[_0x4dc7('0x3f')][_0x4dc7('0x2c')](_0x4dc7('0x8')),this[_0x4dc7('0x1d')]=setInterval(()=>{let _0x5af30a;for(const _0x38c2d1 in _0xf317c1){const _0x8c4a09=_0x38c2d1,_0x4a6d16=_0xf317c1[_0x8c4a09];if(_0x4dc7('0xb')===_0x4a6d16||_0x4dc7('0x0')===_0x4a6d16||_0x4dc7('0x4d')===_0x4a6d16||'aiLicenseKeyTrialLimit:operations'===_0x4a6d16){delete _0xf317c1[_0x8c4a09],_0x5af30a=_0x4a6d16;break;}}if('aiLicenseKeyInvalid'===_0x5af30a)throw clearInterval(this[_0x4dc7('0x1d')]),new _0x23b3f4(_0x4dc7('0x11'),null);if(_0x4dc7('0xb')===_0x5af30a&&console[_0x4dc7('0x59')](_0x4dc7('0x54')),_0x4dc7('0x37')===_0x5af30a)throw clearInterval(this[_0x4dc7('0x1d')]),new _0x23b3f4(_0x4dc7('0x3a'),null);_0x4dc7('0x4d')===_0x5af30a&&clearInterval(this['_licenseKeyCheckInterval']);},0x3e8);}[_0x4dc7('0x52')](){this[_0x4dc7('0x1d')]&&clearInterval(this[_0x4dc7('0x1d')]);}}export function getDefaultCommands(_0x364cf4){return[{'groupId':_0x4dc7('0x12'),'groupLabel':_0x20eb35(_0x364cf4,'Edit\x20or\x20review'),'commands':[{'id':_0x4dc7('0x1e'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0x14')),'prompt':_0x4dc7('0x3b')},{'id':_0x4dc7('0x4e'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0x22')),'prompt':_0x4dc7('0x17')},{'id':_0x4dc7('0xc'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0x1a')),'prompt':_0x4dc7('0x1c')},{'id':_0x4dc7('0x3c'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0x4f')),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':_0x4dc7('0x30'),'groupLabel':_0x20eb35(_0x364cf4,'Generate\x20from\x20selection'),'commands':[{'id':_0x4dc7('0x46'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0x34')),'prompt':'Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.'},{'id':_0x4dc7('0x28'),'label':_0x20eb35(_0x364cf4,'Continue'),'prompt':_0x4dc7('0x55')}]},{'groupId':_0x4dc7('0x40'),'groupLabel':_0x20eb35(_0x364cf4,'Change\x20tone'),'commands':[{'id':'professional','label':_0x20eb35(_0x364cf4,_0x4dc7('0x3')),'prompt':_0x4dc7('0x57')},{'id':_0x4dc7('0x29'),'label':_0x20eb35(_0x364cf4,'Casual'),'prompt':_0x4dc7('0x26')},{'id':_0x4dc7('0x1b'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0x44')),'prompt':_0x4dc7('0x2d')},{'id':_0x4dc7('0x23'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0x47')),'prompt':_0x4dc7('0x2b')},{'id':_0x4dc7('0x4'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0xa')),'prompt':_0x4dc7('0x25')}]},{'groupId':'changeStyle','groupLabel':_0x20eb35(_0x364cf4,_0x4dc7('0x39')),'commands':[{'id':'business','label':_0x20eb35(_0x364cf4,_0x4dc7('0xe')),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':_0x4dc7('0x5a'),'label':_0x20eb35(_0x364cf4,'Legal'),'prompt':_0x4dc7('0x49')},{'id':'journalism','label':_0x20eb35(_0x364cf4,_0x4dc7('0x42')),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':_0x4dc7('0x15'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0x58')),'prompt':_0x4dc7('0x2f')}]},{'groupId':_0x4dc7('0x41'),'groupLabel':_0x20eb35(_0x364cf4,_0x4dc7('0x50')),'commands':[{'id':_0x4dc7('0x38'),'label':_0x20eb35(_0x364cf4,'Translate\x20to\x20%0',[_0x20eb35(_0x364cf4,_0x4dc7('0x5'))]),'prompt':_0x4dc7('0x32')},{'id':_0x4dc7('0x36'),'label':_0x20eb35(_0x364cf4,'Translate\x20to\x20%0',[_0x20eb35(_0x364cf4,'Spanish')]),'prompt':_0x4dc7('0x4c')},{'id':'translatePortuguese','label':_0x20eb35(_0x364cf4,_0x4dc7('0xf'),[_0x20eb35(_0x364cf4,_0x4dc7('0x2'))]),'prompt':_0x4dc7('0x48')},{'id':_0x4dc7('0x2a'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0xf'),[_0x20eb35(_0x364cf4,_0x4dc7('0x43'))]),'prompt':_0x4dc7('0x2e')},{'id':_0x4dc7('0x4b'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0xf'),[_0x20eb35(_0x364cf4,_0x4dc7('0x24'))]),'prompt':_0x4dc7('0x51')},{'id':_0x4dc7('0x4a'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0xf'),[_0x20eb35(_0x364cf4,_0x4dc7('0x20'))]),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':_0x4dc7('0x10'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0xf'),[_0x20eb35(_0x364cf4,_0x4dc7('0x45'))]),'prompt':_0x4dc7('0x21')},{'id':'translateArabic','label':_0x20eb35(_0x364cf4,_0x4dc7('0xf'),[_0x20eb35(_0x364cf4,_0x4dc7('0x16'))]),'prompt':_0x4dc7('0x6')}]}];}
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module ai/aiassistantediting
7
7
  */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import type { Position } from 'ckeditor5/src/engine';
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import type { Position } from 'ckeditor5/src/engine.js';
10
10
  /**
11
11
  * The AI assistant editing plugin.
12
12
  */
@@ -20,26 +20,27 @@ export default class AIAssistantEditing extends Plugin {
20
20
  */
21
21
  init(): void;
22
22
  /**
23
- * Displays a fake visual selection when the contextual balloon is displayed.
23
+ * Displays a fake visual selection.
24
24
  *
25
- * This adds a 'ai-ui' marker into the document that is rendered as a highlight on selected text fragment.
25
+ * This adds a 'ai-ui-candidate' (for the commands dropdown) or 'ai-ui' (for the assistant dialog)
26
+ * marker into the document that is rendered as a highlight on selected text fragment.
26
27
  */
27
- showFakeVisualSelection(): void;
28
+ showFakeVisualSelection(isCandidate?: boolean): void;
28
29
  /**
29
- * Removes a fake visual selection when the contextual balloon is hidden.
30
+ * Removes a fake visual selection.
30
31
  *
31
- * This removes all 'ai-ui' markers from the document.
32
+ * This clears a 'ai-ui-candidate' (for the commands dropdown) or 'ai-ui' (for the assistant dialog)
33
+ * marker from the document.
32
34
  */
33
- hideFakeVisualSelection(): void;
35
+ hideFakeVisualSelection(isCandidate?: boolean): void;
34
36
  /**
35
37
  * Converts the HTML string into the model fragment and inserts it at the specified position.
36
38
  *
37
- * If a position is not provided, the insertion will be performed at the current selection.
39
+ * If a position is not provided, the insertion will replace the visual selection marker.
38
40
  */
39
41
  insertContent(content: string, position?: Position): void;
40
42
  /**
41
- * Converts the HTML string into the model fragment and inserts it at the specified position.
42
- * If a position is not provided, the insertion will be performed at the current selection.
43
+ * Converts the HTML string into the model fragment and inserts it below the visual selection marker.
43
44
  */
44
45
  insertContentBelow(content: string): void;
45
46
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  *
4
4
  *
5
5
  *
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x9e50=['toView','canEditAt','insertContentBelow','data','hideFakeVisualSelection','ck-fake-ai-selection_collapsed','model','markerToElement','pluginName','conversion','document','toModel','editor','getLastMatchingPosition','getLastPosition','span','editingDowncast','processor','has','markers','getSelectedBlocks','selection','isAtEnd','createRange','addMarker','from','isContent','for','insertContent','init','pop','updateMarker','change','start','length'];(function(_0x370254,_0x9e50b8){const _0xe622b4=function(_0xb54faa){while(--_0xb54faa){_0x370254['push'](_0x370254['shift']());}};_0xe622b4(++_0x9e50b8);}(_0x9e50,0x14b));const _0xe622=function(_0x370254,_0x9e50b8){_0x370254=_0x370254-0x0;let _0xe622b4=_0x9e50[_0x370254];return _0xe622b4;};import{Plugin as _0x3a15c2}from'ckeditor5/src/core';const s='ai-ui';export default class i extends _0x3a15c2{static get[_0xe622('0x1b')](){return'AIAssistantEditing';}[_0xe622('0xd')](){const {editor:_0x33c007}=this;_0x33c007[_0xe622('0x1c')][_0xe622('0xb')](_0xe622('0x0'))['markerToHighlight']({'model':s,'view':{'classes':['ck-fake-ai-selection']}}),_0x33c007[_0xe622('0x1c')][_0xe622('0xb')](_0xe622('0x0'))[_0xe622('0x1a')]({'model':s,'view':{'name':_0xe622('0x22'),'classes':['ck-fake-ai-selection',_0xe622('0x18')]}});}['showFakeVisualSelection'](){const _0x15aeaf=this['editor'][_0xe622('0x19')];_0x15aeaf[_0xe622('0x10')](_0x471e83=>{const _0x3fe952=_0x15aeaf['document'][_0xe622('0x5')]['getFirstRange']();if(_0x15aeaf[_0xe622('0x3')][_0xe622('0x2')](s))_0x471e83[_0xe622('0xf')](s,{'range':_0x3fe952});else{if(_0x3fe952[_0xe622('0x11')][_0xe622('0x6')]){const _0x5c68c5=_0x3fe952[_0xe622('0x11')][_0xe622('0x20')](({item:_0x45e63f})=>!_0x15aeaf['schema'][_0xe622('0xa')](_0x45e63f),{'boundaries':_0x3fe952});_0x471e83['addMarker'](s,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x471e83[_0xe622('0x7')](_0x5c68c5,_0x3fe952['end'])});}else _0x471e83[_0xe622('0x8')](s,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x3fe952});}});}[_0xe622('0x17')](){this['editor']['model'][_0xe622('0x10')](_0x8ff20d=>{_0x8ff20d['removeMarker'](s);});}[_0xe622('0xc')](_0x3523e0,_0x3761ab){const _0x499918=_0x3761ab||this[_0xe622('0x1f')]['model'][_0xe622('0x1d')][_0xe622('0x5')];if(!this[_0xe622('0x1f')]['model'][_0xe622('0x14')](_0x499918))return;const _0x42375b=this['editor']['data'][_0xe622('0x1')][_0xe622('0x13')](_0x3523e0),_0x19d9f2=this[_0xe622('0x1f')][_0xe622('0x16')][_0xe622('0x1e')](_0x42375b);this[_0xe622('0x1f')][_0xe622('0x19')][_0xe622('0x10')](_0x404ca2=>{const _0x38e8fd=this[_0xe622('0x1f')]['model'][_0xe622('0xc')](_0x19d9f2,_0x499918);_0x38e8fd&&_0x404ca2['setSelection'](_0x38e8fd);});}[_0xe622('0x15')](_0x2255d7){const {model:_0x2fe986}=this[_0xe622('0x1f')],_0x3df4d9=Array[_0xe622('0x9')](_0x2fe986['document']['selection'][_0xe622('0x4')]()),_0x1d9bea=_0x3df4d9[_0xe622('0x12')]?_0x2fe986['createPositionAfter'](_0x3df4d9[_0xe622('0xe')]()):_0x2fe986[_0xe622('0x1d')][_0xe622('0x5')][_0xe622('0x21')]();this['insertContent'](_0x2255d7,_0x1d9bea);}}
23
+ const _0x5e56=['change','addMarker','createRange','ck-ai-assistant-ui_theme','length','span','document','editor','insertContent','start','from','insertContentBelow','removeMarker','push','getRange','model','isContent','markers','has','createPositionAfter','ck-fake-ai-selection_collapsed','get','setSelection','ck-fake-ai-selection-candidate','pop','data','updateMarker','hideFakeVisualSelection','editingDowncast','ai-ui','canEditAt','markerToHighlight','getSelectedBlocks','ai.useTheme','toView','ck-fake-ai-selection','for','selection','toModel','conversion','createSelection','config','markerToElement'];(function(_0xdaaee9,_0x5e561c){const _0x11a00e=function(_0x391b0a){while(--_0x391b0a){_0xdaaee9['push'](_0xdaaee9['shift']());}};_0x11a00e(++_0x5e561c);}(_0x5e56,0x9d));const _0x11a0=function(_0xdaaee9,_0x5e561c){_0xdaaee9=_0xdaaee9-0x0;let _0x11a00e=_0x5e56[_0xdaaee9];return _0x11a00e;};import{Plugin as _0x46a5a3}from'ckeditor5/src/core.js';const s=_0x11a0('0x1'),c='ai-ui-candidate';export default class i extends _0x46a5a3{static get['pluginName'](){return'AIAssistantEditing';}['init'](){const {editor:_0x295906}=this,_0x2cc52e=['ck-fake-ai-selection'];_0x295906[_0x11a0('0xd')]['get'](_0x11a0('0x5'))&&_0x2cc52e[_0x11a0('0x1c')](_0x11a0('0x12')),_0x295906[_0x11a0('0xb')][_0x11a0('0x8')]('editingDowncast')[_0x11a0('0x3')]({'model':s,'view':{'classes':_0x2cc52e}}),_0x295906['conversion'][_0x11a0('0x8')](_0x11a0('0x0'))[_0x11a0('0xe')]({'model':s,'view':{'name':_0x11a0('0x14'),'classes':[_0x11a0('0x7'),_0x11a0('0x23')]}}),_0x295906[_0x11a0('0xb')][_0x11a0('0x8')]('editingDowncast')['markerToHighlight']({'model':c,'view':{'classes':[_0x11a0('0x26')]}}),_0x295906[_0x11a0('0xb')][_0x11a0('0x8')](_0x11a0('0x0'))[_0x11a0('0xe')]({'model':c,'view':{'name':'span','classes':['ck-fake-ai-selection-candidate',_0x11a0('0x23')]}});}['showFakeVisualSelection'](_0xacb97f){const _0x4b2a20=this['editor'][_0x11a0('0x1e')],_0xfb22fc=_0xacb97f?c:s;_0x4b2a20[_0x11a0('0xf')](_0x3b55fa=>{const _0x5ae606=_0x4b2a20[_0x11a0('0x15')][_0x11a0('0x9')]['getFirstRange']();if(_0x4b2a20[_0x11a0('0x20')][_0x11a0('0x21')](_0xfb22fc))_0x3b55fa[_0x11a0('0x29')](_0xfb22fc,{'range':_0x5ae606});else{if(_0x5ae606[_0x11a0('0x18')]['isAtEnd']){const _0x259cb4=_0x5ae606['start']['getLastMatchingPosition'](({item:_0x51bd87})=>!_0x4b2a20['schema'][_0x11a0('0x1f')](_0x51bd87),{'boundaries':_0x5ae606});_0x3b55fa[_0x11a0('0x10')](_0xfb22fc,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x3b55fa[_0x11a0('0x11')](_0x259cb4,_0x5ae606['end'])});}else _0x3b55fa['addMarker'](_0xfb22fc,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x5ae606});}});}[_0x11a0('0x2a')](_0x1e907b){const _0x32a1e5=this[_0x11a0('0x16')][_0x11a0('0x1e')],_0x1da1a5=_0x1e907b?c:s;_0x32a1e5['markers'][_0x11a0('0x21')](_0x1da1a5)&&_0x32a1e5[_0x11a0('0xf')](_0x50b4e2=>{_0x50b4e2[_0x11a0('0x1b')](_0x1da1a5);});}[_0x11a0('0x17')](_0x56e6cb,_0x1be2fd){const _0x5772a2=_0x1be2fd||this[_0x11a0('0x16')][_0x11a0('0x1e')][_0x11a0('0x20')][_0x11a0('0x24')](s)['getRange']();if(!this[_0x11a0('0x16')]['model'][_0x11a0('0x2')](_0x5772a2))return;const _0x42923b=this[_0x11a0('0x16')][_0x11a0('0x28')]['processor'][_0x11a0('0x6')](_0x56e6cb),_0x415520=this[_0x11a0('0x16')]['data'][_0x11a0('0xa')](_0x42923b);this[_0x11a0('0x16')]['model']['change'](_0x47deb1=>{this[_0x11a0('0x2a')]();const _0x3173cc=this[_0x11a0('0x16')][_0x11a0('0x1e')]['insertContent'](_0x415520,_0x5772a2);_0x3173cc&&_0x47deb1[_0x11a0('0x25')](_0x3173cc);});}[_0x11a0('0x1a')](_0x1577e4){const {model:_0x2ddfa0}=this['editor'],_0x32e744=Array[_0x11a0('0x19')](_0x2ddfa0[_0x11a0('0xc')](this['editor'][_0x11a0('0x1e')]['markers']['get'](s)[_0x11a0('0x1d')]())[_0x11a0('0x4')]()),_0x108d46=_0x32e744[_0x11a0('0x13')]?_0x2ddfa0[_0x11a0('0x22')](_0x32e744[_0x11a0('0x27')]()):_0x2ddfa0[_0x11a0('0x15')][_0x11a0('0x9')]['getLastPosition']();this[_0x11a0('0x17')](_0x1577e4,_0x108d46);}}
@@ -1,14 +1,15 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module ai/aiassistantui
7
7
  * @publicApi
8
8
  */
9
- import { Plugin, type Editor } from 'ckeditor5/src/core';
10
- import { ContextualBalloon } from 'ckeditor5/src/ui';
11
- import AIAssistantEditing from './aiassistantediting';
9
+ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
10
+ import { Dialog } from 'ckeditor5/src/ui.js';
11
+ import AIAssistantEditing from './aiassistantediting.js';
12
+ import AIAdapter from './adapters/aiadapter.js';
12
13
  import '../theme/ai.css';
13
14
  import '../theme/ai-dropdown.css';
14
15
  import '../theme/ai-form.css';
@@ -23,7 +24,7 @@ export default class AIAssistantUI extends Plugin {
23
24
  /**
24
25
  * @inheritDoc
25
26
  */
26
- static get requires(): readonly [typeof AIAssistantEditing, "AIConnector", typeof ContextualBalloon];
27
+ static get requires(): readonly [typeof AIAssistantEditing, typeof AIAdapter, typeof Dialog];
27
28
  /**
28
29
  * @inheritDoc
29
30
  */
@@ -32,13 +33,20 @@ export default class AIAssistantUI extends Plugin {
32
33
  * @inheritDoc
33
34
  */
34
35
  init(): void;
36
+ /**
37
+ * @inheritDoc
38
+ */
35
39
  afterInit(): void;
36
40
  /**
37
- * Initializes the balloon content and displays it based on the selection.
41
+ * Initializes the AI Assistant main view and displays it in a dialog, based on the selection. Also, shows fake selection marker.
42
+ *
43
+ * @param query The initial query. If set, the AI assistant will automatically submit given query to the AI service.
44
+ * @param label Label to be displayed in the AI assistant query input field while the AI assistant processes the initial query.
45
+ * @param actionId The id of the executed action. It can be used in extended and custom adapters to customize the request.
38
46
  */
39
- showUI(prompt?: string, label?: string): void;
47
+ showUI(query?: string, label?: string, actionId?: string): void;
40
48
  /**
41
- * Removes fake markers and clears the balloon content causing it hidden.
49
+ * Hides the AI dialog.
42
50
  */
43
51
  hideUI(): void;
44
52
  }