@ckeditor/ckeditor5-ai 0.0.1 → 40.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE.md +7 -7
  3. package/README.md +32 -3
  4. package/build/ai.js +5 -0
  5. package/build/translations/af.js +1 -0
  6. package/build/translations/ar.js +1 -0
  7. package/build/translations/bg.js +1 -0
  8. package/build/translations/bn.js +1 -0
  9. package/build/translations/bs.js +1 -0
  10. package/build/translations/ca.js +1 -0
  11. package/build/translations/cs.js +1 -0
  12. package/build/translations/da.js +1 -0
  13. package/build/translations/de-ch.js +1 -0
  14. package/build/translations/de.js +1 -0
  15. package/build/translations/el.js +1 -0
  16. package/build/translations/en-au.js +1 -0
  17. package/build/translations/es-co.js +1 -0
  18. package/build/translations/es.js +1 -0
  19. package/build/translations/et.js +1 -0
  20. package/build/translations/fa.js +1 -0
  21. package/build/translations/fi.js +1 -0
  22. package/build/translations/fr.js +1 -0
  23. package/build/translations/gl.js +1 -0
  24. package/build/translations/he.js +1 -0
  25. package/build/translations/hi.js +1 -0
  26. package/build/translations/hr.js +1 -0
  27. package/build/translations/hu.js +1 -0
  28. package/build/translations/id.js +1 -0
  29. package/build/translations/it.js +1 -0
  30. package/build/translations/ja.js +1 -0
  31. package/build/translations/jv.js +1 -0
  32. package/build/translations/ko.js +1 -0
  33. package/build/translations/lt.js +1 -0
  34. package/build/translations/lv.js +1 -0
  35. package/build/translations/ms.js +1 -0
  36. package/build/translations/nl.js +1 -0
  37. package/build/translations/no.js +1 -0
  38. package/build/translations/pl.js +1 -0
  39. package/build/translations/pt-br.js +1 -0
  40. package/build/translations/pt.js +1 -0
  41. package/build/translations/ro.js +1 -0
  42. package/build/translations/ru.js +1 -0
  43. package/build/translations/sk.js +1 -0
  44. package/build/translations/sr-latn.js +1 -0
  45. package/build/translations/sr.js +1 -0
  46. package/build/translations/sv.js +1 -0
  47. package/build/translations/th.js +1 -0
  48. package/build/translations/tk.js +1 -0
  49. package/build/translations/tr.js +1 -0
  50. package/build/translations/ug.js +1 -0
  51. package/build/translations/uk.js +1 -0
  52. package/build/translations/ur.js +1 -0
  53. package/build/translations/vi.js +1 -0
  54. package/build/translations/zh-cn.js +1 -0
  55. package/build/translations/zh.js +1 -0
  56. package/ckeditor5-metadata.json +23 -0
  57. package/lang/contexts.json +53 -0
  58. package/lang/translations/af.po +182 -0
  59. package/lang/translations/ar.po +182 -0
  60. package/lang/translations/bg.po +182 -0
  61. package/lang/translations/bn.po +182 -0
  62. package/lang/translations/bs.po +182 -0
  63. package/lang/translations/ca.po +182 -0
  64. package/lang/translations/cs.po +182 -0
  65. package/lang/translations/da.po +182 -0
  66. package/lang/translations/de-ch.po +182 -0
  67. package/lang/translations/de.po +182 -0
  68. package/lang/translations/el.po +182 -0
  69. package/lang/translations/en-au.po +182 -0
  70. package/lang/translations/en.po +182 -0
  71. package/lang/translations/es-co.po +182 -0
  72. package/lang/translations/es.po +182 -0
  73. package/lang/translations/et.po +182 -0
  74. package/lang/translations/fa.po +182 -0
  75. package/lang/translations/fi.po +182 -0
  76. package/lang/translations/fr.po +182 -0
  77. package/lang/translations/gl.po +182 -0
  78. package/lang/translations/he.po +182 -0
  79. package/lang/translations/hi.po +182 -0
  80. package/lang/translations/hr.po +182 -0
  81. package/lang/translations/hu.po +182 -0
  82. package/lang/translations/id.po +182 -0
  83. package/lang/translations/it.po +182 -0
  84. package/lang/translations/ja.po +182 -0
  85. package/lang/translations/jv.po +182 -0
  86. package/lang/translations/ko.po +182 -0
  87. package/lang/translations/lt.po +182 -0
  88. package/lang/translations/lv.po +182 -0
  89. package/lang/translations/ms.po +182 -0
  90. package/lang/translations/nl.po +182 -0
  91. package/lang/translations/no.po +182 -0
  92. package/lang/translations/pl.po +182 -0
  93. package/lang/translations/pt-br.po +182 -0
  94. package/lang/translations/pt.po +182 -0
  95. package/lang/translations/ro.po +182 -0
  96. package/lang/translations/ru.po +182 -0
  97. package/lang/translations/sk.po +182 -0
  98. package/lang/translations/sr-latn.po +182 -0
  99. package/lang/translations/sr.po +182 -0
  100. package/lang/translations/sv.po +182 -0
  101. package/lang/translations/th.po +182 -0
  102. package/lang/translations/tk.po +182 -0
  103. package/lang/translations/tr.po +182 -0
  104. package/lang/translations/ug.po +182 -0
  105. package/lang/translations/uk.po +182 -0
  106. package/lang/translations/ur.po +182 -0
  107. package/lang/translations/vi.po +182 -0
  108. package/lang/translations/zh-cn.po +182 -0
  109. package/lang/translations/zh.po +182 -0
  110. package/package.json +38 -7
  111. package/src/aiassistant.d.ts +419 -0
  112. package/src/aiassistant.js +23 -0
  113. package/src/aiassistantediting.d.ts +45 -0
  114. package/src/aiassistantediting.js +23 -0
  115. package/src/aiassistantui.d.ts +46 -0
  116. package/src/aiassistantui.js +23 -0
  117. package/src/aiconnector.d.ts +44 -0
  118. package/src/aiconnector.js +23 -0
  119. package/src/augmentation.d.ts +26 -0
  120. package/src/augmentation.js +23 -0
  121. package/src/index.d.ts +9 -0
  122. package/src/index.js +23 -0
  123. package/src/ui/aiassistantcontroller.d.ts +59 -0
  124. package/src/ui/aiassistantcontroller.js +23 -0
  125. package/src/ui/dropdown/aicommandslistview.d.ts +22 -0
  126. package/src/ui/dropdown/aicommandslistview.js +23 -0
  127. package/src/ui/dropdown/buttonlabelwithhighlightview.d.ts +29 -0
  128. package/src/ui/dropdown/buttonlabelwithhighlightview.js +23 -0
  129. package/src/ui/form/aiformcontentarea.d.ts +48 -0
  130. package/src/ui/form/aiformcontentarea.js +23 -0
  131. package/src/ui/form/aiformerrorview.d.ts +26 -0
  132. package/src/ui/form/aiformerrorview.js +23 -0
  133. package/src/ui/form/aiformpromptview.d.ts +46 -0
  134. package/src/ui/form/aiformpromptview.js +23 -0
  135. package/src/ui/form/aiformtoolbarview.d.ts +41 -0
  136. package/src/ui/form/aiformtoolbarview.js +23 -0
  137. package/src/ui/form/aiformview.d.ts +131 -0
  138. package/src/ui/form/aiformview.js +23 -0
  139. package/src/ui/form/aihistorylistitemview.d.ts +18 -0
  140. package/src/ui/form/aihistorylistitemview.js +23 -0
  141. package/src/ui/form/aihistorylistview.d.ts +35 -0
  142. package/src/ui/form/aihistorylistview.js +23 -0
  143. package/src/ui/form/prompthistory.d.ts +20 -0
  144. package/src/ui/form/prompthistory.js +23 -0
  145. package/src/ui/showaiassistantcommand.d.ts +26 -0
  146. package/src/ui/showaiassistantcommand.js +23 -0
  147. package/src/utils/common-translations.d.ts +9 -0
  148. package/src/utils/common-translations.js +23 -0
  149. package/theme/ai-dropdown.css +37 -0
  150. package/theme/ai-form.css +203 -0
  151. package/theme/ai.css +98 -0
  152. package/theme/icons/copy.svg +1 -0
  153. package/theme/icons/error.svg +1 -0
  154. package/theme/icons/magic-wand.svg +1 -0
  155. package/theme/icons/robot-pencil.svg +1 -0
  156. package/theme/icons/submit.svg +1 -0
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ const _0x18ce=['isEnabled','scrollHeight','ck-content','isVisible','textContent','ck-ai-form__content-area-wrapper','ck-ai-form__copy-button','bind','ck-ai-form__copy-button-wrapper','element','contentFieldView','_createLoader','style','text/html','ClipboardItem','loaderView','change:isProcessing','remove','.ck-ai-form__loader','innerHTML','createElement','ck-hidden','position','_copyHTMLToClipboard','bindTemplate','scrollTo','appendLoader','removeAllRanges','_createCopyButton','execCommand','render','value','clipboard','isProcessing','setContent','addRange','appendChild','setTemplate','copyButtonView','copy','locale','text/plain','focus','div','ck-ai-form__content-area','execute','write','change:value','left','class','-9999px'];(function(_0x5d26b5,_0x18cee4){const _0x33b0ef=function(_0x3bd0c8){while(--_0x3bd0c8){_0x5d26b5['push'](_0x5d26b5['shift']());}};_0x33b0ef(++_0x18cee4);}(_0x18ce,0x1eb));const _0x33b0=function(_0x5d26b5,_0x18cee4){_0x5d26b5=_0x5d26b5-0x0;let _0x33b0ef=_0x18ce[_0x5d26b5];return _0x33b0ef;};import{global as _0x15a759}from'ckeditor5/src/utils';import{View as _0x306ae0,ButtonView as _0x42c4ee,SpinnerView as _0x157b07}from'ckeditor5/src/ui';import _0x3e37fe from'../../../theme/icons/copy.svg';import{getTranslation as _0x79ef4b}from'../../utils/common-translations';import{icons as _0x5c8901}from'ckeditor5/src/core';export default class M extends _0x306ae0{constructor(_0x437fa0,_0x2778d0=''){super(_0x437fa0),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x28d8bb=this[_0x33b0('0x2b')];this[_0x33b0('0x1d')]=new ContentFieldView(_0x437fa0,_0x2778d0),this['copyButtonView']=this[_0x33b0('0x2f')](),this[_0x33b0('0x5')]({'tag':'div','attributes':{'class':['ck',_0x33b0('0x18'),_0x28d8bb['if'](_0x33b0('0x16'),_0x33b0('0x28'),_0x265554=>!_0x265554)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck',_0x33b0('0xc'),_0x28d8bb['if'](_0x33b0('0x1'),'ck-ai-form__content-area--processing')]},'children':[this['contentFieldView'],{'tag':_0x33b0('0xb'),'attributes':{'class':['ck',_0x33b0('0x1b')]},'children':[this[_0x33b0('0x6')]]}]}]});}[_0x33b0('0x31')](){super[_0x33b0('0x31')](),this[_0x33b0('0x32')]&&this['contentFieldView'][_0x33b0('0x2')](this[_0x33b0('0x32')]),this['on'](_0x33b0('0xf'),(_0x4f9e4d,_0x548108,_0x567cad)=>{const _0x94cb=!this['contentFieldView']['element']['querySelector'](_0x33b0('0x25'));this[_0x33b0('0x1d')][_0x33b0('0x2')](_0x567cad),this[_0x33b0('0x1')]&&_0x94cb&&this[_0x33b0('0x1c')][_0x33b0('0x2c')]({'top':this[_0x33b0('0x1c')][_0x33b0('0x14')],'behavior':'smooth'});}),this['on'](_0x33b0('0x23'),(_0x8e2a45,_0x4fb235,_0x161559)=>{_0x161559?(this[_0x33b0('0x32')]=null,this[_0x33b0('0x1d')]['appendLoader']()):this['value']||this[_0x33b0('0x1d')][_0x33b0('0x2')]('');});}['focus'](){this['element'][_0x33b0('0xa')]();}[_0x33b0('0x2f')](){const _0x535476=this[_0x33b0('0x8')],_0x3070b5=new _0x42c4ee(this[_0x33b0('0x8')]),_0x2281ff=_0x33b0('0x19');return _0x3070b5['set']({'label':_0x79ef4b(_0x535476,'Copy'),'icon':_0x3e37fe,'class':_0x2281ff,'tooltip':!0x0}),_0x3070b5[_0x33b0('0x1a')](_0x33b0('0x16'))['to'](this,'value',_0x3a9d40=>!!_0x3a9d40),_0x3070b5[_0x33b0('0x1a')](_0x33b0('0x13'))['to'](this,'isProcessing',_0x3cb7ec=>!_0x3cb7ec),_0x3070b5['on'](_0x33b0('0xd'),()=>{this[_0x33b0('0x2a')](this['contentFieldView'][_0x33b0('0x1c')]),_0x3070b5['icon']=_0x5c8901['check'],_0x3070b5['class']=_0x2281ff+'\x20ck-ai-form__copy-button--copied',this[_0x33b0('0xa')](),setTimeout(()=>{_0x3070b5['icon']=_0x3e37fe,_0x3070b5[_0x33b0('0x11')]=_0x2281ff;},0x3e8);}),_0x3070b5;}[_0x33b0('0x2a')](_0x66ebd7){const {window:_0x86f361,document:_0x41117a}=_0x15a759;if(_0x86f361[_0x33b0('0x21')]){const {Blob:_0x2db330,ClipboardItem:_0x57d375}=_0x86f361,_0x34e37a=[new _0x57d375({'text/html':new _0x2db330([_0x66ebd7[_0x33b0('0x26')]],{'type':_0x33b0('0x20')}),'text/plain':new _0x2db330([_0x66ebd7[_0x33b0('0x17')]||''],{'type':_0x33b0('0x9')})})];navigator[_0x33b0('0x0')][_0x33b0('0xe')](_0x34e37a);}else{const _0x2a2048=_0x41117a[_0x33b0('0x27')](_0x33b0('0xb'));_0x2a2048[_0x33b0('0x1f')][_0x33b0('0x29')]='absolute',_0x2a2048[_0x33b0('0x1f')][_0x33b0('0x10')]=_0x33b0('0x12'),_0x2a2048[_0x33b0('0x26')]=_0x66ebd7[_0x33b0('0x26')],_0x41117a['body'][_0x33b0('0x4')](_0x2a2048);const _0x101b46=_0x41117a['createRange']();_0x101b46['selectNodeContents'](_0x2a2048);const _0x40343=_0x86f361['getSelection']();_0x40343[_0x33b0('0x2e')](),_0x40343[_0x33b0('0x3')](_0x101b46),_0x41117a[_0x33b0('0x30')](_0x33b0('0x7')),_0x2a2048[_0x33b0('0x24')]();}}}export class ContentFieldView extends _0x306ae0{constructor(_0x39cb90,_0x38eacd=''){super(_0x39cb90),this[_0x33b0('0x22')]=this[_0x33b0('0x1e')](),this[_0x33b0('0x5')]({'tag':_0x33b0('0xb'),'attributes':{'class':['ck',_0x33b0('0x15'),_0x38eacd,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x20f466){this['element'][_0x33b0('0x26')]=_0x20f466;}[_0x33b0('0x2d')](){this[_0x33b0('0x1c')][_0x33b0('0x4')](this[_0x33b0('0x22')][_0x33b0('0x1c')]);}['_createLoader'](){const _0x3bd92f=new _0x306ae0(),_0x5f5217=this[_0x33b0('0x8')],_0x51ac03=new _0x157b07();return _0x51ac03['isVisible']=!0x0,_0x3bd92f['setTemplate']({'tag':_0x33b0('0xb'),'attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x51ac03,{'text':_0x79ef4b(_0x5f5217,'AI\x20is\x20writing...')}]}),_0x3bd92f[_0x33b0('0x31')](),_0x3bd92f;}}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ai/ui/aiformerrorview
7
+ */
8
+ import type { Locale } from 'ckeditor5/src/utils';
9
+ import { View } from 'ckeditor5/src/ui';
10
+ /**
11
+ * A class representing the error view of the AI assistant.
12
+ */
13
+ export default class AIFormErrorView extends View {
14
+ /**
15
+ * The text of the error.
16
+ *
17
+ * @observable
18
+ */
19
+ text: string;
20
+ /**
21
+ * Creates an instance of the {@link module:ai/ui/aiformerrorview~AIFormErrorView} class.
22
+ *
23
+ * @param locale The localization services instance.
24
+ */
25
+ constructor(locale: Locale, text?: string);
26
+ }
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ const _0x2a0b=['set','text','content','setTemplate','bindTemplate','div','ck-ai-form__error'];(function(_0x35b5de,_0x2a0b2f){const _0x484251=function(_0x29f41d){while(--_0x29f41d){_0x35b5de['push'](_0x35b5de['shift']());}};_0x484251(++_0x2a0b2f);}(_0x2a0b,0x145));const _0x4842=function(_0x35b5de,_0x2a0b2f){_0x35b5de=_0x35b5de-0x0;let _0x484251=_0x2a0b[_0x35b5de];return _0x484251;};import{View as _0x423231,IconView as _0x192b42}from'ckeditor5/src/ui';import _0x80cd23 from'../../../theme/icons/error.svg';export default class J extends _0x423231{constructor(_0x189d5e,_0x406cce=''){super(_0x189d5e);const _0xe8707a=new _0x192b42(),_0x70c12b=this[_0x4842('0x1')];this[_0x4842('0x4')](_0x4842('0x5'),_0x406cce),_0xe8707a[_0x4842('0x6')]=_0x80cd23,this[_0x4842('0x0')]({'tag':_0x4842('0x2'),'attributes':{'class':['ck',_0x4842('0x3')]},'children':[_0xe8707a,{'text':_0x70c12b['to'](_0x4842('0x5'))}]});}}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ai/ui/aiformpromptview
7
+ */
8
+ import { type Locale } from 'ckeditor5/src/utils';
9
+ import { AutocompleteView, ButtonView, type TextareaView, type AutocompleteViewConfig } from 'ckeditor5/src/ui';
10
+ /**
11
+ * A textarea field allowing to ask AI.
12
+ */
13
+ export default class AIFormPromptView extends AutocompleteView<TextareaView> {
14
+ /**
15
+ * The submit button view.
16
+ */
17
+ submitButtonView: ButtonView;
18
+ /**
19
+ * The button that shows and hides the history autocomplete panel.
20
+ */
21
+ showHistoryButtonView: ButtonView;
22
+ /**
23
+ * Creates `AIFormPromptView` instance.
24
+ *
25
+ * @param locale The localization services instance.
26
+ * @param config Autocomplete config.
27
+ */
28
+ constructor(locale: Locale, config: AutocompleteViewConfig<TextareaView>);
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ render(): void;
33
+ /**
34
+ * @inheritDoc
35
+ */
36
+ focus(direction?: 1 | -1): void;
37
+ }
38
+ /**
39
+ * Fired when the query is submitted by the user.
40
+ *
41
+ * @eventName ~AIFormPromptView#submit
42
+ */
43
+ export type AIFormPromptViewSubmitEvent = {
44
+ name: 'submit';
45
+ args: [query: string];
46
+ };
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ const _0x4aed=['fieldView','maxRows','history','right','children','element','minRows','style','render','locale','fire','requestAnimationFrame','submit','isVisible','value','Submit','target','focusableChildren','filteredView','showHistoryButtonView','focusFirst','resultsView','focusCycler','queryView','_createShowHistoryButton','set','width','bind','update','History','execute','window','submitButtonView','ck-ai-form__submit','_createSubmitButton','fieldWrapperChildren','focusLast','focus','isEnabled','add','isOn'];(function(_0x45cf66,_0x4aed63){const _0x34c952=function(_0x4c8106){while(--_0x4c8106){_0x45cf66['push'](_0x45cf66['shift']());}};_0x34c952(++_0x4aed63);}(_0x4aed,0x189));const _0x34c9=function(_0x45cf66,_0x4aed63){_0x45cf66=_0x45cf66-0x0;let _0x34c952=_0x4aed[_0x45cf66];return _0x34c952;};import{Rect as _0x320071,global as _0x5517d8}from'ckeditor5/src/utils';import{AutocompleteView as _0x3bb9e9,ButtonView as _0x3dd51a}from'ckeditor5/src/ui';import{icons as _0x1c4845}from'ckeditor5/src/core';import{escape as _0x16dc1f}from'lodash-es';import{getTranslation as _0x66cc04}from'../../utils/common-translations';import _0x6756fd from'../../../theme/icons/submit.svg';export default class R extends _0x3bb9e9{constructor(_0x91c65b,_0x47ff06){super(_0x91c65b,_0x47ff06),this[_0x34c9('0x28')][_0x34c9('0x11')][_0x34c9('0x17')]=0x1,this[_0x34c9('0x28')][_0x34c9('0x11')][_0x34c9('0x12')]=0x3,this[_0x34c9('0x8')]=this[_0x34c9('0xa')](),this['showHistoryButtonView']=this[_0x34c9('0x0')](),this[_0x34c9('0x22')][_0x34c9('0xf')](this[_0x34c9('0x24')],0x1),this[_0x34c9('0x22')][_0x34c9('0xf')](this['submitButtonView']);}['render'](){super[_0x34c9('0x19')](),this[_0x34c9('0x28')][_0x34c9('0xb')]['add'](this[_0x34c9('0x24')]),this[_0x34c9('0x15')][_0x34c9('0xf')](this[_0x34c9('0x8')]),this['keystrokes'][_0x34c9('0x1')]('enter',(_0x2bb7ba,_0x2e4344)=>{_0x2bb7ba[_0x34c9('0x21')]==this[_0x34c9('0x28')]['fieldView']['element']&&(this[_0x34c9('0x1d')](),_0x2e4344());});}['_createSubmitButton'](){const _0x136f63=new _0x3dd51a(this[_0x34c9('0x1a')]),_0x4598cb=this['locale'];return _0x136f63[_0x34c9('0x1')]({'icon':_0x6756fd,'label':_0x66cc04(_0x4598cb,_0x34c9('0x20')),'isVisible':!0x0,'tooltip':!0x0,'class':_0x34c9('0x9')}),_0x136f63['on'](_0x34c9('0x6'),()=>{this[_0x34c9('0x1d')]();}),_0x136f63[_0x34c9('0x3')](_0x34c9('0xe'))['to'](this[_0x34c9('0x28')][_0x34c9('0x11')],'isEmpty',this,_0x34c9('0xe'),(_0x2949dd,_0x319ecf)=>!_0x2949dd&&_0x319ecf),_0x136f63;}['_createShowHistoryButton'](){const _0x40880e=new _0x3dd51a(this[_0x34c9('0x1a')]),_0x444dea=this[_0x34c9('0x26')],_0xc4bcf1=this['locale'];_0x40880e['set']({'label':_0x66cc04(_0xc4bcf1,_0x34c9('0x5')),'withText':!0x1,'icon':_0x1c4845[_0x34c9('0x13')],'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x40880e[_0x34c9('0x3')](_0x34c9('0x10'))['to'](_0x444dea,_0x34c9('0x1e')),_0x40880e[_0x34c9('0x3')](_0x34c9('0xe'))['to'](this,'isEnabled'),_0x40880e['on'](_0x34c9('0x6'),()=>{_0x444dea[_0x34c9('0x1e')]=!_0x444dea[_0x34c9('0x1e')],_0x444dea[_0x34c9('0x1e')]?this[_0x34c9('0x23')][_0x34c9('0xd')]():this[_0x34c9('0xd')]();});const _0x4c190a=()=>{_0x5517d8[_0x34c9('0x7')][_0x34c9('0x1c')](()=>{const _0x5c758b=new _0x320071(this[_0x34c9('0x28')][_0x34c9('0x11')][_0x34c9('0x16')]),_0x2c42cf=_0x5c758b[_0x34c9('0x2')];_0x5c758b['excludeScrollbarsAndBorders'](),_0x40880e[_0x34c9('0x16')][_0x34c9('0x18')][_0x34c9('0x14')]=_0x2c42cf-_0x5c758b[_0x34c9('0x2')]+0x1+'px';});};return this[_0x34c9('0x28')]['fieldView']['on'](_0x34c9('0x4'),_0x4c190a),this['on'](_0x34c9('0x19'),_0x4c190a),_0x40880e;}['submit'](){const _0x475c83=this[_0x34c9('0x28')][_0x34c9('0x11')][_0x34c9('0x16')][_0x34c9('0x1f')];this[_0x34c9('0x1b')](_0x34c9('0x1d'),_0x16dc1f(_0x475c83));}[_0x34c9('0xd')](_0x561b7b){-0x1===_0x561b7b?this[_0x34c9('0x27')][_0x34c9('0xc')]():this['focusCycler'][_0x34c9('0x25')]();}}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ai/ui/aiformtoolbarview
7
+ */
8
+ import type { Locale } from 'ckeditor5/src/utils';
9
+ import { ToolbarView, ButtonView } from 'ckeditor5/src/ui';
10
+ /**
11
+ * A class representing the text area view of the AI assistant.
12
+ */
13
+ export default class AIFormToolbarView extends ToolbarView {
14
+ /**
15
+ * Controls whether the toolbar is visible.
16
+ *
17
+ * @observable
18
+ * @default false
19
+ */
20
+ isVisible: boolean;
21
+ /**
22
+ * Button that is used to replace the selected content by the generated one.
23
+ */
24
+ replaceButton: ButtonView;
25
+ /**
26
+ * Button that is used to insert the generated content below the selection.
27
+ */
28
+ insertButton: ButtonView;
29
+ /**
30
+ * Button that is used to regenerate the response.
31
+ */
32
+ tryAgainButton: ButtonView;
33
+ /**
34
+ * Button that is used to stop the processing of the request.
35
+ */
36
+ stopButton: ButtonView;
37
+ /**
38
+ * @inheritDoc
39
+ */
40
+ constructor(locale: Locale);
41
+ }
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ const _0x5cc3=['Stop','set','locale','AI_REPLACE_CONTENT','extendTemplate','_createButton','ck-ai-form__toolbar','addMany','insertButton','ck-button-action','ck-hidden','replaceButton','bindTemplate','stopButton','tryAgainButton','Try\x20again'];(function(_0x2fd897,_0x5cc31d){const _0x4ab6b6=function(_0xb8390e){while(--_0xb8390e){_0x2fd897['push'](_0x2fd897['shift']());}};_0x4ab6b6(++_0x5cc31d);}(_0x5cc3,0x12d));const _0x4ab6=function(_0x2fd897,_0x5cc31d){_0x2fd897=_0x2fd897-0x0;let _0x4ab6b6=_0x5cc3[_0x2fd897];return _0x4ab6b6;};import{ToolbarView as _0x407443,ButtonView as _0x47cdb4}from'ckeditor5/src/ui';import{getTranslation as _0x5d9ea9}from'../../utils/common-translations';export default class X extends _0x407443{constructor(_0x54d3b6){super(_0x54d3b6),this['set']('isVisible',!0x1),this['replaceButton']=this[_0x4ab6('0x8')](_0x5d9ea9(_0x54d3b6,_0x4ab6('0x6')),_0x4ab6('0xc')),this[_0x4ab6('0xb')]=this[_0x4ab6('0x8')](_0x5d9ea9(_0x54d3b6,'Insert\x20below')),this[_0x4ab6('0x1')]=this[_0x4ab6('0x8')](_0x5d9ea9(_0x54d3b6,_0x4ab6('0x2'))),this[_0x4ab6('0x0')]=this['_createButton'](_0x5d9ea9(_0x54d3b6,_0x4ab6('0x3')));const _0x2b79ac=this[_0x4ab6('0xf')];this[_0x4ab6('0x7')]({'attributes':{'class':[_0x4ab6('0x9'),_0x2b79ac['if']('isVisible',_0x4ab6('0xd'),_0x1d339f=>!_0x1d339f)]}}),this['items'][_0x4ab6('0xa')]([this[_0x4ab6('0xe')],this[_0x4ab6('0xb')],this[_0x4ab6('0x1')],this[_0x4ab6('0x0')]]);}[_0x4ab6('0x8')](_0x1b39ab,_0x3c9fb3){const _0xfe8c85=new _0x47cdb4(this[_0x4ab6('0x5')]);return _0xfe8c85[_0x4ab6('0x4')]({'label':_0x1b39ab,'class':_0x3c9fb3||'','isVisible':!0x0,'withText':!0x0}),_0xfe8c85;}}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ai/ui/aiformview
7
+ */
8
+ import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
9
+ import { View, FormHeaderView } from 'ckeditor5/src/ui';
10
+ import AIFormToolbarView from './aiformtoolbarview';
11
+ import AIFormContentArea from './aiformcontentarea';
12
+ import AIFormErrorView from './aiformerrorview';
13
+ import AIFormPromptView from './aiformpromptview';
14
+ /**
15
+ * A class representing the form view of the AI assistant.
16
+ */
17
+ export default class AIFormView extends View {
18
+ /**
19
+ * Tracks information about the DOM focus in the form.
20
+ *
21
+ * @readonly
22
+ */
23
+ focusTracker: FocusTracker;
24
+ /**
25
+ * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
26
+ *
27
+ * @readonly
28
+ */
29
+ keystrokes: KeystrokeHandler;
30
+ /**
31
+ * The view that represent the header of the form.
32
+ */
33
+ header: FormHeaderView;
34
+ /**
35
+ * The text area view that is used to display AI response.
36
+ */
37
+ contentArea: AIFormContentArea;
38
+ /**
39
+ * Toolbar view containing button views that manage the AI response and this form itself.
40
+ */
41
+ toolbar: AIFormToolbarView;
42
+ /**
43
+ * The component used for handling the user's query, including history and submit buttons.
44
+ */
45
+ promptView: AIFormPromptView;
46
+ /**
47
+ * View that is used to display the error message.
48
+ */
49
+ errorView: AIFormErrorView;
50
+ /**
51
+ * The prompt text can be configured either during construction when the AI command has been selected,
52
+ * or later by submitting the {@link #labeledInput}, if it hasn't been previously initialized.
53
+ * After setting this value the AI request is triggered.
54
+ */
55
+ prompt: string;
56
+ /**
57
+ * The value that is generated after user submitting the user prompt.
58
+ */
59
+ value: string;
60
+ /**
61
+ * Flag that indicates if the AI assistant form view is enabled or disabled.
62
+ *
63
+ * If it is disabled, all interactive elements of this view are disabled as well.
64
+ */
65
+ isEnabled: boolean;
66
+ /**
67
+ * Indicates if the AI request is processing.
68
+ */
69
+ isProcessing: boolean;
70
+ /**
71
+ * Indicates if the AI request failed.
72
+ */
73
+ isError: boolean;
74
+ /**
75
+ * Creates an instance of the {@link module:ai/ui/aiformview~AIFormView} class.
76
+ *
77
+ * @param locale The localization services instance.
78
+ * @param prompt The text label of the prompt with which the form has been initialized.
79
+ */
80
+ constructor(locale: Locale, prompt: string, uiCssClass: string, contentAreaCssClass?: string);
81
+ /**
82
+ * @inheritDoc
83
+ */
84
+ render(): void;
85
+ focus(): void;
86
+ }
87
+ /**
88
+ * Fired when a user performed an action that should lead to replace the current selection by generated content.
89
+ *
90
+ * @eventName ~AIFormView#replaceContent
91
+ */
92
+ export type ReplaceContentEvent = {
93
+ name: 'replaceContent';
94
+ args: [value: string];
95
+ };
96
+ /**
97
+ * Fired when a user performed an action that should lead to insert generated content below the current selection.
98
+ *
99
+ * @eventName ~AIFormView#insertContentBelow
100
+ */
101
+ export type InsertContentBelowEvent = {
102
+ name: 'insertContentBelow';
103
+ args: [value: string];
104
+ };
105
+ /**
106
+ * Fired when a user performed an action that should lead to retry the previous request to AI.
107
+ *
108
+ * @eventName ~AIFormView#tryAgainEvent
109
+ */
110
+ export type TryAgainEvent = {
111
+ name: 'tryAgainEvent';
112
+ args: [];
113
+ };
114
+ /**
115
+ * Fired when a user performed an action that should lead to stop the processing of AI.
116
+ *
117
+ * @eventName ~AIFormView#stopProcessing
118
+ */
119
+ export type StopProcessingEvent = {
120
+ name: 'stopProcessing';
121
+ args: [];
122
+ };
123
+ /**
124
+ * Fired when a user performed an action that should lead to ask AI.
125
+ *
126
+ * @eventName ~AIFormView#submitPrompt
127
+ */
128
+ export type SubmitPromptEvent = {
129
+ name: 'submitPrompt';
130
+ args: [prompt: string];
131
+ };
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ const _0x66e6=['listenTo','_focusCycler','AI\x20Assistant','isError','_createToolbar','isVisible','tab','startProcessing','clear','execute','_createHistoryView','queryView','finishProcessing','forwardCycle','focus','clearHistory','render','isProcessing','AI_ERROR_FAILED','submitPrompt','items','_focusables','prompt','_promptHistory','tryAgainEvent','trim','bindTo','setTemplate','div','stopButton','ck-ai-form-content','focusFirst','_createPromptView','set','Ask\x20AI\x20to\x20improve\x20generated\x20text','Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.','element','add','insertButton','submit','promptView','locale','contentArea','shift\x20+\x20tab','tryAgainButton','toolbar','replaceButton','bindTemplate','value','copyButtonView','stop','isEnabled','errorView','handleError','bind','replaceContent','Empty\x20history','createCollection','ck-ai-form','keystrokes','stopProcessing','focusTracker','fire','text','backwardCycle','focusCycler','Ask\x20AI\x20to\x20edit\x20or\x20generate','focusPrevious'];(function(_0x4a2397,_0x66e670){const _0x2c3adb=function(_0x3d59e0){while(--_0x3d59e0){_0x4a2397['push'](_0x4a2397['shift']());}};_0x2c3adb(++_0x66e670);}(_0x66e6,0x19b));const _0x2c3a=function(_0x4a2397,_0x66e670){_0x4a2397=_0x4a2397-0x0;let _0x2c3adb=_0x66e6[_0x4a2397];return _0x2c3adb;};import{FocusTracker as _0x50263a,KeystrokeHandler as _0x36c307}from'ckeditor5/src/utils';import{View as _0x727a95,FocusCycler as _0x739176,createLabeledTextarea as _0x55129a,FormHeaderView as _0x5a1a65}from'ckeditor5/src/ui';import _0x36e6aa from'./aiformtoolbarview';import _0xbfd655 from'./aiformcontentarea';import _0x3f3334 from'./aiformerrorview';import _0x2d54b8 from'./aiformpromptview';import _0x60b8c3 from'./aihistorylistview';import _0x21a2e6 from'./aihistorylistitemview';import _0x247d7d from'./prompthistory';import{getTranslation as _0xc386e8}from'../../utils/common-translations';import _0x1ef5f4 from'../../../theme/icons/robot-pencil.svg';export default class y extends _0x727a95{constructor(_0x127562,_0x2871dc,_0x3daeef,_0x305b59=''){super(_0x127562),this[_0x2c3a('0x1e')](_0x2c3a('0x30'),!0x0),this[_0x2c3a('0x1e')](_0x2c3a('0xe'),!0x1),this[_0x2c3a('0x1e')](_0x2c3a('0x13'),_0x2871dc),this['set'](_0x2c3a('0x2d'),''),this[_0x2c3a('0x1e')](_0x2c3a('0x0'),!0x1),this[_0x2c3a('0x14')]=new _0x247d7d(),this[_0x2c3a('0x31')]=new _0x3f3334(_0x127562),this['header']=new _0x5a1a65(_0x127562,{'label':_0xc386e8(_0x127562,_0x2c3a('0x43')),'icon':_0x1ef5f4}),this[_0x2c3a('0x27')]=new _0xbfd655(_0x127562,_0x305b59),this['contentArea'][_0x2c3a('0x33')]('isProcessing')['to'](this),this[_0x2c3a('0x27')][_0x2c3a('0x33')](_0x2c3a('0x2d'))['to'](this),this['toolbar']=this['_createToolbar'](),this['promptView']=this[_0x2c3a('0x1d')](),this[_0x2c3a('0x3a')]=new _0x50263a(),this['keystrokes']=new _0x36c307(),this[_0x2c3a('0x12')]=this[_0x2c3a('0x36')]([this[_0x2c3a('0x27')],this[_0x2c3a('0x27')]['copyButtonView'],this[_0x2c3a('0x2a')],this['promptView']]),this[_0x2c3a('0x42')]=new _0x739176({'focusables':this[_0x2c3a('0x12')],'focusTracker':this['focusTracker'],'keystrokeHandler':this[_0x2c3a('0x38')],'actions':{'focusPrevious':_0x2c3a('0x28'),'focusNext':_0x2c3a('0x3')}}),this[_0x2c3a('0x25')][_0x2c3a('0x3e')]['on'](_0x2c3a('0xa'),_0x16bdb3=>{this[_0x2c3a('0x42')]['focusNext'](),_0x16bdb3[_0x2c3a('0x2f')]();}),this[_0x2c3a('0x25')]['focusCycler']['on'](_0x2c3a('0x3d'),_0x16e24b=>{this[_0x2c3a('0x42')][_0x2c3a('0x40')](),_0x16e24b[_0x2c3a('0x2f')]();});const _0x499261=this[_0x2c3a('0x2c')];this[_0x2c3a('0x18')]({'tag':_0x2c3a('0x19'),'attributes':{'class':['ck',_0x2c3a('0x37'),_0x3daeef],'tabindex':'-1'},'children':[this['header'],{'tag':'div','attributes':{'class':['ck',_0x2c3a('0x1b')]},'children':[{'tag':_0x2c3a('0x19'),'attributes':{'class':[_0x499261['if'](_0x2c3a('0x0'),'ck-hidden',_0x8f99e4=>!_0x8f99e4)]},'children':[this[_0x2c3a('0x31')]]},this[_0x2c3a('0x27')],this[_0x2c3a('0x2a')],this[_0x2c3a('0x25')]]}]});}[_0x2c3a('0xd')](){super['render'](),this[_0x2c3a('0x3a')][_0x2c3a('0x22')](this[_0x2c3a('0x27')][_0x2c3a('0x21')]),this[_0x2c3a('0x3a')]['add'](this[_0x2c3a('0x27')][_0x2c3a('0x2e')][_0x2c3a('0x21')]),this[_0x2c3a('0x3a')][_0x2c3a('0x22')](this[_0x2c3a('0x2a')][_0x2c3a('0x21')]),this[_0x2c3a('0x3a')][_0x2c3a('0x22')](this[_0x2c3a('0x25')]['element']),this['keystrokes']['listenTo'](this['element']);}[_0x2c3a('0xb')](){this[_0x2c3a('0x42')][_0x2c3a('0x1c')]();}[_0x2c3a('0x1d')](){const _0x5d990d=this[_0x2c3a('0x26')],_0xba9f39=new _0x2d54b8(_0x5d990d,{'queryView':{'label':_0xc386e8(_0x5d990d,_0x2c3a('0x3f')),'creator':_0x55129a,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':_0xc386e8(_0x5d990d,_0x2c3a('0x35')),'secondary':_0xc386e8(_0x5d990d,_0x2c3a('0x20'))}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0xba9f39['bind'](_0x2c3a('0x30'))['to'](this,'isEnabled',this,_0x2c3a('0xe'),(_0x239622,_0x5a97bb)=>_0x239622&&!_0x5a97bb),this[_0x2c3a('0x41')](_0xba9f39,_0x2c3a('0x24'),(_0x4b4ee2,_0x4ad695)=>{this[_0x2c3a('0x13')]=_0x4ad695,this[_0x2c3a('0x3b')](_0x2c3a('0x10'),this[_0x2c3a('0x13')]),_0x4ad695[_0x2c3a('0x16')]()&&this['_promptHistory'][_0x2c3a('0x22')]({'prompt':_0x4ad695['trim']()},0x0);},{'priority':'high'}),_0xba9f39;}[_0x2c3a('0x7')](){const _0x433a84=new _0x60b8c3(this[_0x2c3a('0x26')]);return _0x433a84['historyGroupView'][_0x2c3a('0x11')][_0x2c3a('0x17')](this[_0x2c3a('0x14')])['as'](_0x21a2e6),_0x433a84['on'](_0x2c3a('0xc'),()=>{this[_0x2c3a('0x14')][_0x2c3a('0x5')](),this[_0x2c3a('0x25')]['search'](''),this['promptView'][_0x2c3a('0xb')]();}),_0x433a84;}[_0x2c3a('0x1')](){const _0x13bf63=new _0x36e6aa(this[_0x2c3a('0x26')]);return _0x13bf63[_0x2c3a('0x2b')][_0x2c3a('0x33')](_0x2c3a('0x30'))['to'](this,_0x2c3a('0x30'),this,_0x2c3a('0xe'),this,_0x2c3a('0x2d'),(_0x531e90,_0x52ff92,_0x5ad3e8)=>_0x531e90&&!_0x52ff92&&!!_0x5ad3e8),_0x13bf63[_0x2c3a('0x2b')]['on'](_0x2c3a('0x6'),()=>{this[_0x2c3a('0x3b')](_0x2c3a('0x34'),this['value']);}),_0x13bf63[_0x2c3a('0x23')][_0x2c3a('0x33')](_0x2c3a('0x30'))['to'](this,_0x2c3a('0x30'),this,_0x2c3a('0xe'),this,_0x2c3a('0x2d'),(_0x1ee47e,_0x215607,_0x437184)=>_0x1ee47e&&!_0x215607&&!!_0x437184),_0x13bf63[_0x2c3a('0x23')]['on'](_0x2c3a('0x6'),()=>{this['fire']('insertContentBelow',this['value']);}),_0x13bf63[_0x2c3a('0x29')][_0x2c3a('0x33')](_0x2c3a('0x30'))['to'](this,_0x2c3a('0x30'),this,_0x2c3a('0xe'),(_0x569f0c,_0x1ec4f0)=>_0x569f0c&&!_0x1ec4f0),_0x13bf63[_0x2c3a('0x29')]['on'](_0x2c3a('0x6'),()=>{this[_0x2c3a('0x3b')](_0x2c3a('0x15'));}),_0x13bf63[_0x2c3a('0x1a')][_0x2c3a('0x33')](_0x2c3a('0x30'))['to'](this,'isProcessing'),_0x13bf63[_0x2c3a('0x1a')]['on']('execute',()=>{this[_0x2c3a('0x3b')](_0x2c3a('0x39'));}),_0x13bf63;}[_0x2c3a('0x4')](){this['value']='',this[_0x2c3a('0x0')]=!0x1,this[_0x2c3a('0xe')]=!0x0,this[_0x2c3a('0x27')][_0x2c3a('0x2')]=!0x0,this[_0x2c3a('0x2a')][_0x2c3a('0x2')]=!0x0,this[_0x2c3a('0x27')][_0x2c3a('0xb')]();}['finishProcessing'](){const _0x30e579=this['locale'];this[_0x2c3a('0xe')]=!0x1,this[_0x2c3a('0x13')]='',this['promptView']['reset'](),this[_0x2c3a('0x2d')]&&(this[_0x2c3a('0x25')][_0x2c3a('0x8')]['label']=_0xc386e8(_0x30e579,_0x2c3a('0x1f')));}[_0x2c3a('0x32')](_0x36306f){const _0x1cd1e6=this[_0x2c3a('0x26')];this[_0x2c3a('0x9')](),this[_0x2c3a('0x0')]=!0x0,this['errorView'][_0x2c3a('0x3c')]=_0x36306f||_0xc386e8(_0x1cd1e6,_0x2c3a('0xf')),this[_0x2c3a('0x2d')]||(this['contentArea'][_0x2c3a('0x2')]=!0x1);}}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ai/ui/aihistorylistitemview
7
+ */
8
+ import { ListItemView } from 'ckeditor5/src/ui';
9
+ import type { PromptHistoryEntry } from './prompthistory';
10
+ /**
11
+ * A list item view that displays a historical prompt
12
+ */
13
+ export default class AIHistoryListItemView extends ListItemView {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ constructor(promptHistoryEntry: PromptHistoryEntry);
18
+ }
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ const _0x2709=['add','execute','prompt','locale','set','children'];(function(_0x50495a,_0x270962){const _0x1982eb=function(_0x17f496){while(--_0x17f496){_0x50495a['push'](_0x50495a['shift']());}};_0x1982eb(++_0x270962);}(_0x2709,0x1b5));const _0x1982=function(_0x50495a,_0x270962){_0x50495a=_0x50495a-0x0;let _0x1982eb=_0x2709[_0x50495a];return _0x1982eb;};import{ListItemView as _0x35e25a,ButtonView as _0x8bc712}from'ckeditor5/src/ui';import _0x567cdb from'../dropdown/buttonlabelwithhighlightview';import{unescape as _0x502257}from'lodash-es';export default class et extends _0x35e25a{constructor(_0x21d01f){super();const _0x344282=new _0x567cdb(),_0x40844b=new _0x8bc712(this[_0x1982('0x4')],_0x344282);this[_0x1982('0x0')][_0x1982('0x1')](_0x40844b),_0x40844b[_0x1982('0x5')]({'label':_0x21d01f[_0x1982('0x3')],'withText':!0x0}),_0x40844b['on'](_0x1982('0x2'),()=>{this['fire'](_0x1982('0x2'),{'value':_0x502257(_0x21d01f['prompt'])});});}}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ai/ui/aihistorylistview
7
+ */
8
+ import { ListView, ListItemGroupView, ButtonView, type FilteredView } from 'ckeditor5/src/ui';
9
+ import type { Locale } from 'ckeditor5/src/utils';
10
+ /**
11
+ * A list view that displays a list of AI prompts with filter pass-through.
12
+ *
13
+ * @private
14
+ */
15
+ export default class AIHistoryListView extends ListView implements FilteredView {
16
+ historyGroupView: ListItemGroupView;
17
+ clearHistoryButton: ButtonView;
18
+ constructor(locale: Locale);
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ filter(): {
23
+ resultsCount: number;
24
+ totalItemsCount: number;
25
+ };
26
+ }
27
+ /**
28
+ * Fired when the clear history button was executed by the user.
29
+ *
30
+ * @eventName ~AIHistoryListView#clearHistory
31
+ */
32
+ export type AIHistoryListViewClearHistoryEvent = {
33
+ name: 'clearHistory';
34
+ args: [];
35
+ };
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ const _0x1f85=['filter','locale','label','items','delegate','children','execute','fire','Clear','set','_createClearHistoryButton','historyGroupView','clearHistoryButton','Prompt\x20history','add','length','clearHistory'];(function(_0x15144d,_0x1f8511){const _0x4dcf81=function(_0x1effcf){while(--_0x1effcf){_0x15144d['push'](_0x15144d['shift']());}};_0x4dcf81(++_0x1f8511);}(_0x1f85,0xbc));const _0x4dcf=function(_0x15144d,_0x1f8511){_0x15144d=_0x15144d-0x0;let _0x4dcf81=_0x1f85[_0x15144d];return _0x4dcf81;};import{ListView as _0x3279da,ListItemGroupView as _0x6dc875,ButtonView as _0x58d7b3}from'ckeditor5/src/ui';import{getTranslation as _0x57f81d}from'../../utils/common-translations';export default class st extends _0x3279da{constructor(_0x4a65e3){super(_0x4a65e3),this[_0x4dcf('0xb')]=this[_0x4dcf('0x9')](),this[_0x4dcf('0xa')]=new _0x6dc875(),this[_0x4dcf('0xa')][_0x4dcf('0x4')][_0x4dcf('0xd')](this[_0x4dcf('0xb')],0x1),this[_0x4dcf('0xa')][_0x4dcf('0x1')]=_0x57f81d(_0x4a65e3,_0x4dcf('0xc')),this[_0x4dcf('0xa')]['items'][_0x4dcf('0x3')](_0x4dcf('0x5'))['to'](this),this[_0x4dcf('0x2')]['add'](this[_0x4dcf('0xa')]);}[_0x4dcf('0x10')](){let _0x305117=0x0;for(const _0x24cd1e of this[_0x4dcf('0x2')])_0x305117+=_0x24cd1e[_0x4dcf('0x2')][_0x4dcf('0xe')];return{'resultsCount':_0x305117,'totalItemsCount':_0x305117};}['_createClearHistoryButton'](){const _0x1aaf52=this[_0x4dcf('0x0')],_0x379f8c=new _0x58d7b3(this[_0x4dcf('0x0')]);return _0x379f8c[_0x4dcf('0x8')]({'label':'('+_0x57f81d(_0x1aaf52,_0x4dcf('0x7'))+')','withText':!0x0}),_0x379f8c['on'](_0x4dcf('0x5'),()=>this[_0x4dcf('0x6')](_0x4dcf('0xf'))),_0x379f8c;}}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ import { Collection } from 'ckeditor5/src/utils';
6
+ /**
7
+ * A collection that stores the prompt history in the session storage as a side effect.
8
+ */
9
+ export default class PromptHistory extends Collection<PromptHistoryEntry> {
10
+ /**
11
+ * @inheritDoc
12
+ */
13
+ constructor();
14
+ }
15
+ /**
16
+ * An object that represents a historical prompt.
17
+ */
18
+ export type PromptHistoryEntry = {
19
+ prompt: string;
20
+ };
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ const _0x20eb=['CKEditor/AIFormView/PromptHistory','trim','prompt','getItem','setItem','parse','remove','last','addMany','_saveToSessionStorage','map','add','_loadFromSessionStorage'];(function(_0x515ea8,_0x20eb5c){const _0x575c3d=function(_0x324e74){while(--_0x324e74){_0x515ea8['push'](_0x515ea8['shift']());}};_0x575c3d(++_0x20eb5c);}(_0x20eb,0x1ba));const _0x575c=function(_0x515ea8,_0x20eb5c){_0x515ea8=_0x515ea8-0x0;let _0x575c3d=_0x20eb[_0x515ea8];return _0x575c3d;};import{Collection as _0x4e31d3}from'ckeditor5/src/utils';const ts=_0x575c('0x0');export default class rt extends _0x4e31d3{constructor(){super(),this[_0x575c('0xc')](),this['on'](_0x575c('0xb'),(_0x35ac10,_0x44a3ff)=>{const _0x839757=os(_0x44a3ff[_0x575c('0x2')]);for(const _0x216331 of this)if(_0x216331!=_0x44a3ff&&os(_0x216331[_0x575c('0x2')])===_0x839757){this['remove'](_0x216331);break;}this['length']>0x14&&this[_0x575c('0x6')](this[_0x575c('0x7')]),this[_0x575c('0x9')]();}),this['on']('remove',()=>{this[_0x575c('0x9')]();});}[_0x575c('0xc')](){const _0x4d4bcf=sessionStorage[_0x575c('0x3')](ts)||'[]';this[_0x575c('0x8')](JSON[_0x575c('0x5')](_0x4d4bcf));}['_saveToSessionStorage'](){sessionStorage[_0x575c('0x4')](ts,JSON['stringify'](this[_0x575c('0xa')](_0x5eb5c9=>_0x5eb5c9)));}}function os(_0x322da0){return _0x322da0['toLowerCase']()[_0x575c('0x1')]();}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ai/ui/showaiassistantcommand
7
+ * @publicApi
8
+ */
9
+ import { Command } from 'ckeditor5/src/core';
10
+ /**
11
+ * Command that shows the AI Assistant user interface.
12
+ */
13
+ export default class ShowAIAssistantCommand extends Command {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ refresh(): void;
18
+ /**
19
+ * Opens AI Assistant user interface for the current document selection.
20
+ *
21
+ * @param prompt The initial prompt. If set, the AI assistant will automatically submit given prompt to the AI service.
22
+ * @param label Label to be displayed in the AI assistant query input field while the AI assistant processes the initial prompt.
23
+ * @fires execute
24
+ */
25
+ execute(prompt?: string, label?: string): void;
26
+ }
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ const _0x5be9=['selection','execute','isEnabled','getRanges','plugins','editor','get','getItems','name','model','includes','showUI','element','refresh'];(function(_0x3b8c6f,_0x5be972){const _0x4ae474=function(_0x1c8ab8){while(--_0x1c8ab8){_0x3b8c6f['push'](_0x3b8c6f['shift']());}};_0x4ae474(++_0x5be972);}(_0x5be9,0x15e));const _0x4ae4=function(_0x3b8c6f,_0x5be972){_0x3b8c6f=_0x3b8c6f-0x0;let _0x4ae474=_0x5be9[_0x3b8c6f];return _0x4ae474;};import{Command as _0x5696cd}from'ckeditor5/src/core';import _0x4baeb8 from'../aiassistantui';export default class A extends _0x5696cd{[_0x4ae4('0xd')](){const _0x3f2962=this['editor'][_0x4ae4('0x9')]['document'][_0x4ae4('0x0')],_0x19b897=this['editor']['config'][_0x4ae4('0x6')]('aiAssistant.disabledElements');for(const _0x1a2185 of _0x3f2962[_0x4ae4('0x3')]())for(const _0x409131 of _0x1a2185[_0x4ae4('0x7')]())if(_0x409131['is'](_0x4ae4('0xc'))&&_0x19b897[_0x4ae4('0xa')](_0x409131[_0x4ae4('0x8')]))return void(this[_0x4ae4('0x2')]=!0x1);this[_0x4ae4('0x2')]=!0x0;}[_0x4ae4('0x1')](_0x219880='',_0x2e174e=''){this[_0x4ae4('0x5')][_0x4ae4('0x4')][_0x4ae4('0x6')](_0x4baeb8)[_0x4ae4('0xb')](_0x219880,_0x2e174e,this['editor'][_0x4ae4('0x9')]['document']['selection']);}}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ai/utils/common-translations
7
+ */
8
+ import type { Locale } from 'ckeditor5/src/utils';
9
+ export declare function getTranslation(locale: Locale, id: string, values?: string | Array<string> | number): string;