UNPKG

ckeditor5-premium-features

Version:

Premium features for CKEditor 5.

24 lines • 3.98 MB
/* * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved. * * * * * +---------------------------------------------------------------------------------+ * | | * | Hello stranger! | * | | * | | * | What you're currently looking at is the source code of a legally protected, | * | proprietary software. Any attempts to deobfuscate / disassemble this code | * | are forbidden and will result in legal consequences. | * | | * | | * +---------------------------------------------------------------------------------+ * * * * */ import{Plugin,Command as _0x319a28,ContextPlugin,Editor,PendingActions,Context as Context$1,ElementApiMixin}from'ckeditor5';import{uid,CKEditorError,ObservableMixin,global as _0x2148c2,isVisible,Rect,Collection,FocusTracker,KeystrokeHandler,first,diff as _0x3d1d40,priorities,scrollViewportToShowTarget,getEnvKeystrokeText,toUnit,DomEmitterMixin,keyCodes,diffToChanges,scrollAncestorsToShowTarget,collectStylesheets,createElement,logWarning,logError,ResizeObserver as _0x510fa7,env,version as _0xd10597,ElementReplacer,formatHtml,insertToPriorityArray,toArray as toArray$1,getAncestors}from'ckeditor5';import{ToolbarView,ButtonView,View,SpinnerView,IconView,AutocompleteView,ListView,ListItemGroupView,ListItemView,ButtonLabelView,FocusCycler,createLabeledTextarea,Dialog,createDropdown,addMenuToDropdown,MenuBarMenuView,MenuBarMenuListItemButtonView,DialogViewPosition,MenuBarMenuListView,MenuBarMenuListItemView,addListToDropdown,UIModel,DropdownButtonView,isViewWithFocusCycler,EditorUIView,InlineEditableUIView,EditorUI,ViewCollection,focusChildOnDropdownOpen,BodyCollection,BalloonPanelView,ContextualBalloon,Notification,SplitButtonView,FileDialogButtonView,MenuBarMenuListItemFileDialogButtonView,addKeyboardHandlingForGrid,CollapsibleView,LabeledFieldView,createLabeledInputNumber,filterGroupAndItemNames,SearchTextView,LabelWithHighlightView,ButtonLabelWithHighlightView,InputNumberView,LabelView,clickOutsideHandler,CssTransitionDisablerMixin,submitHandler,createLabeledInputText,ToolbarSeparatorView,normalizeToolbarConfig,BoxedEditorUIView,StickyPanelView,HighlightedTextView,normalizeColorOptions,ListSeparatorView}from'ckeditor5';import{IconCopy,IconCheck,IconError,IconSubmit,IconHistory,IconMagicWand,IconRobotPencil,IconCaseChange,IconNotification,IconCancel,IconUndo,IconPencil,IconRemoveComment,IconThreeVerticalDots,IconAddComment,IconCommentsArchive,IconTableOfContents,IconExportPdf,IconExportWord,IconPaintRoller,IconImportWord,IconLineHeight,IconMultiLevelList,IconWarning,IconInsertMergeField,IconPreviewMergeFields,IconArrowDown,IconArrowUp,IconChevronUp,IconChevronDown,IconUser,IconQuote,IconBulletedList,IconCodeBlock,IconBrowseFiles,IconEmoji,IconHeading1,IconHeading2,IconHeading3,IconHeading4,IconHeading5,IconHeading6,IconHorizontalLine,IconHtml,IconIndent,IconTable,IconNumberedList,IconOutdent,IconParagraph,IconTodoList,IconPlay,IconSource,IconTemplateGeneric,IconTemplate,IconTrackChanges,IconOneDrive,IconGooglePhotos,IconGoogleDrive,IconFacebook,IconDropbox,IconUploadcareLink,IconUploadcareImageUpload,IconUploadcareImageEdit}from'ckeditor5';import{ViewDocumentDomEventData,ViewDataTransfer,ViewUpcastWriter,Matcher,disableViewPlaceholder,enableViewPlaceholder,MouseObserver,ModelText,ModelTreeWalker,StylesMap,addMarginStylesRules,addPaddingStylesRules,ClickObserver,ModelRange,isPercentageStyleValue,ViewDocument,ViewDomConverter,ModelLiveRange,History,NoOperation,InsertOperation,MarkerOperation,RootAttributeOperation,transformOperationSets,OperationFactory,ViewContainerElement,ViewAttributeElement,ViewEmptyElement,ViewRawElement,ViewUIElement,ViewDocumentFragment,ViewText,ViewElement,ModelElement,ModelPosition,ModelDocumentFragment,ModelLivePosition,ViewDowncastWriter}from'ckeditor5';import{ClipboardPipeline,ClipboardMarkersUtils,Clipboard}from'ckeditor5';import{Enter,ShiftEnter}from'ckeditor5';import{SelectAll}from'ckeditor5';import{Typing,Delete,Input}from'ckeditor5';import{Undo}from'ckeditor5';import{Paragraph}from'ckeditor5';import{toWidget,Widget,findOptimalInsertionRange,viewToModelPositionOutsideModelElement,setHighlightHandling}from'ckeditor5';import{PasteFromOfficeMSWordNormalizer,parsePasteOfficeHtml}from'ckeditor5';import{EmitterMixin,ObservableMixin as _0x59c840,priorities as priorities$1,global as _0x3971fd,Collection as Collection$1}from'ckeditor5';import{FileRepository}from'ckeditor5';const UNGROUPED_COMMANDS_GROUP_ID='_ungrouppedCommands';function normalizeCommandsConfig(_0x4e6a90,_0x33208e){const _0x27b1d4=(0x0,_0x33208e['t'])('Other');return _0x4e6a90['length']?'groupId'in _0x4e6a90[0x0]?_0x4e6a90:[{'groupId':UNGROUPED_COMMANDS_GROUP_ID,'groupLabel':_0x27b1d4,'order':0x1/0x0,'commands':_0x4e6a90}]:[{'groupId':UNGROUPED_COMMANDS_GROUP_ID,'groupLabel':_0x27b1d4,'order':0x1/0x0,'commands':[]}];}const DomDataTransfer$1=globalThis['DataTransfer'],VISUAL_SELECTION_MARKER_NAME='ai-ui';class AIAssistantEditing extends Plugin{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x4d8ff3}=this,_0x545366=['ck-fake-ai-selection'];_0x4d8ff3['config']['get']('ai.useTheme')&&_0x545366['push']('ck-ai-assistant-ui_theme'),_0x4d8ff3['conversion']['for']('editingDowncast')['markerToHighlight']({'model':VISUAL_SELECTION_MARKER_NAME,'view':{'classes':_0x545366,'priority':0xc}}),_0x4d8ff3['conversion']['for']('editingDowncast')['markerToElement']({'model':VISUAL_SELECTION_MARKER_NAME,'view':(_0x3fc496,{writer:_0x55de3a})=>{if(!_0x3fc496['markerRange']['isCollapsed'])return null;const _0x17825c=_0x55de3a['createUIElement']('span');return _0x55de3a['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x17825c),_0x17825c;}});}['afterInit'](){checkLicense$i(this);}['showFakeVisualSelection'](){const _0x331269=this['editor']['model'];_0x331269['change'](_0x5bb09a=>{const _0x268efc=_0x331269['document']['selection']['getRanges']();let _0x448510=0x0;for(const _0x288abc of _0x268efc){const _0x1c888c=VISUAL_SELECTION_MARKER_NAME+':'+_0x448510;if(_0x331269['markers']['has'](_0x1c888c))_0x5bb09a['updateMarker'](_0x1c888c,{'range':_0x288abc});else{if(_0x288abc['start']['isAtEnd']){const _0xf62cfc=_0x288abc['start']['getLastMatchingPosition'](({item:_0x5b2004})=>!_0x331269['schema']['isContent'](_0x5b2004),{'boundaries':_0x288abc});_0x5bb09a['addMarker'](_0x1c888c,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x5bb09a['createRange'](_0xf62cfc,_0x288abc['end'])});}else _0x5bb09a['addMarker'](_0x1c888c,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x288abc});}_0x448510++;}});}['hideFakeVisualSelection'](){const _0x534db1=this['editor']['model'],_0x2594a1=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](VISUAL_SELECTION_MARKER_NAME));_0x2594a1['length']&&_0x534db1['change'](_0x5335ea=>{_0x2594a1['forEach'](_0x46af50=>{_0x5335ea['removeMarker'](_0x46af50);});});}['insertContent'](_0x3b57b3,_0x5bbc84){const _0x691b61=this['_getAISelection'](),_0x175d6d=_0x5bbc84||_0x691b61['getFirstRange']();this['editor']['model']['canEditAt'](_0x175d6d)&&this['editor']['model']['change'](_0x281408=>{this['hideFakeVisualSelection'](),_0x5bbc84||this['_resetContentOfSelectedTableCells'](_0x281408,_0x691b61),this['_pasteHTMLUsingClipboard']({'insertAt':_0x175d6d,'writer':_0x281408,'html':_0x3b57b3});});}['insertContentBelow'](_0x13218c){const {model:_0x20ded0}=this['editor'],_0x1fe4bd=this['_getAISelection']();_0x20ded0['change'](()=>{const _0x3edeb4=this['_prepareTableInsertBelowPosition'](_0x13218c,_0x1fe4bd)||this['_getDefaultInsertBelowPosition'](_0x1fe4bd);this['insertContent'](_0x13218c,_0x3edeb4);});}['_getAISelection'](){const _0x2bc023=this['editor']['model'],_0x1ea1f2=Array['from'](_0x2bc023['markers']['getMarkersGroup'](VISUAL_SELECTION_MARKER_NAME))['map'](_0x4d703b=>_0x4d703b['getRange']());return _0x2bc023['createSelection'](_0x1ea1f2);}['_pasteHTMLUsingClipboard']({writer:_0x27ea9d,html:_0x5155c7,insertAt:_0x325e62}){const {view:_0x21ce81}=this['editor']['editing'],_0x445542=this['editor']['plugins']['get'](ClipboardPipeline),_0x2b257b=new DomDataTransfer$1();_0x2b257b['setData']('text/html',_0x5155c7);const _0x2c0eea=new ClipboardEvent('paste',{'clipboardData':_0x2b257b}),_0x284346=new ViewDocumentDomEventData(_0x21ce81,_0x2c0eea,{'dataTransfer':new ViewDataTransfer(_0x2b257b)});_0x27ea9d['setSelection'](_0x325e62);const _0x4877a9=(_0x54325a,_0x317df5)=>{_0x317df5['resultRange']&&_0x27ea9d['setSelection'](_0x317df5['resultRange']);};_0x445542['once']('contentInsertion',_0x4877a9,{'priority':'lowest'}),_0x21ce81['document']['fire']('paste',_0x284346),_0x445542['off']('contentInsertion',_0x4877a9);}['_getDefaultInsertBelowPosition'](_0x57b868){const {model:_0x238299}=this['editor'],_0x4dc8c5=Array['from'](_0x57b868['getSelectedBlocks']());return _0x4dc8c5['length']?_0x238299['createPositionAfter'](_0x4dc8c5['pop']()):_0x57b868['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x4479e0,_0x59885e){const {model:_0x3b3c17,plugins:_0x5090ce}=this['editor'];if(_0x5090ce['has']('TableUtils')){const _0x448e27=_0x5090ce['get']('TableUtils')['getSelectedTableCells'](_0x59885e);if(_0x448e27['length']){const _0x1f93ac=this['_getTableRowCountFromContent'](_0x4479e0),_0x16095c=this['_createEmptyTableRows'](_0x448e27,_0x1f93ac);return _0x3b3c17['createPositionAt'](_0x16095c,0x0);}}return null;}['_getTableRowCountFromContent'](_0x1bca9e){const _0x4f3082=this['editor']['plugins']['get']('TableUtils'),_0x364ab3=this['editor']['data']['parse'](_0x1bca9e),_0x29880e=Array['from'](_0x364ab3['getChildren']())['filter'](_0x249595=>_0x249595['is']('element','table'));let _0x1a8fad=0x0;return _0x29880e['forEach'](_0x25c216=>{_0x1a8fad+=_0x4f3082['getRows'](_0x25c216);}),_0x1a8fad;}['_createEmptyTableRows'](_0x473b2a,_0x1827c4){const _0x31632e=this['editor']['plugins']['get']('TableUtils'),_0x1370b3=_0x31632e['getRowIndexes'](_0x473b2a),_0x4f7621=_0x31632e['getColumnIndexes'](_0x473b2a),_0x4bdd02=_0x1370b3['last']+0x1,_0x1d96d5=_0x4f7621['first'],_0xefe6b5=_0x473b2a[0x0]['findAncestor']('table');for(let _0x2ff475=0x0;_0x2ff475<_0x1827c4;_0x2ff475++)_0x31632e['insertRows'](_0xefe6b5,{'at':_0x4bdd02});return _0xefe6b5['getChild'](_0x4bdd02)['getChild'](_0x1d96d5);}['_resetContentOfSelectedTableCells'](_0x20986d,_0x1ebdfb){const {plugins:_0x3256b3}=this['editor'],{model:_0x36d035}=_0x20986d;if(!_0x3256b3['has']('TableUtils'))return;_0x3256b3['get']('TableUtils')['getSelectedTableCells'](_0x1ebdfb)['length']&&_0x36d035['deleteContent'](_0x1ebdfb);}}async function checkLicense$i(_0x37c6f7){const _0x9f5d32=_0x353e79([0x4f,0x76,0x52,0x58,0x77,0x4e,0x64,0x79,0x67,0x36,0x37,0x35,0x30,0x49,0x70,0x5a,0x4b,0x6d,0x65,0x32,0x54,0x63,0x50,0x45,0x66,0x6e,0x6b,0x74,0x6f,0x78,0x38,0x72,0x4d,0x43,0x53,0x68,0x48,0x51,0x44,0x61,0x6c,0x57,0x71,0x7a,0x73,0x33,0x56,0x39,0x59,0x4c,0x62,0x69,0x41,0x4a,0x75,0x55,0x6a,0x42,0x46,0x31,0x47,0x34]),_0x3693d4=window[_0x353e79([0x44,0x61,0x74,0x65])][_0x353e79([0x6e,0x6f,0x77])](),_0xc91a3b=_0x37c6f7[_0x353e79([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x2a77d2=new window[(_0x353e79([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x28a9ed=>{_0xc91a3b[_0x353e79([0x6f,0x6e,0x63,0x65])](_0x353e79([0x72,0x65,0x61,0x64,0x79]),_0x28a9ed);}),_0x22663d={[_0x353e79([0x6b,0x74,0x79])]:_0x353e79([0x45,0x43]),[_0x353e79([0x75,0x73,0x65])]:_0x353e79([0x73,0x69,0x67]),[_0x353e79([0x63,0x72,0x76])]:_0x353e79([0x50,0x2d,0x32,0x35,0x36]),[_0x353e79([0x78])]:_0x353e79([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]),[_0x353e79([0x79])]:_0x353e79([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]),[_0x353e79([0x61,0x6c,0x67])]:_0x353e79([0x45,0x53,0x32,0x35,0x36])},_0xf3bbe4=_0xc91a3b[_0x353e79([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x353e79([0x67,0x65,0x74])](_0x353e79([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])),_0x472718=await(async function(){let _0xf33f13,_0x1ceef6=null,_0x5819bd=null;try{if(_0xf3bbe4==_0x353e79([0x47,0x50,0x4c]))return _0x353e79([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0xf33f13=(function(){const _0x3d2025=_0xf3bbe4[_0x353e79([0x73,0x70,0x6c,0x69,0x74])](_0x353e79([0x2e]));if(0x3!=_0x3d2025[_0x353e79([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;const _0x338c81=_0x3d2025[0x1];return _0x18371c(_0x338c81);function _0x18371c(_0xc01b90){const _0x590431=_0x726d96(_0xc01b90);return _0x590431&&_0x55c8d0()?_0x590431:null;function _0x55c8d0(){const _0x2ccf69=_0x590431[_0x353e79([0x6a,0x74,0x69])],_0x3e6bf5=window[_0x353e79([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x2ccf69[_0x353e79([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x2ccf69[_0x353e79([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x181f3a={..._0x590431,[_0x353e79([0x6a,0x74,0x69])]:_0x2ccf69[_0x353e79([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x2ccf69[_0x353e79([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x181f3a[_0x353e79([0x76,0x63])],_0x5a31e3(_0x181f3a)==_0x3e6bf5;}}}()),!_0xf33f13)return _0x353e79([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);_0xf33f13[_0x353e79([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x5819bd=function(_0x4b0169,_0xeb6a94){return new window[(_0x353e79([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x237174=>{if(_0xb4d684())return _0x237174(_0x353e79([0x56,0x61,0x6c,0x69,0x64]));_0x4d407d(),_0xc91a3b[_0x353e79([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x353e79([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x1c49b9=!0x1;const _0x2e5d3c=uid();function _0x243093(_0x178b74){return!!_0x178b74&&(typeof _0x178b74===_0x353e79([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x178b74===_0x353e79([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x178b74[_0x353e79([0x74,0x68,0x65,0x6e])]===_0x353e79([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x178b74[_0x353e79([0x63,0x61,0x74,0x63,0x68])]===_0x353e79([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x4b576e(_0x7cda5d){_0x53cc1f(_0x7cda5d)[_0x353e79([0x74,0x68,0x65,0x6e])](_0x3e1b4a=>{if(!_0x3e1b4a||_0x3e1b4a[_0x353e79([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x353e79([0x6f,0x6b]))return _0x353e79([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x47a1d0(_0x5a31e3(_0x2e5d3c+_0xeb6a94))!=_0x3e1b4a[_0x353e79([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x353e79([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x353e79([0x56,0x61,0x6c,0x69,0x64]);})[_0x353e79([0x74,0x68,0x65,0x6e])](_0x13f2c0=>(_0xad7bfb(),_0x13f2c0),()=>{const _0x41d5c4=_0x2a7d4e();return null==_0x41d5c4?(_0xad7bfb(),_0x353e79([0x56,0x61,0x6c,0x69,0x64])):_0x353e79(_0x3693d4-_0x41d5c4>0x240c8400?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x353e79([0x74,0x68,0x65,0x6e])](_0x237174)[_0x353e79([0x63,0x61,0x74,0x63,0x68])](()=>{_0x237174(_0x353e79([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x197cb2=0x36ee80;function _0xad7bfb(){const _0x416d4c=_0x353e79([0x6c,0x6c,0x63,0x74,0x2d])+_0x47a1d0(_0x5a31e3(_0x4b0169)),_0x593161=_0x3306a6(_0x47a1d0(window[_0x353e79([0x4d,0x61,0x74,0x68])][_0x353e79([0x63,0x65,0x69,0x6c])](_0x3693d4/_0x197cb2)));window[_0x353e79([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x353e79([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x416d4c,_0x593161);}function _0x2a7d4e(){const _0x3320a4=_0x353e79([0x6c,0x6c,0x63,0x74,0x2d])+_0x47a1d0(_0x5a31e3(_0x4b0169)),_0x4d64df=window[_0x353e79([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x353e79([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x3320a4);return _0x4d64df?window[_0x353e79([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x3306a6(_0x4d64df),0x10)*_0x197cb2:null;}function _0x53cc1f(_0x10e8cb){return new window[(_0x353e79([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x423f76,_0x51c951)=>{_0x10e8cb[_0x353e79([0x74,0x68,0x65,0x6e])](_0x423f76,_0x51c951),window[_0x353e79([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x51c951,0x1d4c0);});}}_0xc91a3b[_0x353e79([0x6f,0x6e])](_0x353e79([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x99f7a,_0x118199)=>{if(_0x118199[0x0]!=_0x4b0169)return _0x237174(_0x353e79([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x118199[0x1]={..._0x118199[0x1],[_0x353e79([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x2e5d3c};},{[_0x353e79([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x353e79([0x68,0x69,0x67,0x68])}),_0xc91a3b[_0x353e79([0x6f,0x6e])](_0x353e79([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x169be2=>{_0x243093(_0x169be2[_0x353e79([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x1c49b9=!0x0,_0x4b576e(_0x169be2[_0x353e79([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x353e79([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x353e79([0x6c,0x6f,0x77])}),_0x2a77d2[_0x353e79([0x74,0x68,0x65,0x6e])](()=>{_0x1c49b9||_0x237174(_0x353e79([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0xb4d684(){return _0xc91a3b[_0x353e79([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x353e79([0x76,0x69,0x65,0x77])][_0x353e79([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x353e79([0x61,0x75,0x74,0x6f]);}function _0x4d407d(){_0xc91a3b[_0x353e79([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x353e79([0x76,0x69,0x65,0x77])][_0x353e79([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x353e79([0x61,0x75,0x74,0x6f]);}}(_0xf33f13[_0x353e79([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0xf33f13[_0x353e79([0x6a,0x74,0x69])]));const _0x5a1604=await(async function(){let _0x49c7e2=!0x0;try{const _0x5a41d5=_0xf3bbe4[_0x353e79([0x73,0x70,0x6c,0x69,0x74])](_0x353e79([0x2e])),[_0x374b8f,_0x56bfe8,_0x824af5]=_0x5a41d5;return _0x1081c6(_0x374b8f),await _0x243507(_0x374b8f,_0x56bfe8,_0x824af5),_0x49c7e2;}catch{return!0x1;}function _0x1081c6(_0x442abc){const _0x398890=_0x726d96(_0x442abc);_0x398890&&_0x398890[_0x353e79([0x61,0x6c,0x67])]==_0x353e79([0x45,0x53,0x32,0x35,0x36])||(_0x49c7e2=!0x1);}async function _0x243507(_0x1293c0,_0x4ca4da,_0x3cbe35){const _0x2c3026=window[_0x353e79([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x353e79([0x66,0x72,0x6f,0x6d])](_0x560246(_0x3cbe35),_0x61ee11=>_0x61ee11[_0x353e79([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0xac4352=new window[(_0x353e79([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x353e79([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x1293c0+_0x353e79([0x2e])+_0x4ca4da),_0x50e0b0=window[_0x353e79([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x353e79([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x50e0b0)return;const _0x549a3b=await _0x50e0b0[_0x353e79([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x353e79([0x6a,0x77,0x6b]),_0x22663d,{[_0x353e79([0x6e,0x61,0x6d,0x65])]:_0x353e79([0x45,0x43,0x44,0x53,0x41]),[_0x353e79([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x353e79([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x353e79([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x50e0b0[_0x353e79([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x353e79([0x6e,0x61,0x6d,0x65])]:_0x353e79([0x45,0x43,0x44,0x53,0x41]),[_0x353e79([0x68,0x61,0x73,0x68])]:{[_0x353e79([0x6e,0x61,0x6d,0x65])]:_0x353e79([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x549a3b,_0x2c3026,_0xac4352)||(_0x49c7e2=!0x1);}}());return _0x5a1604?(function(){const _0x18cbfc=_0xf33f13[_0x353e79([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];if(!_0x18cbfc)return!0x1;if(_0x18cbfc[_0x353e79([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x353e79([0x2a])))return!0x0;if(_0x18cbfc[_0x353e79([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x353e79([0x41,0x49])))return!0x0;return!0x1;}())?(function(){const _0x360bcd=[_0x353e79([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x353e79([0x74,0x72,0x69,0x61,0x6c])][_0x353e79([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0xf33f13[_0x353e79([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x3693d4/0x3e8:0x68993280;return _0xf33f13[_0x353e79([0x65,0x78,0x70])]<_0x360bcd;}())?_0x353e79([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):(function(){const _0x2b6c39=_0xf33f13[_0x353e79([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x2b6c39||0x0==_0x2b6c39[_0x353e79([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x340217}=new URL(window[_0x353e79([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x2b6c39[_0x353e79([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x340217))return!0x0;const _0x3d004f=_0x340217[_0x353e79([0x73,0x70,0x6c,0x69,0x74])](_0x353e79([0x2e]));return _0x2b6c39[_0x353e79([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x447e4f=>_0x447e4f[_0x353e79([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x353e79([0x2a])))[_0x353e79([0x6d,0x61,0x70])](_0x2a493b=>_0x2a493b[_0x353e79([0x73,0x70,0x6c,0x69,0x74])](_0x353e79([0x2e])))[_0x353e79([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x3e9a77=>_0x3e9a77[_0x353e79([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x3d004f[_0x353e79([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x353e79([0x6d,0x61,0x70])](_0x57264b=>Array(_0x3d004f[_0x353e79([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x57264b[_0x353e79([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x353e79([0x66,0x69,0x6c,0x6c])](_0x57264b[0x0]===_0x353e79([0x2a])?_0x353e79([0x2a]):'')[_0x353e79([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x57264b))[_0x353e79([0x73,0x6f,0x6d,0x65])](_0xf8d101=>_0x3d004f[_0x353e79([0x65,0x76,0x65,0x72,0x79])]((_0x490ca4,_0x2a0f9a)=>_0xf8d101[_0x2a0f9a]===_0x490ca4||_0xf8d101[_0x2a0f9a]===_0x353e79([0x2a])));}())?(_0xf33f13[_0x353e79([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x353e79([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x1ceef6=_0xdc9eba(_0x353e79([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),_0xf33f13[_0x353e79([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x353e79([0x74,0x72,0x69,0x61,0x6c])&&(_0x1ceef6=_0xdc9eba(_0x353e79([0x54,0x72,0x69,0x61,0x6c,0x4c,0x69,0x6d,0x69,0x74]))),await(function(){if(_0x1ceef6&&_0x5819bd)return new window[(_0x353e79([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x710e3d,_0x1c3be4)=>{_0x1ceef6[_0x353e79([0x74,0x68,0x65,0x6e])](_0x710e3d,_0x1c3be4),_0x5819bd[_0x353e79([0x74,0x68,0x65,0x6e])](_0x8d4937=>{_0x8d4937!=_0x353e79([0x56,0x61,0x6c,0x69,0x64])&&_0x710e3d(_0x8d4937);},_0x1c3be4);});return _0x1ceef6||_0x5819bd||_0x353e79([0x56,0x61,0x6c,0x69,0x64]);}())):_0x353e79([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x353e79([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x353e79([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x353e79([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}}());function _0xdc9eba(_0x1b897a){const _0x9843e6=[new window[(_0x353e79([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x30d049=>setTimeout(_0x30d049,0x93ecc)),_0x2a77d2[_0x353e79([0x74,0x68,0x65,0x6e])](()=>new window[(_0x353e79([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x1f9f31=>{let _0x428c8a=0x0;_0xc91a3b[_0x353e79([0x6d,0x6f,0x64,0x65,0x6c])][_0x353e79([0x6f,0x6e])](_0x353e79([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x36efa3,_0x55a142)=>{_0x55a142[0x0][_0x353e79([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x428c8a++,0x1f8==_0x428c8a&&(_0x1f9f31(),_0x36efa3[_0x353e79([0x6f,0x66,0x66])]());});}))];return window[_0x353e79([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x353e79([0x72,0x61,0x63,0x65])](_0x9843e6)[_0x353e79([0x74,0x68,0x65,0x6e])](()=>_0x1b897a);}function _0x726d96(_0x59d7a7){return _0x59d7a7[_0x353e79([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x353e79([0x65,0x79]))?JSON[_0x353e79([0x70,0x61,0x72,0x73,0x65])](_0x560246(_0x59d7a7)):null;}function _0x560246(_0x1219eb){return window[_0x353e79([0x61,0x74,0x6f,0x62])](_0x1219eb[_0x353e79([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x353e79([0x2b]))[_0x353e79([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x353e79([0x2f])));}function _0x5a31e3(_0x9ac193){let _0x4cebfb=0x1505;function _0x4be087(_0x306751){for(let _0x55246f=0x0;_0x55246f<_0x306751[_0x353e79([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x55246f++){const _0x2ee581=_0x306751[_0x353e79([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x55246f);_0x4cebfb=(_0x4cebfb<<0x5)+_0x4cebfb+_0x2ee581,_0x4cebfb&=_0x4cebfb;}}return function _0x717af2(_0x3d6546){Array[_0x353e79([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x3d6546)?_0x3d6546[_0x353e79([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x717af2):_0x3d6546&&typeof _0x3d6546==_0x353e79([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x353e79([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x3d6546)[_0x353e79([0x73,0x6f,0x72,0x74])]()[_0x353e79([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x1d6d81,_0x4dea6e])=>{_0x4be087(_0x1d6d81),_0x717af2(_0x4dea6e);}):_0x4be087(window[_0x353e79([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x3d6546));}(_0x9ac193),_0x4cebfb>>>0x0;}function _0x47a1d0(_0x267439){return _0x267439[_0x353e79([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x353e79([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x353e79([0x30]));}function _0x3306a6(_0x113cb7){return _0x113cb7[_0x353e79([0x73,0x70,0x6c,0x69,0x74])]('')[_0x353e79([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x353e79([0x6a,0x6f,0x69,0x6e])]('');}function _0x53756f(){}function _0x353e79(_0x9c49fe){return _0x9c49fe['map'](_0x9bb1e3=>String['fromCharCode'](_0x9bb1e3))['join']('');}!function(_0x22ba7a){const _0x52e42d=(function(){const _0x114b99=window[_0x353e79([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x353e79([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x353e79([0x6e,0x6f,0x77])]())[_0x353e79([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x353e79([0x2e]),'');let _0x4d6e50=_0x353e79([0x4f]);for(let _0x823aef=0x0;_0x823aef<_0x114b99[_0x353e79([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x823aef+=0x2){let _0x354409=window[_0x353e79([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x114b99[_0x353e79([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x823aef,_0x823aef+0x2));_0x354409>=_0x9f5d32[_0x353e79([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x354409-=_0x9f5d32[_0x353e79([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x4d6e50+=_0x9f5d32[_0x354409];}return _0x4d6e50;}());_0xc91a3b[_0x52e42d]=_0x353e79([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x22ba7a,_0x22ba7a!=_0x353e79([0x56,0x61,0x6c,0x69,0x64])&&(async function(){await _0x2a77d2,_0xc91a3b[_0x353e79([0x6d,0x6f,0x64,0x65,0x6c])][_0x353e79([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x53756f,_0xc91a3b[_0x353e79([0x6d,0x6f,0x64,0x65,0x6c])][_0x353e79([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x53756f,_0xc91a3b[_0x353e79([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x353e79([0x6d,0x6f,0x64,0x65,0x6c]));}());}(_0x472718);}class AIAdapter extends Plugin{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new CKEditorError('aiadapter-text-adapter-not-set',null);}}class AIRequestError extends Error{constructor(_0x2867e6){super(_0x2867e6),this['name']='AIRequestError';}}function getTranslation$i(_0x1ee735,_0x6038c2,_0x304808){const t=_0x1ee735['t'];switch(_0x6038c2){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',_0x304808);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x304808);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'},_0x304808);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 _0x6038c2;}}class ShowAIAssistantCommand extends _0x319a28{['_commandDefinitions'];constructor(_0x29c7c9,_0x32f623){super(_0x29c7c9),this['_commandDefinitions']=_0x32f623,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x3ee9b7,_0x2ab294,_0x5a9af4)=>{this['isEnabled']&&(this['enabledCommandsIds']=_getEnabledCommands(this['_commandDefinitions'],_0x5a9af4));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x5a46e2,_0x5d53bf,_0x204544)=>{this['enabledCommandsIds']=_0x204544?_getEnabledCommands(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x3f0393=this['editor']['model'];this['_hasContext']=_isContextAvailable(_0x3f0393);const _0x43de53=_0x3f0393['document']['selection'],_0x5bd7ab=this['editor']['config']['get']('ai.aiAssistant.disabledElements');for(const _0xc062e9 of _0x43de53['getRanges']())for(const _0x1644c2 of _0xc062e9['getItems']())if(_0x1644c2['is']('element')&&_0x5bd7ab['includes'](_0x1644c2['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x5e5a8b='',_0x2f6c4d='',_0x332008='custom'){this['editor']['plugins']['get'](AIAssistantUI)['showUI'](_0x5e5a8b,_0x2f6c4d,_0x332008);}}function _isContextAvailable(_0x27a00e){const _0x161258=_0x27a00e['document']['selection'];return _0x161258['isCollapsed']?0x0!==[..._0x161258['getSelectedBlocks']()]['length']&&![..._0x161258['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x27a00e['hasContent'](_0x161258['getFirstRange']());}function _getEnabledCommands(_0x371d61,_0x1f784c){const _0x500983=new Set();for(const _0xd07198 of _0x371d61['values']())(_0x1f784c||!0x1===_0xd07198['requiresContent'])&&_0x500983['add'](_0xd07198['id']);return Array['from'](_0x500983);}const MIN_RESPONSE_LENGTH_TO_FIRST_HTML=0x64,ALL_UNTIL_FIRST_HTML_REGEX=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class AIAssistantController extends/* #__PURE__ -- @preserve */ ObservableMixin(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x43977c,_0x534985,_0x30d4ef){super(),this['editor']=_0x43977c,this['textAdapter']=_0x534985,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x30d4ef,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x4adbe6,_0x22b33c,_0x4ad99c)=>{this['view']['value']=this['_sanitizeHTML'](_0x4ad99c);}),this['listenTo'](this['view'],'submitPrompt',(_0x26fd88,_0x44ee1e)=>{const _0x1c7e40=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x44ee1e,_0x1c7e40,'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:_0x4c3c76,query:_0x4242bc,htmlContent:_0x30e3db,label:_0x5cb774,mainActionLabel:_0x3959e1}){this['view']['prompt']=_0x5cb774,this['view']['mainAction']=_0x3959e1,this['initialContext']=_0x30e3db,_0x4242bc&&(this['view']['isRendered']?this['_handleQuery'](_0x4242bc,_0x30e3db,_0x4c3c76,_0x5cb774):this['view']['once']('render',()=>{this['_handleQuery'](_0x4242bc,_0x30e3db,_0x4c3c76,_0x5cb774);}));}['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'](_0x3ecdfd,_0x5e447f,_0x5033e9,_0x1d99c6){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x5e447f,this['previousQuery']=_0x3ecdfd,this['previousLabel']=_0x1d99c6||_0x3ecdfd,this['previousActionId']=_0x5033e9,new Promise(_0x394b33=>{this['textAdapter']['makeRequest']({'query':_0x3ecdfd,'context':_0x5e447f,'onData':_0x38a355=>{this['currentResponse']=_0x38a355,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x5033e9})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x1e3a0e=>{_0x1e3a0e instanceof AIRequestError?this['view']['handleError'](_0x1e3a0e['message']):this['view']['handleError'](),_0x394b33();})['finally'](()=>{this['stopProcessing'](),_0x394b33();});});}['_parseAndNormalizeContent'](_0x487fc0,_0x32ecbb=!0x1){const _0x28a878=ALL_UNTIL_FIRST_HTML_REGEX['exec'](_0x487fc0);_0x487fc0=_0x28a878?_0x487fc0['substring'](_0x28a878[0x1]['length']):_0x487fc0['length']<MIN_RESPONSE_LENGTH_TO_FIRST_HTML&&!_0x32ecbb?'':this['_stripMarkdownSyntax'](_0x487fc0);const _0x47d8a5=this['_domParser']['parseFromString'](_0x487fc0,'text/html');if(_0x28a878){const _0x2eb12d=Array['from'](_0x47d8a5['body']['childNodes']);_0x2eb12d['reverse']();for(const _0x1fd7f2 of _0x2eb12d){if(_0x1fd7f2['nodeType']==Node['ELEMENT_NODE'])break;_0x1fd7f2['remove']();}}const _0x2e3dc2=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x47d8a5['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x2e3dc2);const _0x593e73=this['editor']['config']['get']('ai.aiAssistant.preserveComments'),_0x46bf5e=this['editor']['data']['toModel'](_0x2e3dc2);return _0x593e73||_0x46bf5e['markers']['clear'](),this['editor']['data']['stringify'](_0x46bf5e);}['_normalizeResponseHeadings'](_0x5c38a9){const _0x37594a=new ViewUpcastWriter(this['editor']['editing']['view']['document']),_0x23382e=new Matcher({'name':/^h[1-5]$/}),_0x5e9673=[];let _0x42c504=!0x1;for(const _0x27b175 of _0x5c38a9)_0x27b175['is']('element')&&_0x23382e['match'](_0x27b175)&&(_0x5e9673['push'](_0x27b175),'h1'==_0x27b175['name']&&(_0x42c504=!0x0));if(_0x42c504){for(const _0x7782f1 of _0x5e9673)_0x37594a['rename']('h'+(parseInt(_0x7782f1['name'][0x1])+0x1),_0x7782f1);}}['_isH1TagSupportEnabled'](){const {data:_0x1e233f,editing:_0x300954}=this['editor'],_0x455664=_0x1e233f['htmlProcessor']['toView']('<h1></h1>'),_0x1afa96=_0x1e233f['toView'](_0x1e233f['toModel'](_0x455664));return!!_0x300954['view']['domConverter']['viewToDom'](_0x1afa96)['querySelector']('h1');}['_sanitizeHTML'](_0x2cdff7){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x2cdff7),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x596900){const _0x1b4d9f=_0x596900['trim']();return _0x1b4d9f['startsWith']('```html')?_0x1b4d9f['endsWith']('```')?_0x1b4d9f['substring'](0x7,_0x1b4d9f['length']-0x3):_0x1b4d9f['substring'](0x7):_0x596900;}}const AIFormToolbarViewMainActionLabel={'REPLACE':'replace','INSERT':'insert'};class AIFormToolbarView extends ToolbarView{constructor(_0x1a197e){super(_0x1a197e),this['set']('isVisible',!0x1),this['set']('mainAction',AIFormToolbarViewMainActionLabel['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x42400d=>getTranslation$i(_0x1a197e,'AI_'+_0x42400d['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](getTranslation$i(_0x1a197e,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](getTranslation$i(_0x1a197e,'Try\x20again')),this['stopButton']=this['_createButton'](getTranslation$i(_0x1a197e,'Stop'));const _0x20bf8a=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x20bf8a['if']('isVisible','ck-hidden',_0x336d76=>!_0x336d76)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x26a439,_0x388753){const _0x1307af=new ButtonView(this['locale']);return _0x1307af['set']({'label':_0x26a439,'class':_0x388753||'','isVisible':!0x0,'withText':!0x0}),_0x1307af;}}class AIFormContentArea extends View{['contentFieldView'];['copyButtonView'];constructor(_0x454277,_0xf41d6c=''){super(_0x454277),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x405665=this['bindTemplate'];this['contentFieldView']=new ContentFieldView(_0x454277,_0xf41d6c),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x405665['if']('isVisible','ck-hidden',_0x4a71e0=>!_0x4a71e0)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x405665['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 _0x4c617c=!0x1;this['on']('change:value',(_0x556b9e,_0x5ea37a,_0x280871)=>{const _0x19f7cc=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x280871),this['isProcessing']&&_0x19f7cc&&!_0x4c617c&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x5601e0,_0x31f60b,_0x5d1caa)=>{_0x4c617c=!0x1,_0x5d1caa?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x4c617c=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x4c617c=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x201bf4=this['locale'],_0x5831a6=new ButtonView(this['locale']),_0x4b3914='ck-ai-form__copy-button';return _0x5831a6['set']({'label':getTranslation$i(_0x201bf4,'Copy'),'icon':IconCopy,'class':_0x4b3914,'tooltip':!0x0}),_0x5831a6['bind']('isVisible')['to'](this,'value',_0x5deed6=>!!_0x5deed6),_0x5831a6['bind']('isEnabled')['to'](this,'isProcessing',_0xc2702e=>!_0xc2702e),_0x5831a6['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x5831a6['icon']=IconCheck,_0x5831a6['class']=_0x4b3914+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x5831a6['icon']=IconCopy,_0x5831a6['class']=_0x4b3914;},0x3e8);}),_0x5831a6;}['_copyHTMLToClipboard'](_0x38e196){const {window:_0x48b89e,document:_0x3c3781}=_0x2148c2;if(_0x48b89e['ClipboardItem']){const {Blob:_0x2320d7,ClipboardItem:_0x3355b4}=_0x48b89e,_0x56bb28=[new _0x3355b4({'text/html':new _0x2320d7([_0x38e196['innerHTML']],{'type':'text/html'}),'text/plain':new _0x2320d7([_0x38e196['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x56bb28);}else{const _0x5da6cc=_0x3c3781['createElement']('div');_0x5da6cc['style']['position']='absolute',_0x5da6cc['style']['left']='-9999px',_0x5da6cc['innerHTML']='<span>[</span>'+_0x38e196['innerHTML']+'<span>]</span>',_0x3c3781['body']['appendChild'](_0x5da6cc);const _0x3c59a5=_0x3c3781['createRange']();_0x3c59a5['setStartAfter'](_0x5da6cc['firstElementChild']),_0x3c59a5['setEndBefore'](_0x5da6cc['lastElementChild']);const _0xdf679a=_0x48b89e['getSelection']();_0xdf679a['removeAllRanges'](),_0xdf679a['addRange'](_0x3c59a5),_0x3c3781['execCommand']('copy'),_0x5da6cc['remove']();}}}class ContentFieldView extends View{constructor(_0xa63344,_0x19be76=''){super(_0xa63344),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x19be76,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x550ce9){this['element']['innerHTML']=_0x550ce9;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x429369=new View(),_0x54eeca=this['locale'],_0x40d79b=new SpinnerView();return _0x40d79b['isVisible']=!0x0,_0x429369['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x40d79b,{'text':getTranslation$i(_0x54eeca,'AI\x20is\x20writing...')}]}),_0x429369['render'](),_0x429369;}}class AIFormErrorView extends View{constructor(_0x5382a5,_0x173e6c=''){super(_0x5382a5);const _0x501ef7=new IconView(),_0x106aaa=this['bindTemplate'];this['set']('text',_0x173e6c),_0x501ef7['content']=IconError,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x501ef7,{'text':_0x106aaa['to']('text')}]});}}class AIFormPromptView extends AutocompleteView{['submitButtonView'];['showHistoryButtonView'];constructor(_0x301b8c,_0x1fb2ab){super(_0x301b8c,_0x1fb2ab),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',(_0x507057,_0x19e31e)=>{_0x507057['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x19e31e());});}['_createSubmitButton'](){const _0x3d37f3=new ButtonView(this['locale']),_0x7947e0=this['locale'];return _0x3d37f3['set']({'icon':IconSubmit,'label':getTranslation$i(_0x7947e0,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x3d37f3['on']('execute',()=>{this['submit']();}),_0x3d37f3['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x494f3b,_0x53aaea)=>!_0x494f3b&&_0x53aaea),_0x3d37f3;}['_createShowHistoryButton'](){const _0xc9a754=new ButtonView(this['locale']),_0x3687a9=this['resultsView'],_0xc176f6=this['locale'];_0xc9a754['set']({'label':getTranslation$i(_0xc176f6,'History'),'withText':!0x1,'icon':IconHistory,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0xc9a754['bind']('isOn')['to'](_0x3687a9,'isVisible'),_0xc9a754['bind']('isEnabled')['to'](this,'isEnabled'),_0xc9a754['on']('execute',()=>{_0x3687a9['isVisible']=!_0x3687a9['isVisible'],_0x3687a9['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x11d9ae=()=>{_0x2148c2['window']['requestAnimationFrame'](()=>{if(isVisible(this['element'])){const _0x467610=new Rect(this['queryView']['fieldView']['element']),_0x14e83e=_0x467610['width'],_0xa3a824='rtl'===_0xc176f6['uiLanguageDirection']?'left':'right';_0x467610['excludeScrollbarsAndBorders'](),_0xc9a754['element']['style'][_0xa3a824]=_0x14e83e-_0x467610['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x11d9ae),this['on']('render',_0x11d9ae),_0xc9a754;}['submit'](){const _0x1578c8=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x1578c8);}['focus'](_0x37fb33){-0x1===_0x37fb33?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class AIHistoryListView extends ListView{['historyGroupView'];['clearHistoryButton'];constructor(_0x40c345){super(_0x40c345),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new ListItemGroupView(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=getTranslation$i(_0x40c345,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x2e4e1b=0x0;for(const _0x2f3de5 of this['items'])_0x2e4e1b+=_0x2f3de5['items']['length'];return{'resultsCount':_0x2e4e1b,'totalItemsCount':_0x2e4e1b};}['_createClearHistoryButton'](){const _0x511817=this['locale'],_0x37a70c=new ButtonView(this['locale']);return _0x37a70c['set']({'label':'('+getTranslation$i(_0x511817,'Clear')+')','withText':!0x0}),_0x37a70c['on']('execute',()=>this['fire']('clearHistory')),_0x37a70c;}}function isUnsafeProperty(_0x2a9075){return'__proto__'===_0x2a9075;}function isDeepKey(_0x5eb881){switch(typeof _0x5eb881){case'number':case'symbol':return!0x1;case'string':return _0x5eb881['includes']('.')||_0x5eb881['includes']('[')||_0x5eb881['includes'](']');}}function toKey(_0x5818e3){return'string'==typeof _0x5818e3||'symbol'==typeof _0x5818e3?_0x5818e3:Object['is'](_0x5818e3?.['valueOf']?.(),-0x0)?'-0':String(_0x5818e3);}function toPath(_0xc9008f){const _0x3d7044=[],_0x45a7ea=_0xc9008f['length'];if(0x0===_0x45a7ea)return _0x3d7044;let _0x218eff=0x0,_0x34bd0e='',_0x7e87a7='',_0x689b44=!0x1;for(0x2e===_0xc9008f['charCodeAt'](0x0)&&(_0x3d7044['push'](''),_0x218eff++);_0x218eff<_0x45a7ea;){const _0x48d93d=_0xc9008f[_0x218eff];_0x7e87a7?'\x5c'===_0x48d93d&&_0x218eff+0x1<_0x45a7ea?(_0x218eff++,_0x34bd0e+=_0xc9008f[_0x218eff]):_0x48d93d===_0x7e87a7?_0x7e87a7='':_0x34bd0e+=_0x48d93d:_0x689b44?'\x22'===_0x48d93d||'\x27'===_0x48d93d?_0x7e87a7=_0x48d93d:']'===_0x48d93d?(_0x689b44=!0x1,_0x3d7044['push'](_0x34bd0e),_0x34bd0e=''):_0x34bd0e+=_0x48d93d:'['===_0x48d93d?(_0x689b44=!0x0,_0x34bd0e&&(_0x3d7044['push'](_0x34bd0e),_0x34bd0e='')):'.'===_0x48d93d?_0x34bd0e&&(_0x3d7044['push'](_0x34bd0e),_0x34bd0e=''):_0x34bd0e+=_0x48d93d,_0x218eff++;}return _0x34bd0e&&_0x3d7044['push'](_0x34bd0e),_0x3d7044;}function get(_0x235b37,_0x1b90f5,_0x113081){if(null==_0x235b37)return _0x113081;switch(typeof _0x1b90f5){case'string':{if(isUnsafeProperty(_0x1b90f5))return _0x113081;const _0x25f36d=_0x235b37[_0x1b90f5];return void 0x0===_0x25f36d?isDeepKey(_0x1b90f5)?get(_0x235b37,toPath(_0x1b90f5),_0x113081):_0x113081:_0x25f36d;}case'number':case'symbol':{'number'==typeof _0x1b90f5&&(_0x1b90f5=toKey(_0x1b90f5));const _0x182834=_0x235b37[_0x1b90f5];return void 0x0===_0x182834?_0x113081:_0x182834;}default:{if(Array['isArray'](_0x1b90f5))return getWithPath(_0x235b37,_0x1b90f5,_0x113081);if(isUnsafeProperty(_0x1b90f5=Object['is'](_0x1b90f5?.['valueOf'](),-0x0)?'-0':String(_0x1b90f5)))return _0x113081;const _0x556282=_0x235b37[_0x1b90f5];return void 0x0===_0x556282?_0x113081:_0x556282;}}}function getWithPath(_0x2f548e,_0x575d73,_