@ckeditor/ckeditor5-ai 40.1.0 → 40.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/README.md +1 -1
  2. package/build/ai.js +77 -2
  3. package/build/translations/af.js +1 -1
  4. package/build/translations/ar.js +1 -1
  5. package/build/translations/bg.js +1 -1
  6. package/build/translations/bn.js +1 -1
  7. package/build/translations/bs.js +1 -1
  8. package/build/translations/ca.js +1 -1
  9. package/build/translations/cs.js +1 -1
  10. package/build/translations/da.js +1 -1
  11. package/build/translations/de-ch.js +1 -1
  12. package/build/translations/de.js +1 -1
  13. package/build/translations/el.js +1 -1
  14. package/build/translations/en-au.js +1 -1
  15. package/build/translations/es-co.js +1 -1
  16. package/build/translations/es.js +1 -1
  17. package/build/translations/et.js +1 -1
  18. package/build/translations/fa.js +1 -1
  19. package/build/translations/fi.js +1 -1
  20. package/build/translations/fr.js +1 -1
  21. package/build/translations/gl.js +1 -1
  22. package/build/translations/he.js +1 -1
  23. package/build/translations/hi.js +1 -1
  24. package/build/translations/hr.js +1 -1
  25. package/build/translations/hu.js +1 -1
  26. package/build/translations/id.js +1 -1
  27. package/build/translations/it.js +1 -1
  28. package/build/translations/ja.js +1 -1
  29. package/build/translations/jv.js +1 -1
  30. package/build/translations/ko.js +1 -1
  31. package/build/translations/lt.js +1 -1
  32. package/build/translations/lv.js +1 -1
  33. package/build/translations/ms.js +1 -1
  34. package/build/translations/nl.js +1 -1
  35. package/build/translations/no.js +1 -1
  36. package/build/translations/pl.js +1 -1
  37. package/build/translations/pt-br.js +1 -1
  38. package/build/translations/pt.js +1 -1
  39. package/build/translations/ro.js +1 -1
  40. package/build/translations/ru.js +1 -1
  41. package/build/translations/sk.js +1 -1
  42. package/build/translations/sr-latn.js +1 -1
  43. package/build/translations/sr.js +1 -1
  44. package/build/translations/sv.js +1 -1
  45. package/build/translations/th.js +1 -1
  46. package/build/translations/tk.js +1 -1
  47. package/build/translations/tr.js +1 -1
  48. package/build/translations/ug.js +1 -1
  49. package/build/translations/uk.js +1 -1
  50. package/build/translations/ur.js +1 -1
  51. package/build/translations/uz.js +1 -1
  52. package/build/translations/vi.js +1 -1
  53. package/build/translations/zh-cn.js +1 -1
  54. package/build/translations/zh.js +1 -1
  55. package/ckeditor5-metadata.json +1 -1
  56. package/lang/contexts.json +3 -1
  57. package/lang/translations/af.po +2 -2
  58. package/lang/translations/ar.po +3 -3
  59. package/lang/translations/bg.po +3 -3
  60. package/lang/translations/bn.po +3 -3
  61. package/lang/translations/bs.po +2 -2
  62. package/lang/translations/ca.po +3 -3
  63. package/lang/translations/cs.po +3 -3
  64. package/lang/translations/da.po +3 -3
  65. package/lang/translations/de-ch.po +2 -2
  66. package/lang/translations/de.po +3 -3
  67. package/lang/translations/el.po +3 -3
  68. package/lang/translations/en-au.po +2 -2
  69. package/lang/translations/en.po +3 -3
  70. package/lang/translations/es-co.po +2 -2
  71. package/lang/translations/es.po +3 -3
  72. package/lang/translations/et.po +3 -3
  73. package/lang/translations/fa.po +2 -2
  74. package/lang/translations/fi.po +3 -3
  75. package/lang/translations/fr.po +3 -3
  76. package/lang/translations/gl.po +50 -50
  77. package/lang/translations/he.po +3 -3
  78. package/lang/translations/hi.po +3 -3
  79. package/lang/translations/hr.po +2 -2
  80. package/lang/translations/hu.po +3 -3
  81. package/lang/translations/id.po +3 -3
  82. package/lang/translations/it.po +3 -3
  83. package/lang/translations/ja.po +3 -3
  84. package/lang/translations/jv.po +2 -2
  85. package/lang/translations/ko.po +3 -3
  86. package/lang/translations/lt.po +3 -3
  87. package/lang/translations/lv.po +3 -3
  88. package/lang/translations/ms.po +3 -3
  89. package/lang/translations/nl.po +3 -3
  90. package/lang/translations/no.po +3 -3
  91. package/lang/translations/pl.po +3 -3
  92. package/lang/translations/pt-br.po +3 -3
  93. package/lang/translations/pt.po +3 -3
  94. package/lang/translations/ro.po +3 -3
  95. package/lang/translations/ru.po +3 -3
  96. package/lang/translations/sk.po +3 -3
  97. package/lang/translations/sr-latn.po +50 -50
  98. package/lang/translations/sr.po +3 -3
  99. package/lang/translations/sv.po +3 -3
  100. package/lang/translations/th.po +3 -3
  101. package/lang/translations/tk.po +2 -2
  102. package/lang/translations/tr.po +3 -3
  103. package/lang/translations/ug.po +15 -15
  104. package/lang/translations/uk.po +3 -3
  105. package/lang/translations/ur.po +2 -2
  106. package/lang/translations/uz.po +2 -2
  107. package/lang/translations/vi.po +3 -3
  108. package/lang/translations/zh-cn.po +3 -3
  109. package/lang/translations/zh.po +3 -3
  110. package/package.json +4 -3
  111. package/src/adapters/aiadapter.d.ts +48 -0
  112. package/src/adapters/aiadapter.js +23 -0
  113. package/src/adapters/aitextadapter.d.ts +146 -0
  114. package/src/adapters/aitextadapter.js +23 -0
  115. package/src/adapters/awstextadapter.d.ts +178 -0
  116. package/src/adapters/awstextadapter.js +23 -0
  117. package/src/adapters/openaitextadapter.d.ts +181 -0
  118. package/src/adapters/openaitextadapter.js +23 -0
  119. package/src/aiassistant.d.ts +44 -116
  120. package/src/aiassistant.js +1 -1
  121. package/src/aiassistantediting.js +1 -1
  122. package/src/aiassistantui.d.ts +12 -4
  123. package/src/aiassistantui.js +1 -1
  124. package/src/aiconfig.d.ts +69 -0
  125. package/src/aiconfig.js +23 -0
  126. package/src/augmentation.d.ts +6 -5
  127. package/src/index.d.ts +4 -0
  128. package/src/index.js +1 -1
  129. package/src/ui/aiassistantcontroller.d.ts +32 -19
  130. package/src/ui/aiassistantcontroller.js +1 -1
  131. package/src/ui/dropdown/aicommandslistview.js +1 -1
  132. package/src/ui/dropdown/buttonlabelwithhighlightview.js +1 -1
  133. package/src/ui/dropdown/labelwithhighlightview.js +1 -1
  134. package/src/ui/form/aiformcontentarea.js +1 -1
  135. package/src/ui/form/aiformerrorview.js +1 -1
  136. package/src/ui/form/aiformpromptview.js +1 -1
  137. package/src/ui/form/aiformtoolbarview.d.ts +2 -2
  138. package/src/ui/form/aiformtoolbarview.js +1 -1
  139. package/src/ui/form/aiformview.d.ts +2 -2
  140. package/src/ui/form/aiformview.js +1 -1
  141. package/src/ui/form/aihistorylistitemview.js +1 -1
  142. package/src/ui/form/aihistorylistview.js +1 -1
  143. package/src/ui/form/prompthistory.js +1 -1
  144. package/src/ui/showaiassistantcommand.d.ts +6 -3
  145. package/src/ui/showaiassistantcommand.js +1 -1
  146. package/src/utils/common-translations.js +1 -1
  147. package/src/aiconnector.d.ts +0 -45
  148. package/src/aiconnector.js +0 -23
@@ -10,19 +10,19 @@ import { type Locale } from 'ckeditor5/src/utils';
10
10
  import { Plugin, type Editor } from 'ckeditor5/src/core';
11
11
  import AIAssistantUI from './aiassistantui';
12
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>;
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
- };
@@ -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 _0x4dd6=['Direct','AIAssistant','includes','Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.','French','Summarize','Hindi','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.','Simplify\x20language','Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.','init','Change\x20style','ai-trial-license-key-reached-limit-changes','concat','ai.aiAssistant.extraCommandGroups','Friendly','generate','Business','legal','Make\x20longer','Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.','_licenseKeyCheckInterval','simplifyLanguage','Improve\x20writing','find','ai-invalid-license-key','push','Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.','aiLicenseKeyTrialLimit:operations','translateChinese','Translate','Professional','Translate\x20the\x20content\x20to\x20Spanish\x20language.','editOrReview','Translate\x20the\x20content\x20to\x20French\x20language.','filter','forEach','Translate\x20the\x20content\x20to\x20English\x20language.','Change\x20tone','locale','aiLicenseKeyValid','continue','Translate\x20the\x20content\x20to\x20Hindi\x20language.','ai.aiAssistant.commands','makeLonger','journalism','destroy','Journalism','pluginName','Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.','editor','Confident','Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.','Simplified\x20Chinese','define','translateEnglish','changeTone','English','Continue','Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.','requires','makeShorter','Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.','config','improveWriting','Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.','translateHindi','translateGerman','Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.','licenseKey','translate','ai.aiAssistant.removeCommands','Legal','Portuguese','translatePortuguese','casual','get','poetic','Casual','Spanish','aiLicenseKeyInvalid','commands','changeStyle','Translate\x20to\x20%0','professional','Translate\x20the\x20content\x20to\x20German\x20language.','aiLicenseKeyTrial','Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.','Translate\x20the\x20content\x20to\x20Portuguese\x20language.','Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.','groupId','confident','Make\x20shorter','translateFrench','translateSpanish'];(function(_0x4f29fa,_0x4dd6e0){const _0x4aeaa8=function(_0x3cab10){while(--_0x3cab10){_0x4f29fa['push'](_0x4f29fa['shift']());}};_0x4aeaa8(++_0x4dd6e0);}(_0x4dd6,0x1b0));const _0x4aea=function(_0x4f29fa,_0x4dd6e0){_0x4f29fa=_0x4f29fa-0x0;let _0x4aeaa8=_0x4dd6[_0x4f29fa];return _0x4aeaa8;};import{CKEditorError as _0x21ce54}from'ckeditor5/src/utils';import{Plugin as _0x23f38b}from'ckeditor5/src/core';import _0x49bf43 from'./aiassistantui';import _0x574202 from'./aiassistantediting';import{getTranslation as _0x32bf02}from'./utils/common-translations';export default class r extends _0x23f38b{static get[_0x4aea('0x8')](){return[_0x49bf43,_0x574202];}static get[_0x4aea('0x5b')](){return _0x4aea('0x2c');}constructor(_0x4977ec){super(_0x4977ec);const _0x215584=_0x4977ec[_0x4aea('0xb')];_0x215584[_0x4aea('0x2')](_0x4aea('0x56'),getDefaultCommands(_0x4977ec[_0x4aea('0x52')])),_0x215584[_0x4aea('0x2')](_0x4aea('0x39'),[]),_0x215584[_0x4aea('0x2')](_0x4aea('0x13'),[]);const _0x3e6f8e=_0x215584[_0x4aea('0x18')]('ai.aiAssistant.commands'),_0x9f8a0a=_0x215584[_0x4aea('0x18')]('ai.aiAssistant.extraCommandGroups'),_0x5b4b2d=_0x215584[_0x4aea('0x18')](_0x4aea('0x13'));_0x9f8a0a['forEach'](_0x10a40b=>{const _0x2f222d=_0x3e6f8e[_0x4aea('0x43')](_0x4acd67=>_0x4acd67[_0x4aea('0x26')]===_0x10a40b['groupId']);_0x2f222d?_0x2f222d[_0x4aea('0x1d')]=_0x2f222d[_0x4aea('0x1d')][_0x4aea('0x38')](_0x10a40b[_0x4aea('0x1d')]):_0x3e6f8e[_0x4aea('0x45')](_0x10a40b);}),_0x3e6f8e[_0x4aea('0x4f')](_0x4308bd=>{_0x4308bd['commands']=_0x4308bd[_0x4aea('0x1d')][_0x4aea('0x4e')](_0x2fbb1f=>!_0x5b4b2d[_0x4aea('0x2d')](_0x2fbb1f['id']));}),_0x215584['set'](_0x4aea('0x56'),_0x3e6f8e);}[_0x4aea('0x35')](){const _0x2c00dd=this[_0x4aea('0x5d')];this[_0x4aea('0x11')]=_0x2c00dd[_0x4aea('0xb')][_0x4aea('0x18')](_0x4aea('0x11')),this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x4d67cf;for(const _0x4b09e9 in _0x2c00dd){const _0x9cb301=_0x4b09e9,_0x5dbaac=_0x2c00dd[_0x9cb301];if(_0x4aea('0x22')===_0x5dbaac||_0x4aea('0x1c')===_0x5dbaac||_0x4aea('0x53')===_0x5dbaac||_0x4aea('0x47')===_0x5dbaac){delete _0x2c00dd[_0x9cb301],_0x4d67cf=_0x5dbaac;break;}}if(_0x4aea('0x1c')===_0x4d67cf)throw clearInterval(this['_licenseKeyCheckInterval']),new _0x21ce54(_0x4aea('0x44'),null);if(_0x4aea('0x22')===_0x4d67cf&&console['info'](_0x4aea('0x32')),_0x4aea('0x47')===_0x4d67cf)throw clearInterval(this[_0x4aea('0x40')]),new _0x21ce54(_0x4aea('0x37'),null);_0x4aea('0x53')===_0x4d67cf&&clearInterval(this[_0x4aea('0x40')]);},0x3e8);}[_0x4aea('0x59')](){this['_licenseKeyCheckInterval']&&clearInterval(this[_0x4aea('0x40')]);}}export function getDefaultCommands(_0x559e05){return[{'groupId':_0x4aea('0x4c'),'groupLabel':_0x32bf02(_0x559e05,'Edit\x20or\x20review'),'commands':[{'id':_0x4aea('0xc'),'label':_0x32bf02(_0x559e05,_0x4aea('0x42')),'prompt':_0x4aea('0x34')},{'id':_0x4aea('0x9'),'label':_0x32bf02(_0x559e05,_0x4aea('0x28')),'prompt':_0x4aea('0x10')},{'id':_0x4aea('0x57'),'label':_0x32bf02(_0x559e05,_0x4aea('0x3e')),'prompt':_0x4aea('0x0')},{'id':_0x4aea('0x41'),'label':_0x32bf02(_0x559e05,_0x4aea('0x33')),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':_0x4aea('0x3b'),'groupLabel':_0x32bf02(_0x559e05,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':_0x32bf02(_0x559e05,_0x4aea('0x30')),'prompt':_0x4aea('0x46')},{'id':_0x4aea('0x54'),'label':_0x32bf02(_0x559e05,_0x4aea('0x6')),'prompt':'Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.'}]},{'groupId':_0x4aea('0x4'),'groupLabel':_0x32bf02(_0x559e05,_0x4aea('0x51')),'commands':[{'id':_0x4aea('0x20'),'label':_0x32bf02(_0x559e05,_0x4aea('0x4a')),'prompt':_0x4aea('0x5c')},{'id':_0x4aea('0x17'),'label':_0x32bf02(_0x559e05,_0x4aea('0x1a')),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':_0x32bf02(_0x559e05,_0x4aea('0x2b')),'prompt':_0x4aea('0xa')},{'id':_0x4aea('0x27'),'label':_0x32bf02(_0x559e05,_0x4aea('0x5e')),'prompt':_0x4aea('0x2e')},{'id':'friendly','label':_0x32bf02(_0x559e05,_0x4aea('0x3a')),'prompt':_0x4aea('0x23')}]},{'groupId':_0x4aea('0x1e'),'groupLabel':_0x32bf02(_0x559e05,_0x4aea('0x36')),'commands':[{'id':'business','label':_0x32bf02(_0x559e05,_0x4aea('0x3c')),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':_0x4aea('0x3d'),'label':_0x32bf02(_0x559e05,_0x4aea('0x14')),'prompt':_0x4aea('0xd')},{'id':_0x4aea('0x58'),'label':_0x32bf02(_0x559e05,_0x4aea('0x5a')),'prompt':_0x4aea('0x7')},{'id':_0x4aea('0x19'),'label':_0x32bf02(_0x559e05,'Poetic'),'prompt':_0x4aea('0x25')}]},{'groupId':_0x4aea('0x12'),'groupLabel':_0x32bf02(_0x559e05,_0x4aea('0x49')),'commands':[{'id':_0x4aea('0x3'),'label':_0x32bf02(_0x559e05,_0x4aea('0x1f'),[_0x32bf02(_0x559e05,_0x4aea('0x5'))]),'prompt':_0x4aea('0x50')},{'id':_0x4aea('0x2a'),'label':_0x32bf02(_0x559e05,'Translate\x20to\x20%0',[_0x32bf02(_0x559e05,_0x4aea('0x1b'))]),'prompt':_0x4aea('0x4b')},{'id':_0x4aea('0x16'),'label':_0x32bf02(_0x559e05,'Translate\x20to\x20%0',[_0x32bf02(_0x559e05,_0x4aea('0x15'))]),'prompt':_0x4aea('0x24')},{'id':_0x4aea('0xf'),'label':_0x32bf02(_0x559e05,'Translate\x20to\x20%0',[_0x32bf02(_0x559e05,'German')]),'prompt':_0x4aea('0x21')},{'id':_0x4aea('0x29'),'label':_0x32bf02(_0x559e05,_0x4aea('0x1f'),[_0x32bf02(_0x559e05,_0x4aea('0x2f'))]),'prompt':_0x4aea('0x4d')},{'id':_0x4aea('0x48'),'label':_0x32bf02(_0x559e05,_0x4aea('0x1f'),[_0x32bf02(_0x559e05,_0x4aea('0x1'))]),'prompt':_0x4aea('0x3f')},{'id':_0x4aea('0xe'),'label':_0x32bf02(_0x559e05,_0x4aea('0x1f'),[_0x32bf02(_0x559e05,_0x4aea('0x31'))]),'prompt':_0x4aea('0x55')},{'id':'translateArabic','label':_0x32bf02(_0x559e05,'Translate\x20to\x20%0',[_0x32bf02(_0x559e05,'Arabic')]),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}
@@ -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 _0x1ecc=['isAtEnd','processor','document','AIAssistantEditing','editingDowncast','pop','ck-fake-ai-selection_collapsed','markers','addMarker','model','markerToElement','selection','conversion','updateMarker','createRange','ai-ui','hideFakeVisualSelection','getSelectedBlocks','span','data','getLastMatchingPosition','createPositionAfter','schema','pluginName','end','removeMarker','for','toView','getFirstRange','has','toModel','editor','insertContent','change','start','length','setSelection','showFakeVisualSelection','from'];(function(_0x35e903,_0x1ecca8){const _0x228d4d=function(_0x51db74){while(--_0x51db74){_0x35e903['push'](_0x35e903['shift']());}};_0x228d4d(++_0x1ecca8);}(_0x1ecc,0x146));const _0x228d=function(_0x35e903,_0x1ecca8){_0x35e903=_0x35e903-0x0;let _0x228d4d=_0x1ecc[_0x35e903];return _0x228d4d;};import{Plugin as _0x3b481f}from'ckeditor5/src/core';const s=_0x228d('0x1');export default class i extends _0x3b481f{static get[_0x228d('0x9')](){return _0x228d('0x1c');}['init'](){const {editor:_0x31045b}=this;_0x31045b[_0x228d('0x25')][_0x228d('0xc')](_0x228d('0x1d'))['markerToHighlight']({'model':s,'view':{'classes':['ck-fake-ai-selection']}}),_0x31045b[_0x228d('0x25')][_0x228d('0xc')](_0x228d('0x1d'))[_0x228d('0x23')]({'model':s,'view':{'name':_0x228d('0x4'),'classes':['ck-fake-ai-selection',_0x228d('0x1f')]}});}[_0x228d('0x17')](){const _0x4cc91c=this[_0x228d('0x11')][_0x228d('0x22')];_0x4cc91c[_0x228d('0x13')](_0x646a67=>{const _0x2d85bf=_0x4cc91c[_0x228d('0x1b')][_0x228d('0x24')][_0x228d('0xe')]();if(_0x4cc91c[_0x228d('0x20')][_0x228d('0xf')](s))_0x646a67[_0x228d('0x26')](s,{'range':_0x2d85bf});else{if(_0x2d85bf['start'][_0x228d('0x19')]){const _0x5738a0=_0x2d85bf[_0x228d('0x14')][_0x228d('0x6')](({item:_0x177e78})=>!_0x4cc91c[_0x228d('0x8')]['isContent'](_0x177e78),{'boundaries':_0x2d85bf});_0x646a67['addMarker'](s,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x646a67[_0x228d('0x0')](_0x5738a0,_0x2d85bf[_0x228d('0xa')])});}else _0x646a67[_0x228d('0x21')](s,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x2d85bf});}});}[_0x228d('0x2')](){const _0x5067ef=this[_0x228d('0x11')]['model'];_0x5067ef[_0x228d('0x20')][_0x228d('0xf')](s)&&_0x5067ef['change'](_0x1f9530=>{_0x1f9530[_0x228d('0xb')](s);});}[_0x228d('0x12')](_0x21f81b,_0x280bf8){const _0x15ffce=_0x280bf8||this[_0x228d('0x11')][_0x228d('0x22')][_0x228d('0x1b')][_0x228d('0x24')];if(!this[_0x228d('0x11')][_0x228d('0x22')]['canEditAt'](_0x15ffce))return;const _0x4cf5e6=this[_0x228d('0x11')][_0x228d('0x5')][_0x228d('0x1a')][_0x228d('0xd')](_0x21f81b),_0xccd5bf=this[_0x228d('0x11')][_0x228d('0x5')][_0x228d('0x10')](_0x4cf5e6);this[_0x228d('0x11')][_0x228d('0x22')][_0x228d('0x13')](_0x5b2fad=>{const _0x4321dd=this[_0x228d('0x11')][_0x228d('0x22')]['insertContent'](_0xccd5bf,_0x15ffce);_0x4321dd&&_0x5b2fad[_0x228d('0x16')](_0x4321dd);});}['insertContentBelow'](_0x599e55){const {model:_0x521059}=this[_0x228d('0x11')],_0x427777=Array[_0x228d('0x18')](_0x521059[_0x228d('0x1b')]['selection'][_0x228d('0x3')]()),_0xac0690=_0x427777[_0x228d('0x15')]?_0x521059[_0x228d('0x7')](_0x427777[_0x228d('0x1e')]()):_0x521059[_0x228d('0x1b')][_0x228d('0x24')]['getLastPosition']();this[_0x228d('0x12')](_0x599e55,_0xac0690);}}
@@ -9,6 +9,7 @@
9
9
  import { Plugin, type Editor } from 'ckeditor5/src/core';
10
10
  import { ContextualBalloon } from 'ckeditor5/src/ui';
11
11
  import AIAssistantEditing from './aiassistantediting';
12
+ import AIAdapter from './adapters/aiadapter';
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 ContextualBalloon];
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 balloon, 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 Assistant UI balloon and clears fake selection marker.
42
50
  */
43
51
  hideUI(): void;
44
52
  }