@ckeditor/ckeditor5-ai 0.0.0-nightly-20231214.0 → 0.0.0-nightly-20231216.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 (48) hide show
  1. package/build/ai.js +1 -1
  2. package/package.json +4 -3
  3. package/src/adapters/aiadapter.d.ts +2 -2
  4. package/src/adapters/aiadapter.js +1 -1
  5. package/src/adapters/aitextadapter.d.ts +2 -2
  6. package/src/adapters/aitextadapter.js +1 -1
  7. package/src/adapters/awstextadapter.d.ts +2 -2
  8. package/src/adapters/awstextadapter.js +1 -1
  9. package/src/adapters/openaitextadapter.d.ts +2 -2
  10. package/src/adapters/openaitextadapter.js +1 -1
  11. package/src/aiassistant.d.ts +4 -4
  12. package/src/aiassistant.js +1 -1
  13. package/src/aiassistantediting.d.ts +2 -2
  14. package/src/aiassistantediting.js +1 -1
  15. package/src/aiassistantui.d.ts +4 -4
  16. package/src/aiassistantui.js +1 -1
  17. package/src/aiconfig.d.ts +3 -3
  18. package/src/augmentation.d.ts +6 -6
  19. package/src/index.d.ts +6 -6
  20. package/src/index.js +1 -1
  21. package/src/ui/aiassistantcontroller.d.ts +6 -6
  22. package/src/ui/aiassistantcontroller.js +1 -1
  23. package/src/ui/dropdown/aicommandslistview.d.ts +1 -1
  24. package/src/ui/dropdown/aicommandslistview.js +1 -1
  25. package/src/ui/dropdown/buttonlabelwithhighlightview.d.ts +1 -1
  26. package/src/ui/dropdown/buttonlabelwithhighlightview.js +1 -1
  27. package/src/ui/dropdown/labelwithhighlightview.d.ts +1 -1
  28. package/src/ui/dropdown/labelwithhighlightview.js +1 -1
  29. package/src/ui/form/aiformcontentarea.d.ts +2 -2
  30. package/src/ui/form/aiformcontentarea.js +1 -1
  31. package/src/ui/form/aiformerrorview.d.ts +2 -2
  32. package/src/ui/form/aiformerrorview.js +1 -1
  33. package/src/ui/form/aiformpromptview.d.ts +2 -2
  34. package/src/ui/form/aiformpromptview.js +1 -1
  35. package/src/ui/form/aiformtoolbarview.d.ts +2 -2
  36. package/src/ui/form/aiformtoolbarview.js +1 -1
  37. package/src/ui/form/aiformview.d.ts +6 -6
  38. package/src/ui/form/aiformview.js +1 -1
  39. package/src/ui/form/aihistorylistitemview.d.ts +2 -2
  40. package/src/ui/form/aihistorylistitemview.js +1 -1
  41. package/src/ui/form/aihistorylistview.d.ts +2 -2
  42. package/src/ui/form/aihistorylistview.js +1 -1
  43. package/src/ui/form/prompthistory.d.ts +1 -1
  44. package/src/ui/form/prompthistory.js +1 -1
  45. package/src/ui/showaiassistantcommand.d.ts +1 -1
  46. package/src/ui/showaiassistantcommand.js +1 -1
  47. package/src/utils/common-translations.d.ts +1 -1
  48. package/src/utils/common-translations.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-ai",
3
- "version": "0.0.0-nightly-20231214.0",
3
+ "version": "0.0.0-nightly-20231216.0",
4
4
  "description": "AI-powered features for CKEditor 5.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "CKSource (http://cksource.com/)",
@@ -23,11 +23,12 @@
23
23
  "framework"
24
24
  ],
25
25
  "dependencies": {
26
- "ckeditor5": "0.0.0-nightly-20231214.0",
26
+ "ckeditor5": "0.0.0-nightly-20231216.0",
27
27
  "@aws-sdk/client-bedrock-runtime": "3.470.0",
28
- "@ckeditor/ckeditor5-ui": "0.0.0-nightly-20231214.0",
28
+ "@ckeditor/ckeditor5-ui": "0.0.0-nightly-20231216.0",
29
29
  "lodash-es": "4.17.21"
30
30
  },
31
+ "type": "module",
31
32
  "main": "src/index.js",
32
33
  "files": [
33
34
  "lang",
@@ -6,8 +6,8 @@
6
6
  * @module ai/adapters/aiadapter
7
7
  * @publicApi
8
8
  */
9
- import { Plugin } from 'ckeditor5/src/core';
10
- import type AITextAdapter from './aitextadapter';
9
+ import { Plugin } from 'ckeditor5/src/core.js';
10
+ import type AITextAdapter from './aitextadapter.js';
11
11
  /**
12
12
  * Main adapter plugin that is a common interface between AI features and AI adapters.
13
13
  *
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- var _0x16bf=['name','pluginName','AIAdapter','afterInit','aiadapter-text-adapter-not-set','AIRequestError'];(function(_0x5c39e1,_0x16bfe4){var _0x47e2cd=function(_0x39f19e){while(--_0x39f19e){_0x5c39e1['push'](_0x5c39e1['shift']());}};_0x47e2cd(++_0x16bfe4);}(_0x16bf,0x1e7));var _0x47e2=function(_0x5c39e1,_0x16bfe4){_0x5c39e1=_0x5c39e1-0x0;var _0x47e2cd=_0x16bf[_0x5c39e1];return _0x47e2cd;};import{Plugin as _0x174e15}from'ckeditor5/src/core';import{CKEditorError as _0x2928e5}from'ckeditor5/src/utils';export default class A extends _0x174e15{static get[_0x47e2('0x0')](){return _0x47e2('0x1');}[_0x47e2('0x2')](){if(!this['textAdapter'])throw new _0x2928e5(_0x47e2('0x3'),null);}}export class AIRequestError extends Error{constructor(_0x1f7a6b){super(_0x1f7a6b),this[_0x47e2('0x5')]=_0x47e2('0x4');}}
23
+ var _0xc9c5=['afterInit','pluginName','textAdapter','AIAdapter','aiadapter-text-adapter-not-set','AIRequestError'];(function(_0x468cb6,_0xc9c505){var _0x46e187=function(_0x45f512){while(--_0x45f512){_0x468cb6['push'](_0x468cb6['shift']());}};_0x46e187(++_0xc9c505);}(_0xc9c5,0x18c));var _0x46e1=function(_0x468cb6,_0xc9c505){_0x468cb6=_0x468cb6-0x0;var _0x46e187=_0xc9c5[_0x468cb6];return _0x46e187;};import{Plugin as _0x3d3e9b}from'ckeditor5/src/core.js';import{CKEditorError as _0x140041}from'ckeditor5/src/utils.js';export default class A extends _0x3d3e9b{static get[_0x46e1('0x1')](){return _0x46e1('0x3');}[_0x46e1('0x0')](){if(!this[_0x46e1('0x2')])throw new _0x140041(_0x46e1('0x4'),null);}}export class AIRequestError extends Error{constructor(_0x41810d){super(_0x41810d),this['name']=_0x46e1('0x5');}}
@@ -6,8 +6,8 @@
6
6
  * @module ai/adapters/aitextadapter
7
7
  * @publicApi
8
8
  */
9
- import { Plugin } from 'ckeditor5/src/core';
10
- import { default as AIAdapter } from './aiadapter';
9
+ import { Plugin } from 'ckeditor5/src/core.js';
10
+ import { default as AIAdapter } from './aiadapter.js';
11
11
  /**
12
12
  * Abstract base class for AI adapters that perform text-related requests.
13
13
  *
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x3936=['application/json','init','reject','plugins','AI_ERROR_GET_PARAMETERS','error','makeRequest','abortController','_prepareRequestParameters','catch','abort','signal','sendRequest','locale','editor','assign','object','get'];(function(_0x4ee548,_0x393645){const _0x4133fc=function(_0x58a450){while(--_0x58a450){_0x4ee548['push'](_0x4ee548['shift']());}};_0x4133fc(++_0x393645);}(_0x3936,0x1af));const _0x4133=function(_0x4ee548,_0x393645){_0x4ee548=_0x4ee548-0x0;let _0x4133fc=_0x3936[_0x4ee548];return _0x4133fc;};import{Plugin as _0x1fcce2}from'ckeditor5/src/core';import{CKEditorError as _0x339178}from'ckeditor5/src/utils';import{default as _0x4782be,AIRequestError as _0x2dc255}from'./aiadapter';import{getTranslation as _0x4e19ee}from'../utils/common-translations';export default class P extends _0x1fcce2{static get['requires'](){return[_0x4782be];}constructor(_0x27f9f3){super(_0x27f9f3),this[_0x4133('0x8')]=new AbortController();}[_0x4133('0x2')](){this[_0x4133('0xf')][_0x4133('0x4')][_0x4133('0x0')](_0x4782be)['textAdapter']=this;}[_0x4133('0xb')](){this[_0x4133('0x8')][_0x4133('0xc')]['aborted']||(this[_0x4133('0x8')][_0x4133('0xb')](),this['abortController']=new AbortController());}async[_0x4133('0x7')](_0x18ba91){return this[_0x4133('0xd')](_0x18ba91)[_0x4133('0xa')](_0x241e18=>{if(_0x241e18 instanceof _0x2dc255)return Promise[_0x4133('0x3')](_0x241e18);if('AbortError'==_0x241e18['name'])return Promise['resolve']();throw console[_0x4133('0x6')](_0x241e18),new _0x339178('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x108303,_0x5d5b63){const _0x2407be=this['editor'][_0x4133('0xe')],_0x4f72fc={'Content-Type':_0x4133('0x1')};if(_0x4133('0x11')==typeof _0x108303)Object[_0x4133('0x10')](_0x4f72fc,_0x108303);else{if(_0x108303)try{const _0x9786d1=await _0x108303(_0x5d5b63);Object[_0x4133('0x10')](_0x4f72fc,_0x9786d1);}catch(_0x285753){return Promise[_0x4133('0x3')](new _0x2dc255(_0x4e19ee(_0x2407be,'AI_ERROR_GET_HEADERS')));}}return _0x4f72fc;}async[_0x4133('0x9')](_0xa4f618,_0x296b85){const _0x5e7d64=this[_0x4133('0xf')][_0x4133('0xe')];if('object'==typeof _0xa4f618)return _0xa4f618;try{return await _0xa4f618(_0x296b85);}catch(_0x13c138){return Promise[_0x4133('0x3')](new _0x2dc255(_0x4e19ee(_0x5e7d64,_0x4133('0x5'))));}}}
23
+ const _0x22a4=['abortController','signal','aitextadapter-send-request-failed','editor','_prepareRequestHeaders','locale','sendRequest','abort','assign','AbortError','reject','object','aborted','error','requires','makeRequest','_prepareRequestParameters','plugins','catch','AI_ERROR_GET_PARAMETERS','name','AI_ERROR_GET_HEADERS'];(function(_0x3b6ea8,_0x22a429){const _0x244b6b=function(_0x5ae165){while(--_0x5ae165){_0x3b6ea8['push'](_0x3b6ea8['shift']());}};_0x244b6b(++_0x22a429);}(_0x22a4,0x15d));const _0x244b=function(_0x3b6ea8,_0x22a429){_0x3b6ea8=_0x3b6ea8-0x0;let _0x244b6b=_0x22a4[_0x3b6ea8];return _0x244b6b;};import{Plugin as _0x9405ff}from'ckeditor5/src/core.js';import{CKEditorError as _0x4ef85b}from'ckeditor5/src/utils.js';import{default as _0x4901ae,AIRequestError as _0x426f81}from'./aiadapter.js';import{getTranslation as _0xeb4e8e}from'../utils/common-translations.js';export default class _ extends _0x9405ff{static get[_0x244b('0x11')](){return[_0x4901ae];}constructor(_0x496874){super(_0x496874),this[_0x244b('0x3')]=new AbortController();}['init'](){this[_0x244b('0x6')][_0x244b('0x14')]['get'](_0x4901ae)['textAdapter']=this;}[_0x244b('0xa')](){this[_0x244b('0x3')][_0x244b('0x4')][_0x244b('0xf')]||(this['abortController'][_0x244b('0xa')](),this[_0x244b('0x3')]=new AbortController());}async[_0x244b('0x12')](_0x5564b9){return this[_0x244b('0x9')](_0x5564b9)[_0x244b('0x15')](_0x43de29=>{if(_0x43de29 instanceof _0x426f81)return Promise[_0x244b('0xd')](_0x43de29);if(_0x244b('0xc')==_0x43de29[_0x244b('0x1')])return Promise['resolve']();throw console[_0x244b('0x10')](_0x43de29),new _0x4ef85b(_0x244b('0x5'),null);});}async[_0x244b('0x7')](_0x333ac7,_0x5a74e5){const _0x31b2d6=this[_0x244b('0x6')][_0x244b('0x8')],_0x554bb3={'Content-Type':'application/json'};if(_0x244b('0xe')==typeof _0x333ac7)Object[_0x244b('0xb')](_0x554bb3,_0x333ac7);else{if(_0x333ac7)try{const _0x3de410=await _0x333ac7(_0x5a74e5);Object[_0x244b('0xb')](_0x554bb3,_0x3de410);}catch(_0x496cd8){return Promise[_0x244b('0xd')](new _0x426f81(_0xeb4e8e(_0x31b2d6,_0x244b('0x2'))));}}return _0x554bb3;}async[_0x244b('0x13')](_0x40de15,_0x284822){const _0x1e4d90=this[_0x244b('0x6')][_0x244b('0x8')];if('object'==typeof _0x40de15)return _0x40de15;try{return await _0x40de15(_0x284822);}catch(_0x2cb8b3){return Promise['reject'](new _0x426f81(_0xeb4e8e(_0x1e4d90,_0x244b('0x0'))));}}}
@@ -6,8 +6,8 @@
6
6
  * @module ai/adapters/awstextadapter
7
7
  * @publicApi
8
8
  */
9
- import { type Editor } from 'ckeditor5/src/core';
10
- import { default as AITextAdapter, type AITextAdapterRequestData, type RequestHeaders, type RequestParameters } from './aitextadapter';
9
+ import { type Editor } from 'ckeditor5/src/core.js';
10
+ import { default as AITextAdapter, type AITextAdapterRequestData, type RequestHeaders, type RequestParameters } from './aitextadapter.js';
11
11
  import { type BedrockRuntimeClientConfig } from '@aws-sdk/client-bedrock-runtime';
12
12
  /**
13
13
  * Adapter for AI text-related requests that supports AWS Bedrock service.
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x4e1b=['editor','send','decode','AI_ERROR_UNSUPPORTED_MODEL','anthropic.claude','</span>','application/json','ai.aws.requestParameters.top_k','ai.aws.requestParameters.anthropic_version','bedrock-2023-05-31','chunk','ai.aws.requestParameters.top_p','ai.aws.requestParameters.stream','ai.aws.requestParameters.model','_readAsyncIterableResponse','ai.aws.apiUrl','body','getReader','abortController','bytes','define','generations','getModelFamily','generation','stringify','cohere.command','<<SYS>>\x0a','_prepareRequestHeaders','meta.llama','_cleanUpData','_readStaticResponse','read','_prepareRequestParameters','\x0a<</SYS>>\x0a[INST]\x0a','ai.aws.requestParameters.temperature','text','_requestHeaders','completion','ai.aws.bedrockClientConfig','_processAWSRequest','_apiUrl','anthropic.claude-v2','test','json','completions','ai.aws.requestHeaders','sendRequest','_requestParameters','resolve','Instruction:\x0a','Human:\x0a','POST','_readStreamableResponse','ai21.j2','<span>','locale','startsWith','get','\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a','config','ai.aws.requestParameters','signal','_processProxyRequest','preparePrompt','parse','toString','Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.'];(function(_0x1ed0fa,_0x4e1b6d){const _0x1dfaca=function(_0x1ae88c){while(--_0x1ae88c){_0x1ed0fa['push'](_0x1ed0fa['shift']());}};_0x1dfaca(++_0x4e1b6d);}(_0x4e1b,0xe5));const _0x1dfa=function(_0x1ed0fa,_0x4e1b6d){_0x1ed0fa=_0x1ed0fa-0x0;let _0x1dfaca=_0x4e1b[_0x1ed0fa];return _0x1dfaca;};import{default as _0xa6a78e}from'./aitextadapter';import{AIRequestError as _0xb1d7a8}from'./aiadapter';import{BedrockRuntimeClient as _0x327b40,InvokeModelCommand as _0x2e852d,InvokeModelWithResponseStreamCommand as _0x482925}from'@aws-sdk/client-bedrock-runtime';import{getTranslation as _0x167f70}from'../utils/common-translations';export default class H extends _0xa6a78e{static get['pluginName'](){return'AWSTextAdapter';}constructor(_0x4eca3c){super(_0x4eca3c),_0x4eca3c[_0x1dfa('0x1f')][_0x1dfa('0x1d')](_0x1dfa('0x20'))||(_0x4eca3c[_0x1dfa('0x1f')][_0x1dfa('0x3b')](_0x1dfa('0x34'),_0x1dfa('0xd')),_0x4eca3c['config'][_0x1dfa('0x3b')]('ai.aws.requestParameters.max_tokens_to_sample',0x7d0),_0x4eca3c[_0x1dfa('0x1f')][_0x1dfa('0x3b')](_0x1dfa('0x6'),0x1),_0x4eca3c[_0x1dfa('0x1f')][_0x1dfa('0x3b')](_0x1dfa('0x32'),0x1),_0x4eca3c[_0x1dfa('0x1f')]['define'](_0x1dfa('0x2e'),0xfa),_0x4eca3c[_0x1dfa('0x1f')][_0x1dfa('0x3b')](_0x1dfa('0x2f'),_0x1dfa('0x30')),_0x4eca3c[_0x1dfa('0x1f')][_0x1dfa('0x3b')](_0x1dfa('0x33'),!0x0)),this[_0x1dfa('0xc')]=_0x4eca3c[_0x1dfa('0x1f')]['get'](_0x1dfa('0x36')),this['_bedrockClientConfig']=_0x4eca3c[_0x1dfa('0x1f')][_0x1dfa('0x1d')](_0x1dfa('0xa')),this['_requestHeaders']=_0x4eca3c['config'][_0x1dfa('0x1d')](_0x1dfa('0x11')),this[_0x1dfa('0x13')]=_0x4eca3c['config'][_0x1dfa('0x1d')](_0x1dfa('0x20'));}async[_0x1dfa('0x12')]({query:_0x1f53a5,context:_0x2afbeb,onData:_0xac1dd0,actionId:_0x39f1f1}){const {model:_0x119668,stream:_0x48f998,..._0x3f07dd}=await this[_0x1dfa('0x4')](this[_0x1dfa('0x13')],_0x39f1f1),_0x1d844b={'prompt':await this[_0x1dfa('0x23')](_0x1f53a5,_0x2afbeb,_0x119668,_0x39f1f1),..._0x3f07dd};this[_0x1dfa('0xc')]?await this[_0x1dfa('0x22')](_0x1d844b,_0x119668,_0x48f998,_0xac1dd0,_0x39f1f1):await this['_processAWSRequest'](_0x1d844b,_0x119668,_0x48f998,_0xac1dd0);}async[_0x1dfa('0x23')](_0x3d0c09,_0x491723,_0x45493c,_0x272210){let _0x3d99d9,_0x2203c6;return _0x491723?(_0x3d99d9=_0x1dfa('0x26'),_0x2203c6=_0x1dfa('0x15')+_0x3d0c09+_0x1dfa('0x1e')+(_0x491723[_0x1dfa('0x1c')]('<')?_0x491723:_0x1dfa('0x1a')+_0x491723+_0x1dfa('0x2c'))):(_0x3d99d9='Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x2203c6=_0x3d0c09),_0x1dfa('0x0')==this[_0x1dfa('0x3d')](_0x45493c)?_0x1dfa('0x41')+_0x3d99d9+_0x1dfa('0x5')+_0x2203c6+'\x0a[/INST]':_0x1dfa('0x16')+_0x3d99d9+'\x0a'+_0x2203c6+'\x0a\x0aAssistant:';}[_0x1dfa('0x3d')](_0x2a4a10){if(/^anthropic\.claude/[_0x1dfa('0xe')](_0x2a4a10))return'anthropic.claude';if(/^ai21\.j2/[_0x1dfa('0xe')](_0x2a4a10))return'ai21.j2';if(/^cohere\.command/[_0x1dfa('0xe')](_0x2a4a10))return _0x1dfa('0x40');if(/^meta\.llama/['test'](_0x2a4a10))return _0x1dfa('0x0');throw new _0xb1d7a8(_0x167f70(this[_0x1dfa('0x27')][_0x1dfa('0x1b')],_0x1dfa('0x2a'),_0x2a4a10));}async[_0x1dfa('0x22')](_0xd34e32,_0x772e56,_0x4f2b2f,_0x53796b,_0x38e2cd){const _0xddde35={'method':_0x1dfa('0x17'),'headers':await this[_0x1dfa('0x42')](this[_0x1dfa('0x8')],_0x38e2cd),'body':JSON[_0x1dfa('0x3f')]({..._0xd34e32,'model':_0x772e56,'stream':_0x4f2b2f}),'signal':this['abortController'][_0x1dfa('0x21')]},_0x5a006d=await fetch(this['_apiUrl'],_0xddde35);_0x4f2b2f?await this['_readStreamableResponse'](_0x5a006d,_0x772e56,_0x53796b):await this[_0x1dfa('0x2')](_0x5a006d,_0x772e56,_0x53796b);}async[_0x1dfa('0xb')](_0x304146,_0x197f33,_0x286759,_0x4327da){const _0x5cabac=new _0x327b40(this['_bedrockClientConfig']),_0x28396d={'body':JSON[_0x1dfa('0x3f')](_0x304146),'contentType':_0x1dfa('0x2d'),'accept':_0x1dfa('0x2d'),'modelId':_0x197f33};let _0x5100d6;if(_0x286759){const _0x1439fa=new _0x482925(_0x28396d);_0x5100d6=await _0x5cabac[_0x1dfa('0x28')](_0x1439fa,{'abortSignal':this[_0x1dfa('0x39')]['signal']}),await this[_0x1dfa('0x35')](_0x5100d6,_0x197f33,_0x4327da);}else{const _0x4ae316=new _0x2e852d(_0x28396d);_0x5100d6=await _0x5cabac[_0x1dfa('0x28')](_0x4ae316,{'abortSignal':this[_0x1dfa('0x39')][_0x1dfa('0x21')]}),await this[_0x1dfa('0x2')](_0x5100d6,_0x197f33,_0x4327da);}}async[_0x1dfa('0x35')](_0x1a6584,_0x313e8c,_0x1f1537){const _0x480c91=_0x1a6584['body'],_0x26016e=new TextDecoder('utf-8');let _0x5944d4='';for await(const _0x2c6027 of _0x480c91)if(_0x2c6027[_0x1dfa('0x31')]){const _0x4d3e73=_0x26016e[_0x1dfa('0x29')](_0x2c6027[_0x1dfa('0x31')][_0x1dfa('0x3a')]),_0x4392c7=JSON[_0x1dfa('0x24')](_0x4d3e73);_0x5944d4+=this[_0x1dfa('0x1')](_0x4392c7,_0x313e8c),_0x1f1537(_0x5944d4);}return Promise[_0x1dfa('0x14')]();}async[_0x1dfa('0x18')](_0x32ebf3,_0x5a5e9d,_0x453172){const _0x205484=_0x32ebf3[_0x1dfa('0x37')],_0x406bc9=new TextDecoder('utf-8');let _0xb208f6='';const _0x549cec=_0x205484[_0x1dfa('0x38')]();let _0x4de086=!0x1;for(;!_0x4de086;){const {done:_0x4a6458,value:_0x2c6961}=await _0x549cec[_0x1dfa('0x3')]();if(_0x4de086=_0x4a6458,_0x4de086)break;const _0x4e8456=_0x406bc9['decode'](_0x2c6961),_0x2a7275=JSON[_0x1dfa('0x24')](_0x4e8456);_0xb208f6+=this[_0x1dfa('0x1')](_0x2a7275,_0x5a5e9d),_0x453172(_0xb208f6);}return Promise['resolve']();}async[_0x1dfa('0x2')](_0x3114a0,_0x2e7f2a,_0xa1adbf){let _0x4bdfa4;return _0x4bdfa4=_0x3114a0 instanceof Response?await _0x3114a0[_0x1dfa('0xf')]():JSON[_0x1dfa('0x24')](Buffer['from'](_0x3114a0[_0x1dfa('0x37')])[_0x1dfa('0x25')]('utf8')),(_0xa1adbf(this[_0x1dfa('0x1')](_0x4bdfa4,_0x2e7f2a)),Promise['resolve']());}[_0x1dfa('0x1')](_0x5c7da9,_0x1e42f6){switch(this['getModelFamily'](_0x1e42f6)){case _0x1dfa('0x2b'):return _0x5c7da9[_0x1dfa('0x9')];case _0x1dfa('0x19'):return _0x5c7da9[_0x1dfa('0x10')][0x0]['data'][_0x1dfa('0x7')];case'cohere.command':return _0x5c7da9[_0x1dfa('0x3c')][0x0][_0x1dfa('0x7')];case'meta.llama':return _0x5c7da9[_0x1dfa('0x3e')];}}}
23
+ const _0x21f1=['_cleanUpData','_requestParameters','_processAWSRequest','ai.aws.requestParameters.top_p','<span>','ai.aws.requestParameters.stream','parse','Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.','preparePrompt','test','cohere.command','from','text','get','application/json','Human:\x0a','utf-8','\x0a\x0aAssistant:','meta.llama','stringify','decode','</span>','send','body','<<SYS>>\x0a','sendRequest','ai21.j2','getModelFamily','_apiUrl','_bedrockClientConfig','data','getReader','ai.aws.requestParameters.model','startsWith','define','anthropic.claude','ai.aws.requestParameters.top_k','ai.aws.requestParameters.max_tokens_to_sample','config','_prepareRequestHeaders','_readStreamableResponse','ai.aws.requestParameters.anthropic_version','_readAsyncIterableResponse','resolve','ai.aws.requestHeaders','chunk','anthropic.claude-v2','json','toString','AWSTextAdapter','ai.aws.requestParameters','read','locale','abortController','pluginName','bedrock-2023-05-31','ai.aws.bedrockClientConfig','_readStaticResponse','Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.','utf8','AI_ERROR_UNSUPPORTED_MODEL','_requestHeaders','signal'];(function(_0x27db76,_0x21f10b){const _0x251cdf=function(_0x4b06b7){while(--_0x4b06b7){_0x27db76['push'](_0x27db76['shift']());}};_0x251cdf(++_0x21f10b);}(_0x21f1,0x10b));const _0x251c=function(_0x27db76,_0x21f10b){_0x27db76=_0x27db76-0x0;let _0x251cdf=_0x21f1[_0x27db76];return _0x251cdf;};import{default as _0x25e596}from'./aitextadapter.js';import{AIRequestError as _0x1d7230}from'./aiadapter.js';import{BedrockRuntimeClient as _0x41ba53,InvokeModelCommand as _0x23662c,InvokeModelWithResponseStreamCommand as _0x20b0fd}from'@aws-sdk/client-bedrock-runtime';import{getTranslation as _0x1e17f3}from'../utils/common-translations.js';export default class O extends _0x25e596{static get[_0x251c('0x27')](){return _0x251c('0x22');}constructor(_0x4838bc){super(_0x4838bc),_0x4838bc[_0x251c('0x17')]['get'](_0x251c('0x23'))||(_0x4838bc['config'][_0x251c('0x13')](_0x251c('0x11'),_0x251c('0x1f')),_0x4838bc[_0x251c('0x17')][_0x251c('0x13')](_0x251c('0x16'),0x7d0),_0x4838bc['config'][_0x251c('0x13')]('ai.aws.requestParameters.temperature',0x1),_0x4838bc[_0x251c('0x17')][_0x251c('0x13')](_0x251c('0x33'),0x1),_0x4838bc[_0x251c('0x17')]['define'](_0x251c('0x15'),0xfa),_0x4838bc[_0x251c('0x17')][_0x251c('0x13')](_0x251c('0x1a'),_0x251c('0x28')),_0x4838bc[_0x251c('0x17')][_0x251c('0x13')](_0x251c('0x35'),!0x0)),this[_0x251c('0xd')]=_0x4838bc['config'][_0x251c('0x3d')]('ai.aws.apiUrl'),this['_bedrockClientConfig']=_0x4838bc[_0x251c('0x17')][_0x251c('0x3d')](_0x251c('0x29')),this[_0x251c('0x2e')]=_0x4838bc[_0x251c('0x17')]['get'](_0x251c('0x1d')),this[_0x251c('0x31')]=_0x4838bc[_0x251c('0x17')][_0x251c('0x3d')](_0x251c('0x23'));}async[_0x251c('0xa')]({query:_0x51ba12,context:_0x17b9d4,onData:_0x12bb2c,actionId:_0x3e5cb1}){const {model:_0x5ef4f5,stream:_0x2cfb06,..._0x27babd}=await this['_prepareRequestParameters'](this[_0x251c('0x31')],_0x3e5cb1),_0x2f0022={'prompt':await this[_0x251c('0x38')](_0x51ba12,_0x17b9d4,_0x5ef4f5,_0x3e5cb1),..._0x27babd};this[_0x251c('0xd')]?await this['_processProxyRequest'](_0x2f0022,_0x5ef4f5,_0x2cfb06,_0x12bb2c,_0x3e5cb1):await this[_0x251c('0x32')](_0x2f0022,_0x5ef4f5,_0x2cfb06,_0x12bb2c);}async[_0x251c('0x38')](_0x5b844e,_0x20b3db,_0x5022dd,_0x5e8496){let _0x166ca3,_0x260457;return _0x20b3db?(_0x166ca3=_0x251c('0x37'),_0x260457='Instruction:\x0a'+_0x5b844e+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+(_0x20b3db[_0x251c('0x12')]('<')?_0x20b3db:_0x251c('0x34')+_0x20b3db+_0x251c('0x6'))):(_0x166ca3=_0x251c('0x2b'),_0x260457=_0x5b844e),_0x251c('0x3')==this[_0x251c('0xc')](_0x5022dd)?_0x251c('0x9')+_0x166ca3+'\x0a<</SYS>>\x0a[INST]\x0a'+_0x260457+'\x0a[/INST]':_0x251c('0x0')+_0x166ca3+'\x0a'+_0x260457+_0x251c('0x2');}[_0x251c('0xc')](_0x5ce8ae){if(/^anthropic\.claude/[_0x251c('0x39')](_0x5ce8ae))return'anthropic.claude';if(/^ai21\.j2/[_0x251c('0x39')](_0x5ce8ae))return _0x251c('0xb');if(/^cohere\.command/[_0x251c('0x39')](_0x5ce8ae))return _0x251c('0x3a');if(/^meta\.llama/[_0x251c('0x39')](_0x5ce8ae))return _0x251c('0x3');throw new _0x1d7230(_0x1e17f3(this['editor'][_0x251c('0x25')],_0x251c('0x2d'),_0x5ce8ae));}async['_processProxyRequest'](_0x5299b6,_0x4d41ad,_0x50129c,_0x4aaa50,_0x310de6){const _0x64c724={'method':'POST','headers':await this[_0x251c('0x18')](this[_0x251c('0x2e')],_0x310de6),'body':JSON[_0x251c('0x4')]({..._0x5299b6,'model':_0x4d41ad,'stream':_0x50129c}),'signal':this[_0x251c('0x26')][_0x251c('0x2f')]},_0x3bef6d=await fetch(this['_apiUrl'],_0x64c724);_0x50129c?await this['_readStreamableResponse'](_0x3bef6d,_0x4d41ad,_0x4aaa50):await this['_readStaticResponse'](_0x3bef6d,_0x4d41ad,_0x4aaa50);}async[_0x251c('0x32')](_0x2180ea,_0x14efab,_0xed4052,_0x9b7de7){const _0x1db7f4=new _0x41ba53(this[_0x251c('0xe')]),_0x532786={'body':JSON[_0x251c('0x4')](_0x2180ea),'contentType':_0x251c('0x3e'),'accept':_0x251c('0x3e'),'modelId':_0x14efab};let _0x23a55a;if(_0xed4052){const _0x310071=new _0x20b0fd(_0x532786);_0x23a55a=await _0x1db7f4['send'](_0x310071,{'abortSignal':this['abortController'][_0x251c('0x2f')]}),await this[_0x251c('0x1b')](_0x23a55a,_0x14efab,_0x9b7de7);}else{const _0x249e93=new _0x23662c(_0x532786);_0x23a55a=await _0x1db7f4[_0x251c('0x7')](_0x249e93,{'abortSignal':this[_0x251c('0x26')]['signal']}),await this[_0x251c('0x2a')](_0x23a55a,_0x14efab,_0x9b7de7);}}async['_readAsyncIterableResponse'](_0x220f6c,_0x34c60b,_0x14f95d){const _0x324a37=_0x220f6c[_0x251c('0x8')],_0x2c6e47=new TextDecoder(_0x251c('0x1'));let _0x4bb341='';for await(const _0x1da8c7 of _0x324a37)if(_0x1da8c7[_0x251c('0x1e')]){const _0xe4e76a=_0x2c6e47[_0x251c('0x5')](_0x1da8c7[_0x251c('0x1e')]['bytes']),_0xbc5888=JSON[_0x251c('0x36')](_0xe4e76a);_0x4bb341+=this['_cleanUpData'](_0xbc5888,_0x34c60b),_0x14f95d(_0x4bb341);}return Promise[_0x251c('0x1c')]();}async[_0x251c('0x19')](_0x39451e,_0x5674fb,_0x379b5b){const _0x516e7f=_0x39451e['body'],_0x5ab660=new TextDecoder(_0x251c('0x1'));let _0xdf052c='';const _0x376664=_0x516e7f[_0x251c('0x10')]();let _0x4efe79=!0x1;for(;!_0x4efe79;){const {done:_0x39a20a,value:_0x4ff542}=await _0x376664[_0x251c('0x24')]();if(_0x4efe79=_0x39a20a,_0x4efe79)break;const _0x301309=_0x5ab660[_0x251c('0x5')](_0x4ff542),_0x4eff44=JSON[_0x251c('0x36')](_0x301309);_0xdf052c+=this[_0x251c('0x30')](_0x4eff44,_0x5674fb),_0x379b5b(_0xdf052c);}return Promise['resolve']();}async[_0x251c('0x2a')](_0x19187d,_0x28c283,_0x4343b0){let _0x41fe90;return _0x41fe90=_0x19187d instanceof Response?await _0x19187d[_0x251c('0x20')]():JSON[_0x251c('0x36')](Buffer[_0x251c('0x3b')](_0x19187d['body'])[_0x251c('0x21')](_0x251c('0x2c'))),(_0x4343b0(this['_cleanUpData'](_0x41fe90,_0x28c283)),Promise[_0x251c('0x1c')]());}[_0x251c('0x30')](_0x165db0,_0x5337ca){switch(this[_0x251c('0xc')](_0x5337ca)){case _0x251c('0x14'):return _0x165db0['completion'];case _0x251c('0xb'):return _0x165db0['completions'][0x0][_0x251c('0xf')][_0x251c('0x3c')];case _0x251c('0x3a'):return _0x165db0['generations'][0x0]['text'];case _0x251c('0x3'):return _0x165db0['generation'];}}}
@@ -6,8 +6,8 @@
6
6
  * @module ai/adapters/openaitextadapter
7
7
  * @publicApi
8
8
  */
9
- import { type Editor } from 'ckeditor5/src/core';
10
- import { default as AITextAdapter, type AITextAdapterRequestData, type RequestHeaders, type RequestParameters } from './aitextadapter';
9
+ import { type Editor } from 'ckeditor5/src/core.js';
10
+ import { default as AITextAdapter, type AITextAdapterRequestData, type RequestHeaders, type RequestParameters } from './aitextadapter.js';
11
11
  /**
12
12
  * Adapter for AI text-related requests that supports OpenAI and Azure OpenAI services.
13
13
  *
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x24fb=['ai.openAI.requestParameters','prepareMessages','https://api.openai.com/v1/chat/completions','data:\x20','json','abortController','get','filter','reject','Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.','OpenAITextAdapter','system','body','map','getReader','split','signal','choices','ai.openAI.requestParameters.model','ai.openAI.requestHeaders','_readStaticResponse','_cleanUpData','Moderation','ai.openAI.apiUrl','<span>','sendRequest','config','AI_ERROR_MODERATION','gpt-3.5-turbo','resolve','length','define','ai.openAI.requestParameters.top_p','_readStreamableResponse','text','join','startsWith','stream','_apiUrl','stringify','_prepareRequestHeaders','parse','delta','message','includes','decode','_isBufferIncomplete','_requestHeaders','</span>','[DONE]','_requestParameters','locale','\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a','AI_ERROR_CONTEXT_LENGTH','Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.','read','ai.openAI.requestParameters.stream','replace','context_length_exceeded','ai.openAI.requestParameters.max_tokens'];(function(_0x3d072a,_0x24fb6d){const _0x4084a2=function(_0x23868b){while(--_0x23868b){_0x3d072a['push'](_0x3d072a['shift']());}};_0x4084a2(++_0x24fb6d);}(_0x24fb,0x73));const _0x4084=function(_0x3d072a,_0x24fb6d){_0x3d072a=_0x3d072a-0x0;let _0x4084a2=_0x24fb[_0x3d072a];return _0x4084a2;};import{default as _0x431a0c}from'./aitextadapter';import{AIRequestError as _0x1b841f}from'./aiadapter';import{getTranslation as _0x2e351e}from'../utils/common-translations';export default class M extends _0x431a0c{static get['pluginName'](){return _0x4084('0xf');}constructor(_0x14a951){super(_0x14a951),_0x14a951[_0x4084('0x1f')]['define']('ai.openAI.apiUrl',_0x4084('0x7')),_0x14a951['config'][_0x4084('0x24')](_0x4084('0x17'),_0x4084('0x21')),_0x14a951[_0x4084('0x1f')][_0x4084('0x24')](_0x4084('0x4'),0x7d0),_0x14a951[_0x4084('0x1f')][_0x4084('0x24')]('ai.openAI.requestParameters.temperature',0x1),_0x14a951[_0x4084('0x1f')][_0x4084('0x24')](_0x4084('0x25'),0x1),_0x14a951[_0x4084('0x1f')][_0x4084('0x24')](_0x4084('0x1'),!0x0),this[_0x4084('0x2b')]=_0x14a951[_0x4084('0x1f')][_0x4084('0xb')](_0x4084('0x1c')),this[_0x4084('0x34')]=_0x14a951[_0x4084('0x1f')][_0x4084('0xb')](_0x4084('0x18'))||{},this[_0x4084('0x37')]=_0x14a951[_0x4084('0x1f')][_0x4084('0xb')](_0x4084('0x5'));}async[_0x4084('0x1e')]({query:_0x4e0da9,context:_0x874e87,onData:_0x4d5fe2,actionId:_0x1df23a}){const _0x31d87c=this['editor'][_0x4084('0x38')],_0x3e1804=await this[_0x4084('0x6')](_0x4e0da9,_0x874e87,_0x1df23a),_0x1b1055=await this[_0x4084('0x2d')](this[_0x4084('0x34')],_0x1df23a),_0x22ca24=await this['_prepareRequestParameters'](this[_0x4084('0x37')],_0x1df23a),_0x66f397={'messages':_0x3e1804,..._0x22ca24},_0x32c31b={'method':'POST','headers':_0x1b1055,'body':JSON[_0x4084('0x2c')](_0x66f397),'signal':this[_0x4084('0xa')][_0x4084('0x15')]},_0x22dfb7=await fetch(this['_apiUrl'],_0x32c31b);if(_0x22dfb7['ok'])return _0x22ca24[_0x4084('0x2a')]?await this[_0x4084('0x26')](_0x22dfb7,_0x4d5fe2):await this[_0x4084('0x19')](_0x22dfb7,_0x4d5fe2),Promise[_0x4084('0x22')]();{const _0x11690f=await _0x22dfb7[_0x4084('0x27')]();return _0x11690f[_0x4084('0x31')](_0x4084('0x3'))?Promise[_0x4084('0xd')](new _0x1b841f(_0x2e351e(_0x31d87c,_0x4084('0x3a')))):_0x11690f[_0x4084('0x31')](_0x4084('0x1b'))?Promise[_0x4084('0xd')](new _0x1b841f(_0x2e351e(_0x31d87c,_0x4084('0x20')))):Promise[_0x4084('0xd')](new Error(_0x11690f));}}async[_0x4084('0x6')](_0x1ec8c2,_0x3f9dfd,_0x31dd34){let _0x4bd5a4,_0x5acb15;return _0x3f9dfd?(_0x4bd5a4=_0x4084('0x3b'),_0x5acb15='Instruction:\x0a'+_0x1ec8c2+_0x4084('0x39')+(_0x3f9dfd[_0x4084('0x29')]('<')?_0x3f9dfd:_0x4084('0x1d')+_0x3f9dfd+_0x4084('0x35'))):(_0x4bd5a4=_0x4084('0xe'),_0x5acb15=_0x1ec8c2),[{'role':_0x4084('0x10'),'content':_0x4bd5a4},{'role':'user','content':_0x5acb15}];}async['_readStreamableResponse'](_0x40b551,_0x423864){const _0x4c560d=_0x40b551[_0x4084('0x11')][_0x4084('0x13')](),_0x2b6ac5=new TextDecoder();let _0x1a3c06='',_0x1141ba='',_0x2c8495='',_0xa6d680=!0x1;for(;!_0xa6d680;){const {done:_0xfe79c8,value:_0x175375}=await _0x4c560d[_0x4084('0x0')](),_0x192e8a=_0x1a3c06+_0x2b6ac5[_0x4084('0x32')](_0x175375);let _0x1b854c='';_0xa6d680=_0xfe79c8;try{_0x1b854c=this[_0x4084('0x1a')](_0x192e8a),_0x1a3c06='';}catch(_0x336252){_0x1a3c06=_0x192e8a;continue;}_0x1141ba+=_0x1b854c,!_0xa6d680&&this[_0x4084('0x33')](_0x1141ba)||_0x1141ba&&(_0x2c8495+=_0x1141ba,_0x1141ba='',_0x423864(_0x2c8495));}return Promise['resolve']();}async[_0x4084('0x19')](_0x5ccd1f,_0x5d0938){return _0x5d0938((await _0x5ccd1f[_0x4084('0x9')]())[_0x4084('0x16')][0x0][_0x4084('0x30')]['content']),Promise[_0x4084('0x22')]();}[_0x4084('0x33')](_0x53b7c3){const _0x1013de=_0x53b7c3[_0x4084('0x14')]('<')[_0x4084('0x23')]!==_0x53b7c3[_0x4084('0x14')]('>')['length'],_0x523474=_0x53b7c3['length']<0x1e;return _0x1013de&&_0x523474;}[_0x4084('0x1a')](_0x5d2c1d){return _0x5d2c1d['split'](/\n(?![^{]*\})/g)[_0x4084('0x12')](_0x5512e6=>_0x5512e6[_0x4084('0x2')](_0x4084('0x8'),''))[_0x4084('0xc')](_0x17af9b=>_0x17af9b&&_0x17af9b[_0x4084('0x23')]>0x0&&_0x4084('0x36')!==_0x17af9b)[_0x4084('0x12')](_0x17ad8f=>{const {choices:_0xf993b4}=JSON[_0x4084('0x2e')](_0x17ad8f);if(_0xf993b4[0x0]&&_0xf993b4[0x0]['delta']&&_0xf993b4[0x0]['delta']['content'])return _0xf993b4[0x0][_0x4084('0x2f')]['content'];})[_0x4084('0xc')](_0x1886e3=>_0x1886e3)[_0x4084('0x28')]('');}}
23
+ const _0x161e=['editor','get','_readStreamableResponse','Moderation','context_length_exceeded','_cleanUpData','sendRequest','getReader','abortController','ai.openAI.requestParameters.model','choices','config','join','map','resolve','delta','</span>','user','_requestHeaders','signal','system','json','POST','ai.openAI.requestParameters.max_tokens','AI_ERROR_MODERATION','Instruction:\x0a','content','stringify','length','ai.openAI.requestParameters.top_p','OpenAITextAdapter','_prepareRequestParameters','split','ai.openAI.apiUrl','_apiUrl','\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a','locale','reject','message','startsWith','_isBufferIncomplete','ai.openAI.requestParameters','read','_requestParameters','ai.openAI.requestHeaders','Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.','_prepareRequestHeaders','prepareMessages','replace','https://api.openai.com/v1/chat/completions','stream','define','body','includes'];(function(_0x5aa721,_0x161e87){const _0x4a03a1=function(_0x5883d0){while(--_0x5883d0){_0x5aa721['push'](_0x5aa721['shift']());}};_0x4a03a1(++_0x161e87);}(_0x161e,0x1e1));const _0x4a03=function(_0x5aa721,_0x161e87){_0x5aa721=_0x5aa721-0x0;let _0x4a03a1=_0x161e[_0x5aa721];return _0x4a03a1;};import{default as _0xaf488d}from'./aitextadapter.js';import{AIRequestError as _0x3eaed0}from'./aiadapter.js';import{getTranslation as _0x3edff8}from'../utils/common-translations.js';export default class M extends _0xaf488d{static get['pluginName'](){return _0x4a03('0x23');}constructor(_0x2eec96){super(_0x2eec96),_0x2eec96[_0x4a03('0x10')]['define'](_0x4a03('0x26'),_0x4a03('0x0')),_0x2eec96['config']['define'](_0x4a03('0xe'),'gpt-3.5-turbo'),_0x2eec96['config'][_0x4a03('0x2')](_0x4a03('0x1c'),0x7d0),_0x2eec96[_0x4a03('0x10')]['define']('ai.openAI.requestParameters.temperature',0x1),_0x2eec96[_0x4a03('0x10')][_0x4a03('0x2')](_0x4a03('0x22'),0x1),_0x2eec96[_0x4a03('0x10')][_0x4a03('0x2')]('ai.openAI.requestParameters.stream',!0x0),this[_0x4a03('0x27')]=_0x2eec96[_0x4a03('0x10')][_0x4a03('0x6')](_0x4a03('0x26')),this[_0x4a03('0x17')]=_0x2eec96[_0x4a03('0x10')][_0x4a03('0x6')](_0x4a03('0x31'))||{},this[_0x4a03('0x30')]=_0x2eec96['config'][_0x4a03('0x6')](_0x4a03('0x2e'));}async[_0x4a03('0xb')]({query:_0x22774a,context:_0x277dc9,onData:_0x484038,actionId:_0x4a81aa}){const _0x32da58=this[_0x4a03('0x5')][_0x4a03('0x29')],_0x1df104=await this[_0x4a03('0x34')](_0x22774a,_0x277dc9,_0x4a81aa),_0x57f309=await this[_0x4a03('0x33')](this[_0x4a03('0x17')],_0x4a81aa),_0x161d50=await this[_0x4a03('0x24')](this[_0x4a03('0x30')],_0x4a81aa),_0x38da68={'messages':_0x1df104,..._0x161d50},_0x5a12f5={'method':_0x4a03('0x1b'),'headers':_0x57f309,'body':JSON[_0x4a03('0x20')](_0x38da68),'signal':this[_0x4a03('0xd')][_0x4a03('0x18')]},_0x57fa02=await fetch(this[_0x4a03('0x27')],_0x5a12f5);if(_0x57fa02['ok'])return _0x161d50[_0x4a03('0x1')]?await this[_0x4a03('0x7')](_0x57fa02,_0x484038):await this['_readStaticResponse'](_0x57fa02,_0x484038),Promise['resolve']();{const _0x38e716=await _0x57fa02['text']();return _0x38e716[_0x4a03('0x4')](_0x4a03('0x9'))?Promise[_0x4a03('0x2a')](new _0x3eaed0(_0x3edff8(_0x32da58,'AI_ERROR_CONTEXT_LENGTH'))):_0x38e716[_0x4a03('0x4')](_0x4a03('0x8'))?Promise[_0x4a03('0x2a')](new _0x3eaed0(_0x3edff8(_0x32da58,_0x4a03('0x1d')))):Promise[_0x4a03('0x2a')](new Error(_0x38e716));}}async['prepareMessages'](_0x371471,_0x3b998f,_0x1856e7){let _0x302f80,_0x170b48;return _0x3b998f?(_0x302f80='Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x170b48=_0x4a03('0x1e')+_0x371471+_0x4a03('0x28')+(_0x3b998f[_0x4a03('0x2c')]('<')?_0x3b998f:'<span>'+_0x3b998f+_0x4a03('0x15'))):(_0x302f80=_0x4a03('0x32'),_0x170b48=_0x371471),[{'role':_0x4a03('0x19'),'content':_0x302f80},{'role':_0x4a03('0x16'),'content':_0x170b48}];}async[_0x4a03('0x7')](_0x46a0be,_0x40c529){const _0x4b401d=_0x46a0be[_0x4a03('0x3')][_0x4a03('0xc')](),_0x4af904=new TextDecoder();let _0xa657e9='',_0x119237='',_0x5837cd='',_0x40138d=!0x1;for(;!_0x40138d;){const {done:_0xe536bc,value:_0x5b36f7}=await _0x4b401d[_0x4a03('0x2f')](),_0x449119=_0xa657e9+_0x4af904['decode'](_0x5b36f7);let _0x2d073c='';_0x40138d=_0xe536bc;try{_0x2d073c=this[_0x4a03('0xa')](_0x449119),_0xa657e9='';}catch(_0x1f144b){_0xa657e9=_0x449119;continue;}_0x119237+=_0x2d073c,!_0x40138d&&this[_0x4a03('0x2d')](_0x119237)||_0x119237&&(_0x5837cd+=_0x119237,_0x119237='',_0x40c529(_0x5837cd));}return Promise['resolve']();}async['_readStaticResponse'](_0x22b9a8,_0x3df022){return _0x3df022((await _0x22b9a8[_0x4a03('0x1a')]())[_0x4a03('0xf')][0x0][_0x4a03('0x2b')]['content']),Promise[_0x4a03('0x13')]();}[_0x4a03('0x2d')](_0x13d34e){const _0xa18b1d=_0x13d34e[_0x4a03('0x25')]('<')[_0x4a03('0x21')]!==_0x13d34e['split']('>')[_0x4a03('0x21')],_0x5be4b2=_0x13d34e[_0x4a03('0x21')]<0x1e;return _0xa18b1d&&_0x5be4b2;}[_0x4a03('0xa')](_0xf4391c){return _0xf4391c['split'](/\n(?![^{]*\})/g)[_0x4a03('0x12')](_0x289f35=>_0x289f35[_0x4a03('0x35')]('data:\x20',''))['filter'](_0x4b2f9d=>_0x4b2f9d&&_0x4b2f9d[_0x4a03('0x21')]>0x0&&'[DONE]'!==_0x4b2f9d)[_0x4a03('0x12')](_0x3f1c7d=>{const {choices:_0x30bce5}=JSON['parse'](_0x3f1c7d);if(_0x30bce5[0x0]&&_0x30bce5[0x0][_0x4a03('0x14')]&&_0x30bce5[0x0][_0x4a03('0x14')]['content'])return _0x30bce5[0x0]['delta'][_0x4a03('0x1f')];})['filter'](_0x11d4d9=>_0x11d4d9)[_0x4a03('0x11')]('');}}
@@ -6,10 +6,10 @@
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';
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';
13
13
  /**
14
14
  * AI assistant plugin that allows you to use external AI models to generate content or improve existing content.
15
15
  *
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x2b96=['pluginName','get','locale','editor','improveWriting','direct','aiLicenseKeyTrialLimit:operations','aiLicenseKeyTrial','Translate\x20to\x20%0','French','Spanish','includes','Make\x20shorter','Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.','Translate\x20the\x20content\x20to\x20Portuguese\x20language.','Translate\x20the\x20content\x20to\x20German\x20language.','Translate\x20the\x20content\x20to\x20Hindi\x20language.','Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.','Generate\x20from\x20selection','Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.','concat','continue','translateArabic','generate','licenseKey','Simplified\x20Chinese','translatePortuguese','Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.','makeLonger','translateFrench','Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.','Journalism','Casual','forEach','groupId','push','Translate\x20the\x20content\x20to\x20English\x20language.','Arabic','aiLicenseKeyInvalid','Friendly','journalism','Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.','poetic','define','ai-trial-license-key-reached-limit-changes','Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.','Translate\x20the\x20content\x20to\x20French\x20language.','Translate\x20the\x20content\x20to\x20Arabic\x20language.','Confident','aiLicenseKeyValid','translateHindi','commands','Translate','professional','Change\x20style','business','Hindi','ai-invalid-license-key','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.','translateEnglish','Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.','simplifyLanguage','ai.aiAssistant.commands','editOrReview','Make\x20longer','Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.','_licenseKeyCheckInterval','ai.aiAssistant.extraCommandGroups','Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.','casual','AIAssistant','config','ai.aiAssistant.removeCommands','translateGerman','Professional','German','Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.','Translate\x20the\x20content\x20to\x20Spanish\x20language.','filter','Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.','requires'];(function(_0x5200d5,_0x2b9653){const _0x5d4c9e=function(_0x24ad00){while(--_0x24ad00){_0x5200d5['push'](_0x5200d5['shift']());}};_0x5d4c9e(++_0x2b9653);}(_0x2b96,0x1bc));const _0x5d4c=function(_0x5200d5,_0x2b9653){_0x5200d5=_0x5200d5-0x0;let _0x5d4c9e=_0x2b96[_0x5200d5];return _0x5d4c9e;};import{CKEditorError as _0x5ca576}from'ckeditor5/src/utils';import{Plugin as _0x293289}from'ckeditor5/src/core';import _0x331348 from'./aiassistantui';import _0x3e1473 from'./aiassistantediting';import{getTranslation as _0x59d5e4}from'./utils/common-translations';export default class r extends _0x293289{static get[_0x5d4c('0x29')](){return[_0x331348,_0x3e1473];}static get[_0x5d4c('0x2a')](){return _0x5d4c('0x1f');}constructor(_0x57cac6){super(_0x57cac6);const _0x164476=_0x57cac6[_0x5d4c('0x20')];_0x164476[_0x5d4c('0x4')](_0x5d4c('0x17'),getDefaultCommands(_0x57cac6[_0x5d4c('0x2c')])),_0x164476[_0x5d4c('0x4')](_0x5d4c('0x1c'),[]),_0x164476['define'](_0x5d4c('0x21'),[]);const _0x209b43=_0x164476['get'](_0x5d4c('0x17')),_0x70a83b=_0x164476[_0x5d4c('0x2b')](_0x5d4c('0x1c')),_0x2df5c2=_0x164476[_0x5d4c('0x2b')]('ai.aiAssistant.removeCommands');_0x70a83b[_0x5d4c('0x4b')](_0x2cbac2=>{const _0x59eb42=_0x209b43['find'](_0x5b2536=>_0x5b2536[_0x5d4c('0x4c')]===_0x2cbac2[_0x5d4c('0x4c')]);_0x59eb42?_0x59eb42['commands']=_0x59eb42[_0x5d4c('0xc')][_0x5d4c('0x3e')](_0x2cbac2[_0x5d4c('0xc')]):_0x209b43[_0x5d4c('0x4d')](_0x2cbac2);}),_0x209b43[_0x5d4c('0x4b')](_0x126399=>{_0x126399[_0x5d4c('0xc')]=_0x126399[_0x5d4c('0xc')][_0x5d4c('0x27')](_0x12293d=>!_0x2df5c2[_0x5d4c('0x35')](_0x12293d['id']));}),_0x164476['set']('ai.aiAssistant.commands',_0x209b43);}['init'](){const _0x440ce7=this[_0x5d4c('0x2d')];this[_0x5d4c('0x42')]=_0x440ce7[_0x5d4c('0x20')][_0x5d4c('0x2b')]('licenseKey'),this[_0x5d4c('0x1b')]=setInterval(()=>{let _0x561fd0;for(const _0x3285c0 in _0x440ce7){const _0x3aa856=_0x3285c0,_0x41d856=_0x440ce7[_0x3aa856];if(_0x5d4c('0x31')===_0x41d856||_0x5d4c('0x50')===_0x41d856||_0x5d4c('0xa')===_0x41d856||_0x5d4c('0x30')===_0x41d856){delete _0x440ce7[_0x3aa856],_0x561fd0=_0x41d856;break;}}if('aiLicenseKeyInvalid'===_0x561fd0)throw clearInterval(this['_licenseKeyCheckInterval']),new _0x5ca576(_0x5d4c('0x12'),null);if(_0x5d4c('0x31')===_0x561fd0&&console['info'](_0x5d4c('0x13')),_0x5d4c('0x30')===_0x561fd0)throw clearInterval(this['_licenseKeyCheckInterval']),new _0x5ca576(_0x5d4c('0x5'),null);_0x5d4c('0xa')===_0x561fd0&&clearInterval(this['_licenseKeyCheckInterval']);},0x3e8);}['destroy'](){this['_licenseKeyCheckInterval']&&clearInterval(this[_0x5d4c('0x1b')]);}}export function getDefaultCommands(_0xf14cd){return[{'groupId':_0x5d4c('0x18'),'groupLabel':_0x59d5e4(_0xf14cd,'Edit\x20or\x20review'),'commands':[{'id':_0x5d4c('0x2e'),'label':_0x59d5e4(_0xf14cd,'Improve\x20writing'),'prompt':_0x5d4c('0x2')},{'id':'makeShorter','label':_0x59d5e4(_0xf14cd,_0x5d4c('0x36')),'prompt':_0x5d4c('0x28')},{'id':_0x5d4c('0x46'),'label':_0x59d5e4(_0xf14cd,_0x5d4c('0x19')),'prompt':_0x5d4c('0x37')},{'id':_0x5d4c('0x16'),'label':_0x59d5e4(_0xf14cd,'Simplify\x20language'),'prompt':_0x5d4c('0x45')}]},{'groupId':_0x5d4c('0x41'),'groupLabel':_0x59d5e4(_0xf14cd,_0x5d4c('0x3c')),'commands':[{'id':'summarize','label':_0x59d5e4(_0xf14cd,'Summarize'),'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':_0x5d4c('0x3f'),'label':_0x59d5e4(_0xf14cd,'Continue'),'prompt':'Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.'}]},{'groupId':'changeTone','groupLabel':_0x59d5e4(_0xf14cd,'Change\x20tone'),'commands':[{'id':_0x5d4c('0xe'),'label':_0x59d5e4(_0xf14cd,_0x5d4c('0x23')),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':_0x5d4c('0x1e'),'label':_0x59d5e4(_0xf14cd,_0x5d4c('0x4a')),'prompt':_0x5d4c('0x6')},{'id':_0x5d4c('0x2f'),'label':_0x59d5e4(_0xf14cd,'Direct'),'prompt':_0x5d4c('0x48')},{'id':'confident','label':_0x59d5e4(_0xf14cd,_0x5d4c('0x9')),'prompt':_0x5d4c('0x25')},{'id':'friendly','label':_0x59d5e4(_0xf14cd,_0x5d4c('0x0')),'prompt':_0x5d4c('0x3d')}]},{'groupId':'changeStyle','groupLabel':_0x59d5e4(_0xf14cd,_0x5d4c('0xf')),'commands':[{'id':_0x5d4c('0x10'),'label':_0x59d5e4(_0xf14cd,'Business'),'prompt':_0x5d4c('0x1d')},{'id':'legal','label':_0x59d5e4(_0xf14cd,'Legal'),'prompt':_0x5d4c('0x3b')},{'id':_0x5d4c('0x1'),'label':_0x59d5e4(_0xf14cd,_0x5d4c('0x49')),'prompt':_0x5d4c('0x1a')},{'id':_0x5d4c('0x3'),'label':_0x59d5e4(_0xf14cd,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':_0x59d5e4(_0xf14cd,_0x5d4c('0xd')),'commands':[{'id':_0x5d4c('0x14'),'label':_0x59d5e4(_0xf14cd,_0x5d4c('0x32'),[_0x59d5e4(_0xf14cd,'English')]),'prompt':_0x5d4c('0x4e')},{'id':'translateSpanish','label':_0x59d5e4(_0xf14cd,_0x5d4c('0x32'),[_0x59d5e4(_0xf14cd,_0x5d4c('0x34'))]),'prompt':_0x5d4c('0x26')},{'id':_0x5d4c('0x44'),'label':_0x59d5e4(_0xf14cd,'Translate\x20to\x20%0',[_0x59d5e4(_0xf14cd,'Portuguese')]),'prompt':_0x5d4c('0x38')},{'id':_0x5d4c('0x22'),'label':_0x59d5e4(_0xf14cd,_0x5d4c('0x32'),[_0x59d5e4(_0xf14cd,_0x5d4c('0x24'))]),'prompt':_0x5d4c('0x39')},{'id':_0x5d4c('0x47'),'label':_0x59d5e4(_0xf14cd,_0x5d4c('0x32'),[_0x59d5e4(_0xf14cd,_0x5d4c('0x33'))]),'prompt':_0x5d4c('0x7')},{'id':'translateChinese','label':_0x59d5e4(_0xf14cd,_0x5d4c('0x32'),[_0x59d5e4(_0xf14cd,_0x5d4c('0x43'))]),'prompt':_0x5d4c('0x15')},{'id':_0x5d4c('0xb'),'label':_0x59d5e4(_0xf14cd,'Translate\x20to\x20%0',[_0x59d5e4(_0xf14cd,_0x5d4c('0x11'))]),'prompt':_0x5d4c('0x3a')},{'id':_0x5d4c('0x40'),'label':_0x59d5e4(_0xf14cd,_0x5d4c('0x32'),[_0x59d5e4(_0xf14cd,_0x5d4c('0x4f'))]),'prompt':_0x5d4c('0x8')}]}];}
23
+ const _0x1b6d=['Translate\x20to\x20%0','Journalism','Translate\x20the\x20content\x20to\x20Portuguese\x20language.','info','Direct','Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.','Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.','continue','concat','Continue','makeLonger','Legal','_licenseKeyCheckInterval','aiLicenseKeyValid','translateFrench','direct','set','Translate\x20the\x20content\x20to\x20French\x20language.','translateHindi','includes','init','Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.','Poetic','confident','Translate\x20the\x20content\x20to\x20Arabic\x20language.','Change\x20tone','Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.','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.','get','Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.','Change\x20style','English','forEach','filter','changeTone','German','Spanish','define','editOrReview','ai.aiAssistant.commands','translateChinese','Translate','destroy','changeStyle','Hindi','Confident','business','generate','Translate\x20the\x20content\x20to\x20German\x20language.','translatePortuguese','Make\x20shorter','Business','Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.','Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.','translateArabic','ai-trial-license-key-reached-limit-changes','ai.aiAssistant.removeCommands','friendly','requires','French','summarize','aiLicenseKeyTrialLimit:operations','Improve\x20writing','Arabic','journalism','translateGerman','ai.aiAssistant.extraCommandGroups','aiLicenseKeyInvalid','licenseKey','commands','simplifyLanguage','push','pluginName','Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.','Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.','makeShorter','Casual','Generate\x20from\x20selection','Simplified\x20Chinese','Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.','casual','Translate\x20the\x20content\x20to\x20Hindi\x20language.','locale','Friendly','Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.','Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.','editor','Edit\x20or\x20review','groupId','translateEnglish'];(function(_0x1bbe7d,_0x1b6d59){const _0x24f804=function(_0x58443e){while(--_0x58443e){_0x1bbe7d['push'](_0x1bbe7d['shift']());}};_0x24f804(++_0x1b6d59);}(_0x1b6d,0x6b));const _0x24f8=function(_0x1bbe7d,_0x1b6d59){_0x1bbe7d=_0x1bbe7d-0x0;let _0x24f804=_0x1b6d[_0x1bbe7d];return _0x24f804;};import{CKEditorError as _0x8a4536}from'ckeditor5/src/utils.js';import{Plugin as _0x505dda}from'ckeditor5/src/core.js';import _0x1e39bd from'./aiassistantui.js';import _0x2fd8df from'./aiassistantediting.js';import{getTranslation as _0xe8b7f4}from'./utils/common-translations.js';export default class r extends _0x505dda{static get[_0x24f8('0x29')](){return[_0x1e39bd,_0x2fd8df];}static get[_0x24f8('0x37')](){return'AIAssistant';}constructor(_0x286b9a){super(_0x286b9a);const _0x345208=_0x286b9a['config'];_0x345208[_0x24f8('0x14')](_0x24f8('0x16'),getDefaultCommands(_0x286b9a[_0x24f8('0x41')])),_0x345208[_0x24f8('0x14')](_0x24f8('0x31'),[]),_0x345208[_0x24f8('0x14')](_0x24f8('0x27'),[]);const _0x4161a8=_0x345208[_0x24f8('0xb')](_0x24f8('0x16')),_0xbd87a8=_0x345208['get'](_0x24f8('0x31')),_0x152275=_0x345208[_0x24f8('0xb')]('ai.aiAssistant.removeCommands');_0xbd87a8['forEach'](_0x58b32d=>{const _0x54b9e4=_0x4161a8['find'](_0x2bcbf4=>_0x2bcbf4['groupId']===_0x58b32d[_0x24f8('0x47')]);_0x54b9e4?_0x54b9e4[_0x24f8('0x34')]=_0x54b9e4['commands'][_0x24f8('0x51')](_0x58b32d[_0x24f8('0x34')]):_0x4161a8[_0x24f8('0x36')](_0x58b32d);}),_0x4161a8[_0x24f8('0xf')](_0x4c872d=>{_0x4c872d['commands']=_0x4c872d['commands'][_0x24f8('0x10')](_0x50f53f=>!_0x152275[_0x24f8('0x2')](_0x50f53f['id']));}),_0x345208[_0x24f8('0x59')](_0x24f8('0x16'),_0x4161a8);}[_0x24f8('0x3')](){const _0x564f0a=this[_0x24f8('0x45')];this[_0x24f8('0x33')]=_0x564f0a['config'][_0x24f8('0xb')](_0x24f8('0x33')),this[_0x24f8('0x55')]=setInterval(()=>{let _0x4933f0;for(const _0x421800 in _0x564f0a){const _0x1629f0=_0x421800,_0x163eab=_0x564f0a[_0x1629f0];if('aiLicenseKeyTrial'===_0x163eab||_0x24f8('0x32')===_0x163eab||_0x24f8('0x56')===_0x163eab||_0x24f8('0x2c')===_0x163eab){delete _0x564f0a[_0x1629f0],_0x4933f0=_0x163eab;break;}}if(_0x24f8('0x32')===_0x4933f0)throw clearInterval(this[_0x24f8('0x55')]),new _0x8a4536('ai-invalid-license-key',null);if('aiLicenseKeyTrial'===_0x4933f0&&console[_0x24f8('0x4c')](_0x24f8('0xa')),_0x24f8('0x2c')===_0x4933f0)throw clearInterval(this['_licenseKeyCheckInterval']),new _0x8a4536(_0x24f8('0x26'),null);_0x24f8('0x56')===_0x4933f0&&clearInterval(this[_0x24f8('0x55')]);},0x3e8);}[_0x24f8('0x19')](){this[_0x24f8('0x55')]&&clearInterval(this[_0x24f8('0x55')]);}}export function getDefaultCommands(_0x230b3a){return[{'groupId':_0x24f8('0x15'),'groupLabel':_0xe8b7f4(_0x230b3a,_0x24f8('0x46')),'commands':[{'id':'improveWriting','label':_0xe8b7f4(_0x230b3a,_0x24f8('0x2d')),'prompt':_0x24f8('0x23')},{'id':_0x24f8('0x3a'),'label':_0xe8b7f4(_0x230b3a,_0x24f8('0x21')),'prompt':'Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.'},{'id':_0x24f8('0x53'),'label':_0xe8b7f4(_0x230b3a,'Make\x20longer'),'prompt':_0x24f8('0x39')},{'id':_0x24f8('0x35'),'label':_0xe8b7f4(_0x230b3a,'Simplify\x20language'),'prompt':_0x24f8('0x4')}]},{'groupId':_0x24f8('0x1e'),'groupLabel':_0xe8b7f4(_0x230b3a,_0x24f8('0x3c')),'commands':[{'id':_0x24f8('0x2b'),'label':_0xe8b7f4(_0x230b3a,'Summarize'),'prompt':_0x24f8('0xc')},{'id':_0x24f8('0x50'),'label':_0xe8b7f4(_0x230b3a,_0x24f8('0x52')),'prompt':_0x24f8('0x4f')}]},{'groupId':_0x24f8('0x11'),'groupLabel':_0xe8b7f4(_0x230b3a,_0x24f8('0x8')),'commands':[{'id':'professional','label':_0xe8b7f4(_0x230b3a,'Professional'),'prompt':_0x24f8('0x9')},{'id':_0x24f8('0x3f'),'label':_0xe8b7f4(_0x230b3a,_0x24f8('0x3b')),'prompt':_0x24f8('0x24')},{'id':_0x24f8('0x58'),'label':_0xe8b7f4(_0x230b3a,_0x24f8('0x4d')),'prompt':_0x24f8('0x3e')},{'id':_0x24f8('0x6'),'label':_0xe8b7f4(_0x230b3a,_0x24f8('0x1c')),'prompt':_0x24f8('0x43')},{'id':_0x24f8('0x28'),'label':_0xe8b7f4(_0x230b3a,_0x24f8('0x42')),'prompt':_0x24f8('0x38')}]},{'groupId':_0x24f8('0x1a'),'groupLabel':_0xe8b7f4(_0x230b3a,_0x24f8('0xd')),'commands':[{'id':_0x24f8('0x1d'),'label':_0xe8b7f4(_0x230b3a,_0x24f8('0x22')),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':_0xe8b7f4(_0x230b3a,_0x24f8('0x54')),'prompt':_0x24f8('0x4e')},{'id':_0x24f8('0x2f'),'label':_0xe8b7f4(_0x230b3a,_0x24f8('0x4a')),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':_0xe8b7f4(_0x230b3a,_0x24f8('0x5')),'prompt':_0x24f8('0x44')}]},{'groupId':'translate','groupLabel':_0xe8b7f4(_0x230b3a,_0x24f8('0x18')),'commands':[{'id':_0x24f8('0x48'),'label':_0xe8b7f4(_0x230b3a,'Translate\x20to\x20%0',[_0xe8b7f4(_0x230b3a,_0x24f8('0xe'))]),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':_0xe8b7f4(_0x230b3a,_0x24f8('0x49'),[_0xe8b7f4(_0x230b3a,_0x24f8('0x13'))]),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':_0x24f8('0x20'),'label':_0xe8b7f4(_0x230b3a,_0x24f8('0x49'),[_0xe8b7f4(_0x230b3a,'Portuguese')]),'prompt':_0x24f8('0x4b')},{'id':_0x24f8('0x30'),'label':_0xe8b7f4(_0x230b3a,_0x24f8('0x49'),[_0xe8b7f4(_0x230b3a,_0x24f8('0x12'))]),'prompt':_0x24f8('0x1f')},{'id':_0x24f8('0x57'),'label':_0xe8b7f4(_0x230b3a,'Translate\x20to\x20%0',[_0xe8b7f4(_0x230b3a,_0x24f8('0x2a'))]),'prompt':_0x24f8('0x0')},{'id':_0x24f8('0x17'),'label':_0xe8b7f4(_0x230b3a,_0x24f8('0x49'),[_0xe8b7f4(_0x230b3a,_0x24f8('0x3d'))]),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':_0x24f8('0x1'),'label':_0xe8b7f4(_0x230b3a,_0x24f8('0x49'),[_0xe8b7f4(_0x230b3a,_0x24f8('0x1b'))]),'prompt':_0x24f8('0x40')},{'id':_0x24f8('0x25'),'label':_0xe8b7f4(_0x230b3a,_0x24f8('0x49'),[_0xe8b7f4(_0x230b3a,_0x24f8('0x2e'))]),'prompt':_0x24f8('0x7')}]}];}
@@ -5,8 +5,8 @@
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,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x3eea=['init','setSelection','createPositionAfter','isContent','conversion','for','ai-ui','insertContentBelow','processor','insertContent','getFirstRange','schema','toView','has','createRange','data','markers','getLastPosition','editor','change','from','markerToElement','selection','showFakeVisualSelection','isAtEnd','addMarker','ck-fake-ai-selection_collapsed','start','model','canEditAt','getSelectedBlocks','editingDowncast','ck-fake-ai-selection','updateMarker','document','markerToHighlight','toModel'];(function(_0x532186,_0x3eea01){const _0x18a56e=function(_0x19ac92){while(--_0x19ac92){_0x532186['push'](_0x532186['shift']());}};_0x18a56e(++_0x3eea01);}(_0x3eea,0x1c1));const _0x18a5=function(_0x532186,_0x3eea01){_0x532186=_0x532186-0x0;let _0x18a56e=_0x3eea[_0x532186];return _0x18a56e;};import{Plugin as _0x116554}from'ckeditor5/src/core';const s=_0x18a5('0x1');export default class i extends _0x116554{static get['pluginName'](){return'AIAssistantEditing';}[_0x18a5('0x20')](){const {editor:_0x39c824}=this;_0x39c824[_0x18a5('0x24')][_0x18a5('0x0')](_0x18a5('0x1a'))[_0x18a5('0x1e')]({'model':s,'view':{'classes':[_0x18a5('0x1b')]}}),_0x39c824[_0x18a5('0x24')][_0x18a5('0x0')](_0x18a5('0x1a'))[_0x18a5('0x10')]({'model':s,'view':{'name':'span','classes':[_0x18a5('0x1b'),_0x18a5('0x15')]}});}[_0x18a5('0x12')](){const _0x456250=this[_0x18a5('0xd')][_0x18a5('0x17')];_0x456250[_0x18a5('0xe')](_0x23925f=>{const _0xb93822=_0x456250[_0x18a5('0x1d')][_0x18a5('0x11')][_0x18a5('0x5')]();if(_0x456250['markers']['has'](s))_0x23925f[_0x18a5('0x1c')](s,{'range':_0xb93822});else{if(_0xb93822[_0x18a5('0x16')][_0x18a5('0x13')]){const _0x456d0b=_0xb93822['start']['getLastMatchingPosition'](({item:_0x409f76})=>!_0x456250[_0x18a5('0x6')][_0x18a5('0x23')](_0x409f76),{'boundaries':_0xb93822});_0x23925f['addMarker'](s,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x23925f[_0x18a5('0x9')](_0x456d0b,_0xb93822['end'])});}else _0x23925f[_0x18a5('0x14')](s,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0xb93822});}});}['hideFakeVisualSelection'](){const _0x111ad5=this[_0x18a5('0xd')][_0x18a5('0x17')];_0x111ad5[_0x18a5('0xb')][_0x18a5('0x8')](s)&&_0x111ad5[_0x18a5('0xe')](_0x4c3ca0=>{_0x4c3ca0['removeMarker'](s);});}[_0x18a5('0x4')](_0x521d35,_0x108537){const _0x48086e=_0x108537||this[_0x18a5('0xd')][_0x18a5('0x17')][_0x18a5('0x1d')][_0x18a5('0x11')];if(!this[_0x18a5('0xd')]['model'][_0x18a5('0x18')](_0x48086e))return;const _0x38cc82=this[_0x18a5('0xd')][_0x18a5('0xa')][_0x18a5('0x3')][_0x18a5('0x7')](_0x521d35),_0x39f4c0=this[_0x18a5('0xd')][_0x18a5('0xa')][_0x18a5('0x1f')](_0x38cc82);this[_0x18a5('0xd')]['model']['change'](_0x2d4caf=>{const _0x51159e=this['editor']['model'][_0x18a5('0x4')](_0x39f4c0,_0x48086e);_0x51159e&&_0x2d4caf[_0x18a5('0x21')](_0x51159e);});}[_0x18a5('0x2')](_0x3f5e04){const {model:_0x195b2e}=this['editor'],_0x32c601=Array[_0x18a5('0xf')](_0x195b2e[_0x18a5('0x1d')][_0x18a5('0x11')][_0x18a5('0x19')]()),_0x4b098c=_0x32c601['length']?_0x195b2e[_0x18a5('0x22')](_0x32c601['pop']()):_0x195b2e[_0x18a5('0x1d')]['selection'][_0x18a5('0xc')]();this['insertContent'](_0x3f5e04,_0x4b098c);}}
23
+ const _0x16fd=['has','markers','pop','insertContentBelow','markerToElement','toModel','isAtEnd','document','showFakeVisualSelection','toView','ck-fake-ai-selection','AIAssistantEditing','markerToHighlight','conversion','editor','editingDowncast','pluginName','processor','for','createPositionAfter','length','getLastMatchingPosition','data','end','hideFakeVisualSelection','addMarker','getFirstRange','model','getLastPosition','from','selection','createRange','isContent','change','insertContent','span','start','ai-ui'];(function(_0x597b5c,_0x16fdb0){const _0x37638e=function(_0xd995d1){while(--_0xd995d1){_0x597b5c['push'](_0x597b5c['shift']());}};_0x37638e(++_0x16fdb0);}(_0x16fd,0x1dc));const _0x3763=function(_0x597b5c,_0x16fdb0){_0x597b5c=_0x597b5c-0x0;let _0x37638e=_0x16fd[_0x597b5c];return _0x37638e;};import{Plugin as _0x2719e0}from'ckeditor5/src/core.js';const s=_0x3763('0x11');export default class i extends _0x2719e0{static get[_0x3763('0x22')](){return _0x3763('0x1d');}['init'](){const {editor:_0x4f3f61}=this;_0x4f3f61[_0x3763('0x1f')][_0x3763('0x24')](_0x3763('0x21'))[_0x3763('0x1e')]({'model':s,'view':{'classes':[_0x3763('0x1c')]}}),_0x4f3f61[_0x3763('0x1f')][_0x3763('0x24')]('editingDowncast')[_0x3763('0x16')]({'model':s,'view':{'name':_0x3763('0xf'),'classes':[_0x3763('0x1c'),'ck-fake-ai-selection_collapsed']}});}[_0x3763('0x1a')](){const _0x15c827=this[_0x3763('0x20')][_0x3763('0x7')];_0x15c827[_0x3763('0xd')](_0x562f9f=>{const _0x500cb2=_0x15c827[_0x3763('0x19')]['selection'][_0x3763('0x6')]();if(_0x15c827[_0x3763('0x13')]['has'](s))_0x562f9f['updateMarker'](s,{'range':_0x500cb2});else{if(_0x500cb2[_0x3763('0x10')][_0x3763('0x18')]){const _0x6c3b13=_0x500cb2[_0x3763('0x10')][_0x3763('0x1')](({item:_0x542cdd})=>!_0x15c827['schema'][_0x3763('0xc')](_0x542cdd),{'boundaries':_0x500cb2});_0x562f9f[_0x3763('0x5')](s,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x562f9f[_0x3763('0xb')](_0x6c3b13,_0x500cb2[_0x3763('0x3')])});}else _0x562f9f[_0x3763('0x5')](s,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x500cb2});}});}[_0x3763('0x4')](){const _0x3e6c0e=this['editor'][_0x3763('0x7')];_0x3e6c0e[_0x3763('0x13')][_0x3763('0x12')](s)&&_0x3e6c0e[_0x3763('0xd')](_0x1c21cc=>{_0x1c21cc['removeMarker'](s);});}[_0x3763('0xe')](_0x58d860,_0x542ff1){const _0x24c71f=_0x542ff1||this['editor'][_0x3763('0x7')][_0x3763('0x19')][_0x3763('0xa')];if(!this[_0x3763('0x20')]['model']['canEditAt'](_0x24c71f))return;const _0x3f5f21=this[_0x3763('0x20')][_0x3763('0x2')][_0x3763('0x23')][_0x3763('0x1b')](_0x58d860),_0x4de7fe=this[_0x3763('0x20')]['data'][_0x3763('0x17')](_0x3f5f21);this[_0x3763('0x20')][_0x3763('0x7')]['change'](_0x4f6008=>{const _0x396c97=this[_0x3763('0x20')][_0x3763('0x7')][_0x3763('0xe')](_0x4de7fe,_0x24c71f);_0x396c97&&_0x4f6008['setSelection'](_0x396c97);});}[_0x3763('0x15')](_0x5ec535){const {model:_0x44826b}=this[_0x3763('0x20')],_0x5bdd8b=Array[_0x3763('0x9')](_0x44826b[_0x3763('0x19')][_0x3763('0xa')]['getSelectedBlocks']()),_0x399ea8=_0x5bdd8b[_0x3763('0x0')]?_0x44826b[_0x3763('0x25')](_0x5bdd8b[_0x3763('0x14')]()):_0x44826b[_0x3763('0x19')]['selection'][_0x3763('0x8')]();this[_0x3763('0xe')](_0x5ec535,_0x399ea8);}}
@@ -6,10 +6,10 @@
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';
12
- import AIAdapter from './adapters/aiadapter';
9
+ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
10
+ import { ContextualBalloon } from 'ckeditor5/src/ui.js';
11
+ import AIAssistantEditing from './aiassistantediting.js';
12
+ import AIAdapter from './adapters/aiadapter.js';
13
13
  import '../theme/ai.css';
14
14
  import '../theme/ai-dropdown.css';
15
15
  import '../theme/ai-form.css';