@ckeditor/ckeditor5-ai
Version:
AI Assistant feature for CKEditor 5.
23 lines • 10.7 kB
JavaScript
/*
* Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
*
*
*
*
* +---------------------------------------------------------------------------------+
* | |
* | Hello stranger! |
* | |
* | |
* | What you're currently looking at is the source code of a legally protected, |
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
* | are forbidden and will result in legal consequences. |
* | |
* | |
* +---------------------------------------------------------------------------------+
*
*
*
*
*/
const _0x1b95a8=_0x5325;(function(_0x231996,_0x3286fd){const _0x72a5f4=_0x5325,_0x45ea4a=_0x231996();while(!![]){try{const _0x494545=parseInt(_0x72a5f4(0x16b))/0x1*(-parseInt(_0x72a5f4(0x1b2))/0x2)+-parseInt(_0x72a5f4(0x184))/0x3*(parseInt(_0x72a5f4(0x18e))/0x4)+parseInt(_0x72a5f4(0x1b0))/0x5*(-parseInt(_0x72a5f4(0x185))/0x6)+parseInt(_0x72a5f4(0x166))/0x7*(parseInt(_0x72a5f4(0x1b4))/0x8)+-parseInt(_0x72a5f4(0x16e))/0x9*(parseInt(_0x72a5f4(0x191))/0xa)+parseInt(_0x72a5f4(0x17c))/0xb+parseInt(_0x72a5f4(0x1ab))/0xc;if(_0x494545===_0x3286fd)break;else _0x45ea4a['push'](_0x45ea4a['shift']());}catch(_0x5a68a1){_0x45ea4a['push'](_0x45ea4a['shift']());}}}(_0x4de0,0xecb27));import{FocusTracker as _0x10cfd3,KeystrokeHandler as _0x14313d}from'ckeditor5/src/utils.js';import{View as _0x4e2582,FocusCycler as _0x3a060c,createLabeledTextarea as _0x20dcdc}from'ckeditor5/src/ui.js';import _0x24931b,{AIFormToolbarViewMainActionLabel as _0x4a8fbf}from'./aiformtoolbarview.js';import _0x45fede from'./aiformcontentarea.js';import _0x3e6c58 from'./aiformerrorview.js';import _0x677fb9 from'./aiformpromptview.js';import _0x1049c4 from'./aihistorylistview.js';import _0x147b91 from'./aihistorylistitemview.js';function _0x4de0(){const _0x508489=['REPLACE','ck-hidden','copyButtonView','locale','trim','high','isVisible','bindTemplate','replaceContent','insertButton','bindTo','clear','startProcessing','focusCycler','18158760iNziRm','submit','delegate','Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.','shift\x20+\x20tab','29935VbnwXV','bind','2xhMktE','focusLast','14069032UdtEob','isEnabled','insertContentBelow','execute','text','focusTracker','_createToolbar','finishProcessing','listenTo','7xXrAdn','Ask\x20AI\x20to\x20improve\x20generated\x20text','render','isProcessing','stopProcessing','491966RPCcNT','_promptHistory','reset','171yrOKIn','isError','replaceButton','value','_createPromptView','chain','tryAgainEvent','search','_focusables','set','focus','Ask\x20AI\x20to\x20edit\x20or\x20generate','label','submitPrompt','7829998NFkDlg','tryAgainButton','handleError','stopButton','focusFirst','toolbar','fieldView','ck-ai-form-content','375PSqNKO','1062jKgiqH','errorView','prompt','div','items','createCollection','ck-ai-form','historyGroupView','AI_ERROR_FAILED','41128WzszPL','fire','element','93290mYwxPO','contentArea','add','queryView','setTemplate','tab','Empty\x20history','clearHistory','mainAction','keystrokes','_createHistoryView','promptView'];_0x4de0=function(){return _0x508489;};return _0x4de0();}import _0x24d438 from'./prompthistory.js';function _0x5325(_0x300bec,_0x3f3dff){const _0x4de08c=_0x4de0();return _0x5325=function(_0x53251d,_0x25a89e){_0x53251d=_0x53251d-0x166;let _0x45b90e=_0x4de08c[_0x53251d];return _0x45b90e;},_0x5325(_0x300bec,_0x3f3dff);}import{getTranslation as _0xc5f985}from'../../utils/common-translations.js';import{escape as _0x5cf036}from'es-toolkit/compat';export default class _ extends _0x4e2582{[_0x1b95a8(0x1b9)];[_0x1b95a8(0x19a)];[_0x1b95a8(0x192)];[_0x1b95a8(0x181)];[_0x1b95a8(0x19c)];[_0x1b95a8(0x186)];[_0x1b95a8(0x176)];[_0x1b95a8(0x1aa)];[_0x1b95a8(0x16c)];constructor(_0x1a2cb0,_0x5da6fe,_0x5303cd=''){const _0x311740=_0x1b95a8;super(_0x1a2cb0),this[_0x311740(0x177)](_0x311740(0x1b5),!0x0),this[_0x311740(0x177)](_0x311740(0x169),!0x1),this[_0x311740(0x177)](_0x311740(0x187),''),this[_0x311740(0x177)](_0x311740(0x171),''),this[_0x311740(0x177)](_0x311740(0x16f),!0x1),this[_0x311740(0x177)](_0x311740(0x199),_0x4a8fbf[_0x311740(0x19d)]),this[_0x311740(0x16c)]=new _0x24d438(),this[_0x311740(0x186)]=new _0x3e6c58(_0x1a2cb0),this[_0x311740(0x192)]=new _0x45fede(_0x1a2cb0,_0x5303cd),this[_0x311740(0x192)][_0x311740(0x1b1)](_0x311740(0x169))['to'](this),this[_0x311740(0x192)][_0x311740(0x1b1)](_0x311740(0x171))['to'](this),this[_0x311740(0x181)]=this[_0x311740(0x1ba)](),this[_0x311740(0x181)][_0x311740(0x1b1)](_0x311740(0x199))['to'](this),this[_0x311740(0x19c)]=this[_0x311740(0x172)](),this[_0x311740(0x1b9)]=new _0x10cfd3(),this[_0x311740(0x19a)]=new _0x14313d(),this[_0x311740(0x176)]=this[_0x311740(0x18a)]([this[_0x311740(0x192)],this[_0x311740(0x192)][_0x311740(0x19f)],this[_0x311740(0x181)],this[_0x311740(0x19c)]]),this[_0x311740(0x1aa)]=new _0x3a060c({'focusables':this[_0x311740(0x176)],'focusTracker':this[_0x311740(0x1b9)],'keystrokeHandler':this[_0x311740(0x19a)],'actions':{'focusPrevious':_0x311740(0x1af),'focusNext':_0x311740(0x196)}}),this[_0x311740(0x1aa)][_0x311740(0x173)](this[_0x311740(0x19c)][_0x311740(0x1aa)]),this[_0x311740(0x19c)][_0x311740(0x194)][_0x311740(0x182)][_0x311740(0x1b1)](_0x311740(0x171))['to'](this,_0x311740(0x187));const _0x2aab1e=this[_0x311740(0x1a4)];this[_0x311740(0x195)]({'tag':_0x311740(0x188),'attributes':{'class':['ck',_0x311740(0x18b),_0x5da6fe],'tabindex':'-1'},'children':[{'tag':_0x311740(0x188),'attributes':{'class':['ck',_0x311740(0x183)]},'children':[{'tag':_0x311740(0x188),'attributes':{'class':[_0x2aab1e['if'](_0x311740(0x16f),_0x311740(0x19e),_0x53e3dc=>!_0x53e3dc)]},'children':[this[_0x311740(0x186)]]},this[_0x311740(0x192)],this[_0x311740(0x181)],this[_0x311740(0x19c)]]}]});}[_0x1b95a8(0x168)](){const _0x1077f6=_0x1b95a8;super[_0x1077f6(0x168)](),this[_0x1077f6(0x1b9)][_0x1077f6(0x193)](this[_0x1077f6(0x192)][_0x1077f6(0x190)]),this[_0x1077f6(0x1b9)][_0x1077f6(0x193)](this[_0x1077f6(0x192)][_0x1077f6(0x19f)][_0x1077f6(0x190)]),this[_0x1077f6(0x1b9)][_0x1077f6(0x193)](this[_0x1077f6(0x181)][_0x1077f6(0x190)]),this[_0x1077f6(0x1b9)][_0x1077f6(0x193)](this[_0x1077f6(0x19c)][_0x1077f6(0x190)]),this[_0x1077f6(0x19a)][_0x1077f6(0x1bc)](this[_0x1077f6(0x190)]);}[_0x1b95a8(0x178)](_0x150751=0x1){const _0x195496=_0x1b95a8;-0x1===_0x150751?this[_0x195496(0x1aa)][_0x195496(0x1b3)]():this[_0x195496(0x1aa)][_0x195496(0x180)]();}[_0x1b95a8(0x16d)](){const _0x2d26d2=_0x1b95a8;this[_0x2d26d2(0x187)]='',this[_0x2d26d2(0x171)]='',this[_0x2d26d2(0x16f)]=!0x1,this[_0x2d26d2(0x19c)][_0x2d26d2(0x16d)](),this[_0x2d26d2(0x192)][_0x2d26d2(0x1a3)]=!0x1,this[_0x2d26d2(0x181)][_0x2d26d2(0x1a3)]=!0x1;}[_0x1b95a8(0x172)](){const _0x620785=_0x1b95a8,_0x3fc0dd=this[_0x620785(0x1a0)],_0x12abe6=new _0x677fb9(_0x3fc0dd,{'queryView':{'label':_0xc5f985(_0x3fc0dd,_0x620785(0x179)),'creator':_0x20dcdc,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':_0xc5f985(_0x3fc0dd,_0x620785(0x197)),'secondary':_0xc5f985(_0x3fc0dd,_0x620785(0x1ae))}}},'filteredView':this[_0x620785(0x19b)](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x12abe6[_0x620785(0x1b1)](_0x620785(0x1b5))['to'](this,_0x620785(0x1b5),this,_0x620785(0x169),(_0x498a58,_0x972f00)=>_0x498a58&&!_0x972f00),this[_0x620785(0x1bc)](_0x12abe6,_0x620785(0x1ac),(_0x4b3be4,_0x15593d)=>{const _0x453e4f=_0x620785;this[_0x453e4f(0x187)]=_0x15593d;const _0x433bad=_0x5cf036(_0x15593d);this[_0x453e4f(0x18f)](_0x453e4f(0x17b),_0x433bad),_0x15593d[_0x453e4f(0x1a1)]()&&this[_0x453e4f(0x16c)][_0x453e4f(0x193)]({'prompt':_0x433bad},0x0);},{'priority':_0x620785(0x1a2)}),_0x12abe6;}[_0x1b95a8(0x19b)](){const _0x18fa7b=_0x1b95a8,_0x5aadbc=new _0x1049c4(this[_0x18fa7b(0x1a0)]);return _0x5aadbc[_0x18fa7b(0x18c)][_0x18fa7b(0x189)][_0x18fa7b(0x1a7)](this[_0x18fa7b(0x16c)])['as'](_0x147b91),_0x5aadbc['on'](_0x18fa7b(0x198),()=>{const _0x3535a7=_0x18fa7b;this[_0x3535a7(0x16c)][_0x3535a7(0x1a8)](),this[_0x3535a7(0x19c)][_0x3535a7(0x175)](''),this[_0x3535a7(0x19c)][_0x3535a7(0x178)]();}),_0x5aadbc;}[_0x1b95a8(0x1ba)](){const _0x63a3d8=_0x1b95a8,_0x2eafbd=new _0x24931b(this[_0x63a3d8(0x1a0)]);return _0x2eafbd[_0x63a3d8(0x170)][_0x63a3d8(0x1b1)](_0x63a3d8(0x1b5))['to'](this,_0x63a3d8(0x1b5),this,_0x63a3d8(0x169),this,_0x63a3d8(0x171),(_0x1bdeb0,_0x3e8c71,_0x1519af)=>_0x1bdeb0&&!_0x3e8c71&&!!_0x1519af),_0x2eafbd[_0x63a3d8(0x170)][_0x63a3d8(0x1ad)](_0x63a3d8(0x1b7))['to'](this,_0x63a3d8(0x1a5)),_0x2eafbd[_0x63a3d8(0x1a6)][_0x63a3d8(0x1b1)](_0x63a3d8(0x1b5))['to'](this,_0x63a3d8(0x1b5),this,_0x63a3d8(0x169),this,_0x63a3d8(0x171),(_0x5611a6,_0x314f20,_0x44794a)=>_0x5611a6&&!_0x314f20&&!!_0x44794a),_0x2eafbd[_0x63a3d8(0x1a6)][_0x63a3d8(0x1ad)](_0x63a3d8(0x1b7))['to'](this,_0x63a3d8(0x1b6)),_0x2eafbd[_0x63a3d8(0x17d)][_0x63a3d8(0x1b1)](_0x63a3d8(0x1b5))['to'](this,_0x63a3d8(0x1b5),this,_0x63a3d8(0x169),(_0x444b61,_0x99b090)=>_0x444b61&&!_0x99b090),_0x2eafbd[_0x63a3d8(0x17d)][_0x63a3d8(0x1ad)](_0x63a3d8(0x1b7))['to'](this,_0x63a3d8(0x174)),_0x2eafbd[_0x63a3d8(0x17f)][_0x63a3d8(0x1b1)](_0x63a3d8(0x1b5))['to'](this,_0x63a3d8(0x169)),_0x2eafbd[_0x63a3d8(0x17f)][_0x63a3d8(0x1ad)](_0x63a3d8(0x1b7))['to'](this,_0x63a3d8(0x16a)),_0x2eafbd;}[_0x1b95a8(0x1a9)](){const _0x332b65=_0x1b95a8;this[_0x332b65(0x171)]='',this[_0x332b65(0x16f)]=!0x1,this[_0x332b65(0x169)]=!0x0,this[_0x332b65(0x192)][_0x332b65(0x1a3)]=!0x0,this[_0x332b65(0x181)][_0x332b65(0x1a3)]=!0x0,this[_0x332b65(0x192)][_0x332b65(0x178)]();}[_0x1b95a8(0x1bb)](){const _0x1ba811=_0x1b95a8,_0x5eca23=this[_0x1ba811(0x1a0)];this[_0x1ba811(0x169)]=!0x1,this[_0x1ba811(0x187)]='',this[_0x1ba811(0x19c)][_0x1ba811(0x16d)](),this[_0x1ba811(0x171)]&&(this[_0x1ba811(0x19c)][_0x1ba811(0x194)][_0x1ba811(0x17a)]=_0xc5f985(_0x5eca23,_0x1ba811(0x167)));}[_0x1b95a8(0x17e)](_0x4264a2){const _0x44cfcb=_0x1b95a8,_0x4331ad=this[_0x44cfcb(0x1a0)];this[_0x44cfcb(0x1bb)](),this[_0x44cfcb(0x16f)]=!0x0,this[_0x44cfcb(0x186)][_0x44cfcb(0x1b8)]=_0x4264a2||_0xc5f985(_0x4331ad,_0x44cfcb(0x18d)),this[_0x44cfcb(0x171)]||(this[_0x44cfcb(0x192)][_0x44cfcb(0x1a3)]=!0x1);}}