@ckeditor/ckeditor5-ai
Version:
AI features for CKEditor 5.
24 lines • 523 kB
JavaScript
/*
* Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
*
*
*
*
* +---------------------------------------------------------------------------------+
* | |
* | Hello stranger! |
* | |
* | |
* | What you're currently looking at is the source code of a legally protected, |
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
* | are forbidden and will result in legal consequences. |
* | |
* | |
* +---------------------------------------------------------------------------------+
*
*
*
*
*/
import{Plugin as _0x3af82b,Command as Nt,ContextPlugin as _0x98dbd,Editor as st}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x27287b,IconCheck as _0x2de17e,IconError as _0x1816ee,IconSubmit as _0x1e29b0,IconAIHistory as Ht,IconMagicWand as _0x24def2,IconRobotPencil as _0x4ef002,IconMaximize as _0x55cfa0,IconMinimize as _0x139d5b,IconShowChangesOn as _0x4dbc0c,IconShowChangesOff as _0x5e1f3e,IconDocument as _0x39ea3c,IconThreeStars as _0x3cafa6,IconDocumentWithLoupe as _0x4127c1,IconAddComment as _0x3356f5,IconRemove as _0x1e43f9,IconDocumentWithCheckmark as _0xad8ca8,IconDocumentWithCross as _0x26f503,IconLoupe as _0x6ad2a8,IconCancel as _0x2ae09c,IconStop as _0x5eda7f,IconAIChat as Et,IconPlus as _0xa4afbd,IconPin as _0xf039b4,IconThreeHorizontalDots as _0x416014,IconChevronRight as _0x1aeb6a,IconInfo as _0x7b7d53,IconEye as _0x56577a,IconEyeCrossedOut as _0x443f0f,IconAIReview as _0x59a57b}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as _0xa215c8,CKEditorError as _0x38f49c,ObservableMixin as ts,global as _0xbe8f2c,isVisible as _0x5c2483,Rect as _0x4f725a,Collection as _0x381bb7,FocusTracker as _0x9668c0,KeystrokeHandler as _0x514fee,first as _0x15ebca,toArray as ta,EmitterMixin as _0x44d7d3,logWarning as _0x16f6f3,logError as ot,scrollViewportToShowTarget as nt,ResizeObserver as _0x4f1bc9,_isMotionReduced as It,scrollAncestorsToShowTarget as _0x5d0f2c,DomEmitterMixin as te}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as _0x19c936,ButtonView as _0x177962,View as _0x4dc179,SpinnerView as _0x1e6810,IconView as _0x4c8e3c,AutocompleteView as _0xb99b9a,ListView as _0x3c987b,ListItemGroupView as _0x1517bd,ListItemView as _0x2f4a78,ButtonLabelView as _0x310285,FocusCycler as _0x3c97a0,createLabeledTextarea as _0x175e45,Dialog as _0x2a84b1,createDropdown as _0x1353df,addMenuToDropdown as _0x593453,MenuBarMenuView as _0x2f50df,MenuBarMenuListItemButtonView as _0x3b859b,DialogViewPosition as _0x31ad8f,MenuBarMenuListView as _0x1595b4,MenuBarMenuListItemView as _0x4d7dd0,ViewCollection as _0x3b5cfc,UIModel as _0x3c44c5,SplitButtonView as _0x3230b3,BalloonPanelView as _0x4ce253,BodyCollection as Ft,clickOutsideHandler as _0x14a3d2,ListItemButtonView as _0x127b2f,addListToDropdown as _0x29fca4,submitHandler as _0x3727d9,LabeledFieldView as _0x1fb092,createLabeledInputText as th,FormHeaderView as _0x2f6d58,HighlightedTextView as _0x6f5af8,FileDialogButtonView as _0x57f591,InputTextView as _0x9c8d7d,SearchTextView as _0x8fc48f,DropdownMenuButtonView as _0x403066,DropdownMenuPanelPositioningFunctions as _0x65820d,BalloonToolbar as Wt,FormRowView as _0x23aba0,TextareaView as _0x1688b0}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0xb3be2c,ClipboardMarkersUtils as _0x469bef}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{ViewDocumentDomEventData as _0x37438d,ViewDataTransfer as _0x548f9e,ViewUpcastWriter as _0x4dac8d,Matcher as _0x2ee456,ViewDowncastWriter as kt,transformOperationSets as tt,_DetachOperation as _0x317ebf,_insertIntoModelNodeList as _0x417676,_removeFromModelNodeList as _0x36ed50,ModelRange as _0x24e098,ModelDocumentFragment as _0x384315,ModelPosition as _0x2e7abe,ModelTreeWalker as Zt,InsertOperation as $t,MarkerOperation as Xt}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as _0x4077b9,escape as _0x190095,escapeRegExp as _0x417822}from'es-toolkit/compat';import{BedrockRuntimeClient as _0x19ad9d,InvokeModelWithResponseStreamCommand as _0x339243,InvokeModelCommand as _0x573e5f}from'@aws-sdk/client-bedrock-runtime';import{createParser as wt}from'eventsource-parser';import{parseDocument as _0x4f034e}from'htmlparser2';import{isTag as _0x12fdee,findOne as ut,getParent as _0x1302ab,findAll as _0x190a2a,removeElement as _0x257fd3,replaceElement as _0x1105f8,prepend as _0x2d3ee2,prependChild as to,appendChild as _0x3bc0ec,append as _0x1d335e,find as _0x15c81d,isComment as _0x443cb2,getChildren as _0x52fbd6,textContent as _0x428b4a}from'domutils';import _0x5516a8 from'dom-serializer';import{Document as ft,Element as _0x5e1206,Text as _0x333321,cloneNode as _0x1198f3,isDocument as _0x29ce6c,isText as _0x1b24cc,NodeWithChildren as _0x20884a}from'domhandler';import{MarkdownGfmMdToHtml as _0x5f2ec9}from'@ckeditor/ckeditor5-markdown-gfm/dist/index.js';import{getAllMarkersDomElementsSorted as _0x5a76c8,DocumentCompare as _0x3e9353,DATA_ID_MODEL_ATTRIBUTE as lt}from'@ckeditor/ckeditor5-collaboration-core/dist/index.js';import{IconThumbUp as _0x2d0333,IconThumbDown as _0x4e03fb,IconCopy as _0x40876a,IconCheck as _0x16e06b,IconShowChangesOff as _0x5c0242,IconShowChangesOn as _0x26f228,IconWeb as _0x4204ab,IconNextArrow as _0x4e5de6,IconPreviousArrow as _0x7fbeea,IconAI as yt,IconClose as _0x225a15,IconSelection as _0xe2de8e,IconFileUpload as _0x45f76f,IconLink as _0x2bae8e,IconDocument as _0x406e24,IconBulb as _0x16556b,IconDocumentOutline as _0x3b950b,IconPaperClip as _0x3c265a,IconBrowseFiles as _0x570392,IconDropdownArrow as _0x341e07,IconAIAskAI as Ut,IconAIQuickActions as _0x159ea5,IconAIChatCommands as Kt,IconAIImproveWriting as Dt,IconAIContinueWriting as Mt,IconAIGrammarCheck as Lt,IconAIAdjustLength as Qt,IconAIChangeTone as bt,IconAITranslate as Gt,IconAIOther as Yt,IconRefresh as _0x44428b}from'@ckeditor/ckeditor5-icons/dist/index.js';import _0x5c39fc from'morphdom';import{ConfirmMixin as _0x5d5923,LateFocusDropdownButtonView as _0x149c0b,DocumentCompare as _0x2037b9,DATA_ID_VIEW_ATTRIBUTE as _0x5afbf6,DATA_ID_MODEL_ATTRIBUTE as _0xeaebf0}from'ckeditor5-collaboration/dist/index.js';import{diffArrays as _0x961e77}from'diff';const K='_ungrouppedCommands';function o(_0x2968c7,_0x50b72a){const _0x2a95b8=(0x0,_0x50b72a['t'])('Other');return _0x2968c7['length']?'groupId'in _0x2968c7[0x0]?_0x2968c7:[{'groupId':K,'groupLabel':_0x2a95b8,'order':0x1/0x0,'commands':_0x2968c7}]:[{'groupId':K,'groupLabel':_0x2a95b8,'order':0x1/0x0,'commands':[]}];}const $n=globalThis['DataTransfer'],f='ai-ui';class a extends _0x3af82b{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x3f38c3}=this,_0x279f37=['ck-fake-ai-selection'];_0x3f38c3['config']['get']('ai.assistant.useTheme')&&_0x279f37['push']('ck-ai-assistant-ui_theme'),_0x3f38c3['conversion']['for']('editingDowncast')['markerToHighlight']({'model':f,'view':{'classes':_0x279f37,'priority':0xc}}),_0x3f38c3['conversion']['for']('editingDowncast')['markerToElement']({'model':f,'view':(_0x526d4f,{writer:_0x4fc71c})=>{if(!_0x526d4f['markerRange']['isCollapsed'])return null;const _0x4ac993=_0x4fc71c['createUIElement']('span');return _0x4fc71c['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x4ac993),_0x4ac993;}});}['afterInit'](){!async function(_0x4c650a){const _0x9eded0=_0x5d02bc([0x6e,0x41,0x37,0x79,0x75,0x72,0x67,0x4f,0x48,0x62,0x5a,0x76,0x44,0x70,0x6c,0x52,0x6b,0x4a,0x73,0x63,0x64,0x49,0x43,0x6d,0x38,0x36,0x6f,0x50,0x57,0x78,0x39,0x32,0x66,0x31,0x71,0x46,0x30,0x4c,0x61,0x53,0x58,0x33,0x4e,0x47,0x77,0x54,0x4d,0x4b,0x34,0x6a,0x56,0x74,0x59,0x55,0x42,0x51,0x69,0x35,0x7a,0x68,0x65,0x45]),_0x4daac5=0x3dffc4e1,_0x58a0ec=0x3df8b2b9^_0x4daac5,_0x59f89c=window[_0x5d02bc([0x44,0x61,0x74,0x65])][_0x5d02bc([0x6e,0x6f,0x77])](),_0x55f63b=_0x4c650a[_0x5d02bc([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x5dfc03=new window[(_0x5d02bc([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x190bf6=>{_0x55f63b[_0x5d02bc([0x6f,0x6e,0x63,0x65])](_0x5d02bc([0x72,0x65,0x61,0x64,0x79]),_0x190bf6);}),_0x2f46f7={[_0x5d02bc([0x6b,0x74,0x79])]:_0x5d02bc([0x45,0x43]),[_0x5d02bc([0x75,0x73,0x65])]:_0x5d02bc([0x73,0x69,0x67]),[_0x5d02bc([0x63,0x72,0x76])]:_0x5d02bc([0x50,0x2d,0x32,0x35,0x36]),[_0x5d02bc([0x78])]:_0x5d02bc([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]),[_0x5d02bc([0x79])]:_0x5d02bc([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]),[_0x5d02bc([0x61,0x6c,0x67])]:_0x5d02bc([0x45,0x53,0x32,0x35,0x36])},_0x89bdee=_0x55f63b[_0x5d02bc([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x5d02bc([0x67,0x65,0x74])](_0x5d02bc([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x321850(){let _0x5a2f04,_0x40307b=null,_0x54efff=null;try{if(_0x89bdee==_0x5d02bc([0x47,0x50,0x4c]))return _0x5d02bc([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x5a2f04=_0x45508e(),!_0x5a2f04)return _0x5d02bc([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x5a2f04[_0x5d02bc([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x54efff=_0x6199f8(_0x5a2f04[_0x5d02bc([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x5a2f04[_0x5d02bc([0x6a,0x74,0x69])])),await _0x588bd2()?_0x249638()?_0xf9c877()?_0x5d02bc([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x1b0779()?(_0x5a2f04[_0x5d02bc([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x5d02bc([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x40307b=_0x2d68c9(_0x5d02bc([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),_0x5a2f04[_0x5d02bc([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x5d02bc([0x74,0x72,0x69,0x61,0x6c])&&(_0x40307b=_0x2d68c9(_0x5d02bc([0x54,0x72,0x69,0x61,0x6c,0x4c,0x69,0x6d,0x69,0x74]))),await _0x13b5f0()):_0x5d02bc([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x5d02bc([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x5d02bc([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x5d02bc([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0xf9c877(){const _0x46aac2=[_0x5d02bc([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x5d02bc([0x74,0x72,0x69,0x61,0x6c])][_0x5d02bc([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x5a2f04[_0x5d02bc([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x59f89c/0x3e8:0xe10*_0x58a0ec;return _0x5a2f04[_0x5d02bc([0x65,0x78,0x70])]<_0x46aac2;}function _0x249638(){const _0x2b2e50=_0x5a2f04[_0x5d02bc([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x2b2e50&&(!!_0x2b2e50[_0x5d02bc([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x5d02bc([0x2a]))||!!_0x2b2e50[_0x5d02bc([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x5d02bc([0x41,0x49])));}function _0x1b0779(){const _0x5abf9a=_0x5a2f04[_0x5d02bc([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x5abf9a||0x0==_0x5abf9a[_0x5d02bc([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x159733}=new URL(window[_0x5d02bc([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x5abf9a[_0x5d02bc([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x159733))return!0x0;const _0x47851a=_0x159733[_0x5d02bc([0x73,0x70,0x6c,0x69,0x74])](_0x5d02bc([0x2e]));return _0x5abf9a[_0x5d02bc([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x265272=>_0x265272[_0x5d02bc([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x5d02bc([0x2a])))[_0x5d02bc([0x6d,0x61,0x70])](_0x6a71e4=>_0x6a71e4[_0x5d02bc([0x73,0x70,0x6c,0x69,0x74])](_0x5d02bc([0x2e])))[_0x5d02bc([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x2f55a3=>_0x2f55a3[_0x5d02bc([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x47851a[_0x5d02bc([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x5d02bc([0x6d,0x61,0x70])](_0x41abc6=>Array(_0x47851a[_0x5d02bc([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x41abc6[_0x5d02bc([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x5d02bc([0x66,0x69,0x6c,0x6c])](_0x41abc6[0x0]===_0x5d02bc([0x2a])?_0x5d02bc([0x2a]):'')[_0x5d02bc([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x41abc6))[_0x5d02bc([0x73,0x6f,0x6d,0x65])](_0x3d6344=>_0x47851a[_0x5d02bc([0x65,0x76,0x65,0x72,0x79])]((_0x45cee0,_0x3c22ea)=>_0x3d6344[_0x3c22ea]===_0x45cee0||_0x3d6344[_0x3c22ea]===_0x5d02bc([0x2a])));}function _0x13b5f0(){return _0x40307b&&_0x54efff?new window[(_0x5d02bc([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x2d5223,_0x40f692)=>{_0x40307b[_0x5d02bc([0x74,0x68,0x65,0x6e])](_0x2d5223,_0x40f692),_0x54efff[_0x5d02bc([0x74,0x68,0x65,0x6e])](_0xdf16d9=>{_0xdf16d9!=_0x5d02bc([0x56,0x61,0x6c,0x69,0x64])&&_0x2d5223(_0xdf16d9);},_0x40f692);}):_0x40307b||_0x54efff||_0x5d02bc([0x56,0x61,0x6c,0x69,0x64]);}}function _0x6199f8(_0x4b7ee1,_0x3631e1){return new window[(_0x5d02bc([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0xb5e300=>{if(_0x194bba())return _0xb5e300(_0x5d02bc([0x56,0x61,0x6c,0x69,0x64]));_0x176648(),_0x55f63b[_0x5d02bc([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x5d02bc([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x4a0411=!0x1;const _0x398827=_0xa215c8();function _0xedf66c(_0x3af533){return!!_0x3af533&&(typeof _0x3af533===_0x5d02bc([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x3af533===_0x5d02bc([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x3af533[_0x5d02bc([0x74,0x68,0x65,0x6e])]===_0x5d02bc([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x3af533[_0x5d02bc([0x63,0x61,0x74,0x63,0x68])]===_0x5d02bc([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x321d8d(_0x45e903){_0x1e1188(_0x45e903)[_0x5d02bc([0x74,0x68,0x65,0x6e])](_0x571761=>{if(!_0x571761||_0x571761[_0x5d02bc([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x5d02bc([0x6f,0x6b]))return _0x5d02bc([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x5ace29(_0x15f67e(_0x398827+_0x3631e1))!=_0x571761[_0x5d02bc([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x5d02bc([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x5d02bc([0x56,0x61,0x6c,0x69,0x64]);})[_0x5d02bc([0x74,0x68,0x65,0x6e])](_0x2cc9e7=>(_0x88694f(),_0x2cc9e7),()=>{const _0x4101e5=_0x40cc3a();return null==_0x4101e5?(_0x88694f(),_0x5d02bc([0x56,0x61,0x6c,0x69,0x64])):_0x5d02bc(_0x59f89c-_0x4101e5>(0x19f340e1^_0x4daac5)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x5d02bc([0x74,0x68,0x65,0x6e])](_0xb5e300)[_0x5d02bc([0x63,0x61,0x74,0x63,0x68])](()=>{_0xb5e300(_0x5d02bc([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x14f075=0x3dc92a61^_0x4daac5;function _0x88694f(){const _0x4f0870=_0x5d02bc([0x6c,0x6c,0x63,0x74,0x2d])+_0x5ace29(_0x15f67e(_0x4b7ee1)),_0x40dc7e=_0x56ed4d(_0x5ace29(window[_0x5d02bc([0x4d,0x61,0x74,0x68])][_0x5d02bc([0x63,0x65,0x69,0x6c])](_0x59f89c/_0x14f075)));window[_0x5d02bc([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x5d02bc([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x4f0870,_0x40dc7e);}function _0x40cc3a(){const _0x5f3c5e=_0x5d02bc([0x6c,0x6c,0x63,0x74,0x2d])+_0x5ace29(_0x15f67e(_0x4b7ee1)),_0x1a8521=window[_0x5d02bc([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x5d02bc([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x5f3c5e);return _0x1a8521?window[_0x5d02bc([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x56ed4d(_0x1a8521),0x10)*_0x14f075:null;}function _0x1e1188(_0x2dfea8){return new window[(_0x5d02bc([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x467b7f,_0x5f1ce5)=>{_0x2dfea8[_0x5d02bc([0x74,0x68,0x65,0x6e])](_0x467b7f,_0x5f1ce5),window[_0x5d02bc([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x5f1ce5,0x3dfe1021^_0x4daac5);});}}_0x55f63b[_0x5d02bc([0x6f,0x6e])](_0x5d02bc([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x2e3e3b,_0x40f973)=>{if(_0x40f973[0x0]!=_0x4b7ee1)return _0xb5e300(_0x5d02bc([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x40f973[0x1]={..._0x40f973[0x1],[_0x5d02bc([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x398827};},{[_0x5d02bc([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x5d02bc([0x68,0x69,0x67,0x68])}),_0x55f63b[_0x5d02bc([0x6f,0x6e])](_0x5d02bc([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x3668f3=>{_0xedf66c(_0x3668f3[_0x5d02bc([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x4a0411=!0x0,_0x321d8d(_0x3668f3[_0x5d02bc([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x5d02bc([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x5d02bc([0x6c,0x6f,0x77])}),_0x5dfc03[_0x5d02bc([0x74,0x68,0x65,0x6e])](()=>{_0x4a0411||_0xb5e300(_0x5d02bc([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x194bba(){return _0x55f63b[_0x5d02bc([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x5d02bc([0x76,0x69,0x65,0x77])][_0x5d02bc([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x5d02bc([0x61,0x75,0x74,0x6f]);}function _0x176648(){_0x55f63b[_0x5d02bc([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x5d02bc([0x76,0x69,0x65,0x77])][_0x5d02bc([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x5d02bc([0x61,0x75,0x74,0x6f]);}}function _0x2d68c9(_0x1d152c){const _0x2230ca=[new window[(_0x5d02bc([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x39117c=>setTimeout(_0x39117c,0x3df6fa2d^_0x4daac5)),_0x5dfc03[_0x5d02bc([0x74,0x68,0x65,0x6e])](()=>new window[(_0x5d02bc([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x5f3315=>{let _0x33eb54=0x0;_0x55f63b[_0x5d02bc([0x6d,0x6f,0x64,0x65,0x6c])][_0x5d02bc([0x6f,0x6e])](_0x5d02bc([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x546003,_0x2a53f1)=>{_0x2a53f1[0x0][_0x5d02bc([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x33eb54++,_0x33eb54==(0x3dffc519^_0x4daac5)&&(_0x5f3315(),_0x546003[_0x5d02bc([0x6f,0x66,0x66])]());});}))];return window[_0x5d02bc([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x5d02bc([0x72,0x61,0x63,0x65])](_0x2230ca)[_0x5d02bc([0x74,0x68,0x65,0x6e])](()=>_0x1d152c);}async function _0x1ade43(){await _0x5dfc03,_0x55f63b[_0x5d02bc([0x6d,0x6f,0x64,0x65,0x6c])][_0x5d02bc([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x467a07,_0x55f63b[_0x5d02bc([0x6d,0x6f,0x64,0x65,0x6c])][_0x5d02bc([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x467a07,_0x55f63b[_0x5d02bc([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x5d02bc([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x518b04(_0x22080e){const _0x2422c4=_0x22d51f();_0x55f63b[_0x2422c4]=_0x5d02bc([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x22080e,_0x22080e!=_0x5d02bc([0x56,0x61,0x6c,0x69,0x64])&&_0x1ade43();}function _0x22d51f(){const _0x37effa=window[_0x5d02bc([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x5d02bc([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x5d02bc([0x6e,0x6f,0x77])]())[_0x5d02bc([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x5d02bc([0x2e]),'');let _0x159a09=_0x5d02bc([0x6e]);for(let _0x2a30f1=0x0;_0x2a30f1<_0x37effa[_0x5d02bc([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x2a30f1+=0x2){let _0x3b6149=window[_0x5d02bc([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x37effa[_0x5d02bc([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x2a30f1,_0x2a30f1+0x2));_0x3b6149>=_0x9eded0[_0x5d02bc([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x3b6149-=_0x9eded0[_0x5d02bc([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x159a09+=_0x9eded0[_0x3b6149];}return _0x159a09;}function _0x45508e(){const _0x26fa53=_0x89bdee[_0x5d02bc([0x73,0x70,0x6c,0x69,0x74])](_0x5d02bc([0x2e]));if(0x3!=_0x26fa53[_0x5d02bc([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x1d82a8(_0x26fa53[0x1]);function _0x1d82a8(_0x34b3a3){const _0x2d5a41=_0x2c03f3(_0x34b3a3);return _0x2d5a41&&_0x2b100e()?_0x2d5a41:null;function _0x2b100e(){const _0xe4cba4=_0x2d5a41[_0x5d02bc([0x6a,0x74,0x69])],_0x564a91=window[_0x5d02bc([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0xe4cba4[_0x5d02bc([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0xe4cba4[_0x5d02bc([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x20e6a4={..._0x2d5a41,[_0x5d02bc([0x6a,0x74,0x69])]:_0xe4cba4[_0x5d02bc([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0xe4cba4[_0x5d02bc([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x20e6a4[_0x5d02bc([0x76,0x63])],_0x15f67e(_0x20e6a4)==_0x564a91;}}}async function _0x588bd2(){let _0x3d3cef=!0x0;try{const _0x366d58=_0x89bdee[_0x5d02bc([0x73,0x70,0x6c,0x69,0x74])](_0x5d02bc([0x2e])),[_0x12e53e,_0xfe2711,_0x143601]=_0x366d58;return _0x376142(_0x12e53e),await _0x296f16(_0x12e53e,_0xfe2711,_0x143601),_0x3d3cef;}catch{return!0x1;}function _0x376142(_0xa970b5){const _0x2a8cd3=_0x2c03f3(_0xa970b5);_0x2a8cd3&&_0x2a8cd3[_0x5d02bc([0x61,0x6c,0x67])]==_0x5d02bc([0x45,0x53,0x32,0x35,0x36])||(_0x3d3cef=!0x1);}async function _0x296f16(_0x203a1e,_0x3d8393,_0x4985d){const _0x2dda22=window[_0x5d02bc([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x5d02bc([0x66,0x72,0x6f,0x6d])](_0x29e168(_0x4985d),_0x36c621=>_0x36c621[_0x5d02bc([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x50b674=new window[(_0x5d02bc([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x5d02bc([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x203a1e+_0x5d02bc([0x2e])+_0x3d8393),_0x4b9ada=window[_0x5d02bc([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x5d02bc([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x4b9ada)return;const _0x13db51=await _0x4b9ada[_0x5d02bc([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x5d02bc([0x6a,0x77,0x6b]),_0x2f46f7,{[_0x5d02bc([0x6e,0x61,0x6d,0x65])]:_0x5d02bc([0x45,0x43,0x44,0x53,0x41]),[_0x5d02bc([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x5d02bc([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x5d02bc([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x4b9ada[_0x5d02bc([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x5d02bc([0x6e,0x61,0x6d,0x65])]:_0x5d02bc([0x45,0x43,0x44,0x53,0x41]),[_0x5d02bc([0x68,0x61,0x73,0x68])]:{[_0x5d02bc([0x6e,0x61,0x6d,0x65])]:_0x5d02bc([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x13db51,_0x2dda22,_0x50b674)||(_0x3d3cef=!0x1);}}function _0x2c03f3(_0x15d5de){return _0x15d5de[_0x5d02bc([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x5d02bc([0x65,0x79]))?JSON[_0x5d02bc([0x70,0x61,0x72,0x73,0x65])](_0x29e168(_0x15d5de)):null;}function _0x29e168(_0x24d504){return window[_0x5d02bc([0x61,0x74,0x6f,0x62])](_0x24d504[_0x5d02bc([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x5d02bc([0x2b]))[_0x5d02bc([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x5d02bc([0x2f])));}function _0x15f67e(_0x557e88){let _0x1e7150=0x1505;function _0x235484(_0x10f6ef){for(let _0x479a13=0x0;_0x479a13<_0x10f6ef[_0x5d02bc([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x479a13++){const _0x24287b=_0x10f6ef[_0x5d02bc([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x479a13);_0x1e7150=(_0x1e7150<<0x5)+_0x1e7150+_0x24287b,_0x1e7150&=_0x1e7150;}}function _0x1157a3(_0x1425b7){Array[_0x5d02bc([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x1425b7)?_0x1425b7[_0x5d02bc([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x1157a3):_0x1425b7&&typeof _0x1425b7==_0x5d02bc([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x5d02bc([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x1425b7)[_0x5d02bc([0x73,0x6f,0x72,0x74])]()[_0x5d02bc([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x240971,_0x4dea49])=>{_0x235484(_0x240971),_0x1157a3(_0x4dea49);}):_0x235484(window[_0x5d02bc([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x1425b7));}return _0x1157a3(_0x557e88),_0x1e7150>>>0x0;}function _0x5ace29(_0x22de4c){return _0x22de4c[_0x5d02bc([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x5d02bc([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x5d02bc([0x30]));}function _0x56ed4d(_0x1b7e3f){return _0x1b7e3f[_0x5d02bc([0x73,0x70,0x6c,0x69,0x74])]('')[_0x5d02bc([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x5d02bc([0x6a,0x6f,0x69,0x6e])]('');}function _0x467a07(){}function _0x5d02bc(_0x3c349a){return _0x3c349a['map'](_0x4c10a8=>String['fromCharCode'](_0x4c10a8))['join']('');}_0x518b04(await _0x321850());}(this);}['showFakeVisualSelection'](){const _0x316588=this['editor']['model'];_0x316588['change'](_0x584233=>{const _0x5aa523=_0x316588['document']['selection']['getRanges']();let _0x33db73=0x0;for(const _0x78370f of _0x5aa523){const _0x54da92=f+':'+_0x33db73;if(_0x316588['markers']['has'](_0x54da92))_0x584233['updateMarker'](_0x54da92,{'range':_0x78370f});else{if(_0x78370f['start']['isAtEnd']){const _0xc959ca=_0x78370f['start']['getLastMatchingPosition'](({item:_0x434a88})=>!_0x316588['schema']['isContent'](_0x434a88),{'boundaries':_0x78370f});_0x584233['addMarker'](_0x54da92,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x584233['createRange'](_0xc959ca,_0x78370f['end'])});}else _0x584233['addMarker'](_0x54da92,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x78370f});}_0x33db73++;}});}['hideFakeVisualSelection'](){const _0x3d7150=this['editor']['model'],_0x64935a=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](f));_0x64935a['length']&&_0x3d7150['change'](_0x33027d=>{_0x64935a['forEach'](_0x14206a=>{_0x33027d['removeMarker'](_0x14206a);});});}['insertContent'](_0x526e7f,_0x7b1128){const _0x3e8a3d=this['_getAISelection'](),_0x5cb0a8=_0x7b1128||_0x3e8a3d['getFirstRange']();this['editor']['model']['canEditAt'](_0x5cb0a8)&&this['editor']['model']['change'](_0x221a4f=>{this['hideFakeVisualSelection'](),_0x7b1128||this['_resetContentOfSelectedTableCells'](_0x221a4f,_0x3e8a3d),this['_pasteHTMLUsingClipboard']({'insertAt':_0x5cb0a8,'writer':_0x221a4f,'html':_0x526e7f});});}['insertContentBelow'](_0x3e07f4){const {model:_0x2286e5}=this['editor'],_0x7d6e28=this['_getAISelection']();_0x2286e5['change'](()=>{const _0x4256ab=this['_prepareTableInsertBelowPosition'](_0x3e07f4,_0x7d6e28)||this['_getDefaultInsertBelowPosition'](_0x7d6e28);this['insertContent'](_0x3e07f4,_0x4256ab);});}['_getAISelection'](){const _0x1313ea=this['editor']['model'],_0x41cf3a=Array['from'](_0x1313ea['markers']['getMarkersGroup'](f))['map'](_0x5c0a77=>_0x5c0a77['getRange']());return _0x1313ea['createSelection'](_0x41cf3a);}['_pasteHTMLUsingClipboard']({writer:_0x18d906,html:_0x4d747f,insertAt:_0xaf6573}){const {view:_0x58795a}=this['editor']['editing'],_0x5306d5=this['editor']['plugins']['get'](_0xb3be2c),_0x3bac0b=new $n();_0x3bac0b['setData']('text/html',_0x4d747f);const _0x2febc1=new ClipboardEvent('paste',{'clipboardData':_0x3bac0b}),_0x24a753=new _0x37438d(_0x58795a,_0x2febc1,{'dataTransfer':new _0x548f9e(_0x3bac0b)});_0x18d906['setSelection'](_0xaf6573);const _0xf7b196=(_0x56b319,_0x4673d7)=>{_0x4673d7['resultRange']&&_0x18d906['setSelection'](_0x4673d7['resultRange']);};_0x5306d5['once']('contentInsertion',_0xf7b196,{'priority':'lowest'}),_0x58795a['document']['fire']('paste',_0x24a753),_0x5306d5['off']('contentInsertion',_0xf7b196);}['_getDefaultInsertBelowPosition'](_0x51e9c0){const {model:_0x33c431}=this['editor'],_0x2884d1=Array['from'](_0x51e9c0['getSelectedBlocks']());return _0x2884d1['length']?_0x33c431['createPositionAfter'](_0x2884d1['pop']()):_0x51e9c0['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x2910ac,_0x58b879){const {model:_0x5cef01,plugins:_0x222288}=this['editor'];if(_0x222288['has']('TableUtils')){const _0x13a4a3=_0x222288['get']('TableUtils')['getSelectedTableCells'](_0x58b879);if(_0x13a4a3['length']){const _0x49d0f9=this['_getTableRowCountFromContent'](_0x2910ac),_0x5c7cef=this['_createEmptyTableRows'](_0x13a4a3,_0x49d0f9);return _0x5cef01['createPositionAt'](_0x5c7cef,0x0);}}return null;}['_getTableRowCountFromContent'](_0x2791af){const _0x599d2b=this['editor']['plugins']['get']('TableUtils'),_0x523534=this['editor']['data']['parse'](_0x2791af),_0x1defad=Array['from'](_0x523534['getChildren']())['filter'](_0x569c25=>_0x569c25['is']('element','table'));let _0x8757fb=0x0;return _0x1defad['forEach'](_0x51a25e=>{_0x8757fb+=_0x599d2b['getRows'](_0x51a25e);}),_0x8757fb;}['_createEmptyTableRows'](_0x5392bb,_0x4c0ba1){const _0x4e793e=this['editor']['plugins']['get']('TableUtils'),_0x35a7ae=_0x4e793e['getRowIndexes'](_0x5392bb),_0x1db91a=_0x4e793e['getColumnIndexes'](_0x5392bb),_0x2d2ea7=_0x35a7ae['last']+0x1,_0x70b9d3=_0x1db91a['first'],_0x35b13c=_0x5392bb[0x0]['findAncestor']('table');for(let _0x5cde91=0x0;_0x5cde91<_0x4c0ba1;_0x5cde91++)_0x4e793e['insertRows'](_0x35b13c,{'at':_0x2d2ea7});return _0x35b13c['getChild'](_0x2d2ea7)['getChild'](_0x70b9d3);}['_resetContentOfSelectedTableCells'](_0x1d3f6e,_0x104fbd){const {plugins:_0x1822cf}=this['editor'],{model:_0x1f32ac}=_0x1d3f6e;if(!_0x1822cf['has']('TableUtils'))return;_0x1822cf['get']('TableUtils')['getSelectedTableCells'](_0x104fbd)['length']&&_0x1f32ac['deleteContent'](_0x104fbd);}}class x extends _0x3af82b{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new _0x38f49c('aiadapter-text-adapter-not-set',null);}}class tr extends Error{constructor(_0x4f87d2){super(_0x4f87d2),this['name']='AIRequestError';}}function qn(_0x326b58,_0x4a300c,_0x326af3){const t=_0x326b58['t'];switch(_0x4a300c){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',_0x326af3);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x326af3);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'},_0x326af3);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 _0x4a300c;}}class E extends Nt{['_commandDefinitions'];constructor(_0xb0d23f,_0x5bd05d){super(_0xb0d23f),this['_commandDefinitions']=_0x5bd05d,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x669cb2,_0x55d933,_0x3e6361)=>{this['isEnabled']&&(this['enabledCommandsIds']=ns(this['_commandDefinitions'],_0x3e6361));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x27afd3,_0x44ecdd,_0x108d0a)=>{this['enabledCommandsIds']=_0x108d0a?ns(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x36cdcb=this['editor']['model'];this['_hasContext']=function(_0x235095){const _0xe52aae=_0x235095['document']['selection'];return _0xe52aae['isCollapsed']?0x0!==[..._0xe52aae['getSelectedBlocks']()]['length']&&![..._0xe52aae['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x235095['hasContent'](_0xe52aae['getFirstRange']());}(_0x36cdcb);const _0x4570d3=_0x36cdcb['document']['selection'],_0x19a15f=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x48a8ca of _0x4570d3['getRanges']())for(const _0x319979 of _0x48a8ca['getItems']())if(_0x319979['is']('element')&&_0x19a15f['includes'](_0x319979['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x41db2f='',_0x24c8d6='',_0x128b03='custom'){this['editor']['plugins']['get'](n)['showUI'](_0x41db2f,_0x24c8d6,_0x128b03);}}function ns(_0x1cffda,_0x89c5c7){const _0x58899c=new Set();for(const _0x1b3aa2 of _0x1cffda['values']())(_0x89c5c7||!0x1===_0x1b3aa2['requiresContent'])&&_0x58899c['add'](_0x1b3aa2['id']);return Array['from'](_0x58899c);}const hs=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class j extends/* #__PURE__ -- @preserve */
ts(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x1eabcb,_0x2e4465,_0x2464b5){super(),this['editor']=_0x1eabcb,this['textAdapter']=_0x2e4465,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x2464b5,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0xc3a652,_0xa5d9bd,_0x283209)=>{this['view']['value']=this['_sanitizeHTML'](_0x283209);}),this['listenTo'](this['view'],'submitPrompt',(_0x1bdd34,_0x3d7a37)=>{const _0x189d7a=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x3d7a37,_0x189d7a,'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:_0x44cb71,query:_0xb03ec1,htmlContent:_0x2c2c93,label:_0x4cb841,mainActionLabel:_0x5b9715}){this['view']['prompt']=_0x4cb841,this['view']['mainAction']=_0x5b9715,this['initialContext']=_0x2c2c93,_0xb03ec1&&(this['view']['isRendered']?this['_handleQuery'](_0xb03ec1,_0x2c2c93,_0x44cb71,_0x4cb841):this['view']['once']('render',()=>{this['_handleQuery'](_0xb03ec1,_0x2c2c93,_0x44cb71,_0x4cb841);}));}['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'](_0x5814da,_0x2bddac,_0x4101b7,_0x381686){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x2bddac,this['previousQuery']=_0x5814da,this['previousLabel']=_0x381686||_0x5814da,this['previousActionId']=_0x4101b7,new Promise(_0x1abb49=>{this['textAdapter']['makeRequest']({'query':_0x5814da,'context':_0x2bddac,'onData':_0x579a53=>{this['currentResponse']=_0x579a53,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x4101b7})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x19308f=>{_0x19308f instanceof tr?this['view']['handleError'](_0x19308f['message']):this['view']['handleError'](),_0x1abb49();})['finally'](()=>{this['stopProcessing'](),_0x1abb49();});});}['_parseAndNormalizeContent'](_0x4de199,_0x1056aa=!0x1){const _0x4a4a8c=hs['exec'](_0x4de199);_0x4de199=_0x4a4a8c?_0x4de199['substring'](_0x4a4a8c[0x1]['length']):_0x4de199['length']<0x64&&!_0x1056aa?'':this['_stripMarkdownSyntax'](_0x4de199);const _0x2a63db=this['_domParser']['parseFromString'](_0x4de199,'text/html');if(_0x4a4a8c){const _0x486c8a=Array['from'](_0x2a63db['body']['childNodes']);_0x486c8a['reverse']();for(const _0x177887 of _0x486c8a){if(_0x177887['nodeType']==Node['ELEMENT_NODE'])break;_0x177887['remove']();}}const _0x2a0074=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x2a63db['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x2a0074);const _0x327ca1=this['editor']['config']['get']('ai.assistant.preserveComments'),_0xae19f6=this['editor']['data']['toModel'](_0x2a0074);return _0x327ca1||_0xae19f6['markers']['clear'](),this['editor']['data']['stringify'](_0xae19f6);}['_normalizeResponseHeadings'](_0x20fec7){const _0x510723=new _0x4dac8d(this['editor']['editing']['view']['document']),_0x1af997=new _0x2ee456({'name':/^h[1-5]$/}),_0x5f50e8=[];let _0x4e3e4b=!0x1;for(const _0x4502a3 of _0x20fec7)_0x4502a3['is']('element')&&_0x1af997['match'](_0x4502a3)&&(_0x5f50e8['push'](_0x4502a3),'h1'==_0x4502a3['name']&&(_0x4e3e4b=!0x0));if(_0x4e3e4b){for(const _0x4eec11 of _0x5f50e8)_0x510723['rename']('h'+(parseInt(_0x4eec11['name'][0x1])+0x1),_0x4eec11);}}['_isH1TagSupportEnabled'](){const {data:_0x395be3,editing:_0x12b202}=this['editor'],_0x58499b=_0x395be3['htmlProcessor']['toView']('<h1></h1>'),_0x12e1ae=_0x395be3['toView'](_0x395be3['toModel'](_0x58499b));return!!_0x12b202['view']['domConverter']['viewToDom'](_0x12e1ae)['querySelector']('h1');}['_sanitizeHTML'](_0x2fb860){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x2fb860),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0xb45595){const _0x317a42=_0xb45595['trim']();return _0x317a42['startsWith']('```html')?_0x317a42['endsWith']('```')?_0x317a42['substring'](0x7,_0x317a42['length']-0x3):_0x317a42['substring'](0x7):_0xb45595;}}const _={'REPLACE':'replace','INSERT':'insert'};class br extends _0x19c936{constructor(_0x1f63a9){super(_0x1f63a9),this['set']('isVisible',!0x1),this['set']('mainAction',_['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0xa36fc1=>qn(_0x1f63a9,'AI_'+_0xa36fc1['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](qn(_0x1f63a9,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](qn(_0x1f63a9,'Try\x20again')),this['stopButton']=this['_createButton'](qn(_0x1f63a9,'Stop'));const _0x5d27ec=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x5d27ec['if']('isVisible','ck-hidden',_0x377dfc=>!_0x377dfc)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x35455c,_0x3366a6){const _0x309c1e=new _0x177962(this['locale']);return _0x309c1e['set']({'label':_0x35455c,'class':_0x3366a6||'','isVisible':!0x0,'withText':!0x0}),_0x309c1e;}}class wr extends _0x4dc179{['contentFieldView'];['copyButtonView'];constructor(_0x58106d,_0x233320=''){super(_0x58106d),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x486732=this['bindTemplate'];this['contentFieldView']=new Qn(_0x58106d,_0x233320),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x486732['if']('isVisible','ck-hidden',_0xf6e324=>!_0xf6e324)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x486732['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 _0x2592c9=!0x1;this['on']('change:value',(_0x49642a,_0x43ed7a,_0x4879c4)=>{const _0x3e4d0d=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x4879c4),this['isProcessing']&&_0x3e4d0d&&!_0x2592c9&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x47f0ed,_0xd4f640,_0x34632f)=>{_0x2592c9=!0x1,_0x34632f?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x2592c9=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x2592c9=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x7978ff=this['locale'],_0x18c6e7=new _0x177962(this['locale']),_0x1b48a4='ck-ai-form__copy-button';return _0x18c6e7['set']({'label':qn(_0x7978ff,'Copy'),'icon':_0x27287b,'class':_0x1b48a4,'tooltip':!0x0}),_0x18c6e7['bind']('isVisible')['to'](this,'value',_0x292f9e=>!!_0x292f9e),_0x18c6e7['bind']('isEnabled')['to'](this,'isProcessing',_0x9a29c5=>!_0x9a29c5),_0x18c6e7['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x18c6e7['icon']=_0x2de17e,_0x18c6e7['class']=_0x1b48a4+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x18c6e7['icon']=_0x27287b,_0x18c6e7['class']=_0x1b48a4;},0x3e8);}),_0x18c6e7;}['_copyHTMLToClipboard'](_0x241a15){const {window:_0x3a5f6f,document:_0x188de3}=_0xbe8f2c;if(_0x3a5f6f['ClipboardItem']){const {Blob:_0x3b631a,ClipboardItem:_0x534d9e}=_0x3a5f6f,_0x661337=[new _0x534d9e({'text/html':new _0x3b631a([_0x241a15['innerHTML']],{'type':'text/html'}),'text/plain':new _0x3b631a([_0x241a15['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x661337);}else{const _0x53c138=_0x188de3['createElement']('div');_0x53c138['style']['position']='absolute',_0x53c138['style']['left']='-9999px',_0x53c138['innerHTML']='<span>[</span>'+_0x241a15['innerHTML']+'<span>]</span>',_0x188de3['body']['appendChild'](_0x53c138);const _0xbfe851=_0x188de3['createRange']();_0xbfe851['setStartAfter'](_0x53c138['firstElementChild']),_0xbfe851['setEndBefore'](_0x53c138['lastElementChild']);const _0x1552d0=_0x3a5f6f['getSelection']();_0x1552d0['removeAllRanges'](),_0x1552d0['addRange'](_0xbfe851),_0x188de3['execCommand']('copy'),_0x53c138['remove']();}}}class Qn extends _0x4dc179{constructor(_0x47b6d4,_0x13e97e=''){super(_0x47b6d4),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x13e97e,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0xcd10e1){this['element']['innerHTML']=_0xcd10e1;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x3fdce6=new _0x4dc179(),_0xc76ace=this['locale'],_0x4efcb9=new _0x1e6810();return _0x4efcb9['isVisible']=!0x0,_0x3fdce6['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x4efcb9,{'text':qn(_0xc76ace,'AI\x20is\x20writing...')}]}),_0x3fdce6['render'](),_0x3fdce6;}}class yr extends _0x4dc179{constructor(_0x1e24df,_0x1b1516=''){super(_0x1e24df);const _0x203ac4=new _0x4c8e3c(),_0x37c4ac=this['bindTemplate'];this['set']('text',_0x1b1516),_0x203ac4['content']=_0x1816ee,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x203ac4,{'text':_0x37c4ac['to']('text')}]});}}class gr extends _0xb99b9a{['submitButtonView'];['showHistoryButtonView'];constructor(_0x504ee9,_0x44eb30){super(_0x504ee9,_0x44eb30),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',(_0x4fea75,_0x5cd8f3)=>{_0x4fea75['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x5cd8f3());});}['_createSubmitButton'](){const _0x3f5f99=new _0x177962(this['locale']),_0x1e1650=this['locale'];return _0x3f5f99['set']({'icon':_0x1e29b0,'label':qn(_0x1e1650,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x3f5f99['on']('execute',()=>{this['submit']();}),_0x3f5f99['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x99ca1a,_0x1e9a05)=>!_0x99ca1a&&_0x1e9a05),_0x3f5f99;}['_createShowHistoryButton'](){const _0x132a05=new _0x177962(this['locale']),_0x370ebc=this['resultsView'],_0x9b231f=this['locale'];_0x132a05['set']({'label':qn(_0x9b231f,'History'),'withText':!0x1,'icon':Ht,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x132a05['bind']('isOn')['to'](_0x370ebc,'isVisible'),_0x132a05['bind']('isEnabled')['to'](this,'isEnabled'),_0x132a05['on']('execute',()=>{_0x370ebc['isVisible']=!_0x370ebc['isVisible'],_0x370ebc['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x44df00=()=>{_0xbe8f2c['window']['requestAnimationFrame'](()=>{if(_0x5c2483(this['element'])){const _0x1ac756=new _0x4f725a(this['queryView']['fieldView']['element']),_0x1d3a19=_0x1ac756['width'],_0x130ec1='rtl'===_0x9b231f['uiLanguageDirection']?'left':'right';_0x1ac756['excludeScrollbarsAndBorders'](),_0x132a05['element']['style'][_0x130ec1]=_0x1d3a19-_0x1ac756['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x44df00),this['on']('render',_0x44df00),_0x132a05;}['submit'](){const _0x1daf13=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x1daf13);}['focus'](_0x433feb){-0x1===_0x433feb?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class Er extends _0x3c987b{['historyGroupView'];['clearHistoryButton'];constructor(_0x5ac609){super(_0x5ac609),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new _0x1517bd(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=qn(_0x5ac609,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x1ce4d8=0x0;for(const _0x297a96 of this['items'])_0x1ce4d8+=_0x297a96['items']['length'];return{'resultsCount':_0x1ce4d8,'totalItemsCount':_0x1ce4d8};}['_createClearHistoryButton'](){const _0x421409=this['locale'],_0x56d2ef=new _0x177962(this['locale']);return _0x56d2ef['set']({'label':'('+qn(_0x421409,'Clear')+')','withText':!0x0}),_0x56d2ef['on']('execute',()=>this['fire']('clearHistory')),_0x56d2ef;}}class vr extends _0x2f4a78{constructor(_0x5758ef){super();const _0x5bb3a2=new _0x310285(),_0x412994=new _0x177962(this['locale'],_0x5bb3a2);this['children']['add'](_0x412994),_0x412994['set']({'label':_0x5758ef['prompt'],'withText':!0x0}),_0x412994['on']('execute',()=>{this['fire']('execute',{'value':_0x4077b9(_0x5758ef['prompt'])});});}}const ao='CKEditor/AIFormView/PromptHistory';class Ar extends _0x381bb7{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x1676cf,_0x17ffa6)=>{const _0x2a3258=So(_0x17ffa6['prompt']);for(const _0x5f3e99 of this)if(_0x5f3e99!=_0x17ffa6&&So(_0x5f3e99['prompt'])===_0x2a3258){this['remove'](_0x5f3e99);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x5108be=sessionStorage['getItem'](ao)||'[]';this['addMany'](JSON['parse'](_0x5108be));}['_saveToSessionStorage'](){sessionStorage['setItem'](ao,JSON['stringify'](this['map'](_0x308ade=>_0x308ade)));}}function So(_0x1e4274){return _0x1e4274['toLowerCase']()['trim']();}class k extends _0x4dc179{['focus