@ckeditor/ckeditor5-ai 48.8.1-alpha.0 → 48.8.1-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +6 -6
  2. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -20,9 +20,9 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Plugin as _0x1d5649,Command as _0x57166c,ContextPlugin as _0x4127f4,Editor as _0x461551}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x45e942,IconCheck as _0x11d9a5,IconError as _0x2a1448,IconSubmit as _0x3b5d60,IconAIHistory as _0x1bbebc,IconMagicWand as _0x1482e3,IconRobotPencil as _0x334a80,IconMaximize as _0x52d1c2,IconMinimize as _0xf26cd2,IconShowChangesOn as _0x5e8753,IconShowChangesOff as _0x15ce4c,IconDocument as _0x40ebca,IconBoxWithCross as _0x27568b,IconBoxWithCheck as _0x262f77,IconBoxWithMarker as _0x42b593,IconInfo as _0x5be768,IconWeb as _0x43ec4b,IconCancel as _0x1294a9,IconSelection as _0x4f3f50,IconFileUpload as _0x29ada8,IconLink as _0x31e498,IconBulb as _0x57f7fd,IconAI as _0x236d8,IconPreviousArrow as _0x165d4c,IconDocumentOutline as _0x4336ec,IconLoupe as _0x529977,IconPaperClip as _0x311a91,IconBrowseFiles as _0x28ff67,IconDropdownArrow as _0xcf9e,IconStop as _0x2cd0a9,IconPlus as _0x3a3f8a,IconAIChat as _0x2b653e,IconPin as _0x156c16,IconThreeHorizontalDots as _0x3c4086,IconAIReview as _0x50ff5d,IconAITranslate as _0x9de076,IconAIAskAI as _0x24ff37,IconThumbUp as _0x97c385,IconThumbDown as _0x160b72,IconChevronDown as _0xa89179,IconChevronUp as _0xb5647,IconAIQuickActions as _0x19a02b,IconAIChatCommands as _0x42ff52,IconAIImproveWriting as _0x59b680,IconAIContinueWriting as _0x95e427,IconAIGrammarCheck as _0x56d1e0,IconAIAdjustLength as _0x3ac9b4,IconAIChangeTone as _0x5c6fef,IconAIOther as _0x141944,IconRefresh as tt,IconNextArrow as et,IconOutdated as it,IconEye as st,IconEyeCrossedOut as nt,IconChevronRight as rt}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as ot,CKEditorError as at,ObservableMixin as ht,global as ct,isVisible as lt,Rect as ut,Collection as dt,FocusTracker as _t,KeystrokeHandler as It,first as At,logWarning as gt,logError as Ct,toArray as mt,version as pt,EmitterMixin as Et,scrollViewportToShowTarget as wt,insertToPriorityArray as Tt,scrollAncestorsToShowTarget as ft,ResizeObserver as St,_isMotionReduced as Rt,getConstrainedViewportRect as bt,DomEmitterMixin as Ot}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as kt,ButtonView as vt,View as Nt,SpinnerView as yt,IconView as xt,AutocompleteView as Lt,ListView as Dt,ListItemGroupView as Vt,ListItemView as Pt,ButtonLabelView as Ht,FocusCycler as Mt,createLabeledTextarea as Ut,Dialog as Bt,createDropdown as Gt,addMenuToDropdown as Ft,MenuBarMenuView as Kt,MenuBarMenuListItemButtonView as Wt,DialogViewPosition as Yt,MenuBarMenuListView as $t,MenuBarMenuListItemView as qt,BodyCollection as Qt,BalloonPanelView as Xt,clickOutsideHandler as zt,addListToDropdown as jt,UIModel as Jt,submitHandler as Zt,LabeledFieldView as te,createLabeledInputText as _0x5d48d5,FormHeaderView as _0x1ea0e5,HighlightedTextView as _0x3f501c,ViewCollection as _0x5337b1,FileDialogButtonView as _0x2586d8,InputTextView as _0x4c17e0,SearchTextView as _0x483c44,ListItemButtonView as _0x4d069a,ButtonLabelWithHighlightView as _0x31a0ee,DropdownMenuPanelPositioningFunctions as _0x597eef,BalloonToolbar as _0x3811be,FormRowView as _0x450088,TextareaView as _0x282a5b}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x49c966,ClipboardMarkersUtils as _0x289225}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{ViewDocumentDomEventData as _0x527936,ViewDataTransfer as _0x1f61bf,ViewUpcastWriter as _0x54b441,Matcher as _0x281faf,_DetachOperation as _0x56cb8c,_insertIntoModelNodeList as _0x3d933a,_removeFromModelNodeList as _0x2e2ddd,ModelRange as _0x1c9ece,transformOperationSets as _0x586b34,ViewDowncastWriter as _0x203eb2,ModelDocumentFragment as _0x14c213,ModelPosition as _0x22c921,ModelTreeWalker as _0x4a0e2d,MarkerOperation as _0x412044,InsertOperation as _0x4bd349}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as _0x5f40c3,escape as _0x353660,cloneDeep as _0x43e724,throttle as _0x327953,debounce as _0x200174,escapeRegExp as _0x230461}from'es-toolkit/compat';import{createParser as _0x26ef61}from'eventsource-parser';import{CloudServices as _0x289907}from'@ckeditor/ckeditor5-cloud-services/dist/index.js';import{parseDocument as _0x58140b}from'htmlparser2';import{isTag as _0x4590df,findOne as _0x504013,getParent as _0x30e479,findAll as _0xbb1b5f,removeElement as _0x3064c8,prepend as _0x38bdcf,prependChild as _0x56bf59,appendChild as _0x3019ce,append as _0x5229d2,find as _0x1b3db2,isComment as _0x49cf07,replaceElement as _0x315210,getChildren as _0x4bfbc2,textContent as _0x39f544}from'domutils';import ti from'dom-serializer';import{Document as _0x38e78e,Element as _0x59f13d,Text as _0x192276,cloneNode as _0x225cd1,isDocument as _0x243876,isText as _0xcaf2d1,NodeWithChildren as _0x2da0df}from'domhandler';import{MarkdownGfmMdToHtmlDefaultPlugins as _0x12f810,MarkdownGfmMdToHtml as _0x7b1999}from'@ckeditor/ckeditor5-markdown-gfm/dist/index.js';import _0x564c5a from'rehype-sanitize';import{fixElementSuggestionRange as _0x5c5f61,DocumentCompare as _0x4278a5,DATA_ID_MODEL_ATTRIBUTE as _0x4bed1f,ConfirmMixin as _0x3e4ae1,getAllMarkersDomElementsSorted as _0x5268f3,SuggestionsConversion as _0x1509f0,DATA_ID_VIEW_ATTRIBUTE as _0x59e29c,getMarkerDomElement as _0x4db80f}from'@ckeditor/ckeditor5-collaboration-core/dist/index.js';import _0x2c7e16 from'morphdom';import{diffArrays as _0x2b7e81}from'diff';const wi='_ungrouppedCommands';function Ti(_0x2e9e4d,_0x1634e1){const _0x2fe443=(0x0,_0x1634e1['t'])('Other');return _0x2e9e4d['length']?'groupId'in _0x2e9e4d[0x0]?_0x2e9e4d:[{'groupId':wi,'groupLabel':_0x2fe443,'order':0x1/0x0,'commands':_0x2e9e4d}]:[{'groupId':wi,'groupLabel':_0x2fe443,'order':0x1/0x0,'commands':[]}];}const fi=globalThis['DataTransfer'],Si='ai-ui';class AIAssistantEditing extends _0x1d5649{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x326509}=this,_0x897c0c=['ck-fake-ai-selection'];_0x326509['config']['get']('ai.assistant.useTheme')&&_0x897c0c['push']('ck-ai-assistant-ui_theme'),_0x326509['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Si,'view':{'classes':_0x897c0c,'priority':0xc}}),_0x326509['conversion']['for']('editingDowncast')['markerToElement']({'model':Si,'view':(_0x4b3fc6,{writer:_0x236156})=>{if(!_0x4b3fc6['markerRange']['isCollapsed'])return null;const _0x7bc3c1=_0x236156['createUIElement']('span');return _0x236156['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x7bc3c1),_0x7bc3c1;}});}['afterInit'](){!async function(_0x3c83bb){const _0x11e3c3=_0x7bfcbe([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]),_0x294eb5=0x3dffc4e1,_0x248fde=0x3df84ec1^_0x294eb5,_0x1542d4=window[_0x7bfcbe([0x44,0x61,0x74,0x65])][_0x7bfcbe([0x6e,0x6f,0x77])](),_0x3a0fef=_0x3c83bb[_0x7bfcbe([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x2806d4=new window[(_0x7bfcbe([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x34de30=>{_0x3a0fef[_0x7bfcbe([0x6f,0x6e,0x63,0x65])](_0x7bfcbe([0x72,0x65,0x61,0x64,0x79]),_0x34de30);}),_0x213dff={[_0x7bfcbe([0x6b,0x74,0x79])]:_0x7bfcbe([0x45,0x43]),[_0x7bfcbe([0x75,0x73,0x65])]:_0x7bfcbe([0x73,0x69,0x67]),[_0x7bfcbe([0x63,0x72,0x76])]:_0x7bfcbe([0x50,0x2d,0x32,0x35,0x36]),[_0x7bfcbe([0x78])]:_0x7bfcbe([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]),[_0x7bfcbe([0x79])]:_0x7bfcbe([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]),[_0x7bfcbe([0x61,0x6c,0x67])]:_0x7bfcbe([0x45,0x53,0x32,0x35,0x36])},_0x319967=_0x3a0fef[_0x7bfcbe([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x7bfcbe([0x67,0x65,0x74])](_0x7bfcbe([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x37ab97(){let _0x44350d,_0x285dff=null,_0x3b3ba7=null;try{if(_0x319967==_0x7bfcbe([0x47,0x50,0x4c]))return _0x7bfcbe([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x44350d=_0x57988b(),!_0x44350d)return _0x7bfcbe([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x44350d[_0x7bfcbe([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x3b3ba7=_0x3b2b09(_0x44350d[_0x7bfcbe([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x44350d[_0x7bfcbe([0x6a,0x74,0x69])])),await _0x1cd3bb()?_0x512ea7()?_0x34ea85()?_0x7bfcbe([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x2012a1()?(_0x44350d[_0x7bfcbe([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x7bfcbe([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x285dff=_0x2618ca(_0x7bfcbe([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),await _0x5d948f()):_0x7bfcbe([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x7bfcbe([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x7bfcbe([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x7bfcbe([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x34ea85(){const _0x4d5e98=[_0x7bfcbe([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x7bfcbe([0x74,0x72,0x69,0x61,0x6c])][_0x7bfcbe([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x44350d[_0x7bfcbe([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x1542d4/0x3e8:0xe10*_0x248fde;return _0x44350d[_0x7bfcbe([0x65,0x78,0x70])]<_0x4d5e98;}function _0x512ea7(){const _0x109f69=_0x44350d[_0x7bfcbe([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x109f69&&(!!_0x109f69[_0x7bfcbe([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x7bfcbe([0x2a]))||!!_0x109f69[_0x7bfcbe([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x7bfcbe([0x41,0x49])));}function _0x2012a1(){const _0x3c9c6a=_0x44350d[_0x7bfcbe([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x3c9c6a||0x0==_0x3c9c6a[_0x7bfcbe([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x3a5e85}=new URL(window[_0x7bfcbe([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x3c9c6a[_0x7bfcbe([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x3a5e85))return!0x0;const _0x32f0c2=_0x3a5e85[_0x7bfcbe([0x73,0x70,0x6c,0x69,0x74])](_0x7bfcbe([0x2e]));return _0x3c9c6a[_0x7bfcbe([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x20e34e=>_0x20e34e[_0x7bfcbe([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x7bfcbe([0x2a])))[_0x7bfcbe([0x6d,0x61,0x70])](_0x2636de=>_0x2636de[_0x7bfcbe([0x73,0x70,0x6c,0x69,0x74])](_0x7bfcbe([0x2e])))[_0x7bfcbe([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x43716f=>_0x43716f[_0x7bfcbe([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x32f0c2[_0x7bfcbe([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x7bfcbe([0x6d,0x61,0x70])](_0x129b5b=>Array(_0x32f0c2[_0x7bfcbe([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x129b5b[_0x7bfcbe([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x7bfcbe([0x66,0x69,0x6c,0x6c])](_0x129b5b[0x0]===_0x7bfcbe([0x2a])?_0x7bfcbe([0x2a]):'')[_0x7bfcbe([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x129b5b))[_0x7bfcbe([0x73,0x6f,0x6d,0x65])](_0x138fc7=>_0x32f0c2[_0x7bfcbe([0x65,0x76,0x65,0x72,0x79])]((_0x39c4e5,_0x120a3c)=>_0x138fc7[_0x120a3c]===_0x39c4e5||_0x138fc7[_0x120a3c]===_0x7bfcbe([0x2a])));}function _0x5d948f(){return _0x285dff&&_0x3b3ba7?new window[(_0x7bfcbe([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x20ac10,_0x4963bc)=>{_0x285dff[_0x7bfcbe([0x74,0x68,0x65,0x6e])](_0x20ac10,_0x4963bc),_0x3b3ba7[_0x7bfcbe([0x74,0x68,0x65,0x6e])](_0x3c3961=>{_0x3c3961!=_0x7bfcbe([0x56,0x61,0x6c,0x69,0x64])&&_0x20ac10(_0x3c3961);},_0x4963bc);}):_0x285dff||_0x3b3ba7||_0x7bfcbe([0x56,0x61,0x6c,0x69,0x64]);}}function _0x3b2b09(_0x362fe1,_0x35b827){return new window[(_0x7bfcbe([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x3116b7=>{if(_0x1a9e32())return _0x3116b7(_0x7bfcbe([0x56,0x61,0x6c,0x69,0x64]));_0x27bdd9(),_0x3a0fef[_0x7bfcbe([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x7bfcbe([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x378014=!0x1;const _0x246656=ot();function _0x29a674(_0x52a82b){return!!_0x52a82b&&(typeof _0x52a82b===_0x7bfcbe([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x52a82b===_0x7bfcbe([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x52a82b[_0x7bfcbe([0x74,0x68,0x65,0x6e])]===_0x7bfcbe([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x52a82b[_0x7bfcbe([0x63,0x61,0x74,0x63,0x68])]===_0x7bfcbe([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x2c3b17(_0x1ad052){_0x58e97e(_0x1ad052)[_0x7bfcbe([0x74,0x68,0x65,0x6e])](_0x1ea29c=>{if(!_0x1ea29c||_0x1ea29c[_0x7bfcbe([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x7bfcbe([0x6f,0x6b]))return _0x7bfcbe([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x164a61(_0x2663dd(_0x246656+_0x35b827))!=_0x1ea29c[_0x7bfcbe([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x7bfcbe([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x7bfcbe([0x56,0x61,0x6c,0x69,0x64]);})[_0x7bfcbe([0x74,0x68,0x65,0x6e])](_0x21bc5a=>(_0x45a5ef(),_0x21bc5a),()=>{const _0x20c1f5=_0x1476cb();return null==_0x20c1f5?(_0x45a5ef(),_0x7bfcbe([0x56,0x61,0x6c,0x69,0x64])):_0x7bfcbe(_0x1542d4-_0x20c1f5>(0x19f340e1^_0x294eb5)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x7bfcbe([0x74,0x68,0x65,0x6e])](_0x3116b7)[_0x7bfcbe([0x63,0x61,0x74,0x63,0x68])](()=>{_0x3116b7(_0x7bfcbe([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x4270e8=0x3dc92a61^_0x294eb5;function _0x45a5ef(){const _0x245d42=_0x7bfcbe([0x6c,0x6c,0x63,0x74,0x2d])+_0x164a61(_0x2663dd(_0x362fe1)),_0x1cd3c0=_0xd96215(_0x164a61(window[_0x7bfcbe([0x4d,0x61,0x74,0x68])][_0x7bfcbe([0x63,0x65,0x69,0x6c])](_0x1542d4/_0x4270e8)));window[_0x7bfcbe([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x7bfcbe([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x245d42,_0x1cd3c0);}function _0x1476cb(){const _0x4d8899=_0x7bfcbe([0x6c,0x6c,0x63,0x74,0x2d])+_0x164a61(_0x2663dd(_0x362fe1)),_0x35860a=window[_0x7bfcbe([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x7bfcbe([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x4d8899);return _0x35860a?window[_0x7bfcbe([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0xd96215(_0x35860a),0x10)*_0x4270e8:null;}function _0x58e97e(_0x956790){return new window[(_0x7bfcbe([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0xb0c246,_0x20006f)=>{_0x956790[_0x7bfcbe([0x74,0x68,0x65,0x6e])](_0xb0c246,_0x20006f),window[_0x7bfcbe([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x20006f,0x3dfe1021^_0x294eb5);});}}_0x3a0fef[_0x7bfcbe([0x6f,0x6e])](_0x7bfcbe([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x1b6b84,_0x334817)=>{if(_0x334817[0x0]!=_0x362fe1)return _0x3116b7(_0x7bfcbe([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x334817[0x1]={..._0x334817[0x1],[_0x7bfcbe([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x246656};},{[_0x7bfcbe([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x7bfcbe([0x68,0x69,0x67,0x68])}),_0x3a0fef[_0x7bfcbe([0x6f,0x6e])](_0x7bfcbe([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x3e283b=>{_0x29a674(_0x3e283b[_0x7bfcbe([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x378014=!0x0,_0x2c3b17(_0x3e283b[_0x7bfcbe([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x7bfcbe([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x7bfcbe([0x6c,0x6f,0x77])}),_0x2806d4[_0x7bfcbe([0x74,0x68,0x65,0x6e])](()=>{_0x378014||_0x3116b7(_0x7bfcbe([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x1a9e32(){return _0x3a0fef[_0x7bfcbe([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x7bfcbe([0x76,0x69,0x65,0x77])][_0x7bfcbe([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x7bfcbe([0x61,0x75,0x74,0x6f]);}function _0x27bdd9(){_0x3a0fef[_0x7bfcbe([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x7bfcbe([0x76,0x69,0x65,0x77])][_0x7bfcbe([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x7bfcbe([0x61,0x75,0x74,0x6f]);}}function _0x2618ca(_0x28a8f3){const _0x23d8b1=[new window[(_0x7bfcbe([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x401ff6=>setTimeout(_0x401ff6,0x3df6fa2d^_0x294eb5)),_0x2806d4[_0x7bfcbe([0x74,0x68,0x65,0x6e])](()=>new window[(_0x7bfcbe([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x2c7f24=>{let _0x30a7e6=0x0;_0x3a0fef[_0x7bfcbe([0x6d,0x6f,0x64,0x65,0x6c])][_0x7bfcbe([0x6f,0x6e])](_0x7bfcbe([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x51358f,_0xb21dd0)=>{_0xb21dd0[0x0][_0x7bfcbe([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x30a7e6++,_0x30a7e6==(0x3dffc109^_0x294eb5)&&(_0x2c7f24(),_0x51358f[_0x7bfcbe([0x6f,0x66,0x66])]());});}))];return window[_0x7bfcbe([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x7bfcbe([0x72,0x61,0x63,0x65])](_0x23d8b1)[_0x7bfcbe([0x74,0x68,0x65,0x6e])](()=>_0x28a8f3);}async function _0x1a4457(){await _0x2806d4,_0x3a0fef[_0x7bfcbe([0x6d,0x6f,0x64,0x65,0x6c])][_0x7bfcbe([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x320e4e,_0x3a0fef[_0x7bfcbe([0x6d,0x6f,0x64,0x65,0x6c])][_0x7bfcbe([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x320e4e,_0x3a0fef[_0x7bfcbe([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x7bfcbe([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x2ef7a0(_0x3c7c9a){const _0xa2584a=_0x1d8e60();_0x3a0fef[_0xa2584a]=_0x7bfcbe([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x3c7c9a,_0x3c7c9a!=_0x7bfcbe([0x56,0x61,0x6c,0x69,0x64])&&_0x1a4457();}function _0x1d8e60(){const _0x3a0540=window[_0x7bfcbe([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x7bfcbe([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x7bfcbe([0x6e,0x6f,0x77])]())[_0x7bfcbe([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x7bfcbe([0x2e]),'');let _0x417119=_0x7bfcbe([0x6e]);for(let _0x531045=0x0;_0x531045<_0x3a0540[_0x7bfcbe([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x531045+=0x2){let _0x43f814=window[_0x7bfcbe([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x3a0540[_0x7bfcbe([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x531045,_0x531045+0x2));_0x43f814>=_0x11e3c3[_0x7bfcbe([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x43f814-=_0x11e3c3[_0x7bfcbe([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x417119+=_0x11e3c3[_0x43f814];}return _0x417119;}function _0x57988b(){const _0x3867a9=_0x319967[_0x7bfcbe([0x73,0x70,0x6c,0x69,0x74])](_0x7bfcbe([0x2e]));if(0x3!=_0x3867a9[_0x7bfcbe([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x1b86f0(_0x3867a9[0x1]);function _0x1b86f0(_0xbf1c5b){const _0x3d6e11=_0x16f90b(_0xbf1c5b);return _0x3d6e11&&_0x23f2b9()?_0x3d6e11:null;function _0x23f2b9(){const _0x1a5f31=_0x3d6e11[_0x7bfcbe([0x6a,0x74,0x69])],_0x3ff84b=window[_0x7bfcbe([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x1a5f31[_0x7bfcbe([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x1a5f31[_0x7bfcbe([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x40f41e={..._0x3d6e11,[_0x7bfcbe([0x6a,0x74,0x69])]:_0x1a5f31[_0x7bfcbe([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x1a5f31[_0x7bfcbe([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x40f41e[_0x7bfcbe([0x76,0x63])],_0x2663dd(_0x40f41e)==_0x3ff84b;}}}async function _0x1cd3bb(){let _0xd5c48b=!0x0;try{const _0x38da4a=_0x319967[_0x7bfcbe([0x73,0x70,0x6c,0x69,0x74])](_0x7bfcbe([0x2e])),[_0x5041fc,_0x259a9c,_0x5cd565]=_0x38da4a;return _0x12cbc7(_0x5041fc),await _0x25d685(_0x5041fc,_0x259a9c,_0x5cd565),_0xd5c48b;}catch{return!0x1;}function _0x12cbc7(_0x5b65f1){const _0x5ad103=_0x16f90b(_0x5b65f1);_0x5ad103&&_0x5ad103[_0x7bfcbe([0x61,0x6c,0x67])]==_0x7bfcbe([0x45,0x53,0x32,0x35,0x36])||(_0xd5c48b=!0x1);}async function _0x25d685(_0x331016,_0x26ad98,_0x4b3b45){const _0x2eca44=window[_0x7bfcbe([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x7bfcbe([0x66,0x72,0x6f,0x6d])](_0x14087a(_0x4b3b45),_0x51b5de=>_0x51b5de[_0x7bfcbe([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x1e98fa=new window[(_0x7bfcbe([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x7bfcbe([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x331016+_0x7bfcbe([0x2e])+_0x26ad98),_0x1da092=window[_0x7bfcbe([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x7bfcbe([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x1da092)return;const _0x3b0806=await _0x1da092[_0x7bfcbe([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x7bfcbe([0x6a,0x77,0x6b]),_0x213dff,{[_0x7bfcbe([0x6e,0x61,0x6d,0x65])]:_0x7bfcbe([0x45,0x43,0x44,0x53,0x41]),[_0x7bfcbe([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x7bfcbe([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x7bfcbe([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x1da092[_0x7bfcbe([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x7bfcbe([0x6e,0x61,0x6d,0x65])]:_0x7bfcbe([0x45,0x43,0x44,0x53,0x41]),[_0x7bfcbe([0x68,0x61,0x73,0x68])]:{[_0x7bfcbe([0x6e,0x61,0x6d,0x65])]:_0x7bfcbe([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x3b0806,_0x2eca44,_0x1e98fa)||(_0xd5c48b=!0x1);}}function _0x16f90b(_0x2c8d0b){return _0x2c8d0b[_0x7bfcbe([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x7bfcbe([0x65,0x79]))?JSON[_0x7bfcbe([0x70,0x61,0x72,0x73,0x65])](_0x14087a(_0x2c8d0b)):null;}function _0x14087a(_0x4064a5){return window[_0x7bfcbe([0x61,0x74,0x6f,0x62])](_0x4064a5[_0x7bfcbe([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x7bfcbe([0x2b]))[_0x7bfcbe([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x7bfcbe([0x2f])));}function _0x2663dd(_0x1fe6ca){let _0x5e4681=0x1505;function _0x5df6d6(_0x53a9f0){for(let _0x26a087=0x0;_0x26a087<_0x53a9f0[_0x7bfcbe([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x26a087++){const _0xb423a8=_0x53a9f0[_0x7bfcbe([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x26a087);_0x5e4681=(_0x5e4681<<0x5)+_0x5e4681+_0xb423a8,_0x5e4681&=_0x5e4681;}}function _0x244a51(_0x2763e0){Array[_0x7bfcbe([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x2763e0)?_0x2763e0[_0x7bfcbe([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x244a51):_0x2763e0&&typeof _0x2763e0==_0x7bfcbe([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x7bfcbe([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x2763e0)[_0x7bfcbe([0x73,0x6f,0x72,0x74])]()[_0x7bfcbe([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0xb98776,_0x425f07])=>{_0x5df6d6(_0xb98776),_0x244a51(_0x425f07);}):_0x5df6d6(window[_0x7bfcbe([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x2763e0));}return _0x244a51(_0x1fe6ca),_0x5e4681>>>0x0;}function _0x164a61(_0x4ce115){return _0x4ce115[_0x7bfcbe([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x7bfcbe([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x7bfcbe([0x30]));}function _0xd96215(_0x3aa2f0){return _0x3aa2f0[_0x7bfcbe([0x73,0x70,0x6c,0x69,0x74])]('')[_0x7bfcbe([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x7bfcbe([0x6a,0x6f,0x69,0x6e])]('');}function _0x320e4e(){}function _0x7bfcbe(_0x5c58dd){return _0x5c58dd['map'](_0x5f1349=>String['fromCharCode'](_0x5f1349))['join']('');}_0x2ef7a0(await _0x37ab97());}(this);}['showFakeVisualSelection'](){const _0x4b262d=this['editor']['model'];_0x4b262d['change'](_0x1e3a88=>{const _0x17a5e7=_0x4b262d['document']['selection']['getRanges']();let _0xdf5dc9=0x0;for(const _0x1b8e6f of _0x17a5e7){const _0x161ec1=Si+':'+_0xdf5dc9;if(_0x4b262d['markers']['has'](_0x161ec1))_0x1e3a88['updateMarker'](_0x161ec1,{'range':_0x1b8e6f});else{if(_0x1b8e6f['start']['isAtEnd']){const _0x455f65=_0x1b8e6f['start']['getLastMatchingPosition'](({item:_0x599901})=>!_0x4b262d['schema']['isContent'](_0x599901),{'boundaries':_0x1b8e6f});_0x1e3a88['addMarker'](_0x161ec1,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x1e3a88['createRange'](_0x455f65,_0x1b8e6f['end'])});}else _0x1e3a88['addMarker'](_0x161ec1,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x1b8e6f});}_0xdf5dc9++;}});}['hideFakeVisualSelection'](){const _0xca35f2=this['editor']['model'],_0x301218=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Si));_0x301218['length']&&_0xca35f2['change'](_0x295788=>{_0x301218['forEach'](_0x3d62ae=>{_0x295788['removeMarker'](_0x3d62ae);});});}['insertContent'](_0x7b691f,_0x383ab8){const _0x477468=this['_getAISelection'](),_0x2e4ed8=_0x383ab8||_0x477468['getFirstRange']();this['editor']['model']['canEditAt'](_0x2e4ed8)&&this['editor']['model']['change'](_0x1ccfd4=>{this['hideFakeVisualSelection'](),_0x383ab8||this['_resetContentOfSelectedTableCells'](_0x1ccfd4,_0x477468),this['_pasteHTMLUsingClipboard']({'insertAt':_0x2e4ed8,'writer':_0x1ccfd4,'html':_0x7b691f});});}['insertContentBelow'](_0x237198){const {model:_0x3aaca3}=this['editor'],_0x17d309=this['_getAISelection']();_0x3aaca3['change'](()=>{const _0xa730e4=this['_prepareTableInsertBelowPosition'](_0x237198,_0x17d309)||this['_getDefaultInsertBelowPosition'](_0x17d309);this['insertContent'](_0x237198,_0xa730e4);});}['_getAISelection'](){const _0x94bfea=this['editor']['model'],_0x376b80=Array['from'](_0x94bfea['markers']['getMarkersGroup'](Si))['map'](_0xb079de=>_0xb079de['getRange']());return _0x94bfea['createSelection'](_0x376b80);}['_pasteHTMLUsingClipboard']({writer:_0x120087,html:_0x3be89b,insertAt:_0x461932}){const {view:_0x515f29}=this['editor']['editing'],_0x1e5ed3=this['editor']['plugins']['get'](_0x49c966),_0x10d7e5=new fi();_0x10d7e5['setData']('text/html',_0x3be89b);const _0x1f2704=new ClipboardEvent('paste',{'clipboardData':_0x10d7e5}),_0x549d74=new _0x527936(_0x515f29,_0x1f2704,{'dataTransfer':new _0x1f61bf(_0x10d7e5)});_0x120087['setSelection'](_0x461932);const _0x5172d0=(_0x5837e0,_0x43fcb9)=>{_0x43fcb9['resultRange']&&_0x120087['setSelection'](_0x43fcb9['resultRange']);};_0x1e5ed3['once']('contentInsertion',_0x5172d0,{'priority':'lowest'}),_0x515f29['document']['fire']('paste',_0x549d74),_0x1e5ed3['off']('contentInsertion',_0x5172d0);}['_getDefaultInsertBelowPosition'](_0x2fdf4c){const {model:_0x21c686}=this['editor'],_0x5a3389=Array['from'](_0x2fdf4c['getSelectedBlocks']());return _0x5a3389['length']?_0x21c686['createPositionAfter'](_0x5a3389['pop']()):_0x2fdf4c['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x5a2d95,_0x4f725f){const {model:_0x114078,plugins:_0x585460}=this['editor'];if(_0x585460['has']('TableUtils')){const _0x53d54c=_0x585460['get']('TableUtils')['getSelectedTableCells'](_0x4f725f);if(_0x53d54c['length']){const _0x5abb02=this['_getTableRowCountFromContent'](_0x5a2d95),_0x5a5e90=this['_createEmptyTableRows'](_0x53d54c,_0x5abb02);return _0x114078['createPositionAt'](_0x5a5e90,0x0);}}return null;}['_getTableRowCountFromContent'](_0x3d803e){const _0x5b8853=this['editor']['plugins']['get']('TableUtils'),_0x49a6f5=this['editor']['data']['parse'](_0x3d803e),_0x30f1e6=Array['from'](_0x49a6f5['getChildren']())['filter'](_0x5b1893=>_0x5b1893['is']('element','table'));let _0x41539b=0x0;return _0x30f1e6['forEach'](_0x3f4a31=>{_0x41539b+=_0x5b8853['getRows'](_0x3f4a31);}),_0x41539b;}['_createEmptyTableRows'](_0x168225,_0x353ace){const _0x4d0cec=this['editor']['plugins']['get']('TableUtils'),_0x325127=_0x4d0cec['getRowIndexes'](_0x168225),_0x1dfb27=_0x4d0cec['getColumnIndexes'](_0x168225),_0x4bb3a3=_0x325127['last']+0x1,_0x2ba1ff=_0x1dfb27['first'],_0x217314=_0x168225[0x0]['findAncestor']('table');for(let _0x3fc1a6=0x0;_0x3fc1a6<_0x353ace;_0x3fc1a6++)_0x4d0cec['insertRows'](_0x217314,{'at':_0x4bb3a3});return _0x217314['getChild'](_0x4bb3a3)['getChild'](_0x2ba1ff);}['_resetContentOfSelectedTableCells'](_0x561b50,_0x4c2f70){const {plugins:_0x277a02}=this['editor'],{model:_0x22be42}=_0x561b50;if(!_0x277a02['has']('TableUtils'))return;_0x277a02['get']('TableUtils')['getSelectedTableCells'](_0x4c2f70)['length']&&_0x22be42['deleteContent'](_0x4c2f70);}}class AIAdapter extends _0x1d5649{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new at('aiadapter-text-adapter-not-set',null);}}class AIRequestError extends Error{constructor(_0x424876){super(_0x424876),this['name']='AIRequestError';}}function Ri(_0x16f8ab,_0xabd4f,_0xa6aff9){const t=_0x16f8ab['t'];switch(_0xabd4f){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',_0xa6aff9);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0xa6aff9);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'},_0xa6aff9);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_AWS_NOT_SUPPORTED':return t({'id':'AI_ERROR_AWS_NOT_SUPPORTED','string':'The\x20AWS\x20integration\x20is\x20no\x20longer\x20supported.\x20Please\x20contact\x20the\x20support.'});case'AI_ERROR_FAILED':return t({'id':'AI_ERROR_FAILED','string':'Failed\x20to\x20communicate\x20with\x20the\x20AI\x20service'});default:return _0xabd4f;}}class ShowAIAssistantCommand extends _0x57166c{['_commandDefinitions'];constructor(_0x12d521,_0x3c4549){super(_0x12d521),this['_commandDefinitions']=_0x3c4549,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x17af03,_0x7f5dc2,_0x2e0e17)=>{this['isEnabled']&&(this['enabledCommandsIds']=bi(this['_commandDefinitions'],_0x2e0e17));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x49b6ac,_0x4e1edb,_0x99f92e)=>{this['enabledCommandsIds']=_0x99f92e?bi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0xd5ef3=this['editor']['model'];this['_hasContext']=function(_0x5e9417){const _0x4820a0=_0x5e9417['document']['selection'];return _0x4820a0['isCollapsed']?0x0!==[..._0x4820a0['getSelectedBlocks']()]['length']&&![..._0x4820a0['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x5e9417['hasContent'](_0x4820a0['getFirstRange']());}(_0xd5ef3);const _0x2710a0=_0xd5ef3['document']['selection'],_0x5bdbc6=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x2aeed0 of _0x2710a0['getRanges']())for(const _0x324223 of _0x2aeed0['getItems']())if(_0x324223['is']('element')&&_0x5bdbc6['includes'](_0x324223['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x14fc47='',_0x4332b6='',_0x4500f4='custom'){this['editor']['plugins']['get'](AIAssistantUI)['showUI'](_0x14fc47,_0x4332b6,_0x4500f4);}}function bi(_0x35f231,_0x35b39a){const _0x5d3e57=new Set();for(const _0x495cf9 of _0x35f231['values']())(_0x35b39a||!0x1===_0x495cf9['requiresContent'])&&_0x5d3e57['add'](_0x495cf9['id']);return Array['from'](_0x5d3e57);}const Oi=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class AIAssistantController extends/* #__PURE__ -- @preserve */
24
- ht(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x136d77,_0x99c57c,_0x390731){super(),this['editor']=_0x136d77,this['textAdapter']=_0x99c57c,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x390731,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x382125,_0x33bc00,_0x4b68a9)=>{this['view']['value']=this['_sanitizeHTML'](_0x4b68a9);}),this['listenTo'](this['view'],'submitPrompt',(_0x5aa0e8,_0x262c21)=>{const _0x3259f5=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x262c21,_0x3259f5,'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:_0x4a994a,query:_0x352062,htmlContent:_0x29ed90,label:_0x39ca15,mainActionLabel:_0xda5d3b}){this['view']['prompt']=_0x39ca15,this['view']['mainAction']=_0xda5d3b,this['initialContext']=_0x29ed90,_0x352062&&(this['view']['isRendered']?this['_handleQuery'](_0x352062,_0x29ed90,_0x4a994a,_0x39ca15):this['view']['once']('render',()=>{this['_handleQuery'](_0x352062,_0x29ed90,_0x4a994a,_0x39ca15);}));}['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'](_0x3e3587,_0x4a9a9d,_0x5f338c,_0x2b3c69){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x4a9a9d,this['previousQuery']=_0x3e3587,this['previousLabel']=_0x2b3c69||_0x3e3587,this['previousActionId']=_0x5f338c,new Promise(_0x3443e8=>{this['textAdapter']['makeRequest']({'query':_0x3e3587,'context':_0x4a9a9d,'onData':_0x5604e9=>{this['currentResponse']=_0x5604e9,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x5f338c})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x2ac867=>{_0x2ac867 instanceof AIRequestError?this['view']['handleError'](_0x2ac867['message']):this['view']['handleError'](),_0x3443e8();})['finally'](()=>{this['stopProcessing'](),_0x3443e8();});});}['_parseAndNormalizeContent'](_0x3f2a1d,_0x583ef2=!0x1){const _0x455625=Oi['exec'](_0x3f2a1d);_0x3f2a1d=_0x455625?_0x3f2a1d['substring'](_0x455625[0x1]['length']):_0x3f2a1d['length']<0x64&&!_0x583ef2?'':this['_stripMarkdownSyntax'](_0x3f2a1d);const _0x444b87=this['_domParser']['parseFromString'](_0x3f2a1d,'text/html');if(_0x455625){const _0x388fe9=Array['from'](_0x444b87['body']['childNodes']);_0x388fe9['reverse']();for(const _0x4ae7a2 of _0x388fe9){if(_0x4ae7a2['nodeType']==Node['ELEMENT_NODE'])break;_0x4ae7a2['remove']();}}const _0x515b8b=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x444b87['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x515b8b);const _0x507186=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x2bc1ee=this['editor']['data']['toModel'](_0x515b8b);return _0x507186||_0x2bc1ee['markers']['clear'](),this['editor']['data']['stringify'](_0x2bc1ee);}['_normalizeResponseHeadings'](_0x861e90){const _0x49f40f=new _0x54b441(this['editor']['editing']['view']['document']),_0x5f0cc0=new _0x281faf({'name':/^h[1-5]$/}),_0x441eba=[];let _0x5a952e=!0x1;for(const _0x3b33c7 of _0x861e90)_0x3b33c7['is']('element')&&_0x5f0cc0['match'](_0x3b33c7)&&(_0x441eba['push'](_0x3b33c7),'h1'==_0x3b33c7['name']&&(_0x5a952e=!0x0));if(_0x5a952e){for(const _0x1a9e33 of _0x441eba)_0x49f40f['rename']('h'+(parseInt(_0x1a9e33['name'][0x1])+0x1),_0x1a9e33);}}['_isH1TagSupportEnabled'](){const {data:_0x3bf12f,editing:_0x20f4aa}=this['editor'],_0x5bd2c5=_0x3bf12f['htmlProcessor']['toView']('<h1></h1>'),_0x3dfd70=_0x3bf12f['toView'](_0x3bf12f['toModel'](_0x5bd2c5));return!!_0x20f4aa['view']['domConverter']['viewToDom'](_0x3dfd70)['querySelector']('h1');}['_sanitizeHTML'](_0x163ac3){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x163ac3),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x2340b1){const _0x2756e1=_0x2340b1['trim']();return _0x2756e1['startsWith']('```html')?_0x2756e1['endsWith']('```')?_0x2756e1['substring'](0x7,_0x2756e1['length']-0x3):_0x2756e1['substring'](0x7):_0x2340b1;}}const ki={'REPLACE':'replace','INSERT':'insert'};class AIFormToolbarView extends kt{constructor(_0x5b9c04){super(_0x5b9c04),this['set']('isVisible',!0x1),this['set']('mainAction',ki['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x552e40=>Ri(_0x5b9c04,'AI_'+_0x552e40['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Ri(_0x5b9c04,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Ri(_0x5b9c04,'Try\x20again')),this['stopButton']=this['_createButton'](Ri(_0x5b9c04,'Stop'));const _0x474756=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x474756['if']('isVisible','ck-hidden',_0x3da15d=>!_0x3da15d)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0xbf38c2,_0x3de429){const _0x3f961b=new vt(this['locale']);return _0x3f961b['set']({'label':_0xbf38c2,'class':_0x3de429||'','isVisible':!0x0,'withText':!0x0}),_0x3f961b;}}class AIFormContentArea extends Nt{['contentFieldView'];['copyButtonView'];constructor(_0x33ac92,_0x5add76=''){super(_0x33ac92),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x48e15c=this['bindTemplate'];this['contentFieldView']=new ContentFieldView(_0x33ac92,_0x5add76),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x48e15c['if']('isVisible','ck-hidden',_0x3e3615=>!_0x3e3615)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x48e15c['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 _0x50f284=!0x1;this['on']('change:value',(_0x56ecb2,_0x395c57,_0x21d834)=>{const _0x4dd62e=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x21d834),this['isProcessing']&&_0x4dd62e&&!_0x50f284&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x47951f,_0x551a5,_0x953eac)=>{_0x50f284=!0x1,_0x953eac?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x50f284=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x50f284=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x4daf17=this['locale'],_0x40d69b=new vt(this['locale']),_0x2e5691='ck-ai-form__copy-button';return _0x40d69b['set']({'label':Ri(_0x4daf17,'Copy'),'icon':_0x45e942,'class':_0x2e5691,'tooltip':!0x0}),_0x40d69b['bind']('isVisible')['to'](this,'value',_0xfaece5=>!!_0xfaece5),_0x40d69b['bind']('isEnabled')['to'](this,'isProcessing',_0x310e96=>!_0x310e96),_0x40d69b['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x40d69b['icon']=_0x11d9a5,_0x40d69b['class']=_0x2e5691+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x40d69b['icon']=_0x45e942,_0x40d69b['class']=_0x2e5691;},0x3e8);}),_0x40d69b;}['_copyHTMLToClipboard'](_0x2e87f2){const {window:_0x564aef,document:_0x36f855}=ct;if(_0x564aef['ClipboardItem']){const {Blob:_0x9dd7d,ClipboardItem:_0x1071c5}=_0x564aef,_0x4347d1=[new _0x1071c5({'text/html':new _0x9dd7d([_0x2e87f2['innerHTML']],{'type':'text/html'}),'text/plain':new _0x9dd7d([_0x2e87f2['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x4347d1);}else{const _0x33ff5f=_0x36f855['createElement']('div');_0x33ff5f['style']['position']='absolute',_0x33ff5f['style']['left']='-9999px',_0x33ff5f['innerHTML']='<span>[</span>'+_0x2e87f2['innerHTML']+'<span>]</span>',_0x36f855['body']['appendChild'](_0x33ff5f);const _0x2f9da2=_0x36f855['createRange']();_0x2f9da2['setStartAfter'](_0x33ff5f['firstElementChild']),_0x2f9da2['setEndBefore'](_0x33ff5f['lastElementChild']);const _0x39b8b5=_0x564aef['getSelection']();_0x39b8b5['removeAllRanges'](),_0x39b8b5['addRange'](_0x2f9da2),_0x36f855['execCommand']('copy'),_0x33ff5f['remove']();}}}class ContentFieldView extends Nt{constructor(_0x1b8fc9,_0xec0039=''){super(_0x1b8fc9),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0xec0039,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x375f7a){this['element']['innerHTML']=_0x375f7a;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x1d22c6=new Nt(),_0x38c97e=this['locale'],_0x35c861=new yt();return _0x35c861['isVisible']=!0x0,_0x1d22c6['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x35c861,{'text':Ri(_0x38c97e,'AI\x20is\x20writing...')}]}),_0x1d22c6['render'](),_0x1d22c6;}}class AIFormErrorView extends Nt{constructor(_0x3715f3,_0x4ce0bf=''){super(_0x3715f3);const _0x2681f8=new xt(),_0x292f72=this['bindTemplate'];this['set']('text',_0x4ce0bf),_0x2681f8['content']=_0x2a1448,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x2681f8,{'text':_0x292f72['to']('text')}]});}}class AIFormPromptView extends Lt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x4b41a6,_0x469fc0){super(_0x4b41a6,_0x469fc0),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',(_0x1c2d2f,_0x41d609)=>{_0x1c2d2f['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x41d609());});}['_createSubmitButton'](){const _0x3c94a8=new vt(this['locale']),_0x4cd553=this['locale'];return _0x3c94a8['set']({'icon':_0x3b5d60,'label':Ri(_0x4cd553,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x3c94a8['on']('execute',()=>{this['submit']();}),_0x3c94a8['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0xe2cf47,_0xa7dc40)=>!_0xe2cf47&&_0xa7dc40),_0x3c94a8;}['_createShowHistoryButton'](){const _0x1bc67a=new vt(this['locale']),_0x4b7e40=this['resultsView'],_0x18b1bb=this['locale'];_0x1bc67a['set']({'label':Ri(_0x18b1bb,'History'),'withText':!0x1,'icon':_0x1bbebc,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x1bc67a['bind']('isOn')['to'](_0x4b7e40,'isVisible'),_0x1bc67a['bind']('isEnabled')['to'](this,'isEnabled'),_0x1bc67a['on']('execute',()=>{_0x4b7e40['isVisible']=!_0x4b7e40['isVisible'],_0x4b7e40['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x5d12f1=()=>{ct['window']['requestAnimationFrame'](()=>{if(lt(this['element'])){const _0x190dbc=new ut(this['queryView']['fieldView']['element']),_0x577e25=_0x190dbc['width'],_0x116a2b='rtl'===_0x18b1bb['uiLanguageDirection']?'left':'right';_0x190dbc['excludeScrollbarsAndBorders'](),_0x1bc67a['element']['style'][_0x116a2b]=_0x577e25-_0x190dbc['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x5d12f1),this['on']('render',_0x5d12f1),_0x1bc67a;}['submit'](){const _0x27d2b0=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x27d2b0);}['focus'](_0x19309d){-0x1===_0x19309d?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class AIHistoryListView extends Dt{['historyGroupView'];['clearHistoryButton'];constructor(_0x587299){super(_0x587299),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Vt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Ri(_0x587299,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x2d394a=0x0;for(const _0x576bf1 of this['items'])_0x2d394a+=_0x576bf1['items']['length'];return{'resultsCount':_0x2d394a,'totalItemsCount':_0x2d394a};}['_createClearHistoryButton'](){const _0x27c8d7=this['locale'],_0x1477eb=new vt(this['locale']);return _0x1477eb['set']({'label':'('+Ri(_0x27c8d7,'Clear')+')','withText':!0x0}),_0x1477eb['on']('execute',()=>this['fire']('clearHistory')),_0x1477eb;}}class AIHistoryListItemView extends Pt{constructor(_0x73f7de){super();const _0xf32e88=new Ht(),_0x35e324=new vt(this['locale'],_0xf32e88);this['children']['add'](_0x35e324),_0x35e324['set']({'label':_0x73f7de['prompt'],'withText':!0x0}),_0x35e324['on']('execute',()=>{this['fire']('execute',{'value':_0x5f40c3(_0x73f7de['prompt'])});});}}const vi='CKEditor/AIFormView/PromptHistory';class PromptHistory extends dt{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x1b0d68,_0x387fbb)=>{const _0x4ef90b=Ni(_0x387fbb['prompt']);for(const _0x5a1002 of this)if(_0x5a1002!=_0x387fbb&&Ni(_0x5a1002['prompt'])===_0x4ef90b){this['remove'](_0x5a1002);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x2eeec0=sessionStorage['getItem'](vi)||'[]';this['addMany'](JSON['parse'](_0x2eeec0));}['_saveToSessionStorage'](){sessionStorage['setItem'](vi,JSON['stringify'](this['map'](_0x257f87=>_0x257f87)));}}function Ni(_0x2bb42f){return _0x2bb42f['toLowerCase']()['trim']();}class AIFormView extends Nt{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x288547,_0xaf8119,_0x22847b=''){super(_0x288547),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',ki['REPLACE']),this['_promptHistory']=new PromptHistory(),this['errorView']=new AIFormErrorView(_0x288547),this['contentArea']=new AIFormContentArea(_0x288547,_0x22847b),this['contentArea']['bind']('isProcessing')['to'](this),this['contentArea']['bind']('value')['to'](this),this['toolbar']=this['_createToolbar'](),this['toolbar']['bind']('mainAction')['to'](this),this['promptView']=this['_createPromptView'](),this['focusTracker']=new _t(),this['keystrokes']=new It(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Mt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['focusCycler']['chain'](this['promptView']['focusCycler']),this['promptView']['queryView']['fieldView']['bind']('value')['to'](this,'prompt');const _0x53b02e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0xaf8119],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x53b02e['if']('isError','ck-hidden',_0x24b30f=>!_0x24b30f)]},'children':[this['errorView']]},this['contentArea'],this['toolbar'],this['promptView']]}]});}['render'](){super['render'](),this['focusTracker']['add'](this['contentArea']['element']),this['focusTracker']['add'](this['contentArea']['copyButtonView']['element']),this['focusTracker']['add'](this['toolbar']['element']),this['focusTracker']['add'](this['promptView']['element']),this['keystrokes']['listenTo'](this['element']);}['focus'](_0x8ff4da=0x1){-0x1===_0x8ff4da?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['reset'](){this['prompt']='',this['value']='',this['isError']=!0x1,this['promptView']['reset'](),this['contentArea']['isVisible']=!0x1,this['toolbar']['isVisible']=!0x1;}['_createPromptView'](){const _0x7303b=this['locale'],_0x4f4435=new AIFormPromptView(_0x7303b,{'queryView':{'label':Ri(_0x7303b,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':Ut,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Ri(_0x7303b,'Empty\x20history'),'secondary':Ri(_0x7303b,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x4f4435['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x2444b9,_0x3b8a36)=>_0x2444b9&&!_0x3b8a36),this['listenTo'](_0x4f4435,'submit',(_0x1afcd5,_0x1a55cc)=>{this['prompt']=_0x1a55cc;const _0x488807=_0x353660(_0x1a55cc);this['fire']('submitPrompt',_0x488807),_0x1a55cc['trim']()&&this['_promptHistory']['add']({'prompt':_0x488807},0x0);},{'priority':'high'}),_0x4f4435;}['_createHistoryView'](){const _0x584117=new AIHistoryListView(this['locale']);return _0x584117['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](AIHistoryListItemView),_0x584117['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x584117;}['_createToolbar'](){const _0x1e0867=new AIFormToolbarView(this['locale']);return _0x1e0867['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x2f9924,_0x475b5,_0x526c9b)=>_0x2f9924&&!_0x475b5&&!!_0x526c9b),_0x1e0867['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x1e0867['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x13628b,_0x2ce53c,_0x211025)=>_0x13628b&&!_0x2ce53c&&!!_0x211025),_0x1e0867['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x1e0867['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x535e0a,_0x56a551)=>_0x535e0a&&!_0x56a551),_0x1e0867['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x1e0867['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x1e0867['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x1e0867;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x2bf27e=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Ri(_0x2bf27e,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x477668){const _0x2f138f=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x477668||Ri(_0x2f138f,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const yi=globalThis['DataTransfer'];class AIAssistantUI extends _0x1d5649{['licenseKey'];['_licenseKeyCheckInterval'];['_dialog'];['_formView'];['_aiAdapter'];['_aiAssistantController'];['_uiCssClasses']='';static get['pluginName'](){return'AIAssistantUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[_0x289225,AIAssistantEditing,AIAdapter,Bt];}constructor(_0x291fe0){super(_0x291fe0),_0x291fe0['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x291fe0['config']['define']('ai.assistant.contentAreaCssClass',''),_0x291fe0['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x291fe0['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x265392}=this;this['_aiAdapter']=_0x265392['plugins']['get'](AIAdapter),this['_dialog']=_0x265392['plugins']['get'](Bt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x5d5c28=new ShowAIAssistantCommand(_0x265392,Array['from'](this['_commandDefinitions']['values']()));_0x265392['commands']['add']('showAIAssistant',_0x5d5c28),_0x265392['ui']['componentFactory']['add']('aiCommands',_0x3107c9=>{const _0x7a89d0=Gt(_0x3107c9);return _0x7a89d0['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x7a89d0['buttonView']['set']({'label':Ri(_0x3107c9,'AI\x20Commands'),'icon':_0x1482e3,'tooltip':!0x0}),_0x7a89d0['on']('execute',_0x3635b1=>this['_onExecute'](_0x3635b1['source']['id'])),Ft(_0x7a89d0,_0x265392['ui']['view']['body'],function(_0x3ed12a){const _0x42026f=Ti(_0x3ed12a['config']['get']('ai.assistant.commands'),_0x3ed12a['locale']),_0x19ef5f=Li(_0x3ed12a,_0x42026f)['filter'](_0xb464b2=>_0xb464b2['commands']['length']);if(0x1===_0x19ef5f['length'])return Li(_0x3ed12a,_0x19ef5f[0x0]['commands'])['map'](_0x4da21d=>({'id':_0x4da21d['id'],'label':_0x4da21d['label']}));return _0x19ef5f['map'](_0x2a2663=>{const {groupId:_0x3c0aa,groupLabel:_0x49428c,commands:_0x4e070c}=_0x2a2663,_0xb9e47=Li(_0x3ed12a,_0x4e070c)['map'](_0x400e1c=>({'id':_0x400e1c['id'],'label':_0x400e1c['label']}));return{'id':_0x3c0aa,'menu':_0x49428c||_0x3c0aa,'children':_0xb9e47};});}(_0x265392),{'ariaLabel':Ri(_0x3107c9,'AI\x20Commands')}),_0x7a89d0['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x5d5c28['on']('change:enabledCommandsIds',_0x428af3),_0x7a89d0['menuView']['once']('render',_0x428af3),_0x7a89d0;function _0x428af3(){_0x7a89d0['isEnabled']=_0x5d5c28['enabledCommandsIds']['length']>0x0;for(const _0xaadfb0 of _0x7a89d0['menuView']['buttons'])_0xaadfb0['isEnabled']=_0x5d5c28['enabledCommandsIds']['includes'](_0xaadfb0['id']);}}),_0x265392['ui']['componentFactory']['add']('menuBar:aiCommands',_0x5d546e=>{const _0x24b38d=new Kt(_0x5d546e);_0x24b38d['buttonView']['set']({'label':Ri(_0x5d546e,'AI\x20Commands'),'icon':_0x1482e3}),_0x24b38d['bind']('isEnabled')['to'](_0x5d5c28,'enabledCommandsIds',_0x57882c=>_0x57882c['length']>0x0);const _0x270764=Ti(_0x265392['config']['get']('ai.assistant.commands'),_0x5d546e);return this['_populateMenuBarMenu'](_0x5d5c28,_0x24b38d,_0x270764,_0x4054fb=>this['_onExecute'](_0x4054fb)),_0x24b38d;}),_0x265392['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x5c214f=this['_createAIAssistantUIButton'](vt);return _0x5c214f['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x5c214f;}),_0x265392['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x5d776f=this['_createAIAssistantUIButton'](Wt);return _0x5d776f['set']({'role':'menuitemcheckbox'}),_0x5d776f;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x2e7e3f=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x1d64ca;for(const _0x1f11ca in _0x2e7e3f){const _0x3bfdd7=_0x1f11ca,_0x30612d=_0x2e7e3f[_0x3bfdd7];if('aiLicenseKeyValid'==_0x30612d||'aiLicenseKeyInvalid'==_0x30612d||'aiLicenseKeyExpired'==_0x30612d||'aiLicenseKeyDomainLimit'==_0x30612d||'aiLicenseKeyNotAllowed'==_0x30612d||'aiLicenseKeyEvaluationLimit'==_0x30612d||'aiLicenseKeyUsageLimit'==_0x30612d){delete _0x2e7e3f[_0x3bfdd7],_0x1d64ca=_0x30612d,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x1d64ca&&_0x2e7e3f['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x1d64ca&&_0x2e7e3f['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x1d64ca&&_0x2e7e3f['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x1d64ca&&_0x2e7e3f['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x1d64ca&&_0x2e7e3f['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x1d64ca&&_0x2e7e3f['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x283b17='',_0x1bc048='',_0x98b66d='custom'){const _0x44c805=this['editor'],_0x327716=_0x44c805['editing']['view'],_0xd1450b=_0x44c805['plugins']['get'](AIAssistantEditing),_0x1c1154=_0x44c805['plugins']['get'](_0x289225);_0xd1450b['showFakeVisualSelection']();const _0x4107ea=new yi(),_0x525415=new ClipboardEvent('copy',{'clipboardData':_0x4107ea}),_0x1f27bb=new _0x1f61bf(_0x4107ea),_0x462285=new _0x527936(_0x327716,_0x525415,{'dataTransfer':_0x1f27bb});_0x1c1154['_forceMarkersCopy']('comment',()=>{_0x327716['document']['fire']('copy',_0x462285);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new AIAssistantController(_0x44c805,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x2af7fd=_0x1f27bb['getData']('text/html');const _0x153b33=_0x44c805['model']['document']['selection'],_0x217862=Array['from'](_0x153b33['getRanges']());0x1===_0x217862['length']&&_0x217862[0x0]['isFlat']&&!_0x153b33['getSelectedElement']()&&''!==_0x2af7fd['replace'](/&nbsp;/g,'')['trim']()&&(_0x2af7fd='<p>'+_0x2af7fd+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x98b66d,'query':_0x283b17,'htmlContent':_0x2af7fd,'label':_0x1bc048,'mainActionLabel':ki[_0x44c805['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x334a80,'title':Ri(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Yt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0xd1450b['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x36cd9a=new Map(),_0x5cf458=Ti(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0xe545b3 of _0x5cf458)for(const _0x2395d4 of _0xe545b3['commands'])_0x36cd9a['set'](_0x2395d4['id'],{..._0x2395d4,'groupId':_0xe545b3['groupId'],'groupLabel':_0xe545b3['groupLabel']||_0xe545b3['groupId']});return _0x36cd9a;}['_createAIAssistantUIButton'](_0x5c7588){const _0x59b1d3=this['editor'],_0x10c49e=_0x59b1d3['commands']['get']('showAIAssistant'),_0x4b2c40=new _0x5c7588(_0x59b1d3['locale']);return _0x4b2c40['set']({'label':Ri(_0x59b1d3['locale'],'AI\x20Assistant'),'icon':_0x334a80,'isToggleable':!0x0}),_0x4b2c40['bind']('isEnabled')['to'](_0x10c49e),_0x4b2c40['bind']('isOn')['to'](this['_dialog'],'id',_0x15491e=>'aiAssistant'===_0x15491e),this['listenTo'](_0x4b2c40,'execute',()=>{_0x4b2c40['isOn']?this['hideUI']():_0x10c49e['execute']();}),_0x4b2c40;}['_initView'](){const _0x193974=this['editor']['plugins']['get'](AIAssistantEditing);this['_formView']=new AIFormView(this['editor']['locale'],this['_uiCssClasses'],this['editor']['config']['get']('ai.assistant.contentAreaCssClass')),this['_formView']['on']('change:value',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['_formView']['promptView']['queryView']['fieldView']['on']('update',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['listenTo'](this['_formView'],'replaceContent',()=>{_0x193974['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x193974['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x5d19bc,ui:{ariaLiveAnnouncer:_0x117ea5}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x545c2c,_0x4e38ed,_0x2c0d07)=>{const _0x20f800=this['_aiAssistantController']['currentContext'];_0x2c0d07?_0x117ea5['announce'](Ri(_0x5d19bc,'AI\x20is\x20writing')):_0x20f800&&_0x117ea5['announce'](Ri(_0x5d19bc,'Generated\x20content:\x20%0',_0x20f800),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x321fec,_0x4ef0f2,_0x5d03bb)=>{if(_0x5d03bb){const _0x307d50=this['_formView']['errorView']['text'];_0x117ea5['announce'](Ri(_0x5d19bc,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x307d50));}});}['_onExecute'](_0xc00520){const _0x320573=this['_commandDefinitions']['get'](_0xc00520),_0x10a5f8=this['editor'],_0x5764e6=_0x10a5f8['model']['document']['selection'],_0x1c0cef=_0x10a5f8['commands']['get']('showAIAssistant'),_0x56ebc4=_0x10a5f8['plugins']['get'](AIAssistantEditing),_0x50839c=''+(_0x320573['groupId']!==wi?_0x320573['groupLabel']+':\x20':'')+_0x320573['label'];if(!0x1!==_0x320573['requiresContent']&&_0x5764e6['isCollapsed']){const _0x5c0548=At(_0x5764e6['getSelectedBlocks']())||_0x10a5f8['model']['schema']['getLimitElement'](_0x5764e6);_0x10a5f8['model']['change'](_0x304209=>{_0x304209['setSelection'](_0x5c0548,'in');});}_0x56ebc4['showFakeVisualSelection'](),_0x1c0cef['execute'](_0x320573['prompt'],_0x50839c,'command:'+_0xc00520);}['_populateMenuBarMenu'](_0xb70042,_0x3f77e9,_0x419721,_0x43fd1e){const _0x12ceef=this['editor'],_0x19558e=_0x12ceef['locale'],_0x2a1fd3=new $t(_0x19558e),_0x34aec1=Li(_0x12ceef,_0x419721)['filter'](_0x24e5c3=>_0x24e5c3['commands']['length']);0x1===_0x34aec1['length']?this['_getMenuBarGroupButtons']({'command':_0xb70042,'commands':_0x34aec1[0x0]['commands'],'parentMenuView':_0x3f77e9,'onExecute':_0x43fd1e})['forEach'](_0x2dc1a2=>_0x2a1fd3['items']['add'](_0x2dc1a2)):_0x34aec1['forEach'](({groupId:_0x285dc9,groupLabel:_0xc712a9,commands:_0x170363})=>{const _0x9aba63=new qt(_0x19558e,_0x3f77e9),_0x5077e7=new Kt(_0x19558e),_0x24db49=new $t(_0x19558e),_0x4e2bbd=this['_getMenuBarGroupButtons']({'command':_0xb70042,'commands':_0x170363,'parentMenuView':_0x5077e7,'onExecute':_0x43fd1e});_0x5077e7['buttonView']['set']({'label':_0xc712a9||_0x285dc9}),_0x5077e7['delegate']('execute')['to'](_0x3f77e9),_0x24db49['items']['addMany'](_0x4e2bbd),_0x5077e7['panelView']['children']['add'](_0x24db49),_0x9aba63['children']['add'](_0x5077e7),_0x2a1fd3['items']['add'](_0x9aba63);}),_0x3f77e9['panelView']['children']['add'](_0x2a1fd3);}['_getMenuBarGroupButtons']({command:_0x1e6847,commands:_0x396f18,parentMenuView:_0x46d4d1,onExecute:_0x2360c3}){const _0x2e1098=this['editor'],_0x5253ac=_0x2e1098['locale'];return Li(_0x2e1098,_0x396f18)['map'](_0x3e9666=>{const _0xcb3bf2=new qt(_0x5253ac,_0x46d4d1),_0xaa822c=new Wt(_0x5253ac);return _0xaa822c['set']({'label':_0x3e9666['label']}),_0xaa822c['delegate']('execute')['to'](_0x46d4d1),_0xaa822c['on']('execute',()=>_0x2360c3(_0x3e9666['id'])),_0xaa822c['bind']('isEnabled')['to'](_0x1e6847,'enabledCommandsIds',_0x272447=>_0x272447['includes'](_0x3e9666['id'])),_0xcb3bf2['children']['add'](_0xaa822c),_0xcb3bf2;});}}function xi(_0x1b49e9,_0x39733f){return void 0x0!==_0x1b49e9['order']&&void 0x0===_0x39733f['order']?0x1:void 0x0===_0x1b49e9['order']&&void 0x0!==_0x39733f['order']?-0x1:void 0x0!==_0x1b49e9['order']&&void 0x0!==_0x39733f['order']?_0x1b49e9['order']-_0x39733f['order']:0x0;}function Li(_0x21e115,_0x4de535){_0x4de535['sort'](xi);const _0x205e55={},_0x50d8a8=[];for(const _0x143ea2 of _0x4de535)if(void 0x0!==_0x143ea2['order']){if(_0x143ea2['order']in _0x205e55)throw new at('ai-commands-config-order-collision',_0x21e115,{'conflictingDefinitions':[_0x143ea2,_0x205e55[_0x143ea2['order']]]});_0x205e55[_0x143ea2['order']]=_0x143ea2,_0x50d8a8['splice'](_0x143ea2['order'],0x0,_0x143ea2);}else _0x50d8a8['push'](_0x143ea2);return _0x50d8a8;}class AIAssistant extends _0x1d5649{static get['requires'](){return[AIAssistantUI,AIAssistantEditing];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x11ad53){super(_0x11ad53);const _0x325bfd=_0x11ad53['config'],_0xe9f0e8=_0x11ad53['locale'];_0x325bfd['define']('ai.assistant.preserveComments',!0x0),_0x325bfd['define']('ai.assistant.commands',Di(_0xe9f0e8)),_0x325bfd['define']('ai.assistant.extraCommandGroups',[]),_0x325bfd['define']('ai.assistant.removeCommands',[]);let _0x36c59a=Ti(_0x325bfd['get']('ai.assistant.commands'),_0xe9f0e8);const _0x508231=_0x325bfd['get']('ai.assistant.extraCommandGroups'),_0x56f594=_0x325bfd['get']('ai.assistant.removeCommands');_0x508231['forEach'](_0x52ea24=>{const _0x5ef3e0=_0x36c59a['find'](_0xe00aab=>_0xe00aab['groupId']===_0x52ea24['groupId']);_0x5ef3e0?_0x5ef3e0['commands']=_0x5ef3e0['commands']['concat'](_0x52ea24['commands']):_0x36c59a['push'](_0x52ea24);}),_0x36c59a=_0x36c59a['filter'](_0x4f04c0=>!_0x56f594['includes'](_0x4f04c0['groupId'])),_0x36c59a['forEach'](_0x539a9a=>{_0x539a9a['commands']=_0x539a9a['commands']['filter'](_0x124b59=>!_0x56f594['includes'](_0x124b59['id']));}),_0x325bfd['set']('ai.assistant.commands',_0x36c59a);}}function Di(_0x492090){return[{'groupId':'editOrReview','groupLabel':Ri(_0x492090,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Ri(_0x492090,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Ri(_0x492090,'Make\x20shorter'),'prompt':'Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.'},{'id':'makeLonger','label':Ri(_0x492090,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Ri(_0x492090,'Simplify\x20language'),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':'generate','groupLabel':Ri(_0x492090,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Ri(_0x492090,'Summarize'),'prompt':'Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.'},{'id':'continue','label':Ri(_0x492090,'Continue'),'prompt':'Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.'}]},{'groupId':'changeTone','groupLabel':Ri(_0x492090,'Change\x20tone'),'commands':[{'id':'professional','label':Ri(_0x492090,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Ri(_0x492090,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Ri(_0x492090,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Ri(_0x492090,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Ri(_0x492090,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Ri(_0x492090,'Change\x20style'),'commands':[{'id':'business','label':Ri(_0x492090,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Ri(_0x492090,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Ri(_0x492090,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Ri(_0x492090,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Ri(_0x492090,'Translate'),'commands':[{'id':'translateEnglish','label':Ri(_0x492090,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Ri(_0x492090,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Ri(_0x492090,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Ri(_0x492090,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Ri(_0x492090,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Ri(_0x492090,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Ri(_0x492090,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Ri(_0x492090,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}class AITextAdapter extends _0x1d5649{['abortController'];static get['requires'](){return[AIAdapter];}constructor(_0x2aa5ec){super(_0x2aa5ec),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](AIAdapter)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0xee9b14){return this['sendRequest'](_0xee9b14)['catch'](_0x594da1=>{if(_0x594da1 instanceof AIRequestError)return Promise['reject'](_0x594da1);if('AbortError'==_0x594da1['name'])return Promise['resolve']();throw console['error'](_0x594da1),new at('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x3f5db0,_0x3246cd){const _0x1789de=this['editor']['locale'],_0x4dfbd6={'Content-Type':'application/json'};if('object'==typeof _0x3f5db0)Object['assign'](_0x4dfbd6,_0x3f5db0);else{if(_0x3f5db0)try{const _0x2fb933=await _0x3f5db0(_0x3246cd);Object['assign'](_0x4dfbd6,_0x2fb933);}catch{return Promise['reject'](new AIRequestError(Ri(_0x1789de,'AI_ERROR_GET_HEADERS')));}}return _0x4dfbd6;}async['_prepareRequestParameters'](_0xa0aebf,_0x1b7f8d){const _0x20f51d=this['editor']['locale'];if('object'==typeof _0xa0aebf)return _0xa0aebf;try{return await _0xa0aebf(_0x1b7f8d);}catch{return Promise['reject'](new AIRequestError(Ri(_0x20f51d,'AI_ERROR_GET_PARAMETERS')));}}}class OpenAITextAdapter extends AITextAdapter{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x50dd3d){super(_0x50dd3d),_0x50dd3d['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x50dd3d['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x50dd3d['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x50dd3d['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x50dd3d['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x50dd3d['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x67a07b,context:_0x364272,onData:_0x491e22,actionId:_0x216d96}){const _0x35e57c=this['editor']['locale'],_0x572a73=await this['prepareMessages'](_0x67a07b,_0x364272,_0x216d96),_0x17af54=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x216d96),_0x3752e4=await this['_prepareRequestParameters'](this['_requestParameters'],_0x216d96),_0x1251fa={'messages':_0x572a73,..._0x3752e4},_0x1a5910={'method':'POST','headers':_0x17af54,'body':JSON['stringify'](_0x1251fa),'signal':this['abortController']['signal']},_0x592c57=await fetch(this['_apiUrl'],_0x1a5910);if(_0x592c57['ok'])return _0x3752e4['stream']?await this['_readStreamableResponse'](_0x592c57,_0x491e22):await this['_readStaticResponse'](_0x592c57,_0x491e22),Promise['resolve']();{const _0x3a9439=await _0x592c57['text']();return _0x3a9439['includes']('context_length_exceeded')?Promise['reject'](new AIRequestError(Ri(_0x35e57c,'AI_ERROR_CONTEXT_LENGTH'))):_0x3a9439['includes']('Moderation')?Promise['reject'](new AIRequestError(Ri(_0x35e57c,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x3a9439));}}async['prepareMessages'](_0x40ee2c,_0x2659fb,_0x10d5bb){let _0x3d579a,_0x5cf3ef;return _0x2659fb?(_0x3d579a='Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x5cf3ef='Instruction:\x0a'+_0x40ee2c+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x2659fb):(_0x3d579a='Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x5cf3ef=_0x40ee2c),[{'role':'system','content':_0x3d579a},{'role':'user','content':_0x5cf3ef}];}async['_readStreamableResponse'](_0xaddad1,_0x417b27){const _0x545571=_0xaddad1['body']['getReader'](),_0x48b6bb=new TextDecoder();let _0x4fa044='',_0x4d7630='',_0x23404e='',_0x3dc0ce=!0x1;for(;!_0x3dc0ce;){const {done:_0xc6230,value:_0x17ab4a}=await _0x545571['read'](),_0xa08544=_0x4fa044+_0x48b6bb['decode'](_0x17ab4a);let _0x35e33a='';_0x3dc0ce=_0xc6230;try{_0x35e33a=this['_cleanUpData'](_0xa08544),_0x4fa044='';}catch{_0x4fa044=_0xa08544;continue;}_0x4d7630+=_0x35e33a,!_0x3dc0ce&&this['_isBufferIncomplete'](_0x4d7630)||_0x4d7630&&(_0x23404e+=_0x4d7630,_0x4d7630='',_0x417b27(_0x23404e));}return Promise['resolve']();}async['_readStaticResponse'](_0x3e79ab,_0x44d08a){return _0x44d08a((await _0x3e79ab['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x57dab0){const _0x421b20=_0x57dab0['split']('<')['length']!==_0x57dab0['split']('>')['length'],_0x23a006=_0x57dab0['length']<0x1e;return _0x421b20&&_0x23a006;}['_cleanUpData'](_0x479be6){return _0x479be6['split'](/\n(?![^{]*\})/g)['map'](_0x2cb596=>_0x2cb596['replace']('data:\x20',''))['filter'](_0x97dd7d=>_0x97dd7d&&_0x97dd7d['length']>0x0&&'[DONE]'!==_0x97dd7d)['map'](_0x557bab=>{const {choices:_0x322b9f}=JSON['parse'](_0x557bab);if(_0x322b9f[0x0]?.['delta']?.['content'])return _0x322b9f[0x0]['delta']['content'];})['filter'](_0x7dc1d6=>_0x7dc1d6)['join']('');}}class AWSTextAdapter extends AITextAdapter{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),gt('ai-aws-adapter-not-supported');}async['sendRequest'](_0x3e92a7){throw Ct('ai-aws-adapter-not-supported'),new AIRequestError(Ri(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}}class TabButtonView extends vt{constructor(_0x1dcce0,_0xb63b15={}){super(_0x1dcce0),this['isToggleable']=!0x0,this['set']('side',_0xb63b15['side']||'top');const _0x4bbb45=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...mt(_0xb63b15['class']||[]),_0x4bbb45['to']('side',_0x542343=>'ck-tab-button_'+_0x542343),_0x4bbb45['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class TabPanelView extends Nt{['children'];constructor(_0x38b8a8,_0x1849c0={}){super(_0x38b8a8);const _0x2c5749=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...mt(_0x1849c0['class']||[]),_0x2c5749['to']('class'),_0x2c5749['if']('isVisible','ck-hidden',_0x305253=>!_0x305253)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class AITabsView extends Nt{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x49420b,_0x5a7a64={}){super(_0x49420b),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x5a7a64['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x5a7a64['collapsible']||!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'activeTab',(_0x1eebdd,_0x409e49)=>_0x1eebdd&&null!==_0x409e49);const _0x399225=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...mt(_0x5a7a64['class']||[]),_0x399225['to']('side',_0x35ae2f=>'ck-tabs_'+_0x35ae2f),_0x399225['to']('class'),_0x399225['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x399225['to']('activeTab',_0x32cd27=>null===_0x32cd27?'ck-ai-tabs_collapsed':'')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x399225['to']('side',_0x3e8e56=>'ck-tabs__buttons-container_'+_0x3e8e56)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x399225['to']('side',_0x27bb0d=>'ck-tabs__panels-container_'+_0x27bb0d)]},'children':this['panelViews']},...mt(_0x5a7a64['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x1742ae){const _0x7c43c0=this['_tabs']['get'](_0x1742ae);return _0x7c43c0||null;}['addTab'](_0x372cf4){const _0x12129b=this['_setupButton']({'id':_0x372cf4['id'],'label':_0x372cf4['buttonLabel'],'icon':_0x372cf4['buttonIcon'],'order':_0x372cf4['order']}),_0x448965=new TabPanelView(this['locale']);return _0x448965['render'](),_0x372cf4['content']&&_0x448965['children']['add'](_0x372cf4['content']),this['panelViews']['add'](_0x448965),this['_tabs']['set'](_0x372cf4['id'],{'button':_0x12129b,'panel':_0x448965,'order':void 0x0!==_0x372cf4['order']?_0x372cf4['order']:null}),this['fire']('addTab:'+_0x372cf4['id'],{'id':_0x372cf4['id'],'button':_0x12129b,'panel':_0x448965}),null===this['activeTab']?this['activateTab'](_0x372cf4['id']):this['_hidePanel'](_0x372cf4['id']),{'button':_0x12129b,'panel':_0x448965};}['activateTab'](_0x53acb5){if(null!==_0x53acb5&&!this['getTab'](_0x53acb5))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x53acb5});if(this['activeTab']===_0x53acb5)return;const _0x48cf61=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x53acb5,_0x53acb5&&this['_showPanel'](_0x53acb5),this['fire']('activateTab:'+_0x53acb5,{'newTab':_0x53acb5,'oldTab':_0x48cf61});}['toggleTabPanel'](_0x3a5b54){if(!this['getTab'](_0x3a5b54))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x3a5b54});this['activeTab']===_0x3a5b54?this['collapsible']&&(this['activeTab']=null):this['activateTab'](_0x3a5b54);}['showTab'](_0x5d1a6a){if(!this['getTab'](_0x5d1a6a))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x5d1a6a});this['_showPanel'](_0x5d1a6a),this['_showButton'](_0x5d1a6a),this['fire']('show:'+_0x5d1a6a,_0x5d1a6a);}['hideTab'](_0x594b98){if(!this['getTab'](_0x594b98))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x594b98});const _0x4c7705=this['activeTab'];this['_hidePanel'](_0x594b98),this['_hideButton'](_0x594b98);const _0x55f5ed=this['getTabIds']();_0x4c7705===_0x594b98&&_0x55f5ed['length']>0x1&&this['activateTab'](_0x55f5ed['find'](_0x21705c=>_0x21705c!==_0x594b98)),this['fire']('hide:'+_0x594b98,_0x594b98);}['_getPanel'](_0x25f28e){const _0x5a5dc7=this['_tabs']['get'](_0x25f28e);return _0x5a5dc7?_0x5a5dc7['panel']:null;}['_showPanel'](_0x35f31b){null!==this['activeTab']&&this['activeTab']!==_0x35f31b||this['_getPanel'](_0x35f31b)['show']();}['_hidePanel'](_0x5b955e){const _0x58d333=this['_getPanel'](_0x5b955e);_0x58d333['isVisible']&&(this['activeTab']===_0x5b955e&&(this['activeTab']=null),_0x58d333['hide']());}['_getButton'](_0x1628f9){const _0x2e399c=this['_tabs']['get'](_0x1628f9);return _0x2e399c?_0x2e399c['button']:null;}['_showButton'](_0x4fdf77){this['_getButton'](_0x4fdf77)['show']();}['_hideButton'](_0x1304ec){this['_getButton'](_0x1304ec)['hide']();}['_setupButton'](_0x207466){const _0x36dddb=new TabButtonView(this['locale'],{'side':this['side']}),_0xe6571c=this['buttonViews'];if(_0x36dddb['set']({'label':_0x207466['label'],'icon':_0x207466['icon'],'tooltip':!0x0,'withText':!0x0}),_0x36dddb['bind']('isOn')['to'](this,'activeTab',_0x1bcb15=>_0x1bcb15===_0x207466['id']),_0x36dddb['bind']('side')['to'](this,'side'),_0x207466['order']){const _0x52b718=[...this['_tabs']]['reduce']((_0x1bb43e,_0x5e6d18)=>{const _0x3d2668=_0x5e6d18[0x0],{order:_0x38b03d}=_0x5e6d18[0x1];return!_0x38b03d||_0x38b03d>_0x207466['order']?_0x1bb43e:_0x38b03d>=_0x1bb43e['order']?{'id':_0x3d2668,'order':_0x38b03d}:_0x1bb43e;},{'id':'','order':0x0}),_0x22cf63=_0xe6571c['getIndex'](this['_getButton'](_0x52b718['id']));_0xe6571c['add'](_0x36dddb,_0x22cf63+0x1);}else _0xe6571c['add'](_0x36dddb);return _0x36dddb['on']('execute',()=>{this['toggleTabPanel'](_0x207466['id']);}),_0x36dddb;}}const Vi=['overlay','sidebar','custom'],Pi=['left','right'];class AITabsMainView extends AITabsView{constructor(_0x6a623c,_0x2d9b67={}){super(_0x6a623c,_0x2d9b67),this['set']('type',_0x2d9b67['type']||'sidebar'),this['set']('side',_0x2d9b67['side']||'right'),this['set']('isVisible',_0x2d9b67['visibleByDefault']??!0x0);const _0x5712cb=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x5712cb['if']('type','ck-ai-tabs__overlay',_0x289004=>'overlay'===_0x289004),_0x5712cb['if']('type','ck-ai-tabs__sidebar',_0x547670=>'sidebar'===_0x547670),_0x5712cb['if']('isVisible','ck-hidden',_0x3fefb5=>!_0x3fefb5)]}}),this['buttonViews']['on']('add',(_0x3c30c5,_0x5f5198)=>{_0x5f5198['set']('withText',!0x1);});}}class AITabs extends _0x4127f4{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x54bb8a){if(super(_0x54bb8a),!this['context']['config']['get']('ai.container'))throw new at('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x34d818=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x34d818['showResizeButton']&&(this['showResizeButton']=_0x34d818['showResizeButton']),'sidebar'!==_0x34d818['type']&&'overlay'!==_0x34d818['type']||_0x34d818['side']&&(this['side']=_0x34d818['side']),'sidebar'===_0x34d818['type']){if(this['container']=_0x34d818['element'],this['set']('type','sidebar'),!this['container'])throw new at('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x34d818['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new AITabsMainView(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x34d818['visibleByDefault'],'collapsible':_0x34d818['collapsible']}),this['view']['render'](),this['view']['bind']('side')['to'](this,'side'),this['view']['bind']('type')['to'](this,'type'),this['container']&&this['container']['appendChild'](this['view']['element']),this['context']instanceof _0x461551&&this['context']['ui']['focusTracker']['add'](this['view']['element']),this['listenTo'](this,'resizeTabs',()=>{this['view']['isMaximized']=!this['view']['isMaximized'],this['fire']('resizedTabs',this['view']['isMaximized']);});}['switchType'](_0x3a7398){if(_0x3a7398&&this['type']!==_0x3a7398){if(!Vi['includes'](_0x3a7398))throw new at('ai-tabs-unsupported-ui-type');this['type']=_0x3a7398;}}['switchSide'](_0x44b42b){if(_0x44b42b&&this['side']!==_0x44b42b){if(!Pi['includes'](_0x44b42b))throw new at('ai-tabs-unsupported-ui-side');this['side']=_0x44b42b;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}}class AIConnector extends _0x4127f4{['_apiUrl'];['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x289907];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x479c23){super(_0x479c23),this['context']['config']['define']('ai.serviceUrl','https://ai.cke-cs.com/v1'),this['_apiUrl']=this['context']['config']['get']('ai.serviceUrl'),this['_token']=null,this['_decoder']=new TextDecoder(),this['_responseCache']=new Map();}['init'](){const _0x524d5e=this['context']['plugins']['get'](_0x289907);if(!_0x524d5e['token'])throw new at('ai-missing-token',this);this['_token']=_0x524d5e['token'];}['startConversation'](_0x29bddb,_0x194af2){const _0x27019=this['_sendApiRequest']('/conversations','POST',{'id':_0x29bddb,'group':_0x194af2});return{'getConversation':async()=>(await _0x27019['request'])['json'](),'abortController':_0x27019['abortController']};}['queryAssistant']({message:_0x24d8e1,conversationId:_0x30f94b,parts:_0x4a07a7,capabilities:_0x2d3fb7,model:_0x3df705,attributes:_0x1919e2}){const _0x3819ed={'prompt':_0x24d8e1,'content':_0x4a07a7,'model':_0x3df705,..._0x2d3fb7&&{'capabilities':_0x2d3fb7},..._0x1919e2&&{'attributes':_0x1919e2}},_0x104e61=this['_sendApiRequest']('/conversations/'+_0x30f94b+'/messages','POST',_0x3819ed);return{'getStream':async()=>{const _0xcf8b8e=(await _0x104e61['request'])['body'];return this['_getStreamReader'](_0xcf8b8e);},'abortController':_0x104e61['abortController']};}['executeCustomAction']({content:_0x3279c6,message:_0x1f69c9,model:_0x4931b7,outputFormat:_0x319961}){const _0x5ebdd4={'content':[{'type':'text','content':_0x3279c6}],'prompt':_0x1f69c9,'model':_0x4931b7,'outputFormat':_0x319961},_0x52ddbb=this['_sendApiRequest']('/actions/custom/calls','POST',_0x5ebdd4);return{'getStream':async()=>{const _0x26da96=(await _0x52ddbb['request'])['body'];return this['_getStreamReader'](_0x26da96);},'abortController':_0x52ddbb['abortController']};}['executeAction']({actionName:_0x4a12e6,content:_0x5d4b90,args:_0x17e1ce}){const _0x45cdfd={'content':[{'type':'text','content':_0x5d4b90}],'args':_0x17e1ce},_0x3a3b58=this['_sendApiRequest']('/actions/system/'+_0x4a12e6+'/calls','POST',_0x45cdfd);return{'getStream':async()=>{const _0x5f1342=(await _0x3a3b58['request'])['body'];return this['_getStreamReader'](_0x5f1342);},'abortController':_0x3a3b58['abortController']};}['uploadFile'](_0x356a2d,_0x4a62b3,_0x407a88){const _0x55b8bc=new FormData();_0x55b8bc['append']('file',_0x4a62b3,_0x4a62b3['name']),_0x407a88&&_0x55b8bc['append']('attributes',JSON['stringify'](_0x407a88));const _0x3be011=this['_sendApiRequest']('/conversations/'+_0x356a2d+'/files','POST',_0x55b8bc);return{'getId':async()=>(await _0x3be011['request'])['json'](),'abortController':_0x3be011['abortController']};}['fetchDocument'](_0x2ac627,_0x462d99){const _0x1fe1d6=this['_sendApiRequest']('/conversations/'+_0x2ac627+'/documents/'+_0x462d99,'GET');return{'getDocument':async()=>(await _0x1fe1d6['request'])['json'](),'abortController':_0x1fe1d6['abortController']};}['uploadDocument'](_0x333fbf,_0x39892b,_0x19aed1){const _0xf99893={'content':_0x39892b};_0x19aed1&&(_0xf99893['attributes']=_0x19aed1);const _0x5bf27c=this['_sendApiRequest']('/conversations/'+_0x333fbf+'/documents','POST',_0xf99893);return{'getId':async()=>(await _0x5bf27c['request'])['json'](),'abortController':_0x5bf27c['abortController']};}['uploadDocuments'](_0x1ad406,_0x55854f){const _0x2fa9af={'documents':_0x55854f['map'](_0x4c4e64=>({'content':_0x4c4e64['content'],'attributes':{'version':_0x4c4e64['version'],'sessionId':_0x4c4e64['sessionId'],'channelId':_0x4c4e64['channelId'],'rootName':_0x4c4e64['rootName'],'selections':_0x4c4e64['selections']},...void 0x0!==_0x4c4e64['name']?{'name':_0x4c4e64['name']}:{},...void 0x0!==_0x4c4e64['description']?{'description':_0x4c4e64['description']}:{}}))},_0x1fd8c5=this['_sendApiRequest']('/conversations/'+_0x1ad406+'/documents/batch','POST',_0x2fa9af);return{'getIds':async()=>(await _0x1fd8c5['request'])['json'](),'abortController':_0x1fd8c5['abortController']};}['fetchDocuments'](_0x5e2e0e,_0xfb7622){const _0xa85c83=new URLSearchParams();_0xa85c83['append']('documentIds',_0xfb7622['join'](','));const _0x5d8e5c=this['_sendApiRequest']('/conversations/'+_0x5e2e0e+'/documents/batch?'+_0xa85c83['toString'](),'GET');return{'getDocuments':async()=>(await _0x5d8e5c['request'])['json'](),'abortController':_0x5d8e5c['abortController']};}['fetchConversations'](_0x8eb7c7,_0x39ad23={}){const _0x3db82d=new URLSearchParams();_0x3db82d['append']('group',_0x8eb7c7),_0x3db82d['append']('excludeEmpty',!0x1!==_0x39ad23['excludeEmpty']?'true':'false'),_0x3db82d['append']('limit',_0x39ad23['limit']?_0x39ad23['limit']['toString']():'100'),_0x3db82d['append']('sortBy',_0x39ad23['sortBy']?_0x39ad23['sortBy']:'createdAt'),_0x3db82d['append']('order',_0x39ad23['order']?_0x39ad23['order']:'desc');const _0x56725b=this['_sendApiRequest']('/conversations?'+_0x3db82d['toString'](),'GET');return{'getConversations':async()=>{const _0x17afb5=await _0x56725b['request'];return(await _0x17afb5['json']())['items'];},'abortController':_0x56725b['abortController']};}['deleteConversation'](_0x31ac54){const _0x496f82=this['_sendApiRequest']('/conversations/'+_0x31ac54,'DELETE');return{'execute':async()=>{await _0x496f82['request'];},'abortController':_0x496f82['abortController']};}['updateConversation'](_0x46c998,_0x388e4e){const _0x44358a=this['_sendApiRequest']('/conversations/'+_0x46c998,'PATCH',_0x388e4e);return{'getResult':async()=>(await _0x44358a['request'],_0x388e4e),'abortController':_0x44358a['abortController']};}['fetchConversation'](_0x2fa925){const _0x135b35=this['_sendApiRequest']('/conversations/'+_0x2fa925,'GET');return{'getConversation':async()=>(await _0x135b35['request'])['json'](),'abortController':_0x135b35['abortController']};}['fetchConversationMessages'](_0x2b9c19){const _0x320daa=this['_sendApiRequest']('/conversations/'+_0x2b9c19+'/messages','GET');return{'getMessages':async()=>{const _0x385bf5=await _0x320daa['request'];return(await _0x385bf5['json']())['items'];},'abortController':_0x320daa['abortController']};}['uploadUrl'](_0x696bd4,_0x5abd01,_0x5ed79b){const _0x4c0462=this['_sendApiRequest']('/conversations/'+_0x696bd4+'/web-resources','POST',{'url':_0x5abd01,'attributes':_0x5ed79b});return{'getId':async()=>(await _0x4c0462['request'])['json'](),'abortController':_0x4c0462['abortController']};}['getModels'](_0x51ea58='en'){const _0xdc7966=new URLSearchParams();_0xdc7966['append']('language',_0x51ea58);const _0xe2a483='/models/1?'+_0xdc7966['toString'](),_0x451dc3=this['_sendApiRequest'](_0xe2a483,'GET',void 0x0,!0x0);return{'list':async()=>await(await _0x451dc3['request'])['json'](),'abortController':_0x451dc3['abortController']};}['deleteFile'](_0x467d25,_0x35d46e){const _0x69cda8=this['_sendApiRequest']('/conversations/'+_0x467d25+'/files/'+_0x35d46e,'DELETE');return{'execute':async()=>{await _0x69cda8['request'];},'abortController':_0x69cda8['abortController']};}['deleteDocument'](_0x560d83,_0x1abea2){const _0x45c81b=this['_sendApiRequest']('/conversations/'+_0x560d83+'/documents/'+_0x1abea2,'DELETE');return{'execute':async()=>{await _0x45c81b['request'];},'abortController':_0x45c81b['abortController']};}['deleteWebResource'](_0x4293c9,_0x234519){const _0x43779a=this['_sendApiRequest']('/conversations/'+_0x4293c9+'/web-resources/'+_0x234519,'DELETE');return{'execute':async()=>{await _0x43779a['request'];},'abortController':_0x43779a['abortController']};}['callSystemReview']({reviewName:_0x428610,content:_0xedaa8e,args:_0x7467fe}){const _0x3fc192=this['_sendApiRequest']('/reviews/system/'+_0x428610+'/calls','POST',{'content':[{'type':'text','content':_0xedaa8e}],'args':_0x7467fe});return{'getStream':async()=>{const _0x54feff=(await _0x3fc192['request'])['body'];return this['_getStreamReader'](_0x54feff);},'abortController':_0x3fc192['abortController']};}['callCustomReview']({content:_0x57f439,prompt:_0x354466,model:_0x535bdc}){const _0x2b0038=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x57f439}],'prompt':_0x354466,'model':_0x535bdc});return{'getStream':async()=>{const _0x4789c4=(await _0x2b0038['request'])['body'];return this['_getStreamReader'](_0x4789c4);},'abortController':_0x2b0038['abortController']};}['upsertAIChatRating'](_0x2ee831,_0xb7cdef,_0x11c830){const _0x3710ad=this['_sendApiRequest']('/conversations/'+_0x2ee831+'/messages/'+_0xb7cdef+'/ratings','PUT',{'positiveCount':_0x11c830['positiveCount'],'totalCount':_0x11c830['totalCount'],'modificationId':_0x11c830['modificationId']});return{'execute':async()=>{await _0x3710ad['request'];},'abortController':_0x3710ad['abortController']};}['upsertAIActionRating'](_0x1726ee,_0x10f892,_0x3150a2){const _0x3be271=this['_sendApiRequest']('/actions/system/'+_0x1726ee+'/calls/'+_0x10f892+'/ratings','PUT',{'positiveCount':_0x3150a2['positiveCount'],'totalCount':_0x3150a2['totalCount']});return{'execute':async()=>{await _0x3be271['request'];},'abortController':_0x3be271['abortController']};}['upsertCustomAIActionRating'](_0x48ddd2,_0x5bb726){const _0x63c732=this['_sendApiRequest']('/actions/custom/calls/'+_0x48ddd2+'/ratings','PUT',{'positiveCount':_0x5bb726['positiveCount'],'totalCount':_0x5bb726['totalCount']});return{'execute':async()=>{await _0x63c732['request'];},'abortController':_0x63c732['abortController']};}['upsertAIReviewRating'](_0x12484a,_0x124378,_0x3c6e84,_0x1a89d7){const _0x58fd54=this['_sendApiRequest']('/reviews/system/'+_0x12484a+'/calls/'+_0x124378+'/ratings','PUT',{'positiveCount':_0x3c6e84['positiveCount'],'totalCount':_0x3c6e84['totalCount'],'dataId':_0x1a89d7});return{'execute':async()=>{await _0x58fd54['request'];},'abortController':_0x58fd54['abortController']};}['upsertCustomAIReviewRating'](_0x469062,_0x15e395,_0x3019aa){const _0x4cf206=this['_sendApiRequest']('/reviews/custom/calls/'+_0x469062+'/ratings','PUT',{'positiveCount':_0x15e395['positiveCount'],'totalCount':_0x15e395['totalCount'],'dataId':_0x3019aa});return{'execute':async()=>{await _0x4cf206['request'];},'abortController':_0x4cf206['abortController']};}['_sendApiRequest'](_0x2ecb81,_0x1ccc12,_0x1f8de9,_0x124e5e=!0x1){const _0x50b43f=new AbortController(),_0xfa0454=_0x124e5e?_0x1ccc12+':'+_0x2ecb81:null;if(_0xfa0454){const _0x378cd0=this['_responseCache']['get'](_0xfa0454);if(_0x378cd0)return{'request':_0x378cd0['then'](_0x31ad08=>_0x31ad08['clone']()),'abortController':_0x50b43f};}const _0x582007=_0x1f8de9 instanceof FormData,_0x358bb8={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':pt};_0x1f8de9&&!_0x582007&&(_0x358bb8['Content-Type']='application/json');const _0xc22c2d={'method':_0x1ccc12,'headers':_0x358bb8,'signal':_0x50b43f['signal']};_0x1f8de9&&(_0xc22c2d['body']=_0x582007?_0x1f8de9:JSON['stringify'](_0x1f8de9));const _0xf39e36=fetch(''+this['_apiUrl']+_0x2ecb81,_0xc22c2d)['catch'](_0x12de25=>{_0xfa0454&&this['_responseCache']['delete'](_0xfa0454),this['_handleError'](_0x12de25);})['then'](_0x3f6e0c=>_0x3f6e0c['ok']?_0x3f6e0c:_0x3f6e0c['json']()['then'](_0x3b5e1b=>{throw _0xfa0454&&this['_responseCache']['delete'](_0xfa0454),{'url':this['_apiUrl'],'path':_0x2ecb81,'method':_0x1ccc12,'body':_0x1f8de9,'status':(_0x3f6e0c||{})['status'],'statusText':(_0x3f6e0c||{})['statusText'],'code':_0x3b5e1b['code'],'message':_0x3b5e1b['message'],'traceId':_0x3b5e1b['traceId']};}));return _0xfa0454&&this['_responseCache']['set'](_0xfa0454,_0xf39e36['then'](_0x2068ac=>_0x2068ac['clone']())),{'request':_0xf39e36,'abortController':_0x50b43f};}async*['_getStreamReader'](_0x4a3275){const _0x167ae4=[],_0x454d80=_0x4a3275['getReader'](),_0x4fec34=_0x26ef61({'onError':_0x4ba7da=>{this['_handleError'](_0x4ba7da);},'onEvent':_0x815d53=>{_0x815d53['data']=JSON['parse'](_0x815d53['data']),_0x167ae4['push'](_0x815d53);}});try{let _0x2760f9=!0x1;for(;!_0x2760f9;){const {done:_0x58bd43,value:_0x584264}=await _0x454d80['read']();_0x58bd43&&(_0x2760f9=!0x0),_0x4fec34['feed'](this['_decoder']['decode'](_0x584264,{'stream':!0x0})),yield*_0x167ae4,_0x167ae4['length']=0x0;}}catch(_0x4091b6){this['_handleError'](_0x4091b6);}finally{_0x454d80['releaseLock'](),_0x4fec34['reset']();}}['_handleError'](_0xae12ce){if(_0xae12ce instanceof at)throw _0xae12ce;if(_0xae12ce instanceof Error&&'AbortError'===_0xae12ce['name'])throw new at('ai-request-aborted',this,{'originalError':_0xae12ce});throw new at('ai-request-failed',this,{'originalError':_0xae12ce});}}function Hi(_0xb40f35,_0x1fd8bd,_0x5dc7dc){const t=_0xb40f35['t'];switch(_0x1fd8bd){case'AI_SUGGESTION_HEADER_TITLE':return t({'id':'AI_SUGGESTION_HEADER_TITLE','string':'Proposed\x20changes'});case'AI_SUGGESTION_BUTTON_SHOW_CHANGES':return t({'id':'AI_SUGGESTION_BUTTON_SHOW_CHANGES','string':'Show\x20details'});case'AI_MINI_TOOLBAR_LIKE':return t({'id':'AI_MINI_TOOLBAR_LIKE','string':'I\x20like\x20this\x20response'});case'AI_MINI_TOOLBAR_DISLIKE':return t({'id':'AI_MINI_TOOLBAR_DISLIKE','string':'I\x20don\x27t\x20like\x20this\x20response'});case'AI_MINI_TOOLBAR_COPY':return t({'id':'AI_MINI_TOOLBAR_COPY','string':'Copy\x20to\x20clipboard'});case'AI_SUGGESTION_CONTENT_PART_TITLE':return t({'id':'AI_SUGGESTION_CONTENT_PART_TITLE','string':'Change\x20%0'},_0x5dc7dc);case'AI_SUGGESTION_CONTENT_PART_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECTED','string':'Change\x20was\x20rejected'});case'AI_SUGGESTION_CONTENT_PART_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_OUTDATED','string':'Change\x20is\x20outdated'});case'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED':return t({'id':'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED','string':'Change\x20is\x20already\x20applied'});case'AI_SUGGESTION_CONTENT_PART_APPLY':return t({'id':'AI_SUGGESTION_CONTENT_PART_APPLY','string':'Apply\x20change'});case'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION':return t({'id':'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION','string':'Add\x20as\x20suggestion'});case'AI_SUGGESTION_CONTENT_PART_REJECT':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECT','string':'Reject\x20change'});case'AI_SUGGESTION_CONTENT_PART_REMOVED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REMOVED','string':'Removed\x20content.\x20Use\x20\x22Show\x20details\x22\x20to\x20learn\x20more.'});case'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED','string':'Approved'});case'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED','string':'Rejected'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED','string':'Outdated'});case'AI_DISCLAIMER_TEXT':return t({'id':'AI_DISCLAIMER_TEXT','string':'AI\x20can\x20make\x20mistakes.\x20Please\x20double-check\x20responses.'});case'AI_TABS_LABEL_MAXIMIZE':return t({'id':'AI_TABS_LABEL_MAXIMIZE','string':'Maximize'});case'AI_TABS_LABEL_MINIMIZE':return t({'id':'AI_TABS_LABEL_MINIMIZE','string':'Minimize'});case'AI_CHAT_HEADING':return t({'id':'AI_CHAT_HEADING','string':'Chat'});case'AI_CHAT_SOURCES_HEADER':return t({'id':'AI_CHAT_SOURCES_HEADER','string':'Sources'});case'AI_CHAT_UNTITLED_CONVERSATION':return t({'id':'AI_CHAT_UNTITLED_CONVERSATION','string':'Untitled\x20conversation'});case'AI_CHAT_LABEL_NEW_CHAT':return t({'id':'AI_CHAT_LABEL_NEW_CHAT','string':'New\x20chat'});case'AI_CHAT_STOP_GENERATING':return t({'id':'AI_CHAT_STOP_GENERATING','string':'Stop\x20generating'});case'AI_CHAT_IS_WRITING':return t({'id':'AI_CHAT_IS_WRITING','string':'AI\x20is\x20writing...'});case'AI_CHAT_PROMPT_EMPTY_ERROR':return t({'id':'AI_CHAT_PROMPT_EMPTY_ERROR','string':'This\x20field\x20cannot\x20be\x20empty.'});case'AI_CHAT_LABEL_SUBMIT':return t({'id':'AI_CHAT_LABEL_SUBMIT','string':'Submit'});case'AI_CHAT_WELCOME_MESSAGE':return t({'id':'AI_CHAT_WELCOME_MESSAGE','string':'Hi!\x20I\x20can\x20help\x20you\x20draft,\x20rewrite,\x20and\x20improve\x20your\x20text,\x20explore\x20ideas,\x20research\x20topics,\x20and\x20solve\x20problems.\x20How\x20can\x20I\x20help\x20right\x20now?'});case'AI_CHAT_ABORTED_MESSAGE':return t({'id':'AI_CHAT_ABORTED_MESSAGE','string':'Response\x20stopped.'});case'AI_CHAT_GENERIC_ERROR':return t({'id':'AI_CHAT_GENERIC_ERROR','string':'Something\x20went\x20wrong\x20while\x20processing\x20your\x20request.\x20Please\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_START_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_START_CONVERSATION','string':'Unable\x20to\x20start\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION','string':'Unable\x20to\x20load\x20chosen\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE','string':'Failed\x20to\x20upload\x20files:\x20%0.\x20Please\x20try\x20again.'},_0x5dc7dc);case'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES','string':'Unable\x20to\x20load\x20resources\x20from\x20%0.\x20Please\x20try\x20again.'},_0x5dc7dc);case'AI_CHAT_RESOURCE_LOAD_FAILED':return t({'id':'AI_CHAT_RESOURCE_LOAD_FAILED','string':'Failed\x20to\x20load\x20resource.\x20Please\x20try\x20again.'});case'AI_CHAT_CONTEXT_CURRENT_DOCUMENT':return t({'id':'AI_CHAT_CONTEXT_CURRENT_DOCUMENT','string':'Current\x20document'});case'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT','string':'Remove\x20from\x20context'});case'AI_CHAT_CONTEXT_ADD_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_ADD_CONTEXT','string':'Add\x20context'});case'AI_CHAT_CONTEXT_URL_LABEL':return t({'id':'AI_CHAT_CONTEXT_URL_LABEL','string':'URL'});case'AI_CHAT_CONTEXT_FILE_LABEL':return t({'id':'AI_CHAT_CONTEXT_FILE_LABEL','string':'File'});case'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL':return t({'id':'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL','string':'Current\x20context'});case'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL':return t({'id':'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL','string':'Selected\x20content'});case'AI_CHAT_SEARCH_WEB':return t({'id':'AI_CHAT_SEARCH_WEB','string':'Web\x20search'});case'AI_CHAT_ENABLE_WEB_SEARCH':return t({'id':'AI_CHAT_ENABLE_WEB_SEARCH','string':'Enable\x20web\x20search'});case'AI_CHAT_DISABLE_WEB_SEARCH':return t({'id':'AI_CHAT_DISABLE_WEB_SEARCH','string':'Disable\x20web\x20search'});case'AI_CHAT_REASONING':return t({'id':'AI_CHAT_REASONING','string':'Reasoning'});case'AI_CHAT_ENABLE_REASONING':return t({'id':'AI_CHAT_ENABLE_REASONING','string':'Enable\x20reasoning'});case'AI_CHAT_DISABLE_REASONING':return t({'id':'AI_CHAT_DISABLE_REASONING','string':'Disable\x20reasoning'});case'AI_CHAT_COMMANDS':return t({'id':'AI_CHAT_COMMANDS','string':'Commands'});case'AI_CHAT_SEARCH_RESOURCES':return t({'id':'AI_CHAT_SEARCH_RESOURCES','string':'Search\x20resources'});case'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT','string':'Back\x20to\x20context\x20options'});case'AI_CHAT_CONTEXT_URL_ADD_URL':return t({'id':'AI_CHAT_CONTEXT_URL_ADD_URL','string':'Add\x20URL'});case'AI_CHAT_CONTEXT_URL_PLACEHOLDER':return t({'id':'AI_CHAT_CONTEXT_URL_PLACEHOLDER','string':'Add\x20URL...'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL','string':'Failed\x20to\x20upload\x20URL:\x20%0.\x20Please\x20try\x20again.'},_0x5dc7dc);case'AI_CHAT_CONTEXT_INVALID_DATA':return t({'id':'AI_CHAT_CONTEXT_INVALID_DATA','string':'Invalid\x20context\x20data\x20type\x20for\x20the\x20selected\x20resource.'});case'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE':return t({'id':'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE','string':'Unsupported\x20resource\x20type.\x20Only\x20files\x20and\x20URLs\x20are\x20supported.'});case'AI_CHAT_CONTEXT_URL_EMPTY_ERROR':return t({'id':'AI_CHAT_CONTEXT_URL_EMPTY_ERROR','string':'URL\x20cannot\x20be\x20empty.'});case'AI_CHAT_CONTEXT_URL_INVALID_ERROR':return t({'id':'AI_CHAT_CONTEXT_URL_INVALID_ERROR','string':'Please\x20enter\x20a\x20valid\x20URL.'});case'AI_CHAT_INVALID_REQUEST':return t({'id':'AI_CHAT_INVALID_REQUEST','string':'Something\x20went\x20wrong\x20while\x20processing\x20your\x20request.\x20Please\x20try\x20again.'});case'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE':return t({'id':'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE','string':'The\x20file\x20type\x20is\x20not\x20supported.\x20Please\x20upload\x20a\x20different\x20file.'});case'AI_CHAT_CONTEXT_FILE_TOO_LARGE':return t({'id':'AI_CHAT_CONTEXT_FILE_TOO_LARGE','string':'The\x20file\x20is\x20too\x20large.\x20Please\x20upload\x20a\x20smaller\x20file.'});case'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES':return t({'id':'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES','string':'The\x20file\x20has\x20too\x20many\x20pages.\x20Please\x20upload\x20a\x20file\x20with\x20fewer\x20pages.'});case'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED':return t({'id':'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED','string':'The\x20form\x20data\x20size\x20limits\x20are\x20exceeded.\x20Please\x20upload\x20a\x20smaller\x20file.'});case'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR','string':'AI\x20is\x20preparing\x20a\x20response...'});case'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH','string':'AI\x20is\x20searching\x20the\x20web\x20to\x20provide\x20the\x20most\x20accurate\x20answer...'});case'AI_CHAT_FEED_LOADING_MESSAGE_REASONING':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_REASONING','string':'AI\x20is\x20using\x20reasoning\x20to\x20provide\x20the\x20most\x20accurate\x20answer...'});case'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING','string':'AI\x20is\x20using\x20reasoning\x20and\x20searching\x20the\x20web\x20to\x20provide\x20the\x20most\x20accurate\x20answer...'});case'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH':return t({'id':'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH','string':'Scanned\x20the\x20internet\x20for\x20insights'});case'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING':return t({'id':'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING','string':'AI\x20used\x20reasoning\x20to\x20improve\x20the\x20response'});case'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING':return t({'id':'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING','string':'AI\x20used\x20search\x20and\x20reasoning\x20to\x20improve\x20the\x20response'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR','string':'Ask\x20AI\x20anything...'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH','string':'Ask\x20AI\x20anything\x20(web\x20search\x20enabled)...'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING','string':'Ask\x20AI\x20anything\x20(reasoning\x20enabled)...'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING','string':'Ask\x20AI\x20anything\x20(web\x20search\x20and\x20reasoning\x20enabled)...'});case'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL','string':'Suggest\x20all'},_0x5dc7dc);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x5dc7dc);case'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL':return t({'id':'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL','string':'Apply\x20all'});case'AI_CHAT_SUGGESTION_ACTION_APPLY':return t({'id':'AI_CHAT_SUGGESTION_ACTION_APPLY','string':'Apply'});case'AI_CHAT_SUGGESTION_MORE_OPTIONS_TOOLTIP':return t({'id':'AI_CHAT_SUGGESTION_MORE_OPTIONS_TOOLTIP','string':'More\x20options'},_0x5dc7dc);case'AI_CHAT_MODEL_SELECTOR_GROUP':return t({'id':'AI_CHAT_MODEL_SELECTOR_GROUP','string':'Models'});case'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP':return t({'id':'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP','string':'Select\x20a\x20model'});case'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP':return t({'id':'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP','string':'Start\x20a\x20new\x20conversation\x20to\x20change\x20the\x20model'});case'AI_CHAT_CAPABILITIES_YES':return t({'id':'AI_CHAT_CAPABILITIES_YES','string':'Yes'});case'AI_CHAT_CAPABILITIES_NO':return t({'id':'AI_CHAT_CAPABILITIES_NO','string':'No'});case'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT':return t({'id':'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT','string':'The\x20selected\x20model\x20is\x20no\x20longer\x20available,\x20so\x20you\x20cannot\x20continue\x20this\x20conversation.\x20Please\x20'});case'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON':return t({'id':'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON','string':'start\x20a\x20new\x20one.'});case'AI_CHAT_CONTEXT_SOURCES_LABEL':return t({'id':'AI_CHAT_CONTEXT_SOURCES_LABEL','string':'Sources'});case'AI_CHAT_HISTORY_HEADING':return t({'id':'AI_CHAT_HISTORY_HEADING','string':'Chat\x20History'});case'AI_CHAT_HISTORY_SEARCH_LABEL':return t({'id':'AI_CHAT_HISTORY_SEARCH_LABEL','string':'Search\x20history'});case'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY':return t({'id':'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY','string':'No\x20chats\x20were\x20found\x20matching\x20\x22%0\x22.'},_0x5dc7dc);case'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY':return t({'id':'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY','string':'Please\x20try\x20a\x20different\x20phrase\x20or\x20check\x20the\x20spelling.'});case'AI_CHAT_HISTORY_EMPTY_MESSAGE':return t({'id':'AI_CHAT_HISTORY_EMPTY_MESSAGE','string':'Your\x20chat\x20history\x20for\x20current\x20document\x20will\x20appear\x20here.'});case'AI_CHAT_HISTORY_GO_TO_CHAT_BUTTON':return t({'id':'AI_CHAT_HISTORY_GO_TO_CHAT_BUTTON','string':'Go\x20to\x20chat'});case'AI_CHAT_HISTORY_PIN_BUTTON':return t({'id':'AI_CHAT_HISTORY_PIN_BUTTON','string':'Pin'});case'AI_CHAT_HISTORY_SHOW_MORE_ITEMS':return t({'id':'AI_CHAT_HISTORY_SHOW_MORE_ITEMS','string':'Show\x20more\x20items'});case'AI_CHAT_HISTORY_EDIT_NAME':return t({'id':'AI_CHAT_HISTORY_EDIT_NAME','string':'Edit\x20name'});case'AI_CHAT_HISTORY_REMOVE':return t({'id':'AI_CHAT_HISTORY_REMOVE','string':'Remove'});case'AI_CHAT_HISTORY_REMOVE_CONFIRM':return t({'id':'AI_CHAT_HISTORY_REMOVE_CONFIRM','string':'Do\x20you\x20want\x20to\x20remove\x20this\x20chat?'});case'AI_CHAT_HISTORY_ACCEPT':return t({'id':'AI_CHAT_HISTORY_ACCEPT','string':'Accept'});case'AI_CHAT_HISTORY_CANCEL':return t({'id':'AI_CHAT_HISTORY_CANCEL','string':'Cancel'});case'AI_CHAT_HISTORY_LOADING_REMOVING':return t({'id':'AI_CHAT_HISTORY_LOADING_REMOVING','string':'Removing\x20the\x20chat...'});case'AI_CHAT_HISTORY_LOADING_RENAMING':return t({'id':'AI_CHAT_HISTORY_LOADING_RENAMING','string':'Renaming\x20the\x20chat...'});case'AI_CHAT_HISTORY_LOADING_PINNING':return t({'id':'AI_CHAT_HISTORY_LOADING_PINNING','string':'Pinning\x20the\x20chat...'});case'AI_CHAT_HISTORY_LOADING_UNPINNING':return t({'id':'AI_CHAT_HISTORY_LOADING_UNPINNING','string':'Unpinning\x20the\x20chat...'});case'AI_CHAT_HISTORY_CATEGORY_PINNED':return t({'id':'AI_CHAT_HISTORY_CATEGORY_PINNED','string':'Pinned'});case'AI_CHAT_HISTORY_CATEGORY_TODAY':return t({'id':'AI_CHAT_HISTORY_CATEGORY_TODAY','string':'Today'});case'AI_CHAT_HISTORY_CATEGORY_YESTERDAY':return t({'id':'AI_CHAT_HISTORY_CATEGORY_YESTERDAY','string':'Yesterday'});case'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS':return t({'id':'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS','string':'Last\x2014\x20days'});case'AI_CHAT_HISTORY_CATEGORY_LATER':return t({'id':'AI_CHAT_HISTORY_CATEGORY_LATER','string':'Later'});case'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE':return t({'id':'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE','string':'Failed\x20to\x20change\x20the\x20\x22%0\x22\x20chat\x20name.\x20Please\x20try\x20again\x20later.'},_0x5dc7dc);case'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED':return t({'id':'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED','string':'Failed\x20to\x20%0\x20the\x20\x22%1\x22\x20chat.\x20Please\x20try\x20again\x20later.'},_0x5dc7dc);case'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM':return t({'id':'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM','string':'Failed\x20to\x20delete\x20the\x20\x22%0\x22\x20chat.\x20Please\x20try\x20again\x20later.'},_0x5dc7dc);case'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS':return t({'id':'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS','string':'Failed\x20to\x20load\x20the\x20chat\x20history.\x20Please\x20try\x20again\x20later.'});case'AI_CHAT_HISTORY_ERROR_GENERIC':return t({'id':'AI_CHAT_HISTORY_ERROR_GENERIC','string':'Something\x20went\x20wrong.\x20Please\x20try\x20again\x20later.'});case'AI_CHAT_HISTORY_PIN_ACTION':return t({'id':'AI_CHAT_HISTORY_PIN_ACTION','string':'pin'});case'AI_CHAT_HISTORY_UNPIN_ACTION':return t({'id':'AI_CHAT_HISTORY_UNPIN_ACTION','string':'unpin'});case'AI_BALLOON_HEADER_TITLE':return t({'id':'AI_BALLOON_HEADER_TITLE','string':'Change\x20%0'},_0x5dc7dc);case'AI_BALLOON_APPLY_BUTTON':return t({'id':'AI_BALLOON_APPLY_BUTTON','string':'Apply'});case'AI_BALLOON_SUGGEST_BUTTON':return t({'id':'AI_BALLOON_SUGGEST_BUTTON','string':'Suggest'});case'AI_BALLOON_NEXT_LABEL':return t({'id':'AI_BALLOON_NEXT_LABEL','string':'Next'});case'AI_BALLOON_PREVIOUS_LABEL':return t({'id':'AI_BALLOON_PREVIOUS_LABEL','string':'Previous'});case'AI_SUGGESTION_NO_PARTS_WARNING':return t({'id':'AI_SUGGESTION_NO_PARTS_WARNING','string':'This\x20change\x20is\x20not\x20supported\x20by\x20the\x20editor\x20and\x20can\x27t\x20be\x20previewed\x20or\x20applied.'});case'AI_SUGGESTION_EMPTY_PART_WARNING':return t({'id':'AI_SUGGESTION_EMPTY_PART_WARNING','string':'Some\x20of\x20the\x20changes\x20are\x20not\x20supported\x20by\x20the\x20editor\x20and\x20can\x27t\x20be\x20previewed\x20or\x20applied.'});case'AI_ACTIONS_TRY_AGAIN':return t({'id':'AI_ACTIONS_TRY_AGAIN','string':'Retry'});case'AI_ACTIONS_PREVIOUS_INTERACTION':return t({'id':'AI_ACTIONS_PREVIOUS_INTERACTION','string':'Previous'});case'AI_ACTIONS_NEXT_INTERACTION':return t({'id':'AI_ACTIONS_NEXT_INTERACTION','string':'Next'});case'AI_MODEL_NAME_AUTO':return t({'id':'AI_MODEL_NAME_AUTO','string':'Auto'});case'AI_QUICK_ACTIONS_HEADING':return t({'id':'AI_QUICK_ACTIONS_HEADING','string':'AI\x20Quick\x20Actions'});case'AI_QUICK_ACTIONS_SEARCH':return t({'id':'AI_QUICK_ACTIONS_SEARCH','string':'Search\x20AI\x20commands'});case'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND':return t({'id':'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND','string':'No\x20AI\x20commands\x20found'});case'AI_QUICK_ACTIONS_ASK_AI':return t({'id':'AI_QUICK_ACTIONS_ASK_AI','string':'Ask\x20AI'});case'AI_QUICK_ACTIONS_CHAT_COMMANDS':return t({'id':'AI_QUICK_ACTIONS_CHAT_COMMANDS','string':'Chat\x20commands'});case'AI_QUICK_ACTIONS_IMPROVE_WRITING':return t({'id':'AI_QUICK_ACTIONS_IMPROVE_WRITING','string':'Improve\x20writing'});case'AI_QUICK_ACTIONS_CONTINUE_WRITING':return t({'id':'AI_QUICK_ACTIONS_CONTINUE_WRITING','string':'Continue\x20writing'});case'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING':return t({'id':'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING','string':'Fix\x20grammar\x20&\x20spelling'});case'AI_QUICK_ACTIONS_ADJUST_LENGTH':return t({'id':'AI_QUICK_ACTIONS_ADJUST_LENGTH','string':'Adjust\x20length'});case'AI_QUICK_ACTIONS_CHANGE_TONE':return t({'id':'AI_QUICK_ACTIONS_CHANGE_TONE','string':'Change\x20tone'});case'AI_QUICK_ACTIONS_TRANSLATE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE','string':'Translate'});case'AI_QUICK_ACTIONS_EXPLAIN':return t({'id':'AI_QUICK_ACTIONS_EXPLAIN','string':'Explain'});case'AI_QUICK_ACTIONS_SUMMARIZE':return t({'id':'AI_QUICK_ACTIONS_SUMMARIZE','string':'Summarize'});case'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS':return t({'id':'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS','string':'Highlight\x20key\x20points'});case'AI_QUICK_ACTIONS_MAKE_SHORTER':return t({'id':'AI_QUICK_ACTIONS_MAKE_SHORTER','string':'Make\x20shorter'});case'AI_QUICK_ACTIONS_MAKE_LONGER':return t({'id':'AI_QUICK_ACTIONS_MAKE_LONGER','string':'Make\x20longer'});case'AI_QUICK_ACTIONS_MORE_CASUAL':return t({'id':'AI_QUICK_ACTIONS_MORE_CASUAL','string':'More\x20casual'});case'AI_QUICK_ACTIONS_MORE_DIRECT':return t({'id':'AI_QUICK_ACTIONS_MORE_DIRECT','string':'More\x20direct'});case'AI_QUICK_ACTIONS_MORE_FRIENDLY':return t({'id':'AI_QUICK_ACTIONS_MORE_FRIENDLY','string':'More\x20friendly'});case'AI_QUICK_ACTIONS_MORE_CONFIDENT':return t({'id':'AI_QUICK_ACTIONS_MORE_CONFIDENT','string':'More\x20confident'});case'AI_QUICK_ACTIONS_MORE_PROFESSIONAL':return t({'id':'AI_QUICK_ACTIONS_MORE_PROFESSIONAL','string':'More\x20professional'});case'AI_QUICK_ACTIONS_ADJUST_BASED_ON_DOCUMENT':return t({'id':'AI_QUICK_ACTIONS_ADJUST_BASED_ON_DOCUMENT','string':'Adjust\x20based\x20on\x20the\x20rest\x20of\x20the\x20document'});case'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH','string':'English'});case'AI_QUICK_ACTIONS_TRANSLATE_CHINESE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_CHINESE','string':'Chinese\x20(Simplified)'});case'AI_QUICK_ACTIONS_TRANSLATE_FRENCH':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_FRENCH','string':'French'});case'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE','string':'Japanese'});case'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE','string':'Portuguese'});case'AI_QUICK_ACTIONS_TRANSLATE_KOREAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_KOREAN','string':'Korean'});case'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN','string':'Italian'});case'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN','string':'Russian'});case'AI_QUICK_ACTIONS_TRANSLATE_SPANISH':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_SPANISH','string':'Spanish'});case'AI_QUICK_ACTIONS_TRANSLATE_GERMAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_GERMAN','string':'German'});case'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND':return t({'id':'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','string':'%0\x20plugin\x20is\x20required\x20but\x20not\x20found.'},_0x5dc7dc);case'AI_QUICK_ACTIONS_OTHER':return t({'id':'AI_QUICK_ACTIONS_OTHER','string':'Other'});case'AI_ACTIONS_GENERIC_ERROR':return t({'id':'AI_ACTIONS_GENERIC_ERROR','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20response.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_BALLOON_SELECTION_REMOVED_ERROR':return t({'id':'AI_BALLOON_SELECTION_REMOVED_ERROR','string':'Changes\x20cannot\x20be\x20applied.\x20The\x20original\x20content\x20no\x20longer\x20exists.'});case'AI_REVIEW_MODE_STOP_GENERATING':return t({'id':'AI_REVIEW_MODE_STOP_GENERATING','string':'Stop\x20generating'});case'AI_REVIEW_MODE_HIDE_CHANGES':return t({'id':'AI_REVIEW_MODE_HIDE_CHANGES','string':'Hide\x20changes'});case'AI_REVIEW_MODE_SHOW_CHANGES':return t({'id':'AI_REVIEW_MODE_SHOW_CHANGES','string':'Show\x20changes'});case'AI_REVIEW_MODE_ACCEPT_ALL':return t({'id':'AI_REVIEW_MODE_ACCEPT_ALL','string':'Accept\x20all'});case'AI_REVIEW_MODE_EXIT_REVIEW':return t({'id':'AI_REVIEW_MODE_EXIT_REVIEW','string':'Exit\x20review'});case'AI_REVIEW_MODE_ACCEPT_CHANGE':return t({'id':'AI_REVIEW_MODE_ACCEPT_CHANGE','string':'Accept'});case'AI_REVIEW_MODE_DISMISS_CHANGE':return t({'id':'AI_REVIEW_MODE_DISMISS_CHANGE','string':'Dismiss'});case'AI_REVIEW_MODE_LEARN_MORE':return t({'id':'AI_REVIEW_MODE_LEARN_MORE','string':'Learn\x20more'});case'AI_REVIEW_MODE_COMPLETED_TEXT':return t({'id':'AI_REVIEW_MODE_COMPLETED_TEXT','string':'There\x27s\x20nothing\x20left\x20to\x20review.'});case'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT':return t({'id':'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20changes\x20to\x20suggest.'});case'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL','string':'Finish\x20Review'});case'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE','string':'Review\x20complete.\x20Finish\x20when\x20ready.'});case'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE':return t({'id':'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE','string':'AI\x20Review\x20initialized\x20with\x20errors.\x20Some\x20features\x20may\x20not\x20be\x20available\x20or\x20work\x20properly.'});case'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20whole\x20review\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE','string':'Not\x20everything\x20went\x20through,\x20but\x20the\x20completed\x20items\x20are\x20listed\x20below.'});case'AI_REVIEW_MODE':return t({'id':'AI_REVIEW_MODE','string':'Review'});case'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR':return t({'id':'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR','string':'Prompt\x20must\x20not\x20be\x20empty'});case'AI_REVIEW_CHECK_CUSTOM_TITLE':return t({'id':'AI_REVIEW_CHECK_CUSTOM_TITLE','string':'Custom\x20command'});case'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION','string':'Enter\x20a\x20custom\x20command\x20for\x20a\x20specific\x20review.'});case'AI_REVIEW_CHECK_CORRECTNESS_TITLE':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_TITLE','string':'Proofread'});case'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION','string':'Check\x20the\x20text\x20for\x20errors\x20in\x20grammar,\x20spelling,\x20and\x20punctuation.'});case'AI_REVIEW_CHECK_CLARITY_TITLE':return t({'id':'AI_REVIEW_CHECK_CLARITY_TITLE','string':'Improve\x20clarity'});case'AI_REVIEW_CHECK_CLARITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CLARITY_DESCRIPTION','string':'Improve\x20the\x20logical\x20structure\x20and\x20precision\x20for\x20clearer\x20message.'});case'AI_REVIEW_CHECK_READABILITY_TITLE':return t({'id':'AI_REVIEW_CHECK_READABILITY_TITLE','string':'Improve\x20readability'});case'AI_REVIEW_CHECK_READABILITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_READABILITY_DESCRIPTION','string':'Adjust\x20sentence\x20structure\x20and\x20word\x20choice\x20for\x20an\x20easier\x20read.'});case'AI_REVIEW_CHECK_MAKE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TITLE','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_DESCRIPTION','string':'Shorten\x20or\x20lengthen\x20the\x20text\x20as\x20needed.'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER','string':'Longer'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER','string':'Shorter'});case'AI_REVIEW_CHECK_MAKE_TONE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_TITLE','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION','string':'Modify\x20the\x20text\x20to\x20a\x20desired\x20tone\x20and\x20style.'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL','string':'Casual'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT','string':'Direct'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY','string':'Friendly'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT','string':'Confident'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL','string':'Professional'});case'AI_REVIEW_CHECK_TRANSLATE_TITLE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_TITLE','string':'Translate'});case'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION','string':'Translate\x20the\x20text\x20into\x20another\x20language.'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL','string':'Select\x20language'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH','string':'English'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH','string':'Spanish'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH','string':'French'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN','string':'German'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE','string':'Chinese\x20(Simplified)'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE','string':'Japanese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN','string':'Russian'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE','string':'Portuguese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN','string':'Korean'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN','string':'Italian'});case'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED','string':'Accepted'});case'AI_REVIEW_MODE_CHECK_STATUS_REJECTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_REJECTED','string':'Dismissed'});case'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED','string':'Outdated'});case'AI_TOGGLE_BUTTON_LABEL':return t({'id':'AI_TOGGLE_BUTTON_LABEL','string':'AI'});case'AI_TRANSLATE_ACCEPT_ALL':return t({'id':'AI_TRANSLATE_ACCEPT_ALL','string':'Accept\x20translation'});case'AI_TRANSLATE_FINISH_HEADER_TITLE':return t({'id':'AI_TRANSLATE_FINISH_HEADER_TITLE','string':'Translation\x20complete.\x20Finish\x20when\x20ready.'});case'AI_TRANSLATE_EMPTY_RESULTS_TEXT':return t({'id':'AI_TRANSLATE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20translations\x20to\x20review.'});case'AI_TRANSLATE_FINISH_BUTTON_LABEL':return t({'id':'AI_TRANSLATE_FINISH_BUTTON_LABEL','string':'Finish\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE','string':'Content\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION','string':'A\x20dedicated\x20mode\x20for\x20translating\x20the\x20entire\x20text.'});case'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE','string':'Translating\x20to'});case'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE','string':'Translated\x20to'});case'AI_TRANSLATE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_TRANSLATE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20translations\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE','string':'This\x20conversation\x20is\x20loaded\x20from\x20chat\x20history\x20from\x20a\x20previous\x20session,\x20so\x20you\x20can’t\x20apply,\x20reject,\x20or\x20suggest\x20changes.'});case'AI_SUGGESTION_DISABLED_FEED_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_FEED_MESSAGE','string':'Actions\x20aren’t\x20available\x20for\x20changes\x20from\x20a\x20previous\x20session.'});default:return _0x1fd8bd;}}const Mi='ck-ai-button-primary',Ui='ck-ai-button-secondary',Bi='ck-ai-button-tertiary';function Gi(_0x1ca723,_0x1b4e12){const _0x3300b1=new vt(_0x1ca723),_0x2f6858=Hi(_0x1ca723,'AI_TABS_LABEL_MINIMIZE'),_0x26e847=Hi(_0x1ca723,'AI_TABS_LABEL_MAXIMIZE');return _0x3300b1['set']({'withText':!0x1,'icon':_0x52d1c2,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+Bi}),_0x3300b1['bind']('label')['to'](_0x1b4e12,'isMaximized',_0x408340=>_0x408340?_0x2f6858:_0x26e847),_0x3300b1['bind']('icon')['to'](_0x1b4e12,'isMaximized',_0x56ee95=>_0x56ee95?_0xf26cd2:_0x52d1c2),_0x3300b1['bind']('isOn')['to'](_0x1b4e12,'isMaximized'),_0x3300b1['on']('execute',()=>{_0x1b4e12['fire']('resizeTabs');}),_0x3300b1;}function Fi(_0x55a1fb){return _0x58140b(_0x55a1fb);}function Ki(_0x20260d){return ti(_0x20260d);}function Wi(_0x3d89f4,_0x5b36d5,_0x12fcaf){const _0x2f1093=null!==_0x5b36d5?_0x17699d=>_0x17699d['attribs'][_0x3d89f4]===_0x5b36d5:_0x22d8d6=>Boolean(_0x22d8d6['attribs'][_0x3d89f4]);return _0x504013(_0x249230=>_0x4590df(_0x249230)&&_0x2f1093(_0x249230),_0x12fcaf);}function Yi(_0x2328c0,_0xf309f6,_0x1ffda3){const _0xe0d3c2=null!==_0xf309f6?_0x583631=>_0x583631['attribs'][_0x2328c0]===_0xf309f6:_0x4fc159=>Boolean(_0x4fc159['attribs'][_0x2328c0]);return _0xbb1b5f(_0x428ac1=>_0x4590df(_0x428ac1)&&_0xe0d3c2(_0x428ac1),_0x1ffda3);}function $i(_0xb4c14e,_0x2560cc){return _0xb4c14e&&_0x4590df(_0xb4c14e)?_0xb4c14e['attribs'][_0x2560cc]:null;}function qi(_0x23a65d,_0x51651a,_0x32096f){_0x4590df(_0x23a65d)&&(null===_0x32096f?delete _0x23a65d['attribs'][_0x51651a]:_0x23a65d['attribs'][_0x51651a]=_0x32096f);}function Qi(_0x39169b,_0x5bb698,_0x490755){const _0x4cffe0=_0x5bb698['cloneNode'](!0x0);'beforebegin'===_0x490755?_0x38bdcf(_0x39169b,_0x4cffe0):'afterbegin'===_0x490755?_0x56bf59(_0x39169b,_0x4cffe0):'beforeend'===_0x490755?_0x3019ce(_0x39169b,_0x4cffe0):'afterend'===_0x490755&&_0x5229d2(_0x39169b,_0x4cffe0);}function Xi(_0x5f16ee){const _0x4ffa48=[];let _0x3c33fc=_0x5f16ee;for(;_0x3c33fc;)_0x3c33fc=_0x30e479(_0x3c33fc),_0x3c33fc&&_0x4ffa48['push'](_0x3c33fc);return _0x4ffa48;}function zi(_0x2a09f7){return _0x2a09f7['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function ji(_0x1af127){let _0xebaf3e=0x0;for(;_0x1af127['parentNode'];)_0x1af127=_0x1af127['parentNode'],_0xebaf3e++;return _0xebaf3e;}function Ji(_0x24d815){const _0xc186c8=[];let _0x44e8fc=_0x24d815['nextSibling'];for(;_0x44e8fc;)_0xc186c8['push'](_0x44e8fc),_0x44e8fc=_0x44e8fc['nextSibling'];_0xc186c8['forEach'](_0xf75078=>{_0x3064c8(_0xf75078);});}class AIResponseParser extends/* #__PURE__ -- @preserve */
25
- ht(){['_m2html'];constructor(){super();const _0x525cf1=Object['entries'](_0x12f810),_0x141415=_0x525cf1['findIndex'](([_0x1f7b00])=>'rehypeDomRaw'===_0x1f7b00);if(-0x1===_0x141415)throw new at('ai-response-parser-unable-to-set-up-parser');_0x525cf1['splice'](_0x141415+0x1,0x0,['rehypeSanitize',_0x564c5a]),this['_m2html']=new _0x7b1999({'plugins':Object['fromEntries'](_0x525cf1)});}['convertMarkdownToHTML'](_0x266e00){const _0x5123fd=this['_m2html']['parse'](_0x266e00);return this['parseAndNormalizeHTML'](_0x5123fd);}['parseAndNormalizeHTML'](_0x5c1b84){return this['_parseHTML'](_0x5c1b84);}['_parseHTML'](_0x37eae3){const _0xf19364=Fi('<dummy>'+_0x37eae3['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/<[^>]*?$/g,'')+'</dummy>');return _0xf19364['children']=_0xf19364['children'][0x0]['children'],_0xf19364;}}class AIResponseApplier extends/* #__PURE__ -- @preserve */
26
- ht(){['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null};['_existingDataIds']=new Set();constructor(_0x508dd4){super(),this['_generateUid']=_0x508dd4||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x4013c8,_0x4858e4,_0x3d5c0d){this['_uidCounter']=0x0;const _0x2cbb23=_0x4013c8['cloneNode'](!0x0),_0x3973a3=_0x2cbb23['childNodes'],_0x3f8780=Array['from'](_0x3973a3)['filter'](_0x1cc765=>!(0x3===_0x1cc765['nodeType']&&''===Ki(_0x1cc765)['trim']())),_0x1319f1=_0x3f8780['length'],_0x43a447=new Map();for(const _0x425165 of _0x3f8780)_0x425165&&_0x4590df(_0x425165)&&void 0x0===_0x425165['attribs']['data-id']&&qi(_0x425165,'data-id','new-element');if(0x0===_0x4858e4['childNodes']['length']){const _0x37aece=[];return Yi('data-id','new-element',_0x2cbb23)['forEach'](_0xa9693b=>{const _0x543337=this['_generateUid']();qi(_0xa9693b,'data-id',_0x543337),_0x37aece['push'](_0x543337);}),this['_removeSpecialComments'](_0x2cbb23),{'parsedContent':_0x2cbb23,'newNodeIds':_0x37aece,'modifiedNodeIds':[],'removedNodeIds':[],'newAnchorIds':_0x43a447};}_0x3d5c0d&&_0x3d5c0d['markUnstableElements']&&this['_markLastTagElementUnstable'](_0x2cbb23),this['_touchedNodesState']['newIds']=[],this['_touchedNodesState']['modifiedIds']=[],this['_touchedNodesState']['removedIds']=[],this['_touchedNodesState']['invalidIds']=[],this['_touchedNodesState']['lastTouchedId']=null,this['_existingDataIds']=new Set(Yi('data-id',null,_0x4858e4)['map'](_0x3913ce=>$i(_0x3913ce,'data-id'))['filter'](_0x3b90eb=>!!_0x3b90eb));let _0x4fcaf1=-0x1,_0x4b8f4b=!0x1;for(let _0x519e92=0x0;_0x519e92<_0x1319f1;_0x519e92++){const _0x50d760=_0x3f8780[_0x519e92],_0x1d2c4c=_0x3f8780[_0x519e92+0x1];if(this['_isNewNode'](_0x50d760)){if(-0x1===_0x4fcaf1&&(_0x4fcaf1=_0x519e92),this['_markWrappedElements'](_0x50d760),!this['_isNewNode'](_0x1d2c4c)){const [_0x1c08ac,_0x1bc176]=this['_findReferenceNode'](_0x50d760,_0x4b8f4b,_0x4858e4);if(_0x1c08ac){const _0x349105=Array['from'](_0x3f8780)['slice'](_0x4fcaf1,_0x519e92+0x1),_0x3d0add=$i(_0x1c08ac,'data-id');if(this['_insertNodes'](_0x1c08ac,_0x349105,_0x1bc176),_0x3d0add)for(const _0x214efe of _0x349105){const _0x1337d1=$i(_0x214efe,'data-id');_0x1337d1&&_0x43a447['set'](_0x1337d1,_0x3d0add);}_0x4fcaf1=-0x1;}}}else{if(this['_isExistingContentComment'](_0x50d760))_0x4b8f4b=!0x0;else{if(this['_isExistingNode'](_0x50d760)){const _0x730e27=$i(_0x50d760,'data-id');if(_0x730e27&&this['_existingDataIds']['has'](_0x730e27)){const _0x4cf881=Wi('data-id',_0x730e27,_0x4858e4);this['_replaceNode'](_0x4cf881,_0x50d760);}}else{if(this['_isDelNode'](_0x50d760)){const _0x4e8fbd=this['_getNodeDataId'](_0x50d760);!!Wi('data-id',_0x4e8fbd,_0x2cbb23)||this['_touchedNodesState']['removedIds']['push'](_0x4e8fbd);}}}}}for(const _0x3606cf of this['_touchedNodesState']['removedIds']){const _0x51227d=Wi('data-id',_0x3606cf,_0x4858e4);_0x51227d&&this['_removeNode'](_0x51227d,_0x3606cf,_0x3d5c0d);}if(Yi('data-id','new-element',_0x4858e4)['forEach'](_0x46bdde=>{const _0x42ce71=this['_getUid'](_0x46bdde);qi(_0x46bdde,'data-id',_0x42ce71),this['_touchedNodesState']['newIds']['push'](_0x42ce71);}),this['_removeSpecialComments'](_0x4858e4),_0x3d5c0d&&_0x3d5c0d['markUnstableElements']&&this['_markUnstableElements'](_0x4858e4,_0x3d5c0d['markUnstableElementsDepth']||0x0),this['_processWrappedElements'](_0x4858e4,_0x3d5c0d),_0x3d5c0d&&_0x3d5c0d['cutAfterLastChange']&&this['_touchedNodesState']['lastTouchedId']){const _0x494116=Yi('data-id',this['_touchedNodesState']['lastTouchedId'],_0x4858e4);let _0x2b48d5=_0x494116[_0x494116['length']-0x1];for(;_0x2b48d5;)Ji(_0x2b48d5),_0x2b48d5=_0x2b48d5['parentNode'];}return{'parsedContent':_0x4858e4,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds'],'newAnchorIds':_0x43a447};}['_insertNodes'](_0x30f839,_0x4cc6c8,_0x3e3ac5){for(const _0x21a464 of _0x4cc6c8){const _0x5eb1cd=this['_getUid'](_0x21a464);qi(_0x21a464,'data-id',_0x5eb1cd),this['_touchedNodesState']['newIds']['push'](_0x5eb1cd),this['_touchedNodesState']['lastTouchedId']=_0x5eb1cd;}const _0x50e44a='afterbegin'===_0x3e3ac5||'afterend'===_0x3e3ac5?_0x4cc6c8['reverse']():_0x4cc6c8;for(const _0x35a068 of _0x50e44a)Qi(_0x30f839,_0x35a068,_0x3e3ac5);}['_replaceNode'](_0x2f7b21,_0x1b6763){if(!_0x2f7b21)return;if(_0x15d2f3=_0x1b6763,zi(Ki(_0x2f7b21))===zi(Ki(_0x15d2f3)))return;var _0x15d2f3;const _0x75a0c2=this['_getUid'](_0x2f7b21);qi(_0x1b6763,'data-id',_0x75a0c2),this['_touchedNodesState']['modifiedIds']['push'](_0x75a0c2),this['_touchedNodesState']['lastTouchedId']=_0x75a0c2,_0x315210(_0x2f7b21,_0x1b6763['cloneNode'](!0x0));}['_removeNode'](_0x31c560,_0x38d38c,_0x30b16a){if(_0x30b16a&&_0x30b16a['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x38d38c;const _0x11ff6a=_0x30b16a['replaceRemovedWith']['cloneNode'](!0x0);qi(_0x11ff6a,'data-id',_0x38d38c),qi(_0x11ff6a,'data-removed','true'),_0x315210(_0x31c560,_0x11ff6a);}else _0x3064c8(_0x31c560);}['_findReferenceNode'](_0x3aa4bb,_0x506f36,_0x4f2b06){const _0x405e28=this['_findPrevElementWithDataId'](_0x3aa4bb,!0x1);if(_0x405e28){const _0xcbd64d=this['_getNodeDataId'](_0x405e28),_0x226c02=Wi('data-id',_0xcbd64d,_0x4f2b06);if(_0x226c02)return[_0x226c02,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0xcbd64d);}const _0x366a8f=this['_findNextElementWithDataId'](_0x3aa4bb,!0x1);if(_0x366a8f){const _0xdfa969=this['_getNodeDataId'](_0x366a8f),_0x29407f=Wi('data-id',_0xdfa969,_0x4f2b06);if(_0x29407f)return[_0x29407f,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0xdfa969);}return _0x506f36?_0x3aa4bb['nextSibling']?this['_findFallbackReferenceNode'](_0x3aa4bb,_0x4f2b06):[_0x4f2b06['childNodes'][_0x4f2b06['childNodes']['length']-0x1],'afterend']:[_0x4f2b06['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x44e13c,_0x507739){const _0x13e047=[],_0x2c8248=this['_findPrevElementWithDataId'](_0x44e13c,!0x0);if(_0x2c8248){const _0x3da289=Wi('data-id',this['_getNodeDataId'](_0x2c8248),_0x507739);_0x3da289&&_0x13e047['push']([_0x3da289,'afterend']);}const _0x94aff4=this['_findNextElementWithDataId'](_0x44e13c,!0x0);if(_0x94aff4){const _0x7763d4=Wi('data-id',this['_getNodeDataId'](_0x94aff4),_0x507739);_0x7763d4&&_0x13e047['push']([_0x7763d4,'beforebegin']);}if(_0x13e047['length']>0x1)return ji(_0x13e047[0x0][0x0])<=ji(_0x13e047[0x1][0x0])?_0x13e047[0x0]:_0x13e047[0x1];return 0x1===_0x13e047['length']?_0x13e047[0x0]:[_0x507739['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0xfb00,_0x30c924){let _0x128eed=_0xfb00['nextSibling'],_0x1c42e9=null,_0x2f7e3b=!0x1;for(;_0x128eed;){if(_0x49cf07(_0x128eed)){if(this['_isDelNode'](_0x128eed)&&(_0x1c42e9=_0x128eed),this['_isExistingContentComment'](_0x128eed)&&_0x30c924&&!_0x2f7e3b){_0x2f7e3b=!0x0,_0x128eed=_0x128eed['nextSibling'];continue;}break;}const _0x699f7=$i(_0x128eed,'data-id');if(_0x699f7&&'new-element'!==_0x699f7&&this['_existingDataIds']['has'](_0x699f7)){_0x1c42e9=_0x128eed;break;}_0x128eed=_0x128eed['nextSibling'];}return _0x1c42e9;}['_findPrevElementWithDataId'](_0x4f6268,_0x4b2fb4){let _0x49ef62=_0x4f6268['previousSibling'],_0x28c76d=null,_0x2087bc=!0x1;for(;_0x49ef62;){if(_0x49cf07(_0x49ef62)){if(this['_isDelNode'](_0x49ef62)&&(_0x28c76d=_0x49ef62),this['_isExistingContentComment'](_0x49ef62)&&_0x4b2fb4&&!_0x2087bc){_0x2087bc=!0x0,_0x49ef62=_0x49ef62['previousSibling'];continue;}break;}const _0x168134=$i(_0x49ef62,'data-id');if(_0x168134&&'new-element'!==_0x168134&&this['_existingDataIds']['has'](_0x168134)){_0x28c76d=_0x49ef62;break;}_0x49ef62=_0x49ef62['previousSibling'];}return _0x28c76d;}['_markWrappedElements'](_0x3b0590){_0x4590df(_0x3b0590)&&Yi('data-id',null,_0x3b0590)['forEach'](_0x30516e=>{this['_isExistingNode'](_0x30516e)&&(qi(_0x30516e,'data-wrapped-id',$i(_0x30516e,'data-id')),qi(_0x30516e,'data-id',null));});}['_processWrappedElements'](_0x1880fc,_0x232461){Yi('data-wrapped-id',null,_0x1880fc)['forEach'](_0x1c84ad=>{const _0x50107a=$i(_0x1c84ad,'data-wrapped-id');if($i(_0x1c84ad,'data-unstable')||this['_hasUnstableParent'](_0x1c84ad))return;const _0x3dd81a=Wi('data-id',_0x50107a,_0x1880fc);qi(_0x1c84ad,'data-id',_0x50107a),qi(_0x1c84ad,'data-wrapped-id',null),_0x3dd81a&&(this['_removeNode'](_0x3dd81a,_0x50107a,_0x232461),this['_touchedNodesState']['removedIds']['push'](_0x50107a),this['_touchedNodesState']['lastTouchedId']=_0x50107a);});}['_hasUnstableParent'](_0x244446){let _0x368cb2=_0x244446['parentNode'];for(;_0x368cb2;){if($i(_0x368cb2,'data-unstable'))return!0x0;_0x368cb2=_0x368cb2['parentNode'];}return!0x1;}['_getNodeDataId'](_0x457ac9){if(!_0x457ac9)return null;if(_0x4590df(_0x457ac9))return $i(_0x457ac9,'data-id');if(_0x49cf07(_0x457ac9)){const _0x35d273=Ki(_0x457ac9)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x35d273&&_0x35d273[0x1])return _0x35d273[0x1];}return null;}['_getUid'](_0x3a6eab){return this['_isExistingNode'](_0x3a6eab)?$i(_0x3a6eab,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x233285){(function(_0x43a66e){return _0x1b3db2(_0x586fab=>_0x49cf07(_0x586fab),_0x43a66e,!0x0,0x1/0x0);}(_0x233285)['filter'](_0xc3287f=>this['_isDelNode'](_0xc3287f)||this['_isExistingContentComment'](_0xc3287f))['forEach'](_0xbae9a3=>{_0x3064c8(_0xbae9a3);}));}['_markLastTagElementUnstable'](_0x27d7cd){const _0x15cbc4=_0x27d7cd['childNodes'],_0x4a2cbf=_0x15cbc4[_0x15cbc4['length']-0x1];_0x4a2cbf&&_0x4590df(_0x4a2cbf)&&qi(_0x4a2cbf,'data-unstable','true');}['_markUnstableElements'](_0x4fa65e,_0x234363){const _0x12e386=Wi('data-unstable','true',_0x4fa65e);if(!_0x12e386)return;const _0x4ad750=Xi(_0x12e386)['slice'](0x0,-0x1),_0x3e00a1=_0x4ad750['length'];let _0x3fd2de=_0x12e386;if(_0x3e00a1>_0x234363){let _0x492f46=_0x3e00a1,_0x496472=null;for(;_0x492f46>_0x234363&&_0x492f46>=0x0;)_0x492f46--,_0x496472=_0x4ad750[_0x492f46];_0x496472&&(_0x3fd2de=_0x496472,qi(_0x12e386,'data-unstable',null),qi(_0x496472,'data-unstable','true'));}else{if(_0x3e00a1<_0x234363){let _0x407acb=_0x3e00a1,_0x4a3491=_0x12e386;for(;_0x407acb<_0x234363;){const _0x550c24=_0x4a3491['childNodes']['filter'](_0x120867=>_0x4590df(_0x120867));if(0x0===_0x550c24['length'])break;_0x407acb++,_0x4a3491=_0x550c24[_0x550c24['length']-0x1];}_0x4a3491&&(_0x3fd2de=_0x4a3491,qi(_0x12e386,'data-unstable',null),qi(_0x4a3491,'data-unstable','true'));}}let _0x3facc5=_0x3fd2de;for(;_0x3facc5;){for(;_0x3facc5['nextSibling'];)_0x3facc5=_0x3facc5['nextSibling'],_0x4590df(_0x3facc5)&&qi(_0x3facc5,'data-unstable','true');_0x3facc5=_0x3facc5['parentNode'];}}['_isNewNode'](_0x3af376){return Boolean('new-element'===$i(_0x3af376,'data-id'));}['_isExistingNode'](_0x32f94a){return Boolean(($i(_0x32f94a,'data-id')||'')['length']>0x0&&'new-element'!==$i(_0x32f94a,'data-id'));}['_isDelNode'](_0x2df945){return!!_0x2df945&&Boolean(_0x49cf07(_0x2df945)&&Ki(_0x2df945)['match'](/removed[\s*-]data-id="[^"]+"/));}['_isExistingContentComment'](_0x4e0d45){return Boolean(_0x49cf07(_0x4e0d45)&&Ki(_0x4e0d45)['match'](/\s*existing[\s*-](content|document)\s*/g));}}function Zi({editor:_0x4ee955,changeGroups:_0x4e8696,documentContextContent:_0x110bb2,showDiff:_0xbf9a0f,trimUnchanged:_0x113587=!0x0}){return _0x4e8696['map'](_0x213215=>{const _0xcf13c5=new _0x38e78e([]),_0x346098=new _0x38e78e([]),_0x402ee5=new Set();for(const _0x166acf of _0x213215['changes'])'new'==_0x166acf['type']&&Yi('data-id',null,_0x166acf['node'])['forEach'](_0x35d5e2=>{_0x402ee5['add']($i(_0x35d5e2,'data-id'));});for(const _0x5563ae of _0x213215['changes'])if('removed'!=_0x5563ae['type']?_0x346098['children']['push'](_0x5563ae['node']['cloneNode'](!0x0)):_0xbf9a0f||_0x402ee5['has'](_0x5563ae['id'])||_0x346098['children']['push'](_0x5563ae['node']['cloneNode'](!0x0)),'new'!=_0x5563ae['type']&&(_0xbf9a0f||'removed'!=_0x5563ae['type'])){const _0x3db639=_0x504013(_0x1c6140=>$i(_0x1c6140,'data-id')==_0x5563ae['id'],_0x110bb2,!0x0);_0x3db639&&_0xcf13c5['children']['push'](_0x3db639['cloneNode'](!0x0));}const {content:_0x459fc3,hasChanges:_0x22712b}=function(_0x32083e,_0x1f629c,_0x4422d1,_0x373db7,_0x46f3d4=!0x0){const _0x313df4=_0x32083e['plugins']['get']('DocumentCompare'),_0xbc49f8=Ki(_0x1f629c),_0x2209d6=Ki(_0x4422d1),_0x32108e=_0x32083e['data']['parse'](_0xbc49f8,'$root'),_0x2bff60=_0x32083e['model']['createPositionAt'](_0x32108e,0x0),_0x4c8c5e=_0x313df4['getDiff'](_0xbc49f8,_0x2209d6,{'anchor':_0x2bff60,'markDeletions':_0x373db7,'targetEditor':_0x32083e}),_0x324a67=_0x4c8c5e['getOperations']();if(0x0==_0x324a67['length'])return{'content':_0x1f629c['cloneNode'](!0x0),'hasChanges':!0x1};_0x373db7?function(_0x5f36c6,_0x452ac5,_0x19f486){if(0x0==_0x5f36c6['length'])return;const _0x1515d6=_0x19f486['plugins']['get']('DocumentCompare'),_0x40a097=_0x19f486['plugins']['get']('SuggestionsConversion');_0x19f486['model']['change'](_0x5e33e4=>{const _0xb95699=new Set();for(let _0x593959=0x0;_0x593959<_0x5f36c6['length'];_0x593959++){const _0xb1f389=_0x5f36c6[_0x593959];if(_0xb1f389['baseVersion']=null,_0xb1f389['isDocumentOperation']=!0x1,_0x1515d6['isMarkedRemoveOperation'](_0xb1f389)){const _0x30169a=_0x5c5f61(_0xb1f389['newRange'],_0x19f486['model']),_0x303a22='suggestion:deletion:'+ot()+':$aiSuggestion';_0x452ac5['markers']['set'](_0x303a22,_0x30169a);}else switch(_0xb1f389['type']){case'rename':{if(_0xb1f389['oldName']==_0xb1f389['newName'])break;_0x5e33e4['batch']['addOperation'](_0xb1f389),_0x19f486['model']['applyOperation'](_0xb1f389);const _0x5b5207='$elementName',_0x3a7aa6=_0xb1f389['position'],_0x537acb=_0x19f486['model']['createRange'](_0x3a7aa6,_0x19f486['model']['createPositionAt'](_0x3a7aa6['nodeAfter'],'end')),_0x206722='suggestion:attribute:'+_0x5b5207+':'+ot()+':$aiSuggestion';_0x452ac5['markers']['set'](_0x206722,_0x537acb);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0xb1f389['oldValue']==_0xb1f389['newValue'])break;_0x5e33e4['batch']['addOperation'](_0xb1f389),_0x19f486['model']['applyOperation'](_0xb1f389);const _0x12df10=_0xb1f389['key'];if(!_0x40a097['isRegisteredAttribute'](_0x12df10))break;const _0x4f2d7a=_0x5c5f61(_0xb1f389['range'],_0x19f486['model']),_0x2ef9cf='suggestion:attribute:'+_0x12df10+':'+ot()+':$aiSuggestion';_0x452ac5['markers']['set'](_0x2ef9cf,_0x4f2d7a);break;}case'insert':{_0x5e33e4['batch']['addOperation'](_0xb1f389),_0x19f486['model']['applyOperation'](_0xb1f389);if(_0x5f36c6[_0x593959+0x1]&&'move'==_0x5f36c6[_0x593959+0x1]['type']){ts(_0x452ac5,_0xb1f389);break;}const _0x507e3b=_0xb1f389['position'],_0x138803=_0xb1f389['howMany'],_0x460adb=_0x5c5f61(_0x19f486['model']['createRange'](_0x507e3b,_0x507e3b['getShiftedBy'](_0x138803)),_0x19f486['model']),_0x2484b7='suggestion:insertion:'+ot()+':$aiSuggestion';_0x452ac5['markers']['set'](_0x2484b7,_0x460adb);break;}case'split':{_0x5e33e4['batch']['addOperation'](_0xb1f389),_0x19f486['model']['applyOperation'](_0xb1f389);const _0x443748=_0xb1f389['splitPosition'],_0x49a85a=_0xb1f389['moveTargetPosition'],_0xc5079b=_0x19f486['model']['createRange'](_0x443748,_0x49a85a),_0x5a7971='suggestion:insertion:'+ot()+':$aiSuggestion';_0x452ac5['markers']['set'](_0x5a7971,_0xc5079b);break;}case'move':{_0x5e33e4['batch']['addOperation'](_0xb1f389),_0x19f486['model']['applyOperation'](_0xb1f389),_0x5f36c6[_0x593959-0x1]&&'insert'==_0x5f36c6[_0x593959-0x1]['type']&&ts(_0x452ac5,_0xb1f389);const _0x288b98=_0xb1f389['getMovedRangeStart'](),_0x34ae76=_0xb1f389['howMany'];for(let _0x1915e4=0x0;_0x1915e4<_0x34ae76;_0x1915e4++){const _0x99c828=_0x288b98['getShiftedBy'](_0x1915e4)['nodeAfter'];_0xb95699['add'](_0x99c828);}break;}case'remove':{const _0x404448=_0xb1f389['sourcePosition'],_0xec4309=_0xb1f389['howMany'],_0x3913f8=new _0x56cb8c(_0x404448,_0xec4309);_0x5e33e4['batch']['addOperation'](_0x3913f8),_0x19f486['model']['applyOperation'](_0x3913f8);break;}}}for(const _0x23945c of _0xb95699){const _0x5b0e35=_0x19f486['model']['createRangeOn'](_0x23945c),_0x1ef414='suggestion:formatBlock:$fakeWrap:'+ot()+':$aiSuggestion';_0x452ac5['markers']['set'](_0x1ef414,_0x5c5f61(_0x5b0e35,_0x19f486['model']));}});}(_0x324a67,_0x32108e,_0x32083e):_0x32083e['model']['change'](_0x1f0caa=>{for(const _0x29b565 of _0x324a67)if('remove'==_0x29b565['type']){const _0xeb020=_0x29b565['sourcePosition'],_0x121e4d=_0x29b565['howMany'],_0x314ecb=new _0x56cb8c(_0xeb020,_0x121e4d);_0x1f0caa['batch']['addOperation'](_0x314ecb),_0x32083e['model']['applyOperation'](_0x314ecb);}else{if('marker'==_0x29b565['type']){const _0x4f6574=_0x29b565['name'],_0x573082=_0x29b565['newRange'];null!==_0x573082?_0x32108e['markers']['set'](_0x4f6574,_0x573082):_0x32108e['markers']['delete'](_0x4f6574);}else _0x29b565['baseVersion']=null,_0x29b565['isDocumentOperation']=!0x1,_0x1f0caa['batch']['addOperation'](_0x29b565),_0x32083e['model']['applyOperation'](_0x29b565);}});if(_0x46f3d4){const _0x2a378b=es(_0x32083e,_0x324a67,_0x32108e);is(_0x32083e['model'],_0x2a378b),function(_0x5ec77a,_0x510102){const _0x5319b8=_0x510102['getFirstRange']()['start'];let _0x4aa3bb=_0x510102['getFirstRange']()['end'];const _0x376e5c=_0x5319b8['root'];(_0x4aa3bb['textNode']||_0x4aa3bb['nodeAfter']&&_0x4aa3bb['nodeAfter']['is']('$text'))&&(_0x3d933a(_0x4aa3bb,'...'),_0x4aa3bb=_0x4aa3bb['getShiftedBy'](0x3)),(_0x5319b8['textNode']||_0x5319b8['nodeBefore']&&_0x5319b8['nodeBefore']['is']('$text'))&&(_0x3d933a(_0x5319b8,'...'),function(_0x9e3069,_0x9d68ea,_0x85b637){for(let [_0x4abf78,_0x30f2ee]of _0x9e3069['markers']){const _0x1f6bfe=_0x30f2ee['_getTransformedByInsertion'](_0x9d68ea,_0x85b637,!0x1);_0x30f2ee=_0x1f6bfe[0x0],_0x9e3069['markers']['set'](_0x4abf78,_0x30f2ee);}}(_0x376e5c,_0x5319b8,0x3),_0x5319b8['parent']==_0x4aa3bb['parent']&&(_0x4aa3bb=_0x4aa3bb['getShiftedBy'](0x3)));const _0xa34c45=_0x5ec77a['createRange'](_0x5ec77a['createPositionAt'](_0x376e5c,0x0),_0x5319b8),_0x5254c5=_0x5ec77a['createRange'](_0x4aa3bb,_0x5ec77a['createPositionAt'](_0x376e5c,'end')),_0x2c36b7=[..._0xa34c45['getMinimalFlatRanges'](),..._0x5254c5['getMinimalFlatRanges']()];_0x2c36b7['reverse']();for(const _0xac4669 of _0x2c36b7)_0x2e2ddd(_0xac4669),ns(_0x376e5c,_0xac4669);}(_0x32083e['model'],_0x2a378b);}const _0x393b90=_0x32083e['data']['stringify'](_0x32108e,{'showSuggestionHighlights':!0x0});return{'content':Fi(_0x393b90),'hasChanges':!0x0};}(_0x4ee955,_0xcf13c5,_0x346098,_0xbf9a0f,_0x113587);return{'type':_0x213215['changes'][0x0]['type'],'index':_0x213215['index'],'content':_0x459fc3,'hasChanges':_0x22712b};});}function ts(_0x15c0e8,_0x2248b9){for(const [_0x301af3,_0x1471e7]of _0x15c0e8['markers']){const _0x450cd2=_0x1c9ece['_createFromRanges'](_0x1471e7['getTransformedByOperation'](_0x2248b9));_0x15c0e8['markers']['set'](_0x301af3,_0x450cd2);}}function es(_0x42da0d,_0x57a52a,_0x45512b){const _0x48ea7a=_0x42da0d['plugins']['get']('DocumentCompare');let _0x14318e=_0x42da0d['model']['createPositionAt'](_0x45512b,Number['POSITIVE_INFINITY']),_0xcd3d0=_0x42da0d['model']['createPositionAt'](_0x45512b,0x0);for(const _0x34f238 of _0x57a52a){let _0xe510de,_0x4575f1;if(_0x48ea7a['isMarkedRemoveOperation'](_0x34f238))_0xe510de=_0x34f238['newRange']['start'],_0x4575f1=_0x34f238['newRange']['end'];else switch(_0x14318e=_0x14318e['getTransformedByOperation'](_0x34f238),_0xcd3d0=_0xcd3d0['getTransformedByOperation'](_0x34f238),_0x34f238['type']){case'rename':_0xe510de=_0x34f238['position'],_0x4575f1=_0xe510de['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0xe510de=_0x34f238['range']['start'],_0x4575f1=_0x34f238['range']['end'];break;case'insert':_0xe510de=_0x34f238['position'],_0x4575f1=_0xe510de['getShiftedBy'](_0x34f238['howMany']);break;case'split':_0xe510de=_0x34f238['splitPosition'],_0x4575f1=_0x34f238['moveTargetPosition'];break;case'merge':{const _0x2a2cb8=_0x34f238['targetPosition']['path']['slice'](0x0,-0x1);_0xe510de=_0x42da0d['model']['createPositionFromPath'](_0x45512b,_0x2a2cb8),_0x4575f1=_0xe510de['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x2fca0=_0x34f238['howMany'],_0x4506bc=_0x34f238['sourcePosition']['_getTransformedByInsertion'](_0x34f238['targetPosition'],_0x2fca0),_0x2e28f7=_0x34f238['getMovedRangeStart']();'remove'==_0x34f238['type']?(_0xe510de=_0x4506bc,_0x4575f1=_0x4506bc):(_0xe510de=_0x2e28f7,_0x4575f1=_0x2e28f7['getShiftedBy'](_0x2fca0));break;}}_0xe510de&&_0xe510de['isBefore'](_0x14318e)&&(_0x14318e=_0xe510de['clone'](),_0x14318e['stickiness']='toNone'),_0x4575f1&&_0x4575f1['isAfter'](_0xcd3d0)&&(_0xcd3d0=_0x4575f1['clone'](),_0xcd3d0['stickiness']='toNone');}return _0x42da0d['model']['createSelection'](_0x42da0d['model']['createRange'](_0x14318e,_0xcd3d0));}function is(_0x2f0617,_0x55fb92){ss(_0x2f0617,_0x55fb92,'forward');const _0x1a51cb=_0x55fb92['getFirstRange']();_0x55fb92['setTo']([]),_0x55fb92['setTo'](_0x1a51cb,{'backward':!0x0}),ss(_0x2f0617,_0x55fb92,'backward');}function ss(_0x5b8c1c,_0x4a0884,_0x3e14de){let _0x3094b7=0x14;for(;_0x3094b7;){_0x5b8c1c['modifySelection'](_0x4a0884,{'unit':'word','direction':_0x3e14de}),_0x3094b7--;const _0x18e4dd=_0x4a0884['focus']['forward'==_0x3e14de?'nodeBefore':'nodeAfter'];if(_0x18e4dd&&_0x18e4dd['is']('element')&&_0x5b8c1c['schema']['isBlock'](_0x18e4dd)&&_0x5b8c1c['schema']['isObject'](_0x18e4dd))break;}}function ns(_0x18696d,_0x2dd8c8){for(const [_0x9da1e0,_0x2e60dd]of _0x18696d['markers']){const _0x31ac2e=_0x2e60dd['_getTransformedByDeletion'](_0x2dd8c8['start'],_0x2dd8c8['end']['offset']-_0x2dd8c8['start']['offset']);null!=_0x31ac2e?_0x18696d['markers']['set'](_0x9da1e0,_0x31ac2e):_0x18696d['markers']['delete'](_0x9da1e0);}}class AIReply extends ht(){['id'];['interactionId'];['type'];['sources']=[];['parsedContent']=new _0x38e78e([]);['parsedMergedContent']=new _0x38e78e([]);['changeGroups']=[];['areActionsDisabled']=!0x1;['isFromHistory']=!0x1;['documentContextContent'];['documentId'];['dataIdDocumentSources'];['newNodeAnchorIds']=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];['cachedSuggestionContentParts']={'withDiff':[],'withoutDiff':[]};constructor({type:_0x3a4c8d,content:_0x314a77='',isDone:_0x3ada35=!0x1,isComplete:_0x3f5310,interactionId:_0x22bc4d,areActionsDisabled:_0x1fa1cd,isFromHistory:_0x289d8d=!0x1,documentContextContent:_0x18d8c2,dataIdDocumentSources:_0x41ef11,documentId:_0x19ff12,locale:_0x377fad,id:_0x434342}){super(),this['id']=_0x434342||ot(),this['interactionId']=_0x22bc4d,this['type']=_0x3a4c8d,this['areActionsDisabled']=!!_0x1fa1cd,this['locale']=_0x377fad,this['dataIdDocumentSources']=_0x41ef11,this['documentId']=_0x19ff12,this['isFromHistory']=_0x289d8d,this['aiResponseParser']=new AIResponseParser(),this['aiResponseApplier']=new AIResponseApplier(),this['documentContextContent']=Fi(_0x18d8c2||''),this['set']('isDone',_0x3ada35),this['set']('isComplete',_0x3f5310??_0x3ada35),this['on']('change:content',()=>{this['onContentChange']();}),this['set']('content',_0x314a77);}['appendContent'](_0x4c5f8b){this['set']('content',this['content']+_0x4c5f8b);}['done'](_0x53facf=!0x0){this['isComplete']=_0x53facf,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x434090,_0x49637d){this['changeGroups'][_0x434090]['state']=_0x49637d,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x434090,'state':_0x49637d});}['getContentParts']({showDiff:_0x397f43,groupIndex:_0x2a9d49,editor:_0x177fd9}){const _0x56b799=this['_getCachedContentParts'](_0x397f43,_0x2a9d49);if(_0x56b799)return _0x56b799;let _0x515dc3=[];if(void 0x0===_0x2a9d49)_0x515dc3=this['changeGroups'];else{const _0x519d32=this['changeGroups']['find'](({index:_0x2b8a21})=>_0x2b8a21===_0x2a9d49);if(!_0x519d32)throw new at('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x2a9d49});_0x515dc3=[_0x519d32];}const _0x5ecf4e=Zi({'editor':_0x177fd9,'showDiff':_0x397f43,'changeGroups':_0x515dc3,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x397f43,_0x5ecf4e),_0x5ecf4e;}['_getCachedContentParts'](_0x3dab09,_0x183f26){const _0x576ecf=_0x3dab09?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x576ecf]['length'])return null;const _0x325795=this['cachedSuggestionContentParts'][_0x576ecf];if(void 0x0===_0x183f26)return _0x325795['length']>0x0&&_0x325795['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x3dab09,null),null):_0x43e724(_0x325795);{const _0x1e7345=_0x325795['find'](({index:_0x2af4bb})=>_0x2af4bb===_0x183f26);if(_0x1e7345)return[_0x43e724(_0x1e7345)];}return null;}['_setCachedContentParts'](_0x923c2,_0x53f71f){const _0x4eec7d=_0x923c2?'withDiff':'withoutDiff';_0x53f71f?_0x53f71f['forEach'](_0x456cc9=>{const _0x5938ff=this['cachedSuggestionContentParts'][_0x4eec7d],_0xf234c6=_0x5938ff['find'](({index:_0x51d0dc})=>_0x51d0dc===_0x456cc9['index']);if(_0xf234c6){const _0x1d580b=_0x5938ff['indexOf'](_0xf234c6);_0x5938ff['splice'](_0x1d580b,0x1,_0x456cc9);}else _0x5938ff['push'](_0x456cc9);}):this['cachedSuggestionContentParts'][_0x4eec7d]['length']=0x0;}['onContentChange'](){if('modification'===this['type']){this['parsedContent']=this['aiResponseParser']['parseAndNormalizeHTML'](this['content']);const _0x459549=this['changeGroups'];this['updateChangeGroups']();const _0x54a46=this['_getDifferentChangeGroups'](_0x459549,this['changeGroups']);(_0x54a46['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x54a46),this['cachedSuggestionContentParts']['withDiff']['length']=this['cachedSuggestionContentParts']['withoutDiff']['length']=0x0);}else this['parsedContent']=this['aiResponseParser']['convertMarkdownToHTML'](this['content']),this['fire']('replyContentUpdated',this);}['_getDifferentChangeGroups'](_0x4e577a,_0x307507){const _0x1efb6b=[];for(const _0x52c4ce of _0x307507){const _0x2e662d=_0x4e577a[_0x52c4ce['index']];_0x2e662d?_0x2e662d['changes']['length']!==_0x52c4ce['changes']['length']?_0x1efb6b['push'](_0x52c4ce):_0x2e662d['changes']['forEach']((_0x15f15e,_0x558511)=>{const _0x2c5914=_0x52c4ce['changes'][_0x558511];_0x15f15e['id']!==_0x2c5914['id']&&_0x1efb6b['push'](_0x52c4ce);}):_0x1efb6b['push'](_0x52c4ce);}return _0x1efb6b;}['updateChangeGroups'](){const _0x3e7974=this['locale']?new _0x59f13d('p',{},[new _0x59f13d('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x192276(Hi(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]):void 0x0,_0x426848=this['aiResponseApplier']['merge'](this['parsedContent'],this['documentContextContent']['cloneNode'](!0x0),{'markUnstableElements':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x3e7974,'cutAfterLastChange':!this['isDone']||!this['isComplete']});if(!_0x426848['modifiedNodeIds']['length']&&!this['isDone'])return;this['parsedMergedContent']=_0x426848['parsedContent'],this['newNodeAnchorIds']=_0x426848['newAnchorIds'];let _0x18205b=[];if(_0xbb1b5f(_0x4e4971=>{const _0x55b1fa=$i(_0x4e4971,'data-id');if(!_0x55b1fa||!_0x200971(_0x55b1fa))return!0x1;const _0x48f3fd=[_0x4e4971,...Xi(_0x4e4971)]['at'](-0x2);if(_0x4e4971!=_0x48f3fd){const _0x3e20af=$i(_0x48f3fd,'data-id');_0x200971(_0x3e20af)||(_0x18205b['push']({'node':_0x48f3fd,'id':_0x3e20af,'type':'modified'}),_0x426848['modifiedNodeIds']['push'](_0x3e20af));}else _0x426848['modifiedNodeIds']['includes'](_0x55b1fa)?_0x18205b['push']({'node':_0x4e4971,'type':'modified','id':_0x55b1fa}):_0x426848['newNodeIds']['includes'](_0x55b1fa)?_0x18205b['push']({'node':_0x4e4971,'type':'new','id':_0x55b1fa,'anchorId':$i(_0x4e4971['previousSibling'],'data-id')}):_0x18205b['push']({'node':_0x4e4971,'type':'removed','id':_0x55b1fa});return!0x0;},this['parsedMergedContent']),_0x18205b=_0x18205b['filter'](({node:_0xfebf2b})=>[...Xi(_0xfebf2b),_0xfebf2b]['every'](_0x5cb7a3=>!$i(_0x5cb7a3,'data-unstable'))),0x0==_0x18205b['length'])return;const _0x4108ce=[[_0x18205b[0x0]]];for(let _0x7ffb14=0x1;_0x7ffb14<_0x18205b['length'];_0x7ffb14++){const _0x2af7d9=_0x4108ce[_0x4108ce['length']-0x1],_0x1e20b6=_0x2af7d9[_0x2af7d9['length']-0x1];_0x18205b[_0x7ffb14]['node']['previousSibling']==_0x1e20b6['node']&&'modified'!=_0x18205b[_0x7ffb14]['type']&&'modified'!=_0x1e20b6['type']&&this['_isSameDocument'](_0x18205b[_0x7ffb14]['node'],_0x1e20b6['node'])?_0x2af7d9['push'](_0x18205b[_0x7ffb14]):_0x4108ce['push']([_0x18205b[_0x7ffb14]]);}for(const _0x3010d8 of _0x4108ce){const _0x35833e=_0x3010d8[0x0],_0x45d5e3=_0x3010d8[_0x3010d8['length']-0x1],_0x4ac5b7=_0x90a8a2(_0x35833e['node']['previousSibling']);_0x4ac5b7&&this['_isSameDocument'](_0x4ac5b7['node'],_0x35833e['node'])&&_0x3010d8['unshift'](_0x4ac5b7);const _0x41e0c2=_0x90a8a2(_0x45d5e3['node']['nextSibling']);_0x41e0c2&&this['_isSameDocument'](_0x41e0c2['node'],_0x45d5e3['node'])&&_0x3010d8['push'](_0x41e0c2);}function _0x200971(_0x589b6){return _0x426848['modifiedNodeIds']['includes'](_0x589b6)||_0x426848['newNodeIds']['includes'](_0x589b6)||_0x426848['removedNodeIds']['includes'](_0x589b6);}function _0x90a8a2(_0x296c41){if(_0x296c41&&$i(_0x296c41,'data-id')&&!$i(_0x296c41,'data-unstable')){const _0x4728f3=$i(_0x296c41,'data-id');if(!_0x200971(_0x4728f3))return{'node':_0x296c41,'type':'context','id':_0x4728f3};}return null;}this['changeGroups']=_0x4108ce['map']((_0x5d0a01,_0x4f7904)=>({'changes':_0x5d0a01,'state':'pending','index':_0x4f7904}));}['_isSameDocument'](_0x15d328,_0x585942){if(!this['dataIdDocumentSources']?.['size'])return!0x0;const _0x5974dc=this['_resolveDocumentSource'](_0x15d328),_0x2b45f4=this['_resolveDocumentSource'](_0x585942);return!_0x5974dc||!_0x2b45f4||_0x5974dc['editor']===_0x2b45f4['editor']&&_0x5974dc['rootName']===_0x2b45f4['rootName'];}['_resolveDocumentSource'](_0x4aa58a){if(!_0x4aa58a||!this['dataIdDocumentSources'])return;const _0x55c9e3=$i(_0x4aa58a,'data-id');if(_0x55c9e3){const _0x4945f9=this['dataIdDocumentSources']['get'](_0x55c9e3);if(_0x4945f9)return _0x4945f9;const _0x4d348e=this['newNodeAnchorIds']['get'](_0x55c9e3),_0x3631cb=_0x4d348e?this['dataIdDocumentSources']['get'](_0x4d348e):void 0x0;if(_0x3631cb)return _0x3631cb;}for(let _0x357f1f=_0x4aa58a['previousSibling'];_0x357f1f;_0x357f1f=_0x357f1f['previousSibling']){const _0x162824=$i(_0x357f1f,'data-id'),_0x2f0b7c=_0x162824?this['dataIdDocumentSources']['get'](_0x162824):void 0x0;if(_0x2f0b7c)return _0x2f0b7c;}for(let _0x27f862=_0x4aa58a['nextSibling'];_0x27f862;_0x27f862=_0x27f862['nextSibling']){const _0x4dfb57=$i(_0x27f862,'data-id'),_0x292915=_0x4dfb57?this['dataIdDocumentSources']['get'](_0x4dfb57):void 0x0;if(_0x292915)return _0x292915;}}}const rs=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];class AIInteraction extends Et(){['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;constructor({connector:_0x52eaa9,locale:_0x1aacdb}){super(),this['id']=ot(),this['connector']=_0x52eaa9,this['isStopped']=!0x0,this['locale']=_0x1aacdb;}async['start'](){const _0x38f30e=[];let _0x55f501,_0x6beec0,_0x295073,_0xb7b3f0=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x5e4632=await this['currentRequest']['getStream']();for await(const _0x1a0549 of _0x5e4632){if(this['isStopped'])return;if('error'==_0x1a0549['event'])return void this['fire']('error',{'error':new at('ai-chat-interaction-error',this)});switch(_0x1a0549['event']){case'message-metadata':this['messageId']=_0x1a0549['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x1a0549['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x1a0549['data']['conversationTitle'],!0x0);break;case'source':_0x38f30e['push'](_0x1a0549['data']['source']);break;case'web-search':this['_isWebSearching']||(this['_isWebSearching']=!0x0,this['fire']('webSearchStarted',this));break;case'reasoning':this['_isReasoning']||(this['_isReasoning']=!0x0,this['fire']('reasoningStarted',this));break;case'modification-delta':case'text-delta':this['resetReasoningState'](),this['resetWebSearchState'](),_0x55f501='modification-delta'==_0x1a0549['event']?'modification':'text',_0x6beec0='modification-delta'==_0x1a0549['event']?_0x1a0549['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x55f501&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']?'modification-delta'==_0x1a0549['event']&&(this['currentReply']['documentId']=_0x1a0549['data']['documentId']):(this['currentReply']=this['createReply']({'type':_0x55f501,'interactionId':this['id'],'id':_0x6beec0,...'modification-delta'==_0x1a0549['event']&&{'documentId':_0x1a0549['data']['documentId']}}),'modification'==_0x55f501&&(this['currentReply']['sources']=_0x38f30e['splice'](0x0))),this['currentReply']['appendContent'](_0x1a0549['data']['textDelta']);break;case'mcp-tool-result':_0x295073=JSON['parse'](_0x1a0549['data']['result']),this['_handleToolResultData']({'toolName':_0x1a0549['data']['toolName'],'data':_0x295073['data'],'attributes':_0x295073['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x1a0549['data']['toolName'],'data':_0x1a0549['data']['data']});}}_0xb7b3f0=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x38f30e['length']>0x0&&(this['currentReply']['sources']=_0x38f30e['splice'](0x0)),this['_finalizeInteraction'](_0xb7b3f0),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x32229f){return this['replies']['find'](_0x52fc22=>_0x52fc22['id']===_0x32229f);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x2de6c6=>_0x2de6c6['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x176aef){const _0x3869f9=new AIReply({'locale':this['locale'],'documentContextContent':this['getDocumentContext']()?.['content'],'dataIdDocumentSources':this['getDocumentContext']()?.['dataIdDocumentSources'],..._0x176aef});return this['replies']['push'](_0x3869f9),_0x3869f9['delegate'](...rs)['to'](this),this['fire']('replyCreated',_0x3869f9),_0x3869f9;}['setConversationTitle'](_0x5568e1,_0x1d83ea=!0x1){this['fire']('setConversationTitle',_0x5568e1,_0x1d83ea);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x5c0f5f){this['fire']('toolDataReceived',{'type':'result','toolName':_0x5c0f5f['toolName'],'data':structuredClone(_0x5c0f5f['data']||{}),'attributes':structuredClone(_0x5c0f5f['attributes']||{})},this);}['_handleToolNotificationData'](_0x5d4d49){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x5d4d49['toolName'],'data':structuredClone(_0x5d4d49['data'])},this);}['_finalizeInteraction'](_0x3b52b4=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x3b52b4),this['currentRequest']=this['currentReply']=void 0x0;}}const os=new Map([['usage-limits-exceeded','ai-usage-limits-exceeded'],['rate-limits-exceeded','ai-rate-limits-exceeded'],['invalid-content-type','ai-invalid-content-type'],['invalid-request-data','ai-chat-invalid-request'],['model-already-set','ai-chat-model-already-set'],['model-not-found','ai-chat-model-not-found'],['unsafe-content-detected','ai-chat-unsafe-content-detected'],['unsupported-content-type','ai-chat-unsupported-content-type'],['content-too-large','ai-chat-content-too-large'],['unsupported-file-type','ai-chat-context-unsupported-file-type'],['file-too-large','ai-chat-context-file-too-large'],['file-too-many-pages','ai-chat-context-file-too-many-pages'],['form-data-size-limits-exceeded','ai-chat-context-form-data-size-limits-exceeded']]),as=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];class AIChatContext extends ht(){['_connector'];['_config'];['_ownerId'];constructor({connector:_0x195958,config:_0x46f043,ownerId:_0x58000b}){super(),this['_connector']=_0x195958,this['_config']=_0x46f043,this['_ownerId']=_0x58000b;}['init'](){this['_pendingContextItems']=new Map(),this['_conversationContextItems']=new Map(),this['_ongoingUploads']=new Map(),this['_ongoingUploadOperations']=new Map(),this['_documentSources']=new Map(),this['_dataIdToSource']=new Map(),this['_setAddContextOptionsDefaultState']();}['_getDocumentSource'](_0x601741){if(_0x601741)return this['_documentSources']['get'](_0x601741);}['getSourceByDataId'](_0x5b2792){if(_0x5b2792)return this['_dataIdToSource']['get'](_0x5b2792);}['_getDocumentContextSlice'](_0x3774b4){const _0x7937c3=this['_getDocumentSource'](_0x3774b4);if(_0x7937c3)return{'editor':_0x7937c3['editor'],'rootName':_0x7937c3['rootName'],'html':_0x7937c3['content'],'version':_0x7937c3['version']};}['getDocumentContextSliceByDataId'](_0xc8826b){const _0x2d2eb1=this['getSourceByDataId'](_0xc8826b);return _0x2d2eb1?this['_getDocumentContextSlice'](_0x2d2eb1['documentId']):void 0x0;}['getPendingContextItems'](){return this['_pendingContextItems'];}async['populateFromMessage'](_0x2c2f4a){const _0x90bad1=await this['_createContextItemFromContent'](_0x2c2f4a);return this['_addToConversationContextItem'](_0x90bad1),'current-document'===_0x90bad1['uiId']&&this['_toggleAddCurrentDocumentOptionVisibility'](),_0x90bad1;}async['populateDocumentsFromMessage'](_0x2e510e,_0x43c58a){const _0xe4f3c6=_0x2e510e['filter'](_0x5f2790=>'document'===_0x5f2790['type']);if(0x0===_0xe4f3c6['length'])return{'hasUnmatched':!0x1};if(0x1===_0xe4f3c6['length'])return{'contextItem':await this['populateFromMessage'](_0xe4f3c6[0x0]),'hasUnmatched':!0x1};const _0x2e1b88=_0xe4f3c6['map'](_0x1971b5=>_0x1971b5['id']),_0x36a6f6=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x2e1b88)['getDocuments'](),_0x52ebf3=new Map(_0x36a6f6['map'](_0xc3cf86=>[_0xc3cf86['id'],_0xc3cf86]));this['_documentSources']['clear'](),this['_dataIdToSource']['clear']();const _0x23364a=[];let _0x4ce79c=!0x1;for(const _0x4755f6 of _0xe4f3c6){const _0x20a901=_0x52ebf3['get'](_0x4755f6['id']);if(!_0x20a901)continue;const _0x11c61a=this['_matchDocumentToRoot'](_0x20a901,_0x43c58a),_0x568d55=_0x43c58a[0x0]&&this['_getFirstRoot'](_0x43c58a[0x0]);_0x11c61a||(_0x4ce79c=!0x0);const _0x19e2cd=_0x11c61a?.['editor']??_0x568d55?.['editor'],_0x14739c=_0x11c61a?.['rootName']??_0x568d55?.['rootName'];if(_0x19e2cd&&_0x14739c){const _0x388a82={'editor':_0x19e2cd,'rootName':_0x14739c,'content':_0x20a901['content'],'version':_0x20a901['attributes']?.['version']??0x0,'name':_0x20a901['name'],'description':_0x20a901['description']};this['_documentSources']['set'](_0x20a901['id'],_0x388a82);const _0x2fa159=Fi(_0x20a901['content']);for(const _0x520787 of _0xbb1b5f(_0x18a0e4=>!!$i(_0x18a0e4,'data-id'),_0x2fa159)){const _0x57d5f9=$i(_0x520787,'data-id');_0x57d5f9&&this['_dataIdToSource']['set'](_0x57d5f9,{..._0x388a82,'documentId':_0x20a901['id']});}}_0x23364a['push']({'id':_0x20a901['id'],'content':_0x20a901['content'],'version':_0x20a901['attributes']?.['version']??0x0,'sessionId':_0x20a901['attributes']?.['sessionId']??null,'selection':[]});}const _0x4fef83={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x23364a,'dataIdDocumentSources':new Map(this['_dataIdToSource'])};return this['_addToConversationContextItem'](_0x4fef83),this['_toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x4fef83,'hasUnmatched':_0x4ce79c};}['_matchDocumentToRoot'](_0x86c1,_0x2be670){const _0x3127c4=_0x86c1['attributes']?.['channelId'],_0x138193=_0x86c1['attributes']?.['rootName'];if(_0x3127c4&&_0x138193){for(const _0x3ffe27 of _0x2be670)if(_0x3ffe27['config']['get']('collaboration.channelId')===_0x3127c4){for(const _0x3a1b9b of _0x3ffe27['model']['document']['getRoots']())if('$graveyard'!==_0x3a1b9b['rootName']&&_0x3a1b9b['rootName']===_0x138193)return{'editor':_0x3ffe27,'rootName':_0x3a1b9b['rootName']};}}}['_getFirstRoot'](_0x2403b5){for(const _0x9c2a84 of _0x2403b5['model']['document']['getRoots']())if('$graveyard'!==_0x9c2a84['rootName'])return{'editor':_0x2403b5,'rootName':_0x9c2a84['rootName']};}async['_createContextItemFromContent'](_0x39a8dc){if('document'===_0x39a8dc['type']){const _0x116814=await this['_connector']['fetchDocument'](this['_ownerId'],_0x39a8dc['id'])['getDocument']();return{'id':'current-document','uiId':'current-document','label':'Current\x20document','type':_0x39a8dc['type'],'content':_0x116814['content'],'hidden':this['_conversationContextItems']['has']('current-document'),'version':_0x116814['attributes']?.['version'],'sessionId':_0x116814['attributes']?.['sessionId']};}if('mcp-tool-context'===_0x39a8dc['type'])return{'id':_0x39a8dc['id'],'uiId':_0x39a8dc['id'],'label':_0x39a8dc['data']?.['label']||_0x39a8dc['id'],'type':'mcp-tool-context','mcpServerName':_0x39a8dc['mcpServerName'],'toolName':_0x39a8dc['toolName'],'data':_0x39a8dc['data']||{}};return{'id':_0x39a8dc['id'],'uiId':_0x39a8dc['id'],'label':_0x39a8dc['attributes']?.['label']||_0x39a8dc['name']||_0x39a8dc['url']||_0x39a8dc['id'],'type':_0x39a8dc['type'],..._0x39a8dc?.['attributes']?.['resourceId']?{'resourceId':_0x39a8dc['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x4c2e12){const _0x4a946d=this['_pendingContextItems']['get'](_0x4c2e12);_0x4a946d?.['isReadOnly']||this['_removeContextItem'](_0x4c2e12);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x53b465 of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x53b465['uiId']);const _0x1fedcc=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x1fedcc&&this['_addContextItem']({..._0x1fedcc,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x2957d2){for(const _0x39f666 of _0x2957d2['values']())this['_addToConversationContextItem'](_0x39f666);this['clearPendingContextItems'](),this['fire']('contextSent',{'contextItems':Array['from'](this['getSentContextItems']()['values']())});}['isCurrentDocumentInContext'](){return this['_pendingContextItems']['has']('current-document');}['isSelectionInContext'](){return this['_pendingContextItems']['has']('selection');}['isCurrentDocumentInConversation'](){return this['_conversationContextItems']['has']('current-document');}static['mapContextItemsToRequestData'](_0x192af1){return Array['from'](_0x192af1['values']())['flatMap'](_0x62563f=>this['_mapContextItemToRequestData'](_0x62563f));}async['addFilesToContext'](_0x566e78,_0x236a63,_0x35362f='file'){const _0x7df4cc='files-'+ot();this['_startUploadOperation'](_0x7df4cc);try{await Promise['all'](_0x566e78['map'](async _0x4e7597=>{const _0x58d213='file-'+ot(),_0x28b5f8=_0x353660(_0x4e7597['name']);try{this['_addContextItem']({'type':_0x35362f,'label':_0x236a63?.['label']||_0x28b5f8,'uiId':_0x58d213,'resourceId':_0x236a63?.['resourceId']},!0x0);const _0x4499bf=this['_connector']['uploadFile'](this['_ownerId'],_0x4e7597,_0x236a63);this['_ongoingUploads']['set'](_0x58d213,_0x4499bf['abortController']);const {id:_0x4e46bf}=await _0x4499bf['getId']();this['_ongoingUploads']['delete'](_0x58d213),this['_finishContextItemLoading']({'type':_0x35362f,'id':_0x4e46bf,'label':_0x236a63?.['label']||_0x28b5f8,'uiId':_0x58d213,'resourceId':_0x236a63?.['resourceId']},!0x1);}catch(_0x2f8c73){this['_ongoingUploads']['delete'](_0x58d213);if(!(_0x2f8c73 instanceof at&&_0x2f8c73['message']['startsWith']('ai-request-aborted'))){const _0x111683=os['get'](_0x2f8c73['code'])||'ai-chat-file-upload-failed',_0x3f052f=new at(_0x111683,null,{'fileName':_0x28b5f8,..._0x2f8c73});_0x3f052f['stack']=_0x2f8c73['stack'],this['fire']('error',{'error':_0x3f052f});}this['_removeContextItem'](_0x58d213);}}));}finally{this['_finishUploadOperation'](_0x7df4cc);}}['addCurrentDocumentToContext'](_0x2a7207){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x2d70f9={'type':'document','uiId':'current-document','label':_0x2a7207,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x2d70f9);}async['updateCurrentDocument'](_0x1d742c,_0x2a18b7,_0x127953,_0x476277,_0x29d414,_0x535f77){const _0x350f11=this['_pendingContextItems']['get']('current-document');if(_0x350f11&&_0x1d742c){_0x350f11['selection']=_0x535f77?_0x535f77['map'](_0x24a1a2=>({'start':_0x24a1a2['start'],'end':_0x24a1a2['end']})):[];try{if(_0x350f11['version']===_0x2a18b7)return;const {id:_0x2a6f38}=await this['_connector']['uploadDocument'](this['_ownerId'],_0x1d742c,{'version':_0x2a18b7,'sessionId':_0x127953,'channelId':_0x476277,'rootName':_0x29d414})['getId']();_0x350f11['id']=_0x2a6f38,_0x350f11['content']=_0x1d742c,_0x350f11['version']=_0x2a18b7,_0x350f11['sessionId']=_0x127953;}catch(_0x3bf465){const _0xef6f6b=new at('ai-chat-document-upload-failed',null);_0xef6f6b['stack']=_0x3bf465['stack'],this['fire']('error',{'error':_0xef6f6b});}}}async['updateCurrentDocuments'](_0x7f6e20){const _0x381626=this['_pendingContextItems']['get']('current-document');if(!_0x381626||!_0x7f6e20['length']||_0x7f6e20['every'](_0x4a1f4f=>!_0x4a1f4f['content']))return;_0x7f6e20['length']>0x1&&_0x7f6e20['some'](_0x3dbab1=>!_0x3dbab1['description'])&&gt('ai-chat-documents-missing-description');const _0x4bac0c=_0x55b741=>_0x55b741?_0x55b741['map'](_0x414db8=>({'start':_0x414db8['start'],'end':_0x414db8['end']})):[],_0x484e23=_0x381626['documents']??[];if(_0x484e23['length']===_0x7f6e20['length']&&_0x7f6e20['every']((_0x5a787c,_0x54e8b6)=>_0x484e23[_0x54e8b6]?.['version']===_0x5a787c['version']))_0x381626['documents']=_0x484e23['map']((_0x46d94e,_0xc37ecc)=>({..._0x46d94e,'selection':_0x4bac0c(_0x7f6e20[_0xc37ecc]['selections'])}));else try{const _0x5467ce=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x7f6e20)['getIds']();_0x381626['documents']=_0x7f6e20['map']((_0x3003cb,_0x189037)=>({'id':_0x5467ce[_0x189037]?.['id'],'content':_0x3003cb['content'],'version':_0x3003cb['version'],'sessionId':_0x3003cb['sessionId'],'selection':_0x4bac0c(_0x3003cb['selections'])})),this['_documentSources']['clear'](),this['_dataIdToSource']['clear']();for(let _0x43eb6b=0x0;_0x43eb6b<_0x7f6e20['length'];_0x43eb6b++){const _0x373471=_0x5467ce[_0x43eb6b]?.['id'],_0x55d4f2=_0x7f6e20[_0x43eb6b];if(!_0x373471)continue;const _0x3f9d06={'editor':_0x55d4f2['editor'],'rootName':_0x55d4f2['rootName'],'content':_0x55d4f2['content'],'version':_0x55d4f2['version'],'name':_0x55d4f2['name'],'description':_0x55d4f2['description']};this['_documentSources']['set'](_0x373471,_0x3f9d06);const _0x285d8c=Fi(_0x55d4f2['content']);for(const _0x2e208f of _0xbb1b5f(_0xbb979d=>!!$i(_0xbb979d,'data-id'),_0x285d8c)){const _0x1cb93e=$i(_0x2e208f,'data-id');_0x1cb93e&&this['_dataIdToSource']['set'](_0x1cb93e,{..._0x3f9d06,'documentId':_0x373471});}}_0x381626['dataIdDocumentSources']=new Map(this['_dataIdToSource']);}catch(_0xbd6f25){const _0x1faf4a=new at('ai-chat-document-upload-failed',null);_0x1faf4a['stack']=_0xbd6f25['stack'],this['fire']('error',{'error':_0x1faf4a});}}['addSelectionToContext'](_0x508b02){this['_addContextItem']({'type':'selection','label':_0x508b02,'uiId':'selection','content':_0x508b02});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x50880f,_0x11a161){const _0x5edb35='url-'+ot();this['_startUploadOperation'](_0x5edb35);const _0x5aa2b7='url-'+ot();try{this['_addContextItem']({'type':'web-resource','label':_0x11a161?.['label']||_0x50880f,'uiId':_0x5aa2b7,'resourceId':_0x11a161?.['resourceId']},!0x0);const _0x154a03=this['_connector']['uploadUrl'](this['_ownerId'],_0x50880f,_0x11a161);this['_ongoingUploads']['set'](_0x5aa2b7,_0x154a03['abortController']);const {id:_0x1d0dbb}=await _0x154a03['getId']();this['_ongoingUploads']['delete'](_0x5aa2b7),this['_finishContextItemLoading']({'type':'web-resource','id':_0x1d0dbb,'label':_0x11a161?.['label']||_0x50880f,'uiId':_0x5aa2b7,'resourceId':_0x11a161?.['resourceId']},!0x1);}catch(_0x557a0a){this['_ongoingUploads']['delete'](_0x5aa2b7),(_0x557a0a['message']['startsWith']('ai-request-aborted')||this['fire']('error',{'error':new at('ai-chat-url-upload-failed',this,{'url':_0x50880f,'originalError':_0x557a0a}),'url':_0x50880f}),this['_removeContextItem'](_0x5aa2b7));}finally{this['_finishUploadOperation'](_0x5edb35);}}['addToolItemToContext'](_0x43be0f){_0x43be0f['id']=_0x43be0f['id']??ot()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x43be0f['uiId'],_0x43be0f),this['fire']('contextItemAdded',{'contextItem':_0x43be0f,'isLoading':!0x1});}async['loadSourceResources'](_0x27143d,_0xa61637,_0x35d35f){const _0x148467=this['_addContextOptionsState']['sources']['find'](_0x55a4b9=>_0x55a4b9['id']===_0x27143d);if(!_0x148467)return this['fire']('error',{'error':new at('ai-chat-source-not-found',this,{'sourceId':_0x27143d}),'sourceId':_0x27143d}),[];try{const _0x2e239f=(await _0x148467['getResources'](_0xa61637))['map'](_0x10f836=>{const _0x46fc6c=this['_isResourceInContext'](_0x10f836['id']);return{..._0x10f836,'isInContext':_0x46fc6c};});return _0x148467['resources']=_0x2e239f,this['fire']('sourceResourcesLoaded',{'sourceId':_0x27143d,'source':_0x148467,'resources':_0x2e239f,'uid':_0x35d35f}),_0x2e239f;}catch(_0x31e23c){return this['fire']('error',{'error':new at('ai-chat-source-resources-load-failed',this,{'sourceId':_0x27143d,'originalError':_0x31e23c}),'sourceId':_0x27143d,'sourceLabel':_0x148467['label']}),[];}}async['addResourceToContext'](_0x4ac260,_0x517585){if(this['_isResourceInContext'](_0x517585['id']))return;let _0x31e11e=_0x517585['data'];if(!_0x31e11e&&_0x4ac260['getData'])try{_0x31e11e=await _0x4ac260['getData'](_0x517585['id']);}catch(_0x4fc6cd){return void this['fire']('error',{'error':new at('ai-chat-resource-load-failed',this,{'resourceId':_0x517585['id'],'sourceId':_0x4ac260['id'],'originalError':_0x4fc6cd}),'resourceId':_0x517585['id'],'sourceId':_0x4ac260['id']});}if(_0x31e11e)switch(_0x517585['type']){case'web-resource':if('string'!=typeof _0x31e11e)return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x517585['id'],'sourceId':_0x4ac260['id'],'expectedType':'string','actualType':typeof _0x31e11e}),'resourceId':_0x517585['id'],'sourceId':_0x4ac260['id']});await this['addUrlToContext'](_0x31e11e,{'label':_0x517585['label'],'resourceId':_0x517585['id']});break;case'file':if(!(_0x31e11e instanceof File))return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x517585['id'],'sourceId':_0x4ac260['id'],'expectedType':'File','actualType':typeof _0x31e11e}),'resourceId':_0x517585['id'],'sourceId':_0x4ac260['id']});await this['addFilesToContext']([_0x31e11e],{'label':_0x517585['label'],'resourceId':_0x517585['id']});break;case'text':if('object'!=typeof _0x31e11e||!('content'in _0x31e11e)||!('type'in _0x31e11e))return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x517585['id'],'sourceId':_0x4ac260['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x31e11e}),'resourceId':_0x517585['id'],'sourceId':_0x4ac260['id']});_0x31e11e=AIChatContext['_convertTextResourceToFile'](_0x31e11e,_0x517585['label']),await this['addFilesToContext']([_0x31e11e],{'label':_0x517585['label'],'resourceId':_0x517585['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new at('ai-chat-context-unsupported-type',this,{'resourceId':_0x517585['id'],'sourceId':_0x4ac260['id'],'resourceType':_0x517585['type']}),'resourceId':_0x517585['id'],'sourceId':_0x4ac260['id']});}else this['fire']('error',{'error':new at('ai-chat-resource-no-data',this,{'resourceId':_0x517585['id'],'sourceId':_0x4ac260['id']}),'resourceId':_0x517585['id'],'sourceId':_0x4ac260['id']});}static['_convertTextResourceToFile'](_0x159e5e,_0x1c8416){switch(_0x159e5e['type']){case'markdown':return new File([_0x159e5e['content']],_0x1c8416,{'type':'text/markdown'});case'html':return new File([_0x159e5e['content']],_0x1c8416,{'type':'text/html'});default:return new File([_0x159e5e['content']],_0x1c8416,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x445e28){switch(_0x445e28['type']){case'file':case'text':return[{'type':'file','id':_0x445e28['id']}];case'web-resource':return[{'type':'web-resource','id':_0x445e28['id']}];case'document':return _0x445e28['documents']?.['length']?_0x445e28['documents']['map'](_0xbfdfef=>({'type':'document','id':_0xbfdfef['id'],..._0xbfdfef['selection']?.['length']&&{'selection':_0xbfdfef['selection']}})):[{'type':'document','id':_0x445e28['id'],..._0x445e28['selection']?.['length']&&{'selection':_0x445e28['selection']}}];case'mcp-tool-context':{const _0x5970c3=_0x445e28;return[{'type':'mcp-tool-context','mcpServerName':_0x5970c3['mcpServerName'],'toolName':_0x5970c3['toolName'],'data':{..._0x5970c3['data'],'label':_0x5970c3['label']||_0x5970c3['data']?.['label']||_0x5970c3['id']},'id':_0x5970c3['id']}];}default:return[];}}['_addContextItem'](_0x42f308,_0x45c689=!0x1){if(this['_pendingContextItems']['set'](_0x42f308['uiId'],_0x42f308),_0x42f308['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x42f308,'isLoading':_0x45c689}),'current-document'===_0x42f308['uiId']&&this['_toggleAddCurrentDocumentOptionVisibility'](),_0x42f308['resourceId']){const _0x4254dc=this['_findSourceIdsByResourceId'](_0x42f308['resourceId']);_0x4254dc&&_0x4254dc['forEach'](_0x2d07db=>{this['_updateResourceInContextState'](_0x2d07db,_0x42f308['resourceId'],!0x0);});}}['_removeContextItem'](_0x5edb25){const _0x43096c=this['_pendingContextItems']['get'](_0x5edb25),_0x5f4bf9=this['_ongoingUploads']['get'](_0x5edb25);if(_0x5f4bf9&&(_0x5f4bf9['abort'](),this['_ongoingUploads']['delete'](_0x5edb25)),_0x43096c?.['resourceId']){const _0x18def7=this['_findSourceIdsByResourceId'](_0x43096c['resourceId']);_0x18def7&&_0x18def7['forEach'](_0x3fadea=>{this['_updateResourceInContextState'](_0x3fadea,_0x43096c['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x5edb25),this['fire']('contextItemRemoved',{'uiId':_0x5edb25,'type':_0x43096c?.['type']}),'current-document'===_0x5edb25&&this['_toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0xdacdd9,_0x556e17){if(this['_pendingContextItems']['has'](_0xdacdd9['uiId'])&&(this['_pendingContextItems']['set'](_0xdacdd9['uiId'],_0xdacdd9),this['fire']('contextItemLoadingEnded',{'contextItem':_0xdacdd9,'isLoading':_0x556e17}),_0xdacdd9['resourceId'])){const _0x24e1f7=this['_findSourceIdsByResourceId'](_0xdacdd9['resourceId']);_0x24e1f7&&_0x24e1f7['forEach'](_0x26883f=>{this['_updateResourceInContextState'](_0x26883f,_0xdacdd9['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x23b43d){this['_conversationContextItems']['set'](_0x23b43d['uiId'],_0x23b43d);}['_setAddContextOptionsDefaultState'](){this['_addContextOptionsState']={'document':{'enabled':!0x1!==this['_config']?.['document']?.['enabled'],'isHidden':!0x1},'urls':{'enabled':!0x1!==this['_config']?.['urls']?.['enabled']},'files':{'enabled':!0x1!==this['_config']?.['files']?.['enabled']},'sources':this['_getCustomSourcesInitialState'](),'customItems':this['_config']?.['customItems']?.['map'](_0x463168=>({..._0x463168,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x58d472=>({..._0x58d472,'resources':[]}))??[];}['_toggleAddCurrentDocumentOptionVisibility'](){const _0x57dfe6=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x57dfe6,this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_isResourceInContext'](_0x2bfe7e){for(const _0x326a8c of this['_pendingContextItems']['values']())if(_0x326a8c['resourceId']===_0x2bfe7e)return!0x0;for(const _0x53ceb1 of this['_conversationContextItems']['values']())if(_0x53ceb1['resourceId']===_0x2bfe7e)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x3ced0d){const _0x4ca213=[];for(const _0x5aff7d of this['_addContextOptionsState']['sources']){_0x5aff7d['resources']['find'](_0x1248c8=>_0x1248c8['id']===_0x3ced0d)&&_0x4ca213['push'](_0x5aff7d['id']);}return 0x0===_0x4ca213['length']?null:_0x4ca213;}['_updateResourceInContextState'](_0x5a1c27,_0x8f00c1,_0x2e4fc0){const _0x581901=this['_addContextOptionsState']['sources']['find'](_0x509fda=>_0x509fda['id']===_0x5a1c27);if(!_0x581901)return;const _0x51fbe9=_0x581901['resources']['find'](_0x516c13=>_0x516c13['id']===_0x8f00c1);_0x51fbe9&&(_0x51fbe9['isInContext']=_0x2e4fc0,this['fire']('resourceStateChanged',{'sourceId':_0x5a1c27,'resourceId':_0x8f00c1,'isInContext':_0x2e4fc0}));}['_startUploadOperation'](_0x36cd3c){this['_ongoingUploadOperations']['set'](_0x36cd3c,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x2f2727){this['_ongoingUploadOperations']['delete'](_0x2f2727),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}}const hs=['capabilitiesUpdated'];class AICapabilities extends Et(){['_isWebSearchEnabled'];['_isReasoningEnabled'];constructor(){super(),this['_isWebSearchEnabled']=!0x1,this['_isReasoningEnabled']=!0x1;}['init'](){this['reset']();}['reset'](){this['setWebSearch'](!0x1),this['setReasoning'](!0x1);}['getCapabilitiesConfig'](){return{'isWebSearchEnabled':this['_isWebSearchEnabled'],'isReasoningEnabled':this['_isReasoningEnabled']};}static['getCapabilitiesRequestData'](_0x2a7b2f){const _0x506f6e={};return _0x2a7b2f&&_0x2a7b2f['isWebSearchEnabled']&&(_0x506f6e['webSearch']={}),_0x2a7b2f&&_0x2a7b2f['isReasoningEnabled']&&(_0x506f6e['reasoning']={}),_0x506f6e;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x35cb42){_0x35cb42!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x35cb42,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x723f13){_0x723f13!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x723f13,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}}class AIChatInteraction extends AIInteraction{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0xdb70e1){super(_0xdb70e1),this['conversationId']=_0xdb70e1['conversationId'],this['contextItems']=_0xdb70e1['contextItems'],this['capabilities']=_0xdb70e1['capabilities'],this['userMessage']=_0xdb70e1['userMessage'],this['model']=_0xdb70e1['model'],this['attributes']=_0xdb70e1['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':AIChatContext['mapContextItemsToRequestData'](this['contextItems']),'capabilities':AICapabilities['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}['createReply'](_0x15683a){const _0xcb6eb7=this['getDocumentContext']();if(_0xcb6eb7?.['documents']?.['length']){const _0x5232f5=_0xcb6eb7['documents']['map'](_0x63ac8=>_0x63ac8['content']??'')['join']('');if(_0x5232f5)return super['createReply']({'documentContextContent':_0x5232f5,..._0x15683a});}return super['createReply'](_0x15683a);}}class AIChatConversation extends Et(){['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];constructor(_0x145646){super(),this['options']=_0x145646,this['connector']=_0x145646['connector'],this['chatModels']=_0x145646['chatModels'],this['id']=_0x145646['conversationId'],this['isFromHistory']=_0x145646['isFromHistory'];}async['init'](_0x4be1ac){try{this['chatContext']=new AIChatContext({'connector':this['connector'],'config':_0x4be1ac,'ownerId':this['id']}),this['chatContext']['delegate'](...as)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new AICapabilities(),this['chatCapabilities']['delegate'](...hs)['to'](this),this['chatCapabilities']['init']();const _0x52f5e4=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x52f5e4});const _0x422414=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x422414&&await this['setModel'](_0x422414);}catch(_0x33192f){const _0x1c0b40=new at('ai-chat-conversation-init-failed',null,{'message':_0x33192f['message']||_0x33192f});_0x1c0b40['stack']=_0x33192f['stack'],this['fire']('error',{'error':_0x1c0b40});}}async['start'](){if(this['isStarted'])throw new at('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new at('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x211487}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x211487,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x33aa3b){const _0x2e190d=new at('ai-chat-conversation-start-failed',null,{'message':_0x33aa3b['message'],'conversationId':this['id']});throw _0x2e190d['stack']=_0x33aa3b['stack'],this['fire']('error',{'error':_0x2e190d}),_0x2e190d;}}async['load'](_0x3d6705,_0x3096d9){try{const _0x4e1bbc=await this['connector']['fetchConversation'](_0x3d6705)['getConversation'](),_0x18557d=await this['connector']['fetchConversationMessages'](_0x3d6705)['getMessages'](),_0x6cd40f=_0x18557d[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x4e1bbc['id'],'title'in _0x4e1bbc?this['fire']('setConversationTitle',_0x4e1bbc['title'],!0x0):this['fire']('setConversationTitle','',!0x0);const _0x192362=(await this['chatModels']['getAll']())['find'](_0x59d5af=>_0x59d5af['id']['toLowerCase']()===_0x6cd40f['toLowerCase']());return this['selectedModel']=_0x192362,this['fire']('modelSelected',{'selectedModel':_0x192362,'isDisabled':!0x0}),await this['_processMessagesToInteractions'](_0x18557d,_0x3096d9,_0x6cd40f),this['currentInteraction']=void 0x0,this;}catch(_0x483cb8){const _0x20e5ea=new at('ai-chat-conversation-init-from-id-failed',null,{'message':_0x483cb8['message'],'conversationId':_0x3d6705});throw _0x20e5ea['stack']=_0x483cb8['stack'],this['fire']('error',{'error':_0x20e5ea}),_0x20e5ea;}}async['_processMessagesToInteractions'](_0x38deef,_0x3ec09d,_0x3ceba9){let _0x54cc36,_0x3adbf5=!0x1;for(const _0x944bc5 of _0x38deef)if('user'===_0x944bc5['role']){const {contextItems:_0x2354eb,hasUnmatched:_0x5bf031}=await this['_extractContextItems'](_0x944bc5);_0x3adbf5=_0x5bf031;const _0x128242={'isReasoningEnabled':Object['hasOwn'](_0x944bc5['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x944bc5['capabilities'],'webSearch')};_0x54cc36=this['createInteraction']({'userMessage':_0x944bc5['prompt'],'contextItems':_0x2354eb,'capabilities':_0x128242,'modelId':_0x3ceba9,'attributes':_0x944bc5['attributes']}),this['currentInteraction']=_0x54cc36,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x944bc5['role']&&_0x54cc36){const _0x166695=[];for(const _0x4f2f98 of _0x944bc5['content'])switch(_0x4f2f98['type']){case'text':case'modification':{const _0x588dd1=_0x54cc36['getDocumentContext'](),_0x22dacb=(_0x588dd1?.['documents']?.['length']?_0x588dd1['documents']['some'](_0x1d9cfb=>_0x1d9cfb['sessionId']!==_0x3ec09d):_0x588dd1?.['sessionId']!==_0x3ec09d)||_0x3adbf5;_0x54cc36['currentReply']?.['type']!==_0x4f2f98['type']&&(_0x54cc36['currentReply']=_0x54cc36['createReply']({'type':_0x4f2f98['type'],'isDone':!0x0,'interactionId':_0x54cc36['id'],'areActionsDisabled':_0x22dacb,'isFromHistory':!0x0}),_0x166695['length']>0x0&&(_0x54cc36['currentReply']['sources']=_0x166695['splice'](0x0))),_0x54cc36['currentReply']['appendContent'](_0x4f2f98['content']);break;}case'url':_0x166695['push'](_0x4f2f98);break;case'mcp-tool-result':{const {data:_0x3ac63f,attributes:_0x372155}=JSON['parse'](_0x4f2f98['content']);_0x54cc36['_handleToolResultData']({'toolName':_0x4f2f98['toolName'],'data':_0x3ac63f,'attributes':_0x372155});break;}}}}}async['_extractContextItems'](_0x153116){const _0x4f9134=new Map();if(!_0x153116['content'])return{'contextItems':_0x4f9134,'hasUnmatched':!0x1};const _0x2c0a1f=this['_resolveEditors'](),{contextItem:_0x5eb0b0,hasUnmatched:_0x46530c}=await this['chatContext']['populateDocumentsFromMessage'](_0x153116['content'],_0x2c0a1f);_0x5eb0b0&&_0x4f9134['set'](_0x5eb0b0['id'],_0x5eb0b0);for(const _0x2f1350 of _0x153116['content']){if('document'===_0x2f1350['type'])continue;const _0x1f560c=await this['chatContext']['populateFromMessage'](_0x2f1350);_0x1f560c&&_0x4f9134['set'](_0x1f560c['id'],_0x1f560c);}return{'contextItems':_0x4f9134,'hasUnmatched':_0x46530c};}['_resolveEditors'](){return this['options']['getEditors']?this['options']['getEditors']():this['options']['getEditor']?[this['options']['getEditor']()]:[];}async['handleUserInteraction']({userMessage:_0x29f5c5,attributes:_0x679fd}){if(!this['isStarted'])throw new at('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new at('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x3dc05a=this['chatContext']['getPendingContextItems'](),_0x4076a0=this['chatCapabilities']['getCapabilitiesConfig'](),_0x58e7b6=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x29f5c5,'contextItems':_0x3dc05a,'capabilities':_0x4076a0,'modelId':_0x58e7b6,'attributes':_0x679fd}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x58ebd0){if(_0x58ebd0 instanceof at)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x58ebd0});else{const _0x29d153=os['get'](_0x58ebd0['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new at(_0x29d153,null,{'error':_0x58ebd0})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x57791e,contextItems:_0x2bb14c,capabilities:_0x14e902,modelId:_0x564cad,attributes:_0x5c1d3a}){const _0x1a4ad5=new AIChatInteraction({'userMessage':_0x57791e,'contextItems':_0x2bb14c,'capabilities':_0x14e902,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x564cad,'attributes':_0x5c1d3a});return _0x1a4ad5['delegate'](...rs)['to'](this),this['interactions']['push'](_0x1a4ad5),this['fire']('interactionCreated',_0x1a4ad5),_0x1a4ad5;}['getInteraction'](_0x5d1262){return this['interactions']['find'](_0x5f58cb=>_0x5f58cb['id']===_0x5d1262);}['removeInteraction'](_0x4e5a00){const _0x482a1f=this['getInteraction'](_0x4e5a00);_0x482a1f&&(_0x482a1f['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x482a1f),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['addCurrentDocumentToContext'](_0x12a9df){this['chatContext']['addCurrentDocumentToContext'](_0x12a9df);}async['updateCurrentDocumentInContext']({content:_0x5a9b16,version:_0x58b335,sessionId:_0x41372,channelId:_0x34c762,rootName:_0x32ae66,selections:_0x33464c}){await this['chatContext']['updateCurrentDocument'](_0x5a9b16,_0x58b335,_0x41372,_0x34c762,_0x32ae66,_0x33464c);}async['updateCurrentDocumentsInContext'](_0x3360d4){await this['chatContext']['updateCurrentDocuments'](_0x3360d4);}['getSourceByDataId'](_0x1b616c){return this['chatContext']['getSourceByDataId'](_0x1b616c);}['getDocumentContextSliceByDataId'](_0x2786f3){return this['chatContext']['getDocumentContextSliceByDataId'](_0x2786f3);}['getCurrentDocumentContext'](){return this['currentInteraction']?.['getDocumentContext']()?.['content']||'';}['addSelectionToContext'](_0x5b3897){this['chatContext']['addSelectionToContext'](_0x5b3897);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x246a9d){this['chatContext']['addFilesToContext'](_0x246a9d);}['addUrlToContext'](_0x384f52){this['chatContext']['addUrlToContext'](_0x384f52);}['addToolItemToContext'](_0x40350f){this['chatContext']['addToolItemToContext'](_0x40350f);}['addResourceToContext'](_0x119505,_0x4dc0d1){this['chatContext']['addResourceToContext'](_0x119505,_0x4dc0d1);}['loadSourceResources'](_0x53598f,_0x547d75,_0x3c6612){return this['chatContext']['loadSourceResources'](_0x53598f,_0x547d75,_0x3c6612);}['removeFromContext'](_0x28135a){this['chatContext']['removeFromContext'](_0x28135a);}['setWebSearch'](_0x72893a){this['chatCapabilities']['setWebSearch'](_0x72893a);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x45f6be){this['chatCapabilities']['setReasoning'](_0x45f6be);}['toggleReasoning'](){this['chatCapabilities']['toggleReasoning']();}['isCurrentDocumentInContext'](){return this['chatContext']['isCurrentDocumentInContext']();}['isCurrentDocumentInConversation'](){return this['chatContext']['isCurrentDocumentInConversation']();}['isSelectionInContext'](){return this['chatContext']['isSelectionInContext']();}async['setModel'](_0x54c720){_0x54c720?!0x1===await this['chatModels']['isAvailable'](_0x54c720)&&(gt('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x54c720}),_0x54c720=(await this['chatModels']['getAvailableModels']())[0x0]):(gt('ai-chat-conversation-set-model-null',{'conversation':this}),_0x54c720=(await this['chatModels']['getAvailableModels']())[0x0]),_0x54c720['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x54c720,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x54c720}));}}class AIModels extends Et(){['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x37776e,config:_0x5831f3,locale:_0x58098c}){super(),this['_connector']=_0x37776e,this['_config']=_0x5831f3,this['_locale']=_0x58098c;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get['_defaultModelId'](){return this['_config']?.['defaultModelId'];}async['getAll'](){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()),this['_modelsRequest'];}async['getAvailableModels'](){const _0x585a14=await this['getAll']();let _0x137fd1;return _0x137fd1=this['_availableModels']?this['_filterModels'](_0x585a14,this['_availableModels']):_0x585a14['filter'](_0x326f6f=>_0x326f6f['recommended']),_0x137fd1;}async['getModel'](_0x34cb06){const _0x246501=await this['getAll']();if(!_0x246501['length'])return null;if(_0x34cb06){const _0x331c6d=this['_getModelById'](_0x246501,_0x34cb06);if(_0x331c6d)return _0x331c6d;gt('ai-chat-model-id-unrecognized',{'modelId':_0x34cb06,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x5592b6=await this['getAvailableModels']();if(!_0x5592b6['length'])return null;if(this['_defaultModelId']){const _0x17c008=this['_getModelById'](_0x5592b6,this['_defaultModelId']);if(_0x17c008)return _0x17c008;gt('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x5592b6[0x0]['id']});}return _0x5592b6[0x0];}async['isAvailable'](_0x4fbedb){return(await this['getAvailableModels']())['some'](_0x320c37=>_0x320c37['name']===_0x4fbedb['name']&&_0x320c37['provider']===_0x4fbedb['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length'])try{const _0x482ec3=this['_locale']['uiLanguage']||'en',_0x442f7d=this['_connector']['getModels'](_0x482ec3),_0x410b1a=await _0x442f7d['list']();this['_modelList']=_0x410b1a['items']['map'](_0x5ed4d5=>cs(_0x5ed4d5)?{..._0x5ed4d5,'name':Hi(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x5ed4d5);}catch(_0x2d23c5){throw Ct('ai-models-unable-to-retrieve',{'error':_0x2d23c5}),_0x2d23c5;}return[...this['_modelList']];}['_filterModels'](_0x490f0d,_0x1c126e){let _0x13a185;if(_0x1c126e){_0x13a185=[];const _0x3951dc=new Set(),_0x47ac3d='string'==typeof _0x1c126e?[_0x1c126e['toLocaleLowerCase']()]:_0x1c126e['map'](_0x1d8d7e=>_0x1d8d7e['toLocaleLowerCase']());for(const _0x406cb2 of _0x47ac3d)for(const _0x204e57 of _0x490f0d)!_0x3951dc['has'](_0x204e57['id'])&&this['_isMatchingFilter'](_0x204e57,_0x406cb2)&&(_0x13a185['push'](_0x204e57),_0x3951dc['add'](_0x204e57['id']));}else _0x13a185=_0x490f0d;return _0x13a185;}['_isMatchingFilter'](_0x2662ca,_0x1e0040){const _0x11d28e=_0x2662ca['id']['toLocaleLowerCase'](),_0x3be73a=_0x2662ca['name']['toLocaleLowerCase'](),_0x36c5b0=_0x2662ca['provider']['toLocaleLowerCase']();return _0x11d28e===_0x1e0040||_0x3be73a===_0x1e0040||cs(_0x2662ca)&&'auto'===_0x1e0040||_0x36c5b0===_0x1e0040||_0x11d28e['startsWith'](_0x1e0040);}['_getModelById'](_0x112a4b,_0x4ecd4e){return _0x112a4b['find'](_0x18e2f4=>cs(_0x18e2f4)&&'auto'===_0x4ecd4e?_0x18e2f4:_0x18e2f4['id']===_0x4ecd4e)||null;}}function cs(_0x14355e){return _0x14355e['id']['startsWith']('agent');}function ls(_0x37c0f4){return _0x37c0f4?_0x37c0f4 instanceof _0x461551?[_0x37c0f4]:_0x37c0f4['editors']&&0x0!==_0x37c0f4['editors']['length']?Array['from'](_0x37c0f4['editors']):[]:[];}function us(_0x73fa0d){const _0x76e2fb=ls(_0x73fa0d);if(!_0x76e2fb['length'])throw new at('ai-get-editor-from-context-no-editor');if(0x1===_0x76e2fb['length'])return _0x76e2fb[0x0];const _0x1031fa=_0x76e2fb['find'](_0x6c6617=>_0x6c6617['ui']?.['focusTracker']?.['isFocused']);if(_0x1031fa)return _0x1031fa;const _0x29763f=function(_0x57351e){if(_0x57351e instanceof _0x461551)return;const _0x4000f9=_0x57351e;if(!_0x4000f9['plugins']||!_0x4000f9['plugins']['has']('AIEditing'))return;const _0x2cfd0b=_0x4000f9['plugins']['get']('AIEditing');return _0x2cfd0b['getLastContentFocusedEditor']?.();}(_0x73fa0d);return _0x29763f&&_0x76e2fb['includes'](_0x29763f)?_0x29763f:_0x76e2fb[0x0];}function ds(_0x5e7bc0){return us(_0x5e7bc0);}function _s({editor:_0x2c5296,interaction:_0x41bff5,reply:_0x2f60b5,groups:_0x5ec4c5,transform:_0x3d0113,documentCompare:_0x15b93e,documentCompareOptions:_0x32f7c4,documentContextSlice:_0x5d34dc}){const _0x4e7de5=_0x41bff5['getDocumentContext']();if(!_0x4e7de5)return[];const _0x60913f=_0x2f60b5['documentContextContent']['cloneNode'](!0x0);for(const {changes:_0x5f2008}of _0x5ec4c5){const _0x348a3e=_0x5f2008['filter'](_0x10929a=>'new'!=_0x10929a['type'])['map'](_0x580567=>Wi('data-id',_0x580567['id'],_0x60913f)),_0x32625a=_0x5f2008['filter'](_0x1e8a6e=>'removed'!=_0x1e8a6e['type'])['map'](_0x30b23a=>_0x30b23a['node']['cloneNode'](!0x0));let _0x40bbbf=null;if(_0x348a3e['length']){_0x40bbbf=_0x348a3e[0x0]['previousSibling'];for(let _0x57387b=0x0;_0x57387b<_0x348a3e['length'];_0x57387b++)_0x3064c8(_0x348a3e[_0x57387b]);}if(_0x32625a['length']){_0x40bbbf||(_0x5f2008[0x0]['anchorId']?_0x40bbbf=Wi('data-id',_0x5f2008[0x0]['anchorId'],_0x60913f):(_0x40bbbf=_0x32625a['shift'](),_0x56bf59(_0x60913f,_0x40bbbf)));for(let _0x472530=0x0;_0x472530<_0x32625a['length'];_0x472530++)_0x5229d2(_0x40bbbf,_0x32625a[_0x472530]),_0x40bbbf=_0x32625a[_0x472530];}}let _0x43ea71,_0x23a331,_0x298c9b,_0x394af1=_0x32f7c4;if(_0x5d34dc){_0x43ea71=_0x5d34dc['html'],_0x298c9b=_0x5d34dc['version'],_0x394af1={..._0x32f7c4,'anchor':_0x5d34dc['rootName']};const _0x1b4979=new _0x38e78e([]),_0x4eb405=_0x60913f['children'],_0x591d50=_0x2f60b5['dataIdDocumentSources'],_0x540ed4=_0x2f60b5['newNodeAnchorIds'],_0x119d55=_0x5d34dc['editor'],_0xa41a65=_0x5d34dc['rootName'],_0x419ad9=new Array(_0x4eb405['length']),_0x2ebd4e=_0x112859=>_0x112859?_0x112859['editor']===_0x119d55&&_0x112859['rootName']===_0xa41a65:void 0x0;for(let _0x10dac5=0x0;_0x10dac5<_0x4eb405['length'];_0x10dac5++){const _0x35036a=$i(_0x4eb405[_0x10dac5],'data-id');if(!_0x35036a)continue;const _0x261c55=_0x2ebd4e(_0x591d50?.['get'](_0x35036a));if(void 0x0!==_0x261c55){_0x419ad9[_0x10dac5]=_0x261c55;continue;}const _0x57f6b5=_0x540ed4['get'](_0x35036a),_0x4235ca=_0x57f6b5?_0x2ebd4e(_0x591d50?.['get'](_0x57f6b5)):void 0x0;void 0x0!==_0x4235ca&&(_0x419ad9[_0x10dac5]=_0x4235ca);}for(let _0x23d18e=0x0;_0x23d18e<_0x4eb405['length'];_0x23d18e++)if(void 0x0===_0x419ad9[_0x23d18e]){for(let _0x812afc=_0x23d18e-0x1;_0x812afc>=0x0;_0x812afc--)if(void 0x0!==_0x419ad9[_0x812afc]){_0x419ad9[_0x23d18e]=_0x419ad9[_0x812afc];break;}if(void 0x0===_0x419ad9[_0x23d18e]){for(let _0x14ef65=_0x23d18e+0x1;_0x14ef65<_0x4eb405['length'];_0x14ef65++)if(void 0x0!==_0x419ad9[_0x14ef65]){_0x419ad9[_0x23d18e]=_0x419ad9[_0x14ef65];break;}}}for(let _0x5ac7fa=0x0;_0x5ac7fa<_0x4eb405['length'];_0x5ac7fa++)_0x419ad9[_0x5ac7fa]&&_0x1b4979['children']['push'](_0x225cd1(_0x4eb405[_0x5ac7fa],!0x0));_0x23a331=Ki(_0x1b4979);}else _0x43ea71=_0x4e7de5['content'],_0x298c9b=_0x4e7de5['version'],_0x23a331=Ki(_0x60913f);const _0x2a2d37=_0x15b93e['getDiff'](_0x43ea71,_0x23a331,{..._0x394af1,'targetEditor':_0x2c5296})['getOperations']();if(_0x3d0113){const _0x176ea2=_0x2c5296['model']['document']['history']['getOperations'](_0x298c9b),_0x247a71={'document':_0x2c5296['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};return _0x586b34(_0x2a2d37,_0x176ea2,_0x247a71)['operationsA'];}return _0x2a2d37;}function Is(_0x5e9bc6,_0x5e41cf){if('marker'!=_0x5e41cf['type'])return;const _0x3827e9=_0x5e9bc6['model']['markers']['get'](_0x5e41cf['name']);_0x3827e9&&(_0x5e41cf['oldRange']=_0x3827e9['getRange']());}class AIChatController extends _0x4127f4{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_aiChatBalloon'];['_activeBalloon'];['_wiredBalloons']=new Set();['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];static get['requires'](){return[AIConnector,_0x4278a5];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_bodyCollection']=new Qt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_aiChatModels']=new AIModels({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x2897d8=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x2c87a1,_0x26e4da)=>{this['_handleUIUserMessage']({'message':_0x26e4da});}),this['listenTo'](_0x2897d8['view'],'change:activeTab',(_0x21b47f,_0x38293d,_0x8171e1)=>{'chat'!==_0x8171e1&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',async()=>{await this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x3c3013,_0x599719)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x599719));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0xb86230,_0x1b9761)=>{this['activeConversation']?.['addUrlToContext'](_0x1b9761);}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x2d410c,_0x3902ec)=>{_0x3902ec['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x549d25,_0x21de5a)=>{this['activeConversation']?.['addResourceToContext'](_0x21de5a['source'],_0x21de5a['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x77545e,_0x11b8b5)=>{this['_removeFromContext'](_0x11b8b5);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x20a7aa,_0x1ad34f)=>{this['activeConversation']?.['loadSourceResources'](_0x1ad34f['sourceId'],_0x1ad34f['query'],_0x1ad34f['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x573e31,_0x4454fd)=>{this['activeConversation']?.['setModel'](_0x4454fd);}),this['listenTo'](this['_aiChatUi'],'like',(_0x50bb37,{replyId:_0x225bfe})=>{console['log']('Liked\x20response',_0x225bfe);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x3fc00d,{replyId:_0x4f1a20})=>{console['log']('Disliked\x20response',_0x4f1a20);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x29048f,_0x1b1b7c)=>{this['_insertSuggestion'](_0x1b1b7c);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x508aa8,{replyId:_0x48e458,partIndex:_0x5b4262})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x48e458,_0x5b4262);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x5b9dac,{replyId:_0x50bfc9,partIndex:_0x10395c})=>{const _0xf6edd4=this['_getDocumentRangeForReplyChanges'](_0x50bfc9,_0x10395c);_0xf6edd4&&'$graveyard'!=_0xf6edd4['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'ranges':[_0xf6edd4['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x144e92,_0x492dfd)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x492dfd);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x4cfdcd,{replyId:_0x73c55b,showDiff:_0x86d2ae})=>{const {reply:_0x2a784d}=this['getInteractionAndReplyById'](_0x73c55b),_0x4c23d0=_0x2a784d['getContentParts']({'showDiff':_0x86d2ae,'editor':ds(this['context'])});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x2a784d['id'],'parts':_0x4c23d0});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0xd265e9,{replyId:_0xbb2ed9,partIndex:_0x4c8104})=>{this['_rejectSuggestion']({'replyId':_0xbb2ed9,'partIndex':_0x4c8104}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['context']['plugins']['has']('AIChatBalloon')&&(this['_aiChatBalloon']=this['context']['plugins']['get']('AIChatBalloon')),this['on']('interactionCreated',(_0x37f54f,_0x32c44d)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x32c44d);}),this['on']('replyCreated',(_0x126d49,_0x265436)=>{this['_addFeedItemReply'](_0x265436);});}async['afterInit'](){this['context']instanceof _0x461551?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x54cce4,_0x165428)=>{_0x165428['on']('ready',()=>{this['_integrateEditor'](_0x165428);});});const _0x402bfc=this['context']['config']['get']('ai.chat.initialConversation');let _0x2ec680=_0x402bfc;if('lastCreated'!=_0x402bfc||(_0x2ec680=await this['_getLastCreatedConversationId'](),_0x2ec680))return'new'==_0x2ec680?this['_startConversationSafely']():this['loadConversation'](_0x2ec680);}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x3c74bd){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null,(this['context']['plugins']['get'](AITabs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),await this['_stopLastInteraction']());try{await this['_aiConnector']['fetchConversation'](_0x3c74bd)['getConversation'](),await this['_startConversationSafely']({'id':_0x3c74bd}),this['_updateConversationTitle']('\x20'),await this['activeConversation']['load'](_0x3c74bd,this['_aiEditing']['sessionId']),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x2f1206){this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x3c74bd}),this['_logError'](new at('ai-chat-conversation-not-found',this,{'error':_0x2f1206}));}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x337f33){let _0x323960=null,_0x177994=null;this['on']('toolDataReceived',(_0x3fb39a,_0x3075b8,_0x198324)=>{_0x198324['id']!==_0x323960&&(_0x323960=_0x198324['id'],_0x177994=this['_getAIChatFeedAPI'](_0x198324)),_0x337f33(_0x3075b8,_0x177994);});}['addCurrentDocumentToChatContext'](){this['activeConversation']?.['addCurrentDocumentToContext'](Hi(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](){const _0x4bc337=this['_aiEditing']['getSelectionText']();this['activeConversation']?.['addSelectionToContext'](_0x4bc337),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0xef8221){await this['_startConversationSafely']({'modelId':_0xef8221?.['modelId']});}async['sendMessage'](_0x29ed11){await this['_handleUIUserMessage'](_0x29ed11);}['getGroupId'](){const _0x44e398=this['context']['config']['get']('collaboration.channelId');if(!_0x44e398)throw new at('ai-missing-channel-id',this);return _0x44e398;}['_handleRemovedConversation'](_0x417a39){this['activeConversation']['id']===_0x417a39&&this['_startConversationSafely']();}['_insertSuggestion'](_0x14d01f){const _0x5e6b5e=this['context']['plugins']['get']('DocumentCompare'),{reply:_0x4dd4c6,interaction:_0x553d42}=this['getInteractionAndReplyById'](_0x14d01f['replyId']),_0x1305ea=void 0x0!==_0x14d01f['partIndex']?[_0x4dd4c6['changeGroups'][_0x14d01f['partIndex']]]:_0x4dd4c6['changeGroups']['filter'](_0x2466ff=>'pending'==_0x2466ff['state']);for(const _0x48e192 of this['_groupChangesByTarget'](_0x4dd4c6,_0x1305ea)){const {target:_0x7bc816,groups:_0x14e460,groupsIndexes:_0x5df938,slice:_0x38b7f4}=_0x48e192;if(!_0x7bc816['editor']['plugins']['has']('TrackChanges'))throw new at('ai-no-track-changes',null);const _0x50965b=this['_getDocumentRangeForReplyChanges'](_0x14d01f['replyId'],_0x5df938[0x0]);if(!_0x50965b||'$graveyard'==_0x50965b['range']['root']['rootName']){_0x5df938['forEach'](_0x1c03fc=>_0x4dd4c6['setChangeGroupState'](_0x1c03fc,'outdated'));continue;}_0x5df938['forEach'](_0x47d6da=>_0x4dd4c6['setChangeGroupState'](_0x47d6da,'accepted'));const _0x2c4528=_s({'editor':_0x7bc816['editor'],'reply':_0x4dd4c6,'interaction':_0x553d42,'groups':_0x14e460,'transform':!0x0,'documentCompare':_0x5e6b5e,'documentCompareOptions':{'anchor':_0x38b7f4?.['rootName']??'main','markDeletions':!0x0},'documentContextSlice':_0x38b7f4});let _0x24b42d;this['_scrollToSuggestionRange'](_0x50965b['range'],!0x1,_0x7bc816['editor']),_0x7bc816['editor']['model']['change'](_0x4b4ba2=>{_0x24b42d=_0x4b4ba2['batch'],_0x7bc816['editor']['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x2c4528),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x24b42d,{'interactionId':_0x553d42['id'],'replyId':_0x4dd4c6['id'],'indexes':_0x5df938['slice']()});}this['_updateRatings'](_0x4dd4c6);}['_applySuggestion'](_0x47e163){const _0xde542d=this['context']['plugins']['get'](_0x4278a5),{reply:_0x7f778f,interaction:_0x507ed1}=this['getInteractionAndReplyById'](_0x47e163['replyId']),_0x486e3b=void 0x0!==_0x47e163['partIndex']?[_0x7f778f['changeGroups'][_0x47e163['partIndex']]]:_0x7f778f['changeGroups']['filter'](_0x1befad=>'pending'==_0x1befad['state']);for(const _0xf1a4c2 of this['_groupChangesByTarget'](_0x7f778f,_0x486e3b)){const {target:_0x183be7,groups:_0x5525e0,groupsIndexes:_0x204aba,slice:_0x5a015d}=_0xf1a4c2,_0xc19517=this['_getDocumentRangeForReplyChanges'](_0x47e163['replyId'],_0x204aba[0x0]);if(!_0xc19517||'$graveyard'==_0xc19517['range']['root']['rootName']){_0x204aba['forEach'](_0x10f37a=>_0x7f778f['setChangeGroupState'](_0x10f37a,'outdated'));continue;}_0x204aba['forEach'](_0x5e4a95=>_0x7f778f['setChangeGroupState'](_0x5e4a95,'accepted'));const _0x3234aa=_s({'editor':_0x183be7['editor'],'reply':_0x7f778f,'interaction':_0x507ed1,'groups':_0x5525e0,'transform':!0x0,'documentCompare':_0xde542d,'documentCompareOptions':{'anchor':_0x5a015d?.['rootName']??'main','markDeletions':!0x1},'documentContextSlice':_0x5a015d});let _0x130455;this['_scrollToSuggestionRange'](_0xc19517['range'],!0x1,_0x183be7['editor']),_0x183be7['editor']['model']['change'](_0x37279a=>{_0x130455=_0x37279a['batch'];for(const _0x5e1038 of _0x3234aa)_0x5e1038['baseVersion']=_0x183be7['editor']['model']['document']['version'],Is(_0x183be7['editor'],_0x5e1038),_0x37279a['batch']['addOperation'](_0x5e1038),_0x183be7['editor']['model']['applyOperation'](_0x5e1038);}),this['_batchToChanges']['set'](_0x130455,{'interactionId':_0x507ed1['id'],'replyId':_0x7f778f['id'],'indexes':_0x204aba['slice']()});}this['_updateRatings'](_0x7f778f);}['_rejectSuggestion'](_0xd98bc5){const {reply:_0x24684c}=this['getInteractionAndReplyById'](_0xd98bc5['replyId']);_0x24684c['setChangeGroupState'](_0xd98bc5['partIndex'],'rejected');}['_openBalloonFor'](_0x4f9a72,_0x1ef39f){if(!this['_aiChatBalloon'])return;const {reply:_0xd8eebe}=this['getInteractionAndReplyById'](_0x4f9a72),_0x679aa9=_0xd8eebe['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'editor':ds(this['context'])});let _0x5a517b,_0x68a2e1;if(void 0x0!==_0x1ef39f?(_0x68a2e1=_0x679aa9['find'](_0x477f6a=>_0x477f6a['index']==_0x1ef39f),_0x5a517b=_0x68a2e1?.['index']):(_0x68a2e1=_0x679aa9[0x0],_0x5a517b=_0x68a2e1['index']),this['_currentPreviewedChangeGroup']?.['replyId']==_0x4f9a72&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x5a517b)return;const _0x2f2fe6=this['_getUserPresentableContentPartDocumentRange'](_0x4f9a72,_0xd8eebe,_0x68a2e1),_0x1d2e86=_0xd8eebe['changeGroups']['find'](_0x3e8502=>_0x3e8502['index']==_0x5a517b),_0x2fc8a8=_0x1d2e86?this['_resolveGroupTarget'](_0xd8eebe,_0x1d2e86):null,_0x3d1a9f=_0x2fc8a8?.['editor']??ds(this['context']),_0x2cb4bf=_0x3d1a9f['plugins']['has']('AIChatBalloon')?_0x3d1a9f['plugins']['get']('AIChatBalloon'):this['_aiChatBalloon'];if(this['_activeBalloon']&&this['_activeBalloon']!==_0x2cb4bf&&this['_activeBalloon']['close'](),!_0x2f2fe6)return _0x2cb4bf['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x2cb4bf,this['_currentPreviewedChangeGroup']={'replyId':_0x4f9a72,'partIndex':_0x5a517b},this['_scrollToSuggestionRange'](_0x2f2fe6,!0x0,_0x3d1a9f);const _0xcb4615=this['_getPresentableSiblingContentPartIndex'](_0x4f9a72,_0x5a517b,'next');_0x2cb4bf['updateContent']({'part':_0x68a2e1,'renderingStrategy':'static'}),_0x2cb4bf['open']({'index':_0x5a517b,'title':Hi(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x5a517b+0x1)['toString']()),'showRotator':null!==_0xcb4615,'ranges':[_0x2f2fe6],'areActionsDisabled':_0xd8eebe['areActionsDisabled'],'targetEditor':_0x3d1a9f}),_0x2cb4bf['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x4f9a72,_0x5a517b),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x4f9a72,'index':_0x5a517b,'isActive':!0x0});}['_getPresentableSiblingContentPartIndex'](_0x46f5bb,_0x3ce660,_0x449a5e){const {reply:_0x27b3f2}=this['getInteractionAndReplyById'](_0x46f5bb),_0x435f50=_0x27b3f2['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'editor':ds(this['context'])});if(0x1==_0x435f50['length'])return null;const _0x590444=_0x435f50['findIndex'](_0xbf87b9=>_0xbf87b9['index']==_0x3ce660),_0x477966='next'==_0x449a5e?0x1:-0x1;let _0x770b62=_0x435f50['at']((_0x590444+_0x477966)%_0x435f50['length'])['index'],_0x3a3862=_0x435f50[_0x770b62];for(;!this['_getUserPresentableContentPartDocumentRange'](_0x46f5bb,_0x27b3f2,_0x3a3862);){if(_0x770b62=_0x435f50['at']((_0x770b62+_0x477966)%_0x435f50['length'])['index'],_0x770b62===_0x590444)return null;_0x3a3862=_0x435f50[_0x770b62];}return _0x770b62;}['_getUserPresentableContentPartDocumentRange'](_0xa64db3,_0x3f0bed,_0x2c3a02){const _0x4e2340=_0x3f0bed['changeGroups'];if(!_0x2c3a02['hasChanges'])return null;const _0x4f43b2=_0x4e2340['find'](_0x125759=>_0x125759['index']==_0x2c3a02['index']);if('pending'!==_0x4f43b2?.['state'])return null;const _0x354a5e=this['_getDocumentRangeForReplyChanges'](_0xa64db3,_0x2c3a02['index']);if(!_0x354a5e)return _0x3f0bed['setChangeGroupState'](_0x2c3a02['index'],'outdated'),null;const {range:_0x273f58,currentIndex:_0x2d213a}=_0x354a5e;return'$graveyard'==_0x273f58['root']['rootName']?(_0x3f0bed['setChangeGroupState'](_0x2d213a,'outdated'),null):_0x354a5e['range'];}['_getDocumentRangeForReplyChanges'](_0x1b6e5e,_0x38ad2b){const {reply:_0x2ae8cd}=this['getInteractionAndReplyById'](_0x1b6e5e),_0x966e27=_0x2ae8cd['changeGroups']['filter'](_0x2bed6b=>'pending'==_0x2bed6b['state']),_0x2d3fc6=_0x966e27['map'](_0x5a316b=>_0x2ae8cd['changeGroups']['indexOf'](_0x5a316b));void 0x0===_0x38ad2b&&(_0x38ad2b=_0x2d3fc6[0x0]);const _0x3f4289=_0x2d3fc6['indexOf'](_0x38ad2b);if(-0x1==_0x3f4289)return null;const _0x4ce06a=_0x966e27[_0x3f4289],_0x2b6c2a=this['_resolveGroupTarget'](_0x2ae8cd,_0x4ce06a);if(!_0x2b6c2a)return null;const {editor:_0x242574,root:_0xbf6a51,parsedDocumentContent:_0x3319af,serializedDocumentContent:_0x12c8ad,version:_0x489b4e}=_0x2b6c2a,_0x518a8b=new _0x38e78e([]),_0x3263d3=new _0x38e78e([]);for(const _0x42b5e3 of _0x4ce06a['changes']){const _0x9e8c42=this['activeConversation']?.['getSourceByDataId'](_0x42b5e3['id']);if((!_0x9e8c42||_0x9e8c42['editor']===_0x2b6c2a['editor']&&_0x9e8c42['rootName']===_0x2b6c2a['root']['rootName'])&&('removed'!=_0x42b5e3['type']&&_0x3263d3['children']['push'](_0x42b5e3['node']['cloneNode'](!0x0)),'new'!=_0x42b5e3['type'])){const _0xba9fab=_0x504013(_0x8df75d=>$i(_0x8df75d,'data-id')==_0x42b5e3['id'],_0x3319af,!0x0);if(!_0xba9fab)return null;_0x518a8b['children']['push'](_0xba9fab['cloneNode'](!0x0));}}if(0x0==_0x518a8b['children']['length']){if(_0x4ce06a['changes'][0x0]['anchorId']){const _0x3dc4c6=Wi('data-id',_0x4ce06a['changes'][0x0]['anchorId'],_0x3319af);_0x518a8b['children']['unshift'](_0x3dc4c6['cloneNode'](!0x0)),_0x3263d3['children']['unshift'](_0x3dc4c6['cloneNode'](!0x0)),_0x3dc4c6['nextSibling']&&(_0x518a8b['children']['push'](_0x3dc4c6['nextSibling']['cloneNode'](!0x0)),_0x3263d3['children']['push'](_0x3dc4c6['nextSibling']['cloneNode'](!0x0)));}else{const _0x569664=_0x3319af['children'][0x0];if(!_0x569664)return null;_0x518a8b['children']['push'](_0x569664['cloneNode'](!0x0)),_0x3263d3['children']['push'](_0x569664['cloneNode'](!0x0));}}const _0xcd4499=_0x242574['data']['parse'](_0x12c8ad),_0x204e9c=Ki(_0x518a8b),_0x558465=_0x242574['data']['parse'](_0x204e9c),_0x467e07=_0x242574['data']['parse'](_0x204e9c),_0x1d231b=_0x242574['model']['createPositionAt'](_0x558465,0x0),_0x4c3c90=Ki(_0x3263d3),_0x17ffe1={'targetEditor':_0x242574,'anchor':_0x1d231b,'markDeletions':!0x1},_0x8440dc=_0x242574['plugins']['get'](_0x4278a5)['getDiff'](_0x204e9c,_0x4c3c90,_0x17ffe1)['getOperations']();if(!_0x8440dc['length'])return null;_0x242574['model']['change'](_0xdba3b=>{for(const _0x2bc2b7 of _0x8440dc)if('remove'==_0x2bc2b7['type']){const _0x554433=_0x2bc2b7['sourcePosition'],_0x1b9653=_0x2bc2b7['howMany'],_0x5b6b90=new _0x56cb8c(_0x554433,_0x1b9653);_0xdba3b['batch']['addOperation'](_0x5b6b90),_0x242574['model']['applyOperation'](_0x5b6b90);}else'marker'!==_0x2bc2b7['type']&&(_0x2bc2b7['baseVersion']=null,_0x2bc2b7['isDocumentOperation']=!0x1,_0xdba3b['batch']['addOperation'](_0x2bc2b7),_0x242574['model']['applyOperation'](_0x2bc2b7));});const _0x5d60ea=es(_0x242574,_0x8440dc,_0x558465);is(_0x242574['model'],_0x5d60ea);const _0x1f238c=_0x5d60ea['getFirstRange']()['start']['path']['slice'](),_0x2a1fec=_0x5d60ea['getFirstRange']()['end']['path']['slice'](),_0x113de0=[];let _0x2864cf=_0x558465,_0x17dd92=_0x467e07;for(let _0x5aa966=0x0;_0x5aa966<_0x2a1fec['length'];_0x5aa966++){const _0x1e0724=_0x2864cf['maxOffset']-_0x2a1fec[_0x5aa966];_0x113de0[_0x5aa966]=_0x17dd92['maxOffset']-_0x1e0724,_0x2864cf=_0x2864cf['getChildAtOffset'](_0x2a1fec[_0x5aa966]),_0x17dd92=_0x17dd92['getChildAtOffset'](_0x113de0[_0x5aa966]);}const _0x540656=_0x242574['model']['createRange'](_0x242574['model']['createPositionFromPath'](_0x467e07,_0x1f238c),_0x242574['model']['createPositionFromPath'](_0x467e07,_0x113de0)),_0x21f740=_0x467e07['getChild'](0x0)['getAttribute'](_0x4bed1f),_0x61a4c3=Array['from'](_0xcd4499['getChildren']())['find'](_0x267276=>_0x267276['getAttribute'](_0x4bed1f)==_0x21f740)['getPath'](),_0x1ccd36=_0x540656['start']['path']['slice'](),_0x349a23=_0x540656['end']['path']['slice']();_0x1ccd36[0x0]=_0x61a4c3[0x0]+_0x1ccd36[0x0],_0x349a23[0x0]=_0x61a4c3[0x0]+_0x349a23[0x0];let _0x4d2d5d=_0x242574['model']['createRange'](_0x242574['model']['createPositionFromPath'](_0xbf6a51,_0x1ccd36),_0x242574['model']['createPositionFromPath'](_0xbf6a51,_0x349a23));const _0x322858=_0x242574['model']['document']['history']['getOperations'](_0x489b4e);for(const _0x3c00d2 of _0x322858)_0x4d2d5d=_0x1c9ece['_createFromRanges'](_0x4d2d5d['getTransformedByOperation'](_0x3c00d2));return{'range':_0x4d2d5d,'currentIndex':_0x38ad2b};}['_integrateEditorBalloon'](_0x35973d){if(!_0x35973d['plugins']['has']('AIChatBalloon'))return;const _0x1756da=_0x35973d['plugins']['get']('AIChatBalloon');this['_wiredBalloons']['has'](_0x1756da)||(this['_wiredBalloons']['add'](_0x1756da),this['_aiChatBalloon']||(this['_aiChatBalloon']=_0x1756da),_0x1756da['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x1756da,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x12de00,partIndex:_0x5479e4}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x962639}=this['getInteractionAndReplyById'](_0x12de00),_0x614e91=_0x962639['changeGroups']['find'](_0x508f19=>_0x508f19['index']===_0x5479e4),_0x320a94=_0x614e91?this['_resolveGroupTarget'](_0x962639,_0x614e91):null,_0x5e58b0=_0x962639['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x5479e4,'editor':_0x320a94?.['editor']??ds(this['context'])});(this['_activeBalloon']??_0x1756da)['updateContent']({'part':_0x5e58b0[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x1756da,'applySuggestion',()=>{const {replyId:_0x33593f,partIndex:_0x3a7ae2}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x33593f,'partIndex':_0x3a7ae2}),(this['_activeBalloon']??_0x1756da)['setState']('accepted');}),this['listenTo'](_0x1756da,'insertSuggestion',()=>{const {replyId:_0x1213d3,partIndex:_0x2df244}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x1213d3,'partIndex':_0x2df244}),(this['_activeBalloon']??_0x1756da)['setState']('accepted');}),this['listenTo'](_0x1756da,'rejectSuggestion',()=>{const {replyId:_0x129089,partIndex:_0x1250ed}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x129089,'partIndex':_0x1250ed}),(this['_activeBalloon']??_0x1756da)['setState']('rejected');}),this['listenTo'](_0x1756da,'showNext',()=>{const {replyId:_0xdb581a,partIndex:_0xfd3f19}=this['_currentPreviewedChangeGroup'],_0x1bf425=this['_getPresentableSiblingContentPartIndex'](_0xdb581a,_0xfd3f19,'next');null!==_0x1bf425&&this['_openBalloonFor'](_0xdb581a,_0x1bf425);}),this['listenTo'](_0x1756da,'showPrevious',()=>{const {replyId:_0x53fedc,partIndex:_0x8630f1}=this['_currentPreviewedChangeGroup'],_0x272c04=this['_getPresentableSiblingContentPartIndex'](_0x53fedc,_0x8630f1,'previous');null!==_0x272c04&&this['_openBalloonFor'](_0x53fedc,_0x272c04);}),this['listenTo'](_0x1756da,'dialogClosed',(_0x32bb48,{id:_0x5ea648})=>{if('aiChatBalloon'!==_0x5ea648)return;const {replyId:_0x548eb6,partIndex:_0x575f28}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x548eb6,'index':_0x575f28,'isActive':!0x1}),this['_activeBalloon']===_0x1756da&&(this['_activeBalloon']=void 0x0);}));}['_integrateEditor'](_0x8d7ab){if(this['_integrateEditorBalloon'](_0x8d7ab),_0x8d7ab['plugins']['has']('Undo')){const _0x331b04=_0x8d7ab['commands']['get']('undo'),_0x4763fe=_0x8d7ab['commands']['get']('redo');this['listenTo'](_0x331b04,'revert',(_0x48d1f8,_0x51aeb6,_0x40ab03)=>{const _0x5c08bb=this['_batchToChanges']['get'](_0x51aeb6);if(!_0x5c08bb)return;const _0x21ed02=this['activeConversation']['getInteraction'](_0x5c08bb['interactionId']),_0x596d8f=_0x21ed02?.['getReply'](_0x5c08bb['replyId']);this['_batchToChanges']['delete'](_0x51aeb6),_0x21ed02&&_0x596d8f&&(_0x5c08bb['indexes']['forEach'](_0x20f753=>_0x596d8f['setChangeGroupState'](_0x20f753,'pending')),this['_batchToChanges']['set'](_0x40ab03,_0x5c08bb));}),this['listenTo'](_0x4763fe,'revert',(_0x516dfa,_0x27296d,_0x3ca5ee)=>{const _0x3175c1=this['_batchToChanges']['get'](_0x27296d);if(!_0x3175c1)return;const _0x2c50ff=this['activeConversation']['getInteraction'](_0x3175c1['interactionId']),_0x45685c=_0x2c50ff?.['getReply'](_0x3175c1['replyId']);this['_batchToChanges']['delete'](_0x27296d),_0x2c50ff&&_0x45685c&&(_0x3175c1['indexes']['forEach'](_0x42f1e1=>_0x45685c['setChangeGroupState'](_0x42f1e1,'accepted')),this['_batchToChanges']['set'](_0x3ca5ee,_0x3175c1));});}const _0x2140b4=_0x8d7ab['config']['get']('ai.chat.context');_0x2140b4['alwaysAddSelection']&&_0x2140b4['document']['enabled']&&this['listenTo'](_0x8d7ab['model']['document']['selection'],'change:range',(_0x1e3056,_0xa9980f)=>{if(!_0xa9980f['directChange'])return;'chat'===_0x8d7ab['plugins']['get']('AITabs')['view']['activeTab']&&(_0x8d7ab['model']['hasContent'](_0x8d7ab['model']['document']['selection'])?this['addSelectionToChatContext']():this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x5c11fa=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x437ecd=await _0x5c11fa['getConversations']();return _0x437ecd['length']?_0x437ecd[0x0]['id']:'new';}catch(_0x56f586){return this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':ot()}),this['_logError'](new at('ai-chat-conversation-init-failed',this,{'error':_0x56f586})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x20270d={}){try{this['_aiChatUi']['enableControls'](),await this['_handleStartConversation'](_0x20270d);}catch(_0xa2cf2){this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x20270d['id']||ot()}),console['error'](_0xa2cf2),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x63ecea,modelId:_0x2533cb}={}){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;let _0x37e9f4=_0x2533cb;_0x37e9f4||(_0x63ecea||!this['activeConversation']?_0x37e9f4=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x37e9f4=this['activeConversation']['selectedModel']['id'])),await this['_stopLastInteraction']();const _0x743955=this['getGroupId'](),_0x51e25e=_0x63ecea||ot();let _0xcf31f0;this['activeConversation']=new AIChatConversation({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x37e9f4,'conversationId':_0x51e25e,'group':_0x743955,'getEditor':()=>ds(this['context']),'getEditors':()=>ls(this['context']),'locale':this['context']['locale'],'isFromHistory':!!_0x63ecea}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['activeConversation']['on']('conversationInitialized',(_0x3af09a,_0x124838)=>{this['_aiChatUi']['createConversation'](_0x124838),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x63ecea||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['activeConversation']['on']('uploadProgressChanged',(_0x2389e0,_0x393809)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x393809['isUploadInProgress']);}),this['activeConversation']['on']('webSearchStarted',()=>{const _0x1b020f=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x1b020f);}),this['activeConversation']['on']('reasoningStarted',()=>{const _0x4a60ae=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x4a60ae);}),this['activeConversation']['on']('webSearchFinished',(_0x3f9f18,_0x58f92f)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x58f92f,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['activeConversation']['on']('reasoningFinished',(_0x1286b8,_0x17bf89)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x17bf89,{'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});}),this['activeConversation']['on']('interactionStarted',()=>{this['_aiChatUi']['startInteraction']();}),this['activeConversation']['on']('interactionFinished',async()=>{this['_updateReplyContentThrottled']['flush'](),await this['_aiChatUi']['finishInteraction']();}),this['activeConversation']['on']('interactionDestroyed',(_0x21e2fd,_0x3acc55)=>{this['_aiChatUi']['removeFeedInteraction'](_0x3acc55['id']);}),this['activeConversation']['on']('setConversationTitle',(_0x41f284,_0x16dca5,_0x4abbf9)=>{this['_updateConversationTitle'](_0x16dca5,_0x4abbf9);}),this['activeConversation']['on']('replyContentUpdated',async(_0x44264d,_0x3aaf13)=>{void 0x0!==_0xcf31f0&&_0xcf31f0!==_0x3aaf13['id']&&this['_updateReplyContentThrottled']['flush'](),_0xcf31f0=_0x3aaf13['id'],_0x3aaf13['isFromHistory']?await this['_updateReplyContent']({'reply':_0x3aaf13}):await this['_updateReplyContentThrottled']({'reply':_0x3aaf13});}),this['activeConversation']['on']('replyChangeGroupStateUpdated',(_0x56bdb4,{reply:_0x158f42,index:_0x35d6c1,state:_0x21a411})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x158f42['id'],'index':_0x35d6c1,'state':_0x21a411}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x158f42['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x35d6c1&&(this['_activeBalloon']??this['_aiChatBalloon'])?.['setState'](_0x21a411);}),this['activeConversation']['on']('contextItemAdded',(_0x4df2c5,_0x29bdd8)=>{if(this['_aiChatUi']['addContextItem'](_0x29bdd8['contextItem'],_0x29bdd8['isLoading']),'selection'===_0x29bdd8['contextItem']['type']){const _0x3d1d64=[...ds(this['context'])['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'ranges':_0x3d1d64,'id':'context','priority':0x1});}}),this['activeConversation']['on']('contextItemRemoved',(_0x312d46,_0x474486)=>{this['_aiChatUi']['removeContextItem'](_0x474486['uiId']),'current-document'==_0x474486['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x474486['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['activeConversation']['on']('contextItemLoadingEnded',(_0x2f8f3a,_0x39c241)=>{this['_aiChatUi']['setContextItemLoading'](_0x39c241['contextItem']['uiId'],_0x39c241['isLoading']);}),this['activeConversation']['on']('contextSent',(_0xa07ef2,_0x2c0a8d)=>{this['_aiChatUi']['setConversationContext'](_0x2c0a8d['contextItems']);}),this['activeConversation']['on']('addContextOptionsChanged',(_0x1a7a51,_0x2e1d70)=>{this['_aiChatUi']['setAddContextOptions'](_0x2e1d70['options']);}),this['activeConversation']['on']('sourceResourcesLoaded',(_0x3622a3,_0x4b4b2c)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x4b4b2c['sourceId'],_0x4b4b2c['source'],_0x4b4b2c['resources'],_0x4b4b2c['uid']);}),this['activeConversation']['on']('resourceStateChanged',(_0x2ff4c2,_0x5da2dc)=>{this['_aiChatUi']['updateResourceState'](_0x5da2dc['sourceId'],_0x5da2dc['resourceId'],_0x5da2dc['isInContext']);}),this['activeConversation']['on']('capabilitiesUpdated',(_0x45ac37,_0x33250a)=>{this['_aiChatUi']['updateCapabilities'](_0x33250a);}),this['activeConversation']['on']('modelSelected',async(_0x56fcc6,_0x49e722)=>{const _0x1ff5a4=(await this['_aiChatModels']['getAll']())['find'](_0x46a19d=>_0x46a19d['id']===_0x49e722['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x1ff5a4,_0x49e722['isDisabled']);}),this['activeConversation']['on']('error',(_0x1b3018,{error:_0x237fb2,interactionId:_0x6011ba,fileName:_0xdfc9fc,url:_0x5a3dc7,sourceId:_0x1382a5,sourceLabel:_0x3cb08a})=>{const _0x5ae192=_0x6011ba?_0x6011ba+':'+ot():ot();_0x237fb2['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Hi(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x5ae192}):_0x237fb2['message']['startsWith']('ai-chat-conversation-init-failed')||_0x237fb2['message']['startsWith']('ai-chat-conversation-start-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x5ae192}),this['_logError'](_0x237fb2)):_0x237fb2['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0xdfc9fc),'id':_0x5ae192}):_0x237fb2['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x5a3dc7),'id':_0x5ae192}):_0x237fb2['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x5ae192}):_0x237fb2['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x5ae192}):_0x237fb2['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x1382a5&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x1382a5),this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x3cb08a||'source'),'id':_0x5ae192}),this['_logError'](_0x237fb2)):_0x237fb2['message']['startsWith']('ai-chat-resource-load-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x5ae192}),this['_logError'](_0x237fb2)):_0x237fb2['message']['startsWith']('ai-chat-invalid-request')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x5ae192}),this['_logError'](_0x237fb2)):_0x237fb2['message']['startsWith']('ai-chat-context-unsupported-file-type')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x5ae192}),this['_logError'](_0x237fb2)):_0x237fb2['message']['startsWith']('ai-chat-context-file-too-large')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x5ae192}),this['_logError'](_0x237fb2)):_0x237fb2['message']['startsWith']('ai-chat-context-file-too-many-pages')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x5ae192}),this['_logError'](_0x237fb2)):_0x237fb2['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x5ae192}),this['_logError'](_0x237fb2)):(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x5ae192}),this['_logError'](_0x237fb2));}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x63ecea||await this['activeConversation']['start']();}async['_handleUIUserMessage']({message:_0x1d1e59,attributes:_0x56ccea}){if(!this['activeConversation'])throw new at('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x52e64a=await this['_aiEditing']['getDocumentData']();_0x52e64a['length']>0x1?await this['activeConversation']['updateCurrentDocumentsInContext'](_0x52e64a):await this['activeConversation']['updateCurrentDocumentInContext'](_0x52e64a[0x0]);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x1d1e59,'attributes':_0x56ccea});}['_logError'](_0xecaf77){Ct(_0xecaf77['message']);}['_removeFromContext'](_0x27664b){this['activeConversation']?.['removeFromContext'](_0x27664b);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0xfe67d){const [_0x4177d0,_0xd9101d]=_0xfe67d['split'](':'),_0x3cecde=this['activeConversation']['getInteraction'](_0x4177d0),_0xac14bf=_0x3cecde['getReply'](_0xd9101d);return{'interaction':_0x3cecde,'reply':_0xac14bf};}['_resolveGroupTarget'](_0x297533,_0x4c4d77){const _0x7cc96f=[..._0x4c4d77['changes']['filter'](_0x48165d=>'context'!==_0x48165d['type']),..._0x4c4d77['changes']['filter'](_0x5d4366=>'context'===_0x5d4366['type'])];for(const _0x55b45a of _0x7cc96f){const _0x5bfff4=_0x297533['newNodeAnchorIds']['get'](_0x55b45a['id']),_0x31425a=this['activeConversation']?.['getSourceByDataId'](_0x55b45a['id'])||this['activeConversation']?.['getSourceByDataId'](_0x5bfff4)||this['activeConversation']?.['getSourceByDataId'](_0x55b45a['anchorId']??void 0x0);if(_0x31425a){if('destroyed'===_0x31425a['editor']['state'])return null;const _0x20d1da=_0x31425a['editor']['model']['document']['getRoot'](_0x31425a['rootName']);return _0x20d1da?{'editor':_0x31425a['editor'],'root':_0x20d1da,'parsedDocumentContent':Fi(_0x31425a['content']),'serializedDocumentContent':_0x31425a['content'],'version':_0x31425a['version']}:null;}}const _0x7dcaa1=ds(this['context']),_0xf21cbf=this['activeConversation']['getInteraction'](_0x297533['interactionId']),_0x1778cc=_0xf21cbf?.['getDocumentContext']();return{'editor':_0x7dcaa1,'root':_0x7dcaa1['model']['document']['getRoot'](),'parsedDocumentContent':_0x297533['documentContextContent'],'serializedDocumentContent':_0x1778cc?.['content'],'version':_0x1778cc?.['version']};}['_groupChangesByTarget'](_0x36cf7e,_0x57d234){const _0x20ef39=new Map();for(const _0x4c865b of _0x57d234){const _0x2622eb=this['_resolveGroupTarget'](_0x36cf7e,_0x4c865b);if(!_0x2622eb)continue;const _0xedc7d5=(_0x2622eb['editor']['id']||'e')+'|'+_0x2622eb['root']['rootName'];let _0x3ce5d2=_0x20ef39['get'](_0xedc7d5);if(!_0x3ce5d2){let _0xe31b5c;for(const _0x335f82 of[..._0x4c865b['changes']['filter'](_0x5267fc=>'context'!==_0x5267fc['type']),..._0x4c865b['changes']['filter'](_0x4b7fbf=>'context'===_0x4b7fbf['type'])])if(_0xe31b5c=this['activeConversation']?.['getDocumentContextSliceByDataId'](_0x335f82['id'])||this['activeConversation']?.['getDocumentContextSliceByDataId'](_0x36cf7e['newNodeAnchorIds']['get'](_0x335f82['id'])),_0xe31b5c)break;_0x3ce5d2={'target':{'editor':_0x2622eb['editor'],'root':_0x2622eb['root']},'slice':_0xe31b5c,'groups':[],'groupsIndexes':[]},_0x20ef39['set'](_0xedc7d5,_0x3ce5d2);}_0x3ce5d2['groups']['push'](_0x4c865b),_0x3ce5d2['groupsIndexes']['push'](_0x36cf7e['changeGroups']['indexOf'](_0x4c865b));}return Array['from'](_0x20ef39['values']());}['_scrollToSuggestionRange'](_0x545a8f,_0x3e0b45=!0x1,_0x21d6c4){const _0x5ee94c={'target':_0x21d6c4['editing']['view']['domConverter']['viewRangeToDom'](_0x21d6c4['editing']['mapper']['toViewRange'](_0x545a8f)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x3e0b45};_0x3e0b45&&(_0x5ee94c['alignToTop']=!0x0),wt(_0x5ee94c);}['_updateConversationTitle'](_0x410cb9,_0x313b0b=!0x1){this['_aiChatUi']['setConversationTitle'](_0x410cb9||Hi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x313b0b);}['_addFeedItemReply'](_0x3746be){'text'===_0x3746be['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x3746be):this['_aiChatUi']['addFeedItemAISuggestion'](_0x3746be);}async['_updateReplyContent']({reply:_0x3e3520,renderingStrategy:_0x8d2aa5}){const {id:_0x49a718,interactionId:_0x5752b4,isDone:_0x14848,type:_0x4bd835,parsedContent:_0x1ed1da}=_0x3e3520,_0xcc5c11=_0x5752b4+':'+_0x49a718;if('modification'===_0x4bd835){const _0x53d127=_0x3e3520['getContentParts']({'showDiff':this['_aiChatUi']['showDiff'],'editor':ds(this['context'])});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0xcc5c11,'parts':_0x53d127,'isDone':_0x14848,'skipLoadingEffects':_0x3e3520['isFromHistory']});}else'text'===_0x4bd835&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0xcc5c11,'parsedContent':_0x1ed1da,'renderingStrategy':_0x8d2aa5,'isDone':_0x14848});_0x14848&&_0x3e3520['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0xcc5c11,_0x3e3520['sources']);}['_updateReplyContentThrottled']=_0x327953(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x7ef886=this['activeConversation']?.['lastInteraction'];_0x7ef886&&(_0x7ef886['stop'](),this['_aiChatUi']['stopInteraction'](_0x7ef886)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x46290c=this['activeConversation']?.['lastInteraction'];if(_0x46290c){for await(const _0x5e679b of _0x46290c['replies'])this['_aiChatUi']['hasFeedItem'](_0x5e679b['id'])||this['_addFeedItemReply'](_0x5e679b),await this['_updateReplyContent']({'reply':_0x5e679b,'renderingStrategy':'static'});}}['_updateRatings'](_0x588f2c){const _0x3aa961={'positiveCount':_0x588f2c['changeGroups']['filter'](_0x1e53a2=>'accepted'===_0x1e53a2['state'])['length'],'totalCount':_0x588f2c['changeGroups']['length'],'modificationId':_0x588f2c['id']},_0x539c38=this['activeConversation']['getInteraction'](_0x588f2c['interactionId'])['messageId'];_0x539c38&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x539c38,_0x3aa961);}['_getAIChatFeedAPI'](_0x371e00){const _0x4f7e7f=this['_aiChatUi'],_0x53328e=()=>{_0x371e00['resetWebSearchState'](),_0x371e00['resetReasoningState'](),_0x4f7e7f['clearLoadingMessage']();},_0x179493=()=>{_0x371e00['currentReply']&&(_0x371e00['currentReply']['done'](),_0x371e00['currentReply']=void 0x0);};return{'insertTextReply':(_0x571db7,_0x50f6fa)=>{_0x179493(),_0x53328e();const _0x3c07b3=_0x371e00['currentReply']=_0x371e00['createReply']({'type':'text','interactionId':_0x371e00['id'],'content':_0x571db7,'id':_0x50f6fa||ot()});return _0x179493(),_0x3c07b3;},'insertCustomElement':async(_0x377457,_0x57db37)=>(_0x179493(),_0x53328e(),_0x4f7e7f['addFeedItemCustomElement'](_0x377457,_0x57db37||ot())),'setLoadingMessage':_0x1b862b=>{_0x4f7e7f['setLoadingMessage'](_0x1b862b);},'clearLoadingMessage':()=>{_0x4f7e7f['clearLoadingMessage']();}};}}const As='ai-selection',gs=['br'];class AIEditing extends _0x4127f4{constructor(_0x5518fe){super(_0x5518fe),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}['_outputDataProcessor'];['_fakeSelections']=[];['_sessionId'];['_lastContentFocusedEditor'];static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['getLastContentFocusedEditor'](){return this['_lastContentFocusedEditor'];}get['sessionId'](){if(!this['_sessionId']){const _0x4369ef=ls(this['context']),_0x4bd632=_0x4369ef['find'](_0x42381e=>_0x42381e['plugins']['has']('RealTimeCollaborationClient'))||_0x4369ef[0x0],_0xc1b113=_0x4bd632['plugins']['has']('RealTimeCollaborationClient')&&_0x4bd632['plugins']['get']('RealTimeCollaborationClient')['sessionId'];this['_sessionId']=_0xc1b113||ot();}return this['_sessionId'];}async['getDocumentData'](){const _0x3a3cc9=ls(this['context']);if(!_0x3a3cc9['length'])throw new at('ai-get-editor-from-context-no-editor');const _0x16e43f=[],_0x42c3ec=new Set();for(const _0x4a74db of _0x3a3cc9){const _0xb4fe11=_0x4a74db['config']['get']('roots')||{};for(const _0x231aa0 of _0x4a74db['model']['document']['getRoots']()){if('$graveyard'===_0x231aa0['rootName'])continue;const _0x3c2fdf=await this['_getDocumentDataForEditorRoot'](_0x4a74db,_0x231aa0,_0x42c3ec),_0x55ca1b=_0xb4fe11[_0x231aa0['rootName']];let _0x2d1f49;_0x55ca1b?.['label']?_0x2d1f49=_0x55ca1b['label']:(gt('ai-document-root-missing-label',{'editor':_0x4a74db,'rootConfig':_0x55ca1b}),_0x2d1f49=_0x231aa0['rootName']),_0x16e43f['push']({'editor':_0x4a74db,'rootName':_0x231aa0['rootName'],'content':_0x3c2fdf['content'],'version':_0x3c2fdf['version'],'sessionId':this['sessionId'],'channelId':_0x4a74db['config']['get']('collaboration.channelId'),'selections':_0x3c2fdf['selections'],'name':_0x2d1f49,'description':_0x55ca1b?.['description']});}}return _0x16e43f;}async['_getDocumentDataForEditorRoot'](_0x596401,_0xaca86d,_0x131df7){const _0x5c2fd9=_0x596401['data']['toView'](_0xaca86d,{'convertAiChatSelectionMarker':!0x0}),_0x3f6c29=new _0x203eb2(_0x596401['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x5c2fd9,_0x3f6c29,_0x131df7);let _0x451c93=await this['_getDocumentDataStringFromView'](_0x5c2fd9,_0x596401);const _0x448b27=this['_getMarkersInDocumentOrder'](_0x596401,_0xaca86d),_0x3577c6=[];for(const _0x4d8729 of _0x448b27){const _0x5eefa1='<'+_0x4d8729['name']+':start></'+_0x4d8729['name']+':start>',_0x4f4468=_0x451c93['indexOf'](_0x5eefa1);_0x451c93=_0x451c93['substring'](0x0,_0x4f4468)+_0x451c93['substring'](_0x4f4468+_0x5eefa1['length']);const _0x3d5212='<'+_0x4d8729['name']+':end></'+_0x4d8729['name']+':end>',_0x1165f6=_0x451c93['indexOf'](_0x3d5212);_0x451c93=_0x451c93['substring'](0x0,_0x1165f6)+_0x451c93['substring'](_0x1165f6+_0x3d5212['length']),_0x3577c6['push']({'markerName':_0x4d8729['name'],'start':_0x4f4468,'end':_0x1165f6,'htmlFragment':_0x451c93['substring'](_0x4f4468,_0x1165f6)});}return{'content':_0x451c93,'version':_0x596401['model']['document']['version'],'selections':_0x3577c6};}async['afterInit'](){this['context']instanceof _0x461551?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x5579,_0x5cb3fb)=>{_0x5cb3fb['on']('ready',()=>{this['_integrateEditor'](_0x5cb3fb);});});}['_setOutputDataProcessor'](_0xc9db5e){this['_outputDataProcessor']=_0xc9db5e;}async['_getDocumentDataStringFromView'](_0x24409a,_0x232e2a){let _0x497cf4;if(this['_outputDataProcessor']){const _0x413b4e=_0x232e2a['data']['processor']['domConverter']['viewToDom'](_0x24409a),_0x44b7bd=await this['_outputDataProcessor'](_0x413b4e);_0x497cf4=_0x232e2a['data']['processor']['htmlWriter']['getHtml'](_0x44b7bd);}else _0x497cf4=_0x232e2a['data']['processor']['toData'](_0x24409a);return _0x497cf4;}['_integrateEditor'](_0x31ade6){if(!_0x31ade6['config']['get']('collaboration.channelId'))throw new at('ai-missing-channel-id',_0x31ade6);_0x31ade6['ui']['focusTracker']['on']('change:isFocused',(_0x31b961,_0x246cc0,_0x553eb2)=>{_0x553eb2&&(this['_lastContentFocusedEditor']=_0x31ade6);}),_0x31ade6['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x31ade6&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x31ade6['conversion']['for']('editingDowncast')['markerToHighlight']({'model':As,'view':({markerName:_0x46d0b1})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x46d0b1['split'](':')[0x1]],'priority':0xc})}),_0x31ade6['conversion']['for']('dataDowncast')['markerToElement']({'model':As+':context','view':(_0x34b131,{writer:_0xb97a68,options:_0x49fb42})=>_0x49fb42['convertAiChatSelectionMarker']?_0xb97a68['createUIElement'](_0x34b131['markerName']+':'+(_0x34b131['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x4b3c02){const _0x4d0724=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x4b3c02);const _0x26306f=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x4d0724,_0x26306f);}['hideFakeVisualSelection'](_0x369e52){const _0x27d021=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x369e52);const _0x5a7caf=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x27d021,_0x5a7caf);}async['modelToDataWithIds'](_0x49c022){const _0x3cf6ce=ds(this['context']),_0x547bb1=_0x3cf6ce['data']['toView'](_0x49c022),_0x5f276b=new _0x203eb2(_0x3cf6ce['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x547bb1,_0x5f276b),this['_getDocumentDataStringFromView'](_0x547bb1,_0x3cf6ce);}['_setDataIdsOnChildren'](_0x4a2092,_0x3e7b38,_0x3897bf=new Set()){let _0x243e94=!0x1;for(const _0x1991ad of _0x4a2092['getChildren']()){if(!_0x1991ad['is']('view:element')||gs['includes'](_0x1991ad['name']))continue;const _0x24963b=_0x1991ad['is']('view:containerElement'),_0x25b75d=_0x1991ad['is']('view:emptyElement'),_0x188e8a=this['_setDataIdsOnChildren'](_0x1991ad,_0x3e7b38,_0x3897bf);if(_0x1991ad['hasAttribute']('data-id')){_0x243e94=!0x0,_0x3897bf['add'](_0x1991ad['getAttribute']('data-id'));continue;}(_0x24963b||_0x25b75d||_0x188e8a)&&(_0x3e7b38['setAttribute']('data-id',this['_nextDataId'](_0x3897bf),_0x1991ad),_0x243e94=!0x0);}return _0x243e94;}['_nextDataId'](_0xfbd680){let _0x459511;do{_0x459511='';for(let _0x1dadc3=0x0;_0x1dadc3<0x4;_0x1dadc3++)_0x459511+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0xfbd680['has'](_0x459511));return _0xfbd680['add'](_0x459511),_0x459511;}['getSelectionText'](){const {model:_0x1ef592}=ds(this['context']),_0x54cc0d=_0x1ef592['document']['selection'],_0x32947d=[],_0x1439ca=Array['from'](_0x54cc0d['getRanges']());_0x1439ca['sort']((_0x299f3a,_0x4777fb)=>_0x299f3a['start']['isBefore'](_0x4777fb['start'])?-0x1:0x1);for(const _0x5e924d of _0x1439ca)for(const _0x24f023 of _0x5e924d['getItems']())_0x24f023['is']('$textProxy')?_0x32947d['push'](_0x24f023['data']):_0x24f023['is']('element')&&_0x32947d['length']>0x0&&'\x20'!==_0x32947d[_0x32947d['length']-0x1]&&_0x32947d['push']('\x20');return _0x32947d['length']?'\x22'+_0x32947d['join']('')['trim']()+'\x22':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x13aa01){for(let _0x3f21ae=0x0;_0x3f21ae<this['_fakeSelections']['length'];_0x3f21ae++)if(this['_fakeSelections'][_0x3f21ae]['id']==_0x13aa01)return void this['_fakeSelections']['splice'](_0x3f21ae,0x1);}['_addFakeSelection'](_0x97badd){this['_removeFakeSelectionById'](_0x97badd['id']),Tt(this['_fakeSelections'],_0x97badd);}['_refreshFakeSelection'](_0x91dcc,_0x21748d){if(_0x91dcc==_0x21748d)return;const _0x50cb4c=_0x91dcc?this['_getEditorForFakeSelection'](_0x91dcc):null,_0x5e61f8=_0x21748d?this['_getEditorForFakeSelection'](_0x21748d):null,_0x345179=(_0x1b0ad4,_0x495688)=>{const _0x30baf1=_0x495688['model']['markers']['getMarkersGroup'](As);for(const _0x46924c of _0x30baf1)_0x1b0ad4['removeMarker'](_0x46924c);},_0x4c97c9=(_0x315d65,_0xa1349b,_0x5d913a)=>{const _0x2ccdbe=_0xa1349b['model'];for(let _0x354faa=0x0;_0x354faa<_0x5d913a['ranges']['length'];_0x354faa++){let _0x224d79=_0x5d913a['ranges'][_0x354faa];const _0x542188=As+':'+_0x5d913a['id']+':'+_0x354faa;if(_0x224d79['start']['isAtEnd']){const _0x4d493a=_0x224d79['start']['getLastMatchingPosition'](({item:_0x91fcd7})=>!_0x2ccdbe['schema']['isContent'](_0x91fcd7),{'boundaries':_0x224d79});_0x224d79=_0x315d65['createRange'](_0x4d493a,_0x224d79['end']);}_0x315d65['addMarker'](_0x542188,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x224d79});}};_0x50cb4c&&_0x5e61f8&&_0x50cb4c===_0x5e61f8&&_0x21748d?_0x50cb4c['model']['change'](_0x5e6d2e=>{_0x345179(_0x5e6d2e,_0x50cb4c),_0x4c97c9(_0x5e6d2e,_0x5e61f8,_0x21748d);}):(_0x50cb4c&&_0x50cb4c['model']['change'](_0x4dd698=>_0x345179(_0x4dd698,_0x50cb4c)),_0x5e61f8&&_0x21748d&&_0x5e61f8['model']['change'](_0x5b0ade=>_0x4c97c9(_0x5b0ade,_0x5e61f8,_0x21748d)));}['_getEditorForFakeSelection'](_0x389138){if(!_0x389138['ranges']['length'])return ds(this['context']);const _0x500b2c=_0x389138['ranges'][0x0]['root']['document'];return ls(this['context'])['find'](_0x27ca1f=>_0x27ca1f['model']['document']===_0x500b2c)??ds(this['context']);}['_getMarkersInDocumentOrder'](_0x4156f1,_0x2fd5c6){const _0x834c31=Array['from'](_0x4156f1['model']['markers']['getMarkersGroup'](As+':context'));return(_0x2fd5c6?_0x834c31['filter'](_0x4c0f5c=>{const _0x1fdd61=_0x4c0f5c['getRange']();return _0x1fdd61&&_0x1fdd61['root']['rootName']===_0x2fd5c6['rootName'];}):_0x834c31)['sort']((_0x2998f0,_0x482a32)=>_0x2998f0['getStart']()['isBefore'](_0x482a32['getStart']())?-0x1:_0x2998f0['getStart']()['isAfter'](_0x482a32['getStart']())?0x1:0x0);}}const Cs=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],ms=[...Cs,'startConversation','sendUserMessage','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function ps(_0x54d50c){const _0x1fb7e7=new AbortController();return{'promise':new Promise((_0x1b50fd,_0x162f3d)=>{const _0x2febb3=setTimeout(_0x1b50fd,_0x54d50c);_0x1fb7e7['signal']['addEventListener']('abort',()=>{clearTimeout(_0x2febb3),_0x162f3d();});}),'abortController':_0x1fb7e7};}class HTMLStreamer{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x424611){this['options']={'delay':_0x424611?.['delay']??0xa,'textNodeStyle':_0x424611?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x5b119f,targetElement:_0x8a4977,abortSignal:_0x169b81}){this['isStreaming']&&this['stop'](),_0x169b81?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x225cd1(_0x5b119f,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x132cf8=0x0;_0x132cf8<this['currentIndex'];_0x132cf8++)this['nodesList'][_0x132cf8]['shouldBeStreamed']=!0x0;do{const _0x4f9d7f=Date['now'](),_0x2de159=this['nodesList'][this['currentIndex']],_0x4c0648=_0x4f9d7f-this['lastUpdateTime'];if(_0x2de159){_0x2de159['shouldBeStreamed']=!0x0;let _0x188b2c=_0x2de159['parent'];for(;_0x188b2c;)_0x188b2c['shouldBeStreamed']=!0x0,_0x188b2c=_0x188b2c['parent'];}if(_0x4c0648<this['options']['delay'])try{const {promise:_0x29a8ef,abortController:_0x4adc2c}=ps(this['options']['delay']-_0x4c0648);this['timeoutAbortController']=_0x4adc2c,await _0x29a8ef;}catch(_0x2d7e7f){return;}_0x2c7e16(_0x8a4977,'<'+_0x8a4977['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x8a4977['tagName']+'>',{'childrenOnly':!0x0}),this['currentIndex']++,this['lastUpdateTime']=Date['now']();}while(this['currentIndex']<this['nodesList']['length']);this['currentIndex']=this['nodesList']['length'],this['isStreaming']=!0x1;}['reset'](){this['isStreaming']=!0x1,this['document']=null,this['nodesList']=[],this['currentIndex']=0x0,this['timeoutAbortController']=null;}['cleanUpAnimations']({targetElement:_0x194bcb}){Array['from'](_0x194bcb['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x52cabb=>{_0x52cabb['replaceWith'](_0x52cabb['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x5e2e44){let _0x26518e='';if(function(_0x2ee489){return _0x243876(_0x2ee489);}(_0x5e2e44)){for(const _0x9ce07b of _0x5e2e44['children'])_0x26518e+=this['renderNode'](_0x9ce07b);}else{if(Ts(_0x5e2e44)){if(!_0x5e2e44['shouldBeStreamed'])return'';const _0x3dec33=_0x5e2e44,_0xcbd9f9=Object['entries'](_0x3dec33['attribs'])['map'](([_0x1603f2,_0x5dd6cb])=>_0x1603f2+'=\x22'+_0x5dd6cb+'\x22')['join']('\x20');_0x26518e+='<'+_0x3dec33['tagName']+(_0xcbd9f9?'\x20'+_0xcbd9f9:'')+'>';for(const _0x1bd379 of _0x4bfbc2(_0x3dec33))_0x26518e+=this['renderNode'](_0x1bd379);_0x26518e+='</'+_0x3dec33['tagName']+'>';}else{if(!ws(_0x5e2e44))return'';if(!_0x5e2e44['shouldBeStreamed'])return'';!function(_0x2faec5){if(!_0x2faec5['parent']||!Ts(_0x2faec5['parent']))return!0x1;if(!Es['includes'](_0x2faec5['parent']['tagName']))return!0x1;return!_0x39f544(_0x2faec5)['match'](/^\s*[<>]\s*$/);}(_0x5e2e44)?_0x26518e+=ti(_0x5e2e44):_0x26518e+=ti(new _0x59f13d('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x5e2e44]));}}return _0x26518e;}['getParsedDocumentNodeList'](){const _0x3abb35=[];return function(_0x544c3c,_0x572907){const _0x4e957d=_0x246b41=>{if(_0x572907(_0x246b41),_0x246b41 instanceof _0x2da0df)for(let _0x436bfa=0x0;_0x436bfa<_0x246b41['children']['length'];_0x436bfa++){const _0x31ed62=_0x246b41['children'][_0x436bfa];_0x4e957d(_0x31ed62);}};for(let _0x8806b3=0x0;_0x8806b3<_0x544c3c['children']['length'];_0x8806b3++)_0x4e957d(_0x544c3c['children'][_0x8806b3]);}(this['document'],_0x1f004d=>{if(ws(_0x1f004d)){const _0x54e7ae=this['splitTextNodeIntoWordNodes'](_0x1f004d);_0x54e7ae['length']&&_0x3abb35['push'](..._0x54e7ae);}_0x1f004d['isWordSplitSource']||_0x1f004d['isWordSplitResult']||_0x3abb35['push'](_0x1f004d);}),_0x3abb35;}['splitTextNodeIntoWordNodes'](_0x2ee4f5){if(_0x2ee4f5['isWordSplitSource']||_0x2ee4f5['isWordSplitResult'])return[];const _0x2817da=_0x39f544(_0x2ee4f5)['match'](/(?:\s*\S+\s*)/g),_0x66f8b3=[];if(_0x2817da&&_0x2817da['length']>0x1){for(const _0xff3e8d of _0x2817da){const _0x5c072d=new _0x192276(_0xff3e8d);_0x5c072d['isWordSplitResult']=!0x0,_0x38bdcf(_0x2ee4f5,_0x5c072d),_0x66f8b3['push'](_0x5c072d);}_0x2ee4f5['isWordSplitSource']=!0x0,_0x3064c8(_0x2ee4f5);}return _0x66f8b3;}}const Es=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function ws(_0x23f0a6){return _0xcaf2d1(_0x23f0a6);}function Ts(_0x58de72){return _0x4590df(_0x58de72);}class AIChatFeedItemView extends Nt{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x665189){super();const _0x1cc2c5=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new HTMLStreamer(),this['options']=_0x665189,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x1cc2c5['if']('isDone','ck-ai-chat__feed__item_done'),_0x1cc2c5['if']('isVisible','ck-hidden',_0x4a0df0=>!_0x4a0df0),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){this['htmlStreamer']['cleanUpAnimations']({'targetElement':this['element']}),this['element']['querySelectorAll']('[data-id]')['forEach'](_0x4ede9f=>{_0x4ede9f['removeAttribute']('data-id');}),this['isDone']=!0x0;}async['streamIntoElement'](_0x5b781d,_0x47929c,_0x144ff3){await this['htmlStreamer']['stream']({'document':_0x5b781d,'targetElement':_0x47929c,'abortSignal':_0x144ff3});}}class AISuggestionHeaderView extends Nt{['showChangesToggleView'];constructor(_0x1b2c78,_0x78d6ca){super(_0x1b2c78),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new ShowChangesToggleView(_0x1b2c78),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Bi,'label':Hi(_0x1b2c78,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x78d6ca['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x15650c=>_0x15650c?_0x5e8753:_0x15ce4c),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x4159df=new xt();_0x4159df['content']=_0x40ebca,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x78d6ca['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x4159df,{'tag':'span','children':[Hi(_0x1b2c78,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}}class ShowChangesToggleView extends vt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}}const fs={'accepted':_0x262f77,'rejected':_0x27568b,'outdated':_0x27568b};class AISuggestionContentPartStateView extends Nt{['stateIconView'];constructor(_0x424ad2){super(_0x424ad2);const _0x58aeb8=this['bindTemplate'];this['set']('state','accepted'),this['set']('isVisible',!0x0),this['stateIconView']=new StateIconView(),this['stateIconView']['bind']('state')['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x58aeb8['to']('state',_0xd5f01=>'ck-ai-suggestion__content-part-state_'+_0xd5f01),_0x58aeb8['if']('isVisible','ck-hidden',_0x23883d=>!_0x23883d)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x58aeb8['to']('state',_0x535ed9=>{switch(_0x535ed9){case'accepted':return Hi(_0x424ad2,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return Hi(_0x424ad2,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return Hi(_0x424ad2,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x489859){this['state']=_0x489859;}}class StateIconView extends xt{constructor(){super(),this['set']('state','accepted'),this['content']=fs[this['state']],this['on']('change:state',()=>{this['content']=fs[this['state']];});}}class AISuggestionContentPartToolbarView extends kt{['_applyButton'];['_suggestButton'];constructor(_0x3a82fd,_0x4016a6,_0x535cf4){super(_0x3a82fd);const _0x144bf8=Boolean(_0x535cf4);this['set']('isEnabled',!_0x144bf8),this['set']('isVisible',!0x0),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x5632cf=[];if(_0x144bf8){const _0xc9d02d=new vt(_0x3a82fd);_0xc9d02d['set']({'label':Hi(_0x3a82fd,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x5be768}),_0xc9d02d['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x5632cf['push'](_0xc9d02d);}else{_0x4016a6['includes']('applySuggestion')&&(this['_applyButton']=new vt(_0x3a82fd),this['_applyButton']['set']({'label':Hi(_0x3a82fd,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x262f77}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x5632cf['push'](this['_applyButton'])),_0x4016a6['includes']('insertSuggestion')&&(this['_suggestButton']=new vt(_0x3a82fd),this['_suggestButton']['set']({'label':Hi(_0x3a82fd,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x42b593}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x5632cf['push'](this['_suggestButton']));const _0x32effa=new vt(_0x3a82fd);_0x32effa['set']({'label':Hi(_0x3a82fd,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x27568b}),_0x32effa['bind']('isEnabled')['to'](this),_0x32effa['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x5632cf['push'](_0x32effa);}this['items']['addMany'](_0x5632cf);const _0x3d0e9d=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x3d0e9d['if']('isVisible','ck-hidden',_0x11bc71=>!_0x11bc71)]}});}['setButtonsVisibility']({showApplyButton:_0x3cad25,showSuggestButton:_0x15ed60}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x3cad25),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x15ed60);}}class AISuggestionContentPartHeaderView extends Nt{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x2b2c13,{part:_0x219045,uiIndex:_0x3639c3,availableActions:_0x5098b4,areActionsDisabled:_0x31a1a2}){super(_0x2b2c13),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['toolbarView']=new AISuggestionContentPartToolbarView(_0x2b2c13,_0x5098b4,_0x31a1a2),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x219045['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x219045['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x219045['index']});}),this['toolbarView']['bind']('isEnabled')['to'](this),this['stateView']=new AISuggestionContentPartStateView(_0x2b2c13),this['titleLabelView']=new AISuggestionBodyContentPartTitleLabelView(_0x2b2c13,_0x3639c3),this['children']=this['createCollection'](),this['children']['addMany']([this['titleLabelView'],this['toolbarView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-suggestion__body__content-part__title']},'children':this['children']}),this['on']('change:state',(_0x3ac688,_0x3040c5,_0x2d6233,_0x3d8f64)=>{'pending'===_0x3d8f64?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x2d6233?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x2d6233),this['children']['add'](this['stateView']));});}}class AISuggestionBodyContentPartTitleLabelView extends Nt{constructor(_0x52569e,_0x59db5d){super(_0x52569e),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Hi(_0x52569e,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x59db5d['toString']())]});}}class AISuggestionStreamableContentView extends Nt{['htmlStreamer'];constructor(_0x17a640){super(_0x17a640),this['htmlStreamer']=new HTMLStreamer(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async['update']({part:_0x4ec72d,renderingStrategy:_0x1c7700,abortSignal:_0x18bbf5}){'streaming'===_0x1c7700?await this['htmlStreamer']['stream']({'document':_0x4ec72d['content'],'targetElement':this['element'],'abortSignal':_0x18bbf5}):_0x2c7e16(this['element'],'<'+this['element']['tagName']+'>'+Ki(_0x4ec72d['content'])+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='';}}class AISuggestionBodyViewContentPartView extends Nt{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x364de3,{part:_0x4cc090,uiIndex:_0x4d9ecc,areActionsDisabled:_0x3d1c57,availableActions:_0x28cfce}){super(_0x364de3);const _0x10c5b1=this['bindTemplate'];this['set']('state','pending'),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1);const _0x3eee50=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x3d1c57;};this['on']('change:state',_0x3eee50),this['on']('change:isDone',_0x3eee50),_0x3eee50(),this['_children']=this['createCollection'](),this['_headerView']=new AISuggestionContentPartHeaderView(_0x364de3,{'part':_0x4cc090,'uiIndex':_0x4d9ecc,'availableActions':_0x28cfce,'areActionsDisabled':_0x3d1c57}),this['_headerView']['bind']('isEnabled','state')['to'](this),this['_headerView']['delegate'](...Cs)['to'](this),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x364de3),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x10c5b1['to']('state',_0x416f83=>'ck-ai-suggestion__body__content-part_'+_0x416f83),_0x10c5b1['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x10c5b1['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x10c5b1['if']('isVisible','ck-hidden',_0x2db1fc=>!_0x2db1fc)]},'children':this['_children'],'on':{'mouseenter':_0x10c5b1['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x4cc090['index']});}),'mouseleave':_0x10c5b1['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x4cc090['index']});}),'click':_0x10c5b1['to'](_0x510569=>{const _0x4ea22f=_0x510569['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x4ea22f)&&this['fire']('showChangeInText',{'index':_0x4cc090['index']});})}});}async['updateContent']({part:_0x37fa99,showUnchangedParts:_0x4b3470=!0x1,abortSignal:_0x2070dd}){this['partDefinition']=_0x37fa99,this['isVisible']=this['partDefinition']['hasChanges']||_0x4b3470,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x37fa99,'renderingStrategy':'static','abortSignal':_0x2070dd});}['markAsDone'](){this['isDone']=!0x0;}}class AISkeletonView extends Nt{constructor(_0x3dcc60,_0x43e389){super(_0x3dcc60),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x35d642=>!_0x35d642)]},'children':this['_createSkeletonItems'](_0x43e389)});}['_createSkeletonItems'](_0x556e30){const _0x48b018=['ck','ck-ai-skeleton__item'];return _0x556e30['map'](_0x12591f=>{let _0x5b75d0='';switch(_0x12591f['attributes']['align']){case'right':_0x5b75d0='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x5b75d0='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x5b75d0='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x12591f['tag'],'attributes':{'class':[..._0x48b018,_0x12591f['attributes']['class']?_0x12591f['attributes']['class']:''],'style':'width:\x20'+_0x12591f['attributes']['width']+';\x20height:\x20'+_0x12591f['attributes']['height']+';'+_0x5b75d0}};});}}const Ss={'aiSuggestionBody':[{'tag':'div','attributes':{'width':'50%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'85%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'75%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}}],'aiFeed':[{'tag':'div','attributes':{'width':'100%','height':'72px','align':'right'}},{'tag':'div','attributes':{'width':'250px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'88px','align':'right'}},{'tag':'div','attributes':{'width':'150px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'140px','align':'right'}},{'tag':'div','attributes':{'width':'250px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'88px','align':'right'}}],'aiHistory':Rs(0x5,'100%','44px','right'),'aiChatResources':Rs(0x8,'100%','24px','right'),'aiReviewChecks':[{'tag':'div','attributes':{'width':'128px','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'128px','height':'24px','align':'left'}}]};function Rs(_0x2c30f7,_0x4265af,_0x3e645b,_0x1cd7f7){return new Array(_0x2c30f7)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x4265af,'height':_0x3e645b,'align':_0x1cd7f7}}));}class PromiseQueue extends Et(){['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x51d12e){const _0x5e97bd=this['createTask'](_0x51d12e);return this['queue']['push'](_0x5e97bd),this['_processQueue'](),_0x5e97bd['completePromise'];}['abort'](){this['isProcessing']&&(this['_abortController']['abort'](),this['_abortController']=void 0x0,this['queue']=[],this['fire']('_queueEmpty'),this['isProcessing']=!0x1);}get['queueEmptyPromise'](){return this['queue']['length']||this['isProcessing']?new Promise(_0x433b29=>{this['once']('_queueEmpty',()=>{_0x433b29();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x1d7039=this['queue']['shift']();try{await _0x1d7039['callback'](this['_abortController']['signal']),_0x1d7039['resolve']();}catch(_0x484406){_0x1d7039['reject'](_0x484406);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x1f4a62){let _0x536007,_0x4f2533;const _0x2c619f=new Promise((_0x30316a,_0x27c2f7)=>{_0x536007=_0x30316a,_0x4f2533=_0x27c2f7;});return{'callback':_0x1f4a62,'resolve':_0x536007,'reject':_0x4f2533,'completePromise':_0x2c619f};}}class AIChatFeedErrorItemView extends AIChatFeedItemView{constructor(_0x2c4672){super(_0x2c4672),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x2c4672['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x451438){this['element']['innerHTML']=_0x451438;}}const bs=['applySuggestion','insertSuggestion'];class AIChatFeedSuggestionItemActionsView extends Nt{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x153236,_0xc880a8=[...bs],_0x4bb707){super(_0x153236);const _0x158d8d=this['bindTemplate'],_0x34a760=Boolean(_0x4bb707);if(this['set']('isEnabled',!_0x34a760),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x34a760){const _0x3af5dc=new vt(_0x153236);_0x3af5dc['set']({'label':Hi(_0x153236,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x5be768}),_0x3af5dc['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x642a97=new Nt(_0x153236);_0x642a97['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[Hi(_0x153236,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x3af5dc]}]}),this['children']['add'](_0x642a97);}else this['_applyChangesButton']=new vt(_0x153236),this['_applyChangesButton']['set']({'label':Hi(_0x153236,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0xc880a8['includes']('applySuggestion'),'class':Mi}),this['_insertSuggestionsButton']=new vt(_0x153236),this['_insertSuggestionsButton']['set']({'label':Hi(_0x153236,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0xc880a8['includes']('insertSuggestion'),'class':Ui}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0xdecdd5=>{_0xdecdd5['bind']('isEnabled')['to'](this);}),this['children']['addMany']([this['_applyChangesButton'],this['_insertSuggestionsButton']]);this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__ai-suggestion__actions',_0x158d8d['if']('isVisible','ck-hidden',_0x336b99=>!_0x336b99)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x196584){this['isVisible']=_0x196584;}['_switchButtonLabelsPlurality'](_0x12540e){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x12540e?(this['_applyChangesButton']['label']=Hi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=Hi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=Hi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=Hi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}}class AIWebSourcesView extends Nt{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x5f5dcf,_0x10ef97){super(_0x5f5dcf),this['bodyCollection']=_0x10ef97,this['children']=this['createCollection'](),this['set']('isVisible',!0x1),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources',this['bindTemplate']['if']('isVisible','ck-hidden',_0x2c0c73=>!_0x2c0c73)]},'children':this['children']});const _0x48b702=new Nt(this['locale']),_0x110b39=new xt();_0x110b39['content']=_0x43ec4b,_0x48b702['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x110b39,{'tag':'span','children':[{'text':Hi(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x48b702),this['_setupBalloonPanel'](_0x5f5dcf);}['addSource'](_0x4fe89d){this['children']['add'](new AIWebSourceView(this['locale'],_0x4fe89d,this['balloonPanelView']));}['_setupBalloonPanel'](_0x4b4ad3){this['balloonPanelView']=new Xt(_0x4b4ad3),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}}class AIWebSourceView extends vt{['balloonPanelView'];['source'];constructor(_0x518065,_0x1e74cb,_0x3e50bf){super(_0x518065),this['source']=_0x1e74cb,this['balloonPanelView']=_0x3e50bf,this['set']({'label':_0x1e74cb['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x56cd6c=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x56cd6c['to'](()=>{window['open'](_0x1e74cb['url'],'_blank');}),'mouseenter':_0x56cd6c['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x56cd6c['to'](()=>{this['_hideTooltip']();})}}),_0x1e74cb['favicon']){const _0x16fe0d=new Nt(_0x518065);_0x16fe0d['setTemplate']({'tag':'img','attributes':{'src':_0x1e74cb['favicon']||_0x43ec4b,'alt':_0x1e74cb['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x16fe0d);}else this['set']('icon',_0x43ec4b);}['_createTooltipContentView'](_0x1a52f7,_0x330ebd){const _0x2b71c4=new Nt(_0x1a52f7),_0x142ed8=[];let _0x475006;_0x330ebd?.['favicon']?(_0x475006=new Nt(_0x1a52f7),_0x475006['setTemplate']({'tag':'img','attributes':{'src':_0x330ebd['favicon'],'alt':_0x330ebd['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x475006=new xt(),_0x475006['content']=_0x43ec4b,_0x475006['extendTemplate']({'attributes':{'alt':_0x330ebd['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x142ed8['push'](_0x475006);const _0x537e7a=new Nt(_0x1a52f7);_0x537e7a['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x330ebd['url']},'children':[{'text':new URL(_0x330ebd['url'])?.['hostname']}]}),_0x142ed8['push'](_0x537e7a);const _0x2db18c=new Nt(_0x1a52f7);_0x2db18c['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x142ed8});const _0x215fe3=new Nt(_0x1a52f7);return _0x215fe3['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x330ebd['title']['length']>0x190?_0x330ebd['title']['substring'](0x0,0x190)+'...':_0x330ebd['title']}]}),_0x2b71c4['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x2db18c,_0x215fe3]}),_0x2b71c4;}['_showTooltip'](){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[Xt['defaultPositions']['northArrowSouth'],Xt['defaultPositions']['northArrowSouthWest'],Xt['defaultPositions']['northArrowSouthEast']],'limiter':document['querySelector']('.ck-ai-chat')}),this['balloonPanelView']['show']();}['_hideTooltip'](){this['balloonPanelView']['hide']();}['_updateTooltipContent'](){this['balloonPanelView']['content']['get'](0x0)?.['destroy'](),this['balloonPanelView']['content']['clear']();const _0x28e8eb=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x28e8eb);}}class AISuggestionBodyView extends Nt{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x200174(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x3f9ff3,_0x53cd2a){super(_0x3f9ff3);const {areActionsDisabled:_0xc42feb,showUnchangedParts:_0x29acc5,availableActions:_0x2d6305}=_0x53cd2a;this['_areActionsDisabled']=_0xc42feb,this['_showUnchangedParts']=_0x29acc5,this['_availableActions']=_0x2d6305,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new AISkeletonView(_0x3f9ff3,Ss['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new PromiseQueue(),this['_emptyPartsWarningView']=new AIChatFeedErrorItemView({'id':'empty-parts-warning','initialContent':Hi(_0x3f9ff3,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new AIChatFeedSuggestionItemActionsView(_0x3f9ff3,_0x53cd2a['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new AIWebSourcesView(this['locale'],_0x53cd2a['bodyCollection']),_0x53cd2a['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...Cs)['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body']},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-parts']},'children':this['_children']},this['_emptyPartsWarningView'],this['_actionsView'],this['_sourcesView']]});}['destroy'](){this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),super['destroy']();}get['partsCount'](){return this['_contentPartViews']['length'];}get['_contentPartViews'](){return Array['from'](this['_children'])['filter'](_0x10d442=>_0x10d442 instanceof AISuggestionBodyViewContentPartView);}async['updateContentParts']({parts:_0x5e67c7,abortSignal:_0x3c8eec,skipLoadingEffects:_0x45dba7}){this['_cachedContentParts']['length']?_0x5e67c7['forEach'](_0x66f8e8=>{const _0x24b199=this['_cachedContentParts']['findIndex'](_0x23652d=>_0x23652d['index']==_0x66f8e8['index']);-0x1===_0x24b199?this['_cachedContentParts']['push'](_0x66f8e8):this['_cachedContentParts'][_0x24b199]=_0x66f8e8;}):this['_cachedContentParts']=_0x5e67c7;const _0x5dae51=this['_showUnchangedParts']?_0x5e67c7:_0x5e67c7['filter'](_0x4a2be8=>_0x4a2be8['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x5dae51['length']>0x1),_0x45dba7&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x4cb76e of _0x5dae51)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x579195=>{let _0x44a694=this['getPartView'](_0x4cb76e['index']);if(!_0x44a694){if(_0x44a694=new AISuggestionBodyViewContentPartView(this['locale'],{'part':_0x4cb76e,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x44a694['delegate'](...Cs)['to'](this),!_0x45dba7&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x579195),_0x579195['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x44a694,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x45dba7||this['_showSkeletonDebounced']();}await _0x44a694['updateContent']({'part':_0x4cb76e,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x579195}),_0x44a694['markAsDone']();});return _0x3c8eec?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x3254ce,_0x32cc0){const _0x1d1f4b=this['getPartView'](_0x3254ce);_0x1d1f4b&&(_0x1d1f4b['state']=_0x32cc0),this['hasPendingParts']='pending'==_0x32cc0||this['_contentPartViews']['some'](_0x41d032=>'pending'==_0x41d032['state']);}['setPartActive'](_0x488f71,_0x3e535f){if(!0x1===_0x488f71){for(const _0x436151 of this['_contentPartViews'])_0x436151['isActive']=!0x1;}else{const _0x4de08e=this['getPartView'](_0x488f71);_0x4de08e&&(_0x4de08e['isActive']=_0x3e535f);}}['updateSources'](_0xefcba7){_0xefcba7['forEach'](_0x2745b7=>this['_sourcesView']['addSource'](_0x2745b7)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x5c93a9){return this['_contentPartViews']['find'](_0x512423=>_0x512423['partDefinition']['index']==_0x5c93a9)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x3d134e=!this['_cachedContentParts']['find'](({hasChanges:_0x39e41d})=>_0x39e41d),_0x283f23=!!this['_cachedContentParts']['find'](({hasChanges:_0x375378})=>!_0x375378);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x283f23,_0x3d134e?this['_emptyPartsWarningView']['setContent'](Hi(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](Hi(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x3918fe=>_0x3918fe['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x5d333a){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x1619e7=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x1619e7>0x0){const {promise:_0x16f0fb,abortController:_0x4064d1}=ps(_0x1619e7);_0x5d333a?.['addEventListener']('abort',()=>_0x4064d1['abort']()),await _0x16f0fb['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x183faf=>_0x183faf['partDefinition']['hasChanges'])['length']>0x0;}}class AISuggestionContainerView extends Nt{['bodyView'];['children'];['headerView'];constructor(_0x4cc370,_0x1bb79e,_0x3a7eee){super(_0x4cc370);const {showDiff:_0xeb686f,areActionsDisabled:_0x46ecbc,showUnchangedParts:_0x1d8f8c,availableActions:_0x2f3fcc}=_0x1bb79e;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new AISuggestionHeaderView(_0x4cc370,{'showDiff':_0xeb686f}),this['headerView']['on']('toggleShowChanges',(_0x4fe882,_0x689952)=>{this['areChangesVisible']=_0x689952['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x689952['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new AISuggestionBodyView(_0x4cc370,{'areActionsDisabled':_0x46ecbc,'showUnchangedParts':!!_0x1d8f8c,'availableActions':_0x2f3fcc,'bodyCollection':_0x3a7eee}),this['bodyView']['delegate'](...Cs)['to'](this),this['bodyView']['bind']('isTrackChangesOn')['to'](this),this['children']['add'](this['bodyView']),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__container','ck-rounded-corners']},'children':this['children']});}async['updateContent'](_0x5250c7){await this['bodyView']['updateContentParts'](_0x5250c7);}['updateSources'](_0x17af2f){this['bodyView']['updateSources'](_0x17af2f);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}}class AIChatFeedSuggestionItemView extends AIChatFeedItemView{['containerView'];constructor(_0x42757d,_0x3c3b8f,_0x481073){super(_0x3c3b8f),this['set']('isTrackChangesOn',!0x1),this['containerView']=new AISuggestionContainerView(_0x42757d,{'showDiff':_0x3c3b8f['showDiff'],'areActionsDisabled':_0x3c3b8f['areActionsDisabled'],'availableActions':_0x3c3b8f['availableActions']},_0x481073),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x3add9f,_0x442bd6)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x442bd6['showDiff']});}),this['containerView']['bind']('isTrackChangesOn')['to'](this),this['containerView']['on']('like',()=>{this['fire']('like',{'replyId':this['options']['id']});}),this['containerView']['on']('dislike',()=>{this['fire']('dislike',{'replyId':this['options']['id']});}),this['containerView']['on']('showChangeInText',(_0x5e836b,{index:_0x538f0a})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x538f0a});}),this['containerView']['on']('applySuggestion',(_0x5b4246,{index:_0x258b24}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x258b24});}),this['containerView']['on']('insertSuggestion',(_0x1d58dd,{index:_0x422b32}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x422b32});}),this['containerView']['on']('rejectSuggestion',(_0x225757,{index:_0xa3e643})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0xa3e643});}),this['containerView']['on']('mouseOverSuggestion',(_0x554390,{index:_0x8828f8})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x8828f8});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x50327f,{index:_0x11c0bc})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x11c0bc});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x52dccb){await this['containerView']['updateContent'](_0x52dccb);}['updatePartState'](_0x37bfd8,_0x1db40a){this['containerView']['bodyView']['updatePartState'](_0x37bfd8,_0x1db40a);}['setPartActive'](_0x21286a,_0x5dc91d){!0x1===_0x21286a?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x21286a,_0x5dc91d);}['updateSources'](_0x33134d){this['containerView']['updateSources'](_0x33134d);}['getPartView'](_0x30af21){return this['containerView']['bodyView']['getPartView'](_0x30af21);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}}class AIChatFeedReplyItemView extends AIChatFeedItemView{['replyContainer'];['_bodyCollection'];constructor(_0x35ea82,_0x5013b6,_0x237b53){super(_0x5013b6),this['_bodyCollection']=_0x237b53,this['locale']=_0x35ea82,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new Nt(),this['replyContainer']['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-chat__feed__ai-reply-container']}}),this['children']['add'](this['replyContainer']);}async['render'](){super['render'](),this['options']['initialContent']&&(await this['updateContent']({'parsedContent':Fi(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0x249044,renderingStrategy:_0x5f10a6,abortSignal:_0xe79c39}){'streaming'===_0x5f10a6?await this['streamIntoElement'](_0x249044,this['replyContainer']['element'],_0xe79c39):this['replyContainer']['element']['innerHTML']=ti(_0x249044);}['updateSources'](_0x2b28b1){const _0x519c2c=new AIWebSourcesView(this['locale'],this['_bodyCollection']);_0x519c2c['children']['addMany'](_0x2b28b1['map'](_0x1ec852=>new AIWebSourceView(this['locale'],_0x1ec852,_0x519c2c['balloonPanelView']))),_0x519c2c['isVisible']=!0x0,this['children']['add'](_0x519c2c);}}class AISpinnerView extends yt{constructor(_0x5446c6=void 0x0){super();const _0x4232eb=_0x5446c6?'ck-ai-spinner_'+_0x5446c6:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x4232eb]}});}}const Os={'file':_0x29ada8,'document':_0x40ebca,'web-resource':_0x31e498,'text':_0x29ada8,'selection':_0x4f3f50,'mcp-tool-context':_0x40ebca},ks='ck-ai-chat-context-chip',vs='ck-ai-chat-context-chip_wide',Ns='ck-ai-chat-context-chip_document',ys='ck-ai-chat-context-chip__label',xs='ck-ai-chat-context-chip__type-icon',Ls='ck-ai-chat-context-controls__chip-tooltip',Ds='n';class AIChatContextItemButtonView extends vt{constructor(_0x52185b,_0x29d0b9,_0x597977,_0x416203,_0x1c2d3f=!0x1){super(_0x52185b),this['_isAnimationOnEnterEnabled']=_0x416203,this['_initializeProperties'](_0x29d0b9,_0x597977,_0x1c2d3f),this['_setupTemplate']();}['render'](){super['render'](),this['_isAnimationOnEnterEnabled']&&this['element']&&(this['element']['classList']['add']('ck-ai-chat-context-chip_new-chip'),this['_handleAnimationEndOnce'](this['element'],()=>{this['element']&&this['element']['classList']['remove']('ck-ai-chat-context-chip_new-chip');}));}['disableAnimationOnEnter'](){this['_isAnimationOnEnterEnabled']=!0x1,this['element']&&this['element']['classList']['remove']('ck-ai-chat-context-chip_new-chip');}['_initializeProperties'](_0x3d8cea,_0x18f906,_0x5cb500){this['set']('label',_0x3d8cea['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x3d8cea['type']),this['set']('id',_0x3d8cea['uiId']),this['set']('readonly',_0x18f906),this['set']('isLoading',_0x5cb500);}['_setupTemplate'](){const _0x587f13=this['_createIconView'](),_0xf4bd5a=this['_createRemoveButton'](),_0x39b14a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x39b14a),'children':this['_createTemplateChildren'](_0x587f13,_0xf4bd5a,_0x39b14a)});}['_createTemplateAttributes'](_0x1bcccc){return{'class':[ks,_0x1bcccc['if']('itemType',Ns,_0x5b97c2=>'document'==_0x5b97c2),_0x1bcccc['if']('itemType',vs,_0xc734f3=>'selection'==_0xc734f3)],'data-cke-tooltip-text':_0x1bcccc['to']('label',Vs),'data-cke-tooltip-position':Ds,'data-cke-tooltip-class':Ls};}['_createTemplateChildren'](_0x1679b7,_0x45b63b,_0x47badb){const _0x5568a0=this['_createLabelElement'](_0x47badb),_0x52ca6f=this['_createLoaderIcon']();return this['readonly']?[_0x1679b7,_0x5568a0]:[_0x1679b7,_0x52ca6f,_0x5568a0,_0x45b63b];}['_createLabelElement'](_0x27d39d){return{'tag':'span','attributes':{'class':ys},'children':[{'text':_0x27d39d['to']('label')}]};}['_createRemoveButton'](){const _0x22c850=new vt(this['locale']);return _0x22c850['set']({'label':Hi(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x1294a9}),this['_setupRemoveButtonEvent'](_0x22c850),_0x22c850;}['_setupRemoveButtonEvent'](_0x36d671){_0x36d671['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x436e59=this['bindTemplate'],_0x5211b0=new xt();return _0x5211b0['content']=Os[this['itemType']],_0x5211b0['extendTemplate']({'attributes':{'class':[xs,_0x436e59['if']('isLoading','ck-hidden',_0x3dc9aa=>_0x3dc9aa)]}}),_0x5211b0;}['_handleAnimationEndOnce'](_0x33151f,_0x5b1686){if(!_0x33151f)return;const _0x1642f4=()=>{_0x5b1686(),_0x33151f['removeEventListener']('animationend',_0x1642f4),_0x33151f['removeEventListener']('webkitAnimationEnd',_0x1642f4);};_0x33151f['addEventListener']('animationend',_0x1642f4),_0x33151f['addEventListener']('webkitAnimationEnd',_0x1642f4);}['_createLoaderIcon'](){const _0x50368d=new AISpinnerView('small');return _0x50368d['bind']('isVisible')['to'](this,'isLoading',_0x13ea0b=>_0x13ea0b),_0x50368d;}}function Vs(_0x58c360){if(!_0x58c360)return _0x58c360;if(_0x58c360['length']<=0x78)return _0x58c360;const _0x1c1d6a=_0x58c360['slice'](0x0,0x78),_0x40e8c8=_0x1c1d6a['lastIndexOf']('\x20');return(_0x40e8c8>0x0?_0x1c1d6a['slice'](0x0,_0x40e8c8):_0x1c1d6a)+'…';}const Ps={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},Hs='300px';class AIChatChipsOverflowManager{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0x30f48a,_0x4f5fb2,_0x1cd042,_0x543ef7,_0x19ae18){this['_locale']=_0x30f48a,this['_visibleChips']=_0x4f5fb2,this['_config']={...Ps,..._0x1cd042,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x1cd042['cssClasses']}},this['_overflowChips']=new dt(),this['_bodyCollection']=_0x543ef7,this['_parentView']=_0x19ae18||null;}['setContainerElement'](_0x7c4315){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x7c4315,this['_setupVisibilityObserver']();}get['showMoreButtonView'](){return this['_showMoreButtonView'];}get['overflowChips'](){return this['_overflowChips'];}['reorganizeChips'](){requestAnimationFrame(()=>{this['_checkAndHandleOverflow']();});}['showBalloonPanel'](){this['_showMoreButtonView']&&this['_showMoreBalloonPanelView']&&(this['_updateBalloonContent'](),this['_showMoreButtonView']['isOn']=!0x0,this['_showMoreBalloonPanelView']['show'](),this['_showMoreBalloonPanelView']['pin']({'target':this['_showMoreButtonView']['element'],'limiter':document['querySelector']('.ck-ai-chat')}));}['hideBalloonPanel'](){this['_showMoreButtonView']&&this['_showMoreBalloonPanelView']&&(this['_showMoreButtonView']['isOn']=!0x1,this['_showMoreBalloonPanelView']['hide']());}['clear'](){this['_overflowChips']['clear'](),this['hideBalloonPanel'](),this['_updateShowMoreButtonVisibility'](),this['_showMoreButtonView']&&(this['_showMoreButtonView']['label']=''),this['_showMoreBalloonPanelView']&&this['_showMoreBalloonPanelView']['content']['clear']();}['destroy'](){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_showMoreButtonView']&&(this['_showMoreButtonView']['destroy'](),this['_showMoreButtonView']=null),this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['destroy'](),this['_showMoreBalloonPanelView']=null);}['_checkAndHandleOverflow'](){if(!this['_containerElement'])return;if(!this['_isContainerVisible']())return void(this['_pendingCalculation']=!0x0);this['_pendingCalculation']=!0x1;const _0x1b681d=[...this['_visibleChips'],...this['_overflowChips']],_0x5cac73=this['_createCalculationContainer'](),_0x1521fd=this['_calculateOverflowInContainer'](_0x5cac73,_0x1b681d),_0x4e4073=_0x5cac73['_ancestorsToRestore'];_0x4e4073&&this['_restoreAncestorVisibility'](_0x4e4073),_0x5cac73['remove'](),this['_applyOverflowResults'](_0x1b681d,_0x1521fd);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),zt({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x3fc899=new vt(this['_locale']);_0x3fc899['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x5a7c37=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x5a7c37['push'](this['_config']['cssClasses']['controlsButton']),_0x3fc899['extendTemplate']({'attributes':{'class':_0x5a7c37}}),_0x3fc899;}['_createShowMoreBalloonPanelView'](){const _0x11f9d6=new Xt(this['_locale']);return _0x11f9d6['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x11f9d6),_0x11f9d6;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x4dcf7a=>{_0x4dcf7a['disableAnimationOnEnter']();});const _0x25ede4=new Nt(this['_locale']);_0x25ede4['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x25ede4);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x282256=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x282256?'':'none');}['_repinBalloonPanel'](){this['_showMoreButtonView']?.['isOn']&&this['_showMoreBalloonPanelView']?.['isVisible']&&this['_showMoreButtonView']['element']&&this['_showMoreBalloonPanelView']['pin']({'target':this['_showMoreButtonView']['element'],'limiter':document['querySelector']('.ck-ai-chat')});}['_findTargetContainer'](_0x2883d8){const _0x23db9a=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x23931c=this['_containerElement']?.['classList'];if(_0x23931c){const _0x506235=_0x23931c[0x0]||'',_0x327a6b=_0x2883d8['querySelector']('.'+_0x506235),_0x5ce4c2=_0x2883d8['querySelector'](_0x23db9a);return _0x327a6b||_0x5ce4c2||_0x2883d8;}return _0x2883d8['querySelector'](_0x23db9a)||_0x2883d8;}['_calculateContainerWidth'](){const _0x325936=this['_parentView']?.['element']||this['_containerElement'];if(!_0x325936)return Hs;const _0x5ba69f=window['getComputedStyle'](_0x325936)['width'];if('auto'===_0x5ba69f||'0px'===_0x5ba69f||!_0x5ba69f){const _0x3e2f5a=_0x325936['parentElement'];if(_0x3e2f5a){const _0x40e377=window['getComputedStyle'](_0x3e2f5a);return'auto'!==_0x40e377['width']?_0x40e377['width']:Hs;}return Hs;}return _0x5ba69f;}['_applyCalculationStyles'](_0x1f4533,_0x40b378){this['_config']['cssClasses']['calculationContainer']&&_0x1f4533['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x1f4533['style']['width']=_0x40b378,_0x1f4533['style']['position']='absolute',_0x1f4533['style']['top']='-9999px',_0x1f4533['style']['left']='-9999px',_0x1f4533['style']['opacity']='0',_0x1f4533['style']['pointerEvents']='none',_0x1f4533['style']['zIndex']='-1',_0x1f4533['style']['visibility']='visible\x20!important',_0x1f4533['style']['display']='block\x20!important',_0x1f4533['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x2abf73){_0x2abf73['forEach'](({element:_0xfe0e90,originalDisplay:_0x4916f7,originalVisibility:_0x46f121})=>{_0xfe0e90['style']['display']=_0x4916f7,_0xfe0e90['style']['visibility']=_0x46f121;});}['_makeAncestorsVisible'](_0x137bd4){const _0x446c25=[];let _0xb079ae=_0x137bd4;for(;_0xb079ae&&_0xb079ae!==document['body'];){const _0x47e96e=window['getComputedStyle'](_0xb079ae);'none'!==_0x47e96e['display']&&'hidden'!==_0x47e96e['visibility']||(_0x446c25['push']({'element':_0xb079ae,'originalDisplay':_0xb079ae['style']['display'],'originalVisibility':_0xb079ae['style']['visibility']}),_0xb079ae['style']['display']='block',_0xb079ae['style']['visibility']='visible'),_0xb079ae=_0xb079ae['parentElement'];}return _0x446c25;}['_createContainerElements'](){let _0x5710f2,_0x963c60;return this['_parentView']?.['element']?(_0x5710f2=this['_parentView']['element']['cloneNode'](!0x0),_0x963c60=this['_findTargetContainer'](_0x5710f2)):(_0x5710f2=document['createElement']('div'),_0x963c60=_0x5710f2),{'calculationContainer':_0x5710f2,'targetContainer':_0x963c60};}['_createCalculationContainer'](){const {calculationContainer:_0xe3eb59,targetContainer:_0x542f34}=this['_createContainerElements'](),_0x6cbdac=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0xe3eb59,_0x6cbdac);const _0x3509b7=this['_parentView']?.['element']||this['_containerElement'],_0x194f04=_0x3509b7?.['parentElement'];_0x194f04?_0x194f04['appendChild'](_0xe3eb59):document['body']['appendChild'](_0xe3eb59),_0xe3eb59['_targetContainer']=_0x542f34;const _0xa02f6a=this['_makeAncestorsVisible'](_0x194f04||null);return _0xe3eb59['offsetWidth'],_0xe3eb59['_ancestorsToRestore']=_0xa02f6a,_0xe3eb59;}['_calculateOverflowInContainer'](_0x4211e6,_0x1bee6c){const _0x5e36d3=_0x4211e6['_targetContainer']||_0x4211e6,_0x3e54cc=[],{rowCount:_0x1b7e03}=this['_renderChipsAndCountRows'](_0x5e36d3,_0x1bee6c);if(_0x1b7e03<=this['_config']['maxVisibleRows'])return _0x3e54cc;const _0x1d4409=_0x1bee6c['slice']();for(;_0x1d4409['length']>0x0;){if(this['_testButtonFit'](_0x4211e6,_0x5e36d3,_0x1d4409)){const _0x2c82c1=_0x1bee6c['filter'](_0x3fc879=>!_0x1d4409['includes'](_0x3fc879));_0x3e54cc['push'](..._0x2c82c1);break;}if(!_0x1d4409['pop']())break;}return _0x3e54cc;}['_renderChipsAndCountRows'](_0x5f564e,_0x20b34a){_0x5f564e['innerHTML']='',_0x20b34a['forEach'](_0x2f092c=>{if(_0x2f092c['element']){const _0x40bcd9=_0x2f092c['element']['cloneNode'](!0x0);_0x5f564e['appendChild'](_0x40bcd9);}}),_0x5f564e['offsetWidth'];const _0x2c6be8=_0x5f564e['children'],_0x1015ac=[];return Array['from'](_0x2c6be8)['forEach'](_0x470fdd=>{const _0x2ae0e1=_0x470fdd['getBoundingClientRect']()['top'];_0x1015ac['some'](_0x37a26f=>Math['abs'](_0x37a26f-_0x2ae0e1)<this['_config']['rowDetectionTolerance'])||_0x1015ac['push'](_0x2ae0e1);}),{'rowCount':_0x1015ac['length']};}['_createMockButton'](){const _0x3184c8=document['createElement']('button');return _0x3184c8['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x3184c8['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x3184c8['textContent']='+\x201',_0x3184c8;}['_testButtonFit'](_0x2f61ef,_0x1e9636,_0x2c8150){this['_renderChipsAndCountRows'](_0x1e9636,_0x2c8150);const _0x2aeb76=this['_createMockButton']();_0x2f61ef['appendChild'](_0x2aeb76),_0x2f61ef['offsetWidth'];const _0x5db90f=[..._0x1e9636['children'],_0x2aeb76],_0x3ca137=[];_0x5db90f['forEach'](_0x44b047=>{const _0x502c31=_0x44b047['getBoundingClientRect']()['top'];_0x3ca137['some'](_0x18b845=>Math['abs'](_0x18b845-_0x502c31)<this['_config']['rowDetectionTolerance'])||_0x3ca137['push'](_0x502c31);});const _0x235385=_0x3ca137['length'];return _0x2aeb76['remove'](),_0x235385<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x3d0aa3,_0x195de8){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x3d0aa3['forEach'](_0x3ba962=>{_0x195de8['includes'](_0x3ba962)?this['_overflowChips']['add'](_0x3ba962):this['_visibleChips']['add'](_0x3ba962);});}['_updateOverflowUI'](_0x27de29){if(_0x27de29>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x27de29>0x0&&this['_showMoreButtonView']){const _0x501727=''+this['_config']['showMoreLabelPrefix']+(_0x27de29<0x63?_0x27de29:'99');this['_showMoreButtonView']['label']=_0x501727;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x29cc11,_0x5edcec){this['_distributeChips'](_0x29cc11,_0x5edcec),this['_updateOverflowUI'](_0x5edcec['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x5d423d=>{_0x5d423d[0x0]['isIntersecting']&&this['_pendingCalculation']&&requestAnimationFrame(()=>{this['_checkAndHandleOverflow']();});},{'threshold':0.01,'rootMargin':'50px'}),this['_intersectionObserver']['observe'](this['_containerElement']));}['_isContainerVisible'](){if(!this['_containerElement'])return!0x1;if(!this['_containerElement']['isConnected'])return!0x1;const _0x363e0c=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x363e0c['width']||0x0===_0x363e0c['height'])return!0x1;const _0x436f5f=window['innerHeight']||document['documentElement']['clientHeight'],_0x44ef09=window['innerWidth']||document['documentElement']['clientWidth'],_0x192770=0xc8;return _0x363e0c['bottom']>=-0xc8&&_0x363e0c['top']<=_0x436f5f+_0x192770&&_0x363e0c['right']>=-0xc8&&_0x363e0c['left']<=_0x44ef09+_0x192770;}}const Ms='ck-ai-chat__feed__context-chips',Us='ck-ai-chat-context-chips-wrapper',Bs='ck-ai-chat-context-chips-wrapper-balloon',Gs='ck-ai-chat-controls-button',Fs='ck-ai-chat-controls_context_show-more-button',Ks='ck-ai-chat-context-controls__show-more-balloon-panel';class AIChatFeedContextChipsView extends Nt{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x26762e,_0x42d0c5,_0x9bff59){super(_0x26762e),this['_bodyCollection']=_0x9bff59,this['_createContextChips'](_0x42d0c5);const _0xea90e4={'cssClasses':{'showMoreButton':Fs+'\x20'+Bi,'showMoreBalloon':Ks,'overflowContainer':Bs,'controlsButton':Gs}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x26762e,this['_contextChips'],_0xea90e4,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[Ms,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':Us},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x51a145=this['element']['querySelector']('.'+Us);_0x51a145&&(this['_overflowManager']['setContainerElement'](_0x51a145),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x4b24a1){for(const _0x537cca of _0x4b24a1){const _0x551f2a=new AIChatContextItemButtonView(this['locale'],_0x537cca,!0x0,!0x1);this['_contextChips']['add'](_0x551f2a);}}}class AIChatFeedUserMessageItemView extends AIChatFeedItemView{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x4d5e28,_0x8098e4,_0x49678d){super(_0x8098e4),this['_locale']=_0x4d5e28,this['_bodyCollection']=_0x49678d,this['_createContextChipsView'](),this['_createMessageContentView'](),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__user-message']}});}['_createContextChipsView'](){this['options']['contextItems']&&this['options']['contextItems']['length']>0x0&&(this['_contextChipsView']=new AIChatFeedContextChipsView(this['_locale'],this['options']['contextItems']['filter'](_0x58d469=>!_0x58d469['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new Nt(this['_locale']),this['_messageContentView']['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__message-content'}}),this['children']['add'](this['_messageContentView']);}['render'](){super['render'](),this['_messageContentView']['element']['innerHTML']=this['options']['initialContent'],this['markAsDone']();}}class AIChatFeedInteractionHeaderView extends AIChatFeedItemView{['capabilities'];constructor(_0x364feb,_0x330c51){super(_0x330c51);const {isWebSearchEnabled:_0x4a5186,isReasoningEnabled:_0x5380fc}=_0x330c51['capabilities'],_0x572400=[];let _0x3e33fe='';_0x4a5186&&_0x5380fc?(_0x3e33fe=Hi(_0x364feb,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x572400['push'](Ws(_0x43ec4b)),_0x572400['push'](Ws(_0x57f7fd))):_0x4a5186?(_0x3e33fe=Hi(_0x364feb,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x572400['push'](Ws(_0x43ec4b))):_0x5380fc&&(_0x3e33fe=Hi(_0x364feb,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x572400['push'](Ws(_0x57f7fd))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x3e33fe?'':'ck-hidden']}});const _0x11c5c0=new Nt();_0x11c5c0['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x572400,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x3e33fe]}]}),this['children']['add'](_0x11c5c0),this['capabilities']=_0x330c51['capabilities'];}}function Ws(_0xbe1678){const _0x1f4f87=new xt();return _0x1f4f87['content']=_0xbe1678,_0x1f4f87;}const Ys=['wheel','touchstart','pointerdown','keydown'],$s=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];class ScrollManager{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x35c50e){this['element']=_0x35c50e,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x5129e2 of Ys){const _0x13570c='keydown'!==_0x5129e2;this['element']['addEventListener'](_0x5129e2,this['_onUserEvent']['bind'](this),{'passive':_0x13570c,'signal':this['abortController']['signal']});}}['start']({smooth:_0xc7d902=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0xc7d902?'smooth':'auto',this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}['stop'](){requestAnimationFrame(()=>{this['_stop']();});}['destroy'](){this['_stop'](),this['abortController']['abort']();}['_stop'](){null!==this['animationFrameId']&&(cancelAnimationFrame(this['animationFrameId']),this['animationFrameId']=null),this['isRunning']&&(this['isRunning']=!0x1),this['isUserPaused']=!0x1;}['_onUserEvent'](_0x1bf2e1){if(this['isRunning']){if('keydown'===_0x1bf2e1['type']){const _0xe75d2=_0x1bf2e1['key'];if(!$s['includes'](_0xe75d2))return;}_0x1bf2e1 instanceof WheelEvent?_0x1bf2e1['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x27cce5,scrollHeight:_0x6ae187,clientHeight:_0x1b24ef}=this['element'];return _0x6ae187-_0x27cce5-_0x1b24ef<=0x5;}['_rafUpdate'](){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}}class AIChatFeedCustomElementView extends AIChatFeedItemView{constructor(_0x1ba14c){super(_0x1ba14c),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__custom-element']}});}async['render'](){super['render'](),'string'==typeof this['options']['content']?this['element']['innerHTML']=this['options']['content']:this['element']['appendChild'](this['options']['content']);}}class AIChatFeedView extends Nt{['children'];['scrollManager'];['_bodyCollection'];constructor(_0x4d37a6,_0x5a3668){super(_0x4d37a6),this['_bodyCollection']=_0x5a3668,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...ms)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new ScrollManager(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x2e38ce,_0x12532f){let _0x14f90a;return'ai-reply'===_0x2e38ce?_0x14f90a=new AIChatFeedReplyItemView(this['locale'],_0x12532f,this['_bodyCollection']):'ai-suggestion-reply'===_0x2e38ce?(_0x14f90a=new AIChatFeedSuggestionItemView(this['locale'],_0x12532f,this['_bodyCollection']),_0x14f90a['bind']('isTrackChangesOn')['to'](this)):_0x14f90a='user-message'===_0x2e38ce?new AIChatFeedUserMessageItemView(this['locale'],_0x12532f,this['_bodyCollection']):'interaction-header'===_0x2e38ce?new AIChatFeedInteractionHeaderView(this['locale'],_0x12532f):'custom-element'===_0x2e38ce?new AIChatFeedCustomElementView(_0x12532f):new AIChatFeedErrorItemView(_0x12532f),this['children']['add'](_0x14f90a),_0x14f90a;}async['updateReplyItem']({id:_0x4234a5,parsedContent:_0xbcb592,renderingStrategy:_0x568c71,abortSignal:_0x2321ae}){const _0x43c305=this['getItemById'](_0x4234a5);if(!(_0x43c305 instanceof AIChatFeedReplyItemView))throw new at('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x43c305,'id':_0x4234a5,'parsedContent':_0xbcb592});await _0x43c305['updateContent']({'parsedContent':_0xbcb592,'renderingStrategy':_0x568c71,'abortSignal':_0x2321ae});}async['updateWebSources'](_0x468ebe,_0x24af93){const _0x3d1ca0=this['getItemById'](_0x468ebe);if(_0x3d1ca0 instanceof AIChatFeedSuggestionItemView)_0x3d1ca0['updateSources'](_0x24af93);else{if(!(_0x3d1ca0 instanceof AIChatFeedReplyItemView))throw new at('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x3d1ca0,'id':_0x468ebe,'sources':_0x24af93});_0x3d1ca0['updateSources'](_0x24af93);}}async['updateSuggestionItem']({id:_0x254172,parts:_0x178561,abortSignal:_0x4545f0,skipLoadingEffects:_0x47dc89}){const _0x323350=this['getItemById'](_0x254172);if(!(_0x323350 instanceof AIChatFeedSuggestionItemView))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x323350,'id':_0x254172,'parts':_0x178561});await _0x323350['updateContent']({'parts':_0x178561,'abortSignal':_0x4545f0,'skipLoadingEffects':_0x47dc89});}['updateSuggestionPartState']({id:_0xf0e864,index:_0xd611e5,state:_0x407ad1}){const _0x1b0801=this['getItemById'](_0xf0e864);if(!(_0x1b0801 instanceof AIChatFeedSuggestionItemView))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0xf0e864});_0x1b0801['updatePartState'](_0xd611e5,_0x407ad1);}['setSuggestionPartActive']({id:_0x4f2db4,index:_0x1b8ccc,isActive:_0x273e30}){const _0x338910=this['getItemById'](_0x4f2db4);if(!(_0x338910 instanceof AIChatFeedSuggestionItemView))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x4f2db4});this['children']['filter'](_0x253a74=>_0x253a74 instanceof AIChatFeedSuggestionItemView)['forEach'](_0x2fce88=>{_0x2fce88['setPartActive'](!0x1);}),_0x338910['setPartActive'](_0x1b8ccc,_0x273e30);}['markItemAsDone'](_0x2fe230){this['getItemById'](_0x2fe230)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x5e7586=>_0x5e7586['options']['id']);}['removeItem'](_0x7c981a){this['children']['remove'](this['getItemById'](_0x7c981a));}['hasItem'](_0x2fb21d){return!!this['children']['find'](_0x584f4f=>_0x584f4f['options']['id']['includes'](_0x2fb21d));}['scrollToSuggestion'](_0x82e413,_0x557e61){const _0x590a69=this['getItemById'](_0x82e413);if(!(_0x590a69 instanceof AIChatFeedSuggestionItemView))return void gt('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x82e413,'partIndex':_0x557e61});const _0x454c91=_0x590a69['getPartView'](_0x557e61);_0x454c91?ft(_0x454c91['element'],0x14,this['element']['parentElement'],!0x0,!0x0):gt('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x82e413,'partIndex':_0x557e61});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x4ae268=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x4ae268,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x3b5456=new AISkeletonView(this['locale'],Ss['aiFeed']);return _0x3b5456['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x3b5456;}['_createFeedItems'](){const _0x3ef74d=new Nt(this['locale']);return _0x3ef74d['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x3ef74d;}['_createFeedLoader'](){const _0x4fdc19=new Nt(this['locale']);return _0x4fdc19['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x491f4b=>!_0x491f4b)]},'children':this['_createLoaderChildren']()}),_0x4fdc19;}['_createLoaderChildren'](){const _0x3774c4=new AISpinnerView();return _0x3774c4['isVisible']=!0x0,[_0x3774c4,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x6756dd){const _0x34a5a9=this['children']['find'](_0x2e0fff=>_0x2e0fff['options']['id']['includes'](_0x6756dd));if(!_0x34a5a9)throw new at('ai-chat-feed-view-item-not-found',this,{'id':_0x6756dd});return _0x34a5a9;}['setLoadingMessage'](_0x1c46aa){this['set']('loadingMessage',_0x1c46aa);}['toggleLoadingSkeleton'](_0x57199e){this['set']('isLoadingSkeletonVisible',_0x57199e);}['startAutoScroll'](_0x442d40={}){this['scrollManager']['start'](_0x442d40);}['stopAutoScroll'](){this['scrollManager']['stop']();}}class AIChatPromptSuggestionsListView extends Dt{['filter'](){let _0x2e09b7=0x0;for(const _0x5f5123 of this['items'])_0x2e09b7+=_0x5f5123['items']['length'];return{'resultsCount':_0x2e09b7,'totalItemsCount':_0x2e09b7};}}const qs='ck-ai-chat__prompt-input_highlighted';class AIChatPromptInputView extends Lt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x582b6f,_0x1a1b1b){super(_0x582b6f,{'queryView':{'label':'','creator':Ut,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new AIChatPromptSuggestionsListView(_0x582b6f),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x1a1b1b,this['_queryViewResizeObserver']=null,this['queryView']['fieldView']['minRows']=AIChatPromptInputView['MIN_ROWS'],this['queryView']['fieldView']['maxRows']=AIChatPromptInputView['MAX_ROWS'],this['queryView']['fieldWrapperChildren']['add'](this['_addContextButtonView']),this['_setUpAddContextButtonPositioning'](),this['extendTemplate']({'attributes':{'class':['ck','ck-ai-chat__prompt-input']}}),this['submitButtonView']=this['_createSubmitButton'](),this['submitButtonView']['bind']('isEnabled')['to'](this,'isEmpty',this,'isUploadInProgress',(_0x17e0de,_0x334e75)=>!_0x17e0de&&!_0x334e75),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x3e515b,_0x4c1a16)=>{this['isUploadInProgress']||this['isEmpty']||_0x3e515b['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x4c1a16());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();});}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x1afd5d=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x1afd5d)return this['queryView']['errorText']=Hi(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x4e736e=_0x353660(_0x1afd5d);this['fire']('sendUserMessage',_0x4e736e),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x3d8796){this['queryView']['fieldView']['set']('placeholder',_0x3d8796);}['focus'](_0x44fd06=!0x1){super['focus'](),_0x44fd06&&(this['element']['classList']['contains'](qs)||(this['element']['classList']['add'](qs),setTimeout(()=>{this['element']['classList']['remove'](qs);},0x320)));}['_createSubmitButton'](){const _0x4cd7f8=new vt(this['locale']);return _0x4cd7f8['set']({'icon':_0x3b5d60,'label':Hi(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+Mi,'isEnabled':!0x1}),_0x4cd7f8['on']('execute',()=>{this['submit']();}),_0x4cd7f8;}['setIsUploadInProgress'](_0x11b595){this['isUploadInProgress']=_0x11b595;}['_setUpAddContextButtonPositioning'](){const _0x1b58ce=this['locale'],_0x213d9f=()=>{ct['window']['requestAnimationFrame'](()=>{if(lt(this['element'])){const _0x2acde5=new ut(this['queryView']['fieldView']['element']),_0x528afa=new ut(this['_addContextButtonView']['element']),_0x31d7c6=_0x2acde5['width'],_0x5982cc='rtl'===_0x1b58ce['uiLanguageDirection']?'right':'left';_0x2acde5['excludeScrollbarsAndBorders']();const _0x5ad9d8=_0x31d7c6-_0x2acde5['width']+0x1;this['_addContextButtonView']['element']['style'][_0x5982cc]='calc('+(_0x31d7c6-_0x528afa['width']-_0x5ad9d8)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x213d9f),this['on']('render',()=>{_0x213d9f(),this['_queryViewResizeObserver']=new St(this['queryView']['fieldView']['element'],()=>{_0x213d9f();});});}}const Qs='ck-ai-chat__prompt-capabilities',Xs='ck-ai-chat-controls-button',zs='ck-ai-chat-controls-button--commands',js='ck-ai-chat-controls__model-selection',Js='ck-ai-chat-controls__model-selection__item-name',Zs='ck-ai-chat-controls__model-selection__item-description',tn='ck-ai-chat-controls__model-selection__item-capabilities',en='n';class AIChatPromptCapabilitiesView extends Nt{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x1c774d){super(_0x1c774d),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelDisplayMode','selector'),this['set']('modelSelectorEnabled',!0x0),this['set']('activeModelId',null),this['set']('activeModelName',null),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelNameView']=this['_createModelNameView'](),this['_webSearchButton']=this['_createWebSearchButton'](),this['_reasoningButton']=this['_createReasoningButton'](),this['_commandsButton']=this['_createCommandsButton'](),this['_modelSelectionDropdown']['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x1f8887=>'selector'===_0x1f8887),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x5b9fac=>_0x5b9fac?this['_modelSelectionDropdown']['buttonView']['label']:Hi(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x13e5a7=>_0x13e5a7),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x1eb552=>_0x1eb552),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x5d306f=>Hi(this['locale'],_0x5d306f?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x2294a4=>_0x2294a4),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x2b3803=>Hi(this['locale'],_0x2b3803?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[Qs]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new dt(),jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x514e66,_0x195a07){if(_0x195a07)this['set']('modelDisplayMode','hidden');else{const _0x2d7597=0x1===_0x514e66['length'];this['set']('modelDisplayMode',_0x2d7597?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x514e66?.['length'])for(const _0x2f6d20 of _0x514e66){const _0x2b7e46=new Jt({'label':_0x2f6d20['name'],'withText':!0x0,'role':'menuitemradio','id':_0x2f6d20['id'],'model':_0x2f6d20});_0x2b7e46['bind']('isOn')['to'](this,'activeModelId',_0x114ba4=>_0x114ba4===_0x2f6d20['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x2b7e46,'labelView':new sn(this['locale'],_0x2f6d20)});}}['setWebSearch'](_0x7bbcc8){this['set']('webSearchActive',_0x7bbcc8);}['setReasoning'](_0x52aa4f){this['set']('reasoningActive',_0x52aa4f);}['setModel'](_0x1f0d54){if(!_0x1f0d54)return;this['activeModelId']=_0x1f0d54['id'],this['activeModelName']=_0x1f0d54['name']||_0x1f0d54['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x1f0d54['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x1f0d54['name']);const _0x2eb0ca=_0x1f0d54['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x2eb0ca),this['_webSearchButton']['set']('isVisible',_0x2eb0ca);const _0x10e1a8=_0x1f0d54['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x10e1a8),this['_reasoningButton']['set']('isVisible',_0x10e1a8);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0xb32305){this['set']('modelSelectorEnabled',!0x1),_0xb32305&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x24d44e=new vt();return _0x24d44e['set']({'label':Hi(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':_0x43ec4b,'class':Xs+'\x20'+Bi,'isToggleable':!0x0,'tooltipPosition':en}),_0x24d44e['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x24d44e;}['_createReasoningButton'](){const _0x6717b6=new vt();return _0x6717b6['set']({'label':Hi(this['locale'],'AI_CHAT_REASONING'),'icon':_0x57f7fd,'class':Xs+'\x20'+Bi,'isToggleable':!0x0,'tooltipPosition':en}),_0x6717b6['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x6717b6;}['_createCommandsButton'](){const _0x133e77=new vt();return _0x133e77['set']({'label':Hi(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x236d8,'withText':!0x0,'class':Xs+'\x20'+Bi,'isToggleable':!0x0,'tooltip':Hi(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':en}),_0x133e77['extendTemplate']({'attributes':{'class':[zs]}}),_0x133e77['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x133e77;}['_createModelSelectionDropdown'](){const _0x7e4923=Gt(this['locale']);return _0x7e4923['set']({'panelPosition':'ne','class':[js]}),_0x7e4923['buttonView']['set']({'label':Hi(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':en,'class':Bi}),this['listenTo'](_0x7e4923,'execute',_0x5c8cac=>{this['fire']('selectModel',_0x5c8cac['source']['model']);}),_0x7e4923;}['_createModelNameView'](){const _0x144fc0=new nn(this['locale']);return _0x144fc0['bind']('text')['to'](this,'activeModelName',_0x1f9173=>_0x1f9173??''),_0x144fc0['bind']('isVisible')['to'](this,'modelDisplayMode',_0x30c63d=>'name'===_0x30c63d),_0x144fc0;}}let sn=class ModelButtonLabelView extends Ht{constructor(_0x57d9e4,_0xd4fb66){super();const _0x205ccd=this['bindTemplate'],_0x5e6fed=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x205ccd['to']('style'),'id':_0x205ccd['to']('id')},'children':[{'tag':'div','attributes':{'class':[Js]},'children':[{'text':_0x205ccd['to']('text')}]},{'tag':'div','attributes':{'class':[Zs]},'children':[{'tag':'span','children':[{'text':_0xd4fb66['description']}]}]},{'tag':'div','attributes':{'class':[tn]},'children':_0x5e6fed}]}),_0x5e6fed['addMany'](this['_getCapabilityParts'](_0x57d9e4,_0x43ec4b,'AI_CHAT_SEARCH_WEB',_0xd4fb66['capabilities']['webSearch']?.['enabled']??!0x1)),_0x5e6fed['addMany'](this['_getCapabilityParts'](_0x57d9e4,_0x57f7fd,'AI_CHAT_REASONING',_0xd4fb66['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x312d76,_0x1b300c,_0x522e10,_0x2eaa0b){const _0x174b99=new xt();_0x174b99['content']=_0x1b300c;const _0x4a19b2=new Nt(_0x312d76);_0x4a19b2['setTemplate']({'tag':'span','children':[{'text':Hi(_0x312d76,_0x522e10)+':\x20'}]});const _0x153f3f=new Nt(_0x312d76);return _0x153f3f['setTemplate']({'tag':'span','children':[{'text':Hi(_0x312d76,_0x2eaa0b?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x174b99,_0x4a19b2,_0x153f3f];}},nn=class ModelNameView extends Nt{constructor(_0x367a02){super(_0x367a02),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x2012cf=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x2012cf['if']('isVisible','ck-hidden',_0x8acce8=>!_0x8acce8)]},'children':[{'text':_0x2012cf['to']('text')}]});}};const rn='ck-ai-chat-context-controls__url-form',on='ck-ai-chat-context-controls__url-input-section';class AIChatContextPanelUrlInputView extends Nt{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x3f725a){super(_0x3f725a),this['focusTracker']=new _t(),this['keystrokes']=new It(),this['backButton']=this['_createBackButton'](),this['urlInputField']=this['_createUrlInputField'](),this['confirmButton']=this['_createConfirmButton'](),this['_focusables']=this['createCollection']([this['backButton'],this['urlInputField'],this['confirmButton']]),this['focusCycler']=new Mt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift+tab','focusNext':'tab'}}),this['set']('withBackButton',!0x0),this['_setupTemplate'](),this['_setupEventHandlers'](),this['_setupKeystrokes']();}['render'](){super['render'](),this['_focusables']['forEach'](_0xf49c8=>{this['focusTracker']['add'](_0xf49c8['element']),this['keystrokes']['listenTo'](_0xf49c8['element']);}),Zt({'view':this}),this['focus']();}['destroy'](){super['destroy'](),this['focusTracker']['destroy'](),this['keystrokes']['destroy']();}['focus'](){this['urlInputField']['focus']();}['getValue'](){return this['urlInputField']['fieldView']['element']?.['value']?.['trim']()||'';}['clear'](){this['urlInputField']['fieldView']['element']['value']='',this['urlInputField']['errorText']=null,this['confirmButton']['isEnabled']=!0x1;}['setError'](_0x309301){this['urlInputField']['errorText']=_0x309301,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x102ee4=new vt(this['locale']);return _0x102ee4['set']({'icon':_0x165d4c,'tooltip':Hi(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x4e7953,_0x433331,_0x2a9206)=>{_0x102ee4['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x2a9206?'':'\x20ck-hidden')]});}),_0x102ee4;}['_createUrlInputField'](){const _0x393984=new te(this['locale'],_0x5d48d5);return _0x393984['set']({'label':Hi(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x393984['fieldView']['set']({'placeholder':Hi(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x393984;}['_createConfirmButton'](){const _0x5021f7=new vt(this['locale']);return _0x5021f7['set']({'icon':_0x11d9a5,'tooltip':Hi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x5021f7;}['_setupTemplate'](){const _0x5d90d7=new _0x1ea0e5(this['locale'],{'label':Hi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x5d90d7['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':rn,'tabindex':'-1'},'children':[_0x5d90d7,{'tag':'div','attributes':{'class':on},'children':[this['urlInputField'],this['confirmButton']]}]});}['_setupEventHandlers'](){this['backButton']['on']('execute',()=>{this['clear'](),this['fire']('cancel');}),this['urlInputField']['fieldView']['on']('input',()=>{this['clearError'](),this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}),this['on']('submit',_0x4f1633=>{_0x4f1633['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x1b364b,_0x551c12)=>{this['clear'](),this['fire']('cancel'),_0x551c12();});}['_handleSubmit'](){const _0x5d44b2=this['getValue']()['trim']();_0x5d44b2?this['_isValidUrl'](_0x5d44b2)?(this['clearError'](),this['fire']('submitUrl',_0x5d44b2)):this['setError'](Hi(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Hi(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x4f9600=this['getValue']()['trim'](),_0x2f67ac=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x4f9600['length']>0x0&&!_0x2f67ac;}['_isValidUrl'](_0x4b9af0){try{return!!new URL(_0x4b9af0);}catch{return!0x1;}}}const an='ck-ai-chat-resources__item',hn='ck-ai-chat-resources__item--in-context',cn='ck-ai-chat-resources__item-title',ln='ck-ai-chat-resources__item__icon';class AIChatResourceListItemView extends Pt{['resource'];['_titleView'];['_iconView'];constructor(_0x16f9fe,_0x3459bd){super(_0x16f9fe),this['resource']=_0x3459bd,this['set']('isInContext',!!_0x3459bd['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x4c70fb){if(_0x4c70fb['isInContext'])return _0x11d9a5;switch(_0x4c70fb['type']){case'document':return _0x40ebca;case'web-resource':return _0x31e498;case'file':case'text':return _0x29ada8;default:return _0x4336ec;}}['highlightText'](_0x5074e4){if(!_0x5074e4||''===_0x5074e4['trim']())return void this['_titleView']['highlightText'](null);const _0x32ec7c=new RegExp(_0x230461(_0x5074e4),'gi');this['_titleView']['highlightText'](_0x32ec7c);}['updateResourceState'](_0x4e527d){this['resource']['isInContext']=_0x4e527d,this['isInContext']=_0x4e527d,this['_updateIcon']();}['_createTitleView'](){const _0x238021=new _0x3f501c();return _0x238021['text']=this['resource']['label'],_0x238021['extendTemplate']({'tag':'span','attributes':{'class':[cn]}}),_0x238021;}['_createIconView'](){const _0x1efb49=new xt();return _0x1efb49['content']=this['getResourceIcon'](this['resource']),_0x1efb49;}['_setupTemplate'](){const _0x502f40=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[an,_0x502f40['if']('isVisible','ck-hidden',_0x2edcab=>!_0x2edcab),_0x502f40['if']('isInContext',hn)]},'children':[{'tag':'div','attributes':{'class':[ln]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x502f40['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}}const un='ck-ai-chat-resources__list';class AIChatContextResourcesListView extends Dt{['_source'];constructor(_0x17c705,_0x369875){super(_0x17c705),this['_source']=_0x369875,this['extendTemplate']({'attributes':{'class':[un]}});}['setResources'](_0x96358e,_0x396701){this['items']['clear']();let _0x29aead=_0x96358e;if(this['_source']['useDefaultFiltering']&&_0x396701&&''!==_0x396701['trim']()){const _0x518f7b=new RegExp(_0x396701['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x29aead=_0x96358e['filter'](_0x503a84=>_0x518f7b['test'](_0x503a84['label']));}for(const _0x529cc5 of _0x29aead){const _0x56442d=new AIChatResourceListItemView(this['locale'],_0x529cc5);_0x56442d['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x529cc5);}),this['items']['add'](_0x56442d);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x396701);}['highlightText'](_0x5c57c5){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x27e9a5=>{_0x27e9a5['highlightText'](_0x5c57c5);});}['updateResourceState'](_0x6e9b4b,_0x5e3d18){for(const _0x5ac471 of this['items']){const _0x4b2565=_0x5ac471;_0x4b2565['resource']['id']===_0x6e9b4b&&_0x4b2565['updateResourceState'](_0x5e3d18);}}['_handleResourceSelection'](_0xa2c143,_0x1c8e0d){this['fire']('addResourceToContext',{'source':_0xa2c143,'resource':_0x1c8e0d});}}class AIChatContextResourcesSearchInputView extends te{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x45a0f4){const t=_0x45a0f4['t'],_0x4dc8a1={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x5d48d5,'label':Hi(_0x45a0f4,'AI_CHAT_SEARCH_RESOURCES')};super(_0x45a0f4,_0x4dc8a1['creator']),this['label']=_0x4dc8a1['label'],this['_viewConfig']=_0x4dc8a1,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x45a0f4,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x5dc6a1){this['fire']('search',_0x5dc6a1);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new xt(),this['iconView']['content']=_0x529977,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x58b1b4,t){this['resetButtonView']=new vt(_0x58b1b4),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x1294a9,'class':'ck-search__reset','isVisible':!0x1,'tooltip':!0x0}),this['resetButtonView']['on']('execute',()=>{this['reset'](),this['focus'](),this['fire']('reset');}),this['resetButtonView']['bind']('isVisible')['to'](this['fieldView'],'isEmpty',_0x6d9e37=>!_0x6d9e37),this['fieldWrapperChildren']['add'](this['resetButtonView']),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-reset'}});}['_setupEventListeners'](){this['listenTo'](this['fieldView'],'input',()=>{this['search'](this['fieldView']['element']['value']);}),this['bind']('isEnabled')['to'](this);}}class AIChatContextResourcesView extends Nt{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0x16d109,_0x3bb7ca){super(_0x16d109),this['_source']=_0x3bb7ca['source'],this['_searchInputVisibleFrom']=_0x3bb7ca['searchInputVisibleFrom']??0x7,this['set']('isLoading',!0x0),this['_searchView']=this['_createSearchView'](),this['_searchSection']=this['_createSearchSection'](),this['_resourcesListView']=this['_createResourcesListView'](),this['_skeletonLoader']=this['_createSkeletonView'](),this['children']=new _0x5337b1([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}['_createSearchView'](){return new AIChatContextResourcesSearchInputView(this['locale']);}['_createSearchSection'](){const _0x44e795=new Nt(this['locale']);return _0x44e795['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x36cc70,_0x16f43b)=>{this['loadResources'](_0x16f43b),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x16f43b);}),_0x44e795;}['_createResourcesListView'](){const _0x2d8df5=new AIChatContextResourcesListView(this['locale'],this['_source']);return _0x2d8df5['delegate']('addResourceToContext')['to'](this),_0x2d8df5['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x2d8df5;}['_createSkeletonView'](){const _0x90399c=new AISkeletonView(this['locale'],Ss['aiChatResources']);return _0x90399c['bind']('isVisible')['to'](this,'isLoading'),_0x90399c;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x3f294b){const _0x33c53d=ot();this['_latestLoadResourcesUid']=_0x33c53d,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x3f294b,'uid':_0x33c53d}),this['isLoading']=!0x0;}['setResources'](_0x976218,_0x20a317){if(_0x20a317&&_0x20a317!==this['_latestLoadResourcesUid'])return;const _0x2ee213=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x976218,_0x2ee213),_0x976218['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0xcf61c1,_0x4546c5){this['_resourcesListView']['updateResourceState'](_0xcf61c1,_0x4546c5);}}const dn='ck-ai-chat-context-controls__source-balloon-panel',_n='ck-button-icon\x20ck-button-back',In='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';class AIChatResourcesBalloonView{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x53040a,_0x3e3278,_0x14b4bf){this['_locale']=_0x53040a,this['_bodyCollection']=_0x3e3278,this['_config']=_0x14b4bf;}['showSourceResourcesBalloon']({source:_0x25c4ad,withBackButton:_0x54202f}){let _0x301fc5=this['_sourceResourceBalloons']['get'](_0x25c4ad['id']);_0x301fc5||(_0x301fc5=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x25c4ad['id'],_0x301fc5),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x301fc5)),this['_addSourceResourceContent']({'balloonPanel':_0x301fc5,'source':_0x25c4ad,'withBackButton':_0x54202f}),_0x301fc5['show']();const _0x456e84=this['_config']['getTargetElement']();_0x456e84&&_0x301fc5['pin']({'target':_0x456e84,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x2c0397,_0x462d9c,_0xd0dc61){const _0x98236c=this['_sourceResourceBalloons']['get'](_0x2c0397);if(!_0x98236c)return;const _0x177b66=this['_getResourcesViewFromBalloon'](_0x98236c);_0x177b66&&(_0x177b66['setResources'](_0x462d9c,_0xd0dc61),_0x177b66['once']('change:isLoading',()=>{_0x98236c['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x9b0f18){const _0x1eb3d2=this['_sourceResourceBalloons']['get'](_0x9b0f18);_0x1eb3d2&&requestAnimationFrame(()=>{_0x1eb3d2['hide'](),this['_sourceResourceBalloons']['delete'](_0x9b0f18),this['_config']['onBalloonClosed']();});}['isAnyResourceBalloonVisible'](){for(const _0x527ca0 of this['_sourceResourceBalloons']['values']())if(_0x527ca0['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x10001b,_0x3bb9e7,_0x471786){const _0x1c88eb=this['_sourceResourceBalloons']['get'](_0x10001b);if(!_0x1c88eb||!_0x1c88eb['isVisible'])return;const _0x2c57f6=this['_config']['getTargetElement']();if(!_0x2c57f6)return;_0x1c88eb['pin']({'target':_0x2c57f6,'limiter':this['_config']['getLimiterElement']()});const _0x1944fe=this['_getResourcesViewFromBalloon'](_0x1c88eb);_0x1944fe&&_0x1944fe['updateResourceState'](_0x3bb9e7,_0x471786);}['destroy'](){for(const _0x5ee346 of this['_sourceResourceBalloons']['values']())_0x5ee346['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0xd740b7=new Xt(this['_locale']);return _0xd740b7['extendTemplate']({'attributes':{'class':dn}}),this['_bodyCollection']['add'](_0xd740b7),_0xd740b7;}['_addSourceResourceContent']({balloonPanel:_0x1b29d9,source:_0x1fa654,withBackButton:_0x3460e9}){_0x1b29d9['content']['clear']();const _0x3fa6ba=this['_createBalloonHeader']({'balloonPanel':_0x1b29d9,'source':_0x1fa654,'withBackButton':_0x3460e9});_0x1b29d9['content']['add'](_0x3fa6ba);const _0x1cc6ae=this['_createBalloonResourcesView'](_0x1fa654);_0x1b29d9['content']['add'](_0x1cc6ae);}['_createBalloonHeader']({balloonPanel:_0x1c2b2b,source:_0xaf2ae4,withBackButton:_0x4a7b8f}){const _0x1c0937=new _0x1ea0e5(this['_locale'],{'label':_0xaf2ae4['label'],'class':In});return _0x4a7b8f&&_0x1c0937['children']['add'](this['_createBackButton'](_0x1c2b2b),0x0),_0x1c0937;}['_createBackButton'](_0x24e289){const _0x704d7b=new vt(this['_locale']);return _0x704d7b['set']({'icon':_0x165d4c,'tooltip':Hi(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':_n}),_0x704d7b['on']('execute',()=>{_0x24e289['hide'](),this['_config']['onBackToContext']();}),_0x704d7b;}['_createBalloonResourcesView'](_0x545311){const _0xf68d69=new AIChatContextResourcesView(this['_locale'],{'source':_0x545311,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0xf68d69['on']('loadSourceResources',(_0x4039be,_0x160759)=>{this['_config']['onLoadSourceResources'](_0x160759);}),_0xf68d69['on']('addResourceToContext',(_0x500bf8,_0x506de7)=>{this['_config']['onResourceSelected'](_0x506de7['source'],_0x506de7['resource']),this['closeSourceResourceBalloon'](_0x545311['id']);}),_0xf68d69;}['_getResourcesViewFromBalloon'](_0x55fa69){const _0xd22c27=_0x55fa69['content']['get'](0x1);return _0xd22c27 instanceof AIChatContextResourcesView?_0xd22c27:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x15994f){zt({'emitter':_0x15994f,'contextElements':[_0x15994f['element']],'callback':()=>{_0x15994f['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x15994f['isVisible']});}}const An=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],gn='ck-ai-chat-context-controls',Cn='ck-ai-chat-context-controls__pending-contexts',mn='ck-ai-chat-context-controls__add-context-balloon-panel',pn='ck-ai-chat-context-controls__add-context-button',En='ck-ai-chat-context-controls__url-balloon-panel',wn='ck-ai-chat-context-controls__balloon-button',Tn='ck-ai-chat-context-controls__balloon-button-source',fn='ck-ai-chat-controls-button',Sn='ck-ai-chat-context-chips-wrapper-balloon',Rn='ck-ai-chat-controls_context_show-more-button',bn='ck-ai-chat-context-controls__show-more-balloon-panel',On='ck-ai-chat',kn=[Xt['defaultPositions']['northArrowSouthWest'],Xt['defaultPositions']['northArrowSouth'],Xt['defaultPositions']['northArrowSouthEast'],Xt['defaultPositions']['southArrowNorthWest'],Xt['defaultPositions']['southArrowNorth'],Xt['defaultPositions']['southArrowNorthEast']];class AIChatContextPanelView extends Nt{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x42af2f,_0x2a728c){super(_0x42af2f),this['bodyCollection']=_0x2a728c['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x42af2f),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x42af2f),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x42af2f),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x42af2f,_0x2a728c);const _0x289f72={'cssClasses':{'showMoreButton':Rn+'\x20'+Bi,'showMoreBalloon':bn,'overflowContainer':Sn,'controlsButton':fn}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x42af2f,this['_currentContextsChips'],_0x289f72,this['bodyCollection'],this),this['_addContextBalloonConfig']={'buttonView':this['addContextButtonView'],'balloonView':this['_addContextBalloonPanelView'],'hideMethod':this['hideAddContextBalloonPanel']['bind'](this),'showMethod':this['showAddContextBalloonPanel']['bind'](this)},this['_setupTemplate'](),this['_bindEventHandlers']();}['render'](){super['render'](),this['_setupAllBalloonClickOutsideHandlers'](),this['_overflowManager']['setContainerElement'](this['element']),this['_overflowManager']['reorganizeChips']();}['destroy'](){super['destroy'](),this['_overflowManager']['destroy'](),this['_resourcesBalloonView']['destroy']();}['addContextItem'](_0x250227,_0x1c5149){const _0x6f1b60=this['_createContextButton'](_0x250227,'current',!0x0,_0x1c5149);this['_addContextToCollection'](_0x6f1b60,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x237b9f){this['_removeContextFromCollection'](_0x237b9f,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x237b9f,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x49ff33,_0x22009a){let _0x3810e3=this['_currentContextsChips']['find'](_0x500d65=>_0x500d65['id']===_0x49ff33);_0x3810e3||(_0x3810e3=this['_overflowManager']['overflowChips']['find'](_0x4fb24b=>_0x4fb24b['id']===_0x49ff33)),_0x3810e3&&(_0x3810e3['isLoading']=_0x22009a);}['setConversationContext'](_0x4ac890){this['_conversationContextsChips']['clear']();for(const _0x40fd26 of _0x4ac890){const _0x2cd892=this['_createContextButton'](_0x40fd26,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x2cd892,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x4b7f8b,_0x23c8b8,_0x2025d3){this['_resourcesBalloonView']['updateResourceState'](_0x4b7f8b,_0x23c8b8,_0x2025d3);}['hideAddContextBalloonPanel'](){this['_toggleAddContextBalloon'](!0x1);}['showAddContextBalloonPanel'](){this['_toggleAddContextBalloon'](!0x0);}['hideUrlBalloonPanel'](){this['_urlBalloonPanelView']['hide'](),this['addContextButtonView']['isOn']=!0x1,this['_urlInputView']&&this['_urlInputView']['clear']();}['showUrlBalloonPanel'](){this['_urlBalloonPanelView']['show'](),this['addContextButtonView']['isOn']=!0x0;}['_showSourceResourcesBalloon']({source:_0x1f68af,withBackButton:_0x53efa2}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x1f68af,'withBackButton':_0x53efa2}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x169a12,_0x1c9b7d,_0x23b2f9,_0x448ffc){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x169a12,_0x23b2f9,_0x448ffc);}['closeSourceResourceBalloon'](_0x318199){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x318199),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x54ae82){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x54ae82),this['_setAddContextButtonEnabled'](_0x54ae82);}['_setAddContextButtonEnabled'](_0x54b3b1){const _0x17d619=!_0x54b3b1['document']['isHidden']&&_0x54b3b1['document']['enabled'],_0x2b9b02=_0x54b3b1['urls']['enabled'],_0x3030e6=_0x54b3b1['files']['enabled'],_0x59ef27=_0x54b3b1['sources']['length']>0x0,_0x325e98=_0x54b3b1['customItems']&&_0x54b3b1['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x17d619||_0x2b9b02||_0x3030e6||_0x59ef27||_0x325e98;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[gn,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':Cn},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x7d2bc){const _0x2f899f=new vt(_0x7d2bc);return _0x2f899f['set']({'label':Hi(_0x7d2bc,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':fn+'\x20'+pn+'\x20'+Bi,'icon':_0x311a91,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x2f899f;}['_createAddContextBalloonPanelView'](_0x30babf){return this['_createBaseBalloonPanel'](_0x30babf,mn);}['_createUrlBalloonPanelView'](_0x5b05c7){const _0x4dd65b=this['_createBaseBalloonPanel'](_0x5b05c7,En);return this['_addUrlContent'](_0x4dd65b,_0x5b05c7),_0x4dd65b;}['_createResourcesBalloonView'](_0xefd456,_0x19d6c8){const _0x4f6c42={'searchInputVisibleFrom':_0x19d6c8['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':kn});},'onResourceSelected':(_0x30e4f7,_0x167201)=>{this['fire']('addResourceToContext',{'source':_0x30e4f7,'resource':_0x167201});},'onLoadSourceResources':_0x3b579e=>{this['fire']('loadSourceResources',_0x3b579e);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new AIChatResourcesBalloonView(_0xefd456,_0x19d6c8['bodyCollection'],_0x4f6c42);}['_getLimiterElement'](){return this['element']?.['closest']('.'+On)||document['body'];}['_createBaseBalloonPanel'](_0xfed6e,_0x2d443d){const _0x2ea7b3=new Xt(_0xfed6e);return _0x2ea7b3['extendTemplate']({'attributes':{'class':_0x2d443d}}),this['bodyCollection']['add'](_0x2ea7b3),_0x2ea7b3;}['_setBalloonPanelContent'](_0x511d49,_0x2500fc,_0x50abc2){if(_0x511d49['content']['clear'](),!_0x50abc2['document']['isHidden']&&_0x50abc2['document']['enabled']){const _0x16a6b8=this['_createBalloonButton'](_0x2500fc,{'label':Hi(_0x2500fc,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x40ebca});_0x16a6b8['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x511d49['content']['add'](_0x16a6b8);}if(_0x50abc2['urls']['enabled']){const _0x181070=this['_createBalloonButton'](_0x2500fc,{'label':Hi(_0x2500fc,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x31e498});_0x181070['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':kn}),this['_urlInputView']['focus']();}),_0x511d49['content']['add'](_0x181070);}if(_0x50abc2['files']['enabled']){const _0x40a911=new _0x2586d8(_0x2500fc);_0x40a911['set']({'label':Hi(_0x2500fc,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x28ff67,'withText':!0x0,'tooltip':!0x0,'class':wn,'allowMultipleFiles':!0x0}),_0x40a911['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x40a911['on']('done',(_0x11262e,_0x399802)=>{this['fire']('addFileToContext',_0x399802);}),_0x40a911['tooltip']=!0x0,_0x511d49['content']['add'](_0x40a911);}for(const _0x7d336a of _0x50abc2['sources']){const _0x70e107=this['_createBalloonButton'](_0x2500fc,{'label':_0x7d336a['label'],'icon':_0x7d336a['icon']||_0x4336ec,'type':'source'});_0x511d49['content']['add'](_0x70e107),_0x70e107['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x7d336a,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x145cc2 of _0x50abc2['customItems']||[]){const _0x331734=this['_createBalloonButton'](_0x2500fc,{'label':_0x145cc2['label'],'icon':_0x145cc2['icon']||_0x4336ec,'type':'customItem'});_0x511d49['content']['add'](_0x331734),_0x331734['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x145cc2);});}this['_hasExactlyOneSource']=0x1===_0x511d49['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x216b03,_0x3652b6){this['_urlInputView']=new AIChatContextPanelUrlInputView(_0x3652b6),this['_urlInputView']['on']('submitUrl',(_0x224f56,_0x52ee6b)=>{this['_handleUrlSubmit'](_0x52ee6b);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':kn}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':kn});}),_0x216b03['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x3539e3,_0x1578c3){const _0x325760='source'===_0x1578c3['type']?new SourcesBalloonButtonView(_0x3539e3):new vt(_0x3539e3);return _0x325760['set']({'label':_0x1578c3['label'],'icon':_0x1578c3['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':wn}),_0x325760;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){zt({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x2e15fa){const _0x49e074=this['_addContextBalloonConfig'];_0x49e074['buttonView']['isOn']=_0x2e15fa,_0x2e15fa?_0x49e074['balloonView']['show']():_0x49e074['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x566bc6,buttonView:_0x230b96,hideMethod:_0x321695}=this['_addContextBalloonConfig'];zt({'emitter':_0x566bc6,'contextElements':[_0x566bc6['element'],_0x230b96['element']],'callback':()=>{_0x321695();},'activator':()=>_0x230b96['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x59ad34,_0x5a3706,_0x3fd199=!0x1,_0x39797d=!0x1){const _0x4c8492='conversation'===_0x5a3706||!0x0===_0x59ad34['isReadOnly'],_0x197f82=new AIChatContextItemButtonView(this['locale'],_0x59ad34,_0x4c8492,_0x3fd199,_0x39797d);return _0x4c8492||_0x197f82['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x197f82['id']);}),_0x197f82;}['_addContextToCollection'](_0x411bec,_0x2689cd){_0x2689cd['add'](_0x411bec,0x0);}['_removeContextFromCollection'](_0x976d65,_0x1e8d19){const _0x2333f2=_0x1e8d19['find'](_0x2b7d64=>_0x2b7d64['id']===_0x976d65);_0x2333f2&&_0x1e8d19['remove'](_0x2333f2);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':kn}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x3174ce){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x3174ce);}}class SourcesBalloonButtonView extends vt{['arrowView'];constructor(_0x1179fc){super(_0x1179fc),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[Tn]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x32b06e=new xt();return _0x32b06e['content']=_0xcf9e,_0x32b06e['extendTemplate']({'attributes':{'class':Tn+'__arrow'}}),_0x32b06e;}}class AIChatControlsLoaderView extends Nt{['_cancelButtonView'];['_loaderView'];constructor(_0x513310){super(_0x513310),this['_cancelButtonView']=this['_createCancelButtonView'](),this['_loaderView']=this['_createLoaderView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-loader-wrapper','ck-reset_all']},'children':[this['_loaderView'],this['_cancelButtonView']]});}['_createCancelButtonView'](){const _0x49d028=new vt(this['locale']);return _0x49d028['set']({'label':Hi(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Ui+'\x20ck-ai-button-stop-generating','icon':_0x2cd0a9}),_0x49d028['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x49d028;}['_createLoaderView'](){const _0x29365e=new Nt(this['locale']);return _0x29365e['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}},{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}},{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}}]},{'text':Hi(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x29365e;}}class AIChatControlsView extends Nt{['_contextPanelView'];['_promptInputView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];constructor(_0xec05a8,_0x39d172){super(_0xec05a8),this['_contextPanelView']=this['_createContextPanelView'](_0xec05a8,{'bodyCollection':_0x39d172['bodyCollection'],'searchInputVisibleFrom':_0x39d172['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0xec05a8),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0xec05a8),this['_loaderView']=this['_createLoaderView'](_0xec05a8),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0xec05a8),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage')['to'](this),this['_loaderView']['delegate']('abortPromptStream')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleWebSearch')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleReasoning')['to'](this),this['_promptCapabilitiesView']['delegate']('selectModel')['to'](this),this['_contextPanelView']['delegate'](...An)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x5ed5dd=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x5ed5dd['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x5ed5dd['if']('isLoading','ck-hidden',_0x55119c=>_0x55119c||!this['isModelAvailable']),_0x5ed5dd['if']('isModelAvailable','ck-hidden',_0x4af533=>!_0x4af533||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x5ed5dd['if']('isLoading','ck-hidden',_0x2e5ab5=>!_0x2e5ab5)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x5ed5dd['if']('isModelAvailable','ck-hidden',_0x5d366d=>_0x5d366d)]},'children':[this['_modelUnavailableMessageView']]}]}),zt({'emitter':this['_promptInputView'],'activator':()=>this['isLoading'],'contextElements':()=>[this['element']],'callback':()=>{this['_shouldRestorePromptInputFocus']=!0x1;}}),this['on']('change:isLoading',this['_handlePromptInputFocus'],{'priority':'low'});}['_createContextPanelView'](_0x251bbc,_0x525852){return new AIChatContextPanelView(_0x251bbc,_0x525852);}['_createPromptInputView'](_0x541304){return new AIChatPromptInputView(_0x541304,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x273d5a){return new AIChatPromptCapabilitiesView(_0x273d5a);}['_createLoaderView'](_0x2de291){return new AIChatControlsLoaderView(_0x2de291);}['_createModelUnavailableMessageView'](_0x2152e5){const _0x68cd39=new AIChatModelUnavailableMessageView(_0x2152e5);return _0x68cd39['delegate']('startConversation')['to'](this),_0x68cd39;}['_handlePromptInputFocus'](_0x350446,_0x35e23b,_0x4956b7){_0x4956b7?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x3257a6,_0x4a075a){this['_contextPanelView']['addContextItem'](_0x3257a6,_0x4a075a);}['removeContextItem'](_0xf3a2ad){this['_contextPanelView']['removeContextItem'](_0xf3a2ad);}['setContextItemLoading'](_0x34e07b,_0x5b0b55){this['_contextPanelView']['setContextItemLoading'](_0x34e07b,_0x5b0b55);}['setIsUploadInProgress'](_0x1fd2f9){this['_promptInputView']['setIsUploadInProgress'](_0x1fd2f9);}['setConversationContext'](_0x512ce8){this['_contextPanelView']['setConversationContext'](_0x512ce8);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x697c1a,_0x3f48ef,_0x24981a){this['_contextPanelView']['updateResourceState'](_0x697c1a,_0x3f48ef,_0x24981a);}['setWebSearch'](_0x3a584b){this['_promptCapabilitiesView']['setWebSearch'](_0x3a584b);}['setReasoning'](_0x2f6fdd){this['_promptCapabilitiesView']['setReasoning'](_0x2f6fdd);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x2cf27a){this['_contextPanelView']['setAddContextOptions'](_0x2cf27a);}['setInputPlaceholder'](_0x3add7d){this['_promptInputView']['setPlaceholderText'](_0x3add7d);}['setModelList'](_0x55f5df,_0x29bd37){this['_promptCapabilitiesView']['setModelList'](_0x55f5df,_0x29bd37);}['setModel'](_0x4ce93b){_0x4ce93b?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x4ce93b)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x52658d){this['_promptCapabilitiesView']['disableModelSelector'](_0x52658d);}['populateSourceResourceBalloon'](_0x4a0aac,_0x36a852,_0x33088f,_0x5613de){this['_contextPanelView']['populateSourceResourceBalloon'](_0x4a0aac,_0x36a852,_0x33088f,_0x5613de);}['closeSourceResourceBalloon'](_0x39887b){this['_contextPanelView']['closeSourceResourceBalloon'](_0x39887b);}['focusPromptInput'](_0x48b49c=!0x1){this['_promptInputView']['focus'](_0x48b49c);}['setPromptInputValue'](_0x4fc8aa){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x4fc8aa;}}class AIChatModelUnavailableMessageView extends Nt{constructor(_0x331dde){super(_0x331dde);const _0x274fbb=new vt(_0x331dde);_0x274fbb['set']({'label':Hi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x274fbb['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':Hi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x274fbb]}]});}}class AIHeaderView extends _0x1ea0e5{['resizeButton'];constructor(_0x4a3736,_0x13310e){super(_0x4a3736,{'label':_0x13310e['label'],'class':'ck-ai-header\x20'+_0x13310e['class'],'icon':_0x13310e['icon']}),this['set']('isMaximized',!0x1),_0x13310e['content']&&this['children']['add'](_0x13310e['content']),_0x13310e['showResizeButton']&&(this['resizeButton']=Gi(_0x4a3736,this),this['children']['add'](this['resizeButton']));}}class AIDisclaimerView extends Nt{constructor(_0x290100){super(_0x290100),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Hi(_0x290100,'AI_DISCLAIMER_TEXT')}]}]});}}function vn(_0x23e2b8,_0x69c370){const _0x24b96b=new vt(_0x23e2b8);return _0x24b96b['set']({'label':Hi(_0x23e2b8,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x3a3f8a,'class':'ck-ai-chat__start-conversation\x20'+Ui}),_0x24b96b['on']('execute',()=>{_0x69c370['fire']('startConversation');}),_0x24b96b;}class AIChatView extends Nt{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0x4d339f,_0x2e60f1){super(_0x4d339f),this['_bodyCollection']=new Qt(_0x4d339f),this['_bodyCollection']['attachToDom']();const _0x573e5d=vn(_0x4d339f,this);this['chatHeader']=new AIHeaderView(_0x4d339f,{'label':Hi(_0x4d339f,'AI_CHAT_HEADING'),'icon':_0x2b653e,'class':'ck-ai-header_chat','content':_0x573e5d,'showResizeButton':_0x2e60f1['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new AIChatFeedView(_0x4d339f,this['_bodyCollection']),this['chatFeed']['delegate'](...ms)['to'](this),this['chatControls']=new AIChatControlsView(_0x4d339f,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x2e60f1['contextResourcesSearchInputVisibleFrom']}),this['chatControls']['delegate'](...ms)['to'](this),this['chatDisclaimer']=new AIDisclaimerView(_0x4d339f),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x4d339f['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x59b698,_0x5105b3,_0x44af10,_0x3a226d){this['chatControls']['populateSourceResourceBalloon'](_0x59b698,_0x5105b3,_0x44af10,_0x3a226d);}['closeSourceResourceBalloon'](_0x13b650){this['chatControls']['closeSourceResourceBalloon'](_0x13b650);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}}class AIChatUI extends _0x4127f4{static get['requires'](){return[AITabs];}['_view'];static get['pluginName'](){return'AIChatUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['feedItemRenderingStrategy']='streaming';['showDiff']=!0x0;['_promiseQueue'];['_interactionPromiseResolver'];['_titleAnimationInterval']=void 0x0;['_isTrackChangesCommandValueBound']=!0x1;constructor(_0x3f47eb){super(_0x3f47eb);const _0x122633=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue(),this['_view']=new AIChatView(this['context']['locale'],{'showResizeButton':_0x122633['showResizeButton'],'contextResourcesSearchInputVisibleFrom':this['context']['config']['get']('ai.chat.context.searchInputVisibleFrom')}),this['_view']['delegate']('resizeTabs')['to'](_0x122633),this['_view']['delegate'](...ms)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x457941,{showDiff:_0x346564})=>{this['showDiff']=_0x346564;}),_0x122633['view']['addTab']({'id':'chat','buttonLabel':Hi(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x2b653e,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x122633['view'],'isMaximized',_0x23858f=>_0x23858f),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x1bad09=>_0x1bad09),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0xa46278){const _0x2f3cc3=this['context']['config']['get']('ai.chat.welcomeMessage')??Hi(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0xa46278['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x2f3cc3}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x7f5974,staticMessage:_0x1cd869}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x7f5974,'initialContent':'<p>'+_0x1cd869+'</p>'});});}async['addFeedItemUserMessage'](_0x441644){const _0xe83463=_0x441644['attributes']?.['displayedPrompt']||_0x441644['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x441644['contextItems']['values']()),'initialContent':'<p>'+_0xe83463+'</p>','id':_0x441644['id']});});}async['addFeedItemError']({errorMessage:_0x4e415c,id:_0x474c6b}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x4e415c+'</p>','id':_0x474c6b});});}async['addFeedItemAIReply'](_0x459d95){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x459d95['interactionId']+':'+_0x459d95['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x5f4d74){const _0x458beb=ds(this['context']);let _0xce7c02=_0x458beb['config']['get']('ai.availableReplyActions')||[...bs];if(_0x458beb['plugins']['has']('TrackChanges')){if(!this['_isTrackChangesCommandValueBound']){this['_isTrackChangesCommandValueBound']=!0x0;const _0x109488=_0x458beb['commands']['get']('trackChanges');this['_view']['chatFeed']['bind']('isTrackChangesOn')['to'](_0x109488,'value');}}else _0xce7c02=_0xce7c02['filter'](_0x5227a4=>'insertSuggestion'!=_0x5227a4);return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x5f4d74['interactionId']+':'+_0x5f4d74['id'],'areActionsDisabled':_0x5f4d74['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0xce7c02}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x59cff,_0x5e5a18){return this['_promiseQueue']['enqueue'](async()=>{const _0x4d5a64=this['_view']['chatFeed']['children']['last'];if(_0x4d5a64 instanceof AIChatFeedInteractionHeaderView)return this['_view']['chatFeed']['children']['remove'](_0x4d5a64),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x59cff['id'],'capabilities':{'isWebSearchEnabled':_0x4d5a64['capabilities']['isWebSearchEnabled']||_0x5e5a18['isWebSearchEnabled'],'isReasoningEnabled':_0x4d5a64['capabilities']['isReasoningEnabled']||_0x5e5a18['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x59cff['id'],'capabilities':_0x5e5a18});});}async['addFeedItemCustomElement'](_0x281406,_0x25d2f9){let _0x3a97a6;return await this['_promiseQueue']['enqueue'](async()=>{_0x3a97a6=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x281406,'id':_0x25d2f9});}),_0x3a97a6;}['removeFeedItem'](_0xca0519){this['_view']['chatFeed']['removeItem'](_0xca0519);}['hasFeedItem'](_0x471aba){return this['_view']['chatFeed']['hasItem'](_0x471aba);}['updateFeedInteractionHeader'](_0x98233c){const _0x4f3aa3=this['_view']['chatFeed']['children']['find'](_0x159fa1=>_0x159fa1['options']['id']==_0x98233c['id']&&_0x159fa1 instanceof AIChatFeedInteractionHeaderView);_0x4f3aa3&&_0x4f3aa3['set']('isVisible',_0x98233c['isVisible']);}async['updateFeedItemAIReplyContent'](_0x552673){const _0x234036=_0x552673['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x44cf7c=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x552673,'abortSignal':_0x44cf7c,'renderingStrategy':_0x234036}),_0x552673['isDone']&&this['markFeedItemAsDone'](_0x552673['id']);});}['updateFeedItemAIReplySources'](_0x38c6dc,_0x90223){this['_view']['chatFeed']['updateWebSources'](_0x38c6dc,_0x90223);}async['updateFeedItemAIReplySuggestionContent'](_0x5da79c){return this['_promiseQueue']['enqueue'](async _0xd685eb=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x5da79c,'abortSignal':_0xd685eb}),_0x5da79c['isDone']&&this['markFeedItemAsDone'](_0x5da79c['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0xa9c9bc){this['_view']['chatFeed']['updateSuggestionPartState'](_0xa9c9bc);}['setFeedItemAIReplySuggestionPartActive'](_0x531591){this['_view']['chatFeed']['setSuggestionPartActive'](_0x531591);}['markFeedItemAsDone'](_0x324342){this['_view']['chatFeed']['markItemAsDone'](_0x324342);}['removeFeedInteraction'](_0x2fc9f9){this['_view']['chatFeed']['getItemIds']()['filter'](_0x19e94c=>_0x19e94c['startsWith'](_0x2fc9f9))['forEach'](_0x1ce54c=>this['_view']['chatFeed']['removeItem'](_0x1ce54c));}['startInteraction'](){const _0x47e46a=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x47e46a),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x325187){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x20125b=>_0x20125b['startsWith'](_0x325187['id']))['forEach'](_0x1d8eb5=>this['markFeedItemAsDone'](_0x1d8eb5)),this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();}async['finishInteraction'](){return this['_promiseQueue']['queueEmptyPromise']['then'](()=>{this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();});}['addContextItem'](_0x434ff4,_0x3bf6ae){this['_view']['chatControls']['addContextItem'](_0x434ff4,_0x3bf6ae);}['removeContextItem'](_0x59f32c){this['_view']['chatControls']['removeContextItem'](_0x59f32c);}['setContextItemLoading'](_0x3cd3b9,_0x3eec3){this['_view']['chatControls']['setContextItemLoading'](_0x3cd3b9,_0x3eec3);}['setIsUploadInProgress'](_0x3817b0){this['_view']['chatControls']['setIsUploadInProgress'](_0x3817b0);}['setConversationContext'](_0x5a40dd){this['_view']['chatControls']['setConversationContext'](_0x5a40dd);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x3af953,_0x29d364,_0x3b8015){this['_view']['chatControls']['updateResourceState'](_0x3af953,_0x29d364,_0x3b8015);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x267f70){this['_view']['chatControls']['setAddContextOptions'](_0x267f70);}['updateCapabilities'](_0x2089d5){this['_view']['chatControls']['setWebSearch'](_0x2089d5['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x2089d5['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x2089d5));}['setSelectedModel'](_0x2c3884,_0x226a0e){this['_view']['chatControls']['setModel'](_0x2c3884),_0x226a0e&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x2942be){this['feedItemRenderingStrategy']=_0x2942be;}['toggleLoadingSkeleton'](_0xa35b96){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0xa35b96);}['resetConversationTitle'](){this['setConversationTitle'](Hi(this['context']['locale'],'AI_CHAT_HEADING'));}['setConversationTitle'](_0x593c5f,_0x47fd19=!0x1){if(_0x47fd19&&!Rt()&&_0x593c5f['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x593c5f);this['_view']['chatHeader']['label']=_0x593c5f;}['setLoadingMessage'](_0x12f504){this['_view']['chatFeed']['setLoadingMessage'](_0x12f504);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x10e848){let _0x57d5f4=0x0;clearInterval(this['_titleAnimationInterval']),this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x10e848[_0x57d5f4],_0x57d5f4++,_0x57d5f4===_0x10e848['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x1351ed){return _0x1351ed['isWebSearchEnabled']&&_0x1351ed['isReasoningEnabled']?Hi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x1351ed['isWebSearchEnabled']?Hi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x1351ed['isReasoningEnabled']?Hi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Hi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x5e8d76){return _0x5e8d76?_0x5e8d76['isWebSearchEnabled']&&_0x5e8d76['isReasoningEnabled']?Hi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x5e8d76['isWebSearchEnabled']?Hi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x5e8d76['isReasoningEnabled']?Hi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):Hi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):Hi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x478b80,_0x2e7bca,_0x287cc1,_0xc51918){this['_view']['populateSourceResourceBalloon'](_0x478b80,_0x2e7bca,_0x287cc1,_0xc51918);}['closeSourceResourceBalloon'](_0x211a42){this['_view']['closeSourceResourceBalloon'](_0x211a42);}['setPromptInputValue'](_0x3c85ab){this['_view']['chatControls']['setPromptInputValue'](_0x3c85ab);}['focusPromptInput'](_0x5ae696=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x5ae696);}['scrollFeedToSuggestion'](_0x729e23,_0x199ac0){this['_view']['chatFeed']['scrollToSuggestion'](_0x729e23,_0x199ac0);}['startAutoScroll'](_0x5c8f64={}){this['_view']['chatFeed']['startAutoScroll'](_0x5c8f64);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}}class AIChatHistorySectionListView extends Dt{['sections'];constructor(_0x3ae4c1,_0x33add2){super(_0x3ae4c1),this['sections']=_0x33add2,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x7b1c37){let _0x5c573b=0x0,_0x15aa88=0x0;for(const _0x5baaf9 of this['sections']){const {resultsCount:_0x158677,totalItemsCount:_0x31c957}=_0x5baaf9['filter'](_0x7b1c37);_0x5c573b+=_0x158677,_0x15aa88+=_0x31c957;}return{'resultsCount':_0x5c573b,'totalItemsCount':_0x15aa88};}}class AIChatHistoryListView extends Pt{['title'];['itemsViews'];['_itemsListView'];constructor(_0x7d35ad,{title:_0x13466b,items:_0x4ccc81}){super(_0x7d35ad);const _0x53f20c=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x13466b,this['itemsViews']=_0x4ccc81;const _0x5b4cfa=new Nt(_0x7d35ad);_0x5b4cfa['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new Dt(_0x7d35ad),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x53f20c['if']('isVisible','ck-hidden',_0x229126=>!_0x229126)]},'children':[_0x5b4cfa,this['_itemsListView']]});}['filter'](_0x2b7751){const _0x1b8b67=this['itemsViews']['length'];let _0x45f79f=0x0;for(const _0x4216c5 of this['itemsViews']){if(_0x2b7751){const _0x4b9201=_0x4216c5['isMatching'](_0x2b7751);_0x4216c5['isVisible']=!!_0x4b9201,_0x4216c5['highlightText'](_0x2b7751);}else _0x4216c5['isVisible']=!0x0,_0x4216c5['highlightText'](null);_0x4216c5['isVisible']&&_0x45f79f++;}return this['isVisible']=_0x45f79f>0x0,{'resultsCount':_0x45f79f,'totalItemsCount':_0x1b8b67};}['getItem'](_0x45471c){return this['itemsViews']['find'](_0x480c7a=>_0x480c7a['id']===_0x45471c);}['removeItem'](_0x4d36f7){const _0x4cbb=this['itemsViews']['indexOf'](_0x4d36f7);-0x1!==_0x4cbb&&(this['itemsViews']['splice'](_0x4cbb,0x1),this['_itemsListView']['items']['remove'](_0x4d36f7));}}class AIChatHistoryListItemView extends/* #__PURE__ -- @preserve */
27
- _0x3e4ae1(Pt){['id'];static ['LOADING_LABELS']={'remove':'AI_CHAT_HISTORY_LOADING_REMOVING','rename':'AI_CHAT_HISTORY_LOADING_RENAMING','pin':'AI_CHAT_HISTORY_LOADING_PINNING','unpin':'AI_CHAT_HISTORY_LOADING_UNPINNING'};['actions'];['mainContent'];['_titleView'];constructor(_0x48e54c,_0x2c50e9){super(_0x48e54c);const _0x512cea=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x2c50e9['pinned']),this['set']('loadingState',null),this['set']('title',_0x2c50e9['title']),this['id']=_0x2c50e9['id'];const {createdAt:_0x2bdaf6,active:_0x307d31=!0x1}=_0x2c50e9;this['_titleView']=new _0x3f501c(),this['_titleView']['bind']('text')['to'](this,'title',t=>_0x353660(t||'')),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x23d1fd=this['_createCheckView'](),_0x722b80=this['_createPinButtonView'](_0x48e54c),_0x3eb56a=this['_createMenuDropdownView'](),_0x4ed82e=this['_createEditInputView'](_0x48e54c),_0x2af323=this['_createAcceptEditButtonView'](_0x48e54c,_0x4ed82e),_0x473464=this['_createCancelEditButtonView'](_0x48e54c);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x722b80),this['actions']['add'](_0x3eb56a),this['on']('change:isEdit',(_0xee8fa4,_0x16d56c,_0x418b4d)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x418b4d?(this['actions']['add'](_0x2af323),this['actions']['add'](_0x473464),this['mainContent']['add'](_0x4ed82e),_0x4ed82e['element']['value']=this['title']||'',_0x4ed82e['element']['focus']()):(this['actions']['add'](_0x722b80),this['actions']['add'](_0x3eb56a),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x307d31?'ck-ai-chat-history__item--active':'',_0x512cea['if']('isVisible','ck-hidden',_0x40513b=>!_0x40513b),_0x512cea['if']('isEdit','ck-ai-chat-history__item--edit')],'role':'listitem'},'children':[{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-check-container']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-check',_0x512cea['if']('loadingState','ck-hidden',_0x3fba32=>!!_0x3fba32)]},'children':_0x307d31?[_0x23d1fd]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x512cea['if']('loadingState','ck-hidden',_0x4a2f3d=>!_0x4a2f3d)]},'children':[this['_createSpinnerView']()]}]},{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-row']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-content']},'on':{'click':this['bindTemplate']['to']('click')},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-main-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-title-container',_0x512cea['if']('loadingState','ck-hidden',_0x354577=>!!_0x354577)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x512cea['if']('loadingState','ck-hidden',_0x8f449=>!_0x8f449)]},'children':[{'text':_0x512cea['to']('loadingState',_0x434b88=>_0x434b88?Hi(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x434b88]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x2bdaf6]}]},{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-actions']},'children':this['actions']}]}]}),this['on']('click',()=>{this['isEdit']||this['fire']('selectConversation',{'id':this['id']});});}['updateTitle'](_0x4f403c){this['set']('title',_0x4f403c);}['updateLoadingState'](_0x415b11,_0x26cb38){this['set']('loadingState',_0x26cb38?_0x415b11:null);}['_createCheckView'](){const _0x2cc5f0=new xt();return _0x2cc5f0['set']({'content':_0x11d9a5}),_0x2cc5f0;}['_createPinButtonView'](_0x3d9fdb){const _0x5e1ce3=new vt(_0x3d9fdb);return _0x5e1ce3['set']({'label':Hi(_0x3d9fdb,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x156c16,'withText':!0x1,'tooltip':!0x0}),_0x5e1ce3['bind']('isOn')['to'](this,'pinned'),_0x5e1ce3['on']('execute',()=>{const _0xea0fa8=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0xea0fa8});}),_0x5e1ce3;}['_createMenuDropdownView'](){const _0x28e40d=Gt(this['locale']),_0x2d0c57=_0x28e40d['panelView']['children'];_0x28e40d['buttonView']['set']({'label':Hi(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':_0x3c4086}),_0x28e40d['panelPosition']='sw';const _0x4ad070=new vt(this['locale']);_0x4ad070['label']=Hi(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x4ad070['withText']=!0x0,_0x4ad070['on']('execute',()=>{this['isEdit']=!0x0;});const _0x21f249=new vt(this['locale']);_0x21f249['label']=Hi(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x21f249['withText']=!0x0,_0x21f249['on']('execute',()=>{this['showConfirm'](Hi(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x310380=new Dt(this['locale']),_0xd413f7=new Pt(this['locale']);_0xd413f7['children']['add'](_0x4ad070);const _0x573df0=new Pt(this['locale']);return _0x573df0['children']['add'](_0x21f249),_0x310380['items']['addMany']([_0xd413f7,_0x573df0]),_0x2d0c57['add'](_0x310380),_0x28e40d;}['_createEditInputView'](_0xfc30ba){const _0x2145e2=new _0x4c17e0(_0xfc30ba),_0x14f111=_0x2145e2['bindTemplate'];return _0x2145e2['extendTemplate']({'on':{'keydown':_0x14f111['to'](_0x2b3511=>{'Enter'==_0x2b3511['key']&&this['_commitEditInputValue'](_0x2145e2);})}}),_0x2145e2;}['_createAcceptEditButtonView'](_0x3ed877,_0x4ed3ef){const _0x171c41=new vt(_0x3ed877);return _0x171c41['set']({'icon':_0x11d9a5,'withText':!0x1,'tooltip':Hi(_0x3ed877,'AI_CHAT_HISTORY_ACCEPT')}),_0x171c41['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x171c41['on']('execute',()=>{this['_commitEditInputValue'](_0x4ed3ef);}),_0x171c41;}['_commitEditInputValue'](_0x1513da){const _0xba8c29=_0x1513da['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0xba8c29});}['_createCancelEditButtonView'](_0x4ec128){const _0x2caee0=new vt(_0x4ec128);return _0x2caee0['set']({'icon':_0x1294a9,'withText':!0x1,'tooltip':Hi(_0x4ec128,'AI_CHAT_HISTORY_CANCEL')}),_0x2caee0['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x2caee0['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x2caee0;}['_createSpinnerView'](){const _0x25366e=new AISpinnerView('tiny');return _0x25366e['isVisible']=!0x0,_0x25366e;}['isMatching'](_0x9b938f){return'string'==typeof this['title']&&this['title']['match'](_0x9b938f)?{'title':!0x0}:null;}['highlightText'](_0x38ec8b){this['_titleView']['highlightText'](_0x38ec8b);}}class AIChatHistoryView extends Nt{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x13b39f,_0x55c0a0){super(_0x13b39f),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x47fbf2=vn(_0x13b39f,this);this['headerView']=new AIHeaderView(_0x13b39f,{'label':Hi(_0x13b39f,'AI_CHAT_HISTORY_HEADING'),'icon':_0x1bbebc,'class':'ck-ai-header_history','content':_0x47fbf2,'showResizeButton':_0x55c0a0}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new AIChatHistorySectionListView(_0x13b39f,[]),this['sectionsView']['delegate'](...Nn)['to'](this),this['mainErrorView']=this['_createErrorView'](),this['skeletonView']=this['_createSkeletonView'](),this['emptyView']=this['_createEmptyStateView'](),this['searchView']=this['_createSearchView'](),this['mainErrorView']['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isMainErrorViewVisible','ck-hidden',_0x348049=>!_0x348049)]}}),this['on']('change:isLoading',()=>this['_updateViewVisibility']()),this['on']('change:hasItems',()=>this['_updateViewVisibility']()),this['on']('change:errorMessage',()=>this['_updateViewVisibility']()),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat-history','ck-rounded-corners'],'dir':'ltr'},'children':[this['headerView'],{'tag':'div','attributes':{'class':['ck-ai-chat-history__content']},'children':[this['skeletonView'],this['mainErrorView'],this['emptyView'],this['searchView']]}]});}['_updateViewVisibility'](){this['isSearchViewVisible']=!this['isLoading']&&this['hasItems'],this['isEmptyViewVisible']=!this['isLoading']&&!this['hasItems']&&!this['errorMessage'],this['isMainErrorViewVisible']=!this['isSearchViewVisible']&&!!this['errorMessage'];}['_createSearchView'](){const _0x9f1917=new _0x483c44(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Hi(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x5bac2c=>Hi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x5bac2c),'secondary':Hi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x4f8304=this['_createErrorView']();return _0x4f8304['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x57b84c=>!_0x57b84c)]}}),_0x9f1917['on']('render',()=>{_0x9f1917['children']['add'](_0x4f8304,0x1);}),_0x9f1917['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x100d3a=>!_0x100d3a)]}}),_0x9f1917;}['_createSkeletonView'](){const _0x3c46ac=new AISkeletonView(this['locale'],Ss['aiHistory']);return _0x3c46ac['bind']('isVisible')['to'](this,'isLoading'),_0x3c46ac;}['_createErrorView'](){const _0x5a31bd=new Nt(this['locale']),_0x663f18=new vt(this['locale']);_0x663f18['set']({'withText':!0x1,'icon':_0x1294a9,'class':'ck-ai-notification_error__dismiss-button'}),_0x663f18['bind']('isVisible')['to'](this,'hasItems',_0x543eef=>!!_0x543eef),_0x663f18['on']('execute',()=>{this['errorMessage']='';});const _0x576466=this['bindTemplate'];return _0x5a31bd['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x576466['to']('errorMessage')}]},_0x663f18]}),_0x5a31bd;}['_createEmptyStateView'](){const _0x5388ca=new Nt(this['locale']);return _0x5388ca['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x1fb4e5=>!_0x1fb4e5)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Hi(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x5388ca;}['_createListItemViews'](_0x4a0907,_0x22842a){const _0x50c1d1=[];for(const _0x30d5af of _0x4a0907){const _0x301411=new AIChatHistoryListItemView(_0x22842a,_0x30d5af);_0x301411['delegate'](...Nn)['to'](this),_0x50c1d1['push'](_0x301411);}return _0x50c1d1;}['updateHistoryItemsWithCategories'](_0x193eab){const _0x54a1aa=this['locale']||'en',_0x30ce57=[];for(const _0x2fa033 of _0x193eab){const _0x5b33d2=this['_createListItemViews'](_0x2fa033['items'],_0x54a1aa);_0x30ce57['push'](new AIChatHistoryListView(_0x54a1aa,{'title':_0x2fa033['title'],'items':_0x5b33d2}));}this['sectionsView']['sections']=_0x30ce57,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x30ce57),this['hasItems']=_0x193eab['some'](_0x863eee=>_0x863eee['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x36c1a5){for(const _0x5624e7 of this['sectionsView']['sections']){const _0x4efb49=_0x5624e7['getItem'](_0x36c1a5);if(_0x4efb49){if(_0x5624e7['removeItem'](_0x4efb49),0x0===_0x5624e7['itemsViews']['length']){const _0x8c2398=this['sectionsView']['sections']['indexOf'](_0x5624e7);-0x1!==_0x8c2398&&(this['sectionsView']['sections']['splice'](_0x8c2398,0x1),this['sectionsView']['items']['remove'](_0x5624e7));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x1172d5,_0x683284){for(const _0x276910 of this['sectionsView']['sections']){const _0x26b272=_0x276910['getItem'](_0x1172d5);if(_0x26b272){_0x26b272['updateTitle'](_0x683284);break;}}}['updateItemLoadingState'](_0x316a2f,_0x3114d8,_0x2885b0){for(const _0x106bf1 of this['sectionsView']['sections']){const _0x25c019=_0x106bf1['getItem'](_0x316a2f);if(_0x25c019){_0x25c019['updateLoadingState'](_0x3114d8,_0x2885b0);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x3feb3a=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x3feb3a);}}}const Nn=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];class AIChatHistoryUI extends _0x4127f4{static get['requires'](){return[AITabs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xec256b){super(_0xec256b);const _0x871616=this['context']['plugins']['get']('AITabs');this['_historyView']=new AIChatHistoryView(this['context']['locale'],_0x871616['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x871616),this['_historyView']['delegate'](...Nn)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x871616['view'],'isMaximized',_0x26c818=>_0x26c818),_0x871616['view']['addTab']({'id':'history','buttonLabel':Hi(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x1bbebc,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x261aff){this['_historyView']['removeHistoryItem'](_0x261aff);}['updateItems'](_0x384adc){this['_historyView']['updateHistoryItemsWithCategories'](_0x384adc);}['updateItemTitle'](_0x5920f5,_0x4d63c7){this['_historyView']['updateItemTitle'](_0x5920f5,_0x4d63c7);}['updateItemLoadingState'](_0x5519e8,_0x1dc33b,_0x21b5b1){this['_historyView']['updateItemLoadingState'](_0x5519e8,_0x1dc33b,_0x21b5b1);}['setLoadingSkeleton'](_0x444c95){this['_historyView']['isLoading']=_0x444c95;}['showError'](_0x5804d8){this['_historyView']['errorMessage']=_0x5804d8;}['hideError'](){this['_historyView']['errorMessage']='';}}class AIChatHistoryItem extends ht(){['id'];['createdAt'];constructor({id:_0x45a166,title:_0x15ab8a,createdAt:_0x46df5d,updatedAt:_0x4cfb64,pinned:_0xe3a116}){super(),this['id']=_0x45a166,this['createdAt']=new Date(_0x46df5d),this['set']('title',_0x15ab8a),this['set']('updatedAt',_0x4cfb64?new Date(_0x4cfb64):null),this['set']('pinned',_0xe3a116||!0x1);}['updateTitle'](_0x32e706){this['set']('title',_0x32e706),this['updatedAt']=new Date();}['updatePinned'](_0x20a36){this['set']('pinned',_0x20a36),this['updatedAt']=new Date();}}class AIChatHistoryConversations extends Et(){['items']=[];['connector'];['group'];constructor({connector:_0x1e3301,group:_0x5830c3}){super(),this['connector']=_0x1e3301,this['group']=_0x5830c3;}async['init'](){try{const _0x31c741=this['connector']['fetchConversations'](this['group']),_0x55513a=await _0x31c741['getConversations']();this['loadItems'](_0x55513a);}catch(_0x16c211){this['fire']('error',{'error':_0x16c211,'operation':'init'});}}['addItem'](_0x1de22f){this['items']['push'](_0x1de22f);}async['removeItem'](_0x1792b3){const _0x3a4465=this['items']['findIndex'](_0x3387fc=>_0x3387fc['id']===_0x1792b3);if(-0x1===_0x3a4465)return!0x1;try{return await this['connector']['deleteConversation'](_0x1792b3)['execute'](),this['items']['splice'](_0x3a4465,0x1),this['fire']('itemRemoved',{'itemId':_0x1792b3}),!0x0;}catch(_0x2eed53){return this['fire']('error',{'error':_0x2eed53,'operation':'removeItem','itemId':_0x1792b3}),!0x1;}}['getItem'](_0x3af370){return this['items']['find'](_0x5c4534=>_0x5c4534['id']===_0x3af370);}async['updateItemTitle'](_0x1084b4,_0xfe89d8){const _0x1f946c=this['getItem'](_0x1084b4);if(!_0x1f946c)return!0x1;try{return await this['connector']['updateConversation'](_0x1084b4,{'title':_0xfe89d8})['getResult'](),_0x1f946c['updateTitle'](_0xfe89d8),this['fire']('itemUpdated',{'itemId':_0x1084b4,'updates':{'title':_0xfe89d8}}),!0x0;}catch(_0x16d713){return this['fire']('error',{'error':_0x16d713,'operation':'updateItemTitle','itemId':_0x1084b4}),!0x1;}}async['updateItemPinned'](_0x34a98d,_0x377c95){const _0x3b89b6=this['getItem'](_0x34a98d);if(!_0x3b89b6)return!0x1;try{return await this['connector']['updateConversation'](_0x34a98d,{'pinned':_0x377c95})['getResult'](),_0x3b89b6['updatePinned'](_0x377c95),this['fire']('itemUpdated',{'itemId':_0x34a98d,'updates':{'pinned':_0x377c95}}),!0x0;}catch(_0x1854ad){return this['fire']('error',{'error':_0x1854ad,'operation':'updateItemPinned','itemId':_0x34a98d}),!0x1;}}['loadItems'](_0x362ad7){try{this['items']=[],_0x362ad7['map'](_0x29d491=>{this['addItem'](new AIChatHistoryItem(_0x29d491));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x16033b){this['fire']('error',{'error':_0x16033b,'operation':'loadItems'});}}['getItems'](_0x4b89d4={}){const _0x4630ac=void 0x0!==_0x4b89d4['pinned']&&_0x4b89d4['pinned'],_0x52c60f=_0x4b89d4['from']?new Date(_0x4b89d4['from']['getFullYear'](),_0x4b89d4['from']['getMonth'](),_0x4b89d4['from']['getDate']()):null,_0x57e49f=_0x4b89d4['to']?new Date(_0x4b89d4['to']['getFullYear'](),_0x4b89d4['to']['getMonth'](),_0x4b89d4['to']['getDate']()):null;return this['items']['filter'](_0x2a9e5f=>{if(_0x2a9e5f['pinned']!==_0x4630ac)return!0x1;if(_0x57e49f){const _0x15e1c1=new Date(_0x2a9e5f['createdAt']['getFullYear'](),_0x2a9e5f['createdAt']['getMonth'](),_0x2a9e5f['createdAt']['getDate']());return _0x52c60f?_0x52c60f['getTime']()===_0x57e49f['getTime']()?_0x15e1c1['getTime']()===_0x52c60f['getTime']():_0x15e1c1<_0x57e49f&&_0x15e1c1>=_0x52c60f:_0x15e1c1<_0x57e49f;}return!0x0;});}}class AIChatHistoryController extends _0x4127f4{['_aiConnector'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[AIConnector,AIChatController,AIChatHistoryUI,AITabs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiConnector']=this['context']['plugins']['get'](AIConnector),this['_aiChatHistoryUi']=this['context']['plugins']['get'](AIChatHistoryUI),this['_aiChatController']=this['context']['plugins']['get'](AIChatController);const _0x247293=this['context']['plugins']['get'](AITabs);try{const _0x4709f0=this['_aiChatController']['getGroupId']();this['history']=new AIChatHistoryConversations({'connector':this['_aiConnector'],'group':_0x4709f0}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x2fbfff,_0x264221)=>{this['_setItemLoading'](_0x264221['id'],'remove'),this['_handleRemove'](_0x264221['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x3e051,_0x277045)=>{this['_setItemLoading'](_0x277045['id'],'rename'),this['_handleEditTitle'](_0x277045['id'],_0x277045['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x5a5ec2,_0x1df00e)=>{void 0x0!==_0x1df00e['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x1df00e['itemId'],_0x1df00e['updates']['title']),void 0x0!==_0x1df00e['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x1df00e['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x5338bb,_0x1db9ba)=>{this['_aiChatController']['_handleRemovedConversation'](_0x1db9ba['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x1db9ba['itemId']),this['_clearItemLoading'](_0x1db9ba['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x55cdcc,_0x309a76)=>{this['_handleHistoryErrorUI'](_0x309a76['error'],_0x309a76['operation'],_0x309a76['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0xcc31d0,_0x210065)=>{this['_handleSelectConversation'](_0x210065['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x25385e,_0x1c74b3)=>{const _0x210eca=_0x1c74b3['pinned']?'pin':'unpin';this['_setItemLoading'](_0x1c74b3['id'],_0x210eca),this['_handleTogglePin'](_0x1c74b3['id'],_0x1c74b3['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x247293['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x247293['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x8984c){this['_handleHistoryErrorUI'](_0x8984c,'init');}}async['_handleEditTitle'](_0xfb089e,_0x330caf){await this['history']['updateItemTitle'](_0xfb089e,_0x330caf);}async['_handleTogglePin'](_0x3eef9c,_0x27875c){await this['history']['updateItemPinned'](_0x3eef9c,_0x27875c);}async['_handleRemove'](_0x10f463){await this['history']['removeItem'](_0x10f463);}async['_handleSelectConversation'](_0x458ea4){await this['_aiChatController']['loadConversation'](_0x458ea4);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x5dbb75=this['_aiChatController']['activeConversation']?.['id'],_0x34a7ec=this['_getCategorizedItems']()['map'](_0x2b8196=>({'title':_0x2b8196['title'],'items':_0x2b8196['items']['map'](_0x2d99e4=>({'id':_0x2d99e4['id'],'title':_0x2d99e4['title']||Hi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x2d99e4['createdAt'])['toLocaleDateString'](),'active':_0x2d99e4['id']===_0x5dbb75,'pinned':_0x2d99e4['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x34a7ec);}['_setItemLoading'](_0x1769f3,_0x1d9db0){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x1769f3,_0x1d9db0,!0x0);}['_clearItemLoading'](_0x49088c){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x49088c,null,!0x1);}['_handleHistoryErrorUI'](_0x57ad2a,_0x3c4b70,_0x20f870){const _0x26955c=this['_generateErrorMessage'](_0x3c4b70,_0x20f870);this['_aiChatHistoryUi']['showError'](_0x26955c),_0x20f870&&this['_clearItemLoading'](_0x20f870),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x16a9a0,_0x3337a1){const _0x1032c4=_0x3337a1?this['history']['getItem'](_0x3337a1):null,_0x39b9c0=_0x1032c4?.['title']||Hi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x16a9a0){case'updateItemTitle':return Hi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x39b9c0);case'updateItemPinned':{const _0x1a5ae4=Hi(this['context']['locale'],_0x1032c4?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Hi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x1a5ae4,_0x39b9c0]);}case'removeItem':return Hi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x39b9c0);case'init':case'loadItems':return Hi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return Hi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0x3251f2=new Date(),_0x569c5d=new Date(_0x3251f2['getFullYear'](),_0x3251f2['getMonth'](),_0x3251f2['getDate']()),_0xcf38c4=new Date(_0x569c5d);_0xcf38c4['setDate'](_0xcf38c4['getDate']()-0x1);const _0x5663ea=new Date(_0x569c5d);_0x5663ea['setDate'](_0x5663ea['getDate']()-0xe);const _0x3ca2ea=this['history']['getItems']({'pinned':!0x0}),_0xf87a2e=this['history']['getItems']({'from':_0x569c5d,'to':_0x569c5d}),_0x2554e8=this['history']['getItems']({'from':_0xcf38c4,'to':_0xcf38c4}),_0x48e201=this['history']['getItems']({'from':_0x5663ea,'to':_0xcf38c4}),_0x5b934c=this['history']['getItems']({'to':_0x5663ea}),_0x1de82f=[];return _0x3ca2ea['length']>0x0&&_0x1de82f['push']({'title':Hi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x3ca2ea}),_0xf87a2e['length']>0x0&&_0x1de82f['push']({'title':Hi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0xf87a2e}),_0x2554e8['length']>0x0&&_0x1de82f['push']({'title':Hi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x2554e8}),_0x48e201['length']>0x0&&_0x1de82f['push']({'title':Hi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x48e201}),_0x5b934c['length']>0x0&&_0x1de82f['push']({'title':Hi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x5b934c}),_0x1de82f;}}class AIChatHistory extends _0x4127f4{static get['requires'](){return[AIChatHistoryController,AIChatHistoryUI];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class AIChat extends _0x4127f4{static get['requires'](){return[AIChatController,AIEditing,AIChatUI,AIChatHistory];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5c3181){super(_0x5c3181),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'sources':[],'alwaysAddSelection':!0x1}),this['context']['config']['define']('ai.chat.initialConversation','new');}}class AIChatShortcutView extends vt{['id'];constructor(_0x23b2b8,_0x3080b3){super(_0x23b2b8);const {id:_0x568514,type:_0x28ffce,icon:_0x53f573}=_0x3080b3;this['id']=_0x568514,this['set']({'label':_0x3080b3['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x3080b3['id']}}),_0x53f573?this['icon']=_0x53f573:'chat'===_0x28ffce?this['icon']=_0x2b653e:'review'===_0x28ffce?this['icon']=_0x50ff5d:'translate'===_0x28ffce&&(this['icon']=_0x9de076);}}class AIChatShortcutsView extends Nt{['listView'];constructor(_0x4598e1,_0x4eb9ae){super(_0x4598e1);const _0x2289b2=_0x4eb9ae['map'](_0x6cad88=>{const _0x10ddd5=new Pt(this['locale']),_0x2896ec=new AIChatShortcutView(this['locale'],_0x6cad88);return _0x10ddd5['children']['add'](_0x2896ec),_0x2896ec['delegate']('execute')['to'](this),_0x10ddd5;});this['listView']=new Dt(this['locale']),this['listView']['items']['addMany'](_0x2289b2),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}}const yn='chat-shortcuts';class AIChatShortcuts extends _0x4127f4{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];static get['requires'](){return[AIChatUI];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiChatUI']=this['context']['plugins']['get'](AIChatUI),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x5b034a=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{_0x5b034a['activeConversation']['isFromHistory']||this['_injectShortcuts']();}),this['listenTo'](_0x5b034a,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x54faed=['chat','review','translate'];this['_shortcuts']['forEach'](_0x54bc16=>{let _0x362d49=!0x0;if(_0x54bc16['id']&&_0x54bc16['label']&&_0x54faed['includes'](_0x54bc16['type'])?'chat'===_0x54bc16['type']&&(_0x362d49='string'==typeof _0x54bc16['prompt']):_0x362d49=!0x1,!_0x362d49)throw new at('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x54bc16});});}['_injectShortcuts'](){const _0x49f4f2=this['context']['plugins']['get'](AIChatUI);this['_shortcutsView']=new AIChatShortcutsView(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),_0x49f4f2['addFeedItemCustomElement'](this['_shortcutsView']['element'],yn),this['_shortcutsView']['on']('execute',_0x3a91b1=>{const _0x3556fa=_0x3a91b1['source']['id'];this['_executeShortcut'](_0x3556fa);});}['_removeShortcuts'](){const _0x21b8a9=this['context']['plugins']['get'](AIChatUI);_0x21b8a9['hasFeedItem'](yn)&&_0x21b8a9['removeFeedItem'](yn),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x1902b7){const _0x508b55=this['_shortcuts']['find'](_0x3cfcc1=>_0x3cfcc1['id']===_0x1902b7),_0x3c6388=_0x508b55['type'];'chat'===_0x3c6388?this['_runChatShortcut'](_0x508b55):'review'===_0x3c6388?_0x508b55['commandId']?this['_runReviewShortcut'](_0x508b55):this['_switchTab']('reviewMode'):'translate'===_0x3c6388&&(_0x508b55['language']?this['_runTranslateShortcut'](_0x508b55):this['_switchTab']('translate'));}['_switchTab'](_0x5bb235){if(!this['context']['plugins']['has']('AITabs'))throw new at('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x5bb235});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x5bb235);}async['_runChatShortcut']({prompt:_0x4f9cc5,draftMode:_0x536408,useWebSearch:_0x4a6d6c=!0x1,useReasoning:_0x37a0d6=!0x1,model:_0x410b2d}){const _0xd61418=this['context']['plugins']['get']('AIChatController'),_0x591e98=_0xd61418['activeConversation'];let _0x17d173;_0x17d173=_0x410b2d?await _0x591e98['chatModels']['getModel'](_0x410b2d):await _0x591e98['chatModels']['getDefault'](),_0x17d173&&await _0x591e98['setModel'](_0x17d173),_0x591e98['setWebSearch'](_0x4a6d6c),_0x591e98['setReasoning'](_0x37a0d6),_0xd61418['addCurrentDocumentToChatContext'](),_0x536408?(this['_aiChatUI']['setPromptInputValue'](_0x4f9cc5),this['_aiChatUI']['focusPromptInput'](!0x0)):_0xd61418['sendMessage']({'message':_0x4f9cc5});}['_runReviewShortcut']({commandId:_0x2a09f1,model:_0xe45673,prompt:_0x3f62e4,params:_0x788234}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new at('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x3c369a={'id':_0x2a09f1,'isCustom':'custom'===_0x2a09f1};_0xe45673&&_0x3f62e4&&(_0x3c369a['args']={'model':_0xe45673,'prompt':_0x3f62e4}),_0x788234&&(_0x3c369a['params']=_0x788234),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x3c369a);}['_runTranslateShortcut']({language:_0x1bed7a}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new at('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x1bed7a,'args':{'language':_0x1bed7a}});}}class ToggleAICommand extends _0x57166c{constructor(_0xfd479b){super(_0xfd479b);const _0x2d7b67=_0xfd479b['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x2d7b67,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0x12129a=this['editor']['plugins']['get']('AITabs')['view'];_0x12129a['isVisible']=!_0x12129a['isVisible'];}}class AIToggleButtonUI extends _0x1d5649{static get['requires'](){return[AITabs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x4e1bdf=this['editor'];_0x4e1bdf['commands']['add']('toggleAi',new ToggleAICommand(_0x4e1bdf)),_0x4e1bdf['ui']['componentFactory']['add']('toggleAi',()=>{const _0x30f93f=this['_createAIUIButton'](vt);return _0x30f93f['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x30f93f;}),_0x4e1bdf['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x1dda8e=this['_createAIUIButton'](Wt);return _0x1dda8e['set']({'role':'menuitemcheckbox'}),_0x1dda8e;});}['_createAIUIButton'](_0x2da578){const _0x3f8445=this['editor'],_0x1d6490=_0x3f8445['commands']['get']('toggleAi'),_0x44f862=new _0x2da578(_0x3f8445['locale']);return _0x44f862['set']({'label':Hi(_0x3f8445['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x24ff37,'isToggleable':!0x0}),_0x44f862['bind']('isEnabled')['to'](_0x1d6490),_0x44f862['bind']('isOn')['to'](_0x1d6490,'value',_0x577100=>!!_0x577100),this['listenTo'](_0x44f862,'execute',()=>{_0x1d6490['execute']();}),_0x44f862;}}const xn=['applySuggestion','insertSuggestion','showNext','showPrevious'];class AIBalloonView extends Nt{['_errorView'];constructor(_0x4aa20d){super(_0x4aa20d),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x1e2597){this['showError'](_0x1e2597);}['showError'](_0x346b79){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x346b79,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x2d15fa=new Nt(this['locale']),_0x467307=new Nt(this['locale']);return _0x467307['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x2d15fa['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x1b4e0c=>!_0x1b4e0c)]},'children':[_0x467307]}),_0x2d15fa;}}const Ln=0xa;class AIBalloon extends _0x4127f4{static get['requires'](){return[AIEditing];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_getTargetEditor'](){return this['_currentConfig']?.['targetEditor']??ds(this['context']);}['_isUpdatingMarkers']=!0x1;['open'](_0x224c8d){const {id:_0xc716c3}=this['_currentConfig']??{};this['_currentConfig']=_0x224c8d;const {id:_0x173a02}=this['_currentConfig'];this['isOpen']&&_0xc716c3===_0x173a02?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x2f9881=this['_getTargetEditor']()['plugins']['get']('Dialog');_0x2f9881['isOpen']&&this['_currentConfig']&&_0x2f9881['id']===this['_currentConfig']['id']&&_0x2f9881['hide']();}['_updateDialog'](){const _0x5c1447=this['_getTargetEditor']()['plugins']['get']('Dialog'),{icon:_0x1a5bc8,title:_0x2519fa}=this['_currentConfig'];_0x5c1447['view']?.['headerView']&&(_0x5c1447['view']['headerView']['label']=_0x2519fa,_0x5c1447['view']['headerView']['iconView']&&_0x1a5bc8&&(_0x5c1447['view']['headerView']['iconView']['content']=_0x1a5bc8)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x5c1447['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['showFakeVisualSelection']({'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x523cd0=this['_getTargetEditor']()['plugins']['get']('Dialog'),{id:_0x25c420,title:_0x51f3a5,icon:_0x14c14c,class:_0x580c06,mainView:_0x516fa9}=this['_currentConfig'];_0x516fa9['delegate'](...xn)['to'](this),_0x523cd0['show']({'title':_0x51f3a5,'icon':_0x14c14c,'hasCloseButton':!0x0,'id':_0x25c420,'position':this['_calculateDialogPosition']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x580c06||''),'content':_0x516fa9,'onShow':_0x3209b2=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x3209b2['view']?.['updatePosition']();const _0x237d59=this['_getSelectionElements']();_0x237d59&&_0x237d59[0x0]&&wt({'target':_0x237d59[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x3209b2['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x25c420});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x25c420}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x1569dd,_0x2cb701){if(!_0x2cb701){const _0xdd6894=this['_getTargetRootDomRect']();if(!_0xdd6894)return null;_0x2cb701=_0xdd6894;}const _0x1a929b=this['_getSelectionElements']();if(!_0x1a929b||0x0===_0x1a929b['length'])return{'left':Math['round'](_0x2cb701['left']+_0x2cb701['width']/0x2-_0x1569dd['width']/0x2),'top':Math['round'](_0x2cb701['top']+_0x2cb701['height']/0x2-_0x1569dd['height']/0x2)};const _0x211806=Math['round'](_0x2cb701['left']+_0x2cb701['width']/0x2-_0x1569dd['width']/0x2),_0x101f87=_0x1a929b['map'](_0x45877b=>new ut(_0x45877b)),_0x3fbd02=_0x1569dd['height'];return{'left':_0x211806,'top':this['_calculateOptimalTopPosition'](_0x101f87,_0x3fbd02,_0x2cb701)};}['_calculateOptimalTopPosition'](_0x348103,_0x5b8fcc,_0x19a818){const _0x4a5437=new ut(ct['window']),_0x4ab095=_0x348103['map'](_0x3e71cb=>_0x3e71cb['getVisible']())['filter'](_0x42f84a=>_0x42f84a),_0x17ff31=ut['getBoundingRect'](_0x4ab095);if(!_0x17ff31)return Math['round'](_0x19a818['top']+_0x19a818['height']/0x2);const _0x109cdd=_0x4a5437['getIntersection'](_0x17ff31);if(!_0x109cdd)return Math['round'](_0x19a818['top']+_0x19a818['height']/0x2);const _0x2f990b=_0x19a818['getVisible'](),_0x54e732=_0x2f990b&&_0x17ff31['height']>_0x2f990b['height'],_0x219da1=_0x109cdd['top'],_0xac18a5=_0x109cdd['bottom'];if(_0x54e732){const _0xad49d5=(_0x2f990b||_0x4a5437)['height']/0x2-_0x5b8fcc/0x2,_0x10d5b6=_0x219da1-Ln-_0x19a818['top'],_0x25f95a=_0x19a818['bottom']-_0xac18a5-Ln;return _0x10d5b6>=_0x5b8fcc?Math['max'](Ln,_0x219da1-_0x5b8fcc-Ln):_0x25f95a>=_0x5b8fcc?_0xac18a5+Ln:Math['max'](Ln,_0xad49d5);}const _0x5b5f9c=_0x219da1-_0x5b8fcc,_0xa86c64=_0x19a818['bottom']-_0xac18a5-Ln,_0x33f97b=_0x219da1-Ln-_0x19a818['top'];let _0x3abd0f;if(_0xa86c64>=_0x5b8fcc)_0x3abd0f=_0xac18a5+Ln;else{if(_0x33f97b>=_0x5b8fcc)_0x3abd0f=_0x5b5f9c-Ln;else _0x3abd0f=_0x219da1+_0x17ff31['height']/0x2-_0x5b8fcc/0x2;}return _0x3abd0f;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x1fc03e=this['_getTargetEditor']();this['listenTo'](_0x1fc03e['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0xfcd992,data:{newRange:_0x21716c}}of _0x1fc03e['model']['document']['differ']['getChangedMarkers']())if(_0xfcd992['startsWith'](As+':')&&(_0x21716c&&(_0x21716c['start']['isEqual'](_0x21716c['end'])||'$graveyard'==_0x21716c['root']['rootName'])||null==_0x21716c)){const _0x44c169=Hi(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x44c169),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x43c11b=this['_getTargetEditor']();this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x43c11b['model']['document']);}['_getSelectionElements'](){const _0x5614ab=this['_getTargetEditor']();return _0x5268f3(_0x5614ab['editing'],[..._0x5614ab['model']['markers']['getMarkersGroup']('ai-selection'),..._0x5614ab['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getTargetRootDomRect'](){const _0x12af78=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];if(!_0x12af78)return null;const _0x18e078=this['_getTargetEditor'](),_0x4fd980=_0x18e078['editing']['view']['document']['getRoot'](_0x12af78['rootName']);if(!_0x4fd980)return null;const _0x229658=_0x18e078['editing']['view']['domConverter']['mapViewToDom'](_0x4fd980);return _0x229658&&_0x229658 instanceof HTMLElement?new ut(_0x229658):null;}}class AIMiniToolbarView extends kt{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x5a2f3f,_0x56f9ac={}){super(_0x5a2f3f),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x56f9ac};const _0xb6b29b=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0xb6b29b?'ck-ai-mini-toolbar\x20ck-hidden':'ck-ai-mini-toolbar',this['_config']['showCopy']&&(this['_setupCopyButton'](),this['items']['add'](this['copyButton'])),this['_config']['showChanges']&&(this['_setupShowChangesButton'](),this['items']['add'](this['showChangesButton'])),this['_setupRatingButtons'](),this['_config']['showLike']&&this['items']['add'](this['likeButton']),this['_config']['showDislike']&&this['items']['add'](this['dislikeButton']),this['_config']['customView']&&this['items']['addMany'](this['_config']['customView']);}['toggleShowChangesEnabled'](_0x4720df){this['showChangesButton']['isEnabled']=_0x4720df;}['_setupRatingButtons'](){this['likeButton']=new vt(this['locale']),this['likeButton']['set']({'icon':_0x97c385,'label':Hi(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':Bi,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new vt(this['locale']),this['dislikeButton']['set']({'icon':_0x160b72,'label':Hi(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':Bi,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new vt(this['locale']),this['copyButton']['set']({'icon':_0x45e942,'label':Hi(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+Bi,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x28cc5d=new xt();_0x28cc5d['set']({'content':_0x11d9a5}),_0x28cc5d['extendTemplate']({'attributes':{'class':['ck-ai-mini-toolbar-copy-button__check-mark']}}),this['copyButton']['on']('execute',()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20ck-ai-mini-toolbar-copy-button_copied\x20'+Bi,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+Bi;},0x7d0);}),this['copyButton']['children']['add'](_0x28cc5d);}['_setupShowChangesButton'](){this['showChangesButton']=new vt(this['locale']),this['showChangesButton']['set']({'icon':_0x15ce4c,'label':Hi(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':Bi}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x4bdbb8=>_0x4bdbb8?_0x5e8753:_0x15ce4c),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}}class AIChatBalloonView extends AIBalloonView{['children'];['nextButtonView'];['previousButtonView'];['focusCycler'];['_focusables'];['_focusTracker'];['_keystrokes'];['_config'];['_streamableContentView'];['_toolbarContainerView'];['_partToolbarView'];['_stateView'];['_miniToolbarView'];constructor(_0x4ba8d8,_0x2a45f3){super(_0x4ba8d8);const _0xa881e8=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new _t(),this['_keystrokes']=new It(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Mt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x2a45f3,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x4ba8d8),this['_partToolbarView']=new AISuggestionContentPartToolbarView(_0x4ba8d8,_0x2a45f3['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x2a45f3),this['_stateView']=new AISuggestionContentPartStateView(_0x4ba8d8),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new AIMiniToolbarView(_0x4ba8d8,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new AIChatBalloonToolbarContainerView(_0x4ba8d8,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x4532ec,_0x1be23c,_0x3d084d,_0x51f367)=>{let _0x69248,_0x39b6f6;'pending'===_0x51f367?(_0x69248=this['_partToolbarView'],_0x39b6f6=this['_stateView']):(_0x69248=this['_stateView'],_0x39b6f6=this['_partToolbarView']),this['_stateView']['setState'](_0x3d084d),_0x69248['isVisible']=!0x1,_0x39b6f6['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0xa881e8['to']('_state',_0x17abb7=>'ck-ai-chat-balloon-main_state_'+_0x17abb7)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x2a45f3);});}['render'](){super['render'](),this['nextButtonView']['render'](),this['previousButtonView']['render'](),this['_focusTracker']['add'](this['element']),this['_focusTracker']['add'](this['nextButtonView']),this['_focusTracker']['add'](this['previousButtonView']),this['_focusTracker']['add'](this['_miniToolbarView']),this['_focusTracker']['add'](this['_partToolbarView']),this['_keystrokes']['listenTo'](this['element']),this['_keystrokes']['listenTo'](this['nextButtonView']['element']),this['_keystrokes']['listenTo'](this['previousButtonView']['element']),this['_focusables']['addMany']([this['nextButtonView'],this['previousButtonView'],this['_partToolbarView'],this['_miniToolbarView']]);}['destroy'](){super['destroy'](),this['previousButtonView']['destroy'](),this['nextButtonView']['destroy']();}['focus'](){this['focusCycler']['focusFirst']();}['focusLast'](){this['focusCycler']['focusLast']();}async['updateContent'](_0x18d8cd){_0x18d8cd?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x18d8cd);}['setState'](_0x44f33a){this['_state']=_0x44f33a;}['showError'](_0x189a0d){super['showError'](_0x189a0d),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x1da9c0){super['showBlockingError'](_0x1da9c0),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x1aeeba){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x1aeeba;}['togglePartToolbarEnabled'](_0x1c14d9){this['_partToolbarView']['isEnabled']=_0x1c14d9;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x4de3e5,showSuggestButton:_0x38b3f0}){_0x4de3e5=_0x4de3e5&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x38b3f0=_0x38b3f0&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x4de3e5,'showSuggestButton':_0x38b3f0});}['_createNextButtonView'](){const _0x59cc7c=new vt(this['locale']);return _0x59cc7c['set']({'icon':_0xa89179,'label':Hi(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x59cc7c['on']('execute',()=>{this['fire']('showNext');}),_0x59cc7c;}['_createPreviousButtonView'](){const _0x251fd7=new vt(this['locale']);return _0x251fd7['set']({'icon':_0xb5647,'label':Hi(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x251fd7['on']('execute',()=>{this['fire']('showPrevious');}),_0x251fd7;}}class AIChatBalloonToolbarContainerView extends Nt{constructor(_0xa7cdde,_0x17dc24){super(_0xa7cdde),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x17dc24});}}class AIChatBalloon extends _0x1d5649{static get['requires'](){return[Bt,AIBalloon];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x341f8f){super(_0x341f8f),this['set']('showDiff',!0x1);}['open'](_0x3ccc71){const _0x1597b2=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x1597b2['plugins']['get']('AIBalloon')['open']({..._0x3ccc71,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x3ccc71['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x3ccc71['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x4fe5dc){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x4fe5dc);}['setState'](_0x55ee88){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x55ee88);}['_createChatBalloonView'](){const _0x345aeb=this['editor'],_0x10a379=_0x345aeb['plugins']['get']('AIBalloon'),_0x5dc082=_0x345aeb['commands']['get']('trackChanges');let _0x2780b6=_0x345aeb['config']['get']('ai.availableReplyActions')||[...bs];_0x345aeb['plugins']['has']('TrackChanges')||(_0x2780b6=_0x2780b6['filter'](_0x3d678a=>'insertSuggestion'!=_0x3d678a));const _0x5a37db=new AIChatBalloonView(_0x345aeb['locale'],{'availableActions':_0x2780b6,'showApplyButton':!0x0,'showSuggestButton':!!_0x5dc082});return _0x5a37db['bind']('showDiff')['to'](this),_0x5a37db['delegate'](...Cs)['to'](this),_0x5a37db['delegate']('showPrevious','showNext')['to'](this),_0x10a379['delegate']('dialogClosed')['to'](this),_0x5a37db['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x5a37db['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x5a37db['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x5dc082&&_0x5a37db['bind']('isTrackChangesOn')['to'](_0x5dc082,'value'),_0x5a37db['render'](),_0x5a37db;}['_toggleRotatorButtonsInDialogHeader'](_0x49e55e){const _0x70c52a=this['editor'],_0x3af387=_0x70c52a['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x49e55e),_0x3af387['has'](this['_chatBalloonView']['previousButtonView'])||(_0x3af387['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x70c52a['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x3af387['remove'](this['_chatBalloonView']['previousButtonView']),_0x3af387['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}}class AIEditorIntegration extends _0x1d5649{static get['requires'](){return[AIToggleButtonUI,AIChatBalloon,_0x1509f0];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}function Dn(_0x4f90b8){const {editor:_0x1e2ec4,action:_0x573aa5,withText:_0x1d994e=!0x1,withIcon:_0x5d9f6c=!0x0,isInDropdown:_0x429316=!0x0,shouldPreventFocus:_0x23908e=!0x1}=_0x4f90b8;return()=>{const _0x5179ad=_0x1e2ec4['locale'],_0x28ce20=new vt(_0x5179ad),_0x471f40=_0x28ce20['bindTemplate'];_0x429316&&_0x28ce20['extendTemplate']({'on':{'mouseenter':_0x471f40['to'](()=>{_0x23908e&&_0x23908e()||_0x28ce20['focus']();})}});const _0x34cba5=_0x573aa5['icon']??_0x573aa5['parent']?.['icon'];return _0x28ce20['set']({'label':_0x573aa5['label'],'withText':_0x1d994e,'role':'menuitem','icon':_0x5d9f6c?_0x34cba5??_0x19a02b:void 0x0,'tooltip':!_0x1d994e,'class':'ck-ai-quick-actions-button','isEnabled':_0x573aa5['isEnabled']}),_0x28ce20['on']('execute',()=>{_0x1e2ec4['editing']['view']['focus'](),_0x1e2ec4['commands']['execute']('aiQuickAction',_0x573aa5);}),_0x28ce20;};}class DropdownMenuButtonWithHighlightView extends _0x4d069a{['arrowView'];constructor(_0x190c67,_0x56e761){super(_0x190c67,_0x56e761);const _0x208830=this['bindTemplate'];this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':['ck-dropdown-menu-list__nested-menu__button'],'aria-haspopup':!0x0,'aria-expanded':this['bindTemplate']['to']('isOn',_0x424a03=>String(_0x424a03)),'data-cke-tooltip-disabled':_0x208830['to']('isOn')},'on':{'mouseenter':_0x208830['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x5348a6=new xt();return _0x5348a6['content']=_0xcf9e,_0x5348a6['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x5348a6;}}class AIQuickActionsFilteredListView extends Dt{['_allListItems'];['_allSearchableItems'];constructor(_0x44da18,_0x51ea5c,_0x271d26){super(_0x44da18),this['_allListItems']=_0x51ea5c,this['_allSearchableItems']=_0x271d26;}['filter'](_0x4ebe09){if(!_0x4ebe09)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x2a25b0=_0x4ebe09['source']['toLowerCase']()['trim'](),_0x4a39af=this['_allSearchableItems']['filter'](_0x189186=>(_0x189186['groupLabel']?_0x189186['label']+'\x20('+_0x189186['groupLabel']+')':_0x189186['label'])['toLowerCase']()['includes'](_0x2a25b0));return this['items']['clear'](),this['items']['addMany'](_0x4a39af['sort']((_0x2b461b,_0x31645d)=>{const _0x25fb38=_0x2b461b['groupLabel'],_0x401e57=_0x31645d['groupLabel'];return _0x25fb38||_0x401e57?_0x25fb38?0x1:-0x1:0x0;})['map'](_0x480c5d=>_0x480c5d['item'])),this['_highlightQuery'](_0x2a25b0,_0x4a39af),{'resultsCount':_0x4a39af['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x4afedb,_0x1d5078){if(!_0x4afedb)return;const _0x3f2e61=new RegExp(_0x230461(_0x4afedb),'gi');_0x1d5078['forEach'](_0x5580b0=>{_0x5580b0['highlightViews']&&_0x5580b0['highlightViews']['forEach'](_0x2c415d=>{'function'==typeof _0x2c415d['highlightText']&&_0x2c415d['highlightText'](_0x3f2e61);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x195636=>{_0x195636['highlightViews']&&_0x195636['highlightViews']['forEach'](_0x1bf98e=>{'function'==typeof _0x1bf98e['highlightText']&&_0x1bf98e['highlightText'](null);});});}}const Vn='menu',Pn='menuitem';class AIQuickActionsDropdownContentView extends Nt{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];constructor(_0x25baa1,_0x13b3cd,_0x478d9d,_0x2dd6ad,_0x3ba335=!0x1){const _0x180a4f=_0x25baa1['locale'];super(_0x180a4f),this['_bodyCollection']=_0x2dd6ad,this['_hasSearch']=_0x3ba335;const _0x2fefcd=this['_createListItems'](_0x25baa1,_0x13b3cd,_0x478d9d);this['optionsListView']=new AIQuickActionsFilteredListView(_0x180a4f,_0x2fefcd,this['_allSearchableItems']),this['optionsListView']['role']=Vn,this['optionsListView']['items']['addMany'](_0x2fefcd),this['focusTracker']=new _t(),this['keystrokes']=new It(),_0x3ba335&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x2fefcd,this['focusCycler']=new Mt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x3ba335&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x284bba=_0x3ba335&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x5337b1(_0x284bba),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x180a4f['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x483c44(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':Hi(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':Hi(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x29b466=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x29b466);}['_createListItems'](_0x15ebdd,_0xab1110,_0x22e702){const _0x1dd0c4=new _0x5337b1();return _0xab1110['forEach'](_0x32af02=>{if('actions'in _0x32af02){const {listItem:_0x3197f1}=this['_createActionGroupButton'](_0x15ebdd,_0x32af02,_0x22e702);_0x1dd0c4['add'](_0x3197f1),_0x32af02['actions']['forEach'](_0x5717f7=>{this['_createActionButton'](_0x15ebdd,_0x5717f7,_0x32af02['label'],_0x32af02['icon']);const {listItem:_0x3a0ae9,highlightViews:_0x49ee6}=this['_createSearchResultActionButton'](_0x15ebdd,_0x5717f7,_0x32af02['label'],_0x32af02['icon']);this['_allSearchableItems']['push']({'item':_0x3a0ae9,'label':_0x5717f7['label'],'groupLabel':_0x32af02['label'],'highlightViews':_0x49ee6});});}else{const {listItem:_0x47750b}=this['_createActionButton'](_0x15ebdd,_0x32af02);_0x1dd0c4['add'](_0x47750b);const _0x45d6f0=_0x47750b['children']['first'];if(_0x45d6f0){const {listItem:_0x46e8d4,highlightViews:_0x4d2feb}=this['_createSearchResultActionButton'](_0x15ebdd,_0x32af02);this['_allSearchableItems']['push']({'item':_0x46e8d4,'label':_0x45d6f0['label']||'','highlightViews':_0x4d2feb});}}}),_0x1dd0c4;}['_createActionButton'](_0x1246ed,_0x14f5f2,_0xf51920,_0xddb6b7){const _0x237a41=new Pt(this['locale']);if(_0xf51920&&_0xddb6b7){const _0x3439bd=new vt(this['locale']),_0x51583b=_0x3439bd['bindTemplate'],_0x15bb5c=new _0x3f501c();_0x15bb5c['text']=_0x14f5f2['label'];const _0x2b537a=new _0x3f501c();_0x2b537a['text']=_0xf51920;const _0x1c6e97=new xt();_0x1c6e97['content']=_0xddb6b7,_0x1c6e97['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x434043=new Nt(this['locale']);_0x434043['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x4a673f=new Nt(this['locale']);return _0x4a673f['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x3439bd['set']({'label':_0x14f5f2['label']+'\x20('+_0xf51920+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1}),_0x3439bd['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group'],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x15bb5c,_0x434043,_0x1c6e97,_0x2b537a,_0x4a673f],'on':{'mouseenter':_0x51583b['to'](()=>{this['_isSearchFocused']()||_0x3439bd['focus']();}),'click':_0x51583b['to'](()=>{_0x3439bd['fire']('execute');})}}),_0x3439bd['on']('execute',()=>{_0x1246ed['editing']['view']['focus'](),_0x1246ed['commands']['execute']('aiQuickAction',_0x14f5f2);}),_0x237a41['children']['add'](_0x3439bd),{'listItem':_0x237a41,'highlightViews':[_0x15bb5c,_0x2b537a]};}{const _0x5706f0=new _0x31a0ee(),_0x546562=new vt(this['locale'],_0x5706f0),_0x1f80ef=_0x546562['bindTemplate'],_0x504d62=_0x14f5f2['icon']??_0x14f5f2['parent']?.['icon'],_0x458b9e=void 0x0!==_0x14f5f2['icon'];return _0x546562['set']({'label':_0x14f5f2['label'],'withText':!0x0,'role':'menuitem','icon':_0x458b9e?_0x504d62??_0x19a02b:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button'}),_0x546562['extendTemplate']({'on':{'mouseenter':_0x1f80ef['to'](()=>{this['_isSearchFocused']()||_0x546562['focus']();})}}),_0x546562['on']('execute',()=>{_0x1246ed['editing']['view']['focus'](),_0x1246ed['commands']['execute']('aiQuickAction',_0x14f5f2);}),_0x237a41['children']['add'](_0x546562),{'listItem':_0x237a41,'highlightViews':[_0x5706f0]};}}['_createSearchResultActionButton'](_0x379ae4,_0x53b234,_0x29a7ed,_0x32ca00){return _0x29a7ed&&_0x32ca00?this['_createSearchResultGroupedActionButton'](_0x379ae4,_0x53b234,_0x29a7ed,_0x32ca00):this['_createSearchResultIndividualActionButton'](_0x379ae4,_0x53b234);}['_createSearchResultGroupedActionButton'](_0x5dc8a9,_0x32be8a,_0x4f5dbc,_0x54276a){const _0x4f2930=new Pt(this['locale']),_0x4f8f2d=new vt(this['locale']),_0x40d960=_0x4f8f2d['bindTemplate'],{view:_0x4ec33f,highlightView:_0x1f30e0}=this['_createSearchResultGroupRow'](_0x4f5dbc,_0x54276a),{view:_0xbc0811,highlightView:_0x37296e}=this['_createSearchResultActionRow'](_0x32be8a['label']),_0x41658b=this['_createSearchResultContentView'](_0x4ec33f,_0xbc0811);return _0x4f8f2d['set']({'label':_0x32be8a['label'],'withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button\x20ck-ai-quick-actions-search-result-button_with-group','tooltip':!0x1}),_0x4f8f2d['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-search-result-button','ck-ai-quick-actions-search-result-button_with-group'],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x41658b],'on':{'mouseenter':_0x40d960['to'](()=>{this['_isSearchFocused']()||_0x4f8f2d['focus']();}),'click':_0x40d960['to'](()=>{this['_handleSearchResultButtonClick'](_0x4f8f2d);})}}),this['_setupActionButtonExecution'](_0x4f8f2d,_0x5dc8a9,_0x32be8a),_0x4f2930['children']['add'](_0x4f8f2d),{'listItem':_0x4f2930,'highlightViews':[_0x1f30e0,_0x37296e]};}['_createSearchResultIndividualActionButton'](_0x35fa,_0x29ed1c){const _0x3dec72=new Pt(this['locale']),_0x331ddb=new _0x31a0ee(),_0x5c8f6e=new vt(this['locale'],_0x331ddb),_0x52f6a7=_0x5c8f6e['bindTemplate'];return _0x5c8f6e['set']({'label':_0x29ed1c['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button'}),_0x5c8f6e['extendTemplate']({'on':{'mouseenter':_0x52f6a7['to'](()=>{this['_isSearchFocused']()||_0x5c8f6e['focus']();})}}),this['_setupActionButtonExecution'](_0x5c8f6e,_0x35fa,_0x29ed1c),_0x3dec72['children']['add'](_0x5c8f6e),{'listItem':_0x3dec72,'highlightViews':[_0x331ddb]};}['_createSearchResultGroupRow'](_0x58cdb8,_0x564429){const _0x505ea1=new Nt(this['locale']),_0x2dc399=new xt();_0x2dc399['content']=_0x564429,_0x2dc399['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x5b77e4=new _0x3f501c();return _0x5b77e4['text']=_0x58cdb8,_0x505ea1['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x2dc399,_0x5b77e4]}),{'view':_0x505ea1,'highlightView':_0x5b77e4};}['_createSearchResultActionRow'](_0x36cfc5){const _0x4d6341=new Nt(this['locale']),_0x111f0e=new _0x3f501c();return _0x111f0e['text']=_0x36cfc5,_0x4d6341['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x111f0e]}),{'view':_0x4d6341,'highlightView':_0x111f0e};}['_createSearchResultContentView'](_0x552003,_0x3f8fd0){const _0x188003=new Nt(this['locale']);return _0x188003['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x552003,_0x3f8fd0]}),_0x188003;}['_setupActionButtonExecution'](_0x2bbf56,_0xfa81e8,_0x4bdbbd){_0x2bbf56['on']('execute',()=>{_0xfa81e8['editing']['view']['focus'](),_0xfa81e8['commands']['execute']('aiQuickAction',_0x4bdbbd);});}['_createActionGroupButton'](_0x498b08,_0xde218b,_0x399634){const _0x54ef83=new Pt(this['locale']),_0x5f2ae8=new _0x31a0ee(),_0x3d7769=new DropdownMenuButtonWithHighlightView(this['locale'],_0x5f2ae8),_0x133906=_0x3d7769['bindTemplate'],_0x29d96c=this['_getPanelKeystroke'](_0x399634),_0x2a738b=this['_createGroupActionsList'](_0x498b08,_0xde218b['actions'],_0x399634);_0x3d7769['set']({'label':_0xde218b['label'],'withText':!0x0,'role':Pn,'icon':_0xde218b['icon']??_0x19a02b,'isEnabled':_0xde218b['actions']['some'](_0x5284f4=>_0x5284f4['isEnabled'])}),_0x3d7769['extendTemplate']({'on':{'mouseenter':_0x133906['to'](()=>{this['_isSearchFocused']()||_0x3d7769['focus']();})}});const _0x1f6727=new Xt(this['locale']);return _0x1f6727['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x133906['to'](_0x19b473=>{this['_handlePanelKeydown'](_0x19b473,_0x29d96c,_0x3d7769,_0x1f6727);})}}),_0x3d7769['bind']('isOn')['to'](_0x1f6727,'isVisible'),this['_bodyCollection']['add'](_0x1f6727),_0x1f6727['content']['add'](_0x2a738b),this['_setupGroupMenuBehavior'](_0x3d7769,_0x1f6727),_0x54ef83['children']['add'](_0x3d7769),{'listItem':_0x54ef83,'highlightView':_0x5f2ae8};}['_createGroupActionsList'](_0x85c720,_0x24658a,_0x6369f6){const _0x30dd6e=new Dt(this['locale']);return _0x30dd6e['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x24658a['forEach'](_0x2e075b=>{const _0x599e17=new Pt(this['locale']),_0x4980ce=Dn({'editor':_0x85c720,'action':_0x2e075b,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused']()})();_0x599e17['children']['add'](_0x4980ce),_0x6369f6['focusTracker']['add'](_0x4980ce),_0x30dd6e['items']['add'](_0x599e17);}),_0x30dd6e;}['_setupGroupMenuBehavior'](_0x5c5b31,_0x2b0562){const _0x36ff9c=_0x5c5b31['bindTemplate'],_0x473fe7=this['_getButtonKeystroke'](_0x5c5b31);_0x5c5b31['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x36ff9c['to'](()=>{this['_showNestedPanel'](_0x2b0562,_0x5c5b31);}),'mouseleave':_0x36ff9c['to'](_0x3d36b0=>{const _0x47392e=_0x3d36b0['relatedTarget'];this['_isMovingToNestedMenu'](_0x47392e,_0x2b0562)||this['_hideNestedPanel'](_0x2b0562);}),'keydown':_0x36ff9c['to'](_0x57a1a5=>{_0x57a1a5['key']==_0x473fe7&&(this['_showNestedPanel'](_0x2b0562,_0x5c5b31),_0x2b0562['content']['get'](0x0)['focus']());})}}),_0x2b0562['on']('render',()=>{_0x2b0562['element']?.['addEventListener']('mouseleave',_0x2f98d8=>{const _0x53ccc8=_0x2f98d8['relatedTarget'];_0x5c5b31['element']?.['contains'](_0x53ccc8)||this['_isMovingToNestedMenu'](_0x53ccc8,_0x2b0562)||this['_hideNestedPanel'](_0x2b0562);});});}['_showNestedPanel'](_0x395ae4,_0x3b97ac){this['_openNestedPanels']['forEach'](_0x542cda=>{_0x542cda!==_0x395ae4&&_0x542cda['isVisible']&&_0x542cda['hide']();}),_0x395ae4['show'](),_0x395ae4['pin']({'positions':[_0x597eef['eastSouth']],'target':_0x3b97ac['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x395ae4);}['_hideNestedPanel'](_0x5d4106){_0x5d4106['hide'](),this['_openNestedPanels']['delete'](_0x5d4106);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x195025=>_0x195025['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x4c7342,_0x4e351f){if(!_0x4c7342)return!0x1;if(_0x4e351f['element']?.['contains'](_0x4c7342))return!0x0;const _0x440ecb=_0x4c7342;return _0x440ecb['closest']&&(null!==_0x440ecb['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x440ecb['closest']('.ck-ai-quick-actions-group-list')||null!==_0x440ecb['closest']('.ck-ai-quick-actions-group-button'));}['resetSearch'](){this['_searchTextView']&&this['_searchTextView']['reset']();}['destroy'](){this['_hideAllNestedPanels'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}['focus'](){this['_searchTextView']?this['_searchTextView']['focus']():this['optionsListView']['focus']();}['_getPanelKeystroke'](_0x3cd4a8){return'rtl'===_0x3cd4a8['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x148e39){return'rtl'===_0x148e39['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x37928b,_0x24d3c3,_0x3c49c6,_0x1a036d){_0x37928b['key']==_0x24d3c3&&(_0x3c49c6['focus'](),this['_hideNestedPanel'](_0x1a036d));}['_handleSearchResultButtonClick'](_0x57de1f){_0x57de1f['fire']('execute');}}function Hn(_0xa2f4f4){const {editor:_0x2a7add,content:_0x4e2480,buttonDefinition:_0x510fbd,bodyCollection:_0x58dfaf,hasSearch:_0x4eb605=!0x1}=_0xa2f4f4;return()=>{const _0x1f240d=_0x2a7add['locale'],_0x32a396=_0x2a7add['commands']['get']('aiQuickAction'),_0x1d0135=Gt(_0x1f240d);_0x1d0135['bind']('isEnabled')['to'](_0x32a396),_0x1d0135['buttonView']['set']({'icon':_0x510fbd['icon']??_0x19a02b,'label':_0x510fbd['label'],'tooltip':!0x0}),_0x1d0135['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x5f285a=new AIQuickActionsDropdownContentView(_0x2a7add,_0x4e2480,_0x1d0135,_0x58dfaf,_0x4eb605);return _0x1d0135['panelView']['children']['add'](_0x5f285a),_0x4eb605&&_0x1d0135['on']('change:isOpen',(_0x34aa15,_0x40b0d8,_0x18e470)=>{if(_0x18e470){if(_0x2a7add['plugins']['has']('AIEditing')){const _0x4b1399=_0x2a7add['plugins']['get'](AIEditing),_0x5b3509=_0x2a7add['model']['document']['selection'],_0xe0cb76=Array['from'](_0x5b3509['getRanges']());_0xe0cb76['length']>0x0&&_0x4b1399['showFakeVisualSelection']({'ranges':_0xe0cb76,'id':'quick-action','priority':0x14});}}else _0x2a7add['plugins']['has']('AIEditing')&&_0x2a7add['plugins']['get'](AIEditing)['hideFakeVisualSelection']('quick-action'),_0x5f285a['resetSearch']();}),_0x1d0135;};}const Mn='<task>Explain\x20the\x20selected\x20part\x20of\x20the\x20document\x20in\x20plain,\x20simple\x20language.</task><rules>1.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is:-\x20If\x20it\x20looks\x20like\x20a\x20definition\x20explain\x20the\x20concept\x20in\x20simple\x20terms.-\x20If\x20it\x20looks\x20like\x20a\x20description\x20clarify\x20what\x20it\x20is\x20describing\x20and\x20why\x20it\x20matters.-\x20If\x20it\x20contains\x20technical\x20terms\x20or\x20jargon\x20break\x20them\x20down\x20into\x20everyday\x20language.-\x20If\x20it\x20looks\x20instructional\x20restate\x20as\x20clear\x20steps\x20someone\x20can\x20follow.-\x20If\x20it\x20provides\x20examples\x20explain\x20what\x20the\x20example\x20shows\x20and\x20why\x20it\x27s\x20relevant.-\x20If\x20it\x20presents\x20an\x20argument\x20or\x20claim\x20restate\x20the\x20claim\x20neutrally\x20and\x20explain\x20its\x20purpose.-\x20If\x20it\x20is\x20narrative/story-like\x20explain\x20what\x20event\x20or\x20situation\x20is\x20being\x20described.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20explain\x20what\x20the\x20data\x20indicates.-\x20If\x20it\x20is\x20a\x20quotation\x20explain\x20the\x20meaning\x20of\x20the\x20quote\x20in\x20context.-\x20If\x20it\x20compares/contrasts\x20things\x20explain\x20the\x20key\x20differences\x20or\x20similarities\x20simply.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20of\x20the\x20categories\x20above\x20give\x20a\x20clear,\x20plain-language\x20explanation\x20of\x20its\x20meaning,\x20focusing\x20on\x20usefulness.2.\x20Provide\x20context\x20if\x20the\x20meaning\x20could\x20be\x20unclear\x20without\x20it.\x20(e.g.,\x20explain\x20where\x20such\x20a\x20term\x20might\x20be\x20used,\x20or\x20why\x20it\x20is\x20important).3.\x20Keep\x20the\x20explanation\x20short\x20but\x20complete\x20(2–5\x20sentences).-\x20Avoid\x20overly\x20technical\x20detail\x20unless\x20it\x20is\x20necessary\x20for\x20understanding.4.\x20Do\x20not\x20simply\x20repeat\x20the\x20original\x20text\x20—\x20restate\x20and\x20expand\x20it\x20in\x20plain\x20words.5.\x20If\x20possible,\x20add\x20a\x20short\x20example\x20or\x20analogy\x20to\x20make\x20it\x20easier\x20to\x20understand.6.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20explanation.7.\x20Your\x20explanation\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20explanation,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant,\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',Un='<task>Summarize\x20the\x20selected\x20part\x20of\x20the\x20document\x20in\x202–4\x20clear\x20sentences,\x20capturing\x20only\x20the\x20essential\x20meaning.</task><rules>1.\x20Your\x20summary\x20should\x20be\x20short\x20and\x20clear:-\x20Aim\x20for\x202–4\x20sentences\x20unless\x20the\x20text\x20is\x20extremely\x20short.-\x20Focus\x20on\x20capturing\x20the\x20main\x20idea(s)\x20without\x20unnecessary\x20detail.2.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is\x20and\x20adapt\x20the\x20summary\x20style:-\x20If\x20it\x20is\x20descriptive\x20condense\x20the\x20description\x20into\x20its\x20core\x20idea.-\x20If\x20it\x20is\x20argumentative\x20or\x20opinion-based\x20summarize\x20the\x20main\x20claim\x20and\x20reasoning\x20neutrally.-\x20If\x20it\x20is\x20narrative/story-like\x20capture\x20the\x20main\x20event\x20or\x20outcome\x20without\x20side\x20details.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20summarize\x20what\x20the\x20data\x20shows\x20in\x20plain\x20language.-\x20If\x20it\x20is\x20instructional\x20restate\x20the\x20overall\x20purpose\x20of\x20the\x20steps\x20without\x20listing\x20every\x20step.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20of\x20the\x20categories\x20above\x20provide\x20a\x20general\x20concise\x20summary.3.\x20Provide\x20context\x20if\x20necessary\x20for\x20clarity:-\x20Mention\x20the\x20subject\x20or\x20topic\x20explicitly\x20so\x20the\x20summary\x20can\x20stand\x20alone.4.\x20Do\x20not\x20simply\x20copy\x20sentences\x20from\x20the\x20original\x20text\x20—\x20rephrase\x20in\x20plain\x20language.5.\x20Avoid\x20adding\x20new\x20information\x20or\x20interpretation\x20not\x20present\x20in\x20the\x20text.6.\x20Summarize\x20in\x20a\x20way\x20that\x20would\x20make\x20sense\x20to\x20someone\x20who\x20has\x20not\x20read\x20the\x20original\x20text.7.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20summary.8.\x20Your\x20summary\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20summary,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',Bn='<task>Extract\x20and\x20present\x20the\x20key\x20points\x20from\x20the\x20selected\x20part\x20of\x20the\x20document\x20as\x20a\x20concise\x20bulleted\x20list.</task><rules>1.\x20Present\x20the\x20output\x20as\x20a\x20clear,\x20structured\x20list\x20(bullets\x20or\x20numbered).-\x20Each\x20point\x20should\x20be\x20concise\x20(one\x20sentence\x20or\x20less).-\x20Do\x20not\x20merge\x20distinct\x20ideas\x20into\x20one\x20bullet.2.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is\x20and\x20adapt\x20the\x20extraction\x20style:-\x20If\x20it\x20is\x20descriptive\x20capture\x20the\x20main\x20attributes\x20or\x20features.-\x20If\x20it\x20is\x20argumentative\x20extract\x20the\x20main\x20claim\x20and\x20supporting\x20reasons\x20separately.-\x20If\x20it\x20is\x20narrative/story-like\x20extract\x20the\x20main\x20events\x20in\x20chronological\x20order.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20highlight\x20the\x20most\x20important\x20facts\x20or\x20numbers.-\x20If\x20it\x20is\x20instructional\x20list\x20the\x20steps\x20or\x20main\x20actions\x20in\x20simplified\x20form-\x20If\x20it\x20provides\x20comparisons\x20extract\x20the\x20contrasted\x20items\x20and\x20their\x20differences/similarities.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20category\x20above\x20extract\x20the\x20main\x20ideas\x20in\x20plain,\x20short\x20statements.3.\x20Keep\x20the\x20list\x20between\x203–7\x20items\x20where\x20possible.-\x20If\x20the\x20text\x20is\x20very\x20short,\x20fewer\x20items\x20are\x20fine.-\x20If\x20it\x20is\x20very\x20long,\x20focus\x20on\x20the\x20most\x20important\x20ideas\x20only.4.\x20Do\x20not\x20copy\x20long\x20text\x20fragments\x20—\x20restate\x20in\x20simple\x20words.5.\x20Do\x20not\x20add\x20interpretation,\x20evaluation,\x20or\x20commentary\x20beyond\x20the\x20text.6.\x20Ensure\x20the\x20list\x20can\x20stand\x20alone\x20without\x20requiring\x20the\x20reader\x20to\x20see\x20the\x20original\x20document.7.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20key\x20points.8.\x20Your\x20key\x20points\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20key\x20points\x20list,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',Gn=/* #__PURE__ -- @preserve */
28
- ((()=>({'chat':'AIChat','action':'AIActions'}))());class AIQuickActionsUI extends _0x1d5649{static get['requires'](){return[_0x3811be,AIConnector];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['init'](){const _0x26bfb4=await this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x26bfb4),this['_initializeQuickActionsComponentsAndCommands']();}static['getDefaultQuickActions'](_0x35102d){return function(_0x58420f){const _0x4fc1e7=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x58420f['uiLanguage']),_0x3a0b5f=_0x4fc1e7||'English',_0x314608=[{'id':'ask-ai','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x42ff52},{'id':'chat-commands','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x42ff52,'actions':[{'id':'explain','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Hi(_0x58420f,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':Mn['replace']('%0',_0x3a0b5f),'type':'chat'},{'id':'summarize','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Hi(_0x58420f,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Un['replace']('%0',_0x3a0b5f),'type':'chat'},{'id':'highlight-key-points','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Hi(_0x58420f,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Bn['replace']('%0',_0x3a0b5f),'type':'chat'}]},{'id':'improve-writing','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x59b680},{'id':'continue','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x95e427},{'id':'fix-grammar','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x56d1e0},{'id':'adjust-length','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x3ac9b4,'actions':[{'id':'make-shorter','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x5c6fef,'actions':[{'id':'make-tone-casual','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x9de076,'actions':[{'id':'translate-to-english','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Hi(_0x58420f,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x141944,'actions':[]}];return _0x314608;}(_0x35102d);}async['_getDefaultAndCustomActions'](){const _0x3ca803=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x3b23dc=this['editor']['config']['get']('ai.quickActions.extraCommands')||[];let _0x8933b9,_0x223133=[];try{const _0x28cea2=new AIModels({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']});_0x223133=await _0x28cea2['getAll'](),_0x8933b9=(await _0x28cea2['getDefault']())?.['id'];}catch(_0x317c4f){const _0x599a6c=new at('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x317c4f});Ct(_0x599a6c['message']);}finally{const _0x43bce3=_0x3b23dc['map'](_0x5265b7=>({..._0x5265b7,'type':'chat'===_0x5265b7['type']?'chat':'action','model':'chat'!==_0x5265b7['type']?_0x5265b7['model']||_0x8933b9:_0x5265b7['model'],'icon':void 0x0}));_0x3ca803['find'](_0x57df74=>'other'===_0x57df74['id'])['actions']['push'](..._0x43bce3),_0x3ca803['forEach'](_0x455311=>{if('actions'in _0x455311)_0x455311['actions']['forEach'](_0x423eb0=>{if(_0x423eb0['isEnabled']=!!_0x223133['find'](_0x429ac9=>_0x429ac9['id']===_0x423eb0['model'])||void 0x0===_0x423eb0['model'],!_0x423eb0['isEnabled']){const _0x4a682c=new at('ai-quick-actions-unavailable-model',this,{'actionId':_0x423eb0['id'],'modelId':_0x423eb0['model']});Ct(_0x4a682c['message']);}});else{if(_0x455311['isEnabled']=!!_0x223133['find'](_0x25f707=>_0x25f707['id']===_0x455311['model'])||void 0x0===_0x455311['model'],!_0x455311['isEnabled']){const _0x58f322=new at('ai-quick-actions-unavailable-model',this,{'actionId':_0x455311['id'],'modelId':_0x455311['model']});Ct(_0x58f322['message']);}}});}return _0x3ca803;}['_initializeQuickActionsComponentsAndCommands'](){const _0x2a4944=new Qt(this['editor']['locale']);_0x2a4944['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x2a4944),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x2a4944);}['_initializeQuickActionsDropdown'](_0x4f55dd){const _0x4701e4=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',Hn({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x19a02b,'label':Hi(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x4f55dd,'hasSearch':_0x4701e4}));}['_prepareQuickActionsDefinition'](_0x307e21){this['_quickActionsDefinition']=_0x307e21['map'](_0xb83be2=>{if('actions'in _0xb83be2){const _0x341bfa=_0xb83be2;return{..._0x341bfa,'actions':_0x341bfa['actions']['map'](_0x5b5e60=>{const {actions:_0x1a7b4b,..._0x53a8f8}=_0x341bfa;return{..._0x5b5e60,'parent':_0x53a8f8};})['filter'](_0x5af241=>this['_shouldIncludeAction'](_0x5af241))};}return _0xb83be2;})['filter'](_0x1b9e54=>'actions'in _0x1b9e54?_0x1b9e54['actions']['length']>0x0:this['_shouldIncludeAction'](_0x1b9e54));}['_shouldIncludeAction'](_0x27d03d){const _0x19a0ef=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](Gn[_0x27d03d['type']])&&!_0x19a0ef['includes'](_0x27d03d['id'])&&!('chat'===_0x27d03d['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x45b3c2){this['_quickActionsDefinition']['forEach'](_0x44cf21=>{if('actions'in _0x44cf21){const _0x222410=Hn({'editor':this['editor'],'content':_0x44cf21['actions'],'buttonDefinition':_0x44cf21,'bodyCollection':_0x45b3c2});this['editor']['ui']['componentFactory']['add'](_0x44cf21['id'],_0x222410),_0x44cf21['actions']['forEach'](_0x48652a=>{const _0x3da729=Dn({'editor':this['editor'],'action':_0x48652a});this['editor']['ui']['componentFactory']['add'](_0x48652a['id'],_0x3da729);});}else{const _0x59c147=Dn({'editor':this['editor'],'action':_0x44cf21,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1});this['editor']['ui']['componentFactory']['add'](_0x44cf21['id'],_0x59c147);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x22e04c=>{const _0x384bc7=this['editor']['commands']['get']('aiQuickAction'),_0x57e6aa=new Kt(_0x22e04c),_0x1751ad=Hi(_0x22e04c,'AI_QUICK_ACTIONS_HEADING');_0x57e6aa['buttonView']['set']({'label':_0x1751ad,'icon':_0x19a02b});const _0x580fc8=new $t(_0x22e04c);return _0x580fc8['set']({'ariaLabel':_0x1751ad,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x233c16=>{if('actions'in _0x233c16){const _0x3eec45=_0x233c16,_0x1323d9=new qt(_0x22e04c,_0x57e6aa),_0x14c190=new Kt(_0x22e04c),_0x80680a=new $t(_0x22e04c);_0x14c190['buttonView']['set']({'label':_0x3eec45['label'],'icon':_0x3eec45['icon']}),_0x3eec45['actions']['forEach'](_0x54758c=>{const _0x502de4=new qt(_0x22e04c,_0x14c190),_0xf05b49=new Wt(_0x22e04c);_0xf05b49['set']({'label':_0x54758c['label'],'icon':_0x54758c['icon'],'role':'menuitem','isEnabled':_0x54758c['isEnabled']}),_0xf05b49['on']('execute',()=>{this['_executeQuickAction'](_0x54758c);}),_0xf05b49['delegate']('execute')['to'](_0x14c190),_0x502de4['children']['add'](_0xf05b49),_0x80680a['items']['add'](_0x502de4);}),_0x14c190['panelView']['children']['add'](_0x80680a),_0x1323d9['children']['add'](_0x14c190),_0x580fc8['items']['add'](_0x1323d9);}else{const _0x136a93=_0x233c16,_0x26b743=new qt(_0x22e04c,_0x57e6aa),_0x4e6494=new Wt(_0x22e04c);_0x4e6494['set']({'label':_0x136a93['label'],'icon':_0x136a93['icon'],'role':'menuitem','isEnabled':_0x136a93['isEnabled']}),_0x4e6494['on']('execute',()=>{this['_executeQuickAction'](_0x136a93);}),_0x4e6494['delegate']('execute')['to'](_0x57e6aa),_0x26b743['children']['add'](_0x4e6494),_0x580fc8['items']['add'](_0x26b743);}}),(Object['values'](Gn)['some'](_0x5972df=>this['editor']['plugins']['has'](_0x5972df))?_0x57e6aa['bind']('isEnabled')['to'](_0x384bc7):_0x57e6aa['set']({'isEnabled':!0x1}),_0x57e6aa['panelView']['children']['add'](_0x580fc8),_0x57e6aa);});}['_executeQuickAction'](_0x4a0c2a){const _0x325e14=this['editor'];_0x325e14['editing']['view']['focus'](),_0x325e14['commands']['execute']('aiQuickAction',_0x4a0c2a);const _0xf74dc2=_0x325e14['ui']['view']['menuBarView'];_0xf74dc2&&_0xf74dc2['close']&&_0xf74dc2['close']();}}class AIQuickActionsCommand extends _0x57166c{['execute'](_0x7163ac){switch(this['_expandSelectionIfCollapsed'](),_0x7163ac['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x463876=Hi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new at('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x463876});}this['_handleAIChatAction'](_0x7163ac);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x5e8d20=Hi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new at('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x5e8d20});}this['_handleAIActionsAction'](_0x7163ac);}}async['_handleAIChatAction'](_0x20fb61){const _0x350552=this['editor']['plugins']['get']('AIChatController'),_0x28d00b=this['editor']['plugins']['get']('AITabs')['view'];if(_0x28d00b['isVisible']||(_0x28d00b['isVisible']=!0x0),'chat'!==_0x28d00b['activeTab']&&_0x28d00b['activateTab']('chat'),'ask-ai'===_0x20fb61['id'])_0x350552['removeSelectionFromChatContext'](),_0x350552['addSelectionToChatContext'](),_0x350552['focusPromptInput']();else await _0x350552['startConversation']({'modelId':_0x20fb61['model']}),_0x350552['removeSelectionFromChatContext'](),_0x350552['addSelectionToChatContext'](),_0x350552['focusPromptInput'](),await _0x350552['sendMessage']({'message':_0x20fb61['prompt']||_0x20fb61['displayedPrompt']||_0x20fb61['label'],'attributes':{'quickActionData':{'id':_0x20fb61['id']},'displayedPrompt':_0x20fb61['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x13213b=this['editor'],_0x1bf82d=_0x13213b['model']['document']['selection'];if(!_0x1bf82d['isCollapsed'])return;const _0x37b315=At(_0x1bf82d['getSelectedBlocks']())||_0x13213b['model']['schema']['getLimitElement'](_0x1bf82d);_0x13213b['model']['change'](_0x15e713=>{_0x15e713['setSelection'](_0x37b315,'in');});}['_handleAIActionsActionLabel'](_0x155b23){return _0x155b23['parent']?.['label']&&'other'!==_0x155b23['parent']?.['id']?_0x155b23['parent']['label']+':\x20'+_0x155b23['label']:_0x155b23['label'];}async['_handleAIActionsAction'](_0x883a45){const _0x5ddf31=this['editor']['plugins']['get']('AIActions'),_0x4a5ce7=_0x883a45['prompt']?{'userMessage':_0x883a45['prompt'],'model':_0x883a45['model']}:{'actionName':_0x883a45['actionName']||_0x883a45['id'],'args':_0x883a45['args']},_0xec540a=this['_handleAIActionsActionLabel'](_0x883a45);await _0x5ddf31['executeAction'](_0x4a5ce7,_0xec540a,_0x883a45['icon']);}}class AIQuickActionsEditing extends _0x1d5649{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x5629d6=this['editor'],_0x12de71=new AIQuickActionsCommand(this['editor']);if(_0x5629d6['commands']['add']('aiQuickAction',_0x12de71),_0x5629d6['plugins']['has']('AIChat')){const _0x74eb57=this['editor']['plugins']['get']('AIChatController');_0x5629d6['model']['document']['selection']['on']('change:range',(_0x29e3bb,_0xea02d8)=>{_0xea02d8['directChange']&&_0x74eb57['removeSelectionFromChatContext']();});}}}class AIActionsReply extends AIReply{['updateChangeGroups'](){if(this['parsedMergedContent']=this['parsedContent']['cloneNode'](!0x0),0x0==this['parsedMergedContent']['childNodes']['length'])return void(this['changeGroups']=[]);const _0x12b5d5=this['documentContextContent']['children']['map'](_0x5ac909=>({'node':_0x5ac909,'id':$i(_0x5ac909,'data-id')})),_0x2b8a53=this['parsedMergedContent']['children']['map'](_0x471b35=>({'node':_0x471b35,'id':$i(_0x471b35,'data-id')||ot()})),_0x55cc3d=_0x2b7e81(_0x12b5d5,_0x2b8a53,{'comparator':(_0x29e558,_0x911ef2)=>_0x29e558['id']==_0x911ef2['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x55cc3d['length']&&_0x55cc3d[_0x55cc3d['length']-0x1]['removed'];)_0x55cc3d['pop']();}const _0x1ffe33=_0x55cc3d['map'](_0x274b63=>{const _0x1703aa=_0x274b63['added']?'new':_0x274b63['removed']?'removed':'modified';return{'node':_0x274b63['value'][0x0]['node'],'type':_0x1703aa,'id':_0x274b63['value'][0x0]['id']};});this['changeGroups']=[{'changes':_0x1ffe33,'state':'pending','index':0x0}];}['_getDifferentChangeGroups'](_0x1992f5,_0x3e0345){return _0x3e0345;}}class AIActionsInteraction extends AIInteraction{['content'];['version'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x25a3b7){super(_0x25a3b7),this['content']=_0x25a3b7['content'],this['version']=_0x25a3b7['version'],this['actionName']=_0x25a3b7['actionName'],this['args']=_0x25a3b7['args'],this['userMessage']=_0x25a3b7['userMessage'],this['model']=_0x25a3b7['model'],this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}async['sendRequest'](){return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args']}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html'});}['getDocumentContext'](){return{'type':'text','content':this['content'],'version':this['version'],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x342748){const _0x2f6c13=new AIActionsReply({'locale':this['locale'],'documentContextContent':this['content'],..._0x342748});return this['replies']['push'](_0x2f6c13),_0x2f6c13['delegate'](...rs)['to'](this),this['fire']('replyCreated',_0x2f6c13),_0x2f6c13;}}class AIActionsBalloonToolbarView extends kt{constructor(_0x221b59,_0xe4baff=!0x0,_0x11b299=!0x0){super(_0x221b59),this['set']('isEnabled',!0x1),_0xe4baff&&(this['applyButton']=this['_createButton'](Hi(_0x221b59,'AI_BALLOON_APPLY_BUTTON'),Mi),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x11b299&&(this['suggestButton']=this['_createButton'](Hi(_0x221b59,'AI_BALLOON_SUGGEST_BUTTON'),_0xe4baff?Ui:Mi),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0xe4baff,'showSuggestButton':_0x11b299}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x25168e,showSuggestButton:_0x2eb94e}){this['applyButton']&&(this['applyButton']['isVisible']=_0x25168e),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x2eb94e);}['_createButton'](_0x40914b,_0xa32c01){const _0xab6530=new vt(this['locale']);return _0xab6530['set']({'label':_0x40914b,'class':_0xa32c01,'isVisible':!0x0,'withText':!0x0}),_0xab6530;}}class AIActionsBalloonDisclaimerView extends Nt{constructor(_0xb621f6){super(_0xb621f6),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':Hi(_0xb621f6,'AI_DISCLAIMER_TEXT')}]}]});}}class AISuggestionLoaderView extends Nt{constructor(_0x33bac8){super(_0x33bac8),this['set']('isVisible',!0x0);const _0x46e752=new AISpinnerView('small');_0x46e752['isVisible']=!0x0;const _0x3dcf5a=new Nt(this['locale']);_0x3dcf5a['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[Hi(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x2f90ac=>!_0x2f90ac)]},'children':[_0x46e752,_0x3dcf5a]});}}class AIActionsBalloonView extends AIBalloonView{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x1bf90e,_0xac00e9){super(_0x1bf90e),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0xac00e9,this['_focusTracker']=new _t(),this['_keystrokes']=new It(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Mt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x5337b1(),this['_addContentWrapper'](_0xac00e9),this['_addDisclaimerView'](),this['_addToolbar'](_0xac00e9),this['_focusables']['clear'](),this['_focusables']['addMany']([this['_toolbarView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-main']},'children':this['_dialogContent']}),this['on']('change:isTrackChangesOn',()=>{this['_toggleToolbarButtonsVisibility'](_0xac00e9);});}['render'](){super['render']();for(const _0x5d8630 of this['_focusables'])this['_focusTracker']['add'](_0x5d8630['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy']();}['focus'](_0xe9a215){-0x1===_0xe9a215?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x297c3d){this['_isLoading']=_0x297c3d;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x3499ae){super['showError'](_0x3499ae),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x52d479){super['showBlockingError'](_0x52d479),this['setErrorState']();}['addMiniToolbarItem'](_0x41ba25){this['_miniToolbarView']['items']['has'](_0x41ba25)||this['_miniToolbarView']['items']['add'](_0x41ba25);}['removeMiniToolbarItem'](_0x493ca4){this['_miniToolbarView']['items']['has'](_0x493ca4)&&this['_miniToolbarView']['items']['remove'](_0x493ca4);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0xe089aa,showSuggestButton:_0x1e8380}){_0xe089aa=_0xe089aa&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x1e8380=_0x1e8380&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0xe089aa,'showSuggestButton':_0x1e8380});}async['updateContent'](_0x4a2b6b){await this['_streamableContentView']['update'](_0x4a2b6b);}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x6b675){this['_contentWrapper']=new Nt(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x6b675['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new AIActionsBalloonDisclaimerView(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x3d403a,showSuggestButton:_0x3a8827}){this['_toolbarView']=new AIActionsBalloonToolbarView(this['locale'],_0x3d403a,_0x3a8827),this['_toolbarView']['applyButton']?.['on']('execute',()=>{this['fire']('applySuggestion');}),this['_toolbarView']['suggestButton']?.['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_toolbarView']['bind']('isEnabled')['to'](this,'isBusy',this,'_isLoading',this,'_hasError',(_0x356732,_0x41afe3,_0x19d743)=>!(_0x356732||_0x41afe3||_0x19d743)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x3d403a,'showSuggestButton':_0x3a8827}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x102d37){return this['_miniToolbarView']=new AIMiniToolbarView(this['locale'],_0x102d37),this['_miniToolbarView']['delegate'](...Cs)['to'](this),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['_miniToolbarView']['isShowChangesOn']=!this['_miniToolbarView']['isShowChangesOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':this['_miniToolbarView']['isShowChangesOn']});}),this['_miniToolbarView']['bind']('isEnabled')['to'](this,'isBusy',this,'_isLoading',(_0x554ff2,_0x2c2bba)=>!(_0x554ff2||_0x2c2bba)),this['_miniToolbarView'];}['_createLoaderView'](){return this['_loaderView']=new AISuggestionLoaderView(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}['_createStreamableContentView'](){return this['_streamableContentView']=new AISuggestionStreamableContentView(this['locale']),this['_streamableContentView'];}['_setupMiniToolbarButtons'](){const _0x9c4491=new vt(this['locale']),_0x193bc2=new vt(this['locale']),_0x33ceb9=new AIActionsBalloonNavigationCounterView(this['locale']),_0xfb3302=new vt(this['locale']);_0x9c4491['set']({'icon':tt,'label':Hi(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Bi}),_0x193bc2['set']({'icon':_0x165d4c,'tooltip':Hi(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Bi}),_0xfb3302['set']({'icon':et,'tooltip':Hi(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Bi}),_0x9c4491['bind']('isEnabled')['to'](this,'isBusy',_0x1f09c0=>!_0x1f09c0),_0x9c4491['on']('execute',()=>{this['fire']('tryAgain');}),_0x193bc2['bind']('isEnabled')['to'](this,'isBusy',_0x38fe17=>!_0x38fe17),_0x193bc2['on']('execute',()=>{this['fire']('showPrevious');}),_0xfb3302['bind']('isEnabled')['to'](this,'isBusy',_0x410771=>!_0x410771),_0xfb3302['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x193bc2,this['_navigationCounter']=_0x33ceb9,this['_navigationNextButton']=_0xfb3302,this['_navigationTryAgainButton']=_0x9c4491;}['updateMiniToolbarButtons'](_0xcb55b0,_0x5acda8){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x324f74=_0xcb55b0>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x324f74){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x34baaa=_0xcb55b0-_0x5acda8;this['_navigationCounter']['setInteractionCount'](_0x34baaa+'/'+_0xcb55b0),this['_navigationPreviousButton']['isEnabled']=_0x5acda8<_0xcb55b0-0x1,this['_navigationNextButton']['isEnabled']=_0x5acda8>0x0;}else this['removeMiniToolbarItem'](this['_navigationPreviousButton']),this['removeMiniToolbarItem'](this['_navigationCounter']),this['removeMiniToolbarItem'](this['_navigationNextButton']);}['disableMiniToolbarButtons'](){this['_navigationTryAgainButton']['isEnabled']=!0x1,this['_navigationPreviousButton']['isEnabled']=!0x1,this['_navigationNextButton']['isEnabled']=!0x1;}['startAutoScroll'](){this['_initializeScrollManager'](),this['_scrollManager']&&this['_scrollManager']['start']();}['stopAutoScroll'](){this['_scrollManager']&&this['_scrollManager']['stop']();}['toggleIsLoading'](_0x44f781){this['_isLoading']=_0x44f781;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_initializeScrollManager'](){const _0x342332=this['_getScrollableElement']();_0x342332&&!this['_scrollManager']&&(this['_scrollManager']=new ScrollManager(_0x342332));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}}class AIActionsBalloonNavigationCounterView extends Nt{constructor(_0x15e6f9){super(_0x15e6f9);const _0x37e78d=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x37e78d['to']('interactionCount')}]});}['setInteractionCount'](_0x4ae9a9){this['set']('interactionCount',_0x4ae9a9);}}class AIActions extends _0x1d5649{static get['requires'](){return[AIConnector,Bt,AIEditing,AIBalloon,_0x4278a5];}static get['pluginName'](){return'AIActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_aiConnector'];['_interactions']=[];['_currentInteractionIndex']=0x0;['_interactionParams'];['_balloonShowDiff']=!0x1;['_promiseQueue'];['_bodyCollection'];get['_interaction'](){return this['_interactions'][this['_interactions']['length']-0x1];}['_actionsBalloonView'];constructor(_0x3ba55d){super(_0x3ba55d),this['_bodyCollection']=new Qt(this['editor']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x53c50a,_0x25c8d6,_0x28073f){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')){if(this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x423412,anchorData:_0x3650bc,root:_0xf2d931}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x53c50a,_0x423412,_0x3650bc,_0xf2d931,_0x25c8d6,_0x28073f);}}const {modelFragment:_0x2df6c7,anchorData:_0x3e425c,root:_0x3e4347}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x53c50a,_0x2df6c7,_0x3e425c,_0x3e4347,_0x25c8d6,_0x28073f);}async['destroy'](){return this['_stopInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}['_createActionsBalloonView'](){const _0x51eebe=this['editor']['plugins']['has']('TrackChanges');let _0x46e33c=this['editor']['config']['get']('ai.availableReplyActions')||[...bs];_0x51eebe||(_0x46e33c=_0x46e33c['filter'](_0x24627c=>'insertSuggestion'!=_0x24627c));const _0x119080=this['editor']['commands']['get']('trackChanges'),_0x4675d6=new AIActionsBalloonView(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x51eebe,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x46e33c});return _0x4675d6['bind']('isBusy')['to'](this),_0x119080&&_0x4675d6['bind']('isTrackChangesOn')['to'](_0x119080,'value'),_0x4675d6['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x4675d6['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x4675d6['on']('showNext',()=>{this['_navigateToNext']();}),_0x4675d6;}['_getExecuteDataRegular'](){const _0x392f41=this['editor']['model']['document']['selection'],_0x1b269c=_0x392f41['getFirstRange']()['start']['root'];if(_0x392f41['isCollapsed']){const _0x2d18ab=At(_0x392f41['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x392f41);this['editor']['model']['change'](_0x5ac881=>{_0x5ac881['setSelection'](_0x2d18ab,'in');});}const _0x1b9ec3=_0x392f41['getFirstRange'](),_0x54340c=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x392f41),_0x1b9ec3['start'],_0x1b9ec3['end']);this['_copyMarkersToFragment'](_0x54340c,_0x392f41,{'isTableSelection':!0x1});const _0x2173fd=_0x392f41['getFirstRange']()['start'],_0x5bcb73=new Map();let _0x3a4c73=_0x54340c;for(let _0x7e0e7e=0x0;_0x7e0e7e<_0x2173fd['path']['length'];_0x7e0e7e++)_0x5bcb73['set'](_0x3a4c73,_0x2173fd['path'][_0x7e0e7e]),_0x3a4c73=_0x3a4c73['getChild'](0x0);return{'modelFragment':_0x54340c,'anchorData':_0x5bcb73,'root':_0x1b269c};}['_getExecuteDataInTable'](){const _0x6a328f=this['editor']['model']['document']['selection'],_0x1ec7a7=this['editor']['plugins']['get']('TableSelection'),_0xa0e8cb=_0x6a328f['getFirstRange']()['start']['root'],_0x592202=_0x1ec7a7['getSelectionAsFragment'](),_0x73747c=_0x6a328f['getFirstRange']()['start']['parent']['parent'],_0x569532=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x73747c),this['editor']['model']['createPositionAfter'](_0x73747c)),_0x29c53d=this['_wrapWithCommonAncestors'](_0x592202,_0x569532['start'],_0x569532['end']);this['_copyMarkersToFragment'](_0x29c53d,_0x6a328f,{'isTableSelection':!0x0});const _0x57632c=_0x6a328f['getFirstRange']()['start'],_0x322899=new Map();let _0x45c79b=_0x29c53d;for(let _0xf7d539=0x0;_0xf7d539<_0x57632c['path']['length'];_0xf7d539++)if(_0x322899['set'](_0x45c79b,_0x57632c['path'][_0xf7d539]),_0xf7d539<_0x57632c['path']['length']-0x1)_0x45c79b=_0x45c79b['getChild'](0x0);else{let _0x337129=_0x45c79b['nextSibling'];for(;_0x337129;)_0x322899['set'](_0x337129,_0x57632c['path'][_0xf7d539]),_0x337129=_0x337129['nextSibling'];}return{'modelFragment':_0x29c53d,'anchorData':_0x322899,'root':_0xa0e8cb};}async['_executeAction'](_0x420f05,_0x2a5282,_0x5e9d62,_0x269746,_0x536315,_0x42a340){const _0x59121b=this['editor']['plugins']['get'](AIEditing),_0x2ff5ff=this['editor']['plugins']['get'](AIBalloon),_0x89b743=this['editor']['model']['document']['selection'],_0x58d5be=await _0x59121b['modelToDataWithIds'](_0x2a5282),_0x50588a=this['editor']['model']['document']['version'],_0x3f6454=[..._0x89b743['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x2ff5ff['open']({'index':0x3e8*Math['random']()%0x3e8,'title':_0x536315,'icon':_0x42a340||_0x19a02b,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x3f6454,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x2ff5ff),this['_interactionParams']={'action':_0x420f05,'content':_0x58d5be,'version':_0x50588a,'aiBalloon':_0x2ff5ff,'modelFragment':_0x2a5282,'anchorData':_0x5e9d62,'root':_0x269746},this['_setupApplyListeners'](),this['listenTo'](_0x2ff5ff,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x2ff5ff,'dialogClosed',(_0x316815,{id:_0x2b7334})=>{if('aiActionsBalloon'===_0x2b7334){for(const _0x3aad55 of this['_interactions']){if(0x0===_0x3aad55['replies']['length']||_0x3aad55['stoppedExplicitly'])continue;const _0x3bd64a=_0x3aad55['replies'][_0x3aad55['replies']['length']-0x1],_0x2ed0fd=_0x3bd64a['changeGroups'][0x0];_0x2ed0fd&&'pending'===_0x2ed0fd['state']&&_0x3bd64a['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x2ff5ff);}}),this['_createInteraction'](_0x58d5be,_0x50588a,_0x2ff5ff,_0x420f05);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x509bbf,anchorData:_0x39607a,root:_0x52c090}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x509bbf,_0x39607a,_0x52c090,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x509bbf,_0x39607a,_0x52c090,!0x0);});}['_wrapWithCommonAncestors'](_0x13650b,_0x20ef30,_0x31714f){const _0x2b2d75=this['editor']['model']['createRange'](_0x20ef30,_0x31714f)['getCommonAncestor'](),_0x473e4b=_0x2b2d75['is']('documentFragment')?[]:_0x2b2d75['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x473e4b['length']){const _0x7ef44c=_0x473e4b['map'](_0x4966b0=>_0x4966b0['_clone'](!0x1));for(let _0x52dd14=0x1;_0x52dd14<_0x7ef44c['length'];_0x52dd14++)_0x7ef44c[_0x52dd14-0x1]['_appendChild'](_0x7ef44c[_0x52dd14]);return _0x7ef44c[_0x7ef44c['length']-0x1]['_appendChild'](_0x13650b),new _0x14c213(_0x7ef44c[0x0]);}return _0x13650b;}['_copyMarkersToFragment'](_0x232949,_0x3d3da5,_0x486a39={'isTableSelection':!0x1}){const _0x3dd2cd=this['editor']['model'],_0x11d1a8=Array['from'](_0x3d3da5['getRanges']()),_0xe96f09=_0x3d3da5['getFirstRange']()['start'];for(const _0x458070 of _0x3dd2cd['markers']){if(_0x458070['name']['startsWith'](As)||!_0x458070['affectsData'])continue;const _0x4fb1f7=_0x458070['getRange']();if(!_0x11d1a8['some'](_0x4d34b4=>_0x4d34b4['containsRange'](_0x4fb1f7,!0x0)))continue;const _0xbe7098=this['_regularCalculateMarkerPath'](_0x4fb1f7['start'],_0xe96f09,_0x486a39['isTableSelection']),_0x513108=this['_regularCalculateMarkerPath'](_0x4fb1f7['end'],_0xe96f09,_0x486a39['isTableSelection']),_0x3e7ab5=_0x3dd2cd['createPositionFromPath'](_0x232949,_0xbe7098),_0x3b86ed=_0x3dd2cd['createPositionFromPath'](_0x232949,_0x513108);if(!_0x3e7ab5['isEqual'](_0x3b86ed)){const _0x2d1308=_0x3dd2cd['createRange'](_0x3e7ab5,_0x3b86ed);_0x232949['markers']['set'](_0x458070['name'],_0x2d1308);}}}['_regularCalculateMarkerPath'](_0x11fe9f,_0x1885b8,_0x1b16b1=!0x1){const _0xfa7b8d=[..._0x11fe9f['path']['slice']()];for(let _0x3cb057=0x0;_0x3cb057<Math['max'](_0x1885b8['path']['length'],_0x11fe9f['path']['length']);_0x3cb057++){const _0x36df39=_0x1885b8['path'][_0x3cb057]||0x0,_0x462d8e=(_0x11fe9f['path'][_0x3cb057]||0x0)-_0x36df39;if(_0xfa7b8d[_0x3cb057]=_0x462d8e,0x0!==_0x462d8e&&!_0x1b16b1)break;}return _0xfa7b8d;}async['_createInteraction'](_0x52e675,_0x25a1bd,_0x156b8c,_0x399eb){const _0x65059c=this['editor'];this['_interactionParams']||(this['_interactionParams']={'action':_0x399eb,'content':_0x52e675,'version':_0x25a1bd,'aiBalloon':_0x156b8c,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':this['editor']['model']['document']['selection']['getFirstRange']()['start']['root']});const _0x13e2a8=new AIActionsInteraction({'connector':this['_aiConnector'],'locale':_0x65059c['locale'],'content':_0x52e675,'version':_0x25a1bd,..._0x399eb});this['_interactions']['push'](_0x13e2a8);const _0x934280=(_0x3560fc,_0x5ae396=!0x1,_0x31727d='streaming')=>this['_promiseQueue']['enqueue'](async _0x4e4207=>{try{const _0x435594=Zi({'editor':_0x65059c,'changeGroups':_0x3560fc['changeGroups'],'documentContextContent':_0x3560fc['documentContextContent'],'showDiff':_0x5ae396,'trimUnchanged':!0x1});_0x435594['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x435594[0x0],'renderingStrategy':_0x31727d,'abortSignal':_0x4e4207});}catch(_0x5e52bb){if(this['_isAbortError'](_0x5e52bb))return;throw _0x5e52bb;}});_0x13e2a8['on']('replyCreated',(_0xe16403,_0x5bee11)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x934280(_0x5bee11)['catch'](_0x5e5048=>{this['_isAbortError'](_0x5e5048)||(console['error']('Error\x20updating\x20content\x20in\x20replyCreated:',_0x5e5048),this['_setErrorState'](_0x13e2a8));});}),_0x13e2a8['on']('replyContentUpdated',(_0xa1232f,_0x4d643e)=>{_0x934280(_0x4d643e)['catch'](_0x1e1b7e=>{this['_isAbortError'](_0x1e1b7e)||(console['error']('Error\x20updating\x20content\x20in\x20replyContentUpdated:',_0x1e1b7e),this['_setErrorState'](_0x13e2a8));});}),_0x13e2a8['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x39baf8){this['_isAbortError'](_0x39baf8)||(console['error']('Error\x20clearing\x20loading\x20state\x20in\x20interactionFinished:',_0x39baf8),this['_setErrorState'](_0x13e2a8));}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x45161a,{showDiff:_0x3dc389})=>{try{this['_balloonShowDiff']=_0x3dc389;const _0x3778c3=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x3778c3&&await _0x934280(_0x3778c3,_0x3dc389,'static');}catch(_0x58ad50){this['_isAbortError'](_0x58ad50)||(console['error']('Error\x20updating\x20content\x20in\x20toggleSuggestionDisplayMode:',_0x58ad50),this['_setErrorState'](_0x13e2a8));}}),_0x13e2a8['on']('replyChangeGroupStateUpdated',()=>{const _0x5c9e16={'positiveCount':_0x13e2a8['replies']['reduce']((_0x17a8ab,_0x3af17a)=>_0x17a8ab+_0x3af17a['changeGroups']['filter'](_0x5c6bf0=>'accepted'===_0x5c6bf0['state'])['length'],0x0),'totalCount':_0x13e2a8['replies']['reduce']((_0x4052d6,_0x447a1f)=>_0x4052d6+_0x447a1f['changeGroups']['length'],0x0)},_0x166d19=_0x13e2a8['actionCallId'],_0x396558=_0x13e2a8['actionName'];_0x396558?this['_aiConnector']['upsertAIActionRating'](_0x396558,_0x166d19,_0x5c9e16):this['_aiConnector']['upsertCustomAIActionRating'](_0x166d19,_0x5c9e16);}),this['_setLoadingState']();try{const _0x3f4786=await _0x13e2a8['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x3f4786;}catch(_0x25c1b8){if(this['_isAbortError'](_0x25c1b8))return;this['_actionsBalloonView']['hideLoader'](),this['_setErrorState'](_0x13e2a8);}}['_applyChanges'](_0x1a7d56,_0x28a82c,_0x20b125,_0x51d3b3){const _0x4bedd9=this['editor'];if(_0x51d3b3&&!_0x4bedd9['plugins']['has']('TrackChanges'))throw new at('ai-no-track-changes',null);const _0x18a00d=this['editor']['plugins']['get'](_0x4278a5),_0x44b740=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x44b740||!_0x44b740['replies']['length'])return;const _0x2c2185=_0x44b740['replies'][_0x44b740['replies']['length']-0x1],_0x43c282=_0x2c2185['changeGroups'];_0x2c2185['setChangeGroupState'](0x0,'accepted');let _0x3c9570=_s({'editor':_0x4bedd9,'reply':_0x2c2185,'interaction':_0x44b740,'groups':_0x43c282,'transform':!0x1,'documentCompare':_0x18a00d,'documentCompareOptions':{'anchor':_0x4bedd9['model']['createPositionAt'](_0x1a7d56,0x0),'markDeletions':_0x51d3b3}});_0x3c9570=this['_filterOperationsOutsideRange'](_0x3c9570,_0x28a82c);for(const _0x11daa5 of _0x3c9570)this['_anchorOperation'](_0x28a82c,_0x11daa5,_0x20b125);const _0x3168b9=_0x44b740['getDocumentContext']()['version'],_0x4640b9=_0x4bedd9['model']['document']['history']['getOperations'](_0x3168b9),_0x34a31a={'document':_0x4bedd9['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x12c880=_0x586b34(_0x3c9570,_0x4640b9,_0x34a31a)['operationsA'];_0x4bedd9['model']['change'](_0x5b7735=>{if(_0x5b7735['setSelection'](_0x4bedd9['model']['document']['selection']['focus']),_0x51d3b3)_0x4bedd9['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x12c880);else{for(const _0x505516 of _0x12c880)_0x505516['baseVersion']=_0x4bedd9['model']['document']['version'],Is(_0x4bedd9,_0x505516),_0x5b7735['batch']['addOperation'](_0x505516),_0x4bedd9['model']['applyOperation'](_0x505516);}}),this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x535d0c,_0x4728fb){return _0x535d0c['filter'](_0x1af5b2=>{if('rename'==_0x1af5b2['type']){const _0x12f61c=_0x1af5b2['position']['nodeAfter'];return!_0x4728fb['has'](_0x12f61c);}if(_0x1af5b2['type']['indexOf']('Attribute')>-0x1){const _0x1814d4=_0x1af5b2['range']['start']['nodeAfter'];return!_0x4728fb['has'](_0x1814d4);}return!0x0;});}['_anchorOperation'](_0x391f34,_0x15b9b1,_0x5554f3){const _0x4a106f=_0x15b9b1['clone']();for(const _0x1489e6 in _0x15b9b1){const _0x344afd=_0x15b9b1[_0x1489e6];_0x344afd instanceof _0x1c9ece?_0x15b9b1[_0x1489e6]=new _0x1c9ece(_0x1fa912(_0x344afd['start']),_0x1fa912(_0x344afd['end'])):_0x344afd instanceof _0x22c921&&(_0x15b9b1[_0x1489e6]=_0x1fa912(_0x344afd));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x4a106f['type'])){if(_0x4a106f['isDocumentOperation']=!0x1,_0x4a106f['baseVersion']=null,'remove'==_0x4a106f['type']){const _0x1c0458=_0x4a106f['sourcePosition'],_0x1ddbd8=_0x4a106f['howMany'];new _0x56cb8c(_0x1c0458,_0x1ddbd8)['_execute']();}else _0x4a106f['_execute']();}function _0x1fa912(_0xbcd1ad){if('$graveyard'==_0xbcd1ad['root']['rootName'])return _0xbcd1ad;const _0x3c2b9e=[];let _0x307909=_0xbcd1ad['root'];for(let _0x44682d=0x0;_0x44682d<_0xbcd1ad['path']['length'];_0x44682d++){const _0x591e0d=_0x391f34['get'](_0x307909)||0x0;_0x3c2b9e[_0x44682d]=_0xbcd1ad['path'][_0x44682d]+_0x591e0d,_0x307909=_0x307909['getChildAtOffset'](_0xbcd1ad['path'][_0x44682d]);}return new _0x22c921(_0x5554f3,_0x3c2b9e,_0xbcd1ad['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x1c4c50,content:_0x52224d,version:_0x49bbd6,aiBalloon:_0x100170}=this['_interactionParams'];this['_clearErrorState'](),this['_actionsBalloonView']['clearContent'](),this['_actionsBalloonView']['showLoader'](),this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),this['stopListening'](this['_actionsBalloonView']),this['_setupApplyListeners'](),this['_createInteraction'](_0x52224d,_0x49bbd6,_0x100170,_0x1c4c50)['catch'](_0x222a67=>{this['_isAbortError'](_0x222a67)||console['error']('Error\x20refreshing\x20interaction:',_0x222a67);});}['_isAbortError'](_0x4dd4e1){return!!_0x4dd4e1['message']&&_0x4dd4e1['message']['startsWith']('ai-request-aborted');}['_clearInteractionHistory'](){this['_interactions']=[],this['_interactionParams']=void 0x0,this['_currentInteractionIndex']=0x0,this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_stopInteraction'](){this['_interaction']&&this['_interaction']['stop'](),this['_promiseQueue']['abort'](),this['isBusy']=!0x1,this['_interactionParams']&&this['_actionsBalloonView']['stopAutoScroll']();}['_navigateToPrevious'](){const _0x1f113c=this['_interactions']['length'];this['_currentInteractionIndex']<_0x1f113c-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x3895a3){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x3895a3;const _0x42b5f2=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x42b5f2)return;if(_0x42b5f2['hasError'])return this['_setErrorState'](_0x42b5f2),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x42b5f2['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x8346a9=_0x42b5f2['replies'][_0x42b5f2['replies']['length']-0x1];if(_0x8346a9){const _0x48866e=this['editor'];try{const _0x301ac2=Zi({'editor':_0x48866e,'changeGroups':_0x8346a9['changeGroups'],'documentContextContent':_0x8346a9['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x50727a=>setTimeout(_0x50727a,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x301ac2[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x271751){this['_isAbortError'](_0x271751)||console['error']('Error\x20updating\x20content\x20during\x20navigation:',_0x271751);}}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x542f82){const _0x3ccfe5=Hi(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x3ccfe5),_0x542f82['hasError']=!0x0,await this['_promiseQueue']['queueEmptyPromise'],this['_actionsBalloonView']['setErrorState'](),this['_actionsBalloonView']['toggleIsLoading'](!0x0);}['_clearErrorState'](){this['_actionsBalloonView']['hideError'](),this['_actionsBalloonView']['toggleIsLoading'](!0x1);}async['_clearLoadingState'](){await this['_promiseQueue']['queueEmptyPromise'],this['isBusy']=!0x1,this['_actionsBalloonView']['setIsLoading'](!0x1);}}class AIQuickActions extends _0x1d5649{static get['requires'](){return[AIQuickActionsUI,AIQuickActionsEditing,AIActions];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x28fa14){super(_0x28fa14),_0x28fa14['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}}class AIReviewCoreReviewCheckListItemResultsView extends Nt{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x42e52d,_0x4f3be3){super(_0x42e52d),this['id']=_0x4f3be3,this['set']('status','pending'),this['set']('changeId',_0x4f3be3),this['resultResponseView']=this['_createResultResponseView'](),this['acceptButtonView']=this['_createAcceptButtonView'](),this['dismissButtonView']=this['_createDismissButtonView'](),this['infoButtonView']=this['_createInfoButtonView'](),this['outdatedButtonView']=this['_createOutdatedButtonView'](),this['set']('isInfoToggleOn',!0x1),this['set']('isActive',!0x1),this['set']('showDiff',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-result',this['bindTemplate']['if']('isActive','ck-ai_review__check-run-result_active')]},'on':{'click':this['bindTemplate']['to']('click'),'mouseover':this['bindTemplate']['to']('mouseover'),'mouseout':this['bindTemplate']['to']('mouseout')},'children':[this['resultResponseView'],{'tag':'div','attributes':{'class':['ck-ai_review__check-run-result-footer']},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-run-result-action-buttons']},'children':[this['acceptButtonView'],this['dismissButtonView'],this['outdatedButtonView']]},this['infoButtonView']]}]}),this['on']('click',(_0x304dec,_0x113e93)=>{_0x113e93&&_0x113e93['target']&&'A'===_0x113e93['target']['tagName']&&_0x113e93['preventDefault'](),this['fire']('activateChange',{'id':_0x4f3be3,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x4f3be3,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x4f3be3,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x2edee8=new Nt(this['locale']);return _0x2edee8['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response',this['bindTemplate']['if']('showDiff','ck-hidden',_0x25b7aa=>!_0x25b7aa)]}}),_0x2edee8;}['_createAcceptButtonView'](){const _0x5c0b07=new vt(this['locale']);return _0x5c0b07['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x5c0b07['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x56674e=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x56674e['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x5ef489=>'pending'!==_0x5ef489&&'accepted'!==_0x5ef489),this['bindTemplate']['if']('status',Ui,_0x173427=>'pending'===_0x173427),this['bindTemplate']['if']('status',Bi,_0x2cc5a1=>'pending'!==_0x2cc5a1),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x50115e=>'accepted'===_0x50115e)]}}),this['on']('change:status',(_0x59a286,_0x3ee0c7,_0x4dd753)=>{_0x5c0b07['isEnabled']='pending'===_0x4dd753,'accepted'===_0x4dd753&&(_0x5c0b07['label']=Hi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x5c0b07['icon']=_0x11d9a5);}),_0x5c0b07;}['_createDismissButtonView'](){const _0x51ca7=new vt(this['locale']);return _0x51ca7['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x51ca7['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x27e57c=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x27e57c['stopPropagation']();})},'attributes':{'class':[Bi,this['bindTemplate']['if']('status','ck-hidden',_0x372a6d=>'pending'!==_0x372a6d&&'rejected'!==_0x372a6d),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0xadf565=>'pending'===_0xadf565),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x27a958=>'rejected'===_0x27a958)]}}),this['on']('change:status',(_0x16f7d9,_0x4e31e6,_0x3acb47)=>{_0x51ca7['isEnabled']='pending'===_0x3acb47,'rejected'===_0x3acb47&&(_0x51ca7['label']=Hi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x51ca7['icon']=_0x1294a9);}),_0x51ca7;}['_createInfoButtonView'](){const _0x5c555f=new vt(this['locale']);return _0x5c555f['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x5be768,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Bi+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x5c555f['bind']('isOn')['to'](this,'isInfoToggleOn',_0x5f477d=>_0x5f477d),_0x5c555f['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x5c555f;}['_createOutdatedButtonView'](){const _0x5c4181=new vt(this['locale']);return _0x5c4181['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':it,'withText':!0x0,'isEnabled':!0x1}),_0x5c4181['extendTemplate']({'attributes':{'class':[Bi,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x2e63a0=>'outdated'!==_0x2e63a0)],'disabled':'disabled'}}),_0x5c4181;}}class AIReviewCoreBalloonSuggestionItemView extends Xt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x38e6ca,_0xff96c5){super(_0x38e6ca),this['set']({'isVisible':!0x1,'position':'arrow_se','class':null,'top':0x0,'left':0x0}),this['extendTemplate']({'tag':'div','attributes':{'class':['ck-reset'],'tabindex':'-1'}}),this['set']('isDiffActive',!0x1),this['content']['add'](this['_createContentView']()),_0xff96c5['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x160fc2){this['resultItemView']['changeId']=_0x160fc2['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x160fc2['contentDiffed'];}['showBalloon'](_0x4c97b3,_0x300d13,_0xdda5db,_0x11ce24,_0x54d1b9,_0x272930){const _0x30ae95=_0x300d13();if(!_0x30ae95)return;this['updateContent'](_0x4c97b3),this['show']();const _0x1062af=Array['from'](_0x30ae95['getClientRects']())['reverse'](),_0x52799c=this['_getPointedRectIndexFromEvent'](_0xdda5db,_0x1062af),_0x3bd982=_0x1062af[_0x52799c??0x0];'click'===_0x11ce24?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x300d13(),_0x52799c,_0x4c97b3['id'],_0x54d1b9,_0x272930)||_0x3bd982})):'hover'===_0x11ce24&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x300d13(),_0x52799c,_0x4c97b3['id'])||_0x3bd982}));}['hideBalloon'](){this['hide'](),this['unpin'](),this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetElement']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}['hideDiffInBalloon'](){this['resultItemView']['showDiff']=!0x1;}['showDiffInBalloon'](){this['resultItemView']['showDiff']=!0x0;}['deactivateChange'](){this['fire']('deactivateChange',{'origin':'balloon'});}['_setupClickOutsideHandler'](){zt({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x491da4=[this['element']];return this['_pinnedTargetElement']&&_0x491da4['push'](this['_pinnedTargetElement']),_0x491da4;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x25fcb9=new Nt();return this['resultItemView']=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x25fcb9['setTemplate']({'tag':'div','attributes':{'class':['ck-reset','ck-ai_review-balloon-panel-suggestion',this['bindTemplate']['if']('isDiffActive','ck-ai_review-balloon-panel-suggestion_diff-active')]},'children':[{'tag':'p','attributes':{'class':['ck-ai_review__suggestion-text']},'children':[this['resultItemView']]}]}),_0x25fcb9;}['_getBestRectPositionOnClick'](_0x254b10,_0x2e423b,_0x12ded7,_0x1ce4a0,_0xb9d7cb){if(!_0x254b10)return null;const _0x197c97=this['position']['replace']('arrow_',''),_0x5d4a88=Array['from'](_0x254b10['getClientRects']());let _0x3ad32f,_0x2afa93=_0x5d4a88['reverse']();return void 0x0!==_0x2e423b&&this['_isPinnedRectVisible'](_0x2afa93[_0x2e423b],_0x1ce4a0,_0xb9d7cb)?(_0x3ad32f=_0x2afa93[_0x2e423b],this['_pinnedRectIndex']=_0x2e423b):this['_isPinnedRectVisible'](_0x2afa93[0x0],_0x1ce4a0,_0xb9d7cb)&&void 0x0===_0x2e423b?_0x3ad32f=_0x2afa93[0x0]:(_0x2afa93='s'==_0x197c97[0x0]?[..._0x5d4a88]['reverse']():_0x5d4a88,_0x2afa93['forEach'](_0x25ecd5=>{this['_isPinnedRectVisible'](_0x25ecd5,_0x1ce4a0,_0xb9d7cb)&&(_0x3ad32f=_0x25ecd5);})),this['_pinnedTargetChangeId']=_0x12ded7,this['_pinnedTargetElement']=_0x254b10,_0x3ad32f||_0x254b10['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0xcc5b7b,_0x5d0a1b,_0x3edeae){if(!_0xcc5b7b)return null;const _0x125530=Array['from'](_0xcc5b7b['getClientRects']())['reverse']();if(void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x5d0a1b&&this['_pinnedTargetChangeId']!==_0x3edeae)return this['_pinnedRectIndex']=_0x5d0a1b,this['_pinnedTargetElement']=_0xcc5b7b,this['_pinnedTargetChangeId']=_0x3edeae,_0x125530[_0x5d0a1b];if(void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x3edeae){if(_0xcc5b7b!==this['_pinnedTargetElement'])return Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']];return _0x125530[this['_pinnedRectIndex']];}return void 0x0!==_0x5d0a1b&&this['_pinnedTargetChangeId']!==_0x3edeae?(this['_pinnedRectIndex']=_0x5d0a1b,this['_pinnedTargetElement']=_0xcc5b7b,this['_pinnedTargetChangeId']=_0x3edeae,_0x125530[_0x5d0a1b]):_0xcc5b7b['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x2bdc0e,_0x3aba66){if(_0x2bdc0e)for(let _0x21c576=0x0;_0x21c576<_0x3aba66['length'];_0x21c576++){const _0x4da8bb=_0x3aba66[_0x21c576];if(_0x2bdc0e['clientX']>=_0x4da8bb['left']-0x3&&_0x2bdc0e['clientX']<=_0x4da8bb['right']+0x3&&_0x2bdc0e['clientY']>=_0x4da8bb['top']-0x3&&_0x2bdc0e['clientY']<=_0x4da8bb['bottom']+0x3)return _0x21c576;}}['_isPinnedRectVisible'](_0x43d0b6,_0x53016d,_0x450324){const _0x3200cf=new ut(_0x43d0b6),_0x5108c2=_0x53016d||document['documentElement'],_0x2cbdff=_0x3200cf['getIntersection'](bt(_0x450324)),_0x3469e9=new ut(_0x5108c2)['getIntersection'](_0x3200cf);return!!(_0x2cbdff&&_0x3469e9&&_0x3200cf['width']>0x0);}}const Fn=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];class AIReviewCoreUI extends _0x4127f4{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[AITabs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xa39f82){super(_0xa39f82),this['_bodyCollection']=new Qt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Fn)['to'](this),this['_balloonSuggestionView']=new AIReviewCoreBalloonSuggestionItemView(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x47b0e8=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x47b0e8);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x45c6f5){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x3c9a1c=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x45c6f5,_0x3c9a1c);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x228da2){_0x228da2&&('error-general'!==_0x228da2['status']?'error-chunk'!==_0x228da2['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x360b17){this['_mainView']['addCheckRunResult'](_0x360b17);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x1fa5a0){this['_mainView']['showGeneralReviewCoreErrorView'](_0x1fa5a0??Hi(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x245b00,_0x3ae689){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x245b00,_0x3ae689);}['setActiveStateInResults'](_0x45a2ba){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x3f0f8c=>{_0x3f0f8c['id']===_0x45a2ba&&_0x3f0f8c['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x4e4617=>_0x4e4617['setItemAsInactive']());}['updateChangeState'](_0x19f7f2,_0x1af342){'accepted'===_0x1af342||'rejected'===_0x1af342||'outdated'===_0x1af342?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x19f7f2,_0x1af342):this['_mainView']['reviewCheckResultsView']['showResult'](_0x19f7f2,_0x1af342);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x11b686,_0x526184,_0x4c7c6f,_0x4da7da,_0x55006c,_0x31962e){this['_balloonSuggestionView']['showBalloon'](_0x11b686,_0x526184,_0x4c7c6f,_0x4da7da,_0x55006c,_0x31962e);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x361ff7){const _0x2c2727=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x18f6ed=>_0x18f6ed['id']===_0x361ff7);return _0x2c2727?_0x2c2727['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}}class AIReviewCoreGeneralErrorView extends Nt{constructor(_0x4b8bdf){super(_0x4b8bdf),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x51cc18=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x51cc18['if']('isVisible','ck-hidden',_0x3aae75=>!_0x3aae75)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x51cc18['to']('errorMessage')}]}]});}}class AIReviewCoreView extends Nt{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x336cca,_0x5b9501){super(_0x336cca),this['reviewCoreHeader']=_0x5b9501['header'],this['generalErrorView']=new AIReviewCoreGeneralErrorView(_0x336cca),this['reviewCheckListView']=_0x5b9501['list'],this['reviewCheckListView']['delegate'](...Fn)['to'](this),this['reviewCheckResultsView']=_0x5b9501['results'],this['reviewCheckResultsView']['delegate'](...Fn)['to'](this),this['reviewCompletedView']=_0x5b9501['completed'],this['reviewCompletedView']['delegate']('finishReview')['to'](this),this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isLoading',!0x1),this['reviewCheckResultsView']['set']('isResultReady',!0x1),this['reviewCompletedView']['set']('isVisible',!0x1),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-review','ck-rounded-corners'],'dir':'ltr'},'children':[this['reviewCoreHeader'],this['generalErrorView'],this['reviewCheckListView'],this['reviewCheckResultsView'],this['reviewCompletedView']]});}['showReviewCheckListView'](){this['reviewCheckListView']['resetAllParameterizedChecks'](),this['reviewCheckListView']['set']('isVisible',!0x0),this['reviewCheckResultsView']['set']('isVisible',!0x1),this['reviewCompletedView']['set']('isVisible',!0x1);}['showReviewCheckResultsView'](){this['hideActionsWhenResultIsReady'](),this['reviewCheckResultsView']['resetErrorState'](),this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x0),this['reviewCheckResultsView']['clearResults'](),this['reviewCheckResultsView']['set']('isLoading',!0x0),this['reviewCheckResultsView']['set']('isCompleted',!0x1);}['addCheckRunResult'](_0x402bd3){this['reviewCheckResultsView']['addResult'](_0x402bd3),this['reviewCheckResultsView']['set']('isLoading',!0x1);}['showReviewCompletedView'](){this['reviewCheckResultsView']['set']('isVisible',!0x0),this['reviewCompletedView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isCompleted',!0x0),this['reviewCheckListView']['set']('isVisible',!0x1);}['showActionsWhenResultIsReady'](){this['reviewCheckResultsView']['isResultReady']?(this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x0),this['reviewCompletedView']['set']('isVisible',!0x1)):this['reviewCheckResultsView']['isResultReady']=!0x0;}['showNoChangesView'](){this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x1),this['reviewCompletedView']['set']('isVisible',!0x0);}['hideActionsWhenResultIsReady'](){this['reviewCheckResultsView']['isResultReady']=!0x1;}['showGeneralReviewCoreErrorView'](_0x31ebfd){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x31ebfd;}['showGeneralResultsErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}}class AIReviewCoreFinishReviewButtonView extends vt{constructor(_0x4295a4,_0x3c229f){super(_0x3c229f),this['set']({'label':_0x4295a4,'withText':!0x0,'class':Mi}),this['on']('execute',()=>{this['fire']('finishReview');});}}class AIReviewCoreUICheckResultsView extends Pt{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x432138,_0xd9f569){super(_0x432138),this['_contents']=_0xd9f569,this['_resultViews']=new _0x5337b1(),this['_cancelButtonView']=this['_createCancelButtonView'](),this['_acceptAllButtonView']=this['_createAcceptAllButtonView'](),this['_exitReviewButtonView']=this['_createExitReviewButtonView'](),this['_toggleDiffButtonView']=this['_createToggleDiffButtonView'](),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](),this['_resultsHeader']=this['_createResultHeaderView'](),this['_resultsBody']=this['_createResultsBodyView'](),this['_errorMessageView']=this['_createErrorView'](),this['reviewDisclaimer']=new AIDisclaimerView(_0x432138),this['set']('isLoading',!0x1),this['set']('isToggleDiffOn',!0x1),this['set']('isResultReady',!0x1),this['set']('headerTitle',''),this['set']('headerSubtitle',''),this['set']('isError',!0x1),this['set']('showErrorMessage',!0x1),this['set']('errorType','general'),this['set']('isCompleted',!0x1);const _0x4cafc3=this['_createCombinedSkeletonLoader'](),_0x22edef=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x22edef['if']('isLoading','ck-ai_review__check-run_loading',_0x397a1f=>_0x397a1f),_0x22edef['if']('isResultReady','ck-ai_review__check-run_ready',_0x44aa60=>_0x44aa60),_0x22edef['if']('isVisible','ck-hidden',_0x1d9219=>!_0x1d9219)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x4cafc3,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x19001f){const _0x1c7a75=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],_0x19001f['id']);_0x1c7a75['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x1c7a75),_0x1c7a75['resultResponseView']['element']['innerHTML']=_0x19001f['contentDiffed'];}['hideResult'](_0x3b3783,_0x36cc94){if('pending'===_0x36cc94)return;const _0x27f52e=this['_resultViews']['find'](_0x5c75a0=>_0x5c75a0['id']===_0x3b3783);_0x27f52e&&(_0x27f52e['status']=_0x36cc94,_0x27f52e['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x220cb8,_0x4d4704){if('pending'!==_0x4d4704)return;const _0x4f2680=this['_resultViews']['find'](_0x5a3c45=>_0x5a3c45['id']===_0x220cb8);_0x4f2680&&(_0x4f2680['status']=_0x4d4704,_0x4f2680['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x526e73,_0x2a8d9b){this['headerTitle']=_0x526e73,this['headerSubtitle']=_0x2a8d9b||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}['resetErrorState'](){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}['_createSkeletonLoader'](){return new AISkeletonView(this['locale'],Ss['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x11dee2=new Nt(this['locale']),_0x2d5edf=[];for(let _0x498d15=0x0;_0x498d15<0x10;_0x498d15++){const _0x2cabfb=this['_createSkeletonLoader']();_0x2cabfb['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x2d5edf['push'](_0x2cabfb);}return _0x11dee2['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x547cb9=>!_0x547cb9)]},'children':_0x2d5edf}),_0x11dee2;}['_createResultsBodyView'](){const _0x115662=new Nt(this['locale']);return _0x115662['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x33ab2b=>_0x33ab2b)]},'children':this['_resultViews']}),_0x115662;}['_createErrorView'](){const _0x24dc35=new Nt(this['locale']),_0x1168d6=new vt(this['locale']),t=this['locale']['t'];return _0x24dc35['delegate']('retryReview')['to'](this),_0x1168d6['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Ui+'\x20ck-ai_review__check-run-error-retry-button'}),_0x1168d6['on']('execute',()=>{this['fire']('retryReview');}),_0x24dc35['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x17e91f=>!_0x17e91f),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x373c5d=>'chunk'===_0x373c5d)]},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error','ck-ai-notification__full-width','ck-ai_review__check-run-error-message',this['bindTemplate']['if']('errorType','ck-ai-notification_warning',_0x3780c1=>'chunk'===_0x3780c1)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x5ee249=>'general'!==_0x5ee249)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x52a334=>'chunk'!==_0x52a334)]},'children':[{'text':Hi(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x1168d6]}),_0x24dc35;}['_createCancelButtonView'](){const _0x3fe3cc=new vt(this['locale']);return _0x3fe3cc['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Ui+'\x20ck-ai-button-stop-generating'],'icon':_0x2cd0a9}),_0x3fe3cc['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x2fc854=>_0x2fc854),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x30f434=>_0x30f434)]}}),_0x3fe3cc['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x3fe3cc;}['_createToggleDiffButtonView'](){const _0x39ef23=new vt(this['locale']);_0x39ef23['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x39ef23['bind']('isEnabled')['to'](this,'isError',_0x1925cb=>!_0x1925cb),_0x39ef23['extendTemplate']({'attributes':{'class':[Ui,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x441d50=>!_0x441d50),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x442203=>_0x442203)]}});const _0x544756=Hi(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x2956c4=Hi(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x39ef23['bind']('isOn')['to'](this,'isToggleDiffOn',_0x2f3393=>_0x2f3393),_0x39ef23['bind']('icon')['to'](this,'isToggleDiffOn',_0x493cd7=>_0x493cd7?st:nt),_0x39ef23['bind']('label')['to'](this,'isToggleDiffOn',_0x1910b2=>_0x1910b2?_0x544756:_0x2956c4),_0x39ef23['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x39ef23;}['_createAcceptAllButtonView'](){const _0x32c3ed=new vt(this['locale']);return _0x32c3ed['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x32c3ed['bind']('isEnabled')['to'](this,'isError',_0x47c6f2=>!_0x47c6f2),_0x32c3ed['extendTemplate']({'attributes':{'class':[Mi,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x4c9067=>!_0x4c9067),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x55d24a=>_0x55d24a)]}}),_0x32c3ed['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x32c3ed;}['_createExitReviewButtonView'](){const _0x59d723=new vt(this['locale']);return _0x59d723['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x59d723['extendTemplate']({'attributes':{'class':[Bi,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x3e7cde=>!_0x3e7cde),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x26117c=>_0x26117c)]}}),_0x59d723['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x59d723;}['_createResultHeaderView'](){const _0x239002=new Nt(this['locale']),_0x67c177=this['_createTitleView']();return _0x239002['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x5f091e=>_0x5f091e)]},'children':[_0x67c177,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-buttons']},'children':[this['_cancelButtonView'],this['_acceptAllButtonView'],this['_exitReviewButtonView'],this['_toggleDiffButtonView'],this['_finishReviewButtonView']]}]}),_0x239002;}['_createTitleView'](){const _0x4d1e56=new Nt(this['locale']),_0x4cbd05=new AISpinnerView();return _0x4cbd05['bind']('isVisible')['to'](this,'isResultReady',_0x387060=>!_0x387060),_0x4d1e56['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper']},'children':[_0x4cbd05,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-content',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x4aedc1=>_0x4aedc1)]},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-title']},'children':[{'text':this['bindTemplate']['to']('headerTitle')}]},{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-subtitle']},'children':[{'text':this['bindTemplate']['to']('headerSubtitle')}]}]},{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x67269f=>!_0x67269f)]},'children':[{'text':Hi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')}]}]}),_0x4d1e56;}['_createFinishReviewButtonView'](){const _0x17488b=new AIReviewCoreFinishReviewButtonView(Hi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x17488b['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0xb901b2=>!_0xb901b2)]}}),_0x17488b['delegate']('finishReview')['to'](this),_0x17488b;}}class AIReviewCoreReviewCompletedView extends Pt{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x553c08,_0x53c571){super(_0x553c08),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x53c571['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x53c571['headerText']);const _0x1c7058=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x1c7058['if']('isVisible','ck-hidden',_0x385510=>!_0x385510)]},'children':[this['_resultsHeader'],{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-content']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-content-icon']},'children':[{'text':'👍'}]},{'tag':'p','attributes':{'class':['ck-ai_review__review-completed-content-text']},'children':[{'text':_0x53c571['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x4eea4e){const _0x469e8b=new AIReviewCoreFinishReviewButtonView(_0x4eea4e,this['locale']);return _0x469e8b['delegate']('finishReview')['to'](this),_0x469e8b;}['_createResultHeaderView'](_0x1de62f){const _0x3cf29c=new Nt(this['locale']);return _0x3cf29c['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title']},'children':[{'text':_0x1de62f}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x3cf29c;}}class AIReviewCoreFormDropdownView extends Nt{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x3c64d6,_0x3cd137){super(_0x3c64d6),this['_defaultValue']=_0x3cd137['default']||(_0x3cd137['data']['length']>0x0?_0x3cd137['data'][0x0]['id']:''),this['_defaultLabel']=_0x3cd137['data']['find'](_0x316a4a=>_0x316a4a['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=Gt(this['locale']);const _0x14ba8c=this['_prepareListOptions'](_0x3cd137['data']);jt(this['_dropdownView'],_0x14ba8c,{'role':'menu','ariaLabel':_0x3cd137['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x2db453=>{_0x2db453['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x11cf25=>{this['formValue']=_0x11cf25['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x11cf25['source']['model']['label'];}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai_review__check-list-item-parameterized-form-element','ck-ai_review__check-list-item-parameterized-form-element_dropdown']},'children':[this['_dropdownView']]});}['resetToDefault'](){this['formValue']=this['_defaultValue'],this['_dropdownView']['buttonView']['label']=this['_defaultLabel'];}['_prepareListOptions'](_0x363a96=[]){const _0x1b6af3=new dt();this['resetToDefault']();for(const _0x4b411b of _0x363a96){const _0x31d6c7=new Jt({'label':_0x4b411b['label'],'withText':!0x0,'role':'menuitemradio','id':_0x4b411b['id'],'model':_0x4b411b});_0x31d6c7['bind']('isOn')['to'](this,'formValue',_0x1b0866=>_0x1b0866===_0x31d6c7['id']);const _0x5a122c={'type':'button','model':_0x31d6c7};_0x1b6af3['add'](_0x5a122c);}return _0x1b6af3;}}class AIReviewCoreFormManagerView extends Pt{['_formItem']=null;constructor(_0x53edc0,_0x35c4fa,_0x4ea08f){super(_0x53edc0),this['argsKey']=_0x35c4fa?.['argsKey'];if('dropdown'===_0x35c4fa['formType'])this['_formItem']=new AIReviewCoreFormDropdownView(this['locale'],_0x35c4fa);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x3af57c=new _0x450088(this['locale'],{'children':[this['_formItem']],'class':[_0x4ea08f?'ck-form__row_with-submit':'']});_0x4ea08f&&_0x3af57c['children']['add'](_0x4ea08f),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x3af57c]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}}class AIReviewCorePromptInputView extends _0x282a5b{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x424e21){super(_0x424e21),this['set']('isEmpty',!0x0),this['keystrokes']=new It(),this['minRows']=AIReviewCorePromptInputView['MIN_ROWS'],this['maxRows']=AIReviewCorePromptInputView['MAX_ROWS'],this['extendTemplate']({'attributes':{'id':'ai-review-prompt-input','class':['ck','ck-review__prompt-input']}});}['render'](){super['render'](),this['on']('update',()=>{this['isEmpty']=''===this['element']['value']?.['trim']();}),this['keystrokes']['listenTo'](this['element']);}}class AIReviewCoreCustomCheckView extends Nt{['focusTracker']=new _t();['keystrokes']=new It();['focusCycler'];['_focusables']=new _0x5337b1();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0x200961,_0x564927,_0x39f55f=!0x1){super(_0x200961),this['_check']=_0x564927,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x564927['defaultModel']?_0x564927['defaultModel']['id']:'',this['_defaultLabel']=_0x564927['defaultModel']?_0x564927['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new te(this['locale'],()=>new AIReviewCorePromptInputView(_0x200961)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelSelectionDropdownItems']=new dt(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0x39f55f),jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new _0x450088(this['locale'],{'children':[this['promptInputView']]}),new _0x450088(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x247cad,_0x46736f)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x46736f()):_0x46736f();}),this['focusCycler']=new Mt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),([this['promptInputView'],this['_modelSelectionDropdown'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0xca0c7c=>{this['_focusables']['add'](_0xca0c7c),this['focusTracker']['add'](_0xca0c7c['element']);}),this['keystrokes']['listenTo'](this['element']));}get['modelDefaultValue'](){return this['_defaultValue'];}get['modelDefaultLabel'](){return this['_defaultLabel'];}['resetToDefault'](){this['prompt']='',this['modelId']=this['modelDefaultValue'],this['_modelSelectionDropdown']['buttonView']['label']=this['modelDefaultLabel'],this['resetFormValidationStatus']();}['resetFormValidationStatus'](){this['promptInputView']['errorText']='';}['_isValid'](){this['resetFormValidationStatus']();for(const _0x30db0b of this['_getFormValidators']()){const _0x101049=_0x30db0b();if(_0x101049)return this['promptInputView']['errorText']=_0x101049,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return Hi(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x1c0214=new vt(this['locale']),t=this['locale']['t'];return _0x1c0214['set']({'label':t('Submit'),'withText':!0x0,'class':Mi}),_0x1c0214['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x1c0214;}['_createCancelButtonView'](){const _0x4ffd51=new vt(this['locale']),t=this['locale']['t'];return _0x4ffd51['set']({'label':t('Cancel'),'withText':!0x0,'class':Bi}),_0x4ffd51['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x38c0b3=>{_0x38c0b3['stopPropagation']();})}}),_0x4ffd51['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x4ffd51;}['_setModelList'](_0x4510d5){this['_modelSelectionDropdownItems']['clear']();const _0x5ad6d2=this['_check']['models'];if(_0x4510d5)this['set']('modelDisplayMode','hidden');else{const _0x67d199=0x1===_0x5ad6d2['length'];this['set']('modelDisplayMode',_0x67d199?'name':'selector');}if(this['resetToDefault'](),_0x5ad6d2?.['length']){0x1===_0x5ad6d2['length']&&this['set']('activeModelName',_0x5ad6d2[0x0]['name']||_0x5ad6d2[0x0]['id']);for(const _0x2d72b3 of _0x5ad6d2){const _0x3cfe45=new Jt({'label':_0x2d72b3['name'],'withText':!0x0,'role':'menuitemradio','id':_0x2d72b3['id'],'model':_0x2d72b3});_0x3cfe45['bind']('isOn')['to'](this,'modelId',_0x5e9242=>_0x5e9242===_0x2d72b3['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x3cfe45,'labelView':new ModelButtonLabelView(this['locale'],_0x2d72b3)});}}}['_createModelSelectionDropdown'](){const _0x51a73a=Gt(this['locale']);return _0x51a73a['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x51a73a['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':Bi}),_0x51a73a['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x4dff89=>'selector'===_0x4dff89),this['listenTo'](_0x51a73a,'execute',_0x1c8556=>{this['modelId']=_0x1c8556['source']['model']['id'],_0x51a73a['buttonView']['label']=_0x1c8556['source']['label'];}),_0x51a73a;}['_createModelNameView'](){const _0x14fee1=new ModelNameView(this['locale']);return _0x14fee1['bind']('text')['to'](this,'activeModelName',_0x39a0ea=>_0x39a0ea??''),_0x14fee1['bind']('isVisible')['to'](this,'modelDisplayMode',_0x4fa593=>'name'===_0x4fa593),_0x14fee1;}['_createActionsFooterView'](){const _0x4265e8=new Nt(this['locale']);return _0x4265e8['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions-footer']},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-custom-actions-buttons']},'children':[this['cancelButtonView'],this['submitButtonView']]}]}),_0x4265e8;}}class ModelNameView extends Nt{constructor(_0x10ee7d){super(_0x10ee7d),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x26d666=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x26d666['if']('isVisible','ck-hidden',_0x523be1=>!_0x523be1)]},'children':[{'text':_0x26d666['to']('text')}]});}}class ModelButtonLabelView extends Ht{constructor(_0x52e08e,_0x46e5d5){super();const _0x3ebdf7=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x3ebdf7['to']('style'),'id':_0x3ebdf7['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x3ebdf7['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x46e5d5['description']||'']}]}]});}}class AIReviewCoreReviewCommandListItemView extends Pt{['_formItemsCollection']=new _0x5337b1();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x5bbed6,_0x489917,_0x66d655,_0x392fe7=!0x1){super(_0x5bbed6),this['_hideModels']=_0x392fe7,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x489917['isParameterized']);const _0x15a4d1=this['_createIconView']();this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item',this['bindTemplate']['if']('isParametrizedViewOpen','ck-ai_review__check-list-item_selected',_0x368455=>_0x368455),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x124957=>_0x124957)],'style':{'--ck-ai-review-check-list-item-index':_0x66d655}},'on':{'click':this['bindTemplate']['to']('click')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-main-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-title']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__check-list-item-title-text']},'children':[{'text':_0x489917['title']}]},_0x15a4d1]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x489917['description']?[{'text':_0x489917['description']}]:[]}]}]},..._0x489917['isParameterized']?[this['_createParameterizedView'](_0x489917)]:[],...'custom'===_0x489917['id']?[this['_createCustomView'](_0x489917,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x489917['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x489917['id'],'args':_0x489917['useArgs']?_0x489917['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&zt({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x3ff6b3=>{_0x3ff6b3['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x213154=new xt();return _0x213154['content']=rt,_0x213154['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x213154;}['_createParameterizedView'](_0x1c20ce){const _0x5b8f0b=new Nt(),_0x55e645=this['_createFormView'](_0x1c20ce);return _0x5b8f0b['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x303a74=>!_0x303a74)]},'children':[_0x55e645]}),_0x5b8f0b;}['_createFormView'](_0x567cd6){const _0x2aafae=new Nt(),_0x4cb4b4=Array['isArray'](_0x567cd6['options'])?_0x567cd6['options']:[],_0x80e1f6=new vt(this['locale']),t=this['locale']['t'];_0x80e1f6['set']({'label':t('Submit'),'withText':!0x0,'class':Mi}),_0x80e1f6['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x4e6093=>{_0x4e6093['stopPropagation']();})}}),_0x80e1f6['on']('execute',()=>{const _0x3aef78=[],_0x51ad05={};this['_formItemsCollection']['forEach'](_0x14a9b9=>{_0x3aef78['push'](_0x14a9b9['value']),_0x567cd6['useArgs']&&_0x567cd6['options']&&(_0x51ad05[_0x14a9b9['argsKey']]=_0x14a9b9['value']);}),this['fire']('runReviewCheck',{'id':_0x567cd6['id'],'params':_0x3aef78['length']?_0x3aef78:void 0x0,'args':Object['keys'](_0x51ad05)['length']?_0x51ad05:void 0x0});});const _0x17b8bb=_0x4cb4b4['length'];return _0x4cb4b4['forEach']((_0x401eb2,_0x3e7175)=>{const _0x29e920=_0x3e7175===_0x17b8bb-0x1;this['_formItemsCollection']['add'](new AIReviewCoreFormManagerView(this['locale'],_0x401eb2,_0x29e920?_0x80e1f6:null));}),_0x2aafae['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x2aafae;}['_createCustomView'](_0x1a6b3c,_0x3ca93a=!0x1){return this['_customCheckView']=new AIReviewCoreCustomCheckView(this['locale'],_0x1a6b3c,_0x3ca93a),this['_customCheckView']['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-parameterized','ck-ai_review__check-list-item-parameterized_custom',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x3e56ef=>!_0x3e56ef)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x19f2b7,_0xfeee,_0x225cc4)=>{_0x225cc4||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}}class AIReviewCoreReviewCheckListView extends Pt{['_checkViews'];constructor(_0x10d46f){super(_0x10d46f),this['_checkViews']=new _0x5337b1(),this['_setupTemplate']();}['setChecks'](_0x4c8cbc,_0x25aab7=!0x1){this['_checkViews']['clear']();for(const [_0x5d89d2,_0x280fed]of _0x4c8cbc['entries']()){const _0x759cec=new AIReviewCoreReviewCommandListItemView(this['locale'],_0x280fed,_0x5d89d2,_0x25aab7);_0x759cec['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x759cec);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x63ad66 of this['_checkViews'])_0x63ad66 instanceof AIReviewCoreReviewCommandListItemView&&_0x63ad66['resetToDefault']();}['_setupTemplate'](){const _0x5934f4=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x5934f4['if']('isVisible','ck-hidden',_0xea9a45=>!_0xea9a45)]},'children':this['_checkViews']});}}class AIReviewModeUI extends AIReviewCoreUI{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x1ffb43=this['context']['plugins']['get']('AITabs'),_0x40807b=this['context']['locale'],_0x125917=new AIHeaderView(_0x40807b,{'label':Hi(_0x40807b,'AI_REVIEW_MODE'),'icon':_0x50ff5d,'class':'ck-ai-header_review','showResizeButton':_0x1ffb43['showResizeButton']});return _0x125917['delegate']('resizeTabs')['to'](_0x1ffb43),_0x125917['bind']('isMaximized')['to'](_0x1ffb43['view'],'isMaximized',_0x1a6162=>_0x1a6162),new AIReviewCoreView(this['context']['locale'],{'header':_0x125917,'list':new AIReviewCoreReviewCheckListView(_0x40807b),'results':new AIReviewCoreUICheckResultsView(_0x40807b,{'generalErrorText':Hi(_0x40807b,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x40807b,{'headerText':Hi(_0x40807b,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Hi(_0x40807b,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Hi(_0x40807b,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x1a98c7=this['context']['plugins']['get']('AITabs');_0x1a98c7['view']['on']('activateTab',(_0x2110f3,{newTab:_0x22db91,oldTab:_0x3de031})=>{'reviewMode'===_0x22db91?this['fire']('getReviewCheckList'):'reviewMode'===_0x3de031&&this['fire']('leaveReview');}),_0x1a98c7['view']['addTab']({'id':'reviewMode','buttonLabel':Hi(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x50ff5d,'order':0x0,'content':this['_mainView']});}}const Kn='review-',Wn=['softBreak'];class AIReviewCoreEditing extends _0x4127f4{static get['requires'](){return[_0x4278a5,AIEditing];}static get['pluginName'](){return'AIReviewCoreEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_markers']=new Map();['_activeMarkers']=new Set();['_domEmitter'];['_eventEmitter'];['_reviewEditingAttachedEditors']=new WeakSet();['_boundEditables']=new WeakMap();constructor(_0x26d853){super(_0x26d853),this['_domEmitter']=new(Ot())(),this['_eventEmitter']=new(Et())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x51bb32=_0x53e1f8=>this['_scheduleAttachReviewEditingToEditor'](_0x53e1f8);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x461551)return void _0x51bb32(this['context']);const _0x6aa61d=this['context'];for(const _0x4743da of _0x6aa61d['editors'])_0x51bb32(_0x4743da);this['listenTo'](_0x6aa61d['editors'],'add',(_0x904093,_0xbbca6a)=>{_0x51bb32(_0xbbca6a);}),this['listenTo'](_0x6aa61d['editors'],'remove',(_0x274679,_0x36cdb8)=>{for(const [_0x3a801f,_0x229954]of this['_markers'])_0x229954['editor']===_0x36cdb8&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x3a801f,'changeId':_0x229954['groupId']}),this['_markers']['delete'](_0x3a801f));});}['_scheduleAttachReviewEditingToEditor'](_0x57b6f6){const _0x35b72d=()=>{'destroyed'!==_0x57b6f6['state']&&_0x57b6f6['conversion']&&this['_attachReviewEditingToEditor'](_0x57b6f6);};if('ready'===_0x57b6f6['state'])return void _0x35b72d();const _0x37c724=()=>{this['stopListening'](_0x57b6f6,'ready',_0x37c724),_0x35b72d();};this['listenTo'](_0x57b6f6,'ready',_0x37c724);}['_attachReviewEditingToEditor'](_0x5cfe32){this['_reviewEditingAttachedEditors']['has'](_0x5cfe32)||(_0x5cfe32['conversion']['for']('editingDowncast')['markerToElement']({'model':Kn+'insert','view':(_0x5b43f8,{writer:_0x13d0fd})=>{const _0xed05e=this['_markers']['get'](_0x5b43f8['markerName']),_0x47061b={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0xed05e?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x5b43f8['markerName']};return _0x13d0fd['createUIElement']('span',_0x47061b,function(_0x2fc833){const _0x37d000=this['toDomElement'](_0x2fc833);return _0x37d000['innerHTML']=_0xed05e?.['content']?.['asString']||'',_0x37d000;});}}),_0x5cfe32['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Kn+'remove-only','view':_0x42e4c7=>{const _0x4231da=this['_markers']['get'](_0x42e4c7['markerName']),_0x34dbfd=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x4231da?.['id']||'')&&_0x34dbfd['push']('ck-ai_review__change_active'),{'classes':_0x34dbfd,'attributes':{'data-marker-id':_0x42e4c7['markerName']}};}}),_0x5cfe32['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Kn+'remove-context','view':_0x157ec3=>{const _0x495309=this['_markers']['get'](_0x157ec3['markerName']),_0x1237e7=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x495309?.['id']||'')&&_0x1237e7['push']('ck-ai_review__change_active'),{'classes':_0x1237e7,'attributes':{'data-marker-id':_0x157ec3['markerName']}};}}),_0x5cfe32['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Kn+'remove-text','view':_0x111e47=>{const _0x2d9898=this['_markers']['get'](_0x111e47['markerName']),_0x1a0762=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x2d9898?.['id']||'')&&_0x1a0762['push']('ck-ai_review__change_active'),{'classes':_0x1a0762,'attributes':{'data-marker-id':_0x111e47['markerName']}};}}),_0x5cfe32['conversion']['for']('dataDowncast')['markerToElement']({'model':Kn+'suggestion-context','view':(_0x1e14af,{writer:_0x3341b8})=>_0x3341b8['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x1e14af['isOpening']?'start':'end')})}),_0x5cfe32['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x4bed1f,'view':_0x59e29c}),this['_updateMouseMarkerInteractionListeners'](_0x5cfe32),this['listenTo'](_0x5cfe32,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x5cfe32),{'priority':'lowest'}),this['listenTo'](_0x5cfe32,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x5cfe32),{'priority':'lowest'}),_0x5cfe32['model']['document']['registerPostFixer'](_0x576d47=>this['_validateMarkers'](_0x5cfe32,_0x576d47)),_0x5cfe32['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x5cfe32)),this['_reviewEditingAttachedEditors']['add'](_0x5cfe32));}['_updateMouseMarkerInteractionListeners'](_0x210ffb){let _0x349e3b=this['_boundEditables']['get'](_0x210ffb);_0x349e3b||(_0x349e3b=new Map(),this['_boundEditables']['set'](_0x210ffb,_0x349e3b));const _0x480dc6=new Set(_0x210ffb['ui']['getEditableElementsNames']());for(const _0x32e09f of _0x480dc6){if(_0x349e3b['has'](_0x32e09f))continue;const _0x5edafe=_0x210ffb['ui']['getEditableElement'](_0x32e09f);_0x349e3b['set'](_0x32e09f,_0x5edafe),this['_attachMouseMarkerInteractionListeners'](_0x5edafe);}for(const [_0x1c74db,_0x1147dd]of _0x349e3b)_0x480dc6['has'](_0x1c74db)||(_0x349e3b['delete'](_0x1c74db),this['_domEmitter']['stopListening'](_0x1147dd));}['_attachMouseMarkerInteractionListeners'](_0x36c63d){this['_domEmitter']['listenTo'](_0x36c63d,'mouseup',(_0x4ebe56,_0x3bad32)=>{const _0x2a02c8=_0x3bad32['target'],_0x442ee9=this['_findMarkerElement'](_0x2a02c8);if(!_0x442ee9)return;const _0x5d1ec6=_0x442ee9['getAttribute']('data-marker-id'),_0x1e169d=_0x5d1ec6['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x5d1ec6,'changeId':_0x1e169d,'markerElement':()=>this['_findMarkerElementById'](_0x5d1ec6),'domEvent':_0x3bad32});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x36c63d,'mouseover',(_0x2d0348,_0x5bdc39)=>{const _0x4ae59d=_0x5bdc39['target'],_0x12144a=_0x5bdc39['relatedTarget'];let _0x52d745=this['_findMarkerElement'](_0x4ae59d);if(!_0x52d745&&_0x12144a&&(_0x52d745=this['_findMarkerElement'](_0x12144a)),!_0x52d745)return;const _0xb12fe6=_0x52d745['getAttribute']('data-marker-id'),_0x5b5c16=_0xb12fe6['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x5b5c16,'markerElement':()=>this['_findMarkerElementById'](_0xb12fe6),'domEvent':_0x5bdc39});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x200174((_0x1f8095,_0x356ac0)=>{const _0x44c41f=_0x356ac0['target'];if(this['_findMarkerElement'](_0x44c41f))return;_0x44c41f['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x4ec54b=this['context']['plugins']['get']('AIEditing'),_0x7be9a0=ls(this['context']);if(!_0x7be9a0['length'])throw new at('ai-get-editor-from-context-no-editor',this);const _0x473190=new Set(),_0x320dff=[],_0x34b855=new Map();for(const _0x261016 of _0x7be9a0)for(const _0x218904 of _0x261016['model']['document']['getRoots']()){if('$graveyard'===_0x218904['rootName'])continue;const _0x46ec44=this['_buildDocumentDataSliceForRoot'](_0x261016,_0x218904,_0x4ec54b,_0x473190);_0x320dff['push'](_0x46ec44['content']);for(const [_0x23c6e0,_0x5a710a]of _0x46ec44['elements'])_0x34b855['set'](_0x23c6e0,_0x5a710a);}return{'elements':_0x34b855,'content':_0x320dff['join']('')};}['_buildDocumentDataSliceForRoot'](_0x211be9,_0x67f279,_0x4ca518,_0x1cd359){const _0x4a12e7=_0x211be9['model'],_0x5dd8a0=new _0x14c213();for(const _0x18b002 of _0x67f279['getChildren']())_0x5dd8a0['_appendChild'](_0x18b002['_clone'](!0x0));for(const _0x533397 of _0x4a12e7['markers']){const _0x11f384=_0x533397['getRange']();_0x11f384&&_0x11f384['root']['rootName']===_0x67f279['rootName']&&_0x5dd8a0['markers']['set'](_0x533397['name'],this['_changeRangeOwnerDocument'](_0x11f384['clone'](),_0x5dd8a0));}const _0x9553c3=new Map(),_0x4ef3e8=_0x4a12e7['document']['version'],_0x4bfb23=new _0x4a0e2d({'ignoreElementEnd':!0x0,'startPosition':_0x4a12e7['createPositionAt'](_0x5dd8a0,0x0)});for(const {item:_0xc0c04c}of _0x4bfb23){if(!_0xc0c04c['is']('$textProxy'))continue;const _0x234e12=_0xc0c04c['parent'];if(!_0x234e12||!_0x234e12['is']('element'))continue;const _0x4bc4d8=this['_upsertDataId'](_0x234e12,()=>_0x4ca518['_nextDataId'](_0x1cd359));_0x1cd359['add'](_0x4bc4d8);for(const _0x510b5a of _0x234e12['getChildren']())_0x510b5a['is']('element')&&(_0x510b5a['name']&&Wn['includes'](_0x510b5a['name'])||_0x1cd359['add'](this['_upsertDataId'](_0x510b5a,()=>_0x4ca518['_nextDataId'](_0x1cd359))));let _0x27c6b0=_0x234e12;for(;_0x27c6b0['parent']&&!_0x27c6b0['parent']['is']('documentFragment');)_0x27c6b0=_0x27c6b0['parent'],_0x27c6b0['hasAttribute'](_0x4bed1f)&&_0x27c6b0['_removeAttribute'](_0x4bed1f);_0x9553c3['set'](_0x4bc4d8,{'editor':_0x211be9,'rootName':_0x67f279['rootName'],'path':_0x234e12['getPath'](),'documentVersion':_0x4ef3e8,'getContent':this['_createGetContentUsingDataIdFn'](_0x27c6b0['_clone'](!0x0),_0x4bc4d8,_0x211be9['data'])}),_0x4bfb23['jumpTo'](_0x4a12e7['createPositionAfter'](_0x234e12));}return{'content':_0x211be9['data']['processor']['toData'](_0x211be9['data']['toView'](_0x5dd8a0)),'elements':_0x9553c3};}['diffContent'](_0x361d38,_0x2d1fc3,_0x16392f,_0x43b5d1=!0x1){const _0x79a2ed=[],_0xfc77f=_0x361d38['data']['parse'](_0x16392f,'$documentFragment'),_0x1b9438=_0x361d38['data']['parse'](_0x2d1fc3,'$documentFragment'),_0x39d628=_0x361d38['model']['createPositionAt'](_0x1b9438,0x0);if(this['_haveSingleTopLevelElement'](_0xfc77f)){if(!this['_hasSameTopLevelElement'](_0x1b9438,_0xfc77f))return _0x79a2ed;}else{const _0x3d299b=_0x361d38['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x1b9438,_0x3d299b)||!this['_haveOnlyInlineContent'](_0xfc77f,_0x3d299b))return _0x79a2ed;}const _0x4f19b1=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x2d1fc3,_0x16392f,{'targetEditor':_0x361d38,'anchor':_0x39d628,'markDeletions':!0x0})['getOperations']()['filter'](_0x323e7e=>'insert'===_0x323e7e['type']||'marker'===_0x323e7e['type']&&_0x323e7e['name']['startsWith']('$markedRemove')),_0x3722bc=this['_groupAdjacentOperations'](_0x4f19b1),_0x242849=[];if(_0x43b5d1){if(_0x3722bc['length']){const _0x5d95c4=_0x3722bc[0x0]['operations'][0x0],_0x5289b9='insert'===_0x5d95c4['type']?_0x5d95c4['position']:_0x5d95c4['newRange']['start'],_0x430267=this['_getPositionLimitingRange'](_0x5289b9,_0x361d38,'inside'),_0x405368=_0x430267?_0xfc77f['getChild'](0x0)['getChildren']():_0xfc77f['getChildren'](),_0x4fb69f=_0x430267||_0x361d38['model']['createRangeIn'](_0x1b9438),_0x21b97d=[new _0x412044('$markedRemove:synthetic'+ot(),null,_0x4fb69f,_0x361d38['model']['document']['model']['markers'],!0x0,_0x361d38['model']['document']['version']+0x1),new _0x4bd349(_0x4fb69f['end'],_0x405368,_0x361d38['model']['document']['version']+0x2)];_0x242849['push']({'operations':_0x21b97d,'operationsIsolated':_0x21b97d,'groupOffset':0x0});}}else _0x242849['push'](..._0x3722bc);let _0x32b6df=0x0;return _0x361d38['model']['change'](_0x3e2b6b=>{for(let _0x560779=0x0;_0x560779<_0x242849['length'];_0x560779++){const _0x273d6f=_0x242849[_0x560779],_0x57a30b=_0x3e2b6b['createDocumentFragment']();for(const _0x28f7ed of _0x1b9438['getChildren']())_0x3e2b6b['append'](_0x28f7ed['_clone'](!0x0),_0x57a30b);for(const _0x5d00c9 of _0x273d6f['operationsIsolated'])if('insert'===_0x5d00c9['type']){const _0x367cc4=_0x5d00c9;_0x367cc4['baseVersion']=null,_0x367cc4['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x367cc4,_0x57a30b),_0x3e2b6b['batch']['addOperation'](_0x5d00c9),_0x361d38['model']['applyOperation'](_0x5d00c9);const _0x5e2afa='suggestion:insertion:id:authorId:'+_0x32b6df++,_0x51e354=_0x361d38['model']['createRange'](_0x367cc4['position'],_0x367cc4['position']['getShiftedBy'](_0x367cc4['howMany']));_0x57a30b['markers']['set'](_0x5e2afa,_0x51e354);}else{if('marker'===_0x5d00c9['type']&&_0x5d00c9['name']['startsWith']('$markedRemove')){const _0xdd0e2d=_0x5d00c9,_0x3efc34='suggestion:deletion:id:authorId:'+_0x32b6df++;this['_changeOperationOwnerDocument'](_0xdd0e2d,_0x57a30b),_0x57a30b['markers']['set'](_0x3efc34,_0xdd0e2d['newRange']);}}if(_0x43b5d1)_0x79a2ed['push']({..._0x273d6f,'context':this['_createGetContentFn'](_0x1b9438,_0x361d38['data']),'content':this['_createGetContentFn'](_0x1b9438,_0x361d38['data'])});else{const _0x4180b3=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x273d6f['operationsIsolated'][0x0]),_0x57a30b),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x273d6f['operationsIsolated'][_0x273d6f['operationsIsolated']['length']-0x1]),_0x57a30b),_0x361d38);_0x57a30b['markers']['set'](Kn+'suggestion-context',new _0x1c9ece(_0x4180b3['start'],_0x4180b3['end'])),_0x79a2ed['push']({..._0x273d6f,'context':this['_createGetContextFn'](_0x57a30b,_0x361d38['data'],{'ellipsisBefore':_0x4180b3['hasContentBefore'],'ellipsisAfter':_0x4180b3['hasContentAfter']}),'content':this['_createGetContentFn'](_0x57a30b,_0x361d38['data'])});}}}),_0x79a2ed;}['markChangePositionInEditorContent'](_0x4e22be,_0x13abae){if(!_0x4e22be['length'])return;const _0x52bee7=_0x4e22be[0x0]['parent']['id'],_0x384556=_0x13abae['elements']['get'](_0x52bee7);if(!_0x384556)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x52bee7);const _0x4c6d6c=_0x384556['path'],_0x120377=_0x384556['editor'],_0x135ca3=_0x120377['model']['document']['getRoot'](_0x384556['rootName']);if(!_0x135ca3)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x384556['rootName']);const _0x446a97=_0x120377['model']['document']['history']['getOperations'](_0x384556['documentVersion']),_0x13f56b=[];for(const _0x3253cf of _0x4e22be){const _0x17b3c5=_0x3253cf['operationsIsolated']['map'](_0x1c35f5=>this['_translateOperationToEditorContent'](_0x1c35f5,_0x4c6d6c,_0x135ca3));if(!_0x17b3c5||!_0x17b3c5['length'])continue;const _0x221ef7=_0x17b3c5['every'](_0x5484c7=>'marker'===_0x5484c7['type']&&_0x5484c7['name']['startsWith']('$markedRemove')),_0x8bab5={'document':_0x120377['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x5575ac=_0x586b34(_0x17b3c5,_0x446a97,_0x8bab5)['operationsA'];for(const _0x60b3cd of _0x5575ac)if('insert'===_0x60b3cd['type']){const _0x2e585e=_0x60b3cd,_0x13495b=_0x2e585e['nodes'];_0x120377['model']['change'](_0x35b758=>{const _0x2d6500=_0x35b758['createDocumentFragment']();for(const _0x5d3670 of _0x13495b)_0x35b758['append'](_0x5d3670['_clone'](!0x0),_0x2d6500);_0x13f56b['push']({'start':_0x2e585e['position'],'end':_0x2e585e['position'],'type':'insert','groupId':_0x3253cf['id'],'content':{'asString':this['_createGetContentFn'](_0x2d6500,_0x120377['data'])(),'asFragment':_0x2d6500}});});}else{if('marker'===_0x60b3cd['type']&&_0x60b3cd['name']['startsWith']('$markedRemove')){const _0x4d425a=_0x60b3cd;let _0xf742fe='remove-text';if(_0x221ef7){const _0x3aa73b=this['_findAdjacentContextDistance'](_0x4d425a['newRange']['start'],'backward',_0x120377['model']['schema']),_0x54e660=this['_findAdjacentContextDistance'](_0x4d425a['newRange']['end'],'forward',_0x120377['model']['schema']);if(_0x3aa73b||_0x54e660){const _0x1244a3=_0x4d425a['newRange']['start']['getShiftedBy'](-_0x3aa73b),_0x1f69e9=_0x4d425a['newRange']['end']['getShiftedBy'](_0x54e660);_0x13f56b['push']({'start':_0x1244a3,'end':_0x1f69e9,'groupId':_0x3253cf['id'],'type':'remove-context'});}else _0xf742fe='remove-only';}_0x13f56b['push']({'start':_0x4d425a['newRange']['start'],'end':_0x4d425a['newRange']['end'],'groupId':_0x3253cf['id'],'type':_0xf742fe});}}}this['_insertMarkers'](_0x13f56b,_0x120377);}['clearAllMarkers'](){const _0x4d27da=new Map();for(const _0x3c26c2 of this['_markers']['keys']()){const _0x1c02f5=this['_markers']['get'](_0x3c26c2);_0x1c02f5?.['editor']&&(_0x4d27da['has'](_0x1c02f5['editor'])||_0x4d27da['set'](_0x1c02f5['editor'],[]),_0x4d27da['get'](_0x1c02f5['editor'])['push'](_0x3c26c2));}for(const [_0x229b4d,_0x483f35]of _0x4d27da)_0x229b4d['model']['change'](_0x153b41=>{for(const _0x3d1f6f of _0x483f35)_0x229b4d['model']['markers']['get'](_0x3d1f6f)&&_0x153b41['removeMarker'](_0x3d1f6f);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x515e3f of ls(this['context']))_0x515e3f['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x2e07c9 of ls(this['context']))_0x2e07c9['disableReadOnlyMode']('ai-review');}['applyChange'](_0x45a6ed){const _0x4e9ce3=_0x45a6ed['map'](_0x55a5ff=>this['_getMarkersDataForGroup'](_0x55a5ff))['flat'](),_0x45a209=new Map();for(const _0x227aec of _0x4e9ce3)_0x45a209['has'](_0x227aec['editor'])||_0x45a209['set'](_0x227aec['editor'],[]),_0x45a209['get'](_0x227aec['editor'])['push'](_0x227aec);for(const [_0x3a67c5,_0xa06ac0]of _0x45a209){const _0x460b57=_0x3a67c5['model'];_0x460b57['change'](_0x31203f=>{for(const _0x196826 of _0xa06ac0){const _0x573a67=_0x3a67c5['model']['markers']['get'](_0x196826['id']);if(_0x573a67){if('insert'===_0x196826['type']){if(!_0x196826['content'])continue;_0x460b57['insertContent'](_0x196826['content']['asFragment']||null,_0x573a67['getRange']()['start']);}else'remove-text'!==_0x196826['type']&&'remove-only'!==_0x196826['type']||_0x460b57['deleteContent'](_0x460b57['createSelection'](_0x573a67['getRange']()));_0x31203f['removeMarker'](_0x196826['id']),this['_markers']['delete'](_0x196826['id']);}}});}}['rejectChange'](_0x5aaa1f){const _0x4d67d0=this['_getMarkersDataForGroup'](_0x5aaa1f),_0x4b8abf=new Map();for(const _0x31d125 of _0x4d67d0)_0x4b8abf['has'](_0x31d125['editor'])||_0x4b8abf['set'](_0x31d125['editor'],[]),_0x4b8abf['get'](_0x31d125['editor'])['push'](_0x31d125);for(const [_0x1832a4,_0x34dd2c]of _0x4b8abf)_0x1832a4['model']['change'](_0x1bb893=>{for(const _0x3512b5 of _0x34dd2c)_0x1bb893['removeMarker'](_0x3512b5['id']),this['_markers']['delete'](_0x3512b5['id']);});}['getEditor'](){return ds(this['context']);}['getEditors'](){return ls(this['context']);}['getEditorForChange'](_0xafaca4){const _0xbeef2e=this['_getMarkersDataForGroup'](_0xafaca4);return _0xbeef2e[0x0]?.['editor'];}['getMarkerElementForChange'](_0x19ba88){const _0x245eb0=Array['from'](this['_markers']['values']())['filter'](_0x2fe9f6=>_0x2fe9f6['groupId']===_0x19ba88);if(!_0x245eb0['length'])return null;const _0x3a718c=0x1===_0x245eb0['length']?_0x245eb0[0x0]:this['_sortMarkers'](_0x245eb0)[0x0],_0x14b66f=_0x3a718c['editor']['model']['markers']['get'](_0x3a718c['id']);if(!_0x14b66f)return null;return{'modelRange':_0x14b66f['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x3a718c['id'])};}['getContentElementForChange'](_0x4189ff){const _0x4dbc8d=Array['from'](this['_markers']['values']())['filter'](_0x3b2b54=>_0x3b2b54['groupId']===_0x4189ff);if(!_0x4dbc8d['length'])return null;const _0x3f3d57=0x1===_0x4dbc8d['length']?_0x4dbc8d[0x0]:this['_sortMarkers'](_0x4dbc8d)[0x0],_0x34ff78=_0x3f3d57['editor'],_0x237deb=_0x34ff78['model']['markers']['get'](_0x3f3d57['id']);if(!_0x237deb)return null;const _0x466437=_0x237deb['getRange'](),_0xbe6433=_0x34ff78['editing']['view']['getDomRoot'](_0x466437['root']['rootName'])||_0x34ff78['editing']['view']['getDomRoot']();if(!_0xbe6433||!_0x466437)return null;let _0xe1d9cb=_0x466437['start']['parent'];for(;_0xe1d9cb['parent']&&'$root'!==_0xe1d9cb['parent']['name'];)_0xe1d9cb=_0xe1d9cb['parent'];if(!_0xe1d9cb||!_0xe1d9cb['name'])return null;const _0x16a232=_0xbe6433['querySelector']('[data-marker-id=\x22'+_0x3f3d57['id']+'\x22]');if(!_0x16a232)return null;let _0x189de0=null;_0x34ff78['model']['change'](_0x44fa9c=>{_0x189de0=_0x44fa9c['createDocumentFragment'](),_0x44fa9c['append'](_0xe1d9cb['_clone'](!0x0),_0x189de0);});const _0xf3d367=_0x34ff78['data']['toView'](_0x189de0)['getChild'](0x0);return _0x16a232['closest'](_0xf3d367['name']);}['reactivateMarkers'](_0xfa8cc4){const _0x2d10fc=this['_getMarkersDataForGroup'](_0xfa8cc4);if(!_0x2d10fc['length'])return;const _0x57dada=Array['from'](this['_activeMarkers'])['sort'](),_0x17624b=Array['from'](new Set(_0x2d10fc['map'](_0x2ceb35=>_0x2ceb35['id'])))['sort']();_0x57dada['join']('|')!==_0x17624b['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0xfa8cc4));}['setMarkersInElementAsActive'](_0x20f34d){const _0x25e35c=this['_getMarkersDataForGroup'](_0x20f34d);if(!_0x25e35c['length'])return;const _0xa2bb14=_0x25e35c[0x0]['editor'],_0x1349ab=new Set(_0x25e35c['map'](_0x1771d3=>_0x1771d3['id'])),_0x509082=Array['from'](_0x1349ab['values']())['map'](_0x1e89a0=>_0xa2bb14['model']['markers']['get'](_0x1e89a0))['filter'](_0x1c7e74=>!!_0x1c7e74);_0x1349ab['forEach'](_0x5a648e=>{this['_activeMarkers']['add'](_0x5a648e);}),_0xa2bb14['model']['change'](()=>{_0x509082['forEach'](_0x343371=>{_0xa2bb14['editing']['reconvertMarker'](_0x343371);});});}['setAllMarkersAsInactive'](){const _0x24127e=Array['from'](this['_activeMarkers']);if(!_0x24127e['length'])return;this['_activeMarkers']['clear']();const _0x3c9236=new Map();for(const _0x54d940 of _0x24127e){const _0x30640e=this['_markers']['get'](_0x54d940);if(!_0x30640e)continue;const _0x5b9fb1=_0x30640e['editor'],_0x5a7a48=_0x5b9fb1['model']['markers']['get'](_0x54d940);_0x5a7a48&&(_0x3c9236['has'](_0x5b9fb1)||_0x3c9236['set'](_0x5b9fb1,[]),_0x3c9236['get'](_0x5b9fb1)['push'](_0x5a7a48));}for(const [_0x44f5d4,_0x4a5e44]of _0x3c9236)_0x44f5d4['model']['change'](()=>{_0x4a5e44['forEach'](_0x14d408=>{_0x44f5d4['editing']['reconvertMarker'](_0x14d408);});});}['_getPositionLimitingRange'](_0x49c810,_0x30ca96,_0x48cfa3='outside'){if(!_0x49c810)return null;let _0x4b32f3=_0x49c810['parent'];for(;_0x4b32f3&&_0x4b32f3['parent']&&'$root'!==_0x4b32f3['parent']['name']&&!_0x30ca96['model']['schema']['isLimit'](_0x4b32f3)&&!_0x30ca96['model']['schema']['isBlock'](_0x4b32f3);)_0x4b32f3=_0x4b32f3['parent'];if(!_0x4b32f3||!_0x4b32f3['name']||'$root'===_0x4b32f3['name'])return null;let _0x5a44a2=null;return _0x30ca96['model']['change'](_0x357bd7=>{_0x5a44a2='inside'===_0x48cfa3?_0x357bd7['createRangeIn'](_0x4b32f3):_0x357bd7['createRangeOn'](_0x4b32f3);}),_0x5a44a2;}['_validateMarkers'](_0x16a056,_0x386026){const _0x24aa76=Array['from'](this['_markers']['keys']()),_0x5a4c04=new Map();for(const _0xe5c401 of _0x24aa76){const _0x35a41a=_0x16a056['model']['markers']['get'](_0xe5c401);if(!_0x35a41a)continue;const _0x336ae0=_0x35a41a['getStart']()['root']['rootName']+':'+_0x35a41a['getStart']()['path'][0x0];_0x5a4c04['has'](_0x336ae0)||_0x5a4c04['set'](_0x336ae0,[]),_0x5a4c04['get'](_0x336ae0)['push'](_0x35a41a);}const _0x2cfdc2=new Set();for(const _0x3c5edd of _0x16a056['model']['document']['differ']['getChanges']()){let _0xd4f0aa='',_0x2db4c4=null;if('insert'===_0x3c5edd['type'])_0x2db4c4=new _0x1c9ece(_0x3c5edd['position'],_0x3c5edd['position']['getShiftedBy'](_0x3c5edd['length'])),_0xd4f0aa=_0x3c5edd['position']['root']['rootName']+':'+_0x3c5edd['position']['path'][0x0];else{if('remove'!==_0x3c5edd['type'])continue;_0x2db4c4=new _0x1c9ece(_0x3c5edd['position']),_0xd4f0aa=_0x3c5edd['position']['root']['rootName']+':'+_0x3c5edd['position']['path'][0x0];}const _0x7d358e=_0x5a4c04['get'](_0xd4f0aa)||[];if(_0x7d358e['length']){for(const _0x23d562 of _0x7d358e)if(_0x2db4c4['root']['rootName']===_0x23d562['getRange']()['root']['rootName']&&('insert'!==_0x3c5edd['type']||!_0x2db4c4['containsRange'](_0x23d562['getRange']()))&&(_0x2db4c4['isIntersecting'](_0x23d562['getRange']())||_0x2db4c4['start']['isTouching'](_0x23d562['getRange']()['end'])||_0x2db4c4['end']['isTouching'](_0x23d562['getRange']()['start']))){const _0x56e26e=this['_parseMarkerName'](_0x23d562['name']);Array['from'](this['_markers']['values']())['filter'](_0x27a503=>_0x27a503['groupId']===_0x56e26e['groupId'])['forEach'](_0x4bc7fb=>_0x2cfdc2['add'](_0x4bc7fb['id']));}}}if(_0x2cfdc2['size']){for(const _0x47f7d4 of _0x2cfdc2)_0x386026['removeMarker'](_0x47f7d4);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x52b6c5){for(const {name:_0x496a4a,data:_0x5d9cd7}of _0x52b6c5['model']['document']['differ']['getChangedMarkers']()){if(!_0x496a4a['startsWith'](Kn))continue;const _0x4b3a20=_0x5d9cd7['oldRange'],_0x329389=_0x5d9cd7['newRange'],_0x1c27f7=_0x4b3a20&&'$graveyard'===_0x4b3a20['root']['rootName'],_0x488306=_0x329389&&'$graveyard'===_0x329389['root']['rootName'];if(_0x1c27f7&&_0x488306)continue;const _0x4c2c7f=this['_parseMarkerName'](_0x496a4a);this['_markers']['get'](_0x496a4a)&&(_0x488306||!_0x329389?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x496a4a,'changeId':_0x4c2c7f['groupId']}):_0x1c27f7&&_0x329389&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x496a4a,'changeId':_0x4c2c7f['groupId']}));}}['_parseMarkerName'](_0x9e97f){const _0x280be9=_0x9e97f['split'](':'),_0x452117=(_0x280be9[0x1]||'')['split']('_');return{'prefix':_0x280be9[0x0],'groupId':_0x452117[0x0],'suffix':_0x452117[0x1]};}['_translateOperationToEditorContent'](_0x5344de,_0x22c78d,_0x13411d){if('insert'===_0x5344de['type']){const _0x563b35=_0x5344de;return new _0x4bd349(this['_changePosition'](_0x22c78d['concat'](_0x563b35['position']['offset']),_0x13411d),_0x563b35['nodes'],_0x563b35['baseVersion']);}if('marker'===_0x5344de['type']&&_0x5344de['name']['startsWith']('$markedRemove')){const _0x322665=_0x5344de;return new _0x412044(_0x322665['name'],_0x322665['oldRange'],this['_changeRange'](_0x322665['newRange'],_0x22c78d['concat'](_0x322665['newRange']['start']['offset']),_0x22c78d['concat'](_0x322665['newRange']['end']['offset']),_0x13411d),_0x322665['_markers'],_0x322665['affectsData'],_0x322665['baseVersion']);}return _0x5344de;}['_groupAdjacentOperations'](_0x51671){if(!_0x51671['length'])return[];const _0x1662dc=[];let _0x16ab1a=0x0,_0xd6045f=0x0,_0x26b76a=[];for(let _0x5763c6=0x0;_0x5763c6<=_0x51671['length'];_0x5763c6++){const _0x2c9b65=_0x51671[_0x5763c6],_0x55c8ab=_0x51671[_0x5763c6-0x1];!_0x2c9b65||_0x55c8ab&&!this['_getOperationEnd'](_0x55c8ab)['isTouching'](this['_getOperationStart'](_0x2c9b65))?(_0x1662dc['push']({'operations':_0x26b76a,'operationsIsolated':_0x26b76a['map'](_0x4d8182=>this['_shiftOperation'](_0x4d8182['clone'](),-_0xd6045f)),'groupOffset':_0x16ab1a}),_0x26b76a=_0x2c9b65?[_0x2c9b65]:[],_0xd6045f+=_0x16ab1a,_0x16ab1a=0x0):_0x26b76a['push'](_0x2c9b65),_0x2c9b65&&'insert'===_0x2c9b65['type']&&(_0x16ab1a+=_0x2c9b65['howMany']);}return _0x1662dc;}['_findAdjacentContextDistance'](_0x2724f6,_0xa7eac,_0x2e1308,_0x230c72=0x1){const _0xcbe0f6=new _0x4a0e2d({'startPosition':_0x2724f6,'direction':_0xa7eac});let _0x1ca868=0x0;for(let _0x4dd136=0x0;_0x4dd136<_0x230c72;_0x4dd136++){let _0x2bc547=0x0,_0xfb48e8=!0x1,_0xf23d65='forward'===_0xa7eac?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x5b4451}of _0xcbe0f6)if(_0x5b4451['is']('$textProxy')){const _0x13b3f9=_0xf23d65['exec'](_0x5b4451['data']);if(_0x13b3f9&&_0x13b3f9['length']){if(_0x2bc547+='forward'===_0xa7eac?_0x13b3f9['index']+_0x13b3f9[0x0]['length']:_0x5b4451['data']['length']-_0x13b3f9['index'],_0x13b3f9[0x0]['length']!==_0x5b4451['data']['length'])break;_0xfb48e8=!0x0,_0xf23d65='forward'===_0xa7eac?/^\w+/:/\w+$/;}else{if(_0xfb48e8)break;_0x2bc547+=_0x5b4451['offsetSize'];}}else{if(_0x5b4451['is']('element')){_0x2e1308['isInline'](_0x5b4451)&&!_0xfb48e8&&(_0x2bc547+=0x1);break;}}_0x1ca868+=_0x2bc547,_0xcbe0f6['jumpTo'](_0x2724f6['getShiftedBy']('forward'===_0xa7eac?_0x1ca868:-_0x1ca868));}return _0x1ca868;}['_getChangeContext'](_0x44d310,_0x2987d8,_0x33c4f1){const _0x596de7=_0x33c4f1['model']['schema'],_0x4893e1=this['_findAdjacentContextDistance'](_0x44d310,'backward',_0x596de7,0x6),_0x1d49e8=this['_findAdjacentContextDistance'](_0x2987d8,'forward',_0x596de7,0x6),_0x1a1258=_0x44d310['getShiftedBy'](-_0x4893e1),_0x5c2660=_0x2987d8['getShiftedBy'](_0x1d49e8);return{'start':_0x1a1258,'end':_0x5c2660,'hasContentBefore':!_0x1a1258['isAtStart'],'hasContentAfter':!_0x5c2660['isAtEnd']};}['_insertMarkers'](_0xa5aa92,_0x15de5b){const _0xcd39de=this['context']['plugins']['get']('AIEditing'),_0x458e99=new Set();_0x15de5b['model']['change'](_0x43d6b4=>{for(const _0x443fd4 of _0xa5aa92){const _0x502c73=''+Kn+_0x443fd4['type']+':'+_0x443fd4['groupId']+'_'+_0xcd39de['_nextDataId'](_0x458e99);this['_markers']['set'](_0x502c73,{'id':_0x502c73,'groupId':_0x443fd4['groupId'],'type':_0x443fd4['type'],'content':_0x443fd4['content'],'editor':_0x15de5b}),_0x43d6b4['addMarker'](_0x502c73,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x43d6b4['createRange'](_0x443fd4['start'],_0x443fd4['end'])});}});}['_createGetContextFn'](_0x137505,_0x3fac8c,_0x5ee3c8){let _0x543acd='';return()=>{if(!_0x543acd){const _0x2e54e9=_0x3fac8c['toView'](_0x137505,{'showSuggestionHighlights':!0x0});let _0x4d4484=_0x2e54e9['getChild'](0x0);if(_0x4d4484['is']('containerElement')||(_0x4d4484=_0x2e54e9),!_0x4d4484)return'';let _0x5afd2b=!0x1;const _0x454b61=[];for(const _0x38677d of _0x4d4484['getChildren']())_0x38677d['is']('element','span')&&_0x38677d['hasClass']('ck-ai_review-marker_context-end')&&(_0x5afd2b=!0x1),_0x5afd2b&&_0x454b61['push'](_0x38677d),_0x38677d['is']('element','span')&&_0x38677d['hasClass']('ck-ai_review-marker_context-start')&&(_0x5afd2b=!0x0);_0x4d4484['_removeChildren'](0x0,_0x4d4484['childCount']),_0x5ee3c8?.['ellipsisBefore']&&_0x4d4484['_appendChild']('…'),_0x4d4484['_appendChild'](_0x454b61),_0x5ee3c8?.['ellipsisAfter']&&_0x4d4484['_appendChild']('…');const _0x8dd6cf=_0x3fac8c['htmlProcessor']['domConverter']['viewToDom'](_0x2e54e9),_0x2ea873=_0x3fac8c['htmlProcessor']['htmlWriter']['getHtml'](_0x8dd6cf);_0x543acd=_0x2ea873;}return _0x543acd;};}['_createGetContentFn'](_0x4e671a,_0x191bdb){let _0x26d84a='';return()=>(_0x26d84a||(_0x26d84a=_0x191bdb['stringify'](_0x4e671a,{'showSuggestionHighlights':!0x0})),_0x26d84a);}['_createGetContentUsingDataIdFn'](_0x5852cc,_0x31d0de,_0x52ea53){let _0x5ba6f6='';return()=>{if(!_0x5ba6f6){const _0x27516c=_0x52ea53['toView'](new _0x14c213(_0x5852cc)),_0x3d7c38=_0x52ea53['htmlProcessor']['domConverter']['viewToDom'](_0x27516c)['querySelector']('[data-id=\x22'+_0x31d0de+'\x22]');_0x5ba6f6=_0x3d7c38?.['outerHTML']||'';}return _0x5ba6f6;};}['_findMarkerElement'](_0x5ee72b,_0x10aa6e=0x5){let _0x34b349=_0x5ee72b,_0xbee1e6=null;for(let _0x4ca718=0x0;_0x4ca718<_0x10aa6e&&_0x34b349;_0x4ca718++){if(!_0x34b349['className']){_0x34b349=_0x34b349['parentElement'];continue;}if(!(''+_0x34b349['className'])['includes']('ck-ai_review-marker_')){_0x34b349=_0x34b349['parentElement'];continue;}if(!_0x34b349['getAttribute']('data-marker-id'))break;_0xbee1e6=_0x34b349;break;}return _0xbee1e6;}['_findMarkerElementById'](_0x5c0190){const _0x4a110b=this['_markers']['get'](_0x5c0190),_0x4dbdfa=_0x4a110b?.['editor']??ds(this['context']),_0x2f05f8=_0x4dbdfa['model']['markers']['get'](_0x5c0190);return _0x2f05f8?_0x4db80f(_0x4dbdfa['editing'],_0x2f05f8):null;}['_getMarkersDataForGroup'](_0x287be2){return Array['from'](this['_markers']['values']())['filter'](_0x275df6=>_0x275df6['groupId']===_0x287be2);}['_getOperationStart'](_0xa61fe8){return'insert'===_0xa61fe8['type']?_0xa61fe8['position']:_0xa61fe8['newRange']['start'];}['_getOperationEnd'](_0x41e7c7,_0x1290ad=!0x1){return'insert'===_0x41e7c7['type']?_0x1290ad?_0x41e7c7['position']:_0x41e7c7['position']['getShiftedBy'](_0x41e7c7['howMany']):_0x41e7c7['newRange']['end'];}['_shiftOperation'](_0x247f76,_0x3da6db){return'insert'===_0x247f76['type']?_0x247f76['position']=_0x247f76['position']['getShiftedBy'](_0x3da6db):'marker'===_0x247f76['type']&&_0x247f76['newRange']&&(_0x247f76['newRange']=new _0x1c9ece(_0x247f76['newRange']['start']['getShiftedBy'](_0x3da6db),_0x247f76['newRange']['end']['getShiftedBy'](_0x3da6db))),_0x247f76;}['_changeOperationOwnerDocument'](_0x3c1bdb,_0x1851ce){'insert'===_0x3c1bdb['type']?_0x3c1bdb['position']=this['_changePositionOwnerDocument'](_0x3c1bdb['position'],_0x1851ce):'marker'===_0x3c1bdb['type']&&_0x3c1bdb['newRange']&&(_0x3c1bdb['newRange']=this['_changeRangeOwnerDocument'](_0x3c1bdb['newRange'],_0x1851ce));}['_changePositionOwnerDocument'](_0x2bc1d6,_0x2ccd95){return new _0x22c921(_0x2ccd95,_0x2bc1d6['path']);}['_changeRangeOwnerDocument'](_0x456d24,_0xab8824){return new _0x1c9ece(this['_changePositionOwnerDocument'](_0x456d24['start'],_0xab8824),this['_changePositionOwnerDocument'](_0x456d24['end'],_0xab8824));}['_changePosition'](_0x561312,_0x20922c){return new _0x22c921(_0x20922c,[..._0x561312]);}['_changeRange'](_0x5caada,_0x4c3613,_0x57644a,_0x326ca7){return new _0x1c9ece(this['_changePosition'](_0x4c3613,_0x326ca7),this['_changePosition'](_0x57644a,_0x326ca7));}['_sortMarkers'](_0x4ee58e){const _0x1e3548=_0x4975dd=>{switch(_0x4975dd){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x4ee58e['sort']((_0x4167be,_0x1e3891)=>_0x1e3548(_0x4167be['type'])-_0x1e3548(_0x1e3891['type']));}['_hasSameTopLevelElement'](_0x134fde,_0x2c2a21){const _0x438992=_0x134fde['getChild'](0x0),_0x371e1f=_0x2c2a21['getChild'](0x0);return!(!_0x438992||!_0x371e1f)&&((!_0x438992['is']('element')||!_0x371e1f['is']('element')||_0x438992['name']===_0x371e1f['name'])&&!(_0x438992['is']('element')&&!_0x371e1f['is']('element')||!_0x438992['is']('element')&&_0x371e1f['is']('element')));}['_haveSingleTopLevelElement'](_0x11c366){return 0x1===_0x11c366['childCount'];}['_haveOnlyInlineContent'](_0x480846,_0x4a1e1b){for(const _0x58e020 of _0x480846['getChildren']())if(_0x58e020['is']('element')&&!_0x4a1e1b['isInline'](_0x58e020))return!0x1;return!0x0;}['_upsertDataId'](_0x11b4e3,_0x36e4ad){let _0x1bbfb3=_0x11b4e3['getAttribute'](_0x4bed1f);return _0x1bbfb3||(_0x1bbfb3=_0x36e4ad(),_0x11b4e3['_setAttribute'](_0x4bed1f,_0x1bbfb3)),_0x1bbfb3;}}class AIReviewCheckResult extends Et(){['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x15545c,contentNew:_0x352e54,contentInitial:_0x1e010e,documentVersion:_0x146df8}){super(),this['id']=_0x15545c,this['contentNew']=_0x352e54,this['contentInitial']=_0x1e010e,this['documentVersion']=_0x146df8;}}class AIReviewCheckResultChange extends ht(){['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x2f9b7e,_0x50e88e,_0x3707aa){super(),this['id']=_0x2f9b7e,this['parent']=_0x3707aa,this['_data']=_0x50e88e,this['set']('isActivated',!0x1),this['set']('isRated',!0x1),this['set']('status','pending'),this['on']('change:status',()=>{'pending'!==this['status']&&this['isActivated']&&(this['isActivated']=!0x1);});}get['contentDiffed'](){return this['_data']['context']();}get['operations'](){return this['_data']['operations'];}get['operationsIsolated'](){return this['_data']['operationsIsolated'];}}class AIReviewCheckRun extends ht(){['id']=ot();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x1e2ffe,_0xf7b56,_0x40c930,_0x444c01,_0xe630dd){super(),this['_sourceCheck']=_0xf7b56,this['_documentData']=_0x1e2ffe,this['_aiConnector']=_0x40c930,this['_reviewParams']=_0x444c01,this['_reviewArgs']=_0xe630dd,this['on']('change:status',(_0x10045e,_0x561054,_0x47865c)=>{'aborted'==_0x47865c&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x47865c,'run':this,'error':this['_currentError']});}),this['set']('status','initialized');}get['documentData'](){return this['_documentData'];}get['processedResultsCount'](){return this['_results']['size'];}get['title'](){return this['_sourceCheck']['title'];}get['subTitle'](){return'';}get['reviewName'](){return this['_sourceCheck']['id'];}get['hasModifications'](){return!this['_changes']['every'](_0x282839=>'pending'===_0x282839['status']);}get['currentError'](){return this['_currentError'];}['updateDocumentData'](_0x1c8758){this['_documentData']=_0x1c8758;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x559802=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x437c86 of _0x559802)'unmodified'!==_0x437c86['data']['operation']&&('error'!==_0x437c86['data']['operation']?'review-metadata'!==_0x437c86['event']?this['_addReviewCheckResult'](_0x437c86['data']['dataId'],_0x437c86['data']['textDelta']):this['callId']=_0x437c86['data']['callId']:this['status']='error-chunk');'error-chunk'!==this['status']&&(0x0===this['_results']['size']||0x0===this['_changes']['length']?this['status']='unmodified':this['status']='ready');}catch(_0x340338){this['_currentError']=_0x340338,_0x340338 instanceof Error&&_0x340338['message']['includes']('ai-request-aborted')?this['status']='aborted':this['status']='error-general';}finally{this['_activeRequest']=null;}}async['restart'](){this['_results']['clear'](),this['_changes']['length']=0x0,this['_currentError']=void 0x0,await this['start']();}['addResultChanges'](_0x4cdd82,_0x33e88a){const _0x4c02c5=this['_results']['get'](_0x4cdd82);if(!_0x4c02c5)return;if(0x0===_0x33e88a['length'])return;const _0x23fb55=[];_0x33e88a['forEach']((_0x6a043a,_0x1b71f8)=>{const _0x24b59b=new AIReviewCheckResultChange(_0x4c02c5['id']+'-'+_0x1b71f8,_0x6a043a,_0x4c02c5);_0x24b59b['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x24b59b,'status':_0x24b59b['status']});}),_0x24b59b['on']('change:isActivated',()=>{_0x24b59b['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x24b59b}):this['fire']('reviewCheckResultDeactivated',{'change':_0x24b59b});}),this['_changes']['push'](_0x24b59b),_0x23fb55['push'](_0x24b59b);}),this['fire']('reviewCheckResultReady',{'changes':_0x23fb55,'result':_0x4c02c5,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x4eee58){const _0x39ae71=this['_changes']['find'](_0x3d0b10=>_0x3d0b10['id']===_0x4eee58);return!(!_0x39ae71||'pending'!==_0x39ae71['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x1ea09d=>!0x0===_0x1ea09d['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x5dae77=>'pending'===_0x5dae77['status']);}['getChangeById'](_0x469eb5){return this['_changes']['find'](_0x1357e1=>_0x1357e1['id']===_0x469eb5);}['markAllChangesAsAccepted'](){for(const _0xc4025e of this['_changes'])'pending'===_0xc4025e['status']&&(_0xc4025e['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x30dcc5){const _0x5b18f8=this['_changes']['find'](_0x1ef36c=>_0x1ef36c['id']===_0x30dcc5);_0x5b18f8&&'pending'===_0x5b18f8['status']&&(_0x5b18f8['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x29c163){const _0xf64c3e=this['_changes']['find'](_0x250cdb=>_0x250cdb['id']===_0x29c163);_0xf64c3e&&'pending'===_0xf64c3e['status']&&(_0xf64c3e['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x3b0f77){const _0x29e37e=this['_changes']['find'](_0x1553e1=>_0x1553e1['id']===_0x3b0f77);_0x29e37e&&'pending'===_0x29e37e['status']&&(_0x29e37e['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x386e32){const _0x5d3509=this['_changes']['find'](_0x4f79ac=>_0x4f79ac['id']===_0x386e32);_0x5d3509&&'outdated'===_0x5d3509['status']&&(_0x5d3509['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x42bac6){this['_changes']['filter'](_0x27ecff=>_0x27ecff['isActivated']&&_0x27ecff['id']!==_0x42bac6)['forEach'](_0x4f8001=>{_0x4f8001['isActivated']=!0x1;});const _0x4f7b73=this['_changes']['find'](_0x5bbf53=>_0x5bbf53['id']===_0x42bac6);_0x4f7b73&&'pending'===_0x4f7b73['status']&&(_0x4f7b73['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x5ad109=>_0x5ad109['isActivated'])['forEach'](_0x1bb896=>{_0x1bb896['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x49e840){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x457755;if(_0x49e840){const _0x44c8ab=this['_changes']['find'](_0x5bbe81=>_0x5bbe81['id']===_0x49e840);if(_0x44c8ab&&_0x44c8ab['isRated'])return;_0x44c8ab&&(_0x457755=_0x44c8ab['parent']['id'],_0x44c8ab['isRated']=!0x0);}const _0x1b94db={'positiveCount':this['_changes']['filter'](_0x3ecb45=>'accepted'===_0x3ecb45['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x1b94db,this['callId'],_0x457755);}['_addReviewCheckResult'](_0x4de413,_0x10ab85){const _0x260cc5=this['_documentData']['elements']['get'](_0x4de413);if(!_0x260cc5)return;const _0x30ee1=_0x260cc5['getContent']();if(_0x30ee1===_0x10ab85)return;const _0x1b310e=new AIReviewCheckResult({'id':_0x4de413,'contentInitial':_0x30ee1,'contentNew':_0x10ab85,'documentVersion':_0x260cc5['documentVersion']});this['_results']['set'](_0x1b310e['id'],_0x1b310e),this['fire']('reviewCheckResultAdded',{'result':_0x1b310e,'source':this,'editor':_0x260cc5['editor']});}['_checkIfFinished'](){'finished'===this['status']&&(this['_changes']['filter'](_0xed29e9=>'pending'===_0xed29e9['status'])['length']>0x0&&(this['status']='ready')),'ready'===this['status']&&(0x0===this['_changes']['filter'](_0x210582=>'pending'===_0x210582['status'])['length']&&(this['status']='finished'));}}class AIReviewSystemCheckRun extends AIReviewCheckRun{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x485c55=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x3b5065=0x0;_0x3b5065<this['_reviewParams']['length'];_0x3b5065++){if(!this['_reviewParams'][_0x3b5065]||!this['_sourceCheck']['options'][_0x3b5065])continue;const _0x374c85=this['_sourceCheck']['options'][_0x3b5065],_0x240465=_0x374c85['data']?.['find'](_0x59e0c8=>_0x59e0c8['id']===this['_reviewParams'][_0x3b5065]);_0x240465&&_0x485c55['push'](_0x240465['label']);}return _0x485c55['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x290160,_0x47b2a0,_0x42b3b2){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x47b2a0,_0x290160,_0x42b3b2);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}}class AIReviewCoreController extends _0x4127f4{['_aiConnector'];['_aiReviewCoreUi'];['_aiReviewCoreEditing'];['_aiReviewCheckList'];['_currentReviewCheckRun'];['_changeActivationSource']=null;static get['requires'](){return[AIConnector];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['init'](){this['_initRequiredPlugins'](),this['_aiReviewCheckList']=await this['_getChecksList'](),this['listenTo'](this['_aiReviewCoreUi'],'getReviewCheckList',()=>{this['_aiReviewCoreUi']['setAvailableChecks'](this['_aiReviewCheckList']['checks']);}),this['listenTo'](this['_aiReviewCoreUi'],'runReviewCheck',async(_0x1891a6,_0x40d111)=>{const _0x54c67a=this['_aiReviewCheckList']['getCheckById'](_0x40d111['id']);if(_0x54c67a){this['_onReviewCheckRun'](_0x40d111),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x40d111,_0x54c67a),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0xd5c2c0,_0x239c99)=>{switch(_0x239c99['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x239c99);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new at('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new at('ai-review-mode-check-run-chunk-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'aborted':this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['processedResultsCount']>0x0?setTimeout(()=>{this['_currentReviewCheckRun']?.['forceReadyState']();},0x0):this['_onReviewRunLeave'](!0x0);}'ready'!==_0x239c99['status']&&'error-chunk'!==_0x239c99['status']&&'error-general'!==_0x239c99['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x322bfd,_0x384342)=>{if(!this['_currentReviewCheckRun'])throw new at('ai-review-mode-no-current-check-run',this);const _0x41b88e=this['_diffContent'](_0x384342['editor'],_0x384342['result']['contentInitial'],_0x384342['result']['contentNew']);_0x384342['source']['addResultChanges'](_0x384342['result']['id'],_0x41b88e);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0xd36213,_0x1eaed6)=>{for(const _0x401770 of _0x1eaed6['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x401770);this['_markChangePositionInEditorContent'](_0x1eaed6['changes'],_0x1eaed6['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x4c685b,_0x1b3726)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x1b3726['change']['id'],_0x1b3726['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x3d361e,_0x5cb68a)=>{this['_onReviewCheckResultActivated'](_0x5cb68a);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x4194e2){_0x4194e2 instanceof Error&&_0x4194e2['message']['includes']('ai-request-aborted')||(_0x4194e2 instanceof at?this['_logError'](_0x4194e2):this['_logError'](new at('ai-review-mode-check-run-failed',this,void 0x0,_0x4194e2)));}}else this['_logError'](new at('ai-review-mode-source-check-not-found',this,{'checkId':_0x40d111['id']}));}),this['listenTo'](this['_aiReviewCoreUi'],'leaveReview',()=>{this['_onReviewRunLeave']();}),this['listenTo'](this['_aiReviewCoreUi'],'leaveReviewCoreResultList',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'abortReviewStream',()=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}),this['listenTo'](this['_aiReviewCoreUi'],'finishReview',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'acceptAllChanges',()=>{if(!this['_currentReviewCheckRun'])return;const _0x598ce5=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x598ce5['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x598ce5['map'](_0x27f0f3=>_0x27f0f3['id']));const _0x23c3d7=this['_currentReviewCheckRun'];_0x23c3d7['markAllChangesAsAccepted'](),_0x23c3d7['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x13c0d6,_0x588076)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x588076['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x588076['id']]),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x588076['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x588076['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x54de03,_0x22a5d8)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x22a5d8['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x22a5d8['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x22a5d8['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x22a5d8['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'retryReview',async()=>{this['_currentReviewCheckRun']&&(this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_currentReviewCheckRun']['updateDocumentData'](this['_aiReviewCoreEditing']['getDocumentData']()),await this['_currentReviewCheckRun']['restart']());}),this['listenTo'](this['_aiReviewCoreUi'],'activateChange',(_0x9c4494,_0x4ea13c)=>{this['_onActivateChange'](_0x4ea13c);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x48a95b,_0x2063b8)=>{this['_onDeactivateChange'](_0x2063b8);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x16c666,_0x265df6)=>{this['_onChangeMarkerClicked'](_0x16c666,_0x265df6);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x4d25c3,_0xb3a864)=>{this['_onChangeMarkerHovered'](_0x4d25c3,_0xb3a864);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x4910eb,_0x1fc9eb)=>{this['_onChangeMarkerRemoved'](_0x4910eb,_0x1fc9eb);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x5804e0,_0x16a137)=>{this['_onChangeMarkerRestored'](_0x5804e0,_0x16a137);});}['_createReviewCheckRun'](_0x6675e0,_0x2b60b5){return new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x2b60b5,this['_aiConnector'],_0x6675e0['params'],_0x6675e0['args']);}['_onChangeMarkerRemoved'](_0x4cd0cc,_0x2a22ed){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x2a22ed['changeId']);}['_onChangeMarkerRestored'](_0x22aff6,_0x268683){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x268683['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector');}['_onReviewRunLeave'](_0x100910=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x100910&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x261341 of this['_aiReviewCoreEditing']['getEditors']())_0x261341['editing']['view']['change'](_0x4ad212=>{for(const _0x23294b of _0x261341['editing']['view']['document']['getRoots']())_0x4ad212['removeClass']('ck-ai_review-diff',_0x23294b),_0x4ad212['removeClass']('ck-ai_review-highlights',_0x23294b),_0x4ad212['removeClass']('ck-ai-translate-mode-content',_0x23294b);});}['_getTranslationWithDefault'](_0x250938,_0x2abdc0){const _0x2bcf1b=Hi(this['context']['locale'],_0x250938);return _0x2bcf1b===_0x250938?_0x2abdc0:_0x2bcf1b;}['_logError'](_0x3d5fe4,_0x566af3=!0x1){Ct(_0x3d5fe4['message']),_0x566af3||(_0x3d5fe4['message']['startsWith']('ai-review-mode-models-unable-to-retrieve')?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']());}['_scrollToChange'](_0x32bf67){if('content'===this['_changeActivationSource']){const _0x1753ae=this['_aiReviewCoreUi']['getChangeElement'](_0x32bf67);_0x1753ae&&ft(_0x1753ae['closest']('.ck-ai_review__check-run-result')||_0x1753ae);}else{if('panel'===this['_changeActivationSource']){const _0x4c5e4a=this['_getChangeContentElement'](_0x32bf67);if(!_0x4c5e4a)return;wt({'target':_0x4c5e4a,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}}const Yn=[{'id':'custom','commandId':'custom','title':'Custom\x20command','description':'Type\x20a\x20custom\x20command\x20to\x20review\x20the\x20content\x20exactly\x20as\x20you\x20need.','isParameterized':!0x0},{'id':'correctness','commandId':'correctness','title':'Correctness','description':'Ensure\x20the\x20text\x20is\x20factually\x20accurate\x20and\x20free\x20of\x20errors.','isParameterized':!0x1},{'id':'clarity','commandId':'clarity','title':'Clarity','description':'Improve\x20the\x20clarity\x20and\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'readability','commandId':'readability','title':'Readability','description':'Enhance\x20the\x20overall\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'length','commandId':'make','title':'Adjust\x20length','description':'Refine\x20text\x20length\x20to\x20match\x20your\x20needs.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20length','default':'longer','data':[{'label':'Longer','id':'longer'},{'label':'Shorter','id':'shorter'}]}]},{'id':'tone','commandId':'make-tone','title':'Adjust\x20tone\x20and\x20style','description':'Choose\x20tone\x20and\x20style\x20to\x20change\x20content\x20as\x20you\x20need.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20tone\x20and\x20style','default':'casual','data':[{'label':'Casual','id':'casual'},{'label':'Direct','id':'direct'},{'label':'Friendly','id':'friendly'},{'label':'Confident','id':'confident'},{'label':'Professional','id':'professional'}]}]}];class AIReviewCheck{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x24d35f){this['id']=_0x24d35f['id'],this['commandId']=_0x24d35f['commandId'],this['title']=_0x24d35f['title'],this['description']=_0x24d35f['description'],this['isParameterized']=_0x24d35f['isParameterized'],this['useArgs']=_0x24d35f['useArgs'],this['options']=_0x24d35f['options'],this['args']=_0x24d35f['args'];}}class AIReviewCheckList extends ht(){['_checks']=[];['setupChecks'](_0x3f777c){this['_checks']=_0x3f777c['map'](_0x472697=>new AIReviewCheck(_0x472697));}get['checks'](){return this['_checks'];}['getCheckById'](_0x38ee74){return this['checks']['find'](_0x331018=>_0x331018['id']===_0x38ee74);}['removeCheckById'](_0x1537cb){this['_checks']=this['_checks']['filter'](_0x339d63=>_0x339d63['id']!==_0x1537cb);}}class AIReviewCheckCustom extends AIReviewCheck{['_models']=[];['_defaultModel']=null;constructor(_0x519403,_0xaf55d8,_0x3835bf){super(_0x519403),this['_models']=_0xaf55d8,this['_defaultModel']=_0x3835bf;}get['models'](){return this['_models'];}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewCheckExtra extends AIReviewCheck{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x3bcc6b,_0x5c7766,_0x71feba){super(_0x3bcc6b),this['prompt']=_0x3bcc6b['prompt'],this['model']=_0x3bcc6b['model'],this['model']?this['_defaultModel']=_0x5c7766['find'](_0x460d2e=>_0x460d2e['id']===this['model'])||null:this['_defaultModel']=_0x71feba;}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewModeCheckList extends AIReviewCheckList{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x383887,_0x2b625d,_0x26c2f7){super(),this['_allModels']=_0x383887,this['_recommendedModels']=_0x2b625d,this['_defaultModel']=_0x26c2f7;}['setupChecks'](_0x1056b2){this['_checks']=_0x1056b2['map'](_0x1844f0=>!0x0===_0x1844f0['isExtra']?new AIReviewCheckExtra(_0x1844f0,this['_allModels'],this['_defaultModel']):'custom'===_0x1844f0['id']?new AIReviewCheckCustom(_0x1844f0,this['_recommendedModels'],this['_defaultModel']):new AIReviewCheck(_0x1844f0));}}class AIReviewCustomCheckRun extends AIReviewCheckRun{['_prompt'];['_model'];constructor(_0x43df58,_0x5763b2,_0x3b9821,_0x22432f,_0xe94654){super(_0x3b9821,_0x22432f,_0xe94654),this['_prompt']=_0x43df58,this['_model']=_0x5763b2;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x5f4b2b,_0x482c96,_0x5dfb29){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x482c96,_0x5f4b2b,_0x5dfb29);}}class AIReviewExtraCheckRun extends AIReviewCustomCheckRun{get['subTitle'](){return'';}set['prompt'](_0x5d0cce){this['_prompt']=_0x5d0cce;}set['model'](_0x5050bf){this['_model']=_0x5050bf;}}class AIReviewModeController extends AIReviewCoreController{static get['pluginName'](){return'AIReviewModeController';}['_isDiffOn']=!0x1;['_hasDefaultAvailableCommands']=!0x1;constructor(_0x354a9a){super(_0x354a9a),this['_hasDefaultAvailableCommands']=!this['context']['config']['get']('ai.review.availableCommands'),this['context']['config']['define']('ai.review.availableCommands',Yn['map'](_0x5cccf9=>_0x5cccf9['id'])),this['context']['config']['define']('ai.review.extraCommands',[]);}async['init'](){await super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x35fc38,_0x112532)=>{this['_isDiffOn']=_0x112532['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x50d42b,_0x1c5e3){return _0x50d42b['isCustom']?new AIReviewCustomCheckRun(_0x50d42b['args']['prompt'],_0x50d42b['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x1c5e3,this['_aiConnector']):_0x1c5e3['isExtra']?new AIReviewExtraCheckRun(_0x1c5e3['prompt'],_0x1c5e3['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x1c5e3,this['_aiConnector']):new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x1c5e3,this['_aiConnector'],_0x50d42b['params'],_0x50d42b['args']);}['_onReviewCheckResultActivated'](_0x359673){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x359673['change']['id']),this['_scrollToChange'](_0x359673['change']['id']);const _0x549ed1=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x359673['change']['id']);if(!_0x549ed1)return;const _0x2aef17=this['_aiReviewCoreEditing']['getEditorForChange'](_0x359673['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x359673['change'],()=>_0x549ed1['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x2aef17,_0x549ed1['modelRange']['root']['rootName']),_0x2aef17?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x359673['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x1b019c){this['_currentReviewCheckRun']&&'click'===_0x1b019c['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x1b019c['id']));}['_onDeactivateChange'](_0x287d4f){this['_currentReviewCheckRun']&&'balloon'===_0x287d4f['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x5c3441,_0x45ffba){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x45ffba['changeId']);const _0x119aea=this['_currentReviewCheckRun']['getChangeById'](_0x45ffba['changeId']);if(!_0x119aea)return;const _0x4ddfdc=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x45ffba['changeId']),_0x393f75=this['_aiReviewCoreEditing']['getEditorForChange'](_0x45ffba['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x119aea,_0x45ffba['markerElement'],_0x45ffba['domEvent'],'click',this['_getBalloonDomRoot'](_0x393f75,_0x4ddfdc?.['modelRange']['root']['rootName']),_0x393f75?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x597514,_0x12420a){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x108fa1=this['_currentReviewCheckRun']['getChangeById'](_0x12420a['changeId']);if(!_0x108fa1)return;const _0x45c101=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x12420a['changeId']),_0x2be8e6=this['_aiReviewCoreEditing']['getEditorForChange'](_0x12420a['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x108fa1,_0x12420a['markerElement'],_0x12420a['domEvent'],'hover',this['_getBalloonDomRoot'](_0x2be8e6,_0x45c101?.['modelRange']['root']['rootName']),_0x2be8e6?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){if(!this['_currentReviewCheckRun'])return;this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']();}['_getChangeContentElement'](_0x13cee0){const _0x21fd89=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x13cee0);return _0x21fd89?_0x21fd89['getElement']():null;}['_markChangePositionInEditorContent'](_0x23fe65,_0x5a3feb){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x23fe65,_0x5a3feb);}['_diffContent'](_0x1c7625,_0x55db68,_0xd00e32){return this['_aiReviewCoreEditing']['diffContent'](_0x1c7625,_0x55db68,_0xd00e32,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x505aa1){_0x505aa1?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x225348 of this['_aiReviewCoreEditing']['getEditors']())_0x225348['editing']['view']['change'](_0x44f1a7=>{for(const _0x556717 of _0x225348['editing']['view']['document']['getRoots']()){for(const _0x128169 of _0x556717['getClassNames']())_0x128169['startsWith']('ck-ai_review-')&&_0x44f1a7['removeClass'](_0x128169,_0x556717);_0x44f1a7['addClass'](_0x505aa1?'ck-ai_review-diff':'ck-ai_review-highlights',_0x556717);}});}['_getBalloonDomRoot'](_0x553a55,_0x4090b6){const _0x5b3266=_0x553a55['editing']['view'];if(_0x4090b6){const _0x24f544=_0x5b3266['getDomRoot'](_0x4090b6);if(_0x24f544)return _0x24f544;}return _0x5b3266['getDomRoot']()??void 0x0;}async['_getChecksList'](){const _0x46016f=[...Yn,...this['_getExtraChecks']()],_0x2a9283=this['context']['config']['get']('ai.review.availableCommands')||[];this['_logErrorForNonExistentChecks'](_0x2a9283,_0x46016f);let _0x59ee13=_0x46016f;this['_hasDefaultAvailableCommands']||(_0x59ee13=_0x2a9283['map'](_0x16e34d=>_0x46016f['find'](_0x11f59d=>_0x11f59d['id']===_0x16e34d))['filter'](_0x51c610=>!!_0x51c610)),_0x59ee13=_0x59ee13['map'](_0x57c4fd=>_0x57c4fd['isExtra']?_0x57c4fd:this['_translateReviewCheck'](_0x57c4fd));const _0x136aee=_0x59ee13['some'](_0x411040=>_0x411040['isExtra']||'custom'===_0x411040['id']);let _0x81d367=[],_0x2221f7=[],_0x350f57=null;if(_0x136aee){const _0x4f35fd=await this['_getModels']();_0x81d367=_0x4f35fd['all'],_0x2221f7=_0x4f35fd['recommended'],_0x350f57=_0x4f35fd['default'];}const _0x32e307=new AIReviewModeCheckList(_0x81d367,_0x2221f7,_0x350f57);return _0x32e307['setupChecks'](_0x59ee13),_0x136aee&&this['_filterChecksWithMissingModel'](_0x32e307),_0x32e307;}['_getExtraChecks'](){return(this['context']['config']['get']('ai.review.extraCommands')||[])['map'](_0x57dcba=>({'id':_0x57dcba['id'],'commandId':_0x57dcba['id'],'title':_0x57dcba['label'],'description':_0x57dcba['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x57dcba['prompt'],'model':_0x57dcba['model']}));}['_logErrorForNonExistentChecks'](_0x41a506,_0x3d99fa){const _0x8671db=_0x41a506['filter'](_0x4d324e=>!_0x3d99fa['some'](_0x2f3f84=>_0x2f3f84['id']===_0x4d324e));_0x8671db['length']&&this['_logError'](new at('ai-review-mode-non-existent-commands-used',this,{'commandIds':_0x8671db['join'](',\x20')}),!0x0);}async['_getModels'](){try{const _0x223d53=new AIModels({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});return{'all':await _0x223d53['getAll'](),'recommended':await _0x223d53['getAvailableModels'](),'default':await _0x223d53['getDefault']()};}catch(_0xd86c5a){return this['_logError'](new at('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0xd86c5a)),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x3d6e37){const _0x539436='AI_REVIEW_CHECK_'+_0x3d6e37['id']['toUpperCase']()['replaceAll']('-','_'),_0x313ebf={..._0x3d6e37,'title':this['_getTranslationWithDefault'](_0x539436+'_TITLE',_0x3d6e37['title']),'description':this['_getTranslationWithDefault'](_0x539436+'_DESCRIPTION',_0x3d6e37['description'])};return _0x3d6e37['options']&&(_0x313ebf['options']=_0x3d6e37['options']['map'](_0x5afaf2=>({..._0x5afaf2,'label':this['_getTranslationWithDefault'](_0x539436+'_OPTIONS_LABEL',_0x5afaf2['label']||''),'data':_0x5afaf2['data']?_0x5afaf2['data']['map'](_0x39f580=>({..._0x39f580,'label':this['_getTranslationWithDefault'](_0x539436+'_OPTIONS_DATA_'+_0x39f580['id']['toUpperCase'](),_0x39f580['label'])})):void 0x0}))),_0x313ebf;}['_filterChecksWithMissingModel'](_0x9d7471){const _0x549ea2=[];_0x9d7471['checks']['forEach'](_0x43266e=>{(_0x43266e instanceof AIReviewCheckExtra&&!_0x43266e['defaultModel']||_0x43266e instanceof AIReviewCheckCustom&&!_0x43266e['models']['length'])&&_0x549ea2['push'](_0x43266e['id']);}),_0x549ea2['length']&&_0x549ea2['forEach'](_0x171c32=>{_0x9d7471['removeCheckById'](_0x171c32),this['_logError'](new at('ai-review-mode-command-unavailable-due-to-missing-model',this,{'commandId':_0x171c32}),!0x0);});}}class AIReviewMode extends _0x4127f4{static get['requires'](){return[AIReviewModeController,AIReviewModeUI,AIReviewCoreEditing];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class AITranslateCheck extends AIReviewCheck{get['apiId'](){return'translate';}}class AITranslateCheckList extends AIReviewCheckList{['setupChecks'](_0x476c0d){this['_checks']=_0x476c0d['map'](_0x3d6516=>new AITranslateCheck(_0x3d6516));}}class AITranslateCheckRun extends AIReviewSystemCheckRun{['_title'];constructor(_0xac7e43,_0x2fb6b2,_0x4c4fc5,_0x5db607,_0x409dbe,_0x5b1107){super(_0xac7e43,_0x2fb6b2,_0x4c4fc5,_0x409dbe,_0x5b1107),this['_title']=_0x5db607;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}}class AITranslateController extends AIReviewCoreController{static get['pluginName'](){return'AITranslateController';}constructor(_0x4a9f6b){super(_0x4a9f6b),this['context']['config']['define']('ai.translate.languages',[{'label':'English','id':'english'},{'label':'Spanish','id':'spanish'},{'label':'French','id':'french'},{'label':'German','id':'german'},{'label':'Chinese\x20(Simplified)','id':'chinese'},{'label':'Japanese','id':'japanese'},{'label':'Russian','id':'russian'},{'label':'Portuguese','id':'portuguese'},{'label':'Korean','id':'korean'},{'label':'Italian','id':'italian'}]);}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x2db84d,_0x5c8915){return new AITranslateCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x5c8915,this['_aiConnector'],Hi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x2db84d['params'],_0x2db84d['args']);}['_onReviewCheckResultActivated'](_0x534bee){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x534bee['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x534bee['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x40ca4e){this['_currentReviewCheckRun']&&('hover'===_0x40ca4e['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x40ca4e['id'])),'click'===_0x40ca4e['uiInteraction']&&this['_scrollToChange'](_0x40ca4e['id']));}['_onDeactivateChange'](_0x58cf39){this['_currentReviewCheckRun']&&'panel'===_0x58cf39['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x1d605e,_0x228b55){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x228b55['changeId']),this['_scrollToChange'](_0x228b55['changeId']));}['_onChangeMarkerHovered'](_0x187788,_0x3c6d12){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x3c6d12['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x3c6d12['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x595c73){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x595c73);}['_markChangePositionInEditorContent'](_0x495b7f,_0x566095){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x495b7f,_0x566095);}['_diffContent'](_0x39f887,_0x4ae5e5,_0x5656a9){return this['_aiReviewCoreEditing']['diffContent'](_0x39f887,_0x4ae5e5,_0x5656a9,!0x0);}['_onReviewCheckRun'](){for(const _0x42c672 of this['_aiReviewCoreEditing']['getEditors']())_0x42c672['editing']['view']['change'](_0x3a57fe=>{for(const _0x569519 of _0x42c672['editing']['view']['document']['getRoots']())_0x3a57fe['addClass']('ck-ai-translate-mode-content',_0x569519);});}async['_getChecksList'](){const _0x10778a=[],_0x2e611f=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x2c45e0 of _0x2e611f)_0x10778a['push']({'title':_0x2c45e0['label'],'id':_0x2c45e0['id'],'commandId':_0x2c45e0['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x2c45e0['id']}});const _0x357557=new AITranslateCheckList();return _0x357557['setupChecks'](this['_translateChecks'](_0x10778a)),_0x357557;}['_translateChecks'](_0xfde43b){return _0xfde43b['map'](_0x42a552=>{const _0x6c22fe='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x42a552['title']['toUpperCase']()['replaceAll']('-','_');return{..._0x42a552,'title':this['_getTranslationWithDefault'](_0x6c22fe,_0x42a552['title'])};});}}class AITranslateCheckResultsView extends AIReviewCoreUICheckResultsView{constructor(_0x36f08a,_0x402eb9){super(_0x36f08a,_0x402eb9),this['on']('set:isLoading',(_0x3d6d1e,_0x82d9bf,_0x3911fa)=>{_0x3911fa&&(this['headerTitle']=Hi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x579b4d,_0x357b2b,_0x18091a)=>{_0x18091a&&(this['headerTitle']=Hi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x469f4f=super['_createAcceptAllButtonView']();return _0x469f4f['set']('label',Hi(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x469f4f;}['_createExitReviewButtonView'](){const _0x786b94=super['_createExitReviewButtonView']();return _0x786b94['set']('label',Hi(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x786b94;}}class AITranslateCheckListView extends AIReviewCoreReviewCheckListView{['_setupTemplate'](){const _0x3d9ebe=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x3d9ebe['if']('isVisible','ck-hidden',_0x16dc23=>!_0x16dc23)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':Hi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':Hi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x3d9ebe['if']('isVisible','ck-hidden',_0x3a3741=>!_0x3a3741)]},'children':this['_checkViews']}]});}}class AITranslateUI extends AIReviewCoreUI{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x1ad764=this['context']['plugins']['get']('AITabs'),_0x5ef818=this['context']['locale'],_0x524fd0=new AIHeaderView(_0x5ef818,{'label':Hi(_0x5ef818,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x9de076,'class':'ck-ai-header_review-translate','showResizeButton':_0x1ad764['showResizeButton']});_0x524fd0['delegate']('resizeTabs')['to'](_0x1ad764),_0x524fd0['bind']('isMaximized')['to'](_0x1ad764['view'],'isMaximized',_0x10e45b=>_0x10e45b);const _0x2a5366=new AIReviewCoreView(_0x5ef818,{'header':_0x524fd0,'list':new AITranslateCheckListView(_0x5ef818),'results':new AITranslateCheckResultsView(_0x5ef818,{'generalErrorText':Hi(_0x5ef818,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x5ef818,{'headerText':Hi(_0x5ef818,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Hi(_0x5ef818,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Hi(_0x5ef818,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x2a5366['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x2a5366;}['registerTab'](){const _0x16d36c=this['context']['plugins']['get']('AITabs');_0x16d36c['view']['on']('activateTab',(_0x49e919,{newTab:_0x4c2f55,oldTab:_0x5d6b65})=>{'translate'===_0x4c2f55?this['fire']('getReviewCheckList'):'translate'===_0x5d6b65&&this['fire']('leaveReview');}),_0x16d36c['view']['addTab']({'id':'translate','buttonLabel':Hi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x9de076,'order':0x0,'content':this['_mainView']});}}class AITranslate extends _0x4127f4{static get['requires'](){return[AITranslateController,AITranslateUI,AIReviewCoreEditing];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{AIActions,AIAdapter,AIAssistant,AIAssistantUI,AIBalloon,AIChat,AIChatController,AIChatFeedCustomElementView,AIChatHistory,AIChatHistoryController,AIChatHistoryUI,AIChatInteraction,AIChatShortcuts,AIChatUI,AIConnector,AIEditing,AIEditorIntegration,AIInteraction,AIQuickActions,AIQuickActionsUI,AIReply,AIRequestError,AIReviewCheck,AIReviewCheckResult,AIReviewCheckResultChange,AIReviewCheckRun,AIReviewMode,AIReviewCoreController as AIReviewModeController,AIReviewCoreEditing as AIReviewModeEditing,AIReviewModeUI,AITabs,AITabsMainView,AITabsView,AITextAdapter,AIToggleButtonUI,AITranslate,AITranslateController,AITranslateUI,AWSTextAdapter,OpenAITextAdapter,ShowAIAssistantCommand,ToggleAICommand,Gi as createResizeButton,Di as getDefaultAICommands};
23
+ import{Plugin as _0x446a45,Command as _0x1a582e,ContextPlugin as _0xaac0f5,Editor as _0xf823c1}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x4b94a4,IconCheck as _0x413c73,IconError as _0x31bcf6,IconSubmit as _0x800171,IconAIHistory as _0x19de1b,IconMagicWand as _0xbab1bb,IconRobotPencil as _0x544160,IconMaximize as _0x20bed3,IconMinimize as _0x1a42a3,IconShowChangesOn as _0x24b69b,IconShowChangesOff as _0x352036,IconDocument as _0x4ca9e8,IconBoxWithCross as _0x4225ee,IconBoxWithCheck as _0x16f2f3,IconBoxWithMarker as _0x259da5,IconInfo as _0x4507a4,IconWeb as _0x1e6750,IconCancel as _0x4753f1,IconSelection as _0x30d670,IconFileUpload as _0x8492f4,IconLink as _0xc002d4,IconBulb as _0x4c1fd3,IconAI as _0x1ae066,IconPreviousArrow as _0x422a70,IconDocumentOutline as _0x21fc72,IconLoupe as _0x212da2,IconPaperClip as _0x3208de,IconBrowseFiles as _0x72791f,IconDropdownArrow as _0xbcd6d6,IconStop as _0x10fda8,IconPlus as _0x3e2661,IconAIChat as _0x23270b,IconPin as _0x33b62a,IconThreeHorizontalDots as _0x34b4b7,IconAIReview as _0x55b258,IconAITranslate as _0x57b550,IconAIAskAI as _0x17bb2f,IconThumbUp as _0x5d0aa3,IconThumbDown as _0x166134,IconChevronDown as _0x46f285,IconChevronUp as _0x136853,IconAIQuickActions as _0x3c6075,IconAIChatCommands as _0xf21145,IconAIImproveWriting as _0x2ebcfb,IconAIContinueWriting as _0x35534b,IconAIGrammarCheck as _0x5d49a3,IconAIAdjustLength as _0x176b53,IconAIChangeTone as _0xc3f8a0,IconAIOther as _0x3e01d8,IconRefresh as tt,IconNextArrow as et,IconOutdated as it,IconEye as st,IconEyeCrossedOut as nt,IconChevronRight as rt}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as ot,CKEditorError as at,ObservableMixin as ht,global as ct,isVisible as lt,Rect as ut,Collection as dt,FocusTracker as _t,KeystrokeHandler as It,first as At,logWarning as gt,logError as Ct,toArray as mt,version as pt,EmitterMixin as Et,scrollViewportToShowTarget as wt,insertToPriorityArray as Tt,scrollAncestorsToShowTarget as ft,ResizeObserver as St,_isMotionReduced as Rt,getConstrainedViewportRect as bt,DomEmitterMixin as Ot}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as kt,ButtonView as vt,View as Nt,SpinnerView as yt,IconView as xt,AutocompleteView as Lt,ListView as Dt,ListItemGroupView as Vt,ListItemView as Pt,ButtonLabelView as Ht,FocusCycler as Mt,createLabeledTextarea as Ut,Dialog as Bt,createDropdown as Gt,addMenuToDropdown as Ft,MenuBarMenuView as Kt,MenuBarMenuListItemButtonView as Wt,DialogViewPosition as Yt,MenuBarMenuListView as $t,MenuBarMenuListItemView as qt,BodyCollection as Qt,BalloonPanelView as Xt,clickOutsideHandler as zt,addListToDropdown as jt,UIModel as Jt,submitHandler as Zt,LabeledFieldView as te,createLabeledInputText as _0x1b5819,FormHeaderView as _0x525f84,HighlightedTextView as _0x177892,ViewCollection as _0x1ec894,FileDialogButtonView as _0x35dfe7,InputTextView as _0x9c2679,SearchTextView as _0x135d11,ListItemButtonView as _0x3eb8ab,ButtonLabelWithHighlightView as _0x1f5d98,DropdownMenuPanelPositioningFunctions as _0x397b48,BalloonToolbar as _0x540f68,FormRowView as _0x3282fe,TextareaView as _0x3968d5}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x13e56a,ClipboardMarkersUtils as _0x5e515b}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{ViewDocumentDomEventData as _0x5bb62f,ViewDataTransfer as _0x436886,ViewUpcastWriter as _0x7559f9,Matcher as _0x3ca4e8,_DetachOperation as _0x21f6d9,_insertIntoModelNodeList as _0x1e470e,_removeFromModelNodeList as _0x351439,ModelRange as _0x5e3e59,transformOperationSets as _0x146ca3,ViewDowncastWriter as _0xf62489,ModelDocumentFragment as _0x24e4e8,ModelPosition as _0x5464f3,ModelTreeWalker as _0x344e9d,MarkerOperation as _0x5b77c2,InsertOperation as _0x2543a3}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as _0x2bc372,escape as _0x5f10e5,cloneDeep as _0x14908a,throttle as _0x33e214,debounce as _0x5c164b,escapeRegExp as _0x42274b}from'es-toolkit/compat';import{createParser as _0x20eee3}from'eventsource-parser';import{CloudServices as _0xf32b7b}from'@ckeditor/ckeditor5-cloud-services/dist/index.js';import{parseDocument as _0x46c6b0}from'htmlparser2';import{isTag as _0x25dece,findOne as _0x173efb,getParent as _0x54bb93,findAll as _0x26b2bc,removeElement as _0x3ac3c4,prepend as _0x513713,prependChild as _0x2b9809,appendChild as _0x260865,append as _0x2a254f,find as _0x483f57,isComment as _0x234fc3,replaceElement as _0x59e804,getChildren as _0x2b3996,textContent as _0x57f134}from'domutils';import ti from'dom-serializer';import{Document as _0x1ae976,Element as _0xb124ea,Text as _0x1b02fd,cloneNode as _0x533652,isDocument as _0x43d16c,isText as _0x4bd5b2,NodeWithChildren as _0x232458}from'domhandler';import{MarkdownGfmMdToHtmlDefaultPlugins as _0x1163dc,MarkdownGfmMdToHtml as _0x1db452}from'@ckeditor/ckeditor5-markdown-gfm/dist/index.js';import _0x53a40c from'rehype-sanitize';import{fixElementSuggestionRange as _0x460e1e,DocumentCompare as _0x2ef109,DATA_ID_MODEL_ATTRIBUTE as _0x54ef8f,ConfirmMixin as _0x98b234,getAllMarkersDomElementsSorted as _0x22276b,SuggestionsConversion as _0xeedcfe,DATA_ID_VIEW_ATTRIBUTE as _0x5c1cf1,getMarkerDomElement as _0x112f07}from'@ckeditor/ckeditor5-collaboration-core/dist/index.js';import _0x464c8a from'morphdom';import{diffArrays as _0x379e1e}from'diff';const wi='_ungrouppedCommands';function Ti(_0x42f9f1,_0x1cf2d6){const _0x3b5543=(0x0,_0x1cf2d6['t'])('Other');return _0x42f9f1['length']?'groupId'in _0x42f9f1[0x0]?_0x42f9f1:[{'groupId':wi,'groupLabel':_0x3b5543,'order':0x1/0x0,'commands':_0x42f9f1}]:[{'groupId':wi,'groupLabel':_0x3b5543,'order':0x1/0x0,'commands':[]}];}const fi=globalThis['DataTransfer'],Si='ai-ui';class AIAssistantEditing extends _0x446a45{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x1eaa55}=this,_0x3b84c4=['ck-fake-ai-selection'];_0x1eaa55['config']['get']('ai.assistant.useTheme')&&_0x3b84c4['push']('ck-ai-assistant-ui_theme'),_0x1eaa55['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Si,'view':{'classes':_0x3b84c4,'priority':0xc}}),_0x1eaa55['conversion']['for']('editingDowncast')['markerToElement']({'model':Si,'view':(_0x3de751,{writer:_0x174b6e})=>{if(!_0x3de751['markerRange']['isCollapsed'])return null;const _0xfb8e=_0x174b6e['createUIElement']('span');return _0x174b6e['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0xfb8e),_0xfb8e;}});}['afterInit'](){!async function(_0x5b55f0){const _0x52b990=_0x58705([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]),_0x5014ba=0x3dffc4e1,_0x31d9f0=0x3df84eb1^_0x5014ba,_0x323502=window[_0x58705([0x44,0x61,0x74,0x65])][_0x58705([0x6e,0x6f,0x77])](),_0x4910bb=_0x5b55f0[_0x58705([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x2823b=new window[(_0x58705([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x3fe70a=>{_0x4910bb[_0x58705([0x6f,0x6e,0x63,0x65])](_0x58705([0x72,0x65,0x61,0x64,0x79]),_0x3fe70a);}),_0x299b53={[_0x58705([0x6b,0x74,0x79])]:_0x58705([0x45,0x43]),[_0x58705([0x75,0x73,0x65])]:_0x58705([0x73,0x69,0x67]),[_0x58705([0x63,0x72,0x76])]:_0x58705([0x50,0x2d,0x32,0x35,0x36]),[_0x58705([0x78])]:_0x58705([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]),[_0x58705([0x79])]:_0x58705([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]),[_0x58705([0x61,0x6c,0x67])]:_0x58705([0x45,0x53,0x32,0x35,0x36])},_0x35cbb6=_0x4910bb[_0x58705([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x58705([0x67,0x65,0x74])](_0x58705([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0xbc35bb(){let _0x29e9c7,_0xf40e6c=null,_0xd707ea=null;try{if(_0x35cbb6==_0x58705([0x47,0x50,0x4c]))return _0x58705([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x29e9c7=_0x29ed29(),!_0x29e9c7)return _0x58705([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x29e9c7[_0x58705([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0xd707ea=_0x127ede(_0x29e9c7[_0x58705([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x29e9c7[_0x58705([0x6a,0x74,0x69])])),await _0x251efc()?_0x39e1d6()?_0x27ed73()?_0x58705([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x3a99da()?(_0x29e9c7[_0x58705([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x58705([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0xf40e6c=_0x49da26(_0x58705([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),await _0x132242()):_0x58705([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x58705([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x58705([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x58705([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x27ed73(){const _0x1e6e5c=[_0x58705([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x58705([0x74,0x72,0x69,0x61,0x6c])][_0x58705([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x29e9c7[_0x58705([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x323502/0x3e8:0xe10*_0x31d9f0;return _0x29e9c7[_0x58705([0x65,0x78,0x70])]<_0x1e6e5c;}function _0x39e1d6(){const _0x481623=_0x29e9c7[_0x58705([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x481623&&(!!_0x481623[_0x58705([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x58705([0x2a]))||!!_0x481623[_0x58705([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x58705([0x41,0x49])));}function _0x3a99da(){const _0x40c1f1=_0x29e9c7[_0x58705([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x40c1f1||0x0==_0x40c1f1[_0x58705([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x52d1b8}=new URL(window[_0x58705([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x40c1f1[_0x58705([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x52d1b8))return!0x0;const _0x58b575=_0x52d1b8[_0x58705([0x73,0x70,0x6c,0x69,0x74])](_0x58705([0x2e]));return _0x40c1f1[_0x58705([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x274d02=>_0x274d02[_0x58705([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x58705([0x2a])))[_0x58705([0x6d,0x61,0x70])](_0x4c3c8c=>_0x4c3c8c[_0x58705([0x73,0x70,0x6c,0x69,0x74])](_0x58705([0x2e])))[_0x58705([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x4e963b=>_0x4e963b[_0x58705([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x58b575[_0x58705([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x58705([0x6d,0x61,0x70])](_0x30f705=>Array(_0x58b575[_0x58705([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x30f705[_0x58705([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x58705([0x66,0x69,0x6c,0x6c])](_0x30f705[0x0]===_0x58705([0x2a])?_0x58705([0x2a]):'')[_0x58705([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x30f705))[_0x58705([0x73,0x6f,0x6d,0x65])](_0x5d1ec2=>_0x58b575[_0x58705([0x65,0x76,0x65,0x72,0x79])]((_0x2f6cf4,_0x20301d)=>_0x5d1ec2[_0x20301d]===_0x2f6cf4||_0x5d1ec2[_0x20301d]===_0x58705([0x2a])));}function _0x132242(){return _0xf40e6c&&_0xd707ea?new window[(_0x58705([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x51fdfc,_0xd09e4a)=>{_0xf40e6c[_0x58705([0x74,0x68,0x65,0x6e])](_0x51fdfc,_0xd09e4a),_0xd707ea[_0x58705([0x74,0x68,0x65,0x6e])](_0x4a626a=>{_0x4a626a!=_0x58705([0x56,0x61,0x6c,0x69,0x64])&&_0x51fdfc(_0x4a626a);},_0xd09e4a);}):_0xf40e6c||_0xd707ea||_0x58705([0x56,0x61,0x6c,0x69,0x64]);}}function _0x127ede(_0x2cb049,_0x57d475){return new window[(_0x58705([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x477440=>{if(_0x387507())return _0x477440(_0x58705([0x56,0x61,0x6c,0x69,0x64]));_0x46149a(),_0x4910bb[_0x58705([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x58705([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x190892=!0x1;const _0x21d518=ot();function _0x1c9187(_0x23b2d4){return!!_0x23b2d4&&(typeof _0x23b2d4===_0x58705([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x23b2d4===_0x58705([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x23b2d4[_0x58705([0x74,0x68,0x65,0x6e])]===_0x58705([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x23b2d4[_0x58705([0x63,0x61,0x74,0x63,0x68])]===_0x58705([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x34d6de(_0x12b485){_0x4a7bfc(_0x12b485)[_0x58705([0x74,0x68,0x65,0x6e])](_0x59df94=>{if(!_0x59df94||_0x59df94[_0x58705([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x58705([0x6f,0x6b]))return _0x58705([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x7be76c(_0x1dbd1c(_0x21d518+_0x57d475))!=_0x59df94[_0x58705([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x58705([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x58705([0x56,0x61,0x6c,0x69,0x64]);})[_0x58705([0x74,0x68,0x65,0x6e])](_0x547495=>(_0xa8dbc6(),_0x547495),()=>{const _0x20b976=_0x2b8b8c();return null==_0x20b976?(_0xa8dbc6(),_0x58705([0x56,0x61,0x6c,0x69,0x64])):_0x58705(_0x323502-_0x20b976>(0x19f340e1^_0x5014ba)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x58705([0x74,0x68,0x65,0x6e])](_0x477440)[_0x58705([0x63,0x61,0x74,0x63,0x68])](()=>{_0x477440(_0x58705([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x4dc150=0x3dc92a61^_0x5014ba;function _0xa8dbc6(){const _0x511b8c=_0x58705([0x6c,0x6c,0x63,0x74,0x2d])+_0x7be76c(_0x1dbd1c(_0x2cb049)),_0x2945e5=_0x2e4f3a(_0x7be76c(window[_0x58705([0x4d,0x61,0x74,0x68])][_0x58705([0x63,0x65,0x69,0x6c])](_0x323502/_0x4dc150)));window[_0x58705([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x58705([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x511b8c,_0x2945e5);}function _0x2b8b8c(){const _0x1e4dd4=_0x58705([0x6c,0x6c,0x63,0x74,0x2d])+_0x7be76c(_0x1dbd1c(_0x2cb049)),_0x47f901=window[_0x58705([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x58705([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x1e4dd4);return _0x47f901?window[_0x58705([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x2e4f3a(_0x47f901),0x10)*_0x4dc150:null;}function _0x4a7bfc(_0x437da0){return new window[(_0x58705([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x1f5414,_0x58753d)=>{_0x437da0[_0x58705([0x74,0x68,0x65,0x6e])](_0x1f5414,_0x58753d),window[_0x58705([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x58753d,0x3dfe1021^_0x5014ba);});}}_0x4910bb[_0x58705([0x6f,0x6e])](_0x58705([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x2b5dee,_0x15e69c)=>{if(_0x15e69c[0x0]!=_0x2cb049)return _0x477440(_0x58705([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x15e69c[0x1]={..._0x15e69c[0x1],[_0x58705([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x21d518};},{[_0x58705([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x58705([0x68,0x69,0x67,0x68])}),_0x4910bb[_0x58705([0x6f,0x6e])](_0x58705([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x3c45d2=>{_0x1c9187(_0x3c45d2[_0x58705([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x190892=!0x0,_0x34d6de(_0x3c45d2[_0x58705([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x58705([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x58705([0x6c,0x6f,0x77])}),_0x2823b[_0x58705([0x74,0x68,0x65,0x6e])](()=>{_0x190892||_0x477440(_0x58705([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x387507(){return _0x4910bb[_0x58705([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x58705([0x76,0x69,0x65,0x77])][_0x58705([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x58705([0x61,0x75,0x74,0x6f]);}function _0x46149a(){_0x4910bb[_0x58705([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x58705([0x76,0x69,0x65,0x77])][_0x58705([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x58705([0x61,0x75,0x74,0x6f]);}}function _0x49da26(_0x4bace6){const _0x25d98c=[new window[(_0x58705([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x18ed3b=>setTimeout(_0x18ed3b,0x3df6fa2d^_0x5014ba)),_0x2823b[_0x58705([0x74,0x68,0x65,0x6e])](()=>new window[(_0x58705([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x5af500=>{let _0x5dc87b=0x0;_0x4910bb[_0x58705([0x6d,0x6f,0x64,0x65,0x6c])][_0x58705([0x6f,0x6e])](_0x58705([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x3f81e9,_0x3d3f27)=>{_0x3d3f27[0x0][_0x58705([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x5dc87b++,_0x5dc87b==(0x3dffc109^_0x5014ba)&&(_0x5af500(),_0x3f81e9[_0x58705([0x6f,0x66,0x66])]());});}))];return window[_0x58705([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x58705([0x72,0x61,0x63,0x65])](_0x25d98c)[_0x58705([0x74,0x68,0x65,0x6e])](()=>_0x4bace6);}async function _0x331162(){await _0x2823b,_0x4910bb[_0x58705([0x6d,0x6f,0x64,0x65,0x6c])][_0x58705([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x2770e2,_0x4910bb[_0x58705([0x6d,0x6f,0x64,0x65,0x6c])][_0x58705([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x2770e2,_0x4910bb[_0x58705([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x58705([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x36ec2a(_0x19cce7){const _0x178c31=_0x4ce0df();_0x4910bb[_0x178c31]=_0x58705([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x19cce7,_0x19cce7!=_0x58705([0x56,0x61,0x6c,0x69,0x64])&&_0x331162();}function _0x4ce0df(){const _0x94440=window[_0x58705([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x58705([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x58705([0x6e,0x6f,0x77])]())[_0x58705([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x58705([0x2e]),'');let _0x4bd9b7=_0x58705([0x6e]);for(let _0x59c54a=0x0;_0x59c54a<_0x94440[_0x58705([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x59c54a+=0x2){let _0xae47a9=window[_0x58705([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x94440[_0x58705([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x59c54a,_0x59c54a+0x2));_0xae47a9>=_0x52b990[_0x58705([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0xae47a9-=_0x52b990[_0x58705([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x4bd9b7+=_0x52b990[_0xae47a9];}return _0x4bd9b7;}function _0x29ed29(){const _0x3eaf4b=_0x35cbb6[_0x58705([0x73,0x70,0x6c,0x69,0x74])](_0x58705([0x2e]));if(0x3!=_0x3eaf4b[_0x58705([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x19537e(_0x3eaf4b[0x1]);function _0x19537e(_0x3aba88){const _0x48fb78=_0x11bba0(_0x3aba88);return _0x48fb78&&_0x51a3d5()?_0x48fb78:null;function _0x51a3d5(){const _0x37de5d=_0x48fb78[_0x58705([0x6a,0x74,0x69])],_0xd43d0d=window[_0x58705([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x37de5d[_0x58705([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x37de5d[_0x58705([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x1c1493={..._0x48fb78,[_0x58705([0x6a,0x74,0x69])]:_0x37de5d[_0x58705([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x37de5d[_0x58705([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x1c1493[_0x58705([0x76,0x63])],_0x1dbd1c(_0x1c1493)==_0xd43d0d;}}}async function _0x251efc(){let _0x5aa248=!0x0;try{const _0x10ea81=_0x35cbb6[_0x58705([0x73,0x70,0x6c,0x69,0x74])](_0x58705([0x2e])),[_0x57320a,_0x350cac,_0x43445a]=_0x10ea81;return _0x28fc8c(_0x57320a),await _0x4af8aa(_0x57320a,_0x350cac,_0x43445a),_0x5aa248;}catch{return!0x1;}function _0x28fc8c(_0x505cde){const _0x47fc29=_0x11bba0(_0x505cde);_0x47fc29&&_0x47fc29[_0x58705([0x61,0x6c,0x67])]==_0x58705([0x45,0x53,0x32,0x35,0x36])||(_0x5aa248=!0x1);}async function _0x4af8aa(_0x42169e,_0x3c3e84,_0x45cf69){const _0x399784=window[_0x58705([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x58705([0x66,0x72,0x6f,0x6d])](_0xc49421(_0x45cf69),_0xc4ec79=>_0xc4ec79[_0x58705([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x30a0ef=new window[(_0x58705([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x58705([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x42169e+_0x58705([0x2e])+_0x3c3e84),_0x120eab=window[_0x58705([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x58705([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x120eab)return;const _0x57cb9c=await _0x120eab[_0x58705([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x58705([0x6a,0x77,0x6b]),_0x299b53,{[_0x58705([0x6e,0x61,0x6d,0x65])]:_0x58705([0x45,0x43,0x44,0x53,0x41]),[_0x58705([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x58705([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x58705([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x120eab[_0x58705([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x58705([0x6e,0x61,0x6d,0x65])]:_0x58705([0x45,0x43,0x44,0x53,0x41]),[_0x58705([0x68,0x61,0x73,0x68])]:{[_0x58705([0x6e,0x61,0x6d,0x65])]:_0x58705([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x57cb9c,_0x399784,_0x30a0ef)||(_0x5aa248=!0x1);}}function _0x11bba0(_0x3cae92){return _0x3cae92[_0x58705([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x58705([0x65,0x79]))?JSON[_0x58705([0x70,0x61,0x72,0x73,0x65])](_0xc49421(_0x3cae92)):null;}function _0xc49421(_0x399dbd){return window[_0x58705([0x61,0x74,0x6f,0x62])](_0x399dbd[_0x58705([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x58705([0x2b]))[_0x58705([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x58705([0x2f])));}function _0x1dbd1c(_0x32cea9){let _0x52c1b5=0x1505;function _0x363464(_0x5cd200){for(let _0x1c4391=0x0;_0x1c4391<_0x5cd200[_0x58705([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x1c4391++){const _0x6f7930=_0x5cd200[_0x58705([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x1c4391);_0x52c1b5=(_0x52c1b5<<0x5)+_0x52c1b5+_0x6f7930,_0x52c1b5&=_0x52c1b5;}}function _0x2f8d70(_0x2031aa){Array[_0x58705([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x2031aa)?_0x2031aa[_0x58705([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x2f8d70):_0x2031aa&&typeof _0x2031aa==_0x58705([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x58705([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x2031aa)[_0x58705([0x73,0x6f,0x72,0x74])]()[_0x58705([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x1faa86,_0x4e157e])=>{_0x363464(_0x1faa86),_0x2f8d70(_0x4e157e);}):_0x363464(window[_0x58705([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x2031aa));}return _0x2f8d70(_0x32cea9),_0x52c1b5>>>0x0;}function _0x7be76c(_0x60ff51){return _0x60ff51[_0x58705([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x58705([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x58705([0x30]));}function _0x2e4f3a(_0x364d88){return _0x364d88[_0x58705([0x73,0x70,0x6c,0x69,0x74])]('')[_0x58705([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x58705([0x6a,0x6f,0x69,0x6e])]('');}function _0x2770e2(){}function _0x58705(_0x3f7b3b){return _0x3f7b3b['map'](_0x4c6d99=>String['fromCharCode'](_0x4c6d99))['join']('');}_0x36ec2a(await _0xbc35bb());}(this);}['showFakeVisualSelection'](){const _0x464ab2=this['editor']['model'];_0x464ab2['change'](_0x2b437a=>{const _0x59050d=_0x464ab2['document']['selection']['getRanges']();let _0x461772=0x0;for(const _0x4a5caa of _0x59050d){const _0x401ff7=Si+':'+_0x461772;if(_0x464ab2['markers']['has'](_0x401ff7))_0x2b437a['updateMarker'](_0x401ff7,{'range':_0x4a5caa});else{if(_0x4a5caa['start']['isAtEnd']){const _0x448aa1=_0x4a5caa['start']['getLastMatchingPosition'](({item:_0x49580f})=>!_0x464ab2['schema']['isContent'](_0x49580f),{'boundaries':_0x4a5caa});_0x2b437a['addMarker'](_0x401ff7,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x2b437a['createRange'](_0x448aa1,_0x4a5caa['end'])});}else _0x2b437a['addMarker'](_0x401ff7,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x4a5caa});}_0x461772++;}});}['hideFakeVisualSelection'](){const _0x2a13ae=this['editor']['model'],_0x4c6ea0=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Si));_0x4c6ea0['length']&&_0x2a13ae['change'](_0x452f27=>{_0x4c6ea0['forEach'](_0x554e3b=>{_0x452f27['removeMarker'](_0x554e3b);});});}['insertContent'](_0x156c05,_0x59757a){const _0xc5a21d=this['_getAISelection'](),_0x2f61f8=_0x59757a||_0xc5a21d['getFirstRange']();this['editor']['model']['canEditAt'](_0x2f61f8)&&this['editor']['model']['change'](_0x3b51a9=>{this['hideFakeVisualSelection'](),_0x59757a||this['_resetContentOfSelectedTableCells'](_0x3b51a9,_0xc5a21d),this['_pasteHTMLUsingClipboard']({'insertAt':_0x2f61f8,'writer':_0x3b51a9,'html':_0x156c05});});}['insertContentBelow'](_0xf0a048){const {model:_0x2a4598}=this['editor'],_0x98021a=this['_getAISelection']();_0x2a4598['change'](()=>{const _0x3fe8d4=this['_prepareTableInsertBelowPosition'](_0xf0a048,_0x98021a)||this['_getDefaultInsertBelowPosition'](_0x98021a);this['insertContent'](_0xf0a048,_0x3fe8d4);});}['_getAISelection'](){const _0xc8f06e=this['editor']['model'],_0x3b5d5c=Array['from'](_0xc8f06e['markers']['getMarkersGroup'](Si))['map'](_0x4b05d2=>_0x4b05d2['getRange']());return _0xc8f06e['createSelection'](_0x3b5d5c);}['_pasteHTMLUsingClipboard']({writer:_0x253fdc,html:_0x492bb7,insertAt:_0x145526}){const {view:_0x3fcab4}=this['editor']['editing'],_0x32ca46=this['editor']['plugins']['get'](_0x13e56a),_0x1e2784=new fi();_0x1e2784['setData']('text/html',_0x492bb7);const _0x118ecc=new ClipboardEvent('paste',{'clipboardData':_0x1e2784}),_0x5a8b2c=new _0x5bb62f(_0x3fcab4,_0x118ecc,{'dataTransfer':new _0x436886(_0x1e2784)});_0x253fdc['setSelection'](_0x145526);const _0x84781f=(_0x4874d0,_0x4bc962)=>{_0x4bc962['resultRange']&&_0x253fdc['setSelection'](_0x4bc962['resultRange']);};_0x32ca46['once']('contentInsertion',_0x84781f,{'priority':'lowest'}),_0x3fcab4['document']['fire']('paste',_0x5a8b2c),_0x32ca46['off']('contentInsertion',_0x84781f);}['_getDefaultInsertBelowPosition'](_0x5c591d){const {model:_0x348bc2}=this['editor'],_0xab84bb=Array['from'](_0x5c591d['getSelectedBlocks']());return _0xab84bb['length']?_0x348bc2['createPositionAfter'](_0xab84bb['pop']()):_0x5c591d['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x4198c8,_0x1a1c32){const {model:_0x354089,plugins:_0xccd509}=this['editor'];if(_0xccd509['has']('TableUtils')){const _0xa48248=_0xccd509['get']('TableUtils')['getSelectedTableCells'](_0x1a1c32);if(_0xa48248['length']){const _0x48a3d3=this['_getTableRowCountFromContent'](_0x4198c8),_0xebabb1=this['_createEmptyTableRows'](_0xa48248,_0x48a3d3);return _0x354089['createPositionAt'](_0xebabb1,0x0);}}return null;}['_getTableRowCountFromContent'](_0x1c7f23){const _0x45a5c8=this['editor']['plugins']['get']('TableUtils'),_0xde96b7=this['editor']['data']['parse'](_0x1c7f23),_0x5697c4=Array['from'](_0xde96b7['getChildren']())['filter'](_0x37a20a=>_0x37a20a['is']('element','table'));let _0x5b881f=0x0;return _0x5697c4['forEach'](_0xf7503a=>{_0x5b881f+=_0x45a5c8['getRows'](_0xf7503a);}),_0x5b881f;}['_createEmptyTableRows'](_0x4ec20c,_0x3894ac){const _0x459068=this['editor']['plugins']['get']('TableUtils'),_0x5b2fed=_0x459068['getRowIndexes'](_0x4ec20c),_0x574287=_0x459068['getColumnIndexes'](_0x4ec20c),_0x687f5e=_0x5b2fed['last']+0x1,_0x37bfbc=_0x574287['first'],_0x466cbc=_0x4ec20c[0x0]['findAncestor']('table');for(let _0x19a2d9=0x0;_0x19a2d9<_0x3894ac;_0x19a2d9++)_0x459068['insertRows'](_0x466cbc,{'at':_0x687f5e});return _0x466cbc['getChild'](_0x687f5e)['getChild'](_0x37bfbc);}['_resetContentOfSelectedTableCells'](_0x31e783,_0x2ad740){const {plugins:_0x59cc77}=this['editor'],{model:_0x47eb9e}=_0x31e783;if(!_0x59cc77['has']('TableUtils'))return;_0x59cc77['get']('TableUtils')['getSelectedTableCells'](_0x2ad740)['length']&&_0x47eb9e['deleteContent'](_0x2ad740);}}class AIAdapter extends _0x446a45{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new at('aiadapter-text-adapter-not-set',null);}}class AIRequestError extends Error{constructor(_0x4eb013){super(_0x4eb013),this['name']='AIRequestError';}}function Ri(_0x55e67f,_0x333cd8,_0x3ebc39){const t=_0x55e67f['t'];switch(_0x333cd8){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',_0x3ebc39);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x3ebc39);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'},_0x3ebc39);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_AWS_NOT_SUPPORTED':return t({'id':'AI_ERROR_AWS_NOT_SUPPORTED','string':'The\x20AWS\x20integration\x20is\x20no\x20longer\x20supported.\x20Please\x20contact\x20the\x20support.'});case'AI_ERROR_FAILED':return t({'id':'AI_ERROR_FAILED','string':'Failed\x20to\x20communicate\x20with\x20the\x20AI\x20service'});default:return _0x333cd8;}}class ShowAIAssistantCommand extends _0x1a582e{['_commandDefinitions'];constructor(_0x3e88a4,_0x8dfa0f){super(_0x3e88a4),this['_commandDefinitions']=_0x8dfa0f,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x58cfc1,_0x40b702,_0x30cf4f)=>{this['isEnabled']&&(this['enabledCommandsIds']=bi(this['_commandDefinitions'],_0x30cf4f));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x13105b,_0x27e358,_0x273ecf)=>{this['enabledCommandsIds']=_0x273ecf?bi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x1fd404=this['editor']['model'];this['_hasContext']=function(_0xf09c75){const _0x5ce584=_0xf09c75['document']['selection'];return _0x5ce584['isCollapsed']?0x0!==[..._0x5ce584['getSelectedBlocks']()]['length']&&![..._0x5ce584['getSelectedBlocks']()][0x0]['isEmpty']:!!_0xf09c75['hasContent'](_0x5ce584['getFirstRange']());}(_0x1fd404);const _0x228164=_0x1fd404['document']['selection'],_0x2d3ce7=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x2cc1d9 of _0x228164['getRanges']())for(const _0x1ecd4c of _0x2cc1d9['getItems']())if(_0x1ecd4c['is']('element')&&_0x2d3ce7['includes'](_0x1ecd4c['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x1c26b3='',_0x563c8b='',_0x1293f1='custom'){this['editor']['plugins']['get'](AIAssistantUI)['showUI'](_0x1c26b3,_0x563c8b,_0x1293f1);}}function bi(_0x5107d6,_0x5497f8){const _0x5c8075=new Set();for(const _0x3a87d6 of _0x5107d6['values']())(_0x5497f8||!0x1===_0x3a87d6['requiresContent'])&&_0x5c8075['add'](_0x3a87d6['id']);return Array['from'](_0x5c8075);}const Oi=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class AIAssistantController extends/* #__PURE__ -- @preserve */
24
+ ht(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x1e8645,_0x404160,_0x4216e6){super(),this['editor']=_0x1e8645,this['textAdapter']=_0x404160,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x4216e6,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x10a4f8,_0x4db841,_0x3b1f07)=>{this['view']['value']=this['_sanitizeHTML'](_0x3b1f07);}),this['listenTo'](this['view'],'submitPrompt',(_0x516361,_0x1fd086)=>{const _0x3d4957=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x1fd086,_0x3d4957,'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:_0x45aa5e,query:_0x302b1d,htmlContent:_0x319cbf,label:_0x4e9236,mainActionLabel:_0x513490}){this['view']['prompt']=_0x4e9236,this['view']['mainAction']=_0x513490,this['initialContext']=_0x319cbf,_0x302b1d&&(this['view']['isRendered']?this['_handleQuery'](_0x302b1d,_0x319cbf,_0x45aa5e,_0x4e9236):this['view']['once']('render',()=>{this['_handleQuery'](_0x302b1d,_0x319cbf,_0x45aa5e,_0x4e9236);}));}['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'](_0x57293e,_0x57a9b6,_0x5dec15,_0x4a2044){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x57a9b6,this['previousQuery']=_0x57293e,this['previousLabel']=_0x4a2044||_0x57293e,this['previousActionId']=_0x5dec15,new Promise(_0x4b8e94=>{this['textAdapter']['makeRequest']({'query':_0x57293e,'context':_0x57a9b6,'onData':_0x2bd62f=>{this['currentResponse']=_0x2bd62f,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x5dec15})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x7eb28a=>{_0x7eb28a instanceof AIRequestError?this['view']['handleError'](_0x7eb28a['message']):this['view']['handleError'](),_0x4b8e94();})['finally'](()=>{this['stopProcessing'](),_0x4b8e94();});});}['_parseAndNormalizeContent'](_0x5d67c7,_0x5c519c=!0x1){const _0x105d4c=Oi['exec'](_0x5d67c7);_0x5d67c7=_0x105d4c?_0x5d67c7['substring'](_0x105d4c[0x1]['length']):_0x5d67c7['length']<0x64&&!_0x5c519c?'':this['_stripMarkdownSyntax'](_0x5d67c7);const _0x149cb8=this['_domParser']['parseFromString'](_0x5d67c7,'text/html');if(_0x105d4c){const _0x446bd6=Array['from'](_0x149cb8['body']['childNodes']);_0x446bd6['reverse']();for(const _0x32531a of _0x446bd6){if(_0x32531a['nodeType']==Node['ELEMENT_NODE'])break;_0x32531a['remove']();}}const _0x16cffd=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x149cb8['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x16cffd);const _0x4b4fce=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x1ff250=this['editor']['data']['toModel'](_0x16cffd);return _0x4b4fce||_0x1ff250['markers']['clear'](),this['editor']['data']['stringify'](_0x1ff250);}['_normalizeResponseHeadings'](_0x1feca3){const _0x34735f=new _0x7559f9(this['editor']['editing']['view']['document']),_0x8688d1=new _0x3ca4e8({'name':/^h[1-5]$/}),_0xe3f863=[];let _0x501ec3=!0x1;for(const _0x35ae84 of _0x1feca3)_0x35ae84['is']('element')&&_0x8688d1['match'](_0x35ae84)&&(_0xe3f863['push'](_0x35ae84),'h1'==_0x35ae84['name']&&(_0x501ec3=!0x0));if(_0x501ec3){for(const _0x6f3c1d of _0xe3f863)_0x34735f['rename']('h'+(parseInt(_0x6f3c1d['name'][0x1])+0x1),_0x6f3c1d);}}['_isH1TagSupportEnabled'](){const {data:_0x4d2863,editing:_0x31a4bf}=this['editor'],_0x11927b=_0x4d2863['htmlProcessor']['toView']('<h1></h1>'),_0x195831=_0x4d2863['toView'](_0x4d2863['toModel'](_0x11927b));return!!_0x31a4bf['view']['domConverter']['viewToDom'](_0x195831)['querySelector']('h1');}['_sanitizeHTML'](_0x30c072){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x30c072),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x49cb8b){const _0x2ecb1b=_0x49cb8b['trim']();return _0x2ecb1b['startsWith']('```html')?_0x2ecb1b['endsWith']('```')?_0x2ecb1b['substring'](0x7,_0x2ecb1b['length']-0x3):_0x2ecb1b['substring'](0x7):_0x49cb8b;}}const ki={'REPLACE':'replace','INSERT':'insert'};class AIFormToolbarView extends kt{constructor(_0x2b2d31){super(_0x2b2d31),this['set']('isVisible',!0x1),this['set']('mainAction',ki['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x4a14e3=>Ri(_0x2b2d31,'AI_'+_0x4a14e3['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Ri(_0x2b2d31,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Ri(_0x2b2d31,'Try\x20again')),this['stopButton']=this['_createButton'](Ri(_0x2b2d31,'Stop'));const _0x1734e4=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x1734e4['if']('isVisible','ck-hidden',_0xc1c973=>!_0xc1c973)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x4bc1a2,_0x20a8de){const _0x4c0a93=new vt(this['locale']);return _0x4c0a93['set']({'label':_0x4bc1a2,'class':_0x20a8de||'','isVisible':!0x0,'withText':!0x0}),_0x4c0a93;}}class AIFormContentArea extends Nt{['contentFieldView'];['copyButtonView'];constructor(_0x300781,_0x1cda4a=''){super(_0x300781),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x477e2d=this['bindTemplate'];this['contentFieldView']=new ContentFieldView(_0x300781,_0x1cda4a),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x477e2d['if']('isVisible','ck-hidden',_0x47bdfd=>!_0x47bdfd)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x477e2d['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 _0x3d9593=!0x1;this['on']('change:value',(_0x42f5c9,_0x51761b,_0x3dfd32)=>{const _0x1edcfc=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x3dfd32),this['isProcessing']&&_0x1edcfc&&!_0x3d9593&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x1033e6,_0x53f100,_0x4daa9a)=>{_0x3d9593=!0x1,_0x4daa9a?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x3d9593=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x3d9593=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x3f35b4=this['locale'],_0x10c018=new vt(this['locale']),_0x2e6f7b='ck-ai-form__copy-button';return _0x10c018['set']({'label':Ri(_0x3f35b4,'Copy'),'icon':_0x4b94a4,'class':_0x2e6f7b,'tooltip':!0x0}),_0x10c018['bind']('isVisible')['to'](this,'value',_0xe44189=>!!_0xe44189),_0x10c018['bind']('isEnabled')['to'](this,'isProcessing',_0x563c66=>!_0x563c66),_0x10c018['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x10c018['icon']=_0x413c73,_0x10c018['class']=_0x2e6f7b+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x10c018['icon']=_0x4b94a4,_0x10c018['class']=_0x2e6f7b;},0x3e8);}),_0x10c018;}['_copyHTMLToClipboard'](_0x59b170){const {window:_0x2316d1,document:_0x2934f3}=ct;if(_0x2316d1['ClipboardItem']){const {Blob:_0x358c1e,ClipboardItem:_0x17630f}=_0x2316d1,_0x5eb9d8=[new _0x17630f({'text/html':new _0x358c1e([_0x59b170['innerHTML']],{'type':'text/html'}),'text/plain':new _0x358c1e([_0x59b170['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x5eb9d8);}else{const _0x45dad8=_0x2934f3['createElement']('div');_0x45dad8['style']['position']='absolute',_0x45dad8['style']['left']='-9999px',_0x45dad8['innerHTML']='<span>[</span>'+_0x59b170['innerHTML']+'<span>]</span>',_0x2934f3['body']['appendChild'](_0x45dad8);const _0x764631=_0x2934f3['createRange']();_0x764631['setStartAfter'](_0x45dad8['firstElementChild']),_0x764631['setEndBefore'](_0x45dad8['lastElementChild']);const _0x12fa96=_0x2316d1['getSelection']();_0x12fa96['removeAllRanges'](),_0x12fa96['addRange'](_0x764631),_0x2934f3['execCommand']('copy'),_0x45dad8['remove']();}}}class ContentFieldView extends Nt{constructor(_0x7963b3,_0x59a2e9=''){super(_0x7963b3),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x59a2e9,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x4072c6){this['element']['innerHTML']=_0x4072c6;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x5297c1=new Nt(),_0x11c24f=this['locale'],_0x52ee78=new yt();return _0x52ee78['isVisible']=!0x0,_0x5297c1['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x52ee78,{'text':Ri(_0x11c24f,'AI\x20is\x20writing...')}]}),_0x5297c1['render'](),_0x5297c1;}}class AIFormErrorView extends Nt{constructor(_0x115be1,_0x4e45f7=''){super(_0x115be1);const _0x113f47=new xt(),_0x1f79ae=this['bindTemplate'];this['set']('text',_0x4e45f7),_0x113f47['content']=_0x31bcf6,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x113f47,{'text':_0x1f79ae['to']('text')}]});}}class AIFormPromptView extends Lt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x1bc221,_0x5316f1){super(_0x1bc221,_0x5316f1),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',(_0x240b5b,_0x3e0574)=>{_0x240b5b['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x3e0574());});}['_createSubmitButton'](){const _0x47049e=new vt(this['locale']),_0x12aa7d=this['locale'];return _0x47049e['set']({'icon':_0x800171,'label':Ri(_0x12aa7d,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x47049e['on']('execute',()=>{this['submit']();}),_0x47049e['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x39b8a3,_0x12c0fc)=>!_0x39b8a3&&_0x12c0fc),_0x47049e;}['_createShowHistoryButton'](){const _0x56f85a=new vt(this['locale']),_0x2674a6=this['resultsView'],_0x333a94=this['locale'];_0x56f85a['set']({'label':Ri(_0x333a94,'History'),'withText':!0x1,'icon':_0x19de1b,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x56f85a['bind']('isOn')['to'](_0x2674a6,'isVisible'),_0x56f85a['bind']('isEnabled')['to'](this,'isEnabled'),_0x56f85a['on']('execute',()=>{_0x2674a6['isVisible']=!_0x2674a6['isVisible'],_0x2674a6['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x401810=()=>{ct['window']['requestAnimationFrame'](()=>{if(lt(this['element'])){const _0x506902=new ut(this['queryView']['fieldView']['element']),_0xce82e5=_0x506902['width'],_0x54fb8d='rtl'===_0x333a94['uiLanguageDirection']?'left':'right';_0x506902['excludeScrollbarsAndBorders'](),_0x56f85a['element']['style'][_0x54fb8d]=_0xce82e5-_0x506902['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x401810),this['on']('render',_0x401810),_0x56f85a;}['submit'](){const _0x345cb0=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x345cb0);}['focus'](_0xe2b72d){-0x1===_0xe2b72d?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class AIHistoryListView extends Dt{['historyGroupView'];['clearHistoryButton'];constructor(_0x5d331a){super(_0x5d331a),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Vt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Ri(_0x5d331a,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x5635a5=0x0;for(const _0x433ad3 of this['items'])_0x5635a5+=_0x433ad3['items']['length'];return{'resultsCount':_0x5635a5,'totalItemsCount':_0x5635a5};}['_createClearHistoryButton'](){const _0x5d9980=this['locale'],_0x5850c0=new vt(this['locale']);return _0x5850c0['set']({'label':'('+Ri(_0x5d9980,'Clear')+')','withText':!0x0}),_0x5850c0['on']('execute',()=>this['fire']('clearHistory')),_0x5850c0;}}class AIHistoryListItemView extends Pt{constructor(_0x51421b){super();const _0x3b12e8=new Ht(),_0x504dd2=new vt(this['locale'],_0x3b12e8);this['children']['add'](_0x504dd2),_0x504dd2['set']({'label':_0x51421b['prompt'],'withText':!0x0}),_0x504dd2['on']('execute',()=>{this['fire']('execute',{'value':_0x2bc372(_0x51421b['prompt'])});});}}const vi='CKEditor/AIFormView/PromptHistory';class PromptHistory extends dt{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x57f8a0,_0x588878)=>{const _0x4875fa=Ni(_0x588878['prompt']);for(const _0x19596f of this)if(_0x19596f!=_0x588878&&Ni(_0x19596f['prompt'])===_0x4875fa){this['remove'](_0x19596f);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x1bfd1b=sessionStorage['getItem'](vi)||'[]';this['addMany'](JSON['parse'](_0x1bfd1b));}['_saveToSessionStorage'](){sessionStorage['setItem'](vi,JSON['stringify'](this['map'](_0xfa496e=>_0xfa496e)));}}function Ni(_0x5b6830){return _0x5b6830['toLowerCase']()['trim']();}class AIFormView extends Nt{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x2e47b4,_0x2c6b16,_0x332d4f=''){super(_0x2e47b4),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',ki['REPLACE']),this['_promptHistory']=new PromptHistory(),this['errorView']=new AIFormErrorView(_0x2e47b4),this['contentArea']=new AIFormContentArea(_0x2e47b4,_0x332d4f),this['contentArea']['bind']('isProcessing')['to'](this),this['contentArea']['bind']('value')['to'](this),this['toolbar']=this['_createToolbar'](),this['toolbar']['bind']('mainAction')['to'](this),this['promptView']=this['_createPromptView'](),this['focusTracker']=new _t(),this['keystrokes']=new It(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Mt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['focusCycler']['chain'](this['promptView']['focusCycler']),this['promptView']['queryView']['fieldView']['bind']('value')['to'](this,'prompt');const _0x39b15f=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x2c6b16],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x39b15f['if']('isError','ck-hidden',_0x3b9d7c=>!_0x3b9d7c)]},'children':[this['errorView']]},this['contentArea'],this['toolbar'],this['promptView']]}]});}['render'](){super['render'](),this['focusTracker']['add'](this['contentArea']['element']),this['focusTracker']['add'](this['contentArea']['copyButtonView']['element']),this['focusTracker']['add'](this['toolbar']['element']),this['focusTracker']['add'](this['promptView']['element']),this['keystrokes']['listenTo'](this['element']);}['focus'](_0x43b864=0x1){-0x1===_0x43b864?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['reset'](){this['prompt']='',this['value']='',this['isError']=!0x1,this['promptView']['reset'](),this['contentArea']['isVisible']=!0x1,this['toolbar']['isVisible']=!0x1;}['_createPromptView'](){const _0x2e76f1=this['locale'],_0x589354=new AIFormPromptView(_0x2e76f1,{'queryView':{'label':Ri(_0x2e76f1,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':Ut,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Ri(_0x2e76f1,'Empty\x20history'),'secondary':Ri(_0x2e76f1,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x589354['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x1106d6,_0x427d4c)=>_0x1106d6&&!_0x427d4c),this['listenTo'](_0x589354,'submit',(_0x1e4109,_0x1e4cb2)=>{this['prompt']=_0x1e4cb2;const _0x1a2d8b=_0x5f10e5(_0x1e4cb2);this['fire']('submitPrompt',_0x1a2d8b),_0x1e4cb2['trim']()&&this['_promptHistory']['add']({'prompt':_0x1a2d8b},0x0);},{'priority':'high'}),_0x589354;}['_createHistoryView'](){const _0x528a67=new AIHistoryListView(this['locale']);return _0x528a67['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](AIHistoryListItemView),_0x528a67['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x528a67;}['_createToolbar'](){const _0x199be1=new AIFormToolbarView(this['locale']);return _0x199be1['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x39a852,_0x39458e,_0x314dcc)=>_0x39a852&&!_0x39458e&&!!_0x314dcc),_0x199be1['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x199be1['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x629085,_0x3c7473,_0x5d35bb)=>_0x629085&&!_0x3c7473&&!!_0x5d35bb),_0x199be1['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x199be1['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x23b8e2,_0x10dfdc)=>_0x23b8e2&&!_0x10dfdc),_0x199be1['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x199be1['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x199be1['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x199be1;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x1dda84=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Ri(_0x1dda84,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x4f4368){const _0x13241e=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x4f4368||Ri(_0x13241e,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const yi=globalThis['DataTransfer'];class AIAssistantUI extends _0x446a45{['licenseKey'];['_licenseKeyCheckInterval'];['_dialog'];['_formView'];['_aiAdapter'];['_aiAssistantController'];['_uiCssClasses']='';static get['pluginName'](){return'AIAssistantUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[_0x5e515b,AIAssistantEditing,AIAdapter,Bt];}constructor(_0x55ad40){super(_0x55ad40),_0x55ad40['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x55ad40['config']['define']('ai.assistant.contentAreaCssClass',''),_0x55ad40['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x55ad40['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x309dcc}=this;this['_aiAdapter']=_0x309dcc['plugins']['get'](AIAdapter),this['_dialog']=_0x309dcc['plugins']['get'](Bt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x309b73=new ShowAIAssistantCommand(_0x309dcc,Array['from'](this['_commandDefinitions']['values']()));_0x309dcc['commands']['add']('showAIAssistant',_0x309b73),_0x309dcc['ui']['componentFactory']['add']('aiCommands',_0x5a899f=>{const _0x2979a2=Gt(_0x5a899f);return _0x2979a2['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x2979a2['buttonView']['set']({'label':Ri(_0x5a899f,'AI\x20Commands'),'icon':_0xbab1bb,'tooltip':!0x0}),_0x2979a2['on']('execute',_0x2ebeb1=>this['_onExecute'](_0x2ebeb1['source']['id'])),Ft(_0x2979a2,_0x309dcc['ui']['view']['body'],function(_0x554488){const _0x3fa741=Ti(_0x554488['config']['get']('ai.assistant.commands'),_0x554488['locale']),_0x2d378d=Li(_0x554488,_0x3fa741)['filter'](_0x49acda=>_0x49acda['commands']['length']);if(0x1===_0x2d378d['length'])return Li(_0x554488,_0x2d378d[0x0]['commands'])['map'](_0x3eeffd=>({'id':_0x3eeffd['id'],'label':_0x3eeffd['label']}));return _0x2d378d['map'](_0xcd088a=>{const {groupId:_0x47ad25,groupLabel:_0x5e63ff,commands:_0x529a6c}=_0xcd088a,_0x488cdd=Li(_0x554488,_0x529a6c)['map'](_0x4f705b=>({'id':_0x4f705b['id'],'label':_0x4f705b['label']}));return{'id':_0x47ad25,'menu':_0x5e63ff||_0x47ad25,'children':_0x488cdd};});}(_0x309dcc),{'ariaLabel':Ri(_0x5a899f,'AI\x20Commands')}),_0x2979a2['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x309b73['on']('change:enabledCommandsIds',_0x20a866),_0x2979a2['menuView']['once']('render',_0x20a866),_0x2979a2;function _0x20a866(){_0x2979a2['isEnabled']=_0x309b73['enabledCommandsIds']['length']>0x0;for(const _0x34adf2 of _0x2979a2['menuView']['buttons'])_0x34adf2['isEnabled']=_0x309b73['enabledCommandsIds']['includes'](_0x34adf2['id']);}}),_0x309dcc['ui']['componentFactory']['add']('menuBar:aiCommands',_0x3e4bdc=>{const _0x3de588=new Kt(_0x3e4bdc);_0x3de588['buttonView']['set']({'label':Ri(_0x3e4bdc,'AI\x20Commands'),'icon':_0xbab1bb}),_0x3de588['bind']('isEnabled')['to'](_0x309b73,'enabledCommandsIds',_0x30cc86=>_0x30cc86['length']>0x0);const _0x15ce15=Ti(_0x309dcc['config']['get']('ai.assistant.commands'),_0x3e4bdc);return this['_populateMenuBarMenu'](_0x309b73,_0x3de588,_0x15ce15,_0x535d7a=>this['_onExecute'](_0x535d7a)),_0x3de588;}),_0x309dcc['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x438a8c=this['_createAIAssistantUIButton'](vt);return _0x438a8c['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x438a8c;}),_0x309dcc['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x2273ab=this['_createAIAssistantUIButton'](Wt);return _0x2273ab['set']({'role':'menuitemcheckbox'}),_0x2273ab;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x12b55b=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x3b31d9;for(const _0x17dfc4 in _0x12b55b){const _0x5cfa4c=_0x17dfc4,_0x210088=_0x12b55b[_0x5cfa4c];if('aiLicenseKeyValid'==_0x210088||'aiLicenseKeyInvalid'==_0x210088||'aiLicenseKeyExpired'==_0x210088||'aiLicenseKeyDomainLimit'==_0x210088||'aiLicenseKeyNotAllowed'==_0x210088||'aiLicenseKeyEvaluationLimit'==_0x210088||'aiLicenseKeyUsageLimit'==_0x210088){delete _0x12b55b[_0x5cfa4c],_0x3b31d9=_0x210088,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x3b31d9&&_0x12b55b['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x3b31d9&&_0x12b55b['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x3b31d9&&_0x12b55b['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x3b31d9&&_0x12b55b['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x3b31d9&&_0x12b55b['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x3b31d9&&_0x12b55b['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x15ada8='',_0x35ff66='',_0x174a87='custom'){const _0x315a11=this['editor'],_0x5461fe=_0x315a11['editing']['view'],_0x544781=_0x315a11['plugins']['get'](AIAssistantEditing),_0x3f1c6d=_0x315a11['plugins']['get'](_0x5e515b);_0x544781['showFakeVisualSelection']();const _0x3a7059=new yi(),_0x547cd1=new ClipboardEvent('copy',{'clipboardData':_0x3a7059}),_0x143920=new _0x436886(_0x3a7059),_0x1a15f8=new _0x5bb62f(_0x5461fe,_0x547cd1,{'dataTransfer':_0x143920});_0x3f1c6d['_forceMarkersCopy']('comment',()=>{_0x5461fe['document']['fire']('copy',_0x1a15f8);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new AIAssistantController(_0x315a11,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x52c5b5=_0x143920['getData']('text/html');const _0x444f38=_0x315a11['model']['document']['selection'],_0x27c2b3=Array['from'](_0x444f38['getRanges']());0x1===_0x27c2b3['length']&&_0x27c2b3[0x0]['isFlat']&&!_0x444f38['getSelectedElement']()&&''!==_0x52c5b5['replace'](/&nbsp;/g,'')['trim']()&&(_0x52c5b5='<p>'+_0x52c5b5+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x174a87,'query':_0x15ada8,'htmlContent':_0x52c5b5,'label':_0x35ff66,'mainActionLabel':ki[_0x315a11['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x544160,'title':Ri(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Yt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x544781['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x4bdc1c=new Map(),_0x1e57a7=Ti(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x575404 of _0x1e57a7)for(const _0xedc1f6 of _0x575404['commands'])_0x4bdc1c['set'](_0xedc1f6['id'],{..._0xedc1f6,'groupId':_0x575404['groupId'],'groupLabel':_0x575404['groupLabel']||_0x575404['groupId']});return _0x4bdc1c;}['_createAIAssistantUIButton'](_0x494272){const _0x4e90f7=this['editor'],_0x3e541f=_0x4e90f7['commands']['get']('showAIAssistant'),_0x40547d=new _0x494272(_0x4e90f7['locale']);return _0x40547d['set']({'label':Ri(_0x4e90f7['locale'],'AI\x20Assistant'),'icon':_0x544160,'isToggleable':!0x0}),_0x40547d['bind']('isEnabled')['to'](_0x3e541f),_0x40547d['bind']('isOn')['to'](this['_dialog'],'id',_0x48f9da=>'aiAssistant'===_0x48f9da),this['listenTo'](_0x40547d,'execute',()=>{_0x40547d['isOn']?this['hideUI']():_0x3e541f['execute']();}),_0x40547d;}['_initView'](){const _0xa53be5=this['editor']['plugins']['get'](AIAssistantEditing);this['_formView']=new AIFormView(this['editor']['locale'],this['_uiCssClasses'],this['editor']['config']['get']('ai.assistant.contentAreaCssClass')),this['_formView']['on']('change:value',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['_formView']['promptView']['queryView']['fieldView']['on']('update',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['listenTo'](this['_formView'],'replaceContent',()=>{_0xa53be5['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0xa53be5['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x3cc7cb,ui:{ariaLiveAnnouncer:_0x28e452}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x2823ab,_0x17c892,_0x516ec1)=>{const _0x510cf1=this['_aiAssistantController']['currentContext'];_0x516ec1?_0x28e452['announce'](Ri(_0x3cc7cb,'AI\x20is\x20writing')):_0x510cf1&&_0x28e452['announce'](Ri(_0x3cc7cb,'Generated\x20content:\x20%0',_0x510cf1),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x36317b,_0x36a509,_0x7104ca)=>{if(_0x7104ca){const _0x23a1d2=this['_formView']['errorView']['text'];_0x28e452['announce'](Ri(_0x3cc7cb,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x23a1d2));}});}['_onExecute'](_0x28a6a9){const _0x15aa6e=this['_commandDefinitions']['get'](_0x28a6a9),_0x1c7e5a=this['editor'],_0x31ea48=_0x1c7e5a['model']['document']['selection'],_0x3a7a88=_0x1c7e5a['commands']['get']('showAIAssistant'),_0x49c0a4=_0x1c7e5a['plugins']['get'](AIAssistantEditing),_0x1b8438=''+(_0x15aa6e['groupId']!==wi?_0x15aa6e['groupLabel']+':\x20':'')+_0x15aa6e['label'];if(!0x1!==_0x15aa6e['requiresContent']&&_0x31ea48['isCollapsed']){const _0x241c06=At(_0x31ea48['getSelectedBlocks']())||_0x1c7e5a['model']['schema']['getLimitElement'](_0x31ea48);_0x1c7e5a['model']['change'](_0x45b877=>{_0x45b877['setSelection'](_0x241c06,'in');});}_0x49c0a4['showFakeVisualSelection'](),_0x3a7a88['execute'](_0x15aa6e['prompt'],_0x1b8438,'command:'+_0x28a6a9);}['_populateMenuBarMenu'](_0x36feff,_0x59c52e,_0x4d0e5d,_0x3fc844){const _0x3d25af=this['editor'],_0x8d0e5a=_0x3d25af['locale'],_0x15bce8=new $t(_0x8d0e5a),_0x5e0039=Li(_0x3d25af,_0x4d0e5d)['filter'](_0xf2023d=>_0xf2023d['commands']['length']);0x1===_0x5e0039['length']?this['_getMenuBarGroupButtons']({'command':_0x36feff,'commands':_0x5e0039[0x0]['commands'],'parentMenuView':_0x59c52e,'onExecute':_0x3fc844})['forEach'](_0x39337d=>_0x15bce8['items']['add'](_0x39337d)):_0x5e0039['forEach'](({groupId:_0x283ee8,groupLabel:_0x2f91db,commands:_0x4cc1ef})=>{const _0x5882e8=new qt(_0x8d0e5a,_0x59c52e),_0x4a81d2=new Kt(_0x8d0e5a),_0x48e8b8=new $t(_0x8d0e5a),_0x576558=this['_getMenuBarGroupButtons']({'command':_0x36feff,'commands':_0x4cc1ef,'parentMenuView':_0x4a81d2,'onExecute':_0x3fc844});_0x4a81d2['buttonView']['set']({'label':_0x2f91db||_0x283ee8}),_0x4a81d2['delegate']('execute')['to'](_0x59c52e),_0x48e8b8['items']['addMany'](_0x576558),_0x4a81d2['panelView']['children']['add'](_0x48e8b8),_0x5882e8['children']['add'](_0x4a81d2),_0x15bce8['items']['add'](_0x5882e8);}),_0x59c52e['panelView']['children']['add'](_0x15bce8);}['_getMenuBarGroupButtons']({command:_0x13dbdb,commands:_0x29932a,parentMenuView:_0x53de0e,onExecute:_0x5b0cdb}){const _0x20e572=this['editor'],_0xf78228=_0x20e572['locale'];return Li(_0x20e572,_0x29932a)['map'](_0x1606db=>{const _0x8090c9=new qt(_0xf78228,_0x53de0e),_0x4e66f1=new Wt(_0xf78228);return _0x4e66f1['set']({'label':_0x1606db['label']}),_0x4e66f1['delegate']('execute')['to'](_0x53de0e),_0x4e66f1['on']('execute',()=>_0x5b0cdb(_0x1606db['id'])),_0x4e66f1['bind']('isEnabled')['to'](_0x13dbdb,'enabledCommandsIds',_0x372802=>_0x372802['includes'](_0x1606db['id'])),_0x8090c9['children']['add'](_0x4e66f1),_0x8090c9;});}}function xi(_0x363c77,_0x26628c){return void 0x0!==_0x363c77['order']&&void 0x0===_0x26628c['order']?0x1:void 0x0===_0x363c77['order']&&void 0x0!==_0x26628c['order']?-0x1:void 0x0!==_0x363c77['order']&&void 0x0!==_0x26628c['order']?_0x363c77['order']-_0x26628c['order']:0x0;}function Li(_0x3629d9,_0x2db8c3){_0x2db8c3['sort'](xi);const _0x521a94={},_0x488717=[];for(const _0x403d18 of _0x2db8c3)if(void 0x0!==_0x403d18['order']){if(_0x403d18['order']in _0x521a94)throw new at('ai-commands-config-order-collision',_0x3629d9,{'conflictingDefinitions':[_0x403d18,_0x521a94[_0x403d18['order']]]});_0x521a94[_0x403d18['order']]=_0x403d18,_0x488717['splice'](_0x403d18['order'],0x0,_0x403d18);}else _0x488717['push'](_0x403d18);return _0x488717;}class AIAssistant extends _0x446a45{static get['requires'](){return[AIAssistantUI,AIAssistantEditing];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1b6c9e){super(_0x1b6c9e);const _0x45a98e=_0x1b6c9e['config'],_0x506e47=_0x1b6c9e['locale'];_0x45a98e['define']('ai.assistant.preserveComments',!0x0),_0x45a98e['define']('ai.assistant.commands',Di(_0x506e47)),_0x45a98e['define']('ai.assistant.extraCommandGroups',[]),_0x45a98e['define']('ai.assistant.removeCommands',[]);let _0x48b699=Ti(_0x45a98e['get']('ai.assistant.commands'),_0x506e47);const _0x389d2b=_0x45a98e['get']('ai.assistant.extraCommandGroups'),_0x23c6d1=_0x45a98e['get']('ai.assistant.removeCommands');_0x389d2b['forEach'](_0xe73930=>{const _0x167ac8=_0x48b699['find'](_0xb9d122=>_0xb9d122['groupId']===_0xe73930['groupId']);_0x167ac8?_0x167ac8['commands']=_0x167ac8['commands']['concat'](_0xe73930['commands']):_0x48b699['push'](_0xe73930);}),_0x48b699=_0x48b699['filter'](_0x5e0fbe=>!_0x23c6d1['includes'](_0x5e0fbe['groupId'])),_0x48b699['forEach'](_0x3c8bbe=>{_0x3c8bbe['commands']=_0x3c8bbe['commands']['filter'](_0x5c2502=>!_0x23c6d1['includes'](_0x5c2502['id']));}),_0x45a98e['set']('ai.assistant.commands',_0x48b699);}}function Di(_0x2cbd59){return[{'groupId':'editOrReview','groupLabel':Ri(_0x2cbd59,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Ri(_0x2cbd59,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Ri(_0x2cbd59,'Make\x20shorter'),'prompt':'Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.'},{'id':'makeLonger','label':Ri(_0x2cbd59,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Ri(_0x2cbd59,'Simplify\x20language'),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':'generate','groupLabel':Ri(_0x2cbd59,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Ri(_0x2cbd59,'Summarize'),'prompt':'Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.'},{'id':'continue','label':Ri(_0x2cbd59,'Continue'),'prompt':'Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.'}]},{'groupId':'changeTone','groupLabel':Ri(_0x2cbd59,'Change\x20tone'),'commands':[{'id':'professional','label':Ri(_0x2cbd59,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Ri(_0x2cbd59,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Ri(_0x2cbd59,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Ri(_0x2cbd59,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Ri(_0x2cbd59,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Ri(_0x2cbd59,'Change\x20style'),'commands':[{'id':'business','label':Ri(_0x2cbd59,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Ri(_0x2cbd59,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Ri(_0x2cbd59,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Ri(_0x2cbd59,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Ri(_0x2cbd59,'Translate'),'commands':[{'id':'translateEnglish','label':Ri(_0x2cbd59,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Ri(_0x2cbd59,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Ri(_0x2cbd59,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Ri(_0x2cbd59,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Ri(_0x2cbd59,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Ri(_0x2cbd59,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Ri(_0x2cbd59,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Ri(_0x2cbd59,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}class AITextAdapter extends _0x446a45{['abortController'];static get['requires'](){return[AIAdapter];}constructor(_0x575973){super(_0x575973),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](AIAdapter)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x3dab24){return this['sendRequest'](_0x3dab24)['catch'](_0x26fb09=>{if(_0x26fb09 instanceof AIRequestError)return Promise['reject'](_0x26fb09);if('AbortError'==_0x26fb09['name'])return Promise['resolve']();throw console['error'](_0x26fb09),new at('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x2c9688,_0x116d67){const _0x27f87f=this['editor']['locale'],_0x403f46={'Content-Type':'application/json'};if('object'==typeof _0x2c9688)Object['assign'](_0x403f46,_0x2c9688);else{if(_0x2c9688)try{const _0x13f471=await _0x2c9688(_0x116d67);Object['assign'](_0x403f46,_0x13f471);}catch{return Promise['reject'](new AIRequestError(Ri(_0x27f87f,'AI_ERROR_GET_HEADERS')));}}return _0x403f46;}async['_prepareRequestParameters'](_0x47b717,_0x1ffaf6){const _0x431180=this['editor']['locale'];if('object'==typeof _0x47b717)return _0x47b717;try{return await _0x47b717(_0x1ffaf6);}catch{return Promise['reject'](new AIRequestError(Ri(_0x431180,'AI_ERROR_GET_PARAMETERS')));}}}class OpenAITextAdapter extends AITextAdapter{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x3a897f){super(_0x3a897f),_0x3a897f['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x3a897f['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x3a897f['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x3a897f['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x3a897f['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x3a897f['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x17a548,context:_0x2c6d76,onData:_0x15a3fb,actionId:_0x1118e3}){const _0x5faacf=this['editor']['locale'],_0x25d320=await this['prepareMessages'](_0x17a548,_0x2c6d76,_0x1118e3),_0x39b76d=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x1118e3),_0x3cd515=await this['_prepareRequestParameters'](this['_requestParameters'],_0x1118e3),_0x351ba5={'messages':_0x25d320,..._0x3cd515},_0x3c2e58={'method':'POST','headers':_0x39b76d,'body':JSON['stringify'](_0x351ba5),'signal':this['abortController']['signal']},_0x8fc988=await fetch(this['_apiUrl'],_0x3c2e58);if(_0x8fc988['ok'])return _0x3cd515['stream']?await this['_readStreamableResponse'](_0x8fc988,_0x15a3fb):await this['_readStaticResponse'](_0x8fc988,_0x15a3fb),Promise['resolve']();{const _0x2094b8=await _0x8fc988['text']();return _0x2094b8['includes']('context_length_exceeded')?Promise['reject'](new AIRequestError(Ri(_0x5faacf,'AI_ERROR_CONTEXT_LENGTH'))):_0x2094b8['includes']('Moderation')?Promise['reject'](new AIRequestError(Ri(_0x5faacf,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x2094b8));}}async['prepareMessages'](_0x43621c,_0x498d3d,_0xb73922){let _0x1dd2d0,_0x5d0eb5;return _0x498d3d?(_0x1dd2d0='Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x5d0eb5='Instruction:\x0a'+_0x43621c+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x498d3d):(_0x1dd2d0='Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x5d0eb5=_0x43621c),[{'role':'system','content':_0x1dd2d0},{'role':'user','content':_0x5d0eb5}];}async['_readStreamableResponse'](_0x214641,_0x302154){const _0x180282=_0x214641['body']['getReader'](),_0x2fb00d=new TextDecoder();let _0x28eac7='',_0x315006='',_0x307d82='',_0xd6435d=!0x1;for(;!_0xd6435d;){const {done:_0x458e16,value:_0x47c951}=await _0x180282['read'](),_0x20b3af=_0x28eac7+_0x2fb00d['decode'](_0x47c951);let _0x465a23='';_0xd6435d=_0x458e16;try{_0x465a23=this['_cleanUpData'](_0x20b3af),_0x28eac7='';}catch{_0x28eac7=_0x20b3af;continue;}_0x315006+=_0x465a23,!_0xd6435d&&this['_isBufferIncomplete'](_0x315006)||_0x315006&&(_0x307d82+=_0x315006,_0x315006='',_0x302154(_0x307d82));}return Promise['resolve']();}async['_readStaticResponse'](_0x23688c,_0x3d187d){return _0x3d187d((await _0x23688c['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x32d72b){const _0x69ffcd=_0x32d72b['split']('<')['length']!==_0x32d72b['split']('>')['length'],_0x4e931c=_0x32d72b['length']<0x1e;return _0x69ffcd&&_0x4e931c;}['_cleanUpData'](_0x22adbb){return _0x22adbb['split'](/\n(?![^{]*\})/g)['map'](_0x84cefa=>_0x84cefa['replace']('data:\x20',''))['filter'](_0x53b3e8=>_0x53b3e8&&_0x53b3e8['length']>0x0&&'[DONE]'!==_0x53b3e8)['map'](_0x3223a1=>{const {choices:_0x45a36b}=JSON['parse'](_0x3223a1);if(_0x45a36b[0x0]?.['delta']?.['content'])return _0x45a36b[0x0]['delta']['content'];})['filter'](_0x5d2b37=>_0x5d2b37)['join']('');}}class AWSTextAdapter extends AITextAdapter{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),gt('ai-aws-adapter-not-supported');}async['sendRequest'](_0x8339ae){throw Ct('ai-aws-adapter-not-supported'),new AIRequestError(Ri(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}}class TabButtonView extends vt{constructor(_0x39e0bd,_0x402b61={}){super(_0x39e0bd),this['isToggleable']=!0x0,this['set']('side',_0x402b61['side']||'top');const _0x44e7d3=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...mt(_0x402b61['class']||[]),_0x44e7d3['to']('side',_0x5b6f69=>'ck-tab-button_'+_0x5b6f69),_0x44e7d3['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class TabPanelView extends Nt{['children'];constructor(_0x1fa883,_0x5a53b0={}){super(_0x1fa883);const _0x2a46c2=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...mt(_0x5a53b0['class']||[]),_0x2a46c2['to']('class'),_0x2a46c2['if']('isVisible','ck-hidden',_0xecbd9d=>!_0xecbd9d)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class AITabsView extends Nt{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x485068,_0x48d859={}){super(_0x485068),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x48d859['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x48d859['collapsible']||!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'activeTab',(_0x36ecb0,_0x3e19d3)=>_0x36ecb0&&null!==_0x3e19d3);const _0x1398db=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...mt(_0x48d859['class']||[]),_0x1398db['to']('side',_0x4e8281=>'ck-tabs_'+_0x4e8281),_0x1398db['to']('class'),_0x1398db['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x1398db['to']('activeTab',_0x10d53a=>null===_0x10d53a?'ck-ai-tabs_collapsed':'')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x1398db['to']('side',_0x3647de=>'ck-tabs__buttons-container_'+_0x3647de)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x1398db['to']('side',_0x17aaf1=>'ck-tabs__panels-container_'+_0x17aaf1)]},'children':this['panelViews']},...mt(_0x48d859['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x19be8b){const _0x18640b=this['_tabs']['get'](_0x19be8b);return _0x18640b||null;}['addTab'](_0x27fe1f){const _0x4ab1b3=this['_setupButton']({'id':_0x27fe1f['id'],'label':_0x27fe1f['buttonLabel'],'icon':_0x27fe1f['buttonIcon'],'order':_0x27fe1f['order']}),_0x114074=new TabPanelView(this['locale']);return _0x114074['render'](),_0x27fe1f['content']&&_0x114074['children']['add'](_0x27fe1f['content']),this['panelViews']['add'](_0x114074),this['_tabs']['set'](_0x27fe1f['id'],{'button':_0x4ab1b3,'panel':_0x114074,'order':void 0x0!==_0x27fe1f['order']?_0x27fe1f['order']:null}),this['fire']('addTab:'+_0x27fe1f['id'],{'id':_0x27fe1f['id'],'button':_0x4ab1b3,'panel':_0x114074}),null===this['activeTab']?this['activateTab'](_0x27fe1f['id']):this['_hidePanel'](_0x27fe1f['id']),{'button':_0x4ab1b3,'panel':_0x114074};}['activateTab'](_0x2b18a8){if(null!==_0x2b18a8&&!this['getTab'](_0x2b18a8))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x2b18a8});if(this['activeTab']===_0x2b18a8)return;const _0x1de000=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x2b18a8,_0x2b18a8&&this['_showPanel'](_0x2b18a8),this['fire']('activateTab:'+_0x2b18a8,{'newTab':_0x2b18a8,'oldTab':_0x1de000});}['toggleTabPanel'](_0x40a192){if(!this['getTab'](_0x40a192))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x40a192});this['activeTab']===_0x40a192?this['collapsible']&&(this['activeTab']=null):this['activateTab'](_0x40a192);}['showTab'](_0x49eeba){if(!this['getTab'](_0x49eeba))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x49eeba});this['_showPanel'](_0x49eeba),this['_showButton'](_0x49eeba),this['fire']('show:'+_0x49eeba,_0x49eeba);}['hideTab'](_0x4baa6f){if(!this['getTab'](_0x4baa6f))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x4baa6f});const _0x4c55db=this['activeTab'];this['_hidePanel'](_0x4baa6f),this['_hideButton'](_0x4baa6f);const _0x5b50f7=this['getTabIds']();_0x4c55db===_0x4baa6f&&_0x5b50f7['length']>0x1&&this['activateTab'](_0x5b50f7['find'](_0x5295fb=>_0x5295fb!==_0x4baa6f)),this['fire']('hide:'+_0x4baa6f,_0x4baa6f);}['_getPanel'](_0xe52fdf){const _0x1b44c1=this['_tabs']['get'](_0xe52fdf);return _0x1b44c1?_0x1b44c1['panel']:null;}['_showPanel'](_0x3b9bf2){null!==this['activeTab']&&this['activeTab']!==_0x3b9bf2||this['_getPanel'](_0x3b9bf2)['show']();}['_hidePanel'](_0x286381){const _0x3b5fdf=this['_getPanel'](_0x286381);_0x3b5fdf['isVisible']&&(this['activeTab']===_0x286381&&(this['activeTab']=null),_0x3b5fdf['hide']());}['_getButton'](_0x545b43){const _0x3b303e=this['_tabs']['get'](_0x545b43);return _0x3b303e?_0x3b303e['button']:null;}['_showButton'](_0x4d974a){this['_getButton'](_0x4d974a)['show']();}['_hideButton'](_0x7ba797){this['_getButton'](_0x7ba797)['hide']();}['_setupButton'](_0x51d4e5){const _0x282556=new TabButtonView(this['locale'],{'side':this['side']}),_0x3114a9=this['buttonViews'];if(_0x282556['set']({'label':_0x51d4e5['label'],'icon':_0x51d4e5['icon'],'tooltip':!0x0,'withText':!0x0}),_0x282556['bind']('isOn')['to'](this,'activeTab',_0x2fd8e7=>_0x2fd8e7===_0x51d4e5['id']),_0x282556['bind']('side')['to'](this,'side'),_0x51d4e5['order']){const _0x417a36=[...this['_tabs']]['reduce']((_0x2caf18,_0x398a09)=>{const _0x28b064=_0x398a09[0x0],{order:_0x170f3d}=_0x398a09[0x1];return!_0x170f3d||_0x170f3d>_0x51d4e5['order']?_0x2caf18:_0x170f3d>=_0x2caf18['order']?{'id':_0x28b064,'order':_0x170f3d}:_0x2caf18;},{'id':'','order':0x0}),_0x491fb8=_0x3114a9['getIndex'](this['_getButton'](_0x417a36['id']));_0x3114a9['add'](_0x282556,_0x491fb8+0x1);}else _0x3114a9['add'](_0x282556);return _0x282556['on']('execute',()=>{this['toggleTabPanel'](_0x51d4e5['id']);}),_0x282556;}}const Vi=['overlay','sidebar','custom'],Pi=['left','right'];class AITabsMainView extends AITabsView{constructor(_0x17a869,_0x5c5c37={}){super(_0x17a869,_0x5c5c37),this['set']('type',_0x5c5c37['type']||'sidebar'),this['set']('side',_0x5c5c37['side']||'right'),this['set']('isVisible',_0x5c5c37['visibleByDefault']??!0x0);const _0x13fdeb=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x13fdeb['if']('type','ck-ai-tabs__overlay',_0x4831c8=>'overlay'===_0x4831c8),_0x13fdeb['if']('type','ck-ai-tabs__sidebar',_0x4e3d85=>'sidebar'===_0x4e3d85),_0x13fdeb['if']('isVisible','ck-hidden',_0x1e8605=>!_0x1e8605)]}}),this['buttonViews']['on']('add',(_0x10e132,_0x3d003c)=>{_0x3d003c['set']('withText',!0x1);});}}class AITabs extends _0xaac0f5{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1378c9){if(super(_0x1378c9),!this['context']['config']['get']('ai.container'))throw new at('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x6b41b5=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x6b41b5['showResizeButton']&&(this['showResizeButton']=_0x6b41b5['showResizeButton']),'sidebar'!==_0x6b41b5['type']&&'overlay'!==_0x6b41b5['type']||_0x6b41b5['side']&&(this['side']=_0x6b41b5['side']),'sidebar'===_0x6b41b5['type']){if(this['container']=_0x6b41b5['element'],this['set']('type','sidebar'),!this['container'])throw new at('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x6b41b5['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new AITabsMainView(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x6b41b5['visibleByDefault'],'collapsible':_0x6b41b5['collapsible']}),this['view']['render'](),this['view']['bind']('side')['to'](this,'side'),this['view']['bind']('type')['to'](this,'type'),this['container']&&this['container']['appendChild'](this['view']['element']),this['context']instanceof _0xf823c1&&this['context']['ui']['focusTracker']['add'](this['view']['element']),this['listenTo'](this,'resizeTabs',()=>{this['view']['isMaximized']=!this['view']['isMaximized'],this['fire']('resizedTabs',this['view']['isMaximized']);});}['switchType'](_0x430a5f){if(_0x430a5f&&this['type']!==_0x430a5f){if(!Vi['includes'](_0x430a5f))throw new at('ai-tabs-unsupported-ui-type');this['type']=_0x430a5f;}}['switchSide'](_0x5d05e0){if(_0x5d05e0&&this['side']!==_0x5d05e0){if(!Pi['includes'](_0x5d05e0))throw new at('ai-tabs-unsupported-ui-side');this['side']=_0x5d05e0;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}}class AIConnector extends _0xaac0f5{['_apiUrl'];['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0xf32b7b];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x6920d){super(_0x6920d),this['context']['config']['define']('ai.serviceUrl','https://ai.cke-cs.com/v1'),this['_apiUrl']=this['context']['config']['get']('ai.serviceUrl'),this['_token']=null,this['_decoder']=new TextDecoder(),this['_responseCache']=new Map();}['init'](){const _0x55634a=this['context']['plugins']['get'](_0xf32b7b);if(!_0x55634a['token'])throw new at('ai-missing-token',this);this['_token']=_0x55634a['token'];}['startConversation'](_0x37f503,_0x4feb7b){const _0x2cf0ac=this['_sendApiRequest']('/conversations','POST',{'id':_0x37f503,'group':_0x4feb7b});return{'getConversation':async()=>(await _0x2cf0ac['request'])['json'](),'abortController':_0x2cf0ac['abortController']};}['queryAssistant']({message:_0x1f30e4,conversationId:_0xb94779,parts:_0x196067,capabilities:_0x24adf8,model:_0x3d988f,attributes:_0x5f33f5}){const _0x31212a={'prompt':_0x1f30e4,'content':_0x196067,'model':_0x3d988f,..._0x24adf8&&{'capabilities':_0x24adf8},..._0x5f33f5&&{'attributes':_0x5f33f5}},_0x1c0739=this['_sendApiRequest']('/conversations/'+_0xb94779+'/messages','POST',_0x31212a);return{'getStream':async()=>{const _0x2719cf=(await _0x1c0739['request'])['body'];return this['_getStreamReader'](_0x2719cf);},'abortController':_0x1c0739['abortController']};}['executeCustomAction']({content:_0x469609,message:_0x1b1d34,model:_0x3a1489,outputFormat:_0x5b5d71}){const _0x45eb90={'content':[{'type':'text','content':_0x469609}],'prompt':_0x1b1d34,'model':_0x3a1489,'outputFormat':_0x5b5d71},_0x5b5c97=this['_sendApiRequest']('/actions/custom/calls','POST',_0x45eb90);return{'getStream':async()=>{const _0x2504fd=(await _0x5b5c97['request'])['body'];return this['_getStreamReader'](_0x2504fd);},'abortController':_0x5b5c97['abortController']};}['executeAction']({actionName:_0x552508,content:_0x46921d,args:_0x24d746}){const _0x44f7d3={'content':[{'type':'text','content':_0x46921d}],'args':_0x24d746},_0x46eb87=this['_sendApiRequest']('/actions/system/'+_0x552508+'/calls','POST',_0x44f7d3);return{'getStream':async()=>{const _0x5c1aba=(await _0x46eb87['request'])['body'];return this['_getStreamReader'](_0x5c1aba);},'abortController':_0x46eb87['abortController']};}['uploadFile'](_0x2f7fcf,_0xe30383,_0x3e44f4){const _0x166c19=new FormData();_0x166c19['append']('file',_0xe30383,_0xe30383['name']),_0x3e44f4&&_0x166c19['append']('attributes',JSON['stringify'](_0x3e44f4));const _0x2a4dbb=this['_sendApiRequest']('/conversations/'+_0x2f7fcf+'/files','POST',_0x166c19);return{'getId':async()=>(await _0x2a4dbb['request'])['json'](),'abortController':_0x2a4dbb['abortController']};}['fetchDocument'](_0x132837,_0x4b21d6){const _0x17ce82=this['_sendApiRequest']('/conversations/'+_0x132837+'/documents/'+_0x4b21d6,'GET');return{'getDocument':async()=>(await _0x17ce82['request'])['json'](),'abortController':_0x17ce82['abortController']};}['uploadDocument'](_0x540e42,_0x289060,_0x24fd08){const _0x126768={'content':_0x289060};_0x24fd08&&(_0x126768['attributes']=_0x24fd08);const _0x4e2a47=this['_sendApiRequest']('/conversations/'+_0x540e42+'/documents','POST',_0x126768);return{'getId':async()=>(await _0x4e2a47['request'])['json'](),'abortController':_0x4e2a47['abortController']};}['uploadDocuments'](_0x586475,_0x1c6b06){const _0x15b126={'documents':_0x1c6b06['map'](_0x27c1f1=>({'content':_0x27c1f1['content'],'attributes':{'version':_0x27c1f1['version'],'sessionId':_0x27c1f1['sessionId'],'channelId':_0x27c1f1['channelId'],'rootName':_0x27c1f1['rootName'],'selections':_0x27c1f1['selections']},...void 0x0!==_0x27c1f1['name']?{'name':_0x27c1f1['name']}:{},...void 0x0!==_0x27c1f1['description']?{'description':_0x27c1f1['description']}:{}}))},_0x1c564c=this['_sendApiRequest']('/conversations/'+_0x586475+'/documents/batch','POST',_0x15b126);return{'getIds':async()=>(await _0x1c564c['request'])['json'](),'abortController':_0x1c564c['abortController']};}['fetchDocuments'](_0x53a036,_0x5f4dcc){const _0x3feaed=new URLSearchParams();_0x3feaed['append']('documentIds',_0x5f4dcc['join'](','));const _0x5a80a1=this['_sendApiRequest']('/conversations/'+_0x53a036+'/documents/batch?'+_0x3feaed['toString'](),'GET');return{'getDocuments':async()=>(await _0x5a80a1['request'])['json'](),'abortController':_0x5a80a1['abortController']};}['fetchConversations'](_0x7e5c0a,_0x46c4fa={}){const _0x571a63=new URLSearchParams();_0x571a63['append']('group',_0x7e5c0a),_0x571a63['append']('excludeEmpty',!0x1!==_0x46c4fa['excludeEmpty']?'true':'false'),_0x571a63['append']('limit',_0x46c4fa['limit']?_0x46c4fa['limit']['toString']():'100'),_0x571a63['append']('sortBy',_0x46c4fa['sortBy']?_0x46c4fa['sortBy']:'createdAt'),_0x571a63['append']('order',_0x46c4fa['order']?_0x46c4fa['order']:'desc');const _0x2af794=this['_sendApiRequest']('/conversations?'+_0x571a63['toString'](),'GET');return{'getConversations':async()=>{const _0x4b3e1c=await _0x2af794['request'];return(await _0x4b3e1c['json']())['items'];},'abortController':_0x2af794['abortController']};}['deleteConversation'](_0x3b7aa4){const _0x468f2d=this['_sendApiRequest']('/conversations/'+_0x3b7aa4,'DELETE');return{'execute':async()=>{await _0x468f2d['request'];},'abortController':_0x468f2d['abortController']};}['updateConversation'](_0x4dd61d,_0x2a9b3a){const _0x17e22d=this['_sendApiRequest']('/conversations/'+_0x4dd61d,'PATCH',_0x2a9b3a);return{'getResult':async()=>(await _0x17e22d['request'],_0x2a9b3a),'abortController':_0x17e22d['abortController']};}['fetchConversation'](_0x4e9654){const _0x203a34=this['_sendApiRequest']('/conversations/'+_0x4e9654,'GET');return{'getConversation':async()=>(await _0x203a34['request'])['json'](),'abortController':_0x203a34['abortController']};}['fetchConversationMessages'](_0x143a4a){const _0x1d681b=this['_sendApiRequest']('/conversations/'+_0x143a4a+'/messages','GET');return{'getMessages':async()=>{const _0x474508=await _0x1d681b['request'];return(await _0x474508['json']())['items'];},'abortController':_0x1d681b['abortController']};}['uploadUrl'](_0xf65f4f,_0x221873,_0x1a3afd){const _0x4917ce=this['_sendApiRequest']('/conversations/'+_0xf65f4f+'/web-resources','POST',{'url':_0x221873,'attributes':_0x1a3afd});return{'getId':async()=>(await _0x4917ce['request'])['json'](),'abortController':_0x4917ce['abortController']};}['getModels'](_0x5a5a5a='en'){const _0x238220=new URLSearchParams();_0x238220['append']('language',_0x5a5a5a);const _0x6b51b1='/models/1?'+_0x238220['toString'](),_0x1f57c8=this['_sendApiRequest'](_0x6b51b1,'GET',void 0x0,!0x0);return{'list':async()=>await(await _0x1f57c8['request'])['json'](),'abortController':_0x1f57c8['abortController']};}['deleteFile'](_0x148ced,_0x1ff466){const _0x55f979=this['_sendApiRequest']('/conversations/'+_0x148ced+'/files/'+_0x1ff466,'DELETE');return{'execute':async()=>{await _0x55f979['request'];},'abortController':_0x55f979['abortController']};}['deleteDocument'](_0x1d130f,_0x4c0175){const _0x21878c=this['_sendApiRequest']('/conversations/'+_0x1d130f+'/documents/'+_0x4c0175,'DELETE');return{'execute':async()=>{await _0x21878c['request'];},'abortController':_0x21878c['abortController']};}['deleteWebResource'](_0x5b1e07,_0x1c1f78){const _0x59a8ef=this['_sendApiRequest']('/conversations/'+_0x5b1e07+'/web-resources/'+_0x1c1f78,'DELETE');return{'execute':async()=>{await _0x59a8ef['request'];},'abortController':_0x59a8ef['abortController']};}['callSystemReview']({reviewName:_0x43b931,content:_0x30db77,args:_0x2b7bdb}){const _0x2b5a53=this['_sendApiRequest']('/reviews/system/'+_0x43b931+'/calls','POST',{'content':[{'type':'text','content':_0x30db77}],'args':_0x2b7bdb});return{'getStream':async()=>{const _0x1f2998=(await _0x2b5a53['request'])['body'];return this['_getStreamReader'](_0x1f2998);},'abortController':_0x2b5a53['abortController']};}['callCustomReview']({content:_0x4c4495,prompt:_0x145dda,model:_0xabafcb}){const _0x2f2e79=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x4c4495}],'prompt':_0x145dda,'model':_0xabafcb});return{'getStream':async()=>{const _0xa4b400=(await _0x2f2e79['request'])['body'];return this['_getStreamReader'](_0xa4b400);},'abortController':_0x2f2e79['abortController']};}['upsertAIChatRating'](_0x5508b4,_0x53d618,_0x5dca94){const _0x455796=this['_sendApiRequest']('/conversations/'+_0x5508b4+'/messages/'+_0x53d618+'/ratings','PUT',{'positiveCount':_0x5dca94['positiveCount'],'totalCount':_0x5dca94['totalCount'],'modificationId':_0x5dca94['modificationId']});return{'execute':async()=>{await _0x455796['request'];},'abortController':_0x455796['abortController']};}['upsertAIActionRating'](_0x3ea3f0,_0x50a3b7,_0x5257b6){const _0x2b74b7=this['_sendApiRequest']('/actions/system/'+_0x3ea3f0+'/calls/'+_0x50a3b7+'/ratings','PUT',{'positiveCount':_0x5257b6['positiveCount'],'totalCount':_0x5257b6['totalCount']});return{'execute':async()=>{await _0x2b74b7['request'];},'abortController':_0x2b74b7['abortController']};}['upsertCustomAIActionRating'](_0x497d66,_0x294193){const _0x3a8b78=this['_sendApiRequest']('/actions/custom/calls/'+_0x497d66+'/ratings','PUT',{'positiveCount':_0x294193['positiveCount'],'totalCount':_0x294193['totalCount']});return{'execute':async()=>{await _0x3a8b78['request'];},'abortController':_0x3a8b78['abortController']};}['upsertAIReviewRating'](_0x59f563,_0xbd092e,_0x32359c,_0x49777a){const _0x28ed7e=this['_sendApiRequest']('/reviews/system/'+_0x59f563+'/calls/'+_0xbd092e+'/ratings','PUT',{'positiveCount':_0x32359c['positiveCount'],'totalCount':_0x32359c['totalCount'],'dataId':_0x49777a});return{'execute':async()=>{await _0x28ed7e['request'];},'abortController':_0x28ed7e['abortController']};}['upsertCustomAIReviewRating'](_0x2838f7,_0x454c46,_0x62f4e2){const _0x5548fc=this['_sendApiRequest']('/reviews/custom/calls/'+_0x2838f7+'/ratings','PUT',{'positiveCount':_0x454c46['positiveCount'],'totalCount':_0x454c46['totalCount'],'dataId':_0x62f4e2});return{'execute':async()=>{await _0x5548fc['request'];},'abortController':_0x5548fc['abortController']};}['_sendApiRequest'](_0x111b3c,_0x559c33,_0xa5be32,_0x8db43e=!0x1){const _0x570473=new AbortController(),_0x2ec73a=_0x8db43e?_0x559c33+':'+_0x111b3c:null;if(_0x2ec73a){const _0x4353dc=this['_responseCache']['get'](_0x2ec73a);if(_0x4353dc)return{'request':_0x4353dc['then'](_0x4ea235=>_0x4ea235['clone']()),'abortController':_0x570473};}const _0x4259a2=_0xa5be32 instanceof FormData,_0xcd3cc4={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':pt};_0xa5be32&&!_0x4259a2&&(_0xcd3cc4['Content-Type']='application/json');const _0x42d466={'method':_0x559c33,'headers':_0xcd3cc4,'signal':_0x570473['signal']};_0xa5be32&&(_0x42d466['body']=_0x4259a2?_0xa5be32:JSON['stringify'](_0xa5be32));const _0x30bdbe=fetch(''+this['_apiUrl']+_0x111b3c,_0x42d466)['catch'](_0x213b56=>{_0x2ec73a&&this['_responseCache']['delete'](_0x2ec73a),this['_handleError'](_0x213b56);})['then'](_0x5f6da9=>_0x5f6da9['ok']?_0x5f6da9:_0x5f6da9['json']()['then'](_0x50971c=>{throw _0x2ec73a&&this['_responseCache']['delete'](_0x2ec73a),{'url':this['_apiUrl'],'path':_0x111b3c,'method':_0x559c33,'body':_0xa5be32,'status':(_0x5f6da9||{})['status'],'statusText':(_0x5f6da9||{})['statusText'],'code':_0x50971c['code'],'message':_0x50971c['message'],'traceId':_0x50971c['traceId']};}));return _0x2ec73a&&this['_responseCache']['set'](_0x2ec73a,_0x30bdbe['then'](_0x2e84bb=>_0x2e84bb['clone']())),{'request':_0x30bdbe,'abortController':_0x570473};}async*['_getStreamReader'](_0xc1b130){const _0xa26589=[],_0x5dbf4a=_0xc1b130['getReader'](),_0x1f4d20=_0x20eee3({'onError':_0x31b055=>{this['_handleError'](_0x31b055);},'onEvent':_0x142caa=>{_0x142caa['data']=JSON['parse'](_0x142caa['data']),_0xa26589['push'](_0x142caa);}});try{let _0x2563cb=!0x1;for(;!_0x2563cb;){const {done:_0x42bf4f,value:_0x5deb3c}=await _0x5dbf4a['read']();_0x42bf4f&&(_0x2563cb=!0x0),_0x1f4d20['feed'](this['_decoder']['decode'](_0x5deb3c,{'stream':!0x0})),yield*_0xa26589,_0xa26589['length']=0x0;}}catch(_0xe5287c){this['_handleError'](_0xe5287c);}finally{_0x5dbf4a['releaseLock'](),_0x1f4d20['reset']();}}['_handleError'](_0x561adc){if(_0x561adc instanceof at)throw _0x561adc;if(_0x561adc instanceof Error&&'AbortError'===_0x561adc['name'])throw new at('ai-request-aborted',this,{'originalError':_0x561adc});throw new at('ai-request-failed',this,{'originalError':_0x561adc});}}function Hi(_0x159053,_0x3e0c76,_0x1e20ec){const t=_0x159053['t'];switch(_0x3e0c76){case'AI_SUGGESTION_HEADER_TITLE':return t({'id':'AI_SUGGESTION_HEADER_TITLE','string':'Proposed\x20changes'});case'AI_SUGGESTION_BUTTON_SHOW_CHANGES':return t({'id':'AI_SUGGESTION_BUTTON_SHOW_CHANGES','string':'Show\x20details'});case'AI_MINI_TOOLBAR_LIKE':return t({'id':'AI_MINI_TOOLBAR_LIKE','string':'I\x20like\x20this\x20response'});case'AI_MINI_TOOLBAR_DISLIKE':return t({'id':'AI_MINI_TOOLBAR_DISLIKE','string':'I\x20don\x27t\x20like\x20this\x20response'});case'AI_MINI_TOOLBAR_COPY':return t({'id':'AI_MINI_TOOLBAR_COPY','string':'Copy\x20to\x20clipboard'});case'AI_SUGGESTION_CONTENT_PART_TITLE':return t({'id':'AI_SUGGESTION_CONTENT_PART_TITLE','string':'Change\x20%0'},_0x1e20ec);case'AI_SUGGESTION_CONTENT_PART_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECTED','string':'Change\x20was\x20rejected'});case'AI_SUGGESTION_CONTENT_PART_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_OUTDATED','string':'Change\x20is\x20outdated'});case'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED':return t({'id':'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED','string':'Change\x20is\x20already\x20applied'});case'AI_SUGGESTION_CONTENT_PART_APPLY':return t({'id':'AI_SUGGESTION_CONTENT_PART_APPLY','string':'Apply\x20change'});case'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION':return t({'id':'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION','string':'Add\x20as\x20suggestion'});case'AI_SUGGESTION_CONTENT_PART_REJECT':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECT','string':'Reject\x20change'});case'AI_SUGGESTION_CONTENT_PART_REMOVED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REMOVED','string':'Removed\x20content.\x20Use\x20\x22Show\x20details\x22\x20to\x20learn\x20more.'});case'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED','string':'Approved'});case'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED','string':'Rejected'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED','string':'Outdated'});case'AI_DISCLAIMER_TEXT':return t({'id':'AI_DISCLAIMER_TEXT','string':'AI\x20can\x20make\x20mistakes.\x20Please\x20double-check\x20responses.'});case'AI_TABS_LABEL_MAXIMIZE':return t({'id':'AI_TABS_LABEL_MAXIMIZE','string':'Maximize'});case'AI_TABS_LABEL_MINIMIZE':return t({'id':'AI_TABS_LABEL_MINIMIZE','string':'Minimize'});case'AI_CHAT_HEADING':return t({'id':'AI_CHAT_HEADING','string':'Chat'});case'AI_CHAT_SOURCES_HEADER':return t({'id':'AI_CHAT_SOURCES_HEADER','string':'Sources'});case'AI_CHAT_UNTITLED_CONVERSATION':return t({'id':'AI_CHAT_UNTITLED_CONVERSATION','string':'Untitled\x20conversation'});case'AI_CHAT_LABEL_NEW_CHAT':return t({'id':'AI_CHAT_LABEL_NEW_CHAT','string':'New\x20chat'});case'AI_CHAT_STOP_GENERATING':return t({'id':'AI_CHAT_STOP_GENERATING','string':'Stop\x20generating'});case'AI_CHAT_IS_WRITING':return t({'id':'AI_CHAT_IS_WRITING','string':'AI\x20is\x20writing...'});case'AI_CHAT_PROMPT_EMPTY_ERROR':return t({'id':'AI_CHAT_PROMPT_EMPTY_ERROR','string':'This\x20field\x20cannot\x20be\x20empty.'});case'AI_CHAT_LABEL_SUBMIT':return t({'id':'AI_CHAT_LABEL_SUBMIT','string':'Submit'});case'AI_CHAT_WELCOME_MESSAGE':return t({'id':'AI_CHAT_WELCOME_MESSAGE','string':'Hi!\x20I\x20can\x20help\x20you\x20draft,\x20rewrite,\x20and\x20improve\x20your\x20text,\x20explore\x20ideas,\x20research\x20topics,\x20and\x20solve\x20problems.\x20How\x20can\x20I\x20help\x20right\x20now?'});case'AI_CHAT_ABORTED_MESSAGE':return t({'id':'AI_CHAT_ABORTED_MESSAGE','string':'Response\x20stopped.'});case'AI_CHAT_GENERIC_ERROR':return t({'id':'AI_CHAT_GENERIC_ERROR','string':'Something\x20went\x20wrong\x20while\x20processing\x20your\x20request.\x20Please\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_START_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_START_CONVERSATION','string':'Unable\x20to\x20start\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION','string':'Unable\x20to\x20load\x20chosen\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE','string':'Failed\x20to\x20upload\x20files:\x20%0.\x20Please\x20try\x20again.'},_0x1e20ec);case'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES','string':'Unable\x20to\x20load\x20resources\x20from\x20%0.\x20Please\x20try\x20again.'},_0x1e20ec);case'AI_CHAT_RESOURCE_LOAD_FAILED':return t({'id':'AI_CHAT_RESOURCE_LOAD_FAILED','string':'Failed\x20to\x20load\x20resource.\x20Please\x20try\x20again.'});case'AI_CHAT_CONTEXT_CURRENT_DOCUMENT':return t({'id':'AI_CHAT_CONTEXT_CURRENT_DOCUMENT','string':'Current\x20document'});case'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT','string':'Remove\x20from\x20context'});case'AI_CHAT_CONTEXT_ADD_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_ADD_CONTEXT','string':'Add\x20context'});case'AI_CHAT_CONTEXT_URL_LABEL':return t({'id':'AI_CHAT_CONTEXT_URL_LABEL','string':'URL'});case'AI_CHAT_CONTEXT_FILE_LABEL':return t({'id':'AI_CHAT_CONTEXT_FILE_LABEL','string':'File'});case'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL':return t({'id':'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL','string':'Current\x20context'});case'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL':return t({'id':'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL','string':'Selected\x20content'});case'AI_CHAT_SEARCH_WEB':return t({'id':'AI_CHAT_SEARCH_WEB','string':'Web\x20search'});case'AI_CHAT_ENABLE_WEB_SEARCH':return t({'id':'AI_CHAT_ENABLE_WEB_SEARCH','string':'Enable\x20web\x20search'});case'AI_CHAT_DISABLE_WEB_SEARCH':return t({'id':'AI_CHAT_DISABLE_WEB_SEARCH','string':'Disable\x20web\x20search'});case'AI_CHAT_REASONING':return t({'id':'AI_CHAT_REASONING','string':'Reasoning'});case'AI_CHAT_ENABLE_REASONING':return t({'id':'AI_CHAT_ENABLE_REASONING','string':'Enable\x20reasoning'});case'AI_CHAT_DISABLE_REASONING':return t({'id':'AI_CHAT_DISABLE_REASONING','string':'Disable\x20reasoning'});case'AI_CHAT_COMMANDS':return t({'id':'AI_CHAT_COMMANDS','string':'Commands'});case'AI_CHAT_SEARCH_RESOURCES':return t({'id':'AI_CHAT_SEARCH_RESOURCES','string':'Search\x20resources'});case'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT','string':'Back\x20to\x20context\x20options'});case'AI_CHAT_CONTEXT_URL_ADD_URL':return t({'id':'AI_CHAT_CONTEXT_URL_ADD_URL','string':'Add\x20URL'});case'AI_CHAT_CONTEXT_URL_PLACEHOLDER':return t({'id':'AI_CHAT_CONTEXT_URL_PLACEHOLDER','string':'Add\x20URL...'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL','string':'Failed\x20to\x20upload\x20URL:\x20%0.\x20Please\x20try\x20again.'},_0x1e20ec);case'AI_CHAT_CONTEXT_INVALID_DATA':return t({'id':'AI_CHAT_CONTEXT_INVALID_DATA','string':'Invalid\x20context\x20data\x20type\x20for\x20the\x20selected\x20resource.'});case'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE':return t({'id':'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE','string':'Unsupported\x20resource\x20type.\x20Only\x20files\x20and\x20URLs\x20are\x20supported.'});case'AI_CHAT_CONTEXT_URL_EMPTY_ERROR':return t({'id':'AI_CHAT_CONTEXT_URL_EMPTY_ERROR','string':'URL\x20cannot\x20be\x20empty.'});case'AI_CHAT_CONTEXT_URL_INVALID_ERROR':return t({'id':'AI_CHAT_CONTEXT_URL_INVALID_ERROR','string':'Please\x20enter\x20a\x20valid\x20URL.'});case'AI_CHAT_INVALID_REQUEST':return t({'id':'AI_CHAT_INVALID_REQUEST','string':'Something\x20went\x20wrong\x20while\x20processing\x20your\x20request.\x20Please\x20try\x20again.'});case'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE':return t({'id':'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE','string':'The\x20file\x20type\x20is\x20not\x20supported.\x20Please\x20upload\x20a\x20different\x20file.'});case'AI_CHAT_CONTEXT_FILE_TOO_LARGE':return t({'id':'AI_CHAT_CONTEXT_FILE_TOO_LARGE','string':'The\x20file\x20is\x20too\x20large.\x20Please\x20upload\x20a\x20smaller\x20file.'});case'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES':return t({'id':'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES','string':'The\x20file\x20has\x20too\x20many\x20pages.\x20Please\x20upload\x20a\x20file\x20with\x20fewer\x20pages.'});case'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED':return t({'id':'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED','string':'The\x20form\x20data\x20size\x20limits\x20are\x20exceeded.\x20Please\x20upload\x20a\x20smaller\x20file.'});case'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR','string':'AI\x20is\x20preparing\x20a\x20response...'});case'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH','string':'AI\x20is\x20searching\x20the\x20web\x20to\x20provide\x20the\x20most\x20accurate\x20answer...'});case'AI_CHAT_FEED_LOADING_MESSAGE_REASONING':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_REASONING','string':'AI\x20is\x20using\x20reasoning\x20to\x20provide\x20the\x20most\x20accurate\x20answer...'});case'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING','string':'AI\x20is\x20using\x20reasoning\x20and\x20searching\x20the\x20web\x20to\x20provide\x20the\x20most\x20accurate\x20answer...'});case'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH':return t({'id':'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH','string':'Scanned\x20the\x20internet\x20for\x20insights'});case'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING':return t({'id':'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING','string':'AI\x20used\x20reasoning\x20to\x20improve\x20the\x20response'});case'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING':return t({'id':'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING','string':'AI\x20used\x20search\x20and\x20reasoning\x20to\x20improve\x20the\x20response'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR','string':'Ask\x20AI\x20anything...'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH','string':'Ask\x20AI\x20anything\x20(web\x20search\x20enabled)...'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING','string':'Ask\x20AI\x20anything\x20(reasoning\x20enabled)...'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING','string':'Ask\x20AI\x20anything\x20(web\x20search\x20and\x20reasoning\x20enabled)...'});case'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL','string':'Suggest\x20all'},_0x1e20ec);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x1e20ec);case'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL':return t({'id':'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL','string':'Apply\x20all'});case'AI_CHAT_SUGGESTION_ACTION_APPLY':return t({'id':'AI_CHAT_SUGGESTION_ACTION_APPLY','string':'Apply'});case'AI_CHAT_SUGGESTION_MORE_OPTIONS_TOOLTIP':return t({'id':'AI_CHAT_SUGGESTION_MORE_OPTIONS_TOOLTIP','string':'More\x20options'},_0x1e20ec);case'AI_CHAT_MODEL_SELECTOR_GROUP':return t({'id':'AI_CHAT_MODEL_SELECTOR_GROUP','string':'Models'});case'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP':return t({'id':'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP','string':'Select\x20a\x20model'});case'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP':return t({'id':'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP','string':'Start\x20a\x20new\x20conversation\x20to\x20change\x20the\x20model'});case'AI_CHAT_CAPABILITIES_YES':return t({'id':'AI_CHAT_CAPABILITIES_YES','string':'Yes'});case'AI_CHAT_CAPABILITIES_NO':return t({'id':'AI_CHAT_CAPABILITIES_NO','string':'No'});case'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT':return t({'id':'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT','string':'The\x20selected\x20model\x20is\x20no\x20longer\x20available,\x20so\x20you\x20cannot\x20continue\x20this\x20conversation.\x20Please\x20'});case'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON':return t({'id':'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON','string':'start\x20a\x20new\x20one.'});case'AI_CHAT_CONTEXT_SOURCES_LABEL':return t({'id':'AI_CHAT_CONTEXT_SOURCES_LABEL','string':'Sources'});case'AI_CHAT_HISTORY_HEADING':return t({'id':'AI_CHAT_HISTORY_HEADING','string':'Chat\x20History'});case'AI_CHAT_HISTORY_SEARCH_LABEL':return t({'id':'AI_CHAT_HISTORY_SEARCH_LABEL','string':'Search\x20history'});case'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY':return t({'id':'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY','string':'No\x20chats\x20were\x20found\x20matching\x20\x22%0\x22.'},_0x1e20ec);case'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY':return t({'id':'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY','string':'Please\x20try\x20a\x20different\x20phrase\x20or\x20check\x20the\x20spelling.'});case'AI_CHAT_HISTORY_EMPTY_MESSAGE':return t({'id':'AI_CHAT_HISTORY_EMPTY_MESSAGE','string':'Your\x20chat\x20history\x20for\x20current\x20document\x20will\x20appear\x20here.'});case'AI_CHAT_HISTORY_GO_TO_CHAT_BUTTON':return t({'id':'AI_CHAT_HISTORY_GO_TO_CHAT_BUTTON','string':'Go\x20to\x20chat'});case'AI_CHAT_HISTORY_PIN_BUTTON':return t({'id':'AI_CHAT_HISTORY_PIN_BUTTON','string':'Pin'});case'AI_CHAT_HISTORY_SHOW_MORE_ITEMS':return t({'id':'AI_CHAT_HISTORY_SHOW_MORE_ITEMS','string':'Show\x20more\x20items'});case'AI_CHAT_HISTORY_EDIT_NAME':return t({'id':'AI_CHAT_HISTORY_EDIT_NAME','string':'Edit\x20name'});case'AI_CHAT_HISTORY_REMOVE':return t({'id':'AI_CHAT_HISTORY_REMOVE','string':'Remove'});case'AI_CHAT_HISTORY_REMOVE_CONFIRM':return t({'id':'AI_CHAT_HISTORY_REMOVE_CONFIRM','string':'Do\x20you\x20want\x20to\x20remove\x20this\x20chat?'});case'AI_CHAT_HISTORY_ACCEPT':return t({'id':'AI_CHAT_HISTORY_ACCEPT','string':'Accept'});case'AI_CHAT_HISTORY_CANCEL':return t({'id':'AI_CHAT_HISTORY_CANCEL','string':'Cancel'});case'AI_CHAT_HISTORY_LOADING_REMOVING':return t({'id':'AI_CHAT_HISTORY_LOADING_REMOVING','string':'Removing\x20the\x20chat...'});case'AI_CHAT_HISTORY_LOADING_RENAMING':return t({'id':'AI_CHAT_HISTORY_LOADING_RENAMING','string':'Renaming\x20the\x20chat...'});case'AI_CHAT_HISTORY_LOADING_PINNING':return t({'id':'AI_CHAT_HISTORY_LOADING_PINNING','string':'Pinning\x20the\x20chat...'});case'AI_CHAT_HISTORY_LOADING_UNPINNING':return t({'id':'AI_CHAT_HISTORY_LOADING_UNPINNING','string':'Unpinning\x20the\x20chat...'});case'AI_CHAT_HISTORY_CATEGORY_PINNED':return t({'id':'AI_CHAT_HISTORY_CATEGORY_PINNED','string':'Pinned'});case'AI_CHAT_HISTORY_CATEGORY_TODAY':return t({'id':'AI_CHAT_HISTORY_CATEGORY_TODAY','string':'Today'});case'AI_CHAT_HISTORY_CATEGORY_YESTERDAY':return t({'id':'AI_CHAT_HISTORY_CATEGORY_YESTERDAY','string':'Yesterday'});case'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS':return t({'id':'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS','string':'Last\x2014\x20days'});case'AI_CHAT_HISTORY_CATEGORY_LATER':return t({'id':'AI_CHAT_HISTORY_CATEGORY_LATER','string':'Later'});case'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE':return t({'id':'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE','string':'Failed\x20to\x20change\x20the\x20\x22%0\x22\x20chat\x20name.\x20Please\x20try\x20again\x20later.'},_0x1e20ec);case'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED':return t({'id':'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED','string':'Failed\x20to\x20%0\x20the\x20\x22%1\x22\x20chat.\x20Please\x20try\x20again\x20later.'},_0x1e20ec);case'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM':return t({'id':'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM','string':'Failed\x20to\x20delete\x20the\x20\x22%0\x22\x20chat.\x20Please\x20try\x20again\x20later.'},_0x1e20ec);case'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS':return t({'id':'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS','string':'Failed\x20to\x20load\x20the\x20chat\x20history.\x20Please\x20try\x20again\x20later.'});case'AI_CHAT_HISTORY_ERROR_GENERIC':return t({'id':'AI_CHAT_HISTORY_ERROR_GENERIC','string':'Something\x20went\x20wrong.\x20Please\x20try\x20again\x20later.'});case'AI_CHAT_HISTORY_PIN_ACTION':return t({'id':'AI_CHAT_HISTORY_PIN_ACTION','string':'pin'});case'AI_CHAT_HISTORY_UNPIN_ACTION':return t({'id':'AI_CHAT_HISTORY_UNPIN_ACTION','string':'unpin'});case'AI_BALLOON_HEADER_TITLE':return t({'id':'AI_BALLOON_HEADER_TITLE','string':'Change\x20%0'},_0x1e20ec);case'AI_BALLOON_APPLY_BUTTON':return t({'id':'AI_BALLOON_APPLY_BUTTON','string':'Apply'});case'AI_BALLOON_SUGGEST_BUTTON':return t({'id':'AI_BALLOON_SUGGEST_BUTTON','string':'Suggest'});case'AI_BALLOON_NEXT_LABEL':return t({'id':'AI_BALLOON_NEXT_LABEL','string':'Next'});case'AI_BALLOON_PREVIOUS_LABEL':return t({'id':'AI_BALLOON_PREVIOUS_LABEL','string':'Previous'});case'AI_SUGGESTION_NO_PARTS_WARNING':return t({'id':'AI_SUGGESTION_NO_PARTS_WARNING','string':'This\x20change\x20is\x20not\x20supported\x20by\x20the\x20editor\x20and\x20can\x27t\x20be\x20previewed\x20or\x20applied.'});case'AI_SUGGESTION_EMPTY_PART_WARNING':return t({'id':'AI_SUGGESTION_EMPTY_PART_WARNING','string':'Some\x20of\x20the\x20changes\x20are\x20not\x20supported\x20by\x20the\x20editor\x20and\x20can\x27t\x20be\x20previewed\x20or\x20applied.'});case'AI_ACTIONS_TRY_AGAIN':return t({'id':'AI_ACTIONS_TRY_AGAIN','string':'Retry'});case'AI_ACTIONS_PREVIOUS_INTERACTION':return t({'id':'AI_ACTIONS_PREVIOUS_INTERACTION','string':'Previous'});case'AI_ACTIONS_NEXT_INTERACTION':return t({'id':'AI_ACTIONS_NEXT_INTERACTION','string':'Next'});case'AI_MODEL_NAME_AUTO':return t({'id':'AI_MODEL_NAME_AUTO','string':'Auto'});case'AI_QUICK_ACTIONS_HEADING':return t({'id':'AI_QUICK_ACTIONS_HEADING','string':'AI\x20Quick\x20Actions'});case'AI_QUICK_ACTIONS_SEARCH':return t({'id':'AI_QUICK_ACTIONS_SEARCH','string':'Search\x20AI\x20commands'});case'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND':return t({'id':'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND','string':'No\x20AI\x20commands\x20found'});case'AI_QUICK_ACTIONS_ASK_AI':return t({'id':'AI_QUICK_ACTIONS_ASK_AI','string':'Ask\x20AI'});case'AI_QUICK_ACTIONS_CHAT_COMMANDS':return t({'id':'AI_QUICK_ACTIONS_CHAT_COMMANDS','string':'Chat\x20commands'});case'AI_QUICK_ACTIONS_IMPROVE_WRITING':return t({'id':'AI_QUICK_ACTIONS_IMPROVE_WRITING','string':'Improve\x20writing'});case'AI_QUICK_ACTIONS_CONTINUE_WRITING':return t({'id':'AI_QUICK_ACTIONS_CONTINUE_WRITING','string':'Continue\x20writing'});case'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING':return t({'id':'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING','string':'Fix\x20grammar\x20&\x20spelling'});case'AI_QUICK_ACTIONS_ADJUST_LENGTH':return t({'id':'AI_QUICK_ACTIONS_ADJUST_LENGTH','string':'Adjust\x20length'});case'AI_QUICK_ACTIONS_CHANGE_TONE':return t({'id':'AI_QUICK_ACTIONS_CHANGE_TONE','string':'Change\x20tone'});case'AI_QUICK_ACTIONS_TRANSLATE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE','string':'Translate'});case'AI_QUICK_ACTIONS_EXPLAIN':return t({'id':'AI_QUICK_ACTIONS_EXPLAIN','string':'Explain'});case'AI_QUICK_ACTIONS_SUMMARIZE':return t({'id':'AI_QUICK_ACTIONS_SUMMARIZE','string':'Summarize'});case'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS':return t({'id':'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS','string':'Highlight\x20key\x20points'});case'AI_QUICK_ACTIONS_MAKE_SHORTER':return t({'id':'AI_QUICK_ACTIONS_MAKE_SHORTER','string':'Make\x20shorter'});case'AI_QUICK_ACTIONS_MAKE_LONGER':return t({'id':'AI_QUICK_ACTIONS_MAKE_LONGER','string':'Make\x20longer'});case'AI_QUICK_ACTIONS_MORE_CASUAL':return t({'id':'AI_QUICK_ACTIONS_MORE_CASUAL','string':'More\x20casual'});case'AI_QUICK_ACTIONS_MORE_DIRECT':return t({'id':'AI_QUICK_ACTIONS_MORE_DIRECT','string':'More\x20direct'});case'AI_QUICK_ACTIONS_MORE_FRIENDLY':return t({'id':'AI_QUICK_ACTIONS_MORE_FRIENDLY','string':'More\x20friendly'});case'AI_QUICK_ACTIONS_MORE_CONFIDENT':return t({'id':'AI_QUICK_ACTIONS_MORE_CONFIDENT','string':'More\x20confident'});case'AI_QUICK_ACTIONS_MORE_PROFESSIONAL':return t({'id':'AI_QUICK_ACTIONS_MORE_PROFESSIONAL','string':'More\x20professional'});case'AI_QUICK_ACTIONS_ADJUST_BASED_ON_DOCUMENT':return t({'id':'AI_QUICK_ACTIONS_ADJUST_BASED_ON_DOCUMENT','string':'Adjust\x20based\x20on\x20the\x20rest\x20of\x20the\x20document'});case'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH','string':'English'});case'AI_QUICK_ACTIONS_TRANSLATE_CHINESE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_CHINESE','string':'Chinese\x20(Simplified)'});case'AI_QUICK_ACTIONS_TRANSLATE_FRENCH':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_FRENCH','string':'French'});case'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE','string':'Japanese'});case'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE','string':'Portuguese'});case'AI_QUICK_ACTIONS_TRANSLATE_KOREAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_KOREAN','string':'Korean'});case'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN','string':'Italian'});case'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN','string':'Russian'});case'AI_QUICK_ACTIONS_TRANSLATE_SPANISH':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_SPANISH','string':'Spanish'});case'AI_QUICK_ACTIONS_TRANSLATE_GERMAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_GERMAN','string':'German'});case'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND':return t({'id':'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','string':'%0\x20plugin\x20is\x20required\x20but\x20not\x20found.'},_0x1e20ec);case'AI_QUICK_ACTIONS_OTHER':return t({'id':'AI_QUICK_ACTIONS_OTHER','string':'Other'});case'AI_ACTIONS_GENERIC_ERROR':return t({'id':'AI_ACTIONS_GENERIC_ERROR','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20response.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_BALLOON_SELECTION_REMOVED_ERROR':return t({'id':'AI_BALLOON_SELECTION_REMOVED_ERROR','string':'Changes\x20cannot\x20be\x20applied.\x20The\x20original\x20content\x20no\x20longer\x20exists.'});case'AI_REVIEW_MODE_STOP_GENERATING':return t({'id':'AI_REVIEW_MODE_STOP_GENERATING','string':'Stop\x20generating'});case'AI_REVIEW_MODE_HIDE_CHANGES':return t({'id':'AI_REVIEW_MODE_HIDE_CHANGES','string':'Hide\x20changes'});case'AI_REVIEW_MODE_SHOW_CHANGES':return t({'id':'AI_REVIEW_MODE_SHOW_CHANGES','string':'Show\x20changes'});case'AI_REVIEW_MODE_ACCEPT_ALL':return t({'id':'AI_REVIEW_MODE_ACCEPT_ALL','string':'Accept\x20all'});case'AI_REVIEW_MODE_EXIT_REVIEW':return t({'id':'AI_REVIEW_MODE_EXIT_REVIEW','string':'Exit\x20review'});case'AI_REVIEW_MODE_ACCEPT_CHANGE':return t({'id':'AI_REVIEW_MODE_ACCEPT_CHANGE','string':'Accept'});case'AI_REVIEW_MODE_DISMISS_CHANGE':return t({'id':'AI_REVIEW_MODE_DISMISS_CHANGE','string':'Dismiss'});case'AI_REVIEW_MODE_LEARN_MORE':return t({'id':'AI_REVIEW_MODE_LEARN_MORE','string':'Learn\x20more'});case'AI_REVIEW_MODE_COMPLETED_TEXT':return t({'id':'AI_REVIEW_MODE_COMPLETED_TEXT','string':'There\x27s\x20nothing\x20left\x20to\x20review.'});case'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT':return t({'id':'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20changes\x20to\x20suggest.'});case'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL','string':'Finish\x20Review'});case'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE','string':'Review\x20complete.\x20Finish\x20when\x20ready.'});case'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE':return t({'id':'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE','string':'AI\x20Review\x20initialized\x20with\x20errors.\x20Some\x20features\x20may\x20not\x20be\x20available\x20or\x20work\x20properly.'});case'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20whole\x20review\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE','string':'Not\x20everything\x20went\x20through,\x20but\x20the\x20completed\x20items\x20are\x20listed\x20below.'});case'AI_REVIEW_MODE':return t({'id':'AI_REVIEW_MODE','string':'Review'});case'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR':return t({'id':'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR','string':'Prompt\x20must\x20not\x20be\x20empty'});case'AI_REVIEW_CHECK_CUSTOM_TITLE':return t({'id':'AI_REVIEW_CHECK_CUSTOM_TITLE','string':'Custom\x20command'});case'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION','string':'Enter\x20a\x20custom\x20command\x20for\x20a\x20specific\x20review.'});case'AI_REVIEW_CHECK_CORRECTNESS_TITLE':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_TITLE','string':'Proofread'});case'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION','string':'Check\x20the\x20text\x20for\x20errors\x20in\x20grammar,\x20spelling,\x20and\x20punctuation.'});case'AI_REVIEW_CHECK_CLARITY_TITLE':return t({'id':'AI_REVIEW_CHECK_CLARITY_TITLE','string':'Improve\x20clarity'});case'AI_REVIEW_CHECK_CLARITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CLARITY_DESCRIPTION','string':'Improve\x20the\x20logical\x20structure\x20and\x20precision\x20for\x20clearer\x20message.'});case'AI_REVIEW_CHECK_READABILITY_TITLE':return t({'id':'AI_REVIEW_CHECK_READABILITY_TITLE','string':'Improve\x20readability'});case'AI_REVIEW_CHECK_READABILITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_READABILITY_DESCRIPTION','string':'Adjust\x20sentence\x20structure\x20and\x20word\x20choice\x20for\x20an\x20easier\x20read.'});case'AI_REVIEW_CHECK_MAKE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TITLE','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_DESCRIPTION','string':'Shorten\x20or\x20lengthen\x20the\x20text\x20as\x20needed.'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER','string':'Longer'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER','string':'Shorter'});case'AI_REVIEW_CHECK_MAKE_TONE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_TITLE','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION','string':'Modify\x20the\x20text\x20to\x20a\x20desired\x20tone\x20and\x20style.'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL','string':'Casual'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT','string':'Direct'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY','string':'Friendly'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT','string':'Confident'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL','string':'Professional'});case'AI_REVIEW_CHECK_TRANSLATE_TITLE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_TITLE','string':'Translate'});case'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION','string':'Translate\x20the\x20text\x20into\x20another\x20language.'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL','string':'Select\x20language'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH','string':'English'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH','string':'Spanish'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH','string':'French'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN','string':'German'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE','string':'Chinese\x20(Simplified)'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE','string':'Japanese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN','string':'Russian'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE','string':'Portuguese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN','string':'Korean'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN','string':'Italian'});case'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED','string':'Accepted'});case'AI_REVIEW_MODE_CHECK_STATUS_REJECTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_REJECTED','string':'Dismissed'});case'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED','string':'Outdated'});case'AI_TOGGLE_BUTTON_LABEL':return t({'id':'AI_TOGGLE_BUTTON_LABEL','string':'AI'});case'AI_TRANSLATE_ACCEPT_ALL':return t({'id':'AI_TRANSLATE_ACCEPT_ALL','string':'Accept\x20translation'});case'AI_TRANSLATE_FINISH_HEADER_TITLE':return t({'id':'AI_TRANSLATE_FINISH_HEADER_TITLE','string':'Translation\x20complete.\x20Finish\x20when\x20ready.'});case'AI_TRANSLATE_EMPTY_RESULTS_TEXT':return t({'id':'AI_TRANSLATE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20translations\x20to\x20review.'});case'AI_TRANSLATE_FINISH_BUTTON_LABEL':return t({'id':'AI_TRANSLATE_FINISH_BUTTON_LABEL','string':'Finish\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE','string':'Content\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION','string':'A\x20dedicated\x20mode\x20for\x20translating\x20the\x20entire\x20text.'});case'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE','string':'Translating\x20to'});case'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE','string':'Translated\x20to'});case'AI_TRANSLATE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_TRANSLATE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20translations\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE','string':'This\x20conversation\x20is\x20loaded\x20from\x20chat\x20history\x20from\x20a\x20previous\x20session,\x20so\x20you\x20can’t\x20apply,\x20reject,\x20or\x20suggest\x20changes.'});case'AI_SUGGESTION_DISABLED_FEED_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_FEED_MESSAGE','string':'Actions\x20aren’t\x20available\x20for\x20changes\x20from\x20a\x20previous\x20session.'});default:return _0x3e0c76;}}const Mi='ck-ai-button-primary',Ui='ck-ai-button-secondary',Bi='ck-ai-button-tertiary';function Gi(_0x8e482a,_0x1d1023){const _0x25669a=new vt(_0x8e482a),_0x22f184=Hi(_0x8e482a,'AI_TABS_LABEL_MINIMIZE'),_0x21b5a5=Hi(_0x8e482a,'AI_TABS_LABEL_MAXIMIZE');return _0x25669a['set']({'withText':!0x1,'icon':_0x20bed3,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+Bi}),_0x25669a['bind']('label')['to'](_0x1d1023,'isMaximized',_0x3a31fc=>_0x3a31fc?_0x22f184:_0x21b5a5),_0x25669a['bind']('icon')['to'](_0x1d1023,'isMaximized',_0x1a5744=>_0x1a5744?_0x1a42a3:_0x20bed3),_0x25669a['bind']('isOn')['to'](_0x1d1023,'isMaximized'),_0x25669a['on']('execute',()=>{_0x1d1023['fire']('resizeTabs');}),_0x25669a;}function Fi(_0x3a3525){return _0x46c6b0(_0x3a3525);}function Ki(_0xc36be8){return ti(_0xc36be8);}function Wi(_0x5c8190,_0x1a0868,_0x2d170c){const _0x3e3c55=null!==_0x1a0868?_0x2ded25=>_0x2ded25['attribs'][_0x5c8190]===_0x1a0868:_0x11fc0e=>Boolean(_0x11fc0e['attribs'][_0x5c8190]);return _0x173efb(_0x5d7272=>_0x25dece(_0x5d7272)&&_0x3e3c55(_0x5d7272),_0x2d170c);}function Yi(_0x203bc4,_0x37d9d1,_0x4b5d47){const _0x4226ae=null!==_0x37d9d1?_0x55d435=>_0x55d435['attribs'][_0x203bc4]===_0x37d9d1:_0x5cc8c9=>Boolean(_0x5cc8c9['attribs'][_0x203bc4]);return _0x26b2bc(_0x380d96=>_0x25dece(_0x380d96)&&_0x4226ae(_0x380d96),_0x4b5d47);}function $i(_0x5db6be,_0xc8f330){return _0x5db6be&&_0x25dece(_0x5db6be)?_0x5db6be['attribs'][_0xc8f330]:null;}function qi(_0xd344d,_0x4930c0,_0xf46d19){_0x25dece(_0xd344d)&&(null===_0xf46d19?delete _0xd344d['attribs'][_0x4930c0]:_0xd344d['attribs'][_0x4930c0]=_0xf46d19);}function Qi(_0x1cf519,_0x330665,_0x53b846){const _0x20defe=_0x330665['cloneNode'](!0x0);'beforebegin'===_0x53b846?_0x513713(_0x1cf519,_0x20defe):'afterbegin'===_0x53b846?_0x2b9809(_0x1cf519,_0x20defe):'beforeend'===_0x53b846?_0x260865(_0x1cf519,_0x20defe):'afterend'===_0x53b846&&_0x2a254f(_0x1cf519,_0x20defe);}function Xi(_0x523c3e){const _0x1b6f8f=[];let _0x56520b=_0x523c3e;for(;_0x56520b;)_0x56520b=_0x54bb93(_0x56520b),_0x56520b&&_0x1b6f8f['push'](_0x56520b);return _0x1b6f8f;}function zi(_0x3daa54){return _0x3daa54['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function ji(_0x55d259){let _0x1ecb6a=0x0;for(;_0x55d259['parentNode'];)_0x55d259=_0x55d259['parentNode'],_0x1ecb6a++;return _0x1ecb6a;}function Ji(_0x41b71e){const _0x291122=[];let _0x138fdc=_0x41b71e['nextSibling'];for(;_0x138fdc;)_0x291122['push'](_0x138fdc),_0x138fdc=_0x138fdc['nextSibling'];_0x291122['forEach'](_0x2a78d4=>{_0x3ac3c4(_0x2a78d4);});}class AIResponseParser extends/* #__PURE__ -- @preserve */
25
+ ht(){['_m2html'];constructor(){super();const _0x5a1459=Object['entries'](_0x1163dc),_0x42478f=_0x5a1459['findIndex'](([_0x559d7b])=>'rehypeDomRaw'===_0x559d7b);if(-0x1===_0x42478f)throw new at('ai-response-parser-unable-to-set-up-parser');_0x5a1459['splice'](_0x42478f+0x1,0x0,['rehypeSanitize',_0x53a40c]),this['_m2html']=new _0x1db452({'plugins':Object['fromEntries'](_0x5a1459)});}['convertMarkdownToHTML'](_0x2fc075){const _0x452432=this['_m2html']['parse'](_0x2fc075);return this['parseAndNormalizeHTML'](_0x452432);}['parseAndNormalizeHTML'](_0x556c9e){return this['_parseHTML'](_0x556c9e);}['_parseHTML'](_0x34cd02){const _0x2be580=Fi('<dummy>'+_0x34cd02['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/<[^>]*?$/g,'')+'</dummy>');return _0x2be580['children']=_0x2be580['children'][0x0]['children'],_0x2be580;}}class AIResponseApplier extends/* #__PURE__ -- @preserve */
26
+ ht(){['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null};['_existingDataIds']=new Set();constructor(_0x5accca){super(),this['_generateUid']=_0x5accca||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x4f2dbf,_0x111d09,_0x45e98d){this['_uidCounter']=0x0;const _0xd99f9f=_0x4f2dbf['cloneNode'](!0x0),_0xa3b46c=_0xd99f9f['childNodes'],_0x4ec0e2=Array['from'](_0xa3b46c)['filter'](_0x5df5bb=>!(0x3===_0x5df5bb['nodeType']&&''===Ki(_0x5df5bb)['trim']())),_0x20c928=_0x4ec0e2['length'],_0x2deec6=new Map();for(const _0x384d7b of _0x4ec0e2)_0x384d7b&&_0x25dece(_0x384d7b)&&void 0x0===_0x384d7b['attribs']['data-id']&&qi(_0x384d7b,'data-id','new-element');if(0x0===_0x111d09['childNodes']['length']){const _0x58c20d=[];return Yi('data-id','new-element',_0xd99f9f)['forEach'](_0xbd293c=>{const _0x12efae=this['_generateUid']();qi(_0xbd293c,'data-id',_0x12efae),_0x58c20d['push'](_0x12efae);}),this['_removeSpecialComments'](_0xd99f9f),{'parsedContent':_0xd99f9f,'newNodeIds':_0x58c20d,'modifiedNodeIds':[],'removedNodeIds':[],'newAnchorIds':_0x2deec6};}_0x45e98d&&_0x45e98d['markUnstableElements']&&this['_markLastTagElementUnstable'](_0xd99f9f),this['_touchedNodesState']['newIds']=[],this['_touchedNodesState']['modifiedIds']=[],this['_touchedNodesState']['removedIds']=[],this['_touchedNodesState']['invalidIds']=[],this['_touchedNodesState']['lastTouchedId']=null,this['_existingDataIds']=new Set(Yi('data-id',null,_0x111d09)['map'](_0x6c809a=>$i(_0x6c809a,'data-id'))['filter'](_0x563e1c=>!!_0x563e1c));let _0xa6f114=-0x1,_0x58b0f2=!0x1;for(let _0x39b539=0x0;_0x39b539<_0x20c928;_0x39b539++){const _0x59c08a=_0x4ec0e2[_0x39b539],_0x33947c=_0x4ec0e2[_0x39b539+0x1];if(this['_isNewNode'](_0x59c08a)){if(-0x1===_0xa6f114&&(_0xa6f114=_0x39b539),this['_markWrappedElements'](_0x59c08a),!this['_isNewNode'](_0x33947c)){const [_0x33ec4f,_0x94aa34]=this['_findReferenceNode'](_0x59c08a,_0x58b0f2,_0x111d09);if(_0x33ec4f){const _0x1756a2=Array['from'](_0x4ec0e2)['slice'](_0xa6f114,_0x39b539+0x1),_0x17db00=$i(_0x33ec4f,'data-id');if(this['_insertNodes'](_0x33ec4f,_0x1756a2,_0x94aa34),_0x17db00)for(const _0x3e4e4c of _0x1756a2){const _0x4d7091=$i(_0x3e4e4c,'data-id');_0x4d7091&&_0x2deec6['set'](_0x4d7091,_0x17db00);}_0xa6f114=-0x1;}}}else{if(this['_isExistingContentComment'](_0x59c08a))_0x58b0f2=!0x0;else{if(this['_isExistingNode'](_0x59c08a)){const _0x50398f=$i(_0x59c08a,'data-id');if(_0x50398f&&this['_existingDataIds']['has'](_0x50398f)){const _0x47999d=Wi('data-id',_0x50398f,_0x111d09);this['_replaceNode'](_0x47999d,_0x59c08a);}}else{if(this['_isDelNode'](_0x59c08a)){const _0x34ef22=this['_getNodeDataId'](_0x59c08a);!!Wi('data-id',_0x34ef22,_0xd99f9f)||this['_touchedNodesState']['removedIds']['push'](_0x34ef22);}}}}}for(const _0x20998e of this['_touchedNodesState']['removedIds']){const _0x10a2df=Wi('data-id',_0x20998e,_0x111d09);_0x10a2df&&this['_removeNode'](_0x10a2df,_0x20998e,_0x45e98d);}if(Yi('data-id','new-element',_0x111d09)['forEach'](_0x3bb10e=>{const _0x5ee890=this['_getUid'](_0x3bb10e);qi(_0x3bb10e,'data-id',_0x5ee890),this['_touchedNodesState']['newIds']['push'](_0x5ee890);}),this['_removeSpecialComments'](_0x111d09),_0x45e98d&&_0x45e98d['markUnstableElements']&&this['_markUnstableElements'](_0x111d09,_0x45e98d['markUnstableElementsDepth']||0x0),this['_processWrappedElements'](_0x111d09,_0x45e98d),_0x45e98d&&_0x45e98d['cutAfterLastChange']&&this['_touchedNodesState']['lastTouchedId']){const _0x54b178=Yi('data-id',this['_touchedNodesState']['lastTouchedId'],_0x111d09);let _0xefa51=_0x54b178[_0x54b178['length']-0x1];for(;_0xefa51;)Ji(_0xefa51),_0xefa51=_0xefa51['parentNode'];}return{'parsedContent':_0x111d09,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds'],'newAnchorIds':_0x2deec6};}['_insertNodes'](_0x2efce5,_0x2ca472,_0x10a92f){for(const _0x357754 of _0x2ca472){const _0x63c277=this['_getUid'](_0x357754);qi(_0x357754,'data-id',_0x63c277),this['_touchedNodesState']['newIds']['push'](_0x63c277),this['_touchedNodesState']['lastTouchedId']=_0x63c277;}const _0x59aecd='afterbegin'===_0x10a92f||'afterend'===_0x10a92f?_0x2ca472['reverse']():_0x2ca472;for(const _0xcdcb90 of _0x59aecd)Qi(_0x2efce5,_0xcdcb90,_0x10a92f);}['_replaceNode'](_0x3d943c,_0x1d7ebb){if(!_0x3d943c)return;if(_0x5bd9cf=_0x1d7ebb,zi(Ki(_0x3d943c))===zi(Ki(_0x5bd9cf)))return;var _0x5bd9cf;const _0x42d2e3=this['_getUid'](_0x3d943c);qi(_0x1d7ebb,'data-id',_0x42d2e3),this['_touchedNodesState']['modifiedIds']['push'](_0x42d2e3),this['_touchedNodesState']['lastTouchedId']=_0x42d2e3,_0x59e804(_0x3d943c,_0x1d7ebb['cloneNode'](!0x0));}['_removeNode'](_0x371504,_0x14624a,_0x240a4b){if(_0x240a4b&&_0x240a4b['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x14624a;const _0x4bc6fd=_0x240a4b['replaceRemovedWith']['cloneNode'](!0x0);qi(_0x4bc6fd,'data-id',_0x14624a),qi(_0x4bc6fd,'data-removed','true'),_0x59e804(_0x371504,_0x4bc6fd);}else _0x3ac3c4(_0x371504);}['_findReferenceNode'](_0x1ec924,_0x1c0a13,_0x4a61b6){const _0xc59cbc=this['_findPrevElementWithDataId'](_0x1ec924,!0x1);if(_0xc59cbc){const _0x1efe78=this['_getNodeDataId'](_0xc59cbc),_0x1550f4=Wi('data-id',_0x1efe78,_0x4a61b6);if(_0x1550f4)return[_0x1550f4,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x1efe78);}const _0x41ff73=this['_findNextElementWithDataId'](_0x1ec924,!0x1);if(_0x41ff73){const _0x5ac2a4=this['_getNodeDataId'](_0x41ff73),_0x1cbd0a=Wi('data-id',_0x5ac2a4,_0x4a61b6);if(_0x1cbd0a)return[_0x1cbd0a,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x5ac2a4);}return _0x1c0a13?_0x1ec924['nextSibling']?this['_findFallbackReferenceNode'](_0x1ec924,_0x4a61b6):[_0x4a61b6['childNodes'][_0x4a61b6['childNodes']['length']-0x1],'afterend']:[_0x4a61b6['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x4c8134,_0x3470b0){const _0xa8870d=[],_0x43f9e5=this['_findPrevElementWithDataId'](_0x4c8134,!0x0);if(_0x43f9e5){const _0x5ca586=Wi('data-id',this['_getNodeDataId'](_0x43f9e5),_0x3470b0);_0x5ca586&&_0xa8870d['push']([_0x5ca586,'afterend']);}const _0x3f2454=this['_findNextElementWithDataId'](_0x4c8134,!0x0);if(_0x3f2454){const _0x308a11=Wi('data-id',this['_getNodeDataId'](_0x3f2454),_0x3470b0);_0x308a11&&_0xa8870d['push']([_0x308a11,'beforebegin']);}if(_0xa8870d['length']>0x1)return ji(_0xa8870d[0x0][0x0])<=ji(_0xa8870d[0x1][0x0])?_0xa8870d[0x0]:_0xa8870d[0x1];return 0x1===_0xa8870d['length']?_0xa8870d[0x0]:[_0x3470b0['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x1d50b7,_0x3bce7a){let _0x5cdb3c=_0x1d50b7['nextSibling'],_0xc03a9a=null,_0x398d90=!0x1;for(;_0x5cdb3c;){if(_0x234fc3(_0x5cdb3c)){if(this['_isDelNode'](_0x5cdb3c)&&(_0xc03a9a=_0x5cdb3c),this['_isExistingContentComment'](_0x5cdb3c)&&_0x3bce7a&&!_0x398d90){_0x398d90=!0x0,_0x5cdb3c=_0x5cdb3c['nextSibling'];continue;}break;}const _0x5d3542=$i(_0x5cdb3c,'data-id');if(_0x5d3542&&'new-element'!==_0x5d3542&&this['_existingDataIds']['has'](_0x5d3542)){_0xc03a9a=_0x5cdb3c;break;}_0x5cdb3c=_0x5cdb3c['nextSibling'];}return _0xc03a9a;}['_findPrevElementWithDataId'](_0x575024,_0x4f2bb7){let _0x11425c=_0x575024['previousSibling'],_0x22d1c2=null,_0x5974cb=!0x1;for(;_0x11425c;){if(_0x234fc3(_0x11425c)){if(this['_isDelNode'](_0x11425c)&&(_0x22d1c2=_0x11425c),this['_isExistingContentComment'](_0x11425c)&&_0x4f2bb7&&!_0x5974cb){_0x5974cb=!0x0,_0x11425c=_0x11425c['previousSibling'];continue;}break;}const _0x119859=$i(_0x11425c,'data-id');if(_0x119859&&'new-element'!==_0x119859&&this['_existingDataIds']['has'](_0x119859)){_0x22d1c2=_0x11425c;break;}_0x11425c=_0x11425c['previousSibling'];}return _0x22d1c2;}['_markWrappedElements'](_0x543247){_0x25dece(_0x543247)&&Yi('data-id',null,_0x543247)['forEach'](_0xd1209b=>{this['_isExistingNode'](_0xd1209b)&&(qi(_0xd1209b,'data-wrapped-id',$i(_0xd1209b,'data-id')),qi(_0xd1209b,'data-id',null));});}['_processWrappedElements'](_0x2d999c,_0x4af8b9){Yi('data-wrapped-id',null,_0x2d999c)['forEach'](_0x22e87a=>{const _0x4543a9=$i(_0x22e87a,'data-wrapped-id');if($i(_0x22e87a,'data-unstable')||this['_hasUnstableParent'](_0x22e87a))return;const _0x1cac52=Wi('data-id',_0x4543a9,_0x2d999c);qi(_0x22e87a,'data-id',_0x4543a9),qi(_0x22e87a,'data-wrapped-id',null),_0x1cac52&&(this['_removeNode'](_0x1cac52,_0x4543a9,_0x4af8b9),this['_touchedNodesState']['removedIds']['push'](_0x4543a9),this['_touchedNodesState']['lastTouchedId']=_0x4543a9);});}['_hasUnstableParent'](_0x317bbd){let _0x2dadcf=_0x317bbd['parentNode'];for(;_0x2dadcf;){if($i(_0x2dadcf,'data-unstable'))return!0x0;_0x2dadcf=_0x2dadcf['parentNode'];}return!0x1;}['_getNodeDataId'](_0xd2658){if(!_0xd2658)return null;if(_0x25dece(_0xd2658))return $i(_0xd2658,'data-id');if(_0x234fc3(_0xd2658)){const _0xce0547=Ki(_0xd2658)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0xce0547&&_0xce0547[0x1])return _0xce0547[0x1];}return null;}['_getUid'](_0x6cd058){return this['_isExistingNode'](_0x6cd058)?$i(_0x6cd058,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x3f2319){(function(_0x299b2e){return _0x483f57(_0x1263ad=>_0x234fc3(_0x1263ad),_0x299b2e,!0x0,0x1/0x0);}(_0x3f2319)['filter'](_0x4326b7=>this['_isDelNode'](_0x4326b7)||this['_isExistingContentComment'](_0x4326b7))['forEach'](_0x56322c=>{_0x3ac3c4(_0x56322c);}));}['_markLastTagElementUnstable'](_0x251815){const _0x5c4f35=_0x251815['childNodes'],_0x337c91=_0x5c4f35[_0x5c4f35['length']-0x1];_0x337c91&&_0x25dece(_0x337c91)&&qi(_0x337c91,'data-unstable','true');}['_markUnstableElements'](_0x443815,_0x1f82c6){const _0x367900=Wi('data-unstable','true',_0x443815);if(!_0x367900)return;const _0x3c849d=Xi(_0x367900)['slice'](0x0,-0x1),_0x162e78=_0x3c849d['length'];let _0x45dd9d=_0x367900;if(_0x162e78>_0x1f82c6){let _0x104869=_0x162e78,_0x27420f=null;for(;_0x104869>_0x1f82c6&&_0x104869>=0x0;)_0x104869--,_0x27420f=_0x3c849d[_0x104869];_0x27420f&&(_0x45dd9d=_0x27420f,qi(_0x367900,'data-unstable',null),qi(_0x27420f,'data-unstable','true'));}else{if(_0x162e78<_0x1f82c6){let _0xc1af43=_0x162e78,_0xc0379f=_0x367900;for(;_0xc1af43<_0x1f82c6;){const _0x2cce08=_0xc0379f['childNodes']['filter'](_0x3ea820=>_0x25dece(_0x3ea820));if(0x0===_0x2cce08['length'])break;_0xc1af43++,_0xc0379f=_0x2cce08[_0x2cce08['length']-0x1];}_0xc0379f&&(_0x45dd9d=_0xc0379f,qi(_0x367900,'data-unstable',null),qi(_0xc0379f,'data-unstable','true'));}}let _0x4b7319=_0x45dd9d;for(;_0x4b7319;){for(;_0x4b7319['nextSibling'];)_0x4b7319=_0x4b7319['nextSibling'],_0x25dece(_0x4b7319)&&qi(_0x4b7319,'data-unstable','true');_0x4b7319=_0x4b7319['parentNode'];}}['_isNewNode'](_0x55d0f9){return Boolean('new-element'===$i(_0x55d0f9,'data-id'));}['_isExistingNode'](_0x14d3eb){return Boolean(($i(_0x14d3eb,'data-id')||'')['length']>0x0&&'new-element'!==$i(_0x14d3eb,'data-id'));}['_isDelNode'](_0x79df8e){return!!_0x79df8e&&Boolean(_0x234fc3(_0x79df8e)&&Ki(_0x79df8e)['match'](/removed[\s*-]data-id="[^"]+"/));}['_isExistingContentComment'](_0x4187ca){return Boolean(_0x234fc3(_0x4187ca)&&Ki(_0x4187ca)['match'](/\s*existing[\s*-](content|document)\s*/g));}}function Zi({editor:_0x365eff,changeGroups:_0x123e73,documentContextContent:_0xaa68ca,showDiff:_0x3ba271,trimUnchanged:_0x50d0bf=!0x0}){return _0x123e73['map'](_0x5190c3=>{const _0x534616=new _0x1ae976([]),_0x342e97=new _0x1ae976([]),_0x3cf027=new Set();for(const _0xd4552a of _0x5190c3['changes'])'new'==_0xd4552a['type']&&Yi('data-id',null,_0xd4552a['node'])['forEach'](_0x3e87a7=>{_0x3cf027['add']($i(_0x3e87a7,'data-id'));});for(const _0x564f8b of _0x5190c3['changes'])if('removed'!=_0x564f8b['type']?_0x342e97['children']['push'](_0x564f8b['node']['cloneNode'](!0x0)):_0x3ba271||_0x3cf027['has'](_0x564f8b['id'])||_0x342e97['children']['push'](_0x564f8b['node']['cloneNode'](!0x0)),'new'!=_0x564f8b['type']&&(_0x3ba271||'removed'!=_0x564f8b['type'])){const _0x388b92=_0x173efb(_0x47193c=>$i(_0x47193c,'data-id')==_0x564f8b['id'],_0xaa68ca,!0x0);_0x388b92&&_0x534616['children']['push'](_0x388b92['cloneNode'](!0x0));}const {content:_0xd3ddaf,hasChanges:_0xd1895d}=function(_0x5124c4,_0x3554c4,_0x44da0e,_0x503934,_0x2dcaa7=!0x0){const _0x578c25=_0x5124c4['plugins']['get']('DocumentCompare'),_0x15708c=Ki(_0x3554c4),_0x1e925c=Ki(_0x44da0e),_0x3c51d8=_0x5124c4['data']['parse'](_0x15708c,'$root'),_0x556725=_0x5124c4['model']['createPositionAt'](_0x3c51d8,0x0),_0x29074b=_0x578c25['getDiff'](_0x15708c,_0x1e925c,{'anchor':_0x556725,'markDeletions':_0x503934,'targetEditor':_0x5124c4}),_0x74af1c=_0x29074b['getOperations']();if(0x0==_0x74af1c['length'])return{'content':_0x3554c4['cloneNode'](!0x0),'hasChanges':!0x1};_0x503934?function(_0x462b89,_0x23288d,_0x3b2f39){if(0x0==_0x462b89['length'])return;const _0x5e996f=_0x3b2f39['plugins']['get']('DocumentCompare'),_0x33b55c=_0x3b2f39['plugins']['get']('SuggestionsConversion');_0x3b2f39['model']['change'](_0x276492=>{const _0x2e2785=new Set();for(let _0x30f150=0x0;_0x30f150<_0x462b89['length'];_0x30f150++){const _0x255888=_0x462b89[_0x30f150];if(_0x255888['baseVersion']=null,_0x255888['isDocumentOperation']=!0x1,_0x5e996f['isMarkedRemoveOperation'](_0x255888)){const _0xfe232=_0x460e1e(_0x255888['newRange'],_0x3b2f39['model']),_0x5486f1='suggestion:deletion:'+ot()+':$aiSuggestion';_0x23288d['markers']['set'](_0x5486f1,_0xfe232);}else switch(_0x255888['type']){case'rename':{if(_0x255888['oldName']==_0x255888['newName'])break;_0x276492['batch']['addOperation'](_0x255888),_0x3b2f39['model']['applyOperation'](_0x255888);const _0x559eb7='$elementName',_0x4bdd4e=_0x255888['position'],_0x177bbb=_0x3b2f39['model']['createRange'](_0x4bdd4e,_0x3b2f39['model']['createPositionAt'](_0x4bdd4e['nodeAfter'],'end')),_0x35f115='suggestion:attribute:'+_0x559eb7+':'+ot()+':$aiSuggestion';_0x23288d['markers']['set'](_0x35f115,_0x177bbb);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x255888['oldValue']==_0x255888['newValue'])break;_0x276492['batch']['addOperation'](_0x255888),_0x3b2f39['model']['applyOperation'](_0x255888);const _0xc1ff3a=_0x255888['key'];if(!_0x33b55c['isRegisteredAttribute'](_0xc1ff3a))break;const _0x5984ba=_0x460e1e(_0x255888['range'],_0x3b2f39['model']),_0x243f66='suggestion:attribute:'+_0xc1ff3a+':'+ot()+':$aiSuggestion';_0x23288d['markers']['set'](_0x243f66,_0x5984ba);break;}case'insert':{_0x276492['batch']['addOperation'](_0x255888),_0x3b2f39['model']['applyOperation'](_0x255888);if(_0x462b89[_0x30f150+0x1]&&'move'==_0x462b89[_0x30f150+0x1]['type']){ts(_0x23288d,_0x255888);break;}const _0x6c5c72=_0x255888['position'],_0x3f1d31=_0x255888['howMany'],_0x427872=_0x460e1e(_0x3b2f39['model']['createRange'](_0x6c5c72,_0x6c5c72['getShiftedBy'](_0x3f1d31)),_0x3b2f39['model']),_0xcf5790='suggestion:insertion:'+ot()+':$aiSuggestion';_0x23288d['markers']['set'](_0xcf5790,_0x427872);break;}case'split':{_0x276492['batch']['addOperation'](_0x255888),_0x3b2f39['model']['applyOperation'](_0x255888);const _0x5141e1=_0x255888['splitPosition'],_0x35591c=_0x255888['moveTargetPosition'],_0x41d7d6=_0x3b2f39['model']['createRange'](_0x5141e1,_0x35591c),_0x2284d1='suggestion:insertion:'+ot()+':$aiSuggestion';_0x23288d['markers']['set'](_0x2284d1,_0x41d7d6);break;}case'move':{_0x276492['batch']['addOperation'](_0x255888),_0x3b2f39['model']['applyOperation'](_0x255888),_0x462b89[_0x30f150-0x1]&&'insert'==_0x462b89[_0x30f150-0x1]['type']&&ts(_0x23288d,_0x255888);const _0x549ac3=_0x255888['getMovedRangeStart'](),_0x3089e1=_0x255888['howMany'];for(let _0x39a630=0x0;_0x39a630<_0x3089e1;_0x39a630++){const _0x25b201=_0x549ac3['getShiftedBy'](_0x39a630)['nodeAfter'];_0x2e2785['add'](_0x25b201);}break;}case'remove':{const _0x44f11b=_0x255888['sourcePosition'],_0x36caa8=_0x255888['howMany'],_0x1188d7=new _0x21f6d9(_0x44f11b,_0x36caa8);_0x276492['batch']['addOperation'](_0x1188d7),_0x3b2f39['model']['applyOperation'](_0x1188d7);break;}}}for(const _0x2c0318 of _0x2e2785){const _0x428d75=_0x3b2f39['model']['createRangeOn'](_0x2c0318),_0x5a6ae6='suggestion:formatBlock:$fakeWrap:'+ot()+':$aiSuggestion';_0x23288d['markers']['set'](_0x5a6ae6,_0x460e1e(_0x428d75,_0x3b2f39['model']));}});}(_0x74af1c,_0x3c51d8,_0x5124c4):_0x5124c4['model']['change'](_0x51da7d=>{for(const _0x2f66d3 of _0x74af1c)if('remove'==_0x2f66d3['type']){const _0x2b3c31=_0x2f66d3['sourcePosition'],_0x39c26f=_0x2f66d3['howMany'],_0x57ce4d=new _0x21f6d9(_0x2b3c31,_0x39c26f);_0x51da7d['batch']['addOperation'](_0x57ce4d),_0x5124c4['model']['applyOperation'](_0x57ce4d);}else{if('marker'==_0x2f66d3['type']){const _0x5ca2f7=_0x2f66d3['name'],_0x2a96bb=_0x2f66d3['newRange'];null!==_0x2a96bb?_0x3c51d8['markers']['set'](_0x5ca2f7,_0x2a96bb):_0x3c51d8['markers']['delete'](_0x5ca2f7);}else _0x2f66d3['baseVersion']=null,_0x2f66d3['isDocumentOperation']=!0x1,_0x51da7d['batch']['addOperation'](_0x2f66d3),_0x5124c4['model']['applyOperation'](_0x2f66d3);}});if(_0x2dcaa7){const _0x15ce38=es(_0x5124c4,_0x74af1c,_0x3c51d8);is(_0x5124c4['model'],_0x15ce38),function(_0x4836a8,_0x1cb0fb){const _0x56c3da=_0x1cb0fb['getFirstRange']()['start'];let _0x21f2e0=_0x1cb0fb['getFirstRange']()['end'];const _0x41ae8e=_0x56c3da['root'];(_0x21f2e0['textNode']||_0x21f2e0['nodeAfter']&&_0x21f2e0['nodeAfter']['is']('$text'))&&(_0x1e470e(_0x21f2e0,'...'),_0x21f2e0=_0x21f2e0['getShiftedBy'](0x3)),(_0x56c3da['textNode']||_0x56c3da['nodeBefore']&&_0x56c3da['nodeBefore']['is']('$text'))&&(_0x1e470e(_0x56c3da,'...'),function(_0x2ce9d0,_0x4cfc96,_0x599623){for(let [_0x3b8014,_0x2c15fb]of _0x2ce9d0['markers']){const _0x3511eb=_0x2c15fb['_getTransformedByInsertion'](_0x4cfc96,_0x599623,!0x1);_0x2c15fb=_0x3511eb[0x0],_0x2ce9d0['markers']['set'](_0x3b8014,_0x2c15fb);}}(_0x41ae8e,_0x56c3da,0x3),_0x56c3da['parent']==_0x21f2e0['parent']&&(_0x21f2e0=_0x21f2e0['getShiftedBy'](0x3)));const _0x5c4949=_0x4836a8['createRange'](_0x4836a8['createPositionAt'](_0x41ae8e,0x0),_0x56c3da),_0x58065b=_0x4836a8['createRange'](_0x21f2e0,_0x4836a8['createPositionAt'](_0x41ae8e,'end')),_0x419867=[..._0x5c4949['getMinimalFlatRanges'](),..._0x58065b['getMinimalFlatRanges']()];_0x419867['reverse']();for(const _0x55a52c of _0x419867)_0x351439(_0x55a52c),ns(_0x41ae8e,_0x55a52c);}(_0x5124c4['model'],_0x15ce38);}const _0x1fbd51=_0x5124c4['data']['stringify'](_0x3c51d8,{'showSuggestionHighlights':!0x0});return{'content':Fi(_0x1fbd51),'hasChanges':!0x0};}(_0x365eff,_0x534616,_0x342e97,_0x3ba271,_0x50d0bf);return{'type':_0x5190c3['changes'][0x0]['type'],'index':_0x5190c3['index'],'content':_0xd3ddaf,'hasChanges':_0xd1895d};});}function ts(_0x1ebf76,_0x59da26){for(const [_0x398155,_0x563f67]of _0x1ebf76['markers']){const _0x105922=_0x5e3e59['_createFromRanges'](_0x563f67['getTransformedByOperation'](_0x59da26));_0x1ebf76['markers']['set'](_0x398155,_0x105922);}}function es(_0x304cfe,_0x9795be,_0x3be1b5){const _0x3c53d5=_0x304cfe['plugins']['get']('DocumentCompare');let _0x444b2c=_0x304cfe['model']['createPositionAt'](_0x3be1b5,Number['POSITIVE_INFINITY']),_0x25191a=_0x304cfe['model']['createPositionAt'](_0x3be1b5,0x0);for(const _0x18cb9f of _0x9795be){let _0x799091,_0x578576;if(_0x3c53d5['isMarkedRemoveOperation'](_0x18cb9f))_0x799091=_0x18cb9f['newRange']['start'],_0x578576=_0x18cb9f['newRange']['end'];else switch(_0x444b2c=_0x444b2c['getTransformedByOperation'](_0x18cb9f),_0x25191a=_0x25191a['getTransformedByOperation'](_0x18cb9f),_0x18cb9f['type']){case'rename':_0x799091=_0x18cb9f['position'],_0x578576=_0x799091['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x799091=_0x18cb9f['range']['start'],_0x578576=_0x18cb9f['range']['end'];break;case'insert':_0x799091=_0x18cb9f['position'],_0x578576=_0x799091['getShiftedBy'](_0x18cb9f['howMany']);break;case'split':_0x799091=_0x18cb9f['splitPosition'],_0x578576=_0x18cb9f['moveTargetPosition'];break;case'merge':{const _0x2ecfea=_0x18cb9f['targetPosition']['path']['slice'](0x0,-0x1);_0x799091=_0x304cfe['model']['createPositionFromPath'](_0x3be1b5,_0x2ecfea),_0x578576=_0x799091['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x17f49f=_0x18cb9f['howMany'],_0xca9fcf=_0x18cb9f['sourcePosition']['_getTransformedByInsertion'](_0x18cb9f['targetPosition'],_0x17f49f),_0x2a8fd1=_0x18cb9f['getMovedRangeStart']();'remove'==_0x18cb9f['type']?(_0x799091=_0xca9fcf,_0x578576=_0xca9fcf):(_0x799091=_0x2a8fd1,_0x578576=_0x2a8fd1['getShiftedBy'](_0x17f49f));break;}}_0x799091&&_0x799091['isBefore'](_0x444b2c)&&(_0x444b2c=_0x799091['clone'](),_0x444b2c['stickiness']='toNone'),_0x578576&&_0x578576['isAfter'](_0x25191a)&&(_0x25191a=_0x578576['clone'](),_0x25191a['stickiness']='toNone');}return _0x304cfe['model']['createSelection'](_0x304cfe['model']['createRange'](_0x444b2c,_0x25191a));}function is(_0x89ef08,_0x20adb3){ss(_0x89ef08,_0x20adb3,'forward');const _0x3c34b0=_0x20adb3['getFirstRange']();_0x20adb3['setTo']([]),_0x20adb3['setTo'](_0x3c34b0,{'backward':!0x0}),ss(_0x89ef08,_0x20adb3,'backward');}function ss(_0x3930c6,_0x1eb8d1,_0x24b1fe){let _0x1f0be6=0x14;for(;_0x1f0be6;){_0x3930c6['modifySelection'](_0x1eb8d1,{'unit':'word','direction':_0x24b1fe}),_0x1f0be6--;const _0x18db62=_0x1eb8d1['focus']['forward'==_0x24b1fe?'nodeBefore':'nodeAfter'];if(_0x18db62&&_0x18db62['is']('element')&&_0x3930c6['schema']['isBlock'](_0x18db62)&&_0x3930c6['schema']['isObject'](_0x18db62))break;}}function ns(_0x57b85e,_0x4de4b4){for(const [_0x35a928,_0x5e49ec]of _0x57b85e['markers']){const _0x3d8a24=_0x5e49ec['_getTransformedByDeletion'](_0x4de4b4['start'],_0x4de4b4['end']['offset']-_0x4de4b4['start']['offset']);null!=_0x3d8a24?_0x57b85e['markers']['set'](_0x35a928,_0x3d8a24):_0x57b85e['markers']['delete'](_0x35a928);}}class AIReply extends ht(){['id'];['interactionId'];['type'];['sources']=[];['parsedContent']=new _0x1ae976([]);['parsedMergedContent']=new _0x1ae976([]);['changeGroups']=[];['areActionsDisabled']=!0x1;['isFromHistory']=!0x1;['documentContextContent'];['documentId'];['dataIdDocumentSources'];['newNodeAnchorIds']=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];['cachedSuggestionContentParts']={'withDiff':[],'withoutDiff':[]};constructor({type:_0x1c57aa,content:_0x261db1='',isDone:_0x5efbc0=!0x1,isComplete:_0x499a2d,interactionId:_0x4587a8,areActionsDisabled:_0x156c1c,isFromHistory:_0x38cc31=!0x1,documentContextContent:_0x491e7f,dataIdDocumentSources:_0xb149bb,documentId:_0x4e4347,locale:_0x48a975,id:_0x5f4fe}){super(),this['id']=_0x5f4fe||ot(),this['interactionId']=_0x4587a8,this['type']=_0x1c57aa,this['areActionsDisabled']=!!_0x156c1c,this['locale']=_0x48a975,this['dataIdDocumentSources']=_0xb149bb,this['documentId']=_0x4e4347,this['isFromHistory']=_0x38cc31,this['aiResponseParser']=new AIResponseParser(),this['aiResponseApplier']=new AIResponseApplier(),this['documentContextContent']=Fi(_0x491e7f||''),this['set']('isDone',_0x5efbc0),this['set']('isComplete',_0x499a2d??_0x5efbc0),this['on']('change:content',()=>{this['onContentChange']();}),this['set']('content',_0x261db1);}['appendContent'](_0x4e2ecf){this['set']('content',this['content']+_0x4e2ecf);}['done'](_0xaae1fc=!0x0){this['isComplete']=_0xaae1fc,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x170436,_0x41b3cd){this['changeGroups'][_0x170436]['state']=_0x41b3cd,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x170436,'state':_0x41b3cd});}['getContentParts']({showDiff:_0x2d5f3e,groupIndex:_0x31d037,editor:_0x19c2c5}){const _0x5c5b84=this['_getCachedContentParts'](_0x2d5f3e,_0x31d037);if(_0x5c5b84)return _0x5c5b84;let _0x24cf6c=[];if(void 0x0===_0x31d037)_0x24cf6c=this['changeGroups'];else{const _0x24da75=this['changeGroups']['find'](({index:_0x57f970})=>_0x57f970===_0x31d037);if(!_0x24da75)throw new at('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x31d037});_0x24cf6c=[_0x24da75];}const _0x43cfdf=Zi({'editor':_0x19c2c5,'showDiff':_0x2d5f3e,'changeGroups':_0x24cf6c,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x2d5f3e,_0x43cfdf),_0x43cfdf;}['_getCachedContentParts'](_0x49a691,_0x12da7a){const _0x1d2f46=_0x49a691?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x1d2f46]['length'])return null;const _0x5dd628=this['cachedSuggestionContentParts'][_0x1d2f46];if(void 0x0===_0x12da7a)return _0x5dd628['length']>0x0&&_0x5dd628['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x49a691,null),null):_0x14908a(_0x5dd628);{const _0x4dab74=_0x5dd628['find'](({index:_0x535fe1})=>_0x535fe1===_0x12da7a);if(_0x4dab74)return[_0x14908a(_0x4dab74)];}return null;}['_setCachedContentParts'](_0x1a3e2d,_0x4acbdf){const _0xf258a1=_0x1a3e2d?'withDiff':'withoutDiff';_0x4acbdf?_0x4acbdf['forEach'](_0x555f59=>{const _0x400034=this['cachedSuggestionContentParts'][_0xf258a1],_0x10ba45=_0x400034['find'](({index:_0x54d45d})=>_0x54d45d===_0x555f59['index']);if(_0x10ba45){const _0x572e94=_0x400034['indexOf'](_0x10ba45);_0x400034['splice'](_0x572e94,0x1,_0x555f59);}else _0x400034['push'](_0x555f59);}):this['cachedSuggestionContentParts'][_0xf258a1]['length']=0x0;}['onContentChange'](){if('modification'===this['type']){this['parsedContent']=this['aiResponseParser']['parseAndNormalizeHTML'](this['content']);const _0x272e81=this['changeGroups'];this['updateChangeGroups']();const _0x5f1fa7=this['_getDifferentChangeGroups'](_0x272e81,this['changeGroups']);(_0x5f1fa7['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x5f1fa7),this['cachedSuggestionContentParts']['withDiff']['length']=this['cachedSuggestionContentParts']['withoutDiff']['length']=0x0);}else this['parsedContent']=this['aiResponseParser']['convertMarkdownToHTML'](this['content']),this['fire']('replyContentUpdated',this);}['_getDifferentChangeGroups'](_0x13be3b,_0x5285d7){const _0x16090b=[];for(const _0x5576c3 of _0x5285d7){const _0x31b8e3=_0x13be3b[_0x5576c3['index']];_0x31b8e3?_0x31b8e3['changes']['length']!==_0x5576c3['changes']['length']?_0x16090b['push'](_0x5576c3):_0x31b8e3['changes']['forEach']((_0x23ae15,_0x22bb20)=>{const _0x4d9122=_0x5576c3['changes'][_0x22bb20];_0x23ae15['id']!==_0x4d9122['id']&&_0x16090b['push'](_0x5576c3);}):_0x16090b['push'](_0x5576c3);}return _0x16090b;}['updateChangeGroups'](){const _0x15a3ec=this['locale']?new _0xb124ea('p',{},[new _0xb124ea('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x1b02fd(Hi(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]):void 0x0,_0x412fe7=this['aiResponseApplier']['merge'](this['parsedContent'],this['documentContextContent']['cloneNode'](!0x0),{'markUnstableElements':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x15a3ec,'cutAfterLastChange':!this['isDone']||!this['isComplete']});if(!_0x412fe7['modifiedNodeIds']['length']&&!this['isDone'])return;this['parsedMergedContent']=_0x412fe7['parsedContent'],this['newNodeAnchorIds']=_0x412fe7['newAnchorIds'];let _0x12b124=[];if(_0x26b2bc(_0x4ddcb0=>{const _0x13fc3c=$i(_0x4ddcb0,'data-id');if(!_0x13fc3c||!_0x1eaaaf(_0x13fc3c))return!0x1;const _0x35d612=[_0x4ddcb0,...Xi(_0x4ddcb0)]['at'](-0x2);if(_0x4ddcb0!=_0x35d612){const _0x493975=$i(_0x35d612,'data-id');_0x1eaaaf(_0x493975)||(_0x12b124['push']({'node':_0x35d612,'id':_0x493975,'type':'modified'}),_0x412fe7['modifiedNodeIds']['push'](_0x493975));}else _0x412fe7['modifiedNodeIds']['includes'](_0x13fc3c)?_0x12b124['push']({'node':_0x4ddcb0,'type':'modified','id':_0x13fc3c}):_0x412fe7['newNodeIds']['includes'](_0x13fc3c)?_0x12b124['push']({'node':_0x4ddcb0,'type':'new','id':_0x13fc3c,'anchorId':$i(_0x4ddcb0['previousSibling'],'data-id')}):_0x12b124['push']({'node':_0x4ddcb0,'type':'removed','id':_0x13fc3c});return!0x0;},this['parsedMergedContent']),_0x12b124=_0x12b124['filter'](({node:_0x23aaf9})=>[...Xi(_0x23aaf9),_0x23aaf9]['every'](_0x3b2e31=>!$i(_0x3b2e31,'data-unstable'))),0x0==_0x12b124['length'])return;const _0x134e0d=[[_0x12b124[0x0]]];for(let _0x12a3d7=0x1;_0x12a3d7<_0x12b124['length'];_0x12a3d7++){const _0x4cfbf3=_0x134e0d[_0x134e0d['length']-0x1],_0x1fc06f=_0x4cfbf3[_0x4cfbf3['length']-0x1];_0x12b124[_0x12a3d7]['node']['previousSibling']==_0x1fc06f['node']&&'modified'!=_0x12b124[_0x12a3d7]['type']&&'modified'!=_0x1fc06f['type']&&this['_isSameDocument'](_0x12b124[_0x12a3d7]['node'],_0x1fc06f['node'])?_0x4cfbf3['push'](_0x12b124[_0x12a3d7]):_0x134e0d['push']([_0x12b124[_0x12a3d7]]);}for(const _0x721cf8 of _0x134e0d){const _0x5036df=_0x721cf8[0x0],_0x4c2ac5=_0x721cf8[_0x721cf8['length']-0x1],_0x1fe46a=_0x254035(_0x5036df['node']['previousSibling']);_0x1fe46a&&this['_isSameDocument'](_0x1fe46a['node'],_0x5036df['node'])&&_0x721cf8['unshift'](_0x1fe46a);const _0x563496=_0x254035(_0x4c2ac5['node']['nextSibling']);_0x563496&&this['_isSameDocument'](_0x563496['node'],_0x4c2ac5['node'])&&_0x721cf8['push'](_0x563496);}function _0x1eaaaf(_0x5ae6bb){return _0x412fe7['modifiedNodeIds']['includes'](_0x5ae6bb)||_0x412fe7['newNodeIds']['includes'](_0x5ae6bb)||_0x412fe7['removedNodeIds']['includes'](_0x5ae6bb);}function _0x254035(_0x38f8ca){if(_0x38f8ca&&$i(_0x38f8ca,'data-id')&&!$i(_0x38f8ca,'data-unstable')){const _0x24fe4d=$i(_0x38f8ca,'data-id');if(!_0x1eaaaf(_0x24fe4d))return{'node':_0x38f8ca,'type':'context','id':_0x24fe4d};}return null;}this['changeGroups']=_0x134e0d['map']((_0x270c60,_0x268cca)=>({'changes':_0x270c60,'state':'pending','index':_0x268cca}));}['_isSameDocument'](_0x47b364,_0x4429c0){if(!this['dataIdDocumentSources']?.['size'])return!0x0;const _0x555ef1=this['_resolveDocumentSource'](_0x47b364),_0x4a6b7d=this['_resolveDocumentSource'](_0x4429c0);return!_0x555ef1||!_0x4a6b7d||_0x555ef1['editor']===_0x4a6b7d['editor']&&_0x555ef1['rootName']===_0x4a6b7d['rootName'];}['_resolveDocumentSource'](_0x1bfde6){if(!_0x1bfde6||!this['dataIdDocumentSources'])return;const _0xdd8c56=$i(_0x1bfde6,'data-id');if(_0xdd8c56){const _0x5dfd28=this['dataIdDocumentSources']['get'](_0xdd8c56);if(_0x5dfd28)return _0x5dfd28;const _0x250d0d=this['newNodeAnchorIds']['get'](_0xdd8c56),_0x36c345=_0x250d0d?this['dataIdDocumentSources']['get'](_0x250d0d):void 0x0;if(_0x36c345)return _0x36c345;}for(let _0x341da1=_0x1bfde6['previousSibling'];_0x341da1;_0x341da1=_0x341da1['previousSibling']){const _0x57392c=$i(_0x341da1,'data-id'),_0x1be56b=_0x57392c?this['dataIdDocumentSources']['get'](_0x57392c):void 0x0;if(_0x1be56b)return _0x1be56b;}for(let _0x471899=_0x1bfde6['nextSibling'];_0x471899;_0x471899=_0x471899['nextSibling']){const _0x2d1cb3=$i(_0x471899,'data-id'),_0x1124e8=_0x2d1cb3?this['dataIdDocumentSources']['get'](_0x2d1cb3):void 0x0;if(_0x1124e8)return _0x1124e8;}}}const rs=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];class AIInteraction extends Et(){['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;constructor({connector:_0x42d947,locale:_0x4af019}){super(),this['id']=ot(),this['connector']=_0x42d947,this['isStopped']=!0x0,this['locale']=_0x4af019;}async['start'](){const _0x344fef=[];let _0x12a73b,_0x3183da,_0x3300d8,_0x25af8c=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x102489=await this['currentRequest']['getStream']();for await(const _0x517b4e of _0x102489){if(this['isStopped'])return;if('error'==_0x517b4e['event'])return void this['fire']('error',{'error':new at('ai-chat-interaction-error',this)});switch(_0x517b4e['event']){case'message-metadata':this['messageId']=_0x517b4e['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x517b4e['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x517b4e['data']['conversationTitle'],!0x0);break;case'source':_0x344fef['push'](_0x517b4e['data']['source']);break;case'web-search':this['_isWebSearching']||(this['_isWebSearching']=!0x0,this['fire']('webSearchStarted',this));break;case'reasoning':this['_isReasoning']||(this['_isReasoning']=!0x0,this['fire']('reasoningStarted',this));break;case'modification-delta':case'text-delta':this['resetReasoningState'](),this['resetWebSearchState'](),_0x12a73b='modification-delta'==_0x517b4e['event']?'modification':'text',_0x3183da='modification-delta'==_0x517b4e['event']?_0x517b4e['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x12a73b&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']?'modification-delta'==_0x517b4e['event']&&(this['currentReply']['documentId']=_0x517b4e['data']['documentId']):(this['currentReply']=this['createReply']({'type':_0x12a73b,'interactionId':this['id'],'id':_0x3183da,...'modification-delta'==_0x517b4e['event']&&{'documentId':_0x517b4e['data']['documentId']}}),'modification'==_0x12a73b&&(this['currentReply']['sources']=_0x344fef['splice'](0x0))),this['currentReply']['appendContent'](_0x517b4e['data']['textDelta']);break;case'mcp-tool-result':_0x3300d8=JSON['parse'](_0x517b4e['data']['result']),this['_handleToolResultData']({'toolName':_0x517b4e['data']['toolName'],'data':_0x3300d8['data'],'attributes':_0x3300d8['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x517b4e['data']['toolName'],'data':_0x517b4e['data']['data']});}}_0x25af8c=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x344fef['length']>0x0&&(this['currentReply']['sources']=_0x344fef['splice'](0x0)),this['_finalizeInteraction'](_0x25af8c),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x447b69){return this['replies']['find'](_0x3a69b5=>_0x3a69b5['id']===_0x447b69);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0xe8d088=>_0xe8d088['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x384184){const _0x1fd0ae=new AIReply({'locale':this['locale'],'documentContextContent':this['getDocumentContext']()?.['content'],'dataIdDocumentSources':this['getDocumentContext']()?.['dataIdDocumentSources'],..._0x384184});return this['replies']['push'](_0x1fd0ae),_0x1fd0ae['delegate'](...rs)['to'](this),this['fire']('replyCreated',_0x1fd0ae),_0x1fd0ae;}['setConversationTitle'](_0x1486c4,_0x4a3a8e=!0x1){this['fire']('setConversationTitle',_0x1486c4,_0x4a3a8e);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x4d4792){this['fire']('toolDataReceived',{'type':'result','toolName':_0x4d4792['toolName'],'data':structuredClone(_0x4d4792['data']||{}),'attributes':structuredClone(_0x4d4792['attributes']||{})},this);}['_handleToolNotificationData'](_0x30b09d){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x30b09d['toolName'],'data':structuredClone(_0x30b09d['data'])},this);}['_finalizeInteraction'](_0x4163f6=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x4163f6),this['currentRequest']=this['currentReply']=void 0x0;}}const os=new Map([['usage-limits-exceeded','ai-usage-limits-exceeded'],['rate-limits-exceeded','ai-rate-limits-exceeded'],['invalid-content-type','ai-invalid-content-type'],['invalid-request-data','ai-chat-invalid-request'],['model-already-set','ai-chat-model-already-set'],['model-not-found','ai-chat-model-not-found'],['unsafe-content-detected','ai-chat-unsafe-content-detected'],['unsupported-content-type','ai-chat-unsupported-content-type'],['content-too-large','ai-chat-content-too-large'],['unsupported-file-type','ai-chat-context-unsupported-file-type'],['file-too-large','ai-chat-context-file-too-large'],['file-too-many-pages','ai-chat-context-file-too-many-pages'],['form-data-size-limits-exceeded','ai-chat-context-form-data-size-limits-exceeded']]),as=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];class AIChatContext extends ht(){['_connector'];['_config'];['_ownerId'];constructor({connector:_0x4af213,config:_0xbd52f7,ownerId:_0x488347}){super(),this['_connector']=_0x4af213,this['_config']=_0xbd52f7,this['_ownerId']=_0x488347;}['init'](){this['_pendingContextItems']=new Map(),this['_conversationContextItems']=new Map(),this['_ongoingUploads']=new Map(),this['_ongoingUploadOperations']=new Map(),this['_documentSources']=new Map(),this['_dataIdToSource']=new Map(),this['_setAddContextOptionsDefaultState']();}['_getDocumentSource'](_0x212115){if(_0x212115)return this['_documentSources']['get'](_0x212115);}['getSourceByDataId'](_0x45ac8b){if(_0x45ac8b)return this['_dataIdToSource']['get'](_0x45ac8b);}['_getDocumentContextSlice'](_0x3f8528){const _0x336d98=this['_getDocumentSource'](_0x3f8528);if(_0x336d98)return{'editor':_0x336d98['editor'],'rootName':_0x336d98['rootName'],'html':_0x336d98['content'],'version':_0x336d98['version']};}['getDocumentContextSliceByDataId'](_0x4a6016){const _0x92dfe8=this['getSourceByDataId'](_0x4a6016);return _0x92dfe8?this['_getDocumentContextSlice'](_0x92dfe8['documentId']):void 0x0;}['getPendingContextItems'](){return this['_pendingContextItems'];}async['populateFromMessage'](_0x46249b){const _0x36ccfe=await this['_createContextItemFromContent'](_0x46249b);return this['_addToConversationContextItem'](_0x36ccfe),'current-document'===_0x36ccfe['uiId']&&this['_toggleAddCurrentDocumentOptionVisibility'](),_0x36ccfe;}async['populateDocumentsFromMessage'](_0x369645,_0x264f9a){const _0x2021fc=_0x369645['filter'](_0x5847ec=>'document'===_0x5847ec['type']);if(0x0===_0x2021fc['length'])return{'hasUnmatched':!0x1};if(0x1===_0x2021fc['length'])return{'contextItem':await this['populateFromMessage'](_0x2021fc[0x0]),'hasUnmatched':!0x1};const _0x3055de=_0x2021fc['map'](_0x2713c2=>_0x2713c2['id']),_0x3b61d9=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x3055de)['getDocuments'](),_0x3f96ba=new Map(_0x3b61d9['map'](_0x26644a=>[_0x26644a['id'],_0x26644a]));this['_documentSources']['clear'](),this['_dataIdToSource']['clear']();const _0x37b045=[];let _0x88e1d=!0x1;for(const _0x14238c of _0x2021fc){const _0x592579=_0x3f96ba['get'](_0x14238c['id']);if(!_0x592579)continue;const _0x540d1e=this['_matchDocumentToRoot'](_0x592579,_0x264f9a),_0x1f6767=_0x264f9a[0x0]&&this['_getFirstRoot'](_0x264f9a[0x0]);_0x540d1e||(_0x88e1d=!0x0);const _0x2868f9=_0x540d1e?.['editor']??_0x1f6767?.['editor'],_0x23932d=_0x540d1e?.['rootName']??_0x1f6767?.['rootName'];if(_0x2868f9&&_0x23932d){const _0x5bbb08={'editor':_0x2868f9,'rootName':_0x23932d,'content':_0x592579['content'],'version':_0x592579['attributes']?.['version']??0x0,'name':_0x592579['name'],'description':_0x592579['description']};this['_documentSources']['set'](_0x592579['id'],_0x5bbb08);const _0x303569=Fi(_0x592579['content']);for(const _0x1e114e of _0x26b2bc(_0x2eae2b=>!!$i(_0x2eae2b,'data-id'),_0x303569)){const _0x29b7ac=$i(_0x1e114e,'data-id');_0x29b7ac&&this['_dataIdToSource']['set'](_0x29b7ac,{..._0x5bbb08,'documentId':_0x592579['id']});}}_0x37b045['push']({'id':_0x592579['id'],'content':_0x592579['content'],'version':_0x592579['attributes']?.['version']??0x0,'sessionId':_0x592579['attributes']?.['sessionId']??null,'selection':[]});}const _0xf2474d={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x37b045,'dataIdDocumentSources':new Map(this['_dataIdToSource'])};return this['_addToConversationContextItem'](_0xf2474d),this['_toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0xf2474d,'hasUnmatched':_0x88e1d};}['_matchDocumentToRoot'](_0x2b5211,_0x5b3c5c){const _0x4b52c4=_0x2b5211['attributes']?.['channelId'],_0x466230=_0x2b5211['attributes']?.['rootName'];if(_0x4b52c4&&_0x466230){for(const _0x1ab508 of _0x5b3c5c)if(_0x1ab508['config']['get']('collaboration.channelId')===_0x4b52c4){for(const _0x383ea7 of _0x1ab508['model']['document']['getRoots']())if('$graveyard'!==_0x383ea7['rootName']&&_0x383ea7['rootName']===_0x466230)return{'editor':_0x1ab508,'rootName':_0x383ea7['rootName']};}}}['_getFirstRoot'](_0x32fb73){for(const _0x9e354e of _0x32fb73['model']['document']['getRoots']())if('$graveyard'!==_0x9e354e['rootName'])return{'editor':_0x32fb73,'rootName':_0x9e354e['rootName']};}async['_createContextItemFromContent'](_0xde4124){if('document'===_0xde4124['type']){const _0x547887=await this['_connector']['fetchDocument'](this['_ownerId'],_0xde4124['id'])['getDocument']();return{'id':'current-document','uiId':'current-document','label':'Current\x20document','type':_0xde4124['type'],'content':_0x547887['content'],'hidden':this['_conversationContextItems']['has']('current-document'),'version':_0x547887['attributes']?.['version'],'sessionId':_0x547887['attributes']?.['sessionId']};}if('mcp-tool-context'===_0xde4124['type'])return{'id':_0xde4124['id'],'uiId':_0xde4124['id'],'label':_0xde4124['data']?.['label']||_0xde4124['id'],'type':'mcp-tool-context','mcpServerName':_0xde4124['mcpServerName'],'toolName':_0xde4124['toolName'],'data':_0xde4124['data']||{}};return{'id':_0xde4124['id'],'uiId':_0xde4124['id'],'label':_0xde4124['attributes']?.['label']||_0xde4124['name']||_0xde4124['url']||_0xde4124['id'],'type':_0xde4124['type'],..._0xde4124?.['attributes']?.['resourceId']?{'resourceId':_0xde4124['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x43e8d8){const _0x201495=this['_pendingContextItems']['get'](_0x43e8d8);_0x201495?.['isReadOnly']||this['_removeContextItem'](_0x43e8d8);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x5f4adc of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x5f4adc['uiId']);const _0x1a6ca5=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x1a6ca5&&this['_addContextItem']({..._0x1a6ca5,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x452d97){for(const _0x5636c7 of _0x452d97['values']())this['_addToConversationContextItem'](_0x5636c7);this['clearPendingContextItems'](),this['fire']('contextSent',{'contextItems':Array['from'](this['getSentContextItems']()['values']())});}['isCurrentDocumentInContext'](){return this['_pendingContextItems']['has']('current-document');}['isSelectionInContext'](){return this['_pendingContextItems']['has']('selection');}['isCurrentDocumentInConversation'](){return this['_conversationContextItems']['has']('current-document');}static['mapContextItemsToRequestData'](_0x26d600){return Array['from'](_0x26d600['values']())['flatMap'](_0x2aa20e=>this['_mapContextItemToRequestData'](_0x2aa20e));}async['addFilesToContext'](_0x502f34,_0x5bc204,_0x3fd425='file'){const _0x41efbf='files-'+ot();this['_startUploadOperation'](_0x41efbf);try{await Promise['all'](_0x502f34['map'](async _0x408018=>{const _0x1b5811='file-'+ot(),_0x579363=_0x5f10e5(_0x408018['name']);try{this['_addContextItem']({'type':_0x3fd425,'label':_0x5bc204?.['label']||_0x579363,'uiId':_0x1b5811,'resourceId':_0x5bc204?.['resourceId']},!0x0);const _0x416fd6=this['_connector']['uploadFile'](this['_ownerId'],_0x408018,_0x5bc204);this['_ongoingUploads']['set'](_0x1b5811,_0x416fd6['abortController']);const {id:_0x36c1dc}=await _0x416fd6['getId']();this['_ongoingUploads']['delete'](_0x1b5811),this['_finishContextItemLoading']({'type':_0x3fd425,'id':_0x36c1dc,'label':_0x5bc204?.['label']||_0x579363,'uiId':_0x1b5811,'resourceId':_0x5bc204?.['resourceId']},!0x1);}catch(_0x552142){this['_ongoingUploads']['delete'](_0x1b5811);if(!(_0x552142 instanceof at&&_0x552142['message']['startsWith']('ai-request-aborted'))){const _0x12c680=os['get'](_0x552142['code'])||'ai-chat-file-upload-failed',_0x569551=new at(_0x12c680,null,{'fileName':_0x579363,..._0x552142});_0x569551['stack']=_0x552142['stack'],this['fire']('error',{'error':_0x569551});}this['_removeContextItem'](_0x1b5811);}}));}finally{this['_finishUploadOperation'](_0x41efbf);}}['addCurrentDocumentToContext'](_0x303c7a){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x34f367={'type':'document','uiId':'current-document','label':_0x303c7a,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x34f367);}async['updateCurrentDocument'](_0x1f7bfe,_0x54fa55,_0x56932a,_0x182005,_0x462a9e,_0x40443d){const _0x3f5d33=this['_pendingContextItems']['get']('current-document');if(_0x3f5d33&&_0x1f7bfe){_0x3f5d33['selection']=_0x40443d?_0x40443d['map'](_0x1959ec=>({'start':_0x1959ec['start'],'end':_0x1959ec['end']})):[];try{if(_0x3f5d33['version']===_0x54fa55)return;const {id:_0x377426}=await this['_connector']['uploadDocument'](this['_ownerId'],_0x1f7bfe,{'version':_0x54fa55,'sessionId':_0x56932a,'channelId':_0x182005,'rootName':_0x462a9e})['getId']();_0x3f5d33['id']=_0x377426,_0x3f5d33['content']=_0x1f7bfe,_0x3f5d33['version']=_0x54fa55,_0x3f5d33['sessionId']=_0x56932a;}catch(_0x38b900){const _0x4b9280=new at('ai-chat-document-upload-failed',null);_0x4b9280['stack']=_0x38b900['stack'],this['fire']('error',{'error':_0x4b9280});}}}async['updateCurrentDocuments'](_0x105df4){const _0x12110d=this['_pendingContextItems']['get']('current-document');if(!_0x12110d||!_0x105df4['length']||_0x105df4['every'](_0x481ec7=>!_0x481ec7['content']))return;_0x105df4['length']>0x1&&_0x105df4['some'](_0x4a67a5=>!_0x4a67a5['description'])&&gt('ai-chat-documents-missing-description');const _0x4bd24d=_0x1f94e4=>_0x1f94e4?_0x1f94e4['map'](_0x4915f2=>({'start':_0x4915f2['start'],'end':_0x4915f2['end']})):[],_0x52795e=_0x12110d['documents']??[];if(_0x52795e['length']===_0x105df4['length']&&_0x105df4['every']((_0x1ed075,_0x48ade2)=>_0x52795e[_0x48ade2]?.['version']===_0x1ed075['version']))_0x12110d['documents']=_0x52795e['map']((_0x1111ce,_0x579cb2)=>({..._0x1111ce,'selection':_0x4bd24d(_0x105df4[_0x579cb2]['selections'])}));else try{const _0x479ec4=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x105df4)['getIds']();_0x12110d['documents']=_0x105df4['map']((_0x4dba2d,_0x13cf91)=>({'id':_0x479ec4[_0x13cf91]?.['id'],'content':_0x4dba2d['content'],'version':_0x4dba2d['version'],'sessionId':_0x4dba2d['sessionId'],'selection':_0x4bd24d(_0x4dba2d['selections'])})),this['_documentSources']['clear'](),this['_dataIdToSource']['clear']();for(let _0x15602b=0x0;_0x15602b<_0x105df4['length'];_0x15602b++){const _0x146a10=_0x479ec4[_0x15602b]?.['id'],_0x418636=_0x105df4[_0x15602b];if(!_0x146a10)continue;const _0x3f800c={'editor':_0x418636['editor'],'rootName':_0x418636['rootName'],'content':_0x418636['content'],'version':_0x418636['version'],'name':_0x418636['name'],'description':_0x418636['description']};this['_documentSources']['set'](_0x146a10,_0x3f800c);const _0x1dced4=Fi(_0x418636['content']);for(const _0xc34fe2 of _0x26b2bc(_0x16f0a0=>!!$i(_0x16f0a0,'data-id'),_0x1dced4)){const _0x1b56ba=$i(_0xc34fe2,'data-id');_0x1b56ba&&this['_dataIdToSource']['set'](_0x1b56ba,{..._0x3f800c,'documentId':_0x146a10});}}_0x12110d['dataIdDocumentSources']=new Map(this['_dataIdToSource']);}catch(_0x5961a3){const _0x484267=new at('ai-chat-document-upload-failed',null);_0x484267['stack']=_0x5961a3['stack'],this['fire']('error',{'error':_0x484267});}}['addSelectionToContext'](_0x48b2da){this['_addContextItem']({'type':'selection','label':_0x48b2da,'uiId':'selection','content':_0x48b2da});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x33381d,_0x250c76){const _0x562315='url-'+ot();this['_startUploadOperation'](_0x562315);const _0x2b41e3='url-'+ot();try{this['_addContextItem']({'type':'web-resource','label':_0x250c76?.['label']||_0x33381d,'uiId':_0x2b41e3,'resourceId':_0x250c76?.['resourceId']},!0x0);const _0x397319=this['_connector']['uploadUrl'](this['_ownerId'],_0x33381d,_0x250c76);this['_ongoingUploads']['set'](_0x2b41e3,_0x397319['abortController']);const {id:_0x23dcc0}=await _0x397319['getId']();this['_ongoingUploads']['delete'](_0x2b41e3),this['_finishContextItemLoading']({'type':'web-resource','id':_0x23dcc0,'label':_0x250c76?.['label']||_0x33381d,'uiId':_0x2b41e3,'resourceId':_0x250c76?.['resourceId']},!0x1);}catch(_0x1b39b9){this['_ongoingUploads']['delete'](_0x2b41e3),(_0x1b39b9['message']['startsWith']('ai-request-aborted')||this['fire']('error',{'error':new at('ai-chat-url-upload-failed',this,{'url':_0x33381d,'originalError':_0x1b39b9}),'url':_0x33381d}),this['_removeContextItem'](_0x2b41e3));}finally{this['_finishUploadOperation'](_0x562315);}}['addToolItemToContext'](_0x28dd1c){_0x28dd1c['id']=_0x28dd1c['id']??ot()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x28dd1c['uiId'],_0x28dd1c),this['fire']('contextItemAdded',{'contextItem':_0x28dd1c,'isLoading':!0x1});}async['loadSourceResources'](_0x1018c4,_0x287c92,_0x2d5c72){const _0x16191b=this['_addContextOptionsState']['sources']['find'](_0x548069=>_0x548069['id']===_0x1018c4);if(!_0x16191b)return this['fire']('error',{'error':new at('ai-chat-source-not-found',this,{'sourceId':_0x1018c4}),'sourceId':_0x1018c4}),[];try{const _0x3d2f98=(await _0x16191b['getResources'](_0x287c92))['map'](_0x31bccc=>{const _0xe5f695=this['_isResourceInContext'](_0x31bccc['id']);return{..._0x31bccc,'isInContext':_0xe5f695};});return _0x16191b['resources']=_0x3d2f98,this['fire']('sourceResourcesLoaded',{'sourceId':_0x1018c4,'source':_0x16191b,'resources':_0x3d2f98,'uid':_0x2d5c72}),_0x3d2f98;}catch(_0x5408be){return this['fire']('error',{'error':new at('ai-chat-source-resources-load-failed',this,{'sourceId':_0x1018c4,'originalError':_0x5408be}),'sourceId':_0x1018c4,'sourceLabel':_0x16191b['label']}),[];}}async['addResourceToContext'](_0x18bdaf,_0x519d25){if(this['_isResourceInContext'](_0x519d25['id']))return;let _0x55dfc5=_0x519d25['data'];if(!_0x55dfc5&&_0x18bdaf['getData'])try{_0x55dfc5=await _0x18bdaf['getData'](_0x519d25['id']);}catch(_0x1413b7){return void this['fire']('error',{'error':new at('ai-chat-resource-load-failed',this,{'resourceId':_0x519d25['id'],'sourceId':_0x18bdaf['id'],'originalError':_0x1413b7}),'resourceId':_0x519d25['id'],'sourceId':_0x18bdaf['id']});}if(_0x55dfc5)switch(_0x519d25['type']){case'web-resource':if('string'!=typeof _0x55dfc5)return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x519d25['id'],'sourceId':_0x18bdaf['id'],'expectedType':'string','actualType':typeof _0x55dfc5}),'resourceId':_0x519d25['id'],'sourceId':_0x18bdaf['id']});await this['addUrlToContext'](_0x55dfc5,{'label':_0x519d25['label'],'resourceId':_0x519d25['id']});break;case'file':if(!(_0x55dfc5 instanceof File))return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x519d25['id'],'sourceId':_0x18bdaf['id'],'expectedType':'File','actualType':typeof _0x55dfc5}),'resourceId':_0x519d25['id'],'sourceId':_0x18bdaf['id']});await this['addFilesToContext']([_0x55dfc5],{'label':_0x519d25['label'],'resourceId':_0x519d25['id']});break;case'text':if('object'!=typeof _0x55dfc5||!('content'in _0x55dfc5)||!('type'in _0x55dfc5))return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x519d25['id'],'sourceId':_0x18bdaf['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x55dfc5}),'resourceId':_0x519d25['id'],'sourceId':_0x18bdaf['id']});_0x55dfc5=AIChatContext['_convertTextResourceToFile'](_0x55dfc5,_0x519d25['label']),await this['addFilesToContext']([_0x55dfc5],{'label':_0x519d25['label'],'resourceId':_0x519d25['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new at('ai-chat-context-unsupported-type',this,{'resourceId':_0x519d25['id'],'sourceId':_0x18bdaf['id'],'resourceType':_0x519d25['type']}),'resourceId':_0x519d25['id'],'sourceId':_0x18bdaf['id']});}else this['fire']('error',{'error':new at('ai-chat-resource-no-data',this,{'resourceId':_0x519d25['id'],'sourceId':_0x18bdaf['id']}),'resourceId':_0x519d25['id'],'sourceId':_0x18bdaf['id']});}static['_convertTextResourceToFile'](_0x40f38f,_0x6a8a7c){switch(_0x40f38f['type']){case'markdown':return new File([_0x40f38f['content']],_0x6a8a7c,{'type':'text/markdown'});case'html':return new File([_0x40f38f['content']],_0x6a8a7c,{'type':'text/html'});default:return new File([_0x40f38f['content']],_0x6a8a7c,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x4d0c61){switch(_0x4d0c61['type']){case'file':case'text':return[{'type':'file','id':_0x4d0c61['id']}];case'web-resource':return[{'type':'web-resource','id':_0x4d0c61['id']}];case'document':return _0x4d0c61['documents']?.['length']?_0x4d0c61['documents']['map'](_0x2205fe=>({'type':'document','id':_0x2205fe['id'],..._0x2205fe['selection']?.['length']&&{'selection':_0x2205fe['selection']}})):[{'type':'document','id':_0x4d0c61['id'],..._0x4d0c61['selection']?.['length']&&{'selection':_0x4d0c61['selection']}}];case'mcp-tool-context':{const _0x1b577d=_0x4d0c61;return[{'type':'mcp-tool-context','mcpServerName':_0x1b577d['mcpServerName'],'toolName':_0x1b577d['toolName'],'data':{..._0x1b577d['data'],'label':_0x1b577d['label']||_0x1b577d['data']?.['label']||_0x1b577d['id']},'id':_0x1b577d['id']}];}default:return[];}}['_addContextItem'](_0x153e75,_0xbc46ed=!0x1){if(this['_pendingContextItems']['set'](_0x153e75['uiId'],_0x153e75),_0x153e75['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x153e75,'isLoading':_0xbc46ed}),'current-document'===_0x153e75['uiId']&&this['_toggleAddCurrentDocumentOptionVisibility'](),_0x153e75['resourceId']){const _0x10ba84=this['_findSourceIdsByResourceId'](_0x153e75['resourceId']);_0x10ba84&&_0x10ba84['forEach'](_0x3d5706=>{this['_updateResourceInContextState'](_0x3d5706,_0x153e75['resourceId'],!0x0);});}}['_removeContextItem'](_0x3c9722){const _0x49a617=this['_pendingContextItems']['get'](_0x3c9722),_0x9d8a1=this['_ongoingUploads']['get'](_0x3c9722);if(_0x9d8a1&&(_0x9d8a1['abort'](),this['_ongoingUploads']['delete'](_0x3c9722)),_0x49a617?.['resourceId']){const _0x21ef03=this['_findSourceIdsByResourceId'](_0x49a617['resourceId']);_0x21ef03&&_0x21ef03['forEach'](_0x39bb3e=>{this['_updateResourceInContextState'](_0x39bb3e,_0x49a617['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x3c9722),this['fire']('contextItemRemoved',{'uiId':_0x3c9722,'type':_0x49a617?.['type']}),'current-document'===_0x3c9722&&this['_toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x315a95,_0x4bc2fd){if(this['_pendingContextItems']['has'](_0x315a95['uiId'])&&(this['_pendingContextItems']['set'](_0x315a95['uiId'],_0x315a95),this['fire']('contextItemLoadingEnded',{'contextItem':_0x315a95,'isLoading':_0x4bc2fd}),_0x315a95['resourceId'])){const _0x3b3bf6=this['_findSourceIdsByResourceId'](_0x315a95['resourceId']);_0x3b3bf6&&_0x3b3bf6['forEach'](_0x56c26c=>{this['_updateResourceInContextState'](_0x56c26c,_0x315a95['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x23f3d2){this['_conversationContextItems']['set'](_0x23f3d2['uiId'],_0x23f3d2);}['_setAddContextOptionsDefaultState'](){this['_addContextOptionsState']={'document':{'enabled':!0x1!==this['_config']?.['document']?.['enabled'],'isHidden':!0x1},'urls':{'enabled':!0x1!==this['_config']?.['urls']?.['enabled']},'files':{'enabled':!0x1!==this['_config']?.['files']?.['enabled']},'sources':this['_getCustomSourcesInitialState'](),'customItems':this['_config']?.['customItems']?.['map'](_0x326bbe=>({..._0x326bbe,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x34ef5d=>({..._0x34ef5d,'resources':[]}))??[];}['_toggleAddCurrentDocumentOptionVisibility'](){const _0x2044e3=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x2044e3,this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_isResourceInContext'](_0x2d622b){for(const _0x5e4b30 of this['_pendingContextItems']['values']())if(_0x5e4b30['resourceId']===_0x2d622b)return!0x0;for(const _0x1859df of this['_conversationContextItems']['values']())if(_0x1859df['resourceId']===_0x2d622b)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x4c96e8){const _0x33bfa6=[];for(const _0x3fe776 of this['_addContextOptionsState']['sources']){_0x3fe776['resources']['find'](_0x335fdf=>_0x335fdf['id']===_0x4c96e8)&&_0x33bfa6['push'](_0x3fe776['id']);}return 0x0===_0x33bfa6['length']?null:_0x33bfa6;}['_updateResourceInContextState'](_0x3b313b,_0x1985ec,_0x63a4bf){const _0x2cf48c=this['_addContextOptionsState']['sources']['find'](_0x1f057b=>_0x1f057b['id']===_0x3b313b);if(!_0x2cf48c)return;const _0x5d969e=_0x2cf48c['resources']['find'](_0x3b8967=>_0x3b8967['id']===_0x1985ec);_0x5d969e&&(_0x5d969e['isInContext']=_0x63a4bf,this['fire']('resourceStateChanged',{'sourceId':_0x3b313b,'resourceId':_0x1985ec,'isInContext':_0x63a4bf}));}['_startUploadOperation'](_0x3a2229){this['_ongoingUploadOperations']['set'](_0x3a2229,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x1768d9){this['_ongoingUploadOperations']['delete'](_0x1768d9),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}}const hs=['capabilitiesUpdated'];class AICapabilities extends Et(){['_isWebSearchEnabled'];['_isReasoningEnabled'];constructor(){super(),this['_isWebSearchEnabled']=!0x1,this['_isReasoningEnabled']=!0x1;}['init'](){this['reset']();}['reset'](){this['setWebSearch'](!0x1),this['setReasoning'](!0x1);}['getCapabilitiesConfig'](){return{'isWebSearchEnabled':this['_isWebSearchEnabled'],'isReasoningEnabled':this['_isReasoningEnabled']};}static['getCapabilitiesRequestData'](_0x133992){const _0xc52acc={};return _0x133992&&_0x133992['isWebSearchEnabled']&&(_0xc52acc['webSearch']={}),_0x133992&&_0x133992['isReasoningEnabled']&&(_0xc52acc['reasoning']={}),_0xc52acc;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x3bc6e7){_0x3bc6e7!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x3bc6e7,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x4c81bf){_0x4c81bf!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x4c81bf,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}}class AIChatInteraction extends AIInteraction{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x321328){super(_0x321328),this['conversationId']=_0x321328['conversationId'],this['contextItems']=_0x321328['contextItems'],this['capabilities']=_0x321328['capabilities'],this['userMessage']=_0x321328['userMessage'],this['model']=_0x321328['model'],this['attributes']=_0x321328['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':AIChatContext['mapContextItemsToRequestData'](this['contextItems']),'capabilities':AICapabilities['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}['createReply'](_0x3da143){const _0x2f581e=this['getDocumentContext']();if(_0x2f581e?.['documents']?.['length']){const _0x49a28e=_0x2f581e['documents']['map'](_0x295cba=>_0x295cba['content']??'')['join']('');if(_0x49a28e)return super['createReply']({'documentContextContent':_0x49a28e,..._0x3da143});}return super['createReply'](_0x3da143);}}class AIChatConversation extends Et(){['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];constructor(_0x13a5ec){super(),this['options']=_0x13a5ec,this['connector']=_0x13a5ec['connector'],this['chatModels']=_0x13a5ec['chatModels'],this['id']=_0x13a5ec['conversationId'],this['isFromHistory']=_0x13a5ec['isFromHistory'];}async['init'](_0x357181){try{this['chatContext']=new AIChatContext({'connector':this['connector'],'config':_0x357181,'ownerId':this['id']}),this['chatContext']['delegate'](...as)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new AICapabilities(),this['chatCapabilities']['delegate'](...hs)['to'](this),this['chatCapabilities']['init']();const _0x1c8b6a=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x1c8b6a});const _0x255489=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x255489&&await this['setModel'](_0x255489);}catch(_0x608307){const _0x122159=new at('ai-chat-conversation-init-failed',null,{'message':_0x608307['message']||_0x608307});_0x122159['stack']=_0x608307['stack'],this['fire']('error',{'error':_0x122159});}}async['start'](){if(this['isStarted'])throw new at('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new at('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x5d3956}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x5d3956,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x183a14){const _0x53e1ee=new at('ai-chat-conversation-start-failed',null,{'message':_0x183a14['message'],'conversationId':this['id']});throw _0x53e1ee['stack']=_0x183a14['stack'],this['fire']('error',{'error':_0x53e1ee}),_0x53e1ee;}}async['load'](_0x3a157f,_0x576eaa){try{const _0x5ac622=await this['connector']['fetchConversation'](_0x3a157f)['getConversation'](),_0x4a9839=await this['connector']['fetchConversationMessages'](_0x3a157f)['getMessages'](),_0x494a7a=_0x4a9839[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x5ac622['id'],'title'in _0x5ac622?this['fire']('setConversationTitle',_0x5ac622['title'],!0x0):this['fire']('setConversationTitle','',!0x0);const _0x297f05=(await this['chatModels']['getAll']())['find'](_0x27ec32=>_0x27ec32['id']['toLowerCase']()===_0x494a7a['toLowerCase']());return this['selectedModel']=_0x297f05,this['fire']('modelSelected',{'selectedModel':_0x297f05,'isDisabled':!0x0}),await this['_processMessagesToInteractions'](_0x4a9839,_0x576eaa,_0x494a7a),this['currentInteraction']=void 0x0,this;}catch(_0x4e7858){const _0x337bf5=new at('ai-chat-conversation-init-from-id-failed',null,{'message':_0x4e7858['message'],'conversationId':_0x3a157f});throw _0x337bf5['stack']=_0x4e7858['stack'],this['fire']('error',{'error':_0x337bf5}),_0x337bf5;}}async['_processMessagesToInteractions'](_0x3f3f93,_0x25d459,_0x32b008){let _0x51b46c,_0x436f37=!0x1;for(const _0x30b1d3 of _0x3f3f93)if('user'===_0x30b1d3['role']){const {contextItems:_0x394607,hasUnmatched:_0x160116}=await this['_extractContextItems'](_0x30b1d3);_0x436f37=_0x160116;const _0x3db90c={'isReasoningEnabled':Object['hasOwn'](_0x30b1d3['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x30b1d3['capabilities'],'webSearch')};_0x51b46c=this['createInteraction']({'userMessage':_0x30b1d3['prompt'],'contextItems':_0x394607,'capabilities':_0x3db90c,'modelId':_0x32b008,'attributes':_0x30b1d3['attributes']}),this['currentInteraction']=_0x51b46c,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x30b1d3['role']&&_0x51b46c){const _0x116459=[];for(const _0x3577f4 of _0x30b1d3['content'])switch(_0x3577f4['type']){case'text':case'modification':{const _0x67300b=_0x51b46c['getDocumentContext'](),_0x4808f2=(_0x67300b?.['documents']?.['length']?_0x67300b['documents']['some'](_0x2b3ee5=>_0x2b3ee5['sessionId']!==_0x25d459):_0x67300b?.['sessionId']!==_0x25d459)||_0x436f37;_0x51b46c['currentReply']?.['type']!==_0x3577f4['type']&&(_0x51b46c['currentReply']=_0x51b46c['createReply']({'type':_0x3577f4['type'],'isDone':!0x0,'interactionId':_0x51b46c['id'],'areActionsDisabled':_0x4808f2,'isFromHistory':!0x0}),_0x116459['length']>0x0&&(_0x51b46c['currentReply']['sources']=_0x116459['splice'](0x0))),_0x51b46c['currentReply']['appendContent'](_0x3577f4['content']);break;}case'url':_0x116459['push'](_0x3577f4);break;case'mcp-tool-result':{const {data:_0x702d57,attributes:_0x33d5d0}=JSON['parse'](_0x3577f4['content']);_0x51b46c['_handleToolResultData']({'toolName':_0x3577f4['toolName'],'data':_0x702d57,'attributes':_0x33d5d0});break;}}}}}async['_extractContextItems'](_0x499e73){const _0x2e622c=new Map();if(!_0x499e73['content'])return{'contextItems':_0x2e622c,'hasUnmatched':!0x1};const _0x39e6c4=this['_resolveEditors'](),{contextItem:_0x17354d,hasUnmatched:_0xaf630d}=await this['chatContext']['populateDocumentsFromMessage'](_0x499e73['content'],_0x39e6c4);_0x17354d&&_0x2e622c['set'](_0x17354d['id'],_0x17354d);for(const _0x5a8d1c of _0x499e73['content']){if('document'===_0x5a8d1c['type'])continue;const _0x3c79f0=await this['chatContext']['populateFromMessage'](_0x5a8d1c);_0x3c79f0&&_0x2e622c['set'](_0x3c79f0['id'],_0x3c79f0);}return{'contextItems':_0x2e622c,'hasUnmatched':_0xaf630d};}['_resolveEditors'](){return this['options']['getEditors']?this['options']['getEditors']():this['options']['getEditor']?[this['options']['getEditor']()]:[];}async['handleUserInteraction']({userMessage:_0x58bb9b,attributes:_0x2ac571}){if(!this['isStarted'])throw new at('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new at('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x4bc6a5=this['chatContext']['getPendingContextItems'](),_0x3f3cc8=this['chatCapabilities']['getCapabilitiesConfig'](),_0x5acc55=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x58bb9b,'contextItems':_0x4bc6a5,'capabilities':_0x3f3cc8,'modelId':_0x5acc55,'attributes':_0x2ac571}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x2d470d){if(_0x2d470d instanceof at)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x2d470d});else{const _0xeeabb=os['get'](_0x2d470d['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new at(_0xeeabb,null,{'error':_0x2d470d})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x594687,contextItems:_0x4d7751,capabilities:_0x394a5c,modelId:_0x4af9fc,attributes:_0x2822b7}){const _0x3885d5=new AIChatInteraction({'userMessage':_0x594687,'contextItems':_0x4d7751,'capabilities':_0x394a5c,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x4af9fc,'attributes':_0x2822b7});return _0x3885d5['delegate'](...rs)['to'](this),this['interactions']['push'](_0x3885d5),this['fire']('interactionCreated',_0x3885d5),_0x3885d5;}['getInteraction'](_0x9fd29d){return this['interactions']['find'](_0x304a13=>_0x304a13['id']===_0x9fd29d);}['removeInteraction'](_0x4408fc){const _0x4112ba=this['getInteraction'](_0x4408fc);_0x4112ba&&(_0x4112ba['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x4112ba),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['addCurrentDocumentToContext'](_0x1a2395){this['chatContext']['addCurrentDocumentToContext'](_0x1a2395);}async['updateCurrentDocumentInContext']({content:_0x360988,version:_0x4c4292,sessionId:_0xc89587,channelId:_0x2f2808,rootName:_0x65e936,selections:_0x91dce5}){await this['chatContext']['updateCurrentDocument'](_0x360988,_0x4c4292,_0xc89587,_0x2f2808,_0x65e936,_0x91dce5);}async['updateCurrentDocumentsInContext'](_0x49d83c){await this['chatContext']['updateCurrentDocuments'](_0x49d83c);}['getSourceByDataId'](_0x5429de){return this['chatContext']['getSourceByDataId'](_0x5429de);}['getDocumentContextSliceByDataId'](_0x5a2a86){return this['chatContext']['getDocumentContextSliceByDataId'](_0x5a2a86);}['getCurrentDocumentContext'](){return this['currentInteraction']?.['getDocumentContext']()?.['content']||'';}['addSelectionToContext'](_0x1456a7){this['chatContext']['addSelectionToContext'](_0x1456a7);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x5a3b7f){this['chatContext']['addFilesToContext'](_0x5a3b7f);}['addUrlToContext'](_0x206270){this['chatContext']['addUrlToContext'](_0x206270);}['addToolItemToContext'](_0x526ef2){this['chatContext']['addToolItemToContext'](_0x526ef2);}['addResourceToContext'](_0x10bd59,_0x3561b1){this['chatContext']['addResourceToContext'](_0x10bd59,_0x3561b1);}['loadSourceResources'](_0x3a1dbb,_0x3c3063,_0x2356e6){return this['chatContext']['loadSourceResources'](_0x3a1dbb,_0x3c3063,_0x2356e6);}['removeFromContext'](_0x379211){this['chatContext']['removeFromContext'](_0x379211);}['setWebSearch'](_0xde1991){this['chatCapabilities']['setWebSearch'](_0xde1991);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x4db229){this['chatCapabilities']['setReasoning'](_0x4db229);}['toggleReasoning'](){this['chatCapabilities']['toggleReasoning']();}['isCurrentDocumentInContext'](){return this['chatContext']['isCurrentDocumentInContext']();}['isCurrentDocumentInConversation'](){return this['chatContext']['isCurrentDocumentInConversation']();}['isSelectionInContext'](){return this['chatContext']['isSelectionInContext']();}async['setModel'](_0x2fec7d){_0x2fec7d?!0x1===await this['chatModels']['isAvailable'](_0x2fec7d)&&(gt('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x2fec7d}),_0x2fec7d=(await this['chatModels']['getAvailableModels']())[0x0]):(gt('ai-chat-conversation-set-model-null',{'conversation':this}),_0x2fec7d=(await this['chatModels']['getAvailableModels']())[0x0]),_0x2fec7d['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x2fec7d,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x2fec7d}));}}class AIModels extends Et(){['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x145880,config:_0x22f5a3,locale:_0x37688b}){super(),this['_connector']=_0x145880,this['_config']=_0x22f5a3,this['_locale']=_0x37688b;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get['_defaultModelId'](){return this['_config']?.['defaultModelId'];}async['getAll'](){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()),this['_modelsRequest'];}async['getAvailableModels'](){const _0xb56475=await this['getAll']();let _0x5074e1;return _0x5074e1=this['_availableModels']?this['_filterModels'](_0xb56475,this['_availableModels']):_0xb56475['filter'](_0xfb3981=>_0xfb3981['recommended']),_0x5074e1;}async['getModel'](_0x41ea13){const _0x4c31a9=await this['getAll']();if(!_0x4c31a9['length'])return null;if(_0x41ea13){const _0x29ef54=this['_getModelById'](_0x4c31a9,_0x41ea13);if(_0x29ef54)return _0x29ef54;gt('ai-chat-model-id-unrecognized',{'modelId':_0x41ea13,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x460d9f=await this['getAvailableModels']();if(!_0x460d9f['length'])return null;if(this['_defaultModelId']){const _0x6e377b=this['_getModelById'](_0x460d9f,this['_defaultModelId']);if(_0x6e377b)return _0x6e377b;gt('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x460d9f[0x0]['id']});}return _0x460d9f[0x0];}async['isAvailable'](_0x24c09c){return(await this['getAvailableModels']())['some'](_0x5803ad=>_0x5803ad['name']===_0x24c09c['name']&&_0x5803ad['provider']===_0x24c09c['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length'])try{const _0x4c60f2=this['_locale']['uiLanguage']||'en',_0x5e0bba=this['_connector']['getModels'](_0x4c60f2),_0x491cd0=await _0x5e0bba['list']();this['_modelList']=_0x491cd0['items']['map'](_0xe4e374=>cs(_0xe4e374)?{..._0xe4e374,'name':Hi(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0xe4e374);}catch(_0x5350d9){throw Ct('ai-models-unable-to-retrieve',{'error':_0x5350d9}),_0x5350d9;}return[...this['_modelList']];}['_filterModels'](_0x28f50a,_0x1b4660){let _0x37bdd1;if(_0x1b4660){_0x37bdd1=[];const _0x4341f5=new Set(),_0x4238ec='string'==typeof _0x1b4660?[_0x1b4660['toLocaleLowerCase']()]:_0x1b4660['map'](_0x3f78df=>_0x3f78df['toLocaleLowerCase']());for(const _0x120259 of _0x4238ec)for(const _0x10a7a3 of _0x28f50a)!_0x4341f5['has'](_0x10a7a3['id'])&&this['_isMatchingFilter'](_0x10a7a3,_0x120259)&&(_0x37bdd1['push'](_0x10a7a3),_0x4341f5['add'](_0x10a7a3['id']));}else _0x37bdd1=_0x28f50a;return _0x37bdd1;}['_isMatchingFilter'](_0x5e8e5e,_0x2fec14){const _0x5777b9=_0x5e8e5e['id']['toLocaleLowerCase'](),_0x354bff=_0x5e8e5e['name']['toLocaleLowerCase'](),_0x4e66e5=_0x5e8e5e['provider']['toLocaleLowerCase']();return _0x5777b9===_0x2fec14||_0x354bff===_0x2fec14||cs(_0x5e8e5e)&&'auto'===_0x2fec14||_0x4e66e5===_0x2fec14||_0x5777b9['startsWith'](_0x2fec14);}['_getModelById'](_0x35f176,_0x2d63de){return _0x35f176['find'](_0x42b3bb=>cs(_0x42b3bb)&&'auto'===_0x2d63de?_0x42b3bb:_0x42b3bb['id']===_0x2d63de)||null;}}function cs(_0x54bc38){return _0x54bc38['id']['startsWith']('agent');}function ls(_0xfa144a){return _0xfa144a?_0xfa144a instanceof _0xf823c1?[_0xfa144a]:_0xfa144a['editors']&&0x0!==_0xfa144a['editors']['length']?Array['from'](_0xfa144a['editors']):[]:[];}function us(_0x3a1850){const _0x35950f=ls(_0x3a1850);if(!_0x35950f['length'])throw new at('ai-get-editor-from-context-no-editor');if(0x1===_0x35950f['length'])return _0x35950f[0x0];const _0x25703a=_0x35950f['find'](_0x3b1b93=>_0x3b1b93['ui']?.['focusTracker']?.['isFocused']);if(_0x25703a)return _0x25703a;const _0x118f7c=function(_0x56f5b3){if(_0x56f5b3 instanceof _0xf823c1)return;const _0x52c94d=_0x56f5b3;if(!_0x52c94d['plugins']||!_0x52c94d['plugins']['has']('AIEditing'))return;const _0x1ef924=_0x52c94d['plugins']['get']('AIEditing');return _0x1ef924['getLastContentFocusedEditor']?.();}(_0x3a1850);return _0x118f7c&&_0x35950f['includes'](_0x118f7c)?_0x118f7c:_0x35950f[0x0];}function ds(_0xbadf7e){return us(_0xbadf7e);}function _s({editor:_0x86e6ce,interaction:_0x4d0c85,reply:_0x2f8a52,groups:_0x23f427,transform:_0x44df7b,documentCompare:_0x419116,documentCompareOptions:_0x18dd37,documentContextSlice:_0x2d776d}){const _0x3f289b=_0x4d0c85['getDocumentContext']();if(!_0x3f289b)return[];const _0x28105e=_0x2f8a52['documentContextContent']['cloneNode'](!0x0);for(const {changes:_0xefbb0f}of _0x23f427){const _0x368d8d=_0xefbb0f['filter'](_0x49542a=>'new'!=_0x49542a['type'])['map'](_0x2a1100=>Wi('data-id',_0x2a1100['id'],_0x28105e)),_0x55e6e0=_0xefbb0f['filter'](_0x3b840b=>'removed'!=_0x3b840b['type'])['map'](_0x45ef9e=>_0x45ef9e['node']['cloneNode'](!0x0));let _0x53f9d2=null;if(_0x368d8d['length']){_0x53f9d2=_0x368d8d[0x0]['previousSibling'];for(let _0x4bbfff=0x0;_0x4bbfff<_0x368d8d['length'];_0x4bbfff++)_0x3ac3c4(_0x368d8d[_0x4bbfff]);}if(_0x55e6e0['length']){_0x53f9d2||(_0xefbb0f[0x0]['anchorId']?_0x53f9d2=Wi('data-id',_0xefbb0f[0x0]['anchorId'],_0x28105e):(_0x53f9d2=_0x55e6e0['shift'](),_0x2b9809(_0x28105e,_0x53f9d2)));for(let _0x3cc26c=0x0;_0x3cc26c<_0x55e6e0['length'];_0x3cc26c++)_0x2a254f(_0x53f9d2,_0x55e6e0[_0x3cc26c]),_0x53f9d2=_0x55e6e0[_0x3cc26c];}}let _0x5f4a57,_0x2156b4,_0x329a2c,_0x324f93=_0x18dd37;if(_0x2d776d){_0x5f4a57=_0x2d776d['html'],_0x329a2c=_0x2d776d['version'],_0x324f93={..._0x18dd37,'anchor':_0x2d776d['rootName']};const _0x428eec=new _0x1ae976([]),_0x5ec204=_0x28105e['children'],_0xdd0d3a=_0x2f8a52['dataIdDocumentSources'],_0x449c7d=_0x2f8a52['newNodeAnchorIds'],_0x145a3e=_0x2d776d['editor'],_0x55fa55=_0x2d776d['rootName'],_0xd86b09=new Array(_0x5ec204['length']),_0x45ce6e=_0x57e6ca=>_0x57e6ca?_0x57e6ca['editor']===_0x145a3e&&_0x57e6ca['rootName']===_0x55fa55:void 0x0;for(let _0x526a77=0x0;_0x526a77<_0x5ec204['length'];_0x526a77++){const _0x47bd1e=$i(_0x5ec204[_0x526a77],'data-id');if(!_0x47bd1e)continue;const _0x15f0d3=_0x45ce6e(_0xdd0d3a?.['get'](_0x47bd1e));if(void 0x0!==_0x15f0d3){_0xd86b09[_0x526a77]=_0x15f0d3;continue;}const _0x1d7b47=_0x449c7d['get'](_0x47bd1e),_0xfd3dbb=_0x1d7b47?_0x45ce6e(_0xdd0d3a?.['get'](_0x1d7b47)):void 0x0;void 0x0!==_0xfd3dbb&&(_0xd86b09[_0x526a77]=_0xfd3dbb);}for(let _0x450339=0x0;_0x450339<_0x5ec204['length'];_0x450339++)if(void 0x0===_0xd86b09[_0x450339]){for(let _0x26af1d=_0x450339-0x1;_0x26af1d>=0x0;_0x26af1d--)if(void 0x0!==_0xd86b09[_0x26af1d]){_0xd86b09[_0x450339]=_0xd86b09[_0x26af1d];break;}if(void 0x0===_0xd86b09[_0x450339]){for(let _0x52f11f=_0x450339+0x1;_0x52f11f<_0x5ec204['length'];_0x52f11f++)if(void 0x0!==_0xd86b09[_0x52f11f]){_0xd86b09[_0x450339]=_0xd86b09[_0x52f11f];break;}}}for(let _0x58dd26=0x0;_0x58dd26<_0x5ec204['length'];_0x58dd26++)_0xd86b09[_0x58dd26]&&_0x428eec['children']['push'](_0x533652(_0x5ec204[_0x58dd26],!0x0));_0x2156b4=Ki(_0x428eec);}else _0x5f4a57=_0x3f289b['content'],_0x329a2c=_0x3f289b['version'],_0x2156b4=Ki(_0x28105e);const _0x33dc78=_0x419116['getDiff'](_0x5f4a57,_0x2156b4,{..._0x324f93,'targetEditor':_0x86e6ce})['getOperations']();if(_0x44df7b){const _0x4a8292=_0x86e6ce['model']['document']['history']['getOperations'](_0x329a2c),_0x322006={'document':_0x86e6ce['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};return _0x146ca3(_0x33dc78,_0x4a8292,_0x322006)['operationsA'];}return _0x33dc78;}function Is(_0x18404a,_0x215c96){if('marker'!=_0x215c96['type'])return;const _0x57667c=_0x18404a['model']['markers']['get'](_0x215c96['name']);_0x57667c&&(_0x215c96['oldRange']=_0x57667c['getRange']());}class AIChatController extends _0xaac0f5{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_aiChatBalloon'];['_activeBalloon'];['_wiredBalloons']=new Set();['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];static get['requires'](){return[AIConnector,_0x2ef109];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_bodyCollection']=new Qt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_aiChatModels']=new AIModels({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x22dcb6=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x4e9425,_0x3941ae)=>{this['_handleUIUserMessage']({'message':_0x3941ae});}),this['listenTo'](_0x22dcb6['view'],'change:activeTab',(_0x51b026,_0x954c33,_0x2e7da3)=>{'chat'!==_0x2e7da3&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',async()=>{await this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x44cd2c,_0x387b1b)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x387b1b));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0xb98080,_0x1aa1f6)=>{this['activeConversation']?.['addUrlToContext'](_0x1aa1f6);}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x157112,_0x10db11)=>{_0x10db11['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x1c857d,_0x320f91)=>{this['activeConversation']?.['addResourceToContext'](_0x320f91['source'],_0x320f91['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x4ad93e,_0xeca52)=>{this['_removeFromContext'](_0xeca52);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x5773f3,_0x2b4f3f)=>{this['activeConversation']?.['loadSourceResources'](_0x2b4f3f['sourceId'],_0x2b4f3f['query'],_0x2b4f3f['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x44659c,_0x38194c)=>{this['activeConversation']?.['setModel'](_0x38194c);}),this['listenTo'](this['_aiChatUi'],'like',(_0x3f5c18,{replyId:_0x40ebe2})=>{console['log']('Liked\x20response',_0x40ebe2);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x475768,{replyId:_0x4493d6})=>{console['log']('Disliked\x20response',_0x4493d6);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0xc8295b,_0x2f3e3d)=>{this['_insertSuggestion'](_0x2f3e3d);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x3f6ee1,{replyId:_0x14e4e3,partIndex:_0x5bf923})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x14e4e3,_0x5bf923);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0xdebcde,{replyId:_0x10724a,partIndex:_0x886d7})=>{const _0x482075=this['_getDocumentRangeForReplyChanges'](_0x10724a,_0x886d7);_0x482075&&'$graveyard'!=_0x482075['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'ranges':[_0x482075['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x21a6bf,_0x3bbaa6)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x3bbaa6);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x5986b9,{replyId:_0x41e235,showDiff:_0x346749})=>{const {reply:_0x255623}=this['getInteractionAndReplyById'](_0x41e235),_0x50aa03=_0x255623['getContentParts']({'showDiff':_0x346749,'editor':ds(this['context'])});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x255623['id'],'parts':_0x50aa03});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x5ad668,{replyId:_0x3c196f,partIndex:_0xcbf228})=>{this['_rejectSuggestion']({'replyId':_0x3c196f,'partIndex':_0xcbf228}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['context']['plugins']['has']('AIChatBalloon')&&(this['_aiChatBalloon']=this['context']['plugins']['get']('AIChatBalloon')),this['on']('interactionCreated',(_0x5dddda,_0x36c797)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x36c797);}),this['on']('replyCreated',(_0x4b45e1,_0x44e951)=>{this['_addFeedItemReply'](_0x44e951);});}async['afterInit'](){this['context']instanceof _0xf823c1?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x46c00d,_0x30e98c)=>{_0x30e98c['on']('ready',()=>{this['_integrateEditor'](_0x30e98c);});});const _0x2b082c=this['context']['config']['get']('ai.chat.initialConversation');let _0x4b2d8f=_0x2b082c;if('lastCreated'!=_0x2b082c||(_0x4b2d8f=await this['_getLastCreatedConversationId'](),_0x4b2d8f))return'new'==_0x4b2d8f?this['_startConversationSafely']():this['loadConversation'](_0x4b2d8f);}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x4d966e){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null,(this['context']['plugins']['get'](AITabs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),await this['_stopLastInteraction']());try{await this['_aiConnector']['fetchConversation'](_0x4d966e)['getConversation'](),await this['_startConversationSafely']({'id':_0x4d966e}),this['_updateConversationTitle']('\x20'),await this['activeConversation']['load'](_0x4d966e,this['_aiEditing']['sessionId']),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x1763c3){this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x4d966e}),this['_logError'](new at('ai-chat-conversation-not-found',this,{'error':_0x1763c3}));}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x2d9916){let _0x3eace8=null,_0x52bda8=null;this['on']('toolDataReceived',(_0x4829ba,_0x439fca,_0x3cde94)=>{_0x3cde94['id']!==_0x3eace8&&(_0x3eace8=_0x3cde94['id'],_0x52bda8=this['_getAIChatFeedAPI'](_0x3cde94)),_0x2d9916(_0x439fca,_0x52bda8);});}['addCurrentDocumentToChatContext'](){this['activeConversation']?.['addCurrentDocumentToContext'](Hi(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](){const _0x243e36=this['_aiEditing']['getSelectionText']();this['activeConversation']?.['addSelectionToContext'](_0x243e36),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x45616c){await this['_startConversationSafely']({'modelId':_0x45616c?.['modelId']});}async['sendMessage'](_0x426ee1){await this['_handleUIUserMessage'](_0x426ee1);}['getGroupId'](){const _0xc57fec=this['context']['config']['get']('collaboration.channelId');if(!_0xc57fec)throw new at('ai-missing-channel-id',this);return _0xc57fec;}['_handleRemovedConversation'](_0x55373d){this['activeConversation']['id']===_0x55373d&&this['_startConversationSafely']();}['_insertSuggestion'](_0x1637b8){const _0x123d61=this['context']['plugins']['get']('DocumentCompare'),{reply:_0x45be82,interaction:_0xe32b01}=this['getInteractionAndReplyById'](_0x1637b8['replyId']),_0x386386=void 0x0!==_0x1637b8['partIndex']?[_0x45be82['changeGroups'][_0x1637b8['partIndex']]]:_0x45be82['changeGroups']['filter'](_0x2b2af6=>'pending'==_0x2b2af6['state']);for(const _0x2a9f83 of this['_groupChangesByTarget'](_0x45be82,_0x386386)){const {target:_0x4fe29f,groups:_0x5820f7,groupsIndexes:_0x888501,slice:_0x4105d9}=_0x2a9f83;if(!_0x4fe29f['editor']['plugins']['has']('TrackChanges'))throw new at('ai-no-track-changes',null);const _0x7b07f0=this['_getDocumentRangeForReplyChanges'](_0x1637b8['replyId'],_0x888501[0x0]);if(!_0x7b07f0||'$graveyard'==_0x7b07f0['range']['root']['rootName']){_0x888501['forEach'](_0x5a38e4=>_0x45be82['setChangeGroupState'](_0x5a38e4,'outdated'));continue;}_0x888501['forEach'](_0x4138f2=>_0x45be82['setChangeGroupState'](_0x4138f2,'accepted'));const _0x5f3090=_s({'editor':_0x4fe29f['editor'],'reply':_0x45be82,'interaction':_0xe32b01,'groups':_0x5820f7,'transform':!0x0,'documentCompare':_0x123d61,'documentCompareOptions':{'anchor':_0x4105d9?.['rootName']??'main','markDeletions':!0x0},'documentContextSlice':_0x4105d9});let _0x1d672b;this['_scrollToSuggestionRange'](_0x7b07f0['range'],!0x1,_0x4fe29f['editor']),_0x4fe29f['editor']['model']['change'](_0x120f30=>{_0x1d672b=_0x120f30['batch'],_0x4fe29f['editor']['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x5f3090),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x1d672b,{'interactionId':_0xe32b01['id'],'replyId':_0x45be82['id'],'indexes':_0x888501['slice']()});}this['_updateRatings'](_0x45be82);}['_applySuggestion'](_0x3d43b9){const _0x5b8ee5=this['context']['plugins']['get'](_0x2ef109),{reply:_0x185bbd,interaction:_0x5832b7}=this['getInteractionAndReplyById'](_0x3d43b9['replyId']),_0x569243=void 0x0!==_0x3d43b9['partIndex']?[_0x185bbd['changeGroups'][_0x3d43b9['partIndex']]]:_0x185bbd['changeGroups']['filter'](_0x4338a2=>'pending'==_0x4338a2['state']);for(const _0x101011 of this['_groupChangesByTarget'](_0x185bbd,_0x569243)){const {target:_0x138fc3,groups:_0x5d34be,groupsIndexes:_0x13232d,slice:_0x5ccabe}=_0x101011,_0x18a63e=this['_getDocumentRangeForReplyChanges'](_0x3d43b9['replyId'],_0x13232d[0x0]);if(!_0x18a63e||'$graveyard'==_0x18a63e['range']['root']['rootName']){_0x13232d['forEach'](_0x351671=>_0x185bbd['setChangeGroupState'](_0x351671,'outdated'));continue;}_0x13232d['forEach'](_0x9fa492=>_0x185bbd['setChangeGroupState'](_0x9fa492,'accepted'));const _0x33cd32=_s({'editor':_0x138fc3['editor'],'reply':_0x185bbd,'interaction':_0x5832b7,'groups':_0x5d34be,'transform':!0x0,'documentCompare':_0x5b8ee5,'documentCompareOptions':{'anchor':_0x5ccabe?.['rootName']??'main','markDeletions':!0x1},'documentContextSlice':_0x5ccabe});let _0x41cb35;this['_scrollToSuggestionRange'](_0x18a63e['range'],!0x1,_0x138fc3['editor']),_0x138fc3['editor']['model']['change'](_0x4ce4d0=>{_0x41cb35=_0x4ce4d0['batch'];for(const _0x50dd1e of _0x33cd32)_0x50dd1e['baseVersion']=_0x138fc3['editor']['model']['document']['version'],Is(_0x138fc3['editor'],_0x50dd1e),_0x4ce4d0['batch']['addOperation'](_0x50dd1e),_0x138fc3['editor']['model']['applyOperation'](_0x50dd1e);}),this['_batchToChanges']['set'](_0x41cb35,{'interactionId':_0x5832b7['id'],'replyId':_0x185bbd['id'],'indexes':_0x13232d['slice']()});}this['_updateRatings'](_0x185bbd);}['_rejectSuggestion'](_0x5baee2){const {reply:_0x25bb69}=this['getInteractionAndReplyById'](_0x5baee2['replyId']);_0x25bb69['setChangeGroupState'](_0x5baee2['partIndex'],'rejected');}['_openBalloonFor'](_0x2c501b,_0x25165b){if(!this['_aiChatBalloon'])return;const {reply:_0x31869b}=this['getInteractionAndReplyById'](_0x2c501b),_0x426578=_0x31869b['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'editor':ds(this['context'])});let _0x1f4856,_0xb6c084;if(void 0x0!==_0x25165b?(_0xb6c084=_0x426578['find'](_0x2a6f18=>_0x2a6f18['index']==_0x25165b),_0x1f4856=_0xb6c084?.['index']):(_0xb6c084=_0x426578[0x0],_0x1f4856=_0xb6c084['index']),this['_currentPreviewedChangeGroup']?.['replyId']==_0x2c501b&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x1f4856)return;const _0x10567c=this['_getUserPresentableContentPartDocumentRange'](_0x2c501b,_0x31869b,_0xb6c084),_0x1dc297=_0x31869b['changeGroups']['find'](_0x58157=>_0x58157['index']==_0x1f4856),_0x2437ec=_0x1dc297?this['_resolveGroupTarget'](_0x31869b,_0x1dc297):null,_0x13106b=_0x2437ec?.['editor']??ds(this['context']),_0x16c36c=_0x13106b['plugins']['has']('AIChatBalloon')?_0x13106b['plugins']['get']('AIChatBalloon'):this['_aiChatBalloon'];if(this['_activeBalloon']&&this['_activeBalloon']!==_0x16c36c&&this['_activeBalloon']['close'](),!_0x10567c)return _0x16c36c['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x16c36c,this['_currentPreviewedChangeGroup']={'replyId':_0x2c501b,'partIndex':_0x1f4856},this['_scrollToSuggestionRange'](_0x10567c,!0x0,_0x13106b);const _0x591bba=this['_getPresentableSiblingContentPartIndex'](_0x2c501b,_0x1f4856,'next');_0x16c36c['updateContent']({'part':_0xb6c084,'renderingStrategy':'static'}),_0x16c36c['open']({'index':_0x1f4856,'title':Hi(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x1f4856+0x1)['toString']()),'showRotator':null!==_0x591bba,'ranges':[_0x10567c],'areActionsDisabled':_0x31869b['areActionsDisabled'],'targetEditor':_0x13106b}),_0x16c36c['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x2c501b,_0x1f4856),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x2c501b,'index':_0x1f4856,'isActive':!0x0});}['_getPresentableSiblingContentPartIndex'](_0x47e969,_0x43b262,_0x3c7500){const {reply:_0x39ce9f}=this['getInteractionAndReplyById'](_0x47e969),_0xe7939b=_0x39ce9f['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'editor':ds(this['context'])});if(0x1==_0xe7939b['length'])return null;const _0x537624=_0xe7939b['findIndex'](_0x17aae4=>_0x17aae4['index']==_0x43b262),_0x4933ac='next'==_0x3c7500?0x1:-0x1;let _0x426660=_0xe7939b['at']((_0x537624+_0x4933ac)%_0xe7939b['length'])['index'],_0x4f3e3c=_0xe7939b[_0x426660];for(;!this['_getUserPresentableContentPartDocumentRange'](_0x47e969,_0x39ce9f,_0x4f3e3c);){if(_0x426660=_0xe7939b['at']((_0x426660+_0x4933ac)%_0xe7939b['length'])['index'],_0x426660===_0x537624)return null;_0x4f3e3c=_0xe7939b[_0x426660];}return _0x426660;}['_getUserPresentableContentPartDocumentRange'](_0x2b715b,_0x1cc681,_0x1e2d2c){const _0x2b6e0f=_0x1cc681['changeGroups'];if(!_0x1e2d2c['hasChanges'])return null;const _0x3a516e=_0x2b6e0f['find'](_0x4f6600=>_0x4f6600['index']==_0x1e2d2c['index']);if('pending'!==_0x3a516e?.['state'])return null;const _0x72a6a8=this['_getDocumentRangeForReplyChanges'](_0x2b715b,_0x1e2d2c['index']);if(!_0x72a6a8)return _0x1cc681['setChangeGroupState'](_0x1e2d2c['index'],'outdated'),null;const {range:_0x1597e1,currentIndex:_0x3a9952}=_0x72a6a8;return'$graveyard'==_0x1597e1['root']['rootName']?(_0x1cc681['setChangeGroupState'](_0x3a9952,'outdated'),null):_0x72a6a8['range'];}['_getDocumentRangeForReplyChanges'](_0x3327cd,_0x28bdd8){const {reply:_0x5e5723}=this['getInteractionAndReplyById'](_0x3327cd),_0x54de46=_0x5e5723['changeGroups']['filter'](_0x483558=>'pending'==_0x483558['state']),_0x59716c=_0x54de46['map'](_0x2ab50e=>_0x5e5723['changeGroups']['indexOf'](_0x2ab50e));void 0x0===_0x28bdd8&&(_0x28bdd8=_0x59716c[0x0]);const _0x3c6825=_0x59716c['indexOf'](_0x28bdd8);if(-0x1==_0x3c6825)return null;const _0x54961b=_0x54de46[_0x3c6825],_0x39edfc=this['_resolveGroupTarget'](_0x5e5723,_0x54961b);if(!_0x39edfc)return null;const {editor:_0x100ac4,root:_0x3b2a44,parsedDocumentContent:_0x605c09,serializedDocumentContent:_0x366b18,version:_0x3aefab}=_0x39edfc,_0x3d7111=new _0x1ae976([]),_0x329348=new _0x1ae976([]);for(const _0x1277ee of _0x54961b['changes']){const _0x2b7915=this['activeConversation']?.['getSourceByDataId'](_0x1277ee['id']);if((!_0x2b7915||_0x2b7915['editor']===_0x39edfc['editor']&&_0x2b7915['rootName']===_0x39edfc['root']['rootName'])&&('removed'!=_0x1277ee['type']&&_0x329348['children']['push'](_0x1277ee['node']['cloneNode'](!0x0)),'new'!=_0x1277ee['type'])){const _0x22c1cf=_0x173efb(_0x19a9b0=>$i(_0x19a9b0,'data-id')==_0x1277ee['id'],_0x605c09,!0x0);if(!_0x22c1cf)return null;_0x3d7111['children']['push'](_0x22c1cf['cloneNode'](!0x0));}}if(0x0==_0x3d7111['children']['length']){if(_0x54961b['changes'][0x0]['anchorId']){const _0x272a04=Wi('data-id',_0x54961b['changes'][0x0]['anchorId'],_0x605c09);_0x3d7111['children']['unshift'](_0x272a04['cloneNode'](!0x0)),_0x329348['children']['unshift'](_0x272a04['cloneNode'](!0x0)),_0x272a04['nextSibling']&&(_0x3d7111['children']['push'](_0x272a04['nextSibling']['cloneNode'](!0x0)),_0x329348['children']['push'](_0x272a04['nextSibling']['cloneNode'](!0x0)));}else{const _0x58f776=_0x605c09['children'][0x0];if(!_0x58f776)return null;_0x3d7111['children']['push'](_0x58f776['cloneNode'](!0x0)),_0x329348['children']['push'](_0x58f776['cloneNode'](!0x0));}}const _0x161138=_0x100ac4['data']['parse'](_0x366b18),_0x24cae7=Ki(_0x3d7111),_0x3e1fbd=_0x100ac4['data']['parse'](_0x24cae7),_0xe794aa=_0x100ac4['data']['parse'](_0x24cae7),_0x40b100=_0x100ac4['model']['createPositionAt'](_0x3e1fbd,0x0),_0x48f233=Ki(_0x329348),_0x4c7a38={'targetEditor':_0x100ac4,'anchor':_0x40b100,'markDeletions':!0x1},_0x523e3c=_0x100ac4['plugins']['get'](_0x2ef109)['getDiff'](_0x24cae7,_0x48f233,_0x4c7a38)['getOperations']();if(!_0x523e3c['length'])return null;_0x100ac4['model']['change'](_0x3fa025=>{for(const _0x27c088 of _0x523e3c)if('remove'==_0x27c088['type']){const _0x7a79ff=_0x27c088['sourcePosition'],_0x20c49d=_0x27c088['howMany'],_0x2b6010=new _0x21f6d9(_0x7a79ff,_0x20c49d);_0x3fa025['batch']['addOperation'](_0x2b6010),_0x100ac4['model']['applyOperation'](_0x2b6010);}else'marker'!==_0x27c088['type']&&(_0x27c088['baseVersion']=null,_0x27c088['isDocumentOperation']=!0x1,_0x3fa025['batch']['addOperation'](_0x27c088),_0x100ac4['model']['applyOperation'](_0x27c088));});const _0x4d7bcf=es(_0x100ac4,_0x523e3c,_0x3e1fbd);is(_0x100ac4['model'],_0x4d7bcf);const _0x403a2d=_0x4d7bcf['getFirstRange']()['start']['path']['slice'](),_0x52b339=_0x4d7bcf['getFirstRange']()['end']['path']['slice'](),_0x5489a5=[];let _0x4a51a2=_0x3e1fbd,_0x815a83=_0xe794aa;for(let _0x4809ba=0x0;_0x4809ba<_0x52b339['length'];_0x4809ba++){const _0x15f981=_0x4a51a2['maxOffset']-_0x52b339[_0x4809ba];_0x5489a5[_0x4809ba]=_0x815a83['maxOffset']-_0x15f981,_0x4a51a2=_0x4a51a2['getChildAtOffset'](_0x52b339[_0x4809ba]),_0x815a83=_0x815a83['getChildAtOffset'](_0x5489a5[_0x4809ba]);}const _0x252f6e=_0x100ac4['model']['createRange'](_0x100ac4['model']['createPositionFromPath'](_0xe794aa,_0x403a2d),_0x100ac4['model']['createPositionFromPath'](_0xe794aa,_0x5489a5)),_0x1032e1=_0xe794aa['getChild'](0x0)['getAttribute'](_0x54ef8f),_0x573a1f=Array['from'](_0x161138['getChildren']())['find'](_0x1af84c=>_0x1af84c['getAttribute'](_0x54ef8f)==_0x1032e1)['getPath'](),_0x3ae43d=_0x252f6e['start']['path']['slice'](),_0x2409dd=_0x252f6e['end']['path']['slice']();_0x3ae43d[0x0]=_0x573a1f[0x0]+_0x3ae43d[0x0],_0x2409dd[0x0]=_0x573a1f[0x0]+_0x2409dd[0x0];let _0x1b1460=_0x100ac4['model']['createRange'](_0x100ac4['model']['createPositionFromPath'](_0x3b2a44,_0x3ae43d),_0x100ac4['model']['createPositionFromPath'](_0x3b2a44,_0x2409dd));const _0x4fee5d=_0x100ac4['model']['document']['history']['getOperations'](_0x3aefab);for(const _0x548007 of _0x4fee5d)_0x1b1460=_0x5e3e59['_createFromRanges'](_0x1b1460['getTransformedByOperation'](_0x548007));return{'range':_0x1b1460,'currentIndex':_0x28bdd8};}['_integrateEditorBalloon'](_0x46308d){if(!_0x46308d['plugins']['has']('AIChatBalloon'))return;const _0x2992c4=_0x46308d['plugins']['get']('AIChatBalloon');this['_wiredBalloons']['has'](_0x2992c4)||(this['_wiredBalloons']['add'](_0x2992c4),this['_aiChatBalloon']||(this['_aiChatBalloon']=_0x2992c4),_0x2992c4['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x2992c4,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x4c8aae,partIndex:_0x1c7511}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x26b28f}=this['getInteractionAndReplyById'](_0x4c8aae),_0x478b36=_0x26b28f['changeGroups']['find'](_0x435cd3=>_0x435cd3['index']===_0x1c7511),_0x3e6740=_0x478b36?this['_resolveGroupTarget'](_0x26b28f,_0x478b36):null,_0x4a37e2=_0x26b28f['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x1c7511,'editor':_0x3e6740?.['editor']??ds(this['context'])});(this['_activeBalloon']??_0x2992c4)['updateContent']({'part':_0x4a37e2[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x2992c4,'applySuggestion',()=>{const {replyId:_0x3c584d,partIndex:_0x5a5dd9}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x3c584d,'partIndex':_0x5a5dd9}),(this['_activeBalloon']??_0x2992c4)['setState']('accepted');}),this['listenTo'](_0x2992c4,'insertSuggestion',()=>{const {replyId:_0x407e86,partIndex:_0x10390c}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x407e86,'partIndex':_0x10390c}),(this['_activeBalloon']??_0x2992c4)['setState']('accepted');}),this['listenTo'](_0x2992c4,'rejectSuggestion',()=>{const {replyId:_0x55443a,partIndex:_0x4d7f6a}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x55443a,'partIndex':_0x4d7f6a}),(this['_activeBalloon']??_0x2992c4)['setState']('rejected');}),this['listenTo'](_0x2992c4,'showNext',()=>{const {replyId:_0xf2f19,partIndex:_0x10ddcf}=this['_currentPreviewedChangeGroup'],_0x3e9f99=this['_getPresentableSiblingContentPartIndex'](_0xf2f19,_0x10ddcf,'next');null!==_0x3e9f99&&this['_openBalloonFor'](_0xf2f19,_0x3e9f99);}),this['listenTo'](_0x2992c4,'showPrevious',()=>{const {replyId:_0x3c9ef1,partIndex:_0x175589}=this['_currentPreviewedChangeGroup'],_0x2990c8=this['_getPresentableSiblingContentPartIndex'](_0x3c9ef1,_0x175589,'previous');null!==_0x2990c8&&this['_openBalloonFor'](_0x3c9ef1,_0x2990c8);}),this['listenTo'](_0x2992c4,'dialogClosed',(_0x151d1e,{id:_0x393043})=>{if('aiChatBalloon'!==_0x393043)return;const {replyId:_0xa30c01,partIndex:_0x36f255}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0xa30c01,'index':_0x36f255,'isActive':!0x1}),this['_activeBalloon']===_0x2992c4&&(this['_activeBalloon']=void 0x0);}));}['_integrateEditor'](_0x4178e1){if(this['_integrateEditorBalloon'](_0x4178e1),_0x4178e1['plugins']['has']('Undo')){const _0x237be3=_0x4178e1['commands']['get']('undo'),_0x375f47=_0x4178e1['commands']['get']('redo');this['listenTo'](_0x237be3,'revert',(_0x1f11ff,_0x55e85a,_0x5265a4)=>{const _0x24994f=this['_batchToChanges']['get'](_0x55e85a);if(!_0x24994f)return;const _0x46b48f=this['activeConversation']['getInteraction'](_0x24994f['interactionId']),_0x3625aa=_0x46b48f?.['getReply'](_0x24994f['replyId']);this['_batchToChanges']['delete'](_0x55e85a),_0x46b48f&&_0x3625aa&&(_0x24994f['indexes']['forEach'](_0x4a83b3=>_0x3625aa['setChangeGroupState'](_0x4a83b3,'pending')),this['_batchToChanges']['set'](_0x5265a4,_0x24994f));}),this['listenTo'](_0x375f47,'revert',(_0x3cb2ea,_0x255cb5,_0x561bf0)=>{const _0x348023=this['_batchToChanges']['get'](_0x255cb5);if(!_0x348023)return;const _0x37a153=this['activeConversation']['getInteraction'](_0x348023['interactionId']),_0x5d17a5=_0x37a153?.['getReply'](_0x348023['replyId']);this['_batchToChanges']['delete'](_0x255cb5),_0x37a153&&_0x5d17a5&&(_0x348023['indexes']['forEach'](_0x40bbe6=>_0x5d17a5['setChangeGroupState'](_0x40bbe6,'accepted')),this['_batchToChanges']['set'](_0x561bf0,_0x348023));});}const _0x237244=_0x4178e1['config']['get']('ai.chat.context');_0x237244['alwaysAddSelection']&&_0x237244['document']['enabled']&&this['listenTo'](_0x4178e1['model']['document']['selection'],'change:range',(_0x49010f,_0x3d90cb)=>{if(!_0x3d90cb['directChange'])return;'chat'===_0x4178e1['plugins']['get']('AITabs')['view']['activeTab']&&(_0x4178e1['model']['hasContent'](_0x4178e1['model']['document']['selection'])?this['addSelectionToChatContext']():this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x54fa62=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x25af20=await _0x54fa62['getConversations']();return _0x25af20['length']?_0x25af20[0x0]['id']:'new';}catch(_0x397098){return this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':ot()}),this['_logError'](new at('ai-chat-conversation-init-failed',this,{'error':_0x397098})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x2a9c00={}){try{this['_aiChatUi']['enableControls'](),await this['_handleStartConversation'](_0x2a9c00);}catch(_0x2ea5fc){this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x2a9c00['id']||ot()}),console['error'](_0x2ea5fc),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x352b8f,modelId:_0x1466e4}={}){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;let _0x3a712f=_0x1466e4;_0x3a712f||(_0x352b8f||!this['activeConversation']?_0x3a712f=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x3a712f=this['activeConversation']['selectedModel']['id'])),await this['_stopLastInteraction']();const _0x445cd7=this['getGroupId'](),_0x2024c5=_0x352b8f||ot();let _0x1b2a85;this['activeConversation']=new AIChatConversation({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x3a712f,'conversationId':_0x2024c5,'group':_0x445cd7,'getEditor':()=>ds(this['context']),'getEditors':()=>ls(this['context']),'locale':this['context']['locale'],'isFromHistory':!!_0x352b8f}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['activeConversation']['on']('conversationInitialized',(_0x34d6fc,_0x20636b)=>{this['_aiChatUi']['createConversation'](_0x20636b),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x352b8f||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['activeConversation']['on']('uploadProgressChanged',(_0x10a16d,_0x6f24cf)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x6f24cf['isUploadInProgress']);}),this['activeConversation']['on']('webSearchStarted',()=>{const _0x1b0000=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x1b0000);}),this['activeConversation']['on']('reasoningStarted',()=>{const _0x2ca6d8=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x2ca6d8);}),this['activeConversation']['on']('webSearchFinished',(_0x35b41b,_0x99845e)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x99845e,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['activeConversation']['on']('reasoningFinished',(_0x20a99b,_0x15c89d)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x15c89d,{'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});}),this['activeConversation']['on']('interactionStarted',()=>{this['_aiChatUi']['startInteraction']();}),this['activeConversation']['on']('interactionFinished',async()=>{this['_updateReplyContentThrottled']['flush'](),await this['_aiChatUi']['finishInteraction']();}),this['activeConversation']['on']('interactionDestroyed',(_0x709b79,_0x155fff)=>{this['_aiChatUi']['removeFeedInteraction'](_0x155fff['id']);}),this['activeConversation']['on']('setConversationTitle',(_0x18779c,_0x47cd8f,_0x330716)=>{this['_updateConversationTitle'](_0x47cd8f,_0x330716);}),this['activeConversation']['on']('replyContentUpdated',async(_0x37f7a3,_0x12a609)=>{void 0x0!==_0x1b2a85&&_0x1b2a85!==_0x12a609['id']&&this['_updateReplyContentThrottled']['flush'](),_0x1b2a85=_0x12a609['id'],_0x12a609['isFromHistory']?await this['_updateReplyContent']({'reply':_0x12a609}):await this['_updateReplyContentThrottled']({'reply':_0x12a609});}),this['activeConversation']['on']('replyChangeGroupStateUpdated',(_0x439445,{reply:_0x5addb7,index:_0x535bd4,state:_0x4b8173})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x5addb7['id'],'index':_0x535bd4,'state':_0x4b8173}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x5addb7['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x535bd4&&(this['_activeBalloon']??this['_aiChatBalloon'])?.['setState'](_0x4b8173);}),this['activeConversation']['on']('contextItemAdded',(_0x30d239,_0x361a4e)=>{if(this['_aiChatUi']['addContextItem'](_0x361a4e['contextItem'],_0x361a4e['isLoading']),'selection'===_0x361a4e['contextItem']['type']){const _0x2ad503=[...ds(this['context'])['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'ranges':_0x2ad503,'id':'context','priority':0x1});}}),this['activeConversation']['on']('contextItemRemoved',(_0x563082,_0x483db1)=>{this['_aiChatUi']['removeContextItem'](_0x483db1['uiId']),'current-document'==_0x483db1['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x483db1['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['activeConversation']['on']('contextItemLoadingEnded',(_0x25674a,_0x3340be)=>{this['_aiChatUi']['setContextItemLoading'](_0x3340be['contextItem']['uiId'],_0x3340be['isLoading']);}),this['activeConversation']['on']('contextSent',(_0xdc3f4a,_0x3e9e7d)=>{this['_aiChatUi']['setConversationContext'](_0x3e9e7d['contextItems']);}),this['activeConversation']['on']('addContextOptionsChanged',(_0x347ea5,_0x3d49e3)=>{this['_aiChatUi']['setAddContextOptions'](_0x3d49e3['options']);}),this['activeConversation']['on']('sourceResourcesLoaded',(_0x3656f7,_0xefc656)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0xefc656['sourceId'],_0xefc656['source'],_0xefc656['resources'],_0xefc656['uid']);}),this['activeConversation']['on']('resourceStateChanged',(_0x219f2c,_0x4ba313)=>{this['_aiChatUi']['updateResourceState'](_0x4ba313['sourceId'],_0x4ba313['resourceId'],_0x4ba313['isInContext']);}),this['activeConversation']['on']('capabilitiesUpdated',(_0x582ab1,_0x1df995)=>{this['_aiChatUi']['updateCapabilities'](_0x1df995);}),this['activeConversation']['on']('modelSelected',async(_0x6cf821,_0x448e9c)=>{const _0x285891=(await this['_aiChatModels']['getAll']())['find'](_0x35993a=>_0x35993a['id']===_0x448e9c['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x285891,_0x448e9c['isDisabled']);}),this['activeConversation']['on']('error',(_0x5b15d0,{error:_0x56ea6c,interactionId:_0x38d679,fileName:_0x44dc32,url:_0x29cb15,sourceId:_0x19d3cd,sourceLabel:_0x3e7c86})=>{const _0x3a9bc2=_0x38d679?_0x38d679+':'+ot():ot();_0x56ea6c['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Hi(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x3a9bc2}):_0x56ea6c['message']['startsWith']('ai-chat-conversation-init-failed')||_0x56ea6c['message']['startsWith']('ai-chat-conversation-start-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x3a9bc2}),this['_logError'](_0x56ea6c)):_0x56ea6c['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x44dc32),'id':_0x3a9bc2}):_0x56ea6c['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x29cb15),'id':_0x3a9bc2}):_0x56ea6c['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x3a9bc2}):_0x56ea6c['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x3a9bc2}):_0x56ea6c['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x19d3cd&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x19d3cd),this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x3e7c86||'source'),'id':_0x3a9bc2}),this['_logError'](_0x56ea6c)):_0x56ea6c['message']['startsWith']('ai-chat-resource-load-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x3a9bc2}),this['_logError'](_0x56ea6c)):_0x56ea6c['message']['startsWith']('ai-chat-invalid-request')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x3a9bc2}),this['_logError'](_0x56ea6c)):_0x56ea6c['message']['startsWith']('ai-chat-context-unsupported-file-type')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x3a9bc2}),this['_logError'](_0x56ea6c)):_0x56ea6c['message']['startsWith']('ai-chat-context-file-too-large')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x3a9bc2}),this['_logError'](_0x56ea6c)):_0x56ea6c['message']['startsWith']('ai-chat-context-file-too-many-pages')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x3a9bc2}),this['_logError'](_0x56ea6c)):_0x56ea6c['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x3a9bc2}),this['_logError'](_0x56ea6c)):(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x3a9bc2}),this['_logError'](_0x56ea6c));}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x352b8f||await this['activeConversation']['start']();}async['_handleUIUserMessage']({message:_0x2d3bce,attributes:_0x28b001}){if(!this['activeConversation'])throw new at('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x3c4da4=await this['_aiEditing']['getDocumentData']();_0x3c4da4['length']>0x1?await this['activeConversation']['updateCurrentDocumentsInContext'](_0x3c4da4):await this['activeConversation']['updateCurrentDocumentInContext'](_0x3c4da4[0x0]);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x2d3bce,'attributes':_0x28b001});}['_logError'](_0x5a313a){Ct(_0x5a313a['message']);}['_removeFromContext'](_0x56b44d){this['activeConversation']?.['removeFromContext'](_0x56b44d);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x3f11f5){const [_0x524828,_0x69a700]=_0x3f11f5['split'](':'),_0x5ebf87=this['activeConversation']['getInteraction'](_0x524828),_0x5baddc=_0x5ebf87['getReply'](_0x69a700);return{'interaction':_0x5ebf87,'reply':_0x5baddc};}['_resolveGroupTarget'](_0x27a073,_0x439bed){const _0x30032a=[..._0x439bed['changes']['filter'](_0x204612=>'context'!==_0x204612['type']),..._0x439bed['changes']['filter'](_0x159b0b=>'context'===_0x159b0b['type'])];for(const _0x40b378 of _0x30032a){const _0x2bf560=_0x27a073['newNodeAnchorIds']['get'](_0x40b378['id']),_0x42f873=this['activeConversation']?.['getSourceByDataId'](_0x40b378['id'])||this['activeConversation']?.['getSourceByDataId'](_0x2bf560)||this['activeConversation']?.['getSourceByDataId'](_0x40b378['anchorId']??void 0x0);if(_0x42f873){if('destroyed'===_0x42f873['editor']['state'])return null;const _0xc22817=_0x42f873['editor']['model']['document']['getRoot'](_0x42f873['rootName']);return _0xc22817?{'editor':_0x42f873['editor'],'root':_0xc22817,'parsedDocumentContent':Fi(_0x42f873['content']),'serializedDocumentContent':_0x42f873['content'],'version':_0x42f873['version']}:null;}}const _0x1392bc=ds(this['context']),_0xa1f391=this['activeConversation']['getInteraction'](_0x27a073['interactionId']),_0x34571d=_0xa1f391?.['getDocumentContext']();return{'editor':_0x1392bc,'root':_0x1392bc['model']['document']['getRoot'](),'parsedDocumentContent':_0x27a073['documentContextContent'],'serializedDocumentContent':_0x34571d?.['content'],'version':_0x34571d?.['version']};}['_groupChangesByTarget'](_0x70348a,_0x3b6032){const _0x2d4c6c=new Map();for(const _0x435559 of _0x3b6032){const _0x21253b=this['_resolveGroupTarget'](_0x70348a,_0x435559);if(!_0x21253b)continue;const _0x20988d=(_0x21253b['editor']['id']||'e')+'|'+_0x21253b['root']['rootName'];let _0x547655=_0x2d4c6c['get'](_0x20988d);if(!_0x547655){let _0x3a59bb;for(const _0x4fa6e0 of[..._0x435559['changes']['filter'](_0x53df7a=>'context'!==_0x53df7a['type']),..._0x435559['changes']['filter'](_0x336f63=>'context'===_0x336f63['type'])])if(_0x3a59bb=this['activeConversation']?.['getDocumentContextSliceByDataId'](_0x4fa6e0['id'])||this['activeConversation']?.['getDocumentContextSliceByDataId'](_0x70348a['newNodeAnchorIds']['get'](_0x4fa6e0['id'])),_0x3a59bb)break;_0x547655={'target':{'editor':_0x21253b['editor'],'root':_0x21253b['root']},'slice':_0x3a59bb,'groups':[],'groupsIndexes':[]},_0x2d4c6c['set'](_0x20988d,_0x547655);}_0x547655['groups']['push'](_0x435559),_0x547655['groupsIndexes']['push'](_0x70348a['changeGroups']['indexOf'](_0x435559));}return Array['from'](_0x2d4c6c['values']());}['_scrollToSuggestionRange'](_0x288c37,_0x4186dc=!0x1,_0x912aff){const _0x5021da={'target':_0x912aff['editing']['view']['domConverter']['viewRangeToDom'](_0x912aff['editing']['mapper']['toViewRange'](_0x288c37)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x4186dc};_0x4186dc&&(_0x5021da['alignToTop']=!0x0),wt(_0x5021da);}['_updateConversationTitle'](_0x1b9370,_0x28521d=!0x1){this['_aiChatUi']['setConversationTitle'](_0x1b9370||Hi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x28521d);}['_addFeedItemReply'](_0x26e236){'text'===_0x26e236['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x26e236):this['_aiChatUi']['addFeedItemAISuggestion'](_0x26e236);}async['_updateReplyContent']({reply:_0x23ce2c,renderingStrategy:_0x38536c}){const {id:_0xb67966,interactionId:_0x26bab8,isDone:_0x15b18b,type:_0x1eb30f,parsedContent:_0x515ca2}=_0x23ce2c,_0x21ad5d=_0x26bab8+':'+_0xb67966;if('modification'===_0x1eb30f){const _0x2f8aa3=_0x23ce2c['getContentParts']({'showDiff':this['_aiChatUi']['showDiff'],'editor':ds(this['context'])});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x21ad5d,'parts':_0x2f8aa3,'isDone':_0x15b18b,'skipLoadingEffects':_0x23ce2c['isFromHistory']});}else'text'===_0x1eb30f&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x21ad5d,'parsedContent':_0x515ca2,'renderingStrategy':_0x38536c,'isDone':_0x15b18b});_0x15b18b&&_0x23ce2c['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x21ad5d,_0x23ce2c['sources']);}['_updateReplyContentThrottled']=_0x33e214(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x387b27=this['activeConversation']?.['lastInteraction'];_0x387b27&&(_0x387b27['stop'](),this['_aiChatUi']['stopInteraction'](_0x387b27)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x12b977=this['activeConversation']?.['lastInteraction'];if(_0x12b977){for await(const _0x4965ee of _0x12b977['replies'])this['_aiChatUi']['hasFeedItem'](_0x4965ee['id'])||this['_addFeedItemReply'](_0x4965ee),await this['_updateReplyContent']({'reply':_0x4965ee,'renderingStrategy':'static'});}}['_updateRatings'](_0x1cdff4){const _0x806282={'positiveCount':_0x1cdff4['changeGroups']['filter'](_0x818b97=>'accepted'===_0x818b97['state'])['length'],'totalCount':_0x1cdff4['changeGroups']['length'],'modificationId':_0x1cdff4['id']},_0x5cc454=this['activeConversation']['getInteraction'](_0x1cdff4['interactionId'])['messageId'];_0x5cc454&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x5cc454,_0x806282);}['_getAIChatFeedAPI'](_0x2e0726){const _0x25b679=this['_aiChatUi'],_0x25db63=()=>{_0x2e0726['resetWebSearchState'](),_0x2e0726['resetReasoningState'](),_0x25b679['clearLoadingMessage']();},_0x57aca4=()=>{_0x2e0726['currentReply']&&(_0x2e0726['currentReply']['done'](),_0x2e0726['currentReply']=void 0x0);};return{'insertTextReply':(_0x38a36f,_0x52561b)=>{_0x57aca4(),_0x25db63();const _0x26be8c=_0x2e0726['currentReply']=_0x2e0726['createReply']({'type':'text','interactionId':_0x2e0726['id'],'content':_0x38a36f,'id':_0x52561b||ot()});return _0x57aca4(),_0x26be8c;},'insertCustomElement':async(_0x444ba9,_0xe70b94)=>(_0x57aca4(),_0x25db63(),_0x25b679['addFeedItemCustomElement'](_0x444ba9,_0xe70b94||ot())),'setLoadingMessage':_0x35abbe=>{_0x25b679['setLoadingMessage'](_0x35abbe);},'clearLoadingMessage':()=>{_0x25b679['clearLoadingMessage']();}};}}const As='ai-selection',gs=['br'];class AIEditing extends _0xaac0f5{constructor(_0x470a1e){super(_0x470a1e),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}['_outputDataProcessor'];['_fakeSelections']=[];['_sessionId'];['_lastContentFocusedEditor'];static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['getLastContentFocusedEditor'](){return this['_lastContentFocusedEditor'];}get['sessionId'](){if(!this['_sessionId']){const _0x156141=ls(this['context']),_0x4cfc5e=_0x156141['find'](_0xfd45=>_0xfd45['plugins']['has']('RealTimeCollaborationClient'))||_0x156141[0x0],_0x24c729=_0x4cfc5e['plugins']['has']('RealTimeCollaborationClient')&&_0x4cfc5e['plugins']['get']('RealTimeCollaborationClient')['sessionId'];this['_sessionId']=_0x24c729||ot();}return this['_sessionId'];}async['getDocumentData'](){const _0x4ff9d0=ls(this['context']);if(!_0x4ff9d0['length'])throw new at('ai-get-editor-from-context-no-editor');const _0x51a515=[],_0xa9fbc1=new Set();for(const _0x2cc73c of _0x4ff9d0){const _0x36cae9=_0x2cc73c['config']['get']('roots')||{};for(const _0x56f5fd of _0x2cc73c['model']['document']['getRoots']()){if('$graveyard'===_0x56f5fd['rootName'])continue;const _0x986e2f=await this['_getDocumentDataForEditorRoot'](_0x2cc73c,_0x56f5fd,_0xa9fbc1),_0x1863ae=_0x36cae9[_0x56f5fd['rootName']];let _0x551b4d;_0x1863ae?.['label']?_0x551b4d=_0x1863ae['label']:(gt('ai-document-root-missing-label',{'editor':_0x2cc73c,'rootConfig':_0x1863ae}),_0x551b4d=_0x56f5fd['rootName']),_0x51a515['push']({'editor':_0x2cc73c,'rootName':_0x56f5fd['rootName'],'content':_0x986e2f['content'],'version':_0x986e2f['version'],'sessionId':this['sessionId'],'channelId':_0x2cc73c['config']['get']('collaboration.channelId'),'selections':_0x986e2f['selections'],'name':_0x551b4d,'description':_0x1863ae?.['description']});}}return _0x51a515;}async['_getDocumentDataForEditorRoot'](_0x5c9531,_0x226480,_0x4be843){const _0x54e3e3=_0x5c9531['data']['toView'](_0x226480,{'convertAiChatSelectionMarker':!0x0}),_0x4e5d8b=new _0xf62489(_0x5c9531['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x54e3e3,_0x4e5d8b,_0x4be843);let _0x518748=await this['_getDocumentDataStringFromView'](_0x54e3e3,_0x5c9531);const _0x25f5fe=this['_getMarkersInDocumentOrder'](_0x5c9531,_0x226480),_0x5796de=[];for(const _0x5e0b21 of _0x25f5fe){const _0x43dee4='<'+_0x5e0b21['name']+':start></'+_0x5e0b21['name']+':start>',_0x31b3e2=_0x518748['indexOf'](_0x43dee4);_0x518748=_0x518748['substring'](0x0,_0x31b3e2)+_0x518748['substring'](_0x31b3e2+_0x43dee4['length']);const _0x17d651='<'+_0x5e0b21['name']+':end></'+_0x5e0b21['name']+':end>',_0x25a638=_0x518748['indexOf'](_0x17d651);_0x518748=_0x518748['substring'](0x0,_0x25a638)+_0x518748['substring'](_0x25a638+_0x17d651['length']),_0x5796de['push']({'markerName':_0x5e0b21['name'],'start':_0x31b3e2,'end':_0x25a638,'htmlFragment':_0x518748['substring'](_0x31b3e2,_0x25a638)});}return{'content':_0x518748,'version':_0x5c9531['model']['document']['version'],'selections':_0x5796de};}async['afterInit'](){this['context']instanceof _0xf823c1?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x2d96a1,_0x4c9b7a)=>{_0x4c9b7a['on']('ready',()=>{this['_integrateEditor'](_0x4c9b7a);});});}['_setOutputDataProcessor'](_0x29f5b1){this['_outputDataProcessor']=_0x29f5b1;}async['_getDocumentDataStringFromView'](_0x3820bb,_0x2b83ae){let _0x568d55;if(this['_outputDataProcessor']){const _0x2d85e3=_0x2b83ae['data']['processor']['domConverter']['viewToDom'](_0x3820bb),_0x5dfad2=await this['_outputDataProcessor'](_0x2d85e3);_0x568d55=_0x2b83ae['data']['processor']['htmlWriter']['getHtml'](_0x5dfad2);}else _0x568d55=_0x2b83ae['data']['processor']['toData'](_0x3820bb);return _0x568d55;}['_integrateEditor'](_0x4f0c64){if(!_0x4f0c64['config']['get']('collaboration.channelId'))throw new at('ai-missing-channel-id',_0x4f0c64);_0x4f0c64['ui']['focusTracker']['on']('change:isFocused',(_0x446afa,_0x43ad4d,_0x26a47e)=>{_0x26a47e&&(this['_lastContentFocusedEditor']=_0x4f0c64);}),_0x4f0c64['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x4f0c64&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x4f0c64['conversion']['for']('editingDowncast')['markerToHighlight']({'model':As,'view':({markerName:_0x22871e})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x22871e['split'](':')[0x1]],'priority':0xc})}),_0x4f0c64['conversion']['for']('dataDowncast')['markerToElement']({'model':As+':context','view':(_0xefb6f4,{writer:_0x66af15,options:_0x32d0dd})=>_0x32d0dd['convertAiChatSelectionMarker']?_0x66af15['createUIElement'](_0xefb6f4['markerName']+':'+(_0xefb6f4['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x440325){const _0x393f88=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x440325);const _0x9cb450=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x393f88,_0x9cb450);}['hideFakeVisualSelection'](_0x22b3a8){const _0x44bbe6=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x22b3a8);const _0x155bfd=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x44bbe6,_0x155bfd);}async['modelToDataWithIds'](_0x19695b){const _0x349628=ds(this['context']),_0x5b1cdc=_0x349628['data']['toView'](_0x19695b),_0x39a43f=new _0xf62489(_0x349628['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x5b1cdc,_0x39a43f),this['_getDocumentDataStringFromView'](_0x5b1cdc,_0x349628);}['_setDataIdsOnChildren'](_0x244ae4,_0x404ec7,_0x541299=new Set()){let _0x223735=!0x1;for(const _0x4969bf of _0x244ae4['getChildren']()){if(!_0x4969bf['is']('view:element')||gs['includes'](_0x4969bf['name']))continue;const _0x397173=_0x4969bf['is']('view:containerElement'),_0xde6d90=_0x4969bf['is']('view:emptyElement'),_0x29e954=this['_setDataIdsOnChildren'](_0x4969bf,_0x404ec7,_0x541299);if(_0x4969bf['hasAttribute']('data-id')){_0x223735=!0x0,_0x541299['add'](_0x4969bf['getAttribute']('data-id'));continue;}(_0x397173||_0xde6d90||_0x29e954)&&(_0x404ec7['setAttribute']('data-id',this['_nextDataId'](_0x541299),_0x4969bf),_0x223735=!0x0);}return _0x223735;}['_nextDataId'](_0x1131d3){let _0x1cd087;do{_0x1cd087='';for(let _0x1a6d56=0x0;_0x1a6d56<0x4;_0x1a6d56++)_0x1cd087+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x1131d3['has'](_0x1cd087));return _0x1131d3['add'](_0x1cd087),_0x1cd087;}['getSelectionText'](){const {model:_0x262769}=ds(this['context']),_0x2d6ec8=_0x262769['document']['selection'],_0x321cff=[],_0x5040cc=Array['from'](_0x2d6ec8['getRanges']());_0x5040cc['sort']((_0x5c5f89,_0x468c26)=>_0x5c5f89['start']['isBefore'](_0x468c26['start'])?-0x1:0x1);for(const _0x54aed9 of _0x5040cc)for(const _0x428722 of _0x54aed9['getItems']())_0x428722['is']('$textProxy')?_0x321cff['push'](_0x428722['data']):_0x428722['is']('element')&&_0x321cff['length']>0x0&&'\x20'!==_0x321cff[_0x321cff['length']-0x1]&&_0x321cff['push']('\x20');return _0x321cff['length']?'\x22'+_0x321cff['join']('')['trim']()+'\x22':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x2ccddc){for(let _0x4f6d9e=0x0;_0x4f6d9e<this['_fakeSelections']['length'];_0x4f6d9e++)if(this['_fakeSelections'][_0x4f6d9e]['id']==_0x2ccddc)return void this['_fakeSelections']['splice'](_0x4f6d9e,0x1);}['_addFakeSelection'](_0x5b43ff){this['_removeFakeSelectionById'](_0x5b43ff['id']),Tt(this['_fakeSelections'],_0x5b43ff);}['_refreshFakeSelection'](_0x24002a,_0x113eed){if(_0x24002a==_0x113eed)return;const _0x50414f=_0x24002a?this['_getEditorForFakeSelection'](_0x24002a):null,_0x3704e9=_0x113eed?this['_getEditorForFakeSelection'](_0x113eed):null,_0xbf9072=(_0x10f47c,_0x3ba292)=>{const _0x418081=_0x3ba292['model']['markers']['getMarkersGroup'](As);for(const _0x4c985a of _0x418081)_0x10f47c['removeMarker'](_0x4c985a);},_0x26d623=(_0x2060e0,_0x12ddff,_0x26d4fd)=>{const _0x140211=_0x12ddff['model'];for(let _0xc7422f=0x0;_0xc7422f<_0x26d4fd['ranges']['length'];_0xc7422f++){let _0x571c3e=_0x26d4fd['ranges'][_0xc7422f];const _0x4dec2b=As+':'+_0x26d4fd['id']+':'+_0xc7422f;if(_0x571c3e['start']['isAtEnd']){const _0x26ef15=_0x571c3e['start']['getLastMatchingPosition'](({item:_0x1fdd7c})=>!_0x140211['schema']['isContent'](_0x1fdd7c),{'boundaries':_0x571c3e});_0x571c3e=_0x2060e0['createRange'](_0x26ef15,_0x571c3e['end']);}_0x2060e0['addMarker'](_0x4dec2b,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x571c3e});}};_0x50414f&&_0x3704e9&&_0x50414f===_0x3704e9&&_0x113eed?_0x50414f['model']['change'](_0xb72aba=>{_0xbf9072(_0xb72aba,_0x50414f),_0x26d623(_0xb72aba,_0x3704e9,_0x113eed);}):(_0x50414f&&_0x50414f['model']['change'](_0x4610ac=>_0xbf9072(_0x4610ac,_0x50414f)),_0x3704e9&&_0x113eed&&_0x3704e9['model']['change'](_0x1288fb=>_0x26d623(_0x1288fb,_0x3704e9,_0x113eed)));}['_getEditorForFakeSelection'](_0x3191cc){if(!_0x3191cc['ranges']['length'])return ds(this['context']);const _0x52d21b=_0x3191cc['ranges'][0x0]['root']['document'];return ls(this['context'])['find'](_0x4bb969=>_0x4bb969['model']['document']===_0x52d21b)??ds(this['context']);}['_getMarkersInDocumentOrder'](_0x25fae4,_0x1e1711){const _0x382a63=Array['from'](_0x25fae4['model']['markers']['getMarkersGroup'](As+':context'));return(_0x1e1711?_0x382a63['filter'](_0x38f906=>{const _0x292a57=_0x38f906['getRange']();return _0x292a57&&_0x292a57['root']['rootName']===_0x1e1711['rootName'];}):_0x382a63)['sort']((_0x51b278,_0x209f6b)=>_0x51b278['getStart']()['isBefore'](_0x209f6b['getStart']())?-0x1:_0x51b278['getStart']()['isAfter'](_0x209f6b['getStart']())?0x1:0x0);}}const Cs=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],ms=[...Cs,'startConversation','sendUserMessage','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function ps(_0x2d1b82){const _0x2a38e5=new AbortController();return{'promise':new Promise((_0x1f8216,_0x281e58)=>{const _0x21ac65=setTimeout(_0x1f8216,_0x2d1b82);_0x2a38e5['signal']['addEventListener']('abort',()=>{clearTimeout(_0x21ac65),_0x281e58();});}),'abortController':_0x2a38e5};}class HTMLStreamer{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x56b731){this['options']={'delay':_0x56b731?.['delay']??0xa,'textNodeStyle':_0x56b731?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x298c0c,targetElement:_0x72b96e,abortSignal:_0x4051e3}){this['isStreaming']&&this['stop'](),_0x4051e3?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x533652(_0x298c0c,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0xefd605=0x0;_0xefd605<this['currentIndex'];_0xefd605++)this['nodesList'][_0xefd605]['shouldBeStreamed']=!0x0;do{const _0x1dd890=Date['now'](),_0x4d7d79=this['nodesList'][this['currentIndex']],_0x570db9=_0x1dd890-this['lastUpdateTime'];if(_0x4d7d79){_0x4d7d79['shouldBeStreamed']=!0x0;let _0x5cf13d=_0x4d7d79['parent'];for(;_0x5cf13d;)_0x5cf13d['shouldBeStreamed']=!0x0,_0x5cf13d=_0x5cf13d['parent'];}if(_0x570db9<this['options']['delay'])try{const {promise:_0x2fbf56,abortController:_0x10118d}=ps(this['options']['delay']-_0x570db9);this['timeoutAbortController']=_0x10118d,await _0x2fbf56;}catch(_0x5ea68d){return;}_0x464c8a(_0x72b96e,'<'+_0x72b96e['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x72b96e['tagName']+'>',{'childrenOnly':!0x0}),this['currentIndex']++,this['lastUpdateTime']=Date['now']();}while(this['currentIndex']<this['nodesList']['length']);this['currentIndex']=this['nodesList']['length'],this['isStreaming']=!0x1;}['reset'](){this['isStreaming']=!0x1,this['document']=null,this['nodesList']=[],this['currentIndex']=0x0,this['timeoutAbortController']=null;}['cleanUpAnimations']({targetElement:_0x22adca}){Array['from'](_0x22adca['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x1f0865=>{_0x1f0865['replaceWith'](_0x1f0865['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x2aa8d1){let _0x51c156='';if(function(_0x10a704){return _0x43d16c(_0x10a704);}(_0x2aa8d1)){for(const _0x492fa5 of _0x2aa8d1['children'])_0x51c156+=this['renderNode'](_0x492fa5);}else{if(Ts(_0x2aa8d1)){if(!_0x2aa8d1['shouldBeStreamed'])return'';const _0x1b9b95=_0x2aa8d1,_0x3b548f=Object['entries'](_0x1b9b95['attribs'])['map'](([_0x457aea,_0x377d4a])=>_0x457aea+'=\x22'+_0x377d4a+'\x22')['join']('\x20');_0x51c156+='<'+_0x1b9b95['tagName']+(_0x3b548f?'\x20'+_0x3b548f:'')+'>';for(const _0x1743e5 of _0x2b3996(_0x1b9b95))_0x51c156+=this['renderNode'](_0x1743e5);_0x51c156+='</'+_0x1b9b95['tagName']+'>';}else{if(!ws(_0x2aa8d1))return'';if(!_0x2aa8d1['shouldBeStreamed'])return'';!function(_0x3f004f){if(!_0x3f004f['parent']||!Ts(_0x3f004f['parent']))return!0x1;if(!Es['includes'](_0x3f004f['parent']['tagName']))return!0x1;return!_0x57f134(_0x3f004f)['match'](/^\s*[<>]\s*$/);}(_0x2aa8d1)?_0x51c156+=ti(_0x2aa8d1):_0x51c156+=ti(new _0xb124ea('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x2aa8d1]));}}return _0x51c156;}['getParsedDocumentNodeList'](){const _0x5a0501=[];return function(_0x1e7f55,_0x2e6ea9){const _0x1b23dc=_0x41683f=>{if(_0x2e6ea9(_0x41683f),_0x41683f instanceof _0x232458)for(let _0x147288=0x0;_0x147288<_0x41683f['children']['length'];_0x147288++){const _0x4971da=_0x41683f['children'][_0x147288];_0x1b23dc(_0x4971da);}};for(let _0x43862e=0x0;_0x43862e<_0x1e7f55['children']['length'];_0x43862e++)_0x1b23dc(_0x1e7f55['children'][_0x43862e]);}(this['document'],_0x830921=>{if(ws(_0x830921)){const _0x157c24=this['splitTextNodeIntoWordNodes'](_0x830921);_0x157c24['length']&&_0x5a0501['push'](..._0x157c24);}_0x830921['isWordSplitSource']||_0x830921['isWordSplitResult']||_0x5a0501['push'](_0x830921);}),_0x5a0501;}['splitTextNodeIntoWordNodes'](_0x42138e){if(_0x42138e['isWordSplitSource']||_0x42138e['isWordSplitResult'])return[];const _0x488601=_0x57f134(_0x42138e)['match'](/(?:\s*\S+\s*)/g),_0xf2fa89=[];if(_0x488601&&_0x488601['length']>0x1){for(const _0x1d76aa of _0x488601){const _0x2912a4=new _0x1b02fd(_0x1d76aa);_0x2912a4['isWordSplitResult']=!0x0,_0x513713(_0x42138e,_0x2912a4),_0xf2fa89['push'](_0x2912a4);}_0x42138e['isWordSplitSource']=!0x0,_0x3ac3c4(_0x42138e);}return _0xf2fa89;}}const Es=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function ws(_0x251dd8){return _0x4bd5b2(_0x251dd8);}function Ts(_0x23170c){return _0x25dece(_0x23170c);}class AIChatFeedItemView extends Nt{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x47c6cf){super();const _0xa6fd83=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new HTMLStreamer(),this['options']=_0x47c6cf,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0xa6fd83['if']('isDone','ck-ai-chat__feed__item_done'),_0xa6fd83['if']('isVisible','ck-hidden',_0x5d8bd1=>!_0x5d8bd1),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){this['htmlStreamer']['cleanUpAnimations']({'targetElement':this['element']}),this['element']['querySelectorAll']('[data-id]')['forEach'](_0x414314=>{_0x414314['removeAttribute']('data-id');}),this['isDone']=!0x0;}async['streamIntoElement'](_0x174ecc,_0x290fe5,_0x474dd4){await this['htmlStreamer']['stream']({'document':_0x174ecc,'targetElement':_0x290fe5,'abortSignal':_0x474dd4});}}class AISuggestionHeaderView extends Nt{['showChangesToggleView'];constructor(_0x4f6cc2,_0x22f2c5){super(_0x4f6cc2),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new ShowChangesToggleView(_0x4f6cc2),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Bi,'label':Hi(_0x4f6cc2,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x22f2c5['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x511a8e=>_0x511a8e?_0x24b69b:_0x352036),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x175347=new xt();_0x175347['content']=_0x4ca9e8,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x22f2c5['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x175347,{'tag':'span','children':[Hi(_0x4f6cc2,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}}class ShowChangesToggleView extends vt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}}const fs={'accepted':_0x16f2f3,'rejected':_0x4225ee,'outdated':_0x4225ee};class AISuggestionContentPartStateView extends Nt{['stateIconView'];constructor(_0x4274ad){super(_0x4274ad);const _0x485d15=this['bindTemplate'];this['set']('state','accepted'),this['set']('isVisible',!0x0),this['stateIconView']=new StateIconView(),this['stateIconView']['bind']('state')['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x485d15['to']('state',_0x5a0f94=>'ck-ai-suggestion__content-part-state_'+_0x5a0f94),_0x485d15['if']('isVisible','ck-hidden',_0x564e94=>!_0x564e94)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x485d15['to']('state',_0x3995df=>{switch(_0x3995df){case'accepted':return Hi(_0x4274ad,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return Hi(_0x4274ad,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return Hi(_0x4274ad,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0xe8de53){this['state']=_0xe8de53;}}class StateIconView extends xt{constructor(){super(),this['set']('state','accepted'),this['content']=fs[this['state']],this['on']('change:state',()=>{this['content']=fs[this['state']];});}}class AISuggestionContentPartToolbarView extends kt{['_applyButton'];['_suggestButton'];constructor(_0x568cb3,_0x23eba8,_0x39cfcc){super(_0x568cb3);const _0x374e8a=Boolean(_0x39cfcc);this['set']('isEnabled',!_0x374e8a),this['set']('isVisible',!0x0),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x199694=[];if(_0x374e8a){const _0x470682=new vt(_0x568cb3);_0x470682['set']({'label':Hi(_0x568cb3,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x4507a4}),_0x470682['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x199694['push'](_0x470682);}else{_0x23eba8['includes']('applySuggestion')&&(this['_applyButton']=new vt(_0x568cb3),this['_applyButton']['set']({'label':Hi(_0x568cb3,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x16f2f3}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x199694['push'](this['_applyButton'])),_0x23eba8['includes']('insertSuggestion')&&(this['_suggestButton']=new vt(_0x568cb3),this['_suggestButton']['set']({'label':Hi(_0x568cb3,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x259da5}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x199694['push'](this['_suggestButton']));const _0x532bba=new vt(_0x568cb3);_0x532bba['set']({'label':Hi(_0x568cb3,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x4225ee}),_0x532bba['bind']('isEnabled')['to'](this),_0x532bba['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x199694['push'](_0x532bba);}this['items']['addMany'](_0x199694);const _0x5709e1=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x5709e1['if']('isVisible','ck-hidden',_0x2c8273=>!_0x2c8273)]}});}['setButtonsVisibility']({showApplyButton:_0x10383d,showSuggestButton:_0x152f04}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x10383d),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x152f04);}}class AISuggestionContentPartHeaderView extends Nt{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x4050f0,{part:_0x5bb5e7,uiIndex:_0x29a36a,availableActions:_0x48ea5c,areActionsDisabled:_0x4f13e4}){super(_0x4050f0),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['toolbarView']=new AISuggestionContentPartToolbarView(_0x4050f0,_0x48ea5c,_0x4f13e4),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x5bb5e7['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x5bb5e7['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x5bb5e7['index']});}),this['toolbarView']['bind']('isEnabled')['to'](this),this['stateView']=new AISuggestionContentPartStateView(_0x4050f0),this['titleLabelView']=new AISuggestionBodyContentPartTitleLabelView(_0x4050f0,_0x29a36a),this['children']=this['createCollection'](),this['children']['addMany']([this['titleLabelView'],this['toolbarView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-suggestion__body__content-part__title']},'children':this['children']}),this['on']('change:state',(_0x4f0521,_0x5d970f,_0x1ff760,_0x2282ab)=>{'pending'===_0x2282ab?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x1ff760?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x1ff760),this['children']['add'](this['stateView']));});}}class AISuggestionBodyContentPartTitleLabelView extends Nt{constructor(_0x253dee,_0x5a405d){super(_0x253dee),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Hi(_0x253dee,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x5a405d['toString']())]});}}class AISuggestionStreamableContentView extends Nt{['htmlStreamer'];constructor(_0x170c71){super(_0x170c71),this['htmlStreamer']=new HTMLStreamer(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async['update']({part:_0x10d5eb,renderingStrategy:_0x1a6978,abortSignal:_0x3c0b4b}){'streaming'===_0x1a6978?await this['htmlStreamer']['stream']({'document':_0x10d5eb['content'],'targetElement':this['element'],'abortSignal':_0x3c0b4b}):_0x464c8a(this['element'],'<'+this['element']['tagName']+'>'+Ki(_0x10d5eb['content'])+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='';}}class AISuggestionBodyViewContentPartView extends Nt{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x5e55e0,{part:_0x2c3956,uiIndex:_0x1f43d2,areActionsDisabled:_0x410b74,availableActions:_0x3f90a1}){super(_0x5e55e0);const _0x9ff117=this['bindTemplate'];this['set']('state','pending'),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1);const _0x51c89d=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x410b74;};this['on']('change:state',_0x51c89d),this['on']('change:isDone',_0x51c89d),_0x51c89d(),this['_children']=this['createCollection'](),this['_headerView']=new AISuggestionContentPartHeaderView(_0x5e55e0,{'part':_0x2c3956,'uiIndex':_0x1f43d2,'availableActions':_0x3f90a1,'areActionsDisabled':_0x410b74}),this['_headerView']['bind']('isEnabled','state')['to'](this),this['_headerView']['delegate'](...Cs)['to'](this),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x5e55e0),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x9ff117['to']('state',_0x5a270d=>'ck-ai-suggestion__body__content-part_'+_0x5a270d),_0x9ff117['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x9ff117['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x9ff117['if']('isVisible','ck-hidden',_0x564f5b=>!_0x564f5b)]},'children':this['_children'],'on':{'mouseenter':_0x9ff117['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x2c3956['index']});}),'mouseleave':_0x9ff117['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x2c3956['index']});}),'click':_0x9ff117['to'](_0x4516ef=>{const _0x49457e=_0x4516ef['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x49457e)&&this['fire']('showChangeInText',{'index':_0x2c3956['index']});})}});}async['updateContent']({part:_0x24a95a,showUnchangedParts:_0x18ea25=!0x1,abortSignal:_0x49b054}){this['partDefinition']=_0x24a95a,this['isVisible']=this['partDefinition']['hasChanges']||_0x18ea25,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x24a95a,'renderingStrategy':'static','abortSignal':_0x49b054});}['markAsDone'](){this['isDone']=!0x0;}}class AISkeletonView extends Nt{constructor(_0x46aa83,_0x1fdc46){super(_0x46aa83),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x24f05a=>!_0x24f05a)]},'children':this['_createSkeletonItems'](_0x1fdc46)});}['_createSkeletonItems'](_0x1e000a){const _0x55d5f=['ck','ck-ai-skeleton__item'];return _0x1e000a['map'](_0x3a8865=>{let _0x29da33='';switch(_0x3a8865['attributes']['align']){case'right':_0x29da33='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x29da33='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x29da33='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x3a8865['tag'],'attributes':{'class':[..._0x55d5f,_0x3a8865['attributes']['class']?_0x3a8865['attributes']['class']:''],'style':'width:\x20'+_0x3a8865['attributes']['width']+';\x20height:\x20'+_0x3a8865['attributes']['height']+';'+_0x29da33}};});}}const Ss={'aiSuggestionBody':[{'tag':'div','attributes':{'width':'50%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'85%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'75%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}}],'aiFeed':[{'tag':'div','attributes':{'width':'100%','height':'72px','align':'right'}},{'tag':'div','attributes':{'width':'250px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'88px','align':'right'}},{'tag':'div','attributes':{'width':'150px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'140px','align':'right'}},{'tag':'div','attributes':{'width':'250px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'88px','align':'right'}}],'aiHistory':Rs(0x5,'100%','44px','right'),'aiChatResources':Rs(0x8,'100%','24px','right'),'aiReviewChecks':[{'tag':'div','attributes':{'width':'128px','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'128px','height':'24px','align':'left'}}]};function Rs(_0x3f0096,_0x421c2b,_0xd3132d,_0x3f1c3d){return new Array(_0x3f0096)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x421c2b,'height':_0xd3132d,'align':_0x3f1c3d}}));}class PromiseQueue extends Et(){['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x1632d3){const _0x5430b2=this['createTask'](_0x1632d3);return this['queue']['push'](_0x5430b2),this['_processQueue'](),_0x5430b2['completePromise'];}['abort'](){this['isProcessing']&&(this['_abortController']['abort'](),this['_abortController']=void 0x0,this['queue']=[],this['fire']('_queueEmpty'),this['isProcessing']=!0x1);}get['queueEmptyPromise'](){return this['queue']['length']||this['isProcessing']?new Promise(_0x2c6ed8=>{this['once']('_queueEmpty',()=>{_0x2c6ed8();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x3d438a=this['queue']['shift']();try{await _0x3d438a['callback'](this['_abortController']['signal']),_0x3d438a['resolve']();}catch(_0x3d863e){_0x3d438a['reject'](_0x3d863e);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0xb222bd){let _0x5a5d28,_0x1777f0;const _0x1a43c7=new Promise((_0x2958b5,_0x37658d)=>{_0x5a5d28=_0x2958b5,_0x1777f0=_0x37658d;});return{'callback':_0xb222bd,'resolve':_0x5a5d28,'reject':_0x1777f0,'completePromise':_0x1a43c7};}}class AIChatFeedErrorItemView extends AIChatFeedItemView{constructor(_0x398eb6){super(_0x398eb6),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x398eb6['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x1ef044){this['element']['innerHTML']=_0x1ef044;}}const bs=['applySuggestion','insertSuggestion'];class AIChatFeedSuggestionItemActionsView extends Nt{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x462282,_0x219375=[...bs],_0x5005f5){super(_0x462282);const _0x5194b6=this['bindTemplate'],_0x369a26=Boolean(_0x5005f5);if(this['set']('isEnabled',!_0x369a26),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x369a26){const _0x155b50=new vt(_0x462282);_0x155b50['set']({'label':Hi(_0x462282,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x4507a4}),_0x155b50['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x5d4764=new Nt(_0x462282);_0x5d4764['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[Hi(_0x462282,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x155b50]}]}),this['children']['add'](_0x5d4764);}else this['_applyChangesButton']=new vt(_0x462282),this['_applyChangesButton']['set']({'label':Hi(_0x462282,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x219375['includes']('applySuggestion'),'class':Mi}),this['_insertSuggestionsButton']=new vt(_0x462282),this['_insertSuggestionsButton']['set']({'label':Hi(_0x462282,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x219375['includes']('insertSuggestion'),'class':Ui}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x3c29e8=>{_0x3c29e8['bind']('isEnabled')['to'](this);}),this['children']['addMany']([this['_applyChangesButton'],this['_insertSuggestionsButton']]);this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__ai-suggestion__actions',_0x5194b6['if']('isVisible','ck-hidden',_0x58c561=>!_0x58c561)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x4e7519){this['isVisible']=_0x4e7519;}['_switchButtonLabelsPlurality'](_0x3f7424){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x3f7424?(this['_applyChangesButton']['label']=Hi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=Hi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=Hi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=Hi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}}class AIWebSourcesView extends Nt{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x35b679,_0x29992c){super(_0x35b679),this['bodyCollection']=_0x29992c,this['children']=this['createCollection'](),this['set']('isVisible',!0x1),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources',this['bindTemplate']['if']('isVisible','ck-hidden',_0x439b25=>!_0x439b25)]},'children':this['children']});const _0x33019c=new Nt(this['locale']),_0x5a5639=new xt();_0x5a5639['content']=_0x1e6750,_0x33019c['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x5a5639,{'tag':'span','children':[{'text':Hi(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x33019c),this['_setupBalloonPanel'](_0x35b679);}['addSource'](_0xeeaaf0){this['children']['add'](new AIWebSourceView(this['locale'],_0xeeaaf0,this['balloonPanelView']));}['_setupBalloonPanel'](_0x34d026){this['balloonPanelView']=new Xt(_0x34d026),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}}class AIWebSourceView extends vt{['balloonPanelView'];['source'];constructor(_0x41cd4f,_0x3d3793,_0x1f6f79){super(_0x41cd4f),this['source']=_0x3d3793,this['balloonPanelView']=_0x1f6f79,this['set']({'label':_0x3d3793['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x2097ff=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x2097ff['to'](()=>{window['open'](_0x3d3793['url'],'_blank');}),'mouseenter':_0x2097ff['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x2097ff['to'](()=>{this['_hideTooltip']();})}}),_0x3d3793['favicon']){const _0x5abe13=new Nt(_0x41cd4f);_0x5abe13['setTemplate']({'tag':'img','attributes':{'src':_0x3d3793['favicon']||_0x1e6750,'alt':_0x3d3793['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x5abe13);}else this['set']('icon',_0x1e6750);}['_createTooltipContentView'](_0x15045f,_0x163c80){const _0x3a7851=new Nt(_0x15045f),_0x3069a8=[];let _0x43aaf2;_0x163c80?.['favicon']?(_0x43aaf2=new Nt(_0x15045f),_0x43aaf2['setTemplate']({'tag':'img','attributes':{'src':_0x163c80['favicon'],'alt':_0x163c80['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x43aaf2=new xt(),_0x43aaf2['content']=_0x1e6750,_0x43aaf2['extendTemplate']({'attributes':{'alt':_0x163c80['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x3069a8['push'](_0x43aaf2);const _0x3770e8=new Nt(_0x15045f);_0x3770e8['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x163c80['url']},'children':[{'text':new URL(_0x163c80['url'])?.['hostname']}]}),_0x3069a8['push'](_0x3770e8);const _0x396900=new Nt(_0x15045f);_0x396900['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x3069a8});const _0x902c48=new Nt(_0x15045f);return _0x902c48['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x163c80['title']['length']>0x190?_0x163c80['title']['substring'](0x0,0x190)+'...':_0x163c80['title']}]}),_0x3a7851['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x396900,_0x902c48]}),_0x3a7851;}['_showTooltip'](){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[Xt['defaultPositions']['northArrowSouth'],Xt['defaultPositions']['northArrowSouthWest'],Xt['defaultPositions']['northArrowSouthEast']],'limiter':document['querySelector']('.ck-ai-chat')}),this['balloonPanelView']['show']();}['_hideTooltip'](){this['balloonPanelView']['hide']();}['_updateTooltipContent'](){this['balloonPanelView']['content']['get'](0x0)?.['destroy'](),this['balloonPanelView']['content']['clear']();const _0x1bbef9=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x1bbef9);}}class AISuggestionBodyView extends Nt{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x5c164b(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x3a04de,_0x176bb0){super(_0x3a04de);const {areActionsDisabled:_0x501844,showUnchangedParts:_0x4e5fd6,availableActions:_0x3a6e6b}=_0x176bb0;this['_areActionsDisabled']=_0x501844,this['_showUnchangedParts']=_0x4e5fd6,this['_availableActions']=_0x3a6e6b,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new AISkeletonView(_0x3a04de,Ss['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new PromiseQueue(),this['_emptyPartsWarningView']=new AIChatFeedErrorItemView({'id':'empty-parts-warning','initialContent':Hi(_0x3a04de,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new AIChatFeedSuggestionItemActionsView(_0x3a04de,_0x176bb0['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new AIWebSourcesView(this['locale'],_0x176bb0['bodyCollection']),_0x176bb0['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...Cs)['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body']},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-parts']},'children':this['_children']},this['_emptyPartsWarningView'],this['_actionsView'],this['_sourcesView']]});}['destroy'](){this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),super['destroy']();}get['partsCount'](){return this['_contentPartViews']['length'];}get['_contentPartViews'](){return Array['from'](this['_children'])['filter'](_0xc42817=>_0xc42817 instanceof AISuggestionBodyViewContentPartView);}async['updateContentParts']({parts:_0x46e098,abortSignal:_0x268b57,skipLoadingEffects:_0x4181d0}){this['_cachedContentParts']['length']?_0x46e098['forEach'](_0x2b6790=>{const _0x2a3969=this['_cachedContentParts']['findIndex'](_0x65ad47=>_0x65ad47['index']==_0x2b6790['index']);-0x1===_0x2a3969?this['_cachedContentParts']['push'](_0x2b6790):this['_cachedContentParts'][_0x2a3969]=_0x2b6790;}):this['_cachedContentParts']=_0x46e098;const _0x43a90f=this['_showUnchangedParts']?_0x46e098:_0x46e098['filter'](_0x51bd89=>_0x51bd89['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x43a90f['length']>0x1),_0x4181d0&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x10fcdb of _0x43a90f)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x356986=>{let _0x187dca=this['getPartView'](_0x10fcdb['index']);if(!_0x187dca){if(_0x187dca=new AISuggestionBodyViewContentPartView(this['locale'],{'part':_0x10fcdb,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x187dca['delegate'](...Cs)['to'](this),!_0x4181d0&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x356986),_0x356986['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x187dca,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x4181d0||this['_showSkeletonDebounced']();}await _0x187dca['updateContent']({'part':_0x10fcdb,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x356986}),_0x187dca['markAsDone']();});return _0x268b57?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x560fe4,_0xc03466){const _0x3a3f95=this['getPartView'](_0x560fe4);_0x3a3f95&&(_0x3a3f95['state']=_0xc03466),this['hasPendingParts']='pending'==_0xc03466||this['_contentPartViews']['some'](_0x4c0c22=>'pending'==_0x4c0c22['state']);}['setPartActive'](_0x3735f4,_0x1230f3){if(!0x1===_0x3735f4){for(const _0x3eae20 of this['_contentPartViews'])_0x3eae20['isActive']=!0x1;}else{const _0x505199=this['getPartView'](_0x3735f4);_0x505199&&(_0x505199['isActive']=_0x1230f3);}}['updateSources'](_0x91ffff){_0x91ffff['forEach'](_0x21571d=>this['_sourcesView']['addSource'](_0x21571d)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0xa08c64){return this['_contentPartViews']['find'](_0xdbfb79=>_0xdbfb79['partDefinition']['index']==_0xa08c64)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x563148=!this['_cachedContentParts']['find'](({hasChanges:_0x5ec8a1})=>_0x5ec8a1),_0x429d57=!!this['_cachedContentParts']['find'](({hasChanges:_0x2b639a})=>!_0x2b639a);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x429d57,_0x563148?this['_emptyPartsWarningView']['setContent'](Hi(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](Hi(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x44918d=>_0x44918d['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x3baf45){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x453d37=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x453d37>0x0){const {promise:_0x51399d,abortController:_0x5cca8b}=ps(_0x453d37);_0x3baf45?.['addEventListener']('abort',()=>_0x5cca8b['abort']()),await _0x51399d['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x579db2=>_0x579db2['partDefinition']['hasChanges'])['length']>0x0;}}class AISuggestionContainerView extends Nt{['bodyView'];['children'];['headerView'];constructor(_0x511156,_0x2538c5,_0x4f3178){super(_0x511156);const {showDiff:_0x3f4959,areActionsDisabled:_0x34c816,showUnchangedParts:_0x3168f7,availableActions:_0x1e2dac}=_0x2538c5;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new AISuggestionHeaderView(_0x511156,{'showDiff':_0x3f4959}),this['headerView']['on']('toggleShowChanges',(_0x16c3ad,_0x13c0d4)=>{this['areChangesVisible']=_0x13c0d4['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x13c0d4['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new AISuggestionBodyView(_0x511156,{'areActionsDisabled':_0x34c816,'showUnchangedParts':!!_0x3168f7,'availableActions':_0x1e2dac,'bodyCollection':_0x4f3178}),this['bodyView']['delegate'](...Cs)['to'](this),this['bodyView']['bind']('isTrackChangesOn')['to'](this),this['children']['add'](this['bodyView']),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__container','ck-rounded-corners']},'children':this['children']});}async['updateContent'](_0x1ad9cc){await this['bodyView']['updateContentParts'](_0x1ad9cc);}['updateSources'](_0x25df93){this['bodyView']['updateSources'](_0x25df93);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}}class AIChatFeedSuggestionItemView extends AIChatFeedItemView{['containerView'];constructor(_0x31a07f,_0x334739,_0x30eada){super(_0x334739),this['set']('isTrackChangesOn',!0x1),this['containerView']=new AISuggestionContainerView(_0x31a07f,{'showDiff':_0x334739['showDiff'],'areActionsDisabled':_0x334739['areActionsDisabled'],'availableActions':_0x334739['availableActions']},_0x30eada),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x1f82fb,_0x1a90ea)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x1a90ea['showDiff']});}),this['containerView']['bind']('isTrackChangesOn')['to'](this),this['containerView']['on']('like',()=>{this['fire']('like',{'replyId':this['options']['id']});}),this['containerView']['on']('dislike',()=>{this['fire']('dislike',{'replyId':this['options']['id']});}),this['containerView']['on']('showChangeInText',(_0x2f690d,{index:_0x16a3f4})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x16a3f4});}),this['containerView']['on']('applySuggestion',(_0x58b676,{index:_0x2cf82e}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x2cf82e});}),this['containerView']['on']('insertSuggestion',(_0x45c15b,{index:_0x4a820c}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x4a820c});}),this['containerView']['on']('rejectSuggestion',(_0x54e933,{index:_0x579bd8})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x579bd8});}),this['containerView']['on']('mouseOverSuggestion',(_0x517941,{index:_0x5d6b3e})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x5d6b3e});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x4068db,{index:_0x1f1f65})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x1f1f65});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x47e5a2){await this['containerView']['updateContent'](_0x47e5a2);}['updatePartState'](_0x8e324b,_0x529562){this['containerView']['bodyView']['updatePartState'](_0x8e324b,_0x529562);}['setPartActive'](_0x20765b,_0x50545a){!0x1===_0x20765b?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x20765b,_0x50545a);}['updateSources'](_0x54df28){this['containerView']['updateSources'](_0x54df28);}['getPartView'](_0x4d95cd){return this['containerView']['bodyView']['getPartView'](_0x4d95cd);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}}class AIChatFeedReplyItemView extends AIChatFeedItemView{['replyContainer'];['_bodyCollection'];constructor(_0x2417f0,_0x14cba0,_0x498336){super(_0x14cba0),this['_bodyCollection']=_0x498336,this['locale']=_0x2417f0,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new Nt(),this['replyContainer']['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-chat__feed__ai-reply-container']}}),this['children']['add'](this['replyContainer']);}async['render'](){super['render'](),this['options']['initialContent']&&(await this['updateContent']({'parsedContent':Fi(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0x565592,renderingStrategy:_0x3264be,abortSignal:_0xfa807f}){'streaming'===_0x3264be?await this['streamIntoElement'](_0x565592,this['replyContainer']['element'],_0xfa807f):this['replyContainer']['element']['innerHTML']=ti(_0x565592);}['updateSources'](_0x3397ec){const _0x3eb8d8=new AIWebSourcesView(this['locale'],this['_bodyCollection']);_0x3eb8d8['children']['addMany'](_0x3397ec['map'](_0x1e5f8f=>new AIWebSourceView(this['locale'],_0x1e5f8f,_0x3eb8d8['balloonPanelView']))),_0x3eb8d8['isVisible']=!0x0,this['children']['add'](_0x3eb8d8);}}class AISpinnerView extends yt{constructor(_0x58b2bd=void 0x0){super();const _0x51671e=_0x58b2bd?'ck-ai-spinner_'+_0x58b2bd:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x51671e]}});}}const Os={'file':_0x8492f4,'document':_0x4ca9e8,'web-resource':_0xc002d4,'text':_0x8492f4,'selection':_0x30d670,'mcp-tool-context':_0x4ca9e8},ks='ck-ai-chat-context-chip',vs='ck-ai-chat-context-chip_wide',Ns='ck-ai-chat-context-chip_document',ys='ck-ai-chat-context-chip__label',xs='ck-ai-chat-context-chip__type-icon',Ls='ck-ai-chat-context-controls__chip-tooltip',Ds='n';class AIChatContextItemButtonView extends vt{constructor(_0x20aa1a,_0x2b7654,_0x2fe2dc,_0x43a228,_0x36ee0e=!0x1){super(_0x20aa1a),this['_isAnimationOnEnterEnabled']=_0x43a228,this['_initializeProperties'](_0x2b7654,_0x2fe2dc,_0x36ee0e),this['_setupTemplate']();}['render'](){super['render'](),this['_isAnimationOnEnterEnabled']&&this['element']&&(this['element']['classList']['add']('ck-ai-chat-context-chip_new-chip'),this['_handleAnimationEndOnce'](this['element'],()=>{this['element']&&this['element']['classList']['remove']('ck-ai-chat-context-chip_new-chip');}));}['disableAnimationOnEnter'](){this['_isAnimationOnEnterEnabled']=!0x1,this['element']&&this['element']['classList']['remove']('ck-ai-chat-context-chip_new-chip');}['_initializeProperties'](_0x394b00,_0x47715f,_0x41ffb5){this['set']('label',_0x394b00['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x394b00['type']),this['set']('id',_0x394b00['uiId']),this['set']('readonly',_0x47715f),this['set']('isLoading',_0x41ffb5);}['_setupTemplate'](){const _0x20e08a=this['_createIconView'](),_0x5ebe06=this['_createRemoveButton'](),_0x178db2=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x178db2),'children':this['_createTemplateChildren'](_0x20e08a,_0x5ebe06,_0x178db2)});}['_createTemplateAttributes'](_0x3ec231){return{'class':[ks,_0x3ec231['if']('itemType',Ns,_0x2cd339=>'document'==_0x2cd339),_0x3ec231['if']('itemType',vs,_0x2d0c9b=>'selection'==_0x2d0c9b)],'data-cke-tooltip-text':_0x3ec231['to']('label',Vs),'data-cke-tooltip-position':Ds,'data-cke-tooltip-class':Ls};}['_createTemplateChildren'](_0xc6b8ed,_0x284213,_0x5b4712){const _0x3954b2=this['_createLabelElement'](_0x5b4712),_0x4f2639=this['_createLoaderIcon']();return this['readonly']?[_0xc6b8ed,_0x3954b2]:[_0xc6b8ed,_0x4f2639,_0x3954b2,_0x284213];}['_createLabelElement'](_0x49b443){return{'tag':'span','attributes':{'class':ys},'children':[{'text':_0x49b443['to']('label')}]};}['_createRemoveButton'](){const _0x32e5b3=new vt(this['locale']);return _0x32e5b3['set']({'label':Hi(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x4753f1}),this['_setupRemoveButtonEvent'](_0x32e5b3),_0x32e5b3;}['_setupRemoveButtonEvent'](_0x1c399d){_0x1c399d['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x23fd9e=this['bindTemplate'],_0x23b74d=new xt();return _0x23b74d['content']=Os[this['itemType']],_0x23b74d['extendTemplate']({'attributes':{'class':[xs,_0x23fd9e['if']('isLoading','ck-hidden',_0x2f8879=>_0x2f8879)]}}),_0x23b74d;}['_handleAnimationEndOnce'](_0x197075,_0xf17f9d){if(!_0x197075)return;const _0x1bc13a=()=>{_0xf17f9d(),_0x197075['removeEventListener']('animationend',_0x1bc13a),_0x197075['removeEventListener']('webkitAnimationEnd',_0x1bc13a);};_0x197075['addEventListener']('animationend',_0x1bc13a),_0x197075['addEventListener']('webkitAnimationEnd',_0x1bc13a);}['_createLoaderIcon'](){const _0x41c945=new AISpinnerView('small');return _0x41c945['bind']('isVisible')['to'](this,'isLoading',_0x56db24=>_0x56db24),_0x41c945;}}function Vs(_0x421c9d){if(!_0x421c9d)return _0x421c9d;if(_0x421c9d['length']<=0x78)return _0x421c9d;const _0x230062=_0x421c9d['slice'](0x0,0x78),_0x28ce8c=_0x230062['lastIndexOf']('\x20');return(_0x28ce8c>0x0?_0x230062['slice'](0x0,_0x28ce8c):_0x230062)+'…';}const Ps={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},Hs='300px';class AIChatChipsOverflowManager{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0x5e9123,_0x1bdd05,_0x34d9ac,_0x2445e1,_0x4b4954){this['_locale']=_0x5e9123,this['_visibleChips']=_0x1bdd05,this['_config']={...Ps,..._0x34d9ac,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x34d9ac['cssClasses']}},this['_overflowChips']=new dt(),this['_bodyCollection']=_0x2445e1,this['_parentView']=_0x4b4954||null;}['setContainerElement'](_0x14af27){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x14af27,this['_setupVisibilityObserver']();}get['showMoreButtonView'](){return this['_showMoreButtonView'];}get['overflowChips'](){return this['_overflowChips'];}['reorganizeChips'](){requestAnimationFrame(()=>{this['_checkAndHandleOverflow']();});}['showBalloonPanel'](){this['_showMoreButtonView']&&this['_showMoreBalloonPanelView']&&(this['_updateBalloonContent'](),this['_showMoreButtonView']['isOn']=!0x0,this['_showMoreBalloonPanelView']['show'](),this['_showMoreBalloonPanelView']['pin']({'target':this['_showMoreButtonView']['element'],'limiter':document['querySelector']('.ck-ai-chat')}));}['hideBalloonPanel'](){this['_showMoreButtonView']&&this['_showMoreBalloonPanelView']&&(this['_showMoreButtonView']['isOn']=!0x1,this['_showMoreBalloonPanelView']['hide']());}['clear'](){this['_overflowChips']['clear'](),this['hideBalloonPanel'](),this['_updateShowMoreButtonVisibility'](),this['_showMoreButtonView']&&(this['_showMoreButtonView']['label']=''),this['_showMoreBalloonPanelView']&&this['_showMoreBalloonPanelView']['content']['clear']();}['destroy'](){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_showMoreButtonView']&&(this['_showMoreButtonView']['destroy'](),this['_showMoreButtonView']=null),this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['destroy'](),this['_showMoreBalloonPanelView']=null);}['_checkAndHandleOverflow'](){if(!this['_containerElement'])return;if(!this['_isContainerVisible']())return void(this['_pendingCalculation']=!0x0);this['_pendingCalculation']=!0x1;const _0x1feefa=[...this['_visibleChips'],...this['_overflowChips']],_0x3d2877=this['_createCalculationContainer'](),_0x466463=this['_calculateOverflowInContainer'](_0x3d2877,_0x1feefa),_0x11e57a=_0x3d2877['_ancestorsToRestore'];_0x11e57a&&this['_restoreAncestorVisibility'](_0x11e57a),_0x3d2877['remove'](),this['_applyOverflowResults'](_0x1feefa,_0x466463);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),zt({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x40d703=new vt(this['_locale']);_0x40d703['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x6f431e=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x6f431e['push'](this['_config']['cssClasses']['controlsButton']),_0x40d703['extendTemplate']({'attributes':{'class':_0x6f431e}}),_0x40d703;}['_createShowMoreBalloonPanelView'](){const _0x4c9460=new Xt(this['_locale']);return _0x4c9460['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x4c9460),_0x4c9460;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x2e66d7=>{_0x2e66d7['disableAnimationOnEnter']();});const _0x45b5c4=new Nt(this['_locale']);_0x45b5c4['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x45b5c4);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x42a603=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x42a603?'':'none');}['_repinBalloonPanel'](){this['_showMoreButtonView']?.['isOn']&&this['_showMoreBalloonPanelView']?.['isVisible']&&this['_showMoreButtonView']['element']&&this['_showMoreBalloonPanelView']['pin']({'target':this['_showMoreButtonView']['element'],'limiter':document['querySelector']('.ck-ai-chat')});}['_findTargetContainer'](_0x3e048b){const _0x1ce2ce=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x51685f=this['_containerElement']?.['classList'];if(_0x51685f){const _0x293941=_0x51685f[0x0]||'',_0x257123=_0x3e048b['querySelector']('.'+_0x293941),_0x442b08=_0x3e048b['querySelector'](_0x1ce2ce);return _0x257123||_0x442b08||_0x3e048b;}return _0x3e048b['querySelector'](_0x1ce2ce)||_0x3e048b;}['_calculateContainerWidth'](){const _0x37dea9=this['_parentView']?.['element']||this['_containerElement'];if(!_0x37dea9)return Hs;const _0x9a352d=window['getComputedStyle'](_0x37dea9)['width'];if('auto'===_0x9a352d||'0px'===_0x9a352d||!_0x9a352d){const _0x1a3fb2=_0x37dea9['parentElement'];if(_0x1a3fb2){const _0x68ac24=window['getComputedStyle'](_0x1a3fb2);return'auto'!==_0x68ac24['width']?_0x68ac24['width']:Hs;}return Hs;}return _0x9a352d;}['_applyCalculationStyles'](_0x51a842,_0x2fe1fe){this['_config']['cssClasses']['calculationContainer']&&_0x51a842['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x51a842['style']['width']=_0x2fe1fe,_0x51a842['style']['position']='absolute',_0x51a842['style']['top']='-9999px',_0x51a842['style']['left']='-9999px',_0x51a842['style']['opacity']='0',_0x51a842['style']['pointerEvents']='none',_0x51a842['style']['zIndex']='-1',_0x51a842['style']['visibility']='visible\x20!important',_0x51a842['style']['display']='block\x20!important',_0x51a842['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0xdb096d){_0xdb096d['forEach'](({element:_0x581a8b,originalDisplay:_0x1872b0,originalVisibility:_0x44f262})=>{_0x581a8b['style']['display']=_0x1872b0,_0x581a8b['style']['visibility']=_0x44f262;});}['_makeAncestorsVisible'](_0x5dfa8d){const _0x5a91f3=[];let _0x30b5c9=_0x5dfa8d;for(;_0x30b5c9&&_0x30b5c9!==document['body'];){const _0x241dcb=window['getComputedStyle'](_0x30b5c9);'none'!==_0x241dcb['display']&&'hidden'!==_0x241dcb['visibility']||(_0x5a91f3['push']({'element':_0x30b5c9,'originalDisplay':_0x30b5c9['style']['display'],'originalVisibility':_0x30b5c9['style']['visibility']}),_0x30b5c9['style']['display']='block',_0x30b5c9['style']['visibility']='visible'),_0x30b5c9=_0x30b5c9['parentElement'];}return _0x5a91f3;}['_createContainerElements'](){let _0x28750a,_0x3520b5;return this['_parentView']?.['element']?(_0x28750a=this['_parentView']['element']['cloneNode'](!0x0),_0x3520b5=this['_findTargetContainer'](_0x28750a)):(_0x28750a=document['createElement']('div'),_0x3520b5=_0x28750a),{'calculationContainer':_0x28750a,'targetContainer':_0x3520b5};}['_createCalculationContainer'](){const {calculationContainer:_0x3d5c65,targetContainer:_0x57e910}=this['_createContainerElements'](),_0x2d279c=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x3d5c65,_0x2d279c);const _0x430916=this['_parentView']?.['element']||this['_containerElement'],_0xac6ff=_0x430916?.['parentElement'];_0xac6ff?_0xac6ff['appendChild'](_0x3d5c65):document['body']['appendChild'](_0x3d5c65),_0x3d5c65['_targetContainer']=_0x57e910;const _0x3c06e7=this['_makeAncestorsVisible'](_0xac6ff||null);return _0x3d5c65['offsetWidth'],_0x3d5c65['_ancestorsToRestore']=_0x3c06e7,_0x3d5c65;}['_calculateOverflowInContainer'](_0x33839c,_0x350278){const _0x5c6412=_0x33839c['_targetContainer']||_0x33839c,_0x2ec2f3=[],{rowCount:_0x154813}=this['_renderChipsAndCountRows'](_0x5c6412,_0x350278);if(_0x154813<=this['_config']['maxVisibleRows'])return _0x2ec2f3;const _0x255994=_0x350278['slice']();for(;_0x255994['length']>0x0;){if(this['_testButtonFit'](_0x33839c,_0x5c6412,_0x255994)){const _0x3b2e8c=_0x350278['filter'](_0x1a9f3b=>!_0x255994['includes'](_0x1a9f3b));_0x2ec2f3['push'](..._0x3b2e8c);break;}if(!_0x255994['pop']())break;}return _0x2ec2f3;}['_renderChipsAndCountRows'](_0x338664,_0x5145eb){_0x338664['innerHTML']='',_0x5145eb['forEach'](_0x21cd59=>{if(_0x21cd59['element']){const _0x22ba35=_0x21cd59['element']['cloneNode'](!0x0);_0x338664['appendChild'](_0x22ba35);}}),_0x338664['offsetWidth'];const _0x2a6a04=_0x338664['children'],_0x483964=[];return Array['from'](_0x2a6a04)['forEach'](_0x360e1f=>{const _0x3f6649=_0x360e1f['getBoundingClientRect']()['top'];_0x483964['some'](_0x1c228d=>Math['abs'](_0x1c228d-_0x3f6649)<this['_config']['rowDetectionTolerance'])||_0x483964['push'](_0x3f6649);}),{'rowCount':_0x483964['length']};}['_createMockButton'](){const _0x260ac5=document['createElement']('button');return _0x260ac5['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x260ac5['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x260ac5['textContent']='+\x201',_0x260ac5;}['_testButtonFit'](_0x3ef7bb,_0x7c1f73,_0x1b375e){this['_renderChipsAndCountRows'](_0x7c1f73,_0x1b375e);const _0x4f2ac2=this['_createMockButton']();_0x3ef7bb['appendChild'](_0x4f2ac2),_0x3ef7bb['offsetWidth'];const _0x27cd0c=[..._0x7c1f73['children'],_0x4f2ac2],_0x4b26aa=[];_0x27cd0c['forEach'](_0x3515aa=>{const _0x5b6676=_0x3515aa['getBoundingClientRect']()['top'];_0x4b26aa['some'](_0x4a4525=>Math['abs'](_0x4a4525-_0x5b6676)<this['_config']['rowDetectionTolerance'])||_0x4b26aa['push'](_0x5b6676);});const _0x3a09f8=_0x4b26aa['length'];return _0x4f2ac2['remove'](),_0x3a09f8<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x385358,_0x4ebf40){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x385358['forEach'](_0x1bf3aa=>{_0x4ebf40['includes'](_0x1bf3aa)?this['_overflowChips']['add'](_0x1bf3aa):this['_visibleChips']['add'](_0x1bf3aa);});}['_updateOverflowUI'](_0x27a070){if(_0x27a070>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x27a070>0x0&&this['_showMoreButtonView']){const _0x5d2963=''+this['_config']['showMoreLabelPrefix']+(_0x27a070<0x63?_0x27a070:'99');this['_showMoreButtonView']['label']=_0x5d2963;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x422eba,_0x2fd48b){this['_distributeChips'](_0x422eba,_0x2fd48b),this['_updateOverflowUI'](_0x2fd48b['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x525514=>{_0x525514[0x0]['isIntersecting']&&this['_pendingCalculation']&&requestAnimationFrame(()=>{this['_checkAndHandleOverflow']();});},{'threshold':0.01,'rootMargin':'50px'}),this['_intersectionObserver']['observe'](this['_containerElement']));}['_isContainerVisible'](){if(!this['_containerElement'])return!0x1;if(!this['_containerElement']['isConnected'])return!0x1;const _0x591a7e=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x591a7e['width']||0x0===_0x591a7e['height'])return!0x1;const _0x2923a6=window['innerHeight']||document['documentElement']['clientHeight'],_0x7076d9=window['innerWidth']||document['documentElement']['clientWidth'],_0x37a9e0=0xc8;return _0x591a7e['bottom']>=-0xc8&&_0x591a7e['top']<=_0x2923a6+_0x37a9e0&&_0x591a7e['right']>=-0xc8&&_0x591a7e['left']<=_0x7076d9+_0x37a9e0;}}const Ms='ck-ai-chat__feed__context-chips',Us='ck-ai-chat-context-chips-wrapper',Bs='ck-ai-chat-context-chips-wrapper-balloon',Gs='ck-ai-chat-controls-button',Fs='ck-ai-chat-controls_context_show-more-button',Ks='ck-ai-chat-context-controls__show-more-balloon-panel';class AIChatFeedContextChipsView extends Nt{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x1d3a4f,_0x213bbd,_0x2678e7){super(_0x1d3a4f),this['_bodyCollection']=_0x2678e7,this['_createContextChips'](_0x213bbd);const _0x5a66ae={'cssClasses':{'showMoreButton':Fs+'\x20'+Bi,'showMoreBalloon':Ks,'overflowContainer':Bs,'controlsButton':Gs}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x1d3a4f,this['_contextChips'],_0x5a66ae,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[Ms,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':Us},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x17d74c=this['element']['querySelector']('.'+Us);_0x17d74c&&(this['_overflowManager']['setContainerElement'](_0x17d74c),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x2593fa){for(const _0x13dd7f of _0x2593fa){const _0x1bc81d=new AIChatContextItemButtonView(this['locale'],_0x13dd7f,!0x0,!0x1);this['_contextChips']['add'](_0x1bc81d);}}}class AIChatFeedUserMessageItemView extends AIChatFeedItemView{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x19c799,_0x1ef867,_0x464758){super(_0x1ef867),this['_locale']=_0x19c799,this['_bodyCollection']=_0x464758,this['_createContextChipsView'](),this['_createMessageContentView'](),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__user-message']}});}['_createContextChipsView'](){this['options']['contextItems']&&this['options']['contextItems']['length']>0x0&&(this['_contextChipsView']=new AIChatFeedContextChipsView(this['_locale'],this['options']['contextItems']['filter'](_0x1bf729=>!_0x1bf729['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new Nt(this['_locale']),this['_messageContentView']['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__message-content'}}),this['children']['add'](this['_messageContentView']);}['render'](){super['render'](),this['_messageContentView']['element']['innerHTML']=this['options']['initialContent'],this['markAsDone']();}}class AIChatFeedInteractionHeaderView extends AIChatFeedItemView{['capabilities'];constructor(_0x237a43,_0x1746fa){super(_0x1746fa);const {isWebSearchEnabled:_0x33d694,isReasoningEnabled:_0x412269}=_0x1746fa['capabilities'],_0x38d73f=[];let _0x59e77c='';_0x33d694&&_0x412269?(_0x59e77c=Hi(_0x237a43,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x38d73f['push'](Ws(_0x1e6750)),_0x38d73f['push'](Ws(_0x4c1fd3))):_0x33d694?(_0x59e77c=Hi(_0x237a43,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x38d73f['push'](Ws(_0x1e6750))):_0x412269&&(_0x59e77c=Hi(_0x237a43,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x38d73f['push'](Ws(_0x4c1fd3))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x59e77c?'':'ck-hidden']}});const _0x1a6fd9=new Nt();_0x1a6fd9['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x38d73f,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x59e77c]}]}),this['children']['add'](_0x1a6fd9),this['capabilities']=_0x1746fa['capabilities'];}}function Ws(_0x2d44d2){const _0x2a70cd=new xt();return _0x2a70cd['content']=_0x2d44d2,_0x2a70cd;}const Ys=['wheel','touchstart','pointerdown','keydown'],$s=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];class ScrollManager{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x56e719){this['element']=_0x56e719,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x3dbd44 of Ys){const _0x364f5e='keydown'!==_0x3dbd44;this['element']['addEventListener'](_0x3dbd44,this['_onUserEvent']['bind'](this),{'passive':_0x364f5e,'signal':this['abortController']['signal']});}}['start']({smooth:_0x17a054=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x17a054?'smooth':'auto',this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}['stop'](){requestAnimationFrame(()=>{this['_stop']();});}['destroy'](){this['_stop'](),this['abortController']['abort']();}['_stop'](){null!==this['animationFrameId']&&(cancelAnimationFrame(this['animationFrameId']),this['animationFrameId']=null),this['isRunning']&&(this['isRunning']=!0x1),this['isUserPaused']=!0x1;}['_onUserEvent'](_0x174c15){if(this['isRunning']){if('keydown'===_0x174c15['type']){const _0x33a380=_0x174c15['key'];if(!$s['includes'](_0x33a380))return;}_0x174c15 instanceof WheelEvent?_0x174c15['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x426a5b,scrollHeight:_0x3efa74,clientHeight:_0x188564}=this['element'];return _0x3efa74-_0x426a5b-_0x188564<=0x5;}['_rafUpdate'](){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}}class AIChatFeedCustomElementView extends AIChatFeedItemView{constructor(_0x22a6cf){super(_0x22a6cf),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__custom-element']}});}async['render'](){super['render'](),'string'==typeof this['options']['content']?this['element']['innerHTML']=this['options']['content']:this['element']['appendChild'](this['options']['content']);}}class AIChatFeedView extends Nt{['children'];['scrollManager'];['_bodyCollection'];constructor(_0x2a5cca,_0x4af2b8){super(_0x2a5cca),this['_bodyCollection']=_0x4af2b8,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...ms)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new ScrollManager(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x4dbc00,_0x584273){let _0x3d31c7;return'ai-reply'===_0x4dbc00?_0x3d31c7=new AIChatFeedReplyItemView(this['locale'],_0x584273,this['_bodyCollection']):'ai-suggestion-reply'===_0x4dbc00?(_0x3d31c7=new AIChatFeedSuggestionItemView(this['locale'],_0x584273,this['_bodyCollection']),_0x3d31c7['bind']('isTrackChangesOn')['to'](this)):_0x3d31c7='user-message'===_0x4dbc00?new AIChatFeedUserMessageItemView(this['locale'],_0x584273,this['_bodyCollection']):'interaction-header'===_0x4dbc00?new AIChatFeedInteractionHeaderView(this['locale'],_0x584273):'custom-element'===_0x4dbc00?new AIChatFeedCustomElementView(_0x584273):new AIChatFeedErrorItemView(_0x584273),this['children']['add'](_0x3d31c7),_0x3d31c7;}async['updateReplyItem']({id:_0x31d0a7,parsedContent:_0x5a7433,renderingStrategy:_0x5867ff,abortSignal:_0x1fda7c}){const _0xcaf868=this['getItemById'](_0x31d0a7);if(!(_0xcaf868 instanceof AIChatFeedReplyItemView))throw new at('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0xcaf868,'id':_0x31d0a7,'parsedContent':_0x5a7433});await _0xcaf868['updateContent']({'parsedContent':_0x5a7433,'renderingStrategy':_0x5867ff,'abortSignal':_0x1fda7c});}async['updateWebSources'](_0x2a44fc,_0x50a847){const _0x337129=this['getItemById'](_0x2a44fc);if(_0x337129 instanceof AIChatFeedSuggestionItemView)_0x337129['updateSources'](_0x50a847);else{if(!(_0x337129 instanceof AIChatFeedReplyItemView))throw new at('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x337129,'id':_0x2a44fc,'sources':_0x50a847});_0x337129['updateSources'](_0x50a847);}}async['updateSuggestionItem']({id:_0x4f9a9e,parts:_0x29c4d3,abortSignal:_0x4d3099,skipLoadingEffects:_0x1cfeb8}){const _0x5ea55a=this['getItemById'](_0x4f9a9e);if(!(_0x5ea55a instanceof AIChatFeedSuggestionItemView))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x5ea55a,'id':_0x4f9a9e,'parts':_0x29c4d3});await _0x5ea55a['updateContent']({'parts':_0x29c4d3,'abortSignal':_0x4d3099,'skipLoadingEffects':_0x1cfeb8});}['updateSuggestionPartState']({id:_0x58a72f,index:_0x3d37b6,state:_0x210fa5}){const _0x545cc5=this['getItemById'](_0x58a72f);if(!(_0x545cc5 instanceof AIChatFeedSuggestionItemView))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x58a72f});_0x545cc5['updatePartState'](_0x3d37b6,_0x210fa5);}['setSuggestionPartActive']({id:_0x1bc599,index:_0x230276,isActive:_0x30e044}){const _0x255a0e=this['getItemById'](_0x1bc599);if(!(_0x255a0e instanceof AIChatFeedSuggestionItemView))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x1bc599});this['children']['filter'](_0x29e876=>_0x29e876 instanceof AIChatFeedSuggestionItemView)['forEach'](_0x1fb13d=>{_0x1fb13d['setPartActive'](!0x1);}),_0x255a0e['setPartActive'](_0x230276,_0x30e044);}['markItemAsDone'](_0x3712f2){this['getItemById'](_0x3712f2)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x5e5c74=>_0x5e5c74['options']['id']);}['removeItem'](_0x343b1d){this['children']['remove'](this['getItemById'](_0x343b1d));}['hasItem'](_0x3b76f3){return!!this['children']['find'](_0x41b797=>_0x41b797['options']['id']['includes'](_0x3b76f3));}['scrollToSuggestion'](_0x449a0c,_0xc00fda){const _0x5af7de=this['getItemById'](_0x449a0c);if(!(_0x5af7de instanceof AIChatFeedSuggestionItemView))return void gt('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x449a0c,'partIndex':_0xc00fda});const _0x4138ac=_0x5af7de['getPartView'](_0xc00fda);_0x4138ac?ft(_0x4138ac['element'],0x14,this['element']['parentElement'],!0x0,!0x0):gt('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x449a0c,'partIndex':_0xc00fda});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x25b7d4=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x25b7d4,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0xd51b82=new AISkeletonView(this['locale'],Ss['aiFeed']);return _0xd51b82['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0xd51b82;}['_createFeedItems'](){const _0xbd0824=new Nt(this['locale']);return _0xbd0824['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0xbd0824;}['_createFeedLoader'](){const _0x1825a1=new Nt(this['locale']);return _0x1825a1['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x1cc410=>!_0x1cc410)]},'children':this['_createLoaderChildren']()}),_0x1825a1;}['_createLoaderChildren'](){const _0x32b8ff=new AISpinnerView();return _0x32b8ff['isVisible']=!0x0,[_0x32b8ff,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x5f18ce){const _0x13b7af=this['children']['find'](_0x355a77=>_0x355a77['options']['id']['includes'](_0x5f18ce));if(!_0x13b7af)throw new at('ai-chat-feed-view-item-not-found',this,{'id':_0x5f18ce});return _0x13b7af;}['setLoadingMessage'](_0x3092ca){this['set']('loadingMessage',_0x3092ca);}['toggleLoadingSkeleton'](_0x31d29d){this['set']('isLoadingSkeletonVisible',_0x31d29d);}['startAutoScroll'](_0x541ef={}){this['scrollManager']['start'](_0x541ef);}['stopAutoScroll'](){this['scrollManager']['stop']();}}class AIChatPromptSuggestionsListView extends Dt{['filter'](){let _0xd10b76=0x0;for(const _0x2d351b of this['items'])_0xd10b76+=_0x2d351b['items']['length'];return{'resultsCount':_0xd10b76,'totalItemsCount':_0xd10b76};}}const qs='ck-ai-chat__prompt-input_highlighted';class AIChatPromptInputView extends Lt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x372ee3,_0x4bcadc){super(_0x372ee3,{'queryView':{'label':'','creator':Ut,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new AIChatPromptSuggestionsListView(_0x372ee3),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x4bcadc,this['_queryViewResizeObserver']=null,this['queryView']['fieldView']['minRows']=AIChatPromptInputView['MIN_ROWS'],this['queryView']['fieldView']['maxRows']=AIChatPromptInputView['MAX_ROWS'],this['queryView']['fieldWrapperChildren']['add'](this['_addContextButtonView']),this['_setUpAddContextButtonPositioning'](),this['extendTemplate']({'attributes':{'class':['ck','ck-ai-chat__prompt-input']}}),this['submitButtonView']=this['_createSubmitButton'](),this['submitButtonView']['bind']('isEnabled')['to'](this,'isEmpty',this,'isUploadInProgress',(_0x38aa87,_0x1f3d89)=>!_0x38aa87&&!_0x1f3d89),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x18c6e9,_0x302c87)=>{this['isUploadInProgress']||this['isEmpty']||_0x18c6e9['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x302c87());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();});}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x5f37a7=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x5f37a7)return this['queryView']['errorText']=Hi(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x14337c=_0x5f10e5(_0x5f37a7);this['fire']('sendUserMessage',_0x14337c),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x358591){this['queryView']['fieldView']['set']('placeholder',_0x358591);}['focus'](_0x38e007=!0x1){super['focus'](),_0x38e007&&(this['element']['classList']['contains'](qs)||(this['element']['classList']['add'](qs),setTimeout(()=>{this['element']['classList']['remove'](qs);},0x320)));}['_createSubmitButton'](){const _0x5e9a0f=new vt(this['locale']);return _0x5e9a0f['set']({'icon':_0x800171,'label':Hi(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+Mi,'isEnabled':!0x1}),_0x5e9a0f['on']('execute',()=>{this['submit']();}),_0x5e9a0f;}['setIsUploadInProgress'](_0x4eb033){this['isUploadInProgress']=_0x4eb033;}['_setUpAddContextButtonPositioning'](){const _0x4e540a=this['locale'],_0xea87b7=()=>{ct['window']['requestAnimationFrame'](()=>{if(lt(this['element'])){const _0x5365a6=new ut(this['queryView']['fieldView']['element']),_0x4c649b=new ut(this['_addContextButtonView']['element']),_0x1d015f=_0x5365a6['width'],_0x2d0fa1='rtl'===_0x4e540a['uiLanguageDirection']?'right':'left';_0x5365a6['excludeScrollbarsAndBorders']();const _0x2b05dd=_0x1d015f-_0x5365a6['width']+0x1;this['_addContextButtonView']['element']['style'][_0x2d0fa1]='calc('+(_0x1d015f-_0x4c649b['width']-_0x2b05dd)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0xea87b7),this['on']('render',()=>{_0xea87b7(),this['_queryViewResizeObserver']=new St(this['queryView']['fieldView']['element'],()=>{_0xea87b7();});});}}const Qs='ck-ai-chat__prompt-capabilities',Xs='ck-ai-chat-controls-button',zs='ck-ai-chat-controls-button--commands',js='ck-ai-chat-controls__model-selection',Js='ck-ai-chat-controls__model-selection__item-name',Zs='ck-ai-chat-controls__model-selection__item-description',tn='ck-ai-chat-controls__model-selection__item-capabilities',en='n';class AIChatPromptCapabilitiesView extends Nt{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x297a9e){super(_0x297a9e),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelDisplayMode','selector'),this['set']('modelSelectorEnabled',!0x0),this['set']('activeModelId',null),this['set']('activeModelName',null),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelNameView']=this['_createModelNameView'](),this['_webSearchButton']=this['_createWebSearchButton'](),this['_reasoningButton']=this['_createReasoningButton'](),this['_commandsButton']=this['_createCommandsButton'](),this['_modelSelectionDropdown']['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x57271c=>'selector'===_0x57271c),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x4046ec=>_0x4046ec?this['_modelSelectionDropdown']['buttonView']['label']:Hi(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x2bc8a6=>_0x2bc8a6),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x2b35b0=>_0x2b35b0),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x513a4c=>Hi(this['locale'],_0x513a4c?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x55ae73=>_0x55ae73),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x3abace=>Hi(this['locale'],_0x3abace?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[Qs]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new dt(),jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x25943f,_0x43f264){if(_0x43f264)this['set']('modelDisplayMode','hidden');else{const _0x23bd41=0x1===_0x25943f['length'];this['set']('modelDisplayMode',_0x23bd41?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x25943f?.['length'])for(const _0x31f71f of _0x25943f){const _0x44abc5=new Jt({'label':_0x31f71f['name'],'withText':!0x0,'role':'menuitemradio','id':_0x31f71f['id'],'model':_0x31f71f});_0x44abc5['bind']('isOn')['to'](this,'activeModelId',_0x26ccc8=>_0x26ccc8===_0x31f71f['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x44abc5,'labelView':new sn(this['locale'],_0x31f71f)});}}['setWebSearch'](_0x30b0ef){this['set']('webSearchActive',_0x30b0ef);}['setReasoning'](_0x5198ff){this['set']('reasoningActive',_0x5198ff);}['setModel'](_0x58cd4e){if(!_0x58cd4e)return;this['activeModelId']=_0x58cd4e['id'],this['activeModelName']=_0x58cd4e['name']||_0x58cd4e['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x58cd4e['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x58cd4e['name']);const _0x5b0dcf=_0x58cd4e['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x5b0dcf),this['_webSearchButton']['set']('isVisible',_0x5b0dcf);const _0x1318ab=_0x58cd4e['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x1318ab),this['_reasoningButton']['set']('isVisible',_0x1318ab);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x169822){this['set']('modelSelectorEnabled',!0x1),_0x169822&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x2604d2=new vt();return _0x2604d2['set']({'label':Hi(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':_0x1e6750,'class':Xs+'\x20'+Bi,'isToggleable':!0x0,'tooltipPosition':en}),_0x2604d2['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x2604d2;}['_createReasoningButton'](){const _0x4293e1=new vt();return _0x4293e1['set']({'label':Hi(this['locale'],'AI_CHAT_REASONING'),'icon':_0x4c1fd3,'class':Xs+'\x20'+Bi,'isToggleable':!0x0,'tooltipPosition':en}),_0x4293e1['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x4293e1;}['_createCommandsButton'](){const _0x1dcf26=new vt();return _0x1dcf26['set']({'label':Hi(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x1ae066,'withText':!0x0,'class':Xs+'\x20'+Bi,'isToggleable':!0x0,'tooltip':Hi(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':en}),_0x1dcf26['extendTemplate']({'attributes':{'class':[zs]}}),_0x1dcf26['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x1dcf26;}['_createModelSelectionDropdown'](){const _0x4db0a4=Gt(this['locale']);return _0x4db0a4['set']({'panelPosition':'ne','class':[js]}),_0x4db0a4['buttonView']['set']({'label':Hi(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':en,'class':Bi}),this['listenTo'](_0x4db0a4,'execute',_0xae0c1f=>{this['fire']('selectModel',_0xae0c1f['source']['model']);}),_0x4db0a4;}['_createModelNameView'](){const _0x2f2867=new nn(this['locale']);return _0x2f2867['bind']('text')['to'](this,'activeModelName',_0x41965e=>_0x41965e??''),_0x2f2867['bind']('isVisible')['to'](this,'modelDisplayMode',_0x40bf06=>'name'===_0x40bf06),_0x2f2867;}}let sn=class ModelButtonLabelView extends Ht{constructor(_0x30ce0d,_0x42f7de){super();const _0x36d757=this['bindTemplate'],_0xce57f7=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x36d757['to']('style'),'id':_0x36d757['to']('id')},'children':[{'tag':'div','attributes':{'class':[Js]},'children':[{'text':_0x36d757['to']('text')}]},{'tag':'div','attributes':{'class':[Zs]},'children':[{'tag':'span','children':[{'text':_0x42f7de['description']}]}]},{'tag':'div','attributes':{'class':[tn]},'children':_0xce57f7}]}),_0xce57f7['addMany'](this['_getCapabilityParts'](_0x30ce0d,_0x1e6750,'AI_CHAT_SEARCH_WEB',_0x42f7de['capabilities']['webSearch']?.['enabled']??!0x1)),_0xce57f7['addMany'](this['_getCapabilityParts'](_0x30ce0d,_0x4c1fd3,'AI_CHAT_REASONING',_0x42f7de['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x84c5fb,_0x34e223,_0x22b675,_0xb0d819){const _0x24e8ce=new xt();_0x24e8ce['content']=_0x34e223;const _0x508970=new Nt(_0x84c5fb);_0x508970['setTemplate']({'tag':'span','children':[{'text':Hi(_0x84c5fb,_0x22b675)+':\x20'}]});const _0x296e89=new Nt(_0x84c5fb);return _0x296e89['setTemplate']({'tag':'span','children':[{'text':Hi(_0x84c5fb,_0xb0d819?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x24e8ce,_0x508970,_0x296e89];}},nn=class ModelNameView extends Nt{constructor(_0x13be69){super(_0x13be69),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x556f50=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x556f50['if']('isVisible','ck-hidden',_0x80592d=>!_0x80592d)]},'children':[{'text':_0x556f50['to']('text')}]});}};const rn='ck-ai-chat-context-controls__url-form',on='ck-ai-chat-context-controls__url-input-section';class AIChatContextPanelUrlInputView extends Nt{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x1dfaee){super(_0x1dfaee),this['focusTracker']=new _t(),this['keystrokes']=new It(),this['backButton']=this['_createBackButton'](),this['urlInputField']=this['_createUrlInputField'](),this['confirmButton']=this['_createConfirmButton'](),this['_focusables']=this['createCollection']([this['backButton'],this['urlInputField'],this['confirmButton']]),this['focusCycler']=new Mt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift+tab','focusNext':'tab'}}),this['set']('withBackButton',!0x0),this['_setupTemplate'](),this['_setupEventHandlers'](),this['_setupKeystrokes']();}['render'](){super['render'](),this['_focusables']['forEach'](_0x43fa08=>{this['focusTracker']['add'](_0x43fa08['element']),this['keystrokes']['listenTo'](_0x43fa08['element']);}),Zt({'view':this}),this['focus']();}['destroy'](){super['destroy'](),this['focusTracker']['destroy'](),this['keystrokes']['destroy']();}['focus'](){this['urlInputField']['focus']();}['getValue'](){return this['urlInputField']['fieldView']['element']?.['value']?.['trim']()||'';}['clear'](){this['urlInputField']['fieldView']['element']['value']='',this['urlInputField']['errorText']=null,this['confirmButton']['isEnabled']=!0x1;}['setError'](_0x514dfb){this['urlInputField']['errorText']=_0x514dfb,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0xa8615a=new vt(this['locale']);return _0xa8615a['set']({'icon':_0x422a70,'tooltip':Hi(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x54bd34,_0x4a3c37,_0x35cf7c)=>{_0xa8615a['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x35cf7c?'':'\x20ck-hidden')]});}),_0xa8615a;}['_createUrlInputField'](){const _0x8dbf72=new te(this['locale'],_0x1b5819);return _0x8dbf72['set']({'label':Hi(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x8dbf72['fieldView']['set']({'placeholder':Hi(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x8dbf72;}['_createConfirmButton'](){const _0x309552=new vt(this['locale']);return _0x309552['set']({'icon':_0x413c73,'tooltip':Hi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x309552;}['_setupTemplate'](){const _0x14df38=new _0x525f84(this['locale'],{'label':Hi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x14df38['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':rn,'tabindex':'-1'},'children':[_0x14df38,{'tag':'div','attributes':{'class':on},'children':[this['urlInputField'],this['confirmButton']]}]});}['_setupEventHandlers'](){this['backButton']['on']('execute',()=>{this['clear'](),this['fire']('cancel');}),this['urlInputField']['fieldView']['on']('input',()=>{this['clearError'](),this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}),this['on']('submit',_0x4c9636=>{_0x4c9636['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x43e70d,_0x2eb0c0)=>{this['clear'](),this['fire']('cancel'),_0x2eb0c0();});}['_handleSubmit'](){const _0x1b3a70=this['getValue']()['trim']();_0x1b3a70?this['_isValidUrl'](_0x1b3a70)?(this['clearError'](),this['fire']('submitUrl',_0x1b3a70)):this['setError'](Hi(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Hi(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x159921=this['getValue']()['trim'](),_0x596fab=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x159921['length']>0x0&&!_0x596fab;}['_isValidUrl'](_0x3c0620){try{return!!new URL(_0x3c0620);}catch{return!0x1;}}}const an='ck-ai-chat-resources__item',hn='ck-ai-chat-resources__item--in-context',cn='ck-ai-chat-resources__item-title',ln='ck-ai-chat-resources__item__icon';class AIChatResourceListItemView extends Pt{['resource'];['_titleView'];['_iconView'];constructor(_0x2ddad4,_0x9abf6b){super(_0x2ddad4),this['resource']=_0x9abf6b,this['set']('isInContext',!!_0x9abf6b['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x19da92){if(_0x19da92['isInContext'])return _0x413c73;switch(_0x19da92['type']){case'document':return _0x4ca9e8;case'web-resource':return _0xc002d4;case'file':case'text':return _0x8492f4;default:return _0x21fc72;}}['highlightText'](_0x3d5305){if(!_0x3d5305||''===_0x3d5305['trim']())return void this['_titleView']['highlightText'](null);const _0x54d413=new RegExp(_0x42274b(_0x3d5305),'gi');this['_titleView']['highlightText'](_0x54d413);}['updateResourceState'](_0x55f85f){this['resource']['isInContext']=_0x55f85f,this['isInContext']=_0x55f85f,this['_updateIcon']();}['_createTitleView'](){const _0x31dcf6=new _0x177892();return _0x31dcf6['text']=this['resource']['label'],_0x31dcf6['extendTemplate']({'tag':'span','attributes':{'class':[cn]}}),_0x31dcf6;}['_createIconView'](){const _0xf84fe8=new xt();return _0xf84fe8['content']=this['getResourceIcon'](this['resource']),_0xf84fe8;}['_setupTemplate'](){const _0x487dbb=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[an,_0x487dbb['if']('isVisible','ck-hidden',_0x20f5a5=>!_0x20f5a5),_0x487dbb['if']('isInContext',hn)]},'children':[{'tag':'div','attributes':{'class':[ln]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x487dbb['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}}const un='ck-ai-chat-resources__list';class AIChatContextResourcesListView extends Dt{['_source'];constructor(_0x238cf1,_0x48b77c){super(_0x238cf1),this['_source']=_0x48b77c,this['extendTemplate']({'attributes':{'class':[un]}});}['setResources'](_0x367d64,_0x132695){this['items']['clear']();let _0x184e74=_0x367d64;if(this['_source']['useDefaultFiltering']&&_0x132695&&''!==_0x132695['trim']()){const _0x3334e6=new RegExp(_0x132695['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x184e74=_0x367d64['filter'](_0x2af93a=>_0x3334e6['test'](_0x2af93a['label']));}for(const _0x908c9b of _0x184e74){const _0x2804c3=new AIChatResourceListItemView(this['locale'],_0x908c9b);_0x2804c3['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x908c9b);}),this['items']['add'](_0x2804c3);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x132695);}['highlightText'](_0x5affdb){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x3fa956=>{_0x3fa956['highlightText'](_0x5affdb);});}['updateResourceState'](_0x14bf5c,_0x311592){for(const _0x4385ec of this['items']){const _0x4ee1e0=_0x4385ec;_0x4ee1e0['resource']['id']===_0x14bf5c&&_0x4ee1e0['updateResourceState'](_0x311592);}}['_handleResourceSelection'](_0x4ea25b,_0x245f6f){this['fire']('addResourceToContext',{'source':_0x4ea25b,'resource':_0x245f6f});}}class AIChatContextResourcesSearchInputView extends te{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x3a6c33){const t=_0x3a6c33['t'],_0x46292f={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x1b5819,'label':Hi(_0x3a6c33,'AI_CHAT_SEARCH_RESOURCES')};super(_0x3a6c33,_0x46292f['creator']),this['label']=_0x46292f['label'],this['_viewConfig']=_0x46292f,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x3a6c33,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0xd6ca37){this['fire']('search',_0xd6ca37);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new xt(),this['iconView']['content']=_0x212da2,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x3f3f4b,t){this['resetButtonView']=new vt(_0x3f3f4b),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x4753f1,'class':'ck-search__reset','isVisible':!0x1,'tooltip':!0x0}),this['resetButtonView']['on']('execute',()=>{this['reset'](),this['focus'](),this['fire']('reset');}),this['resetButtonView']['bind']('isVisible')['to'](this['fieldView'],'isEmpty',_0x42901c=>!_0x42901c),this['fieldWrapperChildren']['add'](this['resetButtonView']),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-reset'}});}['_setupEventListeners'](){this['listenTo'](this['fieldView'],'input',()=>{this['search'](this['fieldView']['element']['value']);}),this['bind']('isEnabled')['to'](this);}}class AIChatContextResourcesView extends Nt{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0x1279bf,_0x5f3eed){super(_0x1279bf),this['_source']=_0x5f3eed['source'],this['_searchInputVisibleFrom']=_0x5f3eed['searchInputVisibleFrom']??0x7,this['set']('isLoading',!0x0),this['_searchView']=this['_createSearchView'](),this['_searchSection']=this['_createSearchSection'](),this['_resourcesListView']=this['_createResourcesListView'](),this['_skeletonLoader']=this['_createSkeletonView'](),this['children']=new _0x1ec894([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}['_createSearchView'](){return new AIChatContextResourcesSearchInputView(this['locale']);}['_createSearchSection'](){const _0x4c3c9a=new Nt(this['locale']);return _0x4c3c9a['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x23c7e1,_0x36717a)=>{this['loadResources'](_0x36717a),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x36717a);}),_0x4c3c9a;}['_createResourcesListView'](){const _0x171ce1=new AIChatContextResourcesListView(this['locale'],this['_source']);return _0x171ce1['delegate']('addResourceToContext')['to'](this),_0x171ce1['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x171ce1;}['_createSkeletonView'](){const _0x45c45b=new AISkeletonView(this['locale'],Ss['aiChatResources']);return _0x45c45b['bind']('isVisible')['to'](this,'isLoading'),_0x45c45b;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x31fb47){const _0x349de7=ot();this['_latestLoadResourcesUid']=_0x349de7,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x31fb47,'uid':_0x349de7}),this['isLoading']=!0x0;}['setResources'](_0x57812f,_0x370848){if(_0x370848&&_0x370848!==this['_latestLoadResourcesUid'])return;const _0x4f4d18=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x57812f,_0x4f4d18),_0x57812f['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x55b7a4,_0x22e73b){this['_resourcesListView']['updateResourceState'](_0x55b7a4,_0x22e73b);}}const dn='ck-ai-chat-context-controls__source-balloon-panel',_n='ck-button-icon\x20ck-button-back',In='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';class AIChatResourcesBalloonView{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x21b488,_0xdbcd3d,_0x89be72){this['_locale']=_0x21b488,this['_bodyCollection']=_0xdbcd3d,this['_config']=_0x89be72;}['showSourceResourcesBalloon']({source:_0x107bd6,withBackButton:_0x5aaa29}){let _0x37a833=this['_sourceResourceBalloons']['get'](_0x107bd6['id']);_0x37a833||(_0x37a833=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x107bd6['id'],_0x37a833),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x37a833)),this['_addSourceResourceContent']({'balloonPanel':_0x37a833,'source':_0x107bd6,'withBackButton':_0x5aaa29}),_0x37a833['show']();const _0x1d9329=this['_config']['getTargetElement']();_0x1d9329&&_0x37a833['pin']({'target':_0x1d9329,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x42577a,_0x4f2fe4,_0x51a1ab){const _0x444da4=this['_sourceResourceBalloons']['get'](_0x42577a);if(!_0x444da4)return;const _0x38303e=this['_getResourcesViewFromBalloon'](_0x444da4);_0x38303e&&(_0x38303e['setResources'](_0x4f2fe4,_0x51a1ab),_0x38303e['once']('change:isLoading',()=>{_0x444da4['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0xdf010d){const _0x465a86=this['_sourceResourceBalloons']['get'](_0xdf010d);_0x465a86&&requestAnimationFrame(()=>{_0x465a86['hide'](),this['_sourceResourceBalloons']['delete'](_0xdf010d),this['_config']['onBalloonClosed']();});}['isAnyResourceBalloonVisible'](){for(const _0x4ca12f of this['_sourceResourceBalloons']['values']())if(_0x4ca12f['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x587db9,_0x20a6a1,_0x5bb387){const _0xbeef99=this['_sourceResourceBalloons']['get'](_0x587db9);if(!_0xbeef99||!_0xbeef99['isVisible'])return;const _0x4b00b3=this['_config']['getTargetElement']();if(!_0x4b00b3)return;_0xbeef99['pin']({'target':_0x4b00b3,'limiter':this['_config']['getLimiterElement']()});const _0x4c0fab=this['_getResourcesViewFromBalloon'](_0xbeef99);_0x4c0fab&&_0x4c0fab['updateResourceState'](_0x20a6a1,_0x5bb387);}['destroy'](){for(const _0x587834 of this['_sourceResourceBalloons']['values']())_0x587834['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0xc101ab=new Xt(this['_locale']);return _0xc101ab['extendTemplate']({'attributes':{'class':dn}}),this['_bodyCollection']['add'](_0xc101ab),_0xc101ab;}['_addSourceResourceContent']({balloonPanel:_0x5aed4c,source:_0x111c91,withBackButton:_0x597d1e}){_0x5aed4c['content']['clear']();const _0x548b31=this['_createBalloonHeader']({'balloonPanel':_0x5aed4c,'source':_0x111c91,'withBackButton':_0x597d1e});_0x5aed4c['content']['add'](_0x548b31);const _0x455044=this['_createBalloonResourcesView'](_0x111c91);_0x5aed4c['content']['add'](_0x455044);}['_createBalloonHeader']({balloonPanel:_0x2ce76a,source:_0x539893,withBackButton:_0x24fe9f}){const _0x21fa55=new _0x525f84(this['_locale'],{'label':_0x539893['label'],'class':In});return _0x24fe9f&&_0x21fa55['children']['add'](this['_createBackButton'](_0x2ce76a),0x0),_0x21fa55;}['_createBackButton'](_0x5afc85){const _0x1f5616=new vt(this['_locale']);return _0x1f5616['set']({'icon':_0x422a70,'tooltip':Hi(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':_n}),_0x1f5616['on']('execute',()=>{_0x5afc85['hide'](),this['_config']['onBackToContext']();}),_0x1f5616;}['_createBalloonResourcesView'](_0xf84899){const _0x412d9d=new AIChatContextResourcesView(this['_locale'],{'source':_0xf84899,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x412d9d['on']('loadSourceResources',(_0x49370c,_0x4b5007)=>{this['_config']['onLoadSourceResources'](_0x4b5007);}),_0x412d9d['on']('addResourceToContext',(_0x21551c,_0x25840e)=>{this['_config']['onResourceSelected'](_0x25840e['source'],_0x25840e['resource']),this['closeSourceResourceBalloon'](_0xf84899['id']);}),_0x412d9d;}['_getResourcesViewFromBalloon'](_0x5da667){const _0x21620f=_0x5da667['content']['get'](0x1);return _0x21620f instanceof AIChatContextResourcesView?_0x21620f:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x20bff1){zt({'emitter':_0x20bff1,'contextElements':[_0x20bff1['element']],'callback':()=>{_0x20bff1['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x20bff1['isVisible']});}}const An=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],gn='ck-ai-chat-context-controls',Cn='ck-ai-chat-context-controls__pending-contexts',mn='ck-ai-chat-context-controls__add-context-balloon-panel',pn='ck-ai-chat-context-controls__add-context-button',En='ck-ai-chat-context-controls__url-balloon-panel',wn='ck-ai-chat-context-controls__balloon-button',Tn='ck-ai-chat-context-controls__balloon-button-source',fn='ck-ai-chat-controls-button',Sn='ck-ai-chat-context-chips-wrapper-balloon',Rn='ck-ai-chat-controls_context_show-more-button',bn='ck-ai-chat-context-controls__show-more-balloon-panel',On='ck-ai-chat',kn=[Xt['defaultPositions']['northArrowSouthWest'],Xt['defaultPositions']['northArrowSouth'],Xt['defaultPositions']['northArrowSouthEast'],Xt['defaultPositions']['southArrowNorthWest'],Xt['defaultPositions']['southArrowNorth'],Xt['defaultPositions']['southArrowNorthEast']];class AIChatContextPanelView extends Nt{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x137099,_0x287857){super(_0x137099),this['bodyCollection']=_0x287857['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x137099),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x137099),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x137099),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x137099,_0x287857);const _0x29c567={'cssClasses':{'showMoreButton':Rn+'\x20'+Bi,'showMoreBalloon':bn,'overflowContainer':Sn,'controlsButton':fn}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x137099,this['_currentContextsChips'],_0x29c567,this['bodyCollection'],this),this['_addContextBalloonConfig']={'buttonView':this['addContextButtonView'],'balloonView':this['_addContextBalloonPanelView'],'hideMethod':this['hideAddContextBalloonPanel']['bind'](this),'showMethod':this['showAddContextBalloonPanel']['bind'](this)},this['_setupTemplate'](),this['_bindEventHandlers']();}['render'](){super['render'](),this['_setupAllBalloonClickOutsideHandlers'](),this['_overflowManager']['setContainerElement'](this['element']),this['_overflowManager']['reorganizeChips']();}['destroy'](){super['destroy'](),this['_overflowManager']['destroy'](),this['_resourcesBalloonView']['destroy']();}['addContextItem'](_0x4d254d,_0x2ad4a9){const _0xe9e910=this['_createContextButton'](_0x4d254d,'current',!0x0,_0x2ad4a9);this['_addContextToCollection'](_0xe9e910,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x24a962){this['_removeContextFromCollection'](_0x24a962,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x24a962,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x32c3fa,_0x293ef7){let _0x4c03f9=this['_currentContextsChips']['find'](_0x465b17=>_0x465b17['id']===_0x32c3fa);_0x4c03f9||(_0x4c03f9=this['_overflowManager']['overflowChips']['find'](_0x306a7b=>_0x306a7b['id']===_0x32c3fa)),_0x4c03f9&&(_0x4c03f9['isLoading']=_0x293ef7);}['setConversationContext'](_0x3a8c21){this['_conversationContextsChips']['clear']();for(const _0x2c7752 of _0x3a8c21){const _0x5c509f=this['_createContextButton'](_0x2c7752,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x5c509f,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x4b1437,_0x442abc,_0x9ac99c){this['_resourcesBalloonView']['updateResourceState'](_0x4b1437,_0x442abc,_0x9ac99c);}['hideAddContextBalloonPanel'](){this['_toggleAddContextBalloon'](!0x1);}['showAddContextBalloonPanel'](){this['_toggleAddContextBalloon'](!0x0);}['hideUrlBalloonPanel'](){this['_urlBalloonPanelView']['hide'](),this['addContextButtonView']['isOn']=!0x1,this['_urlInputView']&&this['_urlInputView']['clear']();}['showUrlBalloonPanel'](){this['_urlBalloonPanelView']['show'](),this['addContextButtonView']['isOn']=!0x0;}['_showSourceResourcesBalloon']({source:_0x5cb931,withBackButton:_0x18aac3}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x5cb931,'withBackButton':_0x18aac3}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x2298b4,_0x29fc64,_0x4af98b,_0x1d78b4){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x2298b4,_0x4af98b,_0x1d78b4);}['closeSourceResourceBalloon'](_0x8257a1){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x8257a1),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x429bf5){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x429bf5),this['_setAddContextButtonEnabled'](_0x429bf5);}['_setAddContextButtonEnabled'](_0x475f9a){const _0x50564a=!_0x475f9a['document']['isHidden']&&_0x475f9a['document']['enabled'],_0x1731a3=_0x475f9a['urls']['enabled'],_0x278911=_0x475f9a['files']['enabled'],_0xa2caaa=_0x475f9a['sources']['length']>0x0,_0x9dda9a=_0x475f9a['customItems']&&_0x475f9a['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x50564a||_0x1731a3||_0x278911||_0xa2caaa||_0x9dda9a;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[gn,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':Cn},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x149148){const _0x57efaf=new vt(_0x149148);return _0x57efaf['set']({'label':Hi(_0x149148,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':fn+'\x20'+pn+'\x20'+Bi,'icon':_0x3208de,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x57efaf;}['_createAddContextBalloonPanelView'](_0x34bc44){return this['_createBaseBalloonPanel'](_0x34bc44,mn);}['_createUrlBalloonPanelView'](_0x31e1e5){const _0x536693=this['_createBaseBalloonPanel'](_0x31e1e5,En);return this['_addUrlContent'](_0x536693,_0x31e1e5),_0x536693;}['_createResourcesBalloonView'](_0x1b6971,_0xac9d33){const _0x29f3c3={'searchInputVisibleFrom':_0xac9d33['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':kn});},'onResourceSelected':(_0x374eb2,_0x274fe6)=>{this['fire']('addResourceToContext',{'source':_0x374eb2,'resource':_0x274fe6});},'onLoadSourceResources':_0x2c17a0=>{this['fire']('loadSourceResources',_0x2c17a0);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new AIChatResourcesBalloonView(_0x1b6971,_0xac9d33['bodyCollection'],_0x29f3c3);}['_getLimiterElement'](){return this['element']?.['closest']('.'+On)||document['body'];}['_createBaseBalloonPanel'](_0x308bd5,_0x5cfcb2){const _0x40ddf8=new Xt(_0x308bd5);return _0x40ddf8['extendTemplate']({'attributes':{'class':_0x5cfcb2}}),this['bodyCollection']['add'](_0x40ddf8),_0x40ddf8;}['_setBalloonPanelContent'](_0x2b27a6,_0x478dec,_0x1bbf3a){if(_0x2b27a6['content']['clear'](),!_0x1bbf3a['document']['isHidden']&&_0x1bbf3a['document']['enabled']){const _0x4b856b=this['_createBalloonButton'](_0x478dec,{'label':Hi(_0x478dec,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x4ca9e8});_0x4b856b['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x2b27a6['content']['add'](_0x4b856b);}if(_0x1bbf3a['urls']['enabled']){const _0x429cbd=this['_createBalloonButton'](_0x478dec,{'label':Hi(_0x478dec,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0xc002d4});_0x429cbd['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':kn}),this['_urlInputView']['focus']();}),_0x2b27a6['content']['add'](_0x429cbd);}if(_0x1bbf3a['files']['enabled']){const _0x36cd45=new _0x35dfe7(_0x478dec);_0x36cd45['set']({'label':Hi(_0x478dec,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x72791f,'withText':!0x0,'tooltip':!0x0,'class':wn,'allowMultipleFiles':!0x0}),_0x36cd45['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x36cd45['on']('done',(_0x25607a,_0xe73668)=>{this['fire']('addFileToContext',_0xe73668);}),_0x36cd45['tooltip']=!0x0,_0x2b27a6['content']['add'](_0x36cd45);}for(const _0x33ca46 of _0x1bbf3a['sources']){const _0x14f147=this['_createBalloonButton'](_0x478dec,{'label':_0x33ca46['label'],'icon':_0x33ca46['icon']||_0x21fc72,'type':'source'});_0x2b27a6['content']['add'](_0x14f147),_0x14f147['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x33ca46,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x1f3e02 of _0x1bbf3a['customItems']||[]){const _0x47d5d4=this['_createBalloonButton'](_0x478dec,{'label':_0x1f3e02['label'],'icon':_0x1f3e02['icon']||_0x21fc72,'type':'customItem'});_0x2b27a6['content']['add'](_0x47d5d4),_0x47d5d4['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x1f3e02);});}this['_hasExactlyOneSource']=0x1===_0x2b27a6['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x373d40,_0x24076d){this['_urlInputView']=new AIChatContextPanelUrlInputView(_0x24076d),this['_urlInputView']['on']('submitUrl',(_0xfc291d,_0xe0b0fa)=>{this['_handleUrlSubmit'](_0xe0b0fa);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':kn}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':kn});}),_0x373d40['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x20fcf7,_0xadb257){const _0x35f54d='source'===_0xadb257['type']?new SourcesBalloonButtonView(_0x20fcf7):new vt(_0x20fcf7);return _0x35f54d['set']({'label':_0xadb257['label'],'icon':_0xadb257['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':wn}),_0x35f54d;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){zt({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x49f665){const _0x584990=this['_addContextBalloonConfig'];_0x584990['buttonView']['isOn']=_0x49f665,_0x49f665?_0x584990['balloonView']['show']():_0x584990['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x32df3a,buttonView:_0x505951,hideMethod:_0x51c3ca}=this['_addContextBalloonConfig'];zt({'emitter':_0x32df3a,'contextElements':[_0x32df3a['element'],_0x505951['element']],'callback':()=>{_0x51c3ca();},'activator':()=>_0x505951['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x45c7fb,_0x411515,_0x41f62a=!0x1,_0xcf09f6=!0x1){const _0x99a41a='conversation'===_0x411515||!0x0===_0x45c7fb['isReadOnly'],_0x3e3550=new AIChatContextItemButtonView(this['locale'],_0x45c7fb,_0x99a41a,_0x41f62a,_0xcf09f6);return _0x99a41a||_0x3e3550['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x3e3550['id']);}),_0x3e3550;}['_addContextToCollection'](_0x180044,_0x275930){_0x275930['add'](_0x180044,0x0);}['_removeContextFromCollection'](_0x356529,_0x37eb2f){const _0x2339f9=_0x37eb2f['find'](_0x5d38d3=>_0x5d38d3['id']===_0x356529);_0x2339f9&&_0x37eb2f['remove'](_0x2339f9);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':kn}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0xe524b3){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0xe524b3);}}class SourcesBalloonButtonView extends vt{['arrowView'];constructor(_0x518faf){super(_0x518faf),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[Tn]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0xcaced7=new xt();return _0xcaced7['content']=_0xbcd6d6,_0xcaced7['extendTemplate']({'attributes':{'class':Tn+'__arrow'}}),_0xcaced7;}}class AIChatControlsLoaderView extends Nt{['_cancelButtonView'];['_loaderView'];constructor(_0x5e1e75){super(_0x5e1e75),this['_cancelButtonView']=this['_createCancelButtonView'](),this['_loaderView']=this['_createLoaderView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-loader-wrapper','ck-reset_all']},'children':[this['_loaderView'],this['_cancelButtonView']]});}['_createCancelButtonView'](){const _0x2d49c4=new vt(this['locale']);return _0x2d49c4['set']({'label':Hi(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Ui+'\x20ck-ai-button-stop-generating','icon':_0x10fda8}),_0x2d49c4['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x2d49c4;}['_createLoaderView'](){const _0x461650=new Nt(this['locale']);return _0x461650['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}},{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}},{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}}]},{'text':Hi(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x461650;}}class AIChatControlsView extends Nt{['_contextPanelView'];['_promptInputView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];constructor(_0x1f19e0,_0xe40e29){super(_0x1f19e0),this['_contextPanelView']=this['_createContextPanelView'](_0x1f19e0,{'bodyCollection':_0xe40e29['bodyCollection'],'searchInputVisibleFrom':_0xe40e29['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x1f19e0),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x1f19e0),this['_loaderView']=this['_createLoaderView'](_0x1f19e0),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x1f19e0),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage')['to'](this),this['_loaderView']['delegate']('abortPromptStream')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleWebSearch')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleReasoning')['to'](this),this['_promptCapabilitiesView']['delegate']('selectModel')['to'](this),this['_contextPanelView']['delegate'](...An)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x47ea99=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x47ea99['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x47ea99['if']('isLoading','ck-hidden',_0xf2f91c=>_0xf2f91c||!this['isModelAvailable']),_0x47ea99['if']('isModelAvailable','ck-hidden',_0x2413f3=>!_0x2413f3||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x47ea99['if']('isLoading','ck-hidden',_0x4baa14=>!_0x4baa14)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x47ea99['if']('isModelAvailable','ck-hidden',_0x5ec48a=>_0x5ec48a)]},'children':[this['_modelUnavailableMessageView']]}]}),zt({'emitter':this['_promptInputView'],'activator':()=>this['isLoading'],'contextElements':()=>[this['element']],'callback':()=>{this['_shouldRestorePromptInputFocus']=!0x1;}}),this['on']('change:isLoading',this['_handlePromptInputFocus'],{'priority':'low'});}['_createContextPanelView'](_0x551abf,_0x5afe14){return new AIChatContextPanelView(_0x551abf,_0x5afe14);}['_createPromptInputView'](_0x2bc7c2){return new AIChatPromptInputView(_0x2bc7c2,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0xd7be08){return new AIChatPromptCapabilitiesView(_0xd7be08);}['_createLoaderView'](_0x532e3b){return new AIChatControlsLoaderView(_0x532e3b);}['_createModelUnavailableMessageView'](_0xb63d8b){const _0x442286=new AIChatModelUnavailableMessageView(_0xb63d8b);return _0x442286['delegate']('startConversation')['to'](this),_0x442286;}['_handlePromptInputFocus'](_0x35152c,_0x3cf6f1,_0x45d4f0){_0x45d4f0?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x2ad05a,_0x509c9f){this['_contextPanelView']['addContextItem'](_0x2ad05a,_0x509c9f);}['removeContextItem'](_0x5cab98){this['_contextPanelView']['removeContextItem'](_0x5cab98);}['setContextItemLoading'](_0x570e47,_0x51b126){this['_contextPanelView']['setContextItemLoading'](_0x570e47,_0x51b126);}['setIsUploadInProgress'](_0x4c42f6){this['_promptInputView']['setIsUploadInProgress'](_0x4c42f6);}['setConversationContext'](_0x1350fc){this['_contextPanelView']['setConversationContext'](_0x1350fc);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x616db6,_0x40f1ee,_0x5c9a84){this['_contextPanelView']['updateResourceState'](_0x616db6,_0x40f1ee,_0x5c9a84);}['setWebSearch'](_0xc9e1d5){this['_promptCapabilitiesView']['setWebSearch'](_0xc9e1d5);}['setReasoning'](_0xc8bee7){this['_promptCapabilitiesView']['setReasoning'](_0xc8bee7);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x36943c){this['_contextPanelView']['setAddContextOptions'](_0x36943c);}['setInputPlaceholder'](_0x4dc691){this['_promptInputView']['setPlaceholderText'](_0x4dc691);}['setModelList'](_0x25367c,_0x3abda2){this['_promptCapabilitiesView']['setModelList'](_0x25367c,_0x3abda2);}['setModel'](_0x56f8c9){_0x56f8c9?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x56f8c9)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x33b3b5){this['_promptCapabilitiesView']['disableModelSelector'](_0x33b3b5);}['populateSourceResourceBalloon'](_0x5274dd,_0x50814e,_0x42eaab,_0x3848d7){this['_contextPanelView']['populateSourceResourceBalloon'](_0x5274dd,_0x50814e,_0x42eaab,_0x3848d7);}['closeSourceResourceBalloon'](_0x5822b7){this['_contextPanelView']['closeSourceResourceBalloon'](_0x5822b7);}['focusPromptInput'](_0x4502f3=!0x1){this['_promptInputView']['focus'](_0x4502f3);}['setPromptInputValue'](_0x425be2){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x425be2;}}class AIChatModelUnavailableMessageView extends Nt{constructor(_0x588ae8){super(_0x588ae8);const _0x464cd5=new vt(_0x588ae8);_0x464cd5['set']({'label':Hi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x464cd5['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':Hi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x464cd5]}]});}}class AIHeaderView extends _0x525f84{['resizeButton'];constructor(_0x3c7b5f,_0x37ed2c){super(_0x3c7b5f,{'label':_0x37ed2c['label'],'class':'ck-ai-header\x20'+_0x37ed2c['class'],'icon':_0x37ed2c['icon']}),this['set']('isMaximized',!0x1),_0x37ed2c['content']&&this['children']['add'](_0x37ed2c['content']),_0x37ed2c['showResizeButton']&&(this['resizeButton']=Gi(_0x3c7b5f,this),this['children']['add'](this['resizeButton']));}}class AIDisclaimerView extends Nt{constructor(_0x512595){super(_0x512595),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Hi(_0x512595,'AI_DISCLAIMER_TEXT')}]}]});}}function vn(_0x3440fb,_0x57c421){const _0x1477a4=new vt(_0x3440fb);return _0x1477a4['set']({'label':Hi(_0x3440fb,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x3e2661,'class':'ck-ai-chat__start-conversation\x20'+Ui}),_0x1477a4['on']('execute',()=>{_0x57c421['fire']('startConversation');}),_0x1477a4;}class AIChatView extends Nt{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0x530b6d,_0x3dae15){super(_0x530b6d),this['_bodyCollection']=new Qt(_0x530b6d),this['_bodyCollection']['attachToDom']();const _0x52201a=vn(_0x530b6d,this);this['chatHeader']=new AIHeaderView(_0x530b6d,{'label':Hi(_0x530b6d,'AI_CHAT_HEADING'),'icon':_0x23270b,'class':'ck-ai-header_chat','content':_0x52201a,'showResizeButton':_0x3dae15['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new AIChatFeedView(_0x530b6d,this['_bodyCollection']),this['chatFeed']['delegate'](...ms)['to'](this),this['chatControls']=new AIChatControlsView(_0x530b6d,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x3dae15['contextResourcesSearchInputVisibleFrom']}),this['chatControls']['delegate'](...ms)['to'](this),this['chatDisclaimer']=new AIDisclaimerView(_0x530b6d),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x530b6d['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x5c60d7,_0x47db0e,_0x26e890,_0x6d53c3){this['chatControls']['populateSourceResourceBalloon'](_0x5c60d7,_0x47db0e,_0x26e890,_0x6d53c3);}['closeSourceResourceBalloon'](_0x28d033){this['chatControls']['closeSourceResourceBalloon'](_0x28d033);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}}class AIChatUI extends _0xaac0f5{static get['requires'](){return[AITabs];}['_view'];static get['pluginName'](){return'AIChatUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['feedItemRenderingStrategy']='streaming';['showDiff']=!0x0;['_promiseQueue'];['_interactionPromiseResolver'];['_titleAnimationInterval']=void 0x0;['_isTrackChangesCommandValueBound']=!0x1;constructor(_0xc78dd6){super(_0xc78dd6);const _0x557dee=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue(),this['_view']=new AIChatView(this['context']['locale'],{'showResizeButton':_0x557dee['showResizeButton'],'contextResourcesSearchInputVisibleFrom':this['context']['config']['get']('ai.chat.context.searchInputVisibleFrom')}),this['_view']['delegate']('resizeTabs')['to'](_0x557dee),this['_view']['delegate'](...ms)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x30e5ea,{showDiff:_0x2e1aa8})=>{this['showDiff']=_0x2e1aa8;}),_0x557dee['view']['addTab']({'id':'chat','buttonLabel':Hi(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x23270b,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x557dee['view'],'isMaximized',_0x44917c=>_0x44917c),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x3e990c=>_0x3e990c),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x393de5){const _0x34558c=this['context']['config']['get']('ai.chat.welcomeMessage')??Hi(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x393de5['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x34558c}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x24ff3f,staticMessage:_0xf174d2}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x24ff3f,'initialContent':'<p>'+_0xf174d2+'</p>'});});}async['addFeedItemUserMessage'](_0x2c1bab){const _0x2fcca6=_0x2c1bab['attributes']?.['displayedPrompt']||_0x2c1bab['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x2c1bab['contextItems']['values']()),'initialContent':'<p>'+_0x2fcca6+'</p>','id':_0x2c1bab['id']});});}async['addFeedItemError']({errorMessage:_0x5ab5d6,id:_0x25b5c2}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x5ab5d6+'</p>','id':_0x25b5c2});});}async['addFeedItemAIReply'](_0x2e1bbf){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x2e1bbf['interactionId']+':'+_0x2e1bbf['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x25784b){const _0x1bb505=ds(this['context']);let _0x20a7dc=_0x1bb505['config']['get']('ai.availableReplyActions')||[...bs];if(_0x1bb505['plugins']['has']('TrackChanges')){if(!this['_isTrackChangesCommandValueBound']){this['_isTrackChangesCommandValueBound']=!0x0;const _0x48d75b=_0x1bb505['commands']['get']('trackChanges');this['_view']['chatFeed']['bind']('isTrackChangesOn')['to'](_0x48d75b,'value');}}else _0x20a7dc=_0x20a7dc['filter'](_0x3a1848=>'insertSuggestion'!=_0x3a1848);return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x25784b['interactionId']+':'+_0x25784b['id'],'areActionsDisabled':_0x25784b['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x20a7dc}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0xf9099b,_0x4c6ad9){return this['_promiseQueue']['enqueue'](async()=>{const _0x5ef3e5=this['_view']['chatFeed']['children']['last'];if(_0x5ef3e5 instanceof AIChatFeedInteractionHeaderView)return this['_view']['chatFeed']['children']['remove'](_0x5ef3e5),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0xf9099b['id'],'capabilities':{'isWebSearchEnabled':_0x5ef3e5['capabilities']['isWebSearchEnabled']||_0x4c6ad9['isWebSearchEnabled'],'isReasoningEnabled':_0x5ef3e5['capabilities']['isReasoningEnabled']||_0x4c6ad9['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0xf9099b['id'],'capabilities':_0x4c6ad9});});}async['addFeedItemCustomElement'](_0x342026,_0x3e6ddb){let _0x511983;return await this['_promiseQueue']['enqueue'](async()=>{_0x511983=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x342026,'id':_0x3e6ddb});}),_0x511983;}['removeFeedItem'](_0x5bb6be){this['_view']['chatFeed']['removeItem'](_0x5bb6be);}['hasFeedItem'](_0x12d125){return this['_view']['chatFeed']['hasItem'](_0x12d125);}['updateFeedInteractionHeader'](_0x17b0a1){const _0x429be7=this['_view']['chatFeed']['children']['find'](_0x2fc911=>_0x2fc911['options']['id']==_0x17b0a1['id']&&_0x2fc911 instanceof AIChatFeedInteractionHeaderView);_0x429be7&&_0x429be7['set']('isVisible',_0x17b0a1['isVisible']);}async['updateFeedItemAIReplyContent'](_0xb7139c){const _0x116c07=_0xb7139c['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x5708b7=>{await this['_view']['chatFeed']['updateReplyItem']({..._0xb7139c,'abortSignal':_0x5708b7,'renderingStrategy':_0x116c07}),_0xb7139c['isDone']&&this['markFeedItemAsDone'](_0xb7139c['id']);});}['updateFeedItemAIReplySources'](_0x5325b5,_0x1834bf){this['_view']['chatFeed']['updateWebSources'](_0x5325b5,_0x1834bf);}async['updateFeedItemAIReplySuggestionContent'](_0x27decc){return this['_promiseQueue']['enqueue'](async _0x154ebe=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x27decc,'abortSignal':_0x154ebe}),_0x27decc['isDone']&&this['markFeedItemAsDone'](_0x27decc['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x42efd3){this['_view']['chatFeed']['updateSuggestionPartState'](_0x42efd3);}['setFeedItemAIReplySuggestionPartActive'](_0x451bac){this['_view']['chatFeed']['setSuggestionPartActive'](_0x451bac);}['markFeedItemAsDone'](_0x57499c){this['_view']['chatFeed']['markItemAsDone'](_0x57499c);}['removeFeedInteraction'](_0x4588c6){this['_view']['chatFeed']['getItemIds']()['filter'](_0x32d4c8=>_0x32d4c8['startsWith'](_0x4588c6))['forEach'](_0x5288d9=>this['_view']['chatFeed']['removeItem'](_0x5288d9));}['startInteraction'](){const _0x4d35ee=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x4d35ee),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x40995){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x13dd5f=>_0x13dd5f['startsWith'](_0x40995['id']))['forEach'](_0x29f33f=>this['markFeedItemAsDone'](_0x29f33f)),this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();}async['finishInteraction'](){return this['_promiseQueue']['queueEmptyPromise']['then'](()=>{this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();});}['addContextItem'](_0x2772de,_0x4f766b){this['_view']['chatControls']['addContextItem'](_0x2772de,_0x4f766b);}['removeContextItem'](_0x411d90){this['_view']['chatControls']['removeContextItem'](_0x411d90);}['setContextItemLoading'](_0x5e5836,_0x1a5c9e){this['_view']['chatControls']['setContextItemLoading'](_0x5e5836,_0x1a5c9e);}['setIsUploadInProgress'](_0x4d1295){this['_view']['chatControls']['setIsUploadInProgress'](_0x4d1295);}['setConversationContext'](_0x384f68){this['_view']['chatControls']['setConversationContext'](_0x384f68);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x11a152,_0x4fa738,_0x195259){this['_view']['chatControls']['updateResourceState'](_0x11a152,_0x4fa738,_0x195259);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x58062e){this['_view']['chatControls']['setAddContextOptions'](_0x58062e);}['updateCapabilities'](_0x54a587){this['_view']['chatControls']['setWebSearch'](_0x54a587['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x54a587['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x54a587));}['setSelectedModel'](_0x4f2573,_0x3e2ba6){this['_view']['chatControls']['setModel'](_0x4f2573),_0x3e2ba6&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x18e5c9){this['feedItemRenderingStrategy']=_0x18e5c9;}['toggleLoadingSkeleton'](_0xa6bca0){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0xa6bca0);}['resetConversationTitle'](){this['setConversationTitle'](Hi(this['context']['locale'],'AI_CHAT_HEADING'));}['setConversationTitle'](_0x5adc6d,_0x497b3f=!0x1){if(_0x497b3f&&!Rt()&&_0x5adc6d['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x5adc6d);this['_view']['chatHeader']['label']=_0x5adc6d;}['setLoadingMessage'](_0x241bc2){this['_view']['chatFeed']['setLoadingMessage'](_0x241bc2);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x14fc1f){let _0xcc4441=0x0;clearInterval(this['_titleAnimationInterval']),this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x14fc1f[_0xcc4441],_0xcc4441++,_0xcc4441===_0x14fc1f['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x207d14){return _0x207d14['isWebSearchEnabled']&&_0x207d14['isReasoningEnabled']?Hi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x207d14['isWebSearchEnabled']?Hi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x207d14['isReasoningEnabled']?Hi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Hi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x29d8ba){return _0x29d8ba?_0x29d8ba['isWebSearchEnabled']&&_0x29d8ba['isReasoningEnabled']?Hi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x29d8ba['isWebSearchEnabled']?Hi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x29d8ba['isReasoningEnabled']?Hi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):Hi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):Hi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x5dc1b1,_0x4b00e5,_0x2ffdaa,_0x307114){this['_view']['populateSourceResourceBalloon'](_0x5dc1b1,_0x4b00e5,_0x2ffdaa,_0x307114);}['closeSourceResourceBalloon'](_0x19c764){this['_view']['closeSourceResourceBalloon'](_0x19c764);}['setPromptInputValue'](_0x238587){this['_view']['chatControls']['setPromptInputValue'](_0x238587);}['focusPromptInput'](_0x53edcb=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x53edcb);}['scrollFeedToSuggestion'](_0x57cdc6,_0x840a38){this['_view']['chatFeed']['scrollToSuggestion'](_0x57cdc6,_0x840a38);}['startAutoScroll'](_0x5d54ca={}){this['_view']['chatFeed']['startAutoScroll'](_0x5d54ca);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}}class AIChatHistorySectionListView extends Dt{['sections'];constructor(_0x19bbd8,_0x1051f0){super(_0x19bbd8),this['sections']=_0x1051f0,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x35a4f2){let _0x51f241=0x0,_0x340673=0x0;for(const _0x13e2e4 of this['sections']){const {resultsCount:_0x155520,totalItemsCount:_0x5bac79}=_0x13e2e4['filter'](_0x35a4f2);_0x51f241+=_0x155520,_0x340673+=_0x5bac79;}return{'resultsCount':_0x51f241,'totalItemsCount':_0x340673};}}class AIChatHistoryListView extends Pt{['title'];['itemsViews'];['_itemsListView'];constructor(_0x40cdf0,{title:_0x541e40,items:_0x30506e}){super(_0x40cdf0);const _0x261cea=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x541e40,this['itemsViews']=_0x30506e;const _0x4e0d53=new Nt(_0x40cdf0);_0x4e0d53['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new Dt(_0x40cdf0),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x261cea['if']('isVisible','ck-hidden',_0x53157f=>!_0x53157f)]},'children':[_0x4e0d53,this['_itemsListView']]});}['filter'](_0x1aefcd){const _0x23d70f=this['itemsViews']['length'];let _0x10483b=0x0;for(const _0x313a33 of this['itemsViews']){if(_0x1aefcd){const _0x38f159=_0x313a33['isMatching'](_0x1aefcd);_0x313a33['isVisible']=!!_0x38f159,_0x313a33['highlightText'](_0x1aefcd);}else _0x313a33['isVisible']=!0x0,_0x313a33['highlightText'](null);_0x313a33['isVisible']&&_0x10483b++;}return this['isVisible']=_0x10483b>0x0,{'resultsCount':_0x10483b,'totalItemsCount':_0x23d70f};}['getItem'](_0x213432){return this['itemsViews']['find'](_0x5cc3df=>_0x5cc3df['id']===_0x213432);}['removeItem'](_0x2fde41){const _0x15216d=this['itemsViews']['indexOf'](_0x2fde41);-0x1!==_0x15216d&&(this['itemsViews']['splice'](_0x15216d,0x1),this['_itemsListView']['items']['remove'](_0x2fde41));}}class AIChatHistoryListItemView extends/* #__PURE__ -- @preserve */
27
+ _0x98b234(Pt){['id'];static ['LOADING_LABELS']={'remove':'AI_CHAT_HISTORY_LOADING_REMOVING','rename':'AI_CHAT_HISTORY_LOADING_RENAMING','pin':'AI_CHAT_HISTORY_LOADING_PINNING','unpin':'AI_CHAT_HISTORY_LOADING_UNPINNING'};['actions'];['mainContent'];['_titleView'];constructor(_0x1899c5,_0x46fbd6){super(_0x1899c5);const _0x1e5b35=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x46fbd6['pinned']),this['set']('loadingState',null),this['set']('title',_0x46fbd6['title']),this['id']=_0x46fbd6['id'];const {createdAt:_0x4147d3,active:_0x36ac0b=!0x1}=_0x46fbd6;this['_titleView']=new _0x177892(),this['_titleView']['bind']('text')['to'](this,'title',t=>_0x5f10e5(t||'')),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x4a76ff=this['_createCheckView'](),_0x1f3f76=this['_createPinButtonView'](_0x1899c5),_0x54108d=this['_createMenuDropdownView'](),_0x384456=this['_createEditInputView'](_0x1899c5),_0x129cea=this['_createAcceptEditButtonView'](_0x1899c5,_0x384456),_0x1b77f7=this['_createCancelEditButtonView'](_0x1899c5);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x1f3f76),this['actions']['add'](_0x54108d),this['on']('change:isEdit',(_0xbe1b71,_0x49f919,_0x1bc257)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x1bc257?(this['actions']['add'](_0x129cea),this['actions']['add'](_0x1b77f7),this['mainContent']['add'](_0x384456),_0x384456['element']['value']=this['title']||'',_0x384456['element']['focus']()):(this['actions']['add'](_0x1f3f76),this['actions']['add'](_0x54108d),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x36ac0b?'ck-ai-chat-history__item--active':'',_0x1e5b35['if']('isVisible','ck-hidden',_0x24f39a=>!_0x24f39a),_0x1e5b35['if']('isEdit','ck-ai-chat-history__item--edit')],'role':'listitem'},'children':[{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-check-container']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-check',_0x1e5b35['if']('loadingState','ck-hidden',_0x2e5882=>!!_0x2e5882)]},'children':_0x36ac0b?[_0x4a76ff]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x1e5b35['if']('loadingState','ck-hidden',_0x23603b=>!_0x23603b)]},'children':[this['_createSpinnerView']()]}]},{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-row']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-content']},'on':{'click':this['bindTemplate']['to']('click')},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-main-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-title-container',_0x1e5b35['if']('loadingState','ck-hidden',_0x1b998f=>!!_0x1b998f)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x1e5b35['if']('loadingState','ck-hidden',_0x38765a=>!_0x38765a)]},'children':[{'text':_0x1e5b35['to']('loadingState',_0x48e4d8=>_0x48e4d8?Hi(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x48e4d8]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x4147d3]}]},{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-actions']},'children':this['actions']}]}]}),this['on']('click',()=>{this['isEdit']||this['fire']('selectConversation',{'id':this['id']});});}['updateTitle'](_0x17b081){this['set']('title',_0x17b081);}['updateLoadingState'](_0xf72169,_0x3547f4){this['set']('loadingState',_0x3547f4?_0xf72169:null);}['_createCheckView'](){const _0x4ff333=new xt();return _0x4ff333['set']({'content':_0x413c73}),_0x4ff333;}['_createPinButtonView'](_0x2821b8){const _0x303678=new vt(_0x2821b8);return _0x303678['set']({'label':Hi(_0x2821b8,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x33b62a,'withText':!0x1,'tooltip':!0x0}),_0x303678['bind']('isOn')['to'](this,'pinned'),_0x303678['on']('execute',()=>{const _0xab6cfb=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0xab6cfb});}),_0x303678;}['_createMenuDropdownView'](){const _0x4f24d5=Gt(this['locale']),_0x568864=_0x4f24d5['panelView']['children'];_0x4f24d5['buttonView']['set']({'label':Hi(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':_0x34b4b7}),_0x4f24d5['panelPosition']='sw';const _0x4b631c=new vt(this['locale']);_0x4b631c['label']=Hi(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x4b631c['withText']=!0x0,_0x4b631c['on']('execute',()=>{this['isEdit']=!0x0;});const _0x5715f1=new vt(this['locale']);_0x5715f1['label']=Hi(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x5715f1['withText']=!0x0,_0x5715f1['on']('execute',()=>{this['showConfirm'](Hi(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x49c9e6=new Dt(this['locale']),_0x375a67=new Pt(this['locale']);_0x375a67['children']['add'](_0x4b631c);const _0x358ac8=new Pt(this['locale']);return _0x358ac8['children']['add'](_0x5715f1),_0x49c9e6['items']['addMany']([_0x375a67,_0x358ac8]),_0x568864['add'](_0x49c9e6),_0x4f24d5;}['_createEditInputView'](_0x53d025){const _0x40ce67=new _0x9c2679(_0x53d025),_0x25a8b5=_0x40ce67['bindTemplate'];return _0x40ce67['extendTemplate']({'on':{'keydown':_0x25a8b5['to'](_0x34766a=>{'Enter'==_0x34766a['key']&&this['_commitEditInputValue'](_0x40ce67);})}}),_0x40ce67;}['_createAcceptEditButtonView'](_0x4968a2,_0x32a62c){const _0x2f5b56=new vt(_0x4968a2);return _0x2f5b56['set']({'icon':_0x413c73,'withText':!0x1,'tooltip':Hi(_0x4968a2,'AI_CHAT_HISTORY_ACCEPT')}),_0x2f5b56['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x2f5b56['on']('execute',()=>{this['_commitEditInputValue'](_0x32a62c);}),_0x2f5b56;}['_commitEditInputValue'](_0x44ca90){const _0x127ac0=_0x44ca90['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x127ac0});}['_createCancelEditButtonView'](_0x1d4901){const _0x54d1c9=new vt(_0x1d4901);return _0x54d1c9['set']({'icon':_0x4753f1,'withText':!0x1,'tooltip':Hi(_0x1d4901,'AI_CHAT_HISTORY_CANCEL')}),_0x54d1c9['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x54d1c9['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x54d1c9;}['_createSpinnerView'](){const _0x3a9e16=new AISpinnerView('tiny');return _0x3a9e16['isVisible']=!0x0,_0x3a9e16;}['isMatching'](_0x122a92){return'string'==typeof this['title']&&this['title']['match'](_0x122a92)?{'title':!0x0}:null;}['highlightText'](_0x52ed3f){this['_titleView']['highlightText'](_0x52ed3f);}}class AIChatHistoryView extends Nt{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x34b66a,_0x57ac54){super(_0x34b66a),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x274e0a=vn(_0x34b66a,this);this['headerView']=new AIHeaderView(_0x34b66a,{'label':Hi(_0x34b66a,'AI_CHAT_HISTORY_HEADING'),'icon':_0x19de1b,'class':'ck-ai-header_history','content':_0x274e0a,'showResizeButton':_0x57ac54}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new AIChatHistorySectionListView(_0x34b66a,[]),this['sectionsView']['delegate'](...Nn)['to'](this),this['mainErrorView']=this['_createErrorView'](),this['skeletonView']=this['_createSkeletonView'](),this['emptyView']=this['_createEmptyStateView'](),this['searchView']=this['_createSearchView'](),this['mainErrorView']['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isMainErrorViewVisible','ck-hidden',_0x3a3a38=>!_0x3a3a38)]}}),this['on']('change:isLoading',()=>this['_updateViewVisibility']()),this['on']('change:hasItems',()=>this['_updateViewVisibility']()),this['on']('change:errorMessage',()=>this['_updateViewVisibility']()),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat-history','ck-rounded-corners'],'dir':'ltr'},'children':[this['headerView'],{'tag':'div','attributes':{'class':['ck-ai-chat-history__content']},'children':[this['skeletonView'],this['mainErrorView'],this['emptyView'],this['searchView']]}]});}['_updateViewVisibility'](){this['isSearchViewVisible']=!this['isLoading']&&this['hasItems'],this['isEmptyViewVisible']=!this['isLoading']&&!this['hasItems']&&!this['errorMessage'],this['isMainErrorViewVisible']=!this['isSearchViewVisible']&&!!this['errorMessage'];}['_createSearchView'](){const _0x43823e=new _0x135d11(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Hi(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0xca3c26=>Hi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0xca3c26),'secondary':Hi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0xed13cc=this['_createErrorView']();return _0xed13cc['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x5aa097=>!_0x5aa097)]}}),_0x43823e['on']('render',()=>{_0x43823e['children']['add'](_0xed13cc,0x1);}),_0x43823e['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x345c84=>!_0x345c84)]}}),_0x43823e;}['_createSkeletonView'](){const _0x4cfc7e=new AISkeletonView(this['locale'],Ss['aiHistory']);return _0x4cfc7e['bind']('isVisible')['to'](this,'isLoading'),_0x4cfc7e;}['_createErrorView'](){const _0x2f29ff=new Nt(this['locale']),_0x53db57=new vt(this['locale']);_0x53db57['set']({'withText':!0x1,'icon':_0x4753f1,'class':'ck-ai-notification_error__dismiss-button'}),_0x53db57['bind']('isVisible')['to'](this,'hasItems',_0x1cb29a=>!!_0x1cb29a),_0x53db57['on']('execute',()=>{this['errorMessage']='';});const _0x237d1b=this['bindTemplate'];return _0x2f29ff['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x237d1b['to']('errorMessage')}]},_0x53db57]}),_0x2f29ff;}['_createEmptyStateView'](){const _0x62c452=new Nt(this['locale']);return _0x62c452['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x4bbac8=>!_0x4bbac8)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Hi(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x62c452;}['_createListItemViews'](_0x2f4839,_0x48e4d6){const _0x20e5ef=[];for(const _0x4c72ed of _0x2f4839){const _0x5afeda=new AIChatHistoryListItemView(_0x48e4d6,_0x4c72ed);_0x5afeda['delegate'](...Nn)['to'](this),_0x20e5ef['push'](_0x5afeda);}return _0x20e5ef;}['updateHistoryItemsWithCategories'](_0x5cc1e8){const _0x149367=this['locale']||'en',_0x1bf55a=[];for(const _0x36e5bc of _0x5cc1e8){const _0x3114ed=this['_createListItemViews'](_0x36e5bc['items'],_0x149367);_0x1bf55a['push'](new AIChatHistoryListView(_0x149367,{'title':_0x36e5bc['title'],'items':_0x3114ed}));}this['sectionsView']['sections']=_0x1bf55a,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x1bf55a),this['hasItems']=_0x5cc1e8['some'](_0x2ae1ea=>_0x2ae1ea['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x53e8ae){for(const _0x2a821f of this['sectionsView']['sections']){const _0x25781c=_0x2a821f['getItem'](_0x53e8ae);if(_0x25781c){if(_0x2a821f['removeItem'](_0x25781c),0x0===_0x2a821f['itemsViews']['length']){const _0x2f0ad5=this['sectionsView']['sections']['indexOf'](_0x2a821f);-0x1!==_0x2f0ad5&&(this['sectionsView']['sections']['splice'](_0x2f0ad5,0x1),this['sectionsView']['items']['remove'](_0x2a821f));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x7a670f,_0x4f2dd9){for(const _0x1ea88d of this['sectionsView']['sections']){const _0x44e63b=_0x1ea88d['getItem'](_0x7a670f);if(_0x44e63b){_0x44e63b['updateTitle'](_0x4f2dd9);break;}}}['updateItemLoadingState'](_0x1ae68d,_0x9c4cfa,_0x4dd08b){for(const _0x5572ba of this['sectionsView']['sections']){const _0xfd3682=_0x5572ba['getItem'](_0x1ae68d);if(_0xfd3682){_0xfd3682['updateLoadingState'](_0x9c4cfa,_0x4dd08b);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x36690f=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x36690f);}}}const Nn=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];class AIChatHistoryUI extends _0xaac0f5{static get['requires'](){return[AITabs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5c2a17){super(_0x5c2a17);const _0x479c2e=this['context']['plugins']['get']('AITabs');this['_historyView']=new AIChatHistoryView(this['context']['locale'],_0x479c2e['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x479c2e),this['_historyView']['delegate'](...Nn)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x479c2e['view'],'isMaximized',_0x3d3e67=>_0x3d3e67),_0x479c2e['view']['addTab']({'id':'history','buttonLabel':Hi(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x19de1b,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x41a5de){this['_historyView']['removeHistoryItem'](_0x41a5de);}['updateItems'](_0x350aae){this['_historyView']['updateHistoryItemsWithCategories'](_0x350aae);}['updateItemTitle'](_0x1d3fc8,_0x33f3ad){this['_historyView']['updateItemTitle'](_0x1d3fc8,_0x33f3ad);}['updateItemLoadingState'](_0x3476e0,_0x202e7b,_0x3cd962){this['_historyView']['updateItemLoadingState'](_0x3476e0,_0x202e7b,_0x3cd962);}['setLoadingSkeleton'](_0x18252c){this['_historyView']['isLoading']=_0x18252c;}['showError'](_0x569cef){this['_historyView']['errorMessage']=_0x569cef;}['hideError'](){this['_historyView']['errorMessage']='';}}class AIChatHistoryItem extends ht(){['id'];['createdAt'];constructor({id:_0x2a03ca,title:_0x604c71,createdAt:_0x4f16c7,updatedAt:_0x3bd606,pinned:_0x615a82}){super(),this['id']=_0x2a03ca,this['createdAt']=new Date(_0x4f16c7),this['set']('title',_0x604c71),this['set']('updatedAt',_0x3bd606?new Date(_0x3bd606):null),this['set']('pinned',_0x615a82||!0x1);}['updateTitle'](_0x19fa0e){this['set']('title',_0x19fa0e),this['updatedAt']=new Date();}['updatePinned'](_0x359f52){this['set']('pinned',_0x359f52),this['updatedAt']=new Date();}}class AIChatHistoryConversations extends Et(){['items']=[];['connector'];['group'];constructor({connector:_0x56ffe8,group:_0x3aa0bd}){super(),this['connector']=_0x56ffe8,this['group']=_0x3aa0bd;}async['init'](){try{const _0x22f6d9=this['connector']['fetchConversations'](this['group']),_0x5e12b9=await _0x22f6d9['getConversations']();this['loadItems'](_0x5e12b9);}catch(_0x599896){this['fire']('error',{'error':_0x599896,'operation':'init'});}}['addItem'](_0x31d9b8){this['items']['push'](_0x31d9b8);}async['removeItem'](_0x589e8b){const _0x26bc3d=this['items']['findIndex'](_0x3856d0=>_0x3856d0['id']===_0x589e8b);if(-0x1===_0x26bc3d)return!0x1;try{return await this['connector']['deleteConversation'](_0x589e8b)['execute'](),this['items']['splice'](_0x26bc3d,0x1),this['fire']('itemRemoved',{'itemId':_0x589e8b}),!0x0;}catch(_0xf01770){return this['fire']('error',{'error':_0xf01770,'operation':'removeItem','itemId':_0x589e8b}),!0x1;}}['getItem'](_0x40d1fb){return this['items']['find'](_0xfb0a80=>_0xfb0a80['id']===_0x40d1fb);}async['updateItemTitle'](_0x359ca6,_0x5527f9){const _0x45659e=this['getItem'](_0x359ca6);if(!_0x45659e)return!0x1;try{return await this['connector']['updateConversation'](_0x359ca6,{'title':_0x5527f9})['getResult'](),_0x45659e['updateTitle'](_0x5527f9),this['fire']('itemUpdated',{'itemId':_0x359ca6,'updates':{'title':_0x5527f9}}),!0x0;}catch(_0xf0bb90){return this['fire']('error',{'error':_0xf0bb90,'operation':'updateItemTitle','itemId':_0x359ca6}),!0x1;}}async['updateItemPinned'](_0xd52dfd,_0x1245f9){const _0x2a2aa0=this['getItem'](_0xd52dfd);if(!_0x2a2aa0)return!0x1;try{return await this['connector']['updateConversation'](_0xd52dfd,{'pinned':_0x1245f9})['getResult'](),_0x2a2aa0['updatePinned'](_0x1245f9),this['fire']('itemUpdated',{'itemId':_0xd52dfd,'updates':{'pinned':_0x1245f9}}),!0x0;}catch(_0x5a6a0f){return this['fire']('error',{'error':_0x5a6a0f,'operation':'updateItemPinned','itemId':_0xd52dfd}),!0x1;}}['loadItems'](_0x4c82ff){try{this['items']=[],_0x4c82ff['map'](_0x11f6b4=>{this['addItem'](new AIChatHistoryItem(_0x11f6b4));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x2846a9){this['fire']('error',{'error':_0x2846a9,'operation':'loadItems'});}}['getItems'](_0x4c0f73={}){const _0x43c998=void 0x0!==_0x4c0f73['pinned']&&_0x4c0f73['pinned'],_0x150243=_0x4c0f73['from']?new Date(_0x4c0f73['from']['getFullYear'](),_0x4c0f73['from']['getMonth'](),_0x4c0f73['from']['getDate']()):null,_0x32512d=_0x4c0f73['to']?new Date(_0x4c0f73['to']['getFullYear'](),_0x4c0f73['to']['getMonth'](),_0x4c0f73['to']['getDate']()):null;return this['items']['filter'](_0x2b0531=>{if(_0x2b0531['pinned']!==_0x43c998)return!0x1;if(_0x32512d){const _0x26eb73=new Date(_0x2b0531['createdAt']['getFullYear'](),_0x2b0531['createdAt']['getMonth'](),_0x2b0531['createdAt']['getDate']());return _0x150243?_0x150243['getTime']()===_0x32512d['getTime']()?_0x26eb73['getTime']()===_0x150243['getTime']():_0x26eb73<_0x32512d&&_0x26eb73>=_0x150243:_0x26eb73<_0x32512d;}return!0x0;});}}class AIChatHistoryController extends _0xaac0f5{['_aiConnector'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[AIConnector,AIChatController,AIChatHistoryUI,AITabs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiConnector']=this['context']['plugins']['get'](AIConnector),this['_aiChatHistoryUi']=this['context']['plugins']['get'](AIChatHistoryUI),this['_aiChatController']=this['context']['plugins']['get'](AIChatController);const _0x407d80=this['context']['plugins']['get'](AITabs);try{const _0x3c2a82=this['_aiChatController']['getGroupId']();this['history']=new AIChatHistoryConversations({'connector':this['_aiConnector'],'group':_0x3c2a82}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x779d9b,_0x22817e)=>{this['_setItemLoading'](_0x22817e['id'],'remove'),this['_handleRemove'](_0x22817e['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x50c23e,_0x24efa6)=>{this['_setItemLoading'](_0x24efa6['id'],'rename'),this['_handleEditTitle'](_0x24efa6['id'],_0x24efa6['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0xc7a810,_0x48adde)=>{void 0x0!==_0x48adde['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x48adde['itemId'],_0x48adde['updates']['title']),void 0x0!==_0x48adde['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x48adde['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x1e6c74,_0x323604)=>{this['_aiChatController']['_handleRemovedConversation'](_0x323604['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x323604['itemId']),this['_clearItemLoading'](_0x323604['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x4fa829,_0x3d937a)=>{this['_handleHistoryErrorUI'](_0x3d937a['error'],_0x3d937a['operation'],_0x3d937a['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x32c17d,_0x23d1a5)=>{this['_handleSelectConversation'](_0x23d1a5['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x54a441,_0x188d25)=>{const _0x260fd5=_0x188d25['pinned']?'pin':'unpin';this['_setItemLoading'](_0x188d25['id'],_0x260fd5),this['_handleTogglePin'](_0x188d25['id'],_0x188d25['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x407d80['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x407d80['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x13e50f){this['_handleHistoryErrorUI'](_0x13e50f,'init');}}async['_handleEditTitle'](_0x496624,_0x30a3bc){await this['history']['updateItemTitle'](_0x496624,_0x30a3bc);}async['_handleTogglePin'](_0x1fcba3,_0x1fd517){await this['history']['updateItemPinned'](_0x1fcba3,_0x1fd517);}async['_handleRemove'](_0x1f1b56){await this['history']['removeItem'](_0x1f1b56);}async['_handleSelectConversation'](_0xb41880){await this['_aiChatController']['loadConversation'](_0xb41880);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x218467=this['_aiChatController']['activeConversation']?.['id'],_0x3e7056=this['_getCategorizedItems']()['map'](_0x5841c6=>({'title':_0x5841c6['title'],'items':_0x5841c6['items']['map'](_0x35a792=>({'id':_0x35a792['id'],'title':_0x35a792['title']||Hi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x35a792['createdAt'])['toLocaleDateString'](),'active':_0x35a792['id']===_0x218467,'pinned':_0x35a792['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x3e7056);}['_setItemLoading'](_0x3da00f,_0x5b8d52){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x3da00f,_0x5b8d52,!0x0);}['_clearItemLoading'](_0x5a7f14){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x5a7f14,null,!0x1);}['_handleHistoryErrorUI'](_0xad9392,_0x58c948,_0x52da61){const _0x1a366a=this['_generateErrorMessage'](_0x58c948,_0x52da61);this['_aiChatHistoryUi']['showError'](_0x1a366a),_0x52da61&&this['_clearItemLoading'](_0x52da61),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x5a12f6,_0x53c82f){const _0x11b6a0=_0x53c82f?this['history']['getItem'](_0x53c82f):null,_0x47b085=_0x11b6a0?.['title']||Hi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x5a12f6){case'updateItemTitle':return Hi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x47b085);case'updateItemPinned':{const _0x4981cc=Hi(this['context']['locale'],_0x11b6a0?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Hi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x4981cc,_0x47b085]);}case'removeItem':return Hi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x47b085);case'init':case'loadItems':return Hi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return Hi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0x28e029=new Date(),_0x5d695c=new Date(_0x28e029['getFullYear'](),_0x28e029['getMonth'](),_0x28e029['getDate']()),_0x18ea36=new Date(_0x5d695c);_0x18ea36['setDate'](_0x18ea36['getDate']()-0x1);const _0xb77e62=new Date(_0x5d695c);_0xb77e62['setDate'](_0xb77e62['getDate']()-0xe);const _0x4dd2c7=this['history']['getItems']({'pinned':!0x0}),_0x307454=this['history']['getItems']({'from':_0x5d695c,'to':_0x5d695c}),_0x168e92=this['history']['getItems']({'from':_0x18ea36,'to':_0x18ea36}),_0x2f0dad=this['history']['getItems']({'from':_0xb77e62,'to':_0x18ea36}),_0x5813c7=this['history']['getItems']({'to':_0xb77e62}),_0x47b98d=[];return _0x4dd2c7['length']>0x0&&_0x47b98d['push']({'title':Hi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x4dd2c7}),_0x307454['length']>0x0&&_0x47b98d['push']({'title':Hi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x307454}),_0x168e92['length']>0x0&&_0x47b98d['push']({'title':Hi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x168e92}),_0x2f0dad['length']>0x0&&_0x47b98d['push']({'title':Hi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x2f0dad}),_0x5813c7['length']>0x0&&_0x47b98d['push']({'title':Hi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x5813c7}),_0x47b98d;}}class AIChatHistory extends _0xaac0f5{static get['requires'](){return[AIChatHistoryController,AIChatHistoryUI];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class AIChat extends _0xaac0f5{static get['requires'](){return[AIChatController,AIEditing,AIChatUI,AIChatHistory];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x30cfa5){super(_0x30cfa5),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'sources':[],'alwaysAddSelection':!0x1}),this['context']['config']['define']('ai.chat.initialConversation','new');}}class AIChatShortcutView extends vt{['id'];constructor(_0x4903f8,_0x588764){super(_0x4903f8);const {id:_0x1e30a1,type:_0x5bf4c0,icon:_0x2838fb}=_0x588764;this['id']=_0x1e30a1,this['set']({'label':_0x588764['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x588764['id']}}),_0x2838fb?this['icon']=_0x2838fb:'chat'===_0x5bf4c0?this['icon']=_0x23270b:'review'===_0x5bf4c0?this['icon']=_0x55b258:'translate'===_0x5bf4c0&&(this['icon']=_0x57b550);}}class AIChatShortcutsView extends Nt{['listView'];constructor(_0x58d9b0,_0x3bd805){super(_0x58d9b0);const _0x518338=_0x3bd805['map'](_0x93d5ec=>{const _0x756e36=new Pt(this['locale']),_0x3a0b77=new AIChatShortcutView(this['locale'],_0x93d5ec);return _0x756e36['children']['add'](_0x3a0b77),_0x3a0b77['delegate']('execute')['to'](this),_0x756e36;});this['listView']=new Dt(this['locale']),this['listView']['items']['addMany'](_0x518338),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}}const yn='chat-shortcuts';class AIChatShortcuts extends _0xaac0f5{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];static get['requires'](){return[AIChatUI];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiChatUI']=this['context']['plugins']['get'](AIChatUI),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x4a37b4=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{_0x4a37b4['activeConversation']['isFromHistory']||this['_injectShortcuts']();}),this['listenTo'](_0x4a37b4,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0xb04861=['chat','review','translate'];this['_shortcuts']['forEach'](_0x38c510=>{let _0x1006e2=!0x0;if(_0x38c510['id']&&_0x38c510['label']&&_0xb04861['includes'](_0x38c510['type'])?'chat'===_0x38c510['type']&&(_0x1006e2='string'==typeof _0x38c510['prompt']):_0x1006e2=!0x1,!_0x1006e2)throw new at('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x38c510});});}['_injectShortcuts'](){const _0x29b40c=this['context']['plugins']['get'](AIChatUI);this['_shortcutsView']=new AIChatShortcutsView(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),_0x29b40c['addFeedItemCustomElement'](this['_shortcutsView']['element'],yn),this['_shortcutsView']['on']('execute',_0x430319=>{const _0xccb33d=_0x430319['source']['id'];this['_executeShortcut'](_0xccb33d);});}['_removeShortcuts'](){const _0xe4efe5=this['context']['plugins']['get'](AIChatUI);_0xe4efe5['hasFeedItem'](yn)&&_0xe4efe5['removeFeedItem'](yn),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x2dda16){const _0x70d3a=this['_shortcuts']['find'](_0x254539=>_0x254539['id']===_0x2dda16),_0xa32c48=_0x70d3a['type'];'chat'===_0xa32c48?this['_runChatShortcut'](_0x70d3a):'review'===_0xa32c48?_0x70d3a['commandId']?this['_runReviewShortcut'](_0x70d3a):this['_switchTab']('reviewMode'):'translate'===_0xa32c48&&(_0x70d3a['language']?this['_runTranslateShortcut'](_0x70d3a):this['_switchTab']('translate'));}['_switchTab'](_0x378466){if(!this['context']['plugins']['has']('AITabs'))throw new at('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x378466});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x378466);}async['_runChatShortcut']({prompt:_0x1634b2,draftMode:_0x14a76c,useWebSearch:_0x2c98ed=!0x1,useReasoning:_0x3b991d=!0x1,model:_0x2453ef}){const _0x22f84a=this['context']['plugins']['get']('AIChatController'),_0x3f1e82=_0x22f84a['activeConversation'];let _0x51442a;_0x51442a=_0x2453ef?await _0x3f1e82['chatModels']['getModel'](_0x2453ef):await _0x3f1e82['chatModels']['getDefault'](),_0x51442a&&await _0x3f1e82['setModel'](_0x51442a),_0x3f1e82['setWebSearch'](_0x2c98ed),_0x3f1e82['setReasoning'](_0x3b991d),_0x22f84a['addCurrentDocumentToChatContext'](),_0x14a76c?(this['_aiChatUI']['setPromptInputValue'](_0x1634b2),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x22f84a['sendMessage']({'message':_0x1634b2});}['_runReviewShortcut']({commandId:_0x6b4ddc,model:_0x19fa8d,prompt:_0xb411b9,params:_0x126d01}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new at('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x8ce537={'id':_0x6b4ddc,'isCustom':'custom'===_0x6b4ddc};_0x19fa8d&&_0xb411b9&&(_0x8ce537['args']={'model':_0x19fa8d,'prompt':_0xb411b9}),_0x126d01&&(_0x8ce537['params']=_0x126d01),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x8ce537);}['_runTranslateShortcut']({language:_0x1dc980}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new at('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x1dc980,'args':{'language':_0x1dc980}});}}class ToggleAICommand extends _0x1a582e{constructor(_0x1faee3){super(_0x1faee3);const _0x221f9e=_0x1faee3['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x221f9e,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0xb6c0d8=this['editor']['plugins']['get']('AITabs')['view'];_0xb6c0d8['isVisible']=!_0xb6c0d8['isVisible'];}}class AIToggleButtonUI extends _0x446a45{static get['requires'](){return[AITabs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x308804=this['editor'];_0x308804['commands']['add']('toggleAi',new ToggleAICommand(_0x308804)),_0x308804['ui']['componentFactory']['add']('toggleAi',()=>{const _0x5aa58a=this['_createAIUIButton'](vt);return _0x5aa58a['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x5aa58a;}),_0x308804['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x1837b9=this['_createAIUIButton'](Wt);return _0x1837b9['set']({'role':'menuitemcheckbox'}),_0x1837b9;});}['_createAIUIButton'](_0x161a10){const _0x224139=this['editor'],_0x324365=_0x224139['commands']['get']('toggleAi'),_0x2dc788=new _0x161a10(_0x224139['locale']);return _0x2dc788['set']({'label':Hi(_0x224139['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x17bb2f,'isToggleable':!0x0}),_0x2dc788['bind']('isEnabled')['to'](_0x324365),_0x2dc788['bind']('isOn')['to'](_0x324365,'value',_0x4dc1e3=>!!_0x4dc1e3),this['listenTo'](_0x2dc788,'execute',()=>{_0x324365['execute']();}),_0x2dc788;}}const xn=['applySuggestion','insertSuggestion','showNext','showPrevious'];class AIBalloonView extends Nt{['_errorView'];constructor(_0x1c37ec){super(_0x1c37ec),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x194b49){this['showError'](_0x194b49);}['showError'](_0xfbadaf){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0xfbadaf,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x486ab6=new Nt(this['locale']),_0x2e294d=new Nt(this['locale']);return _0x2e294d['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x486ab6['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x1fb4e6=>!_0x1fb4e6)]},'children':[_0x2e294d]}),_0x486ab6;}}const Ln=0xa;class AIBalloon extends _0xaac0f5{static get['requires'](){return[AIEditing];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_getTargetEditor'](){return this['_currentConfig']?.['targetEditor']??ds(this['context']);}['_isUpdatingMarkers']=!0x1;['open'](_0x4c9b49){const {id:_0x2ba4bf}=this['_currentConfig']??{};this['_currentConfig']=_0x4c9b49;const {id:_0x55a9b0}=this['_currentConfig'];this['isOpen']&&_0x2ba4bf===_0x55a9b0?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x335411=this['_getTargetEditor']()['plugins']['get']('Dialog');_0x335411['isOpen']&&this['_currentConfig']&&_0x335411['id']===this['_currentConfig']['id']&&_0x335411['hide']();}['_updateDialog'](){const _0x8aa62e=this['_getTargetEditor']()['plugins']['get']('Dialog'),{icon:_0x1a0b62,title:_0x4575d0}=this['_currentConfig'];_0x8aa62e['view']?.['headerView']&&(_0x8aa62e['view']['headerView']['label']=_0x4575d0,_0x8aa62e['view']['headerView']['iconView']&&_0x1a0b62&&(_0x8aa62e['view']['headerView']['iconView']['content']=_0x1a0b62)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x8aa62e['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['showFakeVisualSelection']({'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x2f0e17=this['_getTargetEditor']()['plugins']['get']('Dialog'),{id:_0xbdebb8,title:_0x2717fc,icon:_0xf56ac0,class:_0x1fd133,mainView:_0x1a7dc3}=this['_currentConfig'];_0x1a7dc3['delegate'](...xn)['to'](this),_0x2f0e17['show']({'title':_0x2717fc,'icon':_0xf56ac0,'hasCloseButton':!0x0,'id':_0xbdebb8,'position':this['_calculateDialogPosition']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x1fd133||''),'content':_0x1a7dc3,'onShow':_0x3ab91d=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x3ab91d['view']?.['updatePosition']();const _0x1ec800=this['_getSelectionElements']();_0x1ec800&&_0x1ec800[0x0]&&wt({'target':_0x1ec800[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x3ab91d['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0xbdebb8});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0xbdebb8}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x3eb3fb,_0x2d4f20){if(!_0x2d4f20){const _0xaae715=this['_getTargetRootDomRect']();if(!_0xaae715)return null;_0x2d4f20=_0xaae715;}const _0xe94c0a=this['_getSelectionElements']();if(!_0xe94c0a||0x0===_0xe94c0a['length'])return{'left':Math['round'](_0x2d4f20['left']+_0x2d4f20['width']/0x2-_0x3eb3fb['width']/0x2),'top':Math['round'](_0x2d4f20['top']+_0x2d4f20['height']/0x2-_0x3eb3fb['height']/0x2)};const _0x3d6146=Math['round'](_0x2d4f20['left']+_0x2d4f20['width']/0x2-_0x3eb3fb['width']/0x2),_0x865434=_0xe94c0a['map'](_0x2148d5=>new ut(_0x2148d5)),_0x5d7cdb=_0x3eb3fb['height'];return{'left':_0x3d6146,'top':this['_calculateOptimalTopPosition'](_0x865434,_0x5d7cdb,_0x2d4f20)};}['_calculateOptimalTopPosition'](_0x4fd6f4,_0x107fb5,_0x254013){const _0x20e70a=new ut(ct['window']),_0x3f6437=_0x4fd6f4['map'](_0x51ccbd=>_0x51ccbd['getVisible']())['filter'](_0x41a489=>_0x41a489),_0x4b5ecd=ut['getBoundingRect'](_0x3f6437);if(!_0x4b5ecd)return Math['round'](_0x254013['top']+_0x254013['height']/0x2);const _0x1f4aa7=_0x20e70a['getIntersection'](_0x4b5ecd);if(!_0x1f4aa7)return Math['round'](_0x254013['top']+_0x254013['height']/0x2);const _0x51dc3c=_0x254013['getVisible'](),_0x15e9d2=_0x51dc3c&&_0x4b5ecd['height']>_0x51dc3c['height'],_0x39cf61=_0x1f4aa7['top'],_0x5f0269=_0x1f4aa7['bottom'];if(_0x15e9d2){const _0x2c0dca=(_0x51dc3c||_0x20e70a)['height']/0x2-_0x107fb5/0x2,_0x4b15d3=_0x39cf61-Ln-_0x254013['top'],_0x2cf042=_0x254013['bottom']-_0x5f0269-Ln;return _0x4b15d3>=_0x107fb5?Math['max'](Ln,_0x39cf61-_0x107fb5-Ln):_0x2cf042>=_0x107fb5?_0x5f0269+Ln:Math['max'](Ln,_0x2c0dca);}const _0x541f2f=_0x39cf61-_0x107fb5,_0x182b8e=_0x254013['bottom']-_0x5f0269-Ln,_0x5ee0fd=_0x39cf61-Ln-_0x254013['top'];let _0x55f25f;if(_0x182b8e>=_0x107fb5)_0x55f25f=_0x5f0269+Ln;else{if(_0x5ee0fd>=_0x107fb5)_0x55f25f=_0x541f2f-Ln;else _0x55f25f=_0x39cf61+_0x4b5ecd['height']/0x2-_0x107fb5/0x2;}return _0x55f25f;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x2b9c97=this['_getTargetEditor']();this['listenTo'](_0x2b9c97['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x177427,data:{newRange:_0x1f75ab}}of _0x2b9c97['model']['document']['differ']['getChangedMarkers']())if(_0x177427['startsWith'](As+':')&&(_0x1f75ab&&(_0x1f75ab['start']['isEqual'](_0x1f75ab['end'])||'$graveyard'==_0x1f75ab['root']['rootName'])||null==_0x1f75ab)){const _0x59d8b9=Hi(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x59d8b9),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x5e7e91=this['_getTargetEditor']();this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x5e7e91['model']['document']);}['_getSelectionElements'](){const _0x2f0ac2=this['_getTargetEditor']();return _0x22276b(_0x2f0ac2['editing'],[..._0x2f0ac2['model']['markers']['getMarkersGroup']('ai-selection'),..._0x2f0ac2['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getTargetRootDomRect'](){const _0x170d9b=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];if(!_0x170d9b)return null;const _0xf8f46f=this['_getTargetEditor'](),_0x530d5c=_0xf8f46f['editing']['view']['document']['getRoot'](_0x170d9b['rootName']);if(!_0x530d5c)return null;const _0x4d71b1=_0xf8f46f['editing']['view']['domConverter']['mapViewToDom'](_0x530d5c);return _0x4d71b1&&_0x4d71b1 instanceof HTMLElement?new ut(_0x4d71b1):null;}}class AIMiniToolbarView extends kt{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x30b94e,_0x1f5d9d={}){super(_0x30b94e),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x1f5d9d};const _0x2803ab=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x2803ab?'ck-ai-mini-toolbar\x20ck-hidden':'ck-ai-mini-toolbar',this['_config']['showCopy']&&(this['_setupCopyButton'](),this['items']['add'](this['copyButton'])),this['_config']['showChanges']&&(this['_setupShowChangesButton'](),this['items']['add'](this['showChangesButton'])),this['_setupRatingButtons'](),this['_config']['showLike']&&this['items']['add'](this['likeButton']),this['_config']['showDislike']&&this['items']['add'](this['dislikeButton']),this['_config']['customView']&&this['items']['addMany'](this['_config']['customView']);}['toggleShowChangesEnabled'](_0x25c518){this['showChangesButton']['isEnabled']=_0x25c518;}['_setupRatingButtons'](){this['likeButton']=new vt(this['locale']),this['likeButton']['set']({'icon':_0x5d0aa3,'label':Hi(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':Bi,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new vt(this['locale']),this['dislikeButton']['set']({'icon':_0x166134,'label':Hi(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':Bi,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new vt(this['locale']),this['copyButton']['set']({'icon':_0x4b94a4,'label':Hi(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+Bi,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0xaf3d32=new xt();_0xaf3d32['set']({'content':_0x413c73}),_0xaf3d32['extendTemplate']({'attributes':{'class':['ck-ai-mini-toolbar-copy-button__check-mark']}}),this['copyButton']['on']('execute',()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20ck-ai-mini-toolbar-copy-button_copied\x20'+Bi,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+Bi;},0x7d0);}),this['copyButton']['children']['add'](_0xaf3d32);}['_setupShowChangesButton'](){this['showChangesButton']=new vt(this['locale']),this['showChangesButton']['set']({'icon':_0x352036,'label':Hi(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':Bi}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x2ed300=>_0x2ed300?_0x24b69b:_0x352036),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}}class AIChatBalloonView extends AIBalloonView{['children'];['nextButtonView'];['previousButtonView'];['focusCycler'];['_focusables'];['_focusTracker'];['_keystrokes'];['_config'];['_streamableContentView'];['_toolbarContainerView'];['_partToolbarView'];['_stateView'];['_miniToolbarView'];constructor(_0x20ad83,_0x2dd5be){super(_0x20ad83);const _0x16fece=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new _t(),this['_keystrokes']=new It(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Mt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x2dd5be,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x20ad83),this['_partToolbarView']=new AISuggestionContentPartToolbarView(_0x20ad83,_0x2dd5be['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x2dd5be),this['_stateView']=new AISuggestionContentPartStateView(_0x20ad83),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new AIMiniToolbarView(_0x20ad83,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new AIChatBalloonToolbarContainerView(_0x20ad83,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x2b6f0d,_0x4b66d0,_0x3850cb,_0x3ac653)=>{let _0x3ed1c2,_0xc08eee;'pending'===_0x3ac653?(_0x3ed1c2=this['_partToolbarView'],_0xc08eee=this['_stateView']):(_0x3ed1c2=this['_stateView'],_0xc08eee=this['_partToolbarView']),this['_stateView']['setState'](_0x3850cb),_0x3ed1c2['isVisible']=!0x1,_0xc08eee['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x16fece['to']('_state',_0x3cd2b3=>'ck-ai-chat-balloon-main_state_'+_0x3cd2b3)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x2dd5be);});}['render'](){super['render'](),this['nextButtonView']['render'](),this['previousButtonView']['render'](),this['_focusTracker']['add'](this['element']),this['_focusTracker']['add'](this['nextButtonView']),this['_focusTracker']['add'](this['previousButtonView']),this['_focusTracker']['add'](this['_miniToolbarView']),this['_focusTracker']['add'](this['_partToolbarView']),this['_keystrokes']['listenTo'](this['element']),this['_keystrokes']['listenTo'](this['nextButtonView']['element']),this['_keystrokes']['listenTo'](this['previousButtonView']['element']),this['_focusables']['addMany']([this['nextButtonView'],this['previousButtonView'],this['_partToolbarView'],this['_miniToolbarView']]);}['destroy'](){super['destroy'](),this['previousButtonView']['destroy'](),this['nextButtonView']['destroy']();}['focus'](){this['focusCycler']['focusFirst']();}['focusLast'](){this['focusCycler']['focusLast']();}async['updateContent'](_0x23b66c){_0x23b66c?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x23b66c);}['setState'](_0x254f29){this['_state']=_0x254f29;}['showError'](_0x425149){super['showError'](_0x425149),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0xa04943){super['showBlockingError'](_0xa04943),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x31d540){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x31d540;}['togglePartToolbarEnabled'](_0x5a6086){this['_partToolbarView']['isEnabled']=_0x5a6086;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x200349,showSuggestButton:_0x4d4fe6}){_0x200349=_0x200349&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x4d4fe6=_0x4d4fe6&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x200349,'showSuggestButton':_0x4d4fe6});}['_createNextButtonView'](){const _0x5908c9=new vt(this['locale']);return _0x5908c9['set']({'icon':_0x46f285,'label':Hi(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x5908c9['on']('execute',()=>{this['fire']('showNext');}),_0x5908c9;}['_createPreviousButtonView'](){const _0x198e66=new vt(this['locale']);return _0x198e66['set']({'icon':_0x136853,'label':Hi(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x198e66['on']('execute',()=>{this['fire']('showPrevious');}),_0x198e66;}}class AIChatBalloonToolbarContainerView extends Nt{constructor(_0x458c6f,_0x2fa3c3){super(_0x458c6f),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x2fa3c3});}}class AIChatBalloon extends _0x446a45{static get['requires'](){return[Bt,AIBalloon];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x4840a0){super(_0x4840a0),this['set']('showDiff',!0x1);}['open'](_0x59295c){const _0x671156=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x671156['plugins']['get']('AIBalloon')['open']({..._0x59295c,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x59295c['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x59295c['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x3773ac){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x3773ac);}['setState'](_0x3a7087){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x3a7087);}['_createChatBalloonView'](){const _0x2284e4=this['editor'],_0x4ca416=_0x2284e4['plugins']['get']('AIBalloon'),_0x16c310=_0x2284e4['commands']['get']('trackChanges');let _0xe57fe2=_0x2284e4['config']['get']('ai.availableReplyActions')||[...bs];_0x2284e4['plugins']['has']('TrackChanges')||(_0xe57fe2=_0xe57fe2['filter'](_0x101d78=>'insertSuggestion'!=_0x101d78));const _0x42d58c=new AIChatBalloonView(_0x2284e4['locale'],{'availableActions':_0xe57fe2,'showApplyButton':!0x0,'showSuggestButton':!!_0x16c310});return _0x42d58c['bind']('showDiff')['to'](this),_0x42d58c['delegate'](...Cs)['to'](this),_0x42d58c['delegate']('showPrevious','showNext')['to'](this),_0x4ca416['delegate']('dialogClosed')['to'](this),_0x42d58c['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x42d58c['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x42d58c['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x16c310&&_0x42d58c['bind']('isTrackChangesOn')['to'](_0x16c310,'value'),_0x42d58c['render'](),_0x42d58c;}['_toggleRotatorButtonsInDialogHeader'](_0xe96e51){const _0x5bc829=this['editor'],_0x37eb05=_0x5bc829['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0xe96e51),_0x37eb05['has'](this['_chatBalloonView']['previousButtonView'])||(_0x37eb05['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x5bc829['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x37eb05['remove'](this['_chatBalloonView']['previousButtonView']),_0x37eb05['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}}class AIEditorIntegration extends _0x446a45{static get['requires'](){return[AIToggleButtonUI,AIChatBalloon,_0xeedcfe];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}function Dn(_0x268ac0){const {editor:_0x13a911,action:_0x4d59e1,withText:_0x12459c=!0x1,withIcon:_0x35776b=!0x0,isInDropdown:_0x89e8b9=!0x0,shouldPreventFocus:_0x311389=!0x1}=_0x268ac0;return()=>{const _0x3d2b61=_0x13a911['locale'],_0x12a836=new vt(_0x3d2b61),_0x1b2f50=_0x12a836['bindTemplate'];_0x89e8b9&&_0x12a836['extendTemplate']({'on':{'mouseenter':_0x1b2f50['to'](()=>{_0x311389&&_0x311389()||_0x12a836['focus']();})}});const _0x1b0adc=_0x4d59e1['icon']??_0x4d59e1['parent']?.['icon'];return _0x12a836['set']({'label':_0x4d59e1['label'],'withText':_0x12459c,'role':'menuitem','icon':_0x35776b?_0x1b0adc??_0x3c6075:void 0x0,'tooltip':!_0x12459c,'class':'ck-ai-quick-actions-button','isEnabled':_0x4d59e1['isEnabled']}),_0x12a836['on']('execute',()=>{_0x13a911['editing']['view']['focus'](),_0x13a911['commands']['execute']('aiQuickAction',_0x4d59e1);}),_0x12a836;};}class DropdownMenuButtonWithHighlightView extends _0x3eb8ab{['arrowView'];constructor(_0x3007f3,_0x51e5a0){super(_0x3007f3,_0x51e5a0);const _0x3ab390=this['bindTemplate'];this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':['ck-dropdown-menu-list__nested-menu__button'],'aria-haspopup':!0x0,'aria-expanded':this['bindTemplate']['to']('isOn',_0x1201e8=>String(_0x1201e8)),'data-cke-tooltip-disabled':_0x3ab390['to']('isOn')},'on':{'mouseenter':_0x3ab390['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x49da5e=new xt();return _0x49da5e['content']=_0xbcd6d6,_0x49da5e['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x49da5e;}}class AIQuickActionsFilteredListView extends Dt{['_allListItems'];['_allSearchableItems'];constructor(_0x3f528b,_0x404691,_0x3d158b){super(_0x3f528b),this['_allListItems']=_0x404691,this['_allSearchableItems']=_0x3d158b;}['filter'](_0x216304){if(!_0x216304)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x4927b1=_0x216304['source']['toLowerCase']()['trim'](),_0x3584ad=this['_allSearchableItems']['filter'](_0x4d20f7=>(_0x4d20f7['groupLabel']?_0x4d20f7['label']+'\x20('+_0x4d20f7['groupLabel']+')':_0x4d20f7['label'])['toLowerCase']()['includes'](_0x4927b1));return this['items']['clear'](),this['items']['addMany'](_0x3584ad['sort']((_0x4990fb,_0x56fa70)=>{const _0x38ca4b=_0x4990fb['groupLabel'],_0xb529b=_0x56fa70['groupLabel'];return _0x38ca4b||_0xb529b?_0x38ca4b?0x1:-0x1:0x0;})['map'](_0x3e504a=>_0x3e504a['item'])),this['_highlightQuery'](_0x4927b1,_0x3584ad),{'resultsCount':_0x3584ad['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x448a04,_0xbf6d94){if(!_0x448a04)return;const _0x44b311=new RegExp(_0x42274b(_0x448a04),'gi');_0xbf6d94['forEach'](_0x266c6c=>{_0x266c6c['highlightViews']&&_0x266c6c['highlightViews']['forEach'](_0x6fabb0=>{'function'==typeof _0x6fabb0['highlightText']&&_0x6fabb0['highlightText'](_0x44b311);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x14681b=>{_0x14681b['highlightViews']&&_0x14681b['highlightViews']['forEach'](_0x2b0611=>{'function'==typeof _0x2b0611['highlightText']&&_0x2b0611['highlightText'](null);});});}}const Vn='menu',Pn='menuitem';class AIQuickActionsDropdownContentView extends Nt{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];constructor(_0x43525e,_0x4ae149,_0xce3614,_0x2a6b4d,_0x780c4b=!0x1){const _0x4e555e=_0x43525e['locale'];super(_0x4e555e),this['_bodyCollection']=_0x2a6b4d,this['_hasSearch']=_0x780c4b;const _0x515b2c=this['_createListItems'](_0x43525e,_0x4ae149,_0xce3614);this['optionsListView']=new AIQuickActionsFilteredListView(_0x4e555e,_0x515b2c,this['_allSearchableItems']),this['optionsListView']['role']=Vn,this['optionsListView']['items']['addMany'](_0x515b2c),this['focusTracker']=new _t(),this['keystrokes']=new It(),_0x780c4b&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x515b2c,this['focusCycler']=new Mt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x780c4b&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x25afc6=_0x780c4b&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x1ec894(_0x25afc6),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x4e555e['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x135d11(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':Hi(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':Hi(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x2a8a0c=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x2a8a0c);}['_createListItems'](_0x49438c,_0x4cffd0,_0x137c30){const _0x24830d=new _0x1ec894();return _0x4cffd0['forEach'](_0x4a339a=>{if('actions'in _0x4a339a){const {listItem:_0x29953b}=this['_createActionGroupButton'](_0x49438c,_0x4a339a,_0x137c30);_0x24830d['add'](_0x29953b),_0x4a339a['actions']['forEach'](_0x531069=>{this['_createActionButton'](_0x49438c,_0x531069,_0x4a339a['label'],_0x4a339a['icon']);const {listItem:_0x1fe98e,highlightViews:_0x25aac8}=this['_createSearchResultActionButton'](_0x49438c,_0x531069,_0x4a339a['label'],_0x4a339a['icon']);this['_allSearchableItems']['push']({'item':_0x1fe98e,'label':_0x531069['label'],'groupLabel':_0x4a339a['label'],'highlightViews':_0x25aac8});});}else{const {listItem:_0x173900}=this['_createActionButton'](_0x49438c,_0x4a339a);_0x24830d['add'](_0x173900);const _0x527e79=_0x173900['children']['first'];if(_0x527e79){const {listItem:_0x7a23f6,highlightViews:_0x5c99b3}=this['_createSearchResultActionButton'](_0x49438c,_0x4a339a);this['_allSearchableItems']['push']({'item':_0x7a23f6,'label':_0x527e79['label']||'','highlightViews':_0x5c99b3});}}}),_0x24830d;}['_createActionButton'](_0x555674,_0x38e794,_0x58f59d,_0x912b7f){const _0x3ac563=new Pt(this['locale']);if(_0x58f59d&&_0x912b7f){const _0x5eac2d=new vt(this['locale']),_0x27fba8=_0x5eac2d['bindTemplate'],_0x406341=new _0x177892();_0x406341['text']=_0x38e794['label'];const _0x40f86c=new _0x177892();_0x40f86c['text']=_0x58f59d;const _0x304dff=new xt();_0x304dff['content']=_0x912b7f,_0x304dff['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x5aab1c=new Nt(this['locale']);_0x5aab1c['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x254deb=new Nt(this['locale']);return _0x254deb['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x5eac2d['set']({'label':_0x38e794['label']+'\x20('+_0x58f59d+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1}),_0x5eac2d['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group'],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x406341,_0x5aab1c,_0x304dff,_0x40f86c,_0x254deb],'on':{'mouseenter':_0x27fba8['to'](()=>{this['_isSearchFocused']()||_0x5eac2d['focus']();}),'click':_0x27fba8['to'](()=>{_0x5eac2d['fire']('execute');})}}),_0x5eac2d['on']('execute',()=>{_0x555674['editing']['view']['focus'](),_0x555674['commands']['execute']('aiQuickAction',_0x38e794);}),_0x3ac563['children']['add'](_0x5eac2d),{'listItem':_0x3ac563,'highlightViews':[_0x406341,_0x40f86c]};}{const _0x25de83=new _0x1f5d98(),_0x49763b=new vt(this['locale'],_0x25de83),_0x46c263=_0x49763b['bindTemplate'],_0x34212e=_0x38e794['icon']??_0x38e794['parent']?.['icon'],_0x4fced6=void 0x0!==_0x38e794['icon'];return _0x49763b['set']({'label':_0x38e794['label'],'withText':!0x0,'role':'menuitem','icon':_0x4fced6?_0x34212e??_0x3c6075:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button'}),_0x49763b['extendTemplate']({'on':{'mouseenter':_0x46c263['to'](()=>{this['_isSearchFocused']()||_0x49763b['focus']();})}}),_0x49763b['on']('execute',()=>{_0x555674['editing']['view']['focus'](),_0x555674['commands']['execute']('aiQuickAction',_0x38e794);}),_0x3ac563['children']['add'](_0x49763b),{'listItem':_0x3ac563,'highlightViews':[_0x25de83]};}}['_createSearchResultActionButton'](_0xb24be7,_0x2f8c81,_0x161538,_0x9204dc){return _0x161538&&_0x9204dc?this['_createSearchResultGroupedActionButton'](_0xb24be7,_0x2f8c81,_0x161538,_0x9204dc):this['_createSearchResultIndividualActionButton'](_0xb24be7,_0x2f8c81);}['_createSearchResultGroupedActionButton'](_0x47c35a,_0x38c266,_0x119e80,_0x2db318){const _0x1c59d6=new Pt(this['locale']),_0x3b7a9f=new vt(this['locale']),_0x5cc4a2=_0x3b7a9f['bindTemplate'],{view:_0xc48dd5,highlightView:_0x5b7e8c}=this['_createSearchResultGroupRow'](_0x119e80,_0x2db318),{view:_0xb91cc9,highlightView:_0x2ee0c5}=this['_createSearchResultActionRow'](_0x38c266['label']),_0x237309=this['_createSearchResultContentView'](_0xc48dd5,_0xb91cc9);return _0x3b7a9f['set']({'label':_0x38c266['label'],'withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button\x20ck-ai-quick-actions-search-result-button_with-group','tooltip':!0x1}),_0x3b7a9f['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-search-result-button','ck-ai-quick-actions-search-result-button_with-group'],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x237309],'on':{'mouseenter':_0x5cc4a2['to'](()=>{this['_isSearchFocused']()||_0x3b7a9f['focus']();}),'click':_0x5cc4a2['to'](()=>{this['_handleSearchResultButtonClick'](_0x3b7a9f);})}}),this['_setupActionButtonExecution'](_0x3b7a9f,_0x47c35a,_0x38c266),_0x1c59d6['children']['add'](_0x3b7a9f),{'listItem':_0x1c59d6,'highlightViews':[_0x5b7e8c,_0x2ee0c5]};}['_createSearchResultIndividualActionButton'](_0x5252c2,_0x5c02b7){const _0x3b5de4=new Pt(this['locale']),_0x1fcfab=new _0x1f5d98(),_0x1ffc14=new vt(this['locale'],_0x1fcfab),_0x3fc76a=_0x1ffc14['bindTemplate'];return _0x1ffc14['set']({'label':_0x5c02b7['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button'}),_0x1ffc14['extendTemplate']({'on':{'mouseenter':_0x3fc76a['to'](()=>{this['_isSearchFocused']()||_0x1ffc14['focus']();})}}),this['_setupActionButtonExecution'](_0x1ffc14,_0x5252c2,_0x5c02b7),_0x3b5de4['children']['add'](_0x1ffc14),{'listItem':_0x3b5de4,'highlightViews':[_0x1fcfab]};}['_createSearchResultGroupRow'](_0xb1036e,_0x26ac90){const _0x3db9f2=new Nt(this['locale']),_0x2952ed=new xt();_0x2952ed['content']=_0x26ac90,_0x2952ed['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0xf37d90=new _0x177892();return _0xf37d90['text']=_0xb1036e,_0x3db9f2['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x2952ed,_0xf37d90]}),{'view':_0x3db9f2,'highlightView':_0xf37d90};}['_createSearchResultActionRow'](_0x964dbd){const _0x5b3f1b=new Nt(this['locale']),_0x590357=new _0x177892();return _0x590357['text']=_0x964dbd,_0x5b3f1b['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x590357]}),{'view':_0x5b3f1b,'highlightView':_0x590357};}['_createSearchResultContentView'](_0x32ee25,_0xf10516){const _0xf04937=new Nt(this['locale']);return _0xf04937['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x32ee25,_0xf10516]}),_0xf04937;}['_setupActionButtonExecution'](_0x4ef283,_0x432c07,_0x548f3c){_0x4ef283['on']('execute',()=>{_0x432c07['editing']['view']['focus'](),_0x432c07['commands']['execute']('aiQuickAction',_0x548f3c);});}['_createActionGroupButton'](_0x41df43,_0x25dad2,_0x328eca){const _0x34748b=new Pt(this['locale']),_0x5ef7e7=new _0x1f5d98(),_0x21e3e6=new DropdownMenuButtonWithHighlightView(this['locale'],_0x5ef7e7),_0x3111b2=_0x21e3e6['bindTemplate'],_0x104c2c=this['_getPanelKeystroke'](_0x328eca),_0x1d73d3=this['_createGroupActionsList'](_0x41df43,_0x25dad2['actions'],_0x328eca);_0x21e3e6['set']({'label':_0x25dad2['label'],'withText':!0x0,'role':Pn,'icon':_0x25dad2['icon']??_0x3c6075,'isEnabled':_0x25dad2['actions']['some'](_0x21ab6c=>_0x21ab6c['isEnabled'])}),_0x21e3e6['extendTemplate']({'on':{'mouseenter':_0x3111b2['to'](()=>{this['_isSearchFocused']()||_0x21e3e6['focus']();})}});const _0x40f021=new Xt(this['locale']);return _0x40f021['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x3111b2['to'](_0x229fde=>{this['_handlePanelKeydown'](_0x229fde,_0x104c2c,_0x21e3e6,_0x40f021);})}}),_0x21e3e6['bind']('isOn')['to'](_0x40f021,'isVisible'),this['_bodyCollection']['add'](_0x40f021),_0x40f021['content']['add'](_0x1d73d3),this['_setupGroupMenuBehavior'](_0x21e3e6,_0x40f021),_0x34748b['children']['add'](_0x21e3e6),{'listItem':_0x34748b,'highlightView':_0x5ef7e7};}['_createGroupActionsList'](_0x24e372,_0x3552e1,_0x1647f5){const _0x4de763=new Dt(this['locale']);return _0x4de763['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x3552e1['forEach'](_0x5bd9cd=>{const _0xbee1cb=new Pt(this['locale']),_0x36f641=Dn({'editor':_0x24e372,'action':_0x5bd9cd,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused']()})();_0xbee1cb['children']['add'](_0x36f641),_0x1647f5['focusTracker']['add'](_0x36f641),_0x4de763['items']['add'](_0xbee1cb);}),_0x4de763;}['_setupGroupMenuBehavior'](_0x52d378,_0xfca44d){const _0x17e7c4=_0x52d378['bindTemplate'],_0x393f8e=this['_getButtonKeystroke'](_0x52d378);_0x52d378['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x17e7c4['to'](()=>{this['_showNestedPanel'](_0xfca44d,_0x52d378);}),'mouseleave':_0x17e7c4['to'](_0x41e0aa=>{const _0x53377e=_0x41e0aa['relatedTarget'];this['_isMovingToNestedMenu'](_0x53377e,_0xfca44d)||this['_hideNestedPanel'](_0xfca44d);}),'keydown':_0x17e7c4['to'](_0x419fb6=>{_0x419fb6['key']==_0x393f8e&&(this['_showNestedPanel'](_0xfca44d,_0x52d378),_0xfca44d['content']['get'](0x0)['focus']());})}}),_0xfca44d['on']('render',()=>{_0xfca44d['element']?.['addEventListener']('mouseleave',_0x3d0c1e=>{const _0x1fefcd=_0x3d0c1e['relatedTarget'];_0x52d378['element']?.['contains'](_0x1fefcd)||this['_isMovingToNestedMenu'](_0x1fefcd,_0xfca44d)||this['_hideNestedPanel'](_0xfca44d);});});}['_showNestedPanel'](_0xbca025,_0x89b78e){this['_openNestedPanels']['forEach'](_0x1d4291=>{_0x1d4291!==_0xbca025&&_0x1d4291['isVisible']&&_0x1d4291['hide']();}),_0xbca025['show'](),_0xbca025['pin']({'positions':[_0x397b48['eastSouth']],'target':_0x89b78e['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0xbca025);}['_hideNestedPanel'](_0x2308d9){_0x2308d9['hide'](),this['_openNestedPanels']['delete'](_0x2308d9);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0xd86e21=>_0xd86e21['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x515eee,_0x16099e){if(!_0x515eee)return!0x1;if(_0x16099e['element']?.['contains'](_0x515eee))return!0x0;const _0x5b94de=_0x515eee;return _0x5b94de['closest']&&(null!==_0x5b94de['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x5b94de['closest']('.ck-ai-quick-actions-group-list')||null!==_0x5b94de['closest']('.ck-ai-quick-actions-group-button'));}['resetSearch'](){this['_searchTextView']&&this['_searchTextView']['reset']();}['destroy'](){this['_hideAllNestedPanels'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}['focus'](){this['_searchTextView']?this['_searchTextView']['focus']():this['optionsListView']['focus']();}['_getPanelKeystroke'](_0x3a7082){return'rtl'===_0x3a7082['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x9e3d98){return'rtl'===_0x9e3d98['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x5e0dd6,_0x550a49,_0x3fe783,_0x433005){_0x5e0dd6['key']==_0x550a49&&(_0x3fe783['focus'](),this['_hideNestedPanel'](_0x433005));}['_handleSearchResultButtonClick'](_0x5c25a9){_0x5c25a9['fire']('execute');}}function Hn(_0x39fad2){const {editor:_0x24da8f,content:_0x4dc111,buttonDefinition:_0x15dfa7,bodyCollection:_0x235499,hasSearch:_0x8fd174=!0x1}=_0x39fad2;return()=>{const _0x144bf3=_0x24da8f['locale'],_0x378c6b=_0x24da8f['commands']['get']('aiQuickAction'),_0x583f06=Gt(_0x144bf3);_0x583f06['bind']('isEnabled')['to'](_0x378c6b),_0x583f06['buttonView']['set']({'icon':_0x15dfa7['icon']??_0x3c6075,'label':_0x15dfa7['label'],'tooltip':!0x0}),_0x583f06['set']({'class':'ck-ai-quick-actions-dropdown'});const _0xf0c42c=new AIQuickActionsDropdownContentView(_0x24da8f,_0x4dc111,_0x583f06,_0x235499,_0x8fd174);return _0x583f06['panelView']['children']['add'](_0xf0c42c),_0x8fd174&&_0x583f06['on']('change:isOpen',(_0x144b78,_0xd97af9,_0x221486)=>{if(_0x221486){if(_0x24da8f['plugins']['has']('AIEditing')){const _0x2e9252=_0x24da8f['plugins']['get'](AIEditing),_0x495b3a=_0x24da8f['model']['document']['selection'],_0x596d96=Array['from'](_0x495b3a['getRanges']());_0x596d96['length']>0x0&&_0x2e9252['showFakeVisualSelection']({'ranges':_0x596d96,'id':'quick-action','priority':0x14});}}else _0x24da8f['plugins']['has']('AIEditing')&&_0x24da8f['plugins']['get'](AIEditing)['hideFakeVisualSelection']('quick-action'),_0xf0c42c['resetSearch']();}),_0x583f06;};}const Mn='<task>Explain\x20the\x20selected\x20part\x20of\x20the\x20document\x20in\x20plain,\x20simple\x20language.</task><rules>1.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is:-\x20If\x20it\x20looks\x20like\x20a\x20definition\x20explain\x20the\x20concept\x20in\x20simple\x20terms.-\x20If\x20it\x20looks\x20like\x20a\x20description\x20clarify\x20what\x20it\x20is\x20describing\x20and\x20why\x20it\x20matters.-\x20If\x20it\x20contains\x20technical\x20terms\x20or\x20jargon\x20break\x20them\x20down\x20into\x20everyday\x20language.-\x20If\x20it\x20looks\x20instructional\x20restate\x20as\x20clear\x20steps\x20someone\x20can\x20follow.-\x20If\x20it\x20provides\x20examples\x20explain\x20what\x20the\x20example\x20shows\x20and\x20why\x20it\x27s\x20relevant.-\x20If\x20it\x20presents\x20an\x20argument\x20or\x20claim\x20restate\x20the\x20claim\x20neutrally\x20and\x20explain\x20its\x20purpose.-\x20If\x20it\x20is\x20narrative/story-like\x20explain\x20what\x20event\x20or\x20situation\x20is\x20being\x20described.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20explain\x20what\x20the\x20data\x20indicates.-\x20If\x20it\x20is\x20a\x20quotation\x20explain\x20the\x20meaning\x20of\x20the\x20quote\x20in\x20context.-\x20If\x20it\x20compares/contrasts\x20things\x20explain\x20the\x20key\x20differences\x20or\x20similarities\x20simply.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20of\x20the\x20categories\x20above\x20give\x20a\x20clear,\x20plain-language\x20explanation\x20of\x20its\x20meaning,\x20focusing\x20on\x20usefulness.2.\x20Provide\x20context\x20if\x20the\x20meaning\x20could\x20be\x20unclear\x20without\x20it.\x20(e.g.,\x20explain\x20where\x20such\x20a\x20term\x20might\x20be\x20used,\x20or\x20why\x20it\x20is\x20important).3.\x20Keep\x20the\x20explanation\x20short\x20but\x20complete\x20(2–5\x20sentences).-\x20Avoid\x20overly\x20technical\x20detail\x20unless\x20it\x20is\x20necessary\x20for\x20understanding.4.\x20Do\x20not\x20simply\x20repeat\x20the\x20original\x20text\x20—\x20restate\x20and\x20expand\x20it\x20in\x20plain\x20words.5.\x20If\x20possible,\x20add\x20a\x20short\x20example\x20or\x20analogy\x20to\x20make\x20it\x20easier\x20to\x20understand.6.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20explanation.7.\x20Your\x20explanation\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20explanation,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant,\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',Un='<task>Summarize\x20the\x20selected\x20part\x20of\x20the\x20document\x20in\x202–4\x20clear\x20sentences,\x20capturing\x20only\x20the\x20essential\x20meaning.</task><rules>1.\x20Your\x20summary\x20should\x20be\x20short\x20and\x20clear:-\x20Aim\x20for\x202–4\x20sentences\x20unless\x20the\x20text\x20is\x20extremely\x20short.-\x20Focus\x20on\x20capturing\x20the\x20main\x20idea(s)\x20without\x20unnecessary\x20detail.2.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is\x20and\x20adapt\x20the\x20summary\x20style:-\x20If\x20it\x20is\x20descriptive\x20condense\x20the\x20description\x20into\x20its\x20core\x20idea.-\x20If\x20it\x20is\x20argumentative\x20or\x20opinion-based\x20summarize\x20the\x20main\x20claim\x20and\x20reasoning\x20neutrally.-\x20If\x20it\x20is\x20narrative/story-like\x20capture\x20the\x20main\x20event\x20or\x20outcome\x20without\x20side\x20details.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20summarize\x20what\x20the\x20data\x20shows\x20in\x20plain\x20language.-\x20If\x20it\x20is\x20instructional\x20restate\x20the\x20overall\x20purpose\x20of\x20the\x20steps\x20without\x20listing\x20every\x20step.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20of\x20the\x20categories\x20above\x20provide\x20a\x20general\x20concise\x20summary.3.\x20Provide\x20context\x20if\x20necessary\x20for\x20clarity:-\x20Mention\x20the\x20subject\x20or\x20topic\x20explicitly\x20so\x20the\x20summary\x20can\x20stand\x20alone.4.\x20Do\x20not\x20simply\x20copy\x20sentences\x20from\x20the\x20original\x20text\x20—\x20rephrase\x20in\x20plain\x20language.5.\x20Avoid\x20adding\x20new\x20information\x20or\x20interpretation\x20not\x20present\x20in\x20the\x20text.6.\x20Summarize\x20in\x20a\x20way\x20that\x20would\x20make\x20sense\x20to\x20someone\x20who\x20has\x20not\x20read\x20the\x20original\x20text.7.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20summary.8.\x20Your\x20summary\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20summary,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',Bn='<task>Extract\x20and\x20present\x20the\x20key\x20points\x20from\x20the\x20selected\x20part\x20of\x20the\x20document\x20as\x20a\x20concise\x20bulleted\x20list.</task><rules>1.\x20Present\x20the\x20output\x20as\x20a\x20clear,\x20structured\x20list\x20(bullets\x20or\x20numbered).-\x20Each\x20point\x20should\x20be\x20concise\x20(one\x20sentence\x20or\x20less).-\x20Do\x20not\x20merge\x20distinct\x20ideas\x20into\x20one\x20bullet.2.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is\x20and\x20adapt\x20the\x20extraction\x20style:-\x20If\x20it\x20is\x20descriptive\x20capture\x20the\x20main\x20attributes\x20or\x20features.-\x20If\x20it\x20is\x20argumentative\x20extract\x20the\x20main\x20claim\x20and\x20supporting\x20reasons\x20separately.-\x20If\x20it\x20is\x20narrative/story-like\x20extract\x20the\x20main\x20events\x20in\x20chronological\x20order.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20highlight\x20the\x20most\x20important\x20facts\x20or\x20numbers.-\x20If\x20it\x20is\x20instructional\x20list\x20the\x20steps\x20or\x20main\x20actions\x20in\x20simplified\x20form-\x20If\x20it\x20provides\x20comparisons\x20extract\x20the\x20contrasted\x20items\x20and\x20their\x20differences/similarities.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20category\x20above\x20extract\x20the\x20main\x20ideas\x20in\x20plain,\x20short\x20statements.3.\x20Keep\x20the\x20list\x20between\x203–7\x20items\x20where\x20possible.-\x20If\x20the\x20text\x20is\x20very\x20short,\x20fewer\x20items\x20are\x20fine.-\x20If\x20it\x20is\x20very\x20long,\x20focus\x20on\x20the\x20most\x20important\x20ideas\x20only.4.\x20Do\x20not\x20copy\x20long\x20text\x20fragments\x20—\x20restate\x20in\x20simple\x20words.5.\x20Do\x20not\x20add\x20interpretation,\x20evaluation,\x20or\x20commentary\x20beyond\x20the\x20text.6.\x20Ensure\x20the\x20list\x20can\x20stand\x20alone\x20without\x20requiring\x20the\x20reader\x20to\x20see\x20the\x20original\x20document.7.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20key\x20points.8.\x20Your\x20key\x20points\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20key\x20points\x20list,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',Gn=/* #__PURE__ -- @preserve */
28
+ ((()=>({'chat':'AIChat','action':'AIActions'}))());class AIQuickActionsUI extends _0x446a45{static get['requires'](){return[_0x540f68,AIConnector];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['init'](){const _0x339632=await this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x339632),this['_initializeQuickActionsComponentsAndCommands']();}static['getDefaultQuickActions'](_0x15f36d){return function(_0x5d5609){const _0x57a642=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x5d5609['uiLanguage']),_0x83572b=_0x57a642||'English',_0x2ceb5d=[{'id':'ask-ai','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0xf21145},{'id':'chat-commands','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0xf21145,'actions':[{'id':'explain','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Hi(_0x5d5609,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':Mn['replace']('%0',_0x83572b),'type':'chat'},{'id':'summarize','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Hi(_0x5d5609,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Un['replace']('%0',_0x83572b),'type':'chat'},{'id':'highlight-key-points','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Hi(_0x5d5609,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Bn['replace']('%0',_0x83572b),'type':'chat'}]},{'id':'improve-writing','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x2ebcfb},{'id':'continue','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x35534b},{'id':'fix-grammar','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x5d49a3},{'id':'adjust-length','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x176b53,'actions':[{'id':'make-shorter','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0xc3f8a0,'actions':[{'id':'make-tone-casual','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x57b550,'actions':[{'id':'translate-to-english','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Hi(_0x5d5609,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x3e01d8,'actions':[]}];return _0x2ceb5d;}(_0x15f36d);}async['_getDefaultAndCustomActions'](){const _0x4ac46a=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0xdc6e9a=this['editor']['config']['get']('ai.quickActions.extraCommands')||[];let _0x22ed75,_0x266b29=[];try{const _0x170d45=new AIModels({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']});_0x266b29=await _0x170d45['getAll'](),_0x22ed75=(await _0x170d45['getDefault']())?.['id'];}catch(_0x50e53e){const _0x34e8e6=new at('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x50e53e});Ct(_0x34e8e6['message']);}finally{const _0x550f7f=_0xdc6e9a['map'](_0xf14aa8=>({..._0xf14aa8,'type':'chat'===_0xf14aa8['type']?'chat':'action','model':'chat'!==_0xf14aa8['type']?_0xf14aa8['model']||_0x22ed75:_0xf14aa8['model'],'icon':void 0x0}));_0x4ac46a['find'](_0x348cbd=>'other'===_0x348cbd['id'])['actions']['push'](..._0x550f7f),_0x4ac46a['forEach'](_0x1adfe4=>{if('actions'in _0x1adfe4)_0x1adfe4['actions']['forEach'](_0x435198=>{if(_0x435198['isEnabled']=!!_0x266b29['find'](_0x3173ae=>_0x3173ae['id']===_0x435198['model'])||void 0x0===_0x435198['model'],!_0x435198['isEnabled']){const _0x15eba1=new at('ai-quick-actions-unavailable-model',this,{'actionId':_0x435198['id'],'modelId':_0x435198['model']});Ct(_0x15eba1['message']);}});else{if(_0x1adfe4['isEnabled']=!!_0x266b29['find'](_0x3d71e2=>_0x3d71e2['id']===_0x1adfe4['model'])||void 0x0===_0x1adfe4['model'],!_0x1adfe4['isEnabled']){const _0x27fbef=new at('ai-quick-actions-unavailable-model',this,{'actionId':_0x1adfe4['id'],'modelId':_0x1adfe4['model']});Ct(_0x27fbef['message']);}}});}return _0x4ac46a;}['_initializeQuickActionsComponentsAndCommands'](){const _0x512ad8=new Qt(this['editor']['locale']);_0x512ad8['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x512ad8),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x512ad8);}['_initializeQuickActionsDropdown'](_0x1c0562){const _0x9afcf4=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',Hn({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x3c6075,'label':Hi(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x1c0562,'hasSearch':_0x9afcf4}));}['_prepareQuickActionsDefinition'](_0x573708){this['_quickActionsDefinition']=_0x573708['map'](_0x450c4e=>{if('actions'in _0x450c4e){const _0x51bb58=_0x450c4e;return{..._0x51bb58,'actions':_0x51bb58['actions']['map'](_0x40a8bd=>{const {actions:_0x531458,..._0x47c672}=_0x51bb58;return{..._0x40a8bd,'parent':_0x47c672};})['filter'](_0x2114cf=>this['_shouldIncludeAction'](_0x2114cf))};}return _0x450c4e;})['filter'](_0x3d3d61=>'actions'in _0x3d3d61?_0x3d3d61['actions']['length']>0x0:this['_shouldIncludeAction'](_0x3d3d61));}['_shouldIncludeAction'](_0x58f9c0){const _0x3cbf9b=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](Gn[_0x58f9c0['type']])&&!_0x3cbf9b['includes'](_0x58f9c0['id'])&&!('chat'===_0x58f9c0['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x21ce29){this['_quickActionsDefinition']['forEach'](_0x4e80da=>{if('actions'in _0x4e80da){const _0x2c3e95=Hn({'editor':this['editor'],'content':_0x4e80da['actions'],'buttonDefinition':_0x4e80da,'bodyCollection':_0x21ce29});this['editor']['ui']['componentFactory']['add'](_0x4e80da['id'],_0x2c3e95),_0x4e80da['actions']['forEach'](_0x392f93=>{const _0x1a2e63=Dn({'editor':this['editor'],'action':_0x392f93});this['editor']['ui']['componentFactory']['add'](_0x392f93['id'],_0x1a2e63);});}else{const _0x4823be=Dn({'editor':this['editor'],'action':_0x4e80da,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1});this['editor']['ui']['componentFactory']['add'](_0x4e80da['id'],_0x4823be);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x160810=>{const _0x104f17=this['editor']['commands']['get']('aiQuickAction'),_0x28c028=new Kt(_0x160810),_0xc2e486=Hi(_0x160810,'AI_QUICK_ACTIONS_HEADING');_0x28c028['buttonView']['set']({'label':_0xc2e486,'icon':_0x3c6075});const _0x284e27=new $t(_0x160810);return _0x284e27['set']({'ariaLabel':_0xc2e486,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x344eee=>{if('actions'in _0x344eee){const _0x34b9ce=_0x344eee,_0x5bd358=new qt(_0x160810,_0x28c028),_0x5bfb08=new Kt(_0x160810),_0x536a00=new $t(_0x160810);_0x5bfb08['buttonView']['set']({'label':_0x34b9ce['label'],'icon':_0x34b9ce['icon']}),_0x34b9ce['actions']['forEach'](_0x5a91dd=>{const _0x3e1213=new qt(_0x160810,_0x5bfb08),_0x1b75ac=new Wt(_0x160810);_0x1b75ac['set']({'label':_0x5a91dd['label'],'icon':_0x5a91dd['icon'],'role':'menuitem','isEnabled':_0x5a91dd['isEnabled']}),_0x1b75ac['on']('execute',()=>{this['_executeQuickAction'](_0x5a91dd);}),_0x1b75ac['delegate']('execute')['to'](_0x5bfb08),_0x3e1213['children']['add'](_0x1b75ac),_0x536a00['items']['add'](_0x3e1213);}),_0x5bfb08['panelView']['children']['add'](_0x536a00),_0x5bd358['children']['add'](_0x5bfb08),_0x284e27['items']['add'](_0x5bd358);}else{const _0x1d3aaf=_0x344eee,_0x4c832a=new qt(_0x160810,_0x28c028),_0x35d6a3=new Wt(_0x160810);_0x35d6a3['set']({'label':_0x1d3aaf['label'],'icon':_0x1d3aaf['icon'],'role':'menuitem','isEnabled':_0x1d3aaf['isEnabled']}),_0x35d6a3['on']('execute',()=>{this['_executeQuickAction'](_0x1d3aaf);}),_0x35d6a3['delegate']('execute')['to'](_0x28c028),_0x4c832a['children']['add'](_0x35d6a3),_0x284e27['items']['add'](_0x4c832a);}}),(Object['values'](Gn)['some'](_0x357850=>this['editor']['plugins']['has'](_0x357850))?_0x28c028['bind']('isEnabled')['to'](_0x104f17):_0x28c028['set']({'isEnabled':!0x1}),_0x28c028['panelView']['children']['add'](_0x284e27),_0x28c028);});}['_executeQuickAction'](_0x3710f0){const _0xf64453=this['editor'];_0xf64453['editing']['view']['focus'](),_0xf64453['commands']['execute']('aiQuickAction',_0x3710f0);const _0x185576=_0xf64453['ui']['view']['menuBarView'];_0x185576&&_0x185576['close']&&_0x185576['close']();}}class AIQuickActionsCommand extends _0x1a582e{['execute'](_0x490d15){switch(this['_expandSelectionIfCollapsed'](),_0x490d15['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x5ef368=Hi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new at('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x5ef368});}this['_handleAIChatAction'](_0x490d15);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x37eaa9=Hi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new at('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x37eaa9});}this['_handleAIActionsAction'](_0x490d15);}}async['_handleAIChatAction'](_0x182230){const _0x3376bf=this['editor']['plugins']['get']('AIChatController'),_0x345e6b=this['editor']['plugins']['get']('AITabs')['view'];if(_0x345e6b['isVisible']||(_0x345e6b['isVisible']=!0x0),'chat'!==_0x345e6b['activeTab']&&_0x345e6b['activateTab']('chat'),'ask-ai'===_0x182230['id'])_0x3376bf['removeSelectionFromChatContext'](),_0x3376bf['addSelectionToChatContext'](),_0x3376bf['focusPromptInput']();else await _0x3376bf['startConversation']({'modelId':_0x182230['model']}),_0x3376bf['removeSelectionFromChatContext'](),_0x3376bf['addSelectionToChatContext'](),_0x3376bf['focusPromptInput'](),await _0x3376bf['sendMessage']({'message':_0x182230['prompt']||_0x182230['displayedPrompt']||_0x182230['label'],'attributes':{'quickActionData':{'id':_0x182230['id']},'displayedPrompt':_0x182230['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x276157=this['editor'],_0x2f4ea4=_0x276157['model']['document']['selection'];if(!_0x2f4ea4['isCollapsed'])return;const _0x1652d2=At(_0x2f4ea4['getSelectedBlocks']())||_0x276157['model']['schema']['getLimitElement'](_0x2f4ea4);_0x276157['model']['change'](_0x4a32a3=>{_0x4a32a3['setSelection'](_0x1652d2,'in');});}['_handleAIActionsActionLabel'](_0x2252a7){return _0x2252a7['parent']?.['label']&&'other'!==_0x2252a7['parent']?.['id']?_0x2252a7['parent']['label']+':\x20'+_0x2252a7['label']:_0x2252a7['label'];}async['_handleAIActionsAction'](_0x76836e){const _0x8f29a6=this['editor']['plugins']['get']('AIActions'),_0x5417cb=_0x76836e['prompt']?{'userMessage':_0x76836e['prompt'],'model':_0x76836e['model']}:{'actionName':_0x76836e['actionName']||_0x76836e['id'],'args':_0x76836e['args']},_0x1e33e0=this['_handleAIActionsActionLabel'](_0x76836e);await _0x8f29a6['executeAction'](_0x5417cb,_0x1e33e0,_0x76836e['icon']);}}class AIQuickActionsEditing extends _0x446a45{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x4d475c=this['editor'],_0xba53cd=new AIQuickActionsCommand(this['editor']);if(_0x4d475c['commands']['add']('aiQuickAction',_0xba53cd),_0x4d475c['plugins']['has']('AIChat')){const _0x40f915=this['editor']['plugins']['get']('AIChatController');_0x4d475c['model']['document']['selection']['on']('change:range',(_0x2a0e95,_0x23bfbd)=>{_0x23bfbd['directChange']&&_0x40f915['removeSelectionFromChatContext']();});}}}class AIActionsReply extends AIReply{['updateChangeGroups'](){if(this['parsedMergedContent']=this['parsedContent']['cloneNode'](!0x0),0x0==this['parsedMergedContent']['childNodes']['length'])return void(this['changeGroups']=[]);const _0x18f739=this['documentContextContent']['children']['map'](_0x14b236=>({'node':_0x14b236,'id':$i(_0x14b236,'data-id')})),_0x58edce=this['parsedMergedContent']['children']['map'](_0x3bd38c=>({'node':_0x3bd38c,'id':$i(_0x3bd38c,'data-id')||ot()})),_0x2006ef=_0x379e1e(_0x18f739,_0x58edce,{'comparator':(_0xd2da15,_0x36bcbc)=>_0xd2da15['id']==_0x36bcbc['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x2006ef['length']&&_0x2006ef[_0x2006ef['length']-0x1]['removed'];)_0x2006ef['pop']();}const _0x5b23f9=_0x2006ef['map'](_0x3deb2f=>{const _0x18b659=_0x3deb2f['added']?'new':_0x3deb2f['removed']?'removed':'modified';return{'node':_0x3deb2f['value'][0x0]['node'],'type':_0x18b659,'id':_0x3deb2f['value'][0x0]['id']};});this['changeGroups']=[{'changes':_0x5b23f9,'state':'pending','index':0x0}];}['_getDifferentChangeGroups'](_0x4feba7,_0x44be7f){return _0x44be7f;}}class AIActionsInteraction extends AIInteraction{['content'];['version'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x40080f){super(_0x40080f),this['content']=_0x40080f['content'],this['version']=_0x40080f['version'],this['actionName']=_0x40080f['actionName'],this['args']=_0x40080f['args'],this['userMessage']=_0x40080f['userMessage'],this['model']=_0x40080f['model'],this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}async['sendRequest'](){return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args']}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html'});}['getDocumentContext'](){return{'type':'text','content':this['content'],'version':this['version'],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x4a9cd0){const _0x48ddc2=new AIActionsReply({'locale':this['locale'],'documentContextContent':this['content'],..._0x4a9cd0});return this['replies']['push'](_0x48ddc2),_0x48ddc2['delegate'](...rs)['to'](this),this['fire']('replyCreated',_0x48ddc2),_0x48ddc2;}}class AIActionsBalloonToolbarView extends kt{constructor(_0x81c6d6,_0x3e9bfe=!0x0,_0x4cda19=!0x0){super(_0x81c6d6),this['set']('isEnabled',!0x1),_0x3e9bfe&&(this['applyButton']=this['_createButton'](Hi(_0x81c6d6,'AI_BALLOON_APPLY_BUTTON'),Mi),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x4cda19&&(this['suggestButton']=this['_createButton'](Hi(_0x81c6d6,'AI_BALLOON_SUGGEST_BUTTON'),_0x3e9bfe?Ui:Mi),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x3e9bfe,'showSuggestButton':_0x4cda19}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x9b48ee,showSuggestButton:_0x5ae954}){this['applyButton']&&(this['applyButton']['isVisible']=_0x9b48ee),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x5ae954);}['_createButton'](_0x5e5025,_0x12d2e2){const _0x3fc29d=new vt(this['locale']);return _0x3fc29d['set']({'label':_0x5e5025,'class':_0x12d2e2,'isVisible':!0x0,'withText':!0x0}),_0x3fc29d;}}class AIActionsBalloonDisclaimerView extends Nt{constructor(_0x319222){super(_0x319222),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':Hi(_0x319222,'AI_DISCLAIMER_TEXT')}]}]});}}class AISuggestionLoaderView extends Nt{constructor(_0xe1daf5){super(_0xe1daf5),this['set']('isVisible',!0x0);const _0x265772=new AISpinnerView('small');_0x265772['isVisible']=!0x0;const _0x294056=new Nt(this['locale']);_0x294056['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[Hi(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x2dd464=>!_0x2dd464)]},'children':[_0x265772,_0x294056]});}}class AIActionsBalloonView extends AIBalloonView{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x2dcf56,_0x718122){super(_0x2dcf56),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x718122,this['_focusTracker']=new _t(),this['_keystrokes']=new It(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Mt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x1ec894(),this['_addContentWrapper'](_0x718122),this['_addDisclaimerView'](),this['_addToolbar'](_0x718122),this['_focusables']['clear'](),this['_focusables']['addMany']([this['_toolbarView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-main']},'children':this['_dialogContent']}),this['on']('change:isTrackChangesOn',()=>{this['_toggleToolbarButtonsVisibility'](_0x718122);});}['render'](){super['render']();for(const _0x215a2f of this['_focusables'])this['_focusTracker']['add'](_0x215a2f['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy']();}['focus'](_0xee783e){-0x1===_0xee783e?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x380559){this['_isLoading']=_0x380559;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x44385f){super['showError'](_0x44385f),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x580844){super['showBlockingError'](_0x580844),this['setErrorState']();}['addMiniToolbarItem'](_0x52c68e){this['_miniToolbarView']['items']['has'](_0x52c68e)||this['_miniToolbarView']['items']['add'](_0x52c68e);}['removeMiniToolbarItem'](_0x3e3e31){this['_miniToolbarView']['items']['has'](_0x3e3e31)&&this['_miniToolbarView']['items']['remove'](_0x3e3e31);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x3d9669,showSuggestButton:_0x36b09a}){_0x3d9669=_0x3d9669&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x36b09a=_0x36b09a&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x3d9669,'showSuggestButton':_0x36b09a});}async['updateContent'](_0x14fef5){await this['_streamableContentView']['update'](_0x14fef5);}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x255bde){this['_contentWrapper']=new Nt(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x255bde['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new AIActionsBalloonDisclaimerView(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x5f5657,showSuggestButton:_0x2012b7}){this['_toolbarView']=new AIActionsBalloonToolbarView(this['locale'],_0x5f5657,_0x2012b7),this['_toolbarView']['applyButton']?.['on']('execute',()=>{this['fire']('applySuggestion');}),this['_toolbarView']['suggestButton']?.['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_toolbarView']['bind']('isEnabled')['to'](this,'isBusy',this,'_isLoading',this,'_hasError',(_0x4e9114,_0x383adb,_0x35c600)=>!(_0x4e9114||_0x383adb||_0x35c600)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x5f5657,'showSuggestButton':_0x2012b7}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x3b7552){return this['_miniToolbarView']=new AIMiniToolbarView(this['locale'],_0x3b7552),this['_miniToolbarView']['delegate'](...Cs)['to'](this),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['_miniToolbarView']['isShowChangesOn']=!this['_miniToolbarView']['isShowChangesOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':this['_miniToolbarView']['isShowChangesOn']});}),this['_miniToolbarView']['bind']('isEnabled')['to'](this,'isBusy',this,'_isLoading',(_0x22c2b9,_0x1eb6d8)=>!(_0x22c2b9||_0x1eb6d8)),this['_miniToolbarView'];}['_createLoaderView'](){return this['_loaderView']=new AISuggestionLoaderView(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}['_createStreamableContentView'](){return this['_streamableContentView']=new AISuggestionStreamableContentView(this['locale']),this['_streamableContentView'];}['_setupMiniToolbarButtons'](){const _0x4a7132=new vt(this['locale']),_0x443b74=new vt(this['locale']),_0x581bf0=new AIActionsBalloonNavigationCounterView(this['locale']),_0xd73b1f=new vt(this['locale']);_0x4a7132['set']({'icon':tt,'label':Hi(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Bi}),_0x443b74['set']({'icon':_0x422a70,'tooltip':Hi(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Bi}),_0xd73b1f['set']({'icon':et,'tooltip':Hi(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Bi}),_0x4a7132['bind']('isEnabled')['to'](this,'isBusy',_0x97fb5e=>!_0x97fb5e),_0x4a7132['on']('execute',()=>{this['fire']('tryAgain');}),_0x443b74['bind']('isEnabled')['to'](this,'isBusy',_0xc30245=>!_0xc30245),_0x443b74['on']('execute',()=>{this['fire']('showPrevious');}),_0xd73b1f['bind']('isEnabled')['to'](this,'isBusy',_0x5a515d=>!_0x5a515d),_0xd73b1f['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x443b74,this['_navigationCounter']=_0x581bf0,this['_navigationNextButton']=_0xd73b1f,this['_navigationTryAgainButton']=_0x4a7132;}['updateMiniToolbarButtons'](_0x5b997a,_0xcc98c){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x506621=_0x5b997a>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x506621){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x21cbf0=_0x5b997a-_0xcc98c;this['_navigationCounter']['setInteractionCount'](_0x21cbf0+'/'+_0x5b997a),this['_navigationPreviousButton']['isEnabled']=_0xcc98c<_0x5b997a-0x1,this['_navigationNextButton']['isEnabled']=_0xcc98c>0x0;}else this['removeMiniToolbarItem'](this['_navigationPreviousButton']),this['removeMiniToolbarItem'](this['_navigationCounter']),this['removeMiniToolbarItem'](this['_navigationNextButton']);}['disableMiniToolbarButtons'](){this['_navigationTryAgainButton']['isEnabled']=!0x1,this['_navigationPreviousButton']['isEnabled']=!0x1,this['_navigationNextButton']['isEnabled']=!0x1;}['startAutoScroll'](){this['_initializeScrollManager'](),this['_scrollManager']&&this['_scrollManager']['start']();}['stopAutoScroll'](){this['_scrollManager']&&this['_scrollManager']['stop']();}['toggleIsLoading'](_0x2b7d5c){this['_isLoading']=_0x2b7d5c;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_initializeScrollManager'](){const _0x69b926=this['_getScrollableElement']();_0x69b926&&!this['_scrollManager']&&(this['_scrollManager']=new ScrollManager(_0x69b926));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}}class AIActionsBalloonNavigationCounterView extends Nt{constructor(_0x380744){super(_0x380744);const _0x1b7abd=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x1b7abd['to']('interactionCount')}]});}['setInteractionCount'](_0x52b977){this['set']('interactionCount',_0x52b977);}}class AIActions extends _0x446a45{static get['requires'](){return[AIConnector,Bt,AIEditing,AIBalloon,_0x2ef109];}static get['pluginName'](){return'AIActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_aiConnector'];['_interactions']=[];['_currentInteractionIndex']=0x0;['_interactionParams'];['_balloonShowDiff']=!0x1;['_promiseQueue'];['_bodyCollection'];get['_interaction'](){return this['_interactions'][this['_interactions']['length']-0x1];}['_actionsBalloonView'];constructor(_0x2b77a3){super(_0x2b77a3),this['_bodyCollection']=new Qt(this['editor']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x505d6e,_0x2e61f9,_0x42af69){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')){if(this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x43654a,anchorData:_0x862e49,root:_0x39f2bc}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x505d6e,_0x43654a,_0x862e49,_0x39f2bc,_0x2e61f9,_0x42af69);}}const {modelFragment:_0x158d8f,anchorData:_0x575663,root:_0xd95b8e}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x505d6e,_0x158d8f,_0x575663,_0xd95b8e,_0x2e61f9,_0x42af69);}async['destroy'](){return this['_stopInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}['_createActionsBalloonView'](){const _0x91deba=this['editor']['plugins']['has']('TrackChanges');let _0x4c5dd3=this['editor']['config']['get']('ai.availableReplyActions')||[...bs];_0x91deba||(_0x4c5dd3=_0x4c5dd3['filter'](_0x3d1cca=>'insertSuggestion'!=_0x3d1cca));const _0x3253d3=this['editor']['commands']['get']('trackChanges'),_0x5d5d70=new AIActionsBalloonView(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x91deba,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x4c5dd3});return _0x5d5d70['bind']('isBusy')['to'](this),_0x3253d3&&_0x5d5d70['bind']('isTrackChangesOn')['to'](_0x3253d3,'value'),_0x5d5d70['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x5d5d70['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x5d5d70['on']('showNext',()=>{this['_navigateToNext']();}),_0x5d5d70;}['_getExecuteDataRegular'](){const _0x5e5e02=this['editor']['model']['document']['selection'],_0x1b07bd=_0x5e5e02['getFirstRange']()['start']['root'];if(_0x5e5e02['isCollapsed']){const _0x48f859=At(_0x5e5e02['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x5e5e02);this['editor']['model']['change'](_0x291f75=>{_0x291f75['setSelection'](_0x48f859,'in');});}const _0x57b3e5=_0x5e5e02['getFirstRange'](),_0x26299d=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x5e5e02),_0x57b3e5['start'],_0x57b3e5['end']);this['_copyMarkersToFragment'](_0x26299d,_0x5e5e02,{'isTableSelection':!0x1});const _0x221266=_0x5e5e02['getFirstRange']()['start'],_0xf7bf1a=new Map();let _0x2fbaef=_0x26299d;for(let _0x12bdbc=0x0;_0x12bdbc<_0x221266['path']['length'];_0x12bdbc++)_0xf7bf1a['set'](_0x2fbaef,_0x221266['path'][_0x12bdbc]),_0x2fbaef=_0x2fbaef['getChild'](0x0);return{'modelFragment':_0x26299d,'anchorData':_0xf7bf1a,'root':_0x1b07bd};}['_getExecuteDataInTable'](){const _0x1306a8=this['editor']['model']['document']['selection'],_0x3ada36=this['editor']['plugins']['get']('TableSelection'),_0x2c971f=_0x1306a8['getFirstRange']()['start']['root'],_0x1bec5a=_0x3ada36['getSelectionAsFragment'](),_0x5d3f46=_0x1306a8['getFirstRange']()['start']['parent']['parent'],_0x64233e=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x5d3f46),this['editor']['model']['createPositionAfter'](_0x5d3f46)),_0x1c9079=this['_wrapWithCommonAncestors'](_0x1bec5a,_0x64233e['start'],_0x64233e['end']);this['_copyMarkersToFragment'](_0x1c9079,_0x1306a8,{'isTableSelection':!0x0});const _0x3bf8f4=_0x1306a8['getFirstRange']()['start'],_0x33ba49=new Map();let _0x6957f2=_0x1c9079;for(let _0x37c0be=0x0;_0x37c0be<_0x3bf8f4['path']['length'];_0x37c0be++)if(_0x33ba49['set'](_0x6957f2,_0x3bf8f4['path'][_0x37c0be]),_0x37c0be<_0x3bf8f4['path']['length']-0x1)_0x6957f2=_0x6957f2['getChild'](0x0);else{let _0x1d7e18=_0x6957f2['nextSibling'];for(;_0x1d7e18;)_0x33ba49['set'](_0x1d7e18,_0x3bf8f4['path'][_0x37c0be]),_0x1d7e18=_0x1d7e18['nextSibling'];}return{'modelFragment':_0x1c9079,'anchorData':_0x33ba49,'root':_0x2c971f};}async['_executeAction'](_0x4b66f7,_0x356cb2,_0x200f7a,_0x5adb30,_0x373f65,_0x379de3){const _0x3d68e2=this['editor']['plugins']['get'](AIEditing),_0x2857e5=this['editor']['plugins']['get'](AIBalloon),_0x124bdf=this['editor']['model']['document']['selection'],_0xb21474=await _0x3d68e2['modelToDataWithIds'](_0x356cb2),_0x40c4fa=this['editor']['model']['document']['version'],_0x2d7482=[..._0x124bdf['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x2857e5['open']({'index':0x3e8*Math['random']()%0x3e8,'title':_0x373f65,'icon':_0x379de3||_0x3c6075,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x2d7482,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x2857e5),this['_interactionParams']={'action':_0x4b66f7,'content':_0xb21474,'version':_0x40c4fa,'aiBalloon':_0x2857e5,'modelFragment':_0x356cb2,'anchorData':_0x200f7a,'root':_0x5adb30},this['_setupApplyListeners'](),this['listenTo'](_0x2857e5,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x2857e5,'dialogClosed',(_0x502af6,{id:_0x43b62c})=>{if('aiActionsBalloon'===_0x43b62c){for(const _0x3d2aea of this['_interactions']){if(0x0===_0x3d2aea['replies']['length']||_0x3d2aea['stoppedExplicitly'])continue;const _0xe13165=_0x3d2aea['replies'][_0x3d2aea['replies']['length']-0x1],_0x170f96=_0xe13165['changeGroups'][0x0];_0x170f96&&'pending'===_0x170f96['state']&&_0xe13165['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x2857e5);}}),this['_createInteraction'](_0xb21474,_0x40c4fa,_0x2857e5,_0x4b66f7);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x17a900,anchorData:_0x56bf85,root:_0x3157c7}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x17a900,_0x56bf85,_0x3157c7,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x17a900,_0x56bf85,_0x3157c7,!0x0);});}['_wrapWithCommonAncestors'](_0x1b3009,_0x56eb1b,_0x2d3411){const _0x584e82=this['editor']['model']['createRange'](_0x56eb1b,_0x2d3411)['getCommonAncestor'](),_0x55de87=_0x584e82['is']('documentFragment')?[]:_0x584e82['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x55de87['length']){const _0x47eb7d=_0x55de87['map'](_0x3adfee=>_0x3adfee['_clone'](!0x1));for(let _0x3ea3a3=0x1;_0x3ea3a3<_0x47eb7d['length'];_0x3ea3a3++)_0x47eb7d[_0x3ea3a3-0x1]['_appendChild'](_0x47eb7d[_0x3ea3a3]);return _0x47eb7d[_0x47eb7d['length']-0x1]['_appendChild'](_0x1b3009),new _0x24e4e8(_0x47eb7d[0x0]);}return _0x1b3009;}['_copyMarkersToFragment'](_0x27d837,_0x257158,_0x23d71c={'isTableSelection':!0x1}){const _0x422291=this['editor']['model'],_0x416e47=Array['from'](_0x257158['getRanges']()),_0x418e7a=_0x257158['getFirstRange']()['start'];for(const _0x5dd681 of _0x422291['markers']){if(_0x5dd681['name']['startsWith'](As)||!_0x5dd681['affectsData'])continue;const _0xe6fa27=_0x5dd681['getRange']();if(!_0x416e47['some'](_0x2a6651=>_0x2a6651['containsRange'](_0xe6fa27,!0x0)))continue;const _0x543694=this['_regularCalculateMarkerPath'](_0xe6fa27['start'],_0x418e7a,_0x23d71c['isTableSelection']),_0x48bcbd=this['_regularCalculateMarkerPath'](_0xe6fa27['end'],_0x418e7a,_0x23d71c['isTableSelection']),_0x26dd38=_0x422291['createPositionFromPath'](_0x27d837,_0x543694),_0xa4ccc1=_0x422291['createPositionFromPath'](_0x27d837,_0x48bcbd);if(!_0x26dd38['isEqual'](_0xa4ccc1)){const _0x3f4e2a=_0x422291['createRange'](_0x26dd38,_0xa4ccc1);_0x27d837['markers']['set'](_0x5dd681['name'],_0x3f4e2a);}}}['_regularCalculateMarkerPath'](_0x4c5365,_0x32a59d,_0x5274c9=!0x1){const _0x1e1d1a=[..._0x4c5365['path']['slice']()];for(let _0x58282e=0x0;_0x58282e<Math['max'](_0x32a59d['path']['length'],_0x4c5365['path']['length']);_0x58282e++){const _0x1641e4=_0x32a59d['path'][_0x58282e]||0x0,_0x3a7f2b=(_0x4c5365['path'][_0x58282e]||0x0)-_0x1641e4;if(_0x1e1d1a[_0x58282e]=_0x3a7f2b,0x0!==_0x3a7f2b&&!_0x5274c9)break;}return _0x1e1d1a;}async['_createInteraction'](_0x5cbed1,_0x531d36,_0x1d4b7b,_0x3b3dea){const _0x2f206a=this['editor'];this['_interactionParams']||(this['_interactionParams']={'action':_0x3b3dea,'content':_0x5cbed1,'version':_0x531d36,'aiBalloon':_0x1d4b7b,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':this['editor']['model']['document']['selection']['getFirstRange']()['start']['root']});const _0x249846=new AIActionsInteraction({'connector':this['_aiConnector'],'locale':_0x2f206a['locale'],'content':_0x5cbed1,'version':_0x531d36,..._0x3b3dea});this['_interactions']['push'](_0x249846);const _0x3cee3c=(_0x5376b9,_0x1d9062=!0x1,_0x29a77f='streaming')=>this['_promiseQueue']['enqueue'](async _0x41e196=>{try{const _0x35ac66=Zi({'editor':_0x2f206a,'changeGroups':_0x5376b9['changeGroups'],'documentContextContent':_0x5376b9['documentContextContent'],'showDiff':_0x1d9062,'trimUnchanged':!0x1});_0x35ac66['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x35ac66[0x0],'renderingStrategy':_0x29a77f,'abortSignal':_0x41e196});}catch(_0x197d10){if(this['_isAbortError'](_0x197d10))return;throw _0x197d10;}});_0x249846['on']('replyCreated',(_0x4d7acd,_0x188648)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x3cee3c(_0x188648)['catch'](_0x5b4e59=>{this['_isAbortError'](_0x5b4e59)||(console['error']('Error\x20updating\x20content\x20in\x20replyCreated:',_0x5b4e59),this['_setErrorState'](_0x249846));});}),_0x249846['on']('replyContentUpdated',(_0x4d8771,_0x4583f8)=>{_0x3cee3c(_0x4583f8)['catch'](_0x2f5a7a=>{this['_isAbortError'](_0x2f5a7a)||(console['error']('Error\x20updating\x20content\x20in\x20replyContentUpdated:',_0x2f5a7a),this['_setErrorState'](_0x249846));});}),_0x249846['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x384a0a){this['_isAbortError'](_0x384a0a)||(console['error']('Error\x20clearing\x20loading\x20state\x20in\x20interactionFinished:',_0x384a0a),this['_setErrorState'](_0x249846));}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x2f508d,{showDiff:_0x373ce9})=>{try{this['_balloonShowDiff']=_0x373ce9;const _0x3df354=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x3df354&&await _0x3cee3c(_0x3df354,_0x373ce9,'static');}catch(_0x2f373a){this['_isAbortError'](_0x2f373a)||(console['error']('Error\x20updating\x20content\x20in\x20toggleSuggestionDisplayMode:',_0x2f373a),this['_setErrorState'](_0x249846));}}),_0x249846['on']('replyChangeGroupStateUpdated',()=>{const _0x17f7d6={'positiveCount':_0x249846['replies']['reduce']((_0x5ea4c5,_0x5b50fa)=>_0x5ea4c5+_0x5b50fa['changeGroups']['filter'](_0x30217e=>'accepted'===_0x30217e['state'])['length'],0x0),'totalCount':_0x249846['replies']['reduce']((_0x124ff7,_0x2419bf)=>_0x124ff7+_0x2419bf['changeGroups']['length'],0x0)},_0x28ea4b=_0x249846['actionCallId'],_0x2cb353=_0x249846['actionName'];_0x2cb353?this['_aiConnector']['upsertAIActionRating'](_0x2cb353,_0x28ea4b,_0x17f7d6):this['_aiConnector']['upsertCustomAIActionRating'](_0x28ea4b,_0x17f7d6);}),this['_setLoadingState']();try{const _0x26a300=await _0x249846['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x26a300;}catch(_0x571e1e){if(this['_isAbortError'](_0x571e1e))return;this['_actionsBalloonView']['hideLoader'](),this['_setErrorState'](_0x249846);}}['_applyChanges'](_0x2bf14b,_0xe98230,_0x196b83,_0x84c3ef){const _0xdfeffe=this['editor'];if(_0x84c3ef&&!_0xdfeffe['plugins']['has']('TrackChanges'))throw new at('ai-no-track-changes',null);const _0x1d0083=this['editor']['plugins']['get'](_0x2ef109),_0x40a287=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x40a287||!_0x40a287['replies']['length'])return;const _0x1bd7a6=_0x40a287['replies'][_0x40a287['replies']['length']-0x1],_0x4631dd=_0x1bd7a6['changeGroups'];_0x1bd7a6['setChangeGroupState'](0x0,'accepted');let _0x143f87=_s({'editor':_0xdfeffe,'reply':_0x1bd7a6,'interaction':_0x40a287,'groups':_0x4631dd,'transform':!0x1,'documentCompare':_0x1d0083,'documentCompareOptions':{'anchor':_0xdfeffe['model']['createPositionAt'](_0x2bf14b,0x0),'markDeletions':_0x84c3ef}});_0x143f87=this['_filterOperationsOutsideRange'](_0x143f87,_0xe98230);for(const _0x37eaa2 of _0x143f87)this['_anchorOperation'](_0xe98230,_0x37eaa2,_0x196b83);const _0x35e8ee=_0x40a287['getDocumentContext']()['version'],_0x2a5553=_0xdfeffe['model']['document']['history']['getOperations'](_0x35e8ee),_0x113fc6={'document':_0xdfeffe['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x21f60c=_0x146ca3(_0x143f87,_0x2a5553,_0x113fc6)['operationsA'];_0xdfeffe['model']['change'](_0x5afe46=>{if(_0x5afe46['setSelection'](_0xdfeffe['model']['document']['selection']['focus']),_0x84c3ef)_0xdfeffe['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x21f60c);else{for(const _0x21c524 of _0x21f60c)_0x21c524['baseVersion']=_0xdfeffe['model']['document']['version'],Is(_0xdfeffe,_0x21c524),_0x5afe46['batch']['addOperation'](_0x21c524),_0xdfeffe['model']['applyOperation'](_0x21c524);}}),this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x304ab9,_0x53b3d8){return _0x304ab9['filter'](_0x91d514=>{if('rename'==_0x91d514['type']){const _0x52b83e=_0x91d514['position']['nodeAfter'];return!_0x53b3d8['has'](_0x52b83e);}if(_0x91d514['type']['indexOf']('Attribute')>-0x1){const _0x524b1a=_0x91d514['range']['start']['nodeAfter'];return!_0x53b3d8['has'](_0x524b1a);}return!0x0;});}['_anchorOperation'](_0x1d5601,_0x528c26,_0x494554){const _0x112f34=_0x528c26['clone']();for(const _0x3b9663 in _0x528c26){const _0xbae8dc=_0x528c26[_0x3b9663];_0xbae8dc instanceof _0x5e3e59?_0x528c26[_0x3b9663]=new _0x5e3e59(_0xa536b0(_0xbae8dc['start']),_0xa536b0(_0xbae8dc['end'])):_0xbae8dc instanceof _0x5464f3&&(_0x528c26[_0x3b9663]=_0xa536b0(_0xbae8dc));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x112f34['type'])){if(_0x112f34['isDocumentOperation']=!0x1,_0x112f34['baseVersion']=null,'remove'==_0x112f34['type']){const _0x4f70cb=_0x112f34['sourcePosition'],_0x188656=_0x112f34['howMany'];new _0x21f6d9(_0x4f70cb,_0x188656)['_execute']();}else _0x112f34['_execute']();}function _0xa536b0(_0x4581af){if('$graveyard'==_0x4581af['root']['rootName'])return _0x4581af;const _0x5886cf=[];let _0x257326=_0x4581af['root'];for(let _0x5e8370=0x0;_0x5e8370<_0x4581af['path']['length'];_0x5e8370++){const _0x53f532=_0x1d5601['get'](_0x257326)||0x0;_0x5886cf[_0x5e8370]=_0x4581af['path'][_0x5e8370]+_0x53f532,_0x257326=_0x257326['getChildAtOffset'](_0x4581af['path'][_0x5e8370]);}return new _0x5464f3(_0x494554,_0x5886cf,_0x4581af['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x1c581d,content:_0x2f82bf,version:_0xb0accc,aiBalloon:_0x4ac5c4}=this['_interactionParams'];this['_clearErrorState'](),this['_actionsBalloonView']['clearContent'](),this['_actionsBalloonView']['showLoader'](),this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),this['stopListening'](this['_actionsBalloonView']),this['_setupApplyListeners'](),this['_createInteraction'](_0x2f82bf,_0xb0accc,_0x4ac5c4,_0x1c581d)['catch'](_0x203449=>{this['_isAbortError'](_0x203449)||console['error']('Error\x20refreshing\x20interaction:',_0x203449);});}['_isAbortError'](_0x288c4d){return!!_0x288c4d['message']&&_0x288c4d['message']['startsWith']('ai-request-aborted');}['_clearInteractionHistory'](){this['_interactions']=[],this['_interactionParams']=void 0x0,this['_currentInteractionIndex']=0x0,this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_stopInteraction'](){this['_interaction']&&this['_interaction']['stop'](),this['_promiseQueue']['abort'](),this['isBusy']=!0x1,this['_interactionParams']&&this['_actionsBalloonView']['stopAutoScroll']();}['_navigateToPrevious'](){const _0x254f0b=this['_interactions']['length'];this['_currentInteractionIndex']<_0x254f0b-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x1a4422){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x1a4422;const _0x5e28d8=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x5e28d8)return;if(_0x5e28d8['hasError'])return this['_setErrorState'](_0x5e28d8),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x5e28d8['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x1b245c=_0x5e28d8['replies'][_0x5e28d8['replies']['length']-0x1];if(_0x1b245c){const _0x4c7bc4=this['editor'];try{const _0x14baf4=Zi({'editor':_0x4c7bc4,'changeGroups':_0x1b245c['changeGroups'],'documentContextContent':_0x1b245c['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x35a998=>setTimeout(_0x35a998,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x14baf4[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x134166){this['_isAbortError'](_0x134166)||console['error']('Error\x20updating\x20content\x20during\x20navigation:',_0x134166);}}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x1c86cf){const _0x199db7=Hi(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x199db7),_0x1c86cf['hasError']=!0x0,await this['_promiseQueue']['queueEmptyPromise'],this['_actionsBalloonView']['setErrorState'](),this['_actionsBalloonView']['toggleIsLoading'](!0x0);}['_clearErrorState'](){this['_actionsBalloonView']['hideError'](),this['_actionsBalloonView']['toggleIsLoading'](!0x1);}async['_clearLoadingState'](){await this['_promiseQueue']['queueEmptyPromise'],this['isBusy']=!0x1,this['_actionsBalloonView']['setIsLoading'](!0x1);}}class AIQuickActions extends _0x446a45{static get['requires'](){return[AIQuickActionsUI,AIQuickActionsEditing,AIActions];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2d3dc2){super(_0x2d3dc2),_0x2d3dc2['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}}class AIReviewCoreReviewCheckListItemResultsView extends Nt{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x3a29ac,_0x4fda13){super(_0x3a29ac),this['id']=_0x4fda13,this['set']('status','pending'),this['set']('changeId',_0x4fda13),this['resultResponseView']=this['_createResultResponseView'](),this['acceptButtonView']=this['_createAcceptButtonView'](),this['dismissButtonView']=this['_createDismissButtonView'](),this['infoButtonView']=this['_createInfoButtonView'](),this['outdatedButtonView']=this['_createOutdatedButtonView'](),this['set']('isInfoToggleOn',!0x1),this['set']('isActive',!0x1),this['set']('showDiff',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-result',this['bindTemplate']['if']('isActive','ck-ai_review__check-run-result_active')]},'on':{'click':this['bindTemplate']['to']('click'),'mouseover':this['bindTemplate']['to']('mouseover'),'mouseout':this['bindTemplate']['to']('mouseout')},'children':[this['resultResponseView'],{'tag':'div','attributes':{'class':['ck-ai_review__check-run-result-footer']},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-run-result-action-buttons']},'children':[this['acceptButtonView'],this['dismissButtonView'],this['outdatedButtonView']]},this['infoButtonView']]}]}),this['on']('click',(_0x131967,_0x10f87a)=>{_0x10f87a&&_0x10f87a['target']&&'A'===_0x10f87a['target']['tagName']&&_0x10f87a['preventDefault'](),this['fire']('activateChange',{'id':_0x4fda13,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x4fda13,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x4fda13,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x596f9e=new Nt(this['locale']);return _0x596f9e['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response',this['bindTemplate']['if']('showDiff','ck-hidden',_0x28d466=>!_0x28d466)]}}),_0x596f9e;}['_createAcceptButtonView'](){const _0x569550=new vt(this['locale']);return _0x569550['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x569550['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x169dd6=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x169dd6['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x43b0a5=>'pending'!==_0x43b0a5&&'accepted'!==_0x43b0a5),this['bindTemplate']['if']('status',Ui,_0x45a5ce=>'pending'===_0x45a5ce),this['bindTemplate']['if']('status',Bi,_0x540f5f=>'pending'!==_0x540f5f),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0xfa72cc=>'accepted'===_0xfa72cc)]}}),this['on']('change:status',(_0x4b06be,_0x3c2430,_0x35b4ed)=>{_0x569550['isEnabled']='pending'===_0x35b4ed,'accepted'===_0x35b4ed&&(_0x569550['label']=Hi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x569550['icon']=_0x413c73);}),_0x569550;}['_createDismissButtonView'](){const _0x3b7178=new vt(this['locale']);return _0x3b7178['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x3b7178['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x552f26=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x552f26['stopPropagation']();})},'attributes':{'class':[Bi,this['bindTemplate']['if']('status','ck-hidden',_0x1e1cf7=>'pending'!==_0x1e1cf7&&'rejected'!==_0x1e1cf7),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x27f2da=>'pending'===_0x27f2da),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x283f20=>'rejected'===_0x283f20)]}}),this['on']('change:status',(_0x5bd5d8,_0x7e7796,_0x420212)=>{_0x3b7178['isEnabled']='pending'===_0x420212,'rejected'===_0x420212&&(_0x3b7178['label']=Hi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x3b7178['icon']=_0x4753f1);}),_0x3b7178;}['_createInfoButtonView'](){const _0x1e1cd3=new vt(this['locale']);return _0x1e1cd3['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x4507a4,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Bi+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x1e1cd3['bind']('isOn')['to'](this,'isInfoToggleOn',_0x25dd89=>_0x25dd89),_0x1e1cd3['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x1e1cd3;}['_createOutdatedButtonView'](){const _0x327686=new vt(this['locale']);return _0x327686['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':it,'withText':!0x0,'isEnabled':!0x1}),_0x327686['extendTemplate']({'attributes':{'class':[Bi,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x30b390=>'outdated'!==_0x30b390)],'disabled':'disabled'}}),_0x327686;}}class AIReviewCoreBalloonSuggestionItemView extends Xt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x3be59a,_0x5dd3a6){super(_0x3be59a),this['set']({'isVisible':!0x1,'position':'arrow_se','class':null,'top':0x0,'left':0x0}),this['extendTemplate']({'tag':'div','attributes':{'class':['ck-reset'],'tabindex':'-1'}}),this['set']('isDiffActive',!0x1),this['content']['add'](this['_createContentView']()),_0x5dd3a6['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x2d7685){this['resultItemView']['changeId']=_0x2d7685['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x2d7685['contentDiffed'];}['showBalloon'](_0x239e65,_0x1d9b03,_0x1a924a,_0x4389c7,_0x1ea39a,_0x46c8db){const _0x135071=_0x1d9b03();if(!_0x135071)return;this['updateContent'](_0x239e65),this['show']();const _0x234835=Array['from'](_0x135071['getClientRects']())['reverse'](),_0x59e278=this['_getPointedRectIndexFromEvent'](_0x1a924a,_0x234835),_0x5d29a1=_0x234835[_0x59e278??0x0];'click'===_0x4389c7?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x1d9b03(),_0x59e278,_0x239e65['id'],_0x1ea39a,_0x46c8db)||_0x5d29a1})):'hover'===_0x4389c7&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x1d9b03(),_0x59e278,_0x239e65['id'])||_0x5d29a1}));}['hideBalloon'](){this['hide'](),this['unpin'](),this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetElement']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}['hideDiffInBalloon'](){this['resultItemView']['showDiff']=!0x1;}['showDiffInBalloon'](){this['resultItemView']['showDiff']=!0x0;}['deactivateChange'](){this['fire']('deactivateChange',{'origin':'balloon'});}['_setupClickOutsideHandler'](){zt({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x329f4d=[this['element']];return this['_pinnedTargetElement']&&_0x329f4d['push'](this['_pinnedTargetElement']),_0x329f4d;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x14338c=new Nt();return this['resultItemView']=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x14338c['setTemplate']({'tag':'div','attributes':{'class':['ck-reset','ck-ai_review-balloon-panel-suggestion',this['bindTemplate']['if']('isDiffActive','ck-ai_review-balloon-panel-suggestion_diff-active')]},'children':[{'tag':'p','attributes':{'class':['ck-ai_review__suggestion-text']},'children':[this['resultItemView']]}]}),_0x14338c;}['_getBestRectPositionOnClick'](_0x507613,_0x14bd62,_0x17749d,_0x251c1c,_0x33a813){if(!_0x507613)return null;const _0xaea1a7=this['position']['replace']('arrow_',''),_0x39961f=Array['from'](_0x507613['getClientRects']());let _0x3d7511,_0x4a2591=_0x39961f['reverse']();return void 0x0!==_0x14bd62&&this['_isPinnedRectVisible'](_0x4a2591[_0x14bd62],_0x251c1c,_0x33a813)?(_0x3d7511=_0x4a2591[_0x14bd62],this['_pinnedRectIndex']=_0x14bd62):this['_isPinnedRectVisible'](_0x4a2591[0x0],_0x251c1c,_0x33a813)&&void 0x0===_0x14bd62?_0x3d7511=_0x4a2591[0x0]:(_0x4a2591='s'==_0xaea1a7[0x0]?[..._0x39961f]['reverse']():_0x39961f,_0x4a2591['forEach'](_0x174c25=>{this['_isPinnedRectVisible'](_0x174c25,_0x251c1c,_0x33a813)&&(_0x3d7511=_0x174c25);})),this['_pinnedTargetChangeId']=_0x17749d,this['_pinnedTargetElement']=_0x507613,_0x3d7511||_0x507613['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x4aafee,_0x374b21,_0x18507b){if(!_0x4aafee)return null;const _0x35a1d7=Array['from'](_0x4aafee['getClientRects']())['reverse']();if(void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x374b21&&this['_pinnedTargetChangeId']!==_0x18507b)return this['_pinnedRectIndex']=_0x374b21,this['_pinnedTargetElement']=_0x4aafee,this['_pinnedTargetChangeId']=_0x18507b,_0x35a1d7[_0x374b21];if(void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x18507b){if(_0x4aafee!==this['_pinnedTargetElement'])return Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']];return _0x35a1d7[this['_pinnedRectIndex']];}return void 0x0!==_0x374b21&&this['_pinnedTargetChangeId']!==_0x18507b?(this['_pinnedRectIndex']=_0x374b21,this['_pinnedTargetElement']=_0x4aafee,this['_pinnedTargetChangeId']=_0x18507b,_0x35a1d7[_0x374b21]):_0x4aafee['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x245acf,_0x2e379c){if(_0x245acf)for(let _0x55840a=0x0;_0x55840a<_0x2e379c['length'];_0x55840a++){const _0xd25bd7=_0x2e379c[_0x55840a];if(_0x245acf['clientX']>=_0xd25bd7['left']-0x3&&_0x245acf['clientX']<=_0xd25bd7['right']+0x3&&_0x245acf['clientY']>=_0xd25bd7['top']-0x3&&_0x245acf['clientY']<=_0xd25bd7['bottom']+0x3)return _0x55840a;}}['_isPinnedRectVisible'](_0x3581b1,_0xd90a80,_0x4a95f1){const _0x3db833=new ut(_0x3581b1),_0x372507=_0xd90a80||document['documentElement'],_0x1a81ee=_0x3db833['getIntersection'](bt(_0x4a95f1)),_0x589cbc=new ut(_0x372507)['getIntersection'](_0x3db833);return!!(_0x1a81ee&&_0x589cbc&&_0x3db833['width']>0x0);}}const Fn=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];class AIReviewCoreUI extends _0xaac0f5{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[AITabs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x280e72){super(_0x280e72),this['_bodyCollection']=new Qt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Fn)['to'](this),this['_balloonSuggestionView']=new AIReviewCoreBalloonSuggestionItemView(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x4701ab=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x4701ab);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x1d0f41){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x26cd97=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x1d0f41,_0x26cd97);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x3bb9d5){_0x3bb9d5&&('error-general'!==_0x3bb9d5['status']?'error-chunk'!==_0x3bb9d5['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0xa113b8){this['_mainView']['addCheckRunResult'](_0xa113b8);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x167322){this['_mainView']['showGeneralReviewCoreErrorView'](_0x167322??Hi(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x514ae4,_0x42eedf){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x514ae4,_0x42eedf);}['setActiveStateInResults'](_0x36a796){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x34c1ea=>{_0x34c1ea['id']===_0x36a796&&_0x34c1ea['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0xe8bd9d=>_0xe8bd9d['setItemAsInactive']());}['updateChangeState'](_0x115061,_0x298c3d){'accepted'===_0x298c3d||'rejected'===_0x298c3d||'outdated'===_0x298c3d?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x115061,_0x298c3d):this['_mainView']['reviewCheckResultsView']['showResult'](_0x115061,_0x298c3d);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x466dd5,_0x5d0961,_0x17fed1,_0x54c0da,_0x43ec42,_0x3bf66c){this['_balloonSuggestionView']['showBalloon'](_0x466dd5,_0x5d0961,_0x17fed1,_0x54c0da,_0x43ec42,_0x3bf66c);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x540928){const _0x55dd29=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x380e32=>_0x380e32['id']===_0x540928);return _0x55dd29?_0x55dd29['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}}class AIReviewCoreGeneralErrorView extends Nt{constructor(_0x3ce838){super(_0x3ce838),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x8b817f=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x8b817f['if']('isVisible','ck-hidden',_0x26ea22=>!_0x26ea22)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x8b817f['to']('errorMessage')}]}]});}}class AIReviewCoreView extends Nt{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x4835a7,_0x4a0e7a){super(_0x4835a7),this['reviewCoreHeader']=_0x4a0e7a['header'],this['generalErrorView']=new AIReviewCoreGeneralErrorView(_0x4835a7),this['reviewCheckListView']=_0x4a0e7a['list'],this['reviewCheckListView']['delegate'](...Fn)['to'](this),this['reviewCheckResultsView']=_0x4a0e7a['results'],this['reviewCheckResultsView']['delegate'](...Fn)['to'](this),this['reviewCompletedView']=_0x4a0e7a['completed'],this['reviewCompletedView']['delegate']('finishReview')['to'](this),this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isLoading',!0x1),this['reviewCheckResultsView']['set']('isResultReady',!0x1),this['reviewCompletedView']['set']('isVisible',!0x1),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-review','ck-rounded-corners'],'dir':'ltr'},'children':[this['reviewCoreHeader'],this['generalErrorView'],this['reviewCheckListView'],this['reviewCheckResultsView'],this['reviewCompletedView']]});}['showReviewCheckListView'](){this['reviewCheckListView']['resetAllParameterizedChecks'](),this['reviewCheckListView']['set']('isVisible',!0x0),this['reviewCheckResultsView']['set']('isVisible',!0x1),this['reviewCompletedView']['set']('isVisible',!0x1);}['showReviewCheckResultsView'](){this['hideActionsWhenResultIsReady'](),this['reviewCheckResultsView']['resetErrorState'](),this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x0),this['reviewCheckResultsView']['clearResults'](),this['reviewCheckResultsView']['set']('isLoading',!0x0),this['reviewCheckResultsView']['set']('isCompleted',!0x1);}['addCheckRunResult'](_0x571db7){this['reviewCheckResultsView']['addResult'](_0x571db7),this['reviewCheckResultsView']['set']('isLoading',!0x1);}['showReviewCompletedView'](){this['reviewCheckResultsView']['set']('isVisible',!0x0),this['reviewCompletedView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isCompleted',!0x0),this['reviewCheckListView']['set']('isVisible',!0x1);}['showActionsWhenResultIsReady'](){this['reviewCheckResultsView']['isResultReady']?(this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x0),this['reviewCompletedView']['set']('isVisible',!0x1)):this['reviewCheckResultsView']['isResultReady']=!0x0;}['showNoChangesView'](){this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x1),this['reviewCompletedView']['set']('isVisible',!0x0);}['hideActionsWhenResultIsReady'](){this['reviewCheckResultsView']['isResultReady']=!0x1;}['showGeneralReviewCoreErrorView'](_0x190c4c){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x190c4c;}['showGeneralResultsErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}}class AIReviewCoreFinishReviewButtonView extends vt{constructor(_0x439b35,_0x4b1bb8){super(_0x4b1bb8),this['set']({'label':_0x439b35,'withText':!0x0,'class':Mi}),this['on']('execute',()=>{this['fire']('finishReview');});}}class AIReviewCoreUICheckResultsView extends Pt{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x3e08ee,_0x53fdb7){super(_0x3e08ee),this['_contents']=_0x53fdb7,this['_resultViews']=new _0x1ec894(),this['_cancelButtonView']=this['_createCancelButtonView'](),this['_acceptAllButtonView']=this['_createAcceptAllButtonView'](),this['_exitReviewButtonView']=this['_createExitReviewButtonView'](),this['_toggleDiffButtonView']=this['_createToggleDiffButtonView'](),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](),this['_resultsHeader']=this['_createResultHeaderView'](),this['_resultsBody']=this['_createResultsBodyView'](),this['_errorMessageView']=this['_createErrorView'](),this['reviewDisclaimer']=new AIDisclaimerView(_0x3e08ee),this['set']('isLoading',!0x1),this['set']('isToggleDiffOn',!0x1),this['set']('isResultReady',!0x1),this['set']('headerTitle',''),this['set']('headerSubtitle',''),this['set']('isError',!0x1),this['set']('showErrorMessage',!0x1),this['set']('errorType','general'),this['set']('isCompleted',!0x1);const _0x19c508=this['_createCombinedSkeletonLoader'](),_0x82570e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x82570e['if']('isLoading','ck-ai_review__check-run_loading',_0x37ca14=>_0x37ca14),_0x82570e['if']('isResultReady','ck-ai_review__check-run_ready',_0x3fcdfb=>_0x3fcdfb),_0x82570e['if']('isVisible','ck-hidden',_0xec2620=>!_0xec2620)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x19c508,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x4a5276){const _0x8a4c57=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],_0x4a5276['id']);_0x8a4c57['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x8a4c57),_0x8a4c57['resultResponseView']['element']['innerHTML']=_0x4a5276['contentDiffed'];}['hideResult'](_0x5605e2,_0x422896){if('pending'===_0x422896)return;const _0xfbf0df=this['_resultViews']['find'](_0xaa4fd1=>_0xaa4fd1['id']===_0x5605e2);_0xfbf0df&&(_0xfbf0df['status']=_0x422896,_0xfbf0df['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x752e23,_0x174ef5){if('pending'!==_0x174ef5)return;const _0x5bccdf=this['_resultViews']['find'](_0x563e77=>_0x563e77['id']===_0x752e23);_0x5bccdf&&(_0x5bccdf['status']=_0x174ef5,_0x5bccdf['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x442b5f,_0x55a496){this['headerTitle']=_0x442b5f,this['headerSubtitle']=_0x55a496||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}['resetErrorState'](){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}['_createSkeletonLoader'](){return new AISkeletonView(this['locale'],Ss['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0xe688d7=new Nt(this['locale']),_0x5161ed=[];for(let _0x560bdf=0x0;_0x560bdf<0x10;_0x560bdf++){const _0x6e92a0=this['_createSkeletonLoader']();_0x6e92a0['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x5161ed['push'](_0x6e92a0);}return _0xe688d7['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x1a915a=>!_0x1a915a)]},'children':_0x5161ed}),_0xe688d7;}['_createResultsBodyView'](){const _0x405810=new Nt(this['locale']);return _0x405810['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x5f4d6e=>_0x5f4d6e)]},'children':this['_resultViews']}),_0x405810;}['_createErrorView'](){const _0x466039=new Nt(this['locale']),_0x406166=new vt(this['locale']),t=this['locale']['t'];return _0x466039['delegate']('retryReview')['to'](this),_0x406166['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Ui+'\x20ck-ai_review__check-run-error-retry-button'}),_0x406166['on']('execute',()=>{this['fire']('retryReview');}),_0x466039['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x5b13dd=>!_0x5b13dd),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x2fed46=>'chunk'===_0x2fed46)]},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error','ck-ai-notification__full-width','ck-ai_review__check-run-error-message',this['bindTemplate']['if']('errorType','ck-ai-notification_warning',_0x167df0=>'chunk'===_0x167df0)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x51234c=>'general'!==_0x51234c)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x5354b1=>'chunk'!==_0x5354b1)]},'children':[{'text':Hi(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x406166]}),_0x466039;}['_createCancelButtonView'](){const _0x3f3355=new vt(this['locale']);return _0x3f3355['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Ui+'\x20ck-ai-button-stop-generating'],'icon':_0x10fda8}),_0x3f3355['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x2a9c93=>_0x2a9c93),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x29b927=>_0x29b927)]}}),_0x3f3355['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x3f3355;}['_createToggleDiffButtonView'](){const _0x1339c=new vt(this['locale']);_0x1339c['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x1339c['bind']('isEnabled')['to'](this,'isError',_0x4d4768=>!_0x4d4768),_0x1339c['extendTemplate']({'attributes':{'class':[Ui,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x2374c6=>!_0x2374c6),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2f671c=>_0x2f671c)]}});const _0x538d09=Hi(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x1eafa8=Hi(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x1339c['bind']('isOn')['to'](this,'isToggleDiffOn',_0x32a84c=>_0x32a84c),_0x1339c['bind']('icon')['to'](this,'isToggleDiffOn',_0x234dde=>_0x234dde?st:nt),_0x1339c['bind']('label')['to'](this,'isToggleDiffOn',_0x1bf78b=>_0x1bf78b?_0x538d09:_0x1eafa8),_0x1339c['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x1339c;}['_createAcceptAllButtonView'](){const _0x5a3617=new vt(this['locale']);return _0x5a3617['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x5a3617['bind']('isEnabled')['to'](this,'isError',_0x493523=>!_0x493523),_0x5a3617['extendTemplate']({'attributes':{'class':[Mi,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x23696f=>!_0x23696f),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x25c9c0=>_0x25c9c0)]}}),_0x5a3617['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x5a3617;}['_createExitReviewButtonView'](){const _0x2d27e7=new vt(this['locale']);return _0x2d27e7['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x2d27e7['extendTemplate']({'attributes':{'class':[Bi,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x42f5a1=>!_0x42f5a1),this['bindTemplate']['if']('isCompleted','ck-hidden',_0xc7e6a2=>_0xc7e6a2)]}}),_0x2d27e7['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x2d27e7;}['_createResultHeaderView'](){const _0x2b535b=new Nt(this['locale']),_0x51b873=this['_createTitleView']();return _0x2b535b['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x497c1f=>_0x497c1f)]},'children':[_0x51b873,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-buttons']},'children':[this['_cancelButtonView'],this['_acceptAllButtonView'],this['_exitReviewButtonView'],this['_toggleDiffButtonView'],this['_finishReviewButtonView']]}]}),_0x2b535b;}['_createTitleView'](){const _0x54b01e=new Nt(this['locale']),_0xd321=new AISpinnerView();return _0xd321['bind']('isVisible')['to'](this,'isResultReady',_0x176396=>!_0x176396),_0x54b01e['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper']},'children':[_0xd321,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-content',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x538883=>_0x538883)]},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-title']},'children':[{'text':this['bindTemplate']['to']('headerTitle')}]},{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-subtitle']},'children':[{'text':this['bindTemplate']['to']('headerSubtitle')}]}]},{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x1981d2=>!_0x1981d2)]},'children':[{'text':Hi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')}]}]}),_0x54b01e;}['_createFinishReviewButtonView'](){const _0x4cb1f9=new AIReviewCoreFinishReviewButtonView(Hi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x4cb1f9['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3ffd94=>!_0x3ffd94)]}}),_0x4cb1f9['delegate']('finishReview')['to'](this),_0x4cb1f9;}}class AIReviewCoreReviewCompletedView extends Pt{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x8ed954,_0x10ba61){super(_0x8ed954),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x10ba61['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x10ba61['headerText']);const _0x4f6bd9=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x4f6bd9['if']('isVisible','ck-hidden',_0x3d2b9b=>!_0x3d2b9b)]},'children':[this['_resultsHeader'],{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-content']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-content-icon']},'children':[{'text':'👍'}]},{'tag':'p','attributes':{'class':['ck-ai_review__review-completed-content-text']},'children':[{'text':_0x10ba61['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x1b4d88){const _0x2a3fa5=new AIReviewCoreFinishReviewButtonView(_0x1b4d88,this['locale']);return _0x2a3fa5['delegate']('finishReview')['to'](this),_0x2a3fa5;}['_createResultHeaderView'](_0x4d4da){const _0x4cf792=new Nt(this['locale']);return _0x4cf792['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title']},'children':[{'text':_0x4d4da}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x4cf792;}}class AIReviewCoreFormDropdownView extends Nt{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x33ca7f,_0x49b746){super(_0x33ca7f),this['_defaultValue']=_0x49b746['default']||(_0x49b746['data']['length']>0x0?_0x49b746['data'][0x0]['id']:''),this['_defaultLabel']=_0x49b746['data']['find'](_0xf7617e=>_0xf7617e['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=Gt(this['locale']);const _0x36e9a9=this['_prepareListOptions'](_0x49b746['data']);jt(this['_dropdownView'],_0x36e9a9,{'role':'menu','ariaLabel':_0x49b746['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x17f016=>{_0x17f016['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x24b2c8=>{this['formValue']=_0x24b2c8['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x24b2c8['source']['model']['label'];}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai_review__check-list-item-parameterized-form-element','ck-ai_review__check-list-item-parameterized-form-element_dropdown']},'children':[this['_dropdownView']]});}['resetToDefault'](){this['formValue']=this['_defaultValue'],this['_dropdownView']['buttonView']['label']=this['_defaultLabel'];}['_prepareListOptions'](_0x3c0f91=[]){const _0x4bbf5d=new dt();this['resetToDefault']();for(const _0x4ae85e of _0x3c0f91){const _0x32d8b7=new Jt({'label':_0x4ae85e['label'],'withText':!0x0,'role':'menuitemradio','id':_0x4ae85e['id'],'model':_0x4ae85e});_0x32d8b7['bind']('isOn')['to'](this,'formValue',_0x1f25d8=>_0x1f25d8===_0x32d8b7['id']);const _0xc9d751={'type':'button','model':_0x32d8b7};_0x4bbf5d['add'](_0xc9d751);}return _0x4bbf5d;}}class AIReviewCoreFormManagerView extends Pt{['_formItem']=null;constructor(_0x1e7044,_0x362e98,_0x50af44){super(_0x1e7044),this['argsKey']=_0x362e98?.['argsKey'];if('dropdown'===_0x362e98['formType'])this['_formItem']=new AIReviewCoreFormDropdownView(this['locale'],_0x362e98);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x293df9=new _0x3282fe(this['locale'],{'children':[this['_formItem']],'class':[_0x50af44?'ck-form__row_with-submit':'']});_0x50af44&&_0x293df9['children']['add'](_0x50af44),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x293df9]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}}class AIReviewCorePromptInputView extends _0x3968d5{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x3ef4b0){super(_0x3ef4b0),this['set']('isEmpty',!0x0),this['keystrokes']=new It(),this['minRows']=AIReviewCorePromptInputView['MIN_ROWS'],this['maxRows']=AIReviewCorePromptInputView['MAX_ROWS'],this['extendTemplate']({'attributes':{'id':'ai-review-prompt-input','class':['ck','ck-review__prompt-input']}});}['render'](){super['render'](),this['on']('update',()=>{this['isEmpty']=''===this['element']['value']?.['trim']();}),this['keystrokes']['listenTo'](this['element']);}}class AIReviewCoreCustomCheckView extends Nt{['focusTracker']=new _t();['keystrokes']=new It();['focusCycler'];['_focusables']=new _0x1ec894();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0x302528,_0x5f2b79,_0x42f4bc=!0x1){super(_0x302528),this['_check']=_0x5f2b79,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x5f2b79['defaultModel']?_0x5f2b79['defaultModel']['id']:'',this['_defaultLabel']=_0x5f2b79['defaultModel']?_0x5f2b79['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new te(this['locale'],()=>new AIReviewCorePromptInputView(_0x302528)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelSelectionDropdownItems']=new dt(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0x42f4bc),jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new _0x3282fe(this['locale'],{'children':[this['promptInputView']]}),new _0x3282fe(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x2b9d7a,_0x18f14a)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x18f14a()):_0x18f14a();}),this['focusCycler']=new Mt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),([this['promptInputView'],this['_modelSelectionDropdown'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0x27859e=>{this['_focusables']['add'](_0x27859e),this['focusTracker']['add'](_0x27859e['element']);}),this['keystrokes']['listenTo'](this['element']));}get['modelDefaultValue'](){return this['_defaultValue'];}get['modelDefaultLabel'](){return this['_defaultLabel'];}['resetToDefault'](){this['prompt']='',this['modelId']=this['modelDefaultValue'],this['_modelSelectionDropdown']['buttonView']['label']=this['modelDefaultLabel'],this['resetFormValidationStatus']();}['resetFormValidationStatus'](){this['promptInputView']['errorText']='';}['_isValid'](){this['resetFormValidationStatus']();for(const _0x56d115 of this['_getFormValidators']()){const _0x50f9b9=_0x56d115();if(_0x50f9b9)return this['promptInputView']['errorText']=_0x50f9b9,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return Hi(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x2d1fb6=new vt(this['locale']),t=this['locale']['t'];return _0x2d1fb6['set']({'label':t('Submit'),'withText':!0x0,'class':Mi}),_0x2d1fb6['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x2d1fb6;}['_createCancelButtonView'](){const _0x31c2dd=new vt(this['locale']),t=this['locale']['t'];return _0x31c2dd['set']({'label':t('Cancel'),'withText':!0x0,'class':Bi}),_0x31c2dd['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x52b76f=>{_0x52b76f['stopPropagation']();})}}),_0x31c2dd['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x31c2dd;}['_setModelList'](_0x3c2c84){this['_modelSelectionDropdownItems']['clear']();const _0x41834e=this['_check']['models'];if(_0x3c2c84)this['set']('modelDisplayMode','hidden');else{const _0xf3a92e=0x1===_0x41834e['length'];this['set']('modelDisplayMode',_0xf3a92e?'name':'selector');}if(this['resetToDefault'](),_0x41834e?.['length']){0x1===_0x41834e['length']&&this['set']('activeModelName',_0x41834e[0x0]['name']||_0x41834e[0x0]['id']);for(const _0x4499d1 of _0x41834e){const _0x3bd67d=new Jt({'label':_0x4499d1['name'],'withText':!0x0,'role':'menuitemradio','id':_0x4499d1['id'],'model':_0x4499d1});_0x3bd67d['bind']('isOn')['to'](this,'modelId',_0x48416e=>_0x48416e===_0x4499d1['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x3bd67d,'labelView':new ModelButtonLabelView(this['locale'],_0x4499d1)});}}}['_createModelSelectionDropdown'](){const _0xa846f2=Gt(this['locale']);return _0xa846f2['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0xa846f2['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':Bi}),_0xa846f2['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x5da018=>'selector'===_0x5da018),this['listenTo'](_0xa846f2,'execute',_0x44a09e=>{this['modelId']=_0x44a09e['source']['model']['id'],_0xa846f2['buttonView']['label']=_0x44a09e['source']['label'];}),_0xa846f2;}['_createModelNameView'](){const _0x31c4b2=new ModelNameView(this['locale']);return _0x31c4b2['bind']('text')['to'](this,'activeModelName',_0x579c11=>_0x579c11??''),_0x31c4b2['bind']('isVisible')['to'](this,'modelDisplayMode',_0x35723e=>'name'===_0x35723e),_0x31c4b2;}['_createActionsFooterView'](){const _0x3748bb=new Nt(this['locale']);return _0x3748bb['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions-footer']},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-custom-actions-buttons']},'children':[this['cancelButtonView'],this['submitButtonView']]}]}),_0x3748bb;}}class ModelNameView extends Nt{constructor(_0x481fd7){super(_0x481fd7),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x372b85=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x372b85['if']('isVisible','ck-hidden',_0x1d004d=>!_0x1d004d)]},'children':[{'text':_0x372b85['to']('text')}]});}}class ModelButtonLabelView extends Ht{constructor(_0x44e5b2,_0x3ca0c0){super();const _0x39c11a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x39c11a['to']('style'),'id':_0x39c11a['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x39c11a['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x3ca0c0['description']||'']}]}]});}}class AIReviewCoreReviewCommandListItemView extends Pt{['_formItemsCollection']=new _0x1ec894();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x5b5796,_0x4ed997,_0x53a9af,_0x8e5ffb=!0x1){super(_0x5b5796),this['_hideModels']=_0x8e5ffb,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x4ed997['isParameterized']);const _0xa5742e=this['_createIconView']();this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item',this['bindTemplate']['if']('isParametrizedViewOpen','ck-ai_review__check-list-item_selected',_0x15f007=>_0x15f007),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x1fddd9=>_0x1fddd9)],'style':{'--ck-ai-review-check-list-item-index':_0x53a9af}},'on':{'click':this['bindTemplate']['to']('click')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-main-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-title']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__check-list-item-title-text']},'children':[{'text':_0x4ed997['title']}]},_0xa5742e]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x4ed997['description']?[{'text':_0x4ed997['description']}]:[]}]}]},..._0x4ed997['isParameterized']?[this['_createParameterizedView'](_0x4ed997)]:[],...'custom'===_0x4ed997['id']?[this['_createCustomView'](_0x4ed997,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x4ed997['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x4ed997['id'],'args':_0x4ed997['useArgs']?_0x4ed997['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&zt({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x27a882=>{_0x27a882['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x27c141=new xt();return _0x27c141['content']=rt,_0x27c141['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x27c141;}['_createParameterizedView'](_0x308370){const _0x30cff6=new Nt(),_0x24e8e6=this['_createFormView'](_0x308370);return _0x30cff6['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x166c5b=>!_0x166c5b)]},'children':[_0x24e8e6]}),_0x30cff6;}['_createFormView'](_0x47e851){const _0x399957=new Nt(),_0x1b37d9=Array['isArray'](_0x47e851['options'])?_0x47e851['options']:[],_0x22255e=new vt(this['locale']),t=this['locale']['t'];_0x22255e['set']({'label':t('Submit'),'withText':!0x0,'class':Mi}),_0x22255e['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x58de1c=>{_0x58de1c['stopPropagation']();})}}),_0x22255e['on']('execute',()=>{const _0x33f0fa=[],_0x1b2bc7={};this['_formItemsCollection']['forEach'](_0xa7a8b9=>{_0x33f0fa['push'](_0xa7a8b9['value']),_0x47e851['useArgs']&&_0x47e851['options']&&(_0x1b2bc7[_0xa7a8b9['argsKey']]=_0xa7a8b9['value']);}),this['fire']('runReviewCheck',{'id':_0x47e851['id'],'params':_0x33f0fa['length']?_0x33f0fa:void 0x0,'args':Object['keys'](_0x1b2bc7)['length']?_0x1b2bc7:void 0x0});});const _0x52017f=_0x1b37d9['length'];return _0x1b37d9['forEach']((_0x59c654,_0x4ddc00)=>{const _0x1af548=_0x4ddc00===_0x52017f-0x1;this['_formItemsCollection']['add'](new AIReviewCoreFormManagerView(this['locale'],_0x59c654,_0x1af548?_0x22255e:null));}),_0x399957['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x399957;}['_createCustomView'](_0x2b8879,_0x5edd5a=!0x1){return this['_customCheckView']=new AIReviewCoreCustomCheckView(this['locale'],_0x2b8879,_0x5edd5a),this['_customCheckView']['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-parameterized','ck-ai_review__check-list-item-parameterized_custom',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x4b8c7d=>!_0x4b8c7d)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x4f31fd,_0xc09580,_0x29c9fe)=>{_0x29c9fe||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}}class AIReviewCoreReviewCheckListView extends Pt{['_checkViews'];constructor(_0x123687){super(_0x123687),this['_checkViews']=new _0x1ec894(),this['_setupTemplate']();}['setChecks'](_0x172ede,_0x4fce52=!0x1){this['_checkViews']['clear']();for(const [_0x38242c,_0x3e2a14]of _0x172ede['entries']()){const _0x4649b8=new AIReviewCoreReviewCommandListItemView(this['locale'],_0x3e2a14,_0x38242c,_0x4fce52);_0x4649b8['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x4649b8);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x58b3ba of this['_checkViews'])_0x58b3ba instanceof AIReviewCoreReviewCommandListItemView&&_0x58b3ba['resetToDefault']();}['_setupTemplate'](){const _0x1f18d4=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x1f18d4['if']('isVisible','ck-hidden',_0x81c177=>!_0x81c177)]},'children':this['_checkViews']});}}class AIReviewModeUI extends AIReviewCoreUI{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x9faa0e=this['context']['plugins']['get']('AITabs'),_0x22650c=this['context']['locale'],_0x46c68f=new AIHeaderView(_0x22650c,{'label':Hi(_0x22650c,'AI_REVIEW_MODE'),'icon':_0x55b258,'class':'ck-ai-header_review','showResizeButton':_0x9faa0e['showResizeButton']});return _0x46c68f['delegate']('resizeTabs')['to'](_0x9faa0e),_0x46c68f['bind']('isMaximized')['to'](_0x9faa0e['view'],'isMaximized',_0x2a79ca=>_0x2a79ca),new AIReviewCoreView(this['context']['locale'],{'header':_0x46c68f,'list':new AIReviewCoreReviewCheckListView(_0x22650c),'results':new AIReviewCoreUICheckResultsView(_0x22650c,{'generalErrorText':Hi(_0x22650c,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x22650c,{'headerText':Hi(_0x22650c,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Hi(_0x22650c,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Hi(_0x22650c,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x308668=this['context']['plugins']['get']('AITabs');_0x308668['view']['on']('activateTab',(_0x100fd0,{newTab:_0x5c4dce,oldTab:_0x37ce58})=>{'reviewMode'===_0x5c4dce?this['fire']('getReviewCheckList'):'reviewMode'===_0x37ce58&&this['fire']('leaveReview');}),_0x308668['view']['addTab']({'id':'reviewMode','buttonLabel':Hi(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x55b258,'order':0x0,'content':this['_mainView']});}}const Kn='review-',Wn=['softBreak'];class AIReviewCoreEditing extends _0xaac0f5{static get['requires'](){return[_0x2ef109,AIEditing];}static get['pluginName'](){return'AIReviewCoreEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_markers']=new Map();['_activeMarkers']=new Set();['_domEmitter'];['_eventEmitter'];['_reviewEditingAttachedEditors']=new WeakSet();['_boundEditables']=new WeakMap();constructor(_0x1cb4aa){super(_0x1cb4aa),this['_domEmitter']=new(Ot())(),this['_eventEmitter']=new(Et())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x39203e=_0xc091a0=>this['_scheduleAttachReviewEditingToEditor'](_0xc091a0);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0xf823c1)return void _0x39203e(this['context']);const _0x338df1=this['context'];for(const _0x2ab05c of _0x338df1['editors'])_0x39203e(_0x2ab05c);this['listenTo'](_0x338df1['editors'],'add',(_0x3cd77c,_0x4bca26)=>{_0x39203e(_0x4bca26);}),this['listenTo'](_0x338df1['editors'],'remove',(_0x1b639b,_0x27d544)=>{for(const [_0xa0c3aa,_0x6c5dcf]of this['_markers'])_0x6c5dcf['editor']===_0x27d544&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0xa0c3aa,'changeId':_0x6c5dcf['groupId']}),this['_markers']['delete'](_0xa0c3aa));});}['_scheduleAttachReviewEditingToEditor'](_0x2e4a3d){const _0x373b3d=()=>{'destroyed'!==_0x2e4a3d['state']&&_0x2e4a3d['conversion']&&this['_attachReviewEditingToEditor'](_0x2e4a3d);};if('ready'===_0x2e4a3d['state'])return void _0x373b3d();const _0x20253e=()=>{this['stopListening'](_0x2e4a3d,'ready',_0x20253e),_0x373b3d();};this['listenTo'](_0x2e4a3d,'ready',_0x20253e);}['_attachReviewEditingToEditor'](_0x3cde44){this['_reviewEditingAttachedEditors']['has'](_0x3cde44)||(_0x3cde44['conversion']['for']('editingDowncast')['markerToElement']({'model':Kn+'insert','view':(_0x3ef22a,{writer:_0x20ee64})=>{const _0x8fea0e=this['_markers']['get'](_0x3ef22a['markerName']),_0x5b914c={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x8fea0e?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x3ef22a['markerName']};return _0x20ee64['createUIElement']('span',_0x5b914c,function(_0x2d5cc7){const _0x21567e=this['toDomElement'](_0x2d5cc7);return _0x21567e['innerHTML']=_0x8fea0e?.['content']?.['asString']||'',_0x21567e;});}}),_0x3cde44['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Kn+'remove-only','view':_0x122c3c=>{const _0x10e2d5=this['_markers']['get'](_0x122c3c['markerName']),_0x1f3ca1=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x10e2d5?.['id']||'')&&_0x1f3ca1['push']('ck-ai_review__change_active'),{'classes':_0x1f3ca1,'attributes':{'data-marker-id':_0x122c3c['markerName']}};}}),_0x3cde44['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Kn+'remove-context','view':_0x4dfc90=>{const _0x1a114b=this['_markers']['get'](_0x4dfc90['markerName']),_0x575a68=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x1a114b?.['id']||'')&&_0x575a68['push']('ck-ai_review__change_active'),{'classes':_0x575a68,'attributes':{'data-marker-id':_0x4dfc90['markerName']}};}}),_0x3cde44['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Kn+'remove-text','view':_0x168ac0=>{const _0x59b151=this['_markers']['get'](_0x168ac0['markerName']),_0x496c3f=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x59b151?.['id']||'')&&_0x496c3f['push']('ck-ai_review__change_active'),{'classes':_0x496c3f,'attributes':{'data-marker-id':_0x168ac0['markerName']}};}}),_0x3cde44['conversion']['for']('dataDowncast')['markerToElement']({'model':Kn+'suggestion-context','view':(_0x154d1d,{writer:_0x147918})=>_0x147918['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x154d1d['isOpening']?'start':'end')})}),_0x3cde44['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x54ef8f,'view':_0x5c1cf1}),this['_updateMouseMarkerInteractionListeners'](_0x3cde44),this['listenTo'](_0x3cde44,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x3cde44),{'priority':'lowest'}),this['listenTo'](_0x3cde44,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x3cde44),{'priority':'lowest'}),_0x3cde44['model']['document']['registerPostFixer'](_0x116f29=>this['_validateMarkers'](_0x3cde44,_0x116f29)),_0x3cde44['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x3cde44)),this['_reviewEditingAttachedEditors']['add'](_0x3cde44));}['_updateMouseMarkerInteractionListeners'](_0x22c6ab){let _0xce8502=this['_boundEditables']['get'](_0x22c6ab);_0xce8502||(_0xce8502=new Map(),this['_boundEditables']['set'](_0x22c6ab,_0xce8502));const _0x2889bc=new Set(_0x22c6ab['ui']['getEditableElementsNames']());for(const _0x36038c of _0x2889bc){if(_0xce8502['has'](_0x36038c))continue;const _0x452de6=_0x22c6ab['ui']['getEditableElement'](_0x36038c);_0xce8502['set'](_0x36038c,_0x452de6),this['_attachMouseMarkerInteractionListeners'](_0x452de6);}for(const [_0x572cc7,_0x444f67]of _0xce8502)_0x2889bc['has'](_0x572cc7)||(_0xce8502['delete'](_0x572cc7),this['_domEmitter']['stopListening'](_0x444f67));}['_attachMouseMarkerInteractionListeners'](_0x4e61ae){this['_domEmitter']['listenTo'](_0x4e61ae,'mouseup',(_0x26750e,_0x46e5b2)=>{const _0xb06699=_0x46e5b2['target'],_0x6f09f7=this['_findMarkerElement'](_0xb06699);if(!_0x6f09f7)return;const _0x2b5bec=_0x6f09f7['getAttribute']('data-marker-id'),_0xcae7e6=_0x2b5bec['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x2b5bec,'changeId':_0xcae7e6,'markerElement':()=>this['_findMarkerElementById'](_0x2b5bec),'domEvent':_0x46e5b2});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x4e61ae,'mouseover',(_0x4eccde,_0xa4bcd9)=>{const _0x17ab83=_0xa4bcd9['target'],_0x3a04e3=_0xa4bcd9['relatedTarget'];let _0x5669cd=this['_findMarkerElement'](_0x17ab83);if(!_0x5669cd&&_0x3a04e3&&(_0x5669cd=this['_findMarkerElement'](_0x3a04e3)),!_0x5669cd)return;const _0x23a6f6=_0x5669cd['getAttribute']('data-marker-id'),_0xbe79b1=_0x23a6f6['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0xbe79b1,'markerElement':()=>this['_findMarkerElementById'](_0x23a6f6),'domEvent':_0xa4bcd9});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x5c164b((_0x387e10,_0x483f03)=>{const _0x3402f2=_0x483f03['target'];if(this['_findMarkerElement'](_0x3402f2))return;_0x3402f2['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x49d1f9=this['context']['plugins']['get']('AIEditing'),_0xca1385=ls(this['context']);if(!_0xca1385['length'])throw new at('ai-get-editor-from-context-no-editor',this);const _0x15ced5=new Set(),_0x4d6fb6=[],_0x218604=new Map();for(const _0x3ffad3 of _0xca1385)for(const _0x2aedb9 of _0x3ffad3['model']['document']['getRoots']()){if('$graveyard'===_0x2aedb9['rootName'])continue;const _0x3af988=this['_buildDocumentDataSliceForRoot'](_0x3ffad3,_0x2aedb9,_0x49d1f9,_0x15ced5);_0x4d6fb6['push'](_0x3af988['content']);for(const [_0x190c6f,_0x140130]of _0x3af988['elements'])_0x218604['set'](_0x190c6f,_0x140130);}return{'elements':_0x218604,'content':_0x4d6fb6['join']('')};}['_buildDocumentDataSliceForRoot'](_0x39f50c,_0x216c6c,_0x52993f,_0x3150ce){const _0x3252cd=_0x39f50c['model'],_0x542704=new _0x24e4e8();for(const _0xac0cc0 of _0x216c6c['getChildren']())_0x542704['_appendChild'](_0xac0cc0['_clone'](!0x0));for(const _0x997ce0 of _0x3252cd['markers']){const _0x5d7ab6=_0x997ce0['getRange']();_0x5d7ab6&&_0x5d7ab6['root']['rootName']===_0x216c6c['rootName']&&_0x542704['markers']['set'](_0x997ce0['name'],this['_changeRangeOwnerDocument'](_0x5d7ab6['clone'](),_0x542704));}const _0x49e7f4=new Map(),_0x33eada=_0x3252cd['document']['version'],_0x2e8884=new _0x344e9d({'ignoreElementEnd':!0x0,'startPosition':_0x3252cd['createPositionAt'](_0x542704,0x0)});for(const {item:_0x74be72}of _0x2e8884){if(!_0x74be72['is']('$textProxy'))continue;const _0xbe157e=_0x74be72['parent'];if(!_0xbe157e||!_0xbe157e['is']('element'))continue;const _0x16b34a=this['_upsertDataId'](_0xbe157e,()=>_0x52993f['_nextDataId'](_0x3150ce));_0x3150ce['add'](_0x16b34a);for(const _0x1a05e3 of _0xbe157e['getChildren']())_0x1a05e3['is']('element')&&(_0x1a05e3['name']&&Wn['includes'](_0x1a05e3['name'])||_0x3150ce['add'](this['_upsertDataId'](_0x1a05e3,()=>_0x52993f['_nextDataId'](_0x3150ce))));let _0x46dfbc=_0xbe157e;for(;_0x46dfbc['parent']&&!_0x46dfbc['parent']['is']('documentFragment');)_0x46dfbc=_0x46dfbc['parent'],_0x46dfbc['hasAttribute'](_0x54ef8f)&&_0x46dfbc['_removeAttribute'](_0x54ef8f);_0x49e7f4['set'](_0x16b34a,{'editor':_0x39f50c,'rootName':_0x216c6c['rootName'],'path':_0xbe157e['getPath'](),'documentVersion':_0x33eada,'getContent':this['_createGetContentUsingDataIdFn'](_0x46dfbc['_clone'](!0x0),_0x16b34a,_0x39f50c['data'])}),_0x2e8884['jumpTo'](_0x3252cd['createPositionAfter'](_0xbe157e));}return{'content':_0x39f50c['data']['processor']['toData'](_0x39f50c['data']['toView'](_0x542704)),'elements':_0x49e7f4};}['diffContent'](_0x1fa085,_0x4796d0,_0x39c037,_0x3919e0=!0x1){const _0x46ddb1=[],_0xb127a9=_0x1fa085['data']['parse'](_0x39c037,'$documentFragment'),_0x39181e=_0x1fa085['data']['parse'](_0x4796d0,'$documentFragment'),_0x5c20ae=_0x1fa085['model']['createPositionAt'](_0x39181e,0x0);if(this['_haveSingleTopLevelElement'](_0xb127a9)){if(!this['_hasSameTopLevelElement'](_0x39181e,_0xb127a9))return _0x46ddb1;}else{const _0x245c98=_0x1fa085['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x39181e,_0x245c98)||!this['_haveOnlyInlineContent'](_0xb127a9,_0x245c98))return _0x46ddb1;}const _0x56be99=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x4796d0,_0x39c037,{'targetEditor':_0x1fa085,'anchor':_0x5c20ae,'markDeletions':!0x0})['getOperations']()['filter'](_0xfea4b3=>'insert'===_0xfea4b3['type']||'marker'===_0xfea4b3['type']&&_0xfea4b3['name']['startsWith']('$markedRemove')),_0x592ea2=this['_groupAdjacentOperations'](_0x56be99),_0x50d439=[];if(_0x3919e0){if(_0x592ea2['length']){const _0x72a0e1=_0x592ea2[0x0]['operations'][0x0],_0x36b09b='insert'===_0x72a0e1['type']?_0x72a0e1['position']:_0x72a0e1['newRange']['start'],_0x1aed6e=this['_getPositionLimitingRange'](_0x36b09b,_0x1fa085,'inside'),_0x2ac83a=_0x1aed6e?_0xb127a9['getChild'](0x0)['getChildren']():_0xb127a9['getChildren'](),_0x13e774=_0x1aed6e||_0x1fa085['model']['createRangeIn'](_0x39181e),_0x43eb8d=[new _0x5b77c2('$markedRemove:synthetic'+ot(),null,_0x13e774,_0x1fa085['model']['document']['model']['markers'],!0x0,_0x1fa085['model']['document']['version']+0x1),new _0x2543a3(_0x13e774['end'],_0x2ac83a,_0x1fa085['model']['document']['version']+0x2)];_0x50d439['push']({'operations':_0x43eb8d,'operationsIsolated':_0x43eb8d,'groupOffset':0x0});}}else _0x50d439['push'](..._0x592ea2);let _0x319541=0x0;return _0x1fa085['model']['change'](_0x3ef1d7=>{for(let _0x85c1ec=0x0;_0x85c1ec<_0x50d439['length'];_0x85c1ec++){const _0xe74bf3=_0x50d439[_0x85c1ec],_0x1782ee=_0x3ef1d7['createDocumentFragment']();for(const _0x4b5af0 of _0x39181e['getChildren']())_0x3ef1d7['append'](_0x4b5af0['_clone'](!0x0),_0x1782ee);for(const _0xd1f044 of _0xe74bf3['operationsIsolated'])if('insert'===_0xd1f044['type']){const _0x4b88b1=_0xd1f044;_0x4b88b1['baseVersion']=null,_0x4b88b1['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x4b88b1,_0x1782ee),_0x3ef1d7['batch']['addOperation'](_0xd1f044),_0x1fa085['model']['applyOperation'](_0xd1f044);const _0xf12b08='suggestion:insertion:id:authorId:'+_0x319541++,_0x842e16=_0x1fa085['model']['createRange'](_0x4b88b1['position'],_0x4b88b1['position']['getShiftedBy'](_0x4b88b1['howMany']));_0x1782ee['markers']['set'](_0xf12b08,_0x842e16);}else{if('marker'===_0xd1f044['type']&&_0xd1f044['name']['startsWith']('$markedRemove')){const _0x57b24d=_0xd1f044,_0x5ffb6='suggestion:deletion:id:authorId:'+_0x319541++;this['_changeOperationOwnerDocument'](_0x57b24d,_0x1782ee),_0x1782ee['markers']['set'](_0x5ffb6,_0x57b24d['newRange']);}}if(_0x3919e0)_0x46ddb1['push']({..._0xe74bf3,'context':this['_createGetContentFn'](_0x39181e,_0x1fa085['data']),'content':this['_createGetContentFn'](_0x39181e,_0x1fa085['data'])});else{const _0x3428dc=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0xe74bf3['operationsIsolated'][0x0]),_0x1782ee),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0xe74bf3['operationsIsolated'][_0xe74bf3['operationsIsolated']['length']-0x1]),_0x1782ee),_0x1fa085);_0x1782ee['markers']['set'](Kn+'suggestion-context',new _0x5e3e59(_0x3428dc['start'],_0x3428dc['end'])),_0x46ddb1['push']({..._0xe74bf3,'context':this['_createGetContextFn'](_0x1782ee,_0x1fa085['data'],{'ellipsisBefore':_0x3428dc['hasContentBefore'],'ellipsisAfter':_0x3428dc['hasContentAfter']}),'content':this['_createGetContentFn'](_0x1782ee,_0x1fa085['data'])});}}}),_0x46ddb1;}['markChangePositionInEditorContent'](_0x3491fa,_0x4ce83a){if(!_0x3491fa['length'])return;const _0x703619=_0x3491fa[0x0]['parent']['id'],_0x318daf=_0x4ce83a['elements']['get'](_0x703619);if(!_0x318daf)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x703619);const _0x536311=_0x318daf['path'],_0x36039b=_0x318daf['editor'],_0x5515f9=_0x36039b['model']['document']['getRoot'](_0x318daf['rootName']);if(!_0x5515f9)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x318daf['rootName']);const _0x553c6f=_0x36039b['model']['document']['history']['getOperations'](_0x318daf['documentVersion']),_0xaf25b2=[];for(const _0x271ea6 of _0x3491fa){const _0x2a1b1a=_0x271ea6['operationsIsolated']['map'](_0x45f379=>this['_translateOperationToEditorContent'](_0x45f379,_0x536311,_0x5515f9));if(!_0x2a1b1a||!_0x2a1b1a['length'])continue;const _0x2b1de7=_0x2a1b1a['every'](_0xc89bca=>'marker'===_0xc89bca['type']&&_0xc89bca['name']['startsWith']('$markedRemove')),_0x5e4052={'document':_0x36039b['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x38cf2d=_0x146ca3(_0x2a1b1a,_0x553c6f,_0x5e4052)['operationsA'];for(const _0x51b42c of _0x38cf2d)if('insert'===_0x51b42c['type']){const _0x4d2737=_0x51b42c,_0x2dda64=_0x4d2737['nodes'];_0x36039b['model']['change'](_0x403b75=>{const _0x7cd4ac=_0x403b75['createDocumentFragment']();for(const _0x138849 of _0x2dda64)_0x403b75['append'](_0x138849['_clone'](!0x0),_0x7cd4ac);_0xaf25b2['push']({'start':_0x4d2737['position'],'end':_0x4d2737['position'],'type':'insert','groupId':_0x271ea6['id'],'content':{'asString':this['_createGetContentFn'](_0x7cd4ac,_0x36039b['data'])(),'asFragment':_0x7cd4ac}});});}else{if('marker'===_0x51b42c['type']&&_0x51b42c['name']['startsWith']('$markedRemove')){const _0x2f16a7=_0x51b42c;let _0x7606ea='remove-text';if(_0x2b1de7){const _0x5c9730=this['_findAdjacentContextDistance'](_0x2f16a7['newRange']['start'],'backward',_0x36039b['model']['schema']),_0x654eb7=this['_findAdjacentContextDistance'](_0x2f16a7['newRange']['end'],'forward',_0x36039b['model']['schema']);if(_0x5c9730||_0x654eb7){const _0x17545a=_0x2f16a7['newRange']['start']['getShiftedBy'](-_0x5c9730),_0x30842a=_0x2f16a7['newRange']['end']['getShiftedBy'](_0x654eb7);_0xaf25b2['push']({'start':_0x17545a,'end':_0x30842a,'groupId':_0x271ea6['id'],'type':'remove-context'});}else _0x7606ea='remove-only';}_0xaf25b2['push']({'start':_0x2f16a7['newRange']['start'],'end':_0x2f16a7['newRange']['end'],'groupId':_0x271ea6['id'],'type':_0x7606ea});}}}this['_insertMarkers'](_0xaf25b2,_0x36039b);}['clearAllMarkers'](){const _0x122038=new Map();for(const _0x1cd509 of this['_markers']['keys']()){const _0x331b96=this['_markers']['get'](_0x1cd509);_0x331b96?.['editor']&&(_0x122038['has'](_0x331b96['editor'])||_0x122038['set'](_0x331b96['editor'],[]),_0x122038['get'](_0x331b96['editor'])['push'](_0x1cd509));}for(const [_0x39cc76,_0x3050b5]of _0x122038)_0x39cc76['model']['change'](_0x4d163d=>{for(const _0xdfa531 of _0x3050b5)_0x39cc76['model']['markers']['get'](_0xdfa531)&&_0x4d163d['removeMarker'](_0xdfa531);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x221882 of ls(this['context']))_0x221882['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x5cb6fa of ls(this['context']))_0x5cb6fa['disableReadOnlyMode']('ai-review');}['applyChange'](_0x58e7ec){const _0x35d7cd=_0x58e7ec['map'](_0x8e283d=>this['_getMarkersDataForGroup'](_0x8e283d))['flat'](),_0x5dfea0=new Map();for(const _0x32279e of _0x35d7cd)_0x5dfea0['has'](_0x32279e['editor'])||_0x5dfea0['set'](_0x32279e['editor'],[]),_0x5dfea0['get'](_0x32279e['editor'])['push'](_0x32279e);for(const [_0x35d603,_0x5d15b7]of _0x5dfea0){const _0x11005d=_0x35d603['model'];_0x11005d['change'](_0x2159d5=>{for(const _0x12c2b7 of _0x5d15b7){const _0x5ed64b=_0x35d603['model']['markers']['get'](_0x12c2b7['id']);if(_0x5ed64b){if('insert'===_0x12c2b7['type']){if(!_0x12c2b7['content'])continue;_0x11005d['insertContent'](_0x12c2b7['content']['asFragment']||null,_0x5ed64b['getRange']()['start']);}else'remove-text'!==_0x12c2b7['type']&&'remove-only'!==_0x12c2b7['type']||_0x11005d['deleteContent'](_0x11005d['createSelection'](_0x5ed64b['getRange']()));_0x2159d5['removeMarker'](_0x12c2b7['id']),this['_markers']['delete'](_0x12c2b7['id']);}}});}}['rejectChange'](_0x12311f){const _0x220b0c=this['_getMarkersDataForGroup'](_0x12311f),_0x402db6=new Map();for(const _0x35b1a0 of _0x220b0c)_0x402db6['has'](_0x35b1a0['editor'])||_0x402db6['set'](_0x35b1a0['editor'],[]),_0x402db6['get'](_0x35b1a0['editor'])['push'](_0x35b1a0);for(const [_0x90673d,_0x3207ae]of _0x402db6)_0x90673d['model']['change'](_0x333e21=>{for(const _0x2ee168 of _0x3207ae)_0x333e21['removeMarker'](_0x2ee168['id']),this['_markers']['delete'](_0x2ee168['id']);});}['getEditor'](){return ds(this['context']);}['getEditors'](){return ls(this['context']);}['getEditorForChange'](_0x360fdb){const _0x1e760e=this['_getMarkersDataForGroup'](_0x360fdb);return _0x1e760e[0x0]?.['editor'];}['getMarkerElementForChange'](_0x1b1e09){const _0x41e3e7=Array['from'](this['_markers']['values']())['filter'](_0x488eb9=>_0x488eb9['groupId']===_0x1b1e09);if(!_0x41e3e7['length'])return null;const _0x372eb0=0x1===_0x41e3e7['length']?_0x41e3e7[0x0]:this['_sortMarkers'](_0x41e3e7)[0x0],_0x3eb75a=_0x372eb0['editor']['model']['markers']['get'](_0x372eb0['id']);if(!_0x3eb75a)return null;return{'modelRange':_0x3eb75a['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x372eb0['id'])};}['getContentElementForChange'](_0x2b0080){const _0x5c313b=Array['from'](this['_markers']['values']())['filter'](_0x582746=>_0x582746['groupId']===_0x2b0080);if(!_0x5c313b['length'])return null;const _0x28d933=0x1===_0x5c313b['length']?_0x5c313b[0x0]:this['_sortMarkers'](_0x5c313b)[0x0],_0x10563b=_0x28d933['editor'],_0x2932af=_0x10563b['model']['markers']['get'](_0x28d933['id']);if(!_0x2932af)return null;const _0x5a12d7=_0x2932af['getRange'](),_0xdf662a=_0x10563b['editing']['view']['getDomRoot'](_0x5a12d7['root']['rootName'])||_0x10563b['editing']['view']['getDomRoot']();if(!_0xdf662a||!_0x5a12d7)return null;let _0x2c5b24=_0x5a12d7['start']['parent'];for(;_0x2c5b24['parent']&&'$root'!==_0x2c5b24['parent']['name'];)_0x2c5b24=_0x2c5b24['parent'];if(!_0x2c5b24||!_0x2c5b24['name'])return null;const _0x1b33f7=_0xdf662a['querySelector']('[data-marker-id=\x22'+_0x28d933['id']+'\x22]');if(!_0x1b33f7)return null;let _0x4cdc2d=null;_0x10563b['model']['change'](_0x401b20=>{_0x4cdc2d=_0x401b20['createDocumentFragment'](),_0x401b20['append'](_0x2c5b24['_clone'](!0x0),_0x4cdc2d);});const _0x184620=_0x10563b['data']['toView'](_0x4cdc2d)['getChild'](0x0);return _0x1b33f7['closest'](_0x184620['name']);}['reactivateMarkers'](_0x2e86f8){const _0x58f622=this['_getMarkersDataForGroup'](_0x2e86f8);if(!_0x58f622['length'])return;const _0x5c398d=Array['from'](this['_activeMarkers'])['sort'](),_0x1eaf34=Array['from'](new Set(_0x58f622['map'](_0x10bdc7=>_0x10bdc7['id'])))['sort']();_0x5c398d['join']('|')!==_0x1eaf34['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x2e86f8));}['setMarkersInElementAsActive'](_0x2ffda0){const _0xe9d1bd=this['_getMarkersDataForGroup'](_0x2ffda0);if(!_0xe9d1bd['length'])return;const _0x463898=_0xe9d1bd[0x0]['editor'],_0x248603=new Set(_0xe9d1bd['map'](_0x4c835f=>_0x4c835f['id'])),_0x579044=Array['from'](_0x248603['values']())['map'](_0xb745a3=>_0x463898['model']['markers']['get'](_0xb745a3))['filter'](_0x4429ef=>!!_0x4429ef);_0x248603['forEach'](_0x27764b=>{this['_activeMarkers']['add'](_0x27764b);}),_0x463898['model']['change'](()=>{_0x579044['forEach'](_0xbe1249=>{_0x463898['editing']['reconvertMarker'](_0xbe1249);});});}['setAllMarkersAsInactive'](){const _0x14bcbb=Array['from'](this['_activeMarkers']);if(!_0x14bcbb['length'])return;this['_activeMarkers']['clear']();const _0x59f42d=new Map();for(const _0x2a93f0 of _0x14bcbb){const _0x475859=this['_markers']['get'](_0x2a93f0);if(!_0x475859)continue;const _0x2c9d17=_0x475859['editor'],_0x14b16c=_0x2c9d17['model']['markers']['get'](_0x2a93f0);_0x14b16c&&(_0x59f42d['has'](_0x2c9d17)||_0x59f42d['set'](_0x2c9d17,[]),_0x59f42d['get'](_0x2c9d17)['push'](_0x14b16c));}for(const [_0x1dc228,_0x1f7010]of _0x59f42d)_0x1dc228['model']['change'](()=>{_0x1f7010['forEach'](_0x4d9c11=>{_0x1dc228['editing']['reconvertMarker'](_0x4d9c11);});});}['_getPositionLimitingRange'](_0x3661ca,_0x3ae428,_0x295960='outside'){if(!_0x3661ca)return null;let _0x417872=_0x3661ca['parent'];for(;_0x417872&&_0x417872['parent']&&'$root'!==_0x417872['parent']['name']&&!_0x3ae428['model']['schema']['isLimit'](_0x417872)&&!_0x3ae428['model']['schema']['isBlock'](_0x417872);)_0x417872=_0x417872['parent'];if(!_0x417872||!_0x417872['name']||'$root'===_0x417872['name'])return null;let _0x2d65b6=null;return _0x3ae428['model']['change'](_0x23b62b=>{_0x2d65b6='inside'===_0x295960?_0x23b62b['createRangeIn'](_0x417872):_0x23b62b['createRangeOn'](_0x417872);}),_0x2d65b6;}['_validateMarkers'](_0x120a78,_0x550616){const _0x46408a=Array['from'](this['_markers']['keys']()),_0x52625b=new Map();for(const _0x28d228 of _0x46408a){const _0x4a2833=_0x120a78['model']['markers']['get'](_0x28d228);if(!_0x4a2833)continue;const _0x38f7fb=_0x4a2833['getStart']()['root']['rootName']+':'+_0x4a2833['getStart']()['path'][0x0];_0x52625b['has'](_0x38f7fb)||_0x52625b['set'](_0x38f7fb,[]),_0x52625b['get'](_0x38f7fb)['push'](_0x4a2833);}const _0x5379d2=new Set();for(const _0x597c8a of _0x120a78['model']['document']['differ']['getChanges']()){let _0x523a1b='',_0x194144=null;if('insert'===_0x597c8a['type'])_0x194144=new _0x5e3e59(_0x597c8a['position'],_0x597c8a['position']['getShiftedBy'](_0x597c8a['length'])),_0x523a1b=_0x597c8a['position']['root']['rootName']+':'+_0x597c8a['position']['path'][0x0];else{if('remove'!==_0x597c8a['type'])continue;_0x194144=new _0x5e3e59(_0x597c8a['position']),_0x523a1b=_0x597c8a['position']['root']['rootName']+':'+_0x597c8a['position']['path'][0x0];}const _0x2a3161=_0x52625b['get'](_0x523a1b)||[];if(_0x2a3161['length']){for(const _0x12307d of _0x2a3161)if(_0x194144['root']['rootName']===_0x12307d['getRange']()['root']['rootName']&&('insert'!==_0x597c8a['type']||!_0x194144['containsRange'](_0x12307d['getRange']()))&&(_0x194144['isIntersecting'](_0x12307d['getRange']())||_0x194144['start']['isTouching'](_0x12307d['getRange']()['end'])||_0x194144['end']['isTouching'](_0x12307d['getRange']()['start']))){const _0x180f0d=this['_parseMarkerName'](_0x12307d['name']);Array['from'](this['_markers']['values']())['filter'](_0x96b7a8=>_0x96b7a8['groupId']===_0x180f0d['groupId'])['forEach'](_0x56e226=>_0x5379d2['add'](_0x56e226['id']));}}}if(_0x5379d2['size']){for(const _0x55a597 of _0x5379d2)_0x550616['removeMarker'](_0x55a597);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0xf193c3){for(const {name:_0x26ddb1,data:_0x58f7eb}of _0xf193c3['model']['document']['differ']['getChangedMarkers']()){if(!_0x26ddb1['startsWith'](Kn))continue;const _0x7e7cb7=_0x58f7eb['oldRange'],_0x2bdfd2=_0x58f7eb['newRange'],_0x2a2994=_0x7e7cb7&&'$graveyard'===_0x7e7cb7['root']['rootName'],_0xc4f28a=_0x2bdfd2&&'$graveyard'===_0x2bdfd2['root']['rootName'];if(_0x2a2994&&_0xc4f28a)continue;const _0x4ca4bf=this['_parseMarkerName'](_0x26ddb1);this['_markers']['get'](_0x26ddb1)&&(_0xc4f28a||!_0x2bdfd2?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x26ddb1,'changeId':_0x4ca4bf['groupId']}):_0x2a2994&&_0x2bdfd2&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x26ddb1,'changeId':_0x4ca4bf['groupId']}));}}['_parseMarkerName'](_0x9ec174){const _0xd6c266=_0x9ec174['split'](':'),_0x2cc94f=(_0xd6c266[0x1]||'')['split']('_');return{'prefix':_0xd6c266[0x0],'groupId':_0x2cc94f[0x0],'suffix':_0x2cc94f[0x1]};}['_translateOperationToEditorContent'](_0x41787d,_0x45fb1e,_0x1a3d54){if('insert'===_0x41787d['type']){const _0x51b49a=_0x41787d;return new _0x2543a3(this['_changePosition'](_0x45fb1e['concat'](_0x51b49a['position']['offset']),_0x1a3d54),_0x51b49a['nodes'],_0x51b49a['baseVersion']);}if('marker'===_0x41787d['type']&&_0x41787d['name']['startsWith']('$markedRemove')){const _0x30b6ed=_0x41787d;return new _0x5b77c2(_0x30b6ed['name'],_0x30b6ed['oldRange'],this['_changeRange'](_0x30b6ed['newRange'],_0x45fb1e['concat'](_0x30b6ed['newRange']['start']['offset']),_0x45fb1e['concat'](_0x30b6ed['newRange']['end']['offset']),_0x1a3d54),_0x30b6ed['_markers'],_0x30b6ed['affectsData'],_0x30b6ed['baseVersion']);}return _0x41787d;}['_groupAdjacentOperations'](_0x286e1b){if(!_0x286e1b['length'])return[];const _0x5e2d08=[];let _0x21d0b0=0x0,_0x50f6c1=0x0,_0x3f8ac7=[];for(let _0x1b400a=0x0;_0x1b400a<=_0x286e1b['length'];_0x1b400a++){const _0x2f51d4=_0x286e1b[_0x1b400a],_0x2cba97=_0x286e1b[_0x1b400a-0x1];!_0x2f51d4||_0x2cba97&&!this['_getOperationEnd'](_0x2cba97)['isTouching'](this['_getOperationStart'](_0x2f51d4))?(_0x5e2d08['push']({'operations':_0x3f8ac7,'operationsIsolated':_0x3f8ac7['map'](_0x2453ac=>this['_shiftOperation'](_0x2453ac['clone'](),-_0x50f6c1)),'groupOffset':_0x21d0b0}),_0x3f8ac7=_0x2f51d4?[_0x2f51d4]:[],_0x50f6c1+=_0x21d0b0,_0x21d0b0=0x0):_0x3f8ac7['push'](_0x2f51d4),_0x2f51d4&&'insert'===_0x2f51d4['type']&&(_0x21d0b0+=_0x2f51d4['howMany']);}return _0x5e2d08;}['_findAdjacentContextDistance'](_0x46c4bf,_0xcdca75,_0x2b804f,_0x4990a6=0x1){const _0x30c53d=new _0x344e9d({'startPosition':_0x46c4bf,'direction':_0xcdca75});let _0x3a71d1=0x0;for(let _0x5251c3=0x0;_0x5251c3<_0x4990a6;_0x5251c3++){let _0x1f9387=0x0,_0x5c21e5=!0x1,_0x38660='forward'===_0xcdca75?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x3cd048}of _0x30c53d)if(_0x3cd048['is']('$textProxy')){const _0x25cf52=_0x38660['exec'](_0x3cd048['data']);if(_0x25cf52&&_0x25cf52['length']){if(_0x1f9387+='forward'===_0xcdca75?_0x25cf52['index']+_0x25cf52[0x0]['length']:_0x3cd048['data']['length']-_0x25cf52['index'],_0x25cf52[0x0]['length']!==_0x3cd048['data']['length'])break;_0x5c21e5=!0x0,_0x38660='forward'===_0xcdca75?/^\w+/:/\w+$/;}else{if(_0x5c21e5)break;_0x1f9387+=_0x3cd048['offsetSize'];}}else{if(_0x3cd048['is']('element')){_0x2b804f['isInline'](_0x3cd048)&&!_0x5c21e5&&(_0x1f9387+=0x1);break;}}_0x3a71d1+=_0x1f9387,_0x30c53d['jumpTo'](_0x46c4bf['getShiftedBy']('forward'===_0xcdca75?_0x3a71d1:-_0x3a71d1));}return _0x3a71d1;}['_getChangeContext'](_0x159c99,_0x195061,_0x179014){const _0x26259e=_0x179014['model']['schema'],_0x4cdfc2=this['_findAdjacentContextDistance'](_0x159c99,'backward',_0x26259e,0x6),_0xfefe69=this['_findAdjacentContextDistance'](_0x195061,'forward',_0x26259e,0x6),_0x181fd0=_0x159c99['getShiftedBy'](-_0x4cdfc2),_0x50cf59=_0x195061['getShiftedBy'](_0xfefe69);return{'start':_0x181fd0,'end':_0x50cf59,'hasContentBefore':!_0x181fd0['isAtStart'],'hasContentAfter':!_0x50cf59['isAtEnd']};}['_insertMarkers'](_0x32573f,_0x16c005){const _0x213543=this['context']['plugins']['get']('AIEditing'),_0xb15e69=new Set();_0x16c005['model']['change'](_0x144abd=>{for(const _0xe7ce1 of _0x32573f){const _0x1c2b13=''+Kn+_0xe7ce1['type']+':'+_0xe7ce1['groupId']+'_'+_0x213543['_nextDataId'](_0xb15e69);this['_markers']['set'](_0x1c2b13,{'id':_0x1c2b13,'groupId':_0xe7ce1['groupId'],'type':_0xe7ce1['type'],'content':_0xe7ce1['content'],'editor':_0x16c005}),_0x144abd['addMarker'](_0x1c2b13,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x144abd['createRange'](_0xe7ce1['start'],_0xe7ce1['end'])});}});}['_createGetContextFn'](_0x4c102b,_0x1845c8,_0x1ddfd9){let _0x460bb6='';return()=>{if(!_0x460bb6){const _0x52b48c=_0x1845c8['toView'](_0x4c102b,{'showSuggestionHighlights':!0x0});let _0x268471=_0x52b48c['getChild'](0x0);if(_0x268471['is']('containerElement')||(_0x268471=_0x52b48c),!_0x268471)return'';let _0x215824=!0x1;const _0x49c180=[];for(const _0x32d0a6 of _0x268471['getChildren']())_0x32d0a6['is']('element','span')&&_0x32d0a6['hasClass']('ck-ai_review-marker_context-end')&&(_0x215824=!0x1),_0x215824&&_0x49c180['push'](_0x32d0a6),_0x32d0a6['is']('element','span')&&_0x32d0a6['hasClass']('ck-ai_review-marker_context-start')&&(_0x215824=!0x0);_0x268471['_removeChildren'](0x0,_0x268471['childCount']),_0x1ddfd9?.['ellipsisBefore']&&_0x268471['_appendChild']('…'),_0x268471['_appendChild'](_0x49c180),_0x1ddfd9?.['ellipsisAfter']&&_0x268471['_appendChild']('…');const _0xb32f51=_0x1845c8['htmlProcessor']['domConverter']['viewToDom'](_0x52b48c),_0x2d3462=_0x1845c8['htmlProcessor']['htmlWriter']['getHtml'](_0xb32f51);_0x460bb6=_0x2d3462;}return _0x460bb6;};}['_createGetContentFn'](_0x2dffdf,_0x28b0a4){let _0x247d1e='';return()=>(_0x247d1e||(_0x247d1e=_0x28b0a4['stringify'](_0x2dffdf,{'showSuggestionHighlights':!0x0})),_0x247d1e);}['_createGetContentUsingDataIdFn'](_0x16fbe2,_0x3212a9,_0x3a480c){let _0xba74df='';return()=>{if(!_0xba74df){const _0x2ca44a=_0x3a480c['toView'](new _0x24e4e8(_0x16fbe2)),_0x23a5b0=_0x3a480c['htmlProcessor']['domConverter']['viewToDom'](_0x2ca44a)['querySelector']('[data-id=\x22'+_0x3212a9+'\x22]');_0xba74df=_0x23a5b0?.['outerHTML']||'';}return _0xba74df;};}['_findMarkerElement'](_0x191c07,_0x294cda=0x5){let _0x534aab=_0x191c07,_0x31bf55=null;for(let _0x4d372e=0x0;_0x4d372e<_0x294cda&&_0x534aab;_0x4d372e++){if(!_0x534aab['className']){_0x534aab=_0x534aab['parentElement'];continue;}if(!(''+_0x534aab['className'])['includes']('ck-ai_review-marker_')){_0x534aab=_0x534aab['parentElement'];continue;}if(!_0x534aab['getAttribute']('data-marker-id'))break;_0x31bf55=_0x534aab;break;}return _0x31bf55;}['_findMarkerElementById'](_0x180492){const _0x391fb0=this['_markers']['get'](_0x180492),_0x2c64a8=_0x391fb0?.['editor']??ds(this['context']),_0x3f6a4a=_0x2c64a8['model']['markers']['get'](_0x180492);return _0x3f6a4a?_0x112f07(_0x2c64a8['editing'],_0x3f6a4a):null;}['_getMarkersDataForGroup'](_0x1a1c18){return Array['from'](this['_markers']['values']())['filter'](_0x53b937=>_0x53b937['groupId']===_0x1a1c18);}['_getOperationStart'](_0x21b436){return'insert'===_0x21b436['type']?_0x21b436['position']:_0x21b436['newRange']['start'];}['_getOperationEnd'](_0x3e7a9e,_0x30c87f=!0x1){return'insert'===_0x3e7a9e['type']?_0x30c87f?_0x3e7a9e['position']:_0x3e7a9e['position']['getShiftedBy'](_0x3e7a9e['howMany']):_0x3e7a9e['newRange']['end'];}['_shiftOperation'](_0x1bbecc,_0x31d0f4){return'insert'===_0x1bbecc['type']?_0x1bbecc['position']=_0x1bbecc['position']['getShiftedBy'](_0x31d0f4):'marker'===_0x1bbecc['type']&&_0x1bbecc['newRange']&&(_0x1bbecc['newRange']=new _0x5e3e59(_0x1bbecc['newRange']['start']['getShiftedBy'](_0x31d0f4),_0x1bbecc['newRange']['end']['getShiftedBy'](_0x31d0f4))),_0x1bbecc;}['_changeOperationOwnerDocument'](_0x4e2dad,_0x5832a4){'insert'===_0x4e2dad['type']?_0x4e2dad['position']=this['_changePositionOwnerDocument'](_0x4e2dad['position'],_0x5832a4):'marker'===_0x4e2dad['type']&&_0x4e2dad['newRange']&&(_0x4e2dad['newRange']=this['_changeRangeOwnerDocument'](_0x4e2dad['newRange'],_0x5832a4));}['_changePositionOwnerDocument'](_0x1911da,_0x431d6c){return new _0x5464f3(_0x431d6c,_0x1911da['path']);}['_changeRangeOwnerDocument'](_0x40e195,_0x237bb8){return new _0x5e3e59(this['_changePositionOwnerDocument'](_0x40e195['start'],_0x237bb8),this['_changePositionOwnerDocument'](_0x40e195['end'],_0x237bb8));}['_changePosition'](_0x2867b0,_0xfc5d36){return new _0x5464f3(_0xfc5d36,[..._0x2867b0]);}['_changeRange'](_0x463868,_0x176e8f,_0x5ebd8c,_0x39793c){return new _0x5e3e59(this['_changePosition'](_0x176e8f,_0x39793c),this['_changePosition'](_0x5ebd8c,_0x39793c));}['_sortMarkers'](_0x3be3de){const _0x512acd=_0x1f1a14=>{switch(_0x1f1a14){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x3be3de['sort']((_0xacb3e1,_0x45d8bb)=>_0x512acd(_0xacb3e1['type'])-_0x512acd(_0x45d8bb['type']));}['_hasSameTopLevelElement'](_0x353dd4,_0x4c556e){const _0x571441=_0x353dd4['getChild'](0x0),_0x4c7d51=_0x4c556e['getChild'](0x0);return!(!_0x571441||!_0x4c7d51)&&((!_0x571441['is']('element')||!_0x4c7d51['is']('element')||_0x571441['name']===_0x4c7d51['name'])&&!(_0x571441['is']('element')&&!_0x4c7d51['is']('element')||!_0x571441['is']('element')&&_0x4c7d51['is']('element')));}['_haveSingleTopLevelElement'](_0x41f643){return 0x1===_0x41f643['childCount'];}['_haveOnlyInlineContent'](_0x38447e,_0x57cab9){for(const _0x5b971d of _0x38447e['getChildren']())if(_0x5b971d['is']('element')&&!_0x57cab9['isInline'](_0x5b971d))return!0x1;return!0x0;}['_upsertDataId'](_0x4f3074,_0x3e79ee){let _0x85e15f=_0x4f3074['getAttribute'](_0x54ef8f);return _0x85e15f||(_0x85e15f=_0x3e79ee(),_0x4f3074['_setAttribute'](_0x54ef8f,_0x85e15f)),_0x85e15f;}}class AIReviewCheckResult extends Et(){['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x398471,contentNew:_0x3169c7,contentInitial:_0x51c691,documentVersion:_0x3b1bb5}){super(),this['id']=_0x398471,this['contentNew']=_0x3169c7,this['contentInitial']=_0x51c691,this['documentVersion']=_0x3b1bb5;}}class AIReviewCheckResultChange extends ht(){['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x3acb7c,_0x4590b7,_0x147e4c){super(),this['id']=_0x3acb7c,this['parent']=_0x147e4c,this['_data']=_0x4590b7,this['set']('isActivated',!0x1),this['set']('isRated',!0x1),this['set']('status','pending'),this['on']('change:status',()=>{'pending'!==this['status']&&this['isActivated']&&(this['isActivated']=!0x1);});}get['contentDiffed'](){return this['_data']['context']();}get['operations'](){return this['_data']['operations'];}get['operationsIsolated'](){return this['_data']['operationsIsolated'];}}class AIReviewCheckRun extends ht(){['id']=ot();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x93b387,_0x3a68ee,_0x5c4b49,_0x5b5530,_0x3897b3){super(),this['_sourceCheck']=_0x3a68ee,this['_documentData']=_0x93b387,this['_aiConnector']=_0x5c4b49,this['_reviewParams']=_0x5b5530,this['_reviewArgs']=_0x3897b3,this['on']('change:status',(_0x4203d9,_0x3f5a1e,_0x358c4f)=>{'aborted'==_0x358c4f&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x358c4f,'run':this,'error':this['_currentError']});}),this['set']('status','initialized');}get['documentData'](){return this['_documentData'];}get['processedResultsCount'](){return this['_results']['size'];}get['title'](){return this['_sourceCheck']['title'];}get['subTitle'](){return'';}get['reviewName'](){return this['_sourceCheck']['id'];}get['hasModifications'](){return!this['_changes']['every'](_0x3ac636=>'pending'===_0x3ac636['status']);}get['currentError'](){return this['_currentError'];}['updateDocumentData'](_0x6938b4){this['_documentData']=_0x6938b4;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x527822=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x53fbeb of _0x527822)'unmodified'!==_0x53fbeb['data']['operation']&&('error'!==_0x53fbeb['data']['operation']?'review-metadata'!==_0x53fbeb['event']?this['_addReviewCheckResult'](_0x53fbeb['data']['dataId'],_0x53fbeb['data']['textDelta']):this['callId']=_0x53fbeb['data']['callId']:this['status']='error-chunk');'error-chunk'!==this['status']&&(0x0===this['_results']['size']||0x0===this['_changes']['length']?this['status']='unmodified':this['status']='ready');}catch(_0x3455ac){this['_currentError']=_0x3455ac,_0x3455ac instanceof Error&&_0x3455ac['message']['includes']('ai-request-aborted')?this['status']='aborted':this['status']='error-general';}finally{this['_activeRequest']=null;}}async['restart'](){this['_results']['clear'](),this['_changes']['length']=0x0,this['_currentError']=void 0x0,await this['start']();}['addResultChanges'](_0x7bc19,_0x588b70){const _0x158ba4=this['_results']['get'](_0x7bc19);if(!_0x158ba4)return;if(0x0===_0x588b70['length'])return;const _0x344503=[];_0x588b70['forEach']((_0x514d11,_0x23b82f)=>{const _0x3ef208=new AIReviewCheckResultChange(_0x158ba4['id']+'-'+_0x23b82f,_0x514d11,_0x158ba4);_0x3ef208['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x3ef208,'status':_0x3ef208['status']});}),_0x3ef208['on']('change:isActivated',()=>{_0x3ef208['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x3ef208}):this['fire']('reviewCheckResultDeactivated',{'change':_0x3ef208});}),this['_changes']['push'](_0x3ef208),_0x344503['push'](_0x3ef208);}),this['fire']('reviewCheckResultReady',{'changes':_0x344503,'result':_0x158ba4,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x5c593){const _0x241c73=this['_changes']['find'](_0x59cb28=>_0x59cb28['id']===_0x5c593);return!(!_0x241c73||'pending'!==_0x241c73['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x221601=>!0x0===_0x221601['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x50954b=>'pending'===_0x50954b['status']);}['getChangeById'](_0x19822b){return this['_changes']['find'](_0x39a694=>_0x39a694['id']===_0x19822b);}['markAllChangesAsAccepted'](){for(const _0xfe168 of this['_changes'])'pending'===_0xfe168['status']&&(_0xfe168['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x304133){const _0x361af6=this['_changes']['find'](_0x4836f4=>_0x4836f4['id']===_0x304133);_0x361af6&&'pending'===_0x361af6['status']&&(_0x361af6['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x13f2b2){const _0x2ee488=this['_changes']['find'](_0xfeb641=>_0xfeb641['id']===_0x13f2b2);_0x2ee488&&'pending'===_0x2ee488['status']&&(_0x2ee488['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x5eb9d1){const _0x322f14=this['_changes']['find'](_0x35b5b7=>_0x35b5b7['id']===_0x5eb9d1);_0x322f14&&'pending'===_0x322f14['status']&&(_0x322f14['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x5dff28){const _0xf225a3=this['_changes']['find'](_0x52bfd5=>_0x52bfd5['id']===_0x5dff28);_0xf225a3&&'outdated'===_0xf225a3['status']&&(_0xf225a3['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x8fcb7c){this['_changes']['filter'](_0x2927cb=>_0x2927cb['isActivated']&&_0x2927cb['id']!==_0x8fcb7c)['forEach'](_0x7fcd4c=>{_0x7fcd4c['isActivated']=!0x1;});const _0x1fe9b6=this['_changes']['find'](_0x57b323=>_0x57b323['id']===_0x8fcb7c);_0x1fe9b6&&'pending'===_0x1fe9b6['status']&&(_0x1fe9b6['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x31978a=>_0x31978a['isActivated'])['forEach'](_0x4bff4b=>{_0x4bff4b['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x3bc63d){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x42e408;if(_0x3bc63d){const _0x416b1a=this['_changes']['find'](_0xf18b5e=>_0xf18b5e['id']===_0x3bc63d);if(_0x416b1a&&_0x416b1a['isRated'])return;_0x416b1a&&(_0x42e408=_0x416b1a['parent']['id'],_0x416b1a['isRated']=!0x0);}const _0x3ab61b={'positiveCount':this['_changes']['filter'](_0x196ada=>'accepted'===_0x196ada['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x3ab61b,this['callId'],_0x42e408);}['_addReviewCheckResult'](_0x92cc93,_0x19e7a6){const _0x26d00b=this['_documentData']['elements']['get'](_0x92cc93);if(!_0x26d00b)return;const _0x28e2a6=_0x26d00b['getContent']();if(_0x28e2a6===_0x19e7a6)return;const _0x4fa53c=new AIReviewCheckResult({'id':_0x92cc93,'contentInitial':_0x28e2a6,'contentNew':_0x19e7a6,'documentVersion':_0x26d00b['documentVersion']});this['_results']['set'](_0x4fa53c['id'],_0x4fa53c),this['fire']('reviewCheckResultAdded',{'result':_0x4fa53c,'source':this,'editor':_0x26d00b['editor']});}['_checkIfFinished'](){'finished'===this['status']&&(this['_changes']['filter'](_0x31275e=>'pending'===_0x31275e['status'])['length']>0x0&&(this['status']='ready')),'ready'===this['status']&&(0x0===this['_changes']['filter'](_0x1ba41d=>'pending'===_0x1ba41d['status'])['length']&&(this['status']='finished'));}}class AIReviewSystemCheckRun extends AIReviewCheckRun{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x40d9f4=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x2b481f=0x0;_0x2b481f<this['_reviewParams']['length'];_0x2b481f++){if(!this['_reviewParams'][_0x2b481f]||!this['_sourceCheck']['options'][_0x2b481f])continue;const _0x4c40e2=this['_sourceCheck']['options'][_0x2b481f],_0x518529=_0x4c40e2['data']?.['find'](_0x5b4c85=>_0x5b4c85['id']===this['_reviewParams'][_0x2b481f]);_0x518529&&_0x40d9f4['push'](_0x518529['label']);}return _0x40d9f4['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x45d49b,_0xcdba11,_0x9bc210){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0xcdba11,_0x45d49b,_0x9bc210);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}}class AIReviewCoreController extends _0xaac0f5{['_aiConnector'];['_aiReviewCoreUi'];['_aiReviewCoreEditing'];['_aiReviewCheckList'];['_currentReviewCheckRun'];['_changeActivationSource']=null;static get['requires'](){return[AIConnector];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['init'](){this['_initRequiredPlugins'](),this['_aiReviewCheckList']=await this['_getChecksList'](),this['listenTo'](this['_aiReviewCoreUi'],'getReviewCheckList',()=>{this['_aiReviewCoreUi']['setAvailableChecks'](this['_aiReviewCheckList']['checks']);}),this['listenTo'](this['_aiReviewCoreUi'],'runReviewCheck',async(_0x12d650,_0x424460)=>{const _0xefe767=this['_aiReviewCheckList']['getCheckById'](_0x424460['id']);if(_0xefe767){this['_onReviewCheckRun'](_0x424460),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x424460,_0xefe767),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x10772b,_0x5d36c1)=>{switch(_0x5d36c1['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x5d36c1);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new at('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new at('ai-review-mode-check-run-chunk-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'aborted':this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['processedResultsCount']>0x0?setTimeout(()=>{this['_currentReviewCheckRun']?.['forceReadyState']();},0x0):this['_onReviewRunLeave'](!0x0);}'ready'!==_0x5d36c1['status']&&'error-chunk'!==_0x5d36c1['status']&&'error-general'!==_0x5d36c1['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x27d61e,_0x39ec0b)=>{if(!this['_currentReviewCheckRun'])throw new at('ai-review-mode-no-current-check-run',this);const _0x358d92=this['_diffContent'](_0x39ec0b['editor'],_0x39ec0b['result']['contentInitial'],_0x39ec0b['result']['contentNew']);_0x39ec0b['source']['addResultChanges'](_0x39ec0b['result']['id'],_0x358d92);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x5a4726,_0x500a41)=>{for(const _0x2128c8 of _0x500a41['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x2128c8);this['_markChangePositionInEditorContent'](_0x500a41['changes'],_0x500a41['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x476116,_0x4a6026)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x4a6026['change']['id'],_0x4a6026['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x27044a,_0x15d589)=>{this['_onReviewCheckResultActivated'](_0x15d589);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x53553a){_0x53553a instanceof Error&&_0x53553a['message']['includes']('ai-request-aborted')||(_0x53553a instanceof at?this['_logError'](_0x53553a):this['_logError'](new at('ai-review-mode-check-run-failed',this,void 0x0,_0x53553a)));}}else this['_logError'](new at('ai-review-mode-source-check-not-found',this,{'checkId':_0x424460['id']}));}),this['listenTo'](this['_aiReviewCoreUi'],'leaveReview',()=>{this['_onReviewRunLeave']();}),this['listenTo'](this['_aiReviewCoreUi'],'leaveReviewCoreResultList',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'abortReviewStream',()=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}),this['listenTo'](this['_aiReviewCoreUi'],'finishReview',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'acceptAllChanges',()=>{if(!this['_currentReviewCheckRun'])return;const _0x2de9a7=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x2de9a7['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x2de9a7['map'](_0x373704=>_0x373704['id']));const _0x431bd6=this['_currentReviewCheckRun'];_0x431bd6['markAllChangesAsAccepted'](),_0x431bd6['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x75439e,_0x5ec33b)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x5ec33b['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x5ec33b['id']]),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x5ec33b['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x5ec33b['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x806069,_0x1820f6)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x1820f6['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x1820f6['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x1820f6['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x1820f6['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'retryReview',async()=>{this['_currentReviewCheckRun']&&(this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_currentReviewCheckRun']['updateDocumentData'](this['_aiReviewCoreEditing']['getDocumentData']()),await this['_currentReviewCheckRun']['restart']());}),this['listenTo'](this['_aiReviewCoreUi'],'activateChange',(_0x207dd6,_0x52adfb)=>{this['_onActivateChange'](_0x52adfb);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x3bcbb6,_0x387f09)=>{this['_onDeactivateChange'](_0x387f09);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x356872,_0x38c42c)=>{this['_onChangeMarkerClicked'](_0x356872,_0x38c42c);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x5e6944,_0x418767)=>{this['_onChangeMarkerHovered'](_0x5e6944,_0x418767);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x2c18bd,_0x80be93)=>{this['_onChangeMarkerRemoved'](_0x2c18bd,_0x80be93);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x309302,_0x1733e3)=>{this['_onChangeMarkerRestored'](_0x309302,_0x1733e3);});}['_createReviewCheckRun'](_0x12abcd,_0x20fdc4){return new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x20fdc4,this['_aiConnector'],_0x12abcd['params'],_0x12abcd['args']);}['_onChangeMarkerRemoved'](_0xb2df9e,_0x449112){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x449112['changeId']);}['_onChangeMarkerRestored'](_0x557d8d,_0x354c30){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x354c30['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector');}['_onReviewRunLeave'](_0xf8b186=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0xf8b186&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x123622 of this['_aiReviewCoreEditing']['getEditors']())_0x123622['editing']['view']['change'](_0x508779=>{for(const _0xcafb7e of _0x123622['editing']['view']['document']['getRoots']())_0x508779['removeClass']('ck-ai_review-diff',_0xcafb7e),_0x508779['removeClass']('ck-ai_review-highlights',_0xcafb7e),_0x508779['removeClass']('ck-ai-translate-mode-content',_0xcafb7e);});}['_getTranslationWithDefault'](_0x4fa99c,_0x4d8bd5){const _0x4fa674=Hi(this['context']['locale'],_0x4fa99c);return _0x4fa674===_0x4fa99c?_0x4d8bd5:_0x4fa674;}['_logError'](_0x32d659,_0x7c53d8=!0x1){Ct(_0x32d659['message']),_0x7c53d8||(_0x32d659['message']['startsWith']('ai-review-mode-models-unable-to-retrieve')?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']());}['_scrollToChange'](_0x4c28f0){if('content'===this['_changeActivationSource']){const _0x4b8ff7=this['_aiReviewCoreUi']['getChangeElement'](_0x4c28f0);_0x4b8ff7&&ft(_0x4b8ff7['closest']('.ck-ai_review__check-run-result')||_0x4b8ff7);}else{if('panel'===this['_changeActivationSource']){const _0x567546=this['_getChangeContentElement'](_0x4c28f0);if(!_0x567546)return;wt({'target':_0x567546,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}}const Yn=[{'id':'custom','commandId':'custom','title':'Custom\x20command','description':'Type\x20a\x20custom\x20command\x20to\x20review\x20the\x20content\x20exactly\x20as\x20you\x20need.','isParameterized':!0x0},{'id':'correctness','commandId':'correctness','title':'Correctness','description':'Ensure\x20the\x20text\x20is\x20factually\x20accurate\x20and\x20free\x20of\x20errors.','isParameterized':!0x1},{'id':'clarity','commandId':'clarity','title':'Clarity','description':'Improve\x20the\x20clarity\x20and\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'readability','commandId':'readability','title':'Readability','description':'Enhance\x20the\x20overall\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'length','commandId':'make','title':'Adjust\x20length','description':'Refine\x20text\x20length\x20to\x20match\x20your\x20needs.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20length','default':'longer','data':[{'label':'Longer','id':'longer'},{'label':'Shorter','id':'shorter'}]}]},{'id':'tone','commandId':'make-tone','title':'Adjust\x20tone\x20and\x20style','description':'Choose\x20tone\x20and\x20style\x20to\x20change\x20content\x20as\x20you\x20need.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20tone\x20and\x20style','default':'casual','data':[{'label':'Casual','id':'casual'},{'label':'Direct','id':'direct'},{'label':'Friendly','id':'friendly'},{'label':'Confident','id':'confident'},{'label':'Professional','id':'professional'}]}]}];class AIReviewCheck{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x475154){this['id']=_0x475154['id'],this['commandId']=_0x475154['commandId'],this['title']=_0x475154['title'],this['description']=_0x475154['description'],this['isParameterized']=_0x475154['isParameterized'],this['useArgs']=_0x475154['useArgs'],this['options']=_0x475154['options'],this['args']=_0x475154['args'];}}class AIReviewCheckList extends ht(){['_checks']=[];['setupChecks'](_0x103804){this['_checks']=_0x103804['map'](_0x155dd8=>new AIReviewCheck(_0x155dd8));}get['checks'](){return this['_checks'];}['getCheckById'](_0x30ba84){return this['checks']['find'](_0x42f67e=>_0x42f67e['id']===_0x30ba84);}['removeCheckById'](_0x13eb18){this['_checks']=this['_checks']['filter'](_0x254515=>_0x254515['id']!==_0x13eb18);}}class AIReviewCheckCustom extends AIReviewCheck{['_models']=[];['_defaultModel']=null;constructor(_0x423d7f,_0x3c1015,_0x270a43){super(_0x423d7f),this['_models']=_0x3c1015,this['_defaultModel']=_0x270a43;}get['models'](){return this['_models'];}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewCheckExtra extends AIReviewCheck{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x53f6a3,_0x54a63e,_0x4229e7){super(_0x53f6a3),this['prompt']=_0x53f6a3['prompt'],this['model']=_0x53f6a3['model'],this['model']?this['_defaultModel']=_0x54a63e['find'](_0x534b0c=>_0x534b0c['id']===this['model'])||null:this['_defaultModel']=_0x4229e7;}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewModeCheckList extends AIReviewCheckList{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x35ff27,_0x2aea84,_0x2131a4){super(),this['_allModels']=_0x35ff27,this['_recommendedModels']=_0x2aea84,this['_defaultModel']=_0x2131a4;}['setupChecks'](_0x3f2ad1){this['_checks']=_0x3f2ad1['map'](_0x318bc4=>!0x0===_0x318bc4['isExtra']?new AIReviewCheckExtra(_0x318bc4,this['_allModels'],this['_defaultModel']):'custom'===_0x318bc4['id']?new AIReviewCheckCustom(_0x318bc4,this['_recommendedModels'],this['_defaultModel']):new AIReviewCheck(_0x318bc4));}}class AIReviewCustomCheckRun extends AIReviewCheckRun{['_prompt'];['_model'];constructor(_0x3f30cc,_0x167633,_0x56eea5,_0x34bd13,_0x33824c){super(_0x56eea5,_0x34bd13,_0x33824c),this['_prompt']=_0x3f30cc,this['_model']=_0x167633;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x289860,_0x5d987f,_0x465ee4){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x5d987f,_0x289860,_0x465ee4);}}class AIReviewExtraCheckRun extends AIReviewCustomCheckRun{get['subTitle'](){return'';}set['prompt'](_0x59227d){this['_prompt']=_0x59227d;}set['model'](_0x57762d){this['_model']=_0x57762d;}}class AIReviewModeController extends AIReviewCoreController{static get['pluginName'](){return'AIReviewModeController';}['_isDiffOn']=!0x1;['_hasDefaultAvailableCommands']=!0x1;constructor(_0x35b2c9){super(_0x35b2c9),this['_hasDefaultAvailableCommands']=!this['context']['config']['get']('ai.review.availableCommands'),this['context']['config']['define']('ai.review.availableCommands',Yn['map'](_0x42bae1=>_0x42bae1['id'])),this['context']['config']['define']('ai.review.extraCommands',[]);}async['init'](){await super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x11bbd1,_0x3f7676)=>{this['_isDiffOn']=_0x3f7676['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x565879,_0x18bd47){return _0x565879['isCustom']?new AIReviewCustomCheckRun(_0x565879['args']['prompt'],_0x565879['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x18bd47,this['_aiConnector']):_0x18bd47['isExtra']?new AIReviewExtraCheckRun(_0x18bd47['prompt'],_0x18bd47['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x18bd47,this['_aiConnector']):new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x18bd47,this['_aiConnector'],_0x565879['params'],_0x565879['args']);}['_onReviewCheckResultActivated'](_0x22b4e5){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x22b4e5['change']['id']),this['_scrollToChange'](_0x22b4e5['change']['id']);const _0x475108=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x22b4e5['change']['id']);if(!_0x475108)return;const _0x3b7056=this['_aiReviewCoreEditing']['getEditorForChange'](_0x22b4e5['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x22b4e5['change'],()=>_0x475108['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x3b7056,_0x475108['modelRange']['root']['rootName']),_0x3b7056?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x22b4e5['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x360d04){this['_currentReviewCheckRun']&&'click'===_0x360d04['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x360d04['id']));}['_onDeactivateChange'](_0x706f26){this['_currentReviewCheckRun']&&'balloon'===_0x706f26['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x3f0303,_0x550884){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x550884['changeId']);const _0x1faade=this['_currentReviewCheckRun']['getChangeById'](_0x550884['changeId']);if(!_0x1faade)return;const _0x8ee2d1=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x550884['changeId']),_0x1589a6=this['_aiReviewCoreEditing']['getEditorForChange'](_0x550884['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x1faade,_0x550884['markerElement'],_0x550884['domEvent'],'click',this['_getBalloonDomRoot'](_0x1589a6,_0x8ee2d1?.['modelRange']['root']['rootName']),_0x1589a6?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x9281d0,_0x4d516d){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x380c6a=this['_currentReviewCheckRun']['getChangeById'](_0x4d516d['changeId']);if(!_0x380c6a)return;const _0x285e96=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x4d516d['changeId']),_0x3a38db=this['_aiReviewCoreEditing']['getEditorForChange'](_0x4d516d['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x380c6a,_0x4d516d['markerElement'],_0x4d516d['domEvent'],'hover',this['_getBalloonDomRoot'](_0x3a38db,_0x285e96?.['modelRange']['root']['rootName']),_0x3a38db?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){if(!this['_currentReviewCheckRun'])return;this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']();}['_getChangeContentElement'](_0x5dfd1f){const _0x2a71ef=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x5dfd1f);return _0x2a71ef?_0x2a71ef['getElement']():null;}['_markChangePositionInEditorContent'](_0x321f36,_0x1cef58){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x321f36,_0x1cef58);}['_diffContent'](_0x3dfb91,_0x5956e8,_0xd16b08){return this['_aiReviewCoreEditing']['diffContent'](_0x3dfb91,_0x5956e8,_0xd16b08,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x524447){_0x524447?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x2a493b of this['_aiReviewCoreEditing']['getEditors']())_0x2a493b['editing']['view']['change'](_0x300aa8=>{for(const _0x2d1c2e of _0x2a493b['editing']['view']['document']['getRoots']()){for(const _0x36c194 of _0x2d1c2e['getClassNames']())_0x36c194['startsWith']('ck-ai_review-')&&_0x300aa8['removeClass'](_0x36c194,_0x2d1c2e);_0x300aa8['addClass'](_0x524447?'ck-ai_review-diff':'ck-ai_review-highlights',_0x2d1c2e);}});}['_getBalloonDomRoot'](_0x42ce15,_0x569f72){const _0x40ef02=_0x42ce15['editing']['view'];if(_0x569f72){const _0xae74f6=_0x40ef02['getDomRoot'](_0x569f72);if(_0xae74f6)return _0xae74f6;}return _0x40ef02['getDomRoot']()??void 0x0;}async['_getChecksList'](){const _0x5003a4=[...Yn,...this['_getExtraChecks']()],_0xf80fb7=this['context']['config']['get']('ai.review.availableCommands')||[];this['_logErrorForNonExistentChecks'](_0xf80fb7,_0x5003a4);let _0x31698b=_0x5003a4;this['_hasDefaultAvailableCommands']||(_0x31698b=_0xf80fb7['map'](_0x2c118d=>_0x5003a4['find'](_0x3f102f=>_0x3f102f['id']===_0x2c118d))['filter'](_0xb09a94=>!!_0xb09a94)),_0x31698b=_0x31698b['map'](_0x43a8b9=>_0x43a8b9['isExtra']?_0x43a8b9:this['_translateReviewCheck'](_0x43a8b9));const _0x2332f5=_0x31698b['some'](_0xedafee=>_0xedafee['isExtra']||'custom'===_0xedafee['id']);let _0x50f904=[],_0xc31c88=[],_0x2a2727=null;if(_0x2332f5){const _0x3fe370=await this['_getModels']();_0x50f904=_0x3fe370['all'],_0xc31c88=_0x3fe370['recommended'],_0x2a2727=_0x3fe370['default'];}const _0x5e66e2=new AIReviewModeCheckList(_0x50f904,_0xc31c88,_0x2a2727);return _0x5e66e2['setupChecks'](_0x31698b),_0x2332f5&&this['_filterChecksWithMissingModel'](_0x5e66e2),_0x5e66e2;}['_getExtraChecks'](){return(this['context']['config']['get']('ai.review.extraCommands')||[])['map'](_0xd22d67=>({'id':_0xd22d67['id'],'commandId':_0xd22d67['id'],'title':_0xd22d67['label'],'description':_0xd22d67['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0xd22d67['prompt'],'model':_0xd22d67['model']}));}['_logErrorForNonExistentChecks'](_0x1d7885,_0x442114){const _0xc66926=_0x1d7885['filter'](_0x17e12d=>!_0x442114['some'](_0x10cfec=>_0x10cfec['id']===_0x17e12d));_0xc66926['length']&&this['_logError'](new at('ai-review-mode-non-existent-commands-used',this,{'commandIds':_0xc66926['join'](',\x20')}),!0x0);}async['_getModels'](){try{const _0x4e86b1=new AIModels({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});return{'all':await _0x4e86b1['getAll'](),'recommended':await _0x4e86b1['getAvailableModels'](),'default':await _0x4e86b1['getDefault']()};}catch(_0x2b6c7e){return this['_logError'](new at('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x2b6c7e)),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0xe73526){const _0x402a0c='AI_REVIEW_CHECK_'+_0xe73526['id']['toUpperCase']()['replaceAll']('-','_'),_0x35d43b={..._0xe73526,'title':this['_getTranslationWithDefault'](_0x402a0c+'_TITLE',_0xe73526['title']),'description':this['_getTranslationWithDefault'](_0x402a0c+'_DESCRIPTION',_0xe73526['description'])};return _0xe73526['options']&&(_0x35d43b['options']=_0xe73526['options']['map'](_0x52d424=>({..._0x52d424,'label':this['_getTranslationWithDefault'](_0x402a0c+'_OPTIONS_LABEL',_0x52d424['label']||''),'data':_0x52d424['data']?_0x52d424['data']['map'](_0x57833f=>({..._0x57833f,'label':this['_getTranslationWithDefault'](_0x402a0c+'_OPTIONS_DATA_'+_0x57833f['id']['toUpperCase'](),_0x57833f['label'])})):void 0x0}))),_0x35d43b;}['_filterChecksWithMissingModel'](_0x150a67){const _0x307699=[];_0x150a67['checks']['forEach'](_0x395839=>{(_0x395839 instanceof AIReviewCheckExtra&&!_0x395839['defaultModel']||_0x395839 instanceof AIReviewCheckCustom&&!_0x395839['models']['length'])&&_0x307699['push'](_0x395839['id']);}),_0x307699['length']&&_0x307699['forEach'](_0x117c45=>{_0x150a67['removeCheckById'](_0x117c45),this['_logError'](new at('ai-review-mode-command-unavailable-due-to-missing-model',this,{'commandId':_0x117c45}),!0x0);});}}class AIReviewMode extends _0xaac0f5{static get['requires'](){return[AIReviewModeController,AIReviewModeUI,AIReviewCoreEditing];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class AITranslateCheck extends AIReviewCheck{get['apiId'](){return'translate';}}class AITranslateCheckList extends AIReviewCheckList{['setupChecks'](_0x1ca393){this['_checks']=_0x1ca393['map'](_0x1550e6=>new AITranslateCheck(_0x1550e6));}}class AITranslateCheckRun extends AIReviewSystemCheckRun{['_title'];constructor(_0x211dee,_0x45ecb8,_0x124525,_0x155e51,_0x4ec6a4,_0x55f2f2){super(_0x211dee,_0x45ecb8,_0x124525,_0x4ec6a4,_0x55f2f2),this['_title']=_0x155e51;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}}class AITranslateController extends AIReviewCoreController{static get['pluginName'](){return'AITranslateController';}constructor(_0x340838){super(_0x340838),this['context']['config']['define']('ai.translate.languages',[{'label':'English','id':'english'},{'label':'Spanish','id':'spanish'},{'label':'French','id':'french'},{'label':'German','id':'german'},{'label':'Chinese\x20(Simplified)','id':'chinese'},{'label':'Japanese','id':'japanese'},{'label':'Russian','id':'russian'},{'label':'Portuguese','id':'portuguese'},{'label':'Korean','id':'korean'},{'label':'Italian','id':'italian'}]);}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x465e1f,_0x339c5e){return new AITranslateCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x339c5e,this['_aiConnector'],Hi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x465e1f['params'],_0x465e1f['args']);}['_onReviewCheckResultActivated'](_0x3022d8){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x3022d8['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x3022d8['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x3edcc2){this['_currentReviewCheckRun']&&('hover'===_0x3edcc2['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x3edcc2['id'])),'click'===_0x3edcc2['uiInteraction']&&this['_scrollToChange'](_0x3edcc2['id']));}['_onDeactivateChange'](_0x30ca5d){this['_currentReviewCheckRun']&&'panel'===_0x30ca5d['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x3f6e0a,_0x3be39d){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x3be39d['changeId']),this['_scrollToChange'](_0x3be39d['changeId']));}['_onChangeMarkerHovered'](_0x147e21,_0x46f0c5){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x46f0c5['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x46f0c5['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x3a1393){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x3a1393);}['_markChangePositionInEditorContent'](_0x1f06ac,_0x100041){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x1f06ac,_0x100041);}['_diffContent'](_0x23a074,_0x248d15,_0x2a5ee0){return this['_aiReviewCoreEditing']['diffContent'](_0x23a074,_0x248d15,_0x2a5ee0,!0x0);}['_onReviewCheckRun'](){for(const _0x51e78e of this['_aiReviewCoreEditing']['getEditors']())_0x51e78e['editing']['view']['change'](_0x170334=>{for(const _0x123238 of _0x51e78e['editing']['view']['document']['getRoots']())_0x170334['addClass']('ck-ai-translate-mode-content',_0x123238);});}async['_getChecksList'](){const _0x2af896=[],_0x4b406e=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x22ec28 of _0x4b406e)_0x2af896['push']({'title':_0x22ec28['label'],'id':_0x22ec28['id'],'commandId':_0x22ec28['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x22ec28['id']}});const _0x1f0c35=new AITranslateCheckList();return _0x1f0c35['setupChecks'](this['_translateChecks'](_0x2af896)),_0x1f0c35;}['_translateChecks'](_0x9f0a21){return _0x9f0a21['map'](_0x3b04d9=>{const _0x2795f2='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x3b04d9['title']['toUpperCase']()['replaceAll']('-','_');return{..._0x3b04d9,'title':this['_getTranslationWithDefault'](_0x2795f2,_0x3b04d9['title'])};});}}class AITranslateCheckResultsView extends AIReviewCoreUICheckResultsView{constructor(_0x483201,_0x15216a){super(_0x483201,_0x15216a),this['on']('set:isLoading',(_0x568930,_0x39a7ed,_0x576c4a)=>{_0x576c4a&&(this['headerTitle']=Hi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x4b4397,_0x3e9fc6,_0xdd4fa7)=>{_0xdd4fa7&&(this['headerTitle']=Hi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x519419=super['_createAcceptAllButtonView']();return _0x519419['set']('label',Hi(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x519419;}['_createExitReviewButtonView'](){const _0x43e016=super['_createExitReviewButtonView']();return _0x43e016['set']('label',Hi(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x43e016;}}class AITranslateCheckListView extends AIReviewCoreReviewCheckListView{['_setupTemplate'](){const _0x6a92f4=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x6a92f4['if']('isVisible','ck-hidden',_0x4c65e5=>!_0x4c65e5)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':Hi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':Hi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x6a92f4['if']('isVisible','ck-hidden',_0x5348cb=>!_0x5348cb)]},'children':this['_checkViews']}]});}}class AITranslateUI extends AIReviewCoreUI{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x1868ac=this['context']['plugins']['get']('AITabs'),_0x2d7368=this['context']['locale'],_0x30095c=new AIHeaderView(_0x2d7368,{'label':Hi(_0x2d7368,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x57b550,'class':'ck-ai-header_review-translate','showResizeButton':_0x1868ac['showResizeButton']});_0x30095c['delegate']('resizeTabs')['to'](_0x1868ac),_0x30095c['bind']('isMaximized')['to'](_0x1868ac['view'],'isMaximized',_0x5822f5=>_0x5822f5);const _0x3b59e2=new AIReviewCoreView(_0x2d7368,{'header':_0x30095c,'list':new AITranslateCheckListView(_0x2d7368),'results':new AITranslateCheckResultsView(_0x2d7368,{'generalErrorText':Hi(_0x2d7368,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x2d7368,{'headerText':Hi(_0x2d7368,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Hi(_0x2d7368,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Hi(_0x2d7368,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x3b59e2['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x3b59e2;}['registerTab'](){const _0x4fd1f2=this['context']['plugins']['get']('AITabs');_0x4fd1f2['view']['on']('activateTab',(_0x51efd9,{newTab:_0x2ca4cb,oldTab:_0x1a9983})=>{'translate'===_0x2ca4cb?this['fire']('getReviewCheckList'):'translate'===_0x1a9983&&this['fire']('leaveReview');}),_0x4fd1f2['view']['addTab']({'id':'translate','buttonLabel':Hi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x57b550,'order':0x0,'content':this['_mainView']});}}class AITranslate extends _0xaac0f5{static get['requires'](){return[AITranslateController,AITranslateUI,AIReviewCoreEditing];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{AIActions,AIAdapter,AIAssistant,AIAssistantUI,AIBalloon,AIChat,AIChatController,AIChatFeedCustomElementView,AIChatHistory,AIChatHistoryController,AIChatHistoryUI,AIChatInteraction,AIChatShortcuts,AIChatUI,AIConnector,AIEditing,AIEditorIntegration,AIInteraction,AIQuickActions,AIQuickActionsUI,AIReply,AIRequestError,AIReviewCheck,AIReviewCheckResult,AIReviewCheckResultChange,AIReviewCheckRun,AIReviewMode,AIReviewCoreController as AIReviewModeController,AIReviewCoreEditing as AIReviewModeEditing,AIReviewModeUI,AITabs,AITabsMainView,AITabsView,AITextAdapter,AIToggleButtonUI,AITranslate,AITranslateController,AITranslateUI,AWSTextAdapter,OpenAITextAdapter,ShowAIAssistantCommand,ToggleAICommand,Gi as createResizeButton,Di as getDefaultAICommands};