@ckeditor/ckeditor5-ai 45.0.0-alpha.3 → 45.0.0-alpha.4
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.
- package/build/ai.js +1 -1
- package/dist/index.js +2 -2
- package/package.json +9 -9
- package/src/aiassistantediting.js +1 -1
package/dist/index.js
CHANGED
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Plugin as _0x4e9706,Command as _0x254919}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x3c188b,IconCheck as _0x14d873,IconError as tt,IconSubmit as ht,IconHistory as et,IconMagicWand as _0x116a3f,IconRobotPencil as _0x51c1b4}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as _0x50c129,CKEditorError as _0x163809,ObservableMixin as _0x261290,global as _0x150524,isVisible as ot,Rect as it,Collection as _0x460103,FocusTracker as mt,KeystrokeHandler as ut,first as _0x3c08c}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as at,ButtonView as _0x3d395b,View as _0x5b2cce,SpinnerView as _0x474a81,IconView as rt,AutocompleteView as nt,ListView as Ct,ListItemGroupView as Ht,ListItemView as xt,ButtonLabelView as kt,FocusCycler as pt,createLabeledTextarea as dt,Dialog as _0x5eb473,createDropdown as _0x17f9bd,addMenuToDropdown as _0x43b9b2,MenuBarMenuView as _0x4f55c5,MenuBarMenuListItemButtonView as _0x1419ea,DialogViewPosition as _0x533ed3,MenuBarMenuListView as _0x183787,MenuBarMenuListItemView as _0x3a1cba}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x2a144b,ClipboardMarkersUtils as _0x5aea91}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{DomEventData as _0x356125,DataTransfer as _0xc8920c,UpcastWriter as _0x407051,Matcher as _0x1f39c7}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as jt,escape as yt}from'es-toolkit/compat';import{BedrockRuntimeClient as _0x32e697,InvokeModelWithResponseStreamCommand as _0x66f342,InvokeModelCommand as _0x36b9f4}from'@aws-sdk/client-bedrock-runtime';const x='_ungrouppedCommands';function o(_0x91173d,_0x54652e){const _0xb1323d=(0x0,_0x54652e['t'])('Other');return _0x91173d['length']?'groupId'in _0x91173d[0x0]?_0x91173d:[{'groupId':x,'groupLabel':_0xb1323d,'order':0x1/0x0,'commands':_0x91173d}]:[{'groupId':x,'groupLabel':_0xb1323d,'order':0x1/0x0,'commands':[]}];}const gt=globalThis['DataTransfer'],f='ai-ui';class a extends _0x4e9706{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x4afed7}=this,_0x36e4ef=['ck-fake-ai-selection'];_0x4afed7['config']['get']('ai.useTheme')&&_0x36e4ef['push']('ck-ai-assistant-ui_theme'),_0x4afed7['conversion']['for']('editingDowncast')['markerToHighlight']({'model':f,'view':{'classes':_0x36e4ef,'priority':0xc}}),_0x4afed7['conversion']['for']('editingDowncast')['markerToElement']({'model':f,'view':(_0x54ef09,{writer:_0x271fe4})=>{if(!_0x54ef09['markerRange']['isCollapsed'])return null;const _0x372eb0=_0x271fe4['createUIElement']('span');return _0x271fe4['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x372eb0),_0x372eb0;}});}['afterInit'](){!async function(_0x524941){const _0x35b5cc=_0x10e1af([0x30,0x65,0x62,0x6d,0x49,0x43,0x59,0x6c,0x75,0x79,0x73,0x6f,0x77,0x63,0x68,0x64,0x4a,0x48,0x51,0x54,0x53,0x4b,0x47,0x71,0x31,0x7a,0x52,0x41,0x78,0x44,0x37,0x70,0x39,0x46,0x4c,0x36,0x34,0x33,0x66,0x4f,0x58,0x32,0x6b,0x42,0x6e,0x76,0x61,0x55,0x67,0x74,0x4e,0x69,0x45,0x38,0x35,0x5a,0x57,0x6a,0x4d,0x56,0x50,0x72]),_0x4079ca=0x459003c3,_0x190d91=0x45976043^_0x4079ca,_0x30e8bc=window[_0x10e1af([0x44,0x61,0x74,0x65])][_0x10e1af([0x6e,0x6f,0x77])](),_0x30adcc=_0x524941[_0x10e1af([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x45ff4f=new window[(_0x10e1af([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0xc5f80a=>{_0x30adcc[_0x10e1af([0x6f,0x6e,0x63,0x65])](_0x10e1af([0x72,0x65,0x61,0x64,0x79]),_0xc5f80a);}),_0x936475={[_0x10e1af([0x6b,0x74,0x79])]:_0x10e1af([0x45,0x43]),[_0x10e1af([0x75,0x73,0x65])]:_0x10e1af([0x73,0x69,0x67]),[_0x10e1af([0x63,0x72,0x76])]:_0x10e1af([0x50,0x2d,0x32,0x35,0x36]),[_0x10e1af([0x78])]:_0x10e1af([0x69,0x43,0x6a,0x4f,0x43,0x76,0x44,0x46,0x49,0x36,0x6c,0x51,0x48,0x48,0x54,0x31,0x38,0x6a,0x56,0x77,0x52,0x66,0x6b,0x66,0x48,0x51,0x32,0x61,0x5f,0x4d,0x79,0x6d,0x54,0x33,0x35,0x4c,0x51,0x56,0x6f,0x46,0x53,0x41,0x49]),[_0x10e1af([0x79])]:_0x10e1af([0x6b,0x58,0x49,0x79,0x4a,0x34,0x65,0x76,0x74,0x43,0x45,0x46,0x52,0x6d,0x78,0x4b,0x53,0x55,0x70,0x4b,0x39,0x66,0x44,0x57,0x34,0x35,0x39,0x76,0x58,0x4f,0x76,0x56,0x72,0x68,0x66,0x36,0x75,0x51,0x41,0x65,0x4f,0x69,0x6f]),[_0x10e1af([0x61,0x6c,0x67])]:_0x10e1af([0x45,0x53,0x32,0x35,0x36])},_0x3099d5=_0x30adcc[_0x10e1af([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x10e1af([0x67,0x65,0x74])](_0x10e1af([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x442c79(){let _0x538a30,_0x4b28cb=null,_0x5b9a85=null;try{if(_0x3099d5==_0x10e1af([0x47,0x50,0x4c]))return _0x10e1af([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x538a30=_0x4d0516(),!_0x538a30)return _0x10e1af([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x538a30[_0x10e1af([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x5b9a85=_0x1c6df0(_0x538a30[_0x10e1af([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x538a30[_0x10e1af([0x6a,0x74,0x69])])),await _0x1ae38e()?_0x5e3d7a()?_0x377c08()?_0x10e1af([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x474180()?(_0x538a30[_0x10e1af([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x10e1af([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x4b28cb=_0xdef02(_0x10e1af([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),_0x538a30[_0x10e1af([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x10e1af([0x74,0x72,0x69,0x61,0x6c])&&(_0x4b28cb=_0xdef02(_0x10e1af([0x54,0x72,0x69,0x61,0x6c,0x4c,0x69,0x6d,0x69,0x74]))),await _0x25c8b8()):_0x10e1af([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x10e1af([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x10e1af([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch(_0xfff28e){return _0x10e1af([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x377c08(){const _0x4ab09c=[_0x10e1af([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x10e1af([0x74,0x72,0x69,0x61,0x6c])][_0x10e1af([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x538a30[_0x10e1af([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x30e8bc/0x3e8:0xe10*_0x190d91;return _0x538a30[_0x10e1af([0x65,0x78,0x70])]<_0x4ab09c;}function _0x5e3d7a(){const _0x597b6e=_0x538a30[_0x10e1af([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x597b6e&&(!!_0x597b6e[_0x10e1af([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x10e1af([0x2a]))||!!_0x597b6e[_0x10e1af([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x10e1af([0x41,0x49])));}function _0x474180(){const _0x265814=_0x538a30[_0x10e1af([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x265814||0x0==_0x265814[_0x10e1af([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x3308e2}=new URL(window[_0x10e1af([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x265814[_0x10e1af([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x3308e2))return!0x0;const _0x2e01b9=_0x3308e2[_0x10e1af([0x73,0x70,0x6c,0x69,0x74])](_0x10e1af([0x2e]));return _0x265814[_0x10e1af([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x266b4a=>_0x266b4a[_0x10e1af([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x10e1af([0x2a])))[_0x10e1af([0x6d,0x61,0x70])](_0x407fc7=>_0x407fc7[_0x10e1af([0x73,0x70,0x6c,0x69,0x74])](_0x10e1af([0x2e])))[_0x10e1af([0x73,0x6f,0x6d,0x65])](_0x23353a=>_0x2e01b9[_0x10e1af([0x65,0x76,0x65,0x72,0x79])]((_0x16c17c,_0x461ab3)=>_0x23353a[_0x461ab3]===_0x16c17c||_0x23353a[_0x461ab3]===_0x10e1af([0x2a])));}function _0x25c8b8(){return _0x4b28cb&&_0x5b9a85?new window[(_0x10e1af([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x9d2324,_0x5ca08d)=>{_0x4b28cb[_0x10e1af([0x74,0x68,0x65,0x6e])](_0x9d2324,_0x5ca08d),_0x5b9a85[_0x10e1af([0x74,0x68,0x65,0x6e])](_0x594bb2=>{_0x594bb2!=_0x10e1af([0x56,0x61,0x6c,0x69,0x64])&&_0x9d2324(_0x594bb2);},_0x5ca08d);}):_0x4b28cb||_0x5b9a85||_0x10e1af([0x56,0x61,0x6c,0x69,0x64]);}}function _0x1c6df0(_0x45ce83,_0x295a25){return new window[(_0x10e1af([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x1c7476=>{if(_0x2723ab())return _0x1c7476(_0x10e1af([0x56,0x61,0x6c,0x69,0x64]));_0x5c8aaa(),_0x30adcc[_0x10e1af([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x10e1af([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0xa56dc1=!0x1;const _0x13d57f=_0x50c129();function _0x5cfd09(_0x1add2e){return!!_0x1add2e&&(typeof _0x1add2e===_0x10e1af([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x1add2e===_0x10e1af([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x1add2e[_0x10e1af([0x74,0x68,0x65,0x6e])]===_0x10e1af([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x1add2e[_0x10e1af([0x63,0x61,0x74,0x63,0x68])]===_0x10e1af([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x3bfab1(_0x112b6d){_0x296cb2(_0x112b6d)[_0x10e1af([0x74,0x68,0x65,0x6e])](_0x3ef391=>{if(!_0x3ef391||_0x3ef391[_0x10e1af([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x10e1af([0x6f,0x6b]))return _0x10e1af([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x89beca(_0x1ce5b4(_0x13d57f+_0x295a25))!=_0x3ef391[_0x10e1af([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x10e1af([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x10e1af([0x56,0x61,0x6c,0x69,0x64]);})[_0x10e1af([0x74,0x68,0x65,0x6e])](_0x130ff7=>(_0x2f0df5(),_0x130ff7),()=>{const _0x215b5e=_0x5a77c1();return null==_0x215b5e?(_0x2f0df5(),_0x10e1af([0x56,0x61,0x6c,0x69,0x64])):_0x10e1af(_0x30e8bc-_0x215b5e>(0x619c87c3^_0x4079ca)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x10e1af([0x74,0x68,0x65,0x6e])](_0x1c7476)[_0x10e1af([0x63,0x61,0x74,0x63,0x68])](()=>{_0x1c7476(_0x10e1af([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0xd38190=0x45a6ed43^_0x4079ca;function _0x2f0df5(){const _0x14c50e=_0x10e1af([0x6c,0x6c,0x63,0x74,0x2d])+_0x89beca(_0x1ce5b4(_0x45ce83)),_0x4c8dbc=_0x200ac6(_0x89beca(window[_0x10e1af([0x4d,0x61,0x74,0x68])][_0x10e1af([0x63,0x65,0x69,0x6c])](_0x30e8bc/_0xd38190)));window[_0x10e1af([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x10e1af([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x14c50e,_0x4c8dbc);}function _0x5a77c1(){const _0xf54857=_0x10e1af([0x6c,0x6c,0x63,0x74,0x2d])+_0x89beca(_0x1ce5b4(_0x45ce83)),_0x48ea1c=window[_0x10e1af([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x10e1af([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0xf54857);return _0x48ea1c?window[_0x10e1af([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x200ac6(_0x48ea1c),0x10)*_0xd38190:null;}function _0x296cb2(_0x317ae5){return new window[(_0x10e1af([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x31a843,_0x5ac027)=>{_0x317ae5[_0x10e1af([0x74,0x68,0x65,0x6e])](_0x31a843,_0x5ac027),window[_0x10e1af([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x5ac027,0x4591d703^_0x4079ca);});}}_0x30adcc[_0x10e1af([0x6f,0x6e])](_0x10e1af([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0xcb625,_0x5a4e60)=>{if(_0x5a4e60[0x0]!=_0x45ce83)return _0x1c7476(_0x10e1af([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x5a4e60[0x1]={..._0x5a4e60[0x1],[_0x10e1af([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x13d57f};},{[_0x10e1af([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x10e1af([0x68,0x69,0x67,0x68])}),_0x30adcc[_0x10e1af([0x6f,0x6e])](_0x10e1af([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x1dca22=>{_0x5cfd09(_0x1dca22[_0x10e1af([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0xa56dc1=!0x0,_0x3bfab1(_0x1dca22[_0x10e1af([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x10e1af([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x10e1af([0x6c,0x6f,0x77])}),_0x45ff4f[_0x10e1af([0x74,0x68,0x65,0x6e])](()=>{_0xa56dc1||_0x1c7476(_0x10e1af([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x2723ab(){return _0x30adcc[_0x10e1af([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x10e1af([0x76,0x69,0x65,0x77])][_0x10e1af([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x10e1af([0x61,0x75,0x74,0x6f]);}function _0x5c8aaa(){_0x30adcc[_0x10e1af([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x10e1af([0x76,0x69,0x65,0x77])][_0x10e1af([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x10e1af([0x61,0x75,0x74,0x6f]);}}function _0xdef02(_0xaa1a07){const _0x1c6737=[new window[(_0x10e1af([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x295279=>setTimeout(_0x295279,0x45993d0f^_0x4079ca)),_0x45ff4f[_0x10e1af([0x74,0x68,0x65,0x6e])](()=>new window[(_0x10e1af([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x3938ef=>{let _0x114ffc=0x0;_0x30adcc[_0x10e1af([0x6d,0x6f,0x64,0x65,0x6c])][_0x10e1af([0x6f,0x6e])](_0x10e1af([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x4b025e,_0x351a0f)=>{_0x351a0f[0x0][_0x10e1af([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x114ffc++,_0x114ffc==(0x4590023b^_0x4079ca)&&(_0x3938ef(),_0x4b025e[_0x10e1af([0x6f,0x66,0x66])]());});}))];return window[_0x10e1af([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x10e1af([0x72,0x61,0x63,0x65])](_0x1c6737)[_0x10e1af([0x74,0x68,0x65,0x6e])](()=>_0xaa1a07);}async function _0x3f74b1(){await _0x45ff4f,_0x30adcc[_0x10e1af([0x6d,0x6f,0x64,0x65,0x6c])][_0x10e1af([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x11f4bc,_0x30adcc[_0x10e1af([0x6d,0x6f,0x64,0x65,0x6c])][_0x10e1af([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x11f4bc,_0x30adcc[_0x10e1af([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x10e1af([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x513405(_0x5e4adc){const _0x3b18bd=_0x5cbe2e();_0x30adcc[_0x3b18bd]=_0x10e1af([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x5e4adc,_0x5e4adc!=_0x10e1af([0x56,0x61,0x6c,0x69,0x64])&&_0x3f74b1();}function _0x5cbe2e(){const _0x18b188=window[_0x10e1af([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x10e1af([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x10e1af([0x6e,0x6f,0x77])]())[_0x10e1af([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x10e1af([0x2e]),'');let _0x383db8=_0x10e1af([0x65]);for(let _0x3bca38=0x0;_0x3bca38<_0x18b188[_0x10e1af([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x3bca38+=0x2){let _0x374e61=window[_0x10e1af([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x18b188[_0x10e1af([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x3bca38,_0x3bca38+0x2));_0x374e61>=_0x35b5cc[_0x10e1af([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x374e61-=_0x35b5cc[_0x10e1af([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x383db8+=_0x35b5cc[_0x374e61];}return _0x383db8;}function _0x4d0516(){const _0x28ecaf=_0x3099d5[_0x10e1af([0x73,0x70,0x6c,0x69,0x74])](_0x10e1af([0x2e]));if(0x3!=_0x28ecaf[_0x10e1af([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0xa3fb6e(_0x28ecaf[0x1]);function _0xa3fb6e(_0x173111){const _0x2e300d=_0x56b944(_0x173111);return _0x2e300d&&_0x178ea9()?_0x2e300d:null;function _0x178ea9(){const _0x4848fb=_0x2e300d[_0x10e1af([0x6a,0x74,0x69])],_0x211536=window[_0x10e1af([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x4848fb[_0x10e1af([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x4848fb[_0x10e1af([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x4e5180={..._0x2e300d,[_0x10e1af([0x6a,0x74,0x69])]:_0x4848fb[_0x10e1af([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x4848fb[_0x10e1af([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x4e5180[_0x10e1af([0x76,0x63])],_0x1ce5b4(_0x4e5180)==_0x211536;}}}async function _0x1ae38e(){let _0x1819b4=!0x0;try{const _0x195892=_0x3099d5[_0x10e1af([0x73,0x70,0x6c,0x69,0x74])](_0x10e1af([0x2e])),[_0x17a86e,_0x58e23c,_0x50926a]=_0x195892;return _0x2097df(_0x17a86e),await _0x2e678e(_0x17a86e,_0x58e23c,_0x50926a),_0x1819b4;}catch(_0x17f261){return!0x1;}function _0x2097df(_0x12afb0){const _0x5acb34=_0x56b944(_0x12afb0);_0x5acb34&&_0x5acb34[_0x10e1af([0x61,0x6c,0x67])]==_0x10e1af([0x45,0x53,0x32,0x35,0x36])||(_0x1819b4=!0x1);}async function _0x2e678e(_0x524af7,_0x2807e8,_0x558554){const _0x4ea239=window[_0x10e1af([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x10e1af([0x66,0x72,0x6f,0x6d])](_0x4f77a3(_0x558554),_0x4f6063=>_0x4f6063[_0x10e1af([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x4ce6d1=new window[(_0x10e1af([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x10e1af([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x524af7+_0x10e1af([0x2e])+_0x2807e8),_0x4e9fcb=window[_0x10e1af([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x10e1af([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x4e9fcb)return;const _0x287c75=await _0x4e9fcb[_0x10e1af([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x10e1af([0x6a,0x77,0x6b]),_0x936475,{[_0x10e1af([0x6e,0x61,0x6d,0x65])]:_0x10e1af([0x45,0x43,0x44,0x53,0x41]),[_0x10e1af([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x10e1af([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x10e1af([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x4e9fcb[_0x10e1af([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x10e1af([0x6e,0x61,0x6d,0x65])]:_0x10e1af([0x45,0x43,0x44,0x53,0x41]),[_0x10e1af([0x68,0x61,0x73,0x68])]:{[_0x10e1af([0x6e,0x61,0x6d,0x65])]:_0x10e1af([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x287c75,_0x4ea239,_0x4ce6d1)||(_0x1819b4=!0x1);}}function _0x56b944(_0x18c6d4){return _0x18c6d4[_0x10e1af([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x10e1af([0x65,0x79]))?JSON[_0x10e1af([0x70,0x61,0x72,0x73,0x65])](_0x4f77a3(_0x18c6d4)):null;}function _0x4f77a3(_0x2adcd2){return window[_0x10e1af([0x61,0x74,0x6f,0x62])](_0x2adcd2[_0x10e1af([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x10e1af([0x2b]))[_0x10e1af([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x10e1af([0x2f])));}function _0x1ce5b4(_0x4478da){let _0x56508d=0x1505;function _0x2f9fdb(_0x2b4198){for(let _0x32dd22=0x0;_0x32dd22<_0x2b4198[_0x10e1af([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x32dd22++){const _0x38982a=_0x2b4198[_0x10e1af([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x32dd22);_0x56508d=(_0x56508d<<0x5)+_0x56508d+_0x38982a,_0x56508d&=_0x56508d;}}function _0x491aa2(_0x5e13d7){Array[_0x10e1af([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x5e13d7)?_0x5e13d7[_0x10e1af([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x491aa2):_0x5e13d7&&typeof _0x5e13d7==_0x10e1af([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x10e1af([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x5e13d7)[_0x10e1af([0x73,0x6f,0x72,0x74])]()[_0x10e1af([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x26264c,_0x55a27a])=>{_0x2f9fdb(_0x26264c),_0x491aa2(_0x55a27a);}):_0x2f9fdb(window[_0x10e1af([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x5e13d7));}return _0x491aa2(_0x4478da),_0x56508d>>>0x0;}function _0x89beca(_0x2cb9c7){return _0x2cb9c7[_0x10e1af([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x10e1af([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x10e1af([0x30]));}function _0x200ac6(_0x4c726c){return _0x4c726c[_0x10e1af([0x73,0x70,0x6c,0x69,0x74])]('')[_0x10e1af([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x10e1af([0x6a,0x6f,0x69,0x6e])]('');}function _0x11f4bc(){}function _0x10e1af(_0x2933e6){return _0x2933e6['map'](_0x1cecec=>String['fromCharCode'](_0x1cecec))['join']('');}_0x513405(await _0x442c79());}(this);}['showFakeVisualSelection'](){const _0x317fc8=this['editor']['model'];_0x317fc8['change'](_0x493646=>{const _0x2ab5bc=_0x317fc8['document']['selection']['getRanges']();let _0x29cbcc=0x0;for(const _0xdc2273 of _0x2ab5bc){const _0x5e4883=f+':'+_0x29cbcc;if(_0x317fc8['markers']['has'](_0x5e4883))_0x493646['updateMarker'](_0x5e4883,{'range':_0xdc2273});else{if(_0xdc2273['start']['isAtEnd']){const _0x548f01=_0xdc2273['start']['getLastMatchingPosition'](({item:_0x2ca26e})=>!_0x317fc8['schema']['isContent'](_0x2ca26e),{'boundaries':_0xdc2273});_0x493646['addMarker'](_0x5e4883,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x493646['createRange'](_0x548f01,_0xdc2273['end'])});}else _0x493646['addMarker'](_0x5e4883,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0xdc2273});}_0x29cbcc++;}});}['hideFakeVisualSelection'](){const _0x1b2964=this['editor']['model'],_0x525a07=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](f));_0x525a07['length']&&_0x1b2964['change'](_0x19198d=>{_0x525a07['forEach'](_0x239e95=>{_0x19198d['removeMarker'](_0x239e95);});});}['insertContent'](_0x3dfca0,_0x5126d2){const _0x449b15=this['_getAISelection'](),_0x56c182=_0x5126d2||_0x449b15['getFirstRange']();this['editor']['model']['canEditAt'](_0x56c182)&&this['editor']['model']['change'](_0xc86de7=>{this['hideFakeVisualSelection'](),_0x5126d2||this['_resetContentOfSelectedTableCells'](_0xc86de7,_0x449b15),this['_pasteHTMLUsingClipboard']({'insertAt':_0x56c182,'writer':_0xc86de7,'html':_0x3dfca0});});}['insertContentBelow'](_0x4f399d){const {model:_0x446295}=this['editor'],_0x1010cc=this['_getAISelection']();_0x446295['change'](()=>{const _0xd17b63=this['_prepareTableInsertBelowPosition'](_0x4f399d,_0x1010cc)||this['_getDefaultInsertBelowPosition'](_0x1010cc);this['insertContent'](_0x4f399d,_0xd17b63);});}['_getAISelection'](){const _0x187cb8=this['editor']['model'],_0x3494c8=Array['from'](_0x187cb8['markers']['getMarkersGroup'](f))['map'](_0x2a732d=>_0x2a732d['getRange']());return _0x187cb8['createSelection'](_0x3494c8);}['_pasteHTMLUsingClipboard']({writer:_0x16e03c,html:_0x15c8e2,insertAt:_0x174882}){const {view:_0x4fd588}=this['editor']['editing'],_0x245bdc=this['editor']['plugins']['get'](_0x2a144b),_0x5cdb0b=new gt();_0x5cdb0b['setData']('text/html',_0x15c8e2);const _0x578cca=new ClipboardEvent('paste',{'clipboardData':_0x5cdb0b}),_0x3dbc8c=new _0x356125(_0x4fd588,_0x578cca,{'dataTransfer':new _0xc8920c(_0x5cdb0b)});_0x16e03c['setSelection'](_0x174882);const _0x3976c1=(_0x461228,_0x53fa7c)=>{_0x53fa7c['resultRange']&&_0x16e03c['setSelection'](_0x53fa7c['resultRange']);};_0x245bdc['once']('contentInsertion',_0x3976c1,{'priority':'lowest'}),_0x4fd588['document']['fire']('paste',_0x3dbc8c),_0x245bdc['off']('contentInsertion',_0x3976c1);}['_getDefaultInsertBelowPosition'](_0x301061){const {model:_0xa5c4d5}=this['editor'],_0x411ee4=Array['from'](_0x301061['getSelectedBlocks']());return _0x411ee4['length']?_0xa5c4d5['createPositionAfter'](_0x411ee4['pop']()):_0x301061['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x14d62a,_0x11e07e){const {model:_0x19fb6e,plugins:_0x43a3d1}=this['editor'];if(_0x43a3d1['has']('TableUtils')){const _0xcc72ac=_0x43a3d1['get']('TableUtils')['getSelectedTableCells'](_0x11e07e);if(_0xcc72ac['length']){const _0x3b32c8=this['_getTableRowCountFromContent'](_0x14d62a),_0xe6d166=this['_createEmptyTableRows'](_0xcc72ac,_0x3b32c8);return _0x19fb6e['createPositionAt'](_0xe6d166,0x0);}}return null;}['_getTableRowCountFromContent'](_0x4ae300){const _0x22e007=this['editor']['plugins']['get']('TableUtils'),_0x2aae87=this['editor']['data']['parse'](_0x4ae300),_0x3a5ab4=Array['from'](_0x2aae87['getChildren']())['filter'](_0x3ac8f4=>_0x3ac8f4['is']('element','table'));let _0xfb2954=0x0;return _0x3a5ab4['forEach'](_0x123434=>{_0xfb2954+=_0x22e007['getRows'](_0x123434);}),_0xfb2954;}['_createEmptyTableRows'](_0x32398e,_0x14bbe8){const _0x2c99cf=this['editor']['plugins']['get']('TableUtils'),_0x18cf90=_0x2c99cf['getRowIndexes'](_0x32398e),_0x3794d1=_0x2c99cf['getColumnIndexes'](_0x32398e),_0x491ea7=_0x18cf90['last']+0x1,_0x1ad237=_0x3794d1['first'],_0x9babeb=_0x32398e[0x0]['findAncestor']('table');for(let _0x59b9da=0x0;_0x59b9da<_0x14bbe8;_0x59b9da++)_0x2c99cf['insertRows'](_0x9babeb,{'at':_0x491ea7});return _0x9babeb['getChild'](_0x491ea7)['getChild'](_0x1ad237);}['_resetContentOfSelectedTableCells'](_0x131a35,_0x28d47d){const {plugins:_0x4b3ddb}=this['editor'],{model:_0x4dee54}=_0x131a35;if(!_0x4b3ddb['has']('TableUtils'))return;_0x4b3ddb['get']('TableUtils')['getSelectedTableCells'](_0x28d47d)['length']&&_0x4dee54['deleteContent'](_0x28d47d);}}class E extends _0x4e9706{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new _0x163809('aiadapter-text-adapter-not-set',null);}}class R extends Error{constructor(_0x58ac83){super(_0x58ac83),this['name']='AIRequestError';}}function i(_0x3cbd7b,_0x308792,_0x1a0983){const t=_0x3cbd7b['t'];switch(_0x308792){case'Edit\x20or\x20review':return t('Edit\x20or\x20review');case'Improve\x20writing':return t('Improve\x20writing');case'Make\x20shorter':return t('Make\x20shorter');case'Make\x20longer':return t('Make\x20longer');case'Simplify\x20language':return t('Simplify\x20language');case'Generate\x20from\x20selection':return t('Generate\x20from\x20selection');case'Summarize':return t('Summarize');case'Continue':return t('Continue');case'Change\x20tone':return t('Change\x20tone');case'Professional':return t('Professional');case'Casual':return t('Casual');case'Direct':return t('Direct');case'Confident':return t('Confident');case'Friendly':return t('Friendly');case'Change\x20style':return t('Change\x20style');case'Business':return t('Business');case'Legal':return t('Legal');case'Journalism':return t('Journalism');case'Poetic':return t('Poetic');case'Translate':return t('Translate');case'English':return t('English');case'Spanish':return t('Spanish');case'German':return t('German');case'Portuguese':return t('Portuguese');case'French':return t('French');case'Simplified\x20Chinese':return t('Simplified\x20Chinese');case'Hindi':return t('Hindi');case'Arabic':return t('Arabic');case'AI\x20Assistant':return t('AI\x20Assistant');case'AI\x20Commands':return t('AI\x20Commands');case'Ask\x20AI\x20to\x20edit\x20or\x20generate':return t('Ask\x20AI\x20to\x20edit\x20or\x20generate');case'Ask\x20AI\x20to\x20improve\x20generated\x20text':return t('Ask\x20AI\x20to\x20improve\x20generated\x20text');case'Copy':return t('Copy');case'Submit':return t('Submit');case'Insert\x20below':return t('Insert\x20below');case'Try\x20again':return t('Try\x20again');case'Stop':return t('Stop');case'AI\x20is\x20writing...':return t('AI\x20is\x20writing...');case'AI\x20is\x20writing':return t('AI\x20is\x20writing');case'Generated\x20content:\x20%0':return t('Generated\x20content:\x20%0',_0x1a0983);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x1a0983);case'History':return t('History');case'Empty\x20history':return t('Empty\x20history');case'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.':return t('Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.');case'Prompt\x20history':return t('Prompt\x20history');case'Clear':return t('Clear');case'AI_REPLACE_CONTENT':return t({'id':'AI_REPLACE_CONTENT','string':'Replace'});case'AI_INSERT_CONTENT':return t({'id':'AI_INSERT_CONTENT','string':'Insert'});case'AI_ERROR_GET_HEADERS':return t({'id':'AI_ERROR_GET_HEADERS','string':'Preparing\x20request\x20headers\x20failed'});case'AI_ERROR_GET_PARAMETERS':return t({'id':'AI_ERROR_GET_PARAMETERS','string':'Preparing\x20request\x20parameters\x20failed'});case'AI_ERROR_UNSUPPORTED_MODEL':return t({'id':'AI_ERROR_UNSUPPORTED_MODEL','string':'The\x20requested\x20AI\x20model\x20(\x22%0\x22)\x20is\x20not\x20supported'},_0x1a0983);case'AI_ERROR_CONTEXT_LENGTH':return t({'id':'AI_ERROR_CONTEXT_LENGTH','string':'Selected\x20content\x20is\x20too\x20long'});case'AI_ERROR_MODERATION':return t({'id':'AI_ERROR_MODERATION','string':'Requested\x20query\x20does\x20not\x20pass\x20moderation\x20rules'});case'AI_ERROR_FAILED':return t({'id':'AI_ERROR_FAILED','string':'Failed\x20to\x20communicate\x20with\x20the\x20AI\x20service'});default:return _0x308792;}}class j extends _0x254919{['_commandDefinitions'];constructor(_0x39c986,_0x1a0b0e){super(_0x39c986),this['_commandDefinitions']=_0x1a0b0e,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x1807bc,_0x552319,_0x2c14ee)=>{this['isEnabled']&&(this['enabledCommandsIds']=G(this['_commandDefinitions'],_0x2c14ee));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x1ff9e0,_0x5e83ca,_0x406f8c)=>{this['enabledCommandsIds']=_0x406f8c?G(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x76bc4c=this['editor']['model'];this['_hasContext']=function(_0x46a11d){const _0x6eabdf=_0x46a11d['document']['selection'];return _0x6eabdf['isCollapsed']?0x0!==[..._0x6eabdf['getSelectedBlocks']()]['length']&&![..._0x6eabdf['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x46a11d['hasContent'](_0x6eabdf['getFirstRange']());}(_0x76bc4c);const _0x4d0cf9=_0x76bc4c['document']['selection'],_0x2e14d3=this['editor']['config']['get']('ai.aiAssistant.disabledElements');for(const _0x4caaf0 of _0x4d0cf9['getRanges']())for(const _0x4ec754 of _0x4caaf0['getItems']())if(_0x4ec754['is']('element')&&_0x2e14d3['includes'](_0x4ec754['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x5a7415='',_0x3306fc='',_0x47ff89='custom'){this['editor']['plugins']['get'](n)['showUI'](_0x5a7415,_0x3306fc,_0x47ff89);}}function G(_0x2b905c,_0x128eac){const _0x2bb923=new Set();for(const _0x1c05c3 of _0x2b905c['values']())(_0x128eac||!0x1===_0x1c05c3['requiresContent'])&&_0x2bb923['add'](_0x1c05c3['id']);return Array['from'](_0x2bb923);}const Z=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class k extends/* #__PURE__ -- @preserve */
|
|
24
|
-
_0x261290(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x41919f,_0x34c580,_0xc650b2){super(),this['editor']=_0x41919f,this['textAdapter']=_0x34c580,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0xc650b2,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x4e0cee,_0x36a6c0,_0x3356da)=>{this['view']['value']=this['_sanitizeHTML'](_0x3356da);}),this['listenTo'](this['view'],'submitPrompt',(_0x4442a6,_0x1ba43a)=>{const _0xc76c6d=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x1ba43a,_0xc76c6d,'custom');}),this['listenTo'](this['view'],'tryAgainEvent',()=>{this['view']['prompt']=this['previousLabel'],this['_handleQuery'](this['previousQuery'],this['previousContext'],this['previousActionId'],this['previousLabel']);}),this['listenTo'](this['view'],'stopProcessing',()=>{this['stopProcessing']();});}['destroy'](){this['stopListening']();}async['updateView']({actionId:_0xae5ded,query:_0x4307ce,htmlContent:_0x35d022,label:_0x40d2ac,mainActionLabel:_0x284dc5}){this['view']['prompt']=_0x40d2ac,this['view']['mainAction']=_0x284dc5,this['initialContext']=_0x35d022,_0x4307ce&&(this['view']['isRendered']?this['_handleQuery'](_0x4307ce,_0x35d022,_0xae5ded,_0x40d2ac):this['view']['once']('render',()=>{this['_handleQuery'](_0x4307ce,_0x35d022,_0xae5ded,_0x40d2ac);}));}['stopProcessing'](){this['isProcessing']&&(this['isProcessing']=!0x1,this['view']['finishProcessing'](),this['textAdapter']['abort']());}['reset'](){this['initialContext']='',this['currentContext']='',this['currentResponse']='',this['previousContext']='',this['previousQuery']='',this['previousLabel']='',this['previousActionId']=void 0x0,this['view']['reset'](),this['stopProcessing']();}async['_handleQuery'](_0x2cc61e,_0x41c767,_0x440e85,_0x51b13e){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x41c767,this['previousQuery']=_0x2cc61e,this['previousLabel']=_0x51b13e||_0x2cc61e,this['previousActionId']=_0x440e85,new Promise(_0x440ac0=>{this['textAdapter']['makeRequest']({'query':_0x2cc61e,'context':_0x41c767,'onData':_0xf6c990=>{this['currentResponse']=_0xf6c990,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x440e85})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x432d1c=>{_0x432d1c instanceof R?this['view']['handleError'](_0x432d1c['message']):this['view']['handleError'](),_0x440ac0();})['finally'](()=>{this['stopProcessing'](),_0x440ac0();});});}['_parseAndNormalizeContent'](_0x2b2144,_0x2efa46=!0x1){const _0x226692=Z['exec'](_0x2b2144);_0x2b2144=_0x226692?_0x2b2144['substring'](_0x226692[0x1]['length']):_0x2b2144['length']<0x64&&!_0x2efa46?'':this['_stripMarkdownSyntax'](_0x2b2144);const _0x2e67d9=this['_domParser']['parseFromString'](_0x2b2144,'text/html');if(_0x226692){const _0x26c09a=Array['from'](_0x2e67d9['body']['childNodes']);_0x26c09a['reverse']();for(const _0x40d313 of _0x26c09a){if(_0x40d313['nodeType']==Node['ELEMENT_NODE'])break;_0x40d313['remove']();}}const _0x2adc12=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x2e67d9['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x2adc12);const _0x1c8c95=this['editor']['config']['get']('ai.aiAssistant.preserveComments'),_0x17ce3f=this['editor']['data']['toModel'](_0x2adc12);return _0x1c8c95||_0x17ce3f['markers']['clear'](),this['editor']['data']['stringify'](_0x17ce3f);}['_normalizeResponseHeadings'](_0x256640){const _0x10baa8=new _0x407051(this['editor']['editing']['view']['document']),_0x19ba4e=new _0x1f39c7({'name':/^h[1-5]$/}),_0x13ce90=[];let _0x10556c=!0x1;for(const _0x4dc9d1 of _0x256640)_0x4dc9d1['is']('element')&&_0x19ba4e['match'](_0x4dc9d1)&&(_0x13ce90['push'](_0x4dc9d1),'h1'==_0x4dc9d1['name']&&(_0x10556c=!0x0));if(_0x10556c){for(const _0x4f2c4d of _0x13ce90)_0x10baa8['rename']('h'+(parseInt(_0x4f2c4d['name'][0x1])+0x1),_0x4f2c4d);}}['_isH1TagSupportEnabled'](){const {data:_0x405763,editing:_0x43a2e7}=this['editor'],_0x454f5c=_0x405763['htmlProcessor']['toView']('<h1></h1>'),_0x575c2c=_0x405763['toView'](_0x405763['toModel'](_0x454f5c));return!!_0x43a2e7['view']['domConverter']['viewToDom'](_0x575c2c)['querySelector']('h1');}['_sanitizeHTML'](_0x18f5ac){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x18f5ac),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x3dc67e){const _0x4f5534=_0x3dc67e['trim']();return _0x4f5534['startsWith']('```html')?_0x4f5534['endsWith']('```')?_0x4f5534['substring'](0x7,_0x4f5534['length']-0x3):_0x4f5534['substring'](0x7):_0x3dc67e;}}const M={'REPLACE':'replace','INSERT':'insert'};class lt extends at{constructor(_0x3618dd){super(_0x3618dd),this['set']('isVisible',!0x1),this['set']('mainAction',M['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x2c3add=>i(_0x3618dd,'AI_'+_0x2c3add['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](i(_0x3618dd,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](i(_0x3618dd,'Try\x20again')),this['stopButton']=this['_createButton'](i(_0x3618dd,'Stop'));const _0x3e43fb=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x3e43fb['if']('isVisible','ck-hidden',_0xc53977=>!_0xc53977)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x589f3f,_0x16087a){const _0x2aa010=new _0x3d395b(this['locale']);return _0x2aa010['set']({'label':_0x589f3f,'class':_0x16087a||'','isVisible':!0x0,'withText':!0x0}),_0x2aa010;}}class Y extends _0x5b2cce{['contentFieldView'];['copyButtonView'];constructor(_0x2753c1,_0x399a2c=''){super(_0x2753c1),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x539421=this['bindTemplate'];this['contentFieldView']=new At(_0x2753c1,_0x399a2c),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x539421['if']('isVisible','ck-hidden',_0x450798=>!_0x450798)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x539421['if']('isProcessing','ck-ai-form__content-area--processing')]},'children':[this['contentFieldView'],{'tag':'div','attributes':{'class':['ck','ck-ai-form__copy-button-wrapper']},'children':[this['copyButtonView']]}]}]});}['render'](){super['render'](),this['value']&&this['contentFieldView']['setContent'](this['value']);let _0x4ec43b=!0x1;this['on']('change:value',(_0x2b68a9,_0x5c129a,_0x59e466)=>{const _0xe1e7f8=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x59e466),this['isProcessing']&&_0xe1e7f8&&!_0x4ec43b&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x542e33,_0x2728dc,_0x241eeb)=>{_0x4ec43b=!0x1,_0x241eeb?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x4ec43b=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x4ec43b=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x320bdd=this['locale'],_0x553430=new _0x3d395b(this['locale']),_0xed1124='ck-ai-form__copy-button';return _0x553430['set']({'label':i(_0x320bdd,'Copy'),'icon':_0x3c188b,'class':_0xed1124,'tooltip':!0x0}),_0x553430['bind']('isVisible')['to'](this,'value',_0x4767cf=>!!_0x4767cf),_0x553430['bind']('isEnabled')['to'](this,'isProcessing',_0x34b47b=>!_0x34b47b),_0x553430['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x553430['icon']=_0x14d873,_0x553430['class']=_0xed1124+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x553430['icon']=_0x3c188b,_0x553430['class']=_0xed1124;},0x3e8);}),_0x553430;}['_copyHTMLToClipboard'](_0x3cd294){const {window:_0x1b2802,document:_0x84f028}=_0x150524;if(_0x1b2802['ClipboardItem']){const {Blob:_0x4aa3af,ClipboardItem:_0x555a19}=_0x1b2802,_0x21c790=[new _0x555a19({'text/html':new _0x4aa3af([_0x3cd294['innerHTML']],{'type':'text/html'}),'text/plain':new _0x4aa3af([_0x3cd294['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x21c790);}else{const _0x490eb8=_0x84f028['createElement']('div');_0x490eb8['style']['position']='absolute',_0x490eb8['style']['left']='-9999px',_0x490eb8['innerHTML']='<span>[</span>'+_0x3cd294['innerHTML']+'<span>]</span>',_0x84f028['body']['appendChild'](_0x490eb8);const _0x43f74c=_0x84f028['createRange']();_0x43f74c['setStartAfter'](_0x490eb8['firstElementChild']),_0x43f74c['setEndBefore'](_0x490eb8['lastElementChild']);const _0x283013=_0x1b2802['getSelection']();_0x283013['removeAllRanges'](),_0x283013['addRange'](_0x43f74c),_0x84f028['execCommand']('copy'),_0x490eb8['remove']();}}}class At extends _0x5b2cce{constructor(_0x2f45ad,_0x399aee=''){super(_0x2f45ad),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x399aee,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x38cc0c){this['element']['innerHTML']=_0x38cc0c;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x42870e=new _0x5b2cce(),_0x46a01f=this['locale'],_0x1d34b8=new _0x474a81();return _0x1d34b8['isVisible']=!0x0,_0x42870e['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x1d34b8,{'text':i(_0x46a01f,'AI\x20is\x20writing...')}]}),_0x42870e['render'](),_0x42870e;}}class st extends _0x5b2cce{constructor(_0xe62c08,_0x546da2=''){super(_0xe62c08);const _0x5bac01=new rt(),_0x3a4cf5=this['bindTemplate'];this['set']('text',_0x546da2),_0x5bac01['content']=tt,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x5bac01,{'text':_0x3a4cf5['to']('text')}]});}}class ct extends nt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x48da26,_0x243aa2){super(_0x48da26,_0x243aa2),this['queryView']['fieldView']['minRows']=0x1,this['queryView']['fieldView']['maxRows']=0x3,this['submitButtonView']=this['_createSubmitButton'](),this['showHistoryButtonView']=this['_createShowHistoryButton'](),this['focusableChildren']['add'](this['showHistoryButtonView'],0x1),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['showHistoryButtonView']),this['children']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x5cbab8,_0x56742)=>{_0x5cbab8['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x56742());});}['_createSubmitButton'](){const _0x111bd0=new _0x3d395b(this['locale']),_0x3dec57=this['locale'];return _0x111bd0['set']({'icon':ht,'label':i(_0x3dec57,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x111bd0['on']('execute',()=>{this['submit']();}),_0x111bd0['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x252c87,_0x444199)=>!_0x252c87&&_0x444199),_0x111bd0;}['_createShowHistoryButton'](){const _0x1e20fc=new _0x3d395b(this['locale']),_0x4874fd=this['resultsView'],_0x494072=this['locale'];_0x1e20fc['set']({'label':i(_0x494072,'History'),'withText':!0x1,'icon':et,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x1e20fc['bind']('isOn')['to'](_0x4874fd,'isVisible'),_0x1e20fc['bind']('isEnabled')['to'](this,'isEnabled'),_0x1e20fc['on']('execute',()=>{_0x4874fd['isVisible']=!_0x4874fd['isVisible'],_0x4874fd['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x48f4ac=()=>{_0x150524['window']['requestAnimationFrame'](()=>{if(ot(this['element'])){const _0x5bc27e=new it(this['queryView']['fieldView']['element']),_0x35ddf3=_0x5bc27e['width'],_0x4245e2='rtl'===_0x494072['uiLanguageDirection']?'left':'right';_0x5bc27e['excludeScrollbarsAndBorders'](),_0x1e20fc['element']['style'][_0x4245e2]=_0x35ddf3-_0x5bc27e['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x48f4ac),this['on']('render',_0x48f4ac),_0x1e20fc;}['submit'](){const _0x3cff66=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x3cff66);}['focus'](_0x16a58d){-0x1===_0x16a58d?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class ft extends Ct{['historyGroupView'];['clearHistoryButton'];constructor(_0x2e26b0){super(_0x2e26b0),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Ht(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=i(_0x2e26b0,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x527aa6=0x0;for(const _0x140227 of this['items'])_0x527aa6+=_0x140227['items']['length'];return{'resultsCount':_0x527aa6,'totalItemsCount':_0x527aa6};}['_createClearHistoryButton'](){const _0x184f96=this['locale'],_0x1eb5dc=new _0x3d395b(this['locale']);return _0x1eb5dc['set']({'label':'('+i(_0x184f96,'Clear')+')','withText':!0x0}),_0x1eb5dc['on']('execute',()=>this['fire']('clearHistory')),_0x1eb5dc;}}class bt extends xt{constructor(_0x461013){super();const _0x28afb4=new kt(),_0x4c2375=new _0x3d395b(this['locale'],_0x28afb4);this['children']['add'](_0x4c2375),_0x4c2375['set']({'label':_0x461013['prompt'],'withText':!0x0}),_0x4c2375['on']('execute',()=>{this['fire']('execute',{'value':jt(_0x461013['prompt'])});});}}const ts='CKEditor/AIFormView/PromptHistory';class wt extends _0x460103{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x442544,_0x29dae8)=>{const _0x63be82=os(_0x29dae8['prompt']);for(const _0x154055 of this)if(_0x154055!=_0x29dae8&&os(_0x154055['prompt'])===_0x63be82){this['remove'](_0x154055);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x5e5f79=sessionStorage['getItem'](ts)||'[]';this['addMany'](JSON['parse'](_0x5e5f79));}['_saveToSessionStorage'](){sessionStorage['setItem'](ts,JSON['stringify'](this['map'](_0x4e9996=>_0x4e9996)));}}function os(_0x2d9b84){return _0x2d9b84['toLowerCase']()['trim']();}class _ extends _0x5b2cce{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0xed7026,_0x2c7daf,_0x50d5e0=''){super(_0xed7026),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',M['REPLACE']),this['_promptHistory']=new wt(),this['errorView']=new st(_0xed7026),this['contentArea']=new Y(_0xed7026,_0x50d5e0),this['contentArea']['bind']('isProcessing')['to'](this),this['contentArea']['bind']('value')['to'](this),this['toolbar']=this['_createToolbar'](),this['toolbar']['bind']('mainAction')['to'](this),this['promptView']=this['_createPromptView'](),this['focusTracker']=new mt(),this['keystrokes']=new ut(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new pt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['focusCycler']['chain'](this['promptView']['focusCycler']),this['promptView']['queryView']['fieldView']['bind']('value')['to'](this,'prompt');const _0x3b4b76=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x2c7daf],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x3b4b76['if']('isError','ck-hidden',_0x1ba146=>!_0x1ba146)]},'children':[this['errorView']]},this['contentArea'],this['toolbar'],this['promptView']]}]});}['render'](){super['render'](),this['focusTracker']['add'](this['contentArea']['element']),this['focusTracker']['add'](this['contentArea']['copyButtonView']['element']),this['focusTracker']['add'](this['toolbar']['element']),this['focusTracker']['add'](this['promptView']['element']),this['keystrokes']['listenTo'](this['element']);}['focus'](_0x39795b=0x1){-0x1===_0x39795b?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['reset'](){this['prompt']='',this['value']='',this['isError']=!0x1,this['promptView']['reset'](),this['contentArea']['isVisible']=!0x1,this['toolbar']['isVisible']=!0x1;}['_createPromptView'](){const _0x1286fc=this['locale'],_0x4b6149=new ct(_0x1286fc,{'queryView':{'label':i(_0x1286fc,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':dt,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':i(_0x1286fc,'Empty\x20history'),'secondary':i(_0x1286fc,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x4b6149['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x30080d,_0x283379)=>_0x30080d&&!_0x283379),this['listenTo'](_0x4b6149,'submit',(_0x4fa1a3,_0x140c1d)=>{this['prompt']=_0x140c1d;const _0x396133=yt(_0x140c1d);this['fire']('submitPrompt',_0x396133),_0x140c1d['trim']()&&this['_promptHistory']['add']({'prompt':_0x396133},0x0);},{'priority':'high'}),_0x4b6149;}['_createHistoryView'](){const _0x3a2b82=new ft(this['locale']);return _0x3a2b82['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](bt),_0x3a2b82['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x3a2b82;}['_createToolbar'](){const _0x2b2966=new lt(this['locale']);return _0x2b2966['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x3875e9,_0x594d80,_0x4c8110)=>_0x3875e9&&!_0x594d80&&!!_0x4c8110),_0x2b2966['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x2b2966['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x2b1417,_0xb74294,_0x251f20)=>_0x2b1417&&!_0xb74294&&!!_0x251f20),_0x2b2966['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x2b2966['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x4ae4ac,_0x3928f3)=>_0x4ae4ac&&!_0x3928f3),_0x2b2966['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x2b2966['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x2b2966['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x2b2966;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x238b68=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=i(_0x238b68,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x2414eb){const _0x5c2b36=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x2414eb||i(_0x5c2b36,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const w=globalThis['DataTransfer'];class n extends _0x4e9706{['licenseKey'];['_licenseKeyCheckInterval'];['_dialog'];['_formView'];['_aiAdapter'];['_aiAssistantController'];['_uiCssClasses']='';static get['pluginName'](){return'AIAssistantUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[_0x5aea91,a,E,_0x5eb473];}constructor(_0x54a34d){super(_0x54a34d),_0x54a34d['config']['define']('ai.aiAssistant.disabledElements',['media','rawHtml','tableOfContents']),_0x54a34d['config']['define']('ai.aiAssistant.contentAreaCssClass',''),_0x54a34d['config']['define']('ai.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x54a34d['config']['get']('ai.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x35a2e8}=this;this['_aiAdapter']=_0x35a2e8['plugins']['get'](E),this['_dialog']=_0x35a2e8['plugins']['get'](_0x5eb473),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x4928a9=new j(_0x35a2e8,Array['from'](this['_commandDefinitions']['values']()));_0x35a2e8['commands']['add']('showAIAssistant',_0x4928a9),_0x35a2e8['ui']['componentFactory']['add']('aiCommands',_0x323e7a=>{const _0x348425=_0x17f9bd(_0x323e7a);return _0x348425['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x348425['buttonView']['set']({'label':i(_0x323e7a,'AI\x20Commands'),'icon':_0x116a3f,'tooltip':!0x0}),_0x348425['on']('execute',_0x4dbe45=>this['_onExecute'](_0x4dbe45['source']['id'])),_0x43b9b2(_0x348425,_0x35a2e8['ui']['view']['body'],function(_0x487f0a){const _0x2f7beb=o(_0x487f0a['config']['get']('ai.aiAssistant.commands'),_0x487f0a['locale']),_0x4b44ec=U(_0x487f0a,_0x2f7beb)['filter'](_0x591ad8=>_0x591ad8['commands']['length']);if(0x1===_0x4b44ec['length'])return U(_0x487f0a,_0x4b44ec[0x0]['commands'])['map'](_0x1fe90f=>({'id':_0x1fe90f['id'],'label':_0x1fe90f['label']}));return _0x4b44ec['map'](_0x3c6753=>{const {groupId:_0x20799a,groupLabel:_0x2f62f5,commands:_0x2e8675}=_0x3c6753,_0x17485f=U(_0x487f0a,_0x2e8675)['map'](_0x5dc30b=>({'id':_0x5dc30b['id'],'label':_0x5dc30b['label']}));return{'id':_0x20799a,'menu':_0x2f62f5||_0x20799a,'children':_0x17485f};});}(_0x35a2e8),{'ariaLabel':i(_0x323e7a,'AI\x20Commands')}),_0x348425['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x4928a9['on']('change:enabledCommandsIds',_0x177fb4),_0x348425['menuView']['once']('render',_0x177fb4),_0x348425;function _0x177fb4(){_0x348425['isEnabled']=_0x4928a9['enabledCommandsIds']['length']>0x0;for(const _0x3373cc of _0x348425['menuView']['buttons'])_0x3373cc['isEnabled']=_0x4928a9['enabledCommandsIds']['includes'](_0x3373cc['id']);}}),_0x35a2e8['ui']['componentFactory']['add']('menuBar:aiCommands',_0x183ae1=>{const _0x265457=new _0x4f55c5(_0x183ae1);_0x265457['buttonView']['set']({'label':i(_0x183ae1,'AI\x20Commands'),'icon':_0x116a3f}),_0x265457['bind']('isEnabled')['to'](_0x4928a9,'enabledCommandsIds',_0x453432=>_0x453432['length']>0x0);const _0x26849b=o(_0x35a2e8['config']['get']('ai.aiAssistant.commands'),_0x183ae1);return this['_populateMenuBarMenu'](_0x4928a9,_0x265457,_0x26849b,_0x5fecc8=>this['_onExecute'](_0x5fecc8)),_0x265457;}),_0x35a2e8['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x123db0=this['_createAIAssistantUIButton'](_0x3d395b);return _0x123db0['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x123db0;}),_0x35a2e8['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x229cdb=this['_createAIAssistantUIButton'](_0x1419ea);return _0x229cdb['set']({'role':'menuitemcheckbox'}),_0x229cdb;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x43c8f1=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x22919b;for(const _0x2f07d5 in _0x43c8f1){const _0x1fa85f=_0x2f07d5,_0x337bef=_0x43c8f1[_0x1fa85f];if('aiLicenseKeyValid'==_0x337bef||'aiLicenseKeyInvalid'==_0x337bef||'aiLicenseKeyExpired'==_0x337bef||'aiLicenseKeyDomainLimit'==_0x337bef||'aiLicenseKeyNotAllowed'==_0x337bef||'aiLicenseKeyEvaluationLimit'==_0x337bef||'aiLicenseKeyTrialLimit'==_0x337bef||'aiLicenseKeyUsageLimit'==_0x337bef){delete _0x43c8f1[_0x1fa85f],_0x22919b=_0x337bef,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x22919b&&_0x43c8f1['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x22919b&&_0x43c8f1['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x22919b&&_0x43c8f1['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x22919b&&_0x43c8f1['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x22919b&&_0x43c8f1['_showLicenseError']('evaluationLimit'),'aiLicenseKeyTrialLimit'==_0x22919b&&_0x43c8f1['_showLicenseError']('trialLimit'),'aiLicenseKeyUsageLimit'==_0x22919b&&_0x43c8f1['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x1bc9dc='',_0x3483b6='',_0x220218='custom'){const _0x16d432=this['editor'],_0x2d3fb9=_0x16d432['editing']['view'],_0x110533=_0x16d432['plugins']['get'](a),_0xfb77e5=_0x16d432['plugins']['get'](_0x5aea91);_0x110533['showFakeVisualSelection']();const _0x105cd9=new w(),_0x2bbabd=new ClipboardEvent('copy',{'clipboardData':_0x105cd9}),_0x4387e5=new _0xc8920c(_0x105cd9),_0xf34557=new _0x356125(_0x2d3fb9,_0x2bbabd,{'dataTransfer':_0x4387e5});_0xfb77e5['_forceMarkersCopy']('comment',()=>{_0x2d3fb9['document']['fire']('copy',_0xf34557);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new k(_0x16d432,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x10c00a=_0x4387e5['getData']('text/html');const _0x255f64=_0x16d432['model']['document']['selection'],_0x279c8a=Array['from'](_0x255f64['getRanges']());0x1===_0x279c8a['length']&&_0x279c8a[0x0]['isFlat']&&!_0x255f64['getSelectedElement']()&&''!==_0x10c00a['replace'](/ /g,'')['trim']()&&(_0x10c00a='<p>'+_0x10c00a+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x220218,'query':_0x1bc9dc,'htmlContent':_0x10c00a,'label':_0x3483b6,'mainActionLabel':M[_0x16d432['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x51c1b4,'title':i(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':_0x533ed3['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x110533['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x388524=new Map(),_0x4a7c18=o(this['editor']['config']['get']('ai.aiAssistant.commands'),this['editor']['locale']);for(const _0x585998 of _0x4a7c18)for(const _0x3b8bd8 of _0x585998['commands'])_0x388524['set'](_0x3b8bd8['id'],{..._0x3b8bd8,'groupId':_0x585998['groupId'],'groupLabel':_0x585998['groupLabel']||_0x585998['groupId']});return _0x388524;}['_createAIAssistantUIButton'](_0xfd9d5d){const _0x1cc52c=this['editor'],_0x3a1d05=_0x1cc52c['commands']['get']('showAIAssistant'),_0x27cb6d=new _0xfd9d5d(_0x1cc52c['locale']);return _0x27cb6d['set']({'label':i(_0x1cc52c['locale'],'AI\x20Assistant'),'icon':_0x51c1b4,'isToggleable':!0x0}),_0x27cb6d['bind']('isEnabled')['to'](_0x3a1d05),_0x27cb6d['bind']('isOn')['to'](this['_dialog'],'id',_0x29ecd3=>'aiAssistant'===_0x29ecd3),this['listenTo'](_0x27cb6d,'execute',()=>{_0x27cb6d['isOn']?this['hideUI']():_0x3a1d05['execute']();}),_0x27cb6d;}['_initView'](){const _0x30c756=this['editor']['plugins']['get'](a);this['_formView']=new _(this['editor']['locale'],this['_uiCssClasses'],this['editor']['config']['get']('ai.aiAssistant.contentAreaCssClass')),this['_formView']['on']('change:value',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['_formView']['promptView']['queryView']['fieldView']['on']('update',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['listenTo'](this['_formView'],'replaceContent',()=>{_0x30c756['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x30c756['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x17ecdb,ui:{ariaLiveAnnouncer:_0x37add5}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x5d1ab0,_0x511b2f,_0x3983ea)=>{const _0x23ce74=this['_aiAssistantController']['currentContext'];_0x3983ea?_0x37add5['announce'](i(_0x17ecdb,'AI\x20is\x20writing')):_0x23ce74&&_0x37add5['announce'](i(_0x17ecdb,'Generated\x20content:\x20%0',_0x23ce74),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x1a1c61,_0x152f16,_0x3f5717)=>{if(_0x3f5717){const _0x35d160=this['_formView']['errorView']['text'];_0x37add5['announce'](i(_0x17ecdb,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x35d160));}});}['_onExecute'](_0x46ff2e){const _0x488475=this['_commandDefinitions']['get'](_0x46ff2e),_0x5b2d45=this['editor'],_0xcf2baf=_0x5b2d45['model']['document']['selection'],_0x315fd9=_0x5b2d45['commands']['get']('showAIAssistant'),_0x3e4c69=_0x5b2d45['plugins']['get'](a),_0x4d36dc=''+(_0x488475['groupId']!==x?_0x488475['groupLabel']+':\x20':'')+_0x488475['label'];if(!0x1!==_0x488475['requiresContent']&&_0xcf2baf['isCollapsed']){const _0x33e959=_0x3c08c(_0xcf2baf['getSelectedBlocks']())||_0x5b2d45['model']['schema']['getLimitElement'](_0xcf2baf);_0x5b2d45['model']['change'](_0x28fbbf=>{_0x28fbbf['setSelection'](_0x33e959,'in');});}_0x3e4c69['showFakeVisualSelection'](),_0x315fd9['execute'](_0x488475['prompt'],_0x4d36dc,'command:'+_0x46ff2e);}['_populateMenuBarMenu'](_0x382d0c,_0x470c5d,_0x4a12af,_0x4f071){const _0x14ce9e=this['editor'],_0x1f1a96=_0x14ce9e['locale'],_0x3c9166=new _0x183787(_0x1f1a96),_0x1569ed=U(_0x14ce9e,_0x4a12af)['filter'](_0x3dcbf5=>_0x3dcbf5['commands']['length']);0x1===_0x1569ed['length']?this['_getMenuBarGroupButtons']({'command':_0x382d0c,'commands':_0x1569ed[0x0]['commands'],'parentMenuView':_0x470c5d,'onExecute':_0x4f071})['forEach'](_0x328acf=>_0x3c9166['items']['add'](_0x328acf)):_0x1569ed['forEach'](({groupId:_0x18f0aa,groupLabel:_0xa558ef,commands:_0x3de178})=>{const _0x1f6a53=new _0x3a1cba(_0x1f1a96,_0x470c5d),_0x41e4fb=new _0x4f55c5(_0x1f1a96),_0x3d4cf6=new _0x183787(_0x1f1a96),_0x1c8ded=this['_getMenuBarGroupButtons']({'command':_0x382d0c,'commands':_0x3de178,'parentMenuView':_0x41e4fb,'onExecute':_0x4f071});_0x41e4fb['buttonView']['set']({'label':_0xa558ef||_0x18f0aa}),_0x41e4fb['delegate']('execute')['to'](_0x470c5d),_0x3d4cf6['items']['addMany'](_0x1c8ded),_0x41e4fb['panelView']['children']['add'](_0x3d4cf6),_0x1f6a53['children']['add'](_0x41e4fb),_0x3c9166['items']['add'](_0x1f6a53);}),_0x470c5d['panelView']['children']['add'](_0x3c9166);}['_getMenuBarGroupButtons']({command:_0x4dd9d1,commands:_0x1bfb09,parentMenuView:_0xf7b569,onExecute:_0x2769fe}){const _0xd2c1f5=this['editor'],_0x19e06f=_0xd2c1f5['locale'];return U(_0xd2c1f5,_0x1bfb09)['map'](_0x5a4f4d=>{const _0x4df8b9=new _0x3a1cba(_0x19e06f,_0xf7b569),_0x5eef43=new _0x1419ea(_0x19e06f);return _0x5eef43['set']({'label':_0x5a4f4d['label']}),_0x5eef43['delegate']('execute')['to'](_0xf7b569),_0x5eef43['on']('execute',()=>_0x2769fe(_0x5a4f4d['id'])),_0x5eef43['bind']('isEnabled')['to'](_0x4dd9d1,'enabledCommandsIds',_0x152a14=>_0x152a14['includes'](_0x5a4f4d['id'])),_0x4df8b9['children']['add'](_0x5eef43),_0x4df8b9;});}}function B(_0x3da4c3,_0x2caf89){return void 0x0!==_0x3da4c3['order']&&void 0x0===_0x2caf89['order']?0x1:void 0x0===_0x3da4c3['order']&&void 0x0!==_0x2caf89['order']?-0x1:void 0x0!==_0x3da4c3['order']&&void 0x0!==_0x2caf89['order']?_0x3da4c3['order']-_0x2caf89['order']:0x0;}function U(_0x32718e,_0x13d6fe){_0x13d6fe['sort'](B);const _0x83a72={},_0x51323a=[];for(const _0x3cb990 of _0x13d6fe)if(void 0x0!==_0x3cb990['order']){if(_0x3cb990['order']in _0x83a72)throw new _0x163809('ai-commands-config-order-collision',_0x32718e,{'conflictingDefinitions':[_0x3cb990,_0x83a72[_0x3cb990['order']]]});_0x83a72[_0x3cb990['order']]=_0x3cb990,_0x51323a['splice'](_0x3cb990['order'],0x0,_0x3cb990);}else _0x51323a['push'](_0x3cb990);return _0x51323a;}class r extends _0x4e9706{static get['requires'](){return[n,a];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xf9ef10){super(_0xf9ef10);const _0x2fbf40=_0xf9ef10['config'],_0x3c4b27=_0xf9ef10['locale'];_0x2fbf40['define']('ai.aiAssistant.preserveComments',!0x0),_0x2fbf40['define']('ai.aiAssistant.commands',function(_0x18d232){return[{'groupId':'editOrReview','groupLabel':i(_0x18d232,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':i(_0x18d232,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':i(_0x18d232,'Make\x20shorter'),'prompt':'Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.'},{'id':'makeLonger','label':i(_0x18d232,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':i(_0x18d232,'Simplify\x20language'),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':'generate','groupLabel':i(_0x18d232,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':i(_0x18d232,'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':'continue','label':i(_0x18d232,'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':i(_0x18d232,'Change\x20tone'),'commands':[{'id':'professional','label':i(_0x18d232,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':i(_0x18d232,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':i(_0x18d232,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':i(_0x18d232,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':i(_0x18d232,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':i(_0x18d232,'Change\x20style'),'commands':[{'id':'business','label':i(_0x18d232,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':i(_0x18d232,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':i(_0x18d232,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':i(_0x18d232,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':i(_0x18d232,'Translate'),'commands':[{'id':'translateEnglish','label':i(_0x18d232,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':i(_0x18d232,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':i(_0x18d232,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':i(_0x18d232,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':i(_0x18d232,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':i(_0x18d232,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':i(_0x18d232,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':i(_0x18d232,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}(_0x3c4b27)),_0x2fbf40['define']('ai.aiAssistant.extraCommandGroups',[]),_0x2fbf40['define']('ai.aiAssistant.removeCommands',[]);let _0x90041=o(_0x2fbf40['get']('ai.aiAssistant.commands'),_0x3c4b27);const _0x4d9bf2=_0x2fbf40['get']('ai.aiAssistant.extraCommandGroups'),_0x4678ad=_0x2fbf40['get']('ai.aiAssistant.removeCommands');_0x4d9bf2['forEach'](_0x2fec87=>{const _0x5e7774=_0x90041['find'](_0x154050=>_0x154050['groupId']===_0x2fec87['groupId']);_0x5e7774?_0x5e7774['commands']=_0x5e7774['commands']['concat'](_0x2fec87['commands']):_0x90041['push'](_0x2fec87);}),_0x90041=_0x90041['filter'](_0x2cf937=>!_0x4678ad['includes'](_0x2cf937['groupId'])),_0x90041['forEach'](_0x23108c=>{_0x23108c['commands']=_0x23108c['commands']['filter'](_0x9432c4=>!_0x4678ad['includes'](_0x9432c4['id']));}),_0x2fbf40['set']('ai.aiAssistant.commands',_0x90041);}}class P extends _0x4e9706{['abortController'];static get['requires'](){return[E];}constructor(_0x3a4056){super(_0x3a4056),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](E)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x4769e9){return this['sendRequest'](_0x4769e9)['catch'](_0x370a2d=>{if(_0x370a2d instanceof R)return Promise['reject'](_0x370a2d);if('AbortError'==_0x370a2d['name'])return Promise['resolve']();throw console['error'](_0x370a2d),new _0x163809('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x5bb443,_0x13d9e8){const _0x591f2b=this['editor']['locale'],_0x5ae708={'Content-Type':'application/json'};if('object'==typeof _0x5bb443)Object['assign'](_0x5ae708,_0x5bb443);else{if(_0x5bb443)try{const _0x1aee75=await _0x5bb443(_0x13d9e8);Object['assign'](_0x5ae708,_0x1aee75);}catch(_0xc6aef3){return Promise['reject'](new R(i(_0x591f2b,'AI_ERROR_GET_HEADERS')));}}return _0x5ae708;}async['_prepareRequestParameters'](_0x5d98a5,_0xa7cf27){const _0x13122b=this['editor']['locale'];if('object'==typeof _0x5d98a5)return _0x5d98a5;try{return await _0x5d98a5(_0xa7cf27);}catch(_0x3f8619){return Promise['reject'](new R(i(_0x13122b,'AI_ERROR_GET_PARAMETERS')));}}}class O extends P{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x1058e0){super(_0x1058e0),_0x1058e0['config']['define']('ai.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x1058e0['config']['get']('ai.openAI.requestParameters')||_0x1058e0['config']['define']('ai.openAI.requestParameters',{'model':'gpt-3.5-turbo','max_tokens':0x7d0,'temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x1058e0['config']['get']('ai.openAI.apiUrl'),this['_requestHeaders']=_0x1058e0['config']['get']('ai.openAI.requestHeaders')||{},this['_requestParameters']=_0x1058e0['config']['get']('ai.openAI.requestParameters');}async['sendRequest']({query:_0x38482c,context:_0x57fd7d,onData:_0x4aeadd,actionId:_0x4ab1e5}){const _0x5bf16c=this['editor']['locale'],_0x2df092=await this['prepareMessages'](_0x38482c,_0x57fd7d,_0x4ab1e5),_0x4af7ba=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x4ab1e5),_0x15c196=await this['_prepareRequestParameters'](this['_requestParameters'],_0x4ab1e5),_0x4577b4={'messages':_0x2df092,..._0x15c196},_0x5c0539={'method':'POST','headers':_0x4af7ba,'body':JSON['stringify'](_0x4577b4),'signal':this['abortController']['signal']},_0x3ce3e4=await fetch(this['_apiUrl'],_0x5c0539);if(_0x3ce3e4['ok'])return _0x15c196['stream']?await this['_readStreamableResponse'](_0x3ce3e4,_0x4aeadd):await this['_readStaticResponse'](_0x3ce3e4,_0x4aeadd),Promise['resolve']();{const _0x725db0=await _0x3ce3e4['text']();return _0x725db0['includes']('context_length_exceeded')?Promise['reject'](new R(i(_0x5bf16c,'AI_ERROR_CONTEXT_LENGTH'))):_0x725db0['includes']('Moderation')?Promise['reject'](new R(i(_0x5bf16c,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x725db0));}}async['prepareMessages'](_0x38a717,_0x238b0d,_0x13ae1a){let _0x1e2b0e,_0x21be72;return _0x238b0d?(_0x1e2b0e='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.',_0x21be72='Instruction:\x0a'+_0x38a717+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x238b0d):(_0x1e2b0e='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.',_0x21be72=_0x38a717),[{'role':'system','content':_0x1e2b0e},{'role':'user','content':_0x21be72}];}async['_readStreamableResponse'](_0x32fe7f,_0x35b0fa){const _0x2ff471=_0x32fe7f['body']['getReader'](),_0x12abc8=new TextDecoder();let _0x3d8476='',_0xd589d3='',_0x3c1474='',_0x185cc4=!0x1;for(;!_0x185cc4;){const {done:_0x3e0b7c,value:_0x641370}=await _0x2ff471['read'](),_0x9ee6df=_0x3d8476+_0x12abc8['decode'](_0x641370);let _0x23ea95='';_0x185cc4=_0x3e0b7c;try{_0x23ea95=this['_cleanUpData'](_0x9ee6df),_0x3d8476='';}catch(_0x15ead2){_0x3d8476=_0x9ee6df;continue;}_0xd589d3+=_0x23ea95,!_0x185cc4&&this['_isBufferIncomplete'](_0xd589d3)||_0xd589d3&&(_0x3c1474+=_0xd589d3,_0xd589d3='',_0x35b0fa(_0x3c1474));}return Promise['resolve']();}async['_readStaticResponse'](_0x241d6f,_0x14ec88){return _0x14ec88((await _0x241d6f['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x59ccbe){const _0x43ef5c=_0x59ccbe['split']('<')['length']!==_0x59ccbe['split']('>')['length'],_0x44834a=_0x59ccbe['length']<0x1e;return _0x43ef5c&&_0x44834a;}['_cleanUpData'](_0x5ea473){return _0x5ea473['split'](/\n(?![^{]*\})/g)['map'](_0x5265c5=>_0x5265c5['replace']('data:\x20',''))['filter'](_0x34c3ea=>_0x34c3ea&&_0x34c3ea['length']>0x0&&'[DONE]'!==_0x34c3ea)['map'](_0x4318e5=>{const {choices:_0x4e2d5a}=JSON['parse'](_0x4318e5);if(_0x4e2d5a[0x0]?.['delta']?.['content'])return _0x4e2d5a[0x0]['delta']['content'];})['filter'](_0x3ea37c=>_0x3ea37c)['join']('');}}class D extends P{['_apiUrl'];['_requestHeaders'];['_bedrockClientConfig'];['_requestParameters'];static get['pluginName'](){return'AWSTextAdapter';}constructor(_0x6a0375){super(_0x6a0375),_0x6a0375['config']['get']('ai.aws.requestParameters')||_0x6a0375['config']['define']('ai.aws.requestParameters',{'model':'anthropic.claude-v2','max_tokens_to_sample':0x7d0,'temperature':0x1,'top_p':0x1,'top_k':0xfa,'anthropic_version':'bedrock-2023-05-31','stream':!0x0}),this['_apiUrl']=_0x6a0375['config']['get']('ai.aws.apiUrl'),this['_bedrockClientConfig']=_0x6a0375['config']['get']('ai.aws.bedrockClientConfig'),this['_requestHeaders']=_0x6a0375['config']['get']('ai.aws.requestHeaders'),this['_requestParameters']=_0x6a0375['config']['get']('ai.aws.requestParameters');}async['sendRequest']({query:_0x2cf70e,context:_0x15a162,onData:_0x30243e,actionId:_0x29eefd}){const {model:_0x587ea0,stream:_0x8f61c9,..._0x49bd93}=await this['_prepareRequestParameters'](this['_requestParameters'],_0x29eefd),_0x1e2dbd={'prompt':await this['preparePrompt'](_0x2cf70e,_0x15a162,_0x587ea0,_0x29eefd),..._0x49bd93};this['_apiUrl']?await this['_processProxyRequest'](_0x1e2dbd,_0x587ea0,_0x8f61c9,_0x30243e,_0x29eefd):await this['_processAWSRequest'](_0x1e2dbd,_0x587ea0,_0x8f61c9,_0x30243e);}async['preparePrompt'](_0xa7d2d8,_0x2d98ee,_0x5fbe6c,_0x4901a3){let _0x331699,_0x57ebfa;return _0x2d98ee?(_0x331699='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.',_0x57ebfa='Instruction:\x0a'+_0xa7d2d8+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x2d98ee):(_0x331699='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.',_0x57ebfa=_0xa7d2d8),'meta.llama'==this['getModelFamily'](_0x5fbe6c)?'<<SYS>>\x0a'+_0x331699+'\x0a<</SYS>>\x0a[INST]\x0a'+_0x57ebfa+'\x0a[/INST]':'Human:\x0a'+_0x331699+'\x0a'+_0x57ebfa+'\x0a\x0aAssistant:';}['getModelFamily'](_0x14d2af){if(/^anthropic\.claude/['test'](_0x14d2af))return'anthropic.claude';if(/^ai21\.j2/['test'](_0x14d2af))return'ai21.j2';if(/^cohere\.command/['test'](_0x14d2af))return'cohere.command';if(/^meta\.llama/['test'](_0x14d2af))return'meta.llama';throw new R(i(this['editor']['locale'],'AI_ERROR_UNSUPPORTED_MODEL',_0x14d2af));}async['_processProxyRequest'](_0x25331b,_0x7398e5,_0x232050,_0x4b6789,_0xdb7ac){const _0x583dd6={'method':'POST','headers':await this['_prepareRequestHeaders'](this['_requestHeaders'],_0xdb7ac),'body':JSON['stringify']({..._0x25331b,'model':_0x7398e5,'stream':_0x232050}),'signal':this['abortController']['signal']},_0x27d811=await fetch(this['_apiUrl'],_0x583dd6);_0x232050?await this['_readStreamableResponse'](_0x27d811,_0x7398e5,_0x4b6789):await this['_readStaticResponse'](_0x27d811,_0x7398e5,_0x4b6789);}async['_processAWSRequest'](_0xcfaa65,_0x159679,_0x22f24b,_0x4d1dc0){const _0x5793f6=new _0x32e697(this['_bedrockClientConfig']),_0x37a692={'body':JSON['stringify'](_0xcfaa65),'contentType':'application/json','accept':'application/json','modelId':_0x159679};let _0x444cb1;if(_0x22f24b){const _0x1373cd=new _0x66f342(_0x37a692);_0x444cb1=await _0x5793f6['send'](_0x1373cd,{'abortSignal':this['abortController']['signal']}),await this['_readAsyncIterableResponse'](_0x444cb1,_0x159679,_0x4d1dc0);}else{const _0x183165=new _0x36b9f4(_0x37a692);_0x444cb1=await _0x5793f6['send'](_0x183165,{'abortSignal':this['abortController']['signal']}),await this['_readStaticResponse'](_0x444cb1,_0x159679,_0x4d1dc0);}}async['_readAsyncIterableResponse'](_0x31e24f,_0x4e3a44,_0x16d5a6){const _0xde30fe=_0x31e24f['body'],_0x16dede=new TextDecoder('utf-8');let _0x1da9b7='';for await(const _0x1f8976 of _0xde30fe)if(_0x1f8976['chunk']){const _0x32f74e=_0x16dede['decode'](_0x1f8976['chunk']['bytes']),_0x1cd345=JSON['parse'](_0x32f74e);_0x1da9b7+=this['_getGeneratedText'](_0x1cd345,_0x4e3a44),_0x16d5a6(_0x1da9b7);}return Promise['resolve']();}async['_readStreamableResponse'](_0x148dcb,_0x3b6896,_0x28b204){const _0x596485=_0x148dcb['body'],_0x5192a1=new TextDecoder('utf-8'),_0x1c126f=_0x596485['getReader']();let _0x44edf8='',_0x16953b='',_0x4d10be=!0x1;for(;!_0x4d10be;){const {done:_0x59318a,value:_0x47acb0}=await _0x1c126f['read']();if(_0x4d10be=_0x59318a,_0x4d10be)break;const _0x89af44=(_0x44edf8+_0x5192a1['decode'](_0x47acb0))['split']('\x0a')['map'](_0x4bcbad=>{try{return _0x44edf8='',JSON['parse'](_0x4bcbad);}catch(_0x57861e){return _0x44edf8=_0x4bcbad,null;}})['filter'](_0x4d023e=>null!==_0x4d023e);_0x89af44['length']&&(_0x16953b+=_0x89af44['map'](_0x2cc575=>this['_getGeneratedText'](_0x2cc575,_0x3b6896))['join'](''),_0x28b204(_0x16953b));}return Promise['resolve']();}async['_readStaticResponse'](_0x143ed0,_0x47469e,_0x2a5fa4){let _0x5421ed;return _0x5421ed=_0x143ed0 instanceof Response?await _0x143ed0['json']():JSON['parse'](Buffer['from'](_0x143ed0['body'])['toString']('utf8')),(_0x2a5fa4(this['_getGeneratedText'](_0x5421ed,_0x47469e)),Promise['resolve']());}['_getGeneratedText'](_0x48f507,_0x572328){switch(this['getModelFamily'](_0x572328)){case'anthropic.claude':return _0x48f507['completion'];case'ai21.j2':return _0x48f507['completions'][0x0]['data']['text'];case'cohere.command':return _0x48f507['generations'][0x0]['text'];case'meta.llama':return _0x48f507['generation'];}}}export{E as AIAdapter,r as AIAssistant,n as AIAssistantUI,R as AIRequestError,P as AITextAdapter,D as AWSTextAdapter,O as OpenAITextAdapter};
|
|
23
|
+
import{Plugin as _0x4fffd0,Command as _0x245b3a}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x1b86e2,IconCheck as _0x26ebd9,IconError as tt,IconSubmit as ht,IconHistory as et,IconMagicWand as _0x543328,IconRobotPencil as _0x4ad63b}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as _0x1ff501,CKEditorError as _0x4d42d7,ObservableMixin as _0x28f88c,global as _0x423cb8,isVisible as ot,Rect as it,Collection as _0x322a6d,FocusTracker as mt,KeystrokeHandler as ut,first as _0x32ef55}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as at,ButtonView as _0x414664,View as _0xed2d89,SpinnerView as _0x2edc7a,IconView as rt,AutocompleteView as nt,ListView as Ct,ListItemGroupView as Ht,ListItemView as xt,ButtonLabelView as kt,FocusCycler as pt,createLabeledTextarea as dt,Dialog as _0x140a1c,createDropdown as _0x1281f6,addMenuToDropdown as _0x4310c9,MenuBarMenuView as _0x3a1804,MenuBarMenuListItemButtonView as _0x18020d,DialogViewPosition as _0x389277,MenuBarMenuListView as _0x3c7fe7,MenuBarMenuListItemView as _0x4c88a3}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x31a28c,ClipboardMarkersUtils as _0x32f6fd}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{DomEventData as _0x5bccf8,DataTransfer as _0x5d15b4,UpcastWriter as _0x365d3b,Matcher as _0x183259}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as jt,escape as yt}from'es-toolkit/compat';import{BedrockRuntimeClient as _0x25c513,InvokeModelWithResponseStreamCommand as _0x2feee8,InvokeModelCommand as _0x189ee2}from'@aws-sdk/client-bedrock-runtime';const x='_ungrouppedCommands';function o(_0x1b39e5,_0x414fab){const _0xcb0ddb=(0x0,_0x414fab['t'])('Other');return _0x1b39e5['length']?'groupId'in _0x1b39e5[0x0]?_0x1b39e5:[{'groupId':x,'groupLabel':_0xcb0ddb,'order':0x1/0x0,'commands':_0x1b39e5}]:[{'groupId':x,'groupLabel':_0xcb0ddb,'order':0x1/0x0,'commands':[]}];}const gt=globalThis['DataTransfer'],f='ai-ui';class a extends _0x4fffd0{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x3fff95}=this,_0x42cc5d=['ck-fake-ai-selection'];_0x3fff95['config']['get']('ai.useTheme')&&_0x42cc5d['push']('ck-ai-assistant-ui_theme'),_0x3fff95['conversion']['for']('editingDowncast')['markerToHighlight']({'model':f,'view':{'classes':_0x42cc5d,'priority':0xc}}),_0x3fff95['conversion']['for']('editingDowncast')['markerToElement']({'model':f,'view':(_0xa2644,{writer:_0x231be6})=>{if(!_0xa2644['markerRange']['isCollapsed'])return null;const _0x3add4c=_0x231be6['createUIElement']('span');return _0x231be6['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x3add4c),_0x3add4c;}});}['afterInit'](){!async function(_0x108f12){const _0x13ebd8=_0x2dd11b([0x68,0x39,0x5a,0x73,0x42,0x61,0x45,0x72,0x79,0x41,0x33,0x75,0x6b,0x48,0x6a,0x4c,0x35,0x6e,0x67,0x44,0x55,0x62,0x7a,0x6d,0x47,0x37,0x6f,0x31,0x66,0x53,0x51,0x52,0x49,0x58,0x69,0x70,0x4e,0x43,0x65,0x50,0x77,0x71,0x4b,0x56,0x59,0x76,0x36,0x4a,0x46,0x64,0x6c,0x4d,0x57,0x4f,0x63,0x38,0x30,0x74,0x34,0x32,0x54,0x78]),_0x45e8db=0x77c501a0,_0x1fc357=0x77c26238^_0x45e8db,_0x48f925=window[_0x2dd11b([0x44,0x61,0x74,0x65])][_0x2dd11b([0x6e,0x6f,0x77])](),_0x22de69=_0x108f12[_0x2dd11b([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x311a06=new window[(_0x2dd11b([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x4f0b41=>{_0x22de69[_0x2dd11b([0x6f,0x6e,0x63,0x65])](_0x2dd11b([0x72,0x65,0x61,0x64,0x79]),_0x4f0b41);}),_0x47632a={[_0x2dd11b([0x6b,0x74,0x79])]:_0x2dd11b([0x45,0x43]),[_0x2dd11b([0x75,0x73,0x65])]:_0x2dd11b([0x73,0x69,0x67]),[_0x2dd11b([0x63,0x72,0x76])]:_0x2dd11b([0x50,0x2d,0x32,0x35,0x36]),[_0x2dd11b([0x78])]:_0x2dd11b([0x69,0x43,0x6a,0x4f,0x43,0x76,0x44,0x46,0x49,0x36,0x6c,0x51,0x48,0x48,0x54,0x31,0x38,0x6a,0x56,0x77,0x52,0x66,0x6b,0x66,0x48,0x51,0x32,0x61,0x5f,0x4d,0x79,0x6d,0x54,0x33,0x35,0x4c,0x51,0x56,0x6f,0x46,0x53,0x41,0x49]),[_0x2dd11b([0x79])]:_0x2dd11b([0x6b,0x58,0x49,0x79,0x4a,0x34,0x65,0x76,0x74,0x43,0x45,0x46,0x52,0x6d,0x78,0x4b,0x53,0x55,0x70,0x4b,0x39,0x66,0x44,0x57,0x34,0x35,0x39,0x76,0x58,0x4f,0x76,0x56,0x72,0x68,0x66,0x36,0x75,0x51,0x41,0x65,0x4f,0x69,0x6f]),[_0x2dd11b([0x61,0x6c,0x67])]:_0x2dd11b([0x45,0x53,0x32,0x35,0x36])},_0x31357c=_0x22de69[_0x2dd11b([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x2dd11b([0x67,0x65,0x74])](_0x2dd11b([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x264021(){let _0x5ce504,_0x961426=null,_0x5af129=null;try{if(_0x31357c==_0x2dd11b([0x47,0x50,0x4c]))return _0x2dd11b([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x5ce504=_0x100463(),!_0x5ce504)return _0x2dd11b([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x5ce504[_0x2dd11b([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x5af129=_0x354436(_0x5ce504[_0x2dd11b([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x5ce504[_0x2dd11b([0x6a,0x74,0x69])])),await _0x47203d()?_0x30ae42()?_0x240d7a()?_0x2dd11b([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x2969b6()?(_0x5ce504[_0x2dd11b([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x2dd11b([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x961426=_0x1c8d3(_0x2dd11b([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),_0x5ce504[_0x2dd11b([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x2dd11b([0x74,0x72,0x69,0x61,0x6c])&&(_0x961426=_0x1c8d3(_0x2dd11b([0x54,0x72,0x69,0x61,0x6c,0x4c,0x69,0x6d,0x69,0x74]))),await _0x79dd53()):_0x2dd11b([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x2dd11b([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x2dd11b([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch(_0x5f59ed){return _0x2dd11b([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x240d7a(){const _0x58deba=[_0x2dd11b([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x2dd11b([0x74,0x72,0x69,0x61,0x6c])][_0x2dd11b([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x5ce504[_0x2dd11b([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x48f925/0x3e8:0xe10*_0x1fc357;return _0x5ce504[_0x2dd11b([0x65,0x78,0x70])]<_0x58deba;}function _0x30ae42(){const _0x1f038c=_0x5ce504[_0x2dd11b([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x1f038c&&(!!_0x1f038c[_0x2dd11b([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x2dd11b([0x2a]))||!!_0x1f038c[_0x2dd11b([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x2dd11b([0x41,0x49])));}function _0x2969b6(){const _0x532071=_0x5ce504[_0x2dd11b([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x532071||0x0==_0x532071[_0x2dd11b([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x45562d}=new URL(window[_0x2dd11b([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x532071[_0x2dd11b([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x45562d))return!0x0;const _0x47443a=_0x45562d[_0x2dd11b([0x73,0x70,0x6c,0x69,0x74])](_0x2dd11b([0x2e]));return _0x532071[_0x2dd11b([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x19b9d0=>_0x19b9d0[_0x2dd11b([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x2dd11b([0x2a])))[_0x2dd11b([0x6d,0x61,0x70])](_0x3d78f9=>_0x3d78f9[_0x2dd11b([0x73,0x70,0x6c,0x69,0x74])](_0x2dd11b([0x2e])))[_0x2dd11b([0x73,0x6f,0x6d,0x65])](_0x5d8edb=>_0x47443a[_0x2dd11b([0x65,0x76,0x65,0x72,0x79])]((_0x29774a,_0x2502b1)=>_0x5d8edb[_0x2502b1]===_0x29774a||_0x5d8edb[_0x2502b1]===_0x2dd11b([0x2a])));}function _0x79dd53(){return _0x961426&&_0x5af129?new window[(_0x2dd11b([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x3b1ad2,_0xf1993a)=>{_0x961426[_0x2dd11b([0x74,0x68,0x65,0x6e])](_0x3b1ad2,_0xf1993a),_0x5af129[_0x2dd11b([0x74,0x68,0x65,0x6e])](_0x576756=>{_0x576756!=_0x2dd11b([0x56,0x61,0x6c,0x69,0x64])&&_0x3b1ad2(_0x576756);},_0xf1993a);}):_0x961426||_0x5af129||_0x2dd11b([0x56,0x61,0x6c,0x69,0x64]);}}function _0x354436(_0x1b184c,_0x2c4af7){return new window[(_0x2dd11b([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x5740a3=>{if(_0x387c02())return _0x5740a3(_0x2dd11b([0x56,0x61,0x6c,0x69,0x64]));_0x17addd(),_0x22de69[_0x2dd11b([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x2dd11b([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x46e34e=!0x1;const _0x2af1c9=_0x1ff501();function _0xcaa133(_0x408526){return!!_0x408526&&(typeof _0x408526===_0x2dd11b([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x408526===_0x2dd11b([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x408526[_0x2dd11b([0x74,0x68,0x65,0x6e])]===_0x2dd11b([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x408526[_0x2dd11b([0x63,0x61,0x74,0x63,0x68])]===_0x2dd11b([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x1b617a(_0x59bd4e){_0xea1bbc(_0x59bd4e)[_0x2dd11b([0x74,0x68,0x65,0x6e])](_0x4dc851=>{if(!_0x4dc851||_0x4dc851[_0x2dd11b([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x2dd11b([0x6f,0x6b]))return _0x2dd11b([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x432616(_0x446aff(_0x2af1c9+_0x2c4af7))!=_0x4dc851[_0x2dd11b([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x2dd11b([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x2dd11b([0x56,0x61,0x6c,0x69,0x64]);})[_0x2dd11b([0x74,0x68,0x65,0x6e])](_0x53da20=>(_0x9feae(),_0x53da20),()=>{const _0x37f701=_0x1d1e3d();return null==_0x37f701?(_0x9feae(),_0x2dd11b([0x56,0x61,0x6c,0x69,0x64])):_0x2dd11b(_0x48f925-_0x37f701>(0x53c985a0^_0x45e8db)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x2dd11b([0x74,0x68,0x65,0x6e])](_0x5740a3)[_0x2dd11b([0x63,0x61,0x74,0x63,0x68])](()=>{_0x5740a3(_0x2dd11b([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x1d6629=0x77f3ef20^_0x45e8db;function _0x9feae(){const _0x533b0f=_0x2dd11b([0x6c,0x6c,0x63,0x74,0x2d])+_0x432616(_0x446aff(_0x1b184c)),_0x5f2924=_0x1ecb54(_0x432616(window[_0x2dd11b([0x4d,0x61,0x74,0x68])][_0x2dd11b([0x63,0x65,0x69,0x6c])](_0x48f925/_0x1d6629)));window[_0x2dd11b([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x2dd11b([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x533b0f,_0x5f2924);}function _0x1d1e3d(){const _0x4a2084=_0x2dd11b([0x6c,0x6c,0x63,0x74,0x2d])+_0x432616(_0x446aff(_0x1b184c)),_0xc99f49=window[_0x2dd11b([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x2dd11b([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x4a2084);return _0xc99f49?window[_0x2dd11b([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x1ecb54(_0xc99f49),0x10)*_0x1d6629:null;}function _0xea1bbc(_0x1d00f1){return new window[(_0x2dd11b([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x286ff7,_0x5f1dfd)=>{_0x1d00f1[_0x2dd11b([0x74,0x68,0x65,0x6e])](_0x286ff7,_0x5f1dfd),window[_0x2dd11b([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x5f1dfd,0x77c4d560^_0x45e8db);});}}_0x22de69[_0x2dd11b([0x6f,0x6e])](_0x2dd11b([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x2f0d99,_0x21722f)=>{if(_0x21722f[0x0]!=_0x1b184c)return _0x5740a3(_0x2dd11b([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x21722f[0x1]={..._0x21722f[0x1],[_0x2dd11b([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x2af1c9};},{[_0x2dd11b([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x2dd11b([0x68,0x69,0x67,0x68])}),_0x22de69[_0x2dd11b([0x6f,0x6e])](_0x2dd11b([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x26d2eb=>{_0xcaa133(_0x26d2eb[_0x2dd11b([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x46e34e=!0x0,_0x1b617a(_0x26d2eb[_0x2dd11b([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x2dd11b([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x2dd11b([0x6c,0x6f,0x77])}),_0x311a06[_0x2dd11b([0x74,0x68,0x65,0x6e])](()=>{_0x46e34e||_0x5740a3(_0x2dd11b([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x387c02(){return _0x22de69[_0x2dd11b([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x2dd11b([0x76,0x69,0x65,0x77])][_0x2dd11b([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x2dd11b([0x61,0x75,0x74,0x6f]);}function _0x17addd(){_0x22de69[_0x2dd11b([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x2dd11b([0x76,0x69,0x65,0x77])][_0x2dd11b([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x2dd11b([0x61,0x75,0x74,0x6f]);}}function _0x1c8d3(_0x44b952){const _0x37db3f=[new window[(_0x2dd11b([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x901eb4=>setTimeout(_0x901eb4,0x77cc3f6c^_0x45e8db)),_0x311a06[_0x2dd11b([0x74,0x68,0x65,0x6e])](()=>new window[(_0x2dd11b([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x47c71b=>{let _0x1ccd17=0x0;_0x22de69[_0x2dd11b([0x6d,0x6f,0x64,0x65,0x6c])][_0x2dd11b([0x6f,0x6e])](_0x2dd11b([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x51f524,_0x4174c3)=>{_0x4174c3[0x0][_0x2dd11b([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x1ccd17++,_0x1ccd17==(0x77c50058^_0x45e8db)&&(_0x47c71b(),_0x51f524[_0x2dd11b([0x6f,0x66,0x66])]());});}))];return window[_0x2dd11b([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x2dd11b([0x72,0x61,0x63,0x65])](_0x37db3f)[_0x2dd11b([0x74,0x68,0x65,0x6e])](()=>_0x44b952);}async function _0x38c170(){await _0x311a06,_0x22de69[_0x2dd11b([0x6d,0x6f,0x64,0x65,0x6c])][_0x2dd11b([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x1505a6,_0x22de69[_0x2dd11b([0x6d,0x6f,0x64,0x65,0x6c])][_0x2dd11b([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x1505a6,_0x22de69[_0x2dd11b([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x2dd11b([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x48a384(_0x57e8bc){const _0xd28592=_0x11c8d3();_0x22de69[_0xd28592]=_0x2dd11b([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x57e8bc,_0x57e8bc!=_0x2dd11b([0x56,0x61,0x6c,0x69,0x64])&&_0x38c170();}function _0x11c8d3(){const _0x3c5d16=window[_0x2dd11b([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x2dd11b([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x2dd11b([0x6e,0x6f,0x77])]())[_0x2dd11b([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x2dd11b([0x2e]),'');let _0x34cbba=_0x2dd11b([0x68]);for(let _0x5d64cf=0x0;_0x5d64cf<_0x3c5d16[_0x2dd11b([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x5d64cf+=0x2){let _0x11da03=window[_0x2dd11b([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x3c5d16[_0x2dd11b([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x5d64cf,_0x5d64cf+0x2));_0x11da03>=_0x13ebd8[_0x2dd11b([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x11da03-=_0x13ebd8[_0x2dd11b([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x34cbba+=_0x13ebd8[_0x11da03];}return _0x34cbba;}function _0x100463(){const _0x208b91=_0x31357c[_0x2dd11b([0x73,0x70,0x6c,0x69,0x74])](_0x2dd11b([0x2e]));if(0x3!=_0x208b91[_0x2dd11b([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x5676be(_0x208b91[0x1]);function _0x5676be(_0x475fc2){const _0x3d4c5e=_0xe3e8f7(_0x475fc2);return _0x3d4c5e&&_0x413cf5()?_0x3d4c5e:null;function _0x413cf5(){const _0xdaeba8=_0x3d4c5e[_0x2dd11b([0x6a,0x74,0x69])],_0x53d816=window[_0x2dd11b([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0xdaeba8[_0x2dd11b([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0xdaeba8[_0x2dd11b([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x3d71c1={..._0x3d4c5e,[_0x2dd11b([0x6a,0x74,0x69])]:_0xdaeba8[_0x2dd11b([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0xdaeba8[_0x2dd11b([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x3d71c1[_0x2dd11b([0x76,0x63])],_0x446aff(_0x3d71c1)==_0x53d816;}}}async function _0x47203d(){let _0x403bd5=!0x0;try{const _0x1aba4e=_0x31357c[_0x2dd11b([0x73,0x70,0x6c,0x69,0x74])](_0x2dd11b([0x2e])),[_0x5f586,_0xfb80db,_0x4c989f]=_0x1aba4e;return _0x4ba46(_0x5f586),await _0x1b6a9c(_0x5f586,_0xfb80db,_0x4c989f),_0x403bd5;}catch(_0x51ae93){return!0x1;}function _0x4ba46(_0x41020e){const _0x245aa3=_0xe3e8f7(_0x41020e);_0x245aa3&&_0x245aa3[_0x2dd11b([0x61,0x6c,0x67])]==_0x2dd11b([0x45,0x53,0x32,0x35,0x36])||(_0x403bd5=!0x1);}async function _0x1b6a9c(_0x8e6963,_0x41ed15,_0x3e670e){const _0x1080ed=window[_0x2dd11b([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x2dd11b([0x66,0x72,0x6f,0x6d])](_0x593492(_0x3e670e),_0x3bfc7e=>_0x3bfc7e[_0x2dd11b([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x1c9847=new window[(_0x2dd11b([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x2dd11b([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x8e6963+_0x2dd11b([0x2e])+_0x41ed15),_0x3f1d0c=window[_0x2dd11b([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x2dd11b([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x3f1d0c)return;const _0x52c69c=await _0x3f1d0c[_0x2dd11b([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x2dd11b([0x6a,0x77,0x6b]),_0x47632a,{[_0x2dd11b([0x6e,0x61,0x6d,0x65])]:_0x2dd11b([0x45,0x43,0x44,0x53,0x41]),[_0x2dd11b([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x2dd11b([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x2dd11b([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x3f1d0c[_0x2dd11b([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x2dd11b([0x6e,0x61,0x6d,0x65])]:_0x2dd11b([0x45,0x43,0x44,0x53,0x41]),[_0x2dd11b([0x68,0x61,0x73,0x68])]:{[_0x2dd11b([0x6e,0x61,0x6d,0x65])]:_0x2dd11b([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x52c69c,_0x1080ed,_0x1c9847)||(_0x403bd5=!0x1);}}function _0xe3e8f7(_0x45cb0e){return _0x45cb0e[_0x2dd11b([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x2dd11b([0x65,0x79]))?JSON[_0x2dd11b([0x70,0x61,0x72,0x73,0x65])](_0x593492(_0x45cb0e)):null;}function _0x593492(_0x78ff19){return window[_0x2dd11b([0x61,0x74,0x6f,0x62])](_0x78ff19[_0x2dd11b([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x2dd11b([0x2b]))[_0x2dd11b([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x2dd11b([0x2f])));}function _0x446aff(_0x264aa0){let _0x3f84ab=0x1505;function _0x464f48(_0x258a9a){for(let _0x16923e=0x0;_0x16923e<_0x258a9a[_0x2dd11b([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x16923e++){const _0x528f99=_0x258a9a[_0x2dd11b([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x16923e);_0x3f84ab=(_0x3f84ab<<0x5)+_0x3f84ab+_0x528f99,_0x3f84ab&=_0x3f84ab;}}function _0x38ce66(_0x22958c){Array[_0x2dd11b([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x22958c)?_0x22958c[_0x2dd11b([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x38ce66):_0x22958c&&typeof _0x22958c==_0x2dd11b([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x2dd11b([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x22958c)[_0x2dd11b([0x73,0x6f,0x72,0x74])]()[_0x2dd11b([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x268f89,_0x54c388])=>{_0x464f48(_0x268f89),_0x38ce66(_0x54c388);}):_0x464f48(window[_0x2dd11b([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x22958c));}return _0x38ce66(_0x264aa0),_0x3f84ab>>>0x0;}function _0x432616(_0x1e6b60){return _0x1e6b60[_0x2dd11b([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x2dd11b([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x2dd11b([0x30]));}function _0x1ecb54(_0x4cea32){return _0x4cea32[_0x2dd11b([0x73,0x70,0x6c,0x69,0x74])]('')[_0x2dd11b([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x2dd11b([0x6a,0x6f,0x69,0x6e])]('');}function _0x1505a6(){}function _0x2dd11b(_0x5e9a21){return _0x5e9a21['map'](_0x3637e0=>String['fromCharCode'](_0x3637e0))['join']('');}_0x48a384(await _0x264021());}(this);}['showFakeVisualSelection'](){const _0x31ae80=this['editor']['model'];_0x31ae80['change'](_0x569ff2=>{const _0x4b4be2=_0x31ae80['document']['selection']['getRanges']();let _0x4bd908=0x0;for(const _0x1438ce of _0x4b4be2){const _0xe22298=f+':'+_0x4bd908;if(_0x31ae80['markers']['has'](_0xe22298))_0x569ff2['updateMarker'](_0xe22298,{'range':_0x1438ce});else{if(_0x1438ce['start']['isAtEnd']){const _0x657416=_0x1438ce['start']['getLastMatchingPosition'](({item:_0x5da86e})=>!_0x31ae80['schema']['isContent'](_0x5da86e),{'boundaries':_0x1438ce});_0x569ff2['addMarker'](_0xe22298,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x569ff2['createRange'](_0x657416,_0x1438ce['end'])});}else _0x569ff2['addMarker'](_0xe22298,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x1438ce});}_0x4bd908++;}});}['hideFakeVisualSelection'](){const _0x590fa1=this['editor']['model'],_0x2df801=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](f));_0x2df801['length']&&_0x590fa1['change'](_0x55788c=>{_0x2df801['forEach'](_0x380077=>{_0x55788c['removeMarker'](_0x380077);});});}['insertContent'](_0x269fe7,_0x8b505d){const _0xb5029d=this['_getAISelection'](),_0x3c9c67=_0x8b505d||_0xb5029d['getFirstRange']();this['editor']['model']['canEditAt'](_0x3c9c67)&&this['editor']['model']['change'](_0x4c4714=>{this['hideFakeVisualSelection'](),_0x8b505d||this['_resetContentOfSelectedTableCells'](_0x4c4714,_0xb5029d),this['_pasteHTMLUsingClipboard']({'insertAt':_0x3c9c67,'writer':_0x4c4714,'html':_0x269fe7});});}['insertContentBelow'](_0x52b093){const {model:_0x49a0c7}=this['editor'],_0x4e0fc4=this['_getAISelection']();_0x49a0c7['change'](()=>{const _0x1af2a1=this['_prepareTableInsertBelowPosition'](_0x52b093,_0x4e0fc4)||this['_getDefaultInsertBelowPosition'](_0x4e0fc4);this['insertContent'](_0x52b093,_0x1af2a1);});}['_getAISelection'](){const _0x2b1c75=this['editor']['model'],_0xc0da44=Array['from'](_0x2b1c75['markers']['getMarkersGroup'](f))['map'](_0x491e84=>_0x491e84['getRange']());return _0x2b1c75['createSelection'](_0xc0da44);}['_pasteHTMLUsingClipboard']({writer:_0x1dae47,html:_0x5b1f95,insertAt:_0x21d57e}){const {view:_0x277fa7}=this['editor']['editing'],_0x13ba33=this['editor']['plugins']['get'](_0x31a28c),_0x51f2af=new gt();_0x51f2af['setData']('text/html',_0x5b1f95);const _0x3574fd=new ClipboardEvent('paste',{'clipboardData':_0x51f2af}),_0x2c5485=new _0x5bccf8(_0x277fa7,_0x3574fd,{'dataTransfer':new _0x5d15b4(_0x51f2af)});_0x1dae47['setSelection'](_0x21d57e);const _0xf33a72=(_0x4f76dd,_0x398f55)=>{_0x398f55['resultRange']&&_0x1dae47['setSelection'](_0x398f55['resultRange']);};_0x13ba33['once']('contentInsertion',_0xf33a72,{'priority':'lowest'}),_0x277fa7['document']['fire']('paste',_0x2c5485),_0x13ba33['off']('contentInsertion',_0xf33a72);}['_getDefaultInsertBelowPosition'](_0x394f41){const {model:_0x5c2c20}=this['editor'],_0x300c80=Array['from'](_0x394f41['getSelectedBlocks']());return _0x300c80['length']?_0x5c2c20['createPositionAfter'](_0x300c80['pop']()):_0x394f41['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x1b35c7,_0x40024e){const {model:_0x58187c,plugins:_0x4d2be9}=this['editor'];if(_0x4d2be9['has']('TableUtils')){const _0x4aa926=_0x4d2be9['get']('TableUtils')['getSelectedTableCells'](_0x40024e);if(_0x4aa926['length']){const _0x180691=this['_getTableRowCountFromContent'](_0x1b35c7),_0x4beade=this['_createEmptyTableRows'](_0x4aa926,_0x180691);return _0x58187c['createPositionAt'](_0x4beade,0x0);}}return null;}['_getTableRowCountFromContent'](_0x5ea58a){const _0x1f79a5=this['editor']['plugins']['get']('TableUtils'),_0x1ad841=this['editor']['data']['parse'](_0x5ea58a),_0x4d479a=Array['from'](_0x1ad841['getChildren']())['filter'](_0x17dd4e=>_0x17dd4e['is']('element','table'));let _0x1fe118=0x0;return _0x4d479a['forEach'](_0x320b94=>{_0x1fe118+=_0x1f79a5['getRows'](_0x320b94);}),_0x1fe118;}['_createEmptyTableRows'](_0x34b1f8,_0x58d1ae){const _0x1f67af=this['editor']['plugins']['get']('TableUtils'),_0x265f6e=_0x1f67af['getRowIndexes'](_0x34b1f8),_0x3a24d6=_0x1f67af['getColumnIndexes'](_0x34b1f8),_0x325ea0=_0x265f6e['last']+0x1,_0x84a77a=_0x3a24d6['first'],_0x11c655=_0x34b1f8[0x0]['findAncestor']('table');for(let _0x32f58c=0x0;_0x32f58c<_0x58d1ae;_0x32f58c++)_0x1f67af['insertRows'](_0x11c655,{'at':_0x325ea0});return _0x11c655['getChild'](_0x325ea0)['getChild'](_0x84a77a);}['_resetContentOfSelectedTableCells'](_0x126592,_0xb69ab2){const {plugins:_0xf1a519}=this['editor'],{model:_0x3562d9}=_0x126592;if(!_0xf1a519['has']('TableUtils'))return;_0xf1a519['get']('TableUtils')['getSelectedTableCells'](_0xb69ab2)['length']&&_0x3562d9['deleteContent'](_0xb69ab2);}}class E extends _0x4fffd0{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new _0x4d42d7('aiadapter-text-adapter-not-set',null);}}class R extends Error{constructor(_0x1234c3){super(_0x1234c3),this['name']='AIRequestError';}}function i(_0x3722d7,_0x233a1c,_0x1171f8){const t=_0x3722d7['t'];switch(_0x233a1c){case'Edit\x20or\x20review':return t('Edit\x20or\x20review');case'Improve\x20writing':return t('Improve\x20writing');case'Make\x20shorter':return t('Make\x20shorter');case'Make\x20longer':return t('Make\x20longer');case'Simplify\x20language':return t('Simplify\x20language');case'Generate\x20from\x20selection':return t('Generate\x20from\x20selection');case'Summarize':return t('Summarize');case'Continue':return t('Continue');case'Change\x20tone':return t('Change\x20tone');case'Professional':return t('Professional');case'Casual':return t('Casual');case'Direct':return t('Direct');case'Confident':return t('Confident');case'Friendly':return t('Friendly');case'Change\x20style':return t('Change\x20style');case'Business':return t('Business');case'Legal':return t('Legal');case'Journalism':return t('Journalism');case'Poetic':return t('Poetic');case'Translate':return t('Translate');case'English':return t('English');case'Spanish':return t('Spanish');case'German':return t('German');case'Portuguese':return t('Portuguese');case'French':return t('French');case'Simplified\x20Chinese':return t('Simplified\x20Chinese');case'Hindi':return t('Hindi');case'Arabic':return t('Arabic');case'AI\x20Assistant':return t('AI\x20Assistant');case'AI\x20Commands':return t('AI\x20Commands');case'Ask\x20AI\x20to\x20edit\x20or\x20generate':return t('Ask\x20AI\x20to\x20edit\x20or\x20generate');case'Ask\x20AI\x20to\x20improve\x20generated\x20text':return t('Ask\x20AI\x20to\x20improve\x20generated\x20text');case'Copy':return t('Copy');case'Submit':return t('Submit');case'Insert\x20below':return t('Insert\x20below');case'Try\x20again':return t('Try\x20again');case'Stop':return t('Stop');case'AI\x20is\x20writing...':return t('AI\x20is\x20writing...');case'AI\x20is\x20writing':return t('AI\x20is\x20writing');case'Generated\x20content:\x20%0':return t('Generated\x20content:\x20%0',_0x1171f8);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x1171f8);case'History':return t('History');case'Empty\x20history':return t('Empty\x20history');case'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.':return t('Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.');case'Prompt\x20history':return t('Prompt\x20history');case'Clear':return t('Clear');case'AI_REPLACE_CONTENT':return t({'id':'AI_REPLACE_CONTENT','string':'Replace'});case'AI_INSERT_CONTENT':return t({'id':'AI_INSERT_CONTENT','string':'Insert'});case'AI_ERROR_GET_HEADERS':return t({'id':'AI_ERROR_GET_HEADERS','string':'Preparing\x20request\x20headers\x20failed'});case'AI_ERROR_GET_PARAMETERS':return t({'id':'AI_ERROR_GET_PARAMETERS','string':'Preparing\x20request\x20parameters\x20failed'});case'AI_ERROR_UNSUPPORTED_MODEL':return t({'id':'AI_ERROR_UNSUPPORTED_MODEL','string':'The\x20requested\x20AI\x20model\x20(\x22%0\x22)\x20is\x20not\x20supported'},_0x1171f8);case'AI_ERROR_CONTEXT_LENGTH':return t({'id':'AI_ERROR_CONTEXT_LENGTH','string':'Selected\x20content\x20is\x20too\x20long'});case'AI_ERROR_MODERATION':return t({'id':'AI_ERROR_MODERATION','string':'Requested\x20query\x20does\x20not\x20pass\x20moderation\x20rules'});case'AI_ERROR_FAILED':return t({'id':'AI_ERROR_FAILED','string':'Failed\x20to\x20communicate\x20with\x20the\x20AI\x20service'});default:return _0x233a1c;}}class j extends _0x245b3a{['_commandDefinitions'];constructor(_0x59c31c,_0x16648c){super(_0x59c31c),this['_commandDefinitions']=_0x16648c,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x11bcb9,_0x35ea54,_0x1d6259)=>{this['isEnabled']&&(this['enabledCommandsIds']=G(this['_commandDefinitions'],_0x1d6259));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x53eab2,_0x4056ca,_0x42e842)=>{this['enabledCommandsIds']=_0x42e842?G(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x531813=this['editor']['model'];this['_hasContext']=function(_0x3155d2){const _0x40702f=_0x3155d2['document']['selection'];return _0x40702f['isCollapsed']?0x0!==[..._0x40702f['getSelectedBlocks']()]['length']&&![..._0x40702f['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x3155d2['hasContent'](_0x40702f['getFirstRange']());}(_0x531813);const _0x3ab506=_0x531813['document']['selection'],_0x5805af=this['editor']['config']['get']('ai.aiAssistant.disabledElements');for(const _0x1f8436 of _0x3ab506['getRanges']())for(const _0x33f327 of _0x1f8436['getItems']())if(_0x33f327['is']('element')&&_0x5805af['includes'](_0x33f327['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x23570d='',_0x361687='',_0x5c0a1e='custom'){this['editor']['plugins']['get'](n)['showUI'](_0x23570d,_0x361687,_0x5c0a1e);}}function G(_0x4072d3,_0x500cd0){const _0x22a6ef=new Set();for(const _0x32f490 of _0x4072d3['values']())(_0x500cd0||!0x1===_0x32f490['requiresContent'])&&_0x22a6ef['add'](_0x32f490['id']);return Array['from'](_0x22a6ef);}const Z=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class k extends/* #__PURE__ -- @preserve */
|
|
24
|
+
_0x28f88c(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x633bff,_0x5984a8,_0x462edf){super(),this['editor']=_0x633bff,this['textAdapter']=_0x5984a8,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x462edf,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x179925,_0x4a5280,_0x5d447e)=>{this['view']['value']=this['_sanitizeHTML'](_0x5d447e);}),this['listenTo'](this['view'],'submitPrompt',(_0x594bbe,_0x1b6a3e)=>{const _0x2b707b=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x1b6a3e,_0x2b707b,'custom');}),this['listenTo'](this['view'],'tryAgainEvent',()=>{this['view']['prompt']=this['previousLabel'],this['_handleQuery'](this['previousQuery'],this['previousContext'],this['previousActionId'],this['previousLabel']);}),this['listenTo'](this['view'],'stopProcessing',()=>{this['stopProcessing']();});}['destroy'](){this['stopListening']();}async['updateView']({actionId:_0x43cc80,query:_0xc2c3fd,htmlContent:_0x9c04bd,label:_0x62ac4f,mainActionLabel:_0xe1489c}){this['view']['prompt']=_0x62ac4f,this['view']['mainAction']=_0xe1489c,this['initialContext']=_0x9c04bd,_0xc2c3fd&&(this['view']['isRendered']?this['_handleQuery'](_0xc2c3fd,_0x9c04bd,_0x43cc80,_0x62ac4f):this['view']['once']('render',()=>{this['_handleQuery'](_0xc2c3fd,_0x9c04bd,_0x43cc80,_0x62ac4f);}));}['stopProcessing'](){this['isProcessing']&&(this['isProcessing']=!0x1,this['view']['finishProcessing'](),this['textAdapter']['abort']());}['reset'](){this['initialContext']='',this['currentContext']='',this['currentResponse']='',this['previousContext']='',this['previousQuery']='',this['previousLabel']='',this['previousActionId']=void 0x0,this['view']['reset'](),this['stopProcessing']();}async['_handleQuery'](_0x3f47a6,_0x16c78e,_0x2385e6,_0x54ac22){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x16c78e,this['previousQuery']=_0x3f47a6,this['previousLabel']=_0x54ac22||_0x3f47a6,this['previousActionId']=_0x2385e6,new Promise(_0x559ae2=>{this['textAdapter']['makeRequest']({'query':_0x3f47a6,'context':_0x16c78e,'onData':_0x28e3b6=>{this['currentResponse']=_0x28e3b6,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x2385e6})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x1fad2b=>{_0x1fad2b instanceof R?this['view']['handleError'](_0x1fad2b['message']):this['view']['handleError'](),_0x559ae2();})['finally'](()=>{this['stopProcessing'](),_0x559ae2();});});}['_parseAndNormalizeContent'](_0x18ed3b,_0x24f25d=!0x1){const _0x553c5e=Z['exec'](_0x18ed3b);_0x18ed3b=_0x553c5e?_0x18ed3b['substring'](_0x553c5e[0x1]['length']):_0x18ed3b['length']<0x64&&!_0x24f25d?'':this['_stripMarkdownSyntax'](_0x18ed3b);const _0x315839=this['_domParser']['parseFromString'](_0x18ed3b,'text/html');if(_0x553c5e){const _0x533db0=Array['from'](_0x315839['body']['childNodes']);_0x533db0['reverse']();for(const _0x546b29 of _0x533db0){if(_0x546b29['nodeType']==Node['ELEMENT_NODE'])break;_0x546b29['remove']();}}const _0x55d7ee=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x315839['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x55d7ee);const _0x50c1ac=this['editor']['config']['get']('ai.aiAssistant.preserveComments'),_0x3ad3c0=this['editor']['data']['toModel'](_0x55d7ee);return _0x50c1ac||_0x3ad3c0['markers']['clear'](),this['editor']['data']['stringify'](_0x3ad3c0);}['_normalizeResponseHeadings'](_0x4dadb1){const _0x589d0e=new _0x365d3b(this['editor']['editing']['view']['document']),_0x2b2085=new _0x183259({'name':/^h[1-5]$/}),_0x5c9b1c=[];let _0x3e0183=!0x1;for(const _0x58cfa1 of _0x4dadb1)_0x58cfa1['is']('element')&&_0x2b2085['match'](_0x58cfa1)&&(_0x5c9b1c['push'](_0x58cfa1),'h1'==_0x58cfa1['name']&&(_0x3e0183=!0x0));if(_0x3e0183){for(const _0x27dfe1 of _0x5c9b1c)_0x589d0e['rename']('h'+(parseInt(_0x27dfe1['name'][0x1])+0x1),_0x27dfe1);}}['_isH1TagSupportEnabled'](){const {data:_0x2f9243,editing:_0x21028e}=this['editor'],_0x73c7d4=_0x2f9243['htmlProcessor']['toView']('<h1></h1>'),_0x4699ad=_0x2f9243['toView'](_0x2f9243['toModel'](_0x73c7d4));return!!_0x21028e['view']['domConverter']['viewToDom'](_0x4699ad)['querySelector']('h1');}['_sanitizeHTML'](_0x4bca07){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x4bca07),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0xd9aa5c){const _0x2b1263=_0xd9aa5c['trim']();return _0x2b1263['startsWith']('```html')?_0x2b1263['endsWith']('```')?_0x2b1263['substring'](0x7,_0x2b1263['length']-0x3):_0x2b1263['substring'](0x7):_0xd9aa5c;}}const M={'REPLACE':'replace','INSERT':'insert'};class lt extends at{constructor(_0x503cf5){super(_0x503cf5),this['set']('isVisible',!0x1),this['set']('mainAction',M['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x362414=>i(_0x503cf5,'AI_'+_0x362414['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](i(_0x503cf5,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](i(_0x503cf5,'Try\x20again')),this['stopButton']=this['_createButton'](i(_0x503cf5,'Stop'));const _0x4e1d5b=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x4e1d5b['if']('isVisible','ck-hidden',_0x2f4f1e=>!_0x2f4f1e)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x325e6b,_0x1b09e4){const _0x3120fd=new _0x414664(this['locale']);return _0x3120fd['set']({'label':_0x325e6b,'class':_0x1b09e4||'','isVisible':!0x0,'withText':!0x0}),_0x3120fd;}}class Y extends _0xed2d89{['contentFieldView'];['copyButtonView'];constructor(_0x1f0f49,_0x4b6843=''){super(_0x1f0f49),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0xffb155=this['bindTemplate'];this['contentFieldView']=new At(_0x1f0f49,_0x4b6843),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0xffb155['if']('isVisible','ck-hidden',_0x4ec644=>!_0x4ec644)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0xffb155['if']('isProcessing','ck-ai-form__content-area--processing')]},'children':[this['contentFieldView'],{'tag':'div','attributes':{'class':['ck','ck-ai-form__copy-button-wrapper']},'children':[this['copyButtonView']]}]}]});}['render'](){super['render'](),this['value']&&this['contentFieldView']['setContent'](this['value']);let _0x4ae060=!0x1;this['on']('change:value',(_0x3bee11,_0x171e6a,_0x56b246)=>{const _0x5cedd2=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x56b246),this['isProcessing']&&_0x5cedd2&&!_0x4ae060&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x5e6037,_0x41295c,_0x2f6277)=>{_0x4ae060=!0x1,_0x2f6277?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x4ae060=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x4ae060=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x3dfffe=this['locale'],_0x520b93=new _0x414664(this['locale']),_0x35546f='ck-ai-form__copy-button';return _0x520b93['set']({'label':i(_0x3dfffe,'Copy'),'icon':_0x1b86e2,'class':_0x35546f,'tooltip':!0x0}),_0x520b93['bind']('isVisible')['to'](this,'value',_0x22de26=>!!_0x22de26),_0x520b93['bind']('isEnabled')['to'](this,'isProcessing',_0x5ed9b3=>!_0x5ed9b3),_0x520b93['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x520b93['icon']=_0x26ebd9,_0x520b93['class']=_0x35546f+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x520b93['icon']=_0x1b86e2,_0x520b93['class']=_0x35546f;},0x3e8);}),_0x520b93;}['_copyHTMLToClipboard'](_0x131d5a){const {window:_0x37ef42,document:_0x401c61}=_0x423cb8;if(_0x37ef42['ClipboardItem']){const {Blob:_0x17dbb8,ClipboardItem:_0xc30cfa}=_0x37ef42,_0x41fcbf=[new _0xc30cfa({'text/html':new _0x17dbb8([_0x131d5a['innerHTML']],{'type':'text/html'}),'text/plain':new _0x17dbb8([_0x131d5a['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x41fcbf);}else{const _0x1d865a=_0x401c61['createElement']('div');_0x1d865a['style']['position']='absolute',_0x1d865a['style']['left']='-9999px',_0x1d865a['innerHTML']='<span>[</span>'+_0x131d5a['innerHTML']+'<span>]</span>',_0x401c61['body']['appendChild'](_0x1d865a);const _0x410e53=_0x401c61['createRange']();_0x410e53['setStartAfter'](_0x1d865a['firstElementChild']),_0x410e53['setEndBefore'](_0x1d865a['lastElementChild']);const _0x78dd31=_0x37ef42['getSelection']();_0x78dd31['removeAllRanges'](),_0x78dd31['addRange'](_0x410e53),_0x401c61['execCommand']('copy'),_0x1d865a['remove']();}}}class At extends _0xed2d89{constructor(_0xea9684,_0x579401=''){super(_0xea9684),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x579401,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x1dedf7){this['element']['innerHTML']=_0x1dedf7;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x1504e1=new _0xed2d89(),_0x5b02bc=this['locale'],_0x25fe32=new _0x2edc7a();return _0x25fe32['isVisible']=!0x0,_0x1504e1['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x25fe32,{'text':i(_0x5b02bc,'AI\x20is\x20writing...')}]}),_0x1504e1['render'](),_0x1504e1;}}class st extends _0xed2d89{constructor(_0x1a20e1,_0xdaf6cf=''){super(_0x1a20e1);const _0x2edddf=new rt(),_0x307990=this['bindTemplate'];this['set']('text',_0xdaf6cf),_0x2edddf['content']=tt,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x2edddf,{'text':_0x307990['to']('text')}]});}}class ct extends nt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x12729b,_0x22306d){super(_0x12729b,_0x22306d),this['queryView']['fieldView']['minRows']=0x1,this['queryView']['fieldView']['maxRows']=0x3,this['submitButtonView']=this['_createSubmitButton'](),this['showHistoryButtonView']=this['_createShowHistoryButton'](),this['focusableChildren']['add'](this['showHistoryButtonView'],0x1),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['showHistoryButtonView']),this['children']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x2aca06,_0x411908)=>{_0x2aca06['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x411908());});}['_createSubmitButton'](){const _0x5b4c36=new _0x414664(this['locale']),_0x5274af=this['locale'];return _0x5b4c36['set']({'icon':ht,'label':i(_0x5274af,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x5b4c36['on']('execute',()=>{this['submit']();}),_0x5b4c36['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x2d84dc,_0x3abbba)=>!_0x2d84dc&&_0x3abbba),_0x5b4c36;}['_createShowHistoryButton'](){const _0x722c76=new _0x414664(this['locale']),_0x375915=this['resultsView'],_0x3a53d9=this['locale'];_0x722c76['set']({'label':i(_0x3a53d9,'History'),'withText':!0x1,'icon':et,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x722c76['bind']('isOn')['to'](_0x375915,'isVisible'),_0x722c76['bind']('isEnabled')['to'](this,'isEnabled'),_0x722c76['on']('execute',()=>{_0x375915['isVisible']=!_0x375915['isVisible'],_0x375915['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x733fb=()=>{_0x423cb8['window']['requestAnimationFrame'](()=>{if(ot(this['element'])){const _0x31837c=new it(this['queryView']['fieldView']['element']),_0xdd71e=_0x31837c['width'],_0x124f3b='rtl'===_0x3a53d9['uiLanguageDirection']?'left':'right';_0x31837c['excludeScrollbarsAndBorders'](),_0x722c76['element']['style'][_0x124f3b]=_0xdd71e-_0x31837c['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x733fb),this['on']('render',_0x733fb),_0x722c76;}['submit'](){const _0x50e75a=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x50e75a);}['focus'](_0x4eebb3){-0x1===_0x4eebb3?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class ft extends Ct{['historyGroupView'];['clearHistoryButton'];constructor(_0x5d9c6c){super(_0x5d9c6c),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Ht(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=i(_0x5d9c6c,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x39f95d=0x0;for(const _0x1631e1 of this['items'])_0x39f95d+=_0x1631e1['items']['length'];return{'resultsCount':_0x39f95d,'totalItemsCount':_0x39f95d};}['_createClearHistoryButton'](){const _0x11ac79=this['locale'],_0xabdfe7=new _0x414664(this['locale']);return _0xabdfe7['set']({'label':'('+i(_0x11ac79,'Clear')+')','withText':!0x0}),_0xabdfe7['on']('execute',()=>this['fire']('clearHistory')),_0xabdfe7;}}class bt extends xt{constructor(_0x37e1e1){super();const _0x18b1c9=new kt(),_0x5b8599=new _0x414664(this['locale'],_0x18b1c9);this['children']['add'](_0x5b8599),_0x5b8599['set']({'label':_0x37e1e1['prompt'],'withText':!0x0}),_0x5b8599['on']('execute',()=>{this['fire']('execute',{'value':jt(_0x37e1e1['prompt'])});});}}const ts='CKEditor/AIFormView/PromptHistory';class wt extends _0x322a6d{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x4fc72f,_0x7f5d86)=>{const _0xb0a43=os(_0x7f5d86['prompt']);for(const _0x5f1aa2 of this)if(_0x5f1aa2!=_0x7f5d86&&os(_0x5f1aa2['prompt'])===_0xb0a43){this['remove'](_0x5f1aa2);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x203ae0=sessionStorage['getItem'](ts)||'[]';this['addMany'](JSON['parse'](_0x203ae0));}['_saveToSessionStorage'](){sessionStorage['setItem'](ts,JSON['stringify'](this['map'](_0x17279d=>_0x17279d)));}}function os(_0x3a5f45){return _0x3a5f45['toLowerCase']()['trim']();}class _ extends _0xed2d89{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x415945,_0x21964f,_0x5b1021=''){super(_0x415945),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',M['REPLACE']),this['_promptHistory']=new wt(),this['errorView']=new st(_0x415945),this['contentArea']=new Y(_0x415945,_0x5b1021),this['contentArea']['bind']('isProcessing')['to'](this),this['contentArea']['bind']('value')['to'](this),this['toolbar']=this['_createToolbar'](),this['toolbar']['bind']('mainAction')['to'](this),this['promptView']=this['_createPromptView'](),this['focusTracker']=new mt(),this['keystrokes']=new ut(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new pt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['focusCycler']['chain'](this['promptView']['focusCycler']),this['promptView']['queryView']['fieldView']['bind']('value')['to'](this,'prompt');const _0x5bd959=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x21964f],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x5bd959['if']('isError','ck-hidden',_0x30e881=>!_0x30e881)]},'children':[this['errorView']]},this['contentArea'],this['toolbar'],this['promptView']]}]});}['render'](){super['render'](),this['focusTracker']['add'](this['contentArea']['element']),this['focusTracker']['add'](this['contentArea']['copyButtonView']['element']),this['focusTracker']['add'](this['toolbar']['element']),this['focusTracker']['add'](this['promptView']['element']),this['keystrokes']['listenTo'](this['element']);}['focus'](_0x16de0e=0x1){-0x1===_0x16de0e?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['reset'](){this['prompt']='',this['value']='',this['isError']=!0x1,this['promptView']['reset'](),this['contentArea']['isVisible']=!0x1,this['toolbar']['isVisible']=!0x1;}['_createPromptView'](){const _0x194f5c=this['locale'],_0x5ec5ae=new ct(_0x194f5c,{'queryView':{'label':i(_0x194f5c,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':dt,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':i(_0x194f5c,'Empty\x20history'),'secondary':i(_0x194f5c,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x5ec5ae['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x7db5a,_0x1107e7)=>_0x7db5a&&!_0x1107e7),this['listenTo'](_0x5ec5ae,'submit',(_0x317ee5,_0x33c03c)=>{this['prompt']=_0x33c03c;const _0x44e0dc=yt(_0x33c03c);this['fire']('submitPrompt',_0x44e0dc),_0x33c03c['trim']()&&this['_promptHistory']['add']({'prompt':_0x44e0dc},0x0);},{'priority':'high'}),_0x5ec5ae;}['_createHistoryView'](){const _0x57e75a=new ft(this['locale']);return _0x57e75a['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](bt),_0x57e75a['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x57e75a;}['_createToolbar'](){const _0x330b90=new lt(this['locale']);return _0x330b90['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0xd7d4df,_0x2db41f,_0x477f10)=>_0xd7d4df&&!_0x2db41f&&!!_0x477f10),_0x330b90['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x330b90['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x267bc0,_0x3dc040,_0x16d598)=>_0x267bc0&&!_0x3dc040&&!!_0x16d598),_0x330b90['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x330b90['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x5ccc76,_0x2eb8e1)=>_0x5ccc76&&!_0x2eb8e1),_0x330b90['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x330b90['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x330b90['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x330b90;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x3c9ea1=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=i(_0x3c9ea1,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0xa0e6ce){const _0x229938=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0xa0e6ce||i(_0x229938,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const w=globalThis['DataTransfer'];class n extends _0x4fffd0{['licenseKey'];['_licenseKeyCheckInterval'];['_dialog'];['_formView'];['_aiAdapter'];['_aiAssistantController'];['_uiCssClasses']='';static get['pluginName'](){return'AIAssistantUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[_0x32f6fd,a,E,_0x140a1c];}constructor(_0x25cf7d){super(_0x25cf7d),_0x25cf7d['config']['define']('ai.aiAssistant.disabledElements',['media','rawHtml','tableOfContents']),_0x25cf7d['config']['define']('ai.aiAssistant.contentAreaCssClass',''),_0x25cf7d['config']['define']('ai.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x25cf7d['config']['get']('ai.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x8f2aec}=this;this['_aiAdapter']=_0x8f2aec['plugins']['get'](E),this['_dialog']=_0x8f2aec['plugins']['get'](_0x140a1c),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x5d6bc6=new j(_0x8f2aec,Array['from'](this['_commandDefinitions']['values']()));_0x8f2aec['commands']['add']('showAIAssistant',_0x5d6bc6),_0x8f2aec['ui']['componentFactory']['add']('aiCommands',_0x230726=>{const _0x295a24=_0x1281f6(_0x230726);return _0x295a24['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x295a24['buttonView']['set']({'label':i(_0x230726,'AI\x20Commands'),'icon':_0x543328,'tooltip':!0x0}),_0x295a24['on']('execute',_0x4c175c=>this['_onExecute'](_0x4c175c['source']['id'])),_0x4310c9(_0x295a24,_0x8f2aec['ui']['view']['body'],function(_0x40448f){const _0x5a9f1a=o(_0x40448f['config']['get']('ai.aiAssistant.commands'),_0x40448f['locale']),_0x34e1bc=U(_0x40448f,_0x5a9f1a)['filter'](_0x204699=>_0x204699['commands']['length']);if(0x1===_0x34e1bc['length'])return U(_0x40448f,_0x34e1bc[0x0]['commands'])['map'](_0x3a272e=>({'id':_0x3a272e['id'],'label':_0x3a272e['label']}));return _0x34e1bc['map'](_0x200750=>{const {groupId:_0x5169f9,groupLabel:_0x2d3f38,commands:_0x164981}=_0x200750,_0x4a6eca=U(_0x40448f,_0x164981)['map'](_0x3938bb=>({'id':_0x3938bb['id'],'label':_0x3938bb['label']}));return{'id':_0x5169f9,'menu':_0x2d3f38||_0x5169f9,'children':_0x4a6eca};});}(_0x8f2aec),{'ariaLabel':i(_0x230726,'AI\x20Commands')}),_0x295a24['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x5d6bc6['on']('change:enabledCommandsIds',_0x42fe01),_0x295a24['menuView']['once']('render',_0x42fe01),_0x295a24;function _0x42fe01(){_0x295a24['isEnabled']=_0x5d6bc6['enabledCommandsIds']['length']>0x0;for(const _0x111c8e of _0x295a24['menuView']['buttons'])_0x111c8e['isEnabled']=_0x5d6bc6['enabledCommandsIds']['includes'](_0x111c8e['id']);}}),_0x8f2aec['ui']['componentFactory']['add']('menuBar:aiCommands',_0xbcc80d=>{const _0x240200=new _0x3a1804(_0xbcc80d);_0x240200['buttonView']['set']({'label':i(_0xbcc80d,'AI\x20Commands'),'icon':_0x543328}),_0x240200['bind']('isEnabled')['to'](_0x5d6bc6,'enabledCommandsIds',_0x4366f9=>_0x4366f9['length']>0x0);const _0x4f41e1=o(_0x8f2aec['config']['get']('ai.aiAssistant.commands'),_0xbcc80d);return this['_populateMenuBarMenu'](_0x5d6bc6,_0x240200,_0x4f41e1,_0x594125=>this['_onExecute'](_0x594125)),_0x240200;}),_0x8f2aec['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x7becd0=this['_createAIAssistantUIButton'](_0x414664);return _0x7becd0['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x7becd0;}),_0x8f2aec['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x5848db=this['_createAIAssistantUIButton'](_0x18020d);return _0x5848db['set']({'role':'menuitemcheckbox'}),_0x5848db;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x293923=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x1d0f0a;for(const _0x339e18 in _0x293923){const _0x50a5d7=_0x339e18,_0x1cc3c0=_0x293923[_0x50a5d7];if('aiLicenseKeyValid'==_0x1cc3c0||'aiLicenseKeyInvalid'==_0x1cc3c0||'aiLicenseKeyExpired'==_0x1cc3c0||'aiLicenseKeyDomainLimit'==_0x1cc3c0||'aiLicenseKeyNotAllowed'==_0x1cc3c0||'aiLicenseKeyEvaluationLimit'==_0x1cc3c0||'aiLicenseKeyTrialLimit'==_0x1cc3c0||'aiLicenseKeyUsageLimit'==_0x1cc3c0){delete _0x293923[_0x50a5d7],_0x1d0f0a=_0x1cc3c0,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x1d0f0a&&_0x293923['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x1d0f0a&&_0x293923['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x1d0f0a&&_0x293923['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x1d0f0a&&_0x293923['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x1d0f0a&&_0x293923['_showLicenseError']('evaluationLimit'),'aiLicenseKeyTrialLimit'==_0x1d0f0a&&_0x293923['_showLicenseError']('trialLimit'),'aiLicenseKeyUsageLimit'==_0x1d0f0a&&_0x293923['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x1d8ac2='',_0x534864='',_0x5aaf9a='custom'){const _0x2b234f=this['editor'],_0x5c2b3e=_0x2b234f['editing']['view'],_0x382e46=_0x2b234f['plugins']['get'](a),_0x207367=_0x2b234f['plugins']['get'](_0x32f6fd);_0x382e46['showFakeVisualSelection']();const _0x4b6e1f=new w(),_0x58ade6=new ClipboardEvent('copy',{'clipboardData':_0x4b6e1f}),_0x48b74a=new _0x5d15b4(_0x4b6e1f),_0x163712=new _0x5bccf8(_0x5c2b3e,_0x58ade6,{'dataTransfer':_0x48b74a});_0x207367['_forceMarkersCopy']('comment',()=>{_0x5c2b3e['document']['fire']('copy',_0x163712);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new k(_0x2b234f,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x387065=_0x48b74a['getData']('text/html');const _0x538b52=_0x2b234f['model']['document']['selection'],_0x5ee738=Array['from'](_0x538b52['getRanges']());0x1===_0x5ee738['length']&&_0x5ee738[0x0]['isFlat']&&!_0x538b52['getSelectedElement']()&&''!==_0x387065['replace'](/ /g,'')['trim']()&&(_0x387065='<p>'+_0x387065+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x5aaf9a,'query':_0x1d8ac2,'htmlContent':_0x387065,'label':_0x534864,'mainActionLabel':M[_0x2b234f['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x4ad63b,'title':i(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':_0x389277['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x382e46['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x194b6f=new Map(),_0x44d2e8=o(this['editor']['config']['get']('ai.aiAssistant.commands'),this['editor']['locale']);for(const _0x1b9802 of _0x44d2e8)for(const _0x5d8dfd of _0x1b9802['commands'])_0x194b6f['set'](_0x5d8dfd['id'],{..._0x5d8dfd,'groupId':_0x1b9802['groupId'],'groupLabel':_0x1b9802['groupLabel']||_0x1b9802['groupId']});return _0x194b6f;}['_createAIAssistantUIButton'](_0x35aaf){const _0x43cd46=this['editor'],_0x53266a=_0x43cd46['commands']['get']('showAIAssistant'),_0x445f35=new _0x35aaf(_0x43cd46['locale']);return _0x445f35['set']({'label':i(_0x43cd46['locale'],'AI\x20Assistant'),'icon':_0x4ad63b,'isToggleable':!0x0}),_0x445f35['bind']('isEnabled')['to'](_0x53266a),_0x445f35['bind']('isOn')['to'](this['_dialog'],'id',_0x2d86b4=>'aiAssistant'===_0x2d86b4),this['listenTo'](_0x445f35,'execute',()=>{_0x445f35['isOn']?this['hideUI']():_0x53266a['execute']();}),_0x445f35;}['_initView'](){const _0x3bb0e8=this['editor']['plugins']['get'](a);this['_formView']=new _(this['editor']['locale'],this['_uiCssClasses'],this['editor']['config']['get']('ai.aiAssistant.contentAreaCssClass')),this['_formView']['on']('change:value',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['_formView']['promptView']['queryView']['fieldView']['on']('update',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['listenTo'](this['_formView'],'replaceContent',()=>{_0x3bb0e8['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x3bb0e8['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x10c73a,ui:{ariaLiveAnnouncer:_0xb737bf}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x2aae96,_0x21f8bb,_0x1c2b68)=>{const _0x231db0=this['_aiAssistantController']['currentContext'];_0x1c2b68?_0xb737bf['announce'](i(_0x10c73a,'AI\x20is\x20writing')):_0x231db0&&_0xb737bf['announce'](i(_0x10c73a,'Generated\x20content:\x20%0',_0x231db0),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x53b758,_0x28be18,_0x2788fd)=>{if(_0x2788fd){const _0x4aab0a=this['_formView']['errorView']['text'];_0xb737bf['announce'](i(_0x10c73a,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x4aab0a));}});}['_onExecute'](_0x45ae00){const _0x4c0595=this['_commandDefinitions']['get'](_0x45ae00),_0x5daceb=this['editor'],_0x493555=_0x5daceb['model']['document']['selection'],_0x1b710c=_0x5daceb['commands']['get']('showAIAssistant'),_0x1a061e=_0x5daceb['plugins']['get'](a),_0xfb40d7=''+(_0x4c0595['groupId']!==x?_0x4c0595['groupLabel']+':\x20':'')+_0x4c0595['label'];if(!0x1!==_0x4c0595['requiresContent']&&_0x493555['isCollapsed']){const _0x5b4070=_0x32ef55(_0x493555['getSelectedBlocks']())||_0x5daceb['model']['schema']['getLimitElement'](_0x493555);_0x5daceb['model']['change'](_0x5dcea0=>{_0x5dcea0['setSelection'](_0x5b4070,'in');});}_0x1a061e['showFakeVisualSelection'](),_0x1b710c['execute'](_0x4c0595['prompt'],_0xfb40d7,'command:'+_0x45ae00);}['_populateMenuBarMenu'](_0x47e3af,_0x15ac4f,_0x3d2b0e,_0x146b9c){const _0x889a71=this['editor'],_0x5aa12f=_0x889a71['locale'],_0xc3a7da=new _0x3c7fe7(_0x5aa12f),_0x23a7c7=U(_0x889a71,_0x3d2b0e)['filter'](_0x48558e=>_0x48558e['commands']['length']);0x1===_0x23a7c7['length']?this['_getMenuBarGroupButtons']({'command':_0x47e3af,'commands':_0x23a7c7[0x0]['commands'],'parentMenuView':_0x15ac4f,'onExecute':_0x146b9c})['forEach'](_0x249fd2=>_0xc3a7da['items']['add'](_0x249fd2)):_0x23a7c7['forEach'](({groupId:_0x506d4c,groupLabel:_0x28fdf4,commands:_0x10a237})=>{const _0x4e5a7e=new _0x4c88a3(_0x5aa12f,_0x15ac4f),_0x1b12cd=new _0x3a1804(_0x5aa12f),_0x2963e2=new _0x3c7fe7(_0x5aa12f),_0x5b5abb=this['_getMenuBarGroupButtons']({'command':_0x47e3af,'commands':_0x10a237,'parentMenuView':_0x1b12cd,'onExecute':_0x146b9c});_0x1b12cd['buttonView']['set']({'label':_0x28fdf4||_0x506d4c}),_0x1b12cd['delegate']('execute')['to'](_0x15ac4f),_0x2963e2['items']['addMany'](_0x5b5abb),_0x1b12cd['panelView']['children']['add'](_0x2963e2),_0x4e5a7e['children']['add'](_0x1b12cd),_0xc3a7da['items']['add'](_0x4e5a7e);}),_0x15ac4f['panelView']['children']['add'](_0xc3a7da);}['_getMenuBarGroupButtons']({command:_0x563259,commands:_0x310be5,parentMenuView:_0x21ab67,onExecute:_0x4ddebc}){const _0x2f691c=this['editor'],_0x8279f=_0x2f691c['locale'];return U(_0x2f691c,_0x310be5)['map'](_0x471575=>{const _0x34c58c=new _0x4c88a3(_0x8279f,_0x21ab67),_0x95f90=new _0x18020d(_0x8279f);return _0x95f90['set']({'label':_0x471575['label']}),_0x95f90['delegate']('execute')['to'](_0x21ab67),_0x95f90['on']('execute',()=>_0x4ddebc(_0x471575['id'])),_0x95f90['bind']('isEnabled')['to'](_0x563259,'enabledCommandsIds',_0x45d907=>_0x45d907['includes'](_0x471575['id'])),_0x34c58c['children']['add'](_0x95f90),_0x34c58c;});}}function B(_0x263308,_0x531396){return void 0x0!==_0x263308['order']&&void 0x0===_0x531396['order']?0x1:void 0x0===_0x263308['order']&&void 0x0!==_0x531396['order']?-0x1:void 0x0!==_0x263308['order']&&void 0x0!==_0x531396['order']?_0x263308['order']-_0x531396['order']:0x0;}function U(_0x3f8889,_0x3e171e){_0x3e171e['sort'](B);const _0x5ac7c4={},_0x5b8602=[];for(const _0x3e65ab of _0x3e171e)if(void 0x0!==_0x3e65ab['order']){if(_0x3e65ab['order']in _0x5ac7c4)throw new _0x4d42d7('ai-commands-config-order-collision',_0x3f8889,{'conflictingDefinitions':[_0x3e65ab,_0x5ac7c4[_0x3e65ab['order']]]});_0x5ac7c4[_0x3e65ab['order']]=_0x3e65ab,_0x5b8602['splice'](_0x3e65ab['order'],0x0,_0x3e65ab);}else _0x5b8602['push'](_0x3e65ab);return _0x5b8602;}class r extends _0x4fffd0{static get['requires'](){return[n,a];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x29f51a){super(_0x29f51a);const _0x2fb0ed=_0x29f51a['config'],_0x3c0150=_0x29f51a['locale'];_0x2fb0ed['define']('ai.aiAssistant.preserveComments',!0x0),_0x2fb0ed['define']('ai.aiAssistant.commands',function(_0x2a9f84){return[{'groupId':'editOrReview','groupLabel':i(_0x2a9f84,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':i(_0x2a9f84,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':i(_0x2a9f84,'Make\x20shorter'),'prompt':'Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.'},{'id':'makeLonger','label':i(_0x2a9f84,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':i(_0x2a9f84,'Simplify\x20language'),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':'generate','groupLabel':i(_0x2a9f84,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':i(_0x2a9f84,'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':'continue','label':i(_0x2a9f84,'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':i(_0x2a9f84,'Change\x20tone'),'commands':[{'id':'professional','label':i(_0x2a9f84,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':i(_0x2a9f84,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':i(_0x2a9f84,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':i(_0x2a9f84,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':i(_0x2a9f84,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':i(_0x2a9f84,'Change\x20style'),'commands':[{'id':'business','label':i(_0x2a9f84,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':i(_0x2a9f84,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':i(_0x2a9f84,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':i(_0x2a9f84,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':i(_0x2a9f84,'Translate'),'commands':[{'id':'translateEnglish','label':i(_0x2a9f84,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':i(_0x2a9f84,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':i(_0x2a9f84,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':i(_0x2a9f84,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':i(_0x2a9f84,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':i(_0x2a9f84,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':i(_0x2a9f84,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':i(_0x2a9f84,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}(_0x3c0150)),_0x2fb0ed['define']('ai.aiAssistant.extraCommandGroups',[]),_0x2fb0ed['define']('ai.aiAssistant.removeCommands',[]);let _0xc65019=o(_0x2fb0ed['get']('ai.aiAssistant.commands'),_0x3c0150);const _0x2abb7d=_0x2fb0ed['get']('ai.aiAssistant.extraCommandGroups'),_0x4d1f59=_0x2fb0ed['get']('ai.aiAssistant.removeCommands');_0x2abb7d['forEach'](_0x2b7011=>{const _0x1d26a3=_0xc65019['find'](_0x1593a9=>_0x1593a9['groupId']===_0x2b7011['groupId']);_0x1d26a3?_0x1d26a3['commands']=_0x1d26a3['commands']['concat'](_0x2b7011['commands']):_0xc65019['push'](_0x2b7011);}),_0xc65019=_0xc65019['filter'](_0xb44eb3=>!_0x4d1f59['includes'](_0xb44eb3['groupId'])),_0xc65019['forEach'](_0xe41915=>{_0xe41915['commands']=_0xe41915['commands']['filter'](_0x181cf7=>!_0x4d1f59['includes'](_0x181cf7['id']));}),_0x2fb0ed['set']('ai.aiAssistant.commands',_0xc65019);}}class P extends _0x4fffd0{['abortController'];static get['requires'](){return[E];}constructor(_0x53f665){super(_0x53f665),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](E)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x38b7ad){return this['sendRequest'](_0x38b7ad)['catch'](_0x50fbfd=>{if(_0x50fbfd instanceof R)return Promise['reject'](_0x50fbfd);if('AbortError'==_0x50fbfd['name'])return Promise['resolve']();throw console['error'](_0x50fbfd),new _0x4d42d7('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x38bef5,_0x28b5e5){const _0x5f0c84=this['editor']['locale'],_0x47f50d={'Content-Type':'application/json'};if('object'==typeof _0x38bef5)Object['assign'](_0x47f50d,_0x38bef5);else{if(_0x38bef5)try{const _0x43c3c7=await _0x38bef5(_0x28b5e5);Object['assign'](_0x47f50d,_0x43c3c7);}catch(_0x398594){return Promise['reject'](new R(i(_0x5f0c84,'AI_ERROR_GET_HEADERS')));}}return _0x47f50d;}async['_prepareRequestParameters'](_0x278218,_0x57aa4c){const _0x3148a6=this['editor']['locale'];if('object'==typeof _0x278218)return _0x278218;try{return await _0x278218(_0x57aa4c);}catch(_0x40e812){return Promise['reject'](new R(i(_0x3148a6,'AI_ERROR_GET_PARAMETERS')));}}}class O extends P{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x2f0b7c){super(_0x2f0b7c),_0x2f0b7c['config']['define']('ai.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x2f0b7c['config']['get']('ai.openAI.requestParameters')||_0x2f0b7c['config']['define']('ai.openAI.requestParameters',{'model':'gpt-3.5-turbo','max_tokens':0x7d0,'temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x2f0b7c['config']['get']('ai.openAI.apiUrl'),this['_requestHeaders']=_0x2f0b7c['config']['get']('ai.openAI.requestHeaders')||{},this['_requestParameters']=_0x2f0b7c['config']['get']('ai.openAI.requestParameters');}async['sendRequest']({query:_0x4220ce,context:_0x7a07ea,onData:_0x477309,actionId:_0x1885af}){const _0x486c3a=this['editor']['locale'],_0x1c47e1=await this['prepareMessages'](_0x4220ce,_0x7a07ea,_0x1885af),_0xfb30f9=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x1885af),_0x30848a=await this['_prepareRequestParameters'](this['_requestParameters'],_0x1885af),_0x4562fd={'messages':_0x1c47e1,..._0x30848a},_0x5671e9={'method':'POST','headers':_0xfb30f9,'body':JSON['stringify'](_0x4562fd),'signal':this['abortController']['signal']},_0x33f970=await fetch(this['_apiUrl'],_0x5671e9);if(_0x33f970['ok'])return _0x30848a['stream']?await this['_readStreamableResponse'](_0x33f970,_0x477309):await this['_readStaticResponse'](_0x33f970,_0x477309),Promise['resolve']();{const _0x811502=await _0x33f970['text']();return _0x811502['includes']('context_length_exceeded')?Promise['reject'](new R(i(_0x486c3a,'AI_ERROR_CONTEXT_LENGTH'))):_0x811502['includes']('Moderation')?Promise['reject'](new R(i(_0x486c3a,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x811502));}}async['prepareMessages'](_0x52ae76,_0x215c51,_0x145398){let _0xbce741,_0x5d271e;return _0x215c51?(_0xbce741='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.',_0x5d271e='Instruction:\x0a'+_0x52ae76+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x215c51):(_0xbce741='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.',_0x5d271e=_0x52ae76),[{'role':'system','content':_0xbce741},{'role':'user','content':_0x5d271e}];}async['_readStreamableResponse'](_0x53c302,_0x58e686){const _0x22a98f=_0x53c302['body']['getReader'](),_0x4bdb8b=new TextDecoder();let _0x9378e6='',_0x4e400b='',_0x4991f6='',_0x5d7b2f=!0x1;for(;!_0x5d7b2f;){const {done:_0x207097,value:_0x5d3c24}=await _0x22a98f['read'](),_0x26224=_0x9378e6+_0x4bdb8b['decode'](_0x5d3c24);let _0x273f01='';_0x5d7b2f=_0x207097;try{_0x273f01=this['_cleanUpData'](_0x26224),_0x9378e6='';}catch(_0x1b505b){_0x9378e6=_0x26224;continue;}_0x4e400b+=_0x273f01,!_0x5d7b2f&&this['_isBufferIncomplete'](_0x4e400b)||_0x4e400b&&(_0x4991f6+=_0x4e400b,_0x4e400b='',_0x58e686(_0x4991f6));}return Promise['resolve']();}async['_readStaticResponse'](_0x31a6d3,_0x239ea3){return _0x239ea3((await _0x31a6d3['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x379e8e){const _0x4a9dda=_0x379e8e['split']('<')['length']!==_0x379e8e['split']('>')['length'],_0x38be9d=_0x379e8e['length']<0x1e;return _0x4a9dda&&_0x38be9d;}['_cleanUpData'](_0x50063b){return _0x50063b['split'](/\n(?![^{]*\})/g)['map'](_0xb0b6a2=>_0xb0b6a2['replace']('data:\x20',''))['filter'](_0x10f0dc=>_0x10f0dc&&_0x10f0dc['length']>0x0&&'[DONE]'!==_0x10f0dc)['map'](_0xbcb545=>{const {choices:_0x532026}=JSON['parse'](_0xbcb545);if(_0x532026[0x0]?.['delta']?.['content'])return _0x532026[0x0]['delta']['content'];})['filter'](_0x4d1873=>_0x4d1873)['join']('');}}class D extends P{['_apiUrl'];['_requestHeaders'];['_bedrockClientConfig'];['_requestParameters'];static get['pluginName'](){return'AWSTextAdapter';}constructor(_0x103a16){super(_0x103a16),_0x103a16['config']['get']('ai.aws.requestParameters')||_0x103a16['config']['define']('ai.aws.requestParameters',{'model':'anthropic.claude-v2','max_tokens_to_sample':0x7d0,'temperature':0x1,'top_p':0x1,'top_k':0xfa,'anthropic_version':'bedrock-2023-05-31','stream':!0x0}),this['_apiUrl']=_0x103a16['config']['get']('ai.aws.apiUrl'),this['_bedrockClientConfig']=_0x103a16['config']['get']('ai.aws.bedrockClientConfig'),this['_requestHeaders']=_0x103a16['config']['get']('ai.aws.requestHeaders'),this['_requestParameters']=_0x103a16['config']['get']('ai.aws.requestParameters');}async['sendRequest']({query:_0x1f85bc,context:_0x3003a0,onData:_0x25e81a,actionId:_0x1227e2}){const {model:_0x4be61d,stream:_0x38cf85,..._0xb7bee2}=await this['_prepareRequestParameters'](this['_requestParameters'],_0x1227e2),_0x24502d={'prompt':await this['preparePrompt'](_0x1f85bc,_0x3003a0,_0x4be61d,_0x1227e2),..._0xb7bee2};this['_apiUrl']?await this['_processProxyRequest'](_0x24502d,_0x4be61d,_0x38cf85,_0x25e81a,_0x1227e2):await this['_processAWSRequest'](_0x24502d,_0x4be61d,_0x38cf85,_0x25e81a);}async['preparePrompt'](_0x3e4b3a,_0x3ec028,_0xc02547,_0x30a7db){let _0x571ad3,_0x5942ce;return _0x3ec028?(_0x571ad3='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.',_0x5942ce='Instruction:\x0a'+_0x3e4b3a+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x3ec028):(_0x571ad3='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.',_0x5942ce=_0x3e4b3a),'meta.llama'==this['getModelFamily'](_0xc02547)?'<<SYS>>\x0a'+_0x571ad3+'\x0a<</SYS>>\x0a[INST]\x0a'+_0x5942ce+'\x0a[/INST]':'Human:\x0a'+_0x571ad3+'\x0a'+_0x5942ce+'\x0a\x0aAssistant:';}['getModelFamily'](_0xa9a0cb){if(/^anthropic\.claude/['test'](_0xa9a0cb))return'anthropic.claude';if(/^ai21\.j2/['test'](_0xa9a0cb))return'ai21.j2';if(/^cohere\.command/['test'](_0xa9a0cb))return'cohere.command';if(/^meta\.llama/['test'](_0xa9a0cb))return'meta.llama';throw new R(i(this['editor']['locale'],'AI_ERROR_UNSUPPORTED_MODEL',_0xa9a0cb));}async['_processProxyRequest'](_0x10624e,_0x3ecb93,_0xd41df2,_0x19a63f,_0x4d7f38){const _0x41d21d={'method':'POST','headers':await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x4d7f38),'body':JSON['stringify']({..._0x10624e,'model':_0x3ecb93,'stream':_0xd41df2}),'signal':this['abortController']['signal']},_0x5307c7=await fetch(this['_apiUrl'],_0x41d21d);_0xd41df2?await this['_readStreamableResponse'](_0x5307c7,_0x3ecb93,_0x19a63f):await this['_readStaticResponse'](_0x5307c7,_0x3ecb93,_0x19a63f);}async['_processAWSRequest'](_0x127f0e,_0x48ce7a,_0x1ee6fc,_0x5c440e){const _0xb06e9a=new _0x25c513(this['_bedrockClientConfig']),_0x11f1ff={'body':JSON['stringify'](_0x127f0e),'contentType':'application/json','accept':'application/json','modelId':_0x48ce7a};let _0x3d1d0e;if(_0x1ee6fc){const _0x558da7=new _0x2feee8(_0x11f1ff);_0x3d1d0e=await _0xb06e9a['send'](_0x558da7,{'abortSignal':this['abortController']['signal']}),await this['_readAsyncIterableResponse'](_0x3d1d0e,_0x48ce7a,_0x5c440e);}else{const _0x26f0c7=new _0x189ee2(_0x11f1ff);_0x3d1d0e=await _0xb06e9a['send'](_0x26f0c7,{'abortSignal':this['abortController']['signal']}),await this['_readStaticResponse'](_0x3d1d0e,_0x48ce7a,_0x5c440e);}}async['_readAsyncIterableResponse'](_0x3eb312,_0xe2ac0a,_0x3b77c6){const _0x13e1c1=_0x3eb312['body'],_0x22efe7=new TextDecoder('utf-8');let _0x9115dd='';for await(const _0x4ec5ee of _0x13e1c1)if(_0x4ec5ee['chunk']){const _0x22d959=_0x22efe7['decode'](_0x4ec5ee['chunk']['bytes']),_0x5006c3=JSON['parse'](_0x22d959);_0x9115dd+=this['_getGeneratedText'](_0x5006c3,_0xe2ac0a),_0x3b77c6(_0x9115dd);}return Promise['resolve']();}async['_readStreamableResponse'](_0xd0badb,_0x14d4bb,_0x5a8169){const _0x4dc66f=_0xd0badb['body'],_0xd49a63=new TextDecoder('utf-8'),_0x10205b=_0x4dc66f['getReader']();let _0x5c44ee='',_0x6c3ec3='',_0x1ac917=!0x1;for(;!_0x1ac917;){const {done:_0x5d0493,value:_0xe9075e}=await _0x10205b['read']();if(_0x1ac917=_0x5d0493,_0x1ac917)break;const _0x4d09b7=(_0x5c44ee+_0xd49a63['decode'](_0xe9075e))['split']('\x0a')['map'](_0x3d5422=>{try{return _0x5c44ee='',JSON['parse'](_0x3d5422);}catch(_0x15d3f1){return _0x5c44ee=_0x3d5422,null;}})['filter'](_0x487ef6=>null!==_0x487ef6);_0x4d09b7['length']&&(_0x6c3ec3+=_0x4d09b7['map'](_0x33ea69=>this['_getGeneratedText'](_0x33ea69,_0x14d4bb))['join'](''),_0x5a8169(_0x6c3ec3));}return Promise['resolve']();}async['_readStaticResponse'](_0xe84c8b,_0x3cb1dd,_0x3362f0){let _0x3f7e3e;return _0x3f7e3e=_0xe84c8b instanceof Response?await _0xe84c8b['json']():JSON['parse'](Buffer['from'](_0xe84c8b['body'])['toString']('utf8')),(_0x3362f0(this['_getGeneratedText'](_0x3f7e3e,_0x3cb1dd)),Promise['resolve']());}['_getGeneratedText'](_0x2f52d5,_0x12b49e){switch(this['getModelFamily'](_0x12b49e)){case'anthropic.claude':return _0x2f52d5['completion'];case'ai21.j2':return _0x2f52d5['completions'][0x0]['data']['text'];case'cohere.command':return _0x2f52d5['generations'][0x0]['text'];case'meta.llama':return _0x2f52d5['generation'];}}}export{E as AIAdapter,r as AIAssistant,n as AIAssistantUI,R as AIRequestError,P as AITextAdapter,D as AWSTextAdapter,O as OpenAITextAdapter};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-ai",
|
|
3
|
-
"version": "45.0.0-alpha.
|
|
3
|
+
"version": "45.0.0-alpha.4",
|
|
4
4
|
"description": "AI Assistant feature for CKEditor 5.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@aws-sdk/client-bedrock-runtime": "3.621.0",
|
|
27
|
-
"@ckeditor/ckeditor5-clipboard": "45.0.0-alpha.
|
|
28
|
-
"@ckeditor/ckeditor5-core": "45.0.0-alpha.
|
|
29
|
-
"@ckeditor/ckeditor5-engine": "45.0.0-alpha.
|
|
30
|
-
"@ckeditor/ckeditor5-icons": "45.0.0-alpha.
|
|
31
|
-
"@ckeditor/ckeditor5-table": "45.0.0-alpha.
|
|
32
|
-
"@ckeditor/ckeditor5-ui": "45.0.0-alpha.
|
|
33
|
-
"@ckeditor/ckeditor5-utils": "45.0.0-alpha.
|
|
34
|
-
"ckeditor5": "45.0.0-alpha.
|
|
27
|
+
"@ckeditor/ckeditor5-clipboard": "45.0.0-alpha.4",
|
|
28
|
+
"@ckeditor/ckeditor5-core": "45.0.0-alpha.4",
|
|
29
|
+
"@ckeditor/ckeditor5-engine": "45.0.0-alpha.4",
|
|
30
|
+
"@ckeditor/ckeditor5-icons": "45.0.0-alpha.4",
|
|
31
|
+
"@ckeditor/ckeditor5-table": "45.0.0-alpha.4",
|
|
32
|
+
"@ckeditor/ckeditor5-ui": "45.0.0-alpha.4",
|
|
33
|
+
"@ckeditor/ckeditor5-utils": "45.0.0-alpha.4",
|
|
34
|
+
"ckeditor5": "45.0.0-alpha.4",
|
|
35
35
|
"es-toolkit": "1.32.0"
|
|
36
36
|
},
|
|
37
37
|
"type": "module",
|