@ckeditor/ckeditor5-ai 48.3.1-alpha.0 → 48.3.1-alpha.1

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 +19 -19
  2. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -20,22 +20,22 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0x1dbdcb,ContextPlugin as _0xe5ed07,Editor as _0xbe1e8b,Plugin as _0x2e97a8,rootAcceptsBlocks as _0x5c2cc5}from'@ckeditor/ckeditor5-core';import{IconAI as _0x10ce41,IconAIAdjustLength as _0x3aa049,IconAIAskAI as _0x1b1301,IconAIChangeTone as _0x2e177f,IconAIChat as _0x532e15,IconAIChatCommands as _0x2e2f03,IconAIContinueWriting as _0x231a2c,IconAIGrammarCheck as _0x4881d4,IconAIHistory as _0x236854,IconAIImproveWriting as _0x379ef6,IconAIOther as _0x4224a0,IconAIQuickActions as _0x2db5af,IconAIReview as _0x4ddb4d,IconAITranslate as _0x9c35d8,IconBoxWithCheck as _0x240d3f,IconBoxWithCross as _0x4920b3,IconBoxWithMarker as _0x498b52,IconBrowseFiles as _0x531cf8,IconBulb as _0x2a5dc8,IconCancel as _0x22db67,IconCheck as _0x3047d4,IconChevronDown as _0x2c1f34,IconChevronRight as _0x432392,IconChevronUp as _0x4a9ca5,IconCopy as _0x51dfb6,IconDocument as _0x59144c,IconDocumentOutline as _0x51cb73,IconDropdownArrow as _0xc2680e,IconError as _0x1b76e7,IconEye as _0x496196,IconEyeCrossedOut as _0x27c4f3,IconFileUpload as _0x20248b,IconImage as _0x34a4e3,IconInfo as _0x445d2f,IconLink as _0x229098,IconLoupe as _0x5bf082,IconMagicWand as _0xc1bf03,IconMaximize as _0x1ff167,IconMinimize as _0x3bd917,IconNextArrow as _0x127d0b,IconOutdated as _0x5e55d4,IconPaperClip as _0x17cead,IconPin as _0x56c9b3,IconPlus as _0x2848a3,IconPreviousArrow as _0x248558,IconRefresh as _0x3c0af6,IconRobotPencil as _0x2a1746,IconSelection as _0x2cdc67,IconShowChangesOff as tt,IconShowChangesOn as et,IconStop as it,IconSubmit as st,IconThreeHorizontalDots as nt,IconThumbDown as rt,IconThumbUp as ot,IconWeb as at}from'@ckeditor/ckeditor5-icons';import{CKEditorError as ht,Collection as ct,DomEmitterMixin as lt,EmitterMixin as ut,FocusTracker as dt,KeystrokeHandler as _t,ObservableMixin as gt,Rect as At,ResizeObserver as It,_isMotionReduced as pt,first as mt,getConstrainedViewportRect as Et,global as Tt,insertToPriorityArray as wt,isVisible as Ct,logError as ft,logWarning as bt,scrollAncestorsToShowTarget as St,scrollViewportToShowTarget as Rt,toArray as Ot,uid as vt,version as kt}from'@ckeditor/ckeditor5-utils';import{AutocompleteView as Nt,BalloonPanelView as yt,BalloonToolbar as xt,BodyCollection as Lt,ButtonLabelView as Dt,ButtonLabelWithHighlightView as Pt,ButtonView as Ht,Dialog as Mt,DialogViewPosition as Vt,DropdownMenuPanelPositioningFunctions as Ut,FileDialogButtonView as Bt,FocusCycler as Gt,FormHeaderView as Ft,FormRowView as Kt,HighlightedTextView as Wt,IconView as Yt,InputTextView as $t,LabeledFieldView as qt,ListItemButtonView as Qt,ListItemGroupView as Xt,ListItemView as zt,ListView as jt,MenuBarMenuListItemButtonView as Jt,MenuBarMenuListItemView as Zt,MenuBarMenuListView as te,MenuBarMenuView as _0x46b15a,SearchTextView as _0x6714a0,SpinnerView as _0xe12bba,TextareaView as _0x512ff1,ToolbarView as _0x3931a6,UIModel as _0x5c4c1e,View as _0x3b0eb8,ViewCollection as _0x554eb4,addListToDropdown as _0x39a4e4,addMenuToDropdown as _0x7fc94e,clickOutsideHandler as _0x45c652,createDropdown as _0x1e2a6d,createLabeledInputText as _0x3b117d,createLabeledTextarea as _0x31d0b9,submitHandler as _0x3a899a}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x4a8643,ClipboardPipeline as _0x333696}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0x25a0c9,MarkerOperation as _0x4fad29,Matcher as _0x58ee9e,ModelDocumentFragment as _0x446730,ModelPosition as _0x3e2549,ModelRange as _0x34b9eb,ModelTreeWalker as _0x4288f8,ViewDataTransfer as _0x397aa6,ViewDocumentDomEventData as _0x270a6e,ViewDowncastWriter as _0x3045c8,ViewUpcastWriter as _0x5499b2,_DetachOperation as _0x2c93bf,_insertIntoModelNodeList as _0x1b1f77,_removeFromModelNodeList as _0x378764,transformOperationSets as _0x17dc83}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x22e557,debounce as _0x13ce22,escape as _0x3c76b5,escapeRegExp as _0xd5ed86,throttle as _0x570ee2,unescape as _0x371ce9}from'es-toolkit/compat';import{createParser as _0x324165}from'eventsource-parser';import{CloudServices as _0x124f03}from'@ckeditor/ckeditor5-cloud-services';import{ConfirmMixin as _0x34c427,DATA_ID_MODEL_ATTRIBUTE as _0x389bd6,DATA_ID_VIEW_ATTRIBUTE as _0x474493,DocumentCompare as _0x5d031e,SuggestionsConversion as _0x9631cb,fixElementSuggestionRange as _0x1e9e70,getAllMarkersDomElementsSorted as _0x1d0b44,getMarkerDomElement as _0x2dd8c2}from'@ckeditor/ckeditor5-collaboration-core';import{parseDocument as _0x1c8199}from'htmlparser2';import{append as _0x1418e3,appendChild as _0x27ef6,find as _0x5ca691,findAll as _0xec138b,findOne as ti,getChildren as _0x587b69,getParent as _0x3d9d2e,isComment as _0x1b98da,isTag as _0x1c0d0f,prepend as _0x3e6f45,prependChild as _0x2ecd48,removeElement as _0x8128e7,replaceElement as _0x297d48,textContent as _0x5125cd}from'domutils';import _0x935be1 from'dom-serializer';import{Document as _0x5e7b74,Element as _0x14308e,NodeWithChildren as _0x1bdc76,Text as _0x336fe1,cloneNode as _0x16e079,isDocument as _0x4f8f6a,isText as _0x4a7ce7}from'domhandler';import{MarkdownGfmMdToHtml as _0x2eb1be,MarkdownGfmMdToHtmlDefaultPlugins as _0x425a2f}from'@ckeditor/ckeditor5-markdown-gfm';import _0x40d8d2 from'rehype-sanitize';import _0x3af4bb from'morphdom';import{diffArrays as _0x270224}from'diff';const fi='_ungrouppedCommands';function bi(_0xc0744,_0x18ecfd){const _0xf64e68=(0x0,_0x18ecfd['t'])('Other');return _0xc0744['length']?'groupId'in _0xc0744[0x0]?_0xc0744:[{'groupId':fi,'groupLabel':_0xf64e68,'order':0x1/0x0,'commands':_0xc0744}]:[{'groupId':fi,'groupLabel':_0xf64e68,'order':0x1/0x0,'commands':[]}];}const Si=globalThis['DataTransfer'],Ri='ai-ui';var Oi=class extends _0x2e97a8{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x52667c}=this,_0x4589c8=['ck-fake-ai-selection'];_0x52667c['config']['get']('ai.assistant.useTheme')&&_0x4589c8['push']('ck-ai-assistant-ui_theme'),_0x52667c['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Ri,'view':{'classes':_0x4589c8,'priority':0xc}}),_0x52667c['conversion']['for']('editingDowncast')['markerToElement']({'model':Ri,'view':(_0x5e0ba5,{writer:_0x4a5320})=>{if(!_0x5e0ba5['markerRange']['isCollapsed'])return null;const _0x3b7eb3=_0x4a5320['createUIElement']('span');return _0x4a5320['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x3b7eb3),_0x3b7eb3;}});}['afterInit'](){!async function(_0x44697e){const _0x1c182c='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x5cf68a=0x78fa8,_0x476f30=window['Date']['now'](),_0x25bddb=_0x44697e['editor'],_0x3c20a1=new window['Promise'](_0x4d149a=>{_0x25bddb['once']('ready',_0x4d149a);}),_0x4d73c7={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x44b255=_0x25bddb['config']['get']('licenseKey');async function _0x17cd56(){let _0x10fbe9,_0x4d8a91=null,_0x36250c=null;try{return'GPL'==_0x44b255?'NotAllowed':(_0x10fbe9=_0xab56ac(),_0x10fbe9?(_0x10fbe9['usageEndpoint']&&(_0x36250c=_0x1e53ae(_0x10fbe9['usageEndpoint'],_0x10fbe9['jti'])),await _0x1d5093()?_0xc04dbe()?_0xf960b6()?'Expired':_0x5663b2()?('evaluation'==_0x10fbe9['licenseType']&&(_0x4d8a91=_0x5061b6('EvaluationLimit')),await _0x44a7c5()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0xf960b6(){const _0x4ac582=['evaluation','trial']['includes'](_0x10fbe9['licenseType'])?_0x476f30/0x3e8:0xe10*_0x5cf68a;return _0x10fbe9['exp']<_0x4ac582;}function _0xc04dbe(){const _0x31f40e=_0x10fbe9['features'];return!!_0x31f40e&&(!!_0x31f40e['includes']('*')||!!_0x31f40e['includes']('AI'));}function _0x5663b2(){const _0x3a3a96=_0x10fbe9['licensedHosts'];if(!_0x3a3a96||0x0==_0x3a3a96['length'])return!0x0;const {hostname:_0x5a2b73}=new URL(window['location']['href']);if(_0x3a3a96['includes'](_0x5a2b73))return!0x0;const _0x24fcaf=_0x5a2b73['split']('.');return _0x3a3a96['filter'](_0x1de3b9=>_0x1de3b9['includes']('*'))['map'](_0x1fb15b=>_0x1fb15b['split']('.'))['filter'](_0x43fc83=>_0x43fc83['length']<=_0x24fcaf['length'])['map'](_0x454e11=>Array(_0x24fcaf['length']-_0x454e11['length'])['fill']('*'===_0x454e11[0x0]?'*':'')['concat'](_0x454e11))['some'](_0x410d22=>_0x24fcaf['every']((_0x57de17,_0x4ed692)=>_0x410d22[_0x4ed692]===_0x57de17||'*'===_0x410d22[_0x4ed692]));}function _0x44a7c5(){return _0x4d8a91&&_0x36250c?new window['Promise']((_0x14aa9b,_0x2154db)=>{_0x4d8a91['then'](_0x14aa9b,_0x2154db),_0x36250c['then'](_0x3dc41c=>{'Valid'!=_0x3dc41c&&_0x14aa9b(_0x3dc41c);},_0x2154db);}):_0x4d8a91||_0x36250c||'Valid';}}function _0x1e53ae(_0x950952,_0x205096){return new window['Promise'](_0x53bfd0=>{if(_0x4289f2())return _0x53bfd0('Valid');_0x308c4b(),_0x25bddb['decorate']('_sendUsageRequest');let _0x5c0851=!0x1;const _0x1e4cd9=vt();function _0x5a83d8(_0x8aa00e){return!!_0x8aa00e&&('object'==typeof _0x8aa00e||'function'==typeof _0x8aa00e)&&'function'==typeof _0x8aa00e['then']&&'function'==typeof _0x8aa00e['catch'];}function _0xcf24ca(_0x59e315){_0xf9ad4a(_0x59e315)['then'](_0x536a53=>_0x536a53&&'ok'==_0x536a53['status']?_0x4295a7(_0x2bf0f0(_0x1e4cd9+_0x205096))!=_0x536a53['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x357625=>(_0x41f54d(),_0x357625),()=>{const _0x5720fc=_0x2f9132();return null==_0x5720fc?(_0x41f54d(),'Valid'):_0x476f30-_0x5720fc>0x240c8400?'UsageLimit':'Valid';})['then'](_0x53bfd0)['catch'](()=>{_0x53bfd0('UsageLimit');});const _0x295b0f=0x36ee80;function _0x41f54d(){const _0x63c4d1='llct-'+_0x4295a7(_0x2bf0f0(_0x950952)),_0x2c27b2=_0x3fb917(_0x4295a7(window['Math']['ceil'](_0x476f30/_0x295b0f)));window['localStorage']['setItem'](_0x63c4d1,_0x2c27b2);}function _0x2f9132(){const _0x16359c='llct-'+_0x4295a7(_0x2bf0f0(_0x950952)),_0x58c5ad=window['localStorage']['getItem'](_0x16359c);return _0x58c5ad?window['parseInt'](_0x3fb917(_0x58c5ad),0x10)*_0x295b0f:null;}function _0xf9ad4a(_0x235fe7){return new window['Promise']((_0x50fd9d,_0xd86fe1)=>{_0x235fe7['then'](_0x50fd9d,_0xd86fe1),window['setTimeout'](_0xd86fe1,0x1d4c0);});}}_0x25bddb['on']('_sendUsageRequest',(_0x262466,_0xe15c99)=>{if(_0xe15c99[0x0]!=_0x950952)return _0x53bfd0('UsageLimit');_0xe15c99[0x1]={..._0xe15c99[0x1],'requestId':_0x1e4cd9};},{'priority':'high'}),_0x25bddb['on']('_sendUsageRequest',_0x4ccc33=>{_0x5a83d8(_0x4ccc33['return'])&&(_0x5c0851=!0x0,_0xcf24ca(_0x4ccc33['return']));},{'priority':'low'}),_0x3c20a1['then'](()=>{_0x5c0851||_0x53bfd0('UsageLimit');});});function _0x4289f2(){return'auto'==_0x25bddb['editing']['view']['_overlayModeHint'];}function _0x308c4b(){_0x25bddb['editing']['view']['_overlayModeHint']='auto';}}function _0x5061b6(_0x528e0e){const _0x321c11=[new window['Promise'](_0x5c1f83=>setTimeout(_0x5c1f83,0x93ecc)),_0x3c20a1['then'](()=>new window['Promise'](_0x136cb7=>{let _0x9af05b=0x0;_0x25bddb['model']['on']('applyOperation',(_0x167459,_0x382cac)=>{_0x382cac[0x0]['isDocumentOperation']&&_0x9af05b++,0x5e8==_0x9af05b&&(_0x136cb7(),_0x167459['off']());});}))];return window['Promise']['race'](_0x321c11)['then'](()=>_0x528e0e);}async function _0xf10dc2(){await _0x3c20a1,_0x25bddb['model']['change']=_0x3bc910,_0x25bddb['model']['enqueueChange']=_0x3bc910,_0x25bddb['enableReadOnlyMode']('model');}function _0x55157b(_0x1123e1){const _0x4b112a=_0x2c699a();_0x25bddb[_0x4b112a]='aiLicenseKey'+_0x1123e1,'Valid'!=_0x1123e1&&_0xf10dc2();}function _0x2c699a(){const _0x1084b9=window['String'](window['performance']['now']())['replace']('.','');let _0x2dd8c3='n';for(let _0x300b88=0x0;_0x300b88<_0x1084b9['length'];_0x300b88+=0x2){let _0x24ce46=window['parseInt'](_0x1084b9['substring'](_0x300b88,_0x300b88+0x2));_0x24ce46>=0x3e&&(_0x24ce46-=0x3e),_0x2dd8c3+=_0x1c182c[_0x24ce46];}return _0x2dd8c3;}function _0xab56ac(){const _0x24e112=_0x44b255['split']('.');if(0x3!=_0x24e112['length'])return null;return _0x5cdb46(_0x24e112[0x1]);function _0x5cdb46(_0x2a1703){const _0x30d3cf=_0x4fc853(_0x2a1703);return _0x30d3cf&&_0x56f987()?_0x30d3cf:null;function _0x56f987(){const _0x14259a=_0x30d3cf['jti'],_0x554d23=window['parseInt'](_0x14259a['substring'](_0x14259a['length']-0x8),0x10),_0x29a88a={..._0x30d3cf,'jti':_0x14259a['substring'](0x0,_0x14259a['length']-0x8)};return delete _0x29a88a['vc'],_0x2bf0f0(_0x29a88a)==_0x554d23;}}}async function _0x1d5093(){let _0x381ae5=!0x0;try{const [_0x3e4009,_0x772f0d,_0xdd4de3]=_0x44b255['split']('.');return _0x47a5d6(_0x3e4009),await _0x139d44(_0x3e4009,_0x772f0d,_0xdd4de3),_0x381ae5;}catch{return!0x1;}function _0x47a5d6(_0xf32d32){const _0x20f359=_0x4fc853(_0xf32d32);_0x20f359&&'ES256'==_0x20f359['alg']||(_0x381ae5=!0x1);}async function _0x139d44(_0x5ceb78,_0x157e03,_0x312e27){const _0x26a5b5=window['Uint8Array']['from'](_0x1af1e0(_0x312e27),_0x11bb37=>_0x11bb37['charCodeAt'](0x0)),_0x5cae8c=new window['TextEncoder']()['encode'](_0x5ceb78+'.'+_0x157e03),_0x221a22=window['crypto']['subtle'];if(!_0x221a22)return;const _0x324e33=await _0x221a22['importKey']('jwk',_0x4d73c7,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x221a22['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x324e33,_0x26a5b5,_0x5cae8c)||(_0x381ae5=!0x1);}}function _0x4fc853(_0x324e39){return _0x324e39['startsWith']('ey')?JSON['parse'](_0x1af1e0(_0x324e39)):null;}function _0x1af1e0(_0x575741){return window['atob'](_0x575741['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x2bf0f0(_0x4090cb){let _0x5b69b2=0x1505;function _0x1b8460(_0x5c219b){for(let _0x2d555a=0x0;_0x2d555a<_0x5c219b['length'];_0x2d555a++){const _0x1cca33=_0x5c219b['charCodeAt'](_0x2d555a);_0x5b69b2=(_0x5b69b2<<0x5)+_0x5b69b2+_0x1cca33,_0x5b69b2&=_0x5b69b2;}}function _0x238c54(_0x3afa73){Array['isArray'](_0x3afa73)?_0x3afa73['forEach'](_0x238c54):_0x3afa73&&'object'==typeof _0x3afa73?Object['entries'](_0x3afa73)['sort']()['forEach'](([_0xbd94d1,_0x29b549])=>{_0x1b8460(_0xbd94d1),_0x238c54(_0x29b549);}):_0x1b8460(window['String'](_0x3afa73));}return _0x238c54(_0x4090cb),_0x5b69b2>>>0x0;}function _0x4295a7(_0x54b38f){return _0x54b38f['toString'](0x10)['padStart'](0x8,'0');}function _0x3fb917(_0x1f8dc1){return _0x1f8dc1['split']('')['reverse']()['join']('');}function _0x3bc910(){}_0x55157b(await _0x17cd56());}(this);}['showFakeVisualSelection'](){const _0x4ca151=this['editor']['model'];_0x4ca151['change'](_0x5e88a4=>{const _0x5e9a73=_0x4ca151['document']['selection']['getRanges']();let _0x579d92=0x0;for(const _0x4f4c43 of _0x5e9a73){const _0x24434b=Ri+':'+_0x579d92;if(_0x4ca151['markers']['has'](_0x24434b))_0x5e88a4['updateMarker'](_0x24434b,{'range':_0x4f4c43});else{if(_0x4f4c43['start']['isAtEnd']){const _0x50c37e=_0x4f4c43['start']['getLastMatchingPosition'](({item:_0x5467d9})=>!_0x4ca151['schema']['isContent'](_0x5467d9),{'boundaries':_0x4f4c43});_0x5e88a4['addMarker'](_0x24434b,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x5e88a4['createRange'](_0x50c37e,_0x4f4c43['end'])});}else _0x5e88a4['addMarker'](_0x24434b,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x4f4c43});}_0x579d92++;}});}['hideFakeVisualSelection'](){const _0x5dbe0a=this['editor']['model'],_0x558cf9=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Ri));_0x558cf9['length']&&_0x5dbe0a['change'](_0x4bc70d=>{_0x558cf9['forEach'](_0x5d1e62=>{_0x4bc70d['removeMarker'](_0x5d1e62);});});}['insertContent'](_0x3817e0,_0x3c3274){const _0x5ac220=this['_getAISelection'](),_0x42eb4a=_0x3c3274||_0x5ac220['getFirstRange']();this['editor']['model']['canEditAt'](_0x42eb4a)&&this['editor']['model']['change'](_0x5d32e0=>{this['hideFakeVisualSelection'](),_0x3c3274||this['_resetContentOfSelectedTableCells'](_0x5d32e0,_0x5ac220),this['_pasteHTMLUsingClipboard']({'insertAt':_0x42eb4a,'writer':_0x5d32e0,'html':_0x3817e0});});}['insertContentBelow'](_0x5a23ee){const {model:_0x3b80f7}=this['editor'],_0x177251=this['_getAISelection']();_0x3b80f7['change'](()=>{const _0x41ab16=this['_prepareTableInsertBelowPosition'](_0x5a23ee,_0x177251)||this['_getDefaultInsertBelowPosition'](_0x177251);this['insertContent'](_0x5a23ee,_0x41ab16);});}['_getAISelection'](){const _0x5be738=this['editor']['model'],_0x220f38=Array['from'](_0x5be738['markers']['getMarkersGroup'](Ri))['map'](_0x240692=>_0x240692['getRange']());return _0x5be738['createSelection'](_0x220f38);}['_pasteHTMLUsingClipboard']({writer:_0x1456d2,html:_0x1c2262,insertAt:_0x339364}){const {view:_0x134e52}=this['editor']['editing'],_0x4b2d31=this['editor']['plugins']['get'](_0x333696),_0x139e4b=new Si();_0x139e4b['setData']('text/html',_0x1c2262);const _0x1e9295=new _0x270a6e(_0x134e52,new ClipboardEvent('paste',{'clipboardData':_0x139e4b}),{'dataTransfer':new _0x397aa6(_0x139e4b)});_0x1456d2['setSelection'](_0x339364);const _0x53ed51=(_0x5b2671,_0x32c0ba)=>{_0x32c0ba['resultRange']&&_0x1456d2['setSelection'](_0x32c0ba['resultRange']);};_0x4b2d31['once']('contentInsertion',_0x53ed51,{'priority':'lowest'}),_0x134e52['document']['fire']('paste',_0x1e9295),_0x4b2d31['off']('contentInsertion',_0x53ed51);}['_getDefaultInsertBelowPosition'](_0x1dc7c5){const {model:_0x5057e0}=this['editor'],_0x44547b=Array['from'](_0x1dc7c5['getSelectedBlocks']());return _0x44547b['length']?_0x5057e0['createPositionAfter'](_0x44547b['pop']()):_0x1dc7c5['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x50b5e3,_0x95ef18){const {model:_0x2462b2,plugins:_0x59a3cc}=this['editor'];if(_0x59a3cc['has']('TableUtils')){const _0x5f143b=_0x59a3cc['get']('TableUtils')['getSelectedTableCells'](_0x95ef18);if(_0x5f143b['length']){const _0x22a899=this['_getTableRowCountFromContent'](_0x50b5e3),_0x3b31ca=this['_createEmptyTableRows'](_0x5f143b,_0x22a899);return _0x2462b2['createPositionAt'](_0x3b31ca,0x0);}}return null;}['_getTableRowCountFromContent'](_0x2dde5f){const _0x5aa9ec=this['editor']['plugins']['get']('TableUtils'),_0x192aa5=this['editor']['data']['parse'](_0x2dde5f,'$documentFragment'),_0x15dce2=Array['from'](_0x192aa5['getChildren']())['filter'](_0x3244f3=>_0x3244f3['is']('element','table'));let _0x54ec94=0x0;return _0x15dce2['forEach'](_0x4f4c08=>{_0x54ec94+=_0x5aa9ec['getRows'](_0x4f4c08);}),_0x54ec94;}['_createEmptyTableRows'](_0x2cfc9a,_0x57e092){const _0x3aca5e=this['editor']['plugins']['get']('TableUtils'),_0x8d3d44=_0x3aca5e['getRowIndexes'](_0x2cfc9a),_0x1b16d7=_0x3aca5e['getColumnIndexes'](_0x2cfc9a),_0x1076f0=_0x8d3d44['last']+0x1,_0x26009a=_0x1b16d7['first'],_0x398f3e=_0x2cfc9a[0x0]['findAncestor']('table');for(let _0x36f155=0x0;_0x36f155<_0x57e092;_0x36f155++)_0x3aca5e['insertRows'](_0x398f3e,{'at':_0x1076f0});return _0x398f3e['getChild'](_0x1076f0)['getChild'](_0x26009a);}['_resetContentOfSelectedTableCells'](_0x1f4fae,_0x1e7b23){const {plugins:_0x866a33}=this['editor'],{model:_0x1eab7d}=_0x1f4fae;_0x866a33['has']('TableUtils')&&_0x866a33['get']('TableUtils')['getSelectedTableCells'](_0x1e7b23)['length']&&_0x1eab7d['deleteContent'](_0x1e7b23);}},vi=class extends _0x2e97a8{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new ht('aiadapter-text-adapter-not-set',null);}},ki=class extends Error{constructor(_0x1594f8){super(_0x1594f8),this['name']='AIRequestError';}};function Ni(_0x2d0239,_0x38c95c,_0x555c03){const t=_0x2d0239['t'];switch(_0x38c95c){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',_0x555c03);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x555c03);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'},_0x555c03);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 _0x38c95c;}}var yi=class extends _0x1dbdcb{['_commandDefinitions'];constructor(_0x2e1649,_0x575a4c){super(_0x2e1649),this['_commandDefinitions']=_0x575a4c,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x1adee4,_0x41011e,_0xfbc4b4)=>{this['isEnabled']&&(this['enabledCommandsIds']=xi(this['_commandDefinitions'],_0xfbc4b4));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x64beb4,_0x596c42,_0x425f68)=>{this['enabledCommandsIds']=_0x425f68?xi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x239f20=this['editor']['model'];this['_hasContext']=function(_0x307279){const _0x4d8bed=_0x307279['document']['selection'];return _0x4d8bed['isCollapsed']?0x0!==[..._0x4d8bed['getSelectedBlocks']()]['length']&&![..._0x4d8bed['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x307279['hasContent'](_0x4d8bed['getFirstRange']());}(_0x239f20);const _0x48637c=_0x239f20['document']['selection'],_0x111dff=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x555460 of _0x48637c['getRanges']())for(const _0xab4429 of _0x555460['getItems']())if(_0xab4429['is']('element')&&_0x111dff['includes'](_0xab4429['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x439912='',_0x477133='',_0x2bb3a6='custom'){this['editor']['plugins']['get'](Xi)['showUI'](_0x439912,_0x477133,_0x2bb3a6);}};function xi(_0x242631,_0x374db6){const _0xf979c4=new Set();for(const _0xfc78b0 of _0x242631['values']())(_0x374db6||!0x1===_0xfc78b0['requiresContent'])&&_0xf979c4['add'](_0xfc78b0['id']);return Array['from'](_0xf979c4);}const Li=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is'),Di=/* #__PURE__ -- @preserve */
24
- gt();var Pi=class extends Di{['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x3a5131,_0x5c3805,_0xecb9cb){super(),this['editor']=_0x3a5131,this['textAdapter']=_0x5c3805,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0xecb9cb,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x1ab89c,_0x1c6b04,_0x56348f)=>{this['view']['value']=this['_sanitizeHTML'](_0x56348f);}),this['listenTo'](this['view'],'submitPrompt',(_0x5b4df0,_0x3539ec)=>{const _0x4470fe=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x3539ec,_0x4470fe,'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:_0x31a66a,query:_0xbb3de0,htmlContent:_0x30df0e,label:_0xe9909a,mainActionLabel:_0x4bec66}){this['view']['prompt']=_0xe9909a,this['view']['mainAction']=_0x4bec66,this['initialContext']=_0x30df0e,_0xbb3de0&&(this['view']['isRendered']?this['_handleQuery'](_0xbb3de0,_0x30df0e,_0x31a66a,_0xe9909a):this['view']['once']('render',()=>{this['_handleQuery'](_0xbb3de0,_0x30df0e,_0x31a66a,_0xe9909a);}));}['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'](_0x4dd764,_0x11e008,_0x2821c7,_0xc9edd3){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x11e008,this['previousQuery']=_0x4dd764,this['previousLabel']=_0xc9edd3||_0x4dd764,this['previousActionId']=_0x2821c7,new Promise(_0x27ae2d=>{this['textAdapter']['makeRequest']({'query':_0x4dd764,'context':_0x11e008,'onData':_0x23e57e=>{this['currentResponse']=_0x23e57e,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x2821c7})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x1be268=>{_0x1be268 instanceof ki?this['view']['handleError'](_0x1be268['message']):this['view']['handleError'](),_0x27ae2d();})['finally'](()=>{this['stopProcessing'](),_0x27ae2d();});});}['_parseAndNormalizeContent'](_0x46a810,_0x4c689a=!0x1){const _0x1e6a52=Li['exec'](_0x46a810);_0x46a810=_0x1e6a52?_0x46a810['substring'](_0x1e6a52[0x1]['length']):_0x46a810['length']<0x64&&!_0x4c689a?'':this['_stripMarkdownSyntax'](_0x46a810);const _0x16042a=this['_domParser']['parseFromString'](_0x46a810,'text/html');if(_0x1e6a52){const _0x1d7529=Array['from'](_0x16042a['body']['childNodes']);_0x1d7529['reverse']();for(const _0x28ec33 of _0x1d7529){if(_0x28ec33['nodeType']==Node['ELEMENT_NODE'])break;_0x28ec33['remove']();}}const _0x4d5745=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x16042a['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x4d5745);const _0x1b1a0c=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x9949c1=this['editor']['data']['toModel'](_0x4d5745);return _0x1b1a0c||_0x9949c1['markers']['clear'](),this['editor']['data']['stringify'](_0x9949c1);}['_normalizeResponseHeadings'](_0x4aa97d){const _0x3240bd=new _0x5499b2(this['editor']['editing']['view']['document']),_0x2a2be5=new _0x58ee9e({'name':/^h[1-5]$/}),_0x4c67c5=[];let _0x2b7c9a=!0x1;for(const _0x10dd59 of _0x4aa97d)_0x10dd59['is']('element')&&_0x2a2be5['match'](_0x10dd59)&&(_0x4c67c5['push'](_0x10dd59),'h1'==_0x10dd59['name']&&(_0x2b7c9a=!0x0));if(_0x2b7c9a){for(const _0x232902 of _0x4c67c5)_0x3240bd['rename']('h'+(parseInt(_0x232902['name'][0x1])+0x1),_0x232902);}}['_isH1TagSupportEnabled'](){const {data:_0x2a0ff2,editing:_0x6b4dac}=this['editor'],_0x1b16f6=_0x2a0ff2['htmlProcessor']['toView']('<h1></h1>'),_0x37b99e=_0x2a0ff2['toView'](_0x2a0ff2['toModel'](_0x1b16f6));return!!_0x6b4dac['view']['domConverter']['viewToDom'](_0x37b99e)['querySelector']('h1');}['_sanitizeHTML'](_0x2960b5){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x2960b5),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x33c917){const _0xbc1d51=_0x33c917['trim']();return _0xbc1d51['startsWith']('```html')?_0xbc1d51['endsWith']('```')?_0xbc1d51['substring'](0x7,_0xbc1d51['length']-0x3):_0xbc1d51['substring'](0x7):_0x33c917;}};const Hi={'REPLACE':'replace','INSERT':'insert'};var Mi=class extends _0x3931a6{constructor(_0x5b5e09){super(_0x5b5e09),this['set']('isVisible',!0x1),this['set']('mainAction',Hi['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0xd0ad8b=>Ni(_0x5b5e09,'AI_'+_0xd0ad8b['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Ni(_0x5b5e09,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Ni(_0x5b5e09,'Try\x20again')),this['stopButton']=this['_createButton'](Ni(_0x5b5e09,'Stop'));const _0x50c7db=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x50c7db['if']('isVisible','ck-hidden',_0x32e0ab=>!_0x32e0ab)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x4f6169,_0x34173f){const _0x44a1c9=new Ht(this['locale']);return _0x44a1c9['set']({'label':_0x4f6169,'class':_0x34173f||'','isVisible':!0x0,'withText':!0x0}),_0x44a1c9;}},Vi=class extends _0x3b0eb8{['contentFieldView'];['copyButtonView'];constructor(_0x1d5c3c,_0x3a0ce8=''){super(_0x1d5c3c),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x129325=this['bindTemplate'];this['contentFieldView']=new Ui(_0x1d5c3c,_0x3a0ce8),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x129325['if']('isVisible','ck-hidden',_0x6e4225=>!_0x6e4225)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x129325['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 _0x445b07=!0x1;this['on']('change:value',(_0x552784,_0xe42736,_0x225ef8)=>{const _0x4da6bd=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x225ef8),this['isProcessing']&&_0x4da6bd&&!_0x445b07&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x324457,_0x60860,_0x3f3e52)=>{_0x445b07=!0x1,_0x3f3e52?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x445b07=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x445b07=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x4e3f4f=this['locale'],_0x1e5d54=new Ht(this['locale']),_0x305463='ck-ai-form__copy-button';return _0x1e5d54['set']({'label':Ni(_0x4e3f4f,'Copy'),'icon':_0x51dfb6,'class':_0x305463,'tooltip':!0x0}),_0x1e5d54['bind']('isVisible')['to'](this,'value',_0x2d1090=>!!_0x2d1090),_0x1e5d54['bind']('isEnabled')['to'](this,'isProcessing',_0x2ffe70=>!_0x2ffe70),_0x1e5d54['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x1e5d54['icon']=_0x3047d4,_0x1e5d54['class']=_0x305463+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x1e5d54['icon']=_0x51dfb6,_0x1e5d54['class']=_0x305463;},0x3e8);}),_0x1e5d54;}['_copyHTMLToClipboard'](_0x5cd021){const {window:_0x3896f3,document:_0x47892d}=Tt;if(_0x3896f3['ClipboardItem']){const {Blob:_0x20a260,ClipboardItem:_0x9a36ec}=_0x3896f3,_0x26c6eb=[new _0x9a36ec({'text/html':new _0x20a260([_0x5cd021['innerHTML']],{'type':'text/html'}),'text/plain':new _0x20a260([_0x5cd021['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x26c6eb);}else{const _0x14d984=_0x47892d['createElement']('div');_0x14d984['style']['position']='absolute',_0x14d984['style']['left']='-9999px',_0x14d984['innerHTML']='<span>[</span>'+_0x5cd021['innerHTML']+'<span>]</span>',_0x47892d['body']['appendChild'](_0x14d984);const _0x2a7473=_0x47892d['createRange']();_0x2a7473['setStartAfter'](_0x14d984['firstElementChild']),_0x2a7473['setEndBefore'](_0x14d984['lastElementChild']);const _0x318622=_0x3896f3['getSelection']();_0x318622['removeAllRanges'](),_0x318622['addRange'](_0x2a7473),_0x47892d['execCommand']('copy'),_0x14d984['remove']();}}},Ui=class extends _0x3b0eb8{constructor(_0x43929c,_0x58e12a=''){super(_0x43929c),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x58e12a,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x323390){this['element']['innerHTML']=_0x323390;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x1e16d2=new _0x3b0eb8(),_0x49131c=this['locale'],_0x28a49b=new _0xe12bba();return _0x28a49b['isVisible']=!0x0,_0x1e16d2['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x28a49b,{'text':Ni(_0x49131c,'AI\x20is\x20writing...')}]}),_0x1e16d2['render'](),_0x1e16d2;}},Bi=class extends _0x3b0eb8{constructor(_0x4e0263,_0x34c576=''){super(_0x4e0263);const _0x4bbeb4=new Yt(),_0x962f58=this['bindTemplate'];this['set']('text',_0x34c576),_0x4bbeb4['content']=_0x1b76e7,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x4bbeb4,{'text':_0x962f58['to']('text')}]});}},Gi=class extends Nt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x388ede,_0x457ddc){super(_0x388ede,_0x457ddc),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',(_0x3f6767,_0x25809c)=>{_0x3f6767['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x25809c());});}['_createSubmitButton'](){const _0x286663=new Ht(this['locale']),_0x4138b5=this['locale'];return _0x286663['set']({'icon':st,'label':Ni(_0x4138b5,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x286663['on']('execute',()=>{this['submit']();}),_0x286663['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x2915ee,_0x4f423a)=>!_0x2915ee&&_0x4f423a),_0x286663;}['_createShowHistoryButton'](){const _0x59355a=new Ht(this['locale']),_0x3e5828=this['resultsView'],_0x1e0bc4=this['locale'];_0x59355a['set']({'label':Ni(_0x1e0bc4,'History'),'withText':!0x1,'icon':_0x236854,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x59355a['bind']('isOn')['to'](_0x3e5828,'isVisible'),_0x59355a['bind']('isEnabled')['to'](this,'isEnabled'),_0x59355a['on']('execute',()=>{_0x3e5828['isVisible']=!_0x3e5828['isVisible'],_0x3e5828['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x443d28=()=>{Tt['window']['requestAnimationFrame'](()=>{if(Ct(this['element'])){const _0x550ff5=new At(this['queryView']['fieldView']['element']),_0x542e22=_0x550ff5['width'],_0x1ecac0='rtl'===_0x1e0bc4['uiLanguageDirection']?'left':'right';_0x550ff5['excludeScrollbarsAndBorders'](),_0x59355a['element']['style'][_0x1ecac0]=_0x542e22-_0x550ff5['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x443d28),this['on']('render',_0x443d28),_0x59355a;}['submit'](){const _0x5ba094=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x5ba094);}['focus'](_0x224504){-0x1===_0x224504?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},Fi=class extends jt{['historyGroupView'];['clearHistoryButton'];constructor(_0x3f3d2f){super(_0x3f3d2f),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Xt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Ni(_0x3f3d2f,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x105b9d=0x0;for(const _0x3b3f90 of this['items'])_0x105b9d+=_0x3b3f90['items']['length'];return{'resultsCount':_0x105b9d,'totalItemsCount':_0x105b9d};}['_createClearHistoryButton'](){const _0x55bc9b=this['locale'],_0x5207b4=new Ht(this['locale']);return _0x5207b4['set']({'label':'('+Ni(_0x55bc9b,'Clear')+')','withText':!0x0}),_0x5207b4['on']('execute',()=>this['fire']('clearHistory')),_0x5207b4;}},Ki=class extends zt{constructor(_0x53f106){super();const _0x5841de=new Dt(),_0x21b664=new Ht(this['locale'],_0x5841de);this['children']['add'](_0x21b664),_0x21b664['set']({'label':_0x53f106['prompt'],'withText':!0x0}),_0x21b664['on']('execute',()=>{this['fire']('execute',{'value':_0x371ce9(_0x53f106['prompt'])});});}};const Wi='CKEditor/AIFormView/PromptHistory';var Yi=class extends ct{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x1eb559,_0x2bcf17)=>{const _0x442e62=$i(_0x2bcf17['prompt']);for(const _0x5aa4ca of this)if(_0x5aa4ca!=_0x2bcf17&&$i(_0x5aa4ca['prompt'])===_0x442e62){this['remove'](_0x5aa4ca);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x562af9=sessionStorage['getItem'](Wi)||'[]';this['addMany'](JSON['parse'](_0x562af9));}['_saveToSessionStorage'](){sessionStorage['setItem'](Wi,JSON['stringify'](this['map'](_0x837257=>_0x837257)));}};function $i(_0x18dfad){return _0x18dfad['toLowerCase']()['trim']();}var qi=class extends _0x3b0eb8{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x281448,_0x52b67d,_0x3cd934=''){super(_0x281448),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',Hi['REPLACE']),this['_promptHistory']=new Yi(),this['errorView']=new Bi(_0x281448),this['contentArea']=new Vi(_0x281448,_0x3cd934),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 dt(),this['keystrokes']=new _t(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Gt({'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 _0x141058=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x52b67d],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x141058['if']('isError','ck-hidden',_0x2539c7=>!_0x2539c7)]},'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'](_0x4c40d9=0x1){-0x1===_0x4c40d9?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 _0x57bdc9=this['locale'],_0x80cc35=new Gi(_0x57bdc9,{'queryView':{'label':Ni(_0x57bdc9,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x31d0b9,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Ni(_0x57bdc9,'Empty\x20history'),'secondary':Ni(_0x57bdc9,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x80cc35['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x59d4d3,_0x48485c)=>_0x59d4d3&&!_0x48485c),this['listenTo'](_0x80cc35,'submit',(_0x4712f4,_0x534e8a)=>{this['prompt']=_0x534e8a;const _0x58888b=_0x3c76b5(_0x534e8a);this['fire']('submitPrompt',_0x58888b),_0x534e8a['trim']()&&this['_promptHistory']['add']({'prompt':_0x58888b},0x0);},{'priority':'high'}),_0x80cc35;}['_createHistoryView'](){const _0x19782e=new Fi(this['locale']);return _0x19782e['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Ki),_0x19782e['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x19782e;}['_createToolbar'](){const _0x55799b=new Mi(this['locale']);return _0x55799b['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x43d68b,_0x457605,_0x3d6b1b)=>_0x43d68b&&!_0x457605&&!!_0x3d6b1b),_0x55799b['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x55799b['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x81ba79,_0x152822,_0x162131)=>_0x81ba79&&!_0x152822&&!!_0x162131),_0x55799b['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x55799b['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x5c8141,_0x381e39)=>_0x5c8141&&!_0x381e39),_0x55799b['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x55799b['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x55799b['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x55799b;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x31a4d6=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Ni(_0x31a4d6,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x4ed0ca){const _0x34369a=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x4ed0ca||Ni(_0x34369a,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const Qi=globalThis['DataTransfer'];var Xi=class extends _0x2e97a8{['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[_0x4a8643,Oi,vi,Mt];}constructor(_0xc5a517){super(_0xc5a517),_0xc5a517['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0xc5a517['config']['define']('ai.assistant.contentAreaCssClass',''),_0xc5a517['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0xc5a517['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x157040}=this;this['_aiAdapter']=_0x157040['plugins']['get'](vi),this['_dialog']=_0x157040['plugins']['get'](Mt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x337f31=new yi(_0x157040,Array['from'](this['_commandDefinitions']['values']()));_0x157040['commands']['add']('showAIAssistant',_0x337f31),_0x157040['ui']['componentFactory']['add']('aiCommands',_0x4130d9=>{const _0x11818b=_0x1e2a6d(_0x4130d9);return _0x11818b['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x11818b['buttonView']['set']({'label':Ni(_0x4130d9,'AI\x20Commands'),'icon':_0xc1bf03,'tooltip':!0x0}),_0x11818b['on']('execute',_0x560100=>this['_onExecute'](_0x560100['source']['id'])),_0x7fc94e(_0x11818b,_0x157040['ui']['view']['body'],function(_0x4528b7){const _0x37ee18=ji(_0x4528b7,bi(_0x4528b7['config']['get']('ai.assistant.commands'),_0x4528b7['locale']))['filter'](_0x446552=>_0x446552['commands']['length']);return 0x1===_0x37ee18['length']?ji(_0x4528b7,_0x37ee18[0x0]['commands'])['map'](_0x53c2e=>({'id':_0x53c2e['id'],'label':_0x53c2e['label']})):_0x37ee18['map'](_0x164354=>{const {groupId:_0x5d1c2f,groupLabel:_0x146a3d,commands:_0x54118f}=_0x164354,_0x55d03f=ji(_0x4528b7,_0x54118f)['map'](_0x2199c8=>({'id':_0x2199c8['id'],'label':_0x2199c8['label']}));return{'id':_0x5d1c2f,'menu':_0x146a3d||_0x5d1c2f,'children':_0x55d03f};});}(_0x157040),{'ariaLabel':Ni(_0x4130d9,'AI\x20Commands')}),_0x11818b['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x337f31['on']('change:enabledCommandsIds',_0xa15fa2),_0x11818b['menuView']['once']('render',_0xa15fa2),_0x11818b;function _0xa15fa2(){_0x11818b['isEnabled']=_0x337f31['enabledCommandsIds']['length']>0x0;for(const _0x3b0266 of _0x11818b['menuView']['buttons'])_0x3b0266['isEnabled']=_0x337f31['enabledCommandsIds']['includes'](_0x3b0266['id']);}}),_0x157040['ui']['componentFactory']['add']('menuBar:aiCommands',_0x5a6164=>{const _0x578a43=new _0x46b15a(_0x5a6164);_0x578a43['buttonView']['set']({'label':Ni(_0x5a6164,'AI\x20Commands'),'icon':_0xc1bf03}),_0x578a43['bind']('isEnabled')['to'](_0x337f31,'enabledCommandsIds',_0x36b511=>_0x36b511['length']>0x0);const _0x586c95=bi(_0x157040['config']['get']('ai.assistant.commands'),_0x5a6164);return this['_populateMenuBarMenu'](_0x337f31,_0x578a43,_0x586c95,_0x3f1df0=>this['_onExecute'](_0x3f1df0)),_0x578a43;}),_0x157040['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x49e507=this['_createAIAssistantUIButton'](Ht);return _0x49e507['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x49e507;}),_0x157040['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x547276=this['_createAIAssistantUIButton'](Jt);return _0x547276['set']({'role':'menuitemcheckbox'}),_0x547276;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x53dc5b=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x387822;for(const _0x26fac7 in _0x53dc5b){const _0x2d09f1=_0x26fac7,_0x342e92=_0x53dc5b[_0x2d09f1];if('aiLicenseKeyValid'==_0x342e92||'aiLicenseKeyInvalid'==_0x342e92||'aiLicenseKeyExpired'==_0x342e92||'aiLicenseKeyDomainLimit'==_0x342e92||'aiLicenseKeyNotAllowed'==_0x342e92||'aiLicenseKeyEvaluationLimit'==_0x342e92||'aiLicenseKeyUsageLimit'==_0x342e92){delete _0x53dc5b[_0x2d09f1],_0x387822=_0x342e92,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x387822&&_0x53dc5b['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x387822&&_0x53dc5b['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x387822&&_0x53dc5b['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x387822&&_0x53dc5b['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x387822&&_0x53dc5b['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x387822&&_0x53dc5b['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x31a945='',_0xade1ec='',_0x4b293b='custom'){const _0x54bbf8=this['editor'],_0x3095d6=_0x54bbf8['editing']['view'],_0xa812ec=_0x54bbf8['plugins']['get'](Oi),_0x35c892=_0x54bbf8['plugins']['get'](_0x4a8643);_0xa812ec['showFakeVisualSelection']();const _0x18086d=new Qi(),_0x484a7f=new ClipboardEvent('copy',{'clipboardData':_0x18086d}),_0x18a9c2=new _0x397aa6(_0x18086d),_0xb1a4d=new _0x270a6e(_0x3095d6,_0x484a7f,{'dataTransfer':_0x18a9c2});_0x35c892['_forceMarkersCopy']('comment',()=>{_0x3095d6['document']['fire']('copy',_0xb1a4d);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Pi(_0x54bbf8,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x145686=_0x18a9c2['getData']('text/html');const _0x3c34c9=_0x54bbf8['model']['document']['selection'],_0x40dafe=Array['from'](_0x3c34c9['getRanges']());0x1===_0x40dafe['length']&&_0x40dafe[0x0]['isFlat']&&!_0x3c34c9['getSelectedElement']()&&''!==_0x145686['replace'](/&nbsp;/g,'')['trim']()&&(_0x145686='<p>'+_0x145686+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x4b293b,'query':_0x31a945,'htmlContent':_0x145686,'label':_0xade1ec,'mainActionLabel':Hi[_0x54bbf8['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x2a1746,'title':Ni(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Vt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0xa812ec['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x5d7b42=new Map(),_0x1343de=bi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x259e83 of _0x1343de)for(const _0x5c2201 of _0x259e83['commands'])_0x5d7b42['set'](_0x5c2201['id'],{..._0x5c2201,'groupId':_0x259e83['groupId'],'groupLabel':_0x259e83['groupLabel']||_0x259e83['groupId']});return _0x5d7b42;}['_createAIAssistantUIButton'](_0x88b5ef){const _0x44c867=this['editor'],_0x451828=_0x44c867['commands']['get']('showAIAssistant'),_0x1e9cae=new _0x88b5ef(_0x44c867['locale']);return _0x1e9cae['set']({'label':Ni(_0x44c867['locale'],'AI\x20Assistant'),'icon':_0x2a1746,'isToggleable':!0x0}),_0x1e9cae['bind']('isEnabled')['to'](_0x451828),_0x1e9cae['bind']('isOn')['to'](this['_dialog'],'id',_0x54a45b=>'aiAssistant'===_0x54a45b),this['listenTo'](_0x1e9cae,'execute',()=>{_0x1e9cae['isOn']?this['hideUI']():_0x451828['execute']();}),_0x1e9cae;}['_initView'](){const _0x2dfe71=this['editor']['plugins']['get'](Oi);this['_formView']=new qi(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',()=>{_0x2dfe71['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x2dfe71['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x2309ea,ui:{ariaLiveAnnouncer:_0x3ea159}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x44dc2b,_0x1ed67f,_0x49eedd)=>{const _0x298371=this['_aiAssistantController']['currentContext'];_0x49eedd?_0x3ea159['announce'](Ni(_0x2309ea,'AI\x20is\x20writing')):_0x298371&&_0x3ea159['announce'](Ni(_0x2309ea,'Generated\x20content:\x20%0',_0x298371),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x51c58c,_0x168781,_0x66a3fb)=>{if(_0x66a3fb){const _0x3b3e14=this['_formView']['errorView']['text'];_0x3ea159['announce'](Ni(_0x2309ea,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x3b3e14));}});}['_onExecute'](_0x5e0240){const _0x57db78=this['_commandDefinitions']['get'](_0x5e0240),_0x589e81=this['editor'],_0x375ac0=_0x589e81['model']['document']['selection'],_0x5a188f=_0x589e81['commands']['get']('showAIAssistant'),_0xe27754=_0x589e81['plugins']['get'](Oi),_0x354f25=''+('_ungrouppedCommands'!==_0x57db78['groupId']?_0x57db78['groupLabel']+':\x20':'')+_0x57db78['label'];if(!0x1!==_0x57db78['requiresContent']&&_0x375ac0['isCollapsed']){const _0x236816=mt(_0x375ac0['getSelectedBlocks']())||_0x589e81['model']['schema']['getLimitElement'](_0x375ac0);_0x589e81['model']['change'](_0x2aab83=>{_0x2aab83['setSelection'](_0x236816,'in');});}_0xe27754['showFakeVisualSelection'](),_0x5a188f['execute'](_0x57db78['prompt'],_0x354f25,'command:'+_0x5e0240);}['_populateMenuBarMenu'](_0x1debd0,_0x1675cb,_0x4e4746,_0x414687){const _0x28a1fb=this['editor'],_0x239e7c=_0x28a1fb['locale'],_0x491fd3=new te(_0x239e7c),_0x41dbf1=ji(_0x28a1fb,_0x4e4746)['filter'](_0x680fa5=>_0x680fa5['commands']['length']);0x1===_0x41dbf1['length']?this['_getMenuBarGroupButtons']({'command':_0x1debd0,'commands':_0x41dbf1[0x0]['commands'],'parentMenuView':_0x1675cb,'onExecute':_0x414687})['forEach'](_0x59d746=>_0x491fd3['items']['add'](_0x59d746)):_0x41dbf1['forEach'](({groupId:_0x76b8ee,groupLabel:_0xd269b2,commands:_0x2cf9ec})=>{const _0x37653a=new Zt(_0x239e7c,_0x1675cb),_0x33d25f=new _0x46b15a(_0x239e7c),_0x5bc95b=new te(_0x239e7c),_0x4c9b04=this['_getMenuBarGroupButtons']({'command':_0x1debd0,'commands':_0x2cf9ec,'parentMenuView':_0x33d25f,'onExecute':_0x414687});_0x33d25f['buttonView']['set']({'label':_0xd269b2||_0x76b8ee}),_0x33d25f['delegate']('execute')['to'](_0x1675cb),_0x5bc95b['items']['addMany'](_0x4c9b04),_0x33d25f['panelView']['children']['add'](_0x5bc95b),_0x37653a['children']['add'](_0x33d25f),_0x491fd3['items']['add'](_0x37653a);}),_0x1675cb['panelView']['children']['add'](_0x491fd3);}['_getMenuBarGroupButtons']({command:_0x185552,commands:_0x28cab1,parentMenuView:_0x259c45,onExecute:_0x4f03f6}){const _0x8aa0d7=this['editor'],_0x1ed9d5=_0x8aa0d7['locale'];return ji(_0x8aa0d7,_0x28cab1)['map'](_0x17baf2=>{const _0x904dc2=new Zt(_0x1ed9d5,_0x259c45),_0x599f21=new Jt(_0x1ed9d5);return _0x599f21['set']({'label':_0x17baf2['label']}),_0x599f21['delegate']('execute')['to'](_0x259c45),_0x599f21['on']('execute',()=>_0x4f03f6(_0x17baf2['id'])),_0x599f21['bind']('isEnabled')['to'](_0x185552,'enabledCommandsIds',_0xcee523=>_0xcee523['includes'](_0x17baf2['id'])),_0x904dc2['children']['add'](_0x599f21),_0x904dc2;});}};function zi(_0x1405b6,_0x4a5269){return void 0x0!==_0x1405b6['order']&&void 0x0===_0x4a5269['order']?0x1:void 0x0===_0x1405b6['order']&&void 0x0!==_0x4a5269['order']?-0x1:void 0x0!==_0x1405b6['order']&&void 0x0!==_0x4a5269['order']?_0x1405b6['order']-_0x4a5269['order']:0x0;}function ji(_0x1f3401,_0x4ee00d){_0x4ee00d['sort'](zi);const _0x5226d3={},_0x1c8888=[];for(const _0x39f884 of _0x4ee00d)if(void 0x0!==_0x39f884['order']){if(_0x39f884['order']in _0x5226d3)throw new ht('ai-commands-config-order-collision',_0x1f3401,{'conflictingDefinitions':[_0x39f884,_0x5226d3[_0x39f884['order']]]});_0x5226d3[_0x39f884['order']]=_0x39f884,_0x1c8888['splice'](_0x39f884['order'],0x0,_0x39f884);}else _0x1c8888['push'](_0x39f884);return _0x1c8888;}var Ji=class extends _0x2e97a8{static get['requires'](){return[Xi,Oi];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5f155d){super(_0x5f155d);const _0x324b8d=_0x5f155d['config'],_0x4c2148=_0x5f155d['locale'];_0x324b8d['define']('ai.assistant.preserveComments',!0x0),_0x324b8d['define']('ai.assistant.commands',Zi(_0x4c2148)),_0x324b8d['define']('ai.assistant.extraCommandGroups',[]),_0x324b8d['define']('ai.assistant.removeCommands',[]);let _0x50c4fd=bi(_0x324b8d['get']('ai.assistant.commands'),_0x4c2148);const _0x42fa2f=_0x324b8d['get']('ai.assistant.extraCommandGroups'),_0x3c4a0f=_0x324b8d['get']('ai.assistant.removeCommands');_0x42fa2f['forEach'](_0x39eee3=>{const _0x5109d2=_0x50c4fd['find'](_0xfb97f2=>_0xfb97f2['groupId']===_0x39eee3['groupId']);_0x5109d2?_0x5109d2['commands']=_0x5109d2['commands']['concat'](_0x39eee3['commands']):_0x50c4fd['push'](_0x39eee3);}),_0x50c4fd=_0x50c4fd['filter'](_0x435a61=>!_0x3c4a0f['includes'](_0x435a61['groupId'])),_0x50c4fd['forEach'](_0xe9ba2b=>{_0xe9ba2b['commands']=_0xe9ba2b['commands']['filter'](_0x2e1602=>!_0x3c4a0f['includes'](_0x2e1602['id']));}),_0x324b8d['set']('ai.assistant.commands',_0x50c4fd);}};function Zi(_0xecfbba){return[{'groupId':'editOrReview','groupLabel':Ni(_0xecfbba,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Ni(_0xecfbba,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Ni(_0xecfbba,'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':Ni(_0xecfbba,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Ni(_0xecfbba,'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':Ni(_0xecfbba,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Ni(_0xecfbba,'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':Ni(_0xecfbba,'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':Ni(_0xecfbba,'Change\x20tone'),'commands':[{'id':'professional','label':Ni(_0xecfbba,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Ni(_0xecfbba,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Ni(_0xecfbba,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Ni(_0xecfbba,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Ni(_0xecfbba,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Ni(_0xecfbba,'Change\x20style'),'commands':[{'id':'business','label':Ni(_0xecfbba,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Ni(_0xecfbba,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Ni(_0xecfbba,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Ni(_0xecfbba,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Ni(_0xecfbba,'Translate'),'commands':[{'id':'translateEnglish','label':Ni(_0xecfbba,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Ni(_0xecfbba,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Ni(_0xecfbba,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Ni(_0xecfbba,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Ni(_0xecfbba,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Ni(_0xecfbba,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Ni(_0xecfbba,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Ni(_0xecfbba,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var ts=class extends _0x2e97a8{['abortController'];static get['requires'](){return[vi];}constructor(_0x4b0e82){super(_0x4b0e82),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](vi)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0xac5c72){return this['sendRequest'](_0xac5c72)['catch'](_0x3ab923=>{if(_0x3ab923 instanceof ki)return Promise['reject'](_0x3ab923);if('AbortError'==_0x3ab923['name'])return Promise['resolve']();throw console['error'](_0x3ab923),new ht('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x3e3dda,_0x3512e1){const _0x5e3e5a=this['editor']['locale'],_0x3a3bb6={'Content-Type':'application/json'};if('object'==typeof _0x3e3dda)Object['assign'](_0x3a3bb6,_0x3e3dda);else{if(_0x3e3dda)try{const _0x2aeb03=await _0x3e3dda(_0x3512e1);Object['assign'](_0x3a3bb6,_0x2aeb03);}catch{return Promise['reject'](new ki(Ni(_0x5e3e5a,'AI_ERROR_GET_HEADERS')));}}return _0x3a3bb6;}async['_prepareRequestParameters'](_0x2c0dea,_0x48b6f9){const _0x30e3f1=this['editor']['locale'];if('object'==typeof _0x2c0dea)return _0x2c0dea;try{return await _0x2c0dea(_0x48b6f9);}catch{return Promise['reject'](new ki(Ni(_0x30e3f1,'AI_ERROR_GET_PARAMETERS')));}}},es=class extends ts{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x16fa26){super(_0x16fa26),_0x16fa26['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x16fa26['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x16fa26['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x16fa26['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x16fa26['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x16fa26['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x3b0829,context:_0x3a37d9,onData:_0x4cd360,actionId:_0xc72b7d}){const _0x5269ea=this['editor']['locale'],_0x15562f=await this['prepareMessages'](_0x3b0829,_0x3a37d9,_0xc72b7d),_0x115fcb=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0xc72b7d),_0x2ca482=await this['_prepareRequestParameters'](this['_requestParameters'],_0xc72b7d),_0x10852c={'messages':_0x15562f,..._0x2ca482},_0x1814b2={'method':'POST','headers':_0x115fcb,'body':JSON['stringify'](_0x10852c),'signal':this['abortController']['signal']},_0x402707=await fetch(this['_apiUrl'],_0x1814b2);if(_0x402707['ok'])return _0x2ca482['stream']?await this['_readStreamableResponse'](_0x402707,_0x4cd360):await this['_readStaticResponse'](_0x402707,_0x4cd360),Promise['resolve']();{const _0x2870c1=await _0x402707['text']();return _0x2870c1['includes']('context_length_exceeded')?Promise['reject'](new ki(Ni(_0x5269ea,'AI_ERROR_CONTEXT_LENGTH'))):_0x2870c1['includes']('Moderation')?Promise['reject'](new ki(Ni(_0x5269ea,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x2870c1));}}async['prepareMessages'](_0x29cc9c,_0x18cfa1,_0x4c3b89){let _0x107b46,_0x236ad1;return _0x18cfa1?(_0x107b46='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.',_0x236ad1='Instruction:\x0a'+_0x29cc9c+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x18cfa1):(_0x107b46='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.',_0x236ad1=_0x29cc9c),[{'role':'system','content':_0x107b46},{'role':'user','content':_0x236ad1}];}async['_readStreamableResponse'](_0x50a252,_0x34cb50){const _0x13fd48=_0x50a252['body']['getReader'](),_0x5a5b8d=new TextDecoder();let _0x3f9909='',_0x2f5995='',_0x333102='',_0x27b041=!0x1;for(;!_0x27b041;){const {done:_0x40c994,value:_0x598d83}=await _0x13fd48['read'](),_0x48c098=_0x3f9909+_0x5a5b8d['decode'](_0x598d83);let _0x40a7fb='';_0x27b041=_0x40c994;try{_0x40a7fb=this['_cleanUpData'](_0x48c098),_0x3f9909='';}catch{_0x3f9909=_0x48c098;continue;}_0x2f5995+=_0x40a7fb,!_0x27b041&&this['_isBufferIncomplete'](_0x2f5995)||_0x2f5995&&(_0x333102+=_0x2f5995,_0x2f5995='',_0x34cb50(_0x333102));}return Promise['resolve']();}async['_readStaticResponse'](_0x187de0,_0x2f73e0){return _0x2f73e0((await _0x187de0['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x6023c2){const _0x5908b3=_0x6023c2['split']('<')['length']!==_0x6023c2['split']('>')['length'],_0xc83fd0=_0x6023c2['length']<0x1e;return _0x5908b3&&_0xc83fd0;}['_cleanUpData'](_0x179936){return _0x179936['split'](/\n(?![^{]*\})/g)['map'](_0x4f78a8=>_0x4f78a8['replace']('data:\x20',''))['filter'](_0x8575da=>_0x8575da&&_0x8575da['length']>0x0&&'[DONE]'!==_0x8575da)['map'](_0x12f0b9=>{const {choices:_0x277222}=JSON['parse'](_0x12f0b9);if(_0x277222[0x0]?.['delta']?.['content'])return _0x277222[0x0]['delta']['content'];})['filter'](_0x49b04e=>_0x49b04e)['join']('');}},is=class extends ts{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),bt('ai-aws-adapter-not-supported');}async['sendRequest'](_0x385d3b){throw ft('ai-aws-adapter-not-supported'),new ki(Ni(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},ss=class extends Ht{constructor(_0xc36a50,_0x176390={}){super(_0xc36a50),this['isToggleable']=!0x0,this['set']('side',_0x176390['side']||'top');const _0x128340=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...Ot(_0x176390['class']||[]),_0x128340['to']('side',_0x19ed1c=>'ck-tab-button_'+_0x19ed1c),_0x128340['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ns=class extends _0x3b0eb8{['children'];constructor(_0xe9b12,_0x4bcf4d={}){super(_0xe9b12);const _0x2706b3=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...Ot(_0x4bcf4d['class']||[]),_0x2706b3['to']('class'),_0x2706b3['if']('isVisible','ck-hidden',_0x310d65=>!_0x310d65)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},rs=class extends _0x3b0eb8{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x2df6b0,_0x4bd5be={}){super(_0x2df6b0),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x4bd5be['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x4bd5be['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x2e25b6,_0x3bb4e7)=>_0x2e25b6&&!_0x3bb4e7);const _0x175ab5=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...Ot(_0x4bd5be['class']||[]),_0x175ab5['to']('side',_0x3f1ebe=>'ck-tabs_'+_0x3f1ebe),_0x175ab5['to']('class'),_0x175ab5['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x175ab5['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x175ab5['to']('side',_0x24b6a6=>'ck-tabs__buttons-container_'+_0x24b6a6)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x175ab5['to']('side',_0xc9b545=>'ck-tabs__panels-container_'+_0xc9b545)]},'children':this['panelViews']},...Ot(_0x4bd5be['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x3af461){const _0x250750=this['_tabs']['get'](_0x3af461);return _0x250750||null;}['addTab'](_0x218b23){const _0x430b61=this['_setupButton']({'id':_0x218b23['id'],'label':_0x218b23['buttonLabel'],'icon':_0x218b23['buttonIcon'],'order':_0x218b23['order']}),_0x3d5900=new ns(this['locale']);return _0x3d5900['render'](),_0x218b23['content']&&_0x3d5900['children']['add'](_0x218b23['content']),this['panelViews']['add'](_0x3d5900),this['_tabs']['set'](_0x218b23['id'],{'button':_0x430b61,'panel':_0x3d5900,'order':void 0x0!==_0x218b23['order']?_0x218b23['order']:null}),this['fire']('addTab:'+_0x218b23['id'],{'id':_0x218b23['id'],'button':_0x430b61,'panel':_0x3d5900}),null===this['activeTab']?this['activateTab'](_0x218b23['id']):this['_hidePanel'](_0x218b23['id']),{'button':_0x430b61,'panel':_0x3d5900};}['activateTab'](_0x573473){if(null!==_0x573473&&!this['getTab'](_0x573473))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x573473});if(this['isCollapsed']=!0x1,this['activeTab']===_0x573473)return;const _0x347893=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x573473,_0x573473&&this['_showPanel'](_0x573473),this['fire']('activateTab:'+_0x573473,{'newTab':_0x573473,'oldTab':_0x347893});}['toggleTabPanel'](_0x12c023){this['activeTab']===_0x12c023?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x12c023);}['showTab'](_0x10cc13){if(!this['getTab'](_0x10cc13))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x10cc13});this['_showPanel'](_0x10cc13),this['_showButton'](_0x10cc13),this['fire']('show:'+_0x10cc13,_0x10cc13);}['hideTab'](_0x25dbe1){if(!this['getTab'](_0x25dbe1))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x25dbe1});const _0x3383b3=this['activeTab'];this['_hidePanel'](_0x25dbe1),this['_hideButton'](_0x25dbe1);const _0x37cc27=this['getTabIds']();_0x3383b3===_0x25dbe1&&_0x37cc27['length']>0x1&&this['activateTab'](_0x37cc27['find'](_0x1fbe93=>_0x1fbe93!==_0x25dbe1)),this['fire']('hide:'+_0x25dbe1,_0x25dbe1);}['_getPanel'](_0x2092cf){const _0x264a06=this['_tabs']['get'](_0x2092cf);return _0x264a06?_0x264a06['panel']:null;}['_showPanel'](_0x2a556e){null!==this['activeTab']&&this['activeTab']!==_0x2a556e||this['_getPanel'](_0x2a556e)['show']();}['_hidePanel'](_0x2c330e){const _0x158f55=this['_getPanel'](_0x2c330e);_0x158f55['isVisible']&&(this['activeTab']===_0x2c330e&&(this['activeTab']=null),_0x158f55['hide']());}['_getButton'](_0x1365a0){const _0xf04a6d=this['_tabs']['get'](_0x1365a0);return _0xf04a6d?_0xf04a6d['button']:null;}['_showButton'](_0x50321e){this['_getButton'](_0x50321e)['show']();}['_hideButton'](_0x50340e){this['_getButton'](_0x50340e)['hide']();}['_setupButton'](_0x2da934){const _0xa32245=new ss(this['locale'],{'side':this['side']}),_0x5c634d=this['buttonViews'];if(_0xa32245['set']({'label':_0x2da934['label'],'icon':_0x2da934['icon'],'tooltip':!0x0,'withText':!0x0}),_0xa32245['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x25e71a,_0x5eb8ae)=>_0x25e71a===_0x2da934['id']&&!_0x5eb8ae),_0xa32245['bind']('side')['to'](this,'side'),_0x2da934['order']){const _0x216e83=[...this['_tabs']]['reduce']((_0x2edb55,_0x5efd0c)=>{const _0x598771=_0x5efd0c[0x0],{order:_0x29e0ea}=_0x5efd0c[0x1];return!_0x29e0ea||_0x29e0ea>_0x2da934['order']?_0x2edb55:_0x29e0ea>=_0x2edb55['order']?{'id':_0x598771,'order':_0x29e0ea}:_0x2edb55;},{'id':'','order':0x0}),_0x5b83f7=_0x5c634d['getIndex'](this['_getButton'](_0x216e83['id']));_0x5c634d['add'](_0xa32245,_0x5b83f7+0x1);}else _0x5c634d['add'](_0xa32245);return _0xa32245['on']('execute',()=>{this['toggleTabPanel'](_0x2da934['id']);}),_0xa32245;}};const os=['overlay','sidebar','custom'],as=['left','right'];var hs=class extends rs{constructor(_0x27e7b6,_0x5cfdcd={}){super(_0x27e7b6,_0x5cfdcd),this['set']('type',_0x5cfdcd['type']||'sidebar'),this['set']('side',_0x5cfdcd['side']||'right'),this['set']('isVisible',_0x5cfdcd['visibleByDefault']??!0x0);const _0x4a22db=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x4a22db['if']('type','ck-ai-tabs__overlay',_0xe580fd=>'overlay'===_0xe580fd),_0x4a22db['if']('type','ck-ai-tabs__sidebar',_0x2ea57d=>'sidebar'===_0x2ea57d),_0x4a22db['if']('isVisible','ck-hidden',_0x421ec8=>!_0x421ec8)]}}),this['buttonViews']['on']('add',(_0x4586a9,_0x1b4114)=>{_0x1b4114['set']('withText',!0x1);});}},cs=class extends _0xe5ed07{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x471d13){if(super(_0x471d13),!this['context']['config']['get']('ai.container'))throw new ht('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x2caba3=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x2caba3['showResizeButton']&&(this['showResizeButton']=_0x2caba3['showResizeButton']),'sidebar'!==_0x2caba3['type']&&'overlay'!==_0x2caba3['type']||_0x2caba3['side']&&(this['side']=_0x2caba3['side']),'sidebar'===_0x2caba3['type']){if(this['container']=_0x2caba3['element'],this['set']('type','sidebar'),!this['container'])throw new ht('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x2caba3['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new hs(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x2caba3['visibleByDefault'],'collapsible':_0x2caba3['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 _0xbe1e8b&&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'](_0x155eb0){if(_0x155eb0&&this['type']!==_0x155eb0){if(!os['includes'](_0x155eb0))throw new ht('ai-tabs-unsupported-ui-type');this['type']=_0x155eb0;}}['switchSide'](_0x441014){if(_0x441014&&this['side']!==_0x441014){if(!as['includes'](_0x441014))throw new ht('ai-tabs-unsupported-ui-side');this['side']=_0x441014;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}},ls=class extends _0xe5ed07{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x124f03];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x348e1c){if(super(_0x348e1c),this['context']['config']['define']('ai.serviceUrl','https://ai.cke-cs.com/v1'),this['_apiUrl']=this['context']['config']['get']('ai.serviceUrl')['replace'](/\/+$/,''),!this['_apiUrl']['endsWith']('/v1'))throw new ht('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder(),this['_responseCache']=new Map();}['init'](){const _0x3a7ba6=this['context']['plugins']['get'](_0x124f03);if(!_0x3a7ba6['token'])throw new ht('ai-missing-token',this);this['_token']=_0x3a7ba6['token'];}['startConversation'](_0x2d31f5,_0x16345d){const _0x23d45b=this['_sendApiRequest']('/conversations','POST',{'id':_0x2d31f5,'group':_0x16345d});return{'getConversation':async()=>(await _0x23d45b['request'])['json'](),'abortController':_0x23d45b['abortController']};}['queryAssistant']({message:_0x3f8d72,conversationId:_0x116f3e,parts:_0x28b5b2,capabilities:_0x4f5cd9,model:_0x13c8af,attributes:_0x421dec}){const _0x286ba={'prompt':_0x3f8d72,'content':_0x28b5b2,'model':_0x13c8af,..._0x4f5cd9&&{'capabilities':_0x4f5cd9},..._0x421dec&&{'attributes':_0x421dec}},_0x1b639f=this['_sendApiRequest']('/conversations/'+_0x116f3e+'/messages','POST',_0x286ba,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x987fa5=(await _0x1b639f['request'])['body'];return this['_getStreamReader'](_0x987fa5);},'abortController':_0x1b639f['abortController']};}['executeCustomAction']({content:_0x21218f,message:_0x5e8e62,model:_0x445ad6,outputFormat:_0x3ea7d6}){const _0x29769e={'content':[{'type':'text','content':_0x21218f}],'prompt':_0x5e8e62,'model':_0x445ad6,'outputFormat':_0x3ea7d6},_0x5bdbf4=this['_sendApiRequest']('/actions/custom/calls','POST',_0x29769e);return{'getStream':async()=>{const _0x253116=(await _0x5bdbf4['request'])['body'];return this['_getStreamReader'](_0x253116);},'abortController':_0x5bdbf4['abortController']};}['executeAction']({actionName:_0x4e0245,content:_0x2a4f1f,args:_0x4a0cdc}){const _0x559ddc={'content':[{'type':'text','content':_0x2a4f1f}],'args':_0x4a0cdc},_0x54fb2e=this['_sendApiRequest']('/actions/system/'+_0x4e0245+'/calls','POST',_0x559ddc);return{'getStream':async()=>{const _0x2a20bc=(await _0x54fb2e['request'])['body'];return this['_getStreamReader'](_0x2a20bc);},'abortController':_0x54fb2e['abortController']};}['uploadFile'](_0x3b14b6,_0x478ff8,_0x3e67a9){const _0x3c284b=new FormData();_0x3c284b['append']('file',_0x478ff8,_0x478ff8['name']),_0x3e67a9&&_0x3c284b['append']('attributes',JSON['stringify'](_0x3e67a9));const _0x2cc8c9=this['_sendApiRequest']('/conversations/'+_0x3b14b6+'/files','POST',_0x3c284b);return{'getId':async()=>(await _0x2cc8c9['request'])['json'](),'abortController':_0x2cc8c9['abortController']};}['uploadDocuments'](_0x16f79c,_0x53fd5b){const _0x2283ae={'documents':_0x53fd5b['map'](_0x5b9a18=>({'content':_0x5b9a18['content'],'attributes':{'version':_0x5b9a18['version'],'sessionId':_0x5b9a18['sessionId'],'channelId':_0x5b9a18['channelId'],'rootName':_0x5b9a18['rootName'],'selections':_0x5b9a18['selections']},...void 0x0!==_0x5b9a18['name']?{'name':_0x5b9a18['name']}:{},...void 0x0!==_0x5b9a18['description']?{'description':_0x5b9a18['description']}:{}}))},_0x127fc8=this['_sendApiRequest']('/conversations/'+_0x16f79c+'/documents/batch','POST',_0x2283ae);return{'getIds':async()=>(await _0x127fc8['request'])['json'](),'abortController':_0x127fc8['abortController']};}['fetchDocuments'](_0x51b144,_0x3e72f){const _0x21ee30=new URLSearchParams();_0x21ee30['append']('documentIds',_0x3e72f['join'](','));const _0x7e6800=this['_sendApiRequest']('/conversations/'+_0x51b144+'/documents/batch?'+_0x21ee30['toString'](),'GET');return{'getDocuments':async()=>(await _0x7e6800['request'])['json'](),'abortController':_0x7e6800['abortController']};}['fetchConversations'](_0x2cdb0d,_0x2ba159={}){const _0xaad906=new URLSearchParams();_0xaad906['append']('group',_0x2cdb0d),_0xaad906['append']('excludeEmpty',!0x1!==_0x2ba159['excludeEmpty']?'true':'false'),_0xaad906['append']('limit',_0x2ba159['limit']?_0x2ba159['limit']['toString']():'100'),_0xaad906['append']('sortBy',_0x2ba159['sortBy']?_0x2ba159['sortBy']:'createdAt'),_0xaad906['append']('order',_0x2ba159['order']?_0x2ba159['order']:'desc');const _0x5f2289=this['_sendApiRequest']('/conversations?'+_0xaad906['toString'](),'GET');return{'getConversations':async()=>(await(await _0x5f2289['request'])['json']())['items'],'abortController':_0x5f2289['abortController']};}['deleteConversation'](_0x1bfb24){const _0x11c99d=this['_sendApiRequest']('/conversations/'+_0x1bfb24,'DELETE');return{'execute':async()=>{await _0x11c99d['request'];},'abortController':_0x11c99d['abortController']};}['updateConversation'](_0x291e0c,_0x52142e){const _0x385eb1=this['_sendApiRequest']('/conversations/'+_0x291e0c,'PATCH',_0x52142e);return{'getResult':async()=>(await _0x385eb1['request'],_0x52142e),'abortController':_0x385eb1['abortController']};}['fetchConversation'](_0x55e144){const _0x55b344=this['_sendApiRequest']('/conversations/'+_0x55e144,'GET');return{'getConversation':async()=>(await _0x55b344['request'])['json'](),'abortController':_0x55b344['abortController']};}['fetchConversationMessages'](_0x2bf107){const _0x744146=this['_sendApiRequest']('/conversations/'+_0x2bf107+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x744146['request'])['json']())['items'],'abortController':_0x744146['abortController']};}['uploadUrl'](_0x448a0e,_0xebcb17,_0x249140){const _0x2fe7d8=this['_sendApiRequest']('/conversations/'+_0x448a0e+'/web-resources','POST',{'url':_0xebcb17,'attributes':_0x249140});return{'getId':async()=>(await _0x2fe7d8['request'])['json'](),'abortController':_0x2fe7d8['abortController']};}['getModels'](_0x179a08='en'){const _0x347c0b=new URLSearchParams();_0x347c0b['append']('language',_0x179a08);const _0x1886b1='/models/1?'+_0x347c0b['toString'](),_0x4bb1ce=this['_sendApiRequest'](_0x1886b1,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0x4bb1ce['request'])['json'](),'abortController':_0x4bb1ce['abortController']};}['deleteFile'](_0x16e11d,_0x25a34b){const _0x1f759e=this['_sendApiRequest']('/conversations/'+_0x16e11d+'/files/'+_0x25a34b,'DELETE');return{'execute':async()=>{await _0x1f759e['request'];},'abortController':_0x1f759e['abortController']};}['deleteDocument'](_0x4a2749,_0x3bd4fc){const _0xe05557=this['_sendApiRequest']('/conversations/'+_0x4a2749+'/documents/'+_0x3bd4fc,'DELETE');return{'execute':async()=>{await _0xe05557['request'];},'abortController':_0xe05557['abortController']};}['deleteWebResource'](_0x30739e,_0x41a698){const _0x3febe0=this['_sendApiRequest']('/conversations/'+_0x30739e+'/web-resources/'+_0x41a698,'DELETE');return{'execute':async()=>{await _0x3febe0['request'];},'abortController':_0x3febe0['abortController']};}['cancelStream'](_0x462cce,_0x423fe9){const _0x65361b=this['_sendApiRequest']('/conversations/'+_0x462cce+'/messages/'+_0x423fe9+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x65361b['request'];},'abortController':_0x65361b['abortController']};}['resumeStream'](_0x1770c0,_0x1c766c,_0x2b0201='0-0'){const _0x37eebb=new URLSearchParams({'lastEventId':_0x2b0201}),_0x5d63ee=this['_sendApiRequest']('/conversations/'+_0x1770c0+'/messages/'+_0x1c766c+'/stream?'+_0x37eebb['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x49ba54=await _0x5d63ee['request'];return this['_getStreamReader'](_0x49ba54['body']);},'abortController':_0x5d63ee['abortController']};}['callSystemReview']({reviewName:_0x42e3d7,content:_0x5b2dcc,args:_0x1ef8e9}){const _0xd02551=this['_sendApiRequest']('/reviews/system/'+_0x42e3d7+'/calls','POST',{'content':[{'type':'text','content':_0x5b2dcc}],'args':_0x1ef8e9});return{'getStream':async()=>{const _0x25f2f0=(await _0xd02551['request'])['body'];return this['_getStreamReader'](_0x25f2f0);},'abortController':_0xd02551['abortController']};}['processDocument']({document:_0x1fef94,prompt:_0x377128,model:_0x15745d}){const _0x17bb29=this['_sendApiRequest']('/documents/process','POST',{'document':_0x1fef94,'prompt':_0x377128,'model':_0x15745d});return{'getResult':async()=>(await _0x17bb29['request'])['json'](),'abortController':_0x17bb29['abortController']};}['callCustomReview']({content:_0xde9f5f,prompt:_0x15f935,model:_0x3e810d}){const _0x8a1b45=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0xde9f5f}],'prompt':_0x15f935,'model':_0x3e810d});return{'getStream':async()=>{const _0x4f67e5=(await _0x8a1b45['request'])['body'];return this['_getStreamReader'](_0x4f67e5);},'abortController':_0x8a1b45['abortController']};}['upsertAIChatRating'](_0x1d06b8,_0x583d67,_0xd29bae){const _0x401831=this['_sendApiRequest']('/conversations/'+_0x1d06b8+'/messages/'+_0x583d67+'/ratings','PUT',{'positiveCount':_0xd29bae['positiveCount'],'totalCount':_0xd29bae['totalCount'],'modificationId':_0xd29bae['modificationId']});return{'execute':async()=>{await _0x401831['request'];},'abortController':_0x401831['abortController']};}['upsertAIActionRating'](_0x244164,_0x2d2fef,_0x100bed){const _0x511b4d=this['_sendApiRequest']('/actions/system/'+_0x244164+'/calls/'+_0x2d2fef+'/ratings','PUT',{'positiveCount':_0x100bed['positiveCount'],'totalCount':_0x100bed['totalCount']});return{'execute':async()=>{await _0x511b4d['request'];},'abortController':_0x511b4d['abortController']};}['upsertCustomAIActionRating'](_0x32c525,_0x487891){const _0x5d1734=this['_sendApiRequest']('/actions/custom/calls/'+_0x32c525+'/ratings','PUT',{'positiveCount':_0x487891['positiveCount'],'totalCount':_0x487891['totalCount']});return{'execute':async()=>{await _0x5d1734['request'];},'abortController':_0x5d1734['abortController']};}['upsertAIReviewRating'](_0x2faad1,_0x30423a,_0x1c390b,_0x130125){const _0x3df4d6=this['_sendApiRequest']('/reviews/system/'+_0x2faad1+'/calls/'+_0x30423a+'/ratings','PUT',{'positiveCount':_0x1c390b['positiveCount'],'totalCount':_0x1c390b['totalCount'],'dataId':_0x130125});return{'execute':async()=>{await _0x3df4d6['request'];},'abortController':_0x3df4d6['abortController']};}['upsertCustomAIReviewRating'](_0x273dec,_0x557b49,_0x4c7519){const _0x4398c1=this['_sendApiRequest']('/reviews/custom/calls/'+_0x273dec+'/ratings','PUT',{'positiveCount':_0x557b49['positiveCount'],'totalCount':_0x557b49['totalCount'],'dataId':_0x4c7519});return{'execute':async()=>{await _0x4398c1['request'];},'abortController':_0x4398c1['abortController']};}['_sendApiRequest'](_0x4e5efe,_0xe0f7bc,_0x423fd3,_0x81a8e7={}){const {useCache:_0x6bf416=!0x1,apiUrl:_0x586bde=this['_apiUrl']}=_0x81a8e7,_0x11b883=new AbortController(),_0xbb9261=_0x6bf416?_0xe0f7bc+':'+_0x4e5efe:null;if(_0xbb9261){const _0x1c28ff=this['_responseCache']['get'](_0xbb9261);if(_0x1c28ff)return{'request':_0x1c28ff['then'](_0x12dfd3=>_0x12dfd3['clone']()),'abortController':_0x11b883};}const _0x5e0e3f=_0x423fd3 instanceof FormData,_0x335c7f={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':kt};_0x423fd3&&!_0x5e0e3f&&(_0x335c7f['Content-Type']='application/json');const _0x377913={'method':_0xe0f7bc,'headers':_0x335c7f,'signal':_0x11b883['signal']};_0x423fd3&&(_0x377913['body']=_0x5e0e3f?_0x423fd3:JSON['stringify'](_0x423fd3));const _0x2dea6b=fetch(''+_0x586bde+_0x4e5efe,_0x377913)['catch'](_0xf40a86=>{_0xbb9261&&this['_responseCache']['delete'](_0xbb9261),this['_handleError'](_0xf40a86);})['then'](_0x53b8ae=>_0x53b8ae['ok']?_0x53b8ae:_0x53b8ae['json']()['then'](_0x27c884=>{throw _0xbb9261&&this['_responseCache']['delete'](_0xbb9261),{'url':_0x586bde,'path':_0x4e5efe,'method':_0xe0f7bc,'body':_0x423fd3,'status':(_0x53b8ae||{})['status'],'statusText':(_0x53b8ae||{})['statusText'],'code':_0x27c884['code'],'message':_0x27c884['message'],'traceId':_0x27c884['traceId']};}));return _0xbb9261&&this['_responseCache']['set'](_0xbb9261,_0x2dea6b['then'](_0x200a6c=>_0x200a6c['clone']())),{'request':_0x2dea6b,'abortController':_0x11b883};}async*['_getStreamReader'](_0x51aa75){const _0x1cd56b=[],_0xa55eda=_0x51aa75['getReader'](),_0x3a7da8=_0x324165({'onError':_0x168124=>{this['_handleError'](_0x168124);},'onEvent':_0x5ee5c2=>{_0x5ee5c2['data']=JSON['parse'](_0x5ee5c2['data']),_0x1cd56b['push'](_0x5ee5c2);}});try{let _0x5d54a5=!0x1;for(;!_0x5d54a5;){const {done:_0x2badd4,value:_0x3b5235}=await _0xa55eda['read']();_0x2badd4&&(_0x5d54a5=!0x0),_0x3a7da8['feed'](this['_decoder']['decode'](_0x3b5235,{'stream':!0x0})),yield*_0x1cd56b,_0x1cd56b['length']=0x0;}}catch(_0x4b7668){this['_handleError'](_0x4b7668);}finally{_0xa55eda['releaseLock'](),_0x3a7da8['reset']();}}['_handleError'](_0x4af628){if(_0x4af628 instanceof ht)throw _0x4af628;if(_0x4af628 instanceof Error&&'AbortError'===_0x4af628['name'])throw new ht('ai-request-aborted',this,{'originalError':_0x4af628});throw new ht('ai-request-failed',this,{'originalError':_0x4af628});}};function us(_0x7b949f,_0x1b135b,_0x53b9c2){const t=_0x7b949f['t'];switch(_0x1b135b){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'},_0x53b9c2);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.'},_0x53b9c2);case'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED':return t({'id':'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED','string':'Folders\x20cannot\x20be\x20added\x20to\x20the\x20chat.\x20Try\x20adding\x20individual\x20files\x20instead.'});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.'},_0x53b9c2);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_PASTED_TEXT_NAME':return t({'id':'AI_CHAT_CONTEXT_PASTED_TEXT_NAME','string':'Pasted\x20Text'});case'AI_CHAT_DROP_ZONE_HINT':return t({'id':'AI_CHAT_DROP_ZONE_HINT','string':'Drop\x20files\x20here\x20to\x20add\x20to\x20the\x20chat'});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.'},_0x53b9c2);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'},_0x53b9c2);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x53b9c2);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'},_0x53b9c2);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.'},_0x53b9c2);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.'},_0x53b9c2);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.'},_0x53b9c2);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.'},_0x53b9c2);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'},_0x53b9c2);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.'},_0x53b9c2);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 _0x1b135b;}}function ds(_0x34b235){return _0x34b235?_0x34b235 instanceof _0xbe1e8b?[_0x34b235]:_0x34b235['editors']&&0x0!==_0x34b235['editors']['length']?Array['from'](_0x34b235['editors']):[]:[];}function _s(_0x220536){const _0xb6218=ds(_0x220536);if(!_0xb6218['length'])throw new ht('ai-get-editor-from-context-no-editor');if(0x1===_0xb6218['length'])return _0xb6218[0x0];const _0x53370d=_0xb6218['find'](_0x980c50=>_0x980c50['ui']?.['focusTracker']?.['isFocused']);if(_0x53370d)return _0x53370d;const _0xe908c0=function(_0x399810){if(_0x399810 instanceof _0xbe1e8b)return;const _0x418827=_0x399810;if(!_0x418827['plugins']||!_0x418827['plugins']['has']('AIEditing'))return;return _0x418827['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x220536);return _0xe908c0&&_0xb6218['includes'](_0xe908c0)?_0xe908c0:_0xb6218[0x0];}const gs='ai-selection',As=['br'];var Is=class extends _0xe5ed07{constructor(_0x56bc67){super(_0x56bc67),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}['_outputDataProcessor'];['_fakeSelections']=[];['_sessionIdByEditor']=new WeakMap();['_lastContentFocusedEditor'];static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['getLastContentFocusedEditor'](){return this['_lastContentFocusedEditor'];}['getSessionId'](_0x4a8291){let _0x5ec5e1=this['_sessionIdByEditor']['get'](_0x4a8291);return _0x5ec5e1||(_0x5ec5e1=_0x4a8291['plugins']['has']('RealTimeCollaborationClient')&&_0x4a8291['plugins']['get']('RealTimeCollaborationClient')['sessionId']||vt(),this['_sessionIdByEditor']['set'](_0x4a8291,_0x5ec5e1)),_0x5ec5e1;}async['getDocumentData'](){const _0x70eb4a=ds(this['context']);if(!_0x70eb4a['length'])throw new ht('ai-get-editor-from-context-no-editor');const _0x3451a7=[],_0x3bd030=new Set();for(const _0x18a6b9 of _0x70eb4a){const _0x19f289=_0x18a6b9['config']['get']('roots')||{};for(const _0x5db1c6 of _0x18a6b9['model']['document']['getRoots']()){if('$graveyard'===_0x5db1c6['rootName'])continue;const _0x486ff1=await this['_getDocumentDataForEditorRoot'](_0x18a6b9,_0x5db1c6,_0x3bd030),_0x5223c6=_0x19f289[_0x5db1c6['rootName']],_0x37ea78=_0x5db1c6['getAttribute']('$description')??_0x5223c6?.['description'];let _0x7fb35f=_0x5db1c6['getAttribute']('$title')??_0x5223c6?.['title'];_0x7fb35f||(_0x7fb35f=_0x5db1c6['getAttribute']('$rootEditableOptions')?.['label']??_0x5223c6?.['label']),_0x7fb35f||(bt('ai-document-root-missing-title',{'editor':_0x18a6b9,'rootName':_0x5db1c6['rootName']}),_0x7fb35f=_0x5db1c6['rootName']),_0x3451a7['push']({'editor':_0x18a6b9,'rootName':_0x5db1c6['rootName'],'content':_0x486ff1['content'],'version':_0x486ff1['version'],'sessionId':this['getSessionId'](_0x18a6b9),'channelId':_0x18a6b9['config']['get']('collaboration.channelId'),'selections':_0x486ff1['selections'],'name':_0x7fb35f,'description':_0x37ea78});}}return _0x3451a7;}async['_getDocumentDataForEditorRoot'](_0x2cc0d7,_0x4b6466,_0x28504a){const _0xad825b=_0x2cc0d7['data']['toView'](_0x4b6466,{'convertAiChatSelectionMarker':!0x0}),_0x35a260=new _0x3045c8(_0x2cc0d7['editing']['view']['document']);this['_setDataIdsOnChildren'](_0xad825b,_0x35a260,_0x28504a);let _0x49aba5=await this['_getDocumentDataStringFromView'](_0xad825b,_0x2cc0d7);const _0x2364cc=this['_getMarkersInDocumentOrder'](_0x2cc0d7,_0x4b6466),_0x457dd8=[];for(const _0x674941 of _0x2364cc){const _0xac3e0f='<'+_0x674941['name']+':start></'+_0x674941['name']+':start>',_0x54aea6=_0x49aba5['indexOf'](_0xac3e0f);_0x49aba5=_0x49aba5['substring'](0x0,_0x54aea6)+_0x49aba5['substring'](_0x54aea6+_0xac3e0f['length']);const _0x201f28='<'+_0x674941['name']+':end></'+_0x674941['name']+':end>',_0x79c2b1=_0x49aba5['indexOf'](_0x201f28);_0x49aba5=_0x49aba5['substring'](0x0,_0x79c2b1)+_0x49aba5['substring'](_0x79c2b1+_0x201f28['length']),_0x457dd8['push']({'markerName':_0x674941['name'],'start':_0x54aea6,'end':_0x79c2b1,'htmlFragment':_0x49aba5['substring'](_0x54aea6,_0x79c2b1)});}return{'content':_0x49aba5,'version':_0x2cc0d7['model']['document']['version'],'selections':_0x457dd8};}['afterInit'](){this['context']instanceof _0xbe1e8b?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x22e451,_0x2c7f8f)=>{_0x2c7f8f['on']('ready',()=>{this['_integrateEditor'](_0x2c7f8f);});});}['_setOutputDataProcessor'](_0x46c673){this['_outputDataProcessor']=_0x46c673;}async['_getDocumentDataStringFromView'](_0x42b0f0,_0x48cce9){let _0x255166;if(this['_outputDataProcessor']){const _0x4a243a=_0x48cce9['data']['processor']['domConverter']['viewToDom'](_0x42b0f0),_0x571702=await this['_outputDataProcessor'](_0x4a243a);_0x255166=_0x48cce9['data']['processor']['htmlWriter']['getHtml'](_0x571702);}else _0x255166=_0x48cce9['data']['processor']['toData'](_0x42b0f0);return _0x255166;}['_integrateEditor'](_0x3c0e9d){if(!_0x3c0e9d['config']['get']('collaboration.channelId'))throw new ht('ai-missing-channel-id',_0x3c0e9d);_0x3c0e9d['ui']['focusTracker']['on']('change:isFocused',(_0x57937e,_0x305f7c,_0xb44cad)=>{_0xb44cad&&(this['_lastContentFocusedEditor']=_0x3c0e9d);}),_0x3c0e9d['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x3c0e9d&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x3c0e9d['conversion']['for']('editingDowncast')['markerToHighlight']({'model':gs,'view':({markerName:_0x1b9027})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x1b9027['split'](':')[0x1]],'priority':0xc})}),_0x3c0e9d['conversion']['for']('dataDowncast')['markerToElement']({'model':gs+':context','view':(_0x2f53dd,{writer:_0x4b8941,options:_0x244157})=>_0x244157['convertAiChatSelectionMarker']?_0x4b8941['createUIElement'](_0x2f53dd['markerName']+':'+(_0x2f53dd['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x4a0a61){const _0x533ba5=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x4a0a61);const _0x765fda=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x533ba5,_0x765fda);}['hideFakeVisualSelection'](_0x1a7084){const _0x39fe1f=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x1a7084);const _0x5f48b9=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x39fe1f,_0x5f48b9);}async['modelToDataWithIds'](_0xb2a2d8,_0x3c9e07){const _0x582b4c=_0x3c9e07['data']['toView'](_0xb2a2d8),_0x2c0dfd=new _0x3045c8(_0x3c9e07['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x582b4c,_0x2c0dfd),this['_getDocumentDataStringFromView'](_0x582b4c,_0x3c9e07);}['_setDataIdsOnChildren'](_0x18561b,_0x746a63,_0x3582bf=new Set()){let _0x346df8=!0x1;for(const _0x5a14bc of _0x18561b['getChildren']()){if(!_0x5a14bc['is']('view:element')||As['includes'](_0x5a14bc['name']))continue;const _0x293627=_0x5a14bc['is']('view:containerElement'),_0x1ad741=_0x5a14bc['is']('view:emptyElement'),_0x4743ba=_0x5a14bc['is']('view:rawElement'),_0x2b5a49=this['_setDataIdsOnChildren'](_0x5a14bc,_0x746a63,_0x3582bf);_0x5a14bc['hasAttribute']('data-id')?(_0x346df8=!0x0,_0x3582bf['add'](_0x5a14bc['getAttribute']('data-id'))):(_0x293627||_0x1ad741||_0x4743ba||_0x2b5a49)&&(_0x746a63['setAttribute']('data-id',this['_nextDataId'](_0x3582bf),_0x5a14bc),_0x346df8=!0x0);}return _0x346df8;}['_nextDataId'](_0x276772){let _0x4e9f65;do{_0x4e9f65='';for(let _0x1bd36d=0x0;_0x1bd36d<0x4;_0x1bd36d++)_0x4e9f65+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x276772['has'](_0x4e9f65));return _0x276772['add'](_0x4e9f65),_0x4e9f65;}['getSelectionText'](_0x5a428b){const _0x3b338e=(_0x5a428b?_0x5a428b['model']:_s(this['context'])['model'])['document']['selection'],_0x2fb3bf=[],_0x11fd38=Array['from'](_0x3b338e['getRanges']());_0x11fd38['sort']((_0xc7b61e,_0x14e5c8)=>_0xc7b61e['start']['isBefore'](_0x14e5c8['start'])?-0x1:0x1);for(const _0x704991 of _0x11fd38)for(const _0x10fb1d of _0x704991['getItems']())_0x10fb1d['is']('$textProxy')?_0x2fb3bf['push'](_0x10fb1d['data']):_0x10fb1d['is']('element')&&_0x2fb3bf['length']>0x0&&'\x20'!==_0x2fb3bf[_0x2fb3bf['length']-0x1]&&_0x2fb3bf['push']('\x20');return _0x2fb3bf['length']?'\x22'+_0x2fb3bf['join']('')['trim']()+'\x22':us(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x9b2f09){for(let _0x244112=0x0;_0x244112<this['_fakeSelections']['length'];_0x244112++)if(this['_fakeSelections'][_0x244112]['id']==_0x9b2f09)return void this['_fakeSelections']['splice'](_0x244112,0x1);}['_addFakeSelection'](_0x7871){this['_removeFakeSelectionById'](_0x7871['id']),wt(this['_fakeSelections'],_0x7871);}['_refreshFakeSelection'](_0x3387ba,_0x98a771){if(_0x3387ba==_0x98a771)return;const _0x23c129=_0x3387ba?_0x3387ba['editor']:null,_0x2c2e25=_0x98a771?_0x98a771['editor']:null,_0x578485=(_0x467b87,_0x4514e2)=>{const _0x47bf2b=_0x4514e2['model']['markers']['getMarkersGroup'](gs);for(const _0x4ef720 of _0x47bf2b)_0x467b87['removeMarker'](_0x4ef720);},_0x577429=(_0x953f96,_0x43ecfb,_0x1c3362)=>{const _0x587750=_0x43ecfb['model'];for(let _0x4cc240=0x0;_0x4cc240<_0x1c3362['ranges']['length'];_0x4cc240++){let _0x4cff57=_0x1c3362['ranges'][_0x4cc240];const _0x4b3ce0=gs+':'+_0x1c3362['id']+':'+_0x4cc240;if(_0x4cff57['start']['isAtEnd']){const _0x44fa3d=_0x4cff57['start']['getLastMatchingPosition'](({item:_0x1fcfb2})=>!_0x587750['schema']['isContent'](_0x1fcfb2),{'boundaries':_0x4cff57});_0x4cff57=_0x953f96['createRange'](_0x44fa3d,_0x4cff57['end']);}_0x953f96['addMarker'](_0x4b3ce0,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x4cff57});}};_0x23c129&&_0x2c2e25&&_0x23c129===_0x2c2e25&&_0x98a771?_0x23c129['model']['change'](_0x37c282=>{_0x578485(_0x37c282,_0x23c129),_0x577429(_0x37c282,_0x2c2e25,_0x98a771);}):(_0x23c129&&_0x23c129['model']['change'](_0x89e692=>_0x578485(_0x89e692,_0x23c129)),_0x2c2e25&&_0x98a771&&_0x2c2e25['model']['change'](_0x349867=>_0x577429(_0x349867,_0x2c2e25,_0x98a771)));}['_getMarkersInDocumentOrder'](_0x2ed1af,_0x3aef31){const _0x237c61=Array['from'](_0x2ed1af['model']['markers']['getMarkersGroup'](gs+':context'));return(_0x3aef31?_0x237c61['filter'](_0x2cb8bb=>{const _0x14760b=_0x2cb8bb['getRange']();return _0x14760b&&_0x14760b['root']['rootName']===_0x3aef31['rootName'];}):_0x237c61)['sort']((_0x5353bb,_0x1d6736)=>_0x5353bb['getStart']()['isBefore'](_0x1d6736['getStart']())?-0x1:_0x5353bb['getStart']()['isAfter'](_0x1d6736['getStart']())?0x1:0x0);}};function ps(_0x58fc55,_0xfde97d){return _0x1c8199(_0x58fc55,_0xfde97d);}function ms(_0x34f75b,_0x43448e){return _0x935be1(_0x34f75b,_0x43448e);}function Es(_0x319bd6,_0xf80133,_0x609c7b){const _0x52d89b=null!==_0xf80133?_0x4a1eaa=>_0x4a1eaa['attribs'][_0x319bd6]===_0xf80133:_0x35aec0=>Boolean(_0x35aec0['attribs'][_0x319bd6]);return ti(_0x28172a=>_0x1c0d0f(_0x28172a)&&_0x52d89b(_0x28172a),_0x609c7b);}function Ts(_0x1fca8f,_0x538875,_0x1245af){const _0x3f8c15=null!==_0x538875?_0x1ce3b1=>_0x1ce3b1['attribs'][_0x1fca8f]===_0x538875:_0x3cd452=>Boolean(_0x3cd452['attribs'][_0x1fca8f]);return _0xec138b(_0x5f2096=>_0x1c0d0f(_0x5f2096)&&_0x3f8c15(_0x5f2096),_0x1245af);}function ws(_0x463eb9){return _0xec138b(_0x2042cc=>_0x1c0d0f(_0x2042cc)&&function(_0x2dbe35){const _0x5b6999=_0x2dbe35['toLowerCase']();return'script'===_0x5b6999||'style'===_0x5b6999||_0x5b6999['includes']('-');}(_0x2042cc['name']),_0x463eb9);}function Cs(_0x47a535){return _0x5ca691(_0x43495c=>_0x1b98da(_0x43495c),_0x47a535,!0x0,0x1/0x0);}function fs(_0x488b62,_0x33ab7d){return _0x488b62&&_0x1c0d0f(_0x488b62)?_0x488b62['attribs'][_0x33ab7d]:null;}function bs(_0x782cd7,_0x2dad5e,_0x4072a2){_0x1c0d0f(_0x782cd7)&&(null===_0x4072a2?delete _0x782cd7['attribs'][_0x2dad5e]:_0x782cd7['attribs'][_0x2dad5e]=_0x4072a2);}function Ss(_0x5f39aa,_0x27a156,_0x27b4ee){const _0x20d256=_0x27a156['cloneNode'](!0x0);'beforebegin'===_0x27b4ee?_0x3e6f45(_0x5f39aa,_0x20d256):'afterbegin'===_0x27b4ee?_0x2ecd48(_0x5f39aa,_0x20d256):'beforeend'===_0x27b4ee?_0x27ef6(_0x5f39aa,_0x20d256):'afterend'===_0x27b4ee&&_0x1418e3(_0x5f39aa,_0x20d256);}function Rs(_0x2e3b91){const _0x19269b=[];let _0x1da551=_0x2e3b91;for(;_0x1da551;)_0x1da551=_0x3d9d2e(_0x1da551),_0x1da551&&_0x19269b['push'](_0x1da551);return _0x19269b;}function Os(_0x3dca51){return _0x3dca51['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function vs(_0x27db64){let _0x5e1a0b=0x0;for(;_0x27db64['parentNode'];)_0x27db64=_0x27db64['parentNode'],_0x5e1a0b++;return _0x5e1a0b;}function ks(_0x40d996){const _0x1d7661=[];let _0x18fe3d=_0x40d996['nextSibling'];for(;_0x18fe3d;)_0x1d7661['push'](_0x18fe3d),_0x18fe3d=_0x18fe3d['nextSibling'];_0x1d7661['forEach'](_0x3f36f0=>{_0x8128e7(_0x3f36f0);});}const Ns=/* #__PURE__ -- @preserve */
25
- gt();var ys=class extends Ns{['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};['_existingDataIds']=new Set();['_referencedExistingIds']=new Set();constructor(_0x5e1f80){super(),this['_generateUid']=_0x5e1f80||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x1a63e6,_0x3ced77,_0x9beb49){this['_uidCounter']=0x0;const _0x57d509=_0x1a63e6['cloneNode'](!0x0);Ds(_0x3ced77,_0x57d509);const _0x47c72f=_0x57d509['childNodes'],_0x29bc69=Array['from'](_0x47c72f)['filter'](_0x5a2389=>!(0x3===_0x5a2389['nodeType']&&''===ms(_0x5a2389)['trim']())),_0x165623=_0x29bc69['length'];this['_existingDataIds']=new Set(Ts('data-id',null,_0x3ced77)['map'](_0x4e6f69=>fs(_0x4e6f69,'data-id'))['filter'](_0x22f459=>!!_0x22f459));for(const _0x36cd1a of _0x29bc69)_0x36cd1a&&_0x1c0d0f(_0x36cd1a)&&void 0x0===_0x36cd1a['attribs']['data-id']&&bs(_0x36cd1a,'data-id','new-element');if(Ts('data-id',null,_0x57d509)['forEach'](_0x258be8=>{const _0x51beb7=fs(_0x258be8,'data-id');'new-element'===_0x51beb7||this['_existingDataIds']['has'](_0x51beb7)||bs(_0x258be8,'data-id','new-element');}),0x0===_0x3ced77['childNodes']['length']){const _0x300278=[];return Ts('data-id','new-element',_0x57d509)['forEach'](_0x3663e5=>{const _0x2851a9=this['_generateUid']();bs(_0x3663e5,'data-id',_0x2851a9),_0x300278['push'](_0x2851a9);}),this['_removeSpecialComments'](_0x57d509),{'parsedContent':_0x57d509,'newNodeIds':_0x300278,'modifiedNodeIds':[],'removedNodeIds':[]};}this['_touchedNodesState']['newIds']=[],this['_touchedNodesState']['modifiedIds']=[],this['_touchedNodesState']['removedIds']=[],this['_touchedNodesState']['invalidIds']=[],this['_touchedNodesState']['lastTouchedId']=null,this['_touchedNodesState']['rescuedNewIds']=new Set(),this['_referencedExistingIds']=new Set();let _0x20c015=-0x1,_0x3a139e=!0x1;for(let _0x271108=0x0;_0x271108<_0x165623;_0x271108++){const _0x3c3482=_0x29bc69[_0x271108],_0x37be5d=_0x29bc69[_0x271108+0x1];if(this['_isNewNode'](_0x3c3482)){if(-0x1===_0x20c015&&(_0x20c015=_0x271108),this['_markWrappedElements'](_0x3c3482),!this['_isNewNode'](_0x37be5d)){const [_0x454fcc,_0x5700f1]=this['_findReferenceNode'](_0x3c3482,_0x3a139e,_0x3ced77);if(_0x454fcc){const _0x45544e=Array['from'](_0x29bc69)['slice'](_0x20c015,_0x271108+0x1);this['_insertNodes'](_0x454fcc,_0x45544e,_0x5700f1),_0x20c015=-0x1;}}}else{if(this['_isExistingContentComment'](_0x3c3482))_0x3a139e=!0x0;else{if(this['_isExistingNode'](_0x3c3482)){const _0x47e83e=fs(_0x3c3482,'data-id');if(_0x47e83e&&this['_existingDataIds']['has'](_0x47e83e)){this['_referencedExistingIds']['add'](_0x47e83e);const _0x2e146f=Es('data-id',_0x47e83e,_0x3ced77);this['_replaceNode'](_0x2e146f,_0x3c3482);}}else{if(xs(_0x3c3482)){const _0x2e1a6a=Ls(_0x3c3482);Es('data-id',_0x2e1a6a,_0x57d509)||this['_touchedNodesState']['removedIds']['push'](_0x2e1a6a);}}}}}for(const _0x40f07a of this['_touchedNodesState']['removedIds']){const _0x3cabfe=Es('data-id',_0x40f07a,_0x3ced77);_0x3cabfe&&(this['_rescueUnwrappedElements'](_0x3cabfe),this['_removeNode'](_0x3cabfe,_0x40f07a,_0x9beb49));}if(Ts('data-id','new-element',_0x3ced77)['forEach'](_0xd94744=>{const _0x549815=this['_getUid'](_0xd94744);bs(_0xd94744,'data-id',_0x549815),this['_touchedNodesState']['newIds']['push'](_0x549815);}),this['_removeSpecialComments'](_0x3ced77),_0x9beb49&&_0x9beb49['cutAfterUnstable']){const _0x466253=this['_findLastConfirmationPoint'](_0x29bc69),_0xfb8065=this['_getLastStableElement'](_0x3ced77,_0x466253);this['_markUnstableElements'](_0x3ced77,_0xfb8065);}if(this['_processWrappedElements'](_0x3ced77,_0x9beb49),_0x9beb49&&_0x9beb49['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x5529ae=Ts('data-id',this['_touchedNodesState']['lastTouchedId'],_0x3ced77);let _0x2ebd38=_0x5529ae[_0x5529ae['length']-0x1];for(;_0x2ebd38;)ks(_0x2ebd38),_0x2ebd38=_0x2ebd38['parentNode'];}return{'parsedContent':_0x3ced77,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x210586,_0x1f4853,_0x22b8bd){for(const _0x4139d7 of _0x1f4853){const _0x330d5a=this['_getUid'](_0x4139d7);bs(_0x4139d7,'data-id',_0x330d5a),this['_touchedNodesState']['newIds']['push'](_0x330d5a),this['_touchedNodesState']['lastTouchedId']=_0x330d5a;}const _0x4b112e='afterbegin'===_0x22b8bd||'afterend'===_0x22b8bd?_0x1f4853['reverse']():_0x1f4853;for(const _0xba629c of _0x4b112e)Ss(_0x210586,_0xba629c,_0x22b8bd);}['_replaceNode'](_0x10d2ea,_0x5efdd3){if(!_0x10d2ea)return;if(_0x134197=_0x5efdd3,Os(ms(_0x10d2ea))===Os(ms(_0x134197)))return;var _0x134197;const _0x177368=fs(_0x10d2ea,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x177368),this['_touchedNodesState']['lastTouchedId']=_0x177368,_0x297d48(_0x10d2ea,_0x5efdd3['cloneNode'](!0x0));}['_removeNode'](_0x2de5f0,_0x4ff050,_0x3404b1){if(_0x3404b1&&_0x3404b1['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x4ff050;const _0x3e3751=_0x3404b1['replaceRemovedWith']['cloneNode'](!0x0);bs(_0x3e3751,'data-id',_0x4ff050),bs(_0x3e3751,'data-removed','true'),_0x297d48(_0x2de5f0,_0x3e3751);}else _0x8128e7(_0x2de5f0);}['_findReferenceNode'](_0x2c13b5,_0x298478,_0x5cdb64){const _0x5bd23b=this['_findPrevElementWithDataId'](_0x2c13b5,!0x1);if(_0x5bd23b){const _0x19951f=Ls(_0x5bd23b),_0x5a805a=Es('data-id',_0x19951f,_0x5cdb64);if(_0x5a805a)return[_0x5a805a,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x19951f);}const _0x3a034a=this['_findNextElementWithDataId'](_0x2c13b5,!0x1);if(_0x3a034a){const _0x2f6d99=Ls(_0x3a034a),_0x241d96=Es('data-id',_0x2f6d99,_0x5cdb64);if(_0x241d96)return[_0x241d96,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x2f6d99);}return _0x298478?_0x2c13b5['nextSibling']?this['_findFallbackReferenceNode'](_0x2c13b5,_0x5cdb64):[_0x5cdb64['childNodes'][_0x5cdb64['childNodes']['length']-0x1],'afterend']:[_0x5cdb64['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x5257e4,_0x40eaf5){const _0x2774b6=[],_0xc8c764=this['_findPrevElementWithDataId'](_0x5257e4,!0x0);if(_0xc8c764){const _0x2914cd=Es('data-id',Ls(_0xc8c764),_0x40eaf5);_0x2914cd&&_0x2774b6['push']([_0x2914cd,'afterend']);}const _0x50341c=this['_findNextElementWithDataId'](_0x5257e4,!0x0);if(_0x50341c){const _0x3c82d8=Es('data-id',Ls(_0x50341c),_0x40eaf5);_0x3c82d8&&_0x2774b6['push']([_0x3c82d8,'beforebegin']);}return _0x2774b6['length']>0x1?vs(_0x2774b6[0x0][0x0])<=vs(_0x2774b6[0x1][0x0])?_0x2774b6[0x0]:_0x2774b6[0x1]:0x1===_0x2774b6['length']?_0x2774b6[0x0]:[_0x40eaf5['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x4302c5,_0x272953){let _0x2aaaab=_0x4302c5['nextSibling'],_0x5e366=null,_0x4c6495=!0x1;for(;_0x2aaaab;){if(_0x1b98da(_0x2aaaab)){if(xs(_0x2aaaab)&&(_0x5e366=_0x2aaaab),this['_isExistingContentComment'](_0x2aaaab)&&_0x272953&&!_0x4c6495){_0x4c6495=!0x0,_0x2aaaab=_0x2aaaab['nextSibling'];continue;}break;}const _0x4e88b9=fs(_0x2aaaab,'data-id');if(_0x4e88b9&&'new-element'!==_0x4e88b9&&this['_existingDataIds']['has'](_0x4e88b9)){_0x5e366=_0x2aaaab;break;}_0x2aaaab=_0x2aaaab['nextSibling'];}return _0x5e366;}['_findPrevElementWithDataId'](_0x37376d,_0x223fbe){let _0x12e285=_0x37376d['previousSibling'],_0x8534d4=null,_0x240f6e=!0x1;for(;_0x12e285;){if(_0x1b98da(_0x12e285)){if(xs(_0x12e285)&&(_0x8534d4=_0x12e285),this['_isExistingContentComment'](_0x12e285)&&_0x223fbe&&!_0x240f6e){_0x240f6e=!0x0,_0x12e285=_0x12e285['previousSibling'];continue;}break;}const _0x5235ae=fs(_0x12e285,'data-id');if(_0x5235ae&&'new-element'!==_0x5235ae&&this['_existingDataIds']['has'](_0x5235ae)){_0x8534d4=_0x12e285;break;}_0x12e285=_0x12e285['previousSibling'];}return _0x8534d4;}['_markWrappedElements'](_0x431277){_0x1c0d0f(_0x431277)&&Ts('data-id',null,_0x431277)['forEach'](_0x3e5459=>{this['_isExistingNode'](_0x3e5459)&&(bs(_0x3e5459,'data-wrapped-id',fs(_0x3e5459,'data-id')),bs(_0x3e5459,'data-id',null));});}['_processWrappedElements'](_0xbbb22d,_0x3550bf){Ts('data-wrapped-id',null,_0xbbb22d)['forEach'](_0x3dc94c=>{const _0x4a884b=fs(_0x3dc94c,'data-wrapped-id');if(this['_hasUnstableParent'](_0x3dc94c))return;const _0x5ca407=Es('data-id',_0x4a884b,_0xbbb22d);bs(_0x3dc94c,'data-id',_0x4a884b),_0x5ca407&&(this['_removeNode'](_0x5ca407,_0x4a884b,_0x3550bf),this['_touchedNodesState']['removedIds']['push'](_0x4a884b),this['_touchedNodesState']['lastTouchedId']=_0x4a884b);});}['_hasUnstableParent'](_0x2434cc){let _0x335a05=_0x2434cc['parentNode'];for(;_0x335a05;){if(fs(_0x335a05,'data-unstable'))return!0x0;_0x335a05=_0x335a05['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0x21ed59){const _0x476a4d=new Set(this['_touchedNodesState']['removedIds']),_0x31d79d=new Set(this['_touchedNodesState']['newIds']);Ts('data-id',null,_0x21ed59)['forEach'](_0xa3ff9e=>{const _0x48ae15=fs(_0xa3ff9e,'data-id'),_0x10cd05=!!_0x48ae15&&this['_referencedExistingIds']['has'](_0x48ae15),_0x570fdd=!!_0x48ae15&&_0x31d79d['has'](_0x48ae15);if(!_0x48ae15||!_0x10cd05&&!_0x570fdd)return;if(_0x476a4d['has'](_0x48ae15))return;let _0x79f9cd=_0xa3ff9e['parentNode'],_0x2f8b22=!0x1;for(;_0x79f9cd;){if(_0x79f9cd===_0x21ed59){_0x2f8b22=!0x0;break;}const _0x50e65d=fs(_0x79f9cd,'data-id');if(_0x50e65d&&(this['_referencedExistingIds']['has'](_0x50e65d)||_0x31d79d['has'](_0x50e65d)))return;_0x79f9cd=_0x79f9cd['parentNode'];}if(_0x2f8b22){if(_0x3e6f45(_0x21ed59,_0xa3ff9e),_0x10cd05){const _0x589683=this['_generateUid'](),_0x8b6c7c=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x48ae15);-0x1!==_0x8b6c7c&&this['_touchedNodesState']['modifiedIds']['splice'](_0x8b6c7c,0x1),bs(_0xa3ff9e,'data-unwrapped-id',_0x48ae15),bs(_0xa3ff9e,'data-id',_0x589683),this['_touchedNodesState']['newIds']['push'](_0x589683),this['_touchedNodesState']['rescuedNewIds']['add'](_0x589683),this['_touchedNodesState']['lastTouchedId']=_0x589683;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x48ae15),this['_touchedNodesState']['lastTouchedId']=_0x48ae15;}});}['_getUid'](_0x346922){return this['_isExistingNode'](_0x346922)?fs(_0x346922,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x3eebc1){Cs(_0x3eebc1)['filter'](_0x3f6032=>xs(_0x3f6032)||this['_isExistingContentComment'](_0x3f6032))['forEach'](_0x238b12=>{_0x8128e7(_0x238b12);});}['_findLastConfirmationPoint'](_0x54ae6f){let _0x1315f0=null,_0x7ea893=null,_0x47c716=null,_0x443536=null;const _0x4e5513=_0x3b456b=>{_0x3b456b&&(_0x1315f0=_0x3b456b),_0x47c716=null,_0x443536=null;};for(let _0x3c7468=0x0;_0x3c7468<_0x54ae6f['length'];_0x3c7468++){const _0x327fe0=_0x54ae6f[_0x3c7468];if(this['_isExistingContentComment'](_0x327fe0)){_0x4e5513(_0x7ea893);continue;}if(_0x1c0d0f(_0x327fe0)){const _0x27e9f8=fs(_0x327fe0,'data-id'),_0x4b38cd=_0x3c7468===_0x54ae6f['length']-0x1;if(_0x27e9f8&&'new-element'!==_0x27e9f8&&this['_touchedNodesState']['modifiedIds']['includes'](_0x27e9f8)&&!_0x4b38cd){_0x4e5513(_0x27e9f8),_0x7ea893=_0x27e9f8;continue;}}let _0x421f66=null;const _0x5773e2=Ls(_0x327fe0);if(_0x5773e2&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x5773e2))_0x7ea893=_0x5773e2;else{if(_0x5773e2&&this['_touchedNodesState']['newIds']['includes'](_0x5773e2))_0x421f66='N';else{if(!xs(_0x327fe0))continue;_0x421f66='R';}_0x421f66===_0x443536||null===_0x443536?_0x443536=_0x421f66:null!==_0x47c716?(_0x4e5513(_0x7ea893),_0x443536=_0x421f66):(_0x47c716=_0x443536,_0x443536=_0x421f66),_0x7ea893=_0x5773e2;}}const _0x493a47=_0x54ae6f[_0x54ae6f['length']-0x1];return _0x493a47&&!_0x1c0d0f(_0x493a47)&&!xs(_0x493a47)&&_0x7ea893&&_0x4e5513(_0x7ea893),_0x1315f0;}['_getLastStableElement'](_0x2b686f,_0x17863b){if(!_0x17863b)return null;const _0x4f079a=Es('data-id',_0x17863b,_0x2b686f);if(!_0x4f079a)return null;const _0x5cb4d5=[_0x4f079a,...Rs(_0x4f079a)]['at'](-0x2);if(_0x5cb4d5===_0x4f079a)return _0x4f079a;let _0x1bbd8d=_0x5cb4d5['previousSibling'];for(;_0x1bbd8d&&!_0x1c0d0f(_0x1bbd8d);)_0x1bbd8d=_0x1bbd8d['previousSibling'];return _0x1bbd8d;}['_markUnstableElements'](_0x2edb7c,_0x4b9ec1){const _0x2da8f4=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x2e5ab9=_0x4b9ec1?_0x4b9ec1['nextSibling']:_0x2edb7c['firstChild'];for(;_0x2e5ab9;)_0x1c0d0f(_0x2e5ab9)&&(_0x2da8f4['has'](fs(_0x2e5ab9,'data-id'))||Ts('data-id',null,_0x2e5ab9)['some'](_0x1b910e=>_0x2da8f4['has'](fs(_0x1b910e,'data-id'))))&&bs(_0x2e5ab9,'data-unstable','true'),_0x2e5ab9=_0x2e5ab9['nextSibling'];}['_isNewNode'](_0x23383c){return Boolean('new-element'===fs(_0x23383c,'data-id'));}['_isExistingNode'](_0x3b1018){return Boolean((fs(_0x3b1018,'data-id')||'')['length']>0x0&&'new-element'!==fs(_0x3b1018,'data-id'));}['_isExistingContentComment'](_0x3b001e){return Boolean(_0x1b98da(_0x3b001e)&&ms(_0x3b001e)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function xs(_0x56d684){return!!_0x56d684&&Boolean(_0x1b98da(_0x56d684)&&ms(_0x56d684)['match'](/removed[\s*-]data-id="[^"]+"/));}function Ls(_0x19623e){if(!_0x19623e)return null;if(_0x1c0d0f(_0x19623e))return fs(_0x19623e,'data-id')??null;if(_0x1b98da(_0x19623e)){const _0x2f2d7a=ms(_0x19623e)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x2f2d7a&&_0x2f2d7a[0x1])return _0x2f2d7a[0x1];}return null;}function Ds(_0x15a305,_0x193e30){const _0x21c999=new Map();for(const _0x21c20b of ws(_0x15a305))_0x21c999['set'](fs(_0x21c20b,'data-id'),_0x21c20b);const _0x19c435=new Set();for(const _0x32efcb of ws(_0x193e30)){const _0x39b6b3=fs(_0x32efcb,'data-id'),_0x1533ba=_0x39b6b3?_0x21c999['get'](_0x39b6b3):void 0x0;_0x1533ba?(_0x297d48(_0x32efcb,_0x16e079(_0x1533ba,!0x0)),_0x19c435['add'](_0x39b6b3)):_0x8128e7(_0x32efcb);}for(const _0x39d7da of Cs(_0x193e30))xs(_0x39d7da)&&_0x21c999['has'](Ls(_0x39d7da))&&_0x8128e7(_0x39d7da);const _0x2f808f=new Set(Ts('data-id',null,_0x193e30)['map'](_0x38aeb2=>fs(_0x38aeb2,'data-id')));for(const [_0x3fb410,_0x254956]of _0x21c999){if(_0x19c435['has'](_0x3fb410))continue;let _0x58e112=_0x254956['parent'],_0x2da3d1=null;for(;_0x58e112&&_0x1c0d0f(_0x58e112);){const _0x5e240d=fs(_0x58e112,'data-id');if(_0x5e240d&&_0x2f808f['has'](_0x5e240d)){_0x2da3d1=_0x5e240d;break;}_0x58e112=_0x58e112['parent'];}if(!_0x2da3d1)continue;const _0x32284d=Es('data-id',_0x2da3d1,_0x193e30);_0x32284d&&_0x27ef6(_0x32284d,_0x16e079(_0x254956,!0x0));}}const Ps=/* #__PURE__ -- @preserve */
26
- gt();var Hs=class extends Ps{['_m2html'];constructor(){super();const _0x3687ff=Object['entries'](_0x425a2f),_0x1c58b3=_0x3687ff['findIndex'](([_0x5d552f])=>'rehypeDomRaw'===_0x5d552f);if(-0x1===_0x1c58b3)throw new ht('ai-response-parser-unable-to-set-up-parser');_0x3687ff['splice'](_0x1c58b3+0x1,0x0,['rehypeSanitize',_0x40d8d2]),this['_m2html']=new _0x2eb1be({'plugins':Object['fromEntries'](_0x3687ff)});}['convertMarkdownToHTML'](_0x33a41b){const _0x6fa205=this['_m2html']['parse'](_0x33a41b);return this['parseAndNormalizeHTML'](_0x6fa205);}['parseAndNormalizeHTML'](_0x18edab){return this['_parseHTML'](_0x18edab);}['_parseHTML'](_0xb287d8){const _0x304c51=ps('<dummy>'+_0xb287d8['replace'](/<[^>]*?$/g,'')+'</dummy>');return Ms(_0x304c51),_0x304c51['children']=_0x304c51['children'][0x0]['children'],_0x304c51;}};function Ms(_0x17c94b){for(const _0x57791c of _0x17c94b['children'])_0x1c0d0f(_0x57791c)?'pre'!==_0x57791c['name']&&Ms(_0x57791c):_0x4a7ce7(_0x57791c)&&(_0x57791c['data']=_0x57791c['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function Vs({changeGroups:_0x1b2eee,documentContextContent:_0x5cd367,showDiff:_0x208b37,trimUnchanged:_0x2b6615=!0x0}){return _0x1b2eee['map'](_0x35f306=>{if(!_0x35f306['editor']||'destroyed'===_0x35f306['editor']['state'])return null;if(!_0x5c2cc5(_0x35f306['editor'],_0x35f306['rootName']))return{'type':_0x35f306['changes'][0x0]['type'],'index':_0x35f306['index'],'content':new _0x5e7b74([]),'hasChanges':!0x1};const _0x34ab70=new _0x5e7b74([]),_0x37f811=new _0x5e7b74([]),_0x29ef8e=new Set();for(const _0x579806 of _0x35f306['changes'])'new'==_0x579806['type']&&Ts('data-id',null,_0x579806['node'])['forEach'](_0x2834b5=>{_0x29ef8e['add'](fs(_0x2834b5,'data-id'));});for(const _0xee25e9 of _0x35f306['changes'])if('removed'!=_0xee25e9['type']?_0x37f811['children']['push'](_0xee25e9['node']['cloneNode'](!0x0)):_0x208b37||_0x29ef8e['has'](_0xee25e9['id'])||_0x37f811['children']['push'](_0xee25e9['node']['cloneNode'](!0x0)),'new'!=_0xee25e9['type']&&(_0x208b37||'removed'!=_0xee25e9['type'])){const _0x3af3a2=ti(_0x16ae7f=>fs(_0x16ae7f,'data-id')==_0xee25e9['id'],_0x5cd367['get'](_0x35f306['documentId']),!0x0);_0x3af3a2&&_0x34ab70['children']['push'](_0x3af3a2['cloneNode'](!0x0));}let _0x246be4,_0x107163;try{({content:_0x246be4,hasChanges:_0x107163}=Us(_0x35f306['editor'],_0x34ab70,_0x37f811,_0x208b37,_0x2b6615));}catch{return{'type':_0x35f306['changes'][0x0]['type'],'index':_0x35f306['index'],'content':new _0x5e7b74([]),'hasChanges':!0x1};}return{'type':_0x35f306['changes'][0x0]['type'],'index':_0x35f306['index'],'content':_0x246be4,'hasChanges':_0x107163};})['filter'](_0x359499=>null!==_0x359499);}function Us(_0x48590f,_0x952635,_0x453549,_0xc5dc5c,_0x5c62f8=!0x0){const _0x312af3=_0x48590f['plugins']['get']('DocumentCompare'),_0x532a46=ms(_0x952635),_0x571819=ms(_0x453549),_0xa3a9b0=_0x48590f['data']['parse'](_0x532a46,'$root'),_0x57792e=_0x48590f['model']['createPositionAt'](_0xa3a9b0,0x0),_0x4301d3=_0x312af3['getDiff'](_0x532a46,_0x571819,{'anchor':_0x57792e,'markDeletions':_0xc5dc5c,'targetEditor':_0x48590f})['getOperations']();if(0x0==_0x4301d3['length'])return{'content':_0x952635['cloneNode'](!0x0),'hasChanges':!0x1};if(_0xc5dc5c?function(_0x4a8dcf,_0x16a786,_0x48fd62){if(0x0==_0x4a8dcf['length'])return;const _0x17e054=_0x48fd62['plugins']['get']('DocumentCompare'),_0x6d7501=_0x48fd62['plugins']['get']('SuggestionsConversion');_0x48fd62['model']['change'](_0x426ef1=>{const _0x477622=new Set();for(let _0x42ebd9=0x0;_0x42ebd9<_0x4a8dcf['length'];_0x42ebd9++){const _0x52ab81=_0x4a8dcf[_0x42ebd9];if(_0x52ab81['baseVersion']=null,_0x52ab81['isDocumentOperation']=!0x1,_0x17e054['isMarkedRemoveOperation'](_0x52ab81)){const _0x1cb31a=_0x1e9e70(_0x52ab81['newRange'],_0x48fd62['model']),_0x36a99='suggestion:deletion:'+vt()+':$aiSuggestion';_0x16a786['markers']['set'](_0x36a99,_0x1cb31a);}else switch(_0x52ab81['type']){case'rename':{if(_0x52ab81['oldName']==_0x52ab81['newName'])break;_0x426ef1['batch']['addOperation'](_0x52ab81),_0x48fd62['model']['applyOperation'](_0x52ab81);const _0x1c0a83='$elementName',_0x504a57=_0x52ab81['position'],_0x2f686c=_0x48fd62['model']['createRange'](_0x504a57,_0x48fd62['model']['createPositionAt'](_0x504a57['nodeAfter'],'end')),_0x115025='suggestion:attribute:'+_0x1c0a83+':'+vt()+':$aiSuggestion';_0x16a786['markers']['set'](_0x115025,_0x2f686c);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x52ab81['oldValue']==_0x52ab81['newValue'])break;_0x426ef1['batch']['addOperation'](_0x52ab81),_0x48fd62['model']['applyOperation'](_0x52ab81);const _0x28b90c=_0x52ab81['key'];if(!_0x6d7501['isRegisteredAttribute'](_0x28b90c))break;const _0x5409b9=_0x1e9e70(_0x52ab81['range'],_0x48fd62['model']),_0x9294ed='suggestion:attribute:'+_0x28b90c+':'+vt()+':$aiSuggestion';_0x16a786['markers']['set'](_0x9294ed,_0x5409b9);break;}case'insert':{if(_0x426ef1['batch']['addOperation'](_0x52ab81),_0x48fd62['model']['applyOperation'](_0x52ab81),Bs(_0x16a786,_0x52ab81),_0x4a8dcf[_0x42ebd9+0x1]&&'move'==_0x4a8dcf[_0x42ebd9+0x1]['type'])break;const _0x128f61=_0x52ab81['position'],_0x2afe67=_0x52ab81['howMany'],_0x2cd0a4=_0x1e9e70(_0x48fd62['model']['createRange'](_0x128f61,_0x128f61['getShiftedBy'](_0x2afe67)),_0x48fd62['model']),_0x342ccf='suggestion:insertion:'+vt()+':$aiSuggestion';_0x16a786['markers']['set'](_0x342ccf,_0x2cd0a4);break;}case'split':{_0x426ef1['batch']['addOperation'](_0x52ab81),_0x48fd62['model']['applyOperation'](_0x52ab81),Bs(_0x16a786,_0x52ab81);const _0x3eb699=_0x52ab81['splitPosition'],_0x1fc1e3=_0x52ab81['moveTargetPosition'],_0x2f5fd2=_0x48fd62['model']['createRange'](_0x3eb699,_0x1fc1e3),_0x16ee60='suggestion:insertion:'+vt()+':$aiSuggestion';_0x16a786['markers']['set'](_0x16ee60,_0x2f5fd2);break;}case'move':{_0x426ef1['batch']['addOperation'](_0x52ab81),_0x48fd62['model']['applyOperation'](_0x52ab81),Bs(_0x16a786,_0x52ab81);const _0x1198ba=_0x52ab81['getMovedRangeStart'](),_0x1dfeb4=_0x52ab81['howMany'];for(let _0x368a15=0x0;_0x368a15<_0x1dfeb4;_0x368a15++){const _0x56c6ae=_0x1198ba['getShiftedBy'](_0x368a15)['nodeAfter'];_0x477622['add'](_0x56c6ae);}break;}case'remove':{const _0x2cd5aa=_0x52ab81['sourcePosition'],_0x372766=_0x52ab81['howMany'],_0x29b5a2=new _0x2c93bf(_0x2cd5aa,_0x372766);_0x426ef1['batch']['addOperation'](_0x29b5a2),_0x48fd62['model']['applyOperation'](_0x29b5a2),Bs(_0x16a786,_0x52ab81);break;}}}for(const _0x196970 of _0x477622){const _0x3df221=_0x48fd62['model']['createRangeOn'](_0x196970),_0x289f2a='suggestion:formatBlock:$fakeWrap:'+vt()+':$aiSuggestion';_0x16a786['markers']['set'](_0x289f2a,_0x1e9e70(_0x3df221,_0x48fd62['model']));}});}(_0x4301d3,_0xa3a9b0,_0x48590f):_0x48590f['model']['change'](_0x248eb5=>{for(const _0x1feed7 of _0x4301d3)if('remove'==_0x1feed7['type']){const _0x1ffaaa=_0x1feed7['sourcePosition'],_0x13450e=_0x1feed7['howMany'],_0x96ba92=new _0x2c93bf(_0x1ffaaa,_0x13450e);_0x248eb5['batch']['addOperation'](_0x96ba92),_0x48590f['model']['applyOperation'](_0x96ba92),Bs(_0xa3a9b0,_0x1feed7);}else{if('marker'==_0x1feed7['type']){const _0x21b690=_0x1feed7['name'],_0x13cdaa=_0x1feed7['newRange'];null!==_0x13cdaa?_0xa3a9b0['markers']['set'](_0x21b690,_0x13cdaa):_0xa3a9b0['markers']['delete'](_0x21b690);}else _0x1feed7['baseVersion']=null,_0x1feed7['isDocumentOperation']=!0x1,_0x248eb5['batch']['addOperation'](_0x1feed7),_0x48590f['model']['applyOperation'](_0x1feed7),Bs(_0xa3a9b0,_0x1feed7);}}),_0x5c62f8){const _0x541de0=Gs(_0x48590f,_0x4301d3,_0xa3a9b0);Ks(_0x48590f['model'],_0x541de0),function(_0x248182,_0x298a11){const _0x1443e7=_0x298a11['getFirstRange']()['start'];let _0x333e39=_0x298a11['getFirstRange']()['end'];const _0x5509ae=_0x1443e7['root'];(_0x333e39['textNode']||_0x333e39['nodeAfter']&&_0x333e39['nodeAfter']['is']('$text'))&&(_0x1b1f77(_0x333e39,'...'),$s(_0x5509ae,_0x333e39,0x3),_0x333e39=_0x333e39['getShiftedBy'](0x3)),(_0x1443e7['textNode']||_0x1443e7['nodeBefore']&&_0x1443e7['nodeBefore']['is']('$text'))&&(_0x1b1f77(_0x1443e7,'...'),$s(_0x5509ae,_0x1443e7,0x3),_0x1443e7['parent']==_0x333e39['parent']&&(_0x333e39=_0x333e39['getShiftedBy'](0x3)));const _0x1a5070=_0x248182['createRange'](_0x248182['createPositionAt'](_0x5509ae,0x0),_0x1443e7),_0x4d45e8=_0x248182['createRange'](_0x333e39,_0x248182['createPositionAt'](_0x5509ae,'end')),_0x3a32da=[..._0x1a5070['getMinimalFlatRanges'](),..._0x4d45e8['getMinimalFlatRanges']()];_0x3a32da['reverse']();for(const _0x51cc91 of _0x3a32da)_0x378764(_0x51cc91),Ys(_0x5509ae,_0x51cc91);}(_0x48590f['model'],_0x541de0);}return{'content':ps(_0x48590f['data']['stringify'](_0xa3a9b0,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function Bs(_0x4ef77d,_0x643fe5){for(const [_0x551a3b,_0x57d1fc]of _0x4ef77d['markers']){const _0x47ae2f=_0x34b9eb['_createFromRanges'](_0x57d1fc['getTransformedByOperation'](_0x643fe5));_0x47ae2f['root']==_0x4ef77d?_0x4ef77d['markers']['set'](_0x551a3b,_0x47ae2f):_0x4ef77d['markers']['delete'](_0x551a3b);}}function Gs(_0x2e87db,_0x53888f,_0x317fef){const _0x5e839b=_0x2e87db['plugins']['get']('DocumentCompare');let _0x1555ca=_0x2e87db['model']['createPositionAt'](_0x317fef,Number['POSITIVE_INFINITY']),_0x1e4626=_0x2e87db['model']['createPositionAt'](_0x317fef,0x0);for(const _0x2746ba of _0x53888f){let _0x4a9ccf,_0xbd83ba;if(_0x5e839b['isMarkedRemoveOperation'](_0x2746ba))_0x4a9ccf=_0x2746ba['newRange']['start'],_0xbd83ba=_0x2746ba['newRange']['end'];else switch(_0x1555ca=Fs(_0x1555ca,_0x2746ba),_0x1e4626=Fs(_0x1e4626,_0x2746ba),_0x2746ba['type']){case'rename':_0x4a9ccf=_0x2746ba['position'],_0xbd83ba=_0x4a9ccf['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x4a9ccf=_0x2746ba['range']['start'],_0xbd83ba=_0x2746ba['range']['end'];break;case'insert':_0x4a9ccf=_0x2746ba['position'],_0xbd83ba=_0x4a9ccf['getShiftedBy'](_0x2746ba['howMany']);break;case'split':_0x4a9ccf=_0x2746ba['splitPosition'],_0xbd83ba=_0x2746ba['moveTargetPosition'];break;case'merge':{const _0x156e89=_0x2746ba['targetPosition']['path']['slice'](0x0,-0x1);_0x4a9ccf=_0x2e87db['model']['createPositionFromPath'](_0x317fef,_0x156e89),_0xbd83ba=_0x4a9ccf['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x4e7441=_0x2746ba['howMany'],_0x462c50=_0x2746ba['sourcePosition']['_getTransformedByInsertion'](_0x2746ba['targetPosition'],_0x4e7441),_0x3479be=_0x2746ba['getMovedRangeStart']();'remove'==_0x2746ba['type']?(_0x4a9ccf=_0x462c50,_0xbd83ba=_0x462c50):(_0x4a9ccf=_0x3479be,_0xbd83ba=_0x3479be['getShiftedBy'](_0x4e7441));break;}}_0x4a9ccf&&_0x4a9ccf['isBefore'](_0x1555ca)&&(_0x1555ca=_0x4a9ccf['clone'](),_0x1555ca['stickiness']='toNone'),_0xbd83ba&&_0xbd83ba['isAfter'](_0x1e4626)&&(_0x1e4626=_0xbd83ba['clone'](),_0x1e4626['stickiness']='toNone');}return _0x2e87db['model']['createSelection'](_0x2e87db['model']['createRange'](_0x1555ca,_0x1e4626));}function Fs(_0x3a2370,_0xc57671){return'move'!=_0xc57671['type']&&'remove'!=_0xc57671['type']||_0xc57671['sourceRange']['containsPosition'](_0x3a2370)&&((_0x3a2370=_0xc57671['sourcePosition']['clone']())['stickiness']='toNone'),_0x3a2370['getTransformedByOperation'](_0xc57671);}function Ks(_0x4f351e,_0x47f183){Ws(_0x4f351e,_0x47f183,'forward');const _0x5f548a=_0x47f183['getFirstRange']();_0x47f183['setTo']([]),_0x47f183['setTo'](_0x5f548a,{'backward':!0x0}),Ws(_0x4f351e,_0x47f183,'backward');}function Ws(_0x1e775b,_0x31abba,_0x4fd1fd){let _0x21e53a=0x14;for(;_0x21e53a;){_0x1e775b['modifySelection'](_0x31abba,{'unit':'word','direction':_0x4fd1fd}),_0x21e53a--;const _0x840d02=_0x31abba['focus']['forward'==_0x4fd1fd?'nodeBefore':'nodeAfter'];if(_0x840d02&&_0x840d02['is']('element')&&_0x1e775b['schema']['isBlock'](_0x840d02)&&_0x1e775b['schema']['isObject'](_0x840d02))break;}}function Ys(_0x596838,_0x2256c5){for(const [_0x25762d,_0x2c11b3]of _0x596838['markers']){const _0x170876=_0x2c11b3['_getTransformedByDeletion'](_0x2256c5['start'],_0x2256c5['end']['offset']-_0x2256c5['start']['offset']);null!=_0x170876?_0x596838['markers']['set'](_0x25762d,_0x170876):_0x596838['markers']['delete'](_0x25762d);}}function $s(_0x567c51,_0x39e8a4,_0x467645){for(let [_0xcb3df0,_0x5aa306]of _0x567c51['markers'])_0x5aa306=_0x5aa306['_getTransformedByInsertion'](_0x39e8a4,_0x467645,!0x1)[0x0],_0x567c51['markers']['set'](_0xcb3df0,_0x5aa306);}const qs=/* #__PURE__ -- @preserve */
27
- ut();var Qs=class extends qs{['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x360b56,config:_0xff813d,locale:_0x1a5ca9}){super(),this['_connector']=_0x360b56,this['_config']=_0xff813d,this['_locale']=_0x1a5ca9;}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 _0x3e2afd=await this['getAll']();let _0x502cd7;return _0x502cd7=this['_availableModels']?this['_filterModels'](_0x3e2afd,this['_availableModels']):_0x3e2afd['filter'](_0x4594a3=>_0x4594a3['recommended']),_0x502cd7;}async['getModel'](_0x3b667f){const _0x4730c3=await this['getAll']();if(!_0x4730c3['length'])return null;if(_0x3b667f){const _0xdc354e=this['_getModelById'](_0x4730c3,_0x3b667f);if(_0xdc354e)return _0xdc354e;bt('ai-chat-model-id-unrecognized',{'modelId':_0x3b667f,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x4d8acb=await this['getAvailableModels']();if(!_0x4d8acb['length'])return null;if(this['_defaultModelId']){const _0x3bdc44=this['_getModelById'](_0x4d8acb,this['_defaultModelId']);if(_0x3bdc44)return _0x3bdc44;bt('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x4d8acb[0x0]['id']});}return _0x4d8acb[0x0];}async['isAvailable'](_0xce661){return(await this['getAvailableModels']())['some'](_0x12931a=>_0x12931a['name']===_0xce661['name']&&_0x12931a['provider']===_0xce661['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length']){const _0x4ad4da=this['_locale']['uiLanguage']||'en',_0x177936=await this['_connector']['getModels'](_0x4ad4da)['list']();this['_modelList']=_0x177936['items']['map'](_0x5a419b=>Xs(_0x5a419b)?{..._0x5a419b,'name':us(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x5a419b);}return[...this['_modelList']];}['_filterModels'](_0x3dcd14,_0x4d019b){let _0x47acfe;if(_0x4d019b){_0x47acfe=[];const _0x50b508=new Set(),_0xcbd84c='string'==typeof _0x4d019b?[_0x4d019b['toLocaleLowerCase']()]:_0x4d019b['map'](_0x2c9dcf=>_0x2c9dcf['toLocaleLowerCase']());for(const _0x492aad of _0xcbd84c)for(const _0x4c517b of _0x3dcd14)!_0x50b508['has'](_0x4c517b['id'])&&this['_isMatchingFilter'](_0x4c517b,_0x492aad)&&(_0x47acfe['push'](_0x4c517b),_0x50b508['add'](_0x4c517b['id']));}else _0x47acfe=_0x3dcd14;return _0x47acfe;}['_isMatchingFilter'](_0x59641e,_0x33bfec){const _0x520277=_0x59641e['id']['toLocaleLowerCase'](),_0x31f688=_0x59641e['name']['toLocaleLowerCase'](),_0x143c14=_0x59641e['provider']['toLocaleLowerCase']();return _0x520277===_0x33bfec||_0x31f688===_0x33bfec||Xs(_0x59641e)&&'auto'===_0x33bfec||_0x143c14===_0x33bfec||_0x520277['startsWith'](_0x33bfec);}['_getModelById'](_0xa34534,_0x515d52){return _0xa34534['find'](_0x2582a8=>Xs(_0x2582a8)&&'auto'===_0x515d52?_0x2582a8:_0x2582a8['id']===_0x515d52)||null;}};function Xs(_0x5b05bd){return _0x5b05bd['id']['startsWith']('agent');}function zs(_0x50b829,_0x25a2ae){for(const _0x4e8c22 of _0x50b829)'noop'!==_0x4e8c22['type']&&(_0x4e8c22['_aiSource']=_0x25a2ae);}var js=class extends _0xe5ed07{static get['pluginName'](){return'AIGateway';}static get['requires'](){return[_0x5d031e];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return new Qs({'connector':this['context']['plugins']['get']('AIConnector'),'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']})['getAll']();}['apply'](_0x799475,_0x530393){if('completed'!==_0x799475['status'])throw new ht('ai-gateway-apply-invalid-status',this,{'status':_0x799475['status']});const _0x145e90=_0x799475['editor'],{applyMethod:_0x255ecb}=_0x530393;if('suggest'===_0x255ecb&&!_0x145e90['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',this);const _0x1b7956='suggest'===_0x255ecb,_0x47bd0e=this['context']['plugins']['get'](_0x5d031e),_0x33be50=_0x145e90['model']['createPositionAt'](_0x145e90['model']['document']['getRoot'](),0x0),_0x58fe74=_0x47bd0e['getDiff'](_0x799475['contentRawOld'],_0x799475['contentRawNew'],{'anchor':_0x33be50,'markDeletions':_0x1b7956,'targetEditor':_0x145e90}),_0x2effb1=_0x145e90['model']['document']['history']['getOperations'](_0x799475['documentVersion']),_0x4a3b81={'document':_0x145e90['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x481a22=_0x17dc83(_0x58fe74['getOperations'](),_0x2effb1,_0x4a3b81)['operationsA'];zs(_0x481a22,_0x530393['aiSource']??'api'),_0x145e90['model']['change'](_0x1dc8e3=>{_0x1b7956?_0x145e90['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x481a22):_0x47bd0e['applyOperations'](_0x1dc8e3,_0x481a22);});}['mergeChangesIntoContent'](_0x3814a4,_0x16903b,_0x5cc3a8){const _0xbc311d=new Hs(),_0x38ba72=new ys();let _0x49aaf1=_0xbc311d['parseAndNormalizeHTML'](_0x16903b);for(const _0x6a23a5 of _0x3814a4)try{const _0x41d215=_0xbc311d['parseAndNormalizeHTML'](_0x6a23a5['content']);_0x49aaf1=_0x38ba72['merge'](_0x41d215,_0x49aaf1,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0xa1ce17){throw new ht('ai-gateway-merge-failed',this,{..._0x6a23a5},_0xa1ce17);}return Us(_0x5cc3a8,_0xbc311d['parseAndNormalizeHTML'](_0x16903b),_0x49aaf1,!0x1,!0x1)['content'];}},Js=class{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0x36fda9){this['_editor']=_0x36fda9['editor'],this['_rootName']=_0x36fda9['rootName'],this['_channelId']=_0x36fda9['channelId'],this['_sessionId']=_0x36fda9['sessionId'];}get['status'](){return this['_error']?'error':this['_isAborted']?'aborted':void 0x0!==this['_contentRawNew']?'completed':'initialized';}get['editor'](){return this['_editor'];}get['rootName'](){return this['_rootName'];}get['channelId'](){return this['_channelId'];}get['sessionId'](){return this['_sessionId'];}get['documentVersion'](){return this['_documentVersion'];}set['documentVersion'](_0x3fd499){this['_documentVersion']=_0x3fd499;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0x5729fa){this['_contentRawOld']=_0x5729fa;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0x2f6942){this['_contentRawNew']=_0x2f6942;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x1f22c7){this['_error']=_0x1f22c7;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0x1aa52f){return _0x1aa52f['replace'](/ data-id="[a-z0-9]+"/g,'');}},Zs=class extends Js{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0xe5119a){this['_summary']=_0xe5119a;}},tn=class extends _0xe5ed07{static get['pluginName'](){return'AIDocumentProcessingGateway';}static get['requires'](){return[ls,Is,js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['processDocument'](_0x20486e,_0x345496){if(!_0x20486e)throw new ht('ai-documentprocessinggateway-missing-prompt',this);const _0x232751=await this['context']['plugins']['get'](Is)['getDocumentData']();if(!_0x232751[0x0])throw new ht('ai-documentprocessinggateway-missing-document',this);const _0x134adc=new Zs({'editor':_0x232751[0x0]['editor'],'rootName':_0x232751[0x0]['rootName'],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x232751[0x0]['sessionId']});if(_0x134adc['contentRawOld']=_0x232751[0x0]['content'],_0x134adc['documentVersion']=_0x232751[0x0]['version'],_0x345496?.['signal']?.['aborted'])return _0x134adc['abort'](),_0x134adc;const _0x24164d=this['context']['plugins']['get']('AIConnector')['processDocument']({'document':_0x134adc['contentRawOld'],'prompt':_0x20486e,'model':_0x345496['model']});let _0x7ffb08;if(_0x345496?.['signal']){if(_0x345496['signal']['aborted'])return _0x24164d['abortController']['abort'](),_0x134adc['abort'](),_0x134adc;const _0x114ab7=_0x345496['signal'],_0x3cb9bd=()=>_0x24164d['abortController']['abort']();_0x114ab7['addEventListener']('abort',_0x3cb9bd),_0x7ffb08=()=>_0x114ab7['removeEventListener']('abort',_0x3cb9bd);}try{const _0x212c8f=await _0x24164d['getResult']();if(!(_0x212c8f&&_0x212c8f['document']&&_0x212c8f['document']['length']>0x0))throw new ht('ai-documentprocessinggateway-empty-reply',this);_0x134adc['contentRawNew']=_0x212c8f['document'],_0x134adc['summary']=_0x212c8f['summary']||'';}catch(_0x403fb5){_0x403fb5 instanceof Error&&_0x403fb5['message']['includes']('ai-request-aborted')?_0x134adc['abort']():_0x134adc['error']=_0x403fb5 instanceof ht?_0x403fb5:new ht('ai-documentprocessinggateway-run-failed',this,{},_0x403fb5);}finally{_0x7ffb08&&_0x7ffb08();}return _0x134adc;}['applyResult'](_0x4b4efa,_0x22de1a){this['context']['plugins']['get']('AIGateway')['apply'](_0x4b4efa,_0x22de1a);}};function en(_0x1fb3ac){return _0x1fb3ac instanceof Error&&('AbortError'===_0x1fb3ac['name']||('AICoreError'===_0x1fb3ac['name']?!0x0===_0x1fb3ac['isAbort']:_0x1fb3ac['message']['startsWith']('ai-request-aborted')));}var sn=class extends Error{['code'];['severity'];['type'];['context'];['isAbort'];constructor(_0x1bb428){super(_0x1bb428['code'],_0x1bb428['cause']instanceof Error?{'cause':_0x1bb428['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0x1bb428['code'],this['severity']=_0x1bb428['severity']??'error',this['type']=_0x1bb428['type']??'system',this['context']=_0x1bb428['context'],this['isAbort']=_0x1bb428['isAbort']??en(_0x1bb428['cause']);}},nn=class extends _0xe5ed07{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['createReporter'](_0xc2b5e2){return new rn(this,_0xc2b5e2);}},rn=class{['_sink'];['_component'];constructor(_0x3d9ab5,_0x144f4f){this['_sink']=_0x3d9ab5,this['_component']=_0x144f4f;}['logError'](_0x217ef8,_0x3437fe={}){this['_emit'](_0x217ef8,_0x3437fe),this['_defaultLog'](_0x217ef8);}['reportError'](_0x1c5bad,_0x5867d9={}){this['_emit'](_0x1c5bad,_0x5867d9);}['_emit'](_0x3128a1,_0x1bfc2b){en(_0x3128a1)||this['_sink']['fire']('error',{'error':_0x3128a1,'component':this['_component'],'context':_0x1bfc2b['context']});}['_defaultLog'](_0x514464){if(!en(_0x514464)){if(_0x514464 instanceof sn){if('user'===_0x514464['type']||'network'===_0x514464['type'])return;if('warning'===_0x514464['severity'])return void console['warn'](this['_component'],_0x514464);}console['error'](this['_component'],_0x514464);}}};const on='ck-ai-button-primary',an='ck-ai-button-secondary',hn='ck-ai-button-tertiary';function cn(_0x5501ed,_0x561833){const _0x135b11=new Ht(_0x5501ed),_0x3816b8=us(_0x5501ed,'AI_TABS_LABEL_MINIMIZE'),_0x31e061=us(_0x5501ed,'AI_TABS_LABEL_MAXIMIZE');return _0x135b11['set']({'withText':!0x1,'icon':_0x1ff167,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+hn}),_0x135b11['bind']('label')['to'](_0x561833,'isMaximized',_0x5b916b=>_0x5b916b?_0x3816b8:_0x31e061),_0x135b11['bind']('icon')['to'](_0x561833,'isMaximized',_0x218e9f=>_0x218e9f?_0x3bd917:_0x1ff167),_0x135b11['bind']('isOn')['to'](_0x561833,'isMaximized'),_0x135b11['on']('execute',()=>{_0x561833['fire']('resizeTabs');}),_0x135b11;}function ln(_0x8aebc0){const _0x3af07a=new Lt(_0x8aebc0);return _0x3af07a['attachToDom'](),_0x3af07a['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x3af07a;}const un=/* #__PURE__ -- @preserve */
28
- gt();var dn=class extends un{['id'];['interactionId'];['type'];['content']=new Map();['sources']=[];['parsedContent']=new Map();['parsedMergedContent']=new Map();['changeGroups']=[];['areActionsDisabled']=!0x1;['isFromHistory']=!0x1;['documentContextContent'];['_documentIdToSource']=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];['cachedSuggestionContentParts']={'withDiff':[],'withoutDiff':[]};constructor({type:_0x13f4d4,isDone:_0x4c1829=!0x1,isComplete:_0x26b842,interactionId:_0x4fd2df,areActionsDisabled:_0x19e5b,isFromHistory:_0x21e1c9=!0x1,documentContextContent:_0x2b5fb2,locale:_0x8158eb,id:_0x3ef35a,channelsToEditors:_0x5e84fc}){super(),this['id']=_0x3ef35a||vt(),this['interactionId']=_0x4fd2df,this['type']=_0x13f4d4,this['areActionsDisabled']=!!_0x19e5b,this['isFromHistory']=_0x21e1c9,this['locale']=_0x8158eb,this['aiResponseParser']=new Hs(),this['aiResponseApplier']=new ys(),this['documentContextContent']=new Map(_0x2b5fb2?.['map'](_0x57d67=>[_0x57d67['id'],ps(_0x57d67['content'])])||[]),this['_documentIdToSource']=new Map(_0x2b5fb2?.['map'](_0x16b0f7=>[_0x16b0f7['id'],{'editor':_0x5e84fc['get'](_0x16b0f7['channelId']),'rootName':_0x16b0f7['rootName']}])||[]),this['set']('isDone',_0x4c1829),this['set']('isComplete',_0x26b842??_0x4c1829),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x530dce,_0x5070a0){const _0x11a381='text'===this['type']?'text':_0x5070a0;this['content']['has'](_0x11a381)||this['content']['set'](_0x11a381,''),this['content']['set'](_0x11a381,this['content']['get'](_0x11a381)+_0x530dce),this['onContentChange'](_0x11a381);}['done'](_0x56e16e=!0x0){this['isComplete']=_0x56e16e,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x5cc236,_0x3f4e3b){this['changeGroups'][_0x5cc236]['state']=_0x3f4e3b,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x5cc236,'state':_0x3f4e3b});}['getContentParts']({showDiff:_0x46e8da,groupIndex:_0xff2d1}){const _0x4aac47=this['_getCachedContentParts'](_0x46e8da,_0xff2d1);if(_0x4aac47)return _0x4aac47;let _0x39300f=[];if(void 0x0===_0xff2d1)_0x39300f=this['changeGroups'];else{const _0x59f97f=this['changeGroups']['find'](({index:_0x9b123d})=>_0x9b123d===_0xff2d1);if(!_0x59f97f)throw new ht('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0xff2d1});_0x39300f=[_0x59f97f];}const _0x5a0faa=Vs({'showDiff':_0x46e8da,'changeGroups':_0x39300f,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x46e8da,_0x5a0faa),_0x5a0faa;}['_getCachedContentParts'](_0x48c4ab,_0x279d7c){const _0x5f3fe1=_0x48c4ab?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x5f3fe1]['length'])return null;const _0x333a72=this['cachedSuggestionContentParts'][_0x5f3fe1];if(void 0x0===_0x279d7c)return _0x333a72['length']>0x0&&_0x333a72['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x48c4ab,null),null):_0x22e557(_0x333a72);{const _0x2d1738=_0x333a72['find'](({index:_0x229638})=>_0x229638===_0x279d7c);if(_0x2d1738)return[_0x22e557(_0x2d1738)];}return null;}['_setCachedContentParts'](_0x348234,_0xebf313){const _0x5b8cf1=_0x348234?'withDiff':'withoutDiff';_0xebf313?_0xebf313['forEach'](_0x493519=>{const _0x7a1a40=this['cachedSuggestionContentParts'][_0x5b8cf1],_0x3dbcfe=_0x7a1a40['find'](({index:_0x31d037})=>_0x31d037===_0x493519['index']);if(_0x3dbcfe){const _0x22deaf=_0x7a1a40['indexOf'](_0x3dbcfe);_0x7a1a40['splice'](_0x22deaf,0x1,_0x493519);}else _0x7a1a40['push'](_0x493519);}):this['cachedSuggestionContentParts'][_0x5b8cf1]['length']=0x0;}['onContentChange'](_0x3af4be){if('modification'===this['type']){if(_0x3af4be)this['parsedContent']['set'](_0x3af4be,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x3af4be)));else{for(const [_0x1f0a40,_0x2c262a]of this['content'])this['parsedContent']['set'](_0x1f0a40,this['aiResponseParser']['parseAndNormalizeHTML'](_0x2c262a));}const _0x57c93f=this['changeGroups'];for(const _0x758f6e of this['content']['keys']())this['updateChangeGroups'](_0x758f6e);const _0x221a6e=this['_getDifferentChangeGroups'](_0x57c93f,this['changeGroups']);(_0x221a6e['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x221a6e),this['cachedSuggestionContentParts']['withDiff']['length']=this['cachedSuggestionContentParts']['withoutDiff']['length']=0x0);}else this['parsedContent']['set']('text',this['aiResponseParser']['convertMarkdownToHTML'](this['content']['get']('text'))),this['fire']('replyContentUpdated',this);}['_getDifferentChangeGroups'](_0x38541c,_0x3cba10){const _0x58d3d3=[];for(const _0x5b020 of _0x3cba10){const _0x93242=_0x38541c[_0x5b020['index']];_0x93242?_0x93242['changes']['length']!==_0x5b020['changes']['length']?_0x58d3d3['push'](_0x5b020):_0x93242['changes']['forEach']((_0x356aac,_0x3e0704)=>{const _0x52c486=_0x5b020['changes'][_0x3e0704];_0x356aac['id']!==_0x52c486['id']&&_0x58d3d3['push'](_0x5b020);}):_0x58d3d3['push'](_0x5b020);}return _0x58d3d3;}['updateChangeGroups'](_0x33e0eb){const _0x5b60f5=this['documentContextContent']['get'](_0x33e0eb),_0x652c62=this['parsedContent']['get'](_0x33e0eb);if(!_0x5b60f5||!_0x652c62)return;const _0x59c833=new _0x14308e('p',{},[new _0x14308e('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x336fe1(us(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x2b2b6d=this['aiResponseApplier']['merge'](_0x652c62,_0x5b60f5['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x59c833});this['parsedMergedContent']['set'](_0x33e0eb,_0x2b2b6d['parsedContent']);let _0x23e16e=[];if(_0xec138b(_0x438386=>{const _0x4a18bb=fs(_0x438386,'data-id');if(!_0x4a18bb||!_0x1db930(_0x4a18bb))return!0x1;const _0x15a8a0=[_0x438386,...Rs(_0x438386)]['at'](-0x2);if(_0x438386!=_0x15a8a0){const _0x569c09=fs(_0x15a8a0,'data-id');_0x1db930(_0x569c09)||(_0x23e16e['push']({'node':_0x15a8a0,'id':_0x569c09,'type':'modified'}),_0x2b2b6d['modifiedNodeIds']['push'](_0x569c09));}else _0x2b2b6d['modifiedNodeIds']['includes'](_0x4a18bb)?_0x23e16e['push']({'node':_0x438386,'type':'modified','id':_0x4a18bb}):_0x2b2b6d['newNodeIds']['includes'](_0x4a18bb)?_0x23e16e['push']({'node':_0x438386,'type':'new','id':_0x4a18bb,'anchorId':fs(_0x438386['previousSibling'],'data-id')}):_0x23e16e['push']({'node':_0x438386,'type':'removed','id':_0x4a18bb});return!0x0;},this['parsedMergedContent']['get'](_0x33e0eb)),_0x23e16e=_0x23e16e['filter'](({node:_0x11d139})=>[...Rs(_0x11d139),_0x11d139]['every'](_0x497ca6=>!fs(_0x497ca6,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x578dea=>_0x578dea['documentId']!==_0x33e0eb),0x0==_0x23e16e['length'])return;const _0x526923=[[_0x23e16e[0x0]]];for(let _0x44b1f7=0x1;_0x44b1f7<_0x23e16e['length'];_0x44b1f7++){const _0x21de27=_0x526923[_0x526923['length']-0x1],_0x338db8=_0x21de27[_0x21de27['length']-0x1];_0x23e16e[_0x44b1f7]['node']['previousSibling']==_0x338db8['node']&&'modified'!=_0x23e16e[_0x44b1f7]['type']&&'modified'!=_0x338db8['type']?_0x21de27['push'](_0x23e16e[_0x44b1f7]):_0x526923['push']([_0x23e16e[_0x44b1f7]]);}for(const _0x470d79 of _0x526923){const _0x218904=_0x470d79[0x0],_0x3d29fd=_0x470d79[_0x470d79['length']-0x1],_0x25b4c4=_0x50690f(_0x218904['node']['previousSibling']);_0x25b4c4&&_0x470d79['unshift'](_0x25b4c4);const _0x1ec211=_0x50690f(_0x3d29fd['node']['nextSibling']);_0x1ec211&&_0x470d79['push'](_0x1ec211);}Ts('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x33e0eb))['forEach'](_0x3551bb=>{bs(_0x3551bb,'data-wrapped-id',null);});const _0x5d6844=new Map();Ts('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x33e0eb))['forEach'](_0xa0d710=>{const _0x487708=fs(_0xa0d710,'data-unwrapped-id'),_0x52aa7e=fs(_0xa0d710,'data-id');_0x5d6844['set'](_0x52aa7e,_0x487708),bs(_0xa0d710,'data-id',_0x487708),bs(_0xa0d710,'data-unwrapped-id',null);});for(const _0x184899 of _0x23e16e){const _0xe6a90d=_0x5d6844['get'](_0x184899['id']);_0xe6a90d&&(_0x184899['id']=_0xe6a90d);}this['changeGroups']['push'](..._0x526923['map']((_0x22cc05,_0x86cc08)=>({'changes':_0x22cc05,'state':'pending','index':_0x86cc08,'editor':this['_documentIdToSource']['get'](_0x33e0eb)['editor'],'rootName':this['_documentIdToSource']['get'](_0x33e0eb)['rootName'],'documentId':_0x33e0eb})));const _0x4e5cef=Array['from'](this['documentContextContent']['keys']());function _0x1db930(_0x212765){return _0x2b2b6d['modifiedNodeIds']['includes'](_0x212765)||_0x2b2b6d['newNodeIds']['includes'](_0x212765)||_0x2b2b6d['removedNodeIds']['includes'](_0x212765);}function _0x50690f(_0x1821e2){if(_0x1821e2&&fs(_0x1821e2,'data-id')&&!fs(_0x1821e2,'data-unstable')){const _0x17863e=fs(_0x1821e2,'data-id');if(!_0x1db930(_0x17863e))return{'node':_0x1821e2,'type':'context','id':_0x17863e};}return null;}this['changeGroups']['sort']((_0x4dba1e,_0x2aeeb8)=>_0x4e5cef['indexOf'](_0x4dba1e['documentId'])-_0x4e5cef['indexOf'](_0x2aeeb8['documentId'])),this['changeGroups']['forEach']((_0x2c9d47,_0x30c5b0)=>{_0x2c9d47['index']=_0x30c5b0;});}};const _n=/* #__PURE__ -- @preserve */
29
- ut(),gn=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];var An=class extends _n{['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;['_channelsToEditors'];constructor({connector:_0x92581d,locale:_0x11321f,channelsToEditors:_0x297b3b}){super(),this['id']=vt(),this['connector']=_0x92581d,this['isStopped']=!0x0,this['locale']=_0x11321f,this['_channelsToEditors']=_0x297b3b||new Map();}async['start'](){await this['_run']();}async['resume'](_0x10ae46){await this['_run'](_0x10ae46);}async['_run'](_0xd8306e){const _0x467778=[];let _0x57b3bb,_0x1914c2,_0x3c8457,_0x885e7a=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0xd8306e||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x51678b=await this['currentRequest']['getStream']();for await(const _0x2e6eb5 of _0x51678b){if(this['isStopped'])return;if('error'==_0x2e6eb5['event'])return void this['fire']('error',{'error':new ht('ai-chat-interaction-error',this)});switch(_0x2e6eb5['event']){case'message-metadata':this['messageId']=_0x2e6eb5['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x2e6eb5['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x2e6eb5['data']['conversationTitle'],!0x0);break;case'source':_0x467778['push'](_0x2e6eb5['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'](),_0x57b3bb='modification-delta'==_0x2e6eb5['event']?'modification':'text',_0x1914c2='modification-delta'==_0x2e6eb5['event']?_0x2e6eb5['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x57b3bb&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x57b3bb,'interactionId':this['id'],'id':_0x1914c2,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x2e6eb5['event']&&{'documentId':_0x2e6eb5['data']['documentId']}}),'modification'==_0x57b3bb&&(this['currentReply']['sources']=_0x467778['splice'](0x0))),this['currentReply']['appendContent'](_0x2e6eb5['data']['textDelta'],_0x2e6eb5['data']['documentId']);break;case'mcp-tool-result':_0x3c8457=JSON['parse'](_0x2e6eb5['data']['result']),this['_handleToolResultData']({'toolName':_0x2e6eb5['data']['toolName'],'data':_0x3c8457['data'],'attributes':_0x3c8457['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x2e6eb5['data']['toolName'],'data':_0x2e6eb5['data']['data']});}}_0x885e7a=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x467778['length']>0x0&&(this['currentReply']['sources']=_0x467778['splice'](0x0)),this['_finalizeInteraction'](_0x885e7a),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x47e2b2){return this['replies']['find'](_0x4e9dee=>_0x4e9dee['id']===_0x47e2b2);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x5723a5=>_0x5723a5['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x4bc7ad){const _0x483972=this['getDocumentContext'](),_0x680b93=new dn({'locale':this['locale'],'documentContextContent':_0x483972?.['documents'],..._0x4bc7ad});return this['replies']['push'](_0x680b93),_0x680b93['delegate'](...gn)['to'](this),this['fire']('replyCreated',_0x680b93),_0x680b93;}['setConversationTitle'](_0x53c5a5,_0x1d2cdd=!0x1){this['fire']('setConversationTitle',_0x53c5a5,_0x1d2cdd);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x151aa1){this['fire']('toolDataReceived',{'type':'result','toolName':_0x151aa1['toolName'],'data':structuredClone(_0x151aa1['data']||{}),'attributes':structuredClone(_0x151aa1['attributes']||{})},this);}['_handleToolNotificationData'](_0x5dc783){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x5dc783['toolName'],'data':structuredClone(_0x5dc783['data'])},this);}['_finalizeInteraction'](_0x523158=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x523158),this['currentRequest']=this['currentReply']=void 0x0;}};const In=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']]),pn=/* #__PURE__ -- @preserve */
30
- gt(),mn=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];var En=class AIChatContext extends pn{['_connector'];['_config'];['_ownerId'];constructor({connector:_0xfed6b2,config:_0x12bfff,ownerId:_0x5cb20e}){super(),this['_connector']=_0xfed6b2,this['_config']=_0x12bfff,this['_ownerId']=_0x5cb20e;}['init'](){this['_pendingContextItems']=new Map(),this['_conversationContextItems']=new Map(),this['_ongoingUploads']=new Map(),this['_ongoingUploadOperations']=new Map(),this['_setAddContextOptionsDefaultState']();}['getPendingContextItems'](){return new Map(this['_pendingContextItems']);}async['populateFromMessage'](_0x2efe9e,_0x1b81ac){const _0xca17a4=new Map(),{contextItem:_0x55359d,hasUnmatched:_0x33b976}=await this['_populateDocumentContextItem'](_0x2efe9e,_0x1b81ac);_0x55359d&&_0xca17a4['set'](_0x55359d['id'],_0x55359d);for(const _0x333785 of _0x2efe9e){if('document'===_0x333785['type'])continue;const _0x2da404=await this['_createContextItemFromContent'](_0x333785);this['_addToConversationContextItem'](_0x2da404),_0xca17a4['set'](_0x2da404['id'],_0x2da404);}return{'contextItems':_0xca17a4,'hasUnmatched':_0x33b976};}async['_populateDocumentContextItem'](_0x562dab,_0x5d30d0){const _0x17e5c9=_0x562dab['filter'](_0x70d24b=>'document'===_0x70d24b['type']);if(0x0===_0x17e5c9['length'])return{'hasUnmatched':!0x1};const _0xdebf65=_0x17e5c9['map'](_0x388df9=>_0x388df9['id']),_0x232061=await this['_connector']['fetchDocuments'](this['_ownerId'],_0xdebf65)['getDocuments'](),_0x464f37=new Map(_0x232061['map'](_0x11618d=>[_0x11618d['id'],_0x11618d])),_0x9db851=[];let _0x33a49c=!0x1;for(const _0x5158b6 of _0x17e5c9){const _0x44dacf=_0x464f37['get'](_0x5158b6['id']);_0x44dacf&&(this['_matchDocumentToRoot'](_0x44dacf,_0x5d30d0)||(_0x33a49c=!0x0),_0x9db851['push']({'id':_0x44dacf['id'],'content':_0x44dacf['content'],'version':_0x44dacf['attributes']?.['version']??0x0,'sessionId':_0x44dacf['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x44dacf['attributes']?.['channelId']??_0x5d30d0[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x44dacf['attributes']?.['rootName']??_0x5d30d0[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0x327173={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x9db851};return this['_addToConversationContextItem'](_0x327173),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x327173,'hasUnmatched':_0x33a49c};}['_matchDocumentToRoot'](_0x1557c1,_0x576335){const _0x452b47=_0x1557c1['attributes']?.['channelId'],_0xe64dc8=_0x1557c1['attributes']?.['rootName'];if(_0x452b47&&_0xe64dc8){for(const _0x25ddcd of _0x576335)if(_0x25ddcd['config']['get']('collaboration.channelId')===_0x452b47){for(const _0x393ac0 of _0x25ddcd['model']['document']['getRoots']())if('$graveyard'!==_0x393ac0['rootName']&&_0x393ac0['rootName']===_0xe64dc8)return{'editor':_0x25ddcd,'rootName':_0x393ac0['rootName']};}}}async['_createContextItemFromContent'](_0x5daf11){return'mcp-tool-context'===_0x5daf11['type']?{'id':_0x5daf11['id'],'uiId':_0x5daf11['id'],'label':_0x5daf11['data']?.['label']||_0x5daf11['id'],'type':'mcp-tool-context','mcpServerName':_0x5daf11['mcpServerName'],'toolName':_0x5daf11['toolName'],'data':_0x5daf11['data']||{}}:{'id':_0x5daf11['id'],'uiId':_0x5daf11['id'],'label':_0x5daf11['attributes']?.['label']||_0x5daf11['name']||_0x5daf11['url']||_0x5daf11['id'],'type':_0x5daf11['type'],..._0x5daf11?.['attributes']?.['resourceId']?{'resourceId':_0x5daf11['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0xe224df){this['_pendingContextItems']['get'](_0xe224df)?.['isReadOnly']||this['_removeContextItem'](_0xe224df);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x4a18d1 of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x4a18d1['uiId']);const _0x4aaa6f=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x4aaa6f&&this['_addContextItem']({..._0x4aaa6f,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x29ddcb){for(const _0x2fe580 of _0x29ddcb['values']())this['_addToConversationContextItem'](_0x2fe580);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'](_0x546f9d){return Array['from'](_0x546f9d['values']())['flatMap'](_0x535fe8=>this['_mapContextItemToRequestData'](_0x535fe8));}async['addFilesToContext'](_0x54328d,_0x32fa82,_0x4127fc='file'){const _0x1031d8='files-'+vt();this['_startUploadOperation'](_0x1031d8);try{await Promise['all'](_0x54328d['map'](async _0x338c17=>{const _0x47835f='file-'+vt(),_0x5a3c4f=_0x3c76b5(_0x338c17['name']),_0x57fd77='file'===_0x4127fc&&_0x338c17['type']['startsWith']('image/')?'image':_0x4127fc;try{this['_addContextItem']({'type':_0x57fd77,'label':_0x32fa82?.['label']||_0x5a3c4f,'uiId':_0x47835f,'resourceId':_0x32fa82?.['resourceId']},!0x0);const _0x326816=this['_connector']['uploadFile'](this['_ownerId'],_0x338c17,_0x32fa82);this['_ongoingUploads']['set'](_0x47835f,_0x326816['abortController']);const {id:_0x2dc9b2}=await _0x326816['getId']();this['_ongoingUploads']['delete'](_0x47835f),this['_finishContextItemLoading']({'type':_0x57fd77,'id':_0x2dc9b2,'label':_0x32fa82?.['label']||_0x5a3c4f,'uiId':_0x47835f,'resourceId':_0x32fa82?.['resourceId']},!0x1);}catch(_0x4e774){if(this['_ongoingUploads']['delete'](_0x47835f),!en(_0x4e774)){const _0xa82276=new sn({'code':In['get'](_0x4e774['code'])||'ai-chat-file-upload-failed','cause':_0x4e774,'context':{'fileName':_0x5a3c4f}});this['fire']('error',{'error':_0xa82276});}this['_removeContextItem'](_0x47835f);}}));}finally{this['_finishUploadOperation'](_0x1031d8);}}['addCurrentDocumentToContext'](_0x2eb969){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x28571b={'type':'document','uiId':'current-document','label':_0x2eb969,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x28571b);}async['updateCurrentDocuments'](_0x2d0959){const _0x2d2d43=this['_pendingContextItems']['get']('current-document');if(!_0x2d2d43||!_0x2d0959['length']||_0x2d0959['every'](_0x982fcc=>!_0x982fcc['content']))return;_0x2d0959['length']>0x1&&_0x2d0959['some'](_0x5090cc=>!_0x5090cc['description'])&&bt('ai-chat-documents-missing-description');try{const _0x8d9932=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x2d0959)['getIds']();if(_0x8d9932['length']!==_0x2d0959['length']||_0x8d9932['some'](_0x2d6c6c=>!_0x2d6c6c?.['id'])){const _0xd3da80=new ht('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0xd3da80});}_0x2d2d43['documents']=_0x2d0959['map']((_0x363408,_0xe10826)=>{return{'id':_0x8d9932[_0xe10826]['id'],'content':_0x363408['content'],'version':_0x363408['version'],'sessionId':_0x363408['sessionId'],'selection':(_0x5e3abd=_0x363408['selections'],_0x5e3abd?_0x5e3abd['map'](_0x25c2f4=>({'start':_0x25c2f4['start'],'end':_0x25c2f4['end']})):[]),'channelId':_0x363408['channelId'],'rootName':_0x363408['rootName']};var _0x5e3abd;});}catch(_0x3b50f2){const _0x3c45ff=new sn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x3b50f2});this['fire']('error',{'error':_0x3c45ff});}}['addSelectionToContext'](_0x3ea7df){this['_addContextItem']({'type':'selection','label':_0x3ea7df,'uiId':'selection','content':_0x3ea7df});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x437a62,_0x575680){const _0x4ea67c='url-'+vt();this['_startUploadOperation'](_0x4ea67c);const _0x4bb417='url-'+vt();try{this['_addContextItem']({'type':'web-resource','label':_0x575680?.['label']||_0x437a62,'uiId':_0x4bb417,'resourceId':_0x575680?.['resourceId']},!0x0);const _0xf2f838=this['_connector']['uploadUrl'](this['_ownerId'],_0x437a62,_0x575680);this['_ongoingUploads']['set'](_0x4bb417,_0xf2f838['abortController']);const {id:_0x92b17b}=await _0xf2f838['getId']();this['_ongoingUploads']['delete'](_0x4bb417),this['_finishContextItemLoading']({'type':'web-resource','id':_0x92b17b,'label':_0x575680?.['label']||_0x437a62,'uiId':_0x4bb417,'resourceId':_0x575680?.['resourceId']},!0x1);}catch(_0x23be15){this['_ongoingUploads']['delete'](_0x4bb417),en(_0x23be15)||this['fire']('error',{'error':new ht('ai-chat-url-upload-failed',this,{'url':_0x437a62,'originalError':_0x23be15}),'url':_0x437a62}),this['_removeContextItem'](_0x4bb417);}finally{this['_finishUploadOperation'](_0x4ea67c);}}['addToolItemToContext'](_0x851183){_0x851183['id']=_0x851183['id']??vt()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x851183['uiId'],_0x851183),this['fire']('contextItemAdded',{'contextItem':_0x851183,'isLoading':!0x1});}async['loadSourceResources'](_0x462f6f,_0x5d4dae,_0xb1c8bf){const _0x265376=this['_addContextOptionsState']['sources']['find'](_0x537398=>_0x537398['id']===_0x462f6f);if(!_0x265376)return this['fire']('error',{'error':new ht('ai-chat-source-not-found',this,{'sourceId':_0x462f6f}),'sourceId':_0x462f6f}),[];try{const _0x53173c=(await _0x265376['getResources'](_0x5d4dae))['map'](_0x51a626=>{const _0x3f6673=this['_isResourceInContext'](_0x51a626['id']);return{..._0x51a626,'isInContext':_0x3f6673};});return _0x265376['resources']=_0x53173c,this['fire']('sourceResourcesLoaded',{'sourceId':_0x462f6f,'source':_0x265376,'resources':_0x53173c,'uid':_0xb1c8bf}),_0x53173c;}catch(_0x43382a){return this['fire']('error',{'error':new ht('ai-chat-source-resources-load-failed',this,{'sourceId':_0x462f6f,'originalError':_0x43382a}),'sourceId':_0x462f6f,'sourceLabel':_0x265376['label']}),[];}}async['addResourceToContext'](_0x2e5392,_0x308570){if(this['_isResourceInContext'](_0x308570['id']))return;let _0x1b8775=_0x308570['data'];if(!_0x1b8775&&_0x2e5392['getData'])try{_0x1b8775=await _0x2e5392['getData'](_0x308570['id']);}catch(_0x2fa5d7){return void this['fire']('error',{'error':new ht('ai-chat-resource-load-failed',this,{'resourceId':_0x308570['id'],'sourceId':_0x2e5392['id'],'originalError':_0x2fa5d7}),'resourceId':_0x308570['id'],'sourceId':_0x2e5392['id']});}if(_0x1b8775)switch(_0x308570['type']){case'web-resource':if('string'!=typeof _0x1b8775)return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x308570['id'],'sourceId':_0x2e5392['id'],'expectedType':'string','actualType':typeof _0x1b8775}),'resourceId':_0x308570['id'],'sourceId':_0x2e5392['id']});await this['addUrlToContext'](_0x1b8775,{'label':_0x308570['label'],'resourceId':_0x308570['id']});break;case'file':if(!(_0x1b8775 instanceof File))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x308570['id'],'sourceId':_0x2e5392['id'],'expectedType':'File','actualType':typeof _0x1b8775}),'resourceId':_0x308570['id'],'sourceId':_0x2e5392['id']});await this['addFilesToContext']([_0x1b8775],{'label':_0x308570['label'],'resourceId':_0x308570['id']});break;case'text':if('object'!=typeof _0x1b8775||!('content'in _0x1b8775)||!('type'in _0x1b8775))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x308570['id'],'sourceId':_0x2e5392['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x1b8775}),'resourceId':_0x308570['id'],'sourceId':_0x2e5392['id']});_0x1b8775=AIChatContext['_convertTextResourceToFile'](_0x1b8775,_0x308570['label']),await this['addFilesToContext']([_0x1b8775],{'label':_0x308570['label'],'resourceId':_0x308570['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ht('ai-chat-context-unsupported-type',this,{'resourceId':_0x308570['id'],'sourceId':_0x2e5392['id'],'resourceType':_0x308570['type']}),'resourceId':_0x308570['id'],'sourceId':_0x2e5392['id']});}else this['fire']('error',{'error':new ht('ai-chat-resource-no-data',this,{'resourceId':_0x308570['id'],'sourceId':_0x2e5392['id']}),'resourceId':_0x308570['id'],'sourceId':_0x2e5392['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0x3159ff){if(void 0x0!==_0x3159ff)this['_addContextOptionsState']['document']['isHidden']=!_0x3159ff;else{const _0x5c954e=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x5c954e;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x4f6a0e,_0x30de07){switch(_0x4f6a0e['type']){case'markdown':return new File([_0x4f6a0e['content']],_0x30de07,{'type':'text/markdown'});case'html':return new File([_0x4f6a0e['content']],_0x30de07,{'type':'text/html'});default:return new File([_0x4f6a0e['content']],_0x30de07,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x2e2c15){switch(_0x2e2c15['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x2e2c15['id']}];case'web-resource':return[{'type':'web-resource','id':_0x2e2c15['id']}];case'document':return _0x2e2c15['documents']?.['length']?_0x2e2c15['documents']['map'](_0x3e6fa3=>({'type':'document','id':_0x3e6fa3['id'],..._0x3e6fa3['selection']?.['length']&&{'selection':_0x3e6fa3['selection']}})):[];case'mcp-tool-context':{const _0xadc0aa=_0x2e2c15;return[{'type':'mcp-tool-context','mcpServerName':_0xadc0aa['mcpServerName'],'toolName':_0xadc0aa['toolName'],'data':{..._0xadc0aa['data'],'label':_0xadc0aa['label']||_0xadc0aa['data']?.['label']||_0xadc0aa['id']},'id':_0xadc0aa['id']}];}default:return[];}}['_addContextItem'](_0x2dba1d,_0x4a679c=!0x1){if(this['_pendingContextItems']['set'](_0x2dba1d['uiId'],_0x2dba1d),_0x2dba1d['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x2dba1d,'isLoading':_0x4a679c}),'current-document'===_0x2dba1d['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x2dba1d['resourceId']){const _0x28f3b9=this['_findSourceIdsByResourceId'](_0x2dba1d['resourceId']);_0x28f3b9&&_0x28f3b9['forEach'](_0x3c09a7=>{this['_updateResourceInContextState'](_0x3c09a7,_0x2dba1d['resourceId'],!0x0);});}}['_removeContextItem'](_0x185d68){const _0x2030c4=this['_pendingContextItems']['get'](_0x185d68),_0x2a4bd8=this['_ongoingUploads']['get'](_0x185d68);if(_0x2a4bd8&&(_0x2a4bd8['abort'](),this['_ongoingUploads']['delete'](_0x185d68)),_0x2030c4?.['resourceId']){const _0x5aa7ff=this['_findSourceIdsByResourceId'](_0x2030c4['resourceId']);_0x5aa7ff&&_0x5aa7ff['forEach'](_0x2f5785=>{this['_updateResourceInContextState'](_0x2f5785,_0x2030c4['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x185d68),this['fire']('contextItemRemoved',{'uiId':_0x185d68,'type':_0x2030c4?.['type']}),'current-document'===_0x185d68&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x3c8948,_0x372c9a){if(this['_pendingContextItems']['has'](_0x3c8948['uiId'])&&(this['_pendingContextItems']['set'](_0x3c8948['uiId'],_0x3c8948),this['fire']('contextItemLoadingEnded',{'contextItem':_0x3c8948,'isLoading':_0x372c9a}),_0x3c8948['resourceId'])){const _0x489a22=this['_findSourceIdsByResourceId'](_0x3c8948['resourceId']);_0x489a22&&_0x489a22['forEach'](_0x267b52=>{this['_updateResourceInContextState'](_0x267b52,_0x3c8948['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x3727c5){this['_conversationContextItems']['set'](_0x3727c5['uiId'],_0x3727c5);}['_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'](_0x207285=>({..._0x207285,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x3746e9=>({..._0x3746e9,'resources':[]}))??[];}['_isResourceInContext'](_0x55998d){for(const _0x5b54f8 of this['_pendingContextItems']['values']())if(_0x5b54f8['resourceId']===_0x55998d)return!0x0;for(const _0x4b2adf of this['_conversationContextItems']['values']())if(_0x4b2adf['resourceId']===_0x55998d)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x26491c){const _0x4b4092=[];for(const _0x1a2494 of this['_addContextOptionsState']['sources'])_0x1a2494['resources']['find'](_0x36b650=>_0x36b650['id']===_0x26491c)&&_0x4b4092['push'](_0x1a2494['id']);return 0x0===_0x4b4092['length']?null:_0x4b4092;}['_updateResourceInContextState'](_0x299941,_0x493f55,_0x567cc2){const _0x2cf774=this['_addContextOptionsState']['sources']['find'](_0x2f5b00=>_0x2f5b00['id']===_0x299941);if(!_0x2cf774)return;const _0x4c241e=_0x2cf774['resources']['find'](_0xf82bf7=>_0xf82bf7['id']===_0x493f55);_0x4c241e&&(_0x4c241e['isInContext']=_0x567cc2,this['fire']('resourceStateChanged',{'sourceId':_0x299941,'resourceId':_0x493f55,'isInContext':_0x567cc2}));}['_startUploadOperation'](_0x2f22ab){this['_ongoingUploadOperations']['set'](_0x2f22ab,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x3a7a07){this['_ongoingUploadOperations']['delete'](_0x3a7a07),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}};const Tn=/* #__PURE__ -- @preserve */
31
- ut(),wn=['capabilitiesUpdated'];var Cn=class extends Tn{['_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'](_0xc53a8f){const _0x45b56f={};return _0xc53a8f&&_0xc53a8f['isWebSearchEnabled']&&(_0x45b56f['webSearch']={}),_0xc53a8f&&_0xc53a8f['isReasoningEnabled']&&(_0x45b56f['reasoning']={}),_0x45b56f;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x5f2a69){_0x5f2a69!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x5f2a69,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x328db8){_0x328db8!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x328db8,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}},fn=class extends An{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x669ef2){super(_0x669ef2),this['conversationId']=_0x669ef2['conversationId'],this['contextItems']=_0x669ef2['contextItems'],this['capabilities']=_0x669ef2['capabilities'],this['userMessage']=_0x669ef2['userMessage'],this['model']=_0x669ef2['model'],this['attributes']=_0x669ef2['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':En['mapContextItemsToRequestData'](this['contextItems']),'capabilities':Cn['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}};const bn=/* #__PURE__ -- @preserve */
32
- ut();var Sn=class extends bn{['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];['_channelsToEditors'];['_getSessionId'];constructor(_0x233c4c){super(),this['options']=_0x233c4c,this['connector']=_0x233c4c['connector'],this['chatModels']=_0x233c4c['chatModels'],this['id']=_0x233c4c['conversationId'],this['isFromHistory']=_0x233c4c['isFromHistory'],this['_channelsToEditors']=_0x233c4c['channelsToEditors'],this['_getSessionId']=_0x233c4c['getSessionId'];}async['init'](_0x58f564){try{this['chatContext']=new En({'connector':this['connector'],'config':_0x58f564,'ownerId':this['id']}),this['chatContext']['delegate'](...mn)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new Cn(),this['chatCapabilities']['delegate'](...wn)['to'](this),this['chatCapabilities']['init']();const _0x31c791=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x31c791});const _0x22bafb=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x22bafb&&await this['setModel'](_0x22bafb);}catch(_0x3c4c1e){const _0x5c1e67=new sn({'code':'ai-chat-conversation-init-failed','cause':_0x3c4c1e,'type':'network'});this['fire']('error',{'error':_0x5c1e67});}}async['start'](){if(this['isStarted'])throw new ht('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new ht('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x3eb5d8}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x3eb5d8,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x128a86){const _0x20a3de=new sn({'code':'ai-chat-conversation-start-failed','cause':_0x128a86,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x20a3de}),_0x20a3de;}}async['load'](_0x550eb9){try{const _0x270942=await this['connector']['fetchConversation'](_0x550eb9)['getConversation'](),_0x23ac85=await this['connector']['fetchConversationMessages'](_0x550eb9)['getMessages'](),_0x5e8aa6=_0x23ac85[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x270942['id'],'title'in _0x270942?this['fire']('setConversationTitle',_0x270942['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']);const _0x10c105=(await this['chatModels']['getAll']())['find'](_0x57a9d5=>_0x57a9d5['id']['toLowerCase']()===_0x5e8aa6['toLowerCase']());this['selectedModel']=_0x10c105,this['fire']('modelSelected',{'selectedModel':_0x10c105,'isDisabled':!0x0});const {streamingMessageId:_0x1348c4}=await this['_processMessagesToInteractions'](_0x23ac85,_0x5e8aa6);return _0x1348c4&&this['currentInteraction']?this['_resumeStream'](_0x1348c4):this['currentInteraction']=void 0x0,this;}catch(_0x395ac2){const _0x30d1fd=new sn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x395ac2,'type':'network','context':{'conversationId':_0x550eb9}});throw this['fire']('error',{'error':_0x30d1fd}),_0x30d1fd;}}async['_processMessagesToInteractions'](_0x4e19f4,_0x4937fe){let _0x3fa9d2,_0x320f2e,_0x13822b=!0x1;for(const _0x300a28 of _0x4e19f4)if('user'===_0x300a28['role']){const {contextItems:_0x1d6cca,hasUnmatched:_0x2bc70e}=await this['_extractContextItems'](_0x300a28);_0x13822b=_0x2bc70e;const _0x12058c={'isReasoningEnabled':Object['hasOwn'](_0x300a28['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x300a28['capabilities'],'webSearch')};_0x3fa9d2=this['createInteraction']({'userMessage':_0x300a28['prompt'],'contextItems':_0x1d6cca,'capabilities':_0x12058c,'modelId':_0x4937fe,'attributes':_0x300a28['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x3fa9d2,_0x320f2e=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x300a28['role']&&_0x3fa9d2){if('streaming'===_0x300a28['status']){_0x320f2e=_0x300a28['id'];continue;}if('error'===_0x300a28['status'])continue;const _0x1a9792=[];for(const _0x30f27c of _0x300a28['content'])switch(_0x30f27c['type']){case'text':case'modification':{const _0x5bf75e=_0x3fa9d2['getDocumentContext'](),_0x194b91=this['_hasSessionMismatch'](_0x5bf75e)||_0x13822b;_0x3fa9d2['currentReply']?.['type']!==_0x30f27c['type']&&(_0x3fa9d2['currentReply']=_0x3fa9d2['createReply']({'type':_0x30f27c['type'],'isDone':!0x0,'interactionId':_0x3fa9d2['id'],'areActionsDisabled':_0x194b91,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x1a9792['length']>0x0&&(_0x3fa9d2['currentReply']['sources']=_0x1a9792['splice'](0x0))),_0x3fa9d2['currentReply']['appendContent'](_0x30f27c['content'],_0x30f27c['documentId']);break;}case'url':_0x1a9792['push'](_0x30f27c);break;case'mcp-tool-result':{const {data:_0x36ce47,attributes:_0x3a8e30}=JSON['parse'](_0x30f27c['content']);_0x3fa9d2['_handleToolResultData']({'toolName':_0x30f27c['toolName'],'data':_0x36ce47,'attributes':_0x3a8e30});break;}}'cancelled'===_0x300a28['status']&&this['fire']('error',{'interactionId':_0x3fa9d2['id'],'error':new ht('ai-request-aborted',this)});}}return{'streamingMessageId':_0x320f2e};}async['_resumeStream'](_0x324dbb){if(this['currentInteraction'])try{const _0x3a839f=this['connector']['resumeStream'](this['id'],_0x324dbb);await this['currentInteraction']['resume'](_0x3a839f);}catch(_0x524165){_0x524165 instanceof ht&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x524165});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0x4e5a89){return _0x4e5a89['content']?this['chatContext']['populateFromMessage'](_0x4e5a89['content'],Array['from'](this['_channelsToEditors']['values']())):{'contextItems':new Map(),'hasUnmatched':!0x1};}async['handleUserInteraction']({userMessage:_0x38b330,attributes:_0x13722d}){if(!this['isStarted'])throw new ht('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new ht('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0xa05548=new Map(this['getPendingContextItems']()),_0x27f768=this['chatCapabilities']['getCapabilitiesConfig'](),_0x78ddaf=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x38b330,'contextItems':_0xa05548,'capabilities':_0x27f768,'modelId':_0x78ddaf,'attributes':_0x13722d,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x47f623){if(_0x47f623 instanceof ht)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x47f623});else{const _0x5c56fd=In['get'](_0x47f623['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ht(_0x5c56fd,null,{'error':_0x47f623})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x254c06,contextItems:_0x242c95,capabilities:_0x1645d2,modelId:_0x48a71b,attributes:_0x3449f6,channelsToEditors:_0x1d8cb5}){const _0x5d445f=new fn({'userMessage':_0x254c06,'contextItems':_0x242c95,'capabilities':_0x1645d2,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x48a71b,'attributes':_0x3449f6,'channelsToEditors':_0x1d8cb5});return _0x5d445f['delegate'](...gn)['to'](this),this['interactions']['push'](_0x5d445f),this['fire']('interactionCreated',_0x5d445f),_0x5d445f;}['getInteraction'](_0x3cd75d){return this['interactions']['find'](_0x483504=>_0x483504['id']===_0x3cd75d);}['removeInteraction'](_0x1fc52f){const _0x99cc9b=this['getInteraction'](_0x1fc52f);_0x99cc9b&&(_0x99cc9b['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x99cc9b),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x492d4f=this['lastInteraction'];_0x492d4f?.['conversationId']&&_0x492d4f['messageId']&&this['connector']['cancelStream'](_0x492d4f['conversationId'],_0x492d4f['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0x30b12d){this['chatContext']['addCurrentDocumentToContext'](_0x30b12d);}async['updateCurrentDocumentsInContext'](_0x5c4c94){await this['chatContext']['updateCurrentDocuments'](_0x5c4c94);}['toggleAddCurrentDocumentOptionVisibility'](_0xd9407c){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0xd9407c);}['_hasSessionMismatch'](_0x413d78){return!!_0x413d78&&_0x413d78['documents']['some'](_0x5b8d17=>{const _0x10836c=this['_channelsToEditors']['get'](_0x5b8d17['channelId']);return!_0x10836c||_0x5b8d17['sessionId']!==this['_getSessionId'](_0x10836c);});}['addSelectionToContext'](_0x3fcf47){this['chatContext']['addSelectionToContext'](_0x3fcf47);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x13c712){this['chatContext']['addFilesToContext'](_0x13c712);}['addUrlToContext'](_0x5c7cbf){this['chatContext']['addUrlToContext'](_0x5c7cbf);}['addToolItemToContext'](_0x128bd1){this['chatContext']['addToolItemToContext'](_0x128bd1);}['addResourceToContext'](_0x269193,_0x2685dd){this['chatContext']['addResourceToContext'](_0x269193,_0x2685dd);}['loadSourceResources'](_0x2c498d,_0x1d7d4e,_0x21f092){return this['chatContext']['loadSourceResources'](_0x2c498d,_0x1d7d4e,_0x21f092);}['removeFromContext'](_0x55cc84){this['chatContext']['removeFromContext'](_0x55cc84);}['setWebSearch'](_0x41e681){this['chatCapabilities']['setWebSearch'](_0x41e681);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x2278f4){this['chatCapabilities']['setReasoning'](_0x2278f4);}['toggleReasoning'](){this['chatCapabilities']['toggleReasoning']();}['isCurrentDocumentInContext'](){return this['chatContext']['isCurrentDocumentInContext']();}['isCurrentDocumentInConversation'](){return this['chatContext']['isCurrentDocumentInConversation']();}['isSelectionInContext'](){return this['chatContext']['isSelectionInContext']();}['getPendingContextItems'](){return this['chatContext']['getPendingContextItems']();}async['setModel'](_0x3f8e3d){_0x3f8e3d?!0x1===await this['chatModels']['isAvailable'](_0x3f8e3d)&&(bt('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x3f8e3d}),_0x3f8e3d=(await this['chatModels']['getAvailableModels']())[0x0]):(bt('ai-chat-conversation-set-model-null',{'conversation':this}),_0x3f8e3d=(await this['chatModels']['getAvailableModels']())[0x0]),_0x3f8e3d['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x3f8e3d,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x3f8e3d}));}};function Rn({documentSuggestions:_0x450a1e,transform:_0x559bbc,documentCompare:_0x5098f6,documentCompareOptions:_0x4a7651}){const _0x21d740=new Map();for(const [_0x288ae7,{groups:_0x91280a,documentContext:_0x4eea9e,documentContent:_0x35035e,editor:_0x2b1eae}]of _0x450a1e){const _0x408064=_0x4eea9e['content'],_0x464ab9=_0x4eea9e['version'],_0x1e3804=_0x35035e['cloneNode'](!0x0);for(const {changes:_0x3ae403}of _0x91280a){const _0x24aa29=_0x3ae403['filter'](_0xe9b6d5=>'new'!=_0xe9b6d5['type'])['map'](_0x57ca70=>Es('data-id',_0x57ca70['id'],_0x1e3804))['filter'](_0x32350e=>null!==_0x32350e),_0x2dc29f=_0x3ae403['filter'](_0x1d1076=>'removed'!=_0x1d1076['type'])['map'](_0x5118b3=>_0x5118b3['node']['cloneNode'](!0x0));let _0x18d0e5=null;if(_0x24aa29['length']){_0x18d0e5=_0x24aa29[0x0]['previousSibling'];for(let _0x90b32e=0x0;_0x90b32e<_0x24aa29['length'];_0x90b32e++)_0x8128e7(_0x24aa29[_0x90b32e]);}if(_0x2dc29f['length']){_0x18d0e5||(_0x3ae403[0x0]['anchorId']?_0x18d0e5=Es('data-id',_0x3ae403[0x0]['anchorId'],_0x1e3804):(_0x18d0e5=_0x2dc29f['shift'](),_0x2ecd48(_0x1e3804,_0x18d0e5)));for(let _0x53a6fc=0x0;_0x53a6fc<_0x2dc29f['length'];_0x53a6fc++)_0x1418e3(_0x18d0e5,_0x2dc29f[_0x53a6fc]),_0x18d0e5=_0x2dc29f[_0x53a6fc];}}const _0x204ed5=ms(_0x1e3804),_0x21b0c8=_0x5098f6['getDiff'](_0x408064,_0x204ed5,{'targetEditor':_0x2b1eae,'anchor':_0x4eea9e['rootName'],..._0x4a7651})['getOperations']();if(_0x559bbc){const _0x2bacf1=_0x2b1eae['model']['document']['history']['getOperations'](_0x464ab9),_0x59c313={'document':_0x2b1eae['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x21d740['set'](_0x288ae7,_0x17dc83(_0x21b0c8,_0x2bacf1,_0x59c313)['operationsA']);}else _0x21d740['set'](_0x288ae7,_0x21b0c8);}return _0x21d740;}function On({groups:_0x1d8d80,documentContextContent:_0x1ac2cf,documents:_0x5079a4}){const _0xdd084f=new Map();for(const _0x5d2856 of _0x1d8d80){const {documentId:_0x3beb58}=_0x5d2856,_0x95727b=_0xdd084f['get'](_0x3beb58);if(_0x95727b)_0x95727b['groups']['push'](_0x5d2856),_0x95727b['indexes']['push'](_0x5d2856['index']);else{const _0x525a23=_0x5079a4['find'](_0x38d011=>_0x38d011['id']===_0x3beb58),_0x38c946=_0x1ac2cf['get'](_0x3beb58);if(!_0x525a23||!_0x38c946)continue;_0xdd084f['set'](_0x3beb58,{'groups':[_0x5d2856],'documentContext':_0x525a23,'documentContent':_0x38c946,'editor':_0x5d2856['editor'],'indexes':[_0x5d2856['index']]});}}return _0xdd084f;}function vn(_0x2e363a,_0xc20701){const _0x49f041=_0x2e363a['files']['length']>0x0&&_0x2e363a['files']['every'](_0x15e4b4=>_0x15e4b4['type']['startsWith']('image/')),_0x1dd4fe=_0x2e363a['plainText']['trim']()['length']>0x0;if(_0x2e363a['files']['length']>0x0&&_0xc20701['filesEnabled']&&(!_0x49f041||!_0x1dd4fe)){const _0x3a3338=_0x2e363a['files']['filter'](_0x275469=>_0x275469['name']);return _0x3a3338['length']>0x0?{'type':'file','files':_0x3a3338}:null;}if(_0xc20701['urlsEnabled']){const _0x31deb0=function(_0x539b29){const _0x1d0aaf=_0x539b29['trim']();if(/\s/['test'](_0x1d0aaf))return null;try{const _0x192a9f=new URL(_0x1d0aaf);return'http:'!==_0x192a9f['protocol']&&'https:'!==_0x192a9f['protocol']?null:_0x192a9f['toString']();}catch{return null;}}(_0x2e363a['plainText']);if(_0x31deb0)return{'type':'url','url':_0x31deb0};}const _0x15af53=_0x2e363a['forceTextAttachment']?0x1:_0xc20701['longTextThreshold']??0x1/0x0;if(_0x2e363a['plainText']['length']>=Math['max'](_0x15af53,0x1)&&_0xc20701['filesEnabled']){const _0x47ddab=_0xc20701['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x2e363a['plainText']],_0x47ddab,{'type':'text/plain'})]};}return null;}var kn=class extends _0xe5ed07{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_reporter'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[ls,nn,_0x5d031e];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['set']('isConversationReady',!0x1),this['_bodyCollection']=ln(this['context']['locale']),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_reporter']=this['context']['plugins']['get'](nn)['createReporter']('aichat'),this['_aiChatModels']=new Qs({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x9e9fff=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x183db7,_0x5fa1cf)=>{this['_handleUIUserMessage']({'message':_0x5fa1cf});}),this['listenTo'](_0x9e9fff['view'],'change:activeTab',(_0x7408c0,_0x2edf17,_0x42ffae)=>{'chat'!==_0x42ffae&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',async()=>{await this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext'](),this['activeConversation']?.['cancelLastInteractionStream']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0xac7c7d,_0x43c90a)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x43c90a));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x288bab,_0x3ec916)=>{this['activeConversation']?.['addUrlToContext'](_0x3ec916);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x4dd0f1,_0x3e5974)=>{const _0x28c6ba=this['activeConversation'];if(!_0x28c6ba)return;_0x3e5974['hasDirectory']&&(_0x3e5974['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+vt()}));const _0x18ec48=vn(_0x3e5974,{'pastedTextLabel':us(this['context']['locale'],'AI_CHAT_CONTEXT_PASTED_TEXT_NAME'),'longTextThreshold':this['context']['config']['get']('ai.chat.context.paste.textThreshold'),'filesEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.files.enabled'),'urlsEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.urls.enabled')});_0x18ec48&&(_0x3e5974['preventDefault'](),'url'===_0x18ec48['type']?_0x28c6ba['addUrlToContext'](_0x18ec48['url']):_0x28c6ba['chatContext']['addFilesToContext'](_0x18ec48['files'],void 0x0,_0x18ec48['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x572e60,_0x1df74a)=>{_0x1df74a['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x123a1f,_0x4319f8)=>{this['activeConversation']?.['addResourceToContext'](_0x4319f8['source'],_0x4319f8['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x5d0b8e,_0x2012fa)=>{this['_removeFromContext'](_0x2012fa);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x4dc1a9,_0xf5c7d0)=>{this['activeConversation']?.['loadSourceResources'](_0xf5c7d0['sourceId'],_0xf5c7d0['query'],_0xf5c7d0['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x2f51e1,_0x12ed4e)=>{this['activeConversation']?.['setModel'](_0x12ed4e);}),this['listenTo'](this['_aiChatUi'],'like',(_0x35528a,{replyId:_0x106c69})=>{console['log']('Liked\x20response',_0x106c69);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x3951ac,{replyId:_0x50466d})=>{console['log']('Disliked\x20response',_0x50466d);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x475aa2,_0x14ebc5)=>{this['_insertSuggestion'](_0x14ebc5);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0xc8e35c,{replyId:_0x4e9381,partIndex:_0x5808d6})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x4e9381,_0x5808d6);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x32f973,{replyId:_0x314225,partIndex:_0x446de8})=>{const _0x5cbc73=this['_getDocumentRangeForReplyChanges'](_0x314225,_0x446de8);if(!_0x5cbc73)return;const {reply:_0x3c0d84}=this['getInteractionAndReplyById'](_0x314225);'$graveyard'!=_0x5cbc73['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x3c0d84['changeGroups'][_0x446de8]['editor'],'ranges':[_0x5cbc73['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0xf00b4d,_0x354ee1)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x354ee1);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x5a309c,{replyId:_0x3fd900,showDiff:_0x5bb631})=>{const {interaction:_0x4c126a,reply:_0x2c4bf4}=this['getInteractionAndReplyById'](_0x3fd900),_0x9468e1=_0x2c4bf4['getContentParts']({'showDiff':_0x5bb631});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x4c126a['id']+':'+_0x2c4bf4['id'],'parts':_0x9468e1});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x2b3791,{replyId:_0x5bc08c,partIndex:_0x593749})=>{this['_rejectSuggestion']({'replyId':_0x5bc08c,'partIndex':_0x593749}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x22859e,_0x1af729)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x1af729);}),this['on']('replyCreated',(_0x44b4a1,_0x2f9761)=>{this['_addFeedItemReply'](_0x2f9761);});}['afterInit'](){this['context']instanceof _0xbe1e8b?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x5a795a,_0x3aca2f)=>{_0x3aca2f['on']('ready',()=>{this['_integrateEditor'](_0x3aca2f);});}),this['_initConversation']();}async['_initConversation'](){const _0x43481e=this['context']['config']['get']('ai.chat.initialConversation');let _0x43f5aa=_0x43481e;('lastCreated'!=_0x43481e||(_0x43f5aa=await this['_getLastCreatedConversationId'](),_0x43f5aa))&&('new'==_0x43f5aa?await this['_startConversationSafely']():await this['loadConversation'](_0x43f5aa));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x1c1228){this['_closeActiveBalloon'](),this['context']['plugins']['get'](cs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();try{this['_aiChatUi']['emptyConversationTitle'](),await this['_aiConnector']['fetchConversation'](_0x1c1228)['getConversation'](),await this['_startConversationSafely']({'id':_0x1c1228}),await this['activeConversation']['load'](_0x1c1228),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x3dad78){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x1c1228}),this['_reporter']['logError'](new ht('ai-chat-conversation-not-found',this,void 0x0,_0x3dad78),{'context':{'operation':'load-conversation'}});}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x37fa10){let _0x4bac0c=null,_0x4acd21=null;this['on']('toolDataReceived',(_0x218329,_0x4d76dd,_0x1c5479)=>{_0x1c5479['id']!==_0x4bac0c&&(_0x4bac0c=_0x1c5479['id'],_0x4acd21=this['_getAIChatFeedAPI'](_0x1c5479)),_0x37fa10(_0x4d76dd,_0x4acd21);});}['addCurrentDocumentToChatContext'](){ds(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](us(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0x48dbae){const _0x20ea86=this['_aiEditing']['getSelectionText'](_0x48dbae);this['activeConversation']?.['addSelectionToContext'](_0x20ea86),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x2db1d7){await this['_startConversationSafely']({'modelId':_0x2db1d7?.['modelId']});}async['sendMessage'](_0x2ba813){await this['_handleUIUserMessage'](_0x2ba813);}['getGroupId'](){const _0x20c0eb=this['context']['config']['get']('collaboration.channelId');if(!_0x20c0eb)throw new ht('ai-missing-channel-id',this);return _0x20c0eb;}['_handleRemovedConversation'](_0x14ec83){this['activeConversation']['id']===_0x14ec83&&this['_startConversationSafely']();}['_prepareDocumentSuggestions'](_0x2ad876){const {reply:_0x2319cb,interaction:_0x5e978d}=this['getInteractionAndReplyById'](_0x2ad876['replyId']),_0x558e8e=void 0x0!==_0x2ad876['partIndex']?[_0x2319cb['changeGroups'][_0x2ad876['partIndex']]]:_0x2319cb['changeGroups']['filter'](_0x2fe830=>'pending'==_0x2fe830['state']);return _0x558e8e['map'](_0x564fdd=>_0x2319cb['changeGroups']['indexOf'](_0x564fdd))['forEach'](_0x490a03=>{const _0x301756=this['_getDocumentRangeForReplyChanges'](_0x2ad876['replyId'],_0x490a03);_0x301756&&'$graveyard'!=_0x301756['range']['root']['rootName']?(_0x2319cb['setChangeGroupState'](_0x490a03,'accepted'),void 0x0!==_0x2ad876['partIndex']&&this['_scrollToSuggestionRange'](_0x301756['range'],!0x1,_0x301756['targetEditor'])):_0x2319cb['setChangeGroupState'](_0x490a03,'outdated');}),On({'groups':_0x558e8e['filter'](_0xbb610e=>'accepted'===_0xbb610e['state']),'documentContextContent':_0x2319cb['documentContextContent'],'documents':_0x5e978d['getDocumentContext']()?.['documents']??[]});}['_insertSuggestion'](_0x247ec9){const _0x141d22=this['context']['plugins']['get'](_0x5d031e),{reply:_0x32bdbd,interaction:_0x3cfb10}=this['getInteractionAndReplyById'](_0x247ec9['replyId']),_0x5a2022=this['_prepareDocumentSuggestions'](_0x247ec9),_0x2945af=Rn({'documentSuggestions':_0x5a2022,'transform':!0x0,'documentCompare':_0x141d22,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0x13e652,_0x46bbc6]of _0x2945af){const {editor:_0x48092a,indexes:_0x1d71b2}=_0x5a2022['get'](_0x13e652);if(!_0x48092a['plugins']['has']('TrackChanges')){bt('ai-no-track-changes',{'editor':_0x48092a});continue;}let _0x49a185;zs(_0x46bbc6,'chat'),_0x48092a['model']['change'](_0x5cad09=>{_0x49a185=_0x5cad09['batch'],_0x48092a['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x46bbc6),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x49a185,{'interactionId':_0x3cfb10['id'],'replyId':_0x32bdbd['id'],'indexes':_0x1d71b2});}this['_updateRatings'](_0x32bdbd);}['_applySuggestion'](_0x1ac679){const _0x369468=this['context']['plugins']['get'](_0x5d031e),{reply:_0x434fae,interaction:_0x2dab89}=this['getInteractionAndReplyById'](_0x1ac679['replyId']),_0x169130=this['_prepareDocumentSuggestions'](_0x1ac679),_0x16f82b=Rn({'documentSuggestions':_0x169130,'transform':!0x0,'documentCompare':_0x369468,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0x548e92,_0x3922ec]of _0x16f82b){const {editor:_0x411341,indexes:_0x5b0a27}=_0x169130['get'](_0x548e92);let _0x58e125;zs(_0x3922ec,'chat');try{_0x411341['model']['change'](_0x18eb13=>{_0x58e125=_0x18eb13['batch'],_0x369468['applyOperations'](_0x18eb13,_0x3922ec);}),this['_batchToChanges']['set'](_0x58e125,{'interactionId':_0x2dab89['id'],'replyId':_0x434fae['id'],'indexes':_0x5b0a27});}catch(_0x12aac6){throw this['_reporter']['logError'](new sn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x12aac6})),_0x12aac6;}}this['_updateRatings'](_0x434fae);}['_rejectSuggestion'](_0x3b44a3){const {reply:_0x3f7fe6}=this['getInteractionAndReplyById'](_0x3b44a3['replyId']);_0x3f7fe6['setChangeGroupState'](_0x3b44a3['partIndex'],'rejected');}['_openBalloonFor'](_0x14f7ed,_0x254938){if(!this['_hasAIChatBalloon'])return;const {reply:_0xf1ba7a}=this['getInteractionAndReplyById'](_0x14f7ed),_0x11fd92=_0xf1ba7a['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x11fd92['length'])return;let _0x20234d,_0x1548b9;if(void 0x0!==_0x254938?(_0x1548b9=_0x11fd92['find'](_0x133fe8=>_0x133fe8['index']==_0x254938),_0x20234d=_0x1548b9?.['index']):(_0x1548b9=_0x11fd92[0x0],_0x20234d=_0x1548b9['index']),!_0x1548b9)return void _0xf1ba7a['setChangeGroupState'](_0x254938??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x14f7ed&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x20234d)return;const _0x21d44d=this['_getUserPresentableContentPartDocumentRange'](_0x14f7ed,_0xf1ba7a,_0x1548b9),_0x4a2a67=_0xf1ba7a['changeGroups']['find'](_0x385826=>_0x385826['index']==_0x20234d)['editor'],_0x25524e=_0x4a2a67['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x25524e&&this['_activeBalloon']['close'](),!_0x21d44d)return _0x25524e['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x25524e,this['_currentPreviewedChangeGroup']={'replyId':_0x14f7ed,'partIndex':_0x20234d},this['_scrollToSuggestionRange'](_0x21d44d,!0x0,_0x4a2a67);const _0x42266b=this['_getPresentableSiblingContentPartIndex'](_0x14f7ed,_0x20234d,'next');_0x25524e['clearContent'](),_0x25524e['updateContent']({'part':_0x1548b9,'renderingStrategy':'static'}),_0x25524e['open']({'index':_0x20234d,'title':us(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x20234d+0x1)['toString']()),'showRotator':null!==_0x42266b,'ranges':[_0x21d44d],'areActionsDisabled':_0xf1ba7a['areActionsDisabled'],'targetEditor':_0x4a2a67}),_0x25524e['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x14f7ed,_0x20234d),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x14f7ed,'index':_0x20234d,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0x38841d,_0x50cf12,_0x13f0a8){const {reply:_0x43e9f1}=this['getInteractionAndReplyById'](_0x38841d),_0x50a724=_0x43e9f1['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x50a724['length'])return null;const _0xd37f81='next'==_0x13f0a8?0x1:-0x1;function _0x38b58b(_0x46ae34){const _0x192db3=(_0x46ae34+_0xd37f81+_0x50a724['length'])%_0x50a724['length'];return{'siblingIndex':_0x192db3,'siblingPart':_0x50a724[_0x192db3]};}const _0x2c5f89=_0x50a724['findIndex'](_0xa26342=>_0xa26342['index']==_0x50cf12);let {siblingIndex:_0x979861,siblingPart:_0x35c382}=_0x38b58b(_0x2c5f89);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x38841d,_0x43e9f1,_0x35c382);)if({siblingIndex:_0x979861,siblingPart:_0x35c382}=_0x38b58b(_0x979861),_0x979861===_0x2c5f89)return null;return _0x35c382['index'];}['_getUserPresentableContentPartDocumentRange'](_0x481e0f,_0x39cee8,_0x3469e3){const _0x515929=_0x39cee8['changeGroups'];if(!_0x3469e3['hasChanges'])return null;const _0x246255=_0x515929['find'](_0x3c6575=>_0x3c6575['index']==_0x3469e3['index']);if('pending'!==_0x246255?.['state'])return null;if(!_0x246255?.['editor']||'destroyed'===_0x246255['editor']['state'])return _0x39cee8['setChangeGroupState'](_0x3469e3['index'],'outdated'),null;const _0x757d24=this['_getDocumentRangeForReplyChanges'](_0x481e0f,_0x3469e3['index']);if(!_0x757d24)return _0x39cee8['setChangeGroupState'](_0x3469e3['index'],'outdated'),null;const {range:_0x1f4fa2,currentIndex:_0x5192ff}=_0x757d24;return'$graveyard'==_0x1f4fa2['root']['rootName']?(_0x39cee8['setChangeGroupState'](_0x5192ff,'outdated'),null):_0x757d24['range'];}['_getDocumentRangeForReplyChanges'](_0x5ea1a7,_0x396a53){const {reply:_0xecbb24,interaction:_0x18fbd}=this['getInteractionAndReplyById'](_0x5ea1a7),_0x1dc6b2=_0xecbb24['changeGroups']['filter'](_0x10dbfd=>'pending'==_0x10dbfd['state']),_0x43c594=_0x1dc6b2['map'](_0xe72f52=>_0xecbb24['changeGroups']['indexOf'](_0xe72f52));void 0x0===_0x396a53&&(_0x396a53=_0x43c594[0x0]);const _0x336e17=_0x43c594['indexOf'](_0x396a53);if(-0x1==_0x336e17)return null;const _0x37d644=_0x1dc6b2[_0x336e17],_0x199e1c=_0x37d644['editor'];if(!_0x199e1c||'destroyed'===_0x199e1c['state'])return null;if(!_0x5c2cc5(_0x199e1c,_0x37d644['rootName']))return null;const _0xde0e2f=_0xecbb24['documentContextContent']['get'](_0x37d644['documentId']),_0x24a873=new _0x5e7b74([]),_0x1f4995=new _0x5e7b74([]);for(const _0x4748dc of _0x37d644['changes'])if('removed'!=_0x4748dc['type']&&_0x1f4995['children']['push'](_0x4748dc['node']['cloneNode'](!0x0)),'new'!=_0x4748dc['type']){const _0x36fa00=ti(_0x6c2e49=>fs(_0x6c2e49,'data-id')==_0x4748dc['id'],_0xde0e2f,!0x0);_0x24a873['children']['push'](_0x36fa00['cloneNode'](!0x0));}if(0x0==_0x24a873['children']['length']){if(_0x37d644['changes'][0x0]['anchorId']){const _0x3760ca=Es('data-id',_0x37d644['changes'][0x0]['anchorId'],_0xde0e2f);_0x24a873['children']['unshift'](_0x3760ca['cloneNode'](!0x0)),_0x1f4995['children']['unshift'](_0x3760ca['cloneNode'](!0x0)),_0x3760ca['nextSibling']&&(_0x24a873['children']['push'](_0x3760ca['nextSibling']['cloneNode'](!0x0)),_0x1f4995['children']['push'](_0x3760ca['nextSibling']['cloneNode'](!0x0)));}else{const _0x2b46bf=_0xde0e2f['children'][0x0];if(!_0x2b46bf)return null;_0x24a873['children']['push'](_0x2b46bf['cloneNode'](!0x0)),_0x1f4995['children']['push'](_0x2b46bf['cloneNode'](!0x0));}}const _0x321ded=_0x18fbd['getDocumentContext'](),_0x16cc64=_0x321ded['documents']['find'](_0x477d22=>_0x477d22['id']==_0x37d644['documentId'])['content'],_0xd6db81=_0x199e1c['model']['document']['getRoot'](_0x37d644['rootName']),_0x581684=_0x199e1c['data']['parse'](_0x16cc64,_0xd6db81),_0x2520ca=ms(_0x24a873),_0x7981bf=_0x199e1c['data']['parse'](_0x2520ca,_0xd6db81),_0x11154b=_0x199e1c['data']['parse'](_0x2520ca,_0xd6db81),_0x35884d=_0x199e1c['model']['createPositionAt'](_0x7981bf,0x0),_0xa6e0d1=ms(_0x1f4995),_0x17fb25={'targetEditor':_0x199e1c,'anchor':_0x35884d,'markDeletions':!0x1};let _0x1fd09d;try{_0x1fd09d=_0x199e1c['plugins']['get'](_0x5d031e)['getDiff'](_0x2520ca,_0xa6e0d1,_0x17fb25)['getOperations']();}catch(_0x41514f){return this['_reporter']['reportError'](new sn({'code':'ai-chat-suggestion-diff-failed','type':'runtime','severity':'warning','cause':_0x41514f,'context':{'replyId':_0x5ea1a7,'partIndex':_0x396a53}})),null;}if(!_0x1fd09d['length'])return null;_0x199e1c['model']['change'](_0x192f73=>{for(const _0xe42e39 of _0x1fd09d)if('remove'==_0xe42e39['type']){const _0x1ec9d6=_0xe42e39['sourcePosition'],_0x27df6b=_0xe42e39['howMany'],_0x2e377d=new _0x2c93bf(_0x1ec9d6,_0x27df6b);_0x192f73['batch']['addOperation'](_0x2e377d),_0x199e1c['model']['applyOperation'](_0x2e377d);}else'marker'!==_0xe42e39['type']&&(_0xe42e39['baseVersion']=null,_0xe42e39['isDocumentOperation']=!0x1,_0x192f73['batch']['addOperation'](_0xe42e39),_0x199e1c['model']['applyOperation'](_0xe42e39));});const _0x2c3e88=Gs(_0x199e1c,_0x1fd09d,_0x7981bf);Ks(_0x199e1c['model'],_0x2c3e88);const _0x1941c9=_0x2c3e88['getFirstRange']()['start']['path']['slice'](),_0x417fb6=_0x2c3e88['getFirstRange']()['end']['path']['slice'](),_0x1cb680=[];let _0x1234ca=_0x7981bf,_0x21dba3=_0x11154b;for(let _0x3edde9=0x0;_0x3edde9<_0x417fb6['length'];_0x3edde9++){const _0x527730=_0x1234ca['maxOffset']-_0x417fb6[_0x3edde9];_0x1cb680[_0x3edde9]=_0x21dba3['maxOffset']-_0x527730,_0x1234ca=_0x1234ca['getChildAtOffset'](_0x417fb6[_0x3edde9]),_0x21dba3=_0x21dba3['getChildAtOffset'](_0x1cb680[_0x3edde9]);}const _0x2ba786=_0x199e1c['model']['createRange'](_0x199e1c['model']['createPositionFromPath'](_0x11154b,_0x1941c9),_0x199e1c['model']['createPositionFromPath'](_0x11154b,_0x1cb680)),_0x420361=_0x11154b['getChild'](0x0)['getAttribute'](_0x389bd6),_0x5a58cf=Array['from'](_0x581684['getChildren']())['find'](_0x211902=>_0x211902['getAttribute'](_0x389bd6)==_0x420361)['getPath'](),_0x24a0ab=_0x2ba786['start']['path']['slice'](),_0xb2a450=_0x2ba786['end']['path']['slice']();_0x24a0ab[0x0]=_0x5a58cf[0x0]+_0x24a0ab[0x0],_0xb2a450[0x0]=_0x5a58cf[0x0]+_0xb2a450[0x0];let _0x4121ef=_0x199e1c['model']['createRange'](_0x199e1c['model']['createPositionFromPath'](_0x199e1c['model']['document']['getRoot'](_0x37d644['rootName']),_0x24a0ab),_0x199e1c['model']['createPositionFromPath'](_0x199e1c['model']['document']['getRoot'](_0x37d644['rootName']),_0xb2a450));const _0x4073fc=_0x321ded['documents']['find'](_0xf1fd21=>_0xf1fd21['id']==_0x37d644['documentId'])['version'],_0x494dd4=_0x199e1c['model']['document']['history']['getOperations'](_0x4073fc);for(const _0x3de2cf of _0x494dd4)_0x4121ef=_0x34b9eb['_createFromRanges'](_0x4121ef['getTransformedByOperation'](_0x3de2cf));return{'range':_0x4121ef,'currentIndex':_0x396a53,'targetEditor':_0x199e1c};}['_integrateEditorBalloon'](_0x5069aa){if(!_0x5069aa['plugins']['has']('AIChatBalloon'))return;const _0x4af06d=_0x5069aa['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x4af06d['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x4af06d,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x33c9c7,partIndex:_0x5c6eaa}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0xee6121}=this['getInteractionAndReplyById'](_0x33c9c7),_0x8f2fe0=_0xee6121['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x5c6eaa});_0x4af06d['updateContent']({'part':_0x8f2fe0[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x4af06d,'applySuggestion',()=>{const {replyId:_0x3385eb,partIndex:_0x5bdf6b}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x3385eb,'partIndex':_0x5bdf6b}),_0x4af06d['setState']('accepted');}),this['listenTo'](_0x4af06d,'insertSuggestion',()=>{const {replyId:_0x37f51b,partIndex:_0x23f276}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x37f51b,'partIndex':_0x23f276}),_0x4af06d['setState']('accepted');}),this['listenTo'](_0x4af06d,'rejectSuggestion',()=>{const {replyId:_0x28ffac,partIndex:_0x17ac64}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x28ffac,'partIndex':_0x17ac64}),_0x4af06d['setState']('rejected');}),this['listenTo'](_0x4af06d,'showNext',()=>{const {replyId:_0x4d375d,partIndex:_0x38991c}=this['_currentPreviewedChangeGroup'],_0x210397=this['_getPresentableSiblingContentPartIndex'](_0x4d375d,_0x38991c,'next');null!==_0x210397&&this['_openBalloonFor'](_0x4d375d,_0x210397);}),this['listenTo'](_0x4af06d,'showPrevious',()=>{const {replyId:_0x151f03,partIndex:_0xed0017}=this['_currentPreviewedChangeGroup'],_0x53b4cf=this['_getPresentableSiblingContentPartIndex'](_0x151f03,_0xed0017,'previous');null!==_0x53b4cf&&this['_openBalloonFor'](_0x151f03,_0x53b4cf);}),this['listenTo'](_0x4af06d,'dialogClosed',(_0x42eb09,{id:_0x28e27f})=>{if('aiChatBalloon'!==_0x28e27f)return;const {replyId:_0x48abb8,partIndex:_0x49c0f5}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x48abb8,'index':_0x49c0f5,'isActive':!0x1}),this['_activeBalloon']===_0x4af06d&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0x18799a){if(this['_channelsToEditors']['set'](_0x18799a['config']['get']('collaboration.channelId'),_0x18799a),this['_integrateEditorBalloon'](_0x18799a),this['addCurrentDocumentToChatContext'](),_0x18799a['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x18799a['plugins']['has']('Undo')){const _0x3b8ed9=_0x18799a['commands']['get']('undo'),_0x5707ce=_0x18799a['commands']['get']('redo');this['listenTo'](_0x3b8ed9,'revert',(_0x477ccc,_0x262672,_0xcfb720)=>{const _0x45647f=this['_batchToChanges']['get'](_0x262672);if(!_0x45647f)return;const _0x17884f=this['activeConversation']['getInteraction'](_0x45647f['interactionId']),_0x1c2699=_0x17884f?.['getReply'](_0x45647f['replyId']);this['_batchToChanges']['delete'](_0x262672),_0x17884f&&_0x1c2699&&(_0x45647f['indexes']['forEach'](_0x521b5a=>_0x1c2699['setChangeGroupState'](_0x521b5a,'pending')),this['_batchToChanges']['set'](_0xcfb720,_0x45647f));}),this['listenTo'](_0x5707ce,'revert',(_0x10afe8,_0xd58faf,_0x753659)=>{const _0x3e670c=this['_batchToChanges']['get'](_0xd58faf);if(!_0x3e670c)return;const _0x4b4695=this['activeConversation']['getInteraction'](_0x3e670c['interactionId']),_0x21c676=_0x4b4695?.['getReply'](_0x3e670c['replyId']);this['_batchToChanges']['delete'](_0xd58faf),_0x4b4695&&_0x21c676&&(_0x3e670c['indexes']['forEach'](_0x3c9491=>_0x21c676['setChangeGroupState'](_0x3c9491,'accepted')),this['_batchToChanges']['set'](_0x753659,_0x3e670c));});}const _0x3232db=_0x18799a['config']['get']('ai.chat.context');_0x3232db['alwaysAddSelection']&&_0x3232db['document']['enabled']&&this['listenTo'](_0x18799a['model']['document']['selection'],'change:range',(_0x20b610,_0xc59e86)=>{_0xc59e86['directChange']&&'chat'===_0x18799a['plugins']['get']('AITabs')['view']['activeTab']&&(_0x18799a['model']['hasContent'](_0x18799a['model']['document']['selection'])?this['addSelectionToChatContext'](_0x18799a):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x368fde=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x41aa40=await _0x368fde['getConversations']();return _0x41aa40['length']?_0x41aa40[0x0]['id']:'new';}catch(_0x22a47d){return this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':vt()}),this['_reporter']['logError'](new ht('ai-chat-conversation-init-failed',this,{'error':_0x22a47d})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x36c3f3={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x36c3f3);}catch(_0x32b795){this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x36c3f3['id']||vt()}),this['_reporter']['logError'](_0x32b795),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x55f2cb,modelId:_0x2fa1d5}={}){this['_closeActiveBalloon']();let _0x3183a9=_0x2fa1d5;_0x3183a9||(_0x55f2cb||!this['activeConversation']?_0x3183a9=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x3183a9=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x436ec7=this['getGroupId'](),_0x484f84=_0x55f2cb||vt();let _0x1d4e16;this['activeConversation']=new Sn({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x3183a9,'conversationId':_0x484f84,'group':_0x436ec7,'locale':this['context']['locale'],'isFromHistory':!!_0x55f2cb,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0xc2ef3d=>this['_aiEditing']['getSessionId'](_0xc2ef3d)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0xdfff9c,_0x7e0389)=>{this['_aiChatUi']['createConversation'](_0x7e0389),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x55f2cb||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x2befaf,_0x49ce67)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x49ce67['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x4ed924=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x4ed924);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x4d909b=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x4d909b);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x40862a,_0x8f2302)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x8f2302,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x2753aa,_0x3a9eb8)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x3a9eb8,{'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});}),this['listenTo'](this['activeConversation'],'interactionStarted',()=>{this['_aiChatUi']['startInteraction']();}),this['listenTo'](this['activeConversation'],'interactionFinished',async()=>{this['_updateReplyContentThrottled']['flush'](),await this['_aiChatUi']['finishInteraction']();}),this['listenTo'](this['activeConversation'],'interactionDestroyed',(_0x465188,_0x5510f7)=>{this['_aiChatUi']['removeFeedInteraction'](_0x5510f7['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x318dac,_0x236316,_0x2d4df1)=>{this['_updateConversationTitle'](_0x236316,_0x2d4df1);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x1630a2,_0x3025de)=>{void 0x0!==_0x1d4e16&&_0x1d4e16!==_0x3025de['id']&&this['_updateReplyContentThrottled']['flush'](),_0x1d4e16=_0x3025de['id'],_0x3025de['isFromHistory']?await this['_updateReplyContent']({'reply':_0x3025de}):await this['_updateReplyContentThrottled']({'reply':_0x3025de});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x1bc8e5,{reply:_0x3a26da,index:_0x44aad7,state:_0x2b1761})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x3a26da['id'],'index':_0x44aad7,'state':_0x2b1761}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x3a26da['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x44aad7&&this['_activeBalloon']?.['setState'](_0x2b1761);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x557711,_0x5928c2)=>{if(this['_aiChatUi']['addContextItem'](_0x5928c2['contextItem'],_0x5928c2['isLoading']),'selection'===_0x5928c2['contextItem']['type']){const _0x393dcb=_s(this['context']),_0x1e1f06=[..._0x393dcb['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x393dcb,'ranges':_0x1e1f06,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x25bf57,_0x2231fc)=>{this['_aiChatUi']['removeContextItem'](_0x2231fc['uiId']),'current-document'==_0x2231fc['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x2231fc['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x419686,_0x45adfe)=>{this['_aiChatUi']['setContextItemLoading'](_0x45adfe['contextItem']['uiId'],_0x45adfe['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x166604,_0x1f5600)=>{this['_aiChatUi']['setConversationContext'](_0x1f5600['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x3351c0,_0x21abbd)=>{this['_aiChatUi']['setAddContextOptions'](_0x21abbd['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x1284e,_0x38d7e0)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x38d7e0['sourceId'],_0x38d7e0['source'],_0x38d7e0['resources'],_0x38d7e0['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x54c489,_0x470f70)=>{this['_aiChatUi']['updateResourceState'](_0x470f70['sourceId'],_0x470f70['resourceId'],_0x470f70['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x57f029,_0x3256b8)=>{this['_aiChatUi']['updateCapabilities'](_0x3256b8);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0x730253,_0x35f754)=>{try{const _0x187834=(await this['_aiChatModels']['getAll']())['find'](_0x12f7a7=>_0x12f7a7['id']===_0x35f754['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x187834,_0x35f754['isDisabled']);}catch(_0x3602a5){this['_reporter']['logError'](new sn({'code':'ai-chat-models-unable-to-retrieve','type':'network','cause':_0x3602a5}),{'context':{'operation':'model-selected'}});}}),this['listenTo'](this['activeConversation'],'error',(_0x233736,{error:_0x27f4d2,interactionId:_0x4b280a,fileName:_0x5df91c,url:_0x5c4afc,sourceId:_0x3cf6cd,sourceLabel:_0x36abc3})=>{const _0x3b9969=_0x4b280a?_0x4b280a+':'+vt():vt();this['_reporter']['reportError'](_0x27f4d2),_0x27f4d2['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':us(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x3b9969}):_0x27f4d2['message']['startsWith']('ai-chat-conversation-init-failed')||_0x27f4d2['message']['startsWith']('ai-chat-conversation-start-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x3b9969}):_0x27f4d2['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x5df91c),'id':_0x3b9969}):_0x27f4d2['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x5c4afc),'id':_0x3b9969}):_0x27f4d2['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x3b9969}):_0x27f4d2['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x3b9969}):_0x27f4d2['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x3cf6cd&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x3cf6cd),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x36abc3||'source'),'id':_0x3b9969})):_0x27f4d2['message']['startsWith']('ai-chat-resource-load-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x3b9969}):_0x27f4d2['message']['startsWith']('ai-chat-invalid-request')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x3b9969}):_0x27f4d2['message']['startsWith']('ai-chat-context-unsupported-file-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x3b9969}):_0x27f4d2['message']['startsWith']('ai-chat-context-file-too-large')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x3b9969}):_0x27f4d2['message']['startsWith']('ai-chat-context-file-too-many-pages')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x3b9969}):_0x27f4d2['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x3b9969}):this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x3b9969});}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x55f2cb||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0x41fdd3,attributes:_0x9f53ef}){if(!this['activeConversation'])throw new ht('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x329837=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0x329837);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x41fdd3,'attributes':_0x9f53ef});}['_removeFromContext'](_0x2c66cf){this['activeConversation']?.['removeFromContext'](_0x2c66cf);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x4d6fed){const [_0x1915eb,_0x36d6fc]=_0x4d6fed['split'](':'),_0x540c54=this['activeConversation']['getInteraction'](_0x1915eb);return{'interaction':_0x540c54,'reply':_0x540c54['getReply'](_0x36d6fc)};}['_scrollToSuggestionRange'](_0x3854ec,_0xb8a46b=!0x1,_0x55aa6d){const _0x3e72d1={'target':_0x55aa6d['editing']['view']['domConverter']['viewRangeToDom'](_0x55aa6d['editing']['mapper']['toViewRange'](_0x3854ec)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0xb8a46b};_0xb8a46b&&(_0x3e72d1['alignToTop']=!0x0),Rt(_0x3e72d1);}['_updateConversationTitle'](_0x42d3e7,_0x269735=!0x1){this['_aiChatUi']['setConversationTitle'](_0x42d3e7||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x269735);}['_addFeedItemReply'](_0x2acc08){'text'===_0x2acc08['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x2acc08):this['_aiChatUi']['addFeedItemAISuggestion'](_0x2acc08);}async['_updateReplyContent']({reply:_0x44cbc7,renderingStrategy:_0x54b6df}){const {id:_0x230fc9,interactionId:_0xd13d37,isDone:_0x17f012,type:_0x100292,parsedContent:_0x52d134}=_0x44cbc7,_0x33bfba=_0xd13d37+':'+_0x230fc9;if('modification'===_0x100292){const _0x366477=_0x44cbc7['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x33bfba,'parts':_0x366477,'isDone':_0x17f012,'skipLoadingEffects':_0x44cbc7['isFromHistory']});}else'text'===_0x100292&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x33bfba,'parsedContent':_0x52d134['get']('text'),'renderingStrategy':_0x54b6df,'isDone':_0x17f012});_0x17f012&&_0x44cbc7['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x33bfba,_0x44cbc7['sources']);}['_updateReplyContentThrottled']=_0x570ee2(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x40be41=this['activeConversation']?.['lastInteraction'];_0x40be41&&(_0x40be41['stop'](),this['_aiChatUi']['stopInteraction'](_0x40be41)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0xff934c=this['activeConversation']?.['lastInteraction'];if(_0xff934c){for await(const _0x44b4ef of _0xff934c['replies'])this['_aiChatUi']['hasFeedItem'](_0x44b4ef['id'])||this['_addFeedItemReply'](_0x44b4ef),await this['_updateReplyContent']({'reply':_0x44b4ef,'renderingStrategy':'static'});}}['_updateRatings'](_0x1838b1){const _0x218093={'positiveCount':_0x1838b1['changeGroups']['filter'](_0xabd433=>'accepted'===_0xabd433['state'])['length'],'totalCount':_0x1838b1['changeGroups']['length'],'modificationId':_0x1838b1['id']},_0x22f8a8=this['activeConversation']['getInteraction'](_0x1838b1['interactionId'])['messageId'];_0x22f8a8&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x22f8a8,_0x218093);}['_getAIChatFeedAPI'](_0x3b2551){const _0xdf5b=this['_aiChatUi'],_0x45db91=()=>{_0x3b2551['resetWebSearchState'](),_0x3b2551['resetReasoningState'](),_0xdf5b['clearLoadingMessage']();},_0x2d17bb=()=>{_0x3b2551['currentReply']&&(_0x3b2551['currentReply']['done'](),_0x3b2551['currentReply']=void 0x0);};return{'insertTextReply':(_0x1eed22,_0x5d7130)=>{_0x2d17bb(),_0x45db91();const _0x52ecda=_0x3b2551['currentReply']=_0x3b2551['createReply']({'type':'text','interactionId':_0x3b2551['id'],'id':_0x5d7130||vt(),'channelsToEditors':this['_channelsToEditors']});return _0x52ecda['appendContent'](_0x1eed22),_0x2d17bb(),_0x52ecda;},'insertCustomElement':async(_0x29e2ee,_0x148a7b)=>(_0x2d17bb(),_0x45db91(),_0xdf5b['addFeedItemCustomElement'](_0x29e2ee,_0x148a7b||vt())),'setLoadingMessage':_0xef3274=>{_0xdf5b['setLoadingMessage'](_0xef3274);},'clearLoadingMessage':()=>{_0xdf5b['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){ds(this['context'])['find'](_0xc4e3fa=>'destroyed'!==_0xc4e3fa['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}};const Nn=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],yn=[...Nn,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function xn(_0x13e369){const _0x57a350=new AbortController();return{'promise':new Promise((_0x30e897,_0xe8a446)=>{const _0xde5013=setTimeout(_0x30e897,_0x13e369);_0x57a350['signal']['addEventListener']('abort',()=>{clearTimeout(_0xde5013),_0xe8a446();});}),'abortController':_0x57a350};}var Ln=class{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x3e9624){this['options']={'delay':_0x3e9624?.['delay']??0xa,'textNodeStyle':_0x3e9624?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x58e28a,targetElement:_0x2f5c62,abortSignal:_0x1ec0a1}){this['isStreaming']&&this['stop'](),_0x1ec0a1?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x16e079(_0x58e28a,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x4abadc=0x0;_0x4abadc<this['currentIndex'];_0x4abadc++)this['nodesList'][_0x4abadc]['shouldBeStreamed']=!0x0;do{const _0x40ded4=Date['now'](),_0x95c5fd=this['nodesList'][this['currentIndex']],_0x6739bc=_0x40ded4-this['lastUpdateTime'];if(_0x95c5fd){_0x95c5fd['shouldBeStreamed']=!0x0;let _0x19e825=_0x95c5fd['parent'];for(;_0x19e825;)_0x19e825['shouldBeStreamed']=!0x0,_0x19e825=_0x19e825['parent'];}if(_0x6739bc<this['options']['delay'])try{const {promise:_0x21748a,abortController:_0x149f78}=xn(this['options']['delay']-_0x6739bc);this['timeoutAbortController']=_0x149f78,await _0x21748a;}catch(_0x1f5885){return;}_0x3af4bb(_0x2f5c62,'<'+_0x2f5c62['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x2f5c62['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:_0x580f45}){Array['from'](_0x580f45['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x139c52=>{_0x139c52['replaceWith'](_0x139c52['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x293fed){let _0x46f737='';if(function(_0x371bf6){return _0x4f8f6a(_0x371bf6);}(_0x293fed)){for(const _0x85618c of _0x293fed['children'])_0x46f737+=this['renderNode'](_0x85618c);}else{if(Hn(_0x293fed)){if(!_0x293fed['shouldBeStreamed'])return'';const _0x97b885=_0x293fed,_0x341129=Object['entries'](_0x97b885['attribs'])['map'](([_0x4b612e,_0xe930db])=>_0x4b612e+'=\x22'+_0xe930db+'\x22')['join']('\x20');_0x46f737+='<'+_0x97b885['tagName']+(_0x341129?'\x20'+_0x341129:'')+'>';for(const _0x2e5d95 of _0x587b69(_0x97b885))_0x46f737+=this['renderNode'](_0x2e5d95);_0x46f737+='</'+_0x97b885['tagName']+'>';}else{if(!Pn(_0x293fed))return'';if(!_0x293fed['shouldBeStreamed'])return'';!function(_0x58bb17){return!(!_0x58bb17['parent']||!Hn(_0x58bb17['parent']))&&(!!Dn['includes'](_0x58bb17['parent']['tagName'])&&!_0x5125cd(_0x58bb17)['match'](/^\s*[<>]\s*$/));}(_0x293fed)?_0x46f737+=_0x935be1(_0x293fed):_0x46f737+=_0x935be1(new _0x14308e('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x293fed]));}}return _0x46f737;}['getParsedDocumentNodeList'](){const _0x2699c3=[];return function(_0x3ee4e2,_0x73563d){const _0x527e73=_0xd5e08a=>{if(_0x73563d(_0xd5e08a),_0xd5e08a instanceof _0x1bdc76)for(let _0x2b82f9=0x0;_0x2b82f9<_0xd5e08a['children']['length'];_0x2b82f9++){const _0x1f697f=_0xd5e08a['children'][_0x2b82f9];_0x527e73(_0x1f697f);}};for(let _0x4182bb=0x0;_0x4182bb<_0x3ee4e2['children']['length'];_0x4182bb++)_0x527e73(_0x3ee4e2['children'][_0x4182bb]);}(this['document'],_0x2a0739=>{if(Pn(_0x2a0739)){const _0x18c67d=this['splitTextNodeIntoWordNodes'](_0x2a0739);_0x18c67d['length']&&_0x2699c3['push'](..._0x18c67d);}_0x2a0739['isWordSplitSource']||_0x2a0739['isWordSplitResult']||_0x2699c3['push'](_0x2a0739);}),_0x2699c3;}['splitTextNodeIntoWordNodes'](_0x84ccf1){if(_0x84ccf1['isWordSplitSource']||_0x84ccf1['isWordSplitResult'])return[];const _0x3ce3b5=_0x5125cd(_0x84ccf1)['match'](/(?:\s*\S+\s*)/g),_0x4373c4=[];if(_0x3ce3b5&&_0x3ce3b5['length']>0x1){for(const _0x3889a1 of _0x3ce3b5){const _0x4f951d=new _0x336fe1(_0x3889a1);_0x4f951d['isWordSplitResult']=!0x0,_0x3e6f45(_0x84ccf1,_0x4f951d),_0x4373c4['push'](_0x4f951d);}_0x84ccf1['isWordSplitSource']=!0x0,_0x8128e7(_0x84ccf1);}return _0x4373c4;}};const Dn=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function Pn(_0xc56993){return _0x4a7ce7(_0xc56993);}function Hn(_0x95bb5){return _0x1c0d0f(_0x95bb5);}function Mn(_0x4f0470,_0x4c5eea){_0x4f0470['cleanUpAnimations']({'targetElement':_0x4c5eea}),_0x4c5eea['querySelectorAll']('[data-id]')['forEach'](_0x437d95=>{_0x437d95['removeAttribute']('data-id');});}var Vn=class extends _0x3b0eb8{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x42b4f8){super();const _0x5d89f9=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new Ln(),this['options']=_0x42b4f8,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x5d89f9['if']('isDone','ck-ai-chat__feed__item_done'),_0x5d89f9['if']('isVisible','ck-hidden',_0x3e815c=>!_0x3e815c),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){Mn(this['htmlStreamer'],this['element']),this['isDone']=!0x0;}async['streamIntoElement'](_0x2d68c8,_0x4bd03d,_0x2865ee){await this['htmlStreamer']['stream']({'document':_0x2d68c8,'targetElement':_0x4bd03d,'abortSignal':_0x2865ee});}},Un=class extends _0x3b0eb8{['showChangesToggleView'];constructor(_0x194678,_0x40aba){super(_0x194678),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new Bn(_0x194678),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+hn,'label':us(_0x194678,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x40aba['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x4354eb=>_0x4354eb?et:tt),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x59a49b=new Yt();_0x59a49b['content']=_0x59144c,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x40aba['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x59a49b,{'tag':'span','children':[us(_0x194678,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}},Bn=class extends Ht{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}};const Gn={'accepted':_0x240d3f,'rejected':_0x4920b3,'outdated':_0x4920b3};var Fn=class extends _0x3b0eb8{['stateIconView'];constructor(_0x32fe24){super(_0x32fe24);const _0x171f0f=this['bindTemplate'];this['set']('state','accepted'),this['set']('isVisible',!0x0),this['stateIconView']=new Kn(),this['stateIconView']['bind']('state')['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x171f0f['to']('state',_0x35e0c9=>'ck-ai-suggestion__content-part-state_'+_0x35e0c9),_0x171f0f['if']('isVisible','ck-hidden',_0x1e1017=>!_0x1e1017)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x171f0f['to']('state',_0xa2b321=>{switch(_0xa2b321){case'accepted':return us(_0x32fe24,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return us(_0x32fe24,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return us(_0x32fe24,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x2b10bb){this['state']=_0x2b10bb;}},Kn=class extends Yt{constructor(){super(),this['set']('state','accepted'),this['content']=Gn[this['state']],this['on']('change:state',()=>{this['content']=Gn[this['state']];});}},Wn=class extends _0x3931a6{['_applyButton'];['_suggestButton'];constructor(_0x25a0d7,_0x49d5ac,_0x1f528b){super(_0x25a0d7);const _0x3c23cb=Boolean(_0x1f528b);this['set']('isEnabled',!_0x3c23cb),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x124da1=[];if(_0x3c23cb){const _0x422082=new Ht(_0x25a0d7);_0x422082['set']({'label':us(_0x25a0d7,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x445d2f}),_0x422082['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x124da1['push'](_0x422082);}else{_0x49d5ac['includes']('applySuggestion')&&(this['_applyButton']=new Ht(_0x25a0d7),this['_applyButton']['set']({'label':us(_0x25a0d7,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x240d3f}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x512e29=>!_0x512e29),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x124da1['push'](this['_applyButton'])),_0x49d5ac['includes']('insertSuggestion')&&(this['_suggestButton']=new Ht(_0x25a0d7),this['_suggestButton']['set']({'label':us(_0x25a0d7,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x498b52}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x124da1['push'](this['_suggestButton']));const _0xffac36=new Ht(_0x25a0d7);_0xffac36['set']({'label':us(_0x25a0d7,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x4920b3}),_0xffac36['bind']('isEnabled')['to'](this),_0xffac36['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x124da1['push'](_0xffac36);}this['items']['addMany'](_0x124da1);const _0x285841=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x285841['if']('isVisible','ck-hidden',_0x182e43=>!_0x182e43)]}});}['setButtonsVisibility']({showApplyButton:_0x484f90,showSuggestButton:_0x5bd302}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x484f90),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x5bd302);}},Yn=class extends _0x3b0eb8{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x1af36e,{part:_0x2d07bc,uiIndex:_0x511baa,availableActions:_0x5f3f5f,areActionsDisabled:_0x1b8d88}){super(_0x1af36e),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new Wn(_0x1af36e,_0x5f3f5f,_0x1b8d88),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x2d07bc['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x2d07bc['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x2d07bc['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new Fn(_0x1af36e),this['titleLabelView']=new $n(_0x1af36e,_0x511baa),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',(_0x30c30c,_0x49b384,_0x4e6010,_0xb44826)=>{'pending'===_0xb44826?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x4e6010?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x4e6010),this['children']['add'](this['stateView']));});}},$n=class extends _0x3b0eb8{constructor(_0x27b940,_0x15f1b0){super(_0x27b940),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[us(_0x27b940,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x15f1b0['toString']())]});}},qn=class extends _0x3b0eb8{['htmlStreamer'];constructor(_0x34b3fa){super(_0x34b3fa),this['htmlStreamer']=new Ln(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async['update']({part:_0xba07e6,renderingStrategy:_0x3253d5,abortSignal:_0x2ad6d9}){const _0x327c79=_0x16e079(_0xba07e6['content'],!0x0);for(const _0x5c7f9a of ws(_0x327c79))_0x8128e7(_0x5c7f9a);'streaming'===_0x3253d5?await this['htmlStreamer']['stream']({'document':_0x327c79,'targetElement':this['element'],'abortSignal':_0x2ad6d9}):_0x3af4bb(this['element'],'<'+this['element']['tagName']+'>'+ms(_0x327c79)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}['cleanUpStreamingArtifacts'](){Mn(this['htmlStreamer'],this['element']);}},Qn=class extends _0x3b0eb8{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x38c939,{part:_0x32bdb4,uiIndex:_0xde38bb,areActionsDisabled:_0x18c9f6,availableActions:_0x5b355f}){super(_0x38c939);const _0x1a9c43=this['bindTemplate'];this['set']('state','pending'),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1),this['set']('isTrackChangesOn',!0x1);const _0x311790=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x18c9f6;};this['on']('change:state',_0x311790),this['on']('change:isDone',_0x311790),_0x311790(),this['_children']=this['createCollection'](),this['_headerView']=new Yn(_0x38c939,{'part':_0x32bdb4,'uiIndex':_0xde38bb,'availableActions':_0x5b355f,'areActionsDisabled':_0x18c9f6}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...Nn)['to'](this),this['_streamableContentView']=new qn(_0x38c939),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x1a9c43['to']('state',_0x1f28a3=>'ck-ai-suggestion__body__content-part_'+_0x1f28a3),_0x1a9c43['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x1a9c43['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x1a9c43['if']('isVisible','ck-hidden',_0x2cca63=>!_0x2cca63)]},'children':this['_children'],'on':{'mouseenter':_0x1a9c43['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x32bdb4['index']});}),'mouseleave':_0x1a9c43['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x32bdb4['index']});}),'click':_0x1a9c43['to'](_0x35d2b3=>{const _0x45b0a5=_0x35d2b3['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x45b0a5)&&this['fire']('showChangeInText',{'index':_0x32bdb4['index']});})}});}async['updateContent']({part:_0x413554,showUnchangedParts:_0x274198=!0x1,abortSignal:_0x51f05c}){this['partDefinition']=_0x413554,this['isVisible']=this['partDefinition']['hasChanges']||_0x274198,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x413554,'renderingStrategy':'static','abortSignal':_0x51f05c});}['markAsDone'](){this['isDone']=!0x0;}},Xn=class extends _0x3b0eb8{constructor(_0x330024,_0x196dad){super(_0x330024),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x2f50c3=>!_0x2f50c3)]},'children':this['_createSkeletonItems'](_0x196dad)});}['_createSkeletonItems'](_0x14e54d){const _0x2b43ae=['ck','ck-ai-skeleton__item'];return _0x14e54d['map'](_0x113ac1=>{let _0x42e5c7='';switch(_0x113ac1['attributes']['align']){case'right':_0x42e5c7='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x42e5c7='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x42e5c7='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x113ac1['tag'],'attributes':{'class':[..._0x2b43ae,_0x113ac1['attributes']['class']?_0x113ac1['attributes']['class']:''],'style':'width:\x20'+_0x113ac1['attributes']['width']+';\x20height:\x20'+_0x113ac1['attributes']['height']+';'+_0x42e5c7}};});}};const zn={'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':jn(0x5,'100%','44px','right'),'aiChatResources':jn(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 jn(_0xd8d8a,_0xf30b41,_0xfc991f,_0x3acd92){return new Array(_0xd8d8a)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0xf30b41,'height':_0xfc991f,'align':_0x3acd92}}));}const Jn=/* #__PURE__ -- @preserve */
33
- ut();var Zn=class extends Jn{['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x46704e){const _0x380a04=this['createTask'](_0x46704e);return this['queue']['push'](_0x380a04),this['_processQueue'](),_0x380a04['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(_0x28c627=>{this['once']('_queueEmpty',()=>{_0x28c627();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0xd0af9e=this['queue']['shift']();try{await _0xd0af9e['callback'](this['_abortController']['signal']),_0xd0af9e['resolve']();}catch(_0x4060f3){_0xd0af9e['reject'](_0x4060f3);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x2fe650){let _0x12923f,_0x4c8980;const _0x478130=new Promise((_0x133209,_0x13c838)=>{_0x12923f=_0x133209,_0x4c8980=_0x13c838;});return{'callback':_0x2fe650,'resolve':_0x12923f,'reject':_0x4c8980,'completePromise':_0x478130};}},tr=class extends Vn{constructor(_0x3d932d){super(_0x3d932d),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x3d932d['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x3dc00d){this['element']['innerHTML']=_0x3dc00d;}};const er=['applySuggestion','insertSuggestion'];var ir=class extends _0x3b0eb8{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x283882,_0x3276d1=[...er],_0x18cb25){super(_0x283882);const _0x47fda7=this['bindTemplate'],_0x11e930=Boolean(_0x18cb25);if(this['set']('isEnabled',!_0x11e930),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x11e930){const _0x2e1d7c=new Ht(_0x283882);_0x2e1d7c['set']({'label':us(_0x283882,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x445d2f}),_0x2e1d7c['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x191528=new _0x3b0eb8(_0x283882);_0x191528['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[us(_0x283882,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x2e1d7c]}]}),this['children']['add'](_0x191528);}else this['_applyChangesButton']=new Ht(_0x283882),this['_applyChangesButton']['set']({'label':us(_0x283882,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x3276d1['includes']('applySuggestion'),'class':on}),this['_insertSuggestionsButton']=new Ht(_0x283882),this['_insertSuggestionsButton']['set']({'label':us(_0x283882,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x3276d1['includes']('insertSuggestion'),'class':an}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x7af081=>{_0x7af081['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',_0x47fda7['if']('isVisible','ck-hidden',_0x2b7fe6=>!_0x2b7fe6)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x15f265){this['isVisible']=_0x15f265;}['_switchButtonLabelsPlurality'](_0x34d3a5){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x34d3a5?(this['_applyChangesButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}},sr=class extends _0x3b0eb8{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x1a42ee,_0x3f2823){super(_0x1a42ee),this['bodyCollection']=_0x3f2823,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',_0x5002c4=>!_0x5002c4)]},'children':this['children']});const _0x28bcc9=new _0x3b0eb8(this['locale']),_0x3ae773=new Yt();_0x3ae773['content']=at,_0x28bcc9['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x3ae773,{'tag':'span','children':[{'text':us(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x28bcc9),this['_setupBalloonPanel'](_0x1a42ee);}['addSource'](_0x4569f9){this['children']['add'](new nr(this['locale'],_0x4569f9,this['balloonPanelView']));}['_setupBalloonPanel'](_0x3e3527){this['balloonPanelView']=new yt(_0x3e3527),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},nr=class extends Ht{['balloonPanelView'];['source'];constructor(_0x371004,_0x3c919f,_0x4f7f48){super(_0x371004),this['source']=_0x3c919f,this['balloonPanelView']=_0x4f7f48,this['set']({'label':_0x3c919f['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x272280=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x272280['to'](()=>{window['open'](_0x3c919f['url'],'_blank');}),'mouseenter':_0x272280['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x272280['to'](()=>{this['_hideTooltip']();})}}),_0x3c919f['favicon']){const _0x2cd1a5=new _0x3b0eb8(_0x371004);_0x2cd1a5['setTemplate']({'tag':'img','attributes':{'src':_0x3c919f['favicon']||at,'alt':_0x3c919f['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x2cd1a5);}else this['set']('icon',at);}['_createTooltipContentView'](_0xcff2e2,_0x540032){const _0x24e056=new _0x3b0eb8(_0xcff2e2),_0x5ab9e7=[];let _0x3606a1;_0x540032?.['favicon']?(_0x3606a1=new _0x3b0eb8(_0xcff2e2),_0x3606a1['setTemplate']({'tag':'img','attributes':{'src':_0x540032['favicon'],'alt':_0x540032['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x3606a1=new Yt(),_0x3606a1['content']=at,_0x3606a1['extendTemplate']({'attributes':{'alt':_0x540032['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x5ab9e7['push'](_0x3606a1);const _0x677473=new _0x3b0eb8(_0xcff2e2);_0x677473['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x540032['url']},'children':[{'text':new URL(_0x540032['url'])?.['hostname']}]}),_0x5ab9e7['push'](_0x677473);const _0x510a01=new _0x3b0eb8(_0xcff2e2);_0x510a01['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x5ab9e7});const _0x419a3e=new _0x3b0eb8(_0xcff2e2);return _0x419a3e['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x540032['title']['length']>0x190?_0x540032['title']['substring'](0x0,0x190)+'...':_0x540032['title']}]}),_0x24e056['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x510a01,_0x419a3e]}),_0x24e056;}['_showTooltip'](){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[yt['defaultPositions']['northArrowSouth'],yt['defaultPositions']['northArrowSouthWest'],yt['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 _0x47fad9=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x47fad9);}},rr=class extends _0x3b0eb8{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x13ce22(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x48f4d1,_0x186af3){super(_0x48f4d1);const {areActionsDisabled:_0x316ab8,showUnchangedParts:_0x15a707,availableActions:_0x32f94c}=_0x186af3;this['_areActionsDisabled']=_0x316ab8,this['_showUnchangedParts']=_0x15a707,this['_availableActions']=_0x32f94c,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new Xn(_0x48f4d1,zn['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new Zn(),this['_emptyPartsWarningView']=new tr({'id':'empty-parts-warning','initialContent':us(_0x48f4d1,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new ir(_0x48f4d1,_0x186af3['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new sr(this['locale'],_0x186af3['bodyCollection']),_0x186af3['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...Nn)['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'](_0x48f8e6=>_0x48f8e6 instanceof Qn);}async['updateContentParts']({parts:_0x4fa548,abortSignal:_0x512928,skipLoadingEffects:_0x38bbd7}){this['_cachedContentParts']['length']?_0x4fa548['forEach'](_0x20a75b=>{const _0x4c78ab=this['_cachedContentParts']['findIndex'](_0x48951b=>_0x48951b['index']==_0x20a75b['index']);-0x1===_0x4c78ab?this['_cachedContentParts']['push'](_0x20a75b):this['_cachedContentParts'][_0x4c78ab]=_0x20a75b;}):this['_cachedContentParts']=_0x4fa548;const _0x3b5b61=this['_showUnchangedParts']?_0x4fa548:_0x4fa548['filter'](_0x232c56=>_0x232c56['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x3b5b61['length']>0x1),_0x38bbd7&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x3c6e22 of _0x3b5b61)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x3c8c3d=>{let _0x55b496=this['getPartView'](_0x3c6e22['index']);if(!_0x55b496){if(_0x55b496=new Qn(this['locale'],{'part':_0x3c6e22,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x55b496['delegate'](...Nn)['to'](this),_0x55b496['bind']('isTrackChangesOn')['to'](this),!_0x38bbd7&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x3c8c3d),_0x3c8c3d['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x55b496,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x38bbd7||this['_showSkeletonDebounced']();}await _0x55b496['updateContent']({'part':_0x3c6e22,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x3c8c3d}),_0x55b496['markAsDone']();});return _0x512928?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x80f245,_0x1f6935){const _0x27d70e=this['getPartView'](_0x80f245);_0x27d70e&&(_0x27d70e['state']=_0x1f6935),this['hasPendingParts']='pending'==_0x1f6935||this['_contentPartViews']['some'](_0x5f2259=>'pending'==_0x5f2259['state']);}['setPartActive'](_0x538de3,_0x75030d){if(!0x1===_0x538de3){for(const _0x3aca16 of this['_contentPartViews'])_0x3aca16['isActive']=!0x1;}else{const _0x3af53f=this['getPartView'](_0x538de3);_0x3af53f&&(_0x3af53f['isActive']=_0x75030d);}}['updateSources'](_0x2b068a){_0x2b068a['forEach'](_0x2697cc=>this['_sourcesView']['addSource'](_0x2697cc)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x2cd190){return this['_contentPartViews']['find'](_0x107900=>_0x107900['partDefinition']['index']==_0x2cd190)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0xf097b7=!this['_cachedContentParts']['find'](({hasChanges:_0x33ed10})=>_0x33ed10),_0x162670=!!this['_cachedContentParts']['find'](({hasChanges:_0x3ce405})=>!_0x3ce405);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x162670,_0xf097b7?this['_emptyPartsWarningView']['setContent'](us(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](us(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x1b9c37=>_0x1b9c37['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x42e4f9){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x12bb91=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x12bb91>0x0){const {promise:_0x2a6b53,abortController:_0x401500}=xn(_0x12bb91);_0x42e4f9?.['addEventListener']('abort',()=>_0x401500['abort']()),await _0x2a6b53['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x137fbb=>_0x137fbb['partDefinition']['hasChanges'])['length']>0x0;}},or=class extends _0x3b0eb8{['bodyView'];['children'];['headerView'];constructor(_0x4f269c,_0x3604cf,_0x2e1f28){super(_0x4f269c);const {showDiff:_0x455c9c,areActionsDisabled:_0x135e7f,showUnchangedParts:_0x14720c,availableActions:_0xb99653}=_0x3604cf;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new Un(_0x4f269c,{'showDiff':_0x455c9c}),this['headerView']['on']('toggleShowChanges',(_0x305ff7,_0x41b905)=>{this['areChangesVisible']=_0x41b905['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x41b905['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new rr(_0x4f269c,{'areActionsDisabled':_0x135e7f,'showUnchangedParts':!!_0x14720c,'availableActions':_0xb99653,'bodyCollection':_0x2e1f28}),this['bodyView']['delegate'](...Nn)['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'](_0x22f824){await this['bodyView']['updateContentParts'](_0x22f824);}['updateSources'](_0x5b742){this['bodyView']['updateSources'](_0x5b742);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},ar=class extends Vn{['containerView'];constructor(_0x149330,_0x2b0de3,_0x4a1c08){super(_0x2b0de3),this['set']('isTrackChangesOn',!0x1),this['containerView']=new or(_0x149330,{'showDiff':_0x2b0de3['showDiff'],'areActionsDisabled':_0x2b0de3['areActionsDisabled'],'availableActions':_0x2b0de3['availableActions']},_0x4a1c08),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x2403b7,_0x42a923)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x42a923['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',(_0x402150,{index:_0x2bea1d})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x2bea1d});}),this['containerView']['on']('applySuggestion',(_0x667262,{index:_0x306e38}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x306e38});}),this['containerView']['on']('insertSuggestion',(_0x1defd8,{index:_0x4b5547}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x4b5547});}),this['containerView']['on']('rejectSuggestion',(_0x45c161,{index:_0x202ed1})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x202ed1});}),this['containerView']['on']('mouseOverSuggestion',(_0x47058b,{index:_0x29861e})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x29861e});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x23158a,{index:_0x457ee4})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x457ee4});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x5a69e2){await this['containerView']['updateContent'](_0x5a69e2);}['updatePartState'](_0x3d28e7,_0x2f0335){this['containerView']['bodyView']['updatePartState'](_0x3d28e7,_0x2f0335);}['setPartActive'](_0x33e1ad,_0x1787a9){!0x1===_0x33e1ad?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x33e1ad,_0x1787a9);}['updateSources'](_0xf76885){this['containerView']['updateSources'](_0xf76885);}['getPartView'](_0x330424){return this['containerView']['bodyView']['getPartView'](_0x330424);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},hr=class extends Vn{['replyContainer'];['_bodyCollection'];constructor(_0x1b3d5b,_0x12c274,_0x5a0094){super(_0x12c274),this['_bodyCollection']=_0x5a0094,this['locale']=_0x1b3d5b,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x3b0eb8(),this['replyContainer']['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-chat__feed__ai-reply-container','ck-ai-chat-content']}}),this['children']['add'](this['replyContainer']);}async['render'](){super['render'](),this['options']['initialContent']&&(await this['updateContent']({'parsedContent':ps(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0xcf26fd,renderingStrategy:_0x1858ec,abortSignal:_0x575c32}){'streaming'===_0x1858ec?await this['streamIntoElement'](_0xcf26fd,this['replyContainer']['element'],_0x575c32):this['replyContainer']['element']['innerHTML']=_0x935be1(_0xcf26fd);}['updateSources'](_0x2a0e29){const _0x2bf472=new sr(this['locale'],this['_bodyCollection']);_0x2bf472['children']['addMany'](_0x2a0e29['map'](_0x3abed3=>new nr(this['locale'],_0x3abed3,_0x2bf472['balloonPanelView']))),_0x2bf472['isVisible']=!0x0,this['children']['add'](_0x2bf472);}},cr=class extends _0xe12bba{constructor(_0x525653=void 0x0){super();const _0x50283f=_0x525653?'ck-ai-spinner_'+_0x525653:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x50283f]}});}};const lr={'file':_0x20248b,'image':_0x34a4e3,'document':_0x59144c,'web-resource':_0x229098,'text':_0x20248b,'selection':_0x2cdc67,'mcp-tool-context':_0x59144c},ur='ck-ai-chat-context-chip',dr='ck-ai-chat-context-chip_wide',_r='ck-ai-chat-context-chip_document',gr='ck-ai-chat-context-chip__label',Ar='ck-ai-chat-context-chip__type-icon',Ir='ck-ai-chat-context-controls__chip-tooltip',pr='n';var mr=class extends Ht{constructor(_0x2de77a,_0x4c6f74,_0x59bd55,_0x419b3d,_0x251827=!0x1){super(_0x2de77a),this['_isAnimationOnEnterEnabled']=_0x419b3d,this['_initializeProperties'](_0x4c6f74,_0x59bd55,_0x251827),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'](_0x3c8778,_0x34f4be,_0x55e239){this['set']('label',_0x3c8778['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x3c8778['type']),this['set']('id',_0x3c8778['uiId']),this['set']('readonly',_0x34f4be),this['set']('isLoading',_0x55e239);}['_setupTemplate'](){const _0x4ed86b=this['_createIconView'](),_0x1947d9=this['_createRemoveButton'](),_0x5ca627=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x5ca627),'children':this['_createTemplateChildren'](_0x4ed86b,_0x1947d9,_0x5ca627)});}['_createTemplateAttributes'](_0x2f7b11){return{'class':[ur,_0x2f7b11['if']('itemType',_r,_0x3f2b76=>'document'==_0x3f2b76),_0x2f7b11['if']('itemType',dr,_0x1c8b39=>'selection'==_0x1c8b39)],'data-cke-tooltip-text':_0x2f7b11['to']('label',Er),'data-cke-tooltip-position':pr,'data-cke-tooltip-class':Ir};}['_createTemplateChildren'](_0x3672e8,_0x8aec7e,_0x10a507){const _0x1e6487=this['_createLabelElement'](_0x10a507),_0x3126c5=this['_createLoaderIcon']();return this['readonly']?[_0x3672e8,_0x1e6487]:[_0x3672e8,_0x3126c5,_0x1e6487,_0x8aec7e];}['_createLabelElement'](_0x4a2e12){return{'tag':'span','attributes':{'class':gr},'children':[{'text':_0x4a2e12['to']('label')}]};}['_createRemoveButton'](){const _0x1ea38d=new Ht(this['locale']);return _0x1ea38d['set']({'label':us(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x22db67}),this['_setupRemoveButtonEvent'](_0x1ea38d),_0x1ea38d;}['_setupRemoveButtonEvent'](_0x13f88d){_0x13f88d['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x55aa8c=this['bindTemplate'],_0x1b1cb9=new Yt();return _0x1b1cb9['content']=lr[this['itemType']],_0x1b1cb9['extendTemplate']({'attributes':{'class':[Ar,_0x55aa8c['if']('isLoading','ck-hidden',_0x5a44c7=>_0x5a44c7)]}}),_0x1b1cb9;}['_handleAnimationEndOnce'](_0xc86125,_0x158442){if(!_0xc86125)return;const _0x3ed18b=()=>{_0x158442(),_0xc86125['removeEventListener']('animationend',_0x3ed18b),_0xc86125['removeEventListener']('webkitAnimationEnd',_0x3ed18b);};_0xc86125['addEventListener']('animationend',_0x3ed18b),_0xc86125['addEventListener']('webkitAnimationEnd',_0x3ed18b);}['_createLoaderIcon'](){const _0x54934e=new cr('small');return _0x54934e['bind']('isVisible')['to'](this,'isLoading',_0x5d50d9=>_0x5d50d9),_0x54934e;}};function Er(_0x525ba4){if(!_0x525ba4)return _0x525ba4;if(_0x525ba4['length']<=0x78)return _0x525ba4;const _0x1fcde9=_0x525ba4['slice'](0x0,0x78),_0x2adb8e=_0x1fcde9['lastIndexOf']('\x20');return(_0x2adb8e>0x0?_0x1fcde9['slice'](0x0,_0x2adb8e):_0x1fcde9)+'…';}const Tr={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},wr='300px';var Cr=class{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0x3c120c,_0x529b28,_0x151aa0,_0x272521,_0x512cf5){this['_locale']=_0x3c120c,this['_visibleChips']=_0x529b28,this['_config']={...Tr,..._0x151aa0,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x151aa0['cssClasses']}},this['_overflowChips']=new ct(),this['_bodyCollection']=_0x272521,this['_parentView']=_0x512cf5||null;}['setContainerElement'](_0x54f169){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x54f169,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 _0x25681a=[...this['_visibleChips'],...this['_overflowChips']],_0x1901c3=this['_createCalculationContainer'](),_0x4d905c=this['_calculateOverflowInContainer'](_0x1901c3,_0x25681a),_0x126002=_0x1901c3['_ancestorsToRestore'];_0x126002&&this['_restoreAncestorVisibility'](_0x126002),_0x1901c3['remove'](),this['_applyOverflowResults'](_0x25681a,_0x4d905c);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0x45c652({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x58022c=new Ht(this['_locale']);_0x58022c['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x18df82=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x18df82['push'](this['_config']['cssClasses']['controlsButton']),_0x58022c['extendTemplate']({'attributes':{'class':_0x18df82}}),_0x58022c;}['_createShowMoreBalloonPanelView'](){const _0xa4c5=new yt(this['_locale']);return _0xa4c5['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0xa4c5),_0xa4c5;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x23b45e=>{_0x23b45e['disableAnimationOnEnter']();});const _0x5b6a98=new _0x3b0eb8(this['_locale']);_0x5b6a98['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x5b6a98);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x2a0b40=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x2a0b40?'':'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'](_0x5aa9b3){const _0x5ce4f8=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x50743c=this['_containerElement']?.['classList'];if(_0x50743c){const _0x3e7d51=_0x50743c[0x0]||'',_0x5affcc=_0x5aa9b3['querySelector']('.'+_0x3e7d51),_0x3d79d5=_0x5aa9b3['querySelector'](_0x5ce4f8);return _0x5affcc||_0x3d79d5||_0x5aa9b3;}return _0x5aa9b3['querySelector'](_0x5ce4f8)||_0x5aa9b3;}['_calculateContainerWidth'](){const _0x585cdb=this['_parentView']?.['element']||this['_containerElement'];if(!_0x585cdb)return wr;const _0x44388a=window['getComputedStyle'](_0x585cdb)['width'];if('auto'===_0x44388a||'0px'===_0x44388a||!_0x44388a){const _0x9e47c2=_0x585cdb['parentElement'];if(_0x9e47c2){const _0x29cc95=window['getComputedStyle'](_0x9e47c2);return'auto'!==_0x29cc95['width']?_0x29cc95['width']:wr;}return wr;}return _0x44388a;}['_applyCalculationStyles'](_0x22576e,_0x53ba7d){this['_config']['cssClasses']['calculationContainer']&&_0x22576e['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x22576e['style']['width']=_0x53ba7d,_0x22576e['style']['position']='absolute',_0x22576e['style']['top']='-9999px',_0x22576e['style']['left']='-9999px',_0x22576e['style']['opacity']='0',_0x22576e['style']['pointerEvents']='none',_0x22576e['style']['zIndex']='-1',_0x22576e['style']['visibility']='visible\x20!important',_0x22576e['style']['display']='block\x20!important',_0x22576e['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x34f9cb){_0x34f9cb['forEach'](({element:_0x16cd87,originalDisplay:_0x2dd611,originalVisibility:_0x58e420})=>{_0x16cd87['style']['display']=_0x2dd611,_0x16cd87['style']['visibility']=_0x58e420;});}['_makeAncestorsVisible'](_0x20d7cf){const _0x3cb1e2=[];let _0xcb2b96=_0x20d7cf;for(;_0xcb2b96&&_0xcb2b96!==document['body'];){const _0x1cf1d4=window['getComputedStyle'](_0xcb2b96);'none'!==_0x1cf1d4['display']&&'hidden'!==_0x1cf1d4['visibility']||(_0x3cb1e2['push']({'element':_0xcb2b96,'originalDisplay':_0xcb2b96['style']['display'],'originalVisibility':_0xcb2b96['style']['visibility']}),_0xcb2b96['style']['display']='block',_0xcb2b96['style']['visibility']='visible'),_0xcb2b96=_0xcb2b96['parentElement'];}return _0x3cb1e2;}['_createContainerElements'](){let _0x291db7,_0x4dfb97;return this['_parentView']?.['element']?(_0x291db7=this['_parentView']['element']['cloneNode'](!0x0),_0x4dfb97=this['_findTargetContainer'](_0x291db7)):(_0x291db7=document['createElement']('div'),_0x4dfb97=_0x291db7),{'calculationContainer':_0x291db7,'targetContainer':_0x4dfb97};}['_createCalculationContainer'](){const {calculationContainer:_0x381069,targetContainer:_0x4b0e65}=this['_createContainerElements'](),_0xf8d718=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x381069,_0xf8d718);const _0x411812=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0x411812?_0x411812['appendChild'](_0x381069):document['body']['appendChild'](_0x381069),_0x381069['_targetContainer']=_0x4b0e65;const _0x37b4ac=this['_makeAncestorsVisible'](_0x411812||null);return _0x381069['offsetWidth'],_0x381069['_ancestorsToRestore']=_0x37b4ac,_0x381069;}['_calculateOverflowInContainer'](_0x4912bf,_0x2e7f2e){const _0x1ad24c=_0x4912bf['_targetContainer']||_0x4912bf,_0x30d8a1=[],{rowCount:_0x5d9287}=this['_renderChipsAndCountRows'](_0x1ad24c,_0x2e7f2e);if(_0x5d9287<=this['_config']['maxVisibleRows'])return _0x30d8a1;const _0x3ac637=_0x2e7f2e['slice']();for(;_0x3ac637['length']>0x0;){if(this['_testButtonFit'](_0x4912bf,_0x1ad24c,_0x3ac637)){const _0x233874=_0x2e7f2e['filter'](_0x6aaacc=>!_0x3ac637['includes'](_0x6aaacc));_0x30d8a1['push'](..._0x233874);break;}if(!_0x3ac637['pop']())break;}return _0x30d8a1;}['_renderChipsAndCountRows'](_0x558e9c,_0x53f0c8){_0x558e9c['innerHTML']='',_0x53f0c8['forEach'](_0x4cdf21=>{if(_0x4cdf21['element']){const _0x248817=_0x4cdf21['element']['cloneNode'](!0x0);_0x558e9c['appendChild'](_0x248817);}}),_0x558e9c['offsetWidth'];const _0x58696f=_0x558e9c['children'],_0x16a750=[];return Array['from'](_0x58696f)['forEach'](_0x509fd9=>{const _0x186fa2=_0x509fd9['getBoundingClientRect']()['top'];_0x16a750['some'](_0x178eaa=>Math['abs'](_0x178eaa-_0x186fa2)<this['_config']['rowDetectionTolerance'])||_0x16a750['push'](_0x186fa2);}),{'rowCount':_0x16a750['length']};}['_createMockButton'](){const _0x315e22=document['createElement']('button');return _0x315e22['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x315e22['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x315e22['textContent']='+\x201',_0x315e22;}['_testButtonFit'](_0x13beac,_0x3503d7,_0xd24dd5){this['_renderChipsAndCountRows'](_0x3503d7,_0xd24dd5);const _0x1990f9=this['_createMockButton']();_0x13beac['appendChild'](_0x1990f9),_0x13beac['offsetWidth'];const _0x2c2b60=[..._0x3503d7['children'],_0x1990f9],_0x19e004=[];_0x2c2b60['forEach'](_0x52a82e=>{const _0x4ffb9a=_0x52a82e['getBoundingClientRect']()['top'];_0x19e004['some'](_0x2a7b34=>Math['abs'](_0x2a7b34-_0x4ffb9a)<this['_config']['rowDetectionTolerance'])||_0x19e004['push'](_0x4ffb9a);});const _0xcbaad7=_0x19e004['length'];return _0x1990f9['remove'](),_0xcbaad7<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x30ad71,_0x39ce07){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x30ad71['forEach'](_0x5c5417=>{_0x39ce07['includes'](_0x5c5417)?this['_overflowChips']['add'](_0x5c5417):this['_visibleChips']['add'](_0x5c5417);});}['_updateOverflowUI'](_0x4a6efb){if(_0x4a6efb>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x4a6efb>0x0&&this['_showMoreButtonView']){const _0x80ede6=''+this['_config']['showMoreLabelPrefix']+(_0x4a6efb<0x63?_0x4a6efb:'99');this['_showMoreButtonView']['label']=_0x80ede6;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x53703b,_0x2372b6){this['_distributeChips'](_0x53703b,_0x2372b6),this['_updateOverflowUI'](_0x2372b6['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x7b420c=>{_0x7b420c[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 _0x107c43=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x107c43['width']||0x0===_0x107c43['height'])return!0x1;const _0x62a147=window['innerHeight']||document['documentElement']['clientHeight'],_0x11a3f8=window['innerWidth']||document['documentElement']['clientWidth'];return _0x107c43['bottom']>=-0xc8&&_0x107c43['top']<=_0x62a147+0xc8&&_0x107c43['right']>=-0xc8&&_0x107c43['left']<=_0x11a3f8+0xc8;}};const fr='ck-ai-chat__feed__context-chips',br='ck-ai-chat-context-chips-wrapper',Sr='ck-ai-chat-context-chips-wrapper-balloon',Rr='ck-ai-chat-controls-button',Or='ck-ai-chat-controls_context_show-more-button',vr='ck-ai-chat-context-controls__show-more-balloon-panel';var kr=class extends _0x3b0eb8{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x2a096e,_0x2515e3,_0x12e217){super(_0x2a096e),this['_bodyCollection']=_0x12e217,this['_createContextChips'](_0x2515e3);const _0x1e1c9a={'cssClasses':{'showMoreButton':Or+'\x20'+hn,'showMoreBalloon':vr,'overflowContainer':Sr,'controlsButton':Rr}};this['_overflowManager']=new Cr(_0x2a096e,this['_contextChips'],_0x1e1c9a,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[fr,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':br},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x34c00a=this['element']['querySelector']('.'+br);_0x34c00a&&(this['_overflowManager']['setContainerElement'](_0x34c00a),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x583afd){for(const _0x4ce3d9 of _0x583afd){const _0x1bbf50=new mr(this['locale'],_0x4ce3d9,!0x0,!0x1);this['_contextChips']['add'](_0x1bbf50);}}},Nr=class extends Vn{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x5f2b93,_0x121c2c,_0x405869){super(_0x121c2c),this['_locale']=_0x5f2b93,this['_bodyCollection']=_0x405869,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 kr(this['_locale'],this['options']['contextItems']['filter'](_0x1ed2dc=>!_0x1ed2dc['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new _0x3b0eb8(this['_locale']),this['_messageContentView']['setTemplate']({'tag':'div','attributes':{'class':['ck-reset_all-excluded','ck-ai-chat__feed__message-content','ck-ai-chat-content']}}),this['children']['add'](this['_messageContentView']);}['render'](){super['render'](),this['_messageContentView']['element']['innerHTML']=this['options']['initialContent'],this['markAsDone']();}},yr=class extends Vn{['capabilities'];constructor(_0x3c31b6,_0x55d649){super(_0x55d649);const {isWebSearchEnabled:_0x362420,isReasoningEnabled:_0x4daf1f}=_0x55d649['capabilities'],_0x5e85b7=[];let _0x247ea4='';_0x362420&&_0x4daf1f?(_0x247ea4=us(_0x3c31b6,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x5e85b7['push'](xr(at)),_0x5e85b7['push'](xr(_0x2a5dc8))):_0x362420?(_0x247ea4=us(_0x3c31b6,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x5e85b7['push'](xr(at))):_0x4daf1f&&(_0x247ea4=us(_0x3c31b6,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x5e85b7['push'](xr(_0x2a5dc8))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x247ea4?'':'ck-hidden']}});const _0x342927=new _0x3b0eb8();_0x342927['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x5e85b7,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x247ea4]}]}),this['children']['add'](_0x342927),this['capabilities']=_0x55d649['capabilities'];}};function xr(_0xdff555){const _0x2e7fd3=new Yt();return _0x2e7fd3['content']=_0xdff555,_0x2e7fd3;}const Lr=['wheel','touchstart','pointerdown','keydown'],Dr=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var Pr=class{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x588a6b){this['element']=_0x588a6b,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x237e65 of Lr){const _0x4d2dba='keydown'!==_0x237e65;this['element']['addEventListener'](_0x237e65,this['_onUserEvent']['bind'](this),{'passive':_0x4d2dba,'signal':this['abortController']['signal']});}}['start']({smooth:_0x3c7cf6=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x3c7cf6?'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'](_0x1fe07c){if(this['isRunning']){if('keydown'===_0x1fe07c['type']){const _0x2af8eb=_0x1fe07c['key'];if(!Dr['includes'](_0x2af8eb))return;}_0x1fe07c instanceof WheelEvent?_0x1fe07c['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x101208,scrollHeight:_0x4b9cdd,clientHeight:_0x289b46}=this['element'];return _0x4b9cdd-_0x101208-_0x289b46<=0x5;}['_rafUpdate'](){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}},Hr=class extends Vn{constructor(_0x268d6c){super(_0x268d6c),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']);}},Mr=class extends _0x3b0eb8{['children'];['scrollManager'];['_bodyCollection'];constructor(_0x302ffb,_0x412575){super(_0x302ffb),this['_bodyCollection']=_0x412575,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...yn)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new Pr(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x429a38,_0x58449e){let _0x1db720;return'ai-reply'===_0x429a38?_0x1db720=new hr(this['locale'],_0x58449e,this['_bodyCollection']):'ai-suggestion-reply'===_0x429a38?(_0x1db720=new ar(this['locale'],_0x58449e,this['_bodyCollection']),_0x1db720['bind']('isTrackChangesOn')['to'](this)):_0x1db720='user-message'===_0x429a38?new Nr(this['locale'],_0x58449e,this['_bodyCollection']):'interaction-header'===_0x429a38?new yr(this['locale'],_0x58449e):'custom-element'===_0x429a38?new Hr(_0x58449e):new tr(_0x58449e),this['children']['add'](_0x1db720),_0x1db720;}async['updateReplyItem']({id:_0x55ac08,parsedContent:_0x248c5a,renderingStrategy:_0x10b50f,abortSignal:_0x43eb16}){const _0x241741=this['getItemById'](_0x55ac08);if(!(_0x241741 instanceof hr))throw new ht('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x241741,'id':_0x55ac08,'parsedContent':_0x248c5a});await _0x241741['updateContent']({'parsedContent':_0x248c5a,'renderingStrategy':_0x10b50f,'abortSignal':_0x43eb16});}async['updateWebSources'](_0x1c74e3,_0x330aa9){const _0x102efe=this['getItemById'](_0x1c74e3);if(_0x102efe instanceof ar)_0x102efe['updateSources'](_0x330aa9);else{if(!(_0x102efe instanceof hr))throw new ht('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x102efe,'id':_0x1c74e3,'sources':_0x330aa9});_0x102efe['updateSources'](_0x330aa9);}}async['updateSuggestionItem']({id:_0x2ac2c3,parts:_0x2242fd,abortSignal:_0x31058a,skipLoadingEffects:_0x59cf12}){const _0x528a85=this['getItemById'](_0x2ac2c3);if(!(_0x528a85 instanceof ar))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x528a85,'id':_0x2ac2c3,'parts':_0x2242fd});await _0x528a85['updateContent']({'parts':_0x2242fd,'abortSignal':_0x31058a,'skipLoadingEffects':_0x59cf12});}['updateSuggestionPartState']({id:_0x41a32f,index:_0x1c8657,state:_0x266102}){const _0x4db8d2=this['getItemById'](_0x41a32f);if(!(_0x4db8d2 instanceof ar))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x41a32f});_0x4db8d2['updatePartState'](_0x1c8657,_0x266102);}['setSuggestionPartActive']({id:_0x5c18b4,index:_0x208da1,isActive:_0x151e2b}){const _0x52db51=this['getItemById'](_0x5c18b4);if(!(_0x52db51 instanceof ar))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x5c18b4});this['children']['filter'](_0x152f86=>_0x152f86 instanceof ar)['forEach'](_0xa26c67=>{_0xa26c67['setPartActive'](!0x1);}),_0x52db51['setPartActive'](_0x208da1,_0x151e2b);}['markItemAsDone'](_0x31b78e){this['getItemById'](_0x31b78e)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x33aa5a=>_0x33aa5a['options']['id']);}['removeItem'](_0x2596a5){this['children']['remove'](this['getItemById'](_0x2596a5));}['hasItem'](_0x19d4ce){return!!this['children']['find'](_0x2a0478=>_0x2a0478['options']['id']['includes'](_0x19d4ce));}['scrollToSuggestion'](_0x300cda,_0x4e7e33){const _0x169ca9=this['getItemById'](_0x300cda);if(!(_0x169ca9 instanceof ar))return void bt('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x300cda,'partIndex':_0x4e7e33});const _0x3c8d57=_0x169ca9['getPartView'](_0x4e7e33);_0x3c8d57?St(_0x3c8d57['element'],0x14,this['element']['parentElement'],!0x0,!0x0):bt('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x300cda,'partIndex':_0x4e7e33});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x29b806=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x29b806,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x54cc2a=new Xn(this['locale'],zn['aiFeed']);return _0x54cc2a['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x54cc2a;}['_createFeedItems'](){const _0x21f929=new _0x3b0eb8(this['locale']);return _0x21f929['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x21f929;}['_createFeedLoader'](){const _0x2634ff=new _0x3b0eb8(this['locale']);return _0x2634ff['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x2d5ce1=>!_0x2d5ce1)]},'children':this['_createLoaderChildren']()}),_0x2634ff;}['_createLoaderChildren'](){const _0x5536bb=new cr();return _0x5536bb['isVisible']=!0x0,[_0x5536bb,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x2c7c03){const _0x486787=this['children']['find'](_0x4fa218=>_0x4fa218['options']['id']['includes'](_0x2c7c03));if(!_0x486787)throw new ht('ai-chat-feed-view-item-not-found',this,{'id':_0x2c7c03});return _0x486787;}['setLoadingMessage'](_0x1e9040){this['set']('loadingMessage',_0x1e9040);}['toggleLoadingSkeleton'](_0x43e722){this['set']('isLoadingSkeletonVisible',_0x43e722);}['startAutoScroll'](_0x497b1f={}){this['scrollManager']['start'](_0x497b1f);}['stopAutoScroll'](){this['scrollManager']['stop']();}},Vr=class extends jt{['filter'](){let _0x47d157=0x0;for(const _0x22ea04 of this['items'])_0x47d157+=_0x22ea04['items']['length'];return{'resultsCount':_0x47d157,'totalItemsCount':_0x47d157};}};function Ur(_0x24e416){const _0x4c86ae=[];let _0x385144=!0x1;for(const _0x3f4529 of Array['from'](_0x24e416['items'])){if('file'!==_0x3f4529['kind'])continue;if(_0x3f4529['webkitGetAsEntry']()?.['isDirectory']){_0x385144=!0x0;continue;}const _0x16f71e=_0x3f4529['getAsFile']();_0x16f71e&&_0x4c86ae['push'](_0x16f71e);}return{'files':_0x4c86ae,'hasDirectory':_0x385144};}const Br='ck-ai-chat__prompt-input_highlighted';var Gr=class AIChatPromptInputView extends Nt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0xd84d9d,_0x378ef8){super(_0xd84d9d,{'queryView':{'label':'','creator':_0x31d0b9,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new Vr(_0xd84d9d),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x378ef8,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',(_0x4eff17,_0xa3da3c)=>!_0x4eff17&&!_0xa3da3c),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x14b073,_0x101e7e)=>{this['isUploadInProgress']||this['isEmpty']||_0x14b073['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x101e7e());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x37e180=>this['_handlePaste'](_0x37e180)),this['element']['addEventListener']('drop',_0x3498cc=>this['_handleDrop'](_0x3498cc));}['_handlePaste'](_0x41c9bd){const _0x552d11=_0x41c9bd['clipboardData'];if(!_0x552d11)return;const {files:_0x766819,hasDirectory:_0x670785}=Ur(_0x552d11),_0x329375={'files':_0x766819,'plainText':_0x552d11['getData']('text/plain'),'hasDirectory':_0x670785,'forceTextAttachment':!0x1,'preventDefault':()=>_0x41c9bd['preventDefault']()};this['fire']('promptInputPaste',_0x329375);}['_handleDrop'](_0x1eeebd){const _0x4a998d=_0x1eeebd['dataTransfer'];if(!_0x4a998d)return;const _0x5914e1={'files':[],'plainText':_0x4a998d['getData']('text/uri-list')||_0x4a998d['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x1eeebd['preventDefault']()};this['fire']('promptInputPaste',_0x5914e1);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x2aea14=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x2aea14)return this['queryView']['errorText']=us(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x3d4922=_0x3c76b5(_0x2aea14);this['fire']('sendUserMessage',_0x3d4922),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x1c7178){this['queryView']['fieldView']['set']('placeholder',_0x1c7178);}['focus'](_0x40056e=!0x1){super['focus'](),_0x40056e&&(this['element']['classList']['contains'](Br)||(this['element']['classList']['add'](Br),setTimeout(()=>{this['element']['classList']['remove'](Br);},0x320)));}['_createSubmitButton'](){const _0x48b0ce=new Ht(this['locale']);return _0x48b0ce['set']({'icon':st,'label':us(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+on,'isEnabled':!0x1}),_0x48b0ce['on']('execute',()=>{this['submit']();}),_0x48b0ce;}['setIsUploadInProgress'](_0x66edb4){this['isUploadInProgress']=_0x66edb4;}['_setUpAddContextButtonPositioning'](){const _0x45c442=this['locale'],_0x8d76ec=()=>{Tt['window']['requestAnimationFrame'](()=>{if(Ct(this['element'])){const _0x4b641c=new At(this['queryView']['fieldView']['element']),_0x42e8d9=new At(this['_addContextButtonView']['element']),_0x5eb99e=_0x4b641c['width'],_0x4a5098='rtl'===_0x45c442['uiLanguageDirection']?'right':'left';_0x4b641c['excludeScrollbarsAndBorders']();const _0x1fbbca=_0x5eb99e-_0x4b641c['width']+0x1;this['_addContextButtonView']['element']['style'][_0x4a5098]='calc('+(_0x5eb99e-_0x42e8d9['width']-_0x1fbbca)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x8d76ec),this['on']('render',()=>{_0x8d76ec(),this['_queryViewResizeObserver']=new It(this['queryView']['fieldView']['element'],()=>{_0x8d76ec();});});}},Fr=class extends _0x3b0eb8{constructor(_0x410d8d){super(_0x410d8d);const _0x4abab7=new Yt();_0x4abab7['content']=_0x20248b,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x4abab7,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':us(_0x410d8d,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0x2e4819){let _0x590a32=0x0;_0x2e4819['addEventListener']('dragenter',_0x17b4c3=>{_0x17b4c3['dataTransfer']&&(_0x590a32++,0x1===_0x590a32&&this['fire']('dragEnter'),_0x2e4819['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0x2e4819['addEventListener']('dragover',_0x3872ad=>{_0x3872ad['dataTransfer']&&_0x3872ad['preventDefault']();}),_0x2e4819['addEventListener']('dragleave',()=>{--_0x590a32<=0x0&&(_0x590a32=0x0,_0x2e4819['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0x2e4819['addEventListener']('drop',_0x5d0cff=>{_0x5d0cff['preventDefault'](),_0x590a32=0x0,_0x2e4819['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0x5d0cff);});}['_handleDrop'](_0x26c0f5){const _0x771a01=_0x26c0f5['dataTransfer'];if(!_0x771a01)return;const {files:_0x44d45d,hasDirectory:_0x123e4d}=Ur(_0x771a01),_0x9a39eb={'files':_0x44d45d,'plainText':_0x771a01['getData']('text/uri-list')||_0x771a01['getData']('text/plain'),'hasDirectory':_0x123e4d,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x9a39eb);}};const Kr='ck-ai-chat__prompt-capabilities',Wr='ck-ai-chat-controls-button',Yr='ck-ai-chat-controls-button--commands',$r='ck-ai-chat-controls__model-selection',qr='ck-ai-chat-controls__model-selection__item-name',Qr='ck-ai-chat-controls__model-selection__item-description',Xr='ck-ai-chat-controls__model-selection__item-capabilities',zr='n';var jr=class extends _0x3b0eb8{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x325329){super(_0x325329),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',_0xe7b24f=>'selector'===_0xe7b24f),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x3b17ac=>_0x3b17ac?this['_modelSelectionDropdown']['buttonView']['label']:us(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x3b76f7=>_0x3b76f7),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x1cf6fa=>_0x1cf6fa),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x59c948=>us(this['locale'],_0x59c948?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0xb20743=>_0xb20743),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x3e85bb=>us(this['locale'],_0x3e85bb?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[Kr]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new ct(),_0x39a4e4(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x1db937,_0x41968c){if(_0x41968c)this['set']('modelDisplayMode','hidden');else{const _0x3a1d9f=0x1===_0x1db937['length'];this['set']('modelDisplayMode',_0x3a1d9f?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x1db937?.['length'])for(const _0x4db4f0 of _0x1db937){const _0x478a42=new _0x5c4c1e({'label':_0x4db4f0['name'],'withText':!0x0,'role':'menuitemradio','id':_0x4db4f0['id'],'model':_0x4db4f0});_0x478a42['bind']('isOn')['to'](this,'activeModelId',_0x31a5bf=>_0x31a5bf===_0x4db4f0['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x478a42,'labelView':new Jr(this['locale'],_0x4db4f0)});}}['setWebSearch'](_0x5dfaeb){this['set']('webSearchActive',_0x5dfaeb);}['setReasoning'](_0x2472d1){this['set']('reasoningActive',_0x2472d1);}['setModel'](_0x4a3d95){if(!_0x4a3d95)return;this['activeModelId']=_0x4a3d95['id'],this['activeModelName']=_0x4a3d95['name']||_0x4a3d95['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x4a3d95['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x4a3d95['name']);const _0x1281b0=_0x4a3d95['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x1281b0),this['_webSearchButton']['set']('isVisible',_0x1281b0);const _0x318c50=_0x4a3d95['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x318c50),this['_reasoningButton']['set']('isVisible',_0x318c50);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x39af7b){this['set']('modelSelectorEnabled',!0x1),_0x39af7b&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x187d22=new Ht();return _0x187d22['set']({'label':us(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':at,'class':Wr+'\x20'+hn,'isToggleable':!0x0,'tooltipPosition':zr}),_0x187d22['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x187d22;}['_createReasoningButton'](){const _0x2b7123=new Ht();return _0x2b7123['set']({'label':us(this['locale'],'AI_CHAT_REASONING'),'icon':_0x2a5dc8,'class':Wr+'\x20'+hn,'isToggleable':!0x0,'tooltipPosition':zr}),_0x2b7123['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x2b7123;}['_createCommandsButton'](){const _0x3e8ca5=new Ht();return _0x3e8ca5['set']({'label':us(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x10ce41,'withText':!0x0,'class':Wr+'\x20'+hn,'isToggleable':!0x0,'tooltip':us(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':zr}),_0x3e8ca5['extendTemplate']({'attributes':{'class':[Yr]}}),_0x3e8ca5['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x3e8ca5;}['_createModelSelectionDropdown'](){const _0x1de43e=_0x1e2a6d(this['locale']);return _0x1de43e['set']({'panelPosition':'ne','class':[$r]}),_0x1de43e['buttonView']['set']({'label':us(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':zr,'class':hn}),this['listenTo'](_0x1de43e,'execute',_0x477a98=>{this['fire']('selectModel',_0x477a98['source']['model']);}),_0x1de43e;}['_createModelNameView'](){const _0x1f4add=new Zr(this['locale']);return _0x1f4add['bind']('text')['to'](this,'activeModelName',_0x4f2e64=>_0x4f2e64??''),_0x1f4add['bind']('isVisible')['to'](this,'modelDisplayMode',_0x19c8a7=>'name'===_0x19c8a7),_0x1f4add;}},Jr=class extends Dt{constructor(_0x12c753,_0x15f424){super();const _0x3896c0=this['bindTemplate'],_0x39def5=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x3896c0['to']('style'),'id':_0x3896c0['to']('id')},'children':[{'tag':'div','attributes':{'class':[qr]},'children':[{'text':_0x3896c0['to']('text')}]},{'tag':'div','attributes':{'class':[Qr]},'children':[{'tag':'span','children':[{'text':_0x15f424['description']}]}]},{'tag':'div','attributes':{'class':[Xr]},'children':_0x39def5}]}),_0x39def5['addMany'](this['_getCapabilityParts'](_0x12c753,at,'AI_CHAT_SEARCH_WEB',_0x15f424['capabilities']['webSearch']?.['enabled']??!0x1)),_0x39def5['addMany'](this['_getCapabilityParts'](_0x12c753,_0x2a5dc8,'AI_CHAT_REASONING',_0x15f424['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x3b5584,_0x7e4d4e,_0x2ab613,_0x5eccb5){const _0x1809a7=new Yt();_0x1809a7['content']=_0x7e4d4e;const _0x155458=new _0x3b0eb8(_0x3b5584);_0x155458['setTemplate']({'tag':'span','children':[{'text':us(_0x3b5584,_0x2ab613)+':\x20'}]});const _0x24a6bf=new _0x3b0eb8(_0x3b5584);return _0x24a6bf['setTemplate']({'tag':'span','children':[{'text':us(_0x3b5584,_0x5eccb5?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x1809a7,_0x155458,_0x24a6bf];}},Zr=class extends _0x3b0eb8{constructor(_0x175ffa){super(_0x175ffa),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x5818f9=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x5818f9['if']('isVisible','ck-hidden',_0x3a521d=>!_0x3a521d)]},'children':[{'text':_0x5818f9['to']('text')}]});}};const to='ck-ai-chat-context-controls__url-form',eo='ck-ai-chat-context-controls__url-input-section';var io=class extends _0x3b0eb8{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x7aed96){super(_0x7aed96),this['focusTracker']=new dt(),this['keystrokes']=new _t(),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 Gt({'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'](_0x5f23bc=>{this['focusTracker']['add'](_0x5f23bc['element']),this['keystrokes']['listenTo'](_0x5f23bc['element']);}),_0x3a899a({'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'](_0x7dc863){this['urlInputField']['errorText']=_0x7dc863,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x23ccce=new Ht(this['locale']);return _0x23ccce['set']({'icon':_0x248558,'tooltip':us(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x4a7039,_0x14f38f,_0x1fc749)=>{_0x23ccce['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x1fc749?'':'\x20ck-hidden')]});}),_0x23ccce;}['_createUrlInputField'](){const _0xce8db7=new qt(this['locale'],_0x3b117d);return _0xce8db7['set']({'label':us(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0xce8db7['fieldView']['set']({'placeholder':us(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0xce8db7;}['_createConfirmButton'](){const _0x19ebd4=new Ht(this['locale']);return _0x19ebd4['set']({'icon':_0x3047d4,'tooltip':us(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x19ebd4;}['_setupTemplate'](){const _0x3caa11=new Ft(this['locale'],{'label':us(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x3caa11['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':to,'tabindex':'-1'},'children':[_0x3caa11,{'tag':'div','attributes':{'class':eo},'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',_0x1b48eb=>{_0x1b48eb['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x508f6d,_0x5b8ebb)=>{this['clear'](),this['fire']('cancel'),_0x5b8ebb();});}['_handleSubmit'](){const _0x471c80=this['getValue']()['trim']();_0x471c80?this['_isValidUrl'](_0x471c80)?(this['clearError'](),this['fire']('submitUrl',_0x471c80)):this['setError'](us(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](us(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x3201c5=this['getValue']()['trim'](),_0xbabaf2=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x3201c5['length']>0x0&&!_0xbabaf2;}['_isValidUrl'](_0x28ad24){try{return!!new URL(_0x28ad24);}catch{return!0x1;}}};const so='ck-ai-chat-resources__item',no='ck-ai-chat-resources__item--in-context',ro='ck-ai-chat-resources__item-title',oo='ck-ai-chat-resources__item__icon';var ao=class extends zt{['resource'];['_titleView'];['_iconView'];constructor(_0x355cfb,_0x1fb4d8){super(_0x355cfb),this['resource']=_0x1fb4d8,this['set']('isInContext',!!_0x1fb4d8['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x3655cf){if(_0x3655cf['isInContext'])return _0x3047d4;switch(_0x3655cf['type']){case'document':return _0x59144c;case'web-resource':return _0x229098;case'file':case'text':return _0x20248b;default:return _0x51cb73;}}['highlightText'](_0x29105a){if(!_0x29105a||''===_0x29105a['trim']())return void this['_titleView']['highlightText'](null);const _0x7f3b73=new RegExp(_0xd5ed86(_0x29105a),'gi');this['_titleView']['highlightText'](_0x7f3b73);}['updateResourceState'](_0x5eef65){this['resource']['isInContext']=_0x5eef65,this['isInContext']=_0x5eef65,this['_updateIcon']();}['_createTitleView'](){const _0x33b374=new Wt();return _0x33b374['text']=this['resource']['label'],_0x33b374['extendTemplate']({'tag':'span','attributes':{'class':[ro]}}),_0x33b374;}['_createIconView'](){const _0x2539c9=new Yt();return _0x2539c9['content']=this['getResourceIcon'](this['resource']),_0x2539c9;}['_setupTemplate'](){const _0x3fe063=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[so,_0x3fe063['if']('isVisible','ck-hidden',_0x47fc71=>!_0x47fc71),_0x3fe063['if']('isInContext',no)]},'children':[{'tag':'div','attributes':{'class':[oo]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x3fe063['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const ho='ck-ai-chat-resources__list';var co=class extends jt{['_source'];constructor(_0x1aa7c3,_0x2064c4){super(_0x1aa7c3),this['_source']=_0x2064c4,this['extendTemplate']({'attributes':{'class':[ho]}});}['setResources'](_0x6b170c,_0x268702){this['items']['clear']();let _0x130c5c=_0x6b170c;if(this['_source']['useDefaultFiltering']&&_0x268702&&''!==_0x268702['trim']()){const _0x5d0ec8=new RegExp(_0x268702['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x130c5c=_0x6b170c['filter'](_0x36fab2=>_0x5d0ec8['test'](_0x36fab2['label']));}for(const _0x54eb02 of _0x130c5c){const _0x569ef8=new ao(this['locale'],_0x54eb02);_0x569ef8['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x54eb02);}),this['items']['add'](_0x569ef8);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x268702);}['highlightText'](_0x2fc927){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x5b268e=>{_0x5b268e['highlightText'](_0x2fc927);});}['updateResourceState'](_0x5b691b,_0x35239c){for(const _0x3a0851 of this['items']){const _0x2f0ddd=_0x3a0851;_0x2f0ddd['resource']['id']===_0x5b691b&&_0x2f0ddd['updateResourceState'](_0x35239c);}}['_handleResourceSelection'](_0x21eaa6,_0xd4f387){this['fire']('addResourceToContext',{'source':_0x21eaa6,'resource':_0xd4f387});}},lo=class extends qt{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x4db194){const t=_0x4db194['t'],_0x254992={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x3b117d,'label':us(_0x4db194,'AI_CHAT_SEARCH_RESOURCES')};super(_0x4db194,_0x254992['creator']),this['label']=_0x254992['label'],this['_viewConfig']=_0x254992,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x4db194,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x1e6f90){this['fire']('search',_0x1e6f90);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Yt(),this['iconView']['content']=_0x5bf082,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x3dc3ab,t){this['resetButtonView']=new Ht(_0x3dc3ab),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x22db67,'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',_0x4ee2b7=>!_0x4ee2b7),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);}},uo=class extends _0x3b0eb8{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0x150eca,_0x1c467b){super(_0x150eca),this['_source']=_0x1c467b['source'],this['_searchInputVisibleFrom']=_0x1c467b['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 _0x554eb4([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}['_createSearchView'](){return new lo(this['locale']);}['_createSearchSection'](){const _0x4f4436=new _0x3b0eb8(this['locale']);return _0x4f4436['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0xcf97c8,_0x3c685b)=>{this['loadResources'](_0x3c685b),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x3c685b);}),_0x4f4436;}['_createResourcesListView'](){const _0x4fd5a3=new co(this['locale'],this['_source']);return _0x4fd5a3['delegate']('addResourceToContext')['to'](this),_0x4fd5a3['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x4fd5a3;}['_createSkeletonView'](){const _0x321726=new Xn(this['locale'],zn['aiChatResources']);return _0x321726['bind']('isVisible')['to'](this,'isLoading'),_0x321726;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x1c80f6){const _0x5cbc3a=vt();this['_latestLoadResourcesUid']=_0x5cbc3a,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x1c80f6,'uid':_0x5cbc3a}),this['isLoading']=!0x0;}['setResources'](_0x59c92b,_0x5c8b08){if(_0x5c8b08&&_0x5c8b08!==this['_latestLoadResourcesUid'])return;const _0x3e370d=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x59c92b,_0x3e370d),_0x59c92b['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x1d7e5d,_0x3d54f8){this['_resourcesListView']['updateResourceState'](_0x1d7e5d,_0x3d54f8);}};const _o='ck-ai-chat-context-controls__source-balloon-panel',go='ck-button-icon\x20ck-button-back',Ao='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';var Io=class{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x23c44d,_0x5a93a3,_0x53258b){this['_locale']=_0x23c44d,this['_bodyCollection']=_0x5a93a3,this['_config']=_0x53258b;}['showSourceResourcesBalloon']({source:_0x433692,withBackButton:_0x168d00}){let _0x894e2b=this['_sourceResourceBalloons']['get'](_0x433692['id']);_0x894e2b||(_0x894e2b=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x433692['id'],_0x894e2b),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x894e2b)),this['_addSourceResourceContent']({'balloonPanel':_0x894e2b,'source':_0x433692,'withBackButton':_0x168d00}),_0x894e2b['show']();const _0x3c2345=this['_config']['getTargetElement']();_0x3c2345&&_0x894e2b['pin']({'target':_0x3c2345,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x1879df,_0x1ed2bd,_0x2455f2){const _0x59da65=this['_sourceResourceBalloons']['get'](_0x1879df);if(!_0x59da65)return;const _0xef9a9f=this['_getResourcesViewFromBalloon'](_0x59da65);_0xef9a9f&&(_0xef9a9f['setResources'](_0x1ed2bd,_0x2455f2),_0xef9a9f['once']('change:isLoading',()=>{_0x59da65['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x196c51){const _0x31f914=this['_sourceResourceBalloons']['get'](_0x196c51);_0x31f914&&requestAnimationFrame(()=>{_0x31f914['hide'](),this['_sourceResourceBalloons']['delete'](_0x196c51),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x42fbe4 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x42fbe4);}['isAnyResourceBalloonVisible'](){for(const _0x13d902 of this['_sourceResourceBalloons']['values']())if(_0x13d902['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x48230c,_0x42cd8b,_0xb7990e){const _0x56f410=this['_sourceResourceBalloons']['get'](_0x48230c);if(!_0x56f410||!_0x56f410['isVisible'])return;const _0x5daae6=this['_config']['getTargetElement']();if(!_0x5daae6)return;_0x56f410['pin']({'target':_0x5daae6,'limiter':this['_config']['getLimiterElement']()});const _0x1c6f90=this['_getResourcesViewFromBalloon'](_0x56f410);_0x1c6f90&&_0x1c6f90['updateResourceState'](_0x42cd8b,_0xb7990e);}['destroy'](){for(const _0x1588e4 of this['_sourceResourceBalloons']['values']())_0x1588e4['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x17f60d=new yt(this['_locale']);return _0x17f60d['extendTemplate']({'attributes':{'class':_o}}),this['_bodyCollection']['add'](_0x17f60d),_0x17f60d;}['_addSourceResourceContent']({balloonPanel:_0x5b3c86,source:_0x5afa9c,withBackButton:_0x4c25a5}){_0x5b3c86['content']['clear']();const _0x4af13c=this['_createBalloonHeader']({'balloonPanel':_0x5b3c86,'source':_0x5afa9c,'withBackButton':_0x4c25a5});_0x5b3c86['content']['add'](_0x4af13c);const _0x5e3812=this['_createBalloonResourcesView'](_0x5afa9c);_0x5b3c86['content']['add'](_0x5e3812);}['_createBalloonHeader']({balloonPanel:_0x2f9f1b,source:_0x1ad618,withBackButton:_0x29f8dc}){const _0x3205d7=new Ft(this['_locale'],{'label':_0x1ad618['label'],'class':Ao});return _0x29f8dc&&_0x3205d7['children']['add'](this['_createBackButton'](_0x2f9f1b),0x0),_0x3205d7;}['_createBackButton'](_0x285a85){const _0x240a15=new Ht(this['_locale']);return _0x240a15['set']({'icon':_0x248558,'tooltip':us(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':go}),_0x240a15['on']('execute',()=>{_0x285a85['hide'](),this['_config']['onBackToContext']();}),_0x240a15;}['_createBalloonResourcesView'](_0x30f5a8){const _0x133350=new uo(this['_locale'],{'source':_0x30f5a8,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x133350['on']('loadSourceResources',(_0x204991,_0x123abd)=>{this['_config']['onLoadSourceResources'](_0x123abd);}),_0x133350['on']('addResourceToContext',(_0x781b9e,_0x45a057)=>{this['_config']['onResourceSelected'](_0x45a057['source'],_0x45a057['resource']),this['closeSourceResourceBalloon'](_0x30f5a8['id']);}),_0x133350;}['_getResourcesViewFromBalloon'](_0x3db59d){const _0x3c9539=_0x3db59d['content']['get'](0x1);return _0x3c9539 instanceof uo?_0x3c9539:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x7af4b0){_0x45c652({'emitter':_0x7af4b0,'contextElements':[_0x7af4b0['element']],'callback':()=>{_0x7af4b0['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x7af4b0['isVisible']});}};const po=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],mo='ck-ai-chat-context-controls',Eo='ck-ai-chat-context-controls__pending-contexts',To='ck-ai-chat-context-controls__add-context-balloon-panel',wo='ck-ai-chat-context-controls__add-context-button',Co='ck-ai-chat-context-controls__url-balloon-panel',fo='ck-ai-chat-context-controls__balloon-button',bo='ck-ai-chat-context-controls__balloon-button-source',So='ck-ai-chat-controls-button',Ro='ck-ai-chat-context-chips-wrapper-balloon',Oo='ck-ai-chat-controls_context_show-more-button',vo='ck-ai-chat-context-controls__show-more-balloon-panel',ko='ck-ai-chat',No=[yt['defaultPositions']['northArrowSouthWest'],yt['defaultPositions']['northArrowSouth'],yt['defaultPositions']['northArrowSouthEast'],yt['defaultPositions']['southArrowNorthWest'],yt['defaultPositions']['southArrowNorth'],yt['defaultPositions']['southArrowNorthEast']];var yo=class extends _0x3b0eb8{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x30de3f,_0xda85b0){super(_0x30de3f),this['bodyCollection']=_0xda85b0['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x30de3f),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x30de3f),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x30de3f),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x30de3f,_0xda85b0);const _0x25b7ef={'cssClasses':{'showMoreButton':Oo+'\x20'+hn,'showMoreBalloon':vo,'overflowContainer':Ro,'controlsButton':So}};this['_overflowManager']=new Cr(_0x30de3f,this['_currentContextsChips'],_0x25b7ef,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'](_0x334582,_0x6b732b){const _0x25871c=this['_createContextButton'](_0x334582,'current',!0x0,_0x6b732b);this['_addContextToCollection'](_0x25871c,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x3c9084){this['_removeContextFromCollection'](_0x3c9084,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x3c9084,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x34f996,_0x4335a1){let _0x4f5cda=this['_currentContextsChips']['find'](_0x3671f9=>_0x3671f9['id']===_0x34f996);_0x4f5cda||(_0x4f5cda=this['_overflowManager']['overflowChips']['find'](_0x24058e=>_0x24058e['id']===_0x34f996)),_0x4f5cda&&(_0x4f5cda['isLoading']=_0x4335a1);}['setConversationContext'](_0x32d1d9){this['_conversationContextsChips']['clear']();for(const _0x8156b7 of _0x32d1d9){const _0x3f188d=this['_createContextButton'](_0x8156b7,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x3f188d,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x16a67a,_0x4042d0,_0x44c4b8){this['_resourcesBalloonView']['updateResourceState'](_0x16a67a,_0x4042d0,_0x44c4b8);}['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;}['hideAllBalloons'](){this['hideAddContextBalloonPanel'](),this['hideUrlBalloonPanel'](),this['_resourcesBalloonView']['closeAll']();}['_showSourceResourcesBalloon']({source:_0x428e9b,withBackButton:_0x138c4b}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x428e9b,'withBackButton':_0x138c4b}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0xfd8378,_0x58f202,_0x5b15ce,_0x20ea37){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0xfd8378,_0x5b15ce,_0x20ea37);}['closeSourceResourceBalloon'](_0x1bf299){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x1bf299),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x468713){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x468713),this['_setAddContextButtonEnabled'](_0x468713);}['_setAddContextButtonEnabled'](_0x1c3cb4){const _0x1f20d1=!_0x1c3cb4['document']['isHidden']&&_0x1c3cb4['document']['enabled'],_0x3cdc56=_0x1c3cb4['urls']['enabled'],_0x27c6b5=_0x1c3cb4['files']['enabled'],_0x3d4452=_0x1c3cb4['sources']['length']>0x0,_0x2b1e81=_0x1c3cb4['customItems']&&_0x1c3cb4['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x1f20d1||_0x3cdc56||_0x27c6b5||_0x3d4452||_0x2b1e81;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[mo,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':Eo},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x1203e5){const _0x3de5ea=new Ht(_0x1203e5);return _0x3de5ea['set']({'label':us(_0x1203e5,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':So+'\x20'+wo+'\x20'+hn,'icon':_0x17cead,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x3de5ea;}['_createAddContextBalloonPanelView'](_0x21824d){return this['_createBaseBalloonPanel'](_0x21824d,To);}['_createUrlBalloonPanelView'](_0x10398a){const _0x3c262a=this['_createBaseBalloonPanel'](_0x10398a,Co);return this['_addUrlContent'](_0x3c262a,_0x10398a),_0x3c262a;}['_createResourcesBalloonView'](_0x349913,_0x54dd21){const _0x1efe04={'searchInputVisibleFrom':_0x54dd21['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No});},'onResourceSelected':(_0x4a5bbe,_0xb25702)=>{this['fire']('addResourceToContext',{'source':_0x4a5bbe,'resource':_0xb25702});},'onLoadSourceResources':_0x327967=>{this['fire']('loadSourceResources',_0x327967);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new Io(_0x349913,_0x54dd21['bodyCollection'],_0x1efe04);}['_getLimiterElement'](){return this['element']?.['closest']('.'+ko)||document['body'];}['_createBaseBalloonPanel'](_0x4fead6,_0x2cadf4){const _0x50aeaf=new yt(_0x4fead6);return _0x50aeaf['extendTemplate']({'attributes':{'class':_0x2cadf4}}),this['bodyCollection']['add'](_0x50aeaf),_0x50aeaf;}['_setBalloonPanelContent'](_0x942ee8,_0x50e2bb,_0xc4fff5){if(_0x942ee8['content']['clear'](),!_0xc4fff5['document']['isHidden']&&_0xc4fff5['document']['enabled']){const _0x4bd6da=this['_createBalloonButton'](_0x50e2bb,{'label':us(_0x50e2bb,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x59144c});_0x4bd6da['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x942ee8['content']['add'](_0x4bd6da);}if(_0xc4fff5['urls']['enabled']){const _0x51260e=this['_createBalloonButton'](_0x50e2bb,{'label':us(_0x50e2bb,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x229098});_0x51260e['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}),this['_urlInputView']['focus']();}),_0x942ee8['content']['add'](_0x51260e);}if(_0xc4fff5['files']['enabled']){const _0x2cefe7=new Bt(_0x50e2bb);_0x2cefe7['set']({'label':us(_0x50e2bb,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x531cf8,'withText':!0x0,'tooltip':!0x0,'class':fo,'allowMultipleFiles':!0x0}),_0x2cefe7['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x2cefe7['on']('done',(_0x4c782e,_0x89f9b4)=>{this['fire']('addFileToContext',_0x89f9b4);}),_0x2cefe7['tooltip']=!0x0,_0x942ee8['content']['add'](_0x2cefe7);}for(const _0x2dff75 of _0xc4fff5['sources']){const _0x2c28da=this['_createBalloonButton'](_0x50e2bb,{'label':_0x2dff75['label'],'icon':_0x2dff75['icon']||_0x51cb73,'type':'source'});_0x942ee8['content']['add'](_0x2c28da),_0x2c28da['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x2dff75,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x52a542 of _0xc4fff5['customItems']||[]){const _0x450cb4=this['_createBalloonButton'](_0x50e2bb,{'label':_0x52a542['label'],'icon':_0x52a542['icon']||_0x51cb73,'type':'customItem'});_0x942ee8['content']['add'](_0x450cb4),_0x450cb4['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x52a542);});}this['_hasExactlyOneSource']=0x1===_0x942ee8['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x679a44,_0x273952){this['_urlInputView']=new io(_0x273952),this['_urlInputView']['on']('submitUrl',(_0x1cab1f,_0x389c8e)=>{this['_handleUrlSubmit'](_0x389c8e);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No});}),_0x679a44['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x370158,_0x141615){const _0x20d67a='source'===_0x141615['type']?new xo(_0x370158):new Ht(_0x370158);return _0x20d67a['set']({'label':_0x141615['label'],'icon':_0x141615['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':fo}),_0x20d67a;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){_0x45c652({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x1c0c5b){const _0x44838a=this['_addContextBalloonConfig'];_0x44838a['buttonView']['isOn']=_0x1c0c5b,_0x1c0c5b?_0x44838a['balloonView']['show']():_0x44838a['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x966872,buttonView:_0x550eb6,hideMethod:_0x215182}=this['_addContextBalloonConfig'];_0x45c652({'emitter':_0x966872,'contextElements':[_0x966872['element'],_0x550eb6['element']],'callback':()=>{_0x215182();},'activator':()=>_0x550eb6['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x3eca4c,_0x552725,_0x1deae6=!0x1,_0x4ebdc5=!0x1){const _0x5639fb='conversation'===_0x552725||!0x0===_0x3eca4c['isReadOnly'],_0x28ef37=new mr(this['locale'],_0x3eca4c,_0x5639fb,_0x1deae6,_0x4ebdc5);return _0x5639fb||_0x28ef37['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x28ef37['id']);}),_0x28ef37;}['_addContextToCollection'](_0x3ef2bf,_0x22f302){_0x22f302['add'](_0x3ef2bf,0x0);}['_removeContextFromCollection'](_0x5abe4,_0x17d304){const _0x2b0fe9=_0x17d304['find'](_0x5920a9=>_0x5920a9['id']===_0x5abe4);_0x2b0fe9&&_0x17d304['remove'](_0x2b0fe9);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x50d953){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x50d953);}},xo=class extends Ht{['arrowView'];constructor(_0x39912c){super(_0x39912c),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[bo]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x3bfcea=new Yt();return _0x3bfcea['content']=_0xc2680e,_0x3bfcea['extendTemplate']({'attributes':{'class':bo+'__arrow'}}),_0x3bfcea;}},Lo=class extends _0x3b0eb8{['_cancelButtonView'];['_loaderView'];constructor(_0x2816a4){super(_0x2816a4),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 _0x548342=new Ht(this['locale']);return _0x548342['set']({'label':us(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':an+'\x20ck-ai-button-stop-generating','icon':it}),_0x548342['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x548342;}['_createLoaderView'](){const _0x17ab72=new _0x3b0eb8(this['locale']);return _0x17ab72['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':us(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x17ab72;}},Do=class extends _0x3b0eb8{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0x1f0aab,_0x3dd5f0){super(_0x1f0aab),this['_filesEnabled']=_0x3dd5f0['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x1f0aab,{'bodyCollection':_0x3dd5f0['bodyCollection'],'searchInputVisibleFrom':_0x3dd5f0['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x1f0aab),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x1f0aab),this['_loaderView']=this['_createLoaderView'](_0x1f0aab),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x1f0aab),this['_dropZoneView']=new Fr(_0x1f0aab),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage','promptInputPaste')['to'](this),this['_dropZoneView']['delegate']('promptInputPaste')['to'](this),this['_dropZoneView']['on']('dragEnter',()=>this['_contextPanelView']['hideAllBalloons']()),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'](...po)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x2db75b=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x2db75b['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x2db75b['if']('isLoading','ck-hidden',_0x1a50bc=>_0x1a50bc||!this['isModelAvailable']),_0x2db75b['if']('isModelAvailable','ck-hidden',_0x2ea5c0=>!_0x2ea5c0||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x2db75b['if']('isLoading','ck-hidden',_0x4258aa=>!_0x4258aa)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x2db75b['if']('isModelAvailable','ck-hidden',_0x7d16ea=>_0x7d16ea)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0x45c652({'emitter':this['_promptInputView'],'activator':()=>this['isLoading'],'contextElements':()=>[this['element']],'callback':()=>{this['_shouldRestorePromptInputFocus']=!0x1;}}),this['on']('change:isLoading',this['_handlePromptInputFocus'],{'priority':'low'});}['render'](){super['render'](),this['_filesEnabled']&&this['_dropZoneView']['attach'](this['element']);}['_createContextPanelView'](_0x22d567,_0x36090c){return new yo(_0x22d567,_0x36090c);}['_createPromptInputView'](_0x21b4b3){return new Gr(_0x21b4b3,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x4d0f01){return new jr(_0x4d0f01);}['_createLoaderView'](_0xff8f9b){return new Lo(_0xff8f9b);}['_createModelUnavailableMessageView'](_0x1192a1){const _0x50a264=new Po(_0x1192a1);return _0x50a264['delegate']('startConversation')['to'](this),_0x50a264;}['_handlePromptInputFocus'](_0x3c8a12,_0x3ad0b9,_0x1564d1){_0x1564d1?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x2b6ddf,_0x143d10){this['_contextPanelView']['addContextItem'](_0x2b6ddf,_0x143d10);}['removeContextItem'](_0x372354){this['_contextPanelView']['removeContextItem'](_0x372354);}['setContextItemLoading'](_0x1d2eb0,_0x32e7a2){this['_contextPanelView']['setContextItemLoading'](_0x1d2eb0,_0x32e7a2);}['setIsUploadInProgress'](_0xb91702){this['_promptInputView']['setIsUploadInProgress'](_0xb91702);}['setConversationContext'](_0x3b8559){this['_contextPanelView']['setConversationContext'](_0x3b8559);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x240da6,_0x504048,_0xf20c9f){this['_contextPanelView']['updateResourceState'](_0x240da6,_0x504048,_0xf20c9f);}['setWebSearch'](_0x31bce4){this['_promptCapabilitiesView']['setWebSearch'](_0x31bce4);}['setReasoning'](_0x1e5a6b){this['_promptCapabilitiesView']['setReasoning'](_0x1e5a6b);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x179cf6){this['_contextPanelView']['setAddContextOptions'](_0x179cf6);}['setInputPlaceholder'](_0x329eb5){this['_promptInputView']['setPlaceholderText'](_0x329eb5);}['setModelList'](_0xa7e15,_0x5d9382){this['_promptCapabilitiesView']['setModelList'](_0xa7e15,_0x5d9382);}['setModel'](_0x19c24){_0x19c24?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x19c24)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x368fc6){this['_promptCapabilitiesView']['disableModelSelector'](_0x368fc6);}['populateSourceResourceBalloon'](_0x3c9c33,_0x2458e5,_0x39d326,_0x146ed3){this['_contextPanelView']['populateSourceResourceBalloon'](_0x3c9c33,_0x2458e5,_0x39d326,_0x146ed3);}['closeSourceResourceBalloon'](_0x25677b){this['_contextPanelView']['closeSourceResourceBalloon'](_0x25677b);}['focusPromptInput'](_0x3a79ee=!0x1){this['_promptInputView']['focus'](_0x3a79ee);}['setPromptInputValue'](_0x40c1b6){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x40c1b6;}},Po=class extends _0x3b0eb8{constructor(_0x54796d){super(_0x54796d);const _0x3c4ec0=new Ht(_0x54796d);_0x3c4ec0['set']({'label':us(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x3c4ec0['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':us(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x3c4ec0]}]});}},Ho=class extends Ft{['resizeButton'];constructor(_0x572c72,_0x56d275){super(_0x572c72,{'label':_0x56d275['label'],'class':'ck-ai-header\x20'+_0x56d275['class'],'icon':_0x56d275['icon']}),this['set']('isMaximized',!0x1),_0x56d275['content']&&this['children']['add'](_0x56d275['content']),_0x56d275['showResizeButton']&&(this['resizeButton']=cn(_0x572c72,this),this['children']['add'](this['resizeButton']));}},Mo=class extends _0x3b0eb8{constructor(_0x4517d8){super(_0x4517d8),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':us(_0x4517d8,'AI_DISCLAIMER_TEXT')}]}]});}};function Vo(_0x2000b8,_0xe5e4eb){const _0x5397b9=new Ht(_0x2000b8);return _0x5397b9['set']({'label':us(_0x2000b8,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x2848a3,'class':'ck-ai-chat__start-conversation\x20'+an}),_0x5397b9['on']('execute',()=>{_0xe5e4eb['fire']('startConversation');}),_0x5397b9;}var Uo=class extends _0x3b0eb8{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0x353e3b,_0x2ad229){super(_0x353e3b),this['_bodyCollection']=ln(_0x353e3b);const _0x4a8c4f=Vo(_0x353e3b,this);this['chatHeader']=new Ho(_0x353e3b,{'label':us(_0x353e3b,'AI_CHAT_HEADING'),'icon':_0x532e15,'class':'ck-ai-header_chat','content':_0x4a8c4f,'showResizeButton':_0x2ad229['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new Mr(_0x353e3b,this['_bodyCollection']),this['chatFeed']['delegate'](...yn)['to'](this),this['chatControls']=new Do(_0x353e3b,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x2ad229['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x2ad229['filesEnabled']}),this['chatControls']['delegate'](...yn)['to'](this),this['chatDisclaimer']=new Mo(_0x353e3b),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x353e3b['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0xe70065,_0x3a225d,_0x18c88f,_0x2ed65f){this['chatControls']['populateSourceResourceBalloon'](_0xe70065,_0x3a225d,_0x18c88f,_0x2ed65f);}['closeSourceResourceBalloon'](_0x3f6f86){this['chatControls']['closeSourceResourceBalloon'](_0x3f6f86);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Bo=class extends _0xe5ed07{static get['requires'](){return[cs];}['_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(_0x19246d){super(_0x19246d);const _0x2d9394=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new Zn(),this['_view']=new Uo(this['context']['locale'],{'showResizeButton':_0x2d9394['showResizeButton'],'contextResourcesSearchInputVisibleFrom':this['context']['config']['get']('ai.chat.context.searchInputVisibleFrom'),'filesEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.files.enabled')}),this['_view']['delegate']('resizeTabs')['to'](_0x2d9394),this['_view']['delegate'](...yn)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x2d85fb,{showDiff:_0x5d4c68})=>{this['showDiff']=_0x5d4c68;}),this['disableControls'](),_0x2d9394['view']['addTab']({'id':'chat','buttonLabel':us(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x532e15,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x2d9394['view'],'isMaximized',_0x41cd4c=>_0x41cd4c),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x4f808=>_0x4f808),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0xa772e){const _0x2e5790=this['context']['config']['get']('ai.chat.welcomeMessage')??us(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0xa772e['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x2e5790}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x3465d1,staticMessage:_0x12cc0b}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x3465d1,'initialContent':'<p>'+_0x12cc0b+'</p>'});});}async['addFeedItemUserMessage'](_0xff98f){const _0x41ed52=_0xff98f['attributes']?.['displayedPrompt']||_0xff98f['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0xff98f['contextItems']['values']()),'initialContent':'<p>'+_0x41ed52+'</p>','id':_0xff98f['id']});});}async['addFeedItemError']({errorMessage:_0x21a958,id:_0x375702}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x21a958+'</p>','id':_0x375702});});}async['addFeedItemAIReply'](_0x385a1d){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x385a1d['interactionId']+':'+_0x385a1d['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x357b2a){const _0x34a5c4=ds(this['context']),_0x48d361=_0x34a5c4['map'](_0x320e9c=>_0x320e9c['config']['get']('ai.availableReplyActions')||[...er]);let _0x50fd7f=_0x48d361['reduce']((_0x450074,_0x5c1cd4)=>_0x450074['filter'](_0x46d9ae=>_0x5c1cd4['includes'](_0x46d9ae)),_0x48d361[0x0]||[...er]);const _0x25b98d=_0x34a5c4['every'](_0x4278aa=>_0x4278aa['plugins']['has']('TrackChanges')),_0x252f9c=_0x34a5c4['map'](_0x57578d=>_0x57578d['commands']['get']('trackChanges'));return _0x25b98d?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x252f9c,'value',(..._0x2596b6)=>_0x2596b6['some'](_0x36e78f=>_0x36e78f))):_0x50fd7f=_0x50fd7f['filter'](_0x4cac4f=>'insertSuggestion'!=_0x4cac4f),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x357b2a['interactionId']+':'+_0x357b2a['id'],'areActionsDisabled':_0x357b2a['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x50fd7f}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x2140fb,_0x6579ea){return this['_promiseQueue']['enqueue'](async()=>{const _0x742128=this['_view']['chatFeed']['children']['last'];if(_0x742128 instanceof yr)return this['_view']['chatFeed']['children']['remove'](_0x742128),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x2140fb['id'],'capabilities':{'isWebSearchEnabled':_0x742128['capabilities']['isWebSearchEnabled']||_0x6579ea['isWebSearchEnabled'],'isReasoningEnabled':_0x742128['capabilities']['isReasoningEnabled']||_0x6579ea['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x2140fb['id'],'capabilities':_0x6579ea});});}async['addFeedItemCustomElement'](_0x3ca0fe,_0xae4846){let _0x4b4843;return await this['_promiseQueue']['enqueue'](async()=>{_0x4b4843=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x3ca0fe,'id':_0xae4846});}),_0x4b4843;}['removeFeedItem'](_0xb5494c){this['_view']['chatFeed']['removeItem'](_0xb5494c);}['hasFeedItem'](_0x72b0ec){return this['_view']['chatFeed']['hasItem'](_0x72b0ec);}['updateFeedInteractionHeader'](_0x5bfac1){const _0x2a1764=this['_view']['chatFeed']['children']['find'](_0x4cbeed=>_0x4cbeed['options']['id']==_0x5bfac1['id']&&_0x4cbeed instanceof yr);_0x2a1764&&_0x2a1764['set']('isVisible',_0x5bfac1['isVisible']);}async['updateFeedItemAIReplyContent'](_0x49d521){const _0x3bd676=_0x49d521['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x1faac6=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x49d521,'abortSignal':_0x1faac6,'renderingStrategy':_0x3bd676}),_0x49d521['isDone']&&this['markFeedItemAsDone'](_0x49d521['id']);});}['updateFeedItemAIReplySources'](_0x430f2b,_0x36390e){this['_view']['chatFeed']['updateWebSources'](_0x430f2b,_0x36390e);}async['updateFeedItemAIReplySuggestionContent'](_0x10c873){return this['_promiseQueue']['enqueue'](async _0x30e059=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x10c873,'abortSignal':_0x30e059}),_0x10c873['isDone']&&this['markFeedItemAsDone'](_0x10c873['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x51e61a){this['_view']['chatFeed']['updateSuggestionPartState'](_0x51e61a);}['setFeedItemAIReplySuggestionPartActive'](_0x504dea){this['_view']['chatFeed']['setSuggestionPartActive'](_0x504dea);}['markFeedItemAsDone'](_0x52ccfa){this['_view']['chatFeed']['markItemAsDone'](_0x52ccfa);}['removeFeedInteraction'](_0x1206c9){this['_view']['chatFeed']['getItemIds']()['filter'](_0x3695e0=>_0x3695e0['startsWith'](_0x1206c9))['forEach'](_0x1ecc30=>this['_view']['chatFeed']['removeItem'](_0x1ecc30));}['startInteraction'](){const _0x2b8cce=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x2b8cce),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x416168){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x54bc3b=>_0x54bc3b['startsWith'](_0x416168['id']))['forEach'](_0x4b2b4c=>this['markFeedItemAsDone'](_0x4b2b4c)),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'](_0x4551ac,_0x36abd0){this['_view']['chatControls']['addContextItem'](_0x4551ac,_0x36abd0);}['removeContextItem'](_0x3db26f){this['_view']['chatControls']['removeContextItem'](_0x3db26f);}['setContextItemLoading'](_0x2a49b5,_0x2d422b){this['_view']['chatControls']['setContextItemLoading'](_0x2a49b5,_0x2d422b);}['setIsUploadInProgress'](_0x1aafa1){this['_view']['chatControls']['setIsUploadInProgress'](_0x1aafa1);}['setConversationContext'](_0x15b32c){this['_view']['chatControls']['setConversationContext'](_0x15b32c);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0xcef50,_0x44919a,_0x30349d){this['_view']['chatControls']['updateResourceState'](_0xcef50,_0x44919a,_0x30349d);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x1daa75){this['_view']['chatControls']['setAddContextOptions'](_0x1daa75);}['updateCapabilities'](_0x39507f){this['_view']['chatControls']['setWebSearch'](_0x39507f['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x39507f['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x39507f));}['setSelectedModel'](_0x541fd0,_0x58e7b9){this['_view']['chatControls']['setModel'](_0x541fd0),_0x58e7b9&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x3d8866){this['feedItemRenderingStrategy']=_0x3d8866;}['toggleLoadingSkeleton'](_0x3b8f77){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x3b8f77);}['resetConversationTitle'](){this['setConversationTitle'](us(this['context']['locale'],'AI_CHAT_HEADING'));}['emptyConversationTitle'](){this['setConversationTitle']('');}['setConversationTitle'](_0x286b38,_0x883c6=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0x883c6&&!pt()&&_0x286b38['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x286b38);this['_view']['chatHeader']['label']=_0x286b38;}['setLoadingMessage'](_0x4dab04){this['_view']['chatFeed']['setLoadingMessage'](_0x4dab04);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x1ed257){let _0x2767bb=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x1ed257[_0x2767bb],_0x2767bb++,_0x2767bb===_0x1ed257['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x33c266){return _0x33c266['isWebSearchEnabled']&&_0x33c266['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x33c266['isWebSearchEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x33c266['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x4dcfa2){return _0x4dcfa2?_0x4dcfa2['isWebSearchEnabled']&&_0x4dcfa2['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x4dcfa2['isWebSearchEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x4dcfa2['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x202179,_0x5cedf1,_0x4679ad,_0x4ed4df){this['_view']['populateSourceResourceBalloon'](_0x202179,_0x5cedf1,_0x4679ad,_0x4ed4df);}['closeSourceResourceBalloon'](_0xc6eb53){this['_view']['closeSourceResourceBalloon'](_0xc6eb53);}['setPromptInputValue'](_0x317e71){this['_view']['chatControls']['setPromptInputValue'](_0x317e71);}['focusPromptInput'](_0xb4afb9=!0x1){this['_view']['chatControls']['focusPromptInput'](_0xb4afb9);}['scrollFeedToSuggestion'](_0x5ace50,_0x1762e0){this['_view']['chatFeed']['scrollToSuggestion'](_0x5ace50,_0x1762e0);}['startAutoScroll'](_0x2660e3={}){this['_view']['chatFeed']['startAutoScroll'](_0x2660e3);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}},Go=class extends jt{['sections'];constructor(_0xd061fe,_0x4f9d51){super(_0xd061fe),this['sections']=_0x4f9d51,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x5ba702){let _0x14a7a3=0x0,_0x5012fd=0x0;for(const _0x4370e2 of this['sections']){const {resultsCount:_0x267d9c,totalItemsCount:_0x2e5390}=_0x4370e2['filter'](_0x5ba702);_0x14a7a3+=_0x267d9c,_0x5012fd+=_0x2e5390;}return{'resultsCount':_0x14a7a3,'totalItemsCount':_0x5012fd};}},Fo=class extends zt{['title'];['itemsViews'];['_itemsListView'];constructor(_0x596dfe,{title:_0x3dde0c,items:_0x6cc7dd}){super(_0x596dfe);const _0x4a292d=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x3dde0c,this['itemsViews']=_0x6cc7dd;const _0xe0f23c=new _0x3b0eb8(_0x596dfe);_0xe0f23c['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new jt(_0x596dfe),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x4a292d['if']('isVisible','ck-hidden',_0x453239=>!_0x453239)]},'children':[_0xe0f23c,this['_itemsListView']]});}['filter'](_0x6b93ec){const _0x588a1a=this['itemsViews']['length'];let _0x4be2cc=0x0;for(const _0x597580 of this['itemsViews'])_0x6b93ec?(_0x597580['isVisible']=!!_0x597580['isMatching'](_0x6b93ec),_0x597580['highlightText'](_0x6b93ec)):(_0x597580['isVisible']=!0x0,_0x597580['highlightText'](null)),_0x597580['isVisible']&&_0x4be2cc++;return this['isVisible']=_0x4be2cc>0x0,{'resultsCount':_0x4be2cc,'totalItemsCount':_0x588a1a};}['getItem'](_0x5a2994){return this['itemsViews']['find'](_0x1af31d=>_0x1af31d['id']===_0x5a2994);}['removeItem'](_0x336237){const _0x2eec2e=this['itemsViews']['indexOf'](_0x336237);-0x1!==_0x2eec2e&&(this['itemsViews']['splice'](_0x2eec2e,0x1),this['_itemsListView']['items']['remove'](_0x336237));}};const Ko=/* #__PURE__ -- @preserve */
34
- _0x34c427(zt);var Wo=class AIChatHistoryListItemView extends Ko{['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(_0x41ab77,_0x397177){super(_0x41ab77);const _0x23afdd=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x397177['pinned']),this['set']('loadingState',null),this['set']('title',_0x397177['title']),this['id']=_0x397177['id'];const {createdAt:_0x1caa96,active:_0x592ff0=!0x1}=_0x397177;this['_titleView']=new Wt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x3ed9a6=this['_createCheckView'](),_0x19f9ed=this['_createPinButtonView'](_0x41ab77),_0x58af02=this['_createMenuDropdownView'](),_0x328ff1=this['_createEditInputView'](_0x41ab77),_0x447a24=this['_createAcceptEditButtonView'](_0x41ab77,_0x328ff1),_0x5de7cb=this['_createCancelEditButtonView'](_0x41ab77);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x19f9ed),this['actions']['add'](_0x58af02),this['on']('change:isEdit',(_0x1882da,_0x354395,_0xce95cd)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0xce95cd?(this['actions']['add'](_0x447a24),this['actions']['add'](_0x5de7cb),this['mainContent']['add'](_0x328ff1),_0x328ff1['element']['value']=this['title']||'',_0x328ff1['element']['focus']()):(this['actions']['add'](_0x19f9ed),this['actions']['add'](_0x58af02),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x592ff0?'ck-ai-chat-history__item--active':'',_0x23afdd['if']('isVisible','ck-hidden',_0x3f4775=>!_0x3f4775),_0x23afdd['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',_0x23afdd['if']('loadingState','ck-hidden',_0x79471=>!!_0x79471)]},'children':_0x592ff0?[_0x3ed9a6]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x23afdd['if']('loadingState','ck-hidden',_0x5f5403=>!_0x5f5403)]},'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',_0x23afdd['if']('loadingState','ck-hidden',_0x59df34=>!!_0x59df34)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x23afdd['if']('loadingState','ck-hidden',_0x1bb238=>!_0x1bb238)]},'children':[{'text':_0x23afdd['to']('loadingState',_0x1cf4a6=>_0x1cf4a6?us(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x1cf4a6]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x1caa96]}]},{'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'](_0x218ab6){this['set']('title',_0x218ab6);}['updateLoadingState'](_0x21df63,_0x4a6980){this['set']('loadingState',_0x4a6980?_0x21df63:null);}['_createCheckView'](){const _0x2ddf77=new Yt();return _0x2ddf77['set']({'content':_0x3047d4}),_0x2ddf77;}['_createPinButtonView'](_0xf72f41){const _0x112517=new Ht(_0xf72f41);return _0x112517['set']({'label':us(_0xf72f41,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x56c9b3,'withText':!0x1,'tooltip':!0x0}),_0x112517['bind']('isOn')['to'](this,'pinned'),_0x112517['on']('execute',()=>{const _0x46c157=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x46c157});}),_0x112517;}['_createMenuDropdownView'](){const _0x58028a=_0x1e2a6d(this['locale']),_0x17ff7c=_0x58028a['panelView']['children'];_0x58028a['buttonView']['set']({'label':us(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':nt}),_0x58028a['panelPosition']='sw';const _0x5208ad=new Ht(this['locale']);_0x5208ad['label']=us(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x5208ad['withText']=!0x0,_0x5208ad['on']('execute',()=>{this['isEdit']=!0x0;});const _0x44cbc9=new Ht(this['locale']);_0x44cbc9['label']=us(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x44cbc9['withText']=!0x0,_0x44cbc9['on']('execute',()=>{this['showConfirm'](us(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x523d27=new jt(this['locale']),_0x198af6=new zt(this['locale']);_0x198af6['children']['add'](_0x5208ad);const _0xc152bf=new zt(this['locale']);return _0xc152bf['children']['add'](_0x44cbc9),_0x523d27['items']['addMany']([_0x198af6,_0xc152bf]),_0x17ff7c['add'](_0x523d27),_0x58028a;}['_createEditInputView'](_0x481b2a){const _0x54ade9=new $t(_0x481b2a),_0x265056=_0x54ade9['bindTemplate'];return _0x54ade9['extendTemplate']({'on':{'keydown':_0x265056['to'](_0x5dbdea=>{'Enter'==_0x5dbdea['key']&&this['_commitEditInputValue'](_0x54ade9);})}}),_0x54ade9;}['_createAcceptEditButtonView'](_0x2bf7a5,_0x228df6){const _0x495188=new Ht(_0x2bf7a5);return _0x495188['set']({'icon':_0x3047d4,'withText':!0x1,'tooltip':us(_0x2bf7a5,'AI_CHAT_HISTORY_ACCEPT')}),_0x495188['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x495188['on']('execute',()=>{this['_commitEditInputValue'](_0x228df6);}),_0x495188;}['_commitEditInputValue'](_0x3008a2){const _0x3ca8fc=_0x3008a2['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x3ca8fc});}['_createCancelEditButtonView'](_0x544875){const _0x4b1f14=new Ht(_0x544875);return _0x4b1f14['set']({'icon':_0x22db67,'withText':!0x1,'tooltip':us(_0x544875,'AI_CHAT_HISTORY_CANCEL')}),_0x4b1f14['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x4b1f14['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x4b1f14;}['_createSpinnerView'](){const _0x53d7e8=new cr('tiny');return _0x53d7e8['isVisible']=!0x0,_0x53d7e8;}['isMatching'](_0x29235c){return'string'==typeof this['title']&&this['title']['match'](_0x29235c)?{'title':!0x0}:null;}['highlightText'](_0x1398ee){this['_titleView']['highlightText'](_0x1398ee);}},Yo=class extends _0x3b0eb8{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x3daa1b,_0x212fba){super(_0x3daa1b),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x1f3ee3=Vo(_0x3daa1b,this);this['headerView']=new Ho(_0x3daa1b,{'label':us(_0x3daa1b,'AI_CHAT_HISTORY_HEADING'),'icon':_0x236854,'class':'ck-ai-header_history','content':_0x1f3ee3,'showResizeButton':_0x212fba}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Go(_0x3daa1b,[]),this['sectionsView']['delegate'](...$o)['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',_0x39648d=>!_0x39648d)]}}),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 _0x5c125f=new _0x6714a0(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':us(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x15ae56=>us(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x15ae56),'secondary':us(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x59d627=this['_createErrorView']();return _0x59d627['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x308852=>!_0x308852)]}}),_0x5c125f['on']('render',()=>{_0x5c125f['children']['add'](_0x59d627,0x1);}),_0x5c125f['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x5f446d=>!_0x5f446d)]}}),_0x5c125f;}['_createSkeletonView'](){const _0x5b356c=new Xn(this['locale'],zn['aiHistory']);return _0x5b356c['bind']('isVisible')['to'](this,'isLoading'),_0x5b356c;}['_createErrorView'](){const _0x34f783=new _0x3b0eb8(this['locale']),_0x3ee148=new Ht(this['locale']);_0x3ee148['set']({'withText':!0x1,'icon':_0x22db67,'class':'ck-ai-notification_error__dismiss-button'}),_0x3ee148['bind']('isVisible')['to'](this,'hasItems',_0x33202b=>!!_0x33202b),_0x3ee148['on']('execute',()=>{this['errorMessage']='';});const _0x4208cf=this['bindTemplate'];return _0x34f783['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x4208cf['to']('errorMessage')}]},_0x3ee148]}),_0x34f783;}['_createEmptyStateView'](){const _0x3f2a0f=new _0x3b0eb8(this['locale']);return _0x3f2a0f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x4b5b6c=>!_0x4b5b6c)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[us(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x3f2a0f;}['_createListItemViews'](_0x31e6d8,_0x9056cd){const _0x47e33e=[];for(const _0x5b56bc of _0x31e6d8){const _0x19e8b3=new Wo(_0x9056cd,_0x5b56bc);_0x19e8b3['delegate'](...$o)['to'](this),_0x47e33e['push'](_0x19e8b3);}return _0x47e33e;}['updateHistoryItemsWithCategories'](_0x4f0a73){const _0x20ad12=this['locale']||'en',_0x1ebab5=[];for(const _0x4cf30c of _0x4f0a73){const _0x398214=this['_createListItemViews'](_0x4cf30c['items'],_0x20ad12);_0x1ebab5['push'](new Fo(_0x20ad12,{'title':_0x4cf30c['title'],'items':_0x398214}));}this['sectionsView']['sections']=_0x1ebab5,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x1ebab5),this['hasItems']=_0x4f0a73['some'](_0x9e79de=>_0x9e79de['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x42de9b){for(const _0x42ab62 of this['sectionsView']['sections']){const _0x3dc122=_0x42ab62['getItem'](_0x42de9b);if(_0x3dc122){if(_0x42ab62['removeItem'](_0x3dc122),0x0===_0x42ab62['itemsViews']['length']){const _0x4fa4b0=this['sectionsView']['sections']['indexOf'](_0x42ab62);-0x1!==_0x4fa4b0&&(this['sectionsView']['sections']['splice'](_0x4fa4b0,0x1),this['sectionsView']['items']['remove'](_0x42ab62));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x3248ff,_0x495958){for(const _0x1d1862 of this['sectionsView']['sections']){const _0x42ee69=_0x1d1862['getItem'](_0x3248ff);if(_0x42ee69){_0x42ee69['updateTitle'](_0x495958);break;}}}['updateItemLoadingState'](_0x59d229,_0xea09e7,_0x18d6b2){for(const _0x54d4d2 of this['sectionsView']['sections']){const _0x33b703=_0x54d4d2['getItem'](_0x59d229);if(_0x33b703){_0x33b703['updateLoadingState'](_0xea09e7,_0x18d6b2);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x4c4012=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x4c4012);}}};const $o=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var qo=class extends _0xe5ed07{static get['requires'](){return[cs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x565e20){super(_0x565e20);const _0x4c9a5c=this['context']['plugins']['get']('AITabs');this['_historyView']=new Yo(this['context']['locale'],_0x4c9a5c['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x4c9a5c),this['_historyView']['delegate'](...$o)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x4c9a5c['view'],'isMaximized',_0x140987=>_0x140987),_0x4c9a5c['view']['addTab']({'id':'history','buttonLabel':us(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x236854,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x2addc8){this['_historyView']['removeHistoryItem'](_0x2addc8);}['updateItems'](_0x984c0b){this['_historyView']['updateHistoryItemsWithCategories'](_0x984c0b);}['updateItemTitle'](_0x4608aa,_0x4da56c){this['_historyView']['updateItemTitle'](_0x4608aa,_0x4da56c);}['updateItemLoadingState'](_0x23e63e,_0x35d31b,_0x1af68e){this['_historyView']['updateItemLoadingState'](_0x23e63e,_0x35d31b,_0x1af68e);}['setLoadingSkeleton'](_0x382331){this['_historyView']['isLoading']=_0x382331;}['showError'](_0x1fe951){this['_historyView']['errorMessage']=_0x1fe951;}['hideError'](){this['_historyView']['errorMessage']='';}};const Qo=/* #__PURE__ -- @preserve */
35
- gt();var Xo=class extends Qo{['id'];['createdAt'];constructor({id:_0x5ef8ce,title:_0x433b82,createdAt:_0x342cb1,updatedAt:_0x4fb69b,pinned:_0x37628c}){super(),this['id']=_0x5ef8ce,this['createdAt']=new Date(_0x342cb1),this['set']('title',_0x433b82),this['set']('updatedAt',_0x4fb69b?new Date(_0x4fb69b):null),this['set']('pinned',_0x37628c||!0x1);}['updateTitle'](_0x19d0b2){this['set']('title',_0x19d0b2),this['updatedAt']=new Date();}['updatePinned'](_0x4fc793){this['set']('pinned',_0x4fc793),this['updatedAt']=new Date();}};const zo=/* #__PURE__ -- @preserve */
36
- ut();var jo=class extends zo{['items']=[];['connector'];['group'];constructor({connector:_0x45fd61,group:_0x45cafe}){super(),this['connector']=_0x45fd61,this['group']=_0x45cafe;}async['init'](){try{const _0x17fdc0=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x17fdc0);}catch(_0x41d6b2){this['fire']('error',{'error':_0x41d6b2,'operation':'init'});}}['addItem'](_0x462db3){this['items']['push'](_0x462db3);}async['removeItem'](_0x13555){const _0x930aa=this['items']['findIndex'](_0x220f85=>_0x220f85['id']===_0x13555);if(-0x1===_0x930aa)return!0x1;try{return await this['connector']['deleteConversation'](_0x13555)['execute'](),this['items']['splice'](_0x930aa,0x1),this['fire']('itemRemoved',{'itemId':_0x13555}),!0x0;}catch(_0x1faafd){return this['fire']('error',{'error':_0x1faafd,'operation':'removeItem','itemId':_0x13555}),!0x1;}}['getItem'](_0x45a180){return this['items']['find'](_0x30d8f6=>_0x30d8f6['id']===_0x45a180);}async['updateItemTitle'](_0x4bff4b,_0x4e91e0){const _0x26269c=this['getItem'](_0x4bff4b);if(!_0x26269c)return!0x1;try{return await this['connector']['updateConversation'](_0x4bff4b,{'title':_0x4e91e0})['getResult'](),_0x26269c['updateTitle'](_0x4e91e0),this['fire']('itemUpdated',{'itemId':_0x4bff4b,'updates':{'title':_0x4e91e0}}),!0x0;}catch(_0x2e1b4d){return this['fire']('error',{'error':_0x2e1b4d,'operation':'updateItemTitle','itemId':_0x4bff4b}),!0x1;}}async['updateItemPinned'](_0xe98246,_0x537400){const _0x5760e7=this['getItem'](_0xe98246);if(!_0x5760e7)return!0x1;try{return await this['connector']['updateConversation'](_0xe98246,{'pinned':_0x537400})['getResult'](),_0x5760e7['updatePinned'](_0x537400),this['fire']('itemUpdated',{'itemId':_0xe98246,'updates':{'pinned':_0x537400}}),!0x0;}catch(_0xa739b5){return this['fire']('error',{'error':_0xa739b5,'operation':'updateItemPinned','itemId':_0xe98246}),!0x1;}}['loadItems'](_0x167f2e){try{this['items']=[],_0x167f2e['map'](_0x3f0791=>{this['addItem'](new Xo(_0x3f0791));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x163543){this['fire']('error',{'error':_0x163543,'operation':'loadItems'});}}['getItems'](_0xdb8f27={}){const _0x5b6ca3=void 0x0!==_0xdb8f27['pinned']&&_0xdb8f27['pinned'],_0x452f48=_0xdb8f27['from']?new Date(_0xdb8f27['from']['getFullYear'](),_0xdb8f27['from']['getMonth'](),_0xdb8f27['from']['getDate']()):null,_0x533fd9=_0xdb8f27['to']?new Date(_0xdb8f27['to']['getFullYear'](),_0xdb8f27['to']['getMonth'](),_0xdb8f27['to']['getDate']()):null;return this['items']['filter'](_0x54f5f3=>{if(_0x54f5f3['pinned']!==_0x5b6ca3)return!0x1;if(_0x533fd9){const _0x22b6c5=new Date(_0x54f5f3['createdAt']['getFullYear'](),_0x54f5f3['createdAt']['getMonth'](),_0x54f5f3['createdAt']['getDate']());return _0x452f48?_0x452f48['getTime']()===_0x533fd9['getTime']()?_0x22b6c5['getTime']()===_0x452f48['getTime']():_0x22b6c5<_0x533fd9&&_0x22b6c5>=_0x452f48:_0x22b6c5<_0x533fd9;}return!0x0;});}},Jo=class extends _0xe5ed07{['_aiConnector'];['_reporter'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[ls,nn,kn,qo,cs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiConnector']=this['context']['plugins']['get'](ls),this['_aiChatHistoryUi']=this['context']['plugins']['get'](qo),this['_aiChatController']=this['context']['plugins']['get'](kn),this['_reporter']=this['context']['plugins']['get'](nn)['createReporter']('aichathistory');const _0x5c3cfe=this['context']['plugins']['get'](cs);try{const _0x4b9210=this['_aiChatController']['getGroupId']();this['history']=new jo({'connector':this['_aiConnector'],'group':_0x4b9210}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x21af88,_0xcdb84a)=>{this['_setItemLoading'](_0xcdb84a['id'],'remove'),this['_handleRemove'](_0xcdb84a['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x225ffc,_0x312a9d)=>{this['_setItemLoading'](_0x312a9d['id'],'rename'),this['_handleEditTitle'](_0x312a9d['id'],_0x312a9d['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x3ad2e8,_0x39fa2a)=>{void 0x0!==_0x39fa2a['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x39fa2a['itemId'],_0x39fa2a['updates']['title']),void 0x0!==_0x39fa2a['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x39fa2a['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x556ab1,_0x55e752)=>{this['_aiChatController']['_handleRemovedConversation'](_0x55e752['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x55e752['itemId']),this['_clearItemLoading'](_0x55e752['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x57e918,_0xdfc48a)=>{this['_handleHistoryErrorUI'](_0xdfc48a['error'],_0xdfc48a['operation'],_0xdfc48a['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x5f3fab,_0x3cbff6)=>{this['_handleSelectConversation'](_0x3cbff6['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x5436ed,_0x5d502a)=>{const _0x1b3342=_0x5d502a['pinned']?'pin':'unpin';this['_setItemLoading'](_0x5d502a['id'],_0x1b3342),this['_handleTogglePin'](_0x5d502a['id'],_0x5d502a['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x5c3cfe['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x5c3cfe['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x305586){this['_handleHistoryErrorUI'](_0x305586,'init');}}async['_handleEditTitle'](_0x5c0fa0,_0x48a7b4){await this['history']['updateItemTitle'](_0x5c0fa0,_0x48a7b4);}async['_handleTogglePin'](_0x384d3d,_0x1642ed){await this['history']['updateItemPinned'](_0x384d3d,_0x1642ed);}async['_handleRemove'](_0x4161d3){await this['history']['removeItem'](_0x4161d3);}async['_handleSelectConversation'](_0x3b64f0){await this['_aiChatController']['loadConversation'](_0x3b64f0);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x487f27=this['_aiChatController']['activeConversation']?.['id'],_0x22ea9e=this['_getCategorizedItems']()['map'](_0x3a2344=>({'title':_0x3a2344['title'],'items':_0x3a2344['items']['map'](_0x42c0d7=>({'id':_0x42c0d7['id'],'title':_0x42c0d7['title']||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x42c0d7['createdAt'])['toLocaleDateString'](),'active':_0x42c0d7['id']===_0x487f27,'pinned':_0x42c0d7['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x22ea9e);}['_setItemLoading'](_0x1fc25f,_0x3cf4ba){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x1fc25f,_0x3cf4ba,!0x0);}['_clearItemLoading'](_0x282dea){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x282dea,null,!0x1);}['_handleHistoryErrorUI'](_0x3d3f36,_0x4e01da,_0x27e67b){const _0x434049=this['_generateErrorMessage'](_0x4e01da,_0x27e67b);this['_aiChatHistoryUi']['showError'](_0x434049),this['_reporter']['reportError'](_0x3d3f36,{'context':{'operation':_0x4e01da}}),_0x27e67b&&this['_clearItemLoading'](_0x27e67b),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x558800,_0x5848e6){const _0x1c10b5=_0x5848e6?this['history']['getItem'](_0x5848e6):null,_0x2a6e49=_0x1c10b5?.['title']||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x558800){case'updateItemTitle':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x2a6e49);case'updateItemPinned':{const _0x5cec17=us(this['context']['locale'],_0x1c10b5?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x5cec17,_0x2a6e49]);}case'removeItem':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x2a6e49);case'init':case'loadItems':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0x33d1f0=new Date(),_0x413200=new Date(_0x33d1f0['getFullYear'](),_0x33d1f0['getMonth'](),_0x33d1f0['getDate']()),_0x274aa7=new Date(_0x413200);_0x274aa7['setDate'](_0x274aa7['getDate']()-0x1);const _0x585235=new Date(_0x413200);_0x585235['setDate'](_0x585235['getDate']()-0xe);const _0x8b0d12=this['history']['getItems']({'pinned':!0x0}),_0x513b88=this['history']['getItems']({'from':_0x413200,'to':_0x413200}),_0x166784=this['history']['getItems']({'from':_0x274aa7,'to':_0x274aa7}),_0x496ea9=this['history']['getItems']({'from':_0x585235,'to':_0x274aa7}),_0x2fc34f=this['history']['getItems']({'to':_0x585235}),_0x1cc8d4=[];return _0x8b0d12['length']>0x0&&_0x1cc8d4['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x8b0d12}),_0x513b88['length']>0x0&&_0x1cc8d4['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x513b88}),_0x166784['length']>0x0&&_0x1cc8d4['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x166784}),_0x496ea9['length']>0x0&&_0x1cc8d4['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x496ea9}),_0x2fc34f['length']>0x0&&_0x1cc8d4['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x2fc34f}),_0x1cc8d4;}},Zo=class extends _0xe5ed07{static get['requires'](){return[Jo,qo];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ta=class extends _0xe5ed07{static get['requires'](){return[kn,Is,Bo,Zo,tn];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1fc2fa){super(_0x1fc2fa),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'sources':[],'alwaysAddSelection':!0x1,'paste':{'textThreshold':0x5dc}}),this['context']['config']['define']('ai.chat.initialConversation','new');}},ea=class extends Ht{['id'];constructor(_0x324daf,_0x432b23){super(_0x324daf);const {id:_0x448044,type:_0x1d99d7,icon:_0xf86769}=_0x432b23;this['id']=_0x448044,this['set']({'label':_0x432b23['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x432b23['id']}}),_0xf86769?this['icon']=_0xf86769:'chat'===_0x1d99d7?this['icon']=_0x532e15:'review'===_0x1d99d7?this['icon']=_0x4ddb4d:'translate'===_0x1d99d7&&(this['icon']=_0x9c35d8);}},ia=class extends _0x3b0eb8{['listView'];constructor(_0x43d1dd,_0x3e113f){super(_0x43d1dd),this['set']('isEnabled',!0x0);const _0x149b1c=_0x3e113f['map'](_0x4e5515=>{const _0x150cf6=new zt(this['locale']),_0x344f5b=new ea(this['locale'],_0x4e5515);return _0x344f5b['bind']('isEnabled')['to'](this),_0x150cf6['children']['add'](_0x344f5b),_0x344f5b['delegate']('execute')['to'](this),_0x150cf6;});this['listView']=new jt(this['locale']),this['listView']['items']['addMany'](_0x149b1c),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const sa='chat-shortcuts';var na=class extends _0xe5ed07{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];['_listenedConversation'];static get['requires'](){return[Bo];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiChatUI']=this['context']['plugins']['get'](Bo),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x3237f1=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x12ad98=_0x3237f1['activeConversation'];_0x12ad98['isFromHistory']||this['_injectShortcuts'](_0x12ad98);}),this['listenTo'](_0x3237f1,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x47c374=['chat','review','translate'];this['_shortcuts']['forEach'](_0x41c437=>{let _0x449fcb=!0x0;if(_0x41c437['id']&&_0x41c437['label']&&_0x47c374['includes'](_0x41c437['type'])?'chat'===_0x41c437['type']&&(_0x449fcb='string'==typeof _0x41c437['prompt']):_0x449fcb=!0x1,!_0x449fcb)throw new ht('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x41c437});});}['_injectShortcuts'](_0x31e523){this['_removeShortcuts'](),this['_shortcutsView']=new ia(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],sa),this['_shortcutsView']['on']('execute',_0x13296d=>{const _0x1ffad5=_0x13296d['source']['id'];this['_executeShortcut'](_0x1ffad5);}),this['_listenedConversation']=_0x31e523,this['listenTo'](_0x31e523,'uploadProgressChanged',(_0x105bdb,_0x310769)=>{this['_shortcutsView']['isEnabled']=!_0x310769['isUploadInProgress'];});}['_removeShortcuts'](){const _0x55248e=this['context']['plugins']['get'](Bo);_0x55248e['hasFeedItem'](sa)&&_0x55248e['removeFeedItem'](sa),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x38f641){const _0x34703d=this['_shortcuts']['find'](_0x173e5e=>_0x173e5e['id']===_0x38f641),_0x5a649f=_0x34703d['type'];'chat'===_0x5a649f?this['_runChatShortcut'](_0x34703d):'review'===_0x5a649f?_0x34703d['commandId']?this['_runReviewShortcut'](_0x34703d):this['_switchTab']('reviewMode'):'translate'===_0x5a649f&&(_0x34703d['language']?this['_runTranslateShortcut'](_0x34703d):this['_switchTab']('translate'));}['_switchTab'](_0x4a62a0){if(!this['context']['plugins']['has']('AITabs'))throw new ht('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x4a62a0});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x4a62a0);}async['_runChatShortcut']({prompt:_0x33b656,draftMode:_0x527a52,useWebSearch:_0x2376d2=!0x1,useReasoning:_0x1c7111=!0x1,model:_0x378b4c}){const _0x1dd3ce=this['context']['plugins']['get']('AIChatController'),_0x46dd7c=_0x1dd3ce['activeConversation'];let _0x29e007;_0x29e007=_0x378b4c?await _0x46dd7c['chatModels']['getModel'](_0x378b4c):await _0x46dd7c['chatModels']['getDefault'](),_0x29e007&&await _0x46dd7c['setModel'](_0x29e007),_0x46dd7c['setWebSearch'](_0x2376d2),_0x46dd7c['setReasoning'](_0x1c7111),_0x1dd3ce['addCurrentDocumentToChatContext'](),_0x527a52?(this['_aiChatUI']['setPromptInputValue'](_0x33b656),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x1dd3ce['sendMessage']({'message':_0x33b656});}['_runReviewShortcut']({commandId:_0x178f92,model:_0x424591,prompt:_0x56106f,params:_0x13b227}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ht('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x35628f={'id':_0x178f92,'isCustom':'custom'===_0x178f92};_0x424591&&_0x56106f&&(_0x35628f['args']={'model':_0x424591,'prompt':_0x56106f}),_0x13b227&&(_0x35628f['params']=_0x13b227),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x35628f);}['_runTranslateShortcut']({language:_0x288568}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new ht('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x288568,'args':{'language':_0x288568}});}},ra=class extends _0x1dbdcb{constructor(_0x2c87bf){super(_0x2c87bf);const _0x2d11c2=_0x2c87bf['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x2d11c2,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0x9804e6=this['editor']['plugins']['get']('AITabs')['view'];_0x9804e6['isVisible']=!_0x9804e6['isVisible'];}},oa=class extends _0x2e97a8{static get['requires'](){return[cs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x44f9f7=this['editor'];_0x44f9f7['commands']['add']('toggleAi',new ra(_0x44f9f7)),_0x44f9f7['ui']['componentFactory']['add']('toggleAi',()=>{const _0x477c62=this['_createAIUIButton'](Ht);return _0x477c62['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x477c62;}),_0x44f9f7['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x1795d8=this['_createAIUIButton'](Jt);return _0x1795d8['set']({'role':'menuitemcheckbox'}),_0x1795d8;});}['_createAIUIButton'](_0x4b896e){const _0x59d445=this['editor'],_0x1c76ac=_0x59d445['commands']['get']('toggleAi'),_0x5cf01e=new _0x4b896e(_0x59d445['locale']);return _0x5cf01e['set']({'label':us(_0x59d445['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x1b1301,'isToggleable':!0x0}),_0x5cf01e['bind']('isEnabled')['to'](_0x1c76ac),_0x5cf01e['bind']('isOn')['to'](_0x1c76ac,'value',_0x250e24=>!!_0x250e24),this['listenTo'](_0x5cf01e,'execute',()=>{_0x1c76ac['execute']();}),_0x5cf01e;}};const aa=['applySuggestion','insertSuggestion','showNext','showPrevious'];var ha=class extends _0x3b0eb8{['_errorView'];constructor(_0x3bb3c5){super(_0x3bb3c5),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x48272c){this['showError'](_0x48272c);}['showError'](_0x47b9d6){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x47b9d6,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x117aed=new _0x3b0eb8(this['locale']),_0x21f8e8=new _0x3b0eb8(this['locale']);return _0x21f8e8['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x117aed['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x292f40=>!_0x292f40)]},'children':[_0x21f8e8]}),_0x117aed;}};const ca=0xa;var la=class extends _0xe5ed07{static get['requires'](){return[Is];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_editor'];['_isUpdatingMarkers']=!0x1;['open'](_0x4e36b4){const {id:_0x22bdcf}=this['_currentConfig']??{};this['_currentConfig']=_0x4e36b4,this['_editor']=_0x4e36b4['targetEditor'];const {id:_0x5e2e89}=this['_currentConfig'];this['isOpen']&&_0x22bdcf===_0x5e2e89?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x33fc6a=this['_editor'];if(!_0x33fc6a)return;const _0x52457f=_0x33fc6a['plugins']['get']('Dialog');_0x52457f['isOpen']&&this['_currentConfig']&&_0x52457f['id']===this['_currentConfig']['id']&&_0x52457f['hide']();}['_updateDialog'](){const _0x5a79cb=this['_editor']['plugins']['get']('Dialog'),{icon:_0x29b939,title:_0x31e352}=this['_currentConfig'];_0x5a79cb['view']?.['headerView']&&(_0x5a79cb['view']['headerView']['label']=_0x31e352,_0x5a79cb['view']['headerView']['iconView']&&_0x29b939&&(_0x5a79cb['view']['headerView']['iconView']['content']=_0x29b939)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x5a79cb['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](Is)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](Is)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x5da948=this['_editor']['plugins']['get']('Dialog'),{id:_0x25f884,title:_0x1ad6ed,icon:_0x54e416,class:_0x5eef47,mainView:_0x5c500a}=this['_currentConfig'];_0x5c500a['delegate'](...aa)['to'](this),_0x5da948['show']({'title':_0x1ad6ed,'icon':_0x54e416,'hasCloseButton':!0x0,'id':_0x25f884,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x5eef47||''),'content':_0x5c500a,'onShow':_0x4c8ec7=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x4c8ec7['view']?.['updatePosition']();const _0x59573d=this['_getSelectionElements']();_0x59573d&&_0x59573d[0x0]&&Rt({'target':_0x59573d[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x4c8ec7['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x25f884});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x25f884}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x7e83c9,_0x55b6b0,_0x2319cd){const _0x5c7eb8=_0x55b6b0||_0x2319cd;if(!_0x5c7eb8)return null;const _0x1d50c2=this['_getSelectionElements']();if(!_0x1d50c2||0x0===_0x1d50c2['length'])return{'left':Math['round'](_0x5c7eb8['left']+_0x5c7eb8['width']/0x2-_0x7e83c9['width']/0x2),'top':Math['round'](_0x5c7eb8['top']+_0x5c7eb8['height']/0x2-_0x7e83c9['height']/0x2)};const _0x1289b2=Math['round'](_0x5c7eb8['left']+_0x5c7eb8['width']/0x2-_0x7e83c9['width']/0x2),_0x549663=_0x1d50c2['map'](_0x51ac4d=>new At(_0x51ac4d)),_0x597af5=_0x7e83c9['height'];return{'left':_0x1289b2,'top':this['_calculateOptimalTopPosition'](_0x549663,_0x597af5,_0x5c7eb8)};}['_calculateOptimalTopPosition'](_0x2034d4,_0x23ea8d,_0x320fff){const _0x5ea560=new At(Tt['window']),_0x458434=_0x2034d4['map'](_0x225cfb=>_0x225cfb['getVisible']())['filter'](_0x3e77ce=>_0x3e77ce),_0x336a34=At['getBoundingRect'](_0x458434);if(!_0x336a34)return Math['round'](_0x320fff['top']+_0x320fff['height']/0x2);const _0x5e0346=_0x5ea560['getIntersection'](_0x336a34);if(!_0x5e0346)return Math['round'](_0x320fff['top']+_0x320fff['height']/0x2);const _0x1106e3=_0x320fff['getVisible'](),_0x311679=_0x1106e3&&_0x336a34['height']>_0x1106e3['height'],_0x585b4e=_0x5e0346['top'],_0xa9f1e5=_0x5e0346['bottom'];if(_0x311679){const _0x477a7b=_0x5ea560['top']+_0x5ea560['height']/0x2-_0x23ea8d/0x2,_0x285380=_0x585b4e-ca-_0x5ea560['top'],_0x584579=_0x5ea560['bottom']-_0xa9f1e5-ca;return _0x285380>=_0x23ea8d?Math['max'](ca,_0x585b4e-_0x23ea8d-ca):_0x584579>=_0x23ea8d?_0xa9f1e5+ca:Math['max'](ca,_0x477a7b);}const _0x29e4f2=_0x585b4e-_0x23ea8d,_0xee10e4=_0x5ea560['bottom']-_0xa9f1e5-ca,_0x50a005=_0x585b4e-ca-_0x5ea560['top'];let _0x2e3cba;return _0x2e3cba=_0xee10e4>=_0x23ea8d?_0xa9f1e5+ca:_0x50a005>=_0x23ea8d?_0x29e4f2-ca:_0x585b4e+_0x336a34['height']/0x2-_0x23ea8d/0x2,_0x2e3cba;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x20c2d0=this['_editor'];this['listenTo'](_0x20c2d0['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x196d13,data:{newRange:_0x142882}}of _0x20c2d0['model']['document']['differ']['getChangedMarkers']())if(_0x196d13['startsWith']('ai-selection:')&&(_0x142882&&(_0x142882['start']['isEqual'](_0x142882['end'])||'$graveyard'==_0x142882['root']['rootName'])||null==_0x142882)){const _0x577c04=us(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x577c04),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x4e50fa=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x4e50fa['model']['document']);}['_getSelectionElements'](){const _0x2132a6=this['_editor'];return _0x1d0b44(_0x2132a6['editing'],[..._0x2132a6['model']['markers']['getMarkersGroup']('ai-selection'),..._0x2132a6['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getCurrentDomRootName'](){const _0x40618e=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x40618e&&_0x40618e['rootName']?_0x40618e['rootName']:null;}},ua=class extends _0x3931a6{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x1f8d9e,_0x223164={}){super(_0x1f8d9e),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x223164};const _0x33246d=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x33246d?'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'](_0x2ac10c){this['showChangesButton']['isEnabled']=_0x2ac10c;}['_setupRatingButtons'](){this['likeButton']=new Ht(this['locale']),this['likeButton']['set']({'icon':ot,'label':us(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':hn,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new Ht(this['locale']),this['dislikeButton']['set']({'icon':rt,'label':us(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':hn,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new Ht(this['locale']),this['copyButton']['set']({'icon':_0x51dfb6,'label':us(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+hn,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x5a33c3=new Yt();_0x5a33c3['set']({'content':_0x3047d4}),_0x5a33c3['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'+hn,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+hn;},0x7d0);}),this['copyButton']['children']['add'](_0x5a33c3);}['_setupShowChangesButton'](){this['showChangesButton']=new Ht(this['locale']),this['showChangesButton']['set']({'icon':tt,'label':us(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':hn}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0xa076da=>_0xa076da?et:tt),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}},da=class extends ha{['children'];['nextButtonView'];['previousButtonView'];['focusCycler'];['_focusables'];['_focusTracker'];['_keystrokes'];['_config'];['_streamableContentView'];['_toolbarContainerView'];['_partToolbarView'];['_stateView'];['_miniToolbarView'];constructor(_0xd8a26d,_0x2a093a){super(_0xd8a26d);const _0x4b8f2f=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new dt(),this['_keystrokes']=new _t(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x2a093a,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new qn(_0xd8a26d),this['_partToolbarView']=new Wn(_0xd8a26d,_0x2a093a['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x2a093a),this['_stateView']=new Fn(_0xd8a26d),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new ua(_0xd8a26d,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new _a(_0xd8a26d,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x591bef,_0x17a79d,_0x2fa3d2,_0x37cec4)=>{let _0x580326,_0x510299;'pending'===_0x37cec4?(_0x580326=this['_partToolbarView'],_0x510299=this['_stateView']):(_0x580326=this['_stateView'],_0x510299=this['_partToolbarView']),this['_stateView']['setState'](_0x2fa3d2),_0x580326['isVisible']=!0x1,_0x510299['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x4b8f2f['to']('_state',_0x24bb25=>'ck-ai-chat-balloon-main_state_'+_0x24bb25)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x2a093a);});}['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'](_0x1f4e6d){_0x1f4e6d?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x1f4e6d);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0x3e64ed){this['_state']=_0x3e64ed;}['showError'](_0x21b7a5){super['showError'](_0x21b7a5),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x2afbbe){super['showBlockingError'](_0x2afbbe),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x19ebc8){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x19ebc8;}['togglePartToolbarEnabled'](_0x3356b0){this['_partToolbarView']['isEnabled']=_0x3356b0;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x1bbb77,showSuggestButton:_0x5df418}){_0x1bbb77=_0x1bbb77&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x5df418=_0x5df418&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x1bbb77,'showSuggestButton':_0x5df418});}['_createNextButtonView'](){const _0x46ee07=new Ht(this['locale']);return _0x46ee07['set']({'icon':_0x2c1f34,'label':us(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x46ee07['on']('execute',()=>{this['fire']('showNext');}),_0x46ee07;}['_createPreviousButtonView'](){const _0x1fa14a=new Ht(this['locale']);return _0x1fa14a['set']({'icon':_0x4a9ca5,'label':us(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x1fa14a['on']('execute',()=>{this['fire']('showPrevious');}),_0x1fa14a;}},_a=class extends _0x3b0eb8{constructor(_0x95ded0,_0x19b5af){super(_0x95ded0),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x19b5af});}},ga=class extends _0x2e97a8{static get['requires'](){return[Mt,la];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x186be5){super(_0x186be5),this['set']('showDiff',!0x1);}['open'](_0x15cd17){const _0x15b2bb=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x15b2bb['plugins']['get']('AIBalloon')['open']({..._0x15cd17,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x15cd17['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x15cd17['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x1eb552){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x1eb552);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x3c39cf){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x3c39cf);}['_createChatBalloonView'](){const _0x363462=this['editor'],_0x491262=_0x363462['plugins']['get']('AIBalloon'),_0x4c128e=_0x363462['commands']['get']('trackChanges');let _0x364c00=_0x363462['config']['get']('ai.availableReplyActions')||[...er];_0x363462['plugins']['has']('TrackChanges')||(_0x364c00=_0x364c00['filter'](_0x212d46=>'insertSuggestion'!=_0x212d46));const _0x1d49db=new da(_0x363462['locale'],{'availableActions':_0x364c00,'showApplyButton':!0x0,'showSuggestButton':!!_0x4c128e});return _0x1d49db['bind']('showDiff')['to'](this),_0x1d49db['delegate'](...Nn)['to'](this),_0x1d49db['delegate']('showPrevious','showNext')['to'](this),_0x491262['delegate']('dialogClosed')['to'](this),_0x1d49db['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x1d49db['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x1d49db['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x4c128e&&_0x1d49db['bind']('isTrackChangesOn')['to'](_0x4c128e,'value'),_0x1d49db['render'](),_0x1d49db;}['_toggleRotatorButtonsInDialogHeader'](_0x512a30){const _0x210418=this['editor'],_0x2f0e2f=_0x210418['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x512a30),_0x2f0e2f['has'](this['_chatBalloonView']['previousButtonView'])||(_0x2f0e2f['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x210418['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x2f0e2f['remove'](this['_chatBalloonView']['previousButtonView']),_0x2f0e2f['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}},Aa=class extends _0x2e97a8{static get['requires'](){return[oa,ga,_0x9631cb];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function Ia(_0x279a5d){const {editor:_0x44971c,action:_0x437810,withText:_0x2247cd=!0x1,withIcon:_0x2b414d=!0x0,isInDropdown:_0x54da9a=!0x0,shouldPreventFocus:_0x31752e=!0x1,actionButtons:_0x44a0ea}=_0x279a5d;return()=>{const _0x58f490=_0x44971c['locale'],_0x2cfe3f=new Ht(_0x58f490),_0x594248=_0x2cfe3f['bindTemplate'];_0x54da9a&&_0x2cfe3f['extendTemplate']({'on':{'mouseenter':_0x594248['to'](()=>{_0x31752e&&_0x31752e()||_0x2cfe3f['focus']();})}}),_0x44a0ea['push']({'buttonView':_0x2cfe3f,'action':_0x437810});const _0x545292=_0x437810['icon']??_0x437810['parent']?.['icon'];return _0x2cfe3f['set']({'label':_0x437810['label'],'withText':_0x2247cd,'role':'menuitem','icon':_0x2b414d?_0x545292??_0x2db5af:void 0x0,'tooltip':!_0x2247cd,'class':'ck-ai-quick-actions-button','isEnabled':_0x437810['isEnabled']}),_0x2cfe3f['on']('execute',()=>{_0x44971c['editing']['view']['focus'](),_0x44971c['commands']['execute']('aiQuickAction',_0x437810);}),_0x2cfe3f;};}var pa=class extends Qt{['arrowView'];constructor(_0x205302,_0x75b583){super(_0x205302,_0x75b583);const _0x21835f=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',_0x3fcc6d=>String(_0x3fcc6d)),'data-cke-tooltip-disabled':_0x21835f['to']('isOn')},'on':{'mouseenter':_0x21835f['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x59af92=new Yt();return _0x59af92['content']=_0xc2680e,_0x59af92['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x59af92;}},ma=class extends jt{['_allListItems'];['_allSearchableItems'];constructor(_0xe9ba34,_0x35cd8c,_0x4f5451){super(_0xe9ba34),this['_allListItems']=_0x35cd8c,this['_allSearchableItems']=_0x4f5451;}['filter'](_0x4a8591){if(!_0x4a8591)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x5a1c1a=_0x4a8591['source']['toLowerCase']()['trim'](),_0x9e6740=this['_allSearchableItems']['filter'](_0x4b23ae=>(_0x4b23ae['groupLabel']?_0x4b23ae['label']+'\x20('+_0x4b23ae['groupLabel']+')':_0x4b23ae['label'])['toLowerCase']()['includes'](_0x5a1c1a));return this['items']['clear'](),this['items']['addMany'](_0x9e6740['sort']((_0x24969d,_0x2cc77a)=>{const _0x67d96f=_0x24969d['groupLabel'],_0x2b71dc=_0x2cc77a['groupLabel'];return _0x67d96f||_0x2b71dc?_0x67d96f?0x1:-0x1:0x0;})['map'](_0x269c6a=>_0x269c6a['item'])),this['_highlightQuery'](_0x5a1c1a,_0x9e6740),{'resultsCount':_0x9e6740['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x555425,_0x3e5567){if(!_0x555425)return;const _0x1999bf=new RegExp(_0xd5ed86(_0x555425),'gi');_0x3e5567['forEach'](_0x4892a0=>{_0x4892a0['highlightViews']&&_0x4892a0['highlightViews']['forEach'](_0x1a5891=>{'function'==typeof _0x1a5891['highlightText']&&_0x1a5891['highlightText'](_0x1999bf);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x448976=>{_0x448976['highlightViews']&&_0x448976['highlightViews']['forEach'](_0x3a46d9=>{'function'==typeof _0x3a46d9['highlightText']&&_0x3a46d9['highlightText'](null);});});}};const Ea='menu',Ta='menuitem';var wa=class extends _0x3b0eb8{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x772eb0,_0x18a7a8,_0x249d80,_0x94bd10,_0x34d52a=!0x1,_0x577b72=[]){const _0xac6bda=_0x772eb0['locale'];super(_0xac6bda),this['_bodyCollection']=_0x94bd10,this['_hasSearch']=_0x34d52a,this['_actionButtons']=_0x577b72;const _0x508058=this['_createListItems'](_0x772eb0,_0x18a7a8,_0x249d80);this['optionsListView']=new ma(_0xac6bda,_0x508058,this['_allSearchableItems']),this['optionsListView']['role']=Ea,this['optionsListView']['items']['addMany'](_0x508058),this['focusTracker']=new dt(),this['keystrokes']=new _t(),_0x34d52a&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x508058,this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x34d52a&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x3fd794=_0x34d52a&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x554eb4(_0x3fd794),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0xac6bda['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x6714a0(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':us(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':us(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x5663e2=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x5663e2);}['_createListItems'](_0x2ffab4,_0x212da5,_0x19e5bc){const _0x537d3f=new _0x554eb4();return _0x212da5['forEach'](_0x24d122=>{if('actions'in _0x24d122){const {listItem:_0x1af569}=this['_createActionGroupButton'](_0x2ffab4,_0x24d122,_0x19e5bc);_0x537d3f['add'](_0x1af569),_0x24d122['actions']['forEach'](_0x4514c8=>{const {listItem:_0x4d0703,highlightViews:_0x4107bc}=this['_createSearchResultActionButton'](_0x2ffab4,_0x4514c8,_0x24d122['label'],_0x24d122['icon']);this['_allSearchableItems']['push']({'item':_0x4d0703,'label':_0x4514c8['label'],'groupLabel':_0x24d122['label'],'highlightViews':_0x4107bc});});}else{const {listItem:_0x320b96}=this['_createActionButton'](_0x2ffab4,_0x24d122);_0x537d3f['add'](_0x320b96);const _0x3f9858=_0x320b96['children']['first'];if(_0x3f9858){const {listItem:_0x1efe85,highlightViews:_0x55ceba}=this['_createSearchResultActionButton'](_0x2ffab4,_0x24d122);this['_allSearchableItems']['push']({'item':_0x1efe85,'label':_0x3f9858['label']||'','highlightViews':_0x55ceba});}}}),_0x537d3f;}['_createActionButton'](_0x143f27,_0xf411ac,_0x1565e6,_0x314d5d){const _0xa8a678=new zt(this['locale']);if(_0x1565e6&&_0x314d5d){const _0x40974a=new Ht(this['locale']),_0x24f549=_0x40974a['bindTemplate'],_0x9040a=new Wt();_0x9040a['text']=_0xf411ac['label'];const _0x3b6819=new Wt();_0x3b6819['text']=_0x1565e6;const _0x37681a=new Yt();_0x37681a['content']=_0x314d5d,_0x37681a['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x57b555=new _0x3b0eb8(this['locale']);_0x57b555['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x10d324=new _0x3b0eb8(this['locale']);return _0x10d324['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x40974a['set']({'label':_0xf411ac['label']+'\x20('+_0x1565e6+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0xf411ac['isEnabled']}),_0x40974a['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x24f549['if']('isEnabled','ck-disabled',_0x4eeb4a=>!_0x4eeb4a)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x9040a,_0x57b555,_0x37681a,_0x3b6819,_0x10d324],'on':{'mouseenter':_0x24f549['to'](()=>{this['_isSearchFocused']()||_0x40974a['focus']();}),'click':_0x24f549['to'](()=>{_0x40974a['fire']('execute');})}}),_0x40974a['on']('execute',()=>{_0x40974a['isEnabled']&&(_0x143f27['editing']['view']['focus'](),_0x143f27['commands']['execute']('aiQuickAction',_0xf411ac));}),_0xa8a678['children']['add'](_0x40974a),this['_actionButtons']['push']({'buttonView':_0x40974a,'action':_0xf411ac}),{'listItem':_0xa8a678,'highlightViews':[_0x9040a,_0x3b6819]};}{const _0x443462=new Pt(),_0x58e9fc=new Ht(this['locale'],_0x443462),_0x458f39=_0x58e9fc['bindTemplate'],_0x2286c3=_0xf411ac['icon']??_0xf411ac['parent']?.['icon'],_0x548590=void 0x0!==_0xf411ac['icon'];return _0x58e9fc['set']({'label':_0xf411ac['label'],'withText':!0x0,'role':'menuitem','icon':_0x548590?_0x2286c3??_0x2db5af:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0xf411ac['isEnabled']}),_0x58e9fc['extendTemplate']({'on':{'mouseenter':_0x458f39['to'](()=>{this['_isSearchFocused']()||_0x58e9fc['focus']();})}}),_0x58e9fc['on']('execute',()=>{_0x143f27['editing']['view']['focus'](),_0x143f27['commands']['execute']('aiQuickAction',_0xf411ac);}),_0xa8a678['children']['add'](_0x58e9fc),this['_actionButtons']['push']({'buttonView':_0x58e9fc,'action':_0xf411ac}),{'listItem':_0xa8a678,'highlightViews':[_0x443462]};}}['_createSearchResultActionButton'](_0x349661,_0xa2d45f,_0x5be7c1,_0x4be53a){return _0x5be7c1&&_0x4be53a?this['_createSearchResultGroupedActionButton'](_0x349661,_0xa2d45f,_0x5be7c1,_0x4be53a):this['_createSearchResultIndividualActionButton'](_0x349661,_0xa2d45f);}['_createSearchResultGroupedActionButton'](_0xb87301,_0x187426,_0x5d7633,_0x38d8a8){const _0x25e734=new zt(this['locale']),_0x354b03=new Ht(this['locale']),_0x4d3ae3=_0x354b03['bindTemplate'],{view:_0x1e398b,highlightView:_0x295a92}=this['_createSearchResultGroupRow'](_0x5d7633,_0x38d8a8),{view:_0x2552e1,highlightView:_0x387a23}=this['_createSearchResultActionRow'](_0x187426['label']),_0x2e58ec=this['_createSearchResultContentView'](_0x1e398b,_0x2552e1);return _0x354b03['set']({'label':_0x187426['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,'isEnabled':_0x187426['isEnabled']}),_0x354b03['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',_0x4d3ae3['if']('isEnabled','ck-disabled',_0x13fab0=>!_0x13fab0)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x2e58ec],'on':{'mouseenter':_0x4d3ae3['to'](()=>{this['_isSearchFocused']()||_0x354b03['focus']();}),'click':_0x4d3ae3['to'](()=>{this['_handleSearchResultButtonClick'](_0x354b03);})}}),this['_setupActionButtonExecution'](_0x354b03,_0xb87301,_0x187426),_0x25e734['children']['add'](_0x354b03),this['_actionButtons']['push']({'buttonView':_0x354b03,'action':_0x187426}),{'listItem':_0x25e734,'highlightViews':[_0x295a92,_0x387a23]};}['_createSearchResultIndividualActionButton'](_0xf47b1a,_0x5c5d65){const _0xbcfef8=new zt(this['locale']),_0x17a33f=new Pt(),_0x17c96b=new Ht(this['locale'],_0x17a33f),_0x39ed30=_0x17c96b['bindTemplate'];return _0x17c96b['set']({'label':_0x5c5d65['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x5c5d65['isEnabled']}),_0x17c96b['extendTemplate']({'on':{'mouseenter':_0x39ed30['to'](()=>{this['_isSearchFocused']()||_0x17c96b['focus']();})}}),this['_setupActionButtonExecution'](_0x17c96b,_0xf47b1a,_0x5c5d65),_0xbcfef8['children']['add'](_0x17c96b),this['_actionButtons']['push']({'buttonView':_0x17c96b,'action':_0x5c5d65}),{'listItem':_0xbcfef8,'highlightViews':[_0x17a33f]};}['_createSearchResultGroupRow'](_0x5dfcab,_0x1a8b6f){const _0x39ede1=new _0x3b0eb8(this['locale']),_0x392918=new Yt();_0x392918['content']=_0x1a8b6f,_0x392918['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x204fc3=new Wt();return _0x204fc3['text']=_0x5dfcab,_0x39ede1['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x392918,_0x204fc3]}),{'view':_0x39ede1,'highlightView':_0x204fc3};}['_createSearchResultActionRow'](_0x346f15){const _0x2ef2c2=new _0x3b0eb8(this['locale']),_0xaeaad6=new Wt();return _0xaeaad6['text']=_0x346f15,_0x2ef2c2['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0xaeaad6]}),{'view':_0x2ef2c2,'highlightView':_0xaeaad6};}['_createSearchResultContentView'](_0x47153e,_0x4a093c){const _0x1fee14=new _0x3b0eb8(this['locale']);return _0x1fee14['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x47153e,_0x4a093c]}),_0x1fee14;}['_setupActionButtonExecution'](_0x481a38,_0x1b39a6,_0x40248b){_0x481a38['on']('execute',()=>{_0x481a38['isEnabled']&&(_0x1b39a6['editing']['view']['focus'](),_0x1b39a6['commands']['execute']('aiQuickAction',_0x40248b));});}['_createActionGroupButton'](_0x42aa05,_0x58bbae,_0x94602a){const _0x3f2d8f=new zt(this['locale']),_0x2fd70c=new Pt(),_0x163595=new pa(this['locale'],_0x2fd70c),_0x4027df=_0x163595['bindTemplate'],_0x59e463=this['_getPanelKeystroke'](_0x94602a),_0x5ea113=this['_createGroupActionsList'](_0x42aa05,_0x58bbae['actions'],_0x94602a);_0x163595['set']({'label':_0x58bbae['label'],'withText':!0x0,'role':Ta,'icon':_0x58bbae['icon']??_0x2db5af,'isEnabled':_0x58bbae['actions']['some'](_0x575b44=>_0x575b44['isEnabled'])}),_0x163595['extendTemplate']({'on':{'mouseenter':_0x4027df['to'](()=>{this['_isSearchFocused']()||_0x163595['focus']();})}});const _0x231406=new yt(this['locale']);return _0x231406['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x4027df['to'](_0x2f2575=>{this['_handlePanelKeydown'](_0x2f2575,_0x59e463,_0x163595,_0x231406);})}}),_0x163595['bind']('isOn')['to'](_0x231406,'isVisible'),this['_bodyCollection']['add'](_0x231406),_0x231406['content']['add'](_0x5ea113),this['_setupGroupMenuBehavior'](_0x163595,_0x231406),_0x3f2d8f['children']['add'](_0x163595),this['_actionButtons']['push']({'buttonView':_0x163595,'action':_0x58bbae}),{'listItem':_0x3f2d8f,'highlightView':_0x2fd70c};}['_createGroupActionsList'](_0x2ec5bb,_0x38c7e6,_0x41961c){const _0x18be9b=new jt(this['locale']);return _0x18be9b['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x38c7e6['forEach'](_0xc9ac36=>{const _0x33c89b=new zt(this['locale']),_0x15ffb3=Ia({'editor':_0x2ec5bb,'action':_0xc9ac36,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x33c89b['children']['add'](_0x15ffb3),_0x41961c['focusTracker']['add'](_0x15ffb3),_0x18be9b['items']['add'](_0x33c89b);}),_0x18be9b;}['_setupGroupMenuBehavior'](_0x4023f1,_0x3ad7de){const _0x269fe8=_0x4023f1['bindTemplate'],_0x3edcb4=this['_getButtonKeystroke'](_0x4023f1);_0x4023f1['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x269fe8['to'](()=>{this['_showNestedPanel'](_0x3ad7de,_0x4023f1);}),'mouseleave':_0x269fe8['to'](_0x37229e=>{const _0x3b0ab2=_0x37229e['relatedTarget'];this['_isMovingToNestedMenu'](_0x3b0ab2,_0x3ad7de)||this['_hideNestedPanel'](_0x3ad7de);}),'keydown':_0x269fe8['to'](_0x1164e3=>{_0x1164e3['key']==_0x3edcb4&&(this['_showNestedPanel'](_0x3ad7de,_0x4023f1),_0x3ad7de['content']['get'](0x0)['focus']());})}}),_0x3ad7de['on']('render',()=>{_0x3ad7de['element']?.['addEventListener']('mouseleave',_0x4d54f1=>{const _0x2b4298=_0x4d54f1['relatedTarget'];_0x4023f1['element']?.['contains'](_0x2b4298)||this['_isMovingToNestedMenu'](_0x2b4298,_0x3ad7de)||this['_hideNestedPanel'](_0x3ad7de);});});}['_showNestedPanel'](_0x1d8e4b,_0x55445c){this['_openNestedPanels']['forEach'](_0x2a929b=>{_0x2a929b!==_0x1d8e4b&&_0x2a929b['isVisible']&&_0x2a929b['hide']();}),_0x1d8e4b['show'](),_0x1d8e4b['pin']({'positions':[Ut['eastSouth']],'target':_0x55445c['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x1d8e4b);}['_hideNestedPanel'](_0x3e78b2){_0x3e78b2['hide'](),this['_openNestedPanels']['delete'](_0x3e78b2);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x571d1f=>_0x571d1f['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x43bb39,_0x20fe31){if(!_0x43bb39)return!0x1;if(_0x20fe31['element']?.['contains'](_0x43bb39))return!0x0;const _0x453f36=_0x43bb39;return _0x453f36['closest']&&(null!==_0x453f36['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x453f36['closest']('.ck-ai-quick-actions-group-list')||null!==_0x453f36['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'](_0x5b67b7){return'rtl'===_0x5b67b7['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x389158){return'rtl'===_0x389158['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x14dfb9,_0x274372,_0x31fd3e,_0x5b5d2a){_0x14dfb9['key']==_0x274372&&(_0x31fd3e['focus'](),this['_hideNestedPanel'](_0x5b5d2a));}['_handleSearchResultButtonClick'](_0x235181){_0x235181['fire']('execute');}};function Ca(_0x24a842){const {editor:_0x12b251,content:_0x8c0cd1,buttonDefinition:_0x2a22eb,bodyCollection:_0x2c27e2,hasSearch:_0x377341=!0x1,actionButtons:_0x413b0f}=_0x24a842;return()=>{const _0x3cb68d=_0x12b251['locale'],_0x454f1e=_0x12b251['commands']['get']('aiQuickAction'),_0x1b98cb=_0x1e2a6d(_0x3cb68d);_0x1b98cb['bind']('isEnabled')['to'](_0x454f1e),_0x1b98cb['buttonView']['set']({'icon':_0x2a22eb['icon']??_0x2db5af,'label':_0x2a22eb['label'],'tooltip':!0x0}),_0x1b98cb['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x469f17=new wa(_0x12b251,_0x8c0cd1,_0x1b98cb,_0x2c27e2,_0x377341,_0x413b0f);return _0x1b98cb['panelView']['children']['add'](_0x469f17),_0x377341&&_0x1b98cb['on']('change:isOpen',(_0x5ebb81,_0x1c36ec,_0x56299e)=>{if(_0x56299e){if(_0x12b251['plugins']['has']('AIEditing')){const _0x51cef7=_0x12b251['plugins']['get'](Is),_0xfa0f78=_0x12b251['model']['document']['selection'],_0x2ad2a9=Array['from'](_0xfa0f78['getRanges']());_0x2ad2a9['length']>0x0&&_0x51cef7['showFakeVisualSelection']({'editor':_0x12b251,'ranges':_0x2ad2a9,'id':'quick-action','priority':0x14});}}else _0x12b251['plugins']['has']('AIEditing')&&_0x12b251['plugins']['get'](Is)['hideFakeVisualSelection']('quick-action'),_0x469f17['resetSearch']();}),_0x1b98cb;};}const fa='<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>',ba='<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>',Sa='<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>',Ra=/* #__PURE__ -- @preserve */
37
- ((()=>({'chat':'AIChat','action':'AIActions'}))());var Oa=class AIQuickActionsUI extends _0x2e97a8{['_actionButtons']=[];['_menuBarGroupViews']=[];['_reporter'];static get['requires'](){return[xt,ls,nn];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_reporter']=this['editor']['plugins']['get'](nn)['createReporter']('aiquickactions');const _0x5d35dc=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x5d35dc),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0x2ffb2a){return function(_0x56dce6){const _0x104bda=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x56dce6['uiLanguage'])||'English';return[{'id':'ask-ai','label':us(_0x56dce6,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x2e2f03},{'id':'chat-commands','label':us(_0x56dce6,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x2e2f03,'actions':[{'id':'explain','label':us(_0x56dce6,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':us(_0x56dce6,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':fa['replace']('%0',_0x104bda),'type':'chat'},{'id':'summarize','label':us(_0x56dce6,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':us(_0x56dce6,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':ba['replace']('%0',_0x104bda),'type':'chat'},{'id':'highlight-key-points','label':us(_0x56dce6,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':us(_0x56dce6,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Sa['replace']('%0',_0x104bda),'type':'chat'}]},{'id':'improve-writing','label':us(_0x56dce6,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x379ef6},{'id':'continue','label':us(_0x56dce6,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x231a2c},{'id':'fix-grammar','label':us(_0x56dce6,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x4881d4},{'id':'adjust-length','label':us(_0x56dce6,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x3aa049,'actions':[{'id':'make-shorter','label':us(_0x56dce6,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':us(_0x56dce6,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':us(_0x56dce6,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x2e177f,'actions':[{'id':'make-tone-casual','label':us(_0x56dce6,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':us(_0x56dce6,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':us(_0x56dce6,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':us(_0x56dce6,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':us(_0x56dce6,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':us(_0x56dce6,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x9c35d8,'actions':[{'id':'translate-to-english','label':us(_0x56dce6,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':us(_0x56dce6,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':us(_0x56dce6,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':us(_0x56dce6,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':us(_0x56dce6,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':us(_0x56dce6,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':us(_0x56dce6,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':us(_0x56dce6,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':us(_0x56dce6,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':us(_0x56dce6,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':us(_0x56dce6,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x4224a0,'actions':[]}];}(_0x2ffb2a);}['_getDefaultAndCustomActions'](){const _0x50386d=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x4deb87=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x505314=>({..._0x505314,'type':'chat'===_0x505314['type']?'chat':'action','icon':void 0x0}));return _0x50386d['find'](_0x3ecdf5=>'other'===_0x3ecdf5['id'])['actions']['push'](..._0x4deb87),_0x50386d;}async['_initActionTypeQuickActions'](){try{const _0x1fb2a6=new Qs({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0x2a0a87=await _0x1fb2a6['getAll'](),_0x407274=(await _0x1fb2a6['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x407274),this['_enableButtonsByType']('action',_0x200623=>!!_0x2a0a87['find'](_0x47f522=>_0x47f522['id']===_0x200623['model'])||void 0x0===_0x200623['model']);}catch(_0x13cb41){const _0x403cfb=new ht('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x13cb41});this['_reporter']['logError'](_0x403cfb);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x258fa3=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x258fa3,'change:isConversationReady',(_0x15356d,_0x5d0516,_0x2c71b9)=>{_0x2c71b9&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x258fa3['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0x3fbf7a,_0x310235){this['_quickActionsDefinition']['forEach'](_0xab92dd=>{'actions'in _0xab92dd?_0xab92dd['actions']['forEach'](_0x2ad312=>{_0x2ad312['type']===_0x3fbf7a&&(_0x2ad312['isEnabled']=_0x310235(_0x2ad312));}):_0xab92dd['type']===_0x3fbf7a&&(_0xab92dd['isEnabled']=_0x310235(_0xab92dd));}),this['_actionButtons']['forEach'](_0x1f290d=>{if(va(_0x1f290d['action']))return;if(_0x1f290d['action']['type']!==_0x3fbf7a)return;const _0x53f77a=_0x310235(_0x1f290d['action']);if(_0x1f290d['action']['isEnabled']=_0x53f77a,_0x1f290d['buttonView']['isEnabled']=_0x53f77a,!_0x53f77a&&_0x1f290d['action']['model']){const _0x3e3cd2=new ht('ai-quick-actions-unavailable-model',this,{'actionId':_0x1f290d['action']['id'],'modelId':_0x1f290d['action']['model']});this['_reporter']['logError'](_0x3e3cd2);}}),this['_actionButtons']['filter'](_0x47afbc=>va(_0x47afbc['action']))['forEach'](_0xd52a0=>{_0xd52a0['buttonView']['isEnabled']=_0xd52a0['action']['actions']['some'](_0x506099=>_0x506099['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x279599,group:_0x5b7190})=>{_0x279599['isEnabled']=_0x5b7190['actions']['some'](_0xfc56f=>_0xfc56f['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0x24b26f){this['_actionButtons']['forEach'](_0x10968f=>{va(_0x10968f['action'])||'action'===_0x10968f['action']['type']&&(_0x10968f['action']['model']||(_0x10968f['action']['model']=_0x24b26f));});}['_initializeQuickActionsComponentsAndCommands'](){const _0x55d497=new Lt(this['editor']['locale']);_0x55d497['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x55d497),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x55d497);}['_initializeQuickActionsDropdown'](_0x31ff3c){const _0x258e41=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',Ca({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x2db5af,'label':us(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x31ff3c,'hasSearch':_0x258e41,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0x15a520){this['_quickActionsDefinition']=_0x15a520['map'](_0x3dc947=>{if('actions'in _0x3dc947){const _0x52ed55=_0x3dc947;return{..._0x52ed55,'actions':_0x52ed55['actions']['map'](_0x1d99ff=>{const {actions:_0x429db5,..._0x3f0362}=_0x52ed55;return{..._0x1d99ff,'isEnabled':!0x1,'parent':_0x3f0362};})['filter'](_0x4c0fdc=>this['_shouldIncludeAction'](_0x4c0fdc))};}return{..._0x3dc947,'isEnabled':!0x1};})['filter'](_0x39ae57=>'actions'in _0x39ae57?_0x39ae57['actions']['length']>0x0:this['_shouldIncludeAction'](_0x39ae57));}['_shouldIncludeAction'](_0x3aaf95){const _0x2fd550=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](Ra[_0x3aaf95['type']])&&!_0x2fd550['includes'](_0x3aaf95['id'])&&!('chat'===_0x3aaf95['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x1c7afd){this['_quickActionsDefinition']['forEach'](_0x30c22a=>{if('actions'in _0x30c22a){const _0x648d90=Ca({'editor':this['editor'],'content':_0x30c22a['actions'],'buttonDefinition':_0x30c22a,'bodyCollection':_0x1c7afd,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x30c22a['id'],_0x648d90),_0x30c22a['actions']['forEach'](_0x330a81=>{const _0x37ca02=Ia({'editor':this['editor'],'action':_0x330a81,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x330a81['id'],_0x37ca02);});}else{const _0x40d6c6=Ia({'editor':this['editor'],'action':_0x30c22a,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x30c22a['id'],_0x40d6c6);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x2551da=>{const _0x388bfe=this['editor']['commands']['get']('aiQuickAction'),_0x288c20=new _0x46b15a(_0x2551da),_0x44f7d0=us(_0x2551da,'AI_QUICK_ACTIONS_HEADING');_0x288c20['buttonView']['set']({'label':_0x44f7d0,'icon':_0x2db5af});const _0x40e506=new te(_0x2551da);return _0x40e506['set']({'ariaLabel':_0x44f7d0,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x5ab7b6=>{if('actions'in _0x5ab7b6){const _0xe0fb0f=_0x5ab7b6,_0x1f3c34=new Zt(_0x2551da,_0x288c20),_0x343a3b=new _0x46b15a(_0x2551da),_0x1b341b=new te(_0x2551da);_0x343a3b['buttonView']['set']({'label':_0xe0fb0f['label'],'icon':_0xe0fb0f['icon']}),_0xe0fb0f['actions']['forEach'](_0x5943d0=>{const _0x4993be=new Zt(_0x2551da,_0x343a3b),_0x356029=new Jt(_0x2551da);_0x356029['set']({'label':_0x5943d0['label'],'icon':_0x5943d0['icon'],'role':'menuitem','isEnabled':_0x5943d0['isEnabled']}),_0x356029['on']('execute',()=>{this['_executeQuickAction'](_0x5943d0);}),this['_actionButtons']['push']({'buttonView':_0x356029,'action':_0x5943d0}),_0x356029['delegate']('execute')['to'](_0x343a3b),_0x4993be['children']['add'](_0x356029),_0x1b341b['items']['add'](_0x4993be);}),_0x343a3b['isEnabled']=_0xe0fb0f['actions']['some'](_0x41a343=>_0x41a343['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x343a3b,'group':_0xe0fb0f}),_0x343a3b['panelView']['children']['add'](_0x1b341b),_0x1f3c34['children']['add'](_0x343a3b),_0x40e506['items']['add'](_0x1f3c34);}else{const _0x4895cb=_0x5ab7b6,_0x1401f5=new Zt(_0x2551da,_0x288c20),_0x160044=new Jt(_0x2551da);_0x160044['set']({'label':_0x4895cb['label'],'icon':_0x4895cb['icon'],'role':'menuitem','isEnabled':_0x4895cb['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x160044,'action':_0x4895cb}),_0x160044['on']('execute',()=>{this['_executeQuickAction'](_0x4895cb);}),_0x160044['delegate']('execute')['to'](_0x288c20),_0x1401f5['children']['add'](_0x160044),_0x40e506['items']['add'](_0x1401f5);}}),Object['values'](Ra)['some'](_0x42b9ba=>this['editor']['plugins']['has'](_0x42b9ba))?_0x288c20['bind']('isEnabled')['to'](_0x388bfe):_0x288c20['set']({'isEnabled':!0x1}),_0x288c20['panelView']['children']['add'](_0x40e506),_0x288c20;});}['_executeQuickAction'](_0x64d562){const _0x488650=this['editor'];_0x488650['editing']['view']['focus'](),_0x488650['commands']['execute']('aiQuickAction',_0x64d562);const _0x14bfc4=_0x488650['ui']['view']['menuBarView'];_0x14bfc4&&_0x14bfc4['close']&&_0x14bfc4['close']();}};function va(_0x6fbdc6){return'actions'in _0x6fbdc6;}function ka(_0x16d340,_0x1ffcff){const _0x2d21a8=_0x16d340['plugins']['get']('AITabs')['view'];_0x2d21a8['isVisible']=!0x0,_0x2d21a8['activateTab'](_0x1ffcff);}var Na=class extends _0x1dbdcb{['execute'](_0x53a6c0){switch(this['_expandSelectionIfCollapsed'](),_0x53a6c0['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x41e906=us(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x41e906});}this['_handleAIChatAction'](_0x53a6c0);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x551f90=us(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x551f90});}this['_handleAIActionsAction'](_0x53a6c0);}}async['_handleAIChatAction'](_0xbbd654){const _0xe6d344=this['editor']['plugins']['get']('AIChatController');if(ka(this['editor'],'chat'),'ask-ai'===_0xbbd654['id'])_0xe6d344['removeSelectionFromChatContext'](),_0xe6d344['addSelectionToChatContext'](this['editor']),_0xe6d344['focusPromptInput']();else await _0xe6d344['startConversation']({'modelId':_0xbbd654['model']}),_0xe6d344['removeSelectionFromChatContext'](),_0xe6d344['addSelectionToChatContext'](this['editor']),_0xe6d344['focusPromptInput'](),await _0xe6d344['sendMessage']({'message':_0xbbd654['prompt']||_0xbbd654['displayedPrompt']||_0xbbd654['label'],'attributes':{'quickActionData':{'id':_0xbbd654['id']},'displayedPrompt':_0xbbd654['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x546d11=this['editor'],_0x380e3b=_0x546d11['model']['document']['selection'];if(!_0x380e3b['isCollapsed'])return;const _0x3a93b9=mt(_0x380e3b['getSelectedBlocks']())||_0x546d11['model']['schema']['getLimitElement'](_0x380e3b);_0x546d11['model']['change'](_0x71a93e=>{_0x71a93e['setSelection'](_0x3a93b9,'in');});}['_handleAIActionsActionLabel'](_0x3e7711){return _0x3e7711['parent']?.['label']&&'other'!==_0x3e7711['parent']?.['id']?_0x3e7711['parent']['label']+':\x20'+_0x3e7711['label']:_0x3e7711['label'];}async['_handleAIActionsAction'](_0x5b6a44){const _0x378435=this['editor']['plugins']['get']('AIActions'),_0x4a6bde=_0x5b6a44['prompt']?{'userMessage':_0x5b6a44['prompt'],'model':_0x5b6a44['model']}:{'actionName':_0x5b6a44['actionName']||_0x5b6a44['id'],'args':_0x5b6a44['args']},_0xb86f12=this['_handleAIActionsActionLabel'](_0x5b6a44);await _0x378435['executeAction'](_0x4a6bde,_0xb86f12,_0x5b6a44['icon']);}},ya=class extends _0x2e97a8{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x512780=this['editor'],_0x21cbe0=new Na(this['editor']);if(_0x512780['commands']['add']('aiQuickAction',_0x21cbe0),_0x512780['plugins']['has']('AIChat')){const _0x39fe71=this['editor']['plugins']['get']('AIChatController');_0x512780['model']['document']['selection']['on']('change:range',(_0x39be1d,_0x14195e)=>{_0x14195e['directChange']&&_0x39fe71['removeSelectionFromChatContext']();});}}},xa=class extends dn{['appendContent'](_0x176e6c,_0x5bf146='text'){'modification'===this['type']&&'text'===_0x5bf146&&(_0x5bf146=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x176e6c,_0x5bf146);}['updateChangeGroups'](_0x1fcf75){const _0xa61d5e=this['parsedContent']['get'](_0x1fcf75)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x1fcf75,_0xa61d5e),this['changeGroups']=[],0x0==_0xa61d5e['childNodes']['length'])return;Ds(this['documentContextContent']['get'](_0x1fcf75),this['parsedMergedContent']['get'](_0x1fcf75));const _0x1f0a53=_0x270224(this['documentContextContent']['get'](_0x1fcf75)['children']['map'](_0x5c6643=>({'node':_0x5c6643,'id':fs(_0x5c6643,'data-id')})),_0xa61d5e['children']['map'](_0x594aa6=>({'node':_0x594aa6,'id':fs(_0x594aa6,'data-id')||vt()})),{'comparator':(_0x2e82b6,_0x40ead4)=>_0x2e82b6['id']==_0x40ead4['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x1f0a53['length']&&_0x1f0a53[_0x1f0a53['length']-0x1]['removed'];)_0x1f0a53['pop']();}const _0x25ba53=_0x1f0a53['map'](_0x1f9214=>{const _0x264925=_0x1f9214['added']?'new':_0x1f9214['removed']?'removed':'modified';return{'node':_0x1f9214['value'][0x0]['node'],'type':_0x264925,'id':_0x1f9214['value'][0x0]['id']};}),_0x64bf70=this['_documentIdToSource']['get'](_0x1fcf75);this['changeGroups']['push']({'changes':_0x25ba53,'state':'pending','index':this['changeGroups']['length'],'editor':_0x64bf70['editor'],'rootName':_0x64bf70['rootName'],'documentId':_0x1fcf75});}['_getDifferentChangeGroups'](_0x5db081,_0x4b38c2){return _0x4b38c2;}},La=class extends An{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x584644){super(_0x584644),this['content']=_0x584644['content'],this['version']=_0x584644['version'],this['editor']=_0x584644['editor'],this['rootName']=_0x584644['rootName'],this['actionName']=_0x584644['actionName'],this['args']=_0x584644['args'],this['userMessage']=_0x584644['userMessage'],this['model']=_0x584644['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':'document','documents':[{'id':this['id'],'content':this['content'],'version':this['version'],'rootName':this['rootName'],'sessionId':vt(),'channelId':this['editor']['config']['get']('collaboration.channelId')}],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x4eb352){const _0x69edaa=this['editor']['config']['get']('collaboration.channelId'),_0x52b92c=new xa({..._0x4eb352,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x69edaa,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x69edaa,this['editor']]])});return this['replies']['push'](_0x52b92c),_0x52b92c['delegate'](...gn)['to'](this),this['fire']('replyCreated',_0x52b92c),_0x52b92c;}},Da=class extends _0x3931a6{constructor(_0x54b359,_0x179707=!0x0,_0x3596a6=!0x0){super(_0x54b359),this['set']('isEnabled',!0x1),_0x179707&&(this['applyButton']=this['_createButton'](us(_0x54b359,'AI_BALLOON_APPLY_BUTTON'),on),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x3596a6&&(this['suggestButton']=this['_createButton'](us(_0x54b359,'AI_BALLOON_SUGGEST_BUTTON'),_0x179707?an:on),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x179707,'showSuggestButton':_0x3596a6}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x103304,showSuggestButton:_0x5af31f}){this['applyButton']&&(this['applyButton']['isVisible']=_0x103304),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x5af31f);}['_createButton'](_0xc4c9bd,_0x59cbd1){const _0x3ef1f8=new Ht(this['locale']);return _0x3ef1f8['set']({'label':_0xc4c9bd,'class':_0x59cbd1,'isVisible':!0x0,'withText':!0x0}),_0x3ef1f8;}},Pa=class extends _0x3b0eb8{constructor(_0x2317dd){super(_0x2317dd),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':us(_0x2317dd,'AI_DISCLAIMER_TEXT')}]}]});}},Ha=class extends _0x3b0eb8{constructor(_0xe5a30){super(_0xe5a30),this['set']('isVisible',!0x0);const _0x38c079=new cr('small');_0x38c079['isVisible']=!0x0;const _0x36a0b2=new _0x3b0eb8(this['locale']);_0x36a0b2['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[us(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x476383=>!_0x476383)]},'children':[_0x38c079,_0x36a0b2]});}},Ma=class extends ha{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x282573,_0xbcfdd6){super(_0x282573),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0xbcfdd6,this['_focusTracker']=new dt(),this['_keystrokes']=new _t(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x554eb4(),this['_addContentWrapper'](_0xbcfdd6),this['_addDisclaimerView'](),this['_addToolbar'](_0xbcfdd6),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'](_0xbcfdd6);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x287020 of this['_focusables'])this['_focusTracker']['add'](_0x287020['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x29fbce){-0x1===_0x29fbce?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x39dbd6){this['_isLoading']=_0x39dbd6;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x2cd55d){super['showError'](_0x2cd55d),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x12a94d){super['showBlockingError'](_0x12a94d),this['setErrorState']();}['addMiniToolbarItem'](_0x5f35e1){this['_miniToolbarView']['items']['has'](_0x5f35e1)||this['_miniToolbarView']['items']['add'](_0x5f35e1);}['removeMiniToolbarItem'](_0x93f6e4){this['_miniToolbarView']['items']['has'](_0x93f6e4)&&this['_miniToolbarView']['items']['remove'](_0x93f6e4);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x3f8ae5,showSuggestButton:_0xd5bf6}){_0x3f8ae5=_0x3f8ae5&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0xd5bf6=_0xd5bf6&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x3f8ae5,'showSuggestButton':_0xd5bf6});}async['updateContent'](_0x5767f1){await this['_streamableContentView']['update'](_0x5767f1);}['finalizeContent'](){this['_streamableContentView']['cleanUpStreamingArtifacts']();}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x5ef3ac){this['_contentWrapper']=new _0x3b0eb8(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content',this['bindTemplate']['if']('_isErrorVisible','ck-hidden')]},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x5ef3ac['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new Pa(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x14b50f,showSuggestButton:_0xa661c4}){this['_toolbarView']=new Da(this['locale'],_0x14b50f,_0xa661c4),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',(_0x15d81b,_0x953d09,_0xf82b7c)=>!(_0x15d81b||_0x953d09||_0xf82b7c)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x14b50f,'showSuggestButton':_0xa661c4}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x2c6060){return this['_miniToolbarView']=new ua(this['locale'],_0x2c6060),this['_miniToolbarView']['delegate'](...Nn)['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',(_0x5f33ef,_0x596ccb)=>!(_0x5f33ef||_0x596ccb)),this['_miniToolbarView'];}['_createLoaderView'](){return this['_loaderView']=new Ha(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}['_createStreamableContentView'](){return this['_streamableContentView']=new qn(this['locale']),this['_streamableContentView'];}['_setupMiniToolbarButtons'](){const _0xe6128e=new Ht(this['locale']),_0x43fbe1=new Ht(this['locale']),_0x2d38be=new Va(this['locale']),_0x5a83c0=new Ht(this['locale']);_0xe6128e['set']({'icon':_0x3c0af6,'label':us(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+hn}),_0x43fbe1['set']({'icon':_0x248558,'tooltip':us(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+hn}),_0x5a83c0['set']({'icon':_0x127d0b,'tooltip':us(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+hn}),_0xe6128e['bind']('isEnabled')['to'](this,'isBusy',_0x2cdf49=>!_0x2cdf49),_0xe6128e['on']('execute',()=>{this['fire']('tryAgain');}),_0x43fbe1['bind']('isEnabled')['to'](this,'isBusy',_0x324831=>!_0x324831),_0x43fbe1['on']('execute',()=>{this['fire']('showPrevious');}),_0x5a83c0['bind']('isEnabled')['to'](this,'isBusy',_0x2d28ed=>!_0x2d28ed),_0x5a83c0['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x43fbe1,this['_navigationCounter']=_0x2d38be,this['_navigationNextButton']=_0x5a83c0,this['_navigationTryAgainButton']=_0xe6128e;}['updateMiniToolbarButtons'](_0x4d6ab4,_0x30b02f){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x19b908=_0x4d6ab4>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x19b908){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x3b9ded=_0x4d6ab4-_0x30b02f;this['_navigationCounter']['setInteractionCount'](_0x3b9ded+'/'+_0x4d6ab4),this['_navigationPreviousButton']['isEnabled']=_0x30b02f<_0x4d6ab4-0x1,this['_navigationNextButton']['isEnabled']=_0x30b02f>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'](_0x47b94a){this['_isLoading']=_0x47b94a;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_setupMiniToolbarPositioning'](){const _0x3198fd=this['_streamableContentView']['element'],_0x1348db=this['_miniToolbarView']['element'],_0x2b5810=()=>{Tt['window']['requestAnimationFrame'](()=>{const _0x40a863=_0x3198fd['offsetWidth']-_0x3198fd['clientWidth'];_0x1348db['style']['right']='calc('+_0x40a863+'px\x20+\x20var(--ck-spacing-large))';});};_0x2b5810(),this['_miniToolbarResizeObserver']=new It(_0x3198fd,()=>{_0x2b5810();});}['_initializeScrollManager'](){const _0x3509c0=this['_getScrollableElement']();_0x3509c0&&!this['_scrollManager']&&(this['_scrollManager']=new Pr(_0x3509c0));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}},Va=class extends _0x3b0eb8{constructor(_0x198e13){super(_0x198e13);const _0x559944=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x559944['to']('interactionCount')}]});}['setInteractionCount'](_0x4bb36c){this['set']('interactionCount',_0x4bb36c);}},Ua=class extends _0x2e97a8{static get['requires'](){return[ls,nn,Mt,Is,la,_0x5d031e];}static get['pluginName'](){return'AIActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_aiConnector'];['_interactions']=[];['_currentInteractionIndex']=0x0;['_interactionParams'];['_balloonShowDiff']=!0x1;['_promiseQueue'];get['_interaction'](){return this['_interactions'][this['_interactions']['length']-0x1];}['_actionsBalloonView'];['_reporter'];constructor(_0x401192){super(_0x401192),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['_reporter']=this['editor']['plugins']['get'](nn)['createReporter']('aiactions'),this['set']('isBusy',!0x1),this['_promiseQueue']=new Zn();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x56adeb,_0x3b1063,_0x980470){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0xcd112c,anchorData:_0x36f733,root:_0x40a0c3}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x56adeb,_0xcd112c,_0x36f733,_0x40a0c3,_0x3b1063,_0x980470);}const {modelFragment:_0x3f324b,anchorData:_0x3bf4d6,root:_0x1087af}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x56adeb,_0x3f324b,_0x3bf4d6,_0x1087af,_0x3b1063,_0x980470);}async['destroy'](){return this['_stopInteraction'](),super['destroy']();}['_createActionsBalloonView'](){const _0x47f79c=this['editor']['plugins']['has']('TrackChanges');let _0x5d4385=this['editor']['config']['get']('ai.availableReplyActions')||[...er];_0x47f79c||(_0x5d4385=_0x5d4385['filter'](_0x4e2c72=>'insertSuggestion'!=_0x4e2c72));const _0x279a1f=this['editor']['commands']['get']('trackChanges'),_0x5202d2=new Ma(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x47f79c,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x5d4385});return _0x5202d2['bind']('isBusy')['to'](this),_0x279a1f&&_0x5202d2['bind']('isTrackChangesOn')['to'](_0x279a1f,'value'),_0x5202d2['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x5202d2['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x5202d2['on']('showNext',()=>{this['_navigateToNext']();}),_0x5202d2;}['_normalizeSelectionStart'](){const _0x157884=this['editor']['model'],_0x3ab2c2=_0x157884['document']['selection'],_0x45c93b=_0x3ab2c2['getFirstRange']();if(!_0x45c93b||_0x45c93b['isCollapsed'])return;const _0x43681e=mt(_0x3ab2c2['getSelectedBlocks']());if(!_0x43681e)return;const _0x595e17=_0x157884['createPositionAt'](_0x43681e,0x0);_0x595e17['isAfter'](_0x45c93b['start'])&&_0x157884['change'](_0x51c5f7=>{_0x51c5f7['setSelection'](_0x51c5f7['createRange'](_0x595e17,_0x45c93b['end']));});}['_getExecuteDataRegular'](){const _0x140885=this['editor']['model']['document']['selection'],_0x2dee8a=_0x140885['getFirstRange']()['start']['root'];if(_0x140885['isCollapsed']){const _0x1967ed=mt(_0x140885['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x140885);this['editor']['model']['change'](_0x197e9f=>{_0x197e9f['setSelection'](_0x1967ed,'in');});}this['_normalizeSelectionStart']();const _0x1d1efe=_0x140885['getFirstRange'](),_0x36820b=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x140885),_0x1d1efe['start'],_0x1d1efe['end']);this['_copyMarkersToFragment'](_0x36820b,_0x140885,{'isTableSelection':!0x1});const _0xdde393=_0x140885['getFirstRange']()['start'],_0x39213d=new Map();let _0x17fbd4=_0x36820b;for(let _0x22843b=0x0;_0x22843b<_0xdde393['path']['length'];_0x22843b++)_0x39213d['set'](_0x17fbd4,_0xdde393['path'][_0x22843b]),_0x17fbd4=_0x17fbd4['getChild'](0x0);return{'modelFragment':_0x36820b,'anchorData':_0x39213d,'root':_0x2dee8a};}['_getExecuteDataInTable'](){const _0x296222=this['editor']['model']['document']['selection'],_0x243508=this['editor']['plugins']['get']('TableSelection'),_0x2fd567=_0x296222['getFirstRange']()['start']['root'],_0x5e11de=_0x243508['getSelectionAsFragment'](),_0x220e95=_0x296222['getFirstRange']()['start']['parent']['parent'],_0x87140b=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x220e95),this['editor']['model']['createPositionAfter'](_0x220e95)),_0x228c99=this['_wrapWithCommonAncestors'](_0x5e11de,_0x87140b['start'],_0x87140b['end']);this['_copyMarkersToFragment'](_0x228c99,_0x296222,{'isTableSelection':!0x0});const _0x5a0403=_0x296222['getFirstRange']()['start'],_0x201513=new Map();let _0x29aec4=_0x228c99;for(let _0x36945b=0x0;_0x36945b<_0x5a0403['path']['length'];_0x36945b++)if(_0x201513['set'](_0x29aec4,_0x5a0403['path'][_0x36945b]),_0x36945b<_0x5a0403['path']['length']-0x1)_0x29aec4=_0x29aec4['getChild'](0x0);else{let _0x5133ab=_0x29aec4['nextSibling'];for(;_0x5133ab;)_0x201513['set'](_0x5133ab,_0x5a0403['path'][_0x36945b]),_0x5133ab=_0x5133ab['nextSibling'];}return{'modelFragment':_0x228c99,'anchorData':_0x201513,'root':_0x2fd567};}async['_executeAction'](_0x410cab,_0x3a27fa,_0x3625f6,_0x4f1dc8,_0xa55cf1,_0x19fe10){const _0x3a27c2=this['editor']['plugins']['get'](Is),_0xce1eb2=this['editor']['plugins']['get'](la),_0x481d58=this['editor']['model']['document']['selection'],_0x3438b3=await _0x3a27c2['modelToDataWithIds'](_0x3a27fa,this['editor']),_0x3fea39=this['editor']['model']['document']['version'],_0x57f5a4=[..._0x481d58['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0xce1eb2['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0xa55cf1,'icon':_0x19fe10||_0x2db5af,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x57f5a4,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0xce1eb2),this['_interactionParams']={'action':_0x410cab,'content':_0x3438b3,'version':_0x3fea39,'aiBalloon':_0xce1eb2,'modelFragment':_0x3a27fa,'anchorData':_0x3625f6,'root':_0x4f1dc8},this['_setupApplyListeners'](),this['listenTo'](_0xce1eb2,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0xce1eb2,'dialogClosed',(_0x4fc0ca,{id:_0x28dd4a})=>{if('aiActionsBalloon'===_0x28dd4a){for(const _0x1b93bb of this['_interactions']){if(0x0===_0x1b93bb['replies']['length']||_0x1b93bb['stoppedExplicitly'])continue;const _0x314215=_0x1b93bb['replies'][_0x1b93bb['replies']['length']-0x1],_0x428575=_0x314215['changeGroups'][0x0];_0x428575&&'pending'===_0x428575['state']&&_0x314215['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0xce1eb2);}}),this['_createInteraction'](_0x3438b3,_0x3fea39,_0xce1eb2,_0x410cab);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x2fba24,anchorData:_0x52f4fc,root:_0x322c7a}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x2fba24,_0x52f4fc,_0x322c7a,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x2fba24,_0x52f4fc,_0x322c7a,!0x0);});}['_wrapWithCommonAncestors'](_0x32b57e,_0x5b7f17,_0x442e65){const _0x3e0b8c=this['editor']['model']['createRange'](_0x5b7f17,_0x442e65)['getCommonAncestor'](),_0x56da93=_0x3e0b8c['is']('documentFragment')?[]:_0x3e0b8c['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x56da93['length']){const _0x30e594=_0x56da93['map'](_0x1b2b1a=>_0x1b2b1a['_clone'](!0x1));for(let _0x1638b9=0x1;_0x1638b9<_0x30e594['length'];_0x1638b9++)_0x30e594[_0x1638b9-0x1]['_appendChild'](_0x30e594[_0x1638b9]);return _0x30e594[_0x30e594['length']-0x1]['_appendChild'](_0x32b57e),new _0x446730(_0x30e594[0x0]);}return _0x32b57e;}['_copyMarkersToFragment'](_0x3e3ec2,_0x3c77d9,_0x217bda={'isTableSelection':!0x1}){const _0x1cd65f=this['editor']['model'],_0x5191d7=Array['from'](_0x3c77d9['getRanges']()),_0x210fe2=_0x3c77d9['getFirstRange']()['start'];for(const _0x38f4e8 of _0x1cd65f['markers']){if(_0x38f4e8['name']['startsWith']('ai-selection')||!_0x38f4e8['affectsData'])continue;const _0x45326e=_0x38f4e8['getRange']();if(!_0x5191d7['some'](_0x3a97e4=>_0x3a97e4['containsRange'](_0x45326e,!0x0)))continue;const _0x1d2d15=this['_regularCalculateMarkerPath'](_0x45326e['start'],_0x210fe2,_0x217bda['isTableSelection']),_0x51e77a=this['_regularCalculateMarkerPath'](_0x45326e['end'],_0x210fe2,_0x217bda['isTableSelection']),_0x468c42=_0x1cd65f['createPositionFromPath'](_0x3e3ec2,_0x1d2d15),_0x1eb622=_0x1cd65f['createPositionFromPath'](_0x3e3ec2,_0x51e77a);if(!_0x468c42['isEqual'](_0x1eb622)){const _0x4906bd=_0x1cd65f['createRange'](_0x468c42,_0x1eb622);_0x3e3ec2['markers']['set'](_0x38f4e8['name'],_0x4906bd);}}}['_regularCalculateMarkerPath'](_0x2ca3c7,_0x47dd4f,_0x358d36=!0x1){const _0x2b5b20=[..._0x2ca3c7['path']['slice']()];for(let _0x363350=0x0;_0x363350<Math['max'](_0x47dd4f['path']['length'],_0x2ca3c7['path']['length']);_0x363350++){const _0x365dea=_0x47dd4f['path'][_0x363350]||0x0,_0x231771=(_0x2ca3c7['path'][_0x363350]||0x0)-_0x365dea;if(_0x2b5b20[_0x363350]=_0x231771,0x0!==_0x231771&&!_0x358d36)break;}return _0x2b5b20;}async['_createInteraction'](_0xe2d9df,_0x4578f7,_0x1eaabd,_0x5dac93){const _0x32b914=this['editor'],_0x530fd8=_0x32b914['model']['document']['selection']['getFirstRange']()['start']['root'];if(!_0x5c2cc5(_0x32b914,_0x530fd8['rootName']))return this['_actionsBalloonView']['showBlockingError'](us(this['editor']['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')),Promise['resolve']();this['_interactionParams']||(this['_interactionParams']={'action':_0x5dac93,'content':_0xe2d9df,'version':_0x4578f7,'aiBalloon':_0x1eaabd,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x530fd8});const _0xf05de9=new La({'connector':this['_aiConnector'],'locale':_0x32b914['locale'],'content':_0xe2d9df,'version':_0x4578f7,'editor':_0x32b914,'rootName':_0x530fd8['rootName'],..._0x5dac93});this['_interactions']['push'](_0xf05de9);const _0x18fa8d=(_0x57b894,_0x257c8d=!0x1,_0x5d99aa='streaming')=>{const {isDone:_0x951e7c}=_0x57b894;return this['_promiseQueue']['enqueue'](async _0x3dc6ce=>{try{const _0x53a2b1=Vs({'changeGroups':_0x57b894['changeGroups'],'documentContextContent':_0x57b894['documentContextContent'],'showDiff':_0x257c8d,'trimUnchanged':!0x1});_0x53a2b1['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x53a2b1[0x0],'renderingStrategy':_0x5d99aa,'abortSignal':_0x3dc6ce}),_0x951e7c&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x1f36ae){if(en(_0x1f36ae))return;throw _0x1f36ae;}});};_0xf05de9['on']('replyCreated',(_0x25a6ca,_0xa016f5)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x18fa8d(_0xa016f5)['catch'](_0x2606f5=>{this['_reporter']['logError'](_0x2606f5,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0xf05de9,_0x2606f5);});}),_0xf05de9['on']('replyContentUpdated',(_0x500ca3,_0x415b99)=>{_0x18fa8d(_0x415b99)['catch'](_0x3fe710=>{this['_reporter']['logError'](_0x3fe710,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0xf05de9,_0x3fe710);});}),_0xf05de9['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x1767be){this['_reporter']['logError'](_0x1767be,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0xf05de9,_0x1767be);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x5e2146,{showDiff:_0x3de394})=>{try{this['_balloonShowDiff']=_0x3de394;const _0x1c662d=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x1c662d&&await _0x18fa8d(_0x1c662d,_0x3de394,'static');}catch(_0x2fcad8){this['_reporter']['logError'](_0x2fcad8,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0xf05de9,_0x2fcad8);}}),_0xf05de9['on']('replyChangeGroupStateUpdated',()=>{const _0x41edc3={'positiveCount':_0xf05de9['replies']['reduce']((_0x17e4ae,_0x51e7db)=>_0x17e4ae+_0x51e7db['changeGroups']['filter'](_0x2fdc41=>'accepted'===_0x2fdc41['state'])['length'],0x0),'totalCount':_0xf05de9['replies']['reduce']((_0x3aa768,_0x44d1b1)=>_0x3aa768+_0x44d1b1['changeGroups']['length'],0x0)},_0x48b6ce=_0xf05de9['actionCallId'],_0x41ee28=_0xf05de9['actionName'];_0x41ee28?this['_aiConnector']['upsertAIActionRating'](_0x41ee28,_0x48b6ce,_0x41edc3):this['_aiConnector']['upsertCustomAIActionRating'](_0x48b6ce,_0x41edc3);}),this['_setLoadingState']();try{const _0x11efe0=await _0xf05de9['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x11efe0;}catch(_0x23e138){en(_0x23e138)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x23e138,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0xf05de9,_0x23e138);}}['_applyChanges'](_0x34aebd,_0x41725b,_0x5a14ca,_0x55debf){const _0x181d74=this['editor'];if(_0x55debf&&!_0x181d74['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',null);const _0x964408=this['editor']['plugins']['get'](_0x5d031e),_0x1d20ec=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x1d20ec||!_0x1d20ec['replies']['length'])return;const _0x40b938=_0x1d20ec['replies'][_0x1d20ec['replies']['length']-0x1];_0x40b938['setChangeGroupState'](0x0,'accepted');const _0x1021f1=Rn({'documentSuggestions':On({'groups':[_0x40b938['changeGroups'][0x0]],'documentContextContent':_0x40b938['documentContextContent'],'documents':_0x1d20ec['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x964408,'documentCompareOptions':{'anchor':_0x181d74['model']['createPositionAt'](_0x34aebd,0x0),'markDeletions':_0x55debf}})['values']()['next']()['value']??[],_0x2a6704=this['_filterOperationsOutsideRange'](_0x1021f1,_0x41725b);for(const _0x5554c3 of _0x2a6704)this['_anchorOperation'](_0x41725b,_0x5554c3,_0x5a14ca);const _0x5b23e3=_0x1d20ec['getDocumentContext']()['documents'][0x0]['version'],_0x465c55=_0x17dc83(_0x2a6704,_0x181d74['model']['document']['history']['getOperations'](_0x5b23e3),{'document':_0x181d74['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];zs(_0x465c55,'quickActions');try{_0x181d74['model']['change'](_0x1d7925=>{_0x1d7925['setSelection'](_0x181d74['model']['document']['selection']['focus']),_0x55debf?_0x181d74['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x465c55):_0x964408['applyOperations'](_0x1d7925,_0x465c55);});}catch(_0x170a1e){throw this['_reporter']['logError'](new sn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x170a1e})),_0x170a1e;}this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x3bcba2,_0x3f09dc){return _0x3bcba2['filter'](_0x5b6847=>{if('rename'==_0x5b6847['type']){const _0x2f228d=_0x5b6847['position']['nodeAfter'];return!_0x3f09dc['has'](_0x2f228d);}if(_0x5b6847['type']['indexOf']('Attribute')>-0x1){const _0x4dfbf3=_0x5b6847['range']['start']['nodeAfter'];return!_0x3f09dc['has'](_0x4dfbf3);}return!0x0;});}['_anchorOperation'](_0xaff288,_0x27cc9e,_0x1689f0){const _0x1a83bb=_0x27cc9e['clone']();for(const _0x24eda1 in _0x27cc9e){const _0x5372f9=_0x27cc9e[_0x24eda1];_0x5372f9 instanceof _0x34b9eb?_0x27cc9e[_0x24eda1]=new _0x34b9eb(_0x466c97(_0x5372f9['start']),_0x466c97(_0x5372f9['end'])):_0x5372f9 instanceof _0x3e2549&&(_0x27cc9e[_0x24eda1]=_0x466c97(_0x5372f9));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x1a83bb['type'])){if(_0x1a83bb['isDocumentOperation']=!0x1,_0x1a83bb['baseVersion']=null,'remove'==_0x1a83bb['type']){const _0x57eced=_0x1a83bb['sourcePosition'],_0x18735a=_0x1a83bb['howMany'];new _0x2c93bf(_0x57eced,_0x18735a)['_execute']();}else _0x1a83bb['_execute']();}function _0x466c97(_0x593a63){if('$graveyard'==_0x593a63['root']['rootName'])return _0x593a63;const _0x558977=[];let _0x2ead27=_0x593a63['root'];for(let _0x532cf8=0x0;_0x532cf8<_0x593a63['path']['length'];_0x532cf8++){const _0x169b17=_0xaff288['get'](_0x2ead27)||0x0;_0x558977[_0x532cf8]=_0x593a63['path'][_0x532cf8]+_0x169b17,_0x2ead27=_0x2ead27['getChildAtOffset'](_0x593a63['path'][_0x532cf8]);}return new _0x3e2549(_0x1689f0,_0x558977,_0x593a63['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0xbd6883,content:_0x143ff7,version:_0x1d401a,aiBalloon:_0x27466d}=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'](_0x143ff7,_0x1d401a,_0x27466d,_0xbd6883)['catch'](_0x49d691=>{this['_reporter']['logError'](_0x49d691,{'context':{'operation':'refresh-interaction'}});});}['_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 _0xbd656=this['_interactions']['length'];this['_currentInteractionIndex']<_0xbd656-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x27a27d){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x27a27d;const _0x271b09=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x271b09)return;if(_0x271b09['hasError'])return this['_setErrorState'](_0x271b09),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x271b09['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x494a5c=_0x271b09['replies'][_0x271b09['replies']['length']-0x1];if(_0x494a5c)try{const _0x2bb7fc=Vs({'changeGroups':_0x494a5c['changeGroups'],'documentContextContent':_0x494a5c['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x25aad2=>setTimeout(_0x25aad2,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x2bb7fc[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x1a28f2){this['_reporter']['logError'](_0x1a28f2,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x2c6528,_0x198ad8){if(void 0x0!==_0x198ad8&&en(_0x198ad8))return;const _0xa543eb=us(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0xa543eb),_0x2c6528['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);}},Ba=class extends _0x2e97a8{static get['requires'](){return[Oa,ya,Ua];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3e8e67){super(_0x3e8e67),_0x3e8e67['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Ga=class extends _0x3b0eb8{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x4fe45c,_0x3a7adf){super(_0x4fe45c),this['id']=_0x3a7adf,this['set']('status','pending'),this['set']('changeId',_0x3a7adf),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',(_0x14496d,_0x33d15a)=>{_0x33d15a&&_0x33d15a['target']&&'A'===_0x33d15a['target']['tagName']&&_0x33d15a['preventDefault'](),this['fire']('activateChange',{'id':_0x3a7adf,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x3a7adf,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x3a7adf,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x1e1204=new _0x3b0eb8(this['locale']);return _0x1e1204['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',_0x3978be=>!_0x3978be)]}}),_0x1e1204;}['_createAcceptButtonView'](){const _0x283d2=new Ht(this['locale']);return _0x283d2['set']({'label':us(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x283d2['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x163c62=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x163c62['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x26221e=>'pending'!==_0x26221e&&'accepted'!==_0x26221e),this['bindTemplate']['if']('status',an,_0x7c3f3=>'pending'===_0x7c3f3),this['bindTemplate']['if']('status',hn,_0x2f3163=>'pending'!==_0x2f3163),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x243e4f=>'accepted'===_0x243e4f)]}}),this['on']('change:status',(_0x1dba83,_0x5a1167,_0x59654b)=>{_0x283d2['isEnabled']='pending'===_0x59654b,'accepted'===_0x59654b&&(_0x283d2['label']=us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x283d2['icon']=_0x3047d4);}),_0x283d2;}['_createDismissButtonView'](){const _0x4514bd=new Ht(this['locale']);return _0x4514bd['set']({'label':us(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x4514bd['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x1b6090=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x1b6090['stopPropagation']();})},'attributes':{'class':[hn,this['bindTemplate']['if']('status','ck-hidden',_0x442616=>'pending'!==_0x442616&&'rejected'!==_0x442616),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x895314=>'pending'===_0x895314),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0xa9854f=>'rejected'===_0xa9854f)]}}),this['on']('change:status',(_0x2c6187,_0x215f69,_0x5972e1)=>{_0x4514bd['isEnabled']='pending'===_0x5972e1,'rejected'===_0x5972e1&&(_0x4514bd['label']=us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x4514bd['icon']=_0x22db67);}),_0x4514bd;}['_createInfoButtonView'](){const _0x43b13b=new Ht(this['locale']);return _0x43b13b['set']({'label':us(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x445d2f,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':hn+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x43b13b['bind']('isOn')['to'](this,'isInfoToggleOn',_0x36a537=>_0x36a537),_0x43b13b['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x43b13b;}['_createOutdatedButtonView'](){const _0x253a58=new Ht(this['locale']);return _0x253a58['set']({'label':us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0x5e55d4,'withText':!0x0,'isEnabled':!0x1}),_0x253a58['extendTemplate']({'attributes':{'class':[hn,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x2e1d2e=>'outdated'!==_0x2e1d2e)],'disabled':'disabled'}}),_0x253a58;}},Fa=class extends yt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x5c6434,_0x612f97){super(_0x5c6434),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']()),_0x612f97['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x535597){this['resultItemView']['changeId']=_0x535597['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x535597['contentDiffed'];}['showBalloon'](_0x1b3a50,_0x290e8f,_0x5da7de,_0x35cbcf,_0x4d5007,_0x45ebd2){const _0x42d66a=_0x290e8f();if(!_0x42d66a)return;this['updateContent'](_0x1b3a50),this['show']();const _0x28662b=Array['from'](_0x42d66a['getClientRects']())['reverse'](),_0x5da7c5=this['_getPointedRectIndexFromEvent'](_0x5da7de,_0x28662b),_0x5140aa=_0x28662b[_0x5da7c5??0x0];'click'===_0x35cbcf?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x290e8f(),_0x5da7c5,_0x1b3a50['id'],_0x4d5007,_0x45ebd2)||_0x5140aa})):'hover'===_0x35cbcf&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x290e8f(),_0x5da7c5,_0x1b3a50['id'])||_0x5140aa}));}['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'](){_0x45c652({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0xb36433=[this['element']];return this['_pinnedTargetElement']&&_0xb36433['push'](this['_pinnedTargetElement']),_0xb36433;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x5eade8=new _0x3b0eb8();return this['resultItemView']=new Ga(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x5eade8['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']]}]}),_0x5eade8;}['_getBestRectPositionOnClick'](_0x2d8b0d,_0x23f647,_0x9256ce,_0x8a3557,_0x1212fb){if(!_0x2d8b0d)return null;const _0x2c48b4=this['position']['replace']('arrow_',''),_0x58b0f6=Array['from'](_0x2d8b0d['getClientRects']());let _0x327a92,_0xdc6ed6=_0x58b0f6['reverse']();return void 0x0!==_0x23f647&&this['_isPinnedRectVisible'](_0xdc6ed6[_0x23f647],_0x8a3557,_0x1212fb)?(_0x327a92=_0xdc6ed6[_0x23f647],this['_pinnedRectIndex']=_0x23f647):this['_isPinnedRectVisible'](_0xdc6ed6[0x0],_0x8a3557,_0x1212fb)&&void 0x0===_0x23f647?_0x327a92=_0xdc6ed6[0x0]:(_0xdc6ed6='s'==_0x2c48b4[0x0]?[..._0x58b0f6]['reverse']():_0x58b0f6,_0xdc6ed6['forEach'](_0x53f84e=>{this['_isPinnedRectVisible'](_0x53f84e,_0x8a3557,_0x1212fb)&&(_0x327a92=_0x53f84e);})),this['_pinnedTargetChangeId']=_0x9256ce,this['_pinnedTargetElement']=_0x2d8b0d,_0x327a92||_0x2d8b0d['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x12a07e,_0x3f479c,_0x2f6e08){if(!_0x12a07e)return null;const _0x2cfca4=Array['from'](_0x12a07e['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x3f479c&&this['_pinnedTargetChangeId']!==_0x2f6e08?(this['_pinnedRectIndex']=_0x3f479c,this['_pinnedTargetElement']=_0x12a07e,this['_pinnedTargetChangeId']=_0x2f6e08,_0x2cfca4[_0x3f479c]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x2f6e08?_0x12a07e!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x2cfca4[this['_pinnedRectIndex']]:void 0x0!==_0x3f479c&&this['_pinnedTargetChangeId']!==_0x2f6e08?(this['_pinnedRectIndex']=_0x3f479c,this['_pinnedTargetElement']=_0x12a07e,this['_pinnedTargetChangeId']=_0x2f6e08,_0x2cfca4[_0x3f479c]):_0x12a07e['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x5ca834,_0x54eeaa){if(_0x5ca834)for(let _0x5550f6=0x0;_0x5550f6<_0x54eeaa['length'];_0x5550f6++){const _0xe09f7d=_0x54eeaa[_0x5550f6];if(_0x5ca834['clientX']>=_0xe09f7d['left']-0x3&&_0x5ca834['clientX']<=_0xe09f7d['right']+0x3&&_0x5ca834['clientY']>=_0xe09f7d['top']-0x3&&_0x5ca834['clientY']<=_0xe09f7d['bottom']+0x3)return _0x5550f6;}}['_isPinnedRectVisible'](_0x5d8ec1,_0x32011c,_0x5417e9){const _0x2b3388=new At(_0x5d8ec1),_0x3d5d00=_0x32011c||document['documentElement'],_0x17b36b=_0x2b3388['getIntersection'](Et(_0x5417e9)),_0x42a93e=new At(_0x3d5d00)['getIntersection'](_0x2b3388);return!!(_0x17b36b&&_0x42a93e&&_0x2b3388['width']>0x0);}};const Ka=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var Wa=class extends _0xe5ed07{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[cs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x24f813){super(_0x24f813),this['_bodyCollection']=ln(this['context']['locale']),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Ka)['to'](this),this['_balloonSuggestionView']=new Fa(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x5c7914=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x5c7914);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x2ba8e4){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x2366bb=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x2ba8e4,_0x2366bb);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x1af7d8){_0x1af7d8&&('error-general'!==_0x1af7d8['status']?'error-chunk'!==_0x1af7d8['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x51100a){this['_mainView']['addCheckRunResult'](_0x51100a);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x4ca7f5){this['_mainView']['showGeneralReviewCoreErrorView'](_0x4ca7f5??us(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x40c0b5,_0x4f7af6){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x40c0b5,_0x4f7af6);}['setActiveStateInResults'](_0x35f9bd){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x332386=>{_0x332386['id']===_0x35f9bd&&_0x332386['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x84582c=>_0x84582c['setItemAsInactive']());}['updateChangeState'](_0x341585,_0x377e83){'accepted'===_0x377e83||'rejected'===_0x377e83||'outdated'===_0x377e83?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x341585,_0x377e83):this['_mainView']['reviewCheckResultsView']['showResult'](_0x341585,_0x377e83);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x519cde,_0x58d51e,_0x1e7f44,_0x1fc3de,_0x21ff15,_0x1280b1){this['_balloonSuggestionView']['showBalloon'](_0x519cde,_0x58d51e,_0x1e7f44,_0x1fc3de,_0x21ff15,_0x1280b1);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x1ef1a3){const _0x20e48d=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x5016c1=>_0x5016c1['id']===_0x1ef1a3);return _0x20e48d?_0x20e48d['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}},Ya=class extends _0x3b0eb8{constructor(_0xa40d24){super(_0xa40d24),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x4e2e25=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x4e2e25['if']('isVisible','ck-hidden',_0x35c661=>!_0x35c661)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x4e2e25['to']('errorMessage')}]}]});}},$a=class extends _0x3b0eb8{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x5a87c6,_0x7307ed){super(_0x5a87c6),this['reviewCoreHeader']=_0x7307ed['header'],this['generalErrorView']=new Ya(_0x5a87c6),this['reviewCheckListView']=_0x7307ed['list'],this['reviewCheckListView']['delegate'](...Ka)['to'](this),this['reviewCheckResultsView']=_0x7307ed['results'],this['reviewCheckResultsView']['delegate'](...Ka)['to'](this),this['reviewCompletedView']=_0x7307ed['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'](_0x416cea){this['reviewCheckResultsView']['addResult'](_0x416cea),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'](_0x27d1f4){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x27d1f4;}['showGeneralResultsErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}},qa=class extends Ht{constructor(_0xcc04d3,_0x1cbf66){super(_0x1cbf66),this['set']({'label':_0xcc04d3,'withText':!0x0,'class':on}),this['on']('execute',()=>{this['fire']('finishReview');});}},Qa=class extends zt{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x5bd297,_0x2146bb){super(_0x5bd297),this['_contents']=_0x2146bb,this['_resultViews']=new _0x554eb4(),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 Mo(_0x5bd297),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 _0x18d593=this['_createCombinedSkeletonLoader'](),_0x33c972=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x33c972['if']('isLoading','ck-ai_review__check-run_loading',_0x14d2ef=>_0x14d2ef),_0x33c972['if']('isResultReady','ck-ai_review__check-run_ready',_0x21993b=>_0x21993b),_0x33c972['if']('isVisible','ck-hidden',_0x162be7=>!_0x162be7)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x18d593,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x1f3f7e){const _0x4869ea=new Ga(this['locale'],_0x1f3f7e['id']);_0x4869ea['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x4869ea),_0x4869ea['resultResponseView']['element']['innerHTML']=_0x1f3f7e['contentDiffed'];}['hideResult'](_0x2936dd,_0x4c6a5b){if('pending'===_0x4c6a5b)return;const _0x4336a4=this['_resultViews']['find'](_0x9bf91e=>_0x9bf91e['id']===_0x2936dd);_0x4336a4&&(_0x4336a4['status']=_0x4c6a5b,_0x4336a4['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0xeb5617,_0x2475bc){if('pending'!==_0x2475bc)return;const _0x15ee54=this['_resultViews']['find'](_0x554f67=>_0x554f67['id']===_0xeb5617);_0x15ee54&&(_0x15ee54['status']=_0x2475bc,_0x15ee54['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x32c8f1,_0x504e3f){this['headerTitle']=_0x32c8f1,this['headerSubtitle']=_0x504e3f||'';}['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 Xn(this['locale'],zn['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x16d11a=new _0x3b0eb8(this['locale']),_0x529b0c=[];for(let _0x40f771=0x0;_0x40f771<0x10;_0x40f771++){const _0x328f75=this['_createSkeletonLoader']();_0x328f75['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x529b0c['push'](_0x328f75);}return _0x16d11a['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x550ca1=>!_0x550ca1)]},'children':_0x529b0c}),_0x16d11a;}['_createResultsBodyView'](){const _0x1c6def=new _0x3b0eb8(this['locale']);return _0x1c6def['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x1ffc17=>_0x1ffc17)]},'children':this['_resultViews']}),_0x1c6def;}['_createErrorView'](){const _0x4b55b=new _0x3b0eb8(this['locale']),_0x55a051=new Ht(this['locale']),t=this['locale']['t'];return _0x4b55b['delegate']('retryReview')['to'](this),_0x55a051['set']({'label':t('Try\x20again'),'withText':!0x0,'class':an+'\x20ck-ai_review__check-run-error-retry-button'}),_0x55a051['on']('execute',()=>{this['fire']('retryReview');}),_0x4b55b['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x371d68=>!_0x371d68),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x45c6e9=>'chunk'===_0x45c6e9)]},'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',_0x1c94b1=>'chunk'===_0x1c94b1)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0xcdbe0e=>'general'!==_0xcdbe0e)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x3a2668=>'chunk'!==_0x3a2668)]},'children':[{'text':us(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x55a051]}),_0x4b55b;}['_createCancelButtonView'](){const _0x4045d6=new Ht(this['locale']);return _0x4045d6['set']({'label':us(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[an+'\x20ck-ai-button-stop-generating'],'icon':it}),_0x4045d6['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x53cd94=>_0x53cd94),this['bindTemplate']['if']('isCompleted','ck-hidden',_0xc36c55=>_0xc36c55)]}}),_0x4045d6['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x4045d6;}['_createToggleDiffButtonView'](){const _0x30ed57=new Ht(this['locale']);_0x30ed57['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x30ed57['bind']('isEnabled')['to'](this,'isError',_0x3a348f=>!_0x3a348f),_0x30ed57['extendTemplate']({'attributes':{'class':[an,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x2b6a9b=>!_0x2b6a9b),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x234915=>_0x234915)]}});const _0x4c5bfb=us(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x258027=us(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x30ed57['bind']('isOn')['to'](this,'isToggleDiffOn',_0x30e769=>_0x30e769),_0x30ed57['bind']('icon')['to'](this,'isToggleDiffOn',_0x2307f1=>_0x2307f1?_0x496196:_0x27c4f3),_0x30ed57['bind']('label')['to'](this,'isToggleDiffOn',_0x3a8973=>_0x3a8973?_0x4c5bfb:_0x258027),_0x30ed57['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x30ed57;}['_createAcceptAllButtonView'](){const _0x1191d9=new Ht(this['locale']);return _0x1191d9['set']({'label':us(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x1191d9['bind']('isEnabled')['to'](this,'isError',_0x4c98cf=>!_0x4c98cf),_0x1191d9['extendTemplate']({'attributes':{'class':[on,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x982f54=>!_0x982f54),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x367f8a=>_0x367f8a)]}}),_0x1191d9['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x1191d9;}['_createExitReviewButtonView'](){const _0x201321=new Ht(this['locale']);return _0x201321['set']({'label':us(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x201321['extendTemplate']({'attributes':{'class':[hn,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x3a0310=>!_0x3a0310),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x17bf19=>_0x17bf19)]}}),_0x201321['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x201321;}['_createResultHeaderView'](){const _0x3f26cd=new _0x3b0eb8(this['locale']),_0x19dfd9=this['_createTitleView']();return _0x3f26cd['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x175d60=>_0x175d60)]},'children':[_0x19dfd9,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x34b8a7=>!_0x34b8a7)],'title':us(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':us(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-buttons']},'children':[this['_cancelButtonView'],this['_acceptAllButtonView'],this['_exitReviewButtonView'],this['_toggleDiffButtonView'],this['_finishReviewButtonView']]}]}),_0x3f26cd;}['_createTitleView'](){const _0x3029a7=new _0x3b0eb8(this['locale']),_0x46e0b7=new cr();return _0x46e0b7['bind']('isVisible')['to'](this,'isResultReady',_0x251322=>!_0x251322),_0x3029a7['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x543b14=>_0x543b14)]},'children':[_0x46e0b7,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-content']},'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')}]}]}]}),_0x3029a7;}['_createFinishReviewButtonView'](){const _0x5da34d=new qa(us(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x5da34d['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0xbb67a0=>!_0xbb67a0)]}}),_0x5da34d['delegate']('finishReview')['to'](this),_0x5da34d;}},Xa=class extends zt{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x34ff8c,_0x72190){super(_0x34ff8c),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x72190['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x72190['headerText']);const _0x2b8f25=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x2b8f25['if']('isVisible','ck-hidden',_0x2ce951=>!_0x2ce951)]},'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':_0x72190['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x417045){const _0x57671a=new qa(_0x417045,this['locale']);return _0x57671a['delegate']('finishReview')['to'](this),_0x57671a;}['_createResultHeaderView'](_0x41fc0e){const _0x4d8932=new _0x3b0eb8(this['locale']);return _0x4d8932['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x41fc0e},'children':[{'text':_0x41fc0e}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x4d8932;}},za=class extends _0x3b0eb8{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x44fe34,_0x2986d6){super(_0x44fe34),this['_defaultValue']=_0x2986d6['default']||(_0x2986d6['data']['length']>0x0?_0x2986d6['data'][0x0]['id']:''),this['_defaultLabel']=_0x2986d6['data']['find'](_0x2871fd=>_0x2871fd['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x1e2a6d(this['locale']);const _0x337542=this['_prepareListOptions'](_0x2986d6['data']);_0x39a4e4(this['_dropdownView'],_0x337542,{'role':'menu','ariaLabel':_0x2986d6['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x144f0f=>{_0x144f0f['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x35b4b9=>{this['formValue']=_0x35b4b9['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x35b4b9['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'](_0x3046e4=[]){const _0x49574b=new ct();this['resetToDefault']();for(const _0x303015 of _0x3046e4){const _0xd3534c=new _0x5c4c1e({'label':_0x303015['label'],'withText':!0x0,'role':'menuitemradio','id':_0x303015['id'],'model':_0x303015});_0xd3534c['bind']('isOn')['to'](this,'formValue',_0x121d8e=>_0x121d8e===_0xd3534c['id']);const _0x4c723f={'type':'button','model':_0xd3534c};_0x49574b['add'](_0x4c723f);}return _0x49574b;}},ja=class extends zt{['_formItem']=null;constructor(_0x3967a9,_0x28a250,_0x1b2758){if(super(_0x3967a9),this['argsKey']=_0x28a250?.['argsKey'],'dropdown'===_0x28a250['formType'])this['_formItem']=new za(this['locale'],_0x28a250);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x53c881=new Kt(this['locale'],{'children':[this['_formItem']],'class':[_0x1b2758?'ck-form__row_with-submit':'']});_0x1b2758&&_0x53c881['children']['add'](_0x1b2758),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x53c881]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}},Ja=class AIReviewCorePromptInputView extends _0x512ff1{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x28d513){super(_0x28d513),this['set']('isEmpty',!0x0),this['keystrokes']=new _t(),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']);}},Za=class extends _0x3b0eb8{['focusTracker']=new dt();['keystrokes']=new _t();['focusCycler'];['_focusables']=new _0x554eb4();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0x422fc3,_0x55419f,_0x5039ff=!0x1){super(_0x422fc3),this['_check']=_0x55419f,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x55419f['defaultModel']?_0x55419f['defaultModel']['id']:'',this['_defaultLabel']=_0x55419f['defaultModel']?_0x55419f['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new qt(this['locale'],()=>new Ja(_0x422fc3)),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 ct(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0x5039ff),_0x39a4e4(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new Kt(this['locale'],{'children':[this['promptInputView']]}),new Kt(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x19cdd0,_0x3c6366)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x3c6366()):_0x3c6366();}),this['focusCycler']=new Gt({'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'](_0x556ad3=>{this['_focusables']['add'](_0x556ad3),this['focusTracker']['add'](_0x556ad3['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 _0x15271a of this['_getFormValidators']()){const _0x427d24=_0x15271a();if(_0x427d24)return this['promptInputView']['errorText']=_0x427d24,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return us(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x5c78ca=new Ht(this['locale']),t=this['locale']['t'];return _0x5c78ca['set']({'label':t('Submit'),'withText':!0x0,'class':on}),_0x5c78ca['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x5c78ca;}['_createCancelButtonView'](){const _0x4279b1=new Ht(this['locale']),t=this['locale']['t'];return _0x4279b1['set']({'label':t('Cancel'),'withText':!0x0,'class':hn}),_0x4279b1['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x31d9e9=>{_0x31d9e9['stopPropagation']();})}}),_0x4279b1['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x4279b1;}['_setModelList'](_0x2481ce){this['_modelSelectionDropdownItems']['clear']();const _0x3949b3=this['_check']['models'];if(_0x2481ce)this['set']('modelDisplayMode','hidden');else{const _0x69c04=0x1===_0x3949b3['length'];this['set']('modelDisplayMode',_0x69c04?'name':'selector');}if(this['resetToDefault'](),_0x3949b3?.['length']){0x1===_0x3949b3['length']&&this['set']('activeModelName',_0x3949b3[0x0]['name']||_0x3949b3[0x0]['id']);for(const _0x33c628 of _0x3949b3){const _0x5d4757=new _0x5c4c1e({'label':_0x33c628['name'],'withText':!0x0,'role':'menuitemradio','id':_0x33c628['id'],'model':_0x33c628});_0x5d4757['bind']('isOn')['to'](this,'modelId',_0x5bce20=>_0x5bce20===_0x33c628['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x5d4757,'labelView':new eh(this['locale'],_0x33c628)});}}}['_createModelSelectionDropdown'](){const _0x24bb12=_0x1e2a6d(this['locale']);return _0x24bb12['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x24bb12['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':hn}),_0x24bb12['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x1b96fb=>'selector'===_0x1b96fb),this['listenTo'](_0x24bb12,'execute',_0x3fc06b=>{this['modelId']=_0x3fc06b['source']['model']['id'],_0x24bb12['buttonView']['label']=_0x3fc06b['source']['label'];}),_0x24bb12;}['_createModelNameView'](){const _0x44b2b0=new th(this['locale']);return _0x44b2b0['bind']('text')['to'](this,'activeModelName',_0x4d2243=>_0x4d2243??''),_0x44b2b0['bind']('isVisible')['to'](this,'modelDisplayMode',_0x300188=>'name'===_0x300188),_0x44b2b0;}['_createActionsFooterView'](){const _0x4d8239=new _0x3b0eb8(this['locale']);return _0x4d8239['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']]}]}),_0x4d8239;}},th=class extends _0x3b0eb8{constructor(_0x137980){super(_0x137980),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x34f45b=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x34f45b['if']('isVisible','ck-hidden',_0x23c1c7=>!_0x23c1c7)]},'children':[{'text':_0x34f45b['to']('text')}]});}},eh=class extends Dt{constructor(_0x5e5359,_0x13c9e4){super();const _0x543091=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x543091['to']('style'),'id':_0x543091['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x543091['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x13c9e4['description']||'']}]}]});}},ih=class extends zt{['_formItemsCollection']=new _0x554eb4();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x3e1bd1,_0x2ada16,_0x21b78b,_0x1a6739=!0x1){super(_0x3e1bd1),this['_hideModels']=_0x1a6739,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x2ada16['isParameterized']);const _0x223fea=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',_0x2c946d=>_0x2c946d),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0xfa5a19=>_0xfa5a19)],'style':{'--ck-ai-review-check-list-item-index':_0x21b78b}},'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':_0x2ada16['title']}]},_0x223fea]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x2ada16['description']?[{'text':_0x2ada16['description']}]:[]}]}]},..._0x2ada16['isParameterized']?[this['_createParameterizedView'](_0x2ada16)]:[],...'custom'===_0x2ada16['id']?[this['_createCustomView'](_0x2ada16,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x2ada16['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x2ada16['id'],'args':_0x2ada16['useArgs']?_0x2ada16['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0x45c652({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x291b71=>{_0x291b71['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x193bf2=new Yt();return _0x193bf2['content']=_0x432392,_0x193bf2['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x193bf2;}['_createParameterizedView'](_0xe39496){const _0x3bdd34=new _0x3b0eb8(),_0x13a80d=this['_createFormView'](_0xe39496);return _0x3bdd34['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x5379e9=>!_0x5379e9)]},'children':[_0x13a80d]}),_0x3bdd34;}['_createFormView'](_0x5a3b7e){const _0x4b6dfe=new _0x3b0eb8(),_0x13a226=Array['isArray'](_0x5a3b7e['options'])?_0x5a3b7e['options']:[],_0x24fb4e=new Ht(this['locale']),t=this['locale']['t'];_0x24fb4e['set']({'label':t('Submit'),'withText':!0x0,'class':on}),_0x24fb4e['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x35e776=>{_0x35e776['stopPropagation']();})}}),_0x24fb4e['on']('execute',()=>{const _0x5c46d2=[],_0x565a46={};this['_formItemsCollection']['forEach'](_0xaeffae=>{_0x5c46d2['push'](_0xaeffae['value']),_0x5a3b7e['useArgs']&&_0x5a3b7e['options']&&(_0x565a46[_0xaeffae['argsKey']]=_0xaeffae['value']);}),this['fire']('runReviewCheck',{'id':_0x5a3b7e['id'],'params':_0x5c46d2['length']?_0x5c46d2:void 0x0,'args':Object['keys'](_0x565a46)['length']?_0x565a46:void 0x0});});const _0x406d5c=_0x13a226['length'];return _0x13a226['forEach']((_0x56ebd6,_0x3d16c0)=>{const _0x1ba20c=_0x3d16c0===_0x406d5c-0x1;this['_formItemsCollection']['add'](new ja(this['locale'],_0x56ebd6,_0x1ba20c?_0x24fb4e:null));}),_0x4b6dfe['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x4b6dfe;}['_createCustomView'](_0x4ad486,_0x294cc7=!0x1){return this['_customCheckView']=new Za(this['locale'],_0x4ad486,_0x294cc7),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',_0x380c0f=>!_0x380c0f)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x521154,_0x21dbe7,_0x41508b)=>{_0x41508b||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},sh=class extends zt{['_checkViews'];constructor(_0x3a729d){super(_0x3a729d),this['_checkViews']=new _0x554eb4(),this['_setupTemplate']();}['setChecks'](_0x4d4a13,_0x2af899=!0x1){this['_checkViews']['clear']();for(const [_0x18c376,_0x1b2a47]of _0x4d4a13['entries']()){const _0x8d1c5f=new ih(this['locale'],_0x1b2a47,_0x18c376,_0x2af899);_0x8d1c5f['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x8d1c5f);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x53fdcf of this['_checkViews'])_0x53fdcf instanceof ih&&_0x53fdcf['resetToDefault']();}['_setupTemplate'](){const _0x460dd6=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x460dd6['if']('isVisible','ck-hidden',_0x34337b=>!_0x34337b)]},'children':this['_checkViews']});}},nh=class extends Wa{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x4326c0=this['context']['plugins']['get']('AITabs'),_0xb33253=this['context']['locale'],_0x5f42e2=new Ho(_0xb33253,{'label':us(_0xb33253,'AI_REVIEW_MODE'),'icon':_0x4ddb4d,'class':'ck-ai-header_review','showResizeButton':_0x4326c0['showResizeButton']});return _0x5f42e2['delegate']('resizeTabs')['to'](_0x4326c0),_0x5f42e2['bind']('isMaximized')['to'](_0x4326c0['view'],'isMaximized',_0x4b2cc6=>_0x4b2cc6),new $a(this['context']['locale'],{'header':_0x5f42e2,'list':new sh(_0xb33253),'results':new Qa(_0xb33253,{'generalErrorText':us(_0xb33253,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new Xa(_0xb33253,{'headerText':us(_0xb33253,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':us(_0xb33253,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':us(_0xb33253,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x2365f2=this['context']['plugins']['get']('AITabs');_0x2365f2['view']['on']('activateTab',(_0x2d24c5,{newTab:_0x3aa74a,oldTab:_0x197643})=>{'reviewMode'===_0x3aa74a?this['fire']('getReviewCheckList'):'reviewMode'===_0x197643&&this['fire']('leaveReview');}),_0x2365f2['view']['addTab']({'id':'reviewMode','buttonLabel':us(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x4ddb4d,'order':0x0,'content':this['_mainView']});}};const rh='review-',oh=['softBreak'],ah=['htmlScript','htmlStyle','htmlCustomElement'];var hh=class extends _0xe5ed07{static get['requires'](){return[_0x5d031e,Is];}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(_0x446280){super(_0x446280),this['_domEmitter']=new(lt())(),this['_eventEmitter']=new(ut())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x18f777=_0x524c71=>this['_scheduleAttachReviewEditingToEditor'](_0x524c71);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0xbe1e8b)return void _0x18f777(this['context']);const _0x4c562b=this['context'];for(const _0x3c26a7 of _0x4c562b['editors'])_0x18f777(_0x3c26a7);this['listenTo'](_0x4c562b['editors'],'add',(_0x2104b0,_0x4b3948)=>{_0x18f777(_0x4b3948);}),this['listenTo'](_0x4c562b['editors'],'remove',(_0x98f73b,_0x128e6d)=>{for(const [_0xe72fb7,_0x5b3197]of this['_markers'])_0x5b3197['editor']===_0x128e6d&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0xe72fb7,'changeId':_0x5b3197['groupId']}),this['_markers']['delete'](_0xe72fb7));});}['_scheduleAttachReviewEditingToEditor'](_0x312d3e){const _0xdeb28f=()=>{'destroyed'!==_0x312d3e['state']&&_0x312d3e['conversion']&&this['_attachReviewEditingToEditor'](_0x312d3e);};if('ready'===_0x312d3e['state'])return void _0xdeb28f();const _0x476be6=()=>{this['stopListening'](_0x312d3e,'ready',_0x476be6),_0xdeb28f();};this['listenTo'](_0x312d3e,'ready',_0x476be6);}['_attachReviewEditingToEditor'](_0x5d2138){this['_reviewEditingAttachedEditors']['has'](_0x5d2138)||(_0x5d2138['conversion']['for']('editingDowncast')['markerToElement']({'model':rh+'insert','view':(_0xbc9653,{writer:_0x4ad229})=>{const _0x27add0=this['_markers']['get'](_0xbc9653['markerName']),_0x5bbdad={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x27add0?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0xbc9653['markerName']};return _0x4ad229['createUIElement']('span',_0x5bbdad,function(_0x35e2ec){const _0x2bc04d=this['toDomElement'](_0x35e2ec);return _0x2bc04d['innerHTML']=_0x27add0?.['content']?.['asString']||'',_0x2bc04d;});}}),_0x5d2138['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-only','view':_0x1861bb=>{const _0x5bbf1d=this['_markers']['get'](_0x1861bb['markerName']),_0xe89d38=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x5bbf1d?.['id']||'')&&_0xe89d38['push']('ck-ai_review__change_active'),{'classes':_0xe89d38,'attributes':{'data-marker-id':_0x1861bb['markerName']}};}}),_0x5d2138['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-context','view':_0x1a3c9f=>{const _0x5476ef=this['_markers']['get'](_0x1a3c9f['markerName']),_0x37c1b4=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x5476ef?.['id']||'')&&_0x37c1b4['push']('ck-ai_review__change_active'),{'classes':_0x37c1b4,'attributes':{'data-marker-id':_0x1a3c9f['markerName']}};}}),_0x5d2138['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-text','view':_0x14698a=>{const _0x13f86f=this['_markers']['get'](_0x14698a['markerName']),_0x159dc6=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x13f86f?.['id']||'')&&_0x159dc6['push']('ck-ai_review__change_active'),{'classes':_0x159dc6,'attributes':{'data-marker-id':_0x14698a['markerName']}};}}),_0x5d2138['conversion']['for']('dataDowncast')['markerToElement']({'model':rh+'suggestion-context','view':(_0x4be36a,{writer:_0x49e76b})=>_0x49e76b['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x4be36a['isOpening']?'start':'end')})}),_0x5d2138['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x389bd6,'view':_0x474493}),this['_updateMouseMarkerInteractionListeners'](_0x5d2138),this['listenTo'](_0x5d2138,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x5d2138),{'priority':'lowest'}),this['listenTo'](_0x5d2138,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x5d2138),{'priority':'lowest'}),_0x5d2138['model']['document']['registerPostFixer'](_0x30345f=>this['_validateMarkers'](_0x5d2138,_0x30345f)),_0x5d2138['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x5d2138)),this['_reviewEditingAttachedEditors']['add'](_0x5d2138));}['_updateMouseMarkerInteractionListeners'](_0x4f8235){let _0x2f2e35=this['_boundEditables']['get'](_0x4f8235);_0x2f2e35||(_0x2f2e35=new Map(),this['_boundEditables']['set'](_0x4f8235,_0x2f2e35));const _0xc15a73=new Set(_0x4f8235['ui']['getEditableElementsNames']());for(const _0x22e272 of _0xc15a73){if(_0x2f2e35['has'](_0x22e272))continue;const _0x2b870a=_0x4f8235['ui']['getEditableElement'](_0x22e272);_0x2f2e35['set'](_0x22e272,_0x2b870a),this['_attachMouseMarkerInteractionListeners'](_0x2b870a);}for(const [_0x39cb50,_0x53eb41]of _0x2f2e35)_0xc15a73['has'](_0x39cb50)||(_0x2f2e35['delete'](_0x39cb50),this['_domEmitter']['stopListening'](_0x53eb41));}['_attachMouseMarkerInteractionListeners'](_0x355b3e){this['_domEmitter']['listenTo'](_0x355b3e,'mouseup',(_0x26b2a7,_0x57a117)=>{const _0x1b8900=_0x57a117['target'],_0x42b526=this['_findMarkerElement'](_0x1b8900);if(!_0x42b526)return;const _0x5dbd70=_0x42b526['getAttribute']('data-marker-id'),_0x25d56b=_0x5dbd70['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x5dbd70,'changeId':_0x25d56b,'markerElement':()=>this['_findMarkerElementById'](_0x5dbd70),'domEvent':_0x57a117});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x355b3e,'mouseover',(_0x4dd5b1,_0xfaafa8)=>{const _0x5c106c=_0xfaafa8['target'],_0x5a8aa5=_0xfaafa8['relatedTarget'];let _0x367777=this['_findMarkerElement'](_0x5c106c);if(!_0x367777&&_0x5a8aa5&&(_0x367777=this['_findMarkerElement'](_0x5a8aa5)),!_0x367777)return;const _0x952780=_0x367777['getAttribute']('data-marker-id'),_0x11f0d8=_0x952780['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x11f0d8,'markerElement':()=>this['_findMarkerElementById'](_0x952780),'domEvent':_0xfaafa8});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x13ce22((_0x3bb4c5,_0x5f1ad9)=>{const _0x2fa4ca=_0x5f1ad9['target'];this['_findMarkerElement'](_0x2fa4ca)||_0x2fa4ca['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x5c8834=this['context']['plugins']['get']('AIEditing'),_0x20b9db=ds(this['context']);if(!_0x20b9db['length'])throw new ht('ai-get-editor-from-context-no-editor',this);const _0x5d01ed=new Set(),_0x2bad74=[],_0xe2d85f=new Map();for(const _0x3b75a1 of _0x20b9db)for(const _0x62c54f of _0x3b75a1['model']['document']['getRoots']()){if('$graveyard'===_0x62c54f['rootName'])continue;const _0x4f7969=this['_buildDocumentDataSliceForRoot'](_0x3b75a1,_0x62c54f,_0x5c8834,_0x5d01ed);_0x2bad74['push'](_0x4f7969['content']);for(const [_0x231a9b,_0x18d6d0]of _0x4f7969['elements'])_0xe2d85f['set'](_0x231a9b,_0x18d6d0);}return{'elements':_0xe2d85f,'content':_0x2bad74['join']('')};}['_buildDocumentDataSliceForRoot'](_0xc46515,_0x5755e5,_0x29bd73,_0x47a4a8){const _0x1ecb3e=_0xc46515['model'],_0x5ed2ff=new _0x446730();for(const _0x2226a5 of _0x5755e5['getChildren']())_0x5ed2ff['_appendChild'](_0x2226a5['_clone'](!0x0));for(const _0x3c02e0 of _0x1ecb3e['markers']){const _0x40814f=_0x3c02e0['getRange']();_0x40814f&&_0x40814f['root']['rootName']===_0x5755e5['rootName']&&_0x5ed2ff['markers']['set'](_0x3c02e0['name'],this['_changeRangeOwnerDocument'](_0x40814f['clone'](),_0x5ed2ff));}const _0x7a379=new Map(),_0x5d34c5=_0x1ecb3e['document']['version'],_0x367f08=new _0x4288f8({'ignoreElementEnd':!0x0,'startPosition':_0x1ecb3e['createPositionAt'](_0x5ed2ff,0x0)});for(const {item:_0x47b08b}of _0x367f08){if(_0x47b08b['is']('element')&&_0x47b08b['name']&&ah['includes'](_0x47b08b['name'])){const _0x1e65ff=this['_upsertDataId'](_0x47b08b,()=>_0x29bd73['_nextDataId'](_0x47a4a8));_0x47a4a8['add'](_0x1e65ff);}if(!_0x47b08b['is']('$textProxy'))continue;const _0x19e44c=_0x47b08b['parent'];if(!_0x19e44c||!_0x19e44c['is']('element'))continue;const _0x30250e=this['_upsertDataId'](_0x19e44c,()=>_0x29bd73['_nextDataId'](_0x47a4a8));_0x47a4a8['add'](_0x30250e);for(const _0x3a3367 of _0x19e44c['getChildren']())_0x3a3367['is']('element')&&(_0x3a3367['name']&&oh['includes'](_0x3a3367['name'])||_0x47a4a8['add'](this['_upsertDataId'](_0x3a3367,()=>_0x29bd73['_nextDataId'](_0x47a4a8))));let _0x1b7f6a=_0x19e44c;for(;_0x1b7f6a['parent']&&!_0x1b7f6a['parent']['is']('documentFragment');)_0x1b7f6a=_0x1b7f6a['parent'],_0x1b7f6a['hasAttribute'](_0x389bd6)&&_0x1b7f6a['_removeAttribute'](_0x389bd6);_0x7a379['set'](_0x30250e,{'editor':_0xc46515,'rootName':_0x5755e5['rootName'],'path':_0x19e44c['getPath'](),'documentVersion':_0x5d34c5,'getContent':this['_createGetContentUsingDataIdFn'](_0x1b7f6a['_clone'](!0x0),_0x30250e,_0xc46515['data'])}),_0x367f08['jumpTo'](_0x1ecb3e['createPositionAfter'](_0x19e44c));}return{'content':_0xc46515['data']['processor']['toData'](_0xc46515['data']['toView'](_0x5ed2ff)),'elements':_0x7a379};}['diffContent'](_0x2b9d49,_0xe50fab,_0x467631,_0x5cbe66=!0x1){const {contentInitial:_0x1281a3,contentNew:_0x206c56}=this['_neutralizeChangesOnUnsupportedElements'](_0xe50fab,_0x467631),_0x1e62aa=[],_0x10641f=_0x2b9d49['data']['parse'](_0x206c56,'$documentFragment'),_0x371cdd=_0x2b9d49['data']['parse'](_0x1281a3,'$documentFragment'),_0x2eed47=_0x2b9d49['model']['createPositionAt'](_0x371cdd,0x0);if(this['_haveSingleTopLevelElement'](_0x10641f)){if(!this['_hasSameTopLevelElement'](_0x371cdd,_0x10641f))return _0x1e62aa;}else{const _0x27637d=_0x2b9d49['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x371cdd,_0x27637d)||!this['_haveOnlyInlineContent'](_0x10641f,_0x27637d))return _0x1e62aa;}const _0x5d6e10=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x1281a3,_0x206c56,{'targetEditor':_0x2b9d49,'anchor':_0x2eed47,'markDeletions':!0x0})['getOperations']()['filter'](_0x4274a6=>'insert'===_0x4274a6['type']||'marker'===_0x4274a6['type']&&_0x4274a6['name']['startsWith']('$markedRemove')),_0x379e51=this['_groupAdjacentOperations'](_0x5d6e10),_0x220f8b=[];if(_0x5cbe66){if(_0x379e51['length']){const _0x73cd51=_0x379e51[0x0]['operations'][0x0],_0x3bfc29='insert'===_0x73cd51['type']?_0x73cd51['position']:_0x73cd51['newRange']['start'],_0x2d8384=this['_getPositionLimitingRange'](_0x3bfc29,_0x2b9d49,'inside'),_0x229469=_0x2d8384?_0x10641f['getChild'](0x0)['getChildren']():_0x10641f['getChildren'](),_0x1050ef=_0x2d8384||_0x2b9d49['model']['createRangeIn'](_0x371cdd),_0x74f5b9=[new _0x4fad29('$markedRemove:synthetic'+vt(),null,_0x1050ef,_0x2b9d49['model']['document']['model']['markers'],!0x0,_0x2b9d49['model']['document']['version']+0x1),new _0x25a0c9(_0x1050ef['end'],_0x229469,_0x2b9d49['model']['document']['version']+0x2)];_0x220f8b['push']({'operations':_0x74f5b9,'operationsIsolated':_0x74f5b9,'groupOffset':0x0});}}else _0x220f8b['push'](..._0x379e51);let _0x3c3ad7=0x0;return _0x2b9d49['model']['change'](_0x226c01=>{for(let _0x49720a=0x0;_0x49720a<_0x220f8b['length'];_0x49720a++){const _0x11d6cc=_0x220f8b[_0x49720a],_0x294483=_0x226c01['createDocumentFragment']();for(const _0x40b708 of _0x371cdd['getChildren']())_0x226c01['append'](_0x40b708['_clone'](!0x0),_0x294483);for(const _0x165bd9 of _0x11d6cc['operationsIsolated'])if('insert'===_0x165bd9['type']){const _0xf7b748=_0x165bd9;_0xf7b748['baseVersion']=null,_0xf7b748['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0xf7b748,_0x294483),_0x226c01['batch']['addOperation'](_0x165bd9),_0x2b9d49['model']['applyOperation'](_0x165bd9);const _0x34e772='suggestion:insertion:id:authorId:'+_0x3c3ad7++,_0x29e1cf=_0x2b9d49['model']['createRange'](_0xf7b748['position'],_0xf7b748['position']['getShiftedBy'](_0xf7b748['howMany']));_0x294483['markers']['set'](_0x34e772,_0x29e1cf);}else{if('marker'===_0x165bd9['type']&&_0x165bd9['name']['startsWith']('$markedRemove')){const _0x3acc19=_0x165bd9,_0x35735e='suggestion:deletion:id:authorId:'+_0x3c3ad7++;this['_changeOperationOwnerDocument'](_0x3acc19,_0x294483),_0x294483['markers']['set'](_0x35735e,_0x3acc19['newRange']);}}if(_0x5cbe66)_0x1e62aa['push']({..._0x11d6cc,'context':this['_createGetContentFn'](_0x371cdd,_0x2b9d49['data']),'content':this['_createGetContentFn'](_0x371cdd,_0x2b9d49['data'])});else{const _0x9955cb=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x11d6cc['operationsIsolated'][0x0]),_0x294483),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x11d6cc['operationsIsolated'][_0x11d6cc['operationsIsolated']['length']-0x1]),_0x294483),_0x2b9d49);_0x294483['markers']['set'](rh+'suggestion-context',new _0x34b9eb(_0x9955cb['start'],_0x9955cb['end'])),_0x1e62aa['push']({..._0x11d6cc,'context':this['_createGetContextFn'](_0x294483,_0x2b9d49['data'],{'ellipsisBefore':_0x9955cb['hasContentBefore'],'ellipsisAfter':_0x9955cb['hasContentAfter']}),'content':this['_createGetContentFn'](_0x294483,_0x2b9d49['data'])});}}}),_0x1e62aa;}['markChangePositionInEditorContent'](_0x26a23c,_0x4fcfda){if(!_0x26a23c['length'])return;const _0x1d3afa=_0x26a23c[0x0]['parent']['id'],_0x5c49e3=_0x4fcfda['elements']['get'](_0x1d3afa);if(!_0x5c49e3)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x1d3afa);const _0x51874a=_0x5c49e3['path'],_0x5e5e85=_0x5c49e3['editor'],_0x266959=_0x5e5e85['model']['document']['getRoot'](_0x5c49e3['rootName']);if(!_0x266959)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x5c49e3['rootName']);const _0x1b0a9c=_0x5e5e85['model']['document']['history']['getOperations'](_0x5c49e3['documentVersion']),_0x3ed881=[];for(const _0xbf55d1 of _0x26a23c){const _0x5ce46c=_0xbf55d1['operationsIsolated']['map'](_0x494f64=>this['_translateOperationToEditorContent'](_0x494f64,_0x51874a,_0x266959));if(!_0x5ce46c||!_0x5ce46c['length'])continue;const _0x5cbe12=_0x5ce46c['every'](_0x123e38=>'marker'===_0x123e38['type']&&_0x123e38['name']['startsWith']('$markedRemove')),_0x462417=_0x17dc83(_0x5ce46c,_0x1b0a9c,{'document':_0x5e5e85['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0x3c0337 of _0x462417)if('insert'===_0x3c0337['type']){const _0x57395f=_0x3c0337,_0x2f9bd4=_0x57395f['nodes'];_0x5e5e85['model']['change'](_0x45c196=>{const _0x1b39b5=_0x45c196['createDocumentFragment']();for(const _0xca815d of _0x2f9bd4)_0x45c196['append'](_0xca815d['_clone'](!0x0),_0x1b39b5);_0x3ed881['push']({'start':_0x57395f['position'],'end':_0x57395f['position'],'type':'insert','groupId':_0xbf55d1['id'],'content':{'asString':this['_createGetContentFn'](_0x1b39b5,_0x5e5e85['data'])(),'asFragment':_0x1b39b5}});});}else{if('marker'===_0x3c0337['type']&&_0x3c0337['name']['startsWith']('$markedRemove')){const _0x1e2ab6=_0x3c0337;let _0x213fae='remove-text';if(_0x5cbe12){const _0x20d6c1=this['_findAdjacentContextDistance'](_0x1e2ab6['newRange']['start'],'backward',_0x5e5e85['model']['schema']),_0x43b739=this['_findAdjacentContextDistance'](_0x1e2ab6['newRange']['end'],'forward',_0x5e5e85['model']['schema']);if(_0x20d6c1||_0x43b739){const _0x50c70e=_0x1e2ab6['newRange']['start']['getShiftedBy'](-_0x20d6c1),_0x5e853b=_0x1e2ab6['newRange']['end']['getShiftedBy'](_0x43b739);_0x3ed881['push']({'start':_0x50c70e,'end':_0x5e853b,'groupId':_0xbf55d1['id'],'type':'remove-context'});}else _0x213fae='remove-only';}_0x3ed881['push']({'start':_0x1e2ab6['newRange']['start'],'end':_0x1e2ab6['newRange']['end'],'groupId':_0xbf55d1['id'],'type':_0x213fae});}}}this['_insertMarkers'](_0x3ed881,_0x5e5e85);}['clearAllMarkers'](){const _0xaacc5f=new Map();for(const _0x51bd48 of this['_markers']['keys']()){const _0xe76206=this['_markers']['get'](_0x51bd48);_0xe76206?.['editor']&&(_0xaacc5f['has'](_0xe76206['editor'])||_0xaacc5f['set'](_0xe76206['editor'],[]),_0xaacc5f['get'](_0xe76206['editor'])['push'](_0x51bd48));}for(const [_0x569f0c,_0x2f118e]of _0xaacc5f)_0x569f0c['model']['change'](_0x3a4d89=>{for(const _0x5a9557 of _0x2f118e)_0x569f0c['model']['markers']['get'](_0x5a9557)&&_0x3a4d89['removeMarker'](_0x5a9557);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x14e4b4 of ds(this['context']))_0x14e4b4['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x261fe6 of ds(this['context']))_0x261fe6['disableReadOnlyMode']('ai-review');}['applyChange'](_0x683168,_0x4b305a=null){const _0x5e3a54=_0x683168['map'](_0x2026c7=>this['_getMarkersDataForGroup'](_0x2026c7))['flat'](),_0x4f5966=new Map();for(const _0x2429de of _0x5e3a54)_0x4f5966['has'](_0x2429de['editor'])||_0x4f5966['set'](_0x2429de['editor'],[]),_0x4f5966['get'](_0x2429de['editor'])['push'](_0x2429de);for(const [_0x12daac,_0x56dc4d]of _0x4f5966){const _0x163c7f=_0x12daac['model'],_0xafe237=_0x12daac['plugins']['has']('TrackChangesEditing')?_0x12daac['plugins']['get']('TrackChangesEditing'):null,_0x1d5166=_0x4b305a&&_0xafe237?new Set(_0xafe237['getSuggestions']()['map'](_0x359f51=>_0x359f51['id'])):null;_0x163c7f['change'](_0x5ed8ff=>{const _0x474580=_0x5ed8ff['batch']['operations']['length'];for(const _0xd2a581 of _0x56dc4d){const _0x1fb78f=_0x12daac['model']['markers']['get'](_0xd2a581['id']);if(_0x1fb78f){if('insert'===_0xd2a581['type']){if(!_0xd2a581['content'])continue;_0x163c7f['insertContent'](_0xd2a581['content']['asFragment']||null,_0x1fb78f['getRange']()['start']);}else'remove-text'!==_0xd2a581['type']&&'remove-only'!==_0xd2a581['type']||_0x163c7f['deleteContent'](_0x163c7f['createSelection'](_0x1fb78f['getRange']()));_0x5ed8ff['removeMarker'](_0xd2a581['id']),this['_markers']['delete'](_0xd2a581['id']);}}if(_0x4b305a&&(zs(_0x5ed8ff['batch']['operations']['slice'](_0x474580),_0x4b305a),_0xafe237)){for(const _0x38e6af of _0xafe237['getSuggestions']())_0x1d5166['has'](_0x38e6af['id'])||_0x38e6af['setAttribute']('@ai',{'type':_0x4b305a});}});}}['rejectChange'](_0x227e43){const _0x400e49=this['_getMarkersDataForGroup'](_0x227e43),_0x3f1e5e=new Map();for(const _0x1497c6 of _0x400e49)_0x3f1e5e['has'](_0x1497c6['editor'])||_0x3f1e5e['set'](_0x1497c6['editor'],[]),_0x3f1e5e['get'](_0x1497c6['editor'])['push'](_0x1497c6);for(const [_0x56c91c,_0x1dc7fb]of _0x3f1e5e)_0x56c91c['model']['change'](_0x3d39ea=>{for(const _0xb09cf5 of _0x1dc7fb)_0x3d39ea['removeMarker'](_0xb09cf5['id']),this['_markers']['delete'](_0xb09cf5['id']);});}['getEditor'](){return _s(this['context']);}['getEditors'](){return ds(this['context']);}['getEditorForChange'](_0x9c8539){return this['_getMarkersDataForGroup'](_0x9c8539)[0x0]?.['editor'];}['getMarkerElementForChange'](_0x20d4c1){const _0x3c4daf=Array['from'](this['_markers']['values']())['filter'](_0x8b0a89=>_0x8b0a89['groupId']===_0x20d4c1);if(!_0x3c4daf['length'])return null;const _0x386f29=0x1===_0x3c4daf['length']?_0x3c4daf[0x0]:this['_sortMarkers'](_0x3c4daf)[0x0],_0x2e1d1b=_0x386f29['editor']['model']['markers']['get'](_0x386f29['id']);return _0x2e1d1b?{'modelRange':_0x2e1d1b['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x386f29['id'])}:null;}['getContentElementForChange'](_0x2bf38c){const _0x510242=Array['from'](this['_markers']['values']())['filter'](_0x1126e0=>_0x1126e0['groupId']===_0x2bf38c);if(!_0x510242['length'])return null;const _0x5ce1c9=0x1===_0x510242['length']?_0x510242[0x0]:this['_sortMarkers'](_0x510242)[0x0],_0xa35575=_0x5ce1c9['editor'],_0x2103fe=_0xa35575['model']['markers']['get'](_0x5ce1c9['id']);if(!_0x2103fe)return null;const _0x54ad78=_0x2103fe['getRange'](),_0x593436=_0xa35575['editing']['view']['getDomRoot'](_0x54ad78['root']['rootName'])||_0xa35575['editing']['view']['getDomRoot']();if(!_0x593436||!_0x54ad78)return null;let _0x458d96=_0x54ad78['start']['parent'];for(;_0x458d96['parent']&&!_0x458d96['parent']['is']('rootElement');)_0x458d96=_0x458d96['parent'];if(!_0x458d96||!_0x458d96['name'])return null;const _0x4a3b89=_0x593436['querySelector']('[data-marker-id=\x22'+_0x5ce1c9['id']+'\x22]');if(!_0x4a3b89)return null;let _0x207652=null;_0xa35575['model']['change'](_0x58f0fc=>{_0x207652=_0x58f0fc['createDocumentFragment'](),_0x58f0fc['append'](_0x458d96['_clone'](!0x0),_0x207652);});const _0x37ccc8=_0xa35575['data']['toView'](_0x207652)['getChild'](0x0);return _0x4a3b89['closest'](_0x37ccc8['name']);}['reactivateMarkers'](_0xcf3443){const _0x37e70f=this['_getMarkersDataForGroup'](_0xcf3443);if(!_0x37e70f['length'])return;const _0x429869=Array['from'](this['_activeMarkers'])['sort'](),_0x1a0625=Array['from'](new Set(_0x37e70f['map'](_0x3e6246=>_0x3e6246['id'])))['sort']();_0x429869['join']('|')!==_0x1a0625['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0xcf3443));}['setMarkersInElementAsActive'](_0x2f6050){const _0x10665c=this['_getMarkersDataForGroup'](_0x2f6050);if(!_0x10665c['length'])return;const _0x54ac49=_0x10665c[0x0]['editor'],_0x8cef90=new Set(_0x10665c['map'](_0x1591ff=>_0x1591ff['id'])),_0x29fccb=Array['from'](_0x8cef90['values']())['map'](_0x563df6=>_0x54ac49['model']['markers']['get'](_0x563df6))['filter'](_0x46c0bb=>!!_0x46c0bb);_0x8cef90['forEach'](_0x1d0fbd=>{this['_activeMarkers']['add'](_0x1d0fbd);}),_0x54ac49['model']['change'](()=>{_0x29fccb['forEach'](_0x3da8ff=>{_0x54ac49['editing']['reconvertMarker'](_0x3da8ff);});});}['setAllMarkersAsInactive'](){const _0x23aae3=Array['from'](this['_activeMarkers']);if(!_0x23aae3['length'])return;this['_activeMarkers']['clear']();const _0x447e3d=new Map();for(const _0x30915d of _0x23aae3){const _0x205220=this['_markers']['get'](_0x30915d);if(!_0x205220)continue;const _0x35b211=_0x205220['editor'],_0x3ec4b9=_0x35b211['model']['markers']['get'](_0x30915d);_0x3ec4b9&&(_0x447e3d['has'](_0x35b211)||_0x447e3d['set'](_0x35b211,[]),_0x447e3d['get'](_0x35b211)['push'](_0x3ec4b9));}for(const [_0x490e0b,_0x2cdb5d]of _0x447e3d)_0x490e0b['model']['change'](()=>{_0x2cdb5d['forEach'](_0x5e459e=>{_0x490e0b['editing']['reconvertMarker'](_0x5e459e);});});}['_getPositionLimitingRange'](_0x944d9e,_0x55c61b,_0x2f4729='outside'){if(!_0x944d9e)return null;let _0x4e9bb1=_0x944d9e['parent'];for(;_0x4e9bb1&&_0x4e9bb1['parent']&&!_0x4e9bb1['parent']['is']('rootElement')&&!_0x55c61b['model']['schema']['isLimit'](_0x4e9bb1)&&!_0x55c61b['model']['schema']['isBlock'](_0x4e9bb1);)_0x4e9bb1=_0x4e9bb1['parent'];if(!_0x4e9bb1||!_0x4e9bb1['name']||_0x4e9bb1['is']('rootElement'))return null;let _0x3241bb=null;return _0x55c61b['model']['change'](_0x37c14d=>{_0x3241bb='inside'===_0x2f4729?_0x37c14d['createRangeIn'](_0x4e9bb1):_0x37c14d['createRangeOn'](_0x4e9bb1);}),_0x3241bb;}['_validateMarkers'](_0x526007,_0x5c7e38){const _0x4c9a1a=Array['from'](this['_markers']['keys']()),_0x6a2411=new Map();for(const _0x300c10 of _0x4c9a1a){const _0x5df8e3=_0x526007['model']['markers']['get'](_0x300c10);if(!_0x5df8e3)continue;const _0x376ef9=_0x5df8e3['getStart']()['root']['rootName']+':'+_0x5df8e3['getStart']()['path'][0x0];_0x6a2411['has'](_0x376ef9)||_0x6a2411['set'](_0x376ef9,[]),_0x6a2411['get'](_0x376ef9)['push'](_0x5df8e3);}const _0x421945=new Set();for(const _0x3bc8c6 of _0x526007['model']['document']['differ']['getChanges']()){let _0x3cff6a='',_0x1cb18c=null;if('insert'===_0x3bc8c6['type'])_0x1cb18c=new _0x34b9eb(_0x3bc8c6['position'],_0x3bc8c6['position']['getShiftedBy'](_0x3bc8c6['length'])),_0x3cff6a=_0x3bc8c6['position']['root']['rootName']+':'+_0x3bc8c6['position']['path'][0x0];else{if('remove'!==_0x3bc8c6['type'])continue;_0x1cb18c=new _0x34b9eb(_0x3bc8c6['position']),_0x3cff6a=_0x3bc8c6['position']['root']['rootName']+':'+_0x3bc8c6['position']['path'][0x0];}const _0x1b9f20=_0x6a2411['get'](_0x3cff6a)||[];if(_0x1b9f20['length']){for(const _0x5e3f23 of _0x1b9f20)if(_0x1cb18c['root']['rootName']===_0x5e3f23['getRange']()['root']['rootName']&&('insert'!==_0x3bc8c6['type']||!_0x1cb18c['containsRange'](_0x5e3f23['getRange']()))&&(_0x1cb18c['isIntersecting'](_0x5e3f23['getRange']())||_0x1cb18c['start']['isTouching'](_0x5e3f23['getRange']()['end'])||_0x1cb18c['end']['isTouching'](_0x5e3f23['getRange']()['start']))){const _0x5846ad=this['_parseMarkerName'](_0x5e3f23['name']);Array['from'](this['_markers']['values']())['filter'](_0x207ea3=>_0x207ea3['groupId']===_0x5846ad['groupId'])['forEach'](_0x513ee7=>_0x421945['add'](_0x513ee7['id']));}}}if(_0x421945['size']){for(const _0x37ad9e of _0x421945)_0x5c7e38['removeMarker'](_0x37ad9e);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x2e19f4){for(const {name:_0xa4bdef,data:_0x247dd6}of _0x2e19f4['model']['document']['differ']['getChangedMarkers']()){if(!_0xa4bdef['startsWith'](rh))continue;const _0x363b13=_0x247dd6['oldRange'],_0xd3cb23=_0x247dd6['newRange'],_0x544a34=_0x363b13&&'$graveyard'===_0x363b13['root']['rootName'],_0xbba7eb=_0xd3cb23&&'$graveyard'===_0xd3cb23['root']['rootName'];if(_0x544a34&&_0xbba7eb)continue;const _0x2c614c=this['_parseMarkerName'](_0xa4bdef);this['_markers']['get'](_0xa4bdef)&&(_0xbba7eb||!_0xd3cb23?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0xa4bdef,'changeId':_0x2c614c['groupId']}):_0x544a34&&_0xd3cb23&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0xa4bdef,'changeId':_0x2c614c['groupId']}));}}['_parseMarkerName'](_0x2f87fd){const _0x1e0c81=_0x2f87fd['split'](':'),_0x2cf358=(_0x1e0c81[0x1]||'')['split']('_');return{'prefix':_0x1e0c81[0x0],'groupId':_0x2cf358[0x0],'suffix':_0x2cf358[0x1]};}['_translateOperationToEditorContent'](_0x1229b7,_0x560777,_0x1c00f3){if('insert'===_0x1229b7['type']){const _0x15c6b0=_0x1229b7;return new _0x25a0c9(this['_changePosition'](_0x560777['concat'](_0x15c6b0['position']['offset']),_0x1c00f3),_0x15c6b0['nodes'],_0x15c6b0['baseVersion']);}if('marker'===_0x1229b7['type']&&_0x1229b7['name']['startsWith']('$markedRemove')){const _0x33a36f=_0x1229b7;return new _0x4fad29(_0x33a36f['name'],_0x33a36f['oldRange'],this['_changeRange'](_0x33a36f['newRange'],_0x560777['concat'](_0x33a36f['newRange']['start']['offset']),_0x560777['concat'](_0x33a36f['newRange']['end']['offset']),_0x1c00f3),_0x33a36f['_markers'],_0x33a36f['affectsData'],_0x33a36f['baseVersion']);}return _0x1229b7;}['_groupAdjacentOperations'](_0x472e49){if(!_0x472e49['length'])return[];const _0x6326d1=[];let _0x266540=0x0,_0xf1e6d7=0x0,_0x111b49=[];for(let _0x53f6a7=0x0;_0x53f6a7<=_0x472e49['length'];_0x53f6a7++){const _0x50088e=_0x472e49[_0x53f6a7],_0xdedcb1=_0x472e49[_0x53f6a7-0x1];!_0x50088e||_0xdedcb1&&!this['_getOperationEnd'](_0xdedcb1)['isTouching'](this['_getOperationStart'](_0x50088e))?(_0x6326d1['push']({'operations':_0x111b49,'operationsIsolated':_0x111b49['map'](_0x1f67f4=>this['_shiftOperation'](_0x1f67f4['clone'](),-_0xf1e6d7)),'groupOffset':_0x266540}),_0x111b49=_0x50088e?[_0x50088e]:[],_0xf1e6d7+=_0x266540,_0x266540=0x0):_0x111b49['push'](_0x50088e),_0x50088e&&'insert'===_0x50088e['type']&&(_0x266540+=_0x50088e['howMany']);}return _0x6326d1;}['_findAdjacentContextDistance'](_0xa8a17b,_0x134247,_0x1a983c,_0x444479=0x1){const _0x3d63b0=new _0x4288f8({'startPosition':_0xa8a17b,'direction':_0x134247});let _0x4abba6=0x0;for(let _0x334bb0=0x0;_0x334bb0<_0x444479;_0x334bb0++){let _0x3a3252=0x0,_0x1b41a6=!0x1,_0x221864='forward'===_0x134247?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x37af25}of _0x3d63b0)if(_0x37af25['is']('$textProxy')){const _0x330c33=_0x221864['exec'](_0x37af25['data']);if(_0x330c33&&_0x330c33['length']){if(_0x3a3252+='forward'===_0x134247?_0x330c33['index']+_0x330c33[0x0]['length']:_0x37af25['data']['length']-_0x330c33['index'],_0x330c33[0x0]['length']!==_0x37af25['data']['length'])break;_0x1b41a6=!0x0,_0x221864='forward'===_0x134247?/^\w+/:/\w+$/;}else{if(_0x1b41a6)break;_0x3a3252+=_0x37af25['offsetSize'];}}else{if(_0x37af25['is']('element')){_0x1a983c['isInline'](_0x37af25)&&!_0x1b41a6&&(_0x3a3252+=0x1);break;}}_0x4abba6+=_0x3a3252,_0x3d63b0['jumpTo'](_0xa8a17b['getShiftedBy']('forward'===_0x134247?_0x4abba6:-_0x4abba6));}return _0x4abba6;}['_getChangeContext'](_0xf79a64,_0x4ca50a,_0x96dcd2){const _0x3aefea=_0x96dcd2['model']['schema'],_0x4359b6=this['_findAdjacentContextDistance'](_0xf79a64,'backward',_0x3aefea,0x6),_0x4ee9b7=this['_findAdjacentContextDistance'](_0x4ca50a,'forward',_0x3aefea,0x6),_0x537efe=_0xf79a64['getShiftedBy'](-_0x4359b6),_0xa7a7e9=_0x4ca50a['getShiftedBy'](_0x4ee9b7);return{'start':_0x537efe,'end':_0xa7a7e9,'hasContentBefore':!_0x537efe['isAtStart'],'hasContentAfter':!_0xa7a7e9['isAtEnd']};}['_insertMarkers'](_0x4c10d7,_0x1319ea){const _0x4cdd8c=this['context']['plugins']['get']('AIEditing'),_0x548dd0=new Set();_0x1319ea['model']['change'](_0x440346=>{for(const _0x3cf731 of _0x4c10d7){const _0x1afb5b=''+rh+_0x3cf731['type']+':'+_0x3cf731['groupId']+'_'+_0x4cdd8c['_nextDataId'](_0x548dd0);this['_markers']['set'](_0x1afb5b,{'id':_0x1afb5b,'groupId':_0x3cf731['groupId'],'type':_0x3cf731['type'],'content':_0x3cf731['content'],'editor':_0x1319ea}),_0x440346['addMarker'](_0x1afb5b,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x440346['createRange'](_0x3cf731['start'],_0x3cf731['end'])});}});}['_createGetContextFn'](_0x5d0f67,_0x395a75,_0x11f722){let _0x37ceb6='';return()=>{if(!_0x37ceb6){const _0xbdacb9=_0x395a75['toView'](_0x5d0f67,{'showSuggestionHighlights':!0x0});let _0x20033e=_0xbdacb9['getChild'](0x0);if(_0x20033e['is']('containerElement')||(_0x20033e=_0xbdacb9),!_0x20033e)return'';let _0x1a19f8=!0x1;const _0x5428b3=[];for(const _0x33cf24 of _0x20033e['getChildren']())_0x33cf24['is']('element','span')&&_0x33cf24['hasClass']('ck-ai_review-marker_context-end')&&(_0x1a19f8=!0x1),_0x1a19f8&&_0x5428b3['push'](_0x33cf24),_0x33cf24['is']('element','span')&&_0x33cf24['hasClass']('ck-ai_review-marker_context-start')&&(_0x1a19f8=!0x0);_0x20033e['_removeChildren'](0x0,_0x20033e['childCount']),_0x11f722?.['ellipsisBefore']&&_0x20033e['_appendChild']('…'),_0x20033e['_appendChild'](_0x5428b3),_0x11f722?.['ellipsisAfter']&&_0x20033e['_appendChild']('…');const _0x48ebbd=_0x395a75['htmlProcessor']['domConverter']['viewToDom'](_0xbdacb9),_0x4c3134=_0x395a75['htmlProcessor']['htmlWriter']['getHtml'](_0x48ebbd);_0x37ceb6=this['_removeUnsupportedElements'](_0x4c3134);}return _0x37ceb6;};}['_createGetContentFn'](_0x2cb353,_0x5d89d0){let _0x1cce6c='';return()=>(_0x1cce6c||(_0x1cce6c=this['_removeUnsupportedElements'](_0x5d89d0['stringify'](_0x2cb353,{'showSuggestionHighlights':!0x0}))),_0x1cce6c);}['_createGetContentUsingDataIdFn'](_0x3da079,_0xa79129,_0x1ee160){let _0x5ba495='';return()=>{if(!_0x5ba495){const _0x1f986c=_0x1ee160['toView'](new _0x446730(_0x3da079));_0x5ba495=_0x1ee160['htmlProcessor']['domConverter']['viewToDom'](_0x1f986c)['querySelector']('[data-id=\x22'+_0xa79129+'\x22]')?.['outerHTML']||'';}return _0x5ba495;};}['_removeUnsupportedElements'](_0xd121cd){if(!_0xd121cd)return'';const _0xbe3004=ps(_0xd121cd,{'decodeEntities':!0x1}),_0x33562b=ws(_0xbe3004);if(!_0x33562b['length'])return _0xd121cd;for(const _0x3ebd68 of _0x33562b)_0x8128e7(_0x3ebd68);return ms(_0xbe3004,{'encodeEntities':!0x1});}['_neutralizeChangesOnUnsupportedElements'](_0x10ac76,_0x26f39d){const _0x477f3c=ps(_0x10ac76,{'decodeEntities':!0x1}),_0x76663f=ps(_0x26f39d,{'decodeEntities':!0x1}),_0x3c71a7=ws(_0x477f3c),_0x1cc532=ws(_0x76663f);if(!_0x3c71a7['length']&&!_0x1cc532['length'])return{'contentInitial':_0x10ac76,'contentNew':_0x26f39d};const _0x110709=new Map();for(const _0x34e2b6 of _0x3c71a7)_0x110709['set'](fs(_0x34e2b6,'data-id'),_0x34e2b6);for(const _0x2acd42 of _0x1cc532){const _0x3d9455=fs(_0x2acd42,'data-id'),_0x4c68f0=_0x3d9455?_0x110709['get'](_0x3d9455):void 0x0;_0x4c68f0?_0x297d48(_0x2acd42,_0x16e079(_0x4c68f0,!0x0)):_0x8128e7(_0x2acd42);}return{'contentInitial':ms(_0x477f3c,{'encodeEntities':!0x1}),'contentNew':ms(_0x76663f,{'encodeEntities':!0x1})};}['_findMarkerElement'](_0x40cf91,_0x17ef1b=0x5){let _0x2d440f=_0x40cf91,_0x49ed1c=null;for(let _0x2e83e6=0x0;_0x2e83e6<_0x17ef1b&&_0x2d440f;_0x2e83e6++)if(_0x2d440f['className']){if((''+_0x2d440f['className'])['includes']('ck-ai_review-marker_')){if(!_0x2d440f['getAttribute']('data-marker-id'))break;_0x49ed1c=_0x2d440f;break;}_0x2d440f=_0x2d440f['parentElement'];}else _0x2d440f=_0x2d440f['parentElement'];return _0x49ed1c;}['_findMarkerElementById'](_0x2c3ada){const _0x44c6c8=this['_markers']['get'](_0x2c3ada);if(!_0x44c6c8)return null;const _0xf3d8fb=_0x44c6c8['editor']['model']['markers']['get'](_0x2c3ada);return _0xf3d8fb?_0x2dd8c2(_0x44c6c8['editor']['editing'],_0xf3d8fb):null;}['_getMarkersDataForGroup'](_0x5dab5e){return Array['from'](this['_markers']['values']())['filter'](_0x32a927=>_0x32a927['groupId']===_0x5dab5e);}['_getOperationStart'](_0x208d3f){return'insert'===_0x208d3f['type']?_0x208d3f['position']:_0x208d3f['newRange']['start'];}['_getOperationEnd'](_0x3d6267,_0x5d0159=!0x1){return'insert'===_0x3d6267['type']?_0x5d0159?_0x3d6267['position']:_0x3d6267['position']['getShiftedBy'](_0x3d6267['howMany']):_0x3d6267['newRange']['end'];}['_shiftOperation'](_0x336d23,_0x1afb5a){return'insert'===_0x336d23['type']?_0x336d23['position']=_0x336d23['position']['getShiftedBy'](_0x1afb5a):'marker'===_0x336d23['type']&&_0x336d23['newRange']&&(_0x336d23['newRange']=new _0x34b9eb(_0x336d23['newRange']['start']['getShiftedBy'](_0x1afb5a),_0x336d23['newRange']['end']['getShiftedBy'](_0x1afb5a))),_0x336d23;}['_changeOperationOwnerDocument'](_0x520a18,_0x245666){'insert'===_0x520a18['type']?_0x520a18['position']=this['_changePositionOwnerDocument'](_0x520a18['position'],_0x245666):'marker'===_0x520a18['type']&&_0x520a18['newRange']&&(_0x520a18['newRange']=this['_changeRangeOwnerDocument'](_0x520a18['newRange'],_0x245666));}['_changePositionOwnerDocument'](_0x1a1edc,_0x1c6506){return new _0x3e2549(_0x1c6506,_0x1a1edc['path']);}['_changeRangeOwnerDocument'](_0x4d39bd,_0x25955e){return new _0x34b9eb(this['_changePositionOwnerDocument'](_0x4d39bd['start'],_0x25955e),this['_changePositionOwnerDocument'](_0x4d39bd['end'],_0x25955e));}['_changePosition'](_0x4c8727,_0xfbaef2){return new _0x3e2549(_0xfbaef2,[..._0x4c8727]);}['_changeRange'](_0x155449,_0x37ef34,_0x2b6253,_0x556f37){return new _0x34b9eb(this['_changePosition'](_0x37ef34,_0x556f37),this['_changePosition'](_0x2b6253,_0x556f37));}['_sortMarkers'](_0xe5c6d9){const _0x4b1a25=_0x37be94=>{switch(_0x37be94){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0xe5c6d9['sort']((_0x46ed9c,_0x69df9d)=>_0x4b1a25(_0x46ed9c['type'])-_0x4b1a25(_0x69df9d['type']));}['_hasSameTopLevelElement'](_0x43a975,_0xa8a742){const _0xd91733=_0x43a975['getChild'](0x0),_0x40e746=_0xa8a742['getChild'](0x0);return!(!_0xd91733||!_0x40e746)&&((!_0xd91733['is']('element')||!_0x40e746['is']('element')||_0xd91733['name']===_0x40e746['name'])&&!(_0xd91733['is']('element')&&!_0x40e746['is']('element')||!_0xd91733['is']('element')&&_0x40e746['is']('element')));}['_haveSingleTopLevelElement'](_0x10a111){return 0x1===_0x10a111['childCount'];}['_haveOnlyInlineContent'](_0x40a3ec,_0x39acff){for(const _0x24e9e2 of _0x40a3ec['getChildren']())if(_0x24e9e2['is']('element')&&!_0x39acff['isInline'](_0x24e9e2))return!0x1;return!0x0;}['_upsertDataId'](_0x558a7c,_0x3ffd1c){let _0x206f84=_0x558a7c['getAttribute'](_0x389bd6);return _0x206f84||(_0x206f84=_0x3ffd1c(),_0x558a7c['_setAttribute'](_0x389bd6,_0x206f84)),_0x206f84;}};const ch=/* #__PURE__ -- @preserve */
38
- ut();var lh=class extends ch{['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x6a5a82,contentNew:_0x44b690,contentInitial:_0x327564,documentVersion:_0x439bb4}){super(),this['id']=_0x6a5a82,this['contentNew']=_0x44b690,this['contentInitial']=_0x327564,this['documentVersion']=_0x439bb4;}};const uh=/* #__PURE__ -- @preserve */
39
- gt();var dh=class extends uh{['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x3ed006,_0x139891,_0x53f874){super(),this['id']=_0x3ed006,this['parent']=_0x53f874,this['_data']=_0x139891,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']['slice']();}get['operationsIsolated'](){return this['_data']['operationsIsolated']['slice']();}};const _h=/* #__PURE__ -- @preserve */
40
- gt();var gh=class extends _h{['id']=vt();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x5c620a,_0x8c1e91,_0x1a2752,_0x5a7764,_0x206b96){super(),this['_sourceCheck']=_0x8c1e91,this['_documentData']=_0x5c620a,this['_aiConnector']=_0x1a2752,this['_reviewParams']=_0x5a7764,this['_reviewArgs']=_0x206b96,this['on']('change:status',(_0x27d9bd,_0x426f04,_0x357d30)=>{'aborted'==_0x357d30&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x357d30,'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'](_0x4ca383=>'pending'===_0x4ca383['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0xf2226c){this['_documentData']=_0xf2226c;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0xed320f=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x148c5f of _0xed320f)'unmodified'!==_0x148c5f['data']['operation']&&('error'!==_0x148c5f['data']['operation']?'review-metadata'!==_0x148c5f['event']?this['_addReviewCheckResult'](_0x148c5f['data']['dataId'],_0x148c5f['data']['textDelta']):this['callId']=_0x148c5f['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(_0x7039a2){this['_currentError']=_0x7039a2,en(_0x7039a2)?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'](_0x109f2d,_0x329413){const _0x276a23=this['_results']['get'](_0x109f2d);if(!_0x276a23)return;if(0x0===_0x329413['length'])return;const _0x47becd=[];_0x329413['forEach']((_0x9dd096,_0x1d3b00)=>{const _0x391175=new dh(_0x276a23['id']+'-'+_0x1d3b00,_0x9dd096,_0x276a23);_0x391175['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x391175,'status':_0x391175['status']});}),_0x391175['on']('change:isActivated',()=>{_0x391175['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x391175}):this['fire']('reviewCheckResultDeactivated',{'change':_0x391175});}),this['_changes']['push'](_0x391175),_0x47becd['push'](_0x391175);}),this['fire']('reviewCheckResultReady',{'changes':_0x47becd,'result':_0x276a23,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x30b114){const _0x3a6bba=this['_changes']['find'](_0x4ae547=>_0x4ae547['id']===_0x30b114);return!(!_0x3a6bba||'pending'!==_0x3a6bba['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x4a55b1=>!0x0===_0x4a55b1['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x5f18be=>'pending'===_0x5f18be['status']);}['getChangeById'](_0x3ebc99){return this['_changes']['find'](_0x703c2d=>_0x703c2d['id']===_0x3ebc99);}['markAllChangesAsAccepted'](){for(const _0xf1c54a of this['_changes'])'pending'===_0xf1c54a['status']&&(_0xf1c54a['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0xeae863){const _0x237ee5=this['_changes']['find'](_0x39330c=>_0x39330c['id']===_0xeae863);_0x237ee5&&'pending'===_0x237ee5['status']&&(_0x237ee5['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x30912c){const _0x1fc73c=this['_changes']['find'](_0x1eac36=>_0x1eac36['id']===_0x30912c);_0x1fc73c&&'pending'===_0x1fc73c['status']&&(_0x1fc73c['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x4b5c87){const _0x3d6022=this['_changes']['find'](_0x4dfc7c=>_0x4dfc7c['id']===_0x4b5c87);_0x3d6022&&'pending'===_0x3d6022['status']&&(_0x3d6022['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x1bcf65){const _0x69a24a=this['_changes']['find'](_0x56dfe5=>_0x56dfe5['id']===_0x1bcf65);_0x69a24a&&'outdated'===_0x69a24a['status']&&(_0x69a24a['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x5b69ed){this['_changes']['filter'](_0x311531=>_0x311531['isActivated']&&_0x311531['id']!==_0x5b69ed)['forEach'](_0x1ace47=>{_0x1ace47['isActivated']=!0x1;});const _0x575ec3=this['_changes']['find'](_0x5aa037=>_0x5aa037['id']===_0x5b69ed);_0x575ec3&&'pending'===_0x575ec3['status']&&(_0x575ec3['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x1764ed=>_0x1764ed['isActivated'])['forEach'](_0x5860e1=>{_0x5860e1['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x1e6ad4){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x3c7da4;if(_0x1e6ad4){const _0x3b4b99=this['_changes']['find'](_0x32e1d9=>_0x32e1d9['id']===_0x1e6ad4);if(_0x3b4b99&&_0x3b4b99['isRated'])return;_0x3b4b99&&(_0x3c7da4=_0x3b4b99['parent']['id'],_0x3b4b99['isRated']=!0x0);}const _0x12ddb9={'positiveCount':this['_changes']['filter'](_0x26a2bf=>'accepted'===_0x26a2bf['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x12ddb9,this['callId'],_0x3c7da4);}['_addReviewCheckResult'](_0x3fae45,_0x325a73){const _0x5bb064=this['_documentData']['elements']['get'](_0x3fae45);if(!_0x5bb064)return;const _0x563e3e=_0x5bb064['getContent']();if(_0x563e3e===_0x325a73)return;const _0x97f6cd=new lh({'id':_0x3fae45,'contentInitial':_0x563e3e,'contentNew':_0x325a73,'documentVersion':_0x5bb064['documentVersion']});this['_results']['set'](_0x97f6cd['id'],_0x97f6cd),this['fire']('reviewCheckResultAdded',{'result':_0x97f6cd,'source':this,'editor':_0x5bb064['editor']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0x501af5=>'pending'===_0x501af5['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x4d24d6=>'pending'===_0x4d24d6['status'])['length']&&(this['status']='finished');}},Ah=class extends gh{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x2b11fb=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x32d958=0x0;_0x32d958<this['_reviewParams']['length'];_0x32d958++){if(!this['_reviewParams'][_0x32d958]||!this['_sourceCheck']['options'][_0x32d958])continue;const _0x3b60f6=this['_sourceCheck']['options'][_0x32d958]['data']?.['find'](_0x3a6e42=>_0x3a6e42['id']===this['_reviewParams'][_0x32d958]);_0x3b60f6&&_0x2b11fb['push'](_0x3b60f6['label']);}return _0x2b11fb['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x16349a,_0x56b0f6,_0x4fe362){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x56b0f6,_0x16349a,_0x4fe362);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},Ih=class extends _0xe5ed07{['_aiConnector'];['_aiReviewCoreUi'];['_aiReviewCoreEditing'];['_availableReviewChecks'];['_reporter'];['_currentReviewCheckRun'];['_changeActivationSource']=null;static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_initRequiredPlugins'](),this['_initAvailableReviewChecks'](),this['_initUIListeners']();}async['_initAvailableReviewChecks'](){this['_availableReviewChecks']=await this['_getReviewChecks'](),this['_aiReviewCoreUi']['setAvailableChecks'](this['_availableReviewChecks']);}['_initUIListeners'](){this['listenTo'](this['_aiReviewCoreUi'],'getReviewCheckList',()=>{this['_availableReviewChecks']&&this['_aiReviewCoreUi']['setAvailableChecks'](this['_availableReviewChecks']);}),this['listenTo'](this['_aiReviewCoreUi'],'runReviewCheck',(_0x22b304,_0x391a80)=>this['runCheck'](_0x391a80)),this['listenTo'](this['_aiReviewCoreUi'],'leaveReview',()=>{this['_onReviewRunLeave']();}),this['listenTo'](this['_aiReviewCoreUi'],'leaveReviewCoreResultList',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'abortReviewStream',()=>this['abort']()),this['listenTo'](this['_aiReviewCoreUi'],'finishReview',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'acceptAllChanges',()=>{if(!this['_currentReviewCheckRun'])return;const _0x3c1af1=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x3c1af1['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x3c1af1['map'](_0x9bac3d=>_0x9bac3d['id']),this['_aiSource']);const _0x1002c9=this['_currentReviewCheckRun'];_0x1002c9['markAllChangesAsAccepted'](),_0x1002c9['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x318ad4,_0x221bef)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x221bef['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x221bef['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x221bef['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x221bef['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x3037bd,_0x5b1c8d)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x5b1c8d['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x5b1c8d['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x5b1c8d['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x5b1c8d['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',(_0x3e3e13,_0xe42f9e)=>{this['_onActivateChange'](_0xe42f9e);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x55a71d,_0x3fac98)=>{this['_onDeactivateChange'](_0x3fac98);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x439c27,_0x4733fe)=>{this['_onChangeMarkerClicked'](_0x439c27,_0x4733fe);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0xfb1f5b,_0x2d81f3)=>{this['_onChangeMarkerHovered'](_0xfb1f5b,_0x2d81f3);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x4ea17e,_0x3385e7)=>{this['_onChangeMarkerRemoved'](_0x4ea17e,_0x3385e7);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x41e049,_0x19956f)=>{this['_onChangeMarkerRestored'](_0x41e049,_0x19956f);});}async['runCheck'](_0xad6251){if(!this['_availableReviewChecks'])return;const _0x1c5b54=this['_availableReviewChecks']['find'](_0x51a5ad=>_0x51a5ad['id']===_0xad6251['id']);if(_0x1c5b54){this['_onReviewCheckRun'](_0xad6251),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0xad6251,_0x1c5b54),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x2a098c,_0x30ec9d)=>{switch(_0x30ec9d['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x30ec9d);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 ht('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new ht('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'!==_0x30ec9d['status']&&'error-chunk'!==_0x30ec9d['status']&&'error-general'!==_0x30ec9d['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x2cd33d,_0x5306ae)=>{if(!this['_currentReviewCheckRun'])throw new ht('ai-review-mode-no-current-check-run',this);const _0x378224=this['_diffContent'](_0x5306ae['editor'],_0x5306ae['result']['contentInitial'],_0x5306ae['result']['contentNew']);_0x5306ae['source']['addResultChanges'](_0x5306ae['result']['id'],_0x378224);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x48d0da,_0x48f94f)=>{for(const _0x1bec45 of _0x48f94f['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x1bec45);this['_markChangePositionInEditorContent'](_0x48f94f['changes'],_0x48f94f['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x121818,_0x333e4a)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x333e4a['change']['id'],_0x333e4a['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x11e0be,_0x1321a5)=>{this['_onReviewCheckResultActivated'](_0x1321a5);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x9a7200){if(en(_0x9a7200))return;_0x9a7200 instanceof ht?this['_logError'](_0x9a7200):this['_logError'](new ht('ai-review-mode-check-run-failed',this,void 0x0,_0x9a7200));}}else this['_logError'](new ht('ai-review-mode-source-check-not-found',this,{'checkId':_0xad6251['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return(this['_availableReviewChecks']??[])['slice']();}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0x205f53,_0x2a009f){return new Ah(this['_aiReviewCoreEditing']['getDocumentData'](),_0x2a009f,this['_aiConnector'],_0x205f53['params'],_0x205f53['args']);}['_onChangeMarkerRemoved'](_0x50c39e,_0x4e362b){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x4e362b['changeId']);}['_onChangeMarkerRestored'](_0x1b1fca,_0x581cfe){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x581cfe['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](nn)['createReporter']('aireview');}['_onReviewRunLeave'](_0x12b129=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x12b129&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x13c96c of this['_aiReviewCoreEditing']['getEditors']())_0x13c96c['editing']['view']['change'](_0x370bb7=>{for(const _0x2aa159 of _0x13c96c['editing']['view']['document']['getRoots']())_0x370bb7['removeClass']('ck-ai_review-diff',_0x2aa159),_0x370bb7['removeClass']('ck-ai_review-highlights',_0x2aa159),_0x370bb7['removeClass']('ck-ai-translate-mode-content',_0x2aa159);});}['_logError'](_0x14ffd8){this['_reporter']['logError'](_0x14ffd8),'ai-review-mode-models-unable-to-retrieve'===function(_0x24430a){return _0x24430a instanceof sn?_0x24430a['code']:_0x24430a instanceof Error?_0x24430a['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x14ffd8)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0x3f7a40){if('content'===this['_changeActivationSource']){const _0x104a7d=this['_aiReviewCoreUi']['getChangeElement'](_0x3f7a40);_0x104a7d&&St(_0x104a7d['closest']('.ck-ai_review__check-run-result')||_0x104a7d);}else{if('panel'===this['_changeActivationSource']){const _0x440862=this['_getChangeContentElement'](_0x3f7a40);if(!_0x440862)return;Rt({'target':_0x440862,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},ph=class extends gh{['_prompt'];['_model'];constructor(_0xcf0858,_0x466c3d,_0x5efefb,_0x6b2298,_0x3493a8){super(_0x5efefb,_0x6b2298,_0x3493a8),this['_prompt']=_0xcf0858,this['_model']=_0x466c3d;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x4e2b2d,_0x214b85,_0x4a2d52){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x214b85,_0x4e2b2d,_0x4a2d52);}},mh=class{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x173c7b){this['id']=_0x173c7b['id'],this['commandId']=_0x173c7b['commandId'],this['title']=_0x173c7b['title'],this['description']=_0x173c7b['description'],this['isParameterized']=_0x173c7b['isParameterized'],this['useArgs']=_0x173c7b['useArgs'],this['options']=_0x173c7b['options'],this['args']=_0x173c7b['args'];}},Eh=class extends mh{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x21e042,_0x4e5486,_0x1f8f1a){super(_0x21e042),this['prompt']=_0x21e042['prompt'],this['model']=_0x21e042['model'],this['model']?this['_defaultModel']=_0x4e5486['find'](_0x531843=>_0x531843['id']===this['model'])||null:this['_defaultModel']=_0x1f8f1a;}get['defaultModel'](){return this['_defaultModel'];}},Th=class extends ph{get['subTitle'](){return'';}set['prompt'](_0x1c9787){this['_prompt']=_0x1c9787;}set['model'](_0x4bae4a){this['_model']=_0x4bae4a;}},wh=class extends _0xe5ed07{static get['requires'](){return[ls,nn];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];['_reporter'];['init'](){this['_reporter']=this['context']['plugins']['get'](nn)['createReporter']('aireview');}['getChecksList'](){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}};const Ch=[{'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'}]}]}],fh=/* #__PURE__ -- @preserve */
41
- gt();var bh=class extends fh{['_checks']=[];['setupChecks'](_0x149c39){this['_checks']=_0x149c39['map'](_0x28c780=>new mh(_0x28c780));}get['checks'](){return this['_checks']['slice']();}['getCheckById'](_0x41be93){return this['checks']['find'](_0x4633a1=>_0x4633a1['id']===_0x41be93);}['removeCheckById'](_0x1c5287){this['_checks']=this['_checks']['filter'](_0x2d09b4=>_0x2d09b4['id']!==_0x1c5287);}},Sh=class extends mh{['_models']=[];['_defaultModel']=null;constructor(_0x139da3,_0x4e191c,_0x3ef99d){super(_0x139da3),this['_models']=_0x4e191c,this['_defaultModel']=_0x3ef99d;}get['models'](){return this['_models']['slice']();}get['defaultModel'](){return this['_defaultModel'];}},Rh=class extends bh{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x1ce8b1,_0xa3aaa,_0xaf526a){super(),this['_allModels']=_0x1ce8b1,this['_recommendedModels']=_0xa3aaa,this['_defaultModel']=_0xaf526a;}get['allModels'](){return this['_allModels']['slice']();}['setupChecks'](_0x14193c){this['_checks']=_0x14193c['map'](_0x3b5d12=>!0x0===_0x3b5d12['isExtra']?new Eh(_0x3b5d12,this['_allModels'],this['_defaultModel']):'custom'===_0x3b5d12['id']?new Sh(_0x3b5d12,this['_recommendedModels'],this['_defaultModel']):new mh(_0x3b5d12));}},Oh=class extends wh{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0xea588f){super(_0xea588f),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x5cf6a2=>({'id':_0x5cf6a2['id'],'commandId':_0x5cf6a2['id'],'title':_0x5cf6a2['label'],'description':_0x5cf6a2['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x5cf6a2['prompt'],'model':_0x5cf6a2['model']}));}async['_loadChecksList'](){const _0x24dddc=[...Ch,...this['getExtraChecks']()]['map'](_0x286408=>_0x286408['isExtra']?_0x286408:this['_translateReviewCheck'](_0x286408)),_0x35b293=await this['_getModels'](),_0x46ed07=new Rh(_0x35b293['all'],_0x35b293['recommended'],_0x35b293['default']);return _0x46ed07['setupChecks'](_0x24dddc),_0x46ed07;}async['_getModels'](){const _0x342c69=this['context']['plugins']['get']('AIConnector');try{const _0x10394a=new Qs({'connector':_0x342c69,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0x2269ec={'all':await _0x10394a['getAll'](),'recommended':await _0x10394a['getAvailableModels'](),'default':await _0x10394a['getDefault']()};return this['_modelsLoadError']=null,_0x2269ec;}catch(_0x41d435){return this['_modelsLoadError']=new ht('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x41d435),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x1c0f3d){const _0x552c89='AI_REVIEW_CHECK_'+_0x1c0f3d['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x4f30c1={..._0x1c0f3d,'title':this['_translate'](_0x552c89+'_TITLE',_0x1c0f3d['title']),'description':this['_translate'](_0x552c89+'_DESCRIPTION',_0x1c0f3d['description'])};return _0x1c0f3d['options']&&(_0x4f30c1['options']=_0x1c0f3d['options']['map'](_0x41185e=>({..._0x41185e,'label':this['_translate'](_0x552c89+'_OPTIONS_LABEL',_0x41185e['label']||''),'data':_0x41185e['data']?_0x41185e['data']['map'](_0x610674=>({..._0x610674,'label':this['_translate'](_0x552c89+'_OPTIONS_DATA_'+_0x610674['id']['toUpperCase'](),_0x610674['label'])})):void 0x0}))),_0x4f30c1;}['_translate'](_0x148024,_0xa95eab){const _0x2db8eb=us(this['context']['locale'],_0x148024);return _0x2db8eb===_0x148024?_0xa95eab:_0x2db8eb;}},vh=class extends Ih{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[nn,Oh];}get['_aiSource'](){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0xd6223c){super(_0xd6223c),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',Ch['map'](_0x16c370=>_0x16c370['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x2e4f5b,_0x5d53f4)=>{this['_isDiffOn']=_0x5d53f4['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x3d8290,_0x2fab61){if(_0x3d8290['isCustom'])return new ph(_0x3d8290['args']['prompt'],_0x3d8290['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x2fab61,this['_aiConnector']);if(_0x2fab61['isExtra']){const _0xa43159=_0x2fab61;return new Th(_0x3d8290['args']?.['prompt']??_0xa43159['prompt'],_0x3d8290['args']?.['model']??_0xa43159['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x2fab61,this['_aiConnector']);}return new Ah(this['_aiReviewCoreEditing']['getDocumentData'](),_0x2fab61,this['_aiConnector'],_0x3d8290['params'],_0x3d8290['args']);}['_onReviewCheckResultActivated'](_0x1cc31c){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x1cc31c['change']['id']),this['_scrollToChange'](_0x1cc31c['change']['id']);const _0xbbf72a=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x1cc31c['change']['id']);if(!_0xbbf72a)return;const _0x57dfa6=this['_aiReviewCoreEditing']['getEditorForChange'](_0x1cc31c['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x1cc31c['change'],()=>_0xbbf72a['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x57dfa6,_0xbbf72a['modelRange']['root']['rootName']),_0x57dfa6?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x1cc31c['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x40f8ca){this['_currentReviewCheckRun']&&'click'===_0x40f8ca['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x40f8ca['id']));}['_onDeactivateChange'](_0x388199){this['_currentReviewCheckRun']&&'balloon'===_0x388199['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x18fbbf,_0x1f8650){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x1f8650['changeId']);const _0x296cdf=this['_currentReviewCheckRun']['getChangeById'](_0x1f8650['changeId']);if(!_0x296cdf)return;const _0x2486e3=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x1f8650['changeId']),_0x286942=this['_aiReviewCoreEditing']['getEditorForChange'](_0x1f8650['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x296cdf,_0x1f8650['markerElement'],_0x1f8650['domEvent'],'click',this['_getBalloonDomRoot'](_0x286942,_0x2486e3?.['modelRange']['root']['rootName']),_0x286942?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x5e8bca,_0x299e39){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x4b3d04=this['_currentReviewCheckRun']['getChangeById'](_0x299e39['changeId']);if(!_0x4b3d04)return;const _0x3ee838=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x299e39['changeId']),_0x2f23ad=this['_aiReviewCoreEditing']['getEditorForChange'](_0x299e39['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x4b3d04,_0x299e39['markerElement'],_0x299e39['domEvent'],'hover',this['_getBalloonDomRoot'](_0x2f23ad,_0x3ee838?.['modelRange']['root']['rootName']),_0x2f23ad?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}['_getChangeContentElement'](_0xc7e10a){const _0x364184=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0xc7e10a);return _0x364184?_0x364184['getElement']():null;}['_markChangePositionInEditorContent'](_0x4f9559,_0x50a328){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x4f9559,_0x50a328);}['_diffContent'](_0x7be9bc,_0x579bfc,_0x484723){return this['_aiReviewCoreEditing']['diffContent'](_0x7be9bc,_0x579bfc,_0x484723,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x2bdea9){_0x2bdea9?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x4d378d of this['_aiReviewCoreEditing']['getEditors']())_0x4d378d['editing']['view']['change'](_0x3e317f=>{for(const _0x15acc0 of _0x4d378d['editing']['view']['document']['getRoots']()){for(const _0x20e71d of _0x15acc0['getClassNames']())_0x20e71d['startsWith']('ck-ai_review-')&&_0x3e317f['removeClass'](_0x20e71d,_0x15acc0);_0x3e317f['addClass'](_0x2bdea9?'ck-ai_review-diff':'ck-ai_review-highlights',_0x15acc0);}});}['_getBalloonDomRoot'](_0x38cac6,_0x5b3edf){const _0x5bcad4=_0x38cac6['editing']['view'];if(_0x5b3edf){const _0x587291=_0x5bcad4['getDomRoot'](_0x5b3edf);if(_0x587291)return _0x587291;}return _0x5bcad4['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0x376fdb=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x446503=await _0x376fdb['getChecksList']();_0x376fdb['modelsLoadError']&&this['_logError'](_0x376fdb['modelsLoadError']);let _0x4a45e6=_0x446503['checks'];const _0x52df18=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x52df18,_0x4a45e6),this['_usesAvailableCommandsConfig']&&(_0x4a45e6=_0x52df18['map'](_0xd4e02b=>_0x4a45e6['find'](_0xb07c6d=>_0xb07c6d['id']===_0xd4e02b))['filter'](_0x56e85e=>!!_0x56e85e)),this['_filterChecksWithMissingModel'](_0x4a45e6);}['_logWarningForNonExistentChecks'](_0x4a7f90,_0x5432b9){const _0x2d2de2=_0x4a7f90['filter'](_0x45b222=>!_0x5432b9['some'](_0x1bd3c2=>_0x1bd3c2['id']===_0x45b222));_0x2d2de2['length']&&this['_reporter']['logError'](new sn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x2d2de2['join'](',\x20')}}));}['_filterChecksWithMissingModel'](_0x2c502a){const _0x411267=[];return _0x2c502a['forEach'](_0x1f5896=>{(_0x1f5896 instanceof Eh&&!_0x1f5896['defaultModel']||_0x1f5896 instanceof Sh&&!_0x1f5896['models']['length'])&&_0x411267['push'](_0x1f5896['id']);}),_0x411267['length']&&_0x411267['forEach'](_0x4cd6ef=>{_0x2c502a=_0x2c502a['filter'](_0x15db32=>_0x15db32['id']!==_0x4cd6ef),this['_reporter']['logError'](new sn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x4cd6ef}}));}),_0x2c502a;}};function kh(_0x2e625f,_0x5a5c9e,_0x3bfd77,_0x1eb1f5){return _0x2e625f instanceof ht?_0x2e625f:new ht(_0x5a5c9e,_0x3bfd77,_0x1eb1f5,_0x2e625f);}var Nh=class extends Js{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks']['slice']();}set['affectedBlocks'](_0x40a06){this['_affectedBlocks']=_0x40a06;}},yh=class extends _0xe5ed07{static get['pluginName'](){return'AIReviewGateway';}static get['requires'](){return[hh,Oh,ls,Is,js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAllCommands'](){return(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['map'](_0x34ac84=>{const _0x42b4c8={'id':_0x34ac84['id'],'title':_0x34ac84['title'],'description':_0x34ac84['description']};return'custom'!==_0x34ac84['id']&&_0x34ac84['options']?.['length']&&(_0x42b4c8['parameters']=_0x34ac84['options'][0x0]['data']['map'](_0x2701d4=>({..._0x2701d4}))),_0x42b4c8;});}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['runReview'](_0x2d3c64,_0xd64aa){return await this['_runReviewCheck'](_0x2d3c64,()=>this['_createReviewCheckRun'](_0x2d3c64,_0xd64aa?.['parameterId']),_0xd64aa?.['signal']);}async['runCustomReview'](_0x1ce92f,_0x4e3308){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x1ce92f,_0x4e3308?.['model']),_0x4e3308?.['signal']);}['applyReview'](_0x1a3b50,_0x20eaef){this['context']['plugins']['get']('AIGateway')['apply'](_0x1a3b50,{'applyMethod':_0x20eaef,'aiSource':'review'});}async['_runReviewCheck'](_0x7a5d6,_0x1a2e28,_0x2db81e){const _0x1273cf=_s(this['context']),_0x4b03bf=new Nh({'editor':_0x1273cf,'rootName':_0x1273cf['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x1273cf['plugins']['get']('AIEditing')['getSessionId'](_0x1273cf)});let _0x4e32a2,_0x2968b0;if(_0x2db81e){if(_0x2db81e['aborted'])return _0x4b03bf['abort'](),_0x4b03bf;const _0x3b0bb3=()=>{_0x4b03bf['error']||(_0x4b03bf['abort'](),_0x4e32a2&&_0x4e32a2['abort']());};_0x2db81e['addEventListener']('abort',_0x3b0bb3),_0x2968b0=()=>_0x2db81e['removeEventListener']('abort',_0x3b0bb3);}try{_0x4e32a2=await _0x1a2e28(),_0x4b03bf['contentRawOld']=_0x4e32a2['documentData']['content'],_0x4b03bf['documentVersion']=Array['from'](_0x4e32a2['documentData']['elements'])['find'](([,_0x399259])=>_0x399259['rootName']===_0x4b03bf['rootName'])?.[0x1]['documentVersion']??0x1,_0x4e32a2['on']('reviewCheckRunUpdated',(_0x3c6df2,_0x419dd5)=>{'aborted'===_0x419dd5['status']?_0x4b03bf['abort']():'error-general'!==_0x419dd5['status']&&'error-chunk'!==_0x419dd5['status']||(_0x4b03bf['error']=kh(_0x419dd5['error'],'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x7a5d6}));}),'aborted'!==_0x4b03bf['status']&&await _0x4e32a2['start']();}catch(_0x15b0ab){_0x4b03bf['error']=kh(_0x15b0ab,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x7a5d6});}finally{_0x2968b0&&_0x2968b0();}if(!_0x4e32a2||'aborted'===_0x4b03bf['status']||'error'===_0x4b03bf['status'])return _0x4b03bf;_0x4b03bf['affectedBlocks']=_0x4e32a2['results']['map'](_0x395138=>({'id':_0x395138['id'],'content':_0x395138['contentNew']}));try{_0x4b03bf['contentRawNew']=ms(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x4b03bf['affectedBlocks'],_0x4b03bf['contentRawOld'],_0x4b03bf['editor']));}catch(_0x205d15){_0x4b03bf['error']=kh(_0x205d15,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x7a5d6});}return _0x4b03bf;}async['_createReviewCheckRun'](_0x916bd2,_0x2a484a){const _0x270e0f=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x5c99e7=>_0x5c99e7['id']===_0x916bd2);if(!_0x270e0f)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x916bd2});if(_0x270e0f instanceof Sh)throw new ht('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x916bd2});const _0x478eef=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0xf6df93=this['context']['plugins']['get']('AIConnector');if(_0x270e0f instanceof Eh){if(!_0x270e0f['defaultModel']?.['id'])throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x916bd2});return new Th(_0x270e0f['prompt'],_0x270e0f['defaultModel']['id'],_0x478eef,_0x270e0f,_0xf6df93);}return new Ah(_0x478eef,_0x270e0f,_0xf6df93,_0x2a484a?[_0x2a484a]:void 0x0);}async['_createCustomReviewCheckRun'](_0x2d1e85,_0x4b0e0c,_0x3a1650){const _0x2838ac=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x509a68=>_0x509a68['id']===_0x2d1e85);if(!_0x2838ac)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x2d1e85});if(!(_0x2838ac instanceof Sh))throw new ht('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x2d1e85});const _0x36eb88=_0x3a1650??_0x2838ac['defaultModel']?.['id'];if(!_0x4b0e0c)throw new ht('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x2d1e85});if(!_0x36eb88)throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x2d1e85});return new ph(_0x4b0e0c,_0x36eb88,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x2838ac,this['context']['plugins']['get']('AIConnector'));}},xh=class extends _0xe5ed07{static get['requires'](){return[vh,nh,hh,yh];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startReview'](_0x2e4f18,_0x411679){if(this['assertStartReviewPreconditions'](_0x2e4f18)instanceof Sh)throw new ht('ai-reviewmode-not-a-system-command',this,{'commandId':_0x2e4f18});ka(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x2e4f18,'params':_0x411679?.['parameterId']?[_0x411679['parameterId']]:void 0x0});}async['startCustomReview'](_0x4e9a57,_0x3915ae){if(!_0x4e9a57)throw new ht('ai-reviewmode-missing-custom-command-prompt',this);const _0x48b0d2=Ch['find'](_0x3834b9=>'custom'===_0x3834b9['commandId'])['id'],_0x145ca4=this['assertStartReviewPreconditions'](_0x48b0d2),_0x1baec0=_0x3915ae?.['model']??_0x145ca4['defaultModel']?.['id'];if(!_0x1baec0)throw new ht('ai-reviewmode-missing-custom-command-model',this);ka(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x48b0d2,'isCustom':!0x0,'args':{'prompt':_0x4e9a57,'model':_0x1baec0}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x540f3a=>{const _0x3ab034={'id':_0x540f3a['id'],'title':_0x540f3a['title'],'description':_0x540f3a['description']};return'custom'!==_0x540f3a['id']&&_0x540f3a['options']?.['length']&&(_0x3ab034['parameters']=_0x540f3a['options'][0x0]['data']['map'](_0x61905d=>({..._0x61905d}))),_0x3ab034;});}['assertStartReviewPreconditions'](_0x5b3a3a){const _0x237dff=this['context']['plugins']['get']('AIReviewModeController');if(_0x237dff['getCurrentCheckRun']())throw new ht('ai-reviewmode-review-already-running',this);const _0xe6e857=_0x237dff['getAvailableChecks']()['find'](_0x3a9097=>_0x3a9097['id']===_0x5b3a3a);if(!_0xe6e857)throw new ht('ai-reviewmode-unknown-command',this,{'commandId':_0x5b3a3a});return _0xe6e857;}},Lh=class extends Ah{['_title'];constructor(_0x29c356,_0x55a341,_0x7ce84d,_0x1f9755,_0x1c29b7,_0x13a369){super(_0x29c356,_0x55a341,_0x7ce84d,_0x1c29b7,_0x13a369),this['_title']=_0x1f9755;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}},Dh=class extends mh{get['apiId'](){return'translate';}},Ph=class extends bh{['setupChecks'](_0x189748){this['_checks']=_0x189748['map'](_0x2fab6a=>new Dh(_0x2fab6a));}};const Hh=[{'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'}];var Mh=class extends wh{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x17a854){super(_0x17a854),this['context']['config']['define']('ai.translate.languages',Hh);}async['_loadChecksList'](){const _0x572a2a=[],_0x1ac9be=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x2a040c of _0x1ac9be)_0x572a2a['push']({'title':_0x2a040c['label'],'id':_0x2a040c['id'],'commandId':_0x2a040c['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x2a040c['id']}});const _0x53e2e3=new Ph();return _0x53e2e3['setupChecks'](this['_translateChecks'](_0x572a2a)),_0x53e2e3;}['_translateChecks'](_0x3f4fda){const _0x71d055=this['context']['locale'];return _0x3f4fda['map'](_0x2c7845=>{const _0x39b907='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x2c7845['title']['toUpperCase']()['replaceAll']('-','_'),_0x31736c=us(_0x71d055,_0x39b907);return{..._0x2c7845,'title':_0x31736c===_0x39b907?_0x2c7845['title']:_0x31736c};});}},Vh=class extends Ih{static get['pluginName'](){return'AITranslateController';}static get['requires'](){return[nn,Mh];}get['_aiSource'](){return'translate';}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x34a220,_0x49ec8a){return new Lh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x49ec8a,this['_aiConnector'],us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x34a220['params'],_0x34a220['args']);}['_onReviewCheckResultActivated'](_0x93667a){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x93667a['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x93667a['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x52ecd2){this['_currentReviewCheckRun']&&('hover'===_0x52ecd2['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x52ecd2['id'])),'click'===_0x52ecd2['uiInteraction']&&this['_scrollToChange'](_0x52ecd2['id']));}['_onDeactivateChange'](_0x337464){this['_currentReviewCheckRun']&&'panel'===_0x337464['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x5c30f0,_0x154f3d){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x154f3d['changeId']),this['_scrollToChange'](_0x154f3d['changeId']));}['_onChangeMarkerHovered'](_0x41d957,_0x1302d6){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x1302d6['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x1302d6['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0xa03544){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0xa03544);}['_markChangePositionInEditorContent'](_0x5e5b6d,_0x2f8506){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x5e5b6d,_0x2f8506);}['_diffContent'](_0x5bb5cd,_0x256037,_0x2cb58e){return this['_aiReviewCoreEditing']['diffContent'](_0x5bb5cd,_0x256037,_0x2cb58e,!0x0);}['_onReviewCheckRun'](){for(const _0x3d5d91 of this['_aiReviewCoreEditing']['getEditors']())_0x3d5d91['editing']['view']['change'](_0x297b4d=>{for(const _0x515b08 of _0x3d5d91['editing']['view']['document']['getRoots']())_0x297b4d['addClass']('ck-ai-translate-mode-content',_0x515b08);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},Uh=class extends Qa{constructor(_0x269b30,_0xfa697f){super(_0x269b30,_0xfa697f),this['on']('set:isLoading',(_0x2a8663,_0x4da39c,_0x259e05)=>{_0x259e05&&(this['headerTitle']=us(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x329a54,_0x4cd165,_0x541bab)=>{_0x541bab&&(this['headerTitle']=us(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x2fd897=super['_createAcceptAllButtonView']();return _0x2fd897['set']('label',us(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x2fd897;}['_createExitReviewButtonView'](){const _0xabce6f=super['_createExitReviewButtonView']();return _0xabce6f['set']('label',us(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0xabce6f;}},Bh=class extends sh{['_setupTemplate'](){const _0x37d0ed=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x37d0ed['if']('isVisible','ck-hidden',_0x5f49fd=>!_0x5f49fd)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':us(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':us(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x37d0ed['if']('isVisible','ck-hidden',_0x4e4c6b=>!_0x4e4c6b)]},'children':this['_checkViews']}]});}},Gh=class extends Wa{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x389728=this['context']['plugins']['get']('AITabs'),_0x29749c=this['context']['locale'],_0x390f2d=new Ho(_0x29749c,{'label':us(_0x29749c,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x9c35d8,'class':'ck-ai-header_review-translate','showResizeButton':_0x389728['showResizeButton']});_0x390f2d['delegate']('resizeTabs')['to'](_0x389728),_0x390f2d['bind']('isMaximized')['to'](_0x389728['view'],'isMaximized',_0x2a906e=>_0x2a906e);const _0x288854=new $a(_0x29749c,{'header':_0x390f2d,'list':new Bh(_0x29749c),'results':new Uh(_0x29749c,{'generalErrorText':us(_0x29749c,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new Xa(_0x29749c,{'headerText':us(_0x29749c,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':us(_0x29749c,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':us(_0x29749c,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x288854['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x288854;}['registerTab'](){const _0x2ef371=this['context']['plugins']['get']('AITabs');_0x2ef371['view']['on']('activateTab',(_0x3291f0,{newTab:_0x200a2c,oldTab:_0x511979})=>{'translate'===_0x200a2c?this['fire']('getReviewCheckList'):'translate'===_0x511979&&this['fire']('leaveReview');}),_0x2ef371['view']['addTab']({'id':'translate','buttonLabel':us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x9c35d8,'order':0x0,'content':this['_mainView']});}},Fh=class extends Js{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x67d979){this['_affectedBlocks']=_0x67d979;}},Kh=class extends _0xe5ed07{static get['pluginName'](){return'AITranslateGateway';}static get['requires'](){return[hh,ls,Is,js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['runTranslate'](_0x2e95b9,_0x49f92b){return await this['_runTranslateCheck'](_0x2e95b9,()=>this['_createTranslateCheckRun'](_0x2e95b9),_0x49f92b?.['signal']);}['applyTranslate'](_0x2dc0df,_0x5c3caa){this['context']['plugins']['get']('AIGateway')['apply'](_0x2dc0df,_0x5c3caa);}async['_runTranslateCheck'](_0x4bef4e,_0x3c5789,_0x4a2625){const _0x58e8a5=_s(this['context']),_0x218c72=new Fh({'editor':_0x58e8a5,'rootName':_0x58e8a5['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x58e8a5['plugins']['get']('AIEditing')['getSessionId'](_0x58e8a5)});let _0x340a38,_0x479218;if(_0x4a2625){if(_0x4a2625['aborted'])return _0x218c72['abort'](),_0x218c72;const _0x4885ca=()=>{_0x218c72['error']||(_0x218c72['abort'](),_0x340a38&&_0x340a38['abort']());};_0x4a2625['addEventListener']('abort',_0x4885ca),_0x479218=()=>_0x4a2625['removeEventListener']('abort',_0x4885ca);}try{_0x340a38=await _0x3c5789(),_0x218c72['contentRawOld']=_0x340a38['documentData']['content'],_0x218c72['documentVersion']=Array['from'](_0x340a38['documentData']['elements'])['find'](([,_0x1f1eb0])=>_0x1f1eb0['rootName']===_0x218c72['rootName'])?.[0x1]['documentVersion']??0x1,_0x340a38['on']('reviewCheckRunUpdated',(_0x290938,_0xf30b23)=>{'aborted'===_0xf30b23['status']?_0x218c72['abort']():'error-general'!==_0xf30b23['status']&&'error-chunk'!==_0xf30b23['status']||(_0x218c72['error']=kh(_0xf30b23['error'],'ai-translategateway-translation-run-failed',this,{'language':_0x4bef4e}));}),'aborted'!==_0x218c72['status']&&await _0x340a38['start']();}catch(_0x3455e5){_0x218c72['error']=kh(_0x3455e5,'ai-translategateway-translation-run-failed',this,{'language':_0x4bef4e});}finally{_0x479218&&_0x479218();}if(!_0x340a38||'aborted'===_0x218c72['status']||'error'===_0x218c72['status'])return _0x218c72;_0x218c72['affectedBlocks']=_0x340a38['results']['map'](_0x505d56=>({'id':_0x505d56['id'],'content':_0x505d56['contentNew']}));try{_0x218c72['contentRawNew']=ms(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x218c72['affectedBlocks'],_0x218c72['contentRawOld'],_0x218c72['editor']));}catch(_0x44ac2a){_0x218c72['error']=kh(_0x44ac2a,'ai-translategateway-translation-run-failed',this,{'language':_0x4bef4e});}return _0x218c72;}async['_createTranslateCheckRun'](_0x1f8f29){const _0x1e9c3f=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x1526fb=this['context']['plugins']['get']('AIConnector');return new Lh(_0x1e9c3f,new Dh({'id':_0x1f8f29,'commandId':_0x1f8f29,'title':_0x1f8f29,'description':'','isParameterized':!0x1}),_0x1526fb,us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),void 0x0,{'language':_0x1f8f29});}},Wh=class extends _0xe5ed07{static get['requires'](){return[Vh,Gh,hh,Kh];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startTranslate'](_0x2c7370){const _0x13b5f7=this['assertStartTranslatePreconditions'](_0x2c7370);ka(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0x13b5f7['id'],'args':_0x13b5f7['useArgs']?_0x13b5f7['args']:void 0x0});}['getAvailableLanguages'](){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x487112=>({'id':_0x487112['id'],'label':_0x487112['title']}));}['assertStartTranslatePreconditions'](_0x6ae701){const _0xf36bad=this['context']['plugins']['get']('AITranslateController');if(_0xf36bad['getCurrentCheckRun']())throw new ht('ai-translate-translation-already-running',this);const _0x1a0181=_0xf36bad['getAvailableChecks']()['find'](_0x53d568=>_0x53d568['id']===_0x6ae701);if(!_0x1a0181)throw new ht('ai-translate-unknown-language',this,{'languageId':_0x6ae701});return _0x1a0181;}};export{Ua as AIActions,vi as AIAdapter,Ji as AIAssistant,Xi as AIAssistantUI,la as AIBalloon,ta as AIChat,kn as AIChatController,Hr as AIChatFeedCustomElementView,Zo as AIChatHistory,Jo as AIChatHistoryController,qo as AIChatHistoryUI,fn as AIChatInteraction,na as AIChatShortcuts,Bo as AIChatUI,ls as AIConnector,sn as AICoreError,tn as AIDocumentProcessingGateway,Zs as AIDocumentProcessingRunResult,Is as AIEditing,Aa as AIEditorIntegration,rn as AIErrorReporter,nn as AIErrorSink,js as AIGateway,An as AIInteraction,Ba as AIQuickActions,Oa as AIQuickActionsUI,dn as AIReply,ki as AIRequestError,mh as AIReviewCheck,lh as AIReviewCheckResult,dh as AIReviewCheckResultChange,gh as AIReviewCheckRun,yh as AIReviewGateway,xh as AIReviewMode,Ih as AIReviewModeController,hh as AIReviewModeEditing,nh as AIReviewModeUI,Nh as AIReviewRunResult,Js as AIRunResult,cs as AITabs,hs as AITabsMainView,rs as AITabsView,ts as AITextAdapter,oa as AIToggleButtonUI,Wh as AITranslate,Vh as AITranslateController,Kh as AITranslateGateway,Fh as AITranslateRunResult,Gh as AITranslateUI,is as AWSTextAdapter,es as OpenAITextAdapter,yi as ShowAIAssistantCommand,ra as ToggleAICommand,cn as createResizeButton,Zi as getDefaultAICommands,zs as markOperationsAsAI};
23
+ import{Command as _0x24f2c3,ContextPlugin as _0x5d28a2,Editor as _0x1f7986,Plugin as _0x3688ab,rootAcceptsBlocks as _0x30f76f}from'@ckeditor/ckeditor5-core';import{IconAI as _0x170240,IconAIAdjustLength as _0x4bdbb4,IconAIAskAI as _0x3adddc,IconAIChangeTone as _0xc3c3ab,IconAIChat as _0x4282d3,IconAIChatCommands as _0x573020,IconAIContinueWriting as _0x33e37e,IconAIGrammarCheck as _0xc4a56a,IconAIHistory as _0x5c358f,IconAIImproveWriting as _0x1382e4,IconAIOther as _0x1c72b8,IconAIQuickActions as _0x27a3d4,IconAIReview as _0x5bd10a,IconAITranslate as _0x4dd947,IconBoxWithCheck as _0x3cdc95,IconBoxWithCross as _0x2cae61,IconBoxWithMarker as _0x41c137,IconBrowseFiles as _0x50cb94,IconBulb as _0x1c8883,IconCancel as _0x27af74,IconCheck as _0x27c014,IconChevronDown as _0x13018d,IconChevronRight as _0x1d567d,IconChevronUp as _0x53c774,IconCopy as _0x26f268,IconDocument as _0x97af05,IconDocumentOutline as _0x31a9ab,IconDropdownArrow as _0x20cf00,IconError as _0x340eb9,IconEye as _0x236ceb,IconEyeCrossedOut as _0x2ee912,IconFileUpload as _0x43190a,IconImage as _0xfe36cf,IconInfo as _0x4d8e0c,IconLink as _0x2906fb,IconLoupe as _0x11ac1a,IconMagicWand as _0x3775e2,IconMaximize as _0x14d558,IconMinimize as _0x4df119,IconNextArrow as _0x1a35f7,IconOutdated as _0x4f2173,IconPaperClip as _0x14f9ee,IconPin as _0x1f7bdc,IconPlus as _0x3927b2,IconPreviousArrow as _0x1901d7,IconRefresh as _0xd0bd37,IconRobotPencil as _0x595fc7,IconSelection as _0xc348c2,IconShowChangesOff as tt,IconShowChangesOn as et,IconStop as it,IconSubmit as st,IconThreeHorizontalDots as nt,IconThumbDown as rt,IconThumbUp as ot,IconWeb as at}from'@ckeditor/ckeditor5-icons';import{CKEditorError as ht,Collection as ct,DomEmitterMixin as lt,EmitterMixin as ut,FocusTracker as dt,KeystrokeHandler as _t,ObservableMixin as gt,Rect as At,ResizeObserver as It,_isMotionReduced as pt,first as mt,getConstrainedViewportRect as Et,global as Tt,insertToPriorityArray as wt,isVisible as Ct,logError as ft,logWarning as bt,scrollAncestorsToShowTarget as St,scrollViewportToShowTarget as Rt,toArray as Ot,uid as vt,version as kt}from'@ckeditor/ckeditor5-utils';import{AutocompleteView as Nt,BalloonPanelView as yt,BalloonToolbar as xt,BodyCollection as Lt,ButtonLabelView as Dt,ButtonLabelWithHighlightView as Pt,ButtonView as Ht,Dialog as Mt,DialogViewPosition as Vt,DropdownMenuPanelPositioningFunctions as Ut,FileDialogButtonView as Bt,FocusCycler as Gt,FormHeaderView as Ft,FormRowView as Kt,HighlightedTextView as Wt,IconView as Yt,InputTextView as $t,LabeledFieldView as qt,ListItemButtonView as Qt,ListItemGroupView as Xt,ListItemView as zt,ListView as jt,MenuBarMenuListItemButtonView as Jt,MenuBarMenuListItemView as Zt,MenuBarMenuListView as te,MenuBarMenuView as _0x42746f,SearchTextView as _0x27b4c4,SpinnerView as _0x3a0dfe,TextareaView as _0x5455d5,ToolbarView as _0x116a57,UIModel as _0x24dcce,View as _0x215f6f,ViewCollection as _0x498844,addListToDropdown as _0x1d523e,addMenuToDropdown as _0x24db68,clickOutsideHandler as _0x191c5a,createDropdown as _0x32dc43,createLabeledInputText as _0x4fc470,createLabeledTextarea as _0x30e284,submitHandler as _0x1dbba7}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x3cc194,ClipboardPipeline as _0x4c1dbc}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0x416680,MarkerOperation as _0x11ea10,Matcher as _0x935ec5,ModelDocumentFragment as _0x2868da,ModelPosition as _0x5d12c5,ModelRange as _0x4e8468,ModelTreeWalker as _0x143bbc,ViewDataTransfer as _0x46cc83,ViewDocumentDomEventData as _0x5dfed6,ViewDowncastWriter as _0x17a1b2,ViewUpcastWriter as _0x361177,_DetachOperation as _0x50ba30,_insertIntoModelNodeList as _0x4ec8f8,_removeFromModelNodeList as _0x3c01a8,transformOperationSets as _0x29e916}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x21b61f,debounce as _0x5d2c2e,escape as _0x33f243,escapeRegExp as _0x49ade4,throttle as _0x2150f4,unescape as _0x57857d}from'es-toolkit/compat';import{createParser as _0x239286}from'eventsource-parser';import{CloudServices as _0x545796}from'@ckeditor/ckeditor5-cloud-services';import{ConfirmMixin as _0x3688b4,DATA_ID_MODEL_ATTRIBUTE as _0x5e92a3,DATA_ID_VIEW_ATTRIBUTE as _0x2d4fde,DocumentCompare as _0x1cf5c4,SuggestionsConversion as _0x611eb6,fixElementSuggestionRange as _0x38a66a,getAllMarkersDomElementsSorted as _0x456453,getMarkerDomElement as _0x5e0b30}from'@ckeditor/ckeditor5-collaboration-core';import{parseDocument as _0x1023a2}from'htmlparser2';import{append as _0x218be5,appendChild as _0x1cca13,find as _0x3ced30,findAll as _0x5380b2,findOne as ti,getChildren as _0x5b482f,getParent as _0x38b6f8,isComment as _0xc2cc58,isTag as _0x489441,prepend as _0x201d1c,prependChild as _0x2dfbea,removeElement as _0x2a7599,replaceElement as _0x43a070,textContent as _0x1d60b7}from'domutils';import _0x1dbe92 from'dom-serializer';import{Document as _0x3df49e,Element as _0x1a4ef3,NodeWithChildren as _0x9749e,Text as _0xecc90d,cloneNode as _0x373861,isDocument as _0x1f806c,isText as _0x506b37}from'domhandler';import{MarkdownGfmMdToHtml as _0x3e333d,MarkdownGfmMdToHtmlDefaultPlugins as _0x387a1c}from'@ckeditor/ckeditor5-markdown-gfm';import _0x20d56a from'rehype-sanitize';import _0x312697 from'morphdom';import{diffArrays as _0x118114}from'diff';const fi='_ungrouppedCommands';function bi(_0x3b315e,_0x292931){const _0x2428af=(0x0,_0x292931['t'])('Other');return _0x3b315e['length']?'groupId'in _0x3b315e[0x0]?_0x3b315e:[{'groupId':fi,'groupLabel':_0x2428af,'order':0x1/0x0,'commands':_0x3b315e}]:[{'groupId':fi,'groupLabel':_0x2428af,'order':0x1/0x0,'commands':[]}];}const Si=globalThis['DataTransfer'],Ri='ai-ui';var Oi=class extends _0x3688ab{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x489399}=this,_0x1c602c=['ck-fake-ai-selection'];_0x489399['config']['get']('ai.assistant.useTheme')&&_0x1c602c['push']('ck-ai-assistant-ui_theme'),_0x489399['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Ri,'view':{'classes':_0x1c602c,'priority':0xc}}),_0x489399['conversion']['for']('editingDowncast')['markerToElement']({'model':Ri,'view':(_0x358685,{writer:_0x280018})=>{if(!_0x358685['markerRange']['isCollapsed'])return null;const _0x5459bb=_0x280018['createUIElement']('span');return _0x280018['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x5459bb),_0x5459bb;}});}['afterInit'](){!async function(_0x329860){const _0x1630b9='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x1b28b1=0x78fc0,_0x597aab=window['Date']['now'](),_0x10bcf3=_0x329860['editor'],_0x5afeaa=new window['Promise'](_0x2b68d0=>{_0x10bcf3['once']('ready',_0x2b68d0);}),_0x482d73={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x8b32cf=_0x10bcf3['config']['get']('licenseKey');async function _0x54c08a(){let _0x302725,_0x5623d3=null,_0x35e609=null;try{return'GPL'==_0x8b32cf?'NotAllowed':(_0x302725=_0x1361d6(),_0x302725?(_0x302725['usageEndpoint']&&(_0x35e609=_0x269d18(_0x302725['usageEndpoint'],_0x302725['jti'])),await _0x28b671()?_0x21623d()?_0x1ea366()?'Expired':_0x4c3e04()?('evaluation'==_0x302725['licenseType']&&(_0x5623d3=_0x5b05cd('EvaluationLimit')),await _0x11f220()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x1ea366(){const _0x4c2ae8=['evaluation','trial']['includes'](_0x302725['licenseType'])?_0x597aab/0x3e8:0xe10*_0x1b28b1;return _0x302725['exp']<_0x4c2ae8;}function _0x21623d(){const _0x33bdae=_0x302725['features'];return!!_0x33bdae&&(!!_0x33bdae['includes']('*')||!!_0x33bdae['includes']('AI'));}function _0x4c3e04(){const _0x546bf5=_0x302725['licensedHosts'];if(!_0x546bf5||0x0==_0x546bf5['length'])return!0x0;const {hostname:_0x379ea5}=new URL(window['location']['href']);if(_0x546bf5['includes'](_0x379ea5))return!0x0;const _0x181d0b=_0x379ea5['split']('.');return _0x546bf5['filter'](_0x12ce47=>_0x12ce47['includes']('*'))['map'](_0x453c33=>_0x453c33['split']('.'))['filter'](_0x10e763=>_0x10e763['length']<=_0x181d0b['length'])['map'](_0x48ff43=>Array(_0x181d0b['length']-_0x48ff43['length'])['fill']('*'===_0x48ff43[0x0]?'*':'')['concat'](_0x48ff43))['some'](_0x2c6668=>_0x181d0b['every']((_0x2578d4,_0x1c4955)=>_0x2c6668[_0x1c4955]===_0x2578d4||'*'===_0x2c6668[_0x1c4955]));}function _0x11f220(){return _0x5623d3&&_0x35e609?new window['Promise']((_0x57d237,_0x363f36)=>{_0x5623d3['then'](_0x57d237,_0x363f36),_0x35e609['then'](_0x3ef96e=>{'Valid'!=_0x3ef96e&&_0x57d237(_0x3ef96e);},_0x363f36);}):_0x5623d3||_0x35e609||'Valid';}}function _0x269d18(_0x1384ee,_0x1a9a7d){return new window['Promise'](_0x43ff7f=>{if(_0x51b778())return _0x43ff7f('Valid');_0x282df5(),_0x10bcf3['decorate']('_sendUsageRequest');let _0x17f4c6=!0x1;const _0x59863e=vt();function _0x328df6(_0x3ce702){return!!_0x3ce702&&('object'==typeof _0x3ce702||'function'==typeof _0x3ce702)&&'function'==typeof _0x3ce702['then']&&'function'==typeof _0x3ce702['catch'];}function _0x1732ac(_0x3a2fcd){_0xcf2d37(_0x3a2fcd)['then'](_0x2fb95a=>_0x2fb95a&&'ok'==_0x2fb95a['status']?_0x31d5c8(_0x753373(_0x59863e+_0x1a9a7d))!=_0x2fb95a['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x12eb05=>(_0x472263(),_0x12eb05),()=>{const _0x35abd6=_0x268452();return null==_0x35abd6?(_0x472263(),'Valid'):_0x597aab-_0x35abd6>0x240c8400?'UsageLimit':'Valid';})['then'](_0x43ff7f)['catch'](()=>{_0x43ff7f('UsageLimit');});const _0x23d003=0x36ee80;function _0x472263(){const _0x11487a='llct-'+_0x31d5c8(_0x753373(_0x1384ee)),_0x1358dc=_0x1caf3a(_0x31d5c8(window['Math']['ceil'](_0x597aab/_0x23d003)));window['localStorage']['setItem'](_0x11487a,_0x1358dc);}function _0x268452(){const _0x492a13='llct-'+_0x31d5c8(_0x753373(_0x1384ee)),_0x36cd85=window['localStorage']['getItem'](_0x492a13);return _0x36cd85?window['parseInt'](_0x1caf3a(_0x36cd85),0x10)*_0x23d003:null;}function _0xcf2d37(_0x131da6){return new window['Promise']((_0xc923ef,_0x392866)=>{_0x131da6['then'](_0xc923ef,_0x392866),window['setTimeout'](_0x392866,0x1d4c0);});}}_0x10bcf3['on']('_sendUsageRequest',(_0x2b50b9,_0x1fd30f)=>{if(_0x1fd30f[0x0]!=_0x1384ee)return _0x43ff7f('UsageLimit');_0x1fd30f[0x1]={..._0x1fd30f[0x1],'requestId':_0x59863e};},{'priority':'high'}),_0x10bcf3['on']('_sendUsageRequest',_0x229c46=>{_0x328df6(_0x229c46['return'])&&(_0x17f4c6=!0x0,_0x1732ac(_0x229c46['return']));},{'priority':'low'}),_0x5afeaa['then'](()=>{_0x17f4c6||_0x43ff7f('UsageLimit');});});function _0x51b778(){return'auto'==_0x10bcf3['editing']['view']['_overlayModeHint'];}function _0x282df5(){_0x10bcf3['editing']['view']['_overlayModeHint']='auto';}}function _0x5b05cd(_0x4220e5){const _0x57593d=[new window['Promise'](_0x241055=>setTimeout(_0x241055,0x93ecc)),_0x5afeaa['then'](()=>new window['Promise'](_0x2cb754=>{let _0x510b34=0x0;_0x10bcf3['model']['on']('applyOperation',(_0x312a58,_0x5662ba)=>{_0x5662ba[0x0]['isDocumentOperation']&&_0x510b34++,0x5e8==_0x510b34&&(_0x2cb754(),_0x312a58['off']());});}))];return window['Promise']['race'](_0x57593d)['then'](()=>_0x4220e5);}async function _0x1a25ac(){await _0x5afeaa,_0x10bcf3['model']['change']=_0x258a67,_0x10bcf3['model']['enqueueChange']=_0x258a67,_0x10bcf3['enableReadOnlyMode']('model');}function _0x53bc2d(_0x865c6f){const _0x424d00=_0xd714ec();_0x10bcf3[_0x424d00]='aiLicenseKey'+_0x865c6f,'Valid'!=_0x865c6f&&_0x1a25ac();}function _0xd714ec(){const _0x59f86b=window['String'](window['performance']['now']())['replace']('.','');let _0x10faf7='n';for(let _0x3acc99=0x0;_0x3acc99<_0x59f86b['length'];_0x3acc99+=0x2){let _0x15009a=window['parseInt'](_0x59f86b['substring'](_0x3acc99,_0x3acc99+0x2));_0x15009a>=0x3e&&(_0x15009a-=0x3e),_0x10faf7+=_0x1630b9[_0x15009a];}return _0x10faf7;}function _0x1361d6(){const _0x550f29=_0x8b32cf['split']('.');if(0x3!=_0x550f29['length'])return null;return _0x350e65(_0x550f29[0x1]);function _0x350e65(_0x2168fb){const _0x317c80=_0x10947e(_0x2168fb);return _0x317c80&&_0x53adbf()?_0x317c80:null;function _0x53adbf(){const _0x3c8854=_0x317c80['jti'],_0x435730=window['parseInt'](_0x3c8854['substring'](_0x3c8854['length']-0x8),0x10),_0x41b4b6={..._0x317c80,'jti':_0x3c8854['substring'](0x0,_0x3c8854['length']-0x8)};return delete _0x41b4b6['vc'],_0x753373(_0x41b4b6)==_0x435730;}}}async function _0x28b671(){let _0x20009a=!0x0;try{const [_0x17ba1b,_0x3c047d,_0x345480]=_0x8b32cf['split']('.');return _0x5edafa(_0x17ba1b),await _0x18834b(_0x17ba1b,_0x3c047d,_0x345480),_0x20009a;}catch{return!0x1;}function _0x5edafa(_0x5758e9){const _0x3ae87b=_0x10947e(_0x5758e9);_0x3ae87b&&'ES256'==_0x3ae87b['alg']||(_0x20009a=!0x1);}async function _0x18834b(_0x477dde,_0x1379d3,_0x3522ea){const _0x436cd9=window['Uint8Array']['from'](_0x3246f1(_0x3522ea),_0x25c96a=>_0x25c96a['charCodeAt'](0x0)),_0x1d5615=new window['TextEncoder']()['encode'](_0x477dde+'.'+_0x1379d3),_0x51cb81=window['crypto']['subtle'];if(!_0x51cb81)return;const _0x35d4c5=await _0x51cb81['importKey']('jwk',_0x482d73,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x51cb81['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x35d4c5,_0x436cd9,_0x1d5615)||(_0x20009a=!0x1);}}function _0x10947e(_0x3db679){return _0x3db679['startsWith']('ey')?JSON['parse'](_0x3246f1(_0x3db679)):null;}function _0x3246f1(_0x77b29a){return window['atob'](_0x77b29a['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x753373(_0x40f9eb){let _0xad9c54=0x1505;function _0x18abd7(_0x3d2287){for(let _0x106255=0x0;_0x106255<_0x3d2287['length'];_0x106255++){const _0x3a9d92=_0x3d2287['charCodeAt'](_0x106255);_0xad9c54=(_0xad9c54<<0x5)+_0xad9c54+_0x3a9d92,_0xad9c54&=_0xad9c54;}}function _0x20a3ae(_0x42be40){Array['isArray'](_0x42be40)?_0x42be40['forEach'](_0x20a3ae):_0x42be40&&'object'==typeof _0x42be40?Object['entries'](_0x42be40)['sort']()['forEach'](([_0x5cb533,_0x57864a])=>{_0x18abd7(_0x5cb533),_0x20a3ae(_0x57864a);}):_0x18abd7(window['String'](_0x42be40));}return _0x20a3ae(_0x40f9eb),_0xad9c54>>>0x0;}function _0x31d5c8(_0x475d35){return _0x475d35['toString'](0x10)['padStart'](0x8,'0');}function _0x1caf3a(_0x1c8d98){return _0x1c8d98['split']('')['reverse']()['join']('');}function _0x258a67(){}_0x53bc2d(await _0x54c08a());}(this);}['showFakeVisualSelection'](){const _0x45d90e=this['editor']['model'];_0x45d90e['change'](_0x3a08f9=>{const _0x476f93=_0x45d90e['document']['selection']['getRanges']();let _0x4a353f=0x0;for(const _0x117083 of _0x476f93){const _0x3b0afa=Ri+':'+_0x4a353f;if(_0x45d90e['markers']['has'](_0x3b0afa))_0x3a08f9['updateMarker'](_0x3b0afa,{'range':_0x117083});else{if(_0x117083['start']['isAtEnd']){const _0x31b147=_0x117083['start']['getLastMatchingPosition'](({item:_0x308d91})=>!_0x45d90e['schema']['isContent'](_0x308d91),{'boundaries':_0x117083});_0x3a08f9['addMarker'](_0x3b0afa,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x3a08f9['createRange'](_0x31b147,_0x117083['end'])});}else _0x3a08f9['addMarker'](_0x3b0afa,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x117083});}_0x4a353f++;}});}['hideFakeVisualSelection'](){const _0x346971=this['editor']['model'],_0x50617a=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Ri));_0x50617a['length']&&_0x346971['change'](_0xa9874b=>{_0x50617a['forEach'](_0x2b3255=>{_0xa9874b['removeMarker'](_0x2b3255);});});}['insertContent'](_0x39be8a,_0x56da82){const _0x4a0dfc=this['_getAISelection'](),_0x27bafe=_0x56da82||_0x4a0dfc['getFirstRange']();this['editor']['model']['canEditAt'](_0x27bafe)&&this['editor']['model']['change'](_0x5f1250=>{this['hideFakeVisualSelection'](),_0x56da82||this['_resetContentOfSelectedTableCells'](_0x5f1250,_0x4a0dfc),this['_pasteHTMLUsingClipboard']({'insertAt':_0x27bafe,'writer':_0x5f1250,'html':_0x39be8a});});}['insertContentBelow'](_0x1ca16f){const {model:_0x58e0e1}=this['editor'],_0x5e4d12=this['_getAISelection']();_0x58e0e1['change'](()=>{const _0x4a502a=this['_prepareTableInsertBelowPosition'](_0x1ca16f,_0x5e4d12)||this['_getDefaultInsertBelowPosition'](_0x5e4d12);this['insertContent'](_0x1ca16f,_0x4a502a);});}['_getAISelection'](){const _0x4630d3=this['editor']['model'],_0x1157c4=Array['from'](_0x4630d3['markers']['getMarkersGroup'](Ri))['map'](_0x260c75=>_0x260c75['getRange']());return _0x4630d3['createSelection'](_0x1157c4);}['_pasteHTMLUsingClipboard']({writer:_0x5edd6b,html:_0x3f4673,insertAt:_0x4a4709}){const {view:_0x45efc6}=this['editor']['editing'],_0x324af6=this['editor']['plugins']['get'](_0x4c1dbc),_0x495d3e=new Si();_0x495d3e['setData']('text/html',_0x3f4673);const _0x4f6cad=new _0x5dfed6(_0x45efc6,new ClipboardEvent('paste',{'clipboardData':_0x495d3e}),{'dataTransfer':new _0x46cc83(_0x495d3e)});_0x5edd6b['setSelection'](_0x4a4709);const _0x1e49bb=(_0x1b0b69,_0x2aa89e)=>{_0x2aa89e['resultRange']&&_0x5edd6b['setSelection'](_0x2aa89e['resultRange']);};_0x324af6['once']('contentInsertion',_0x1e49bb,{'priority':'lowest'}),_0x45efc6['document']['fire']('paste',_0x4f6cad),_0x324af6['off']('contentInsertion',_0x1e49bb);}['_getDefaultInsertBelowPosition'](_0x22cb28){const {model:_0x48f6e4}=this['editor'],_0x248d77=Array['from'](_0x22cb28['getSelectedBlocks']());return _0x248d77['length']?_0x48f6e4['createPositionAfter'](_0x248d77['pop']()):_0x22cb28['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x17d36b,_0x335cd2){const {model:_0x11ae76,plugins:_0x4fdce4}=this['editor'];if(_0x4fdce4['has']('TableUtils')){const _0x30d028=_0x4fdce4['get']('TableUtils')['getSelectedTableCells'](_0x335cd2);if(_0x30d028['length']){const _0x542f64=this['_getTableRowCountFromContent'](_0x17d36b),_0x4b6901=this['_createEmptyTableRows'](_0x30d028,_0x542f64);return _0x11ae76['createPositionAt'](_0x4b6901,0x0);}}return null;}['_getTableRowCountFromContent'](_0x197f5f){const _0x517854=this['editor']['plugins']['get']('TableUtils'),_0x3d7181=this['editor']['data']['parse'](_0x197f5f,'$documentFragment'),_0x355724=Array['from'](_0x3d7181['getChildren']())['filter'](_0x1d69c5=>_0x1d69c5['is']('element','table'));let _0x541843=0x0;return _0x355724['forEach'](_0x27d91c=>{_0x541843+=_0x517854['getRows'](_0x27d91c);}),_0x541843;}['_createEmptyTableRows'](_0x2ffc36,_0x4a54d4){const _0x1f9e69=this['editor']['plugins']['get']('TableUtils'),_0xc380e=_0x1f9e69['getRowIndexes'](_0x2ffc36),_0x558fdf=_0x1f9e69['getColumnIndexes'](_0x2ffc36),_0x15e6d6=_0xc380e['last']+0x1,_0x2ef366=_0x558fdf['first'],_0x29170d=_0x2ffc36[0x0]['findAncestor']('table');for(let _0x4a00f7=0x0;_0x4a00f7<_0x4a54d4;_0x4a00f7++)_0x1f9e69['insertRows'](_0x29170d,{'at':_0x15e6d6});return _0x29170d['getChild'](_0x15e6d6)['getChild'](_0x2ef366);}['_resetContentOfSelectedTableCells'](_0x74054,_0x275a9f){const {plugins:_0x5d53f5}=this['editor'],{model:_0x267637}=_0x74054;_0x5d53f5['has']('TableUtils')&&_0x5d53f5['get']('TableUtils')['getSelectedTableCells'](_0x275a9f)['length']&&_0x267637['deleteContent'](_0x275a9f);}},vi=class extends _0x3688ab{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new ht('aiadapter-text-adapter-not-set',null);}},ki=class extends Error{constructor(_0x34608e){super(_0x34608e),this['name']='AIRequestError';}};function Ni(_0x69e469,_0x1d72c5,_0x5c795b){const t=_0x69e469['t'];switch(_0x1d72c5){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',_0x5c795b);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x5c795b);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'},_0x5c795b);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 _0x1d72c5;}}var yi=class extends _0x24f2c3{['_commandDefinitions'];constructor(_0x3b740b,_0x1f8d94){super(_0x3b740b),this['_commandDefinitions']=_0x1f8d94,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x3cc37a,_0x1c8ea1,_0x4c8ecd)=>{this['isEnabled']&&(this['enabledCommandsIds']=xi(this['_commandDefinitions'],_0x4c8ecd));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0xa14906,_0x4ffe92,_0x1aaa83)=>{this['enabledCommandsIds']=_0x1aaa83?xi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x2d7279=this['editor']['model'];this['_hasContext']=function(_0x449ec7){const _0x5b8270=_0x449ec7['document']['selection'];return _0x5b8270['isCollapsed']?0x0!==[..._0x5b8270['getSelectedBlocks']()]['length']&&![..._0x5b8270['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x449ec7['hasContent'](_0x5b8270['getFirstRange']());}(_0x2d7279);const _0x432081=_0x2d7279['document']['selection'],_0x54799b=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x2d6a35 of _0x432081['getRanges']())for(const _0x34bdd7 of _0x2d6a35['getItems']())if(_0x34bdd7['is']('element')&&_0x54799b['includes'](_0x34bdd7['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x996623='',_0x2853fa='',_0x4a77a2='custom'){this['editor']['plugins']['get'](Xi)['showUI'](_0x996623,_0x2853fa,_0x4a77a2);}};function xi(_0x50c602,_0x204f63){const _0x416b9d=new Set();for(const _0x3546ef of _0x50c602['values']())(_0x204f63||!0x1===_0x3546ef['requiresContent'])&&_0x416b9d['add'](_0x3546ef['id']);return Array['from'](_0x416b9d);}const Li=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is'),Di=/* #__PURE__ -- @preserve */
24
+ gt();var Pi=class extends Di{['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x2de2e9,_0x5c7dcd,_0x209394){super(),this['editor']=_0x2de2e9,this['textAdapter']=_0x5c7dcd,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x209394,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x23bbf9,_0x32584f,_0x4e39f8)=>{this['view']['value']=this['_sanitizeHTML'](_0x4e39f8);}),this['listenTo'](this['view'],'submitPrompt',(_0x149a54,_0x2170bc)=>{const _0x4ed6c8=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x2170bc,_0x4ed6c8,'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:_0x35e050,query:_0x65db97,htmlContent:_0x564524,label:_0x4c07ef,mainActionLabel:_0x9b9139}){this['view']['prompt']=_0x4c07ef,this['view']['mainAction']=_0x9b9139,this['initialContext']=_0x564524,_0x65db97&&(this['view']['isRendered']?this['_handleQuery'](_0x65db97,_0x564524,_0x35e050,_0x4c07ef):this['view']['once']('render',()=>{this['_handleQuery'](_0x65db97,_0x564524,_0x35e050,_0x4c07ef);}));}['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'](_0x21c08c,_0x175fbf,_0x2162ed,_0x18b060){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x175fbf,this['previousQuery']=_0x21c08c,this['previousLabel']=_0x18b060||_0x21c08c,this['previousActionId']=_0x2162ed,new Promise(_0x113ec2=>{this['textAdapter']['makeRequest']({'query':_0x21c08c,'context':_0x175fbf,'onData':_0x2a7e80=>{this['currentResponse']=_0x2a7e80,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x2162ed})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x959eee=>{_0x959eee instanceof ki?this['view']['handleError'](_0x959eee['message']):this['view']['handleError'](),_0x113ec2();})['finally'](()=>{this['stopProcessing'](),_0x113ec2();});});}['_parseAndNormalizeContent'](_0x3b2761,_0x2bdbdf=!0x1){const _0x4cc63f=Li['exec'](_0x3b2761);_0x3b2761=_0x4cc63f?_0x3b2761['substring'](_0x4cc63f[0x1]['length']):_0x3b2761['length']<0x64&&!_0x2bdbdf?'':this['_stripMarkdownSyntax'](_0x3b2761);const _0xc9094=this['_domParser']['parseFromString'](_0x3b2761,'text/html');if(_0x4cc63f){const _0xc2b6dd=Array['from'](_0xc9094['body']['childNodes']);_0xc2b6dd['reverse']();for(const _0x40856a of _0xc2b6dd){if(_0x40856a['nodeType']==Node['ELEMENT_NODE'])break;_0x40856a['remove']();}}const _0x2d1150=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0xc9094['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x2d1150);const _0x53c97d=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x3161fa=this['editor']['data']['toModel'](_0x2d1150);return _0x53c97d||_0x3161fa['markers']['clear'](),this['editor']['data']['stringify'](_0x3161fa);}['_normalizeResponseHeadings'](_0x204925){const _0x2fed78=new _0x361177(this['editor']['editing']['view']['document']),_0x12e344=new _0x935ec5({'name':/^h[1-5]$/}),_0x326a17=[];let _0x3e1a09=!0x1;for(const _0x2fff68 of _0x204925)_0x2fff68['is']('element')&&_0x12e344['match'](_0x2fff68)&&(_0x326a17['push'](_0x2fff68),'h1'==_0x2fff68['name']&&(_0x3e1a09=!0x0));if(_0x3e1a09){for(const _0xb505a of _0x326a17)_0x2fed78['rename']('h'+(parseInt(_0xb505a['name'][0x1])+0x1),_0xb505a);}}['_isH1TagSupportEnabled'](){const {data:_0x20c595,editing:_0x5df508}=this['editor'],_0x1d9327=_0x20c595['htmlProcessor']['toView']('<h1></h1>'),_0x3cd87f=_0x20c595['toView'](_0x20c595['toModel'](_0x1d9327));return!!_0x5df508['view']['domConverter']['viewToDom'](_0x3cd87f)['querySelector']('h1');}['_sanitizeHTML'](_0x52996c){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x52996c),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x59533c){const _0xb3326a=_0x59533c['trim']();return _0xb3326a['startsWith']('```html')?_0xb3326a['endsWith']('```')?_0xb3326a['substring'](0x7,_0xb3326a['length']-0x3):_0xb3326a['substring'](0x7):_0x59533c;}};const Hi={'REPLACE':'replace','INSERT':'insert'};var Mi=class extends _0x116a57{constructor(_0xb52c51){super(_0xb52c51),this['set']('isVisible',!0x1),this['set']('mainAction',Hi['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x558d90=>Ni(_0xb52c51,'AI_'+_0x558d90['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Ni(_0xb52c51,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Ni(_0xb52c51,'Try\x20again')),this['stopButton']=this['_createButton'](Ni(_0xb52c51,'Stop'));const _0x39649e=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x39649e['if']('isVisible','ck-hidden',_0x506ccc=>!_0x506ccc)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x5d2679,_0x339ec4){const _0x1f60c8=new Ht(this['locale']);return _0x1f60c8['set']({'label':_0x5d2679,'class':_0x339ec4||'','isVisible':!0x0,'withText':!0x0}),_0x1f60c8;}},Vi=class extends _0x215f6f{['contentFieldView'];['copyButtonView'];constructor(_0x445cb1,_0x3cea2f=''){super(_0x445cb1),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x1bca16=this['bindTemplate'];this['contentFieldView']=new Ui(_0x445cb1,_0x3cea2f),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x1bca16['if']('isVisible','ck-hidden',_0x209f25=>!_0x209f25)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x1bca16['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 _0x5c4c5e=!0x1;this['on']('change:value',(_0x3e94a7,_0x4aa542,_0x43af10)=>{const _0x17550f=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x43af10),this['isProcessing']&&_0x17550f&&!_0x5c4c5e&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x5b658d,_0x3e79ec,_0x1d186c)=>{_0x5c4c5e=!0x1,_0x1d186c?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x5c4c5e=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x5c4c5e=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0xd99891=this['locale'],_0x150b15=new Ht(this['locale']),_0x40c463='ck-ai-form__copy-button';return _0x150b15['set']({'label':Ni(_0xd99891,'Copy'),'icon':_0x26f268,'class':_0x40c463,'tooltip':!0x0}),_0x150b15['bind']('isVisible')['to'](this,'value',_0x345550=>!!_0x345550),_0x150b15['bind']('isEnabled')['to'](this,'isProcessing',_0x576705=>!_0x576705),_0x150b15['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x150b15['icon']=_0x27c014,_0x150b15['class']=_0x40c463+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x150b15['icon']=_0x26f268,_0x150b15['class']=_0x40c463;},0x3e8);}),_0x150b15;}['_copyHTMLToClipboard'](_0x3b3e81){const {window:_0x110ae5,document:_0x173d5b}=Tt;if(_0x110ae5['ClipboardItem']){const {Blob:_0x304bc9,ClipboardItem:_0x45eaef}=_0x110ae5,_0x21fdef=[new _0x45eaef({'text/html':new _0x304bc9([_0x3b3e81['innerHTML']],{'type':'text/html'}),'text/plain':new _0x304bc9([_0x3b3e81['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x21fdef);}else{const _0x294fab=_0x173d5b['createElement']('div');_0x294fab['style']['position']='absolute',_0x294fab['style']['left']='-9999px',_0x294fab['innerHTML']='<span>[</span>'+_0x3b3e81['innerHTML']+'<span>]</span>',_0x173d5b['body']['appendChild'](_0x294fab);const _0x4036b4=_0x173d5b['createRange']();_0x4036b4['setStartAfter'](_0x294fab['firstElementChild']),_0x4036b4['setEndBefore'](_0x294fab['lastElementChild']);const _0x4ebdfc=_0x110ae5['getSelection']();_0x4ebdfc['removeAllRanges'](),_0x4ebdfc['addRange'](_0x4036b4),_0x173d5b['execCommand']('copy'),_0x294fab['remove']();}}},Ui=class extends _0x215f6f{constructor(_0x23b1a4,_0x5ad59e=''){super(_0x23b1a4),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x5ad59e,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x53f1c3){this['element']['innerHTML']=_0x53f1c3;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x28065d=new _0x215f6f(),_0x5db2c0=this['locale'],_0x46e94b=new _0x3a0dfe();return _0x46e94b['isVisible']=!0x0,_0x28065d['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x46e94b,{'text':Ni(_0x5db2c0,'AI\x20is\x20writing...')}]}),_0x28065d['render'](),_0x28065d;}},Bi=class extends _0x215f6f{constructor(_0x4ea770,_0x22e236=''){super(_0x4ea770);const _0x4e59dc=new Yt(),_0x1f4a73=this['bindTemplate'];this['set']('text',_0x22e236),_0x4e59dc['content']=_0x340eb9,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x4e59dc,{'text':_0x1f4a73['to']('text')}]});}},Gi=class extends Nt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x6c3d8f,_0x3a3209){super(_0x6c3d8f,_0x3a3209),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',(_0x4faaf4,_0x3d8783)=>{_0x4faaf4['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x3d8783());});}['_createSubmitButton'](){const _0x4a50e3=new Ht(this['locale']),_0x3f4b3e=this['locale'];return _0x4a50e3['set']({'icon':st,'label':Ni(_0x3f4b3e,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x4a50e3['on']('execute',()=>{this['submit']();}),_0x4a50e3['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x5ad8c0,_0x4effa1)=>!_0x5ad8c0&&_0x4effa1),_0x4a50e3;}['_createShowHistoryButton'](){const _0x2e9248=new Ht(this['locale']),_0x2f6046=this['resultsView'],_0x176505=this['locale'];_0x2e9248['set']({'label':Ni(_0x176505,'History'),'withText':!0x1,'icon':_0x5c358f,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x2e9248['bind']('isOn')['to'](_0x2f6046,'isVisible'),_0x2e9248['bind']('isEnabled')['to'](this,'isEnabled'),_0x2e9248['on']('execute',()=>{_0x2f6046['isVisible']=!_0x2f6046['isVisible'],_0x2f6046['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x3f3638=()=>{Tt['window']['requestAnimationFrame'](()=>{if(Ct(this['element'])){const _0x1d4c53=new At(this['queryView']['fieldView']['element']),_0x5b9095=_0x1d4c53['width'],_0x1e281c='rtl'===_0x176505['uiLanguageDirection']?'left':'right';_0x1d4c53['excludeScrollbarsAndBorders'](),_0x2e9248['element']['style'][_0x1e281c]=_0x5b9095-_0x1d4c53['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x3f3638),this['on']('render',_0x3f3638),_0x2e9248;}['submit'](){const _0x5764f7=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x5764f7);}['focus'](_0x160f0d){-0x1===_0x160f0d?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},Fi=class extends jt{['historyGroupView'];['clearHistoryButton'];constructor(_0x2bf9ee){super(_0x2bf9ee),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Xt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Ni(_0x2bf9ee,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x4b9f6e=0x0;for(const _0x3d0756 of this['items'])_0x4b9f6e+=_0x3d0756['items']['length'];return{'resultsCount':_0x4b9f6e,'totalItemsCount':_0x4b9f6e};}['_createClearHistoryButton'](){const _0x65da43=this['locale'],_0x152297=new Ht(this['locale']);return _0x152297['set']({'label':'('+Ni(_0x65da43,'Clear')+')','withText':!0x0}),_0x152297['on']('execute',()=>this['fire']('clearHistory')),_0x152297;}},Ki=class extends zt{constructor(_0x33a261){super();const _0x538aac=new Dt(),_0x26c2e3=new Ht(this['locale'],_0x538aac);this['children']['add'](_0x26c2e3),_0x26c2e3['set']({'label':_0x33a261['prompt'],'withText':!0x0}),_0x26c2e3['on']('execute',()=>{this['fire']('execute',{'value':_0x57857d(_0x33a261['prompt'])});});}};const Wi='CKEditor/AIFormView/PromptHistory';var Yi=class extends ct{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x47c1dc,_0x5536af)=>{const _0x4bf6d0=$i(_0x5536af['prompt']);for(const _0x33c067 of this)if(_0x33c067!=_0x5536af&&$i(_0x33c067['prompt'])===_0x4bf6d0){this['remove'](_0x33c067);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x19e371=sessionStorage['getItem'](Wi)||'[]';this['addMany'](JSON['parse'](_0x19e371));}['_saveToSessionStorage'](){sessionStorage['setItem'](Wi,JSON['stringify'](this['map'](_0x5cb5d6=>_0x5cb5d6)));}};function $i(_0x4967d5){return _0x4967d5['toLowerCase']()['trim']();}var qi=class extends _0x215f6f{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x2dfc99,_0x186992,_0x33281d=''){super(_0x2dfc99),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',Hi['REPLACE']),this['_promptHistory']=new Yi(),this['errorView']=new Bi(_0x2dfc99),this['contentArea']=new Vi(_0x2dfc99,_0x33281d),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 dt(),this['keystrokes']=new _t(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Gt({'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 _0x530394=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x186992],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x530394['if']('isError','ck-hidden',_0x2f5223=>!_0x2f5223)]},'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'](_0x11b0dc=0x1){-0x1===_0x11b0dc?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 _0x534af2=this['locale'],_0x59d432=new Gi(_0x534af2,{'queryView':{'label':Ni(_0x534af2,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x30e284,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Ni(_0x534af2,'Empty\x20history'),'secondary':Ni(_0x534af2,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x59d432['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x74c521,_0x11582a)=>_0x74c521&&!_0x11582a),this['listenTo'](_0x59d432,'submit',(_0x442115,_0x4754e8)=>{this['prompt']=_0x4754e8;const _0x2b24fa=_0x33f243(_0x4754e8);this['fire']('submitPrompt',_0x2b24fa),_0x4754e8['trim']()&&this['_promptHistory']['add']({'prompt':_0x2b24fa},0x0);},{'priority':'high'}),_0x59d432;}['_createHistoryView'](){const _0xb5c691=new Fi(this['locale']);return _0xb5c691['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Ki),_0xb5c691['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0xb5c691;}['_createToolbar'](){const _0x5ed465=new Mi(this['locale']);return _0x5ed465['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x289ed1,_0x51b7b4,_0x52b98a)=>_0x289ed1&&!_0x51b7b4&&!!_0x52b98a),_0x5ed465['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x5ed465['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x2d56b5,_0x3a056f,_0x4fa0a6)=>_0x2d56b5&&!_0x3a056f&&!!_0x4fa0a6),_0x5ed465['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x5ed465['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x47de1e,_0x506b4f)=>_0x47de1e&&!_0x506b4f),_0x5ed465['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x5ed465['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x5ed465['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x5ed465;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x35022a=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Ni(_0x35022a,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x3f0c77){const _0x473b39=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x3f0c77||Ni(_0x473b39,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const Qi=globalThis['DataTransfer'];var Xi=class extends _0x3688ab{['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[_0x3cc194,Oi,vi,Mt];}constructor(_0x459326){super(_0x459326),_0x459326['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x459326['config']['define']('ai.assistant.contentAreaCssClass',''),_0x459326['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x459326['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x3be6fd}=this;this['_aiAdapter']=_0x3be6fd['plugins']['get'](vi),this['_dialog']=_0x3be6fd['plugins']['get'](Mt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x187080=new yi(_0x3be6fd,Array['from'](this['_commandDefinitions']['values']()));_0x3be6fd['commands']['add']('showAIAssistant',_0x187080),_0x3be6fd['ui']['componentFactory']['add']('aiCommands',_0xe0e1f6=>{const _0x50bcb2=_0x32dc43(_0xe0e1f6);return _0x50bcb2['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x50bcb2['buttonView']['set']({'label':Ni(_0xe0e1f6,'AI\x20Commands'),'icon':_0x3775e2,'tooltip':!0x0}),_0x50bcb2['on']('execute',_0x13aec7=>this['_onExecute'](_0x13aec7['source']['id'])),_0x24db68(_0x50bcb2,_0x3be6fd['ui']['view']['body'],function(_0x3e368f){const _0x310444=ji(_0x3e368f,bi(_0x3e368f['config']['get']('ai.assistant.commands'),_0x3e368f['locale']))['filter'](_0xb6caab=>_0xb6caab['commands']['length']);return 0x1===_0x310444['length']?ji(_0x3e368f,_0x310444[0x0]['commands'])['map'](_0x14e91b=>({'id':_0x14e91b['id'],'label':_0x14e91b['label']})):_0x310444['map'](_0x1ac8ef=>{const {groupId:_0x285228,groupLabel:_0x1a4f3e,commands:_0x453963}=_0x1ac8ef,_0x2986c2=ji(_0x3e368f,_0x453963)['map'](_0x68d111=>({'id':_0x68d111['id'],'label':_0x68d111['label']}));return{'id':_0x285228,'menu':_0x1a4f3e||_0x285228,'children':_0x2986c2};});}(_0x3be6fd),{'ariaLabel':Ni(_0xe0e1f6,'AI\x20Commands')}),_0x50bcb2['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x187080['on']('change:enabledCommandsIds',_0x42d502),_0x50bcb2['menuView']['once']('render',_0x42d502),_0x50bcb2;function _0x42d502(){_0x50bcb2['isEnabled']=_0x187080['enabledCommandsIds']['length']>0x0;for(const _0x3ace52 of _0x50bcb2['menuView']['buttons'])_0x3ace52['isEnabled']=_0x187080['enabledCommandsIds']['includes'](_0x3ace52['id']);}}),_0x3be6fd['ui']['componentFactory']['add']('menuBar:aiCommands',_0x7f7b4d=>{const _0x96cb03=new _0x42746f(_0x7f7b4d);_0x96cb03['buttonView']['set']({'label':Ni(_0x7f7b4d,'AI\x20Commands'),'icon':_0x3775e2}),_0x96cb03['bind']('isEnabled')['to'](_0x187080,'enabledCommandsIds',_0x5b382f=>_0x5b382f['length']>0x0);const _0x3d01f1=bi(_0x3be6fd['config']['get']('ai.assistant.commands'),_0x7f7b4d);return this['_populateMenuBarMenu'](_0x187080,_0x96cb03,_0x3d01f1,_0xa5a32f=>this['_onExecute'](_0xa5a32f)),_0x96cb03;}),_0x3be6fd['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x30384f=this['_createAIAssistantUIButton'](Ht);return _0x30384f['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x30384f;}),_0x3be6fd['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x257220=this['_createAIAssistantUIButton'](Jt);return _0x257220['set']({'role':'menuitemcheckbox'}),_0x257220;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x2317c4=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x199f99;for(const _0x5e55e0 in _0x2317c4){const _0x4a88fd=_0x5e55e0,_0x1b61fe=_0x2317c4[_0x4a88fd];if('aiLicenseKeyValid'==_0x1b61fe||'aiLicenseKeyInvalid'==_0x1b61fe||'aiLicenseKeyExpired'==_0x1b61fe||'aiLicenseKeyDomainLimit'==_0x1b61fe||'aiLicenseKeyNotAllowed'==_0x1b61fe||'aiLicenseKeyEvaluationLimit'==_0x1b61fe||'aiLicenseKeyUsageLimit'==_0x1b61fe){delete _0x2317c4[_0x4a88fd],_0x199f99=_0x1b61fe,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x199f99&&_0x2317c4['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x199f99&&_0x2317c4['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x199f99&&_0x2317c4['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x199f99&&_0x2317c4['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x199f99&&_0x2317c4['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x199f99&&_0x2317c4['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x2283a4='',_0x462bd7='',_0x58297e='custom'){const _0x1865e5=this['editor'],_0x4a7695=_0x1865e5['editing']['view'],_0x416261=_0x1865e5['plugins']['get'](Oi),_0x45b99b=_0x1865e5['plugins']['get'](_0x3cc194);_0x416261['showFakeVisualSelection']();const _0x46d4b3=new Qi(),_0x3c7cde=new ClipboardEvent('copy',{'clipboardData':_0x46d4b3}),_0x2a37bd=new _0x46cc83(_0x46d4b3),_0x76c7e0=new _0x5dfed6(_0x4a7695,_0x3c7cde,{'dataTransfer':_0x2a37bd});_0x45b99b['_forceMarkersCopy']('comment',()=>{_0x4a7695['document']['fire']('copy',_0x76c7e0);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Pi(_0x1865e5,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x3b2c80=_0x2a37bd['getData']('text/html');const _0x342272=_0x1865e5['model']['document']['selection'],_0x24fdbd=Array['from'](_0x342272['getRanges']());0x1===_0x24fdbd['length']&&_0x24fdbd[0x0]['isFlat']&&!_0x342272['getSelectedElement']()&&''!==_0x3b2c80['replace'](/&nbsp;/g,'')['trim']()&&(_0x3b2c80='<p>'+_0x3b2c80+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x58297e,'query':_0x2283a4,'htmlContent':_0x3b2c80,'label':_0x462bd7,'mainActionLabel':Hi[_0x1865e5['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x595fc7,'title':Ni(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Vt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x416261['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x11292e=new Map(),_0x51f8a8=bi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x5dc91d of _0x51f8a8)for(const _0x5960be of _0x5dc91d['commands'])_0x11292e['set'](_0x5960be['id'],{..._0x5960be,'groupId':_0x5dc91d['groupId'],'groupLabel':_0x5dc91d['groupLabel']||_0x5dc91d['groupId']});return _0x11292e;}['_createAIAssistantUIButton'](_0x46ce4e){const _0x4e33f0=this['editor'],_0x369658=_0x4e33f0['commands']['get']('showAIAssistant'),_0x472628=new _0x46ce4e(_0x4e33f0['locale']);return _0x472628['set']({'label':Ni(_0x4e33f0['locale'],'AI\x20Assistant'),'icon':_0x595fc7,'isToggleable':!0x0}),_0x472628['bind']('isEnabled')['to'](_0x369658),_0x472628['bind']('isOn')['to'](this['_dialog'],'id',_0x3590d8=>'aiAssistant'===_0x3590d8),this['listenTo'](_0x472628,'execute',()=>{_0x472628['isOn']?this['hideUI']():_0x369658['execute']();}),_0x472628;}['_initView'](){const _0x4be033=this['editor']['plugins']['get'](Oi);this['_formView']=new qi(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',()=>{_0x4be033['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x4be033['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x273eaa,ui:{ariaLiveAnnouncer:_0x595e49}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x1e8d3f,_0x3ef78c,_0x4f37b2)=>{const _0x220f50=this['_aiAssistantController']['currentContext'];_0x4f37b2?_0x595e49['announce'](Ni(_0x273eaa,'AI\x20is\x20writing')):_0x220f50&&_0x595e49['announce'](Ni(_0x273eaa,'Generated\x20content:\x20%0',_0x220f50),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x53050b,_0x57e30e,_0x23dc82)=>{if(_0x23dc82){const _0x32728e=this['_formView']['errorView']['text'];_0x595e49['announce'](Ni(_0x273eaa,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x32728e));}});}['_onExecute'](_0xa7fd5f){const _0x4daeba=this['_commandDefinitions']['get'](_0xa7fd5f),_0xf9112=this['editor'],_0x47ae49=_0xf9112['model']['document']['selection'],_0x2dbdba=_0xf9112['commands']['get']('showAIAssistant'),_0x426fbf=_0xf9112['plugins']['get'](Oi),_0x294781=''+('_ungrouppedCommands'!==_0x4daeba['groupId']?_0x4daeba['groupLabel']+':\x20':'')+_0x4daeba['label'];if(!0x1!==_0x4daeba['requiresContent']&&_0x47ae49['isCollapsed']){const _0x24c4cb=mt(_0x47ae49['getSelectedBlocks']())||_0xf9112['model']['schema']['getLimitElement'](_0x47ae49);_0xf9112['model']['change'](_0x50e368=>{_0x50e368['setSelection'](_0x24c4cb,'in');});}_0x426fbf['showFakeVisualSelection'](),_0x2dbdba['execute'](_0x4daeba['prompt'],_0x294781,'command:'+_0xa7fd5f);}['_populateMenuBarMenu'](_0x4d4595,_0x4f4296,_0xd7fa3d,_0x5baa6b){const _0x73ff1d=this['editor'],_0x438ea4=_0x73ff1d['locale'],_0x311777=new te(_0x438ea4),_0xbdf268=ji(_0x73ff1d,_0xd7fa3d)['filter'](_0x54b605=>_0x54b605['commands']['length']);0x1===_0xbdf268['length']?this['_getMenuBarGroupButtons']({'command':_0x4d4595,'commands':_0xbdf268[0x0]['commands'],'parentMenuView':_0x4f4296,'onExecute':_0x5baa6b})['forEach'](_0x4d1209=>_0x311777['items']['add'](_0x4d1209)):_0xbdf268['forEach'](({groupId:_0x420012,groupLabel:_0x51d028,commands:_0x45d2f4})=>{const _0x45aa50=new Zt(_0x438ea4,_0x4f4296),_0x27f27f=new _0x42746f(_0x438ea4),_0x24d376=new te(_0x438ea4),_0x775bc2=this['_getMenuBarGroupButtons']({'command':_0x4d4595,'commands':_0x45d2f4,'parentMenuView':_0x27f27f,'onExecute':_0x5baa6b});_0x27f27f['buttonView']['set']({'label':_0x51d028||_0x420012}),_0x27f27f['delegate']('execute')['to'](_0x4f4296),_0x24d376['items']['addMany'](_0x775bc2),_0x27f27f['panelView']['children']['add'](_0x24d376),_0x45aa50['children']['add'](_0x27f27f),_0x311777['items']['add'](_0x45aa50);}),_0x4f4296['panelView']['children']['add'](_0x311777);}['_getMenuBarGroupButtons']({command:_0x54548c,commands:_0x204385,parentMenuView:_0x52a180,onExecute:_0x3e9a73}){const _0x285e33=this['editor'],_0x3f5869=_0x285e33['locale'];return ji(_0x285e33,_0x204385)['map'](_0x39acb6=>{const _0x3516eb=new Zt(_0x3f5869,_0x52a180),_0x42615b=new Jt(_0x3f5869);return _0x42615b['set']({'label':_0x39acb6['label']}),_0x42615b['delegate']('execute')['to'](_0x52a180),_0x42615b['on']('execute',()=>_0x3e9a73(_0x39acb6['id'])),_0x42615b['bind']('isEnabled')['to'](_0x54548c,'enabledCommandsIds',_0x3d5aaa=>_0x3d5aaa['includes'](_0x39acb6['id'])),_0x3516eb['children']['add'](_0x42615b),_0x3516eb;});}};function zi(_0x4297f8,_0x15f3bb){return void 0x0!==_0x4297f8['order']&&void 0x0===_0x15f3bb['order']?0x1:void 0x0===_0x4297f8['order']&&void 0x0!==_0x15f3bb['order']?-0x1:void 0x0!==_0x4297f8['order']&&void 0x0!==_0x15f3bb['order']?_0x4297f8['order']-_0x15f3bb['order']:0x0;}function ji(_0x1d3a54,_0x1c5f01){_0x1c5f01['sort'](zi);const _0x2c0ba5={},_0x4e21ea=[];for(const _0x2eba57 of _0x1c5f01)if(void 0x0!==_0x2eba57['order']){if(_0x2eba57['order']in _0x2c0ba5)throw new ht('ai-commands-config-order-collision',_0x1d3a54,{'conflictingDefinitions':[_0x2eba57,_0x2c0ba5[_0x2eba57['order']]]});_0x2c0ba5[_0x2eba57['order']]=_0x2eba57,_0x4e21ea['splice'](_0x2eba57['order'],0x0,_0x2eba57);}else _0x4e21ea['push'](_0x2eba57);return _0x4e21ea;}var Ji=class extends _0x3688ab{static get['requires'](){return[Xi,Oi];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x14f94d){super(_0x14f94d);const _0x18d4dd=_0x14f94d['config'],_0x2452ba=_0x14f94d['locale'];_0x18d4dd['define']('ai.assistant.preserveComments',!0x0),_0x18d4dd['define']('ai.assistant.commands',Zi(_0x2452ba)),_0x18d4dd['define']('ai.assistant.extraCommandGroups',[]),_0x18d4dd['define']('ai.assistant.removeCommands',[]);let _0x4fb70d=bi(_0x18d4dd['get']('ai.assistant.commands'),_0x2452ba);const _0x253b9c=_0x18d4dd['get']('ai.assistant.extraCommandGroups'),_0x4ea9d5=_0x18d4dd['get']('ai.assistant.removeCommands');_0x253b9c['forEach'](_0x5e4283=>{const _0x405d34=_0x4fb70d['find'](_0x4d2041=>_0x4d2041['groupId']===_0x5e4283['groupId']);_0x405d34?_0x405d34['commands']=_0x405d34['commands']['concat'](_0x5e4283['commands']):_0x4fb70d['push'](_0x5e4283);}),_0x4fb70d=_0x4fb70d['filter'](_0x4008cd=>!_0x4ea9d5['includes'](_0x4008cd['groupId'])),_0x4fb70d['forEach'](_0x1a78c3=>{_0x1a78c3['commands']=_0x1a78c3['commands']['filter'](_0x5f3eff=>!_0x4ea9d5['includes'](_0x5f3eff['id']));}),_0x18d4dd['set']('ai.assistant.commands',_0x4fb70d);}};function Zi(_0x119265){return[{'groupId':'editOrReview','groupLabel':Ni(_0x119265,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Ni(_0x119265,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Ni(_0x119265,'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':Ni(_0x119265,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Ni(_0x119265,'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':Ni(_0x119265,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Ni(_0x119265,'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':Ni(_0x119265,'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':Ni(_0x119265,'Change\x20tone'),'commands':[{'id':'professional','label':Ni(_0x119265,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Ni(_0x119265,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Ni(_0x119265,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Ni(_0x119265,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Ni(_0x119265,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Ni(_0x119265,'Change\x20style'),'commands':[{'id':'business','label':Ni(_0x119265,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Ni(_0x119265,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Ni(_0x119265,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Ni(_0x119265,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Ni(_0x119265,'Translate'),'commands':[{'id':'translateEnglish','label':Ni(_0x119265,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Ni(_0x119265,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Ni(_0x119265,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Ni(_0x119265,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Ni(_0x119265,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Ni(_0x119265,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Ni(_0x119265,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Ni(_0x119265,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var ts=class extends _0x3688ab{['abortController'];static get['requires'](){return[vi];}constructor(_0x35a2cb){super(_0x35a2cb),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](vi)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x2b4b82){return this['sendRequest'](_0x2b4b82)['catch'](_0x393f86=>{if(_0x393f86 instanceof ki)return Promise['reject'](_0x393f86);if('AbortError'==_0x393f86['name'])return Promise['resolve']();throw console['error'](_0x393f86),new ht('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x50d458,_0x1eef3b){const _0x59c001=this['editor']['locale'],_0xd44f34={'Content-Type':'application/json'};if('object'==typeof _0x50d458)Object['assign'](_0xd44f34,_0x50d458);else{if(_0x50d458)try{const _0x229367=await _0x50d458(_0x1eef3b);Object['assign'](_0xd44f34,_0x229367);}catch{return Promise['reject'](new ki(Ni(_0x59c001,'AI_ERROR_GET_HEADERS')));}}return _0xd44f34;}async['_prepareRequestParameters'](_0x56ee1f,_0x24bc29){const _0x378815=this['editor']['locale'];if('object'==typeof _0x56ee1f)return _0x56ee1f;try{return await _0x56ee1f(_0x24bc29);}catch{return Promise['reject'](new ki(Ni(_0x378815,'AI_ERROR_GET_PARAMETERS')));}}},es=class extends ts{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x5c2ca2){super(_0x5c2ca2),_0x5c2ca2['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x5c2ca2['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x5c2ca2['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x5c2ca2['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x5c2ca2['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x5c2ca2['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x28ea2a,context:_0x103d7b,onData:_0x39b2b8,actionId:_0x48768d}){const _0x53f7b1=this['editor']['locale'],_0x275125=await this['prepareMessages'](_0x28ea2a,_0x103d7b,_0x48768d),_0x2b5490=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x48768d),_0x1ab818=await this['_prepareRequestParameters'](this['_requestParameters'],_0x48768d),_0x4d15e1={'messages':_0x275125,..._0x1ab818},_0xcd1337={'method':'POST','headers':_0x2b5490,'body':JSON['stringify'](_0x4d15e1),'signal':this['abortController']['signal']},_0x3142c8=await fetch(this['_apiUrl'],_0xcd1337);if(_0x3142c8['ok'])return _0x1ab818['stream']?await this['_readStreamableResponse'](_0x3142c8,_0x39b2b8):await this['_readStaticResponse'](_0x3142c8,_0x39b2b8),Promise['resolve']();{const _0x42208e=await _0x3142c8['text']();return _0x42208e['includes']('context_length_exceeded')?Promise['reject'](new ki(Ni(_0x53f7b1,'AI_ERROR_CONTEXT_LENGTH'))):_0x42208e['includes']('Moderation')?Promise['reject'](new ki(Ni(_0x53f7b1,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x42208e));}}async['prepareMessages'](_0x28f8fa,_0x2b71f2,_0x183809){let _0x40185f,_0x4c2b32;return _0x2b71f2?(_0x40185f='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.',_0x4c2b32='Instruction:\x0a'+_0x28f8fa+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x2b71f2):(_0x40185f='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.',_0x4c2b32=_0x28f8fa),[{'role':'system','content':_0x40185f},{'role':'user','content':_0x4c2b32}];}async['_readStreamableResponse'](_0x36a376,_0x64feb1){const _0x3b2cc4=_0x36a376['body']['getReader'](),_0x55f087=new TextDecoder();let _0x2847ea='',_0x385000='',_0x2349ec='',_0x15e947=!0x1;for(;!_0x15e947;){const {done:_0x544831,value:_0x18dada}=await _0x3b2cc4['read'](),_0x155d60=_0x2847ea+_0x55f087['decode'](_0x18dada);let _0x4a6c2c='';_0x15e947=_0x544831;try{_0x4a6c2c=this['_cleanUpData'](_0x155d60),_0x2847ea='';}catch{_0x2847ea=_0x155d60;continue;}_0x385000+=_0x4a6c2c,!_0x15e947&&this['_isBufferIncomplete'](_0x385000)||_0x385000&&(_0x2349ec+=_0x385000,_0x385000='',_0x64feb1(_0x2349ec));}return Promise['resolve']();}async['_readStaticResponse'](_0x71d0a6,_0x606348){return _0x606348((await _0x71d0a6['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x11ff92){const _0x4a8cf2=_0x11ff92['split']('<')['length']!==_0x11ff92['split']('>')['length'],_0x519008=_0x11ff92['length']<0x1e;return _0x4a8cf2&&_0x519008;}['_cleanUpData'](_0x1d80d2){return _0x1d80d2['split'](/\n(?![^{]*\})/g)['map'](_0x1cb672=>_0x1cb672['replace']('data:\x20',''))['filter'](_0x2d02f7=>_0x2d02f7&&_0x2d02f7['length']>0x0&&'[DONE]'!==_0x2d02f7)['map'](_0x1e9503=>{const {choices:_0x425d2a}=JSON['parse'](_0x1e9503);if(_0x425d2a[0x0]?.['delta']?.['content'])return _0x425d2a[0x0]['delta']['content'];})['filter'](_0x4535bc=>_0x4535bc)['join']('');}},is=class extends ts{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),bt('ai-aws-adapter-not-supported');}async['sendRequest'](_0x1936b7){throw ft('ai-aws-adapter-not-supported'),new ki(Ni(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},ss=class extends Ht{constructor(_0x114ecf,_0x3170a9={}){super(_0x114ecf),this['isToggleable']=!0x0,this['set']('side',_0x3170a9['side']||'top');const _0x2e5206=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...Ot(_0x3170a9['class']||[]),_0x2e5206['to']('side',_0x2a83c0=>'ck-tab-button_'+_0x2a83c0),_0x2e5206['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ns=class extends _0x215f6f{['children'];constructor(_0x5a2c9e,_0x1a2665={}){super(_0x5a2c9e);const _0x45d434=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...Ot(_0x1a2665['class']||[]),_0x45d434['to']('class'),_0x45d434['if']('isVisible','ck-hidden',_0x4a2253=>!_0x4a2253)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},rs=class extends _0x215f6f{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x1b99ed,_0x37bb05={}){super(_0x1b99ed),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x37bb05['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x37bb05['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x1a972e,_0x8b261b)=>_0x1a972e&&!_0x8b261b);const _0x5c6b7e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...Ot(_0x37bb05['class']||[]),_0x5c6b7e['to']('side',_0x138bb5=>'ck-tabs_'+_0x138bb5),_0x5c6b7e['to']('class'),_0x5c6b7e['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x5c6b7e['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x5c6b7e['to']('side',_0x5eb353=>'ck-tabs__buttons-container_'+_0x5eb353)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x5c6b7e['to']('side',_0x2ed95e=>'ck-tabs__panels-container_'+_0x2ed95e)]},'children':this['panelViews']},...Ot(_0x37bb05['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0xce696b){const _0x44d24e=this['_tabs']['get'](_0xce696b);return _0x44d24e||null;}['addTab'](_0x3fcbae){const _0x551ad2=this['_setupButton']({'id':_0x3fcbae['id'],'label':_0x3fcbae['buttonLabel'],'icon':_0x3fcbae['buttonIcon'],'order':_0x3fcbae['order']}),_0x2294aa=new ns(this['locale']);return _0x2294aa['render'](),_0x3fcbae['content']&&_0x2294aa['children']['add'](_0x3fcbae['content']),this['panelViews']['add'](_0x2294aa),this['_tabs']['set'](_0x3fcbae['id'],{'button':_0x551ad2,'panel':_0x2294aa,'order':void 0x0!==_0x3fcbae['order']?_0x3fcbae['order']:null}),this['fire']('addTab:'+_0x3fcbae['id'],{'id':_0x3fcbae['id'],'button':_0x551ad2,'panel':_0x2294aa}),null===this['activeTab']?this['activateTab'](_0x3fcbae['id']):this['_hidePanel'](_0x3fcbae['id']),{'button':_0x551ad2,'panel':_0x2294aa};}['activateTab'](_0x169a1b){if(null!==_0x169a1b&&!this['getTab'](_0x169a1b))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x169a1b});if(this['isCollapsed']=!0x1,this['activeTab']===_0x169a1b)return;const _0x444131=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x169a1b,_0x169a1b&&this['_showPanel'](_0x169a1b),this['fire']('activateTab:'+_0x169a1b,{'newTab':_0x169a1b,'oldTab':_0x444131});}['toggleTabPanel'](_0x2a4be9){this['activeTab']===_0x2a4be9?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x2a4be9);}['showTab'](_0x30008d){if(!this['getTab'](_0x30008d))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x30008d});this['_showPanel'](_0x30008d),this['_showButton'](_0x30008d),this['fire']('show:'+_0x30008d,_0x30008d);}['hideTab'](_0x4efcda){if(!this['getTab'](_0x4efcda))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x4efcda});const _0x53c818=this['activeTab'];this['_hidePanel'](_0x4efcda),this['_hideButton'](_0x4efcda);const _0xcb615a=this['getTabIds']();_0x53c818===_0x4efcda&&_0xcb615a['length']>0x1&&this['activateTab'](_0xcb615a['find'](_0x4fa9ea=>_0x4fa9ea!==_0x4efcda)),this['fire']('hide:'+_0x4efcda,_0x4efcda);}['_getPanel'](_0x1033f5){const _0x5a2d4c=this['_tabs']['get'](_0x1033f5);return _0x5a2d4c?_0x5a2d4c['panel']:null;}['_showPanel'](_0x4e1229){null!==this['activeTab']&&this['activeTab']!==_0x4e1229||this['_getPanel'](_0x4e1229)['show']();}['_hidePanel'](_0x1eaee2){const _0x110b7c=this['_getPanel'](_0x1eaee2);_0x110b7c['isVisible']&&(this['activeTab']===_0x1eaee2&&(this['activeTab']=null),_0x110b7c['hide']());}['_getButton'](_0x33690c){const _0x40dc8f=this['_tabs']['get'](_0x33690c);return _0x40dc8f?_0x40dc8f['button']:null;}['_showButton'](_0x5e2ce2){this['_getButton'](_0x5e2ce2)['show']();}['_hideButton'](_0x484bce){this['_getButton'](_0x484bce)['hide']();}['_setupButton'](_0x5bcfd1){const _0x1d7f41=new ss(this['locale'],{'side':this['side']}),_0x71b222=this['buttonViews'];if(_0x1d7f41['set']({'label':_0x5bcfd1['label'],'icon':_0x5bcfd1['icon'],'tooltip':!0x0,'withText':!0x0}),_0x1d7f41['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x37fb8d,_0x2733d5)=>_0x37fb8d===_0x5bcfd1['id']&&!_0x2733d5),_0x1d7f41['bind']('side')['to'](this,'side'),_0x5bcfd1['order']){const _0x5e9dd8=[...this['_tabs']]['reduce']((_0x3241e6,_0x249fc1)=>{const _0x6eeb69=_0x249fc1[0x0],{order:_0x166b9a}=_0x249fc1[0x1];return!_0x166b9a||_0x166b9a>_0x5bcfd1['order']?_0x3241e6:_0x166b9a>=_0x3241e6['order']?{'id':_0x6eeb69,'order':_0x166b9a}:_0x3241e6;},{'id':'','order':0x0}),_0x5478a4=_0x71b222['getIndex'](this['_getButton'](_0x5e9dd8['id']));_0x71b222['add'](_0x1d7f41,_0x5478a4+0x1);}else _0x71b222['add'](_0x1d7f41);return _0x1d7f41['on']('execute',()=>{this['toggleTabPanel'](_0x5bcfd1['id']);}),_0x1d7f41;}};const os=['overlay','sidebar','custom'],as=['left','right'];var hs=class extends rs{constructor(_0x319353,_0x1cb62e={}){super(_0x319353,_0x1cb62e),this['set']('type',_0x1cb62e['type']||'sidebar'),this['set']('side',_0x1cb62e['side']||'right'),this['set']('isVisible',_0x1cb62e['visibleByDefault']??!0x0);const _0x17a10d=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x17a10d['if']('type','ck-ai-tabs__overlay',_0x5d9ec4=>'overlay'===_0x5d9ec4),_0x17a10d['if']('type','ck-ai-tabs__sidebar',_0x3ce0db=>'sidebar'===_0x3ce0db),_0x17a10d['if']('isVisible','ck-hidden',_0x1d30d2=>!_0x1d30d2)]}}),this['buttonViews']['on']('add',(_0x385e9a,_0x16ef40)=>{_0x16ef40['set']('withText',!0x1);});}},cs=class extends _0x5d28a2{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x19d6b7){if(super(_0x19d6b7),!this['context']['config']['get']('ai.container'))throw new ht('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x1d4692=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x1d4692['showResizeButton']&&(this['showResizeButton']=_0x1d4692['showResizeButton']),'sidebar'!==_0x1d4692['type']&&'overlay'!==_0x1d4692['type']||_0x1d4692['side']&&(this['side']=_0x1d4692['side']),'sidebar'===_0x1d4692['type']){if(this['container']=_0x1d4692['element'],this['set']('type','sidebar'),!this['container'])throw new ht('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x1d4692['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new hs(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x1d4692['visibleByDefault'],'collapsible':_0x1d4692['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 _0x1f7986&&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'](_0x26a136){if(_0x26a136&&this['type']!==_0x26a136){if(!os['includes'](_0x26a136))throw new ht('ai-tabs-unsupported-ui-type');this['type']=_0x26a136;}}['switchSide'](_0x5d1ce7){if(_0x5d1ce7&&this['side']!==_0x5d1ce7){if(!as['includes'](_0x5d1ce7))throw new ht('ai-tabs-unsupported-ui-side');this['side']=_0x5d1ce7;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}},ls=class extends _0x5d28a2{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x545796];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x42be62){if(super(_0x42be62),this['context']['config']['define']('ai.serviceUrl','https://ai.cke-cs.com/v1'),this['_apiUrl']=this['context']['config']['get']('ai.serviceUrl')['replace'](/\/+$/,''),!this['_apiUrl']['endsWith']('/v1'))throw new ht('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder(),this['_responseCache']=new Map();}['init'](){const _0x2f0248=this['context']['plugins']['get'](_0x545796);if(!_0x2f0248['token'])throw new ht('ai-missing-token',this);this['_token']=_0x2f0248['token'];}['startConversation'](_0x28e2c4,_0x17e221){const _0x4567ad=this['_sendApiRequest']('/conversations','POST',{'id':_0x28e2c4,'group':_0x17e221});return{'getConversation':async()=>(await _0x4567ad['request'])['json'](),'abortController':_0x4567ad['abortController']};}['queryAssistant']({message:_0x3607d8,conversationId:_0xa3daa4,parts:_0x5ad693,capabilities:_0x434a47,model:_0x5b93f,attributes:_0x275944}){const _0x50b7fd={'prompt':_0x3607d8,'content':_0x5ad693,'model':_0x5b93f,..._0x434a47&&{'capabilities':_0x434a47},..._0x275944&&{'attributes':_0x275944}},_0x2f1a7a=this['_sendApiRequest']('/conversations/'+_0xa3daa4+'/messages','POST',_0x50b7fd,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x30cad8=(await _0x2f1a7a['request'])['body'];return this['_getStreamReader'](_0x30cad8);},'abortController':_0x2f1a7a['abortController']};}['executeCustomAction']({content:_0x28e1f1,message:_0x380637,model:_0x42f123,outputFormat:_0xcdd14a}){const _0x4cb797={'content':[{'type':'text','content':_0x28e1f1}],'prompt':_0x380637,'model':_0x42f123,'outputFormat':_0xcdd14a},_0x3bb4fe=this['_sendApiRequest']('/actions/custom/calls','POST',_0x4cb797);return{'getStream':async()=>{const _0x41aa12=(await _0x3bb4fe['request'])['body'];return this['_getStreamReader'](_0x41aa12);},'abortController':_0x3bb4fe['abortController']};}['executeAction']({actionName:_0x50d4e9,content:_0x355935,args:_0x238c28}){const _0x27eea5={'content':[{'type':'text','content':_0x355935}],'args':_0x238c28},_0x587318=this['_sendApiRequest']('/actions/system/'+_0x50d4e9+'/calls','POST',_0x27eea5);return{'getStream':async()=>{const _0x3c3c39=(await _0x587318['request'])['body'];return this['_getStreamReader'](_0x3c3c39);},'abortController':_0x587318['abortController']};}['uploadFile'](_0x2ffbc4,_0xa776d7,_0xfafdcd){const _0x4b5f45=new FormData();_0x4b5f45['append']('file',_0xa776d7,_0xa776d7['name']),_0xfafdcd&&_0x4b5f45['append']('attributes',JSON['stringify'](_0xfafdcd));const _0x27da1f=this['_sendApiRequest']('/conversations/'+_0x2ffbc4+'/files','POST',_0x4b5f45);return{'getId':async()=>(await _0x27da1f['request'])['json'](),'abortController':_0x27da1f['abortController']};}['uploadDocuments'](_0x541453,_0xeba703){const _0x371a86={'documents':_0xeba703['map'](_0x5006e3=>({'content':_0x5006e3['content'],'attributes':{'version':_0x5006e3['version'],'sessionId':_0x5006e3['sessionId'],'channelId':_0x5006e3['channelId'],'rootName':_0x5006e3['rootName'],'selections':_0x5006e3['selections']},...void 0x0!==_0x5006e3['name']?{'name':_0x5006e3['name']}:{},...void 0x0!==_0x5006e3['description']?{'description':_0x5006e3['description']}:{}}))},_0x2c8642=this['_sendApiRequest']('/conversations/'+_0x541453+'/documents/batch','POST',_0x371a86);return{'getIds':async()=>(await _0x2c8642['request'])['json'](),'abortController':_0x2c8642['abortController']};}['fetchDocuments'](_0x23cf1a,_0x4cc811){const _0x37e747=new URLSearchParams();_0x37e747['append']('documentIds',_0x4cc811['join'](','));const _0x52ffed=this['_sendApiRequest']('/conversations/'+_0x23cf1a+'/documents/batch?'+_0x37e747['toString'](),'GET');return{'getDocuments':async()=>(await _0x52ffed['request'])['json'](),'abortController':_0x52ffed['abortController']};}['fetchConversations'](_0x59341d,_0x4e94f8={}){const _0x5ea1d5=new URLSearchParams();_0x5ea1d5['append']('group',_0x59341d),_0x5ea1d5['append']('excludeEmpty',!0x1!==_0x4e94f8['excludeEmpty']?'true':'false'),_0x5ea1d5['append']('limit',_0x4e94f8['limit']?_0x4e94f8['limit']['toString']():'100'),_0x5ea1d5['append']('sortBy',_0x4e94f8['sortBy']?_0x4e94f8['sortBy']:'createdAt'),_0x5ea1d5['append']('order',_0x4e94f8['order']?_0x4e94f8['order']:'desc');const _0x115a8f=this['_sendApiRequest']('/conversations?'+_0x5ea1d5['toString'](),'GET');return{'getConversations':async()=>(await(await _0x115a8f['request'])['json']())['items'],'abortController':_0x115a8f['abortController']};}['deleteConversation'](_0x4ff7be){const _0x22562c=this['_sendApiRequest']('/conversations/'+_0x4ff7be,'DELETE');return{'execute':async()=>{await _0x22562c['request'];},'abortController':_0x22562c['abortController']};}['updateConversation'](_0x4029e3,_0x3a7cb4){const _0x51a799=this['_sendApiRequest']('/conversations/'+_0x4029e3,'PATCH',_0x3a7cb4);return{'getResult':async()=>(await _0x51a799['request'],_0x3a7cb4),'abortController':_0x51a799['abortController']};}['fetchConversation'](_0x1fb4ec){const _0x2b3b98=this['_sendApiRequest']('/conversations/'+_0x1fb4ec,'GET');return{'getConversation':async()=>(await _0x2b3b98['request'])['json'](),'abortController':_0x2b3b98['abortController']};}['fetchConversationMessages'](_0x5553b1){const _0x16e65b=this['_sendApiRequest']('/conversations/'+_0x5553b1+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x16e65b['request'])['json']())['items'],'abortController':_0x16e65b['abortController']};}['uploadUrl'](_0x5c7f4,_0x5d30c8,_0x1b18df){const _0x509880=this['_sendApiRequest']('/conversations/'+_0x5c7f4+'/web-resources','POST',{'url':_0x5d30c8,'attributes':_0x1b18df});return{'getId':async()=>(await _0x509880['request'])['json'](),'abortController':_0x509880['abortController']};}['getModels'](_0x1ba488='en'){const _0x51e98b=new URLSearchParams();_0x51e98b['append']('language',_0x1ba488);const _0x365a70='/models/1?'+_0x51e98b['toString'](),_0x49c99d=this['_sendApiRequest'](_0x365a70,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0x49c99d['request'])['json'](),'abortController':_0x49c99d['abortController']};}['deleteFile'](_0xb5c4,_0x1967c2){const _0x5dfa82=this['_sendApiRequest']('/conversations/'+_0xb5c4+'/files/'+_0x1967c2,'DELETE');return{'execute':async()=>{await _0x5dfa82['request'];},'abortController':_0x5dfa82['abortController']};}['deleteDocument'](_0xf959ac,_0x186575){const _0x30128a=this['_sendApiRequest']('/conversations/'+_0xf959ac+'/documents/'+_0x186575,'DELETE');return{'execute':async()=>{await _0x30128a['request'];},'abortController':_0x30128a['abortController']};}['deleteWebResource'](_0x529bc8,_0x2dc30f){const _0x2cd402=this['_sendApiRequest']('/conversations/'+_0x529bc8+'/web-resources/'+_0x2dc30f,'DELETE');return{'execute':async()=>{await _0x2cd402['request'];},'abortController':_0x2cd402['abortController']};}['cancelStream'](_0x199375,_0xb0a05c){const _0x252c7b=this['_sendApiRequest']('/conversations/'+_0x199375+'/messages/'+_0xb0a05c+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x252c7b['request'];},'abortController':_0x252c7b['abortController']};}['resumeStream'](_0x4fa1c8,_0x1684d1,_0x10a0aa='0-0'){const _0x56242d=new URLSearchParams({'lastEventId':_0x10a0aa}),_0x1d4ca9=this['_sendApiRequest']('/conversations/'+_0x4fa1c8+'/messages/'+_0x1684d1+'/stream?'+_0x56242d['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x465ee3=await _0x1d4ca9['request'];return this['_getStreamReader'](_0x465ee3['body']);},'abortController':_0x1d4ca9['abortController']};}['callSystemReview']({reviewName:_0x33840e,content:_0x11d635,args:_0x481bfc}){const _0x174ef0=this['_sendApiRequest']('/reviews/system/'+_0x33840e+'/calls','POST',{'content':[{'type':'text','content':_0x11d635}],'args':_0x481bfc});return{'getStream':async()=>{const _0xe1dadf=(await _0x174ef0['request'])['body'];return this['_getStreamReader'](_0xe1dadf);},'abortController':_0x174ef0['abortController']};}['processDocument']({document:_0xf33ebc,prompt:_0x58d5e9,model:_0x24c374}){const _0x58fcdb=this['_sendApiRequest']('/documents/process','POST',{'document':_0xf33ebc,'prompt':_0x58d5e9,'model':_0x24c374});return{'getResult':async()=>(await _0x58fcdb['request'])['json'](),'abortController':_0x58fcdb['abortController']};}['callCustomReview']({content:_0x45f59e,prompt:_0x2aa807,model:_0x126ae4}){const _0x1689c9=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x45f59e}],'prompt':_0x2aa807,'model':_0x126ae4});return{'getStream':async()=>{const _0x54584d=(await _0x1689c9['request'])['body'];return this['_getStreamReader'](_0x54584d);},'abortController':_0x1689c9['abortController']};}['upsertAIChatRating'](_0x24d4af,_0x429e1a,_0x3f3d76){const _0x44cd4a=this['_sendApiRequest']('/conversations/'+_0x24d4af+'/messages/'+_0x429e1a+'/ratings','PUT',{'positiveCount':_0x3f3d76['positiveCount'],'totalCount':_0x3f3d76['totalCount'],'modificationId':_0x3f3d76['modificationId']});return{'execute':async()=>{await _0x44cd4a['request'];},'abortController':_0x44cd4a['abortController']};}['upsertAIActionRating'](_0xbe37c7,_0x3c109a,_0x1217aa){const _0x257a7f=this['_sendApiRequest']('/actions/system/'+_0xbe37c7+'/calls/'+_0x3c109a+'/ratings','PUT',{'positiveCount':_0x1217aa['positiveCount'],'totalCount':_0x1217aa['totalCount']});return{'execute':async()=>{await _0x257a7f['request'];},'abortController':_0x257a7f['abortController']};}['upsertCustomAIActionRating'](_0x4d154a,_0x343773){const _0x456550=this['_sendApiRequest']('/actions/custom/calls/'+_0x4d154a+'/ratings','PUT',{'positiveCount':_0x343773['positiveCount'],'totalCount':_0x343773['totalCount']});return{'execute':async()=>{await _0x456550['request'];},'abortController':_0x456550['abortController']};}['upsertAIReviewRating'](_0xd9dfff,_0x3c1e27,_0x52331e,_0x297bd8){const _0x5da121=this['_sendApiRequest']('/reviews/system/'+_0xd9dfff+'/calls/'+_0x3c1e27+'/ratings','PUT',{'positiveCount':_0x52331e['positiveCount'],'totalCount':_0x52331e['totalCount'],'dataId':_0x297bd8});return{'execute':async()=>{await _0x5da121['request'];},'abortController':_0x5da121['abortController']};}['upsertCustomAIReviewRating'](_0x548579,_0x176f50,_0x8e257f){const _0x2a61aa=this['_sendApiRequest']('/reviews/custom/calls/'+_0x548579+'/ratings','PUT',{'positiveCount':_0x176f50['positiveCount'],'totalCount':_0x176f50['totalCount'],'dataId':_0x8e257f});return{'execute':async()=>{await _0x2a61aa['request'];},'abortController':_0x2a61aa['abortController']};}['_sendApiRequest'](_0x1a82de,_0x23b48d,_0x4239bd,_0x372a9a={}){const {useCache:_0x9ba803=!0x1,apiUrl:_0x3064c0=this['_apiUrl']}=_0x372a9a,_0x449cd1=new AbortController(),_0x4578ed=_0x9ba803?_0x23b48d+':'+_0x1a82de:null;if(_0x4578ed){const _0x2dbb1e=this['_responseCache']['get'](_0x4578ed);if(_0x2dbb1e)return{'request':_0x2dbb1e['then'](_0x451b0a=>_0x451b0a['clone']()),'abortController':_0x449cd1};}const _0x237f52=_0x4239bd instanceof FormData,_0x16834f={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':kt};_0x4239bd&&!_0x237f52&&(_0x16834f['Content-Type']='application/json');const _0x5368bf={'method':_0x23b48d,'headers':_0x16834f,'signal':_0x449cd1['signal']};_0x4239bd&&(_0x5368bf['body']=_0x237f52?_0x4239bd:JSON['stringify'](_0x4239bd));const _0x1db712=fetch(''+_0x3064c0+_0x1a82de,_0x5368bf)['catch'](_0x3c41cd=>{_0x4578ed&&this['_responseCache']['delete'](_0x4578ed),this['_handleError'](_0x3c41cd);})['then'](_0x259aff=>_0x259aff['ok']?_0x259aff:_0x259aff['json']()['then'](_0xce94e1=>{throw _0x4578ed&&this['_responseCache']['delete'](_0x4578ed),{'url':_0x3064c0,'path':_0x1a82de,'method':_0x23b48d,'body':_0x4239bd,'status':(_0x259aff||{})['status'],'statusText':(_0x259aff||{})['statusText'],'code':_0xce94e1['code'],'message':_0xce94e1['message'],'traceId':_0xce94e1['traceId']};}));return _0x4578ed&&this['_responseCache']['set'](_0x4578ed,_0x1db712['then'](_0x2f1798=>_0x2f1798['clone']())),{'request':_0x1db712,'abortController':_0x449cd1};}async*['_getStreamReader'](_0x23cf33){const _0x58ba27=[],_0x148767=_0x23cf33['getReader'](),_0x1734ee=_0x239286({'onError':_0x191c89=>{this['_handleError'](_0x191c89);},'onEvent':_0x5bc01d=>{_0x5bc01d['data']=JSON['parse'](_0x5bc01d['data']),_0x58ba27['push'](_0x5bc01d);}});try{let _0x3644ab=!0x1;for(;!_0x3644ab;){const {done:_0x26a6fa,value:_0x445920}=await _0x148767['read']();_0x26a6fa&&(_0x3644ab=!0x0),_0x1734ee['feed'](this['_decoder']['decode'](_0x445920,{'stream':!0x0})),yield*_0x58ba27,_0x58ba27['length']=0x0;}}catch(_0x363fe3){this['_handleError'](_0x363fe3);}finally{_0x148767['releaseLock'](),_0x1734ee['reset']();}}['_handleError'](_0x56d96c){if(_0x56d96c instanceof ht)throw _0x56d96c;if(_0x56d96c instanceof Error&&'AbortError'===_0x56d96c['name'])throw new ht('ai-request-aborted',this,{'originalError':_0x56d96c});throw new ht('ai-request-failed',this,{'originalError':_0x56d96c});}};function us(_0x2b2472,_0x5dfed2,_0x29e6a1){const t=_0x2b2472['t'];switch(_0x5dfed2){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'},_0x29e6a1);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.'},_0x29e6a1);case'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED':return t({'id':'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED','string':'Folders\x20cannot\x20be\x20added\x20to\x20the\x20chat.\x20Try\x20adding\x20individual\x20files\x20instead.'});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.'},_0x29e6a1);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_PASTED_TEXT_NAME':return t({'id':'AI_CHAT_CONTEXT_PASTED_TEXT_NAME','string':'Pasted\x20Text'});case'AI_CHAT_DROP_ZONE_HINT':return t({'id':'AI_CHAT_DROP_ZONE_HINT','string':'Drop\x20files\x20here\x20to\x20add\x20to\x20the\x20chat'});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.'},_0x29e6a1);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'},_0x29e6a1);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x29e6a1);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'},_0x29e6a1);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.'},_0x29e6a1);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.'},_0x29e6a1);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.'},_0x29e6a1);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.'},_0x29e6a1);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'},_0x29e6a1);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.'},_0x29e6a1);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 _0x5dfed2;}}function ds(_0x852c78){return _0x852c78?_0x852c78 instanceof _0x1f7986?[_0x852c78]:_0x852c78['editors']&&0x0!==_0x852c78['editors']['length']?Array['from'](_0x852c78['editors']):[]:[];}function _s(_0x1ac7ef){const _0x51fc97=ds(_0x1ac7ef);if(!_0x51fc97['length'])throw new ht('ai-get-editor-from-context-no-editor');if(0x1===_0x51fc97['length'])return _0x51fc97[0x0];const _0x3b6552=_0x51fc97['find'](_0x5d40e4=>_0x5d40e4['ui']?.['focusTracker']?.['isFocused']);if(_0x3b6552)return _0x3b6552;const _0x3d3a58=function(_0x19dd7f){if(_0x19dd7f instanceof _0x1f7986)return;const _0x48b6ac=_0x19dd7f;if(!_0x48b6ac['plugins']||!_0x48b6ac['plugins']['has']('AIEditing'))return;return _0x48b6ac['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x1ac7ef);return _0x3d3a58&&_0x51fc97['includes'](_0x3d3a58)?_0x3d3a58:_0x51fc97[0x0];}const gs='ai-selection',As=['br'];var Is=class extends _0x5d28a2{constructor(_0x53249d){super(_0x53249d),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}['_outputDataProcessor'];['_fakeSelections']=[];['_sessionIdByEditor']=new WeakMap();['_lastContentFocusedEditor'];static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['getLastContentFocusedEditor'](){return this['_lastContentFocusedEditor'];}['getSessionId'](_0x1e1a0a){let _0x9dcaaf=this['_sessionIdByEditor']['get'](_0x1e1a0a);return _0x9dcaaf||(_0x9dcaaf=_0x1e1a0a['plugins']['has']('RealTimeCollaborationClient')&&_0x1e1a0a['plugins']['get']('RealTimeCollaborationClient')['sessionId']||vt(),this['_sessionIdByEditor']['set'](_0x1e1a0a,_0x9dcaaf)),_0x9dcaaf;}async['getDocumentData'](){const _0x4cb17f=ds(this['context']);if(!_0x4cb17f['length'])throw new ht('ai-get-editor-from-context-no-editor');const _0x4b33a4=[],_0x8944f=new Set();for(const _0x48c164 of _0x4cb17f){const _0x36dc45=_0x48c164['config']['get']('roots')||{};for(const _0x258668 of _0x48c164['model']['document']['getRoots']()){if('$graveyard'===_0x258668['rootName'])continue;const _0x1cd549=await this['_getDocumentDataForEditorRoot'](_0x48c164,_0x258668,_0x8944f),_0x87ea60=_0x36dc45[_0x258668['rootName']],_0x4b97b2=_0x258668['getAttribute']('$description')??_0x87ea60?.['description'];let _0x297a2d=_0x258668['getAttribute']('$title')??_0x87ea60?.['title'];_0x297a2d||(_0x297a2d=_0x258668['getAttribute']('$rootEditableOptions')?.['label']??_0x87ea60?.['label']),_0x297a2d||(bt('ai-document-root-missing-title',{'editor':_0x48c164,'rootName':_0x258668['rootName']}),_0x297a2d=_0x258668['rootName']),_0x4b33a4['push']({'editor':_0x48c164,'rootName':_0x258668['rootName'],'content':_0x1cd549['content'],'version':_0x1cd549['version'],'sessionId':this['getSessionId'](_0x48c164),'channelId':_0x48c164['config']['get']('collaboration.channelId'),'selections':_0x1cd549['selections'],'name':_0x297a2d,'description':_0x4b97b2});}}return _0x4b33a4;}async['_getDocumentDataForEditorRoot'](_0x1e7126,_0x1681cb,_0x174796){const _0x3bdbb8=_0x1e7126['data']['toView'](_0x1681cb,{'convertAiChatSelectionMarker':!0x0}),_0x35b9f7=new _0x17a1b2(_0x1e7126['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x3bdbb8,_0x35b9f7,_0x174796);let _0x3e187b=await this['_getDocumentDataStringFromView'](_0x3bdbb8,_0x1e7126);const _0x1ae75f=this['_getMarkersInDocumentOrder'](_0x1e7126,_0x1681cb),_0x1f91fd=[];for(const _0x13b5b3 of _0x1ae75f){const _0x4cb827='<'+_0x13b5b3['name']+':start></'+_0x13b5b3['name']+':start>',_0x5d39c0=_0x3e187b['indexOf'](_0x4cb827);_0x3e187b=_0x3e187b['substring'](0x0,_0x5d39c0)+_0x3e187b['substring'](_0x5d39c0+_0x4cb827['length']);const _0x2420d5='<'+_0x13b5b3['name']+':end></'+_0x13b5b3['name']+':end>',_0xd25ac5=_0x3e187b['indexOf'](_0x2420d5);_0x3e187b=_0x3e187b['substring'](0x0,_0xd25ac5)+_0x3e187b['substring'](_0xd25ac5+_0x2420d5['length']),_0x1f91fd['push']({'markerName':_0x13b5b3['name'],'start':_0x5d39c0,'end':_0xd25ac5,'htmlFragment':_0x3e187b['substring'](_0x5d39c0,_0xd25ac5)});}return{'content':_0x3e187b,'version':_0x1e7126['model']['document']['version'],'selections':_0x1f91fd};}['afterInit'](){this['context']instanceof _0x1f7986?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x5106bf,_0xdb2daa)=>{_0xdb2daa['on']('ready',()=>{this['_integrateEditor'](_0xdb2daa);});});}['_setOutputDataProcessor'](_0x5c4ac9){this['_outputDataProcessor']=_0x5c4ac9;}async['_getDocumentDataStringFromView'](_0x1a713e,_0x573886){let _0x472a9b;if(this['_outputDataProcessor']){const _0x422530=_0x573886['data']['processor']['domConverter']['viewToDom'](_0x1a713e),_0x29ff44=await this['_outputDataProcessor'](_0x422530);_0x472a9b=_0x573886['data']['processor']['htmlWriter']['getHtml'](_0x29ff44);}else _0x472a9b=_0x573886['data']['processor']['toData'](_0x1a713e);return _0x472a9b;}['_integrateEditor'](_0xa3009a){if(!_0xa3009a['config']['get']('collaboration.channelId'))throw new ht('ai-missing-channel-id',_0xa3009a);_0xa3009a['ui']['focusTracker']['on']('change:isFocused',(_0x295efb,_0xe32f7e,_0x399e4f)=>{_0x399e4f&&(this['_lastContentFocusedEditor']=_0xa3009a);}),_0xa3009a['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0xa3009a&&(this['_lastContentFocusedEditor']=void 0x0);}),_0xa3009a['conversion']['for']('editingDowncast')['markerToHighlight']({'model':gs,'view':({markerName:_0x4d85ab})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x4d85ab['split'](':')[0x1]],'priority':0xc})}),_0xa3009a['conversion']['for']('dataDowncast')['markerToElement']({'model':gs+':context','view':(_0x1f6819,{writer:_0x37e6cc,options:_0x10635a})=>_0x10635a['convertAiChatSelectionMarker']?_0x37e6cc['createUIElement'](_0x1f6819['markerName']+':'+(_0x1f6819['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x16072f){const _0x3ddaa2=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x16072f);const _0x2963bd=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x3ddaa2,_0x2963bd);}['hideFakeVisualSelection'](_0x3e4228){const _0x32275f=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x3e4228);const _0x16c904=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x32275f,_0x16c904);}async['modelToDataWithIds'](_0x257cc4,_0x1eb814){const _0x3c2ebf=_0x1eb814['data']['toView'](_0x257cc4),_0x4cdca5=new _0x17a1b2(_0x1eb814['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x3c2ebf,_0x4cdca5),this['_getDocumentDataStringFromView'](_0x3c2ebf,_0x1eb814);}['_setDataIdsOnChildren'](_0x55cfb7,_0x51a601,_0x192eb=new Set()){let _0x3c9055=!0x1;for(const _0x13d6d9 of _0x55cfb7['getChildren']()){if(!_0x13d6d9['is']('view:element')||As['includes'](_0x13d6d9['name']))continue;const _0x38c306=_0x13d6d9['is']('view:containerElement'),_0x197da5=_0x13d6d9['is']('view:emptyElement'),_0x8fe909=_0x13d6d9['is']('view:rawElement'),_0x4c171e=this['_setDataIdsOnChildren'](_0x13d6d9,_0x51a601,_0x192eb);_0x13d6d9['hasAttribute']('data-id')?(_0x3c9055=!0x0,_0x192eb['add'](_0x13d6d9['getAttribute']('data-id'))):(_0x38c306||_0x197da5||_0x8fe909||_0x4c171e)&&(_0x51a601['setAttribute']('data-id',this['_nextDataId'](_0x192eb),_0x13d6d9),_0x3c9055=!0x0);}return _0x3c9055;}['_nextDataId'](_0x3d781f){let _0x4250c4;do{_0x4250c4='';for(let _0x51f297=0x0;_0x51f297<0x4;_0x51f297++)_0x4250c4+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x3d781f['has'](_0x4250c4));return _0x3d781f['add'](_0x4250c4),_0x4250c4;}['getSelectionText'](_0x23219c){const _0x2e6266=(_0x23219c?_0x23219c['model']:_s(this['context'])['model'])['document']['selection'],_0x105701=[],_0xd10d74=Array['from'](_0x2e6266['getRanges']());_0xd10d74['sort']((_0x5bdbf7,_0x3d3673)=>_0x5bdbf7['start']['isBefore'](_0x3d3673['start'])?-0x1:0x1);for(const _0x4ae082 of _0xd10d74)for(const _0x8699b3 of _0x4ae082['getItems']())_0x8699b3['is']('$textProxy')?_0x105701['push'](_0x8699b3['data']):_0x8699b3['is']('element')&&_0x105701['length']>0x0&&'\x20'!==_0x105701[_0x105701['length']-0x1]&&_0x105701['push']('\x20');return _0x105701['length']?'\x22'+_0x105701['join']('')['trim']()+'\x22':us(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x2e0b9f){for(let _0x178721=0x0;_0x178721<this['_fakeSelections']['length'];_0x178721++)if(this['_fakeSelections'][_0x178721]['id']==_0x2e0b9f)return void this['_fakeSelections']['splice'](_0x178721,0x1);}['_addFakeSelection'](_0xa23c56){this['_removeFakeSelectionById'](_0xa23c56['id']),wt(this['_fakeSelections'],_0xa23c56);}['_refreshFakeSelection'](_0x5d011d,_0x5ef1a7){if(_0x5d011d==_0x5ef1a7)return;const _0x449a08=_0x5d011d?_0x5d011d['editor']:null,_0x4181fe=_0x5ef1a7?_0x5ef1a7['editor']:null,_0x5b3495=(_0x5f3d45,_0x28a137)=>{const _0x5165bd=_0x28a137['model']['markers']['getMarkersGroup'](gs);for(const _0x353314 of _0x5165bd)_0x5f3d45['removeMarker'](_0x353314);},_0x1bb8aa=(_0x4747e9,_0x22a32a,_0xbf6276)=>{const _0x278614=_0x22a32a['model'];for(let _0x5a76ad=0x0;_0x5a76ad<_0xbf6276['ranges']['length'];_0x5a76ad++){let _0x4fed90=_0xbf6276['ranges'][_0x5a76ad];const _0x3f3ebf=gs+':'+_0xbf6276['id']+':'+_0x5a76ad;if(_0x4fed90['start']['isAtEnd']){const _0x3422ae=_0x4fed90['start']['getLastMatchingPosition'](({item:_0x373e20})=>!_0x278614['schema']['isContent'](_0x373e20),{'boundaries':_0x4fed90});_0x4fed90=_0x4747e9['createRange'](_0x3422ae,_0x4fed90['end']);}_0x4747e9['addMarker'](_0x3f3ebf,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x4fed90});}};_0x449a08&&_0x4181fe&&_0x449a08===_0x4181fe&&_0x5ef1a7?_0x449a08['model']['change'](_0x501cc9=>{_0x5b3495(_0x501cc9,_0x449a08),_0x1bb8aa(_0x501cc9,_0x4181fe,_0x5ef1a7);}):(_0x449a08&&_0x449a08['model']['change'](_0x307336=>_0x5b3495(_0x307336,_0x449a08)),_0x4181fe&&_0x5ef1a7&&_0x4181fe['model']['change'](_0x17516d=>_0x1bb8aa(_0x17516d,_0x4181fe,_0x5ef1a7)));}['_getMarkersInDocumentOrder'](_0x533eee,_0x3bc108){const _0x4ebbe2=Array['from'](_0x533eee['model']['markers']['getMarkersGroup'](gs+':context'));return(_0x3bc108?_0x4ebbe2['filter'](_0x2c32bc=>{const _0x45b5ab=_0x2c32bc['getRange']();return _0x45b5ab&&_0x45b5ab['root']['rootName']===_0x3bc108['rootName'];}):_0x4ebbe2)['sort']((_0x468335,_0x28356b)=>_0x468335['getStart']()['isBefore'](_0x28356b['getStart']())?-0x1:_0x468335['getStart']()['isAfter'](_0x28356b['getStart']())?0x1:0x0);}};function ps(_0xce7bc8,_0x25a33f){return _0x1023a2(_0xce7bc8,_0x25a33f);}function ms(_0x523007,_0x48d5a5){return _0x1dbe92(_0x523007,_0x48d5a5);}function Es(_0x1acc4a,_0x1550e9,_0x4fde0a){const _0x34ac3e=null!==_0x1550e9?_0x505b97=>_0x505b97['attribs'][_0x1acc4a]===_0x1550e9:_0x224522=>Boolean(_0x224522['attribs'][_0x1acc4a]);return ti(_0x3f80fc=>_0x489441(_0x3f80fc)&&_0x34ac3e(_0x3f80fc),_0x4fde0a);}function Ts(_0x996ba3,_0x2c2b23,_0x32afec){const _0x440166=null!==_0x2c2b23?_0x575e74=>_0x575e74['attribs'][_0x996ba3]===_0x2c2b23:_0x3df786=>Boolean(_0x3df786['attribs'][_0x996ba3]);return _0x5380b2(_0x4e83ad=>_0x489441(_0x4e83ad)&&_0x440166(_0x4e83ad),_0x32afec);}function ws(_0x19dc87){return _0x5380b2(_0x4b0b3=>_0x489441(_0x4b0b3)&&function(_0xad93bc){const _0x46eb6c=_0xad93bc['toLowerCase']();return'script'===_0x46eb6c||'style'===_0x46eb6c||_0x46eb6c['includes']('-');}(_0x4b0b3['name']),_0x19dc87);}function Cs(_0x2f3240){return _0x3ced30(_0x4a0068=>_0xc2cc58(_0x4a0068),_0x2f3240,!0x0,0x1/0x0);}function fs(_0x630422,_0x48e3a5){return _0x630422&&_0x489441(_0x630422)?_0x630422['attribs'][_0x48e3a5]:null;}function bs(_0x3b840c,_0x57fe55,_0x775cbd){_0x489441(_0x3b840c)&&(null===_0x775cbd?delete _0x3b840c['attribs'][_0x57fe55]:_0x3b840c['attribs'][_0x57fe55]=_0x775cbd);}function Ss(_0x4afb5d,_0x127bbb,_0x35ebe2){const _0x435f0d=_0x127bbb['cloneNode'](!0x0);'beforebegin'===_0x35ebe2?_0x201d1c(_0x4afb5d,_0x435f0d):'afterbegin'===_0x35ebe2?_0x2dfbea(_0x4afb5d,_0x435f0d):'beforeend'===_0x35ebe2?_0x1cca13(_0x4afb5d,_0x435f0d):'afterend'===_0x35ebe2&&_0x218be5(_0x4afb5d,_0x435f0d);}function Rs(_0x53eae5){const _0x352c9e=[];let _0x203175=_0x53eae5;for(;_0x203175;)_0x203175=_0x38b6f8(_0x203175),_0x203175&&_0x352c9e['push'](_0x203175);return _0x352c9e;}function Os(_0xf62bee){return _0xf62bee['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function vs(_0x3c666a){let _0x5a7a5e=0x0;for(;_0x3c666a['parentNode'];)_0x3c666a=_0x3c666a['parentNode'],_0x5a7a5e++;return _0x5a7a5e;}function ks(_0x5357b1){const _0x559cdb=[];let _0x5b142c=_0x5357b1['nextSibling'];for(;_0x5b142c;)_0x559cdb['push'](_0x5b142c),_0x5b142c=_0x5b142c['nextSibling'];_0x559cdb['forEach'](_0x337091=>{_0x2a7599(_0x337091);});}const Ns=/* #__PURE__ -- @preserve */
25
+ gt();var ys=class extends Ns{['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};['_existingDataIds']=new Set();['_referencedExistingIds']=new Set();constructor(_0x34c4b1){super(),this['_generateUid']=_0x34c4b1||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x288a4c,_0x19960b,_0x4758bd){this['_uidCounter']=0x0;const _0x5dec6a=_0x288a4c['cloneNode'](!0x0);Ds(_0x19960b,_0x5dec6a);const _0x64937d=_0x5dec6a['childNodes'],_0x54b64f=Array['from'](_0x64937d)['filter'](_0x32a8f7=>!(0x3===_0x32a8f7['nodeType']&&''===ms(_0x32a8f7)['trim']())),_0x1a961b=_0x54b64f['length'];this['_existingDataIds']=new Set(Ts('data-id',null,_0x19960b)['map'](_0xc2c589=>fs(_0xc2c589,'data-id'))['filter'](_0x515a2c=>!!_0x515a2c));for(const _0x33961c of _0x54b64f)_0x33961c&&_0x489441(_0x33961c)&&void 0x0===_0x33961c['attribs']['data-id']&&bs(_0x33961c,'data-id','new-element');if(Ts('data-id',null,_0x5dec6a)['forEach'](_0x1f64e2=>{const _0x1d018d=fs(_0x1f64e2,'data-id');'new-element'===_0x1d018d||this['_existingDataIds']['has'](_0x1d018d)||bs(_0x1f64e2,'data-id','new-element');}),0x0===_0x19960b['childNodes']['length']){const _0x4359c5=[];return Ts('data-id','new-element',_0x5dec6a)['forEach'](_0x3aa07f=>{const _0x52cf73=this['_generateUid']();bs(_0x3aa07f,'data-id',_0x52cf73),_0x4359c5['push'](_0x52cf73);}),this['_removeSpecialComments'](_0x5dec6a),{'parsedContent':_0x5dec6a,'newNodeIds':_0x4359c5,'modifiedNodeIds':[],'removedNodeIds':[]};}this['_touchedNodesState']['newIds']=[],this['_touchedNodesState']['modifiedIds']=[],this['_touchedNodesState']['removedIds']=[],this['_touchedNodesState']['invalidIds']=[],this['_touchedNodesState']['lastTouchedId']=null,this['_touchedNodesState']['rescuedNewIds']=new Set(),this['_referencedExistingIds']=new Set();let _0x3ea70d=-0x1,_0x46a40c=!0x1;for(let _0x2292bc=0x0;_0x2292bc<_0x1a961b;_0x2292bc++){const _0x56fe18=_0x54b64f[_0x2292bc],_0x294f30=_0x54b64f[_0x2292bc+0x1];if(this['_isNewNode'](_0x56fe18)){if(-0x1===_0x3ea70d&&(_0x3ea70d=_0x2292bc),this['_markWrappedElements'](_0x56fe18),!this['_isNewNode'](_0x294f30)){const [_0x58054a,_0x335ce9]=this['_findReferenceNode'](_0x56fe18,_0x46a40c,_0x19960b);if(_0x58054a){const _0x2ee891=Array['from'](_0x54b64f)['slice'](_0x3ea70d,_0x2292bc+0x1);this['_insertNodes'](_0x58054a,_0x2ee891,_0x335ce9),_0x3ea70d=-0x1;}}}else{if(this['_isExistingContentComment'](_0x56fe18))_0x46a40c=!0x0;else{if(this['_isExistingNode'](_0x56fe18)){const _0x5e5145=fs(_0x56fe18,'data-id');if(_0x5e5145&&this['_existingDataIds']['has'](_0x5e5145)){this['_referencedExistingIds']['add'](_0x5e5145);const _0xb65813=Es('data-id',_0x5e5145,_0x19960b);this['_replaceNode'](_0xb65813,_0x56fe18);}}else{if(xs(_0x56fe18)){const _0x4ce02e=Ls(_0x56fe18);Es('data-id',_0x4ce02e,_0x5dec6a)||this['_touchedNodesState']['removedIds']['push'](_0x4ce02e);}}}}}for(const _0x1dfe0e of this['_touchedNodesState']['removedIds']){const _0x1eb568=Es('data-id',_0x1dfe0e,_0x19960b);_0x1eb568&&(this['_rescueUnwrappedElements'](_0x1eb568),this['_removeNode'](_0x1eb568,_0x1dfe0e,_0x4758bd));}if(Ts('data-id','new-element',_0x19960b)['forEach'](_0x183778=>{const _0xad0aba=this['_getUid'](_0x183778);bs(_0x183778,'data-id',_0xad0aba),this['_touchedNodesState']['newIds']['push'](_0xad0aba);}),this['_removeSpecialComments'](_0x19960b),_0x4758bd&&_0x4758bd['cutAfterUnstable']){const _0x40cba1=this['_findLastConfirmationPoint'](_0x54b64f),_0x56ec23=this['_getLastStableElement'](_0x19960b,_0x40cba1);this['_markUnstableElements'](_0x19960b,_0x56ec23);}if(this['_processWrappedElements'](_0x19960b,_0x4758bd),_0x4758bd&&_0x4758bd['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x3e6cc8=Ts('data-id',this['_touchedNodesState']['lastTouchedId'],_0x19960b);let _0x4d8624=_0x3e6cc8[_0x3e6cc8['length']-0x1];for(;_0x4d8624;)ks(_0x4d8624),_0x4d8624=_0x4d8624['parentNode'];}return{'parsedContent':_0x19960b,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x461f5b,_0x16ffa5,_0x18879b){for(const _0x5d5670 of _0x16ffa5){const _0x48959c=this['_getUid'](_0x5d5670);bs(_0x5d5670,'data-id',_0x48959c),this['_touchedNodesState']['newIds']['push'](_0x48959c),this['_touchedNodesState']['lastTouchedId']=_0x48959c;}const _0x2ed1dd='afterbegin'===_0x18879b||'afterend'===_0x18879b?_0x16ffa5['reverse']():_0x16ffa5;for(const _0x29d1bb of _0x2ed1dd)Ss(_0x461f5b,_0x29d1bb,_0x18879b);}['_replaceNode'](_0x30e4c4,_0xe695e1){if(!_0x30e4c4)return;if(_0x405579=_0xe695e1,Os(ms(_0x30e4c4))===Os(ms(_0x405579)))return;var _0x405579;const _0xef4bbe=fs(_0x30e4c4,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0xef4bbe),this['_touchedNodesState']['lastTouchedId']=_0xef4bbe,_0x43a070(_0x30e4c4,_0xe695e1['cloneNode'](!0x0));}['_removeNode'](_0x462006,_0x3aaa32,_0x3e982b){if(_0x3e982b&&_0x3e982b['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x3aaa32;const _0x3cde96=_0x3e982b['replaceRemovedWith']['cloneNode'](!0x0);bs(_0x3cde96,'data-id',_0x3aaa32),bs(_0x3cde96,'data-removed','true'),_0x43a070(_0x462006,_0x3cde96);}else _0x2a7599(_0x462006);}['_findReferenceNode'](_0x1d52c6,_0x347e6f,_0x5a0fda){const _0x348296=this['_findPrevElementWithDataId'](_0x1d52c6,!0x1);if(_0x348296){const _0x5645ac=Ls(_0x348296),_0x55c0e5=Es('data-id',_0x5645ac,_0x5a0fda);if(_0x55c0e5)return[_0x55c0e5,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x5645ac);}const _0x2df460=this['_findNextElementWithDataId'](_0x1d52c6,!0x1);if(_0x2df460){const _0x21a9a8=Ls(_0x2df460),_0x3e1fa7=Es('data-id',_0x21a9a8,_0x5a0fda);if(_0x3e1fa7)return[_0x3e1fa7,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x21a9a8);}return _0x347e6f?_0x1d52c6['nextSibling']?this['_findFallbackReferenceNode'](_0x1d52c6,_0x5a0fda):[_0x5a0fda['childNodes'][_0x5a0fda['childNodes']['length']-0x1],'afterend']:[_0x5a0fda['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x19f8f0,_0x52c18e){const _0x44a81f=[],_0x4c0f5d=this['_findPrevElementWithDataId'](_0x19f8f0,!0x0);if(_0x4c0f5d){const _0x3d638e=Es('data-id',Ls(_0x4c0f5d),_0x52c18e);_0x3d638e&&_0x44a81f['push']([_0x3d638e,'afterend']);}const _0x3cc0dc=this['_findNextElementWithDataId'](_0x19f8f0,!0x0);if(_0x3cc0dc){const _0x4c6aa6=Es('data-id',Ls(_0x3cc0dc),_0x52c18e);_0x4c6aa6&&_0x44a81f['push']([_0x4c6aa6,'beforebegin']);}return _0x44a81f['length']>0x1?vs(_0x44a81f[0x0][0x0])<=vs(_0x44a81f[0x1][0x0])?_0x44a81f[0x0]:_0x44a81f[0x1]:0x1===_0x44a81f['length']?_0x44a81f[0x0]:[_0x52c18e['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x4addfa,_0x3b58e8){let _0x4f50b1=_0x4addfa['nextSibling'],_0x47f29c=null,_0x33c836=!0x1;for(;_0x4f50b1;){if(_0xc2cc58(_0x4f50b1)){if(xs(_0x4f50b1)&&(_0x47f29c=_0x4f50b1),this['_isExistingContentComment'](_0x4f50b1)&&_0x3b58e8&&!_0x33c836){_0x33c836=!0x0,_0x4f50b1=_0x4f50b1['nextSibling'];continue;}break;}const _0x2fb9e2=fs(_0x4f50b1,'data-id');if(_0x2fb9e2&&'new-element'!==_0x2fb9e2&&this['_existingDataIds']['has'](_0x2fb9e2)){_0x47f29c=_0x4f50b1;break;}_0x4f50b1=_0x4f50b1['nextSibling'];}return _0x47f29c;}['_findPrevElementWithDataId'](_0x202be2,_0x290c23){let _0x4a0ef2=_0x202be2['previousSibling'],_0x5d7b12=null,_0x3844d9=!0x1;for(;_0x4a0ef2;){if(_0xc2cc58(_0x4a0ef2)){if(xs(_0x4a0ef2)&&(_0x5d7b12=_0x4a0ef2),this['_isExistingContentComment'](_0x4a0ef2)&&_0x290c23&&!_0x3844d9){_0x3844d9=!0x0,_0x4a0ef2=_0x4a0ef2['previousSibling'];continue;}break;}const _0x4fd174=fs(_0x4a0ef2,'data-id');if(_0x4fd174&&'new-element'!==_0x4fd174&&this['_existingDataIds']['has'](_0x4fd174)){_0x5d7b12=_0x4a0ef2;break;}_0x4a0ef2=_0x4a0ef2['previousSibling'];}return _0x5d7b12;}['_markWrappedElements'](_0x485080){_0x489441(_0x485080)&&Ts('data-id',null,_0x485080)['forEach'](_0x922ee9=>{this['_isExistingNode'](_0x922ee9)&&(bs(_0x922ee9,'data-wrapped-id',fs(_0x922ee9,'data-id')),bs(_0x922ee9,'data-id',null));});}['_processWrappedElements'](_0x5b8e35,_0x42f45b){Ts('data-wrapped-id',null,_0x5b8e35)['forEach'](_0x5f2801=>{const _0x1d8d85=fs(_0x5f2801,'data-wrapped-id');if(this['_hasUnstableParent'](_0x5f2801))return;const _0x4ab3b9=Es('data-id',_0x1d8d85,_0x5b8e35);bs(_0x5f2801,'data-id',_0x1d8d85),_0x4ab3b9&&(this['_removeNode'](_0x4ab3b9,_0x1d8d85,_0x42f45b),this['_touchedNodesState']['removedIds']['push'](_0x1d8d85),this['_touchedNodesState']['lastTouchedId']=_0x1d8d85);});}['_hasUnstableParent'](_0xebcfe5){let _0x593d4e=_0xebcfe5['parentNode'];for(;_0x593d4e;){if(fs(_0x593d4e,'data-unstable'))return!0x0;_0x593d4e=_0x593d4e['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0x5b16e3){const _0x135b1c=new Set(this['_touchedNodesState']['removedIds']),_0x1eee4b=new Set(this['_touchedNodesState']['newIds']);Ts('data-id',null,_0x5b16e3)['forEach'](_0x2a359c=>{const _0x3b11c8=fs(_0x2a359c,'data-id'),_0x31c35f=!!_0x3b11c8&&this['_referencedExistingIds']['has'](_0x3b11c8),_0x3a16b3=!!_0x3b11c8&&_0x1eee4b['has'](_0x3b11c8);if(!_0x3b11c8||!_0x31c35f&&!_0x3a16b3)return;if(_0x135b1c['has'](_0x3b11c8))return;let _0x66c4a1=_0x2a359c['parentNode'],_0x480fb9=!0x1;for(;_0x66c4a1;){if(_0x66c4a1===_0x5b16e3){_0x480fb9=!0x0;break;}const _0x48e47f=fs(_0x66c4a1,'data-id');if(_0x48e47f&&(this['_referencedExistingIds']['has'](_0x48e47f)||_0x1eee4b['has'](_0x48e47f)))return;_0x66c4a1=_0x66c4a1['parentNode'];}if(_0x480fb9){if(_0x201d1c(_0x5b16e3,_0x2a359c),_0x31c35f){const _0x306d3a=this['_generateUid'](),_0x58f2ed=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x3b11c8);-0x1!==_0x58f2ed&&this['_touchedNodesState']['modifiedIds']['splice'](_0x58f2ed,0x1),bs(_0x2a359c,'data-unwrapped-id',_0x3b11c8),bs(_0x2a359c,'data-id',_0x306d3a),this['_touchedNodesState']['newIds']['push'](_0x306d3a),this['_touchedNodesState']['rescuedNewIds']['add'](_0x306d3a),this['_touchedNodesState']['lastTouchedId']=_0x306d3a;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x3b11c8),this['_touchedNodesState']['lastTouchedId']=_0x3b11c8;}});}['_getUid'](_0x1d5783){return this['_isExistingNode'](_0x1d5783)?fs(_0x1d5783,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x597305){Cs(_0x597305)['filter'](_0x38120f=>xs(_0x38120f)||this['_isExistingContentComment'](_0x38120f))['forEach'](_0x52afc3=>{_0x2a7599(_0x52afc3);});}['_findLastConfirmationPoint'](_0x2fb43b){let _0x2b5970=null,_0x95eb2c=null,_0x2ef9a3=null,_0x18fdb5=null;const _0x32b85e=_0x4e8787=>{_0x4e8787&&(_0x2b5970=_0x4e8787),_0x2ef9a3=null,_0x18fdb5=null;};for(let _0xf0934a=0x0;_0xf0934a<_0x2fb43b['length'];_0xf0934a++){const _0x2506a5=_0x2fb43b[_0xf0934a];if(this['_isExistingContentComment'](_0x2506a5)){_0x32b85e(_0x95eb2c);continue;}if(_0x489441(_0x2506a5)){const _0x1b1844=fs(_0x2506a5,'data-id'),_0x4ecfc0=_0xf0934a===_0x2fb43b['length']-0x1;if(_0x1b1844&&'new-element'!==_0x1b1844&&this['_touchedNodesState']['modifiedIds']['includes'](_0x1b1844)&&!_0x4ecfc0){_0x32b85e(_0x1b1844),_0x95eb2c=_0x1b1844;continue;}}let _0x13da3f=null;const _0x3ca8e2=Ls(_0x2506a5);if(_0x3ca8e2&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x3ca8e2))_0x95eb2c=_0x3ca8e2;else{if(_0x3ca8e2&&this['_touchedNodesState']['newIds']['includes'](_0x3ca8e2))_0x13da3f='N';else{if(!xs(_0x2506a5))continue;_0x13da3f='R';}_0x13da3f===_0x18fdb5||null===_0x18fdb5?_0x18fdb5=_0x13da3f:null!==_0x2ef9a3?(_0x32b85e(_0x95eb2c),_0x18fdb5=_0x13da3f):(_0x2ef9a3=_0x18fdb5,_0x18fdb5=_0x13da3f),_0x95eb2c=_0x3ca8e2;}}const _0x35143c=_0x2fb43b[_0x2fb43b['length']-0x1];return _0x35143c&&!_0x489441(_0x35143c)&&!xs(_0x35143c)&&_0x95eb2c&&_0x32b85e(_0x95eb2c),_0x2b5970;}['_getLastStableElement'](_0x4c3087,_0x3bfc36){if(!_0x3bfc36)return null;const _0x302db2=Es('data-id',_0x3bfc36,_0x4c3087);if(!_0x302db2)return null;const _0x566f8c=[_0x302db2,...Rs(_0x302db2)]['at'](-0x2);if(_0x566f8c===_0x302db2)return _0x302db2;let _0x3bb0ed=_0x566f8c['previousSibling'];for(;_0x3bb0ed&&!_0x489441(_0x3bb0ed);)_0x3bb0ed=_0x3bb0ed['previousSibling'];return _0x3bb0ed;}['_markUnstableElements'](_0x2385fb,_0x5791de){const _0x556327=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x5f072c=_0x5791de?_0x5791de['nextSibling']:_0x2385fb['firstChild'];for(;_0x5f072c;)_0x489441(_0x5f072c)&&(_0x556327['has'](fs(_0x5f072c,'data-id'))||Ts('data-id',null,_0x5f072c)['some'](_0x4ea8e7=>_0x556327['has'](fs(_0x4ea8e7,'data-id'))))&&bs(_0x5f072c,'data-unstable','true'),_0x5f072c=_0x5f072c['nextSibling'];}['_isNewNode'](_0x304ec1){return Boolean('new-element'===fs(_0x304ec1,'data-id'));}['_isExistingNode'](_0x308205){return Boolean((fs(_0x308205,'data-id')||'')['length']>0x0&&'new-element'!==fs(_0x308205,'data-id'));}['_isExistingContentComment'](_0x2f17bf){return Boolean(_0xc2cc58(_0x2f17bf)&&ms(_0x2f17bf)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function xs(_0x4338bf){return!!_0x4338bf&&Boolean(_0xc2cc58(_0x4338bf)&&ms(_0x4338bf)['match'](/removed[\s*-]data-id="[^"]+"/));}function Ls(_0x1c818e){if(!_0x1c818e)return null;if(_0x489441(_0x1c818e))return fs(_0x1c818e,'data-id')??null;if(_0xc2cc58(_0x1c818e)){const _0x453ff6=ms(_0x1c818e)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x453ff6&&_0x453ff6[0x1])return _0x453ff6[0x1];}return null;}function Ds(_0x3c6db9,_0x3fa5be){const _0x230de9=new Map();for(const _0x504b0f of ws(_0x3c6db9))_0x230de9['set'](fs(_0x504b0f,'data-id'),_0x504b0f);const _0x261edd=new Set();for(const _0x385f4d of ws(_0x3fa5be)){const _0x4d6b8a=fs(_0x385f4d,'data-id'),_0x2d1d54=_0x4d6b8a?_0x230de9['get'](_0x4d6b8a):void 0x0;_0x2d1d54?(_0x43a070(_0x385f4d,_0x373861(_0x2d1d54,!0x0)),_0x261edd['add'](_0x4d6b8a)):_0x2a7599(_0x385f4d);}for(const _0x3bc007 of Cs(_0x3fa5be))xs(_0x3bc007)&&_0x230de9['has'](Ls(_0x3bc007))&&_0x2a7599(_0x3bc007);const _0x484aae=new Set(Ts('data-id',null,_0x3fa5be)['map'](_0x23ce58=>fs(_0x23ce58,'data-id')));for(const [_0x3117b3,_0x4a0442]of _0x230de9){if(_0x261edd['has'](_0x3117b3))continue;let _0x2403a4=_0x4a0442['parent'],_0x2a8751=null;for(;_0x2403a4&&_0x489441(_0x2403a4);){const _0x10a03f=fs(_0x2403a4,'data-id');if(_0x10a03f&&_0x484aae['has'](_0x10a03f)){_0x2a8751=_0x10a03f;break;}_0x2403a4=_0x2403a4['parent'];}if(!_0x2a8751)continue;const _0x4551f5=Es('data-id',_0x2a8751,_0x3fa5be);_0x4551f5&&_0x1cca13(_0x4551f5,_0x373861(_0x4a0442,!0x0));}}const Ps=/* #__PURE__ -- @preserve */
26
+ gt();var Hs=class extends Ps{['_m2html'];constructor(){super();const _0x94d6de=Object['entries'](_0x387a1c),_0x1b0b51=_0x94d6de['findIndex'](([_0x217c9e])=>'rehypeDomRaw'===_0x217c9e);if(-0x1===_0x1b0b51)throw new ht('ai-response-parser-unable-to-set-up-parser');_0x94d6de['splice'](_0x1b0b51+0x1,0x0,['rehypeSanitize',_0x20d56a]),this['_m2html']=new _0x3e333d({'plugins':Object['fromEntries'](_0x94d6de)});}['convertMarkdownToHTML'](_0x4e31f5){const _0x101648=this['_m2html']['parse'](_0x4e31f5);return this['parseAndNormalizeHTML'](_0x101648);}['parseAndNormalizeHTML'](_0x1b3efc){return this['_parseHTML'](_0x1b3efc);}['_parseHTML'](_0x3d2294){const _0x1c7ecb=ps('<dummy>'+_0x3d2294['replace'](/<[^>]*?$/g,'')+'</dummy>');return Ms(_0x1c7ecb),_0x1c7ecb['children']=_0x1c7ecb['children'][0x0]['children'],_0x1c7ecb;}};function Ms(_0xd93574){for(const _0x259b3e of _0xd93574['children'])_0x489441(_0x259b3e)?'pre'!==_0x259b3e['name']&&Ms(_0x259b3e):_0x506b37(_0x259b3e)&&(_0x259b3e['data']=_0x259b3e['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function Vs({changeGroups:_0x46dfd0,documentContextContent:_0x1ebb87,showDiff:_0x4684c7,trimUnchanged:_0x1ce0e1=!0x0}){return _0x46dfd0['map'](_0x15db2c=>{if(!_0x15db2c['editor']||'destroyed'===_0x15db2c['editor']['state'])return null;if(!_0x30f76f(_0x15db2c['editor'],_0x15db2c['rootName']))return{'type':_0x15db2c['changes'][0x0]['type'],'index':_0x15db2c['index'],'content':new _0x3df49e([]),'hasChanges':!0x1};const _0x5c3780=new _0x3df49e([]),_0x2b5dda=new _0x3df49e([]),_0x463dbe=new Set();for(const _0x2496cb of _0x15db2c['changes'])'new'==_0x2496cb['type']&&Ts('data-id',null,_0x2496cb['node'])['forEach'](_0x4ba396=>{_0x463dbe['add'](fs(_0x4ba396,'data-id'));});for(const _0x364671 of _0x15db2c['changes'])if('removed'!=_0x364671['type']?_0x2b5dda['children']['push'](_0x364671['node']['cloneNode'](!0x0)):_0x4684c7||_0x463dbe['has'](_0x364671['id'])||_0x2b5dda['children']['push'](_0x364671['node']['cloneNode'](!0x0)),'new'!=_0x364671['type']&&(_0x4684c7||'removed'!=_0x364671['type'])){const _0x1544dd=ti(_0x4011cf=>fs(_0x4011cf,'data-id')==_0x364671['id'],_0x1ebb87['get'](_0x15db2c['documentId']),!0x0);_0x1544dd&&_0x5c3780['children']['push'](_0x1544dd['cloneNode'](!0x0));}let _0x3eb654,_0xd8b082;try{({content:_0x3eb654,hasChanges:_0xd8b082}=Us(_0x15db2c['editor'],_0x5c3780,_0x2b5dda,_0x4684c7,_0x1ce0e1));}catch{return{'type':_0x15db2c['changes'][0x0]['type'],'index':_0x15db2c['index'],'content':new _0x3df49e([]),'hasChanges':!0x1};}return{'type':_0x15db2c['changes'][0x0]['type'],'index':_0x15db2c['index'],'content':_0x3eb654,'hasChanges':_0xd8b082};})['filter'](_0x3c8550=>null!==_0x3c8550);}function Us(_0x12e59a,_0x58666c,_0x23b852,_0x110c53,_0x359b3f=!0x0){const _0x4c72ad=_0x12e59a['plugins']['get']('DocumentCompare'),_0x16a872=ms(_0x58666c),_0xa9753f=ms(_0x23b852),_0x47da27=_0x12e59a['data']['parse'](_0x16a872,'$root'),_0x5b97e5=_0x12e59a['model']['createPositionAt'](_0x47da27,0x0),_0x14bcdf=_0x4c72ad['getDiff'](_0x16a872,_0xa9753f,{'anchor':_0x5b97e5,'markDeletions':_0x110c53,'targetEditor':_0x12e59a})['getOperations']();if(0x0==_0x14bcdf['length'])return{'content':_0x58666c['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x110c53?function(_0xfb943,_0xc68e33,_0x31bbb3){if(0x0==_0xfb943['length'])return;const _0x41fe24=_0x31bbb3['plugins']['get']('DocumentCompare'),_0xebf2f8=_0x31bbb3['plugins']['get']('SuggestionsConversion');_0x31bbb3['model']['change'](_0x292ac5=>{const _0x470127=new Set();for(let _0x37a246=0x0;_0x37a246<_0xfb943['length'];_0x37a246++){const _0xfb9111=_0xfb943[_0x37a246];if(_0xfb9111['baseVersion']=null,_0xfb9111['isDocumentOperation']=!0x1,_0x41fe24['isMarkedRemoveOperation'](_0xfb9111)){const _0x1108b1=_0x38a66a(_0xfb9111['newRange'],_0x31bbb3['model']),_0x16bd66='suggestion:deletion:'+vt()+':$aiSuggestion';_0xc68e33['markers']['set'](_0x16bd66,_0x1108b1);}else switch(_0xfb9111['type']){case'rename':{if(_0xfb9111['oldName']==_0xfb9111['newName'])break;_0x292ac5['batch']['addOperation'](_0xfb9111),_0x31bbb3['model']['applyOperation'](_0xfb9111);const _0x39a161='$elementName',_0x3dcdcf=_0xfb9111['position'],_0xd7b133=_0x31bbb3['model']['createRange'](_0x3dcdcf,_0x31bbb3['model']['createPositionAt'](_0x3dcdcf['nodeAfter'],'end')),_0x48ca49='suggestion:attribute:'+_0x39a161+':'+vt()+':$aiSuggestion';_0xc68e33['markers']['set'](_0x48ca49,_0xd7b133);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0xfb9111['oldValue']==_0xfb9111['newValue'])break;_0x292ac5['batch']['addOperation'](_0xfb9111),_0x31bbb3['model']['applyOperation'](_0xfb9111);const _0x162175=_0xfb9111['key'];if(!_0xebf2f8['isRegisteredAttribute'](_0x162175))break;const _0x264f81=_0x38a66a(_0xfb9111['range'],_0x31bbb3['model']),_0x4e51e9='suggestion:attribute:'+_0x162175+':'+vt()+':$aiSuggestion';_0xc68e33['markers']['set'](_0x4e51e9,_0x264f81);break;}case'insert':{if(_0x292ac5['batch']['addOperation'](_0xfb9111),_0x31bbb3['model']['applyOperation'](_0xfb9111),Bs(_0xc68e33,_0xfb9111),_0xfb943[_0x37a246+0x1]&&'move'==_0xfb943[_0x37a246+0x1]['type'])break;const _0x37ba09=_0xfb9111['position'],_0x5ad68f=_0xfb9111['howMany'],_0x3531d4=_0x38a66a(_0x31bbb3['model']['createRange'](_0x37ba09,_0x37ba09['getShiftedBy'](_0x5ad68f)),_0x31bbb3['model']),_0x354073='suggestion:insertion:'+vt()+':$aiSuggestion';_0xc68e33['markers']['set'](_0x354073,_0x3531d4);break;}case'split':{_0x292ac5['batch']['addOperation'](_0xfb9111),_0x31bbb3['model']['applyOperation'](_0xfb9111),Bs(_0xc68e33,_0xfb9111);const _0x346c1e=_0xfb9111['splitPosition'],_0x3671e5=_0xfb9111['moveTargetPosition'],_0x1b4669=_0x31bbb3['model']['createRange'](_0x346c1e,_0x3671e5),_0xeb5a95='suggestion:insertion:'+vt()+':$aiSuggestion';_0xc68e33['markers']['set'](_0xeb5a95,_0x1b4669);break;}case'move':{_0x292ac5['batch']['addOperation'](_0xfb9111),_0x31bbb3['model']['applyOperation'](_0xfb9111),Bs(_0xc68e33,_0xfb9111);const _0x5225f4=_0xfb9111['getMovedRangeStart'](),_0x443592=_0xfb9111['howMany'];for(let _0x5bace6=0x0;_0x5bace6<_0x443592;_0x5bace6++){const _0xf3bd35=_0x5225f4['getShiftedBy'](_0x5bace6)['nodeAfter'];_0x470127['add'](_0xf3bd35);}break;}case'remove':{const _0x2e8e7b=_0xfb9111['sourcePosition'],_0x360d66=_0xfb9111['howMany'],_0x14d313=new _0x50ba30(_0x2e8e7b,_0x360d66);_0x292ac5['batch']['addOperation'](_0x14d313),_0x31bbb3['model']['applyOperation'](_0x14d313),Bs(_0xc68e33,_0xfb9111);break;}}}for(const _0x55942e of _0x470127){const _0x28e377=_0x31bbb3['model']['createRangeOn'](_0x55942e),_0x35393b='suggestion:formatBlock:$fakeWrap:'+vt()+':$aiSuggestion';_0xc68e33['markers']['set'](_0x35393b,_0x38a66a(_0x28e377,_0x31bbb3['model']));}});}(_0x14bcdf,_0x47da27,_0x12e59a):_0x12e59a['model']['change'](_0x225907=>{for(const _0x5d9069 of _0x14bcdf)if('remove'==_0x5d9069['type']){const _0x3ce39d=_0x5d9069['sourcePosition'],_0x1d6db6=_0x5d9069['howMany'],_0x2ab71b=new _0x50ba30(_0x3ce39d,_0x1d6db6);_0x225907['batch']['addOperation'](_0x2ab71b),_0x12e59a['model']['applyOperation'](_0x2ab71b),Bs(_0x47da27,_0x5d9069);}else{if('marker'==_0x5d9069['type']){const _0x91b379=_0x5d9069['name'],_0x38c248=_0x5d9069['newRange'];null!==_0x38c248?_0x47da27['markers']['set'](_0x91b379,_0x38c248):_0x47da27['markers']['delete'](_0x91b379);}else _0x5d9069['baseVersion']=null,_0x5d9069['isDocumentOperation']=!0x1,_0x225907['batch']['addOperation'](_0x5d9069),_0x12e59a['model']['applyOperation'](_0x5d9069),Bs(_0x47da27,_0x5d9069);}}),_0x359b3f){const _0x1d163a=Gs(_0x12e59a,_0x14bcdf,_0x47da27);Ks(_0x12e59a['model'],_0x1d163a),function(_0x570b1f,_0x37553e){const _0x3d9f29=_0x37553e['getFirstRange']()['start'];let _0x22345c=_0x37553e['getFirstRange']()['end'];const _0x3f0831=_0x3d9f29['root'];(_0x22345c['textNode']||_0x22345c['nodeAfter']&&_0x22345c['nodeAfter']['is']('$text'))&&(_0x4ec8f8(_0x22345c,'...'),$s(_0x3f0831,_0x22345c,0x3),_0x22345c=_0x22345c['getShiftedBy'](0x3)),(_0x3d9f29['textNode']||_0x3d9f29['nodeBefore']&&_0x3d9f29['nodeBefore']['is']('$text'))&&(_0x4ec8f8(_0x3d9f29,'...'),$s(_0x3f0831,_0x3d9f29,0x3),_0x3d9f29['parent']==_0x22345c['parent']&&(_0x22345c=_0x22345c['getShiftedBy'](0x3)));const _0x3bcc30=_0x570b1f['createRange'](_0x570b1f['createPositionAt'](_0x3f0831,0x0),_0x3d9f29),_0x46fbc5=_0x570b1f['createRange'](_0x22345c,_0x570b1f['createPositionAt'](_0x3f0831,'end')),_0x5a55b3=[..._0x3bcc30['getMinimalFlatRanges'](),..._0x46fbc5['getMinimalFlatRanges']()];_0x5a55b3['reverse']();for(const _0x444cd9 of _0x5a55b3)_0x3c01a8(_0x444cd9),Ys(_0x3f0831,_0x444cd9);}(_0x12e59a['model'],_0x1d163a);}return{'content':ps(_0x12e59a['data']['stringify'](_0x47da27,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function Bs(_0x3dd41c,_0x2c36d7){for(const [_0x4fe438,_0x3e9c1d]of _0x3dd41c['markers']){const _0x424b3f=_0x4e8468['_createFromRanges'](_0x3e9c1d['getTransformedByOperation'](_0x2c36d7));_0x424b3f['root']==_0x3dd41c?_0x3dd41c['markers']['set'](_0x4fe438,_0x424b3f):_0x3dd41c['markers']['delete'](_0x4fe438);}}function Gs(_0x210aaa,_0x60f65f,_0x5e7c3b){const _0x2a3c1a=_0x210aaa['plugins']['get']('DocumentCompare');let _0x254106=_0x210aaa['model']['createPositionAt'](_0x5e7c3b,Number['POSITIVE_INFINITY']),_0x2d9443=_0x210aaa['model']['createPositionAt'](_0x5e7c3b,0x0);for(const _0x17cbb6 of _0x60f65f){let _0x5e37c8,_0x369177;if(_0x2a3c1a['isMarkedRemoveOperation'](_0x17cbb6))_0x5e37c8=_0x17cbb6['newRange']['start'],_0x369177=_0x17cbb6['newRange']['end'];else switch(_0x254106=Fs(_0x254106,_0x17cbb6),_0x2d9443=Fs(_0x2d9443,_0x17cbb6),_0x17cbb6['type']){case'rename':_0x5e37c8=_0x17cbb6['position'],_0x369177=_0x5e37c8['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x5e37c8=_0x17cbb6['range']['start'],_0x369177=_0x17cbb6['range']['end'];break;case'insert':_0x5e37c8=_0x17cbb6['position'],_0x369177=_0x5e37c8['getShiftedBy'](_0x17cbb6['howMany']);break;case'split':_0x5e37c8=_0x17cbb6['splitPosition'],_0x369177=_0x17cbb6['moveTargetPosition'];break;case'merge':{const _0x497549=_0x17cbb6['targetPosition']['path']['slice'](0x0,-0x1);_0x5e37c8=_0x210aaa['model']['createPositionFromPath'](_0x5e7c3b,_0x497549),_0x369177=_0x5e37c8['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x5e3113=_0x17cbb6['howMany'],_0x9e4620=_0x17cbb6['sourcePosition']['_getTransformedByInsertion'](_0x17cbb6['targetPosition'],_0x5e3113),_0x935012=_0x17cbb6['getMovedRangeStart']();'remove'==_0x17cbb6['type']?(_0x5e37c8=_0x9e4620,_0x369177=_0x9e4620):(_0x5e37c8=_0x935012,_0x369177=_0x935012['getShiftedBy'](_0x5e3113));break;}}_0x5e37c8&&_0x5e37c8['isBefore'](_0x254106)&&(_0x254106=_0x5e37c8['clone'](),_0x254106['stickiness']='toNone'),_0x369177&&_0x369177['isAfter'](_0x2d9443)&&(_0x2d9443=_0x369177['clone'](),_0x2d9443['stickiness']='toNone');}return _0x210aaa['model']['createSelection'](_0x210aaa['model']['createRange'](_0x254106,_0x2d9443));}function Fs(_0x13a639,_0x104fbc){return'move'!=_0x104fbc['type']&&'remove'!=_0x104fbc['type']||_0x104fbc['sourceRange']['containsPosition'](_0x13a639)&&((_0x13a639=_0x104fbc['sourcePosition']['clone']())['stickiness']='toNone'),_0x13a639['getTransformedByOperation'](_0x104fbc);}function Ks(_0x531098,_0x1734bc){Ws(_0x531098,_0x1734bc,'forward');const _0x3dcdaf=_0x1734bc['getFirstRange']();_0x1734bc['setTo']([]),_0x1734bc['setTo'](_0x3dcdaf,{'backward':!0x0}),Ws(_0x531098,_0x1734bc,'backward');}function Ws(_0x407861,_0x501f70,_0x5ab3b9){let _0x3ed86e=0x14;for(;_0x3ed86e;){_0x407861['modifySelection'](_0x501f70,{'unit':'word','direction':_0x5ab3b9}),_0x3ed86e--;const _0x2c0d0d=_0x501f70['focus']['forward'==_0x5ab3b9?'nodeBefore':'nodeAfter'];if(_0x2c0d0d&&_0x2c0d0d['is']('element')&&_0x407861['schema']['isBlock'](_0x2c0d0d)&&_0x407861['schema']['isObject'](_0x2c0d0d))break;}}function Ys(_0x31bb16,_0x1381be){for(const [_0x14239c,_0x15a305]of _0x31bb16['markers']){const _0x4275ca=_0x15a305['_getTransformedByDeletion'](_0x1381be['start'],_0x1381be['end']['offset']-_0x1381be['start']['offset']);null!=_0x4275ca?_0x31bb16['markers']['set'](_0x14239c,_0x4275ca):_0x31bb16['markers']['delete'](_0x14239c);}}function $s(_0x46865f,_0x84e0f,_0x269c61){for(let [_0x5bdbad,_0x5f4bf2]of _0x46865f['markers'])_0x5f4bf2=_0x5f4bf2['_getTransformedByInsertion'](_0x84e0f,_0x269c61,!0x1)[0x0],_0x46865f['markers']['set'](_0x5bdbad,_0x5f4bf2);}const qs=/* #__PURE__ -- @preserve */
27
+ ut();var Qs=class extends qs{['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x429d70,config:_0x29b55b,locale:_0xa7eae7}){super(),this['_connector']=_0x429d70,this['_config']=_0x29b55b,this['_locale']=_0xa7eae7;}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 _0xdb5d85=await this['getAll']();let _0x29f7a5;return _0x29f7a5=this['_availableModels']?this['_filterModels'](_0xdb5d85,this['_availableModels']):_0xdb5d85['filter'](_0x5580b8=>_0x5580b8['recommended']),_0x29f7a5;}async['getModel'](_0x56b7a1){const _0x38da6f=await this['getAll']();if(!_0x38da6f['length'])return null;if(_0x56b7a1){const _0x2ba722=this['_getModelById'](_0x38da6f,_0x56b7a1);if(_0x2ba722)return _0x2ba722;bt('ai-chat-model-id-unrecognized',{'modelId':_0x56b7a1,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x5a3d85=await this['getAvailableModels']();if(!_0x5a3d85['length'])return null;if(this['_defaultModelId']){const _0x248bdd=this['_getModelById'](_0x5a3d85,this['_defaultModelId']);if(_0x248bdd)return _0x248bdd;bt('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x5a3d85[0x0]['id']});}return _0x5a3d85[0x0];}async['isAvailable'](_0xce2bff){return(await this['getAvailableModels']())['some'](_0x63ff0f=>_0x63ff0f['name']===_0xce2bff['name']&&_0x63ff0f['provider']===_0xce2bff['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length']){const _0x476203=this['_locale']['uiLanguage']||'en',_0x402a01=await this['_connector']['getModels'](_0x476203)['list']();this['_modelList']=_0x402a01['items']['map'](_0x2c5a6d=>Xs(_0x2c5a6d)?{..._0x2c5a6d,'name':us(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x2c5a6d);}return[...this['_modelList']];}['_filterModels'](_0x58a65c,_0x1ccfe4){let _0x19a43a;if(_0x1ccfe4){_0x19a43a=[];const _0x596ee9=new Set(),_0x12f58d='string'==typeof _0x1ccfe4?[_0x1ccfe4['toLocaleLowerCase']()]:_0x1ccfe4['map'](_0x3211e6=>_0x3211e6['toLocaleLowerCase']());for(const _0x14b3c1 of _0x12f58d)for(const _0x2c6776 of _0x58a65c)!_0x596ee9['has'](_0x2c6776['id'])&&this['_isMatchingFilter'](_0x2c6776,_0x14b3c1)&&(_0x19a43a['push'](_0x2c6776),_0x596ee9['add'](_0x2c6776['id']));}else _0x19a43a=_0x58a65c;return _0x19a43a;}['_isMatchingFilter'](_0x53f4c0,_0x4b61ba){const _0x57e9ca=_0x53f4c0['id']['toLocaleLowerCase'](),_0x404806=_0x53f4c0['name']['toLocaleLowerCase'](),_0x3c3e74=_0x53f4c0['provider']['toLocaleLowerCase']();return _0x57e9ca===_0x4b61ba||_0x404806===_0x4b61ba||Xs(_0x53f4c0)&&'auto'===_0x4b61ba||_0x3c3e74===_0x4b61ba||_0x57e9ca['startsWith'](_0x4b61ba);}['_getModelById'](_0x2995f7,_0x54da9e){return _0x2995f7['find'](_0x45ffda=>Xs(_0x45ffda)&&'auto'===_0x54da9e?_0x45ffda:_0x45ffda['id']===_0x54da9e)||null;}};function Xs(_0x392847){return _0x392847['id']['startsWith']('agent');}function zs(_0x45b37a,_0x299ec3){for(const _0x16da91 of _0x45b37a)'noop'!==_0x16da91['type']&&(_0x16da91['_aiSource']=_0x299ec3);}var js=class extends _0x5d28a2{static get['pluginName'](){return'AIGateway';}static get['requires'](){return[_0x1cf5c4];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return new Qs({'connector':this['context']['plugins']['get']('AIConnector'),'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']})['getAll']();}['apply'](_0x3e4859,_0x5c6f7a){if('completed'!==_0x3e4859['status'])throw new ht('ai-gateway-apply-invalid-status',this,{'status':_0x3e4859['status']});const _0x3a1fb8=_0x3e4859['editor'],{applyMethod:_0x2edad3}=_0x5c6f7a;if('suggest'===_0x2edad3&&!_0x3a1fb8['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',this);const _0x1d8527='suggest'===_0x2edad3,_0x549eff=this['context']['plugins']['get'](_0x1cf5c4),_0x4a49dc=_0x3a1fb8['model']['createPositionAt'](_0x3a1fb8['model']['document']['getRoot'](),0x0),_0x2e4ed3=_0x549eff['getDiff'](_0x3e4859['contentRawOld'],_0x3e4859['contentRawNew'],{'anchor':_0x4a49dc,'markDeletions':_0x1d8527,'targetEditor':_0x3a1fb8}),_0x2e0ac0=_0x3a1fb8['model']['document']['history']['getOperations'](_0x3e4859['documentVersion']),_0x4ff93b={'document':_0x3a1fb8['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x4e2410=_0x29e916(_0x2e4ed3['getOperations'](),_0x2e0ac0,_0x4ff93b)['operationsA'];zs(_0x4e2410,_0x5c6f7a['aiSource']??'api'),_0x3a1fb8['model']['change'](_0x29666e=>{_0x1d8527?_0x3a1fb8['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x4e2410):_0x549eff['applyOperations'](_0x29666e,_0x4e2410);});}['mergeChangesIntoContent'](_0x2e2c34,_0xc6f4b9,_0x460e05){const _0xe45099=new Hs(),_0x39c13a=new ys();let _0xbc3b9f=_0xe45099['parseAndNormalizeHTML'](_0xc6f4b9);for(const _0x5bfca6 of _0x2e2c34)try{const _0x2a29fb=_0xe45099['parseAndNormalizeHTML'](_0x5bfca6['content']);_0xbc3b9f=_0x39c13a['merge'](_0x2a29fb,_0xbc3b9f,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x5508c6){throw new ht('ai-gateway-merge-failed',this,{..._0x5bfca6},_0x5508c6);}return Us(_0x460e05,_0xe45099['parseAndNormalizeHTML'](_0xc6f4b9),_0xbc3b9f,!0x1,!0x1)['content'];}},Js=class{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0x2abfc2){this['_editor']=_0x2abfc2['editor'],this['_rootName']=_0x2abfc2['rootName'],this['_channelId']=_0x2abfc2['channelId'],this['_sessionId']=_0x2abfc2['sessionId'];}get['status'](){return this['_error']?'error':this['_isAborted']?'aborted':void 0x0!==this['_contentRawNew']?'completed':'initialized';}get['editor'](){return this['_editor'];}get['rootName'](){return this['_rootName'];}get['channelId'](){return this['_channelId'];}get['sessionId'](){return this['_sessionId'];}get['documentVersion'](){return this['_documentVersion'];}set['documentVersion'](_0x5e9433){this['_documentVersion']=_0x5e9433;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0x27d301){this['_contentRawOld']=_0x27d301;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0x978b11){this['_contentRawNew']=_0x978b11;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x359ce7){this['_error']=_0x359ce7;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0x16428e){return _0x16428e['replace'](/ data-id="[a-z0-9]+"/g,'');}},Zs=class extends Js{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0x551e79){this['_summary']=_0x551e79;}},tn=class extends _0x5d28a2{static get['pluginName'](){return'AIDocumentProcessingGateway';}static get['requires'](){return[ls,Is,js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['processDocument'](_0x2c564e,_0x153dec){if(!_0x2c564e)throw new ht('ai-documentprocessinggateway-missing-prompt',this);const _0x5ccce1=await this['context']['plugins']['get'](Is)['getDocumentData']();if(!_0x5ccce1[0x0])throw new ht('ai-documentprocessinggateway-missing-document',this);const _0x19344a=new Zs({'editor':_0x5ccce1[0x0]['editor'],'rootName':_0x5ccce1[0x0]['rootName'],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x5ccce1[0x0]['sessionId']});if(_0x19344a['contentRawOld']=_0x5ccce1[0x0]['content'],_0x19344a['documentVersion']=_0x5ccce1[0x0]['version'],_0x153dec?.['signal']?.['aborted'])return _0x19344a['abort'](),_0x19344a;const _0x5c1cb2=this['context']['plugins']['get']('AIConnector')['processDocument']({'document':_0x19344a['contentRawOld'],'prompt':_0x2c564e,'model':_0x153dec['model']});let _0x25160c;if(_0x153dec?.['signal']){if(_0x153dec['signal']['aborted'])return _0x5c1cb2['abortController']['abort'](),_0x19344a['abort'](),_0x19344a;const _0x525a9f=_0x153dec['signal'],_0xe02a92=()=>_0x5c1cb2['abortController']['abort']();_0x525a9f['addEventListener']('abort',_0xe02a92),_0x25160c=()=>_0x525a9f['removeEventListener']('abort',_0xe02a92);}try{const _0x296cb3=await _0x5c1cb2['getResult']();if(!(_0x296cb3&&_0x296cb3['document']&&_0x296cb3['document']['length']>0x0))throw new ht('ai-documentprocessinggateway-empty-reply',this);_0x19344a['contentRawNew']=_0x296cb3['document'],_0x19344a['summary']=_0x296cb3['summary']||'';}catch(_0x393edf){_0x393edf instanceof Error&&_0x393edf['message']['includes']('ai-request-aborted')?_0x19344a['abort']():_0x19344a['error']=_0x393edf instanceof ht?_0x393edf:new ht('ai-documentprocessinggateway-run-failed',this,{},_0x393edf);}finally{_0x25160c&&_0x25160c();}return _0x19344a;}['applyResult'](_0x4f7e8e,_0x3b7b32){this['context']['plugins']['get']('AIGateway')['apply'](_0x4f7e8e,_0x3b7b32);}};function en(_0x2a51cb){return _0x2a51cb instanceof Error&&('AbortError'===_0x2a51cb['name']||('AICoreError'===_0x2a51cb['name']?!0x0===_0x2a51cb['isAbort']:_0x2a51cb['message']['startsWith']('ai-request-aborted')));}var sn=class extends Error{['code'];['severity'];['type'];['context'];['isAbort'];constructor(_0x3ab87c){super(_0x3ab87c['code'],_0x3ab87c['cause']instanceof Error?{'cause':_0x3ab87c['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0x3ab87c['code'],this['severity']=_0x3ab87c['severity']??'error',this['type']=_0x3ab87c['type']??'system',this['context']=_0x3ab87c['context'],this['isAbort']=_0x3ab87c['isAbort']??en(_0x3ab87c['cause']);}},nn=class extends _0x5d28a2{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['createReporter'](_0x1aae3c){return new rn(this,_0x1aae3c);}},rn=class{['_sink'];['_component'];constructor(_0x4ecee9,_0x10c734){this['_sink']=_0x4ecee9,this['_component']=_0x10c734;}['logError'](_0x20a843,_0x2611bb={}){this['_emit'](_0x20a843,_0x2611bb),this['_defaultLog'](_0x20a843);}['reportError'](_0x3d6606,_0x1c92e1={}){this['_emit'](_0x3d6606,_0x1c92e1);}['_emit'](_0xeb45b3,_0x41679c){en(_0xeb45b3)||this['_sink']['fire']('error',{'error':_0xeb45b3,'component':this['_component'],'context':_0x41679c['context']});}['_defaultLog'](_0x335262){if(!en(_0x335262)){if(_0x335262 instanceof sn){if('user'===_0x335262['type']||'network'===_0x335262['type'])return;if('warning'===_0x335262['severity'])return void console['warn'](this['_component'],_0x335262);}console['error'](this['_component'],_0x335262);}}};const on='ck-ai-button-primary',an='ck-ai-button-secondary',hn='ck-ai-button-tertiary';function cn(_0x5461e1,_0x2e769e){const _0xe5bb1e=new Ht(_0x5461e1),_0x2a3915=us(_0x5461e1,'AI_TABS_LABEL_MINIMIZE'),_0x25f4ee=us(_0x5461e1,'AI_TABS_LABEL_MAXIMIZE');return _0xe5bb1e['set']({'withText':!0x1,'icon':_0x14d558,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+hn}),_0xe5bb1e['bind']('label')['to'](_0x2e769e,'isMaximized',_0x10f29d=>_0x10f29d?_0x2a3915:_0x25f4ee),_0xe5bb1e['bind']('icon')['to'](_0x2e769e,'isMaximized',_0x19b9fc=>_0x19b9fc?_0x4df119:_0x14d558),_0xe5bb1e['bind']('isOn')['to'](_0x2e769e,'isMaximized'),_0xe5bb1e['on']('execute',()=>{_0x2e769e['fire']('resizeTabs');}),_0xe5bb1e;}function ln(_0x32ae18){const _0x99c722=new Lt(_0x32ae18);return _0x99c722['attachToDom'](),_0x99c722['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x99c722;}const un=/* #__PURE__ -- @preserve */
28
+ gt();var dn=class extends un{['id'];['interactionId'];['type'];['content']=new Map();['sources']=[];['parsedContent']=new Map();['parsedMergedContent']=new Map();['changeGroups']=[];['areActionsDisabled']=!0x1;['isFromHistory']=!0x1;['documentContextContent'];['_documentIdToSource']=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];['cachedSuggestionContentParts']={'withDiff':[],'withoutDiff':[]};constructor({type:_0x1737ca,isDone:_0x447031=!0x1,isComplete:_0x3ffa2d,interactionId:_0x277315,areActionsDisabled:_0xa05282,isFromHistory:_0x6cc929=!0x1,documentContextContent:_0x554399,locale:_0x2077d7,id:_0x1aa88c,channelsToEditors:_0x1814f4}){super(),this['id']=_0x1aa88c||vt(),this['interactionId']=_0x277315,this['type']=_0x1737ca,this['areActionsDisabled']=!!_0xa05282,this['isFromHistory']=_0x6cc929,this['locale']=_0x2077d7,this['aiResponseParser']=new Hs(),this['aiResponseApplier']=new ys(),this['documentContextContent']=new Map(_0x554399?.['map'](_0x5cb955=>[_0x5cb955['id'],ps(_0x5cb955['content'])])||[]),this['_documentIdToSource']=new Map(_0x554399?.['map'](_0x1f590d=>[_0x1f590d['id'],{'editor':_0x1814f4['get'](_0x1f590d['channelId']),'rootName':_0x1f590d['rootName']}])||[]),this['set']('isDone',_0x447031),this['set']('isComplete',_0x3ffa2d??_0x447031),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x3ed08b,_0x3f5da3){const _0x300490='text'===this['type']?'text':_0x3f5da3;this['content']['has'](_0x300490)||this['content']['set'](_0x300490,''),this['content']['set'](_0x300490,this['content']['get'](_0x300490)+_0x3ed08b),this['onContentChange'](_0x300490);}['done'](_0x5d083c=!0x0){this['isComplete']=_0x5d083c,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x591845,_0x5ebd67){this['changeGroups'][_0x591845]['state']=_0x5ebd67,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x591845,'state':_0x5ebd67});}['getContentParts']({showDiff:_0x4d7b62,groupIndex:_0x1aeaba}){const _0x1267a2=this['_getCachedContentParts'](_0x4d7b62,_0x1aeaba);if(_0x1267a2)return _0x1267a2;let _0x5d5d9b=[];if(void 0x0===_0x1aeaba)_0x5d5d9b=this['changeGroups'];else{const _0xb2a688=this['changeGroups']['find'](({index:_0x335761})=>_0x335761===_0x1aeaba);if(!_0xb2a688)throw new ht('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x1aeaba});_0x5d5d9b=[_0xb2a688];}const _0x2e1bc4=Vs({'showDiff':_0x4d7b62,'changeGroups':_0x5d5d9b,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x4d7b62,_0x2e1bc4),_0x2e1bc4;}['_getCachedContentParts'](_0x3ac7fa,_0x22d0f8){const _0x2bc394=_0x3ac7fa?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x2bc394]['length'])return null;const _0x37ac78=this['cachedSuggestionContentParts'][_0x2bc394];if(void 0x0===_0x22d0f8)return _0x37ac78['length']>0x0&&_0x37ac78['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x3ac7fa,null),null):_0x21b61f(_0x37ac78);{const _0x3e915f=_0x37ac78['find'](({index:_0x3a812a})=>_0x3a812a===_0x22d0f8);if(_0x3e915f)return[_0x21b61f(_0x3e915f)];}return null;}['_setCachedContentParts'](_0x280c1c,_0x3471c7){const _0x1dcea6=_0x280c1c?'withDiff':'withoutDiff';_0x3471c7?_0x3471c7['forEach'](_0x4745dd=>{const _0x4d959d=this['cachedSuggestionContentParts'][_0x1dcea6],_0x32be68=_0x4d959d['find'](({index:_0x2828d3})=>_0x2828d3===_0x4745dd['index']);if(_0x32be68){const _0xa5643e=_0x4d959d['indexOf'](_0x32be68);_0x4d959d['splice'](_0xa5643e,0x1,_0x4745dd);}else _0x4d959d['push'](_0x4745dd);}):this['cachedSuggestionContentParts'][_0x1dcea6]['length']=0x0;}['onContentChange'](_0x127073){if('modification'===this['type']){if(_0x127073)this['parsedContent']['set'](_0x127073,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x127073)));else{for(const [_0x43fac4,_0x1c125a]of this['content'])this['parsedContent']['set'](_0x43fac4,this['aiResponseParser']['parseAndNormalizeHTML'](_0x1c125a));}const _0x1a2756=this['changeGroups'];for(const _0x418ad1 of this['content']['keys']())this['updateChangeGroups'](_0x418ad1);const _0x3ac1f2=this['_getDifferentChangeGroups'](_0x1a2756,this['changeGroups']);(_0x3ac1f2['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x3ac1f2),this['cachedSuggestionContentParts']['withDiff']['length']=this['cachedSuggestionContentParts']['withoutDiff']['length']=0x0);}else this['parsedContent']['set']('text',this['aiResponseParser']['convertMarkdownToHTML'](this['content']['get']('text'))),this['fire']('replyContentUpdated',this);}['_getDifferentChangeGroups'](_0x1ae85c,_0x4226cf){const _0x87cc2=[];for(const _0x3e9be5 of _0x4226cf){const _0x1f6f7f=_0x1ae85c[_0x3e9be5['index']];_0x1f6f7f?_0x1f6f7f['changes']['length']!==_0x3e9be5['changes']['length']?_0x87cc2['push'](_0x3e9be5):_0x1f6f7f['changes']['forEach']((_0x46af3e,_0x3d413c)=>{const _0x211390=_0x3e9be5['changes'][_0x3d413c];_0x46af3e['id']!==_0x211390['id']&&_0x87cc2['push'](_0x3e9be5);}):_0x87cc2['push'](_0x3e9be5);}return _0x87cc2;}['updateChangeGroups'](_0x3ea8bc){const _0xe6a14a=this['documentContextContent']['get'](_0x3ea8bc),_0x48fee6=this['parsedContent']['get'](_0x3ea8bc);if(!_0xe6a14a||!_0x48fee6)return;const _0x245472=new _0x1a4ef3('p',{},[new _0x1a4ef3('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0xecc90d(us(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x2d5ace=this['aiResponseApplier']['merge'](_0x48fee6,_0xe6a14a['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x245472});this['parsedMergedContent']['set'](_0x3ea8bc,_0x2d5ace['parsedContent']);let _0x4d3763=[];if(_0x5380b2(_0x43b4af=>{const _0x5ed04e=fs(_0x43b4af,'data-id');if(!_0x5ed04e||!_0xf94a6f(_0x5ed04e))return!0x1;const _0x13c079=[_0x43b4af,...Rs(_0x43b4af)]['at'](-0x2);if(_0x43b4af!=_0x13c079){const _0x5cf09b=fs(_0x13c079,'data-id');_0xf94a6f(_0x5cf09b)||(_0x4d3763['push']({'node':_0x13c079,'id':_0x5cf09b,'type':'modified'}),_0x2d5ace['modifiedNodeIds']['push'](_0x5cf09b));}else _0x2d5ace['modifiedNodeIds']['includes'](_0x5ed04e)?_0x4d3763['push']({'node':_0x43b4af,'type':'modified','id':_0x5ed04e}):_0x2d5ace['newNodeIds']['includes'](_0x5ed04e)?_0x4d3763['push']({'node':_0x43b4af,'type':'new','id':_0x5ed04e,'anchorId':fs(_0x43b4af['previousSibling'],'data-id')}):_0x4d3763['push']({'node':_0x43b4af,'type':'removed','id':_0x5ed04e});return!0x0;},this['parsedMergedContent']['get'](_0x3ea8bc)),_0x4d3763=_0x4d3763['filter'](({node:_0x4b15f3})=>[...Rs(_0x4b15f3),_0x4b15f3]['every'](_0x350412=>!fs(_0x350412,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x5e826c=>_0x5e826c['documentId']!==_0x3ea8bc),0x0==_0x4d3763['length'])return;const _0x42bf4b=[[_0x4d3763[0x0]]];for(let _0x5dce1e=0x1;_0x5dce1e<_0x4d3763['length'];_0x5dce1e++){const _0xf20a9f=_0x42bf4b[_0x42bf4b['length']-0x1],_0x4b798a=_0xf20a9f[_0xf20a9f['length']-0x1];_0x4d3763[_0x5dce1e]['node']['previousSibling']==_0x4b798a['node']&&'modified'!=_0x4d3763[_0x5dce1e]['type']&&'modified'!=_0x4b798a['type']?_0xf20a9f['push'](_0x4d3763[_0x5dce1e]):_0x42bf4b['push']([_0x4d3763[_0x5dce1e]]);}for(const _0x4a371d of _0x42bf4b){const _0x45556e=_0x4a371d[0x0],_0x40f281=_0x4a371d[_0x4a371d['length']-0x1],_0xfdde55=_0x6ffec(_0x45556e['node']['previousSibling']);_0xfdde55&&_0x4a371d['unshift'](_0xfdde55);const _0x23721b=_0x6ffec(_0x40f281['node']['nextSibling']);_0x23721b&&_0x4a371d['push'](_0x23721b);}Ts('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x3ea8bc))['forEach'](_0x3144c3=>{bs(_0x3144c3,'data-wrapped-id',null);});const _0x582ca6=new Map();Ts('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x3ea8bc))['forEach'](_0x1800d4=>{const _0x376726=fs(_0x1800d4,'data-unwrapped-id'),_0xfca508=fs(_0x1800d4,'data-id');_0x582ca6['set'](_0xfca508,_0x376726),bs(_0x1800d4,'data-id',_0x376726),bs(_0x1800d4,'data-unwrapped-id',null);});for(const _0x332cba of _0x4d3763){const _0x5eb6e6=_0x582ca6['get'](_0x332cba['id']);_0x5eb6e6&&(_0x332cba['id']=_0x5eb6e6);}this['changeGroups']['push'](..._0x42bf4b['map']((_0xda7ef2,_0x5c9afd)=>({'changes':_0xda7ef2,'state':'pending','index':_0x5c9afd,'editor':this['_documentIdToSource']['get'](_0x3ea8bc)['editor'],'rootName':this['_documentIdToSource']['get'](_0x3ea8bc)['rootName'],'documentId':_0x3ea8bc})));const _0x3bacab=Array['from'](this['documentContextContent']['keys']());function _0xf94a6f(_0x4e506c){return _0x2d5ace['modifiedNodeIds']['includes'](_0x4e506c)||_0x2d5ace['newNodeIds']['includes'](_0x4e506c)||_0x2d5ace['removedNodeIds']['includes'](_0x4e506c);}function _0x6ffec(_0x8cf620){if(_0x8cf620&&fs(_0x8cf620,'data-id')&&!fs(_0x8cf620,'data-unstable')){const _0xa041c4=fs(_0x8cf620,'data-id');if(!_0xf94a6f(_0xa041c4))return{'node':_0x8cf620,'type':'context','id':_0xa041c4};}return null;}this['changeGroups']['sort']((_0x1e17fc,_0x5490c9)=>_0x3bacab['indexOf'](_0x1e17fc['documentId'])-_0x3bacab['indexOf'](_0x5490c9['documentId'])),this['changeGroups']['forEach']((_0x181a53,_0x5f1750)=>{_0x181a53['index']=_0x5f1750;});}};const _n=/* #__PURE__ -- @preserve */
29
+ ut(),gn=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];var An=class extends _n{['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;['_channelsToEditors'];constructor({connector:_0x46f787,locale:_0x2e05d9,channelsToEditors:_0x3507e9}){super(),this['id']=vt(),this['connector']=_0x46f787,this['isStopped']=!0x0,this['locale']=_0x2e05d9,this['_channelsToEditors']=_0x3507e9||new Map();}async['start'](){await this['_run']();}async['resume'](_0x2afb63){await this['_run'](_0x2afb63);}async['_run'](_0x5e10f1){const _0x1aa5fd=[];let _0x2c036b,_0x15e225,_0x469afd,_0x351a4b=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x5e10f1||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x4810b7=await this['currentRequest']['getStream']();for await(const _0x4755c0 of _0x4810b7){if(this['isStopped'])return;if('error'==_0x4755c0['event'])return void this['fire']('error',{'error':new ht('ai-chat-interaction-error',this)});switch(_0x4755c0['event']){case'message-metadata':this['messageId']=_0x4755c0['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x4755c0['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x4755c0['data']['conversationTitle'],!0x0);break;case'source':_0x1aa5fd['push'](_0x4755c0['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'](),_0x2c036b='modification-delta'==_0x4755c0['event']?'modification':'text',_0x15e225='modification-delta'==_0x4755c0['event']?_0x4755c0['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x2c036b&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x2c036b,'interactionId':this['id'],'id':_0x15e225,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x4755c0['event']&&{'documentId':_0x4755c0['data']['documentId']}}),'modification'==_0x2c036b&&(this['currentReply']['sources']=_0x1aa5fd['splice'](0x0))),this['currentReply']['appendContent'](_0x4755c0['data']['textDelta'],_0x4755c0['data']['documentId']);break;case'mcp-tool-result':_0x469afd=JSON['parse'](_0x4755c0['data']['result']),this['_handleToolResultData']({'toolName':_0x4755c0['data']['toolName'],'data':_0x469afd['data'],'attributes':_0x469afd['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x4755c0['data']['toolName'],'data':_0x4755c0['data']['data']});}}_0x351a4b=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x1aa5fd['length']>0x0&&(this['currentReply']['sources']=_0x1aa5fd['splice'](0x0)),this['_finalizeInteraction'](_0x351a4b),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x13cdfb){return this['replies']['find'](_0x55218f=>_0x55218f['id']===_0x13cdfb);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x1c4776=>_0x1c4776['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x1462d5){const _0x5a0f32=this['getDocumentContext'](),_0x23afda=new dn({'locale':this['locale'],'documentContextContent':_0x5a0f32?.['documents'],..._0x1462d5});return this['replies']['push'](_0x23afda),_0x23afda['delegate'](...gn)['to'](this),this['fire']('replyCreated',_0x23afda),_0x23afda;}['setConversationTitle'](_0x88b819,_0x2a7125=!0x1){this['fire']('setConversationTitle',_0x88b819,_0x2a7125);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x2deae4){this['fire']('toolDataReceived',{'type':'result','toolName':_0x2deae4['toolName'],'data':structuredClone(_0x2deae4['data']||{}),'attributes':structuredClone(_0x2deae4['attributes']||{})},this);}['_handleToolNotificationData'](_0x48694c){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x48694c['toolName'],'data':structuredClone(_0x48694c['data'])},this);}['_finalizeInteraction'](_0x17188c=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x17188c),this['currentRequest']=this['currentReply']=void 0x0;}};const In=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']]),pn=/* #__PURE__ -- @preserve */
30
+ gt(),mn=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];var En=class AIChatContext extends pn{['_connector'];['_config'];['_ownerId'];constructor({connector:_0x320143,config:_0x5a3feb,ownerId:_0x3ef225}){super(),this['_connector']=_0x320143,this['_config']=_0x5a3feb,this['_ownerId']=_0x3ef225;}['init'](){this['_pendingContextItems']=new Map(),this['_conversationContextItems']=new Map(),this['_ongoingUploads']=new Map(),this['_ongoingUploadOperations']=new Map(),this['_setAddContextOptionsDefaultState']();}['getPendingContextItems'](){return new Map(this['_pendingContextItems']);}async['populateFromMessage'](_0x333da7,_0x109d16){const _0x1f5bea=new Map(),{contextItem:_0x8895b2,hasUnmatched:_0x1c7212}=await this['_populateDocumentContextItem'](_0x333da7,_0x109d16);_0x8895b2&&_0x1f5bea['set'](_0x8895b2['id'],_0x8895b2);for(const _0x57c0e5 of _0x333da7){if('document'===_0x57c0e5['type'])continue;const _0xb65412=await this['_createContextItemFromContent'](_0x57c0e5);this['_addToConversationContextItem'](_0xb65412),_0x1f5bea['set'](_0xb65412['id'],_0xb65412);}return{'contextItems':_0x1f5bea,'hasUnmatched':_0x1c7212};}async['_populateDocumentContextItem'](_0x166e0f,_0x1996e1){const _0xa64785=_0x166e0f['filter'](_0x450666=>'document'===_0x450666['type']);if(0x0===_0xa64785['length'])return{'hasUnmatched':!0x1};const _0x13a381=_0xa64785['map'](_0x45eab7=>_0x45eab7['id']),_0x34a85e=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x13a381)['getDocuments'](),_0x5a2ce9=new Map(_0x34a85e['map'](_0x4a9c8d=>[_0x4a9c8d['id'],_0x4a9c8d])),_0x541f81=[];let _0x3fc271=!0x1;for(const _0x8d3ddd of _0xa64785){const _0x34981b=_0x5a2ce9['get'](_0x8d3ddd['id']);_0x34981b&&(this['_matchDocumentToRoot'](_0x34981b,_0x1996e1)||(_0x3fc271=!0x0),_0x541f81['push']({'id':_0x34981b['id'],'content':_0x34981b['content'],'version':_0x34981b['attributes']?.['version']??0x0,'sessionId':_0x34981b['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x34981b['attributes']?.['channelId']??_0x1996e1[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x34981b['attributes']?.['rootName']??_0x1996e1[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0x2f3c72={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x541f81};return this['_addToConversationContextItem'](_0x2f3c72),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x2f3c72,'hasUnmatched':_0x3fc271};}['_matchDocumentToRoot'](_0x4d8fe5,_0x57b883){const _0x24b7d1=_0x4d8fe5['attributes']?.['channelId'],_0x1e384a=_0x4d8fe5['attributes']?.['rootName'];if(_0x24b7d1&&_0x1e384a){for(const _0x2f585c of _0x57b883)if(_0x2f585c['config']['get']('collaboration.channelId')===_0x24b7d1){for(const _0x4f8ee9 of _0x2f585c['model']['document']['getRoots']())if('$graveyard'!==_0x4f8ee9['rootName']&&_0x4f8ee9['rootName']===_0x1e384a)return{'editor':_0x2f585c,'rootName':_0x4f8ee9['rootName']};}}}async['_createContextItemFromContent'](_0x437f24){return'mcp-tool-context'===_0x437f24['type']?{'id':_0x437f24['id'],'uiId':_0x437f24['id'],'label':_0x437f24['data']?.['label']||_0x437f24['id'],'type':'mcp-tool-context','mcpServerName':_0x437f24['mcpServerName'],'toolName':_0x437f24['toolName'],'data':_0x437f24['data']||{}}:{'id':_0x437f24['id'],'uiId':_0x437f24['id'],'label':_0x437f24['attributes']?.['label']||_0x437f24['name']||_0x437f24['url']||_0x437f24['id'],'type':_0x437f24['type'],..._0x437f24?.['attributes']?.['resourceId']?{'resourceId':_0x437f24['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x5bb709){this['_pendingContextItems']['get'](_0x5bb709)?.['isReadOnly']||this['_removeContextItem'](_0x5bb709);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0xf5cd29 of this['_pendingContextItems']['values']())this['_removeContextItem'](_0xf5cd29['uiId']);const _0x203450=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x203450&&this['_addContextItem']({..._0x203450,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x39199f){for(const _0x4014f6 of _0x39199f['values']())this['_addToConversationContextItem'](_0x4014f6);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'](_0x37c20b){return Array['from'](_0x37c20b['values']())['flatMap'](_0x17f942=>this['_mapContextItemToRequestData'](_0x17f942));}async['addFilesToContext'](_0x8aac21,_0x3b11d7,_0x1213a3='file'){const _0xfd611c='files-'+vt();this['_startUploadOperation'](_0xfd611c);try{await Promise['all'](_0x8aac21['map'](async _0x2c3670=>{const _0x331dc0='file-'+vt(),_0x14e8e1=_0x33f243(_0x2c3670['name']),_0x28d51d='file'===_0x1213a3&&_0x2c3670['type']['startsWith']('image/')?'image':_0x1213a3;try{this['_addContextItem']({'type':_0x28d51d,'label':_0x3b11d7?.['label']||_0x14e8e1,'uiId':_0x331dc0,'resourceId':_0x3b11d7?.['resourceId']},!0x0);const _0x195b68=this['_connector']['uploadFile'](this['_ownerId'],_0x2c3670,_0x3b11d7);this['_ongoingUploads']['set'](_0x331dc0,_0x195b68['abortController']);const {id:_0x3311a1}=await _0x195b68['getId']();this['_ongoingUploads']['delete'](_0x331dc0),this['_finishContextItemLoading']({'type':_0x28d51d,'id':_0x3311a1,'label':_0x3b11d7?.['label']||_0x14e8e1,'uiId':_0x331dc0,'resourceId':_0x3b11d7?.['resourceId']},!0x1);}catch(_0x4e1768){if(this['_ongoingUploads']['delete'](_0x331dc0),!en(_0x4e1768)){const _0x50c90f=new sn({'code':In['get'](_0x4e1768['code'])||'ai-chat-file-upload-failed','cause':_0x4e1768,'context':{'fileName':_0x14e8e1}});this['fire']('error',{'error':_0x50c90f});}this['_removeContextItem'](_0x331dc0);}}));}finally{this['_finishUploadOperation'](_0xfd611c);}}['addCurrentDocumentToContext'](_0x3bd0ad){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x3639f4={'type':'document','uiId':'current-document','label':_0x3bd0ad,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x3639f4);}async['updateCurrentDocuments'](_0xd1d92b){const _0xcc66b0=this['_pendingContextItems']['get']('current-document');if(!_0xcc66b0||!_0xd1d92b['length']||_0xd1d92b['every'](_0x465494=>!_0x465494['content']))return;_0xd1d92b['length']>0x1&&_0xd1d92b['some'](_0x4cd813=>!_0x4cd813['description'])&&bt('ai-chat-documents-missing-description');try{const _0x30b45c=await this['_connector']['uploadDocuments'](this['_ownerId'],_0xd1d92b)['getIds']();if(_0x30b45c['length']!==_0xd1d92b['length']||_0x30b45c['some'](_0x1d2ecc=>!_0x1d2ecc?.['id'])){const _0x20fef7=new ht('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x20fef7});}_0xcc66b0['documents']=_0xd1d92b['map']((_0x297b4,_0x49291f)=>{return{'id':_0x30b45c[_0x49291f]['id'],'content':_0x297b4['content'],'version':_0x297b4['version'],'sessionId':_0x297b4['sessionId'],'selection':(_0xe614a1=_0x297b4['selections'],_0xe614a1?_0xe614a1['map'](_0x36c476=>({'start':_0x36c476['start'],'end':_0x36c476['end']})):[]),'channelId':_0x297b4['channelId'],'rootName':_0x297b4['rootName']};var _0xe614a1;});}catch(_0x37ac83){const _0x2f54e8=new sn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x37ac83});this['fire']('error',{'error':_0x2f54e8});}}['addSelectionToContext'](_0x293d9a){this['_addContextItem']({'type':'selection','label':_0x293d9a,'uiId':'selection','content':_0x293d9a});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x575ee8,_0x262713){const _0x130700='url-'+vt();this['_startUploadOperation'](_0x130700);const _0x325795='url-'+vt();try{this['_addContextItem']({'type':'web-resource','label':_0x262713?.['label']||_0x575ee8,'uiId':_0x325795,'resourceId':_0x262713?.['resourceId']},!0x0);const _0x19a602=this['_connector']['uploadUrl'](this['_ownerId'],_0x575ee8,_0x262713);this['_ongoingUploads']['set'](_0x325795,_0x19a602['abortController']);const {id:_0x5aa9bb}=await _0x19a602['getId']();this['_ongoingUploads']['delete'](_0x325795),this['_finishContextItemLoading']({'type':'web-resource','id':_0x5aa9bb,'label':_0x262713?.['label']||_0x575ee8,'uiId':_0x325795,'resourceId':_0x262713?.['resourceId']},!0x1);}catch(_0x4b92a8){this['_ongoingUploads']['delete'](_0x325795),en(_0x4b92a8)||this['fire']('error',{'error':new ht('ai-chat-url-upload-failed',this,{'url':_0x575ee8,'originalError':_0x4b92a8}),'url':_0x575ee8}),this['_removeContextItem'](_0x325795);}finally{this['_finishUploadOperation'](_0x130700);}}['addToolItemToContext'](_0x5c8724){_0x5c8724['id']=_0x5c8724['id']??vt()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x5c8724['uiId'],_0x5c8724),this['fire']('contextItemAdded',{'contextItem':_0x5c8724,'isLoading':!0x1});}async['loadSourceResources'](_0x46fbfe,_0x1f899a,_0x2009c2){const _0xd3dbd1=this['_addContextOptionsState']['sources']['find'](_0x40ff15=>_0x40ff15['id']===_0x46fbfe);if(!_0xd3dbd1)return this['fire']('error',{'error':new ht('ai-chat-source-not-found',this,{'sourceId':_0x46fbfe}),'sourceId':_0x46fbfe}),[];try{const _0x5ce0ef=(await _0xd3dbd1['getResources'](_0x1f899a))['map'](_0x5b3a98=>{const _0x2501a3=this['_isResourceInContext'](_0x5b3a98['id']);return{..._0x5b3a98,'isInContext':_0x2501a3};});return _0xd3dbd1['resources']=_0x5ce0ef,this['fire']('sourceResourcesLoaded',{'sourceId':_0x46fbfe,'source':_0xd3dbd1,'resources':_0x5ce0ef,'uid':_0x2009c2}),_0x5ce0ef;}catch(_0x56d2d3){return this['fire']('error',{'error':new ht('ai-chat-source-resources-load-failed',this,{'sourceId':_0x46fbfe,'originalError':_0x56d2d3}),'sourceId':_0x46fbfe,'sourceLabel':_0xd3dbd1['label']}),[];}}async['addResourceToContext'](_0x1ad5f1,_0x502189){if(this['_isResourceInContext'](_0x502189['id']))return;let _0x263e50=_0x502189['data'];if(!_0x263e50&&_0x1ad5f1['getData'])try{_0x263e50=await _0x1ad5f1['getData'](_0x502189['id']);}catch(_0x535455){return void this['fire']('error',{'error':new ht('ai-chat-resource-load-failed',this,{'resourceId':_0x502189['id'],'sourceId':_0x1ad5f1['id'],'originalError':_0x535455}),'resourceId':_0x502189['id'],'sourceId':_0x1ad5f1['id']});}if(_0x263e50)switch(_0x502189['type']){case'web-resource':if('string'!=typeof _0x263e50)return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x502189['id'],'sourceId':_0x1ad5f1['id'],'expectedType':'string','actualType':typeof _0x263e50}),'resourceId':_0x502189['id'],'sourceId':_0x1ad5f1['id']});await this['addUrlToContext'](_0x263e50,{'label':_0x502189['label'],'resourceId':_0x502189['id']});break;case'file':if(!(_0x263e50 instanceof File))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x502189['id'],'sourceId':_0x1ad5f1['id'],'expectedType':'File','actualType':typeof _0x263e50}),'resourceId':_0x502189['id'],'sourceId':_0x1ad5f1['id']});await this['addFilesToContext']([_0x263e50],{'label':_0x502189['label'],'resourceId':_0x502189['id']});break;case'text':if('object'!=typeof _0x263e50||!('content'in _0x263e50)||!('type'in _0x263e50))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x502189['id'],'sourceId':_0x1ad5f1['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x263e50}),'resourceId':_0x502189['id'],'sourceId':_0x1ad5f1['id']});_0x263e50=AIChatContext['_convertTextResourceToFile'](_0x263e50,_0x502189['label']),await this['addFilesToContext']([_0x263e50],{'label':_0x502189['label'],'resourceId':_0x502189['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ht('ai-chat-context-unsupported-type',this,{'resourceId':_0x502189['id'],'sourceId':_0x1ad5f1['id'],'resourceType':_0x502189['type']}),'resourceId':_0x502189['id'],'sourceId':_0x1ad5f1['id']});}else this['fire']('error',{'error':new ht('ai-chat-resource-no-data',this,{'resourceId':_0x502189['id'],'sourceId':_0x1ad5f1['id']}),'resourceId':_0x502189['id'],'sourceId':_0x1ad5f1['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0x4e9c0a){if(void 0x0!==_0x4e9c0a)this['_addContextOptionsState']['document']['isHidden']=!_0x4e9c0a;else{const _0x3f9385=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x3f9385;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x2ee21a,_0x5b0439){switch(_0x2ee21a['type']){case'markdown':return new File([_0x2ee21a['content']],_0x5b0439,{'type':'text/markdown'});case'html':return new File([_0x2ee21a['content']],_0x5b0439,{'type':'text/html'});default:return new File([_0x2ee21a['content']],_0x5b0439,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x116217){switch(_0x116217['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x116217['id']}];case'web-resource':return[{'type':'web-resource','id':_0x116217['id']}];case'document':return _0x116217['documents']?.['length']?_0x116217['documents']['map'](_0x3035c9=>({'type':'document','id':_0x3035c9['id'],..._0x3035c9['selection']?.['length']&&{'selection':_0x3035c9['selection']}})):[];case'mcp-tool-context':{const _0x3b0258=_0x116217;return[{'type':'mcp-tool-context','mcpServerName':_0x3b0258['mcpServerName'],'toolName':_0x3b0258['toolName'],'data':{..._0x3b0258['data'],'label':_0x3b0258['label']||_0x3b0258['data']?.['label']||_0x3b0258['id']},'id':_0x3b0258['id']}];}default:return[];}}['_addContextItem'](_0x329b61,_0x4433f4=!0x1){if(this['_pendingContextItems']['set'](_0x329b61['uiId'],_0x329b61),_0x329b61['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x329b61,'isLoading':_0x4433f4}),'current-document'===_0x329b61['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x329b61['resourceId']){const _0x3298a0=this['_findSourceIdsByResourceId'](_0x329b61['resourceId']);_0x3298a0&&_0x3298a0['forEach'](_0x2523fe=>{this['_updateResourceInContextState'](_0x2523fe,_0x329b61['resourceId'],!0x0);});}}['_removeContextItem'](_0x1087b4){const _0x2a30fe=this['_pendingContextItems']['get'](_0x1087b4),_0x309f24=this['_ongoingUploads']['get'](_0x1087b4);if(_0x309f24&&(_0x309f24['abort'](),this['_ongoingUploads']['delete'](_0x1087b4)),_0x2a30fe?.['resourceId']){const _0x24b884=this['_findSourceIdsByResourceId'](_0x2a30fe['resourceId']);_0x24b884&&_0x24b884['forEach'](_0x31584b=>{this['_updateResourceInContextState'](_0x31584b,_0x2a30fe['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x1087b4),this['fire']('contextItemRemoved',{'uiId':_0x1087b4,'type':_0x2a30fe?.['type']}),'current-document'===_0x1087b4&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x297c0e,_0x214873){if(this['_pendingContextItems']['has'](_0x297c0e['uiId'])&&(this['_pendingContextItems']['set'](_0x297c0e['uiId'],_0x297c0e),this['fire']('contextItemLoadingEnded',{'contextItem':_0x297c0e,'isLoading':_0x214873}),_0x297c0e['resourceId'])){const _0x28afc9=this['_findSourceIdsByResourceId'](_0x297c0e['resourceId']);_0x28afc9&&_0x28afc9['forEach'](_0x1997ea=>{this['_updateResourceInContextState'](_0x1997ea,_0x297c0e['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0xbe0124){this['_conversationContextItems']['set'](_0xbe0124['uiId'],_0xbe0124);}['_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'](_0x124795=>({..._0x124795,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x3fb03b=>({..._0x3fb03b,'resources':[]}))??[];}['_isResourceInContext'](_0x1a45d5){for(const _0xca05d5 of this['_pendingContextItems']['values']())if(_0xca05d5['resourceId']===_0x1a45d5)return!0x0;for(const _0x5e9ba8 of this['_conversationContextItems']['values']())if(_0x5e9ba8['resourceId']===_0x1a45d5)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x3fb20b){const _0x2ad1df=[];for(const _0x36705a of this['_addContextOptionsState']['sources'])_0x36705a['resources']['find'](_0x2dc7a7=>_0x2dc7a7['id']===_0x3fb20b)&&_0x2ad1df['push'](_0x36705a['id']);return 0x0===_0x2ad1df['length']?null:_0x2ad1df;}['_updateResourceInContextState'](_0x236d4b,_0x2cf503,_0x9ca95){const _0x126a58=this['_addContextOptionsState']['sources']['find'](_0x14e98d=>_0x14e98d['id']===_0x236d4b);if(!_0x126a58)return;const _0x14da57=_0x126a58['resources']['find'](_0x439d22=>_0x439d22['id']===_0x2cf503);_0x14da57&&(_0x14da57['isInContext']=_0x9ca95,this['fire']('resourceStateChanged',{'sourceId':_0x236d4b,'resourceId':_0x2cf503,'isInContext':_0x9ca95}));}['_startUploadOperation'](_0x7ef63f){this['_ongoingUploadOperations']['set'](_0x7ef63f,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x3087ed){this['_ongoingUploadOperations']['delete'](_0x3087ed),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}};const Tn=/* #__PURE__ -- @preserve */
31
+ ut(),wn=['capabilitiesUpdated'];var Cn=class extends Tn{['_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'](_0x2d6014){const _0x43410d={};return _0x2d6014&&_0x2d6014['isWebSearchEnabled']&&(_0x43410d['webSearch']={}),_0x2d6014&&_0x2d6014['isReasoningEnabled']&&(_0x43410d['reasoning']={}),_0x43410d;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0xb038b7){_0xb038b7!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0xb038b7,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0xbc8cca){_0xbc8cca!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0xbc8cca,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}},fn=class extends An{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x277cfd){super(_0x277cfd),this['conversationId']=_0x277cfd['conversationId'],this['contextItems']=_0x277cfd['contextItems'],this['capabilities']=_0x277cfd['capabilities'],this['userMessage']=_0x277cfd['userMessage'],this['model']=_0x277cfd['model'],this['attributes']=_0x277cfd['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':En['mapContextItemsToRequestData'](this['contextItems']),'capabilities':Cn['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}};const bn=/* #__PURE__ -- @preserve */
32
+ ut();var Sn=class extends bn{['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];['_channelsToEditors'];['_getSessionId'];constructor(_0xb41bc5){super(),this['options']=_0xb41bc5,this['connector']=_0xb41bc5['connector'],this['chatModels']=_0xb41bc5['chatModels'],this['id']=_0xb41bc5['conversationId'],this['isFromHistory']=_0xb41bc5['isFromHistory'],this['_channelsToEditors']=_0xb41bc5['channelsToEditors'],this['_getSessionId']=_0xb41bc5['getSessionId'];}async['init'](_0x228cd2){try{this['chatContext']=new En({'connector':this['connector'],'config':_0x228cd2,'ownerId':this['id']}),this['chatContext']['delegate'](...mn)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new Cn(),this['chatCapabilities']['delegate'](...wn)['to'](this),this['chatCapabilities']['init']();const _0xa907f8=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0xa907f8});const _0x48c70c=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x48c70c&&await this['setModel'](_0x48c70c);}catch(_0x52d55c){const _0x5108d5=new sn({'code':'ai-chat-conversation-init-failed','cause':_0x52d55c,'type':'network'});this['fire']('error',{'error':_0x5108d5});}}async['start'](){if(this['isStarted'])throw new ht('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new ht('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x2e5fc3}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x2e5fc3,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x3bbc61){const _0x586311=new sn({'code':'ai-chat-conversation-start-failed','cause':_0x3bbc61,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x586311}),_0x586311;}}async['load'](_0x4a754a){try{const _0x4e29a4=await this['connector']['fetchConversation'](_0x4a754a)['getConversation'](),_0x290363=await this['connector']['fetchConversationMessages'](_0x4a754a)['getMessages'](),_0x53a235=_0x290363[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x4e29a4['id'],'title'in _0x4e29a4?this['fire']('setConversationTitle',_0x4e29a4['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']);const _0x12b95a=(await this['chatModels']['getAll']())['find'](_0x231635=>_0x231635['id']['toLowerCase']()===_0x53a235['toLowerCase']());this['selectedModel']=_0x12b95a,this['fire']('modelSelected',{'selectedModel':_0x12b95a,'isDisabled':!0x0});const {streamingMessageId:_0x3e67d1}=await this['_processMessagesToInteractions'](_0x290363,_0x53a235);return _0x3e67d1&&this['currentInteraction']?this['_resumeStream'](_0x3e67d1):this['currentInteraction']=void 0x0,this;}catch(_0x8aedd7){const _0x511381=new sn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x8aedd7,'type':'network','context':{'conversationId':_0x4a754a}});throw this['fire']('error',{'error':_0x511381}),_0x511381;}}async['_processMessagesToInteractions'](_0x44e42d,_0x491df8){let _0x4ff528,_0x5d4b31,_0x15b474=!0x1;for(const _0x43ee02 of _0x44e42d)if('user'===_0x43ee02['role']){const {contextItems:_0xe493ac,hasUnmatched:_0x4440db}=await this['_extractContextItems'](_0x43ee02);_0x15b474=_0x4440db;const _0x1aa0ec={'isReasoningEnabled':Object['hasOwn'](_0x43ee02['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x43ee02['capabilities'],'webSearch')};_0x4ff528=this['createInteraction']({'userMessage':_0x43ee02['prompt'],'contextItems':_0xe493ac,'capabilities':_0x1aa0ec,'modelId':_0x491df8,'attributes':_0x43ee02['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x4ff528,_0x5d4b31=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x43ee02['role']&&_0x4ff528){if('streaming'===_0x43ee02['status']){_0x5d4b31=_0x43ee02['id'];continue;}if('error'===_0x43ee02['status'])continue;const _0xf8cdbe=[];for(const _0x374318 of _0x43ee02['content'])switch(_0x374318['type']){case'text':case'modification':{const _0x348dc1=_0x4ff528['getDocumentContext'](),_0xdc46f9=this['_hasSessionMismatch'](_0x348dc1)||_0x15b474;_0x4ff528['currentReply']?.['type']!==_0x374318['type']&&(_0x4ff528['currentReply']=_0x4ff528['createReply']({'type':_0x374318['type'],'isDone':!0x0,'interactionId':_0x4ff528['id'],'areActionsDisabled':_0xdc46f9,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0xf8cdbe['length']>0x0&&(_0x4ff528['currentReply']['sources']=_0xf8cdbe['splice'](0x0))),_0x4ff528['currentReply']['appendContent'](_0x374318['content'],_0x374318['documentId']);break;}case'url':_0xf8cdbe['push'](_0x374318);break;case'mcp-tool-result':{const {data:_0x295712,attributes:_0x4c9172}=JSON['parse'](_0x374318['content']);_0x4ff528['_handleToolResultData']({'toolName':_0x374318['toolName'],'data':_0x295712,'attributes':_0x4c9172});break;}}'cancelled'===_0x43ee02['status']&&this['fire']('error',{'interactionId':_0x4ff528['id'],'error':new ht('ai-request-aborted',this)});}}return{'streamingMessageId':_0x5d4b31};}async['_resumeStream'](_0x220499){if(this['currentInteraction'])try{const _0x156c2c=this['connector']['resumeStream'](this['id'],_0x220499);await this['currentInteraction']['resume'](_0x156c2c);}catch(_0x36c583){_0x36c583 instanceof ht&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x36c583});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0x51736a){return _0x51736a['content']?this['chatContext']['populateFromMessage'](_0x51736a['content'],Array['from'](this['_channelsToEditors']['values']())):{'contextItems':new Map(),'hasUnmatched':!0x1};}async['handleUserInteraction']({userMessage:_0x5bb580,attributes:_0x3c8dd2}){if(!this['isStarted'])throw new ht('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new ht('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x5c1e32=new Map(this['getPendingContextItems']()),_0x251e18=this['chatCapabilities']['getCapabilitiesConfig'](),_0x19af05=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x5bb580,'contextItems':_0x5c1e32,'capabilities':_0x251e18,'modelId':_0x19af05,'attributes':_0x3c8dd2,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x1c928a){if(_0x1c928a instanceof ht)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x1c928a});else{const _0x81ba81=In['get'](_0x1c928a['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ht(_0x81ba81,null,{'error':_0x1c928a})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x4f88f0,contextItems:_0x41c5c6,capabilities:_0x5e7989,modelId:_0x497f48,attributes:_0x5e075,channelsToEditors:_0x3e1cd5}){const _0x168f5a=new fn({'userMessage':_0x4f88f0,'contextItems':_0x41c5c6,'capabilities':_0x5e7989,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x497f48,'attributes':_0x5e075,'channelsToEditors':_0x3e1cd5});return _0x168f5a['delegate'](...gn)['to'](this),this['interactions']['push'](_0x168f5a),this['fire']('interactionCreated',_0x168f5a),_0x168f5a;}['getInteraction'](_0x5a8ce0){return this['interactions']['find'](_0x188bcc=>_0x188bcc['id']===_0x5a8ce0);}['removeInteraction'](_0x1c69e1){const _0x375d24=this['getInteraction'](_0x1c69e1);_0x375d24&&(_0x375d24['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x375d24),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x1b4dca=this['lastInteraction'];_0x1b4dca?.['conversationId']&&_0x1b4dca['messageId']&&this['connector']['cancelStream'](_0x1b4dca['conversationId'],_0x1b4dca['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0x24f911){this['chatContext']['addCurrentDocumentToContext'](_0x24f911);}async['updateCurrentDocumentsInContext'](_0x388105){await this['chatContext']['updateCurrentDocuments'](_0x388105);}['toggleAddCurrentDocumentOptionVisibility'](_0x25f995){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x25f995);}['_hasSessionMismatch'](_0x29c98d){return!!_0x29c98d&&_0x29c98d['documents']['some'](_0x55211f=>{const _0xf98812=this['_channelsToEditors']['get'](_0x55211f['channelId']);return!_0xf98812||_0x55211f['sessionId']!==this['_getSessionId'](_0xf98812);});}['addSelectionToContext'](_0x3ca2d7){this['chatContext']['addSelectionToContext'](_0x3ca2d7);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x25134c){this['chatContext']['addFilesToContext'](_0x25134c);}['addUrlToContext'](_0x5547ed){this['chatContext']['addUrlToContext'](_0x5547ed);}['addToolItemToContext'](_0x5c5649){this['chatContext']['addToolItemToContext'](_0x5c5649);}['addResourceToContext'](_0x4f0639,_0x47b943){this['chatContext']['addResourceToContext'](_0x4f0639,_0x47b943);}['loadSourceResources'](_0x250c83,_0x3dbada,_0x1019c8){return this['chatContext']['loadSourceResources'](_0x250c83,_0x3dbada,_0x1019c8);}['removeFromContext'](_0xdb9e4){this['chatContext']['removeFromContext'](_0xdb9e4);}['setWebSearch'](_0xc3d6ff){this['chatCapabilities']['setWebSearch'](_0xc3d6ff);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x55eab2){this['chatCapabilities']['setReasoning'](_0x55eab2);}['toggleReasoning'](){this['chatCapabilities']['toggleReasoning']();}['isCurrentDocumentInContext'](){return this['chatContext']['isCurrentDocumentInContext']();}['isCurrentDocumentInConversation'](){return this['chatContext']['isCurrentDocumentInConversation']();}['isSelectionInContext'](){return this['chatContext']['isSelectionInContext']();}['getPendingContextItems'](){return this['chatContext']['getPendingContextItems']();}async['setModel'](_0x43cc82){_0x43cc82?!0x1===await this['chatModels']['isAvailable'](_0x43cc82)&&(bt('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x43cc82}),_0x43cc82=(await this['chatModels']['getAvailableModels']())[0x0]):(bt('ai-chat-conversation-set-model-null',{'conversation':this}),_0x43cc82=(await this['chatModels']['getAvailableModels']())[0x0]),_0x43cc82['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x43cc82,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x43cc82}));}};function Rn({documentSuggestions:_0x545967,transform:_0x54e9b3,documentCompare:_0xe1cae8,documentCompareOptions:_0x25255d}){const _0x58c023=new Map();for(const [_0x50399b,{groups:_0x2b5bf4,documentContext:_0x2e6cb5,documentContent:_0x468e43,editor:_0x3ea79a}]of _0x545967){const _0x490fe8=_0x2e6cb5['content'],_0xc4a465=_0x2e6cb5['version'],_0x4ba7fd=_0x468e43['cloneNode'](!0x0);for(const {changes:_0x4a2b47}of _0x2b5bf4){const _0x5b1e3a=_0x4a2b47['filter'](_0x17be98=>'new'!=_0x17be98['type'])['map'](_0x2294e0=>Es('data-id',_0x2294e0['id'],_0x4ba7fd))['filter'](_0x10e0eb=>null!==_0x10e0eb),_0x5ce9f0=_0x4a2b47['filter'](_0x43e0b2=>'removed'!=_0x43e0b2['type'])['map'](_0x33bd1b=>_0x33bd1b['node']['cloneNode'](!0x0));let _0x2ef674=null;if(_0x5b1e3a['length']){_0x2ef674=_0x5b1e3a[0x0]['previousSibling'];for(let _0x54fbf0=0x0;_0x54fbf0<_0x5b1e3a['length'];_0x54fbf0++)_0x2a7599(_0x5b1e3a[_0x54fbf0]);}if(_0x5ce9f0['length']){_0x2ef674||(_0x4a2b47[0x0]['anchorId']?_0x2ef674=Es('data-id',_0x4a2b47[0x0]['anchorId'],_0x4ba7fd):(_0x2ef674=_0x5ce9f0['shift'](),_0x2dfbea(_0x4ba7fd,_0x2ef674)));for(let _0x5e8621=0x0;_0x5e8621<_0x5ce9f0['length'];_0x5e8621++)_0x218be5(_0x2ef674,_0x5ce9f0[_0x5e8621]),_0x2ef674=_0x5ce9f0[_0x5e8621];}}const _0x2bf207=ms(_0x4ba7fd),_0x188be0=_0xe1cae8['getDiff'](_0x490fe8,_0x2bf207,{'targetEditor':_0x3ea79a,'anchor':_0x2e6cb5['rootName'],..._0x25255d})['getOperations']();if(_0x54e9b3){const _0x4d899f=_0x3ea79a['model']['document']['history']['getOperations'](_0xc4a465),_0x1f7f16={'document':_0x3ea79a['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x58c023['set'](_0x50399b,_0x29e916(_0x188be0,_0x4d899f,_0x1f7f16)['operationsA']);}else _0x58c023['set'](_0x50399b,_0x188be0);}return _0x58c023;}function On({groups:_0x4654a3,documentContextContent:_0x13fb24,documents:_0x249aec}){const _0x202cc8=new Map();for(const _0x1862e2 of _0x4654a3){const {documentId:_0x314834}=_0x1862e2,_0x5c9640=_0x202cc8['get'](_0x314834);if(_0x5c9640)_0x5c9640['groups']['push'](_0x1862e2),_0x5c9640['indexes']['push'](_0x1862e2['index']);else{const _0x428c6b=_0x249aec['find'](_0x7f74ef=>_0x7f74ef['id']===_0x314834),_0x3e7156=_0x13fb24['get'](_0x314834);if(!_0x428c6b||!_0x3e7156)continue;_0x202cc8['set'](_0x314834,{'groups':[_0x1862e2],'documentContext':_0x428c6b,'documentContent':_0x3e7156,'editor':_0x1862e2['editor'],'indexes':[_0x1862e2['index']]});}}return _0x202cc8;}function vn(_0x24c31c,_0x23bb03){const _0x425b7e=_0x24c31c['files']['length']>0x0&&_0x24c31c['files']['every'](_0x150a11=>_0x150a11['type']['startsWith']('image/')),_0x52d519=_0x24c31c['plainText']['trim']()['length']>0x0;if(_0x24c31c['files']['length']>0x0&&_0x23bb03['filesEnabled']&&(!_0x425b7e||!_0x52d519)){const _0x560fe9=_0x24c31c['files']['filter'](_0x1ad9a3=>_0x1ad9a3['name']);return _0x560fe9['length']>0x0?{'type':'file','files':_0x560fe9}:null;}if(_0x23bb03['urlsEnabled']){const _0x167179=function(_0x298458){const _0x1de3f7=_0x298458['trim']();if(/\s/['test'](_0x1de3f7))return null;try{const _0x106ba7=new URL(_0x1de3f7);return'http:'!==_0x106ba7['protocol']&&'https:'!==_0x106ba7['protocol']?null:_0x106ba7['toString']();}catch{return null;}}(_0x24c31c['plainText']);if(_0x167179)return{'type':'url','url':_0x167179};}const _0x4b1003=_0x24c31c['forceTextAttachment']?0x1:_0x23bb03['longTextThreshold']??0x1/0x0;if(_0x24c31c['plainText']['length']>=Math['max'](_0x4b1003,0x1)&&_0x23bb03['filesEnabled']){const _0x152696=_0x23bb03['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x24c31c['plainText']],_0x152696,{'type':'text/plain'})]};}return null;}var kn=class extends _0x5d28a2{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_reporter'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[ls,nn,_0x1cf5c4];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['set']('isConversationReady',!0x1),this['_bodyCollection']=ln(this['context']['locale']),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_reporter']=this['context']['plugins']['get'](nn)['createReporter']('aichat'),this['_aiChatModels']=new Qs({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0xb1ce3a=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x7e54a2,_0x25d832)=>{this['_handleUIUserMessage']({'message':_0x25d832});}),this['listenTo'](_0xb1ce3a['view'],'change:activeTab',(_0x23a271,_0x46bd3a,_0x4c9022)=>{'chat'!==_0x4c9022&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',async()=>{await this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext'](),this['activeConversation']?.['cancelLastInteractionStream']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x57ddc3,_0x3e1498)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x3e1498));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x20515b,_0x57cb65)=>{this['activeConversation']?.['addUrlToContext'](_0x57cb65);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x4ed4ad,_0x1a2783)=>{const _0x5cf0ed=this['activeConversation'];if(!_0x5cf0ed)return;_0x1a2783['hasDirectory']&&(_0x1a2783['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+vt()}));const _0x5af76c=vn(_0x1a2783,{'pastedTextLabel':us(this['context']['locale'],'AI_CHAT_CONTEXT_PASTED_TEXT_NAME'),'longTextThreshold':this['context']['config']['get']('ai.chat.context.paste.textThreshold'),'filesEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.files.enabled'),'urlsEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.urls.enabled')});_0x5af76c&&(_0x1a2783['preventDefault'](),'url'===_0x5af76c['type']?_0x5cf0ed['addUrlToContext'](_0x5af76c['url']):_0x5cf0ed['chatContext']['addFilesToContext'](_0x5af76c['files'],void 0x0,_0x5af76c['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0xc9b8d4,_0x862eee)=>{_0x862eee['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x59b8f2,_0x4dca10)=>{this['activeConversation']?.['addResourceToContext'](_0x4dca10['source'],_0x4dca10['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x2802e8,_0x55c7b2)=>{this['_removeFromContext'](_0x55c7b2);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x191f32,_0x581092)=>{this['activeConversation']?.['loadSourceResources'](_0x581092['sourceId'],_0x581092['query'],_0x581092['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x163243,_0x2a4fc9)=>{this['activeConversation']?.['setModel'](_0x2a4fc9);}),this['listenTo'](this['_aiChatUi'],'like',(_0x52c85f,{replyId:_0x52a976})=>{console['log']('Liked\x20response',_0x52a976);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x464a68,{replyId:_0x37efd2})=>{console['log']('Disliked\x20response',_0x37efd2);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x197108,_0x579101)=>{this['_insertSuggestion'](_0x579101);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x452d56,{replyId:_0x54409a,partIndex:_0x1d6be5})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x54409a,_0x1d6be5);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x60b0f6,{replyId:_0x4ad277,partIndex:_0x2b7995})=>{const _0x1ec419=this['_getDocumentRangeForReplyChanges'](_0x4ad277,_0x2b7995);if(!_0x1ec419)return;const {reply:_0x4ffafc}=this['getInteractionAndReplyById'](_0x4ad277);'$graveyard'!=_0x1ec419['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x4ffafc['changeGroups'][_0x2b7995]['editor'],'ranges':[_0x1ec419['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x574d93,_0x3999d1)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x3999d1);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x23ffc1,{replyId:_0x383415,showDiff:_0x22412d})=>{const {interaction:_0x41eb5f,reply:_0x2784a6}=this['getInteractionAndReplyById'](_0x383415),_0x517d6a=_0x2784a6['getContentParts']({'showDiff':_0x22412d});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x41eb5f['id']+':'+_0x2784a6['id'],'parts':_0x517d6a});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x25c6b5,{replyId:_0x863409,partIndex:_0x2379a7})=>{this['_rejectSuggestion']({'replyId':_0x863409,'partIndex':_0x2379a7}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x36cc87,_0x17924d)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x17924d);}),this['on']('replyCreated',(_0x5264a6,_0x57cdb3)=>{this['_addFeedItemReply'](_0x57cdb3);});}['afterInit'](){this['context']instanceof _0x1f7986?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x3666ca,_0x3f2028)=>{_0x3f2028['on']('ready',()=>{this['_integrateEditor'](_0x3f2028);});}),this['_initConversation']();}async['_initConversation'](){const _0x592333=this['context']['config']['get']('ai.chat.initialConversation');let _0x5f411e=_0x592333;('lastCreated'!=_0x592333||(_0x5f411e=await this['_getLastCreatedConversationId'](),_0x5f411e))&&('new'==_0x5f411e?await this['_startConversationSafely']():await this['loadConversation'](_0x5f411e));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x51e367){this['_closeActiveBalloon'](),this['context']['plugins']['get'](cs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();try{this['_aiChatUi']['emptyConversationTitle'](),await this['_aiConnector']['fetchConversation'](_0x51e367)['getConversation'](),await this['_startConversationSafely']({'id':_0x51e367}),await this['activeConversation']['load'](_0x51e367),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x56d921){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x51e367}),this['_reporter']['logError'](new ht('ai-chat-conversation-not-found',this,void 0x0,_0x56d921),{'context':{'operation':'load-conversation'}});}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x466794){let _0x40e29d=null,_0x3fe774=null;this['on']('toolDataReceived',(_0x21acec,_0x361a5c,_0x4a8d6b)=>{_0x4a8d6b['id']!==_0x40e29d&&(_0x40e29d=_0x4a8d6b['id'],_0x3fe774=this['_getAIChatFeedAPI'](_0x4a8d6b)),_0x466794(_0x361a5c,_0x3fe774);});}['addCurrentDocumentToChatContext'](){ds(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](us(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0x379874){const _0x56a3d8=this['_aiEditing']['getSelectionText'](_0x379874);this['activeConversation']?.['addSelectionToContext'](_0x56a3d8),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x269f2b){await this['_startConversationSafely']({'modelId':_0x269f2b?.['modelId']});}async['sendMessage'](_0x4a25bd){await this['_handleUIUserMessage'](_0x4a25bd);}['getGroupId'](){const _0x52e340=this['context']['config']['get']('collaboration.channelId');if(!_0x52e340)throw new ht('ai-missing-channel-id',this);return _0x52e340;}['_handleRemovedConversation'](_0x15b21d){this['activeConversation']['id']===_0x15b21d&&this['_startConversationSafely']();}['_prepareDocumentSuggestions'](_0x22f80a){const {reply:_0x54b175,interaction:_0x49b8aa}=this['getInteractionAndReplyById'](_0x22f80a['replyId']),_0xca862=void 0x0!==_0x22f80a['partIndex']?[_0x54b175['changeGroups'][_0x22f80a['partIndex']]]:_0x54b175['changeGroups']['filter'](_0x21549d=>'pending'==_0x21549d['state']);return _0xca862['map'](_0x3c6984=>_0x54b175['changeGroups']['indexOf'](_0x3c6984))['forEach'](_0x4b1e38=>{const _0x1c0b3e=this['_getDocumentRangeForReplyChanges'](_0x22f80a['replyId'],_0x4b1e38);_0x1c0b3e&&'$graveyard'!=_0x1c0b3e['range']['root']['rootName']?(_0x54b175['setChangeGroupState'](_0x4b1e38,'accepted'),void 0x0!==_0x22f80a['partIndex']&&this['_scrollToSuggestionRange'](_0x1c0b3e['range'],!0x1,_0x1c0b3e['targetEditor'])):_0x54b175['setChangeGroupState'](_0x4b1e38,'outdated');}),On({'groups':_0xca862['filter'](_0x4ec2ee=>'accepted'===_0x4ec2ee['state']),'documentContextContent':_0x54b175['documentContextContent'],'documents':_0x49b8aa['getDocumentContext']()?.['documents']??[]});}['_insertSuggestion'](_0x51e707){const _0x5f4046=this['context']['plugins']['get'](_0x1cf5c4),{reply:_0x474177,interaction:_0x4cab7c}=this['getInteractionAndReplyById'](_0x51e707['replyId']),_0x24916d=this['_prepareDocumentSuggestions'](_0x51e707),_0x4ada41=Rn({'documentSuggestions':_0x24916d,'transform':!0x0,'documentCompare':_0x5f4046,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0x416db4,_0x578490]of _0x4ada41){const {editor:_0xc4fc70,indexes:_0x444257}=_0x24916d['get'](_0x416db4);if(!_0xc4fc70['plugins']['has']('TrackChanges')){bt('ai-no-track-changes',{'editor':_0xc4fc70});continue;}let _0x425e90;zs(_0x578490,'chat'),_0xc4fc70['model']['change'](_0x20e117=>{_0x425e90=_0x20e117['batch'],_0xc4fc70['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x578490),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x425e90,{'interactionId':_0x4cab7c['id'],'replyId':_0x474177['id'],'indexes':_0x444257});}this['_updateRatings'](_0x474177);}['_applySuggestion'](_0x47bf0b){const _0x18ead6=this['context']['plugins']['get'](_0x1cf5c4),{reply:_0x4c5ec2,interaction:_0x49dbf9}=this['getInteractionAndReplyById'](_0x47bf0b['replyId']),_0x220d93=this['_prepareDocumentSuggestions'](_0x47bf0b),_0x29cd47=Rn({'documentSuggestions':_0x220d93,'transform':!0x0,'documentCompare':_0x18ead6,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0x4c0eab,_0x196e57]of _0x29cd47){const {editor:_0x1bf09d,indexes:_0x1f9bb5}=_0x220d93['get'](_0x4c0eab);let _0x139136;zs(_0x196e57,'chat');try{_0x1bf09d['model']['change'](_0x252d07=>{_0x139136=_0x252d07['batch'],_0x18ead6['applyOperations'](_0x252d07,_0x196e57);}),this['_batchToChanges']['set'](_0x139136,{'interactionId':_0x49dbf9['id'],'replyId':_0x4c5ec2['id'],'indexes':_0x1f9bb5});}catch(_0x5ebdb2){throw this['_reporter']['logError'](new sn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x5ebdb2})),_0x5ebdb2;}}this['_updateRatings'](_0x4c5ec2);}['_rejectSuggestion'](_0x40f58d){const {reply:_0x22cee3}=this['getInteractionAndReplyById'](_0x40f58d['replyId']);_0x22cee3['setChangeGroupState'](_0x40f58d['partIndex'],'rejected');}['_openBalloonFor'](_0x2a1508,_0xbe60cd){if(!this['_hasAIChatBalloon'])return;const {reply:_0x3c41de}=this['getInteractionAndReplyById'](_0x2a1508),_0x83f12a=_0x3c41de['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x83f12a['length'])return;let _0x2fad00,_0x2bb91d;if(void 0x0!==_0xbe60cd?(_0x2bb91d=_0x83f12a['find'](_0x2fe4ea=>_0x2fe4ea['index']==_0xbe60cd),_0x2fad00=_0x2bb91d?.['index']):(_0x2bb91d=_0x83f12a[0x0],_0x2fad00=_0x2bb91d['index']),!_0x2bb91d)return void _0x3c41de['setChangeGroupState'](_0xbe60cd??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x2a1508&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x2fad00)return;const _0x3c1f5f=this['_getUserPresentableContentPartDocumentRange'](_0x2a1508,_0x3c41de,_0x2bb91d),_0x445980=_0x3c41de['changeGroups']['find'](_0x320ae1=>_0x320ae1['index']==_0x2fad00)['editor'],_0x4cd231=_0x445980['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x4cd231&&this['_activeBalloon']['close'](),!_0x3c1f5f)return _0x4cd231['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x4cd231,this['_currentPreviewedChangeGroup']={'replyId':_0x2a1508,'partIndex':_0x2fad00},this['_scrollToSuggestionRange'](_0x3c1f5f,!0x0,_0x445980);const _0x51a119=this['_getPresentableSiblingContentPartIndex'](_0x2a1508,_0x2fad00,'next');_0x4cd231['clearContent'](),_0x4cd231['updateContent']({'part':_0x2bb91d,'renderingStrategy':'static'}),_0x4cd231['open']({'index':_0x2fad00,'title':us(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x2fad00+0x1)['toString']()),'showRotator':null!==_0x51a119,'ranges':[_0x3c1f5f],'areActionsDisabled':_0x3c41de['areActionsDisabled'],'targetEditor':_0x445980}),_0x4cd231['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x2a1508,_0x2fad00),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x2a1508,'index':_0x2fad00,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0x3b4233,_0x2b876d,_0x29798c){const {reply:_0x4bc61a}=this['getInteractionAndReplyById'](_0x3b4233),_0x10101a=_0x4bc61a['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x10101a['length'])return null;const _0x4343eb='next'==_0x29798c?0x1:-0x1;function _0x485fbf(_0x72fe6){const _0x52afea=(_0x72fe6+_0x4343eb+_0x10101a['length'])%_0x10101a['length'];return{'siblingIndex':_0x52afea,'siblingPart':_0x10101a[_0x52afea]};}const _0x3abcff=_0x10101a['findIndex'](_0x166d81=>_0x166d81['index']==_0x2b876d);let {siblingIndex:_0xe9af9d,siblingPart:_0x19c93e}=_0x485fbf(_0x3abcff);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x3b4233,_0x4bc61a,_0x19c93e);)if({siblingIndex:_0xe9af9d,siblingPart:_0x19c93e}=_0x485fbf(_0xe9af9d),_0xe9af9d===_0x3abcff)return null;return _0x19c93e['index'];}['_getUserPresentableContentPartDocumentRange'](_0x4751a9,_0x3968bb,_0x1d585d){const _0x599326=_0x3968bb['changeGroups'];if(!_0x1d585d['hasChanges'])return null;const _0x4f9054=_0x599326['find'](_0x46cb3e=>_0x46cb3e['index']==_0x1d585d['index']);if('pending'!==_0x4f9054?.['state'])return null;if(!_0x4f9054?.['editor']||'destroyed'===_0x4f9054['editor']['state'])return _0x3968bb['setChangeGroupState'](_0x1d585d['index'],'outdated'),null;const _0x434a6a=this['_getDocumentRangeForReplyChanges'](_0x4751a9,_0x1d585d['index']);if(!_0x434a6a)return _0x3968bb['setChangeGroupState'](_0x1d585d['index'],'outdated'),null;const {range:_0xc2e67d,currentIndex:_0x25375f}=_0x434a6a;return'$graveyard'==_0xc2e67d['root']['rootName']?(_0x3968bb['setChangeGroupState'](_0x25375f,'outdated'),null):_0x434a6a['range'];}['_getDocumentRangeForReplyChanges'](_0x45bf3f,_0x4316aa){const {reply:_0x543d2c,interaction:_0x4baba1}=this['getInteractionAndReplyById'](_0x45bf3f),_0x11495b=_0x543d2c['changeGroups']['filter'](_0x2fe535=>'pending'==_0x2fe535['state']),_0x5c0467=_0x11495b['map'](_0x33f88e=>_0x543d2c['changeGroups']['indexOf'](_0x33f88e));void 0x0===_0x4316aa&&(_0x4316aa=_0x5c0467[0x0]);const _0x440467=_0x5c0467['indexOf'](_0x4316aa);if(-0x1==_0x440467)return null;const _0x43575a=_0x11495b[_0x440467],_0x282be9=_0x43575a['editor'];if(!_0x282be9||'destroyed'===_0x282be9['state'])return null;if(!_0x30f76f(_0x282be9,_0x43575a['rootName']))return null;const _0x1f30fa=_0x543d2c['documentContextContent']['get'](_0x43575a['documentId']),_0x1707ed=new _0x3df49e([]),_0x68d88c=new _0x3df49e([]);for(const _0x5aeef3 of _0x43575a['changes'])if('removed'!=_0x5aeef3['type']&&_0x68d88c['children']['push'](_0x5aeef3['node']['cloneNode'](!0x0)),'new'!=_0x5aeef3['type']){const _0x4eb465=ti(_0x4f2d68=>fs(_0x4f2d68,'data-id')==_0x5aeef3['id'],_0x1f30fa,!0x0);_0x1707ed['children']['push'](_0x4eb465['cloneNode'](!0x0));}if(0x0==_0x1707ed['children']['length']){if(_0x43575a['changes'][0x0]['anchorId']){const _0x4bcff3=Es('data-id',_0x43575a['changes'][0x0]['anchorId'],_0x1f30fa);_0x1707ed['children']['unshift'](_0x4bcff3['cloneNode'](!0x0)),_0x68d88c['children']['unshift'](_0x4bcff3['cloneNode'](!0x0)),_0x4bcff3['nextSibling']&&(_0x1707ed['children']['push'](_0x4bcff3['nextSibling']['cloneNode'](!0x0)),_0x68d88c['children']['push'](_0x4bcff3['nextSibling']['cloneNode'](!0x0)));}else{const _0x237357=_0x1f30fa['children'][0x0];if(!_0x237357)return null;_0x1707ed['children']['push'](_0x237357['cloneNode'](!0x0)),_0x68d88c['children']['push'](_0x237357['cloneNode'](!0x0));}}const _0x17d2d0=_0x4baba1['getDocumentContext'](),_0x583581=_0x17d2d0['documents']['find'](_0x2cffbd=>_0x2cffbd['id']==_0x43575a['documentId'])['content'],_0x157bea=_0x282be9['model']['document']['getRoot'](_0x43575a['rootName']),_0x571982=_0x282be9['data']['parse'](_0x583581,_0x157bea),_0x4e2b1d=ms(_0x1707ed),_0x397d17=_0x282be9['data']['parse'](_0x4e2b1d,_0x157bea),_0x38eee6=_0x282be9['data']['parse'](_0x4e2b1d,_0x157bea),_0x38ae58=_0x282be9['model']['createPositionAt'](_0x397d17,0x0),_0x347bec=ms(_0x68d88c),_0x24c45e={'targetEditor':_0x282be9,'anchor':_0x38ae58,'markDeletions':!0x1};let _0x22ae2f;try{_0x22ae2f=_0x282be9['plugins']['get'](_0x1cf5c4)['getDiff'](_0x4e2b1d,_0x347bec,_0x24c45e)['getOperations']();}catch(_0x5ac8a0){return this['_reporter']['reportError'](new sn({'code':'ai-chat-suggestion-diff-failed','type':'runtime','severity':'warning','cause':_0x5ac8a0,'context':{'replyId':_0x45bf3f,'partIndex':_0x4316aa}})),null;}if(!_0x22ae2f['length'])return null;_0x282be9['model']['change'](_0x1fff46=>{for(const _0x325daa of _0x22ae2f)if('remove'==_0x325daa['type']){const _0x2a81b8=_0x325daa['sourcePosition'],_0x132806=_0x325daa['howMany'],_0x3edfa8=new _0x50ba30(_0x2a81b8,_0x132806);_0x1fff46['batch']['addOperation'](_0x3edfa8),_0x282be9['model']['applyOperation'](_0x3edfa8);}else'marker'!==_0x325daa['type']&&(_0x325daa['baseVersion']=null,_0x325daa['isDocumentOperation']=!0x1,_0x1fff46['batch']['addOperation'](_0x325daa),_0x282be9['model']['applyOperation'](_0x325daa));});const _0xcb229c=Gs(_0x282be9,_0x22ae2f,_0x397d17);Ks(_0x282be9['model'],_0xcb229c);const _0x25528f=_0xcb229c['getFirstRange']()['start']['path']['slice'](),_0x22f79b=_0xcb229c['getFirstRange']()['end']['path']['slice'](),_0x4557b0=[];let _0xc2449=_0x397d17,_0x2dd95b=_0x38eee6;for(let _0xabf0c7=0x0;_0xabf0c7<_0x22f79b['length'];_0xabf0c7++){const _0x39abf8=_0xc2449['maxOffset']-_0x22f79b[_0xabf0c7];_0x4557b0[_0xabf0c7]=_0x2dd95b['maxOffset']-_0x39abf8,_0xc2449=_0xc2449['getChildAtOffset'](_0x22f79b[_0xabf0c7]),_0x2dd95b=_0x2dd95b['getChildAtOffset'](_0x4557b0[_0xabf0c7]);}const _0x357854=_0x282be9['model']['createRange'](_0x282be9['model']['createPositionFromPath'](_0x38eee6,_0x25528f),_0x282be9['model']['createPositionFromPath'](_0x38eee6,_0x4557b0)),_0x5d08ea=_0x38eee6['getChild'](0x0)['getAttribute'](_0x5e92a3),_0x5738fc=Array['from'](_0x571982['getChildren']())['find'](_0x2a482c=>_0x2a482c['getAttribute'](_0x5e92a3)==_0x5d08ea)['getPath'](),_0x2edb77=_0x357854['start']['path']['slice'](),_0x4b2768=_0x357854['end']['path']['slice']();_0x2edb77[0x0]=_0x5738fc[0x0]+_0x2edb77[0x0],_0x4b2768[0x0]=_0x5738fc[0x0]+_0x4b2768[0x0];let _0x132d1f=_0x282be9['model']['createRange'](_0x282be9['model']['createPositionFromPath'](_0x282be9['model']['document']['getRoot'](_0x43575a['rootName']),_0x2edb77),_0x282be9['model']['createPositionFromPath'](_0x282be9['model']['document']['getRoot'](_0x43575a['rootName']),_0x4b2768));const _0x49cb5b=_0x17d2d0['documents']['find'](_0x2b9c18=>_0x2b9c18['id']==_0x43575a['documentId'])['version'],_0x34b68e=_0x282be9['model']['document']['history']['getOperations'](_0x49cb5b);for(const _0x217d64 of _0x34b68e)_0x132d1f=_0x4e8468['_createFromRanges'](_0x132d1f['getTransformedByOperation'](_0x217d64));return{'range':_0x132d1f,'currentIndex':_0x4316aa,'targetEditor':_0x282be9};}['_integrateEditorBalloon'](_0x3a7d97){if(!_0x3a7d97['plugins']['has']('AIChatBalloon'))return;const _0x474784=_0x3a7d97['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x474784['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x474784,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x4e0742,partIndex:_0x3c0ea2}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x5b86ae}=this['getInteractionAndReplyById'](_0x4e0742),_0x319c73=_0x5b86ae['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x3c0ea2});_0x474784['updateContent']({'part':_0x319c73[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x474784,'applySuggestion',()=>{const {replyId:_0x56e98c,partIndex:_0x5b91ee}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x56e98c,'partIndex':_0x5b91ee}),_0x474784['setState']('accepted');}),this['listenTo'](_0x474784,'insertSuggestion',()=>{const {replyId:_0x22bcba,partIndex:_0x14765d}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x22bcba,'partIndex':_0x14765d}),_0x474784['setState']('accepted');}),this['listenTo'](_0x474784,'rejectSuggestion',()=>{const {replyId:_0x54a46b,partIndex:_0x605ebb}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x54a46b,'partIndex':_0x605ebb}),_0x474784['setState']('rejected');}),this['listenTo'](_0x474784,'showNext',()=>{const {replyId:_0x3be21e,partIndex:_0x36ca45}=this['_currentPreviewedChangeGroup'],_0x3c30f1=this['_getPresentableSiblingContentPartIndex'](_0x3be21e,_0x36ca45,'next');null!==_0x3c30f1&&this['_openBalloonFor'](_0x3be21e,_0x3c30f1);}),this['listenTo'](_0x474784,'showPrevious',()=>{const {replyId:_0xa88de9,partIndex:_0x5a5224}=this['_currentPreviewedChangeGroup'],_0x39189c=this['_getPresentableSiblingContentPartIndex'](_0xa88de9,_0x5a5224,'previous');null!==_0x39189c&&this['_openBalloonFor'](_0xa88de9,_0x39189c);}),this['listenTo'](_0x474784,'dialogClosed',(_0x3b5ccd,{id:_0x127181})=>{if('aiChatBalloon'!==_0x127181)return;const {replyId:_0x2b1c1d,partIndex:_0x4083b0}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x2b1c1d,'index':_0x4083b0,'isActive':!0x1}),this['_activeBalloon']===_0x474784&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0x578f5a){if(this['_channelsToEditors']['set'](_0x578f5a['config']['get']('collaboration.channelId'),_0x578f5a),this['_integrateEditorBalloon'](_0x578f5a),this['addCurrentDocumentToChatContext'](),_0x578f5a['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x578f5a['plugins']['has']('Undo')){const _0x1c95ed=_0x578f5a['commands']['get']('undo'),_0x29e0f8=_0x578f5a['commands']['get']('redo');this['listenTo'](_0x1c95ed,'revert',(_0x4d7745,_0x368742,_0x490634)=>{const _0x174446=this['_batchToChanges']['get'](_0x368742);if(!_0x174446)return;const _0x9c0de7=this['activeConversation']['getInteraction'](_0x174446['interactionId']),_0x35a994=_0x9c0de7?.['getReply'](_0x174446['replyId']);this['_batchToChanges']['delete'](_0x368742),_0x9c0de7&&_0x35a994&&(_0x174446['indexes']['forEach'](_0x3fa303=>_0x35a994['setChangeGroupState'](_0x3fa303,'pending')),this['_batchToChanges']['set'](_0x490634,_0x174446));}),this['listenTo'](_0x29e0f8,'revert',(_0x5bc333,_0x2ce8cd,_0x41a1e1)=>{const _0x1b02eb=this['_batchToChanges']['get'](_0x2ce8cd);if(!_0x1b02eb)return;const _0x46c213=this['activeConversation']['getInteraction'](_0x1b02eb['interactionId']),_0xc342e4=_0x46c213?.['getReply'](_0x1b02eb['replyId']);this['_batchToChanges']['delete'](_0x2ce8cd),_0x46c213&&_0xc342e4&&(_0x1b02eb['indexes']['forEach'](_0x589882=>_0xc342e4['setChangeGroupState'](_0x589882,'accepted')),this['_batchToChanges']['set'](_0x41a1e1,_0x1b02eb));});}const _0x51e88b=_0x578f5a['config']['get']('ai.chat.context');_0x51e88b['alwaysAddSelection']&&_0x51e88b['document']['enabled']&&this['listenTo'](_0x578f5a['model']['document']['selection'],'change:range',(_0x239033,_0x5059fb)=>{_0x5059fb['directChange']&&'chat'===_0x578f5a['plugins']['get']('AITabs')['view']['activeTab']&&(_0x578f5a['model']['hasContent'](_0x578f5a['model']['document']['selection'])?this['addSelectionToChatContext'](_0x578f5a):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x4dfd69=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x244fed=await _0x4dfd69['getConversations']();return _0x244fed['length']?_0x244fed[0x0]['id']:'new';}catch(_0x5758ad){return this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':vt()}),this['_reporter']['logError'](new ht('ai-chat-conversation-init-failed',this,{'error':_0x5758ad})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x16ee78={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x16ee78);}catch(_0x3ff748){this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x16ee78['id']||vt()}),this['_reporter']['logError'](_0x3ff748),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x217a5c,modelId:_0x4f189b}={}){this['_closeActiveBalloon']();let _0x55a04d=_0x4f189b;_0x55a04d||(_0x217a5c||!this['activeConversation']?_0x55a04d=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x55a04d=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x22b7c3=this['getGroupId'](),_0x4af79c=_0x217a5c||vt();let _0x580260;this['activeConversation']=new Sn({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x55a04d,'conversationId':_0x4af79c,'group':_0x22b7c3,'locale':this['context']['locale'],'isFromHistory':!!_0x217a5c,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0x5ae304=>this['_aiEditing']['getSessionId'](_0x5ae304)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0x16e06e,_0x31895f)=>{this['_aiChatUi']['createConversation'](_0x31895f),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x217a5c||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x2bacb9,_0x92e8d)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x92e8d['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x47879d=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x47879d);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x5a2a67=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x5a2a67);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x3f67e3,_0x41b258)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x41b258,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x14b85e,_0x1a3eea)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x1a3eea,{'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});}),this['listenTo'](this['activeConversation'],'interactionStarted',()=>{this['_aiChatUi']['startInteraction']();}),this['listenTo'](this['activeConversation'],'interactionFinished',async()=>{this['_updateReplyContentThrottled']['flush'](),await this['_aiChatUi']['finishInteraction']();}),this['listenTo'](this['activeConversation'],'interactionDestroyed',(_0x299833,_0x439330)=>{this['_aiChatUi']['removeFeedInteraction'](_0x439330['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x3470c3,_0x10f968,_0x46ef1e)=>{this['_updateConversationTitle'](_0x10f968,_0x46ef1e);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x1f84e3,_0x245c01)=>{void 0x0!==_0x580260&&_0x580260!==_0x245c01['id']&&this['_updateReplyContentThrottled']['flush'](),_0x580260=_0x245c01['id'],_0x245c01['isFromHistory']?await this['_updateReplyContent']({'reply':_0x245c01}):await this['_updateReplyContentThrottled']({'reply':_0x245c01});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x32c229,{reply:_0x492ddb,index:_0x5a887d,state:_0xe4e0b8})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x492ddb['id'],'index':_0x5a887d,'state':_0xe4e0b8}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x492ddb['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x5a887d&&this['_activeBalloon']?.['setState'](_0xe4e0b8);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0xcd6555,_0x1aef65)=>{if(this['_aiChatUi']['addContextItem'](_0x1aef65['contextItem'],_0x1aef65['isLoading']),'selection'===_0x1aef65['contextItem']['type']){const _0xa19f8d=_s(this['context']),_0x522c85=[..._0xa19f8d['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0xa19f8d,'ranges':_0x522c85,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x48663f,_0x9add17)=>{this['_aiChatUi']['removeContextItem'](_0x9add17['uiId']),'current-document'==_0x9add17['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x9add17['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x25b2c3,_0x44feb1)=>{this['_aiChatUi']['setContextItemLoading'](_0x44feb1['contextItem']['uiId'],_0x44feb1['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x3b7671,_0x447eb9)=>{this['_aiChatUi']['setConversationContext'](_0x447eb9['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x5e8c4d,_0x32099e)=>{this['_aiChatUi']['setAddContextOptions'](_0x32099e['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x24211a,_0x9de79c)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x9de79c['sourceId'],_0x9de79c['source'],_0x9de79c['resources'],_0x9de79c['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x1e59aa,_0x16b77f)=>{this['_aiChatUi']['updateResourceState'](_0x16b77f['sourceId'],_0x16b77f['resourceId'],_0x16b77f['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x159fa5,_0x5566e2)=>{this['_aiChatUi']['updateCapabilities'](_0x5566e2);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0x27aaf1,_0x1cf860)=>{try{const _0x1228e4=(await this['_aiChatModels']['getAll']())['find'](_0x4d028f=>_0x4d028f['id']===_0x1cf860['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x1228e4,_0x1cf860['isDisabled']);}catch(_0x3703ee){this['_reporter']['logError'](new sn({'code':'ai-chat-models-unable-to-retrieve','type':'network','cause':_0x3703ee}),{'context':{'operation':'model-selected'}});}}),this['listenTo'](this['activeConversation'],'error',(_0x4a0776,{error:_0x2b5f12,interactionId:_0x4f384f,fileName:_0x33721f,url:_0x270f5d,sourceId:_0xed376,sourceLabel:_0x303ce8})=>{const _0x3d60f2=_0x4f384f?_0x4f384f+':'+vt():vt();this['_reporter']['reportError'](_0x2b5f12),_0x2b5f12['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':us(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x3d60f2}):_0x2b5f12['message']['startsWith']('ai-chat-conversation-init-failed')||_0x2b5f12['message']['startsWith']('ai-chat-conversation-start-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x3d60f2}):_0x2b5f12['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x33721f),'id':_0x3d60f2}):_0x2b5f12['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x270f5d),'id':_0x3d60f2}):_0x2b5f12['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x3d60f2}):_0x2b5f12['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x3d60f2}):_0x2b5f12['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0xed376&&this['_aiChatUi']['closeSourceResourceBalloon'](_0xed376),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x303ce8||'source'),'id':_0x3d60f2})):_0x2b5f12['message']['startsWith']('ai-chat-resource-load-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x3d60f2}):_0x2b5f12['message']['startsWith']('ai-chat-invalid-request')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x3d60f2}):_0x2b5f12['message']['startsWith']('ai-chat-context-unsupported-file-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x3d60f2}):_0x2b5f12['message']['startsWith']('ai-chat-context-file-too-large')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x3d60f2}):_0x2b5f12['message']['startsWith']('ai-chat-context-file-too-many-pages')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x3d60f2}):_0x2b5f12['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x3d60f2}):this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x3d60f2});}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x217a5c||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0x39c03f,attributes:_0x2e566e}){if(!this['activeConversation'])throw new ht('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x3108a3=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0x3108a3);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x39c03f,'attributes':_0x2e566e});}['_removeFromContext'](_0x2d5d21){this['activeConversation']?.['removeFromContext'](_0x2d5d21);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x67fabd){const [_0x30dafa,_0x47b9dd]=_0x67fabd['split'](':'),_0x4e3010=this['activeConversation']['getInteraction'](_0x30dafa);return{'interaction':_0x4e3010,'reply':_0x4e3010['getReply'](_0x47b9dd)};}['_scrollToSuggestionRange'](_0xbc1091,_0x35415e=!0x1,_0x246042){const _0x13072d={'target':_0x246042['editing']['view']['domConverter']['viewRangeToDom'](_0x246042['editing']['mapper']['toViewRange'](_0xbc1091)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x35415e};_0x35415e&&(_0x13072d['alignToTop']=!0x0),Rt(_0x13072d);}['_updateConversationTitle'](_0x423cc3,_0x5f4775=!0x1){this['_aiChatUi']['setConversationTitle'](_0x423cc3||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x5f4775);}['_addFeedItemReply'](_0x2bf93d){'text'===_0x2bf93d['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x2bf93d):this['_aiChatUi']['addFeedItemAISuggestion'](_0x2bf93d);}async['_updateReplyContent']({reply:_0x5b0035,renderingStrategy:_0x572f0a}){const {id:_0x427a6f,interactionId:_0x4f651d,isDone:_0x109741,type:_0x342ed6,parsedContent:_0x2de264}=_0x5b0035,_0x3d4284=_0x4f651d+':'+_0x427a6f;if('modification'===_0x342ed6){const _0x3ded4f=_0x5b0035['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x3d4284,'parts':_0x3ded4f,'isDone':_0x109741,'skipLoadingEffects':_0x5b0035['isFromHistory']});}else'text'===_0x342ed6&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x3d4284,'parsedContent':_0x2de264['get']('text'),'renderingStrategy':_0x572f0a,'isDone':_0x109741});_0x109741&&_0x5b0035['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x3d4284,_0x5b0035['sources']);}['_updateReplyContentThrottled']=_0x2150f4(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x2f1a3a=this['activeConversation']?.['lastInteraction'];_0x2f1a3a&&(_0x2f1a3a['stop'](),this['_aiChatUi']['stopInteraction'](_0x2f1a3a)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x4f573a=this['activeConversation']?.['lastInteraction'];if(_0x4f573a){for await(const _0x28f274 of _0x4f573a['replies'])this['_aiChatUi']['hasFeedItem'](_0x28f274['id'])||this['_addFeedItemReply'](_0x28f274),await this['_updateReplyContent']({'reply':_0x28f274,'renderingStrategy':'static'});}}['_updateRatings'](_0x9fb4fc){const _0x5d79e4={'positiveCount':_0x9fb4fc['changeGroups']['filter'](_0xd8bb48=>'accepted'===_0xd8bb48['state'])['length'],'totalCount':_0x9fb4fc['changeGroups']['length'],'modificationId':_0x9fb4fc['id']},_0x9016c7=this['activeConversation']['getInteraction'](_0x9fb4fc['interactionId'])['messageId'];_0x9016c7&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x9016c7,_0x5d79e4);}['_getAIChatFeedAPI'](_0x32b46a){const _0x312300=this['_aiChatUi'],_0x2aed53=()=>{_0x32b46a['resetWebSearchState'](),_0x32b46a['resetReasoningState'](),_0x312300['clearLoadingMessage']();},_0x48b446=()=>{_0x32b46a['currentReply']&&(_0x32b46a['currentReply']['done'](),_0x32b46a['currentReply']=void 0x0);};return{'insertTextReply':(_0x98692,_0x1c4466)=>{_0x48b446(),_0x2aed53();const _0xc80a01=_0x32b46a['currentReply']=_0x32b46a['createReply']({'type':'text','interactionId':_0x32b46a['id'],'id':_0x1c4466||vt(),'channelsToEditors':this['_channelsToEditors']});return _0xc80a01['appendContent'](_0x98692),_0x48b446(),_0xc80a01;},'insertCustomElement':async(_0x1ace82,_0x406de9)=>(_0x48b446(),_0x2aed53(),_0x312300['addFeedItemCustomElement'](_0x1ace82,_0x406de9||vt())),'setLoadingMessage':_0x44d3d3=>{_0x312300['setLoadingMessage'](_0x44d3d3);},'clearLoadingMessage':()=>{_0x312300['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){ds(this['context'])['find'](_0x3c476b=>'destroyed'!==_0x3c476b['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}};const Nn=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],yn=[...Nn,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function xn(_0x52e316){const _0x1af2b1=new AbortController();return{'promise':new Promise((_0xca641f,_0x40d054)=>{const _0x202b2b=setTimeout(_0xca641f,_0x52e316);_0x1af2b1['signal']['addEventListener']('abort',()=>{clearTimeout(_0x202b2b),_0x40d054();});}),'abortController':_0x1af2b1};}var Ln=class{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x1f646b){this['options']={'delay':_0x1f646b?.['delay']??0xa,'textNodeStyle':_0x1f646b?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x4fd009,targetElement:_0x53ba12,abortSignal:_0x58de84}){this['isStreaming']&&this['stop'](),_0x58de84?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x373861(_0x4fd009,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x197521=0x0;_0x197521<this['currentIndex'];_0x197521++)this['nodesList'][_0x197521]['shouldBeStreamed']=!0x0;do{const _0x47a12f=Date['now'](),_0x9d654b=this['nodesList'][this['currentIndex']],_0x5b3d2a=_0x47a12f-this['lastUpdateTime'];if(_0x9d654b){_0x9d654b['shouldBeStreamed']=!0x0;let _0x509905=_0x9d654b['parent'];for(;_0x509905;)_0x509905['shouldBeStreamed']=!0x0,_0x509905=_0x509905['parent'];}if(_0x5b3d2a<this['options']['delay'])try{const {promise:_0x383ac9,abortController:_0x1dd74f}=xn(this['options']['delay']-_0x5b3d2a);this['timeoutAbortController']=_0x1dd74f,await _0x383ac9;}catch(_0x2aaebc){return;}_0x312697(_0x53ba12,'<'+_0x53ba12['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x53ba12['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:_0x1adc62}){Array['from'](_0x1adc62['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x3f6328=>{_0x3f6328['replaceWith'](_0x3f6328['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x2b56ea){let _0x1e68b5='';if(function(_0x5808d1){return _0x1f806c(_0x5808d1);}(_0x2b56ea)){for(const _0x2ad752 of _0x2b56ea['children'])_0x1e68b5+=this['renderNode'](_0x2ad752);}else{if(Hn(_0x2b56ea)){if(!_0x2b56ea['shouldBeStreamed'])return'';const _0xaec030=_0x2b56ea,_0x2b9b54=Object['entries'](_0xaec030['attribs'])['map'](([_0xfbc3c9,_0x3d5f62])=>_0xfbc3c9+'=\x22'+_0x3d5f62+'\x22')['join']('\x20');_0x1e68b5+='<'+_0xaec030['tagName']+(_0x2b9b54?'\x20'+_0x2b9b54:'')+'>';for(const _0x2602c9 of _0x5b482f(_0xaec030))_0x1e68b5+=this['renderNode'](_0x2602c9);_0x1e68b5+='</'+_0xaec030['tagName']+'>';}else{if(!Pn(_0x2b56ea))return'';if(!_0x2b56ea['shouldBeStreamed'])return'';!function(_0x522660){return!(!_0x522660['parent']||!Hn(_0x522660['parent']))&&(!!Dn['includes'](_0x522660['parent']['tagName'])&&!_0x1d60b7(_0x522660)['match'](/^\s*[<>]\s*$/));}(_0x2b56ea)?_0x1e68b5+=_0x1dbe92(_0x2b56ea):_0x1e68b5+=_0x1dbe92(new _0x1a4ef3('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x2b56ea]));}}return _0x1e68b5;}['getParsedDocumentNodeList'](){const _0x1e7212=[];return function(_0x3f150f,_0x4f0f51){const _0x2ff969=_0x4def9c=>{if(_0x4f0f51(_0x4def9c),_0x4def9c instanceof _0x9749e)for(let _0x1de984=0x0;_0x1de984<_0x4def9c['children']['length'];_0x1de984++){const _0x230d38=_0x4def9c['children'][_0x1de984];_0x2ff969(_0x230d38);}};for(let _0x556b3f=0x0;_0x556b3f<_0x3f150f['children']['length'];_0x556b3f++)_0x2ff969(_0x3f150f['children'][_0x556b3f]);}(this['document'],_0xf825df=>{if(Pn(_0xf825df)){const _0x19236f=this['splitTextNodeIntoWordNodes'](_0xf825df);_0x19236f['length']&&_0x1e7212['push'](..._0x19236f);}_0xf825df['isWordSplitSource']||_0xf825df['isWordSplitResult']||_0x1e7212['push'](_0xf825df);}),_0x1e7212;}['splitTextNodeIntoWordNodes'](_0x8361db){if(_0x8361db['isWordSplitSource']||_0x8361db['isWordSplitResult'])return[];const _0x52e939=_0x1d60b7(_0x8361db)['match'](/(?:\s*\S+\s*)/g),_0x43940b=[];if(_0x52e939&&_0x52e939['length']>0x1){for(const _0x31190a of _0x52e939){const _0x27b832=new _0xecc90d(_0x31190a);_0x27b832['isWordSplitResult']=!0x0,_0x201d1c(_0x8361db,_0x27b832),_0x43940b['push'](_0x27b832);}_0x8361db['isWordSplitSource']=!0x0,_0x2a7599(_0x8361db);}return _0x43940b;}};const Dn=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function Pn(_0x1ae8d7){return _0x506b37(_0x1ae8d7);}function Hn(_0x3256bd){return _0x489441(_0x3256bd);}function Mn(_0x4ce1f1,_0x31218d){_0x4ce1f1['cleanUpAnimations']({'targetElement':_0x31218d}),_0x31218d['querySelectorAll']('[data-id]')['forEach'](_0x5e2263=>{_0x5e2263['removeAttribute']('data-id');});}var Vn=class extends _0x215f6f{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x38f411){super();const _0x47a1ea=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new Ln(),this['options']=_0x38f411,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x47a1ea['if']('isDone','ck-ai-chat__feed__item_done'),_0x47a1ea['if']('isVisible','ck-hidden',_0x529f0b=>!_0x529f0b),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){Mn(this['htmlStreamer'],this['element']),this['isDone']=!0x0;}async['streamIntoElement'](_0x201cd7,_0x4fd373,_0x476545){await this['htmlStreamer']['stream']({'document':_0x201cd7,'targetElement':_0x4fd373,'abortSignal':_0x476545});}},Un=class extends _0x215f6f{['showChangesToggleView'];constructor(_0x11cfa6,_0x3ac5b3){super(_0x11cfa6),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new Bn(_0x11cfa6),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+hn,'label':us(_0x11cfa6,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x3ac5b3['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x4bcd2d=>_0x4bcd2d?et:tt),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x8b73f1=new Yt();_0x8b73f1['content']=_0x97af05,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x3ac5b3['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x8b73f1,{'tag':'span','children':[us(_0x11cfa6,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}},Bn=class extends Ht{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}};const Gn={'accepted':_0x3cdc95,'rejected':_0x2cae61,'outdated':_0x2cae61};var Fn=class extends _0x215f6f{['stateIconView'];constructor(_0xeee098){super(_0xeee098);const _0x2d56f1=this['bindTemplate'];this['set']('state','accepted'),this['set']('isVisible',!0x0),this['stateIconView']=new Kn(),this['stateIconView']['bind']('state')['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x2d56f1['to']('state',_0x1d2def=>'ck-ai-suggestion__content-part-state_'+_0x1d2def),_0x2d56f1['if']('isVisible','ck-hidden',_0x21d96a=>!_0x21d96a)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x2d56f1['to']('state',_0x338da1=>{switch(_0x338da1){case'accepted':return us(_0xeee098,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return us(_0xeee098,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return us(_0xeee098,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x12d4ed){this['state']=_0x12d4ed;}},Kn=class extends Yt{constructor(){super(),this['set']('state','accepted'),this['content']=Gn[this['state']],this['on']('change:state',()=>{this['content']=Gn[this['state']];});}},Wn=class extends _0x116a57{['_applyButton'];['_suggestButton'];constructor(_0x134894,_0x4a7686,_0x1532f7){super(_0x134894);const _0x4c6b52=Boolean(_0x1532f7);this['set']('isEnabled',!_0x4c6b52),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x550ba5=[];if(_0x4c6b52){const _0x18614f=new Ht(_0x134894);_0x18614f['set']({'label':us(_0x134894,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x4d8e0c}),_0x18614f['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x550ba5['push'](_0x18614f);}else{_0x4a7686['includes']('applySuggestion')&&(this['_applyButton']=new Ht(_0x134894),this['_applyButton']['set']({'label':us(_0x134894,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x3cdc95}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x45551a=>!_0x45551a),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x550ba5['push'](this['_applyButton'])),_0x4a7686['includes']('insertSuggestion')&&(this['_suggestButton']=new Ht(_0x134894),this['_suggestButton']['set']({'label':us(_0x134894,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x41c137}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x550ba5['push'](this['_suggestButton']));const _0x3804ae=new Ht(_0x134894);_0x3804ae['set']({'label':us(_0x134894,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x2cae61}),_0x3804ae['bind']('isEnabled')['to'](this),_0x3804ae['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x550ba5['push'](_0x3804ae);}this['items']['addMany'](_0x550ba5);const _0x235a5c=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x235a5c['if']('isVisible','ck-hidden',_0x490ea5=>!_0x490ea5)]}});}['setButtonsVisibility']({showApplyButton:_0x257104,showSuggestButton:_0x553ebb}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x257104),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x553ebb);}},Yn=class extends _0x215f6f{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x3ea895,{part:_0x1acda3,uiIndex:_0x4764cc,availableActions:_0xbecfb0,areActionsDisabled:_0x31b6ff}){super(_0x3ea895),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new Wn(_0x3ea895,_0xbecfb0,_0x31b6ff),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x1acda3['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x1acda3['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x1acda3['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new Fn(_0x3ea895),this['titleLabelView']=new $n(_0x3ea895,_0x4764cc),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',(_0x56fb95,_0xc34fdf,_0x64026e,_0x34b102)=>{'pending'===_0x34b102?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x64026e?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x64026e),this['children']['add'](this['stateView']));});}},$n=class extends _0x215f6f{constructor(_0x58c5d0,_0x42b9a4){super(_0x58c5d0),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[us(_0x58c5d0,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x42b9a4['toString']())]});}},qn=class extends _0x215f6f{['htmlStreamer'];constructor(_0x201dff){super(_0x201dff),this['htmlStreamer']=new Ln(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async['update']({part:_0x4778ba,renderingStrategy:_0x690c4b,abortSignal:_0x2cf519}){const _0x149880=_0x373861(_0x4778ba['content'],!0x0);for(const _0x5829ba of ws(_0x149880))_0x2a7599(_0x5829ba);'streaming'===_0x690c4b?await this['htmlStreamer']['stream']({'document':_0x149880,'targetElement':this['element'],'abortSignal':_0x2cf519}):_0x312697(this['element'],'<'+this['element']['tagName']+'>'+ms(_0x149880)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}['cleanUpStreamingArtifacts'](){Mn(this['htmlStreamer'],this['element']);}},Qn=class extends _0x215f6f{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x3e1137,{part:_0x3ec587,uiIndex:_0x2731e6,areActionsDisabled:_0x8638c3,availableActions:_0x31c85f}){super(_0x3e1137);const _0x169f6e=this['bindTemplate'];this['set']('state','pending'),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1),this['set']('isTrackChangesOn',!0x1);const _0x3bf664=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x8638c3;};this['on']('change:state',_0x3bf664),this['on']('change:isDone',_0x3bf664),_0x3bf664(),this['_children']=this['createCollection'](),this['_headerView']=new Yn(_0x3e1137,{'part':_0x3ec587,'uiIndex':_0x2731e6,'availableActions':_0x31c85f,'areActionsDisabled':_0x8638c3}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...Nn)['to'](this),this['_streamableContentView']=new qn(_0x3e1137),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x169f6e['to']('state',_0x4e5577=>'ck-ai-suggestion__body__content-part_'+_0x4e5577),_0x169f6e['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x169f6e['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x169f6e['if']('isVisible','ck-hidden',_0x1d72f8=>!_0x1d72f8)]},'children':this['_children'],'on':{'mouseenter':_0x169f6e['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x3ec587['index']});}),'mouseleave':_0x169f6e['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x3ec587['index']});}),'click':_0x169f6e['to'](_0x118875=>{const _0x171f30=_0x118875['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x171f30)&&this['fire']('showChangeInText',{'index':_0x3ec587['index']});})}});}async['updateContent']({part:_0x5999f1,showUnchangedParts:_0x13fddf=!0x1,abortSignal:_0xf17bce}){this['partDefinition']=_0x5999f1,this['isVisible']=this['partDefinition']['hasChanges']||_0x13fddf,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x5999f1,'renderingStrategy':'static','abortSignal':_0xf17bce});}['markAsDone'](){this['isDone']=!0x0;}},Xn=class extends _0x215f6f{constructor(_0x1ab1a6,_0x140815){super(_0x1ab1a6),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x3cea51=>!_0x3cea51)]},'children':this['_createSkeletonItems'](_0x140815)});}['_createSkeletonItems'](_0xaa10f1){const _0x4b8d4c=['ck','ck-ai-skeleton__item'];return _0xaa10f1['map'](_0x12bf36=>{let _0x52f099='';switch(_0x12bf36['attributes']['align']){case'right':_0x52f099='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x52f099='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x52f099='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x12bf36['tag'],'attributes':{'class':[..._0x4b8d4c,_0x12bf36['attributes']['class']?_0x12bf36['attributes']['class']:''],'style':'width:\x20'+_0x12bf36['attributes']['width']+';\x20height:\x20'+_0x12bf36['attributes']['height']+';'+_0x52f099}};});}};const zn={'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':jn(0x5,'100%','44px','right'),'aiChatResources':jn(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 jn(_0x32f0fc,_0x4e4a40,_0x4b2c9d,_0x3865f4){return new Array(_0x32f0fc)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x4e4a40,'height':_0x4b2c9d,'align':_0x3865f4}}));}const Jn=/* #__PURE__ -- @preserve */
33
+ ut();var Zn=class extends Jn{['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x7f3853){const _0x554619=this['createTask'](_0x7f3853);return this['queue']['push'](_0x554619),this['_processQueue'](),_0x554619['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(_0x3240fb=>{this['once']('_queueEmpty',()=>{_0x3240fb();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x4f04cb=this['queue']['shift']();try{await _0x4f04cb['callback'](this['_abortController']['signal']),_0x4f04cb['resolve']();}catch(_0x42a655){_0x4f04cb['reject'](_0x42a655);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x43d26e){let _0xb2476c,_0x56a343;const _0x1ca897=new Promise((_0xab3e6c,_0x3e4c2a)=>{_0xb2476c=_0xab3e6c,_0x56a343=_0x3e4c2a;});return{'callback':_0x43d26e,'resolve':_0xb2476c,'reject':_0x56a343,'completePromise':_0x1ca897};}},tr=class extends Vn{constructor(_0x4fe1b7){super(_0x4fe1b7),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x4fe1b7['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x424917){this['element']['innerHTML']=_0x424917;}};const er=['applySuggestion','insertSuggestion'];var ir=class extends _0x215f6f{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x30d9d9,_0x5aa352=[...er],_0x3f6ab2){super(_0x30d9d9);const _0x8d24ae=this['bindTemplate'],_0x18be2d=Boolean(_0x3f6ab2);if(this['set']('isEnabled',!_0x18be2d),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x18be2d){const _0x27863b=new Ht(_0x30d9d9);_0x27863b['set']({'label':us(_0x30d9d9,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x4d8e0c}),_0x27863b['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x503c38=new _0x215f6f(_0x30d9d9);_0x503c38['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[us(_0x30d9d9,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x27863b]}]}),this['children']['add'](_0x503c38);}else this['_applyChangesButton']=new Ht(_0x30d9d9),this['_applyChangesButton']['set']({'label':us(_0x30d9d9,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x5aa352['includes']('applySuggestion'),'class':on}),this['_insertSuggestionsButton']=new Ht(_0x30d9d9),this['_insertSuggestionsButton']['set']({'label':us(_0x30d9d9,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x5aa352['includes']('insertSuggestion'),'class':an}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x2190e1=>{_0x2190e1['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',_0x8d24ae['if']('isVisible','ck-hidden',_0x314236=>!_0x314236)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x33fc74){this['isVisible']=_0x33fc74;}['_switchButtonLabelsPlurality'](_0x1c1847){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x1c1847?(this['_applyChangesButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}},sr=class extends _0x215f6f{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x1183f7,_0x12d4f3){super(_0x1183f7),this['bodyCollection']=_0x12d4f3,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',_0x478196=>!_0x478196)]},'children':this['children']});const _0x1ba361=new _0x215f6f(this['locale']),_0x1b9e63=new Yt();_0x1b9e63['content']=at,_0x1ba361['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x1b9e63,{'tag':'span','children':[{'text':us(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x1ba361),this['_setupBalloonPanel'](_0x1183f7);}['addSource'](_0x366130){this['children']['add'](new nr(this['locale'],_0x366130,this['balloonPanelView']));}['_setupBalloonPanel'](_0x5312c9){this['balloonPanelView']=new yt(_0x5312c9),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},nr=class extends Ht{['balloonPanelView'];['source'];constructor(_0x55410f,_0x2136cb,_0x23d548){super(_0x55410f),this['source']=_0x2136cb,this['balloonPanelView']=_0x23d548,this['set']({'label':_0x2136cb['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x5c4029=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x5c4029['to'](()=>{window['open'](_0x2136cb['url'],'_blank');}),'mouseenter':_0x5c4029['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x5c4029['to'](()=>{this['_hideTooltip']();})}}),_0x2136cb['favicon']){const _0x166ce1=new _0x215f6f(_0x55410f);_0x166ce1['setTemplate']({'tag':'img','attributes':{'src':_0x2136cb['favicon']||at,'alt':_0x2136cb['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x166ce1);}else this['set']('icon',at);}['_createTooltipContentView'](_0x7a3bc8,_0x32d379){const _0x1832f8=new _0x215f6f(_0x7a3bc8),_0x52fc43=[];let _0x12c782;_0x32d379?.['favicon']?(_0x12c782=new _0x215f6f(_0x7a3bc8),_0x12c782['setTemplate']({'tag':'img','attributes':{'src':_0x32d379['favicon'],'alt':_0x32d379['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x12c782=new Yt(),_0x12c782['content']=at,_0x12c782['extendTemplate']({'attributes':{'alt':_0x32d379['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x52fc43['push'](_0x12c782);const _0x2eb3c3=new _0x215f6f(_0x7a3bc8);_0x2eb3c3['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x32d379['url']},'children':[{'text':new URL(_0x32d379['url'])?.['hostname']}]}),_0x52fc43['push'](_0x2eb3c3);const _0x406210=new _0x215f6f(_0x7a3bc8);_0x406210['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x52fc43});const _0x410bc7=new _0x215f6f(_0x7a3bc8);return _0x410bc7['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x32d379['title']['length']>0x190?_0x32d379['title']['substring'](0x0,0x190)+'...':_0x32d379['title']}]}),_0x1832f8['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x406210,_0x410bc7]}),_0x1832f8;}['_showTooltip'](){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[yt['defaultPositions']['northArrowSouth'],yt['defaultPositions']['northArrowSouthWest'],yt['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 _0x3bb5e9=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x3bb5e9);}},rr=class extends _0x215f6f{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x5d2c2e(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x3d001a,_0x1a4aca){super(_0x3d001a);const {areActionsDisabled:_0x541196,showUnchangedParts:_0x4de8a2,availableActions:_0x434e21}=_0x1a4aca;this['_areActionsDisabled']=_0x541196,this['_showUnchangedParts']=_0x4de8a2,this['_availableActions']=_0x434e21,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new Xn(_0x3d001a,zn['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new Zn(),this['_emptyPartsWarningView']=new tr({'id':'empty-parts-warning','initialContent':us(_0x3d001a,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new ir(_0x3d001a,_0x1a4aca['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new sr(this['locale'],_0x1a4aca['bodyCollection']),_0x1a4aca['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...Nn)['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'](_0x5608ee=>_0x5608ee instanceof Qn);}async['updateContentParts']({parts:_0x40aa42,abortSignal:_0xe51461,skipLoadingEffects:_0x1958b5}){this['_cachedContentParts']['length']?_0x40aa42['forEach'](_0x28855c=>{const _0x5c1876=this['_cachedContentParts']['findIndex'](_0x172df9=>_0x172df9['index']==_0x28855c['index']);-0x1===_0x5c1876?this['_cachedContentParts']['push'](_0x28855c):this['_cachedContentParts'][_0x5c1876]=_0x28855c;}):this['_cachedContentParts']=_0x40aa42;const _0x374e24=this['_showUnchangedParts']?_0x40aa42:_0x40aa42['filter'](_0x4b19fc=>_0x4b19fc['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x374e24['length']>0x1),_0x1958b5&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0xd39898 of _0x374e24)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x574cc7=>{let _0x43f1f5=this['getPartView'](_0xd39898['index']);if(!_0x43f1f5){if(_0x43f1f5=new Qn(this['locale'],{'part':_0xd39898,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x43f1f5['delegate'](...Nn)['to'](this),_0x43f1f5['bind']('isTrackChangesOn')['to'](this),!_0x1958b5&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x574cc7),_0x574cc7['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x43f1f5,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x1958b5||this['_showSkeletonDebounced']();}await _0x43f1f5['updateContent']({'part':_0xd39898,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x574cc7}),_0x43f1f5['markAsDone']();});return _0xe51461?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x240729,_0x52bb21){const _0x12ee2a=this['getPartView'](_0x240729);_0x12ee2a&&(_0x12ee2a['state']=_0x52bb21),this['hasPendingParts']='pending'==_0x52bb21||this['_contentPartViews']['some'](_0x442adb=>'pending'==_0x442adb['state']);}['setPartActive'](_0x590ebb,_0x8d9cc9){if(!0x1===_0x590ebb){for(const _0x2748f3 of this['_contentPartViews'])_0x2748f3['isActive']=!0x1;}else{const _0x2bcb03=this['getPartView'](_0x590ebb);_0x2bcb03&&(_0x2bcb03['isActive']=_0x8d9cc9);}}['updateSources'](_0x445fde){_0x445fde['forEach'](_0x226384=>this['_sourcesView']['addSource'](_0x226384)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x2d42d8){return this['_contentPartViews']['find'](_0x25fa49=>_0x25fa49['partDefinition']['index']==_0x2d42d8)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x542c19=!this['_cachedContentParts']['find'](({hasChanges:_0x38824c})=>_0x38824c),_0x355746=!!this['_cachedContentParts']['find'](({hasChanges:_0x358087})=>!_0x358087);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x355746,_0x542c19?this['_emptyPartsWarningView']['setContent'](us(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](us(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x4790a6=>_0x4790a6['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x4c3f46){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x1824bd=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x1824bd>0x0){const {promise:_0x4f3cf1,abortController:_0x542230}=xn(_0x1824bd);_0x4c3f46?.['addEventListener']('abort',()=>_0x542230['abort']()),await _0x4f3cf1['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x3188e0=>_0x3188e0['partDefinition']['hasChanges'])['length']>0x0;}},or=class extends _0x215f6f{['bodyView'];['children'];['headerView'];constructor(_0x38aa6a,_0x52796d,_0xa21ee5){super(_0x38aa6a);const {showDiff:_0x1f2986,areActionsDisabled:_0x149010,showUnchangedParts:_0x282ff1,availableActions:_0x5e5de3}=_0x52796d;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new Un(_0x38aa6a,{'showDiff':_0x1f2986}),this['headerView']['on']('toggleShowChanges',(_0x3fef17,_0x748d56)=>{this['areChangesVisible']=_0x748d56['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x748d56['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new rr(_0x38aa6a,{'areActionsDisabled':_0x149010,'showUnchangedParts':!!_0x282ff1,'availableActions':_0x5e5de3,'bodyCollection':_0xa21ee5}),this['bodyView']['delegate'](...Nn)['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'](_0xd29a56){await this['bodyView']['updateContentParts'](_0xd29a56);}['updateSources'](_0x2b29c5){this['bodyView']['updateSources'](_0x2b29c5);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},ar=class extends Vn{['containerView'];constructor(_0x1fad5b,_0x11fd86,_0x541101){super(_0x11fd86),this['set']('isTrackChangesOn',!0x1),this['containerView']=new or(_0x1fad5b,{'showDiff':_0x11fd86['showDiff'],'areActionsDisabled':_0x11fd86['areActionsDisabled'],'availableActions':_0x11fd86['availableActions']},_0x541101),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x1a8813,_0x48b7d8)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x48b7d8['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',(_0x105096,{index:_0x1df433})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x1df433});}),this['containerView']['on']('applySuggestion',(_0x19176d,{index:_0x20a5ca}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x20a5ca});}),this['containerView']['on']('insertSuggestion',(_0x596e6a,{index:_0x598f81}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x598f81});}),this['containerView']['on']('rejectSuggestion',(_0x4ab241,{index:_0x343dda})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x343dda});}),this['containerView']['on']('mouseOverSuggestion',(_0x1174c6,{index:_0x4c6db5})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x4c6db5});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x3429de,{index:_0x32b2b2})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x32b2b2});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x9cba72){await this['containerView']['updateContent'](_0x9cba72);}['updatePartState'](_0x117e2c,_0x5eadb0){this['containerView']['bodyView']['updatePartState'](_0x117e2c,_0x5eadb0);}['setPartActive'](_0x181384,_0x24e2d7){!0x1===_0x181384?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x181384,_0x24e2d7);}['updateSources'](_0x4d7e5f){this['containerView']['updateSources'](_0x4d7e5f);}['getPartView'](_0x2ebc6a){return this['containerView']['bodyView']['getPartView'](_0x2ebc6a);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},hr=class extends Vn{['replyContainer'];['_bodyCollection'];constructor(_0xcd9763,_0x53defe,_0x511072){super(_0x53defe),this['_bodyCollection']=_0x511072,this['locale']=_0xcd9763,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x215f6f(),this['replyContainer']['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-chat__feed__ai-reply-container','ck-ai-chat-content']}}),this['children']['add'](this['replyContainer']);}async['render'](){super['render'](),this['options']['initialContent']&&(await this['updateContent']({'parsedContent':ps(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0x393b6b,renderingStrategy:_0xd393f0,abortSignal:_0xd2206d}){'streaming'===_0xd393f0?await this['streamIntoElement'](_0x393b6b,this['replyContainer']['element'],_0xd2206d):this['replyContainer']['element']['innerHTML']=_0x1dbe92(_0x393b6b);}['updateSources'](_0x481327){const _0x428983=new sr(this['locale'],this['_bodyCollection']);_0x428983['children']['addMany'](_0x481327['map'](_0x952bb0=>new nr(this['locale'],_0x952bb0,_0x428983['balloonPanelView']))),_0x428983['isVisible']=!0x0,this['children']['add'](_0x428983);}},cr=class extends _0x3a0dfe{constructor(_0x25f999=void 0x0){super();const _0x46d426=_0x25f999?'ck-ai-spinner_'+_0x25f999:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x46d426]}});}};const lr={'file':_0x43190a,'image':_0xfe36cf,'document':_0x97af05,'web-resource':_0x2906fb,'text':_0x43190a,'selection':_0xc348c2,'mcp-tool-context':_0x97af05},ur='ck-ai-chat-context-chip',dr='ck-ai-chat-context-chip_wide',_r='ck-ai-chat-context-chip_document',gr='ck-ai-chat-context-chip__label',Ar='ck-ai-chat-context-chip__type-icon',Ir='ck-ai-chat-context-controls__chip-tooltip',pr='n';var mr=class extends Ht{constructor(_0x475c26,_0x3166db,_0x437843,_0x599761,_0x4a31c9=!0x1){super(_0x475c26),this['_isAnimationOnEnterEnabled']=_0x599761,this['_initializeProperties'](_0x3166db,_0x437843,_0x4a31c9),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'](_0x51edbf,_0xa563d6,_0x516c6c){this['set']('label',_0x51edbf['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x51edbf['type']),this['set']('id',_0x51edbf['uiId']),this['set']('readonly',_0xa563d6),this['set']('isLoading',_0x516c6c);}['_setupTemplate'](){const _0x57ad15=this['_createIconView'](),_0x2e9e53=this['_createRemoveButton'](),_0x2ab0eb=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x2ab0eb),'children':this['_createTemplateChildren'](_0x57ad15,_0x2e9e53,_0x2ab0eb)});}['_createTemplateAttributes'](_0x52a9f1){return{'class':[ur,_0x52a9f1['if']('itemType',_r,_0xbd93d7=>'document'==_0xbd93d7),_0x52a9f1['if']('itemType',dr,_0x59f5c2=>'selection'==_0x59f5c2)],'data-cke-tooltip-text':_0x52a9f1['to']('label',Er),'data-cke-tooltip-position':pr,'data-cke-tooltip-class':Ir};}['_createTemplateChildren'](_0xdac1dd,_0x52e21a,_0x3dd149){const _0x21a787=this['_createLabelElement'](_0x3dd149),_0x5de487=this['_createLoaderIcon']();return this['readonly']?[_0xdac1dd,_0x21a787]:[_0xdac1dd,_0x5de487,_0x21a787,_0x52e21a];}['_createLabelElement'](_0x31ff5d){return{'tag':'span','attributes':{'class':gr},'children':[{'text':_0x31ff5d['to']('label')}]};}['_createRemoveButton'](){const _0x354781=new Ht(this['locale']);return _0x354781['set']({'label':us(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x27af74}),this['_setupRemoveButtonEvent'](_0x354781),_0x354781;}['_setupRemoveButtonEvent'](_0x21d2bb){_0x21d2bb['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x11bc3a=this['bindTemplate'],_0x262373=new Yt();return _0x262373['content']=lr[this['itemType']],_0x262373['extendTemplate']({'attributes':{'class':[Ar,_0x11bc3a['if']('isLoading','ck-hidden',_0x5a1719=>_0x5a1719)]}}),_0x262373;}['_handleAnimationEndOnce'](_0x28a384,_0x1c1bab){if(!_0x28a384)return;const _0x3ecd9b=()=>{_0x1c1bab(),_0x28a384['removeEventListener']('animationend',_0x3ecd9b),_0x28a384['removeEventListener']('webkitAnimationEnd',_0x3ecd9b);};_0x28a384['addEventListener']('animationend',_0x3ecd9b),_0x28a384['addEventListener']('webkitAnimationEnd',_0x3ecd9b);}['_createLoaderIcon'](){const _0x924076=new cr('small');return _0x924076['bind']('isVisible')['to'](this,'isLoading',_0x2135e6=>_0x2135e6),_0x924076;}};function Er(_0x30cdf5){if(!_0x30cdf5)return _0x30cdf5;if(_0x30cdf5['length']<=0x78)return _0x30cdf5;const _0x3de7c3=_0x30cdf5['slice'](0x0,0x78),_0x1bbc6a=_0x3de7c3['lastIndexOf']('\x20');return(_0x1bbc6a>0x0?_0x3de7c3['slice'](0x0,_0x1bbc6a):_0x3de7c3)+'…';}const Tr={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},wr='300px';var Cr=class{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0x19c6d6,_0x55eec3,_0x1385a9,_0x4b1afa,_0x23ff37){this['_locale']=_0x19c6d6,this['_visibleChips']=_0x55eec3,this['_config']={...Tr,..._0x1385a9,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x1385a9['cssClasses']}},this['_overflowChips']=new ct(),this['_bodyCollection']=_0x4b1afa,this['_parentView']=_0x23ff37||null;}['setContainerElement'](_0x2cf711){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x2cf711,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 _0x35d3fa=[...this['_visibleChips'],...this['_overflowChips']],_0x462681=this['_createCalculationContainer'](),_0x229621=this['_calculateOverflowInContainer'](_0x462681,_0x35d3fa),_0x4d4c9b=_0x462681['_ancestorsToRestore'];_0x4d4c9b&&this['_restoreAncestorVisibility'](_0x4d4c9b),_0x462681['remove'](),this['_applyOverflowResults'](_0x35d3fa,_0x229621);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0x191c5a({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x2585c6=new Ht(this['_locale']);_0x2585c6['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x49062a=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x49062a['push'](this['_config']['cssClasses']['controlsButton']),_0x2585c6['extendTemplate']({'attributes':{'class':_0x49062a}}),_0x2585c6;}['_createShowMoreBalloonPanelView'](){const _0x208474=new yt(this['_locale']);return _0x208474['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x208474),_0x208474;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x2413cc=>{_0x2413cc['disableAnimationOnEnter']();});const _0x594e4f=new _0x215f6f(this['_locale']);_0x594e4f['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x594e4f);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x18d1bd=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x18d1bd?'':'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'](_0x54fd2e){const _0x13de41=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x4d5703=this['_containerElement']?.['classList'];if(_0x4d5703){const _0x22a7fa=_0x4d5703[0x0]||'',_0x4347d4=_0x54fd2e['querySelector']('.'+_0x22a7fa),_0x18a28b=_0x54fd2e['querySelector'](_0x13de41);return _0x4347d4||_0x18a28b||_0x54fd2e;}return _0x54fd2e['querySelector'](_0x13de41)||_0x54fd2e;}['_calculateContainerWidth'](){const _0x40ae39=this['_parentView']?.['element']||this['_containerElement'];if(!_0x40ae39)return wr;const _0x5ec72e=window['getComputedStyle'](_0x40ae39)['width'];if('auto'===_0x5ec72e||'0px'===_0x5ec72e||!_0x5ec72e){const _0x366da0=_0x40ae39['parentElement'];if(_0x366da0){const _0x19e7e9=window['getComputedStyle'](_0x366da0);return'auto'!==_0x19e7e9['width']?_0x19e7e9['width']:wr;}return wr;}return _0x5ec72e;}['_applyCalculationStyles'](_0x30658e,_0x265c33){this['_config']['cssClasses']['calculationContainer']&&_0x30658e['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x30658e['style']['width']=_0x265c33,_0x30658e['style']['position']='absolute',_0x30658e['style']['top']='-9999px',_0x30658e['style']['left']='-9999px',_0x30658e['style']['opacity']='0',_0x30658e['style']['pointerEvents']='none',_0x30658e['style']['zIndex']='-1',_0x30658e['style']['visibility']='visible\x20!important',_0x30658e['style']['display']='block\x20!important',_0x30658e['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x4b749b){_0x4b749b['forEach'](({element:_0x299712,originalDisplay:_0x12b1fb,originalVisibility:_0x2dcf2d})=>{_0x299712['style']['display']=_0x12b1fb,_0x299712['style']['visibility']=_0x2dcf2d;});}['_makeAncestorsVisible'](_0x49b327){const _0x5bec8d=[];let _0xf0a062=_0x49b327;for(;_0xf0a062&&_0xf0a062!==document['body'];){const _0xc057f9=window['getComputedStyle'](_0xf0a062);'none'!==_0xc057f9['display']&&'hidden'!==_0xc057f9['visibility']||(_0x5bec8d['push']({'element':_0xf0a062,'originalDisplay':_0xf0a062['style']['display'],'originalVisibility':_0xf0a062['style']['visibility']}),_0xf0a062['style']['display']='block',_0xf0a062['style']['visibility']='visible'),_0xf0a062=_0xf0a062['parentElement'];}return _0x5bec8d;}['_createContainerElements'](){let _0x555526,_0x22c746;return this['_parentView']?.['element']?(_0x555526=this['_parentView']['element']['cloneNode'](!0x0),_0x22c746=this['_findTargetContainer'](_0x555526)):(_0x555526=document['createElement']('div'),_0x22c746=_0x555526),{'calculationContainer':_0x555526,'targetContainer':_0x22c746};}['_createCalculationContainer'](){const {calculationContainer:_0x5d6466,targetContainer:_0x9961c1}=this['_createContainerElements'](),_0x2d9fc1=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x5d6466,_0x2d9fc1);const _0x3f87dc=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0x3f87dc?_0x3f87dc['appendChild'](_0x5d6466):document['body']['appendChild'](_0x5d6466),_0x5d6466['_targetContainer']=_0x9961c1;const _0x42f975=this['_makeAncestorsVisible'](_0x3f87dc||null);return _0x5d6466['offsetWidth'],_0x5d6466['_ancestorsToRestore']=_0x42f975,_0x5d6466;}['_calculateOverflowInContainer'](_0xf676c7,_0x51490c){const _0x4a173d=_0xf676c7['_targetContainer']||_0xf676c7,_0x594ff6=[],{rowCount:_0x5be90b}=this['_renderChipsAndCountRows'](_0x4a173d,_0x51490c);if(_0x5be90b<=this['_config']['maxVisibleRows'])return _0x594ff6;const _0x115044=_0x51490c['slice']();for(;_0x115044['length']>0x0;){if(this['_testButtonFit'](_0xf676c7,_0x4a173d,_0x115044)){const _0x32c8bd=_0x51490c['filter'](_0x3178ba=>!_0x115044['includes'](_0x3178ba));_0x594ff6['push'](..._0x32c8bd);break;}if(!_0x115044['pop']())break;}return _0x594ff6;}['_renderChipsAndCountRows'](_0x54093a,_0x4232ff){_0x54093a['innerHTML']='',_0x4232ff['forEach'](_0x95610c=>{if(_0x95610c['element']){const _0x3a88cc=_0x95610c['element']['cloneNode'](!0x0);_0x54093a['appendChild'](_0x3a88cc);}}),_0x54093a['offsetWidth'];const _0xf3de19=_0x54093a['children'],_0x410fd7=[];return Array['from'](_0xf3de19)['forEach'](_0x349035=>{const _0x375831=_0x349035['getBoundingClientRect']()['top'];_0x410fd7['some'](_0x2e70e1=>Math['abs'](_0x2e70e1-_0x375831)<this['_config']['rowDetectionTolerance'])||_0x410fd7['push'](_0x375831);}),{'rowCount':_0x410fd7['length']};}['_createMockButton'](){const _0x58072f=document['createElement']('button');return _0x58072f['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x58072f['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x58072f['textContent']='+\x201',_0x58072f;}['_testButtonFit'](_0x60612e,_0x34e63d,_0x35d328){this['_renderChipsAndCountRows'](_0x34e63d,_0x35d328);const _0x31778a=this['_createMockButton']();_0x60612e['appendChild'](_0x31778a),_0x60612e['offsetWidth'];const _0x371848=[..._0x34e63d['children'],_0x31778a],_0x11fce9=[];_0x371848['forEach'](_0x1f14b6=>{const _0x15fc13=_0x1f14b6['getBoundingClientRect']()['top'];_0x11fce9['some'](_0x369000=>Math['abs'](_0x369000-_0x15fc13)<this['_config']['rowDetectionTolerance'])||_0x11fce9['push'](_0x15fc13);});const _0xd6c81c=_0x11fce9['length'];return _0x31778a['remove'](),_0xd6c81c<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x581923,_0xf4d51c){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x581923['forEach'](_0x458430=>{_0xf4d51c['includes'](_0x458430)?this['_overflowChips']['add'](_0x458430):this['_visibleChips']['add'](_0x458430);});}['_updateOverflowUI'](_0x1558e3){if(_0x1558e3>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x1558e3>0x0&&this['_showMoreButtonView']){const _0x597068=''+this['_config']['showMoreLabelPrefix']+(_0x1558e3<0x63?_0x1558e3:'99');this['_showMoreButtonView']['label']=_0x597068;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x367076,_0xeec443){this['_distributeChips'](_0x367076,_0xeec443),this['_updateOverflowUI'](_0xeec443['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x1df282=>{_0x1df282[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 _0x4a9b08=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x4a9b08['width']||0x0===_0x4a9b08['height'])return!0x1;const _0x11b6cd=window['innerHeight']||document['documentElement']['clientHeight'],_0x3b8252=window['innerWidth']||document['documentElement']['clientWidth'];return _0x4a9b08['bottom']>=-0xc8&&_0x4a9b08['top']<=_0x11b6cd+0xc8&&_0x4a9b08['right']>=-0xc8&&_0x4a9b08['left']<=_0x3b8252+0xc8;}};const fr='ck-ai-chat__feed__context-chips',br='ck-ai-chat-context-chips-wrapper',Sr='ck-ai-chat-context-chips-wrapper-balloon',Rr='ck-ai-chat-controls-button',Or='ck-ai-chat-controls_context_show-more-button',vr='ck-ai-chat-context-controls__show-more-balloon-panel';var kr=class extends _0x215f6f{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x14cdcb,_0x19f598,_0x291f3c){super(_0x14cdcb),this['_bodyCollection']=_0x291f3c,this['_createContextChips'](_0x19f598);const _0x4787fc={'cssClasses':{'showMoreButton':Or+'\x20'+hn,'showMoreBalloon':vr,'overflowContainer':Sr,'controlsButton':Rr}};this['_overflowManager']=new Cr(_0x14cdcb,this['_contextChips'],_0x4787fc,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[fr,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':br},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x3c1613=this['element']['querySelector']('.'+br);_0x3c1613&&(this['_overflowManager']['setContainerElement'](_0x3c1613),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x3dda8f){for(const _0x534f0a of _0x3dda8f){const _0x40825e=new mr(this['locale'],_0x534f0a,!0x0,!0x1);this['_contextChips']['add'](_0x40825e);}}},Nr=class extends Vn{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x49e063,_0x275552,_0x3d15f8){super(_0x275552),this['_locale']=_0x49e063,this['_bodyCollection']=_0x3d15f8,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 kr(this['_locale'],this['options']['contextItems']['filter'](_0x25aa01=>!_0x25aa01['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new _0x215f6f(this['_locale']),this['_messageContentView']['setTemplate']({'tag':'div','attributes':{'class':['ck-reset_all-excluded','ck-ai-chat__feed__message-content','ck-ai-chat-content']}}),this['children']['add'](this['_messageContentView']);}['render'](){super['render'](),this['_messageContentView']['element']['innerHTML']=this['options']['initialContent'],this['markAsDone']();}},yr=class extends Vn{['capabilities'];constructor(_0x2fd960,_0x12258b){super(_0x12258b);const {isWebSearchEnabled:_0x209a76,isReasoningEnabled:_0x4865f2}=_0x12258b['capabilities'],_0x3fca99=[];let _0x3b7d5d='';_0x209a76&&_0x4865f2?(_0x3b7d5d=us(_0x2fd960,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x3fca99['push'](xr(at)),_0x3fca99['push'](xr(_0x1c8883))):_0x209a76?(_0x3b7d5d=us(_0x2fd960,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x3fca99['push'](xr(at))):_0x4865f2&&(_0x3b7d5d=us(_0x2fd960,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x3fca99['push'](xr(_0x1c8883))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x3b7d5d?'':'ck-hidden']}});const _0x55b722=new _0x215f6f();_0x55b722['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x3fca99,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x3b7d5d]}]}),this['children']['add'](_0x55b722),this['capabilities']=_0x12258b['capabilities'];}};function xr(_0x95988){const _0x3695f0=new Yt();return _0x3695f0['content']=_0x95988,_0x3695f0;}const Lr=['wheel','touchstart','pointerdown','keydown'],Dr=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var Pr=class{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x22bb06){this['element']=_0x22bb06,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x11a659 of Lr){const _0x47a75e='keydown'!==_0x11a659;this['element']['addEventListener'](_0x11a659,this['_onUserEvent']['bind'](this),{'passive':_0x47a75e,'signal':this['abortController']['signal']});}}['start']({smooth:_0x3b560d=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x3b560d?'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'](_0x51a51a){if(this['isRunning']){if('keydown'===_0x51a51a['type']){const _0x9a1ffc=_0x51a51a['key'];if(!Dr['includes'](_0x9a1ffc))return;}_0x51a51a instanceof WheelEvent?_0x51a51a['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x18cc92,scrollHeight:_0x1e3786,clientHeight:_0x2a49aa}=this['element'];return _0x1e3786-_0x18cc92-_0x2a49aa<=0x5;}['_rafUpdate'](){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}},Hr=class extends Vn{constructor(_0xdb8596){super(_0xdb8596),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']);}},Mr=class extends _0x215f6f{['children'];['scrollManager'];['_bodyCollection'];constructor(_0x2d41d1,_0x5d1771){super(_0x2d41d1),this['_bodyCollection']=_0x5d1771,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...yn)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new Pr(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x2474e0,_0x349779){let _0x5b89fe;return'ai-reply'===_0x2474e0?_0x5b89fe=new hr(this['locale'],_0x349779,this['_bodyCollection']):'ai-suggestion-reply'===_0x2474e0?(_0x5b89fe=new ar(this['locale'],_0x349779,this['_bodyCollection']),_0x5b89fe['bind']('isTrackChangesOn')['to'](this)):_0x5b89fe='user-message'===_0x2474e0?new Nr(this['locale'],_0x349779,this['_bodyCollection']):'interaction-header'===_0x2474e0?new yr(this['locale'],_0x349779):'custom-element'===_0x2474e0?new Hr(_0x349779):new tr(_0x349779),this['children']['add'](_0x5b89fe),_0x5b89fe;}async['updateReplyItem']({id:_0x1baecb,parsedContent:_0x96eb9e,renderingStrategy:_0x38bcfa,abortSignal:_0x259581}){const _0x2fad84=this['getItemById'](_0x1baecb);if(!(_0x2fad84 instanceof hr))throw new ht('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x2fad84,'id':_0x1baecb,'parsedContent':_0x96eb9e});await _0x2fad84['updateContent']({'parsedContent':_0x96eb9e,'renderingStrategy':_0x38bcfa,'abortSignal':_0x259581});}async['updateWebSources'](_0x2aa047,_0x36a2aa){const _0x58a1da=this['getItemById'](_0x2aa047);if(_0x58a1da instanceof ar)_0x58a1da['updateSources'](_0x36a2aa);else{if(!(_0x58a1da instanceof hr))throw new ht('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x58a1da,'id':_0x2aa047,'sources':_0x36a2aa});_0x58a1da['updateSources'](_0x36a2aa);}}async['updateSuggestionItem']({id:_0x2a0644,parts:_0x50d002,abortSignal:_0x8759bb,skipLoadingEffects:_0x14d0bd}){const _0x2cce92=this['getItemById'](_0x2a0644);if(!(_0x2cce92 instanceof ar))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x2cce92,'id':_0x2a0644,'parts':_0x50d002});await _0x2cce92['updateContent']({'parts':_0x50d002,'abortSignal':_0x8759bb,'skipLoadingEffects':_0x14d0bd});}['updateSuggestionPartState']({id:_0x5297f4,index:_0x322b23,state:_0x21c106}){const _0x3d48d6=this['getItemById'](_0x5297f4);if(!(_0x3d48d6 instanceof ar))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x5297f4});_0x3d48d6['updatePartState'](_0x322b23,_0x21c106);}['setSuggestionPartActive']({id:_0x32b70c,index:_0x377996,isActive:_0x38ed0e}){const _0x13222f=this['getItemById'](_0x32b70c);if(!(_0x13222f instanceof ar))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x32b70c});this['children']['filter'](_0x28445d=>_0x28445d instanceof ar)['forEach'](_0x24cd73=>{_0x24cd73['setPartActive'](!0x1);}),_0x13222f['setPartActive'](_0x377996,_0x38ed0e);}['markItemAsDone'](_0x17c70a){this['getItemById'](_0x17c70a)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x48b3bd=>_0x48b3bd['options']['id']);}['removeItem'](_0xaf8084){this['children']['remove'](this['getItemById'](_0xaf8084));}['hasItem'](_0x594cad){return!!this['children']['find'](_0x323553=>_0x323553['options']['id']['includes'](_0x594cad));}['scrollToSuggestion'](_0x3d72e5,_0x56ebda){const _0x2e493e=this['getItemById'](_0x3d72e5);if(!(_0x2e493e instanceof ar))return void bt('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x3d72e5,'partIndex':_0x56ebda});const _0xeca349=_0x2e493e['getPartView'](_0x56ebda);_0xeca349?St(_0xeca349['element'],0x14,this['element']['parentElement'],!0x0,!0x0):bt('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x3d72e5,'partIndex':_0x56ebda});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x162706=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x162706,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0xd7a71d=new Xn(this['locale'],zn['aiFeed']);return _0xd7a71d['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0xd7a71d;}['_createFeedItems'](){const _0x50a862=new _0x215f6f(this['locale']);return _0x50a862['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x50a862;}['_createFeedLoader'](){const _0x170b11=new _0x215f6f(this['locale']);return _0x170b11['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x2c5bc2=>!_0x2c5bc2)]},'children':this['_createLoaderChildren']()}),_0x170b11;}['_createLoaderChildren'](){const _0x137801=new cr();return _0x137801['isVisible']=!0x0,[_0x137801,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x121f78){const _0x4e7ac=this['children']['find'](_0x1ec20b=>_0x1ec20b['options']['id']['includes'](_0x121f78));if(!_0x4e7ac)throw new ht('ai-chat-feed-view-item-not-found',this,{'id':_0x121f78});return _0x4e7ac;}['setLoadingMessage'](_0x5611ae){this['set']('loadingMessage',_0x5611ae);}['toggleLoadingSkeleton'](_0x3278e0){this['set']('isLoadingSkeletonVisible',_0x3278e0);}['startAutoScroll'](_0x1f7924={}){this['scrollManager']['start'](_0x1f7924);}['stopAutoScroll'](){this['scrollManager']['stop']();}},Vr=class extends jt{['filter'](){let _0x590c3f=0x0;for(const _0x3d4dec of this['items'])_0x590c3f+=_0x3d4dec['items']['length'];return{'resultsCount':_0x590c3f,'totalItemsCount':_0x590c3f};}};function Ur(_0x1c0c06){const _0x40fab3=[];let _0x29edf3=!0x1;for(const _0x168d77 of Array['from'](_0x1c0c06['items'])){if('file'!==_0x168d77['kind'])continue;if(_0x168d77['webkitGetAsEntry']()?.['isDirectory']){_0x29edf3=!0x0;continue;}const _0x3550fd=_0x168d77['getAsFile']();_0x3550fd&&_0x40fab3['push'](_0x3550fd);}return{'files':_0x40fab3,'hasDirectory':_0x29edf3};}const Br='ck-ai-chat__prompt-input_highlighted';var Gr=class AIChatPromptInputView extends Nt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x594a8b,_0x1d0c2a){super(_0x594a8b,{'queryView':{'label':'','creator':_0x30e284,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new Vr(_0x594a8b),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x1d0c2a,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',(_0x2f7902,_0x38d1e3)=>!_0x2f7902&&!_0x38d1e3),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x354fd7,_0x25505e)=>{this['isUploadInProgress']||this['isEmpty']||_0x354fd7['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x25505e());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x399204=>this['_handlePaste'](_0x399204)),this['element']['addEventListener']('drop',_0x5861a3=>this['_handleDrop'](_0x5861a3));}['_handlePaste'](_0x1d1742){const _0x16941e=_0x1d1742['clipboardData'];if(!_0x16941e)return;const {files:_0x32bf56,hasDirectory:_0xd2a28c}=Ur(_0x16941e),_0x162675={'files':_0x32bf56,'plainText':_0x16941e['getData']('text/plain'),'hasDirectory':_0xd2a28c,'forceTextAttachment':!0x1,'preventDefault':()=>_0x1d1742['preventDefault']()};this['fire']('promptInputPaste',_0x162675);}['_handleDrop'](_0x2dbfb8){const _0x3be5f3=_0x2dbfb8['dataTransfer'];if(!_0x3be5f3)return;const _0x5ba208={'files':[],'plainText':_0x3be5f3['getData']('text/uri-list')||_0x3be5f3['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x2dbfb8['preventDefault']()};this['fire']('promptInputPaste',_0x5ba208);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0xb2aff6=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0xb2aff6)return this['queryView']['errorText']=us(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x4bb3ea=_0x33f243(_0xb2aff6);this['fire']('sendUserMessage',_0x4bb3ea),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x2a4b78){this['queryView']['fieldView']['set']('placeholder',_0x2a4b78);}['focus'](_0x668ea5=!0x1){super['focus'](),_0x668ea5&&(this['element']['classList']['contains'](Br)||(this['element']['classList']['add'](Br),setTimeout(()=>{this['element']['classList']['remove'](Br);},0x320)));}['_createSubmitButton'](){const _0x40bbd0=new Ht(this['locale']);return _0x40bbd0['set']({'icon':st,'label':us(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+on,'isEnabled':!0x1}),_0x40bbd0['on']('execute',()=>{this['submit']();}),_0x40bbd0;}['setIsUploadInProgress'](_0x4410f3){this['isUploadInProgress']=_0x4410f3;}['_setUpAddContextButtonPositioning'](){const _0x42cb7c=this['locale'],_0x1daa9f=()=>{Tt['window']['requestAnimationFrame'](()=>{if(Ct(this['element'])){const _0x4215b4=new At(this['queryView']['fieldView']['element']),_0x57eb47=new At(this['_addContextButtonView']['element']),_0x287fba=_0x4215b4['width'],_0xaa3cab='rtl'===_0x42cb7c['uiLanguageDirection']?'right':'left';_0x4215b4['excludeScrollbarsAndBorders']();const _0x25da01=_0x287fba-_0x4215b4['width']+0x1;this['_addContextButtonView']['element']['style'][_0xaa3cab]='calc('+(_0x287fba-_0x57eb47['width']-_0x25da01)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x1daa9f),this['on']('render',()=>{_0x1daa9f(),this['_queryViewResizeObserver']=new It(this['queryView']['fieldView']['element'],()=>{_0x1daa9f();});});}},Fr=class extends _0x215f6f{constructor(_0x38c245){super(_0x38c245);const _0x4dc307=new Yt();_0x4dc307['content']=_0x43190a,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x4dc307,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':us(_0x38c245,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0x60af86){let _0xf3c5e7=0x0;_0x60af86['addEventListener']('dragenter',_0x211221=>{_0x211221['dataTransfer']&&(_0xf3c5e7++,0x1===_0xf3c5e7&&this['fire']('dragEnter'),_0x60af86['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0x60af86['addEventListener']('dragover',_0x38d668=>{_0x38d668['dataTransfer']&&_0x38d668['preventDefault']();}),_0x60af86['addEventListener']('dragleave',()=>{--_0xf3c5e7<=0x0&&(_0xf3c5e7=0x0,_0x60af86['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0x60af86['addEventListener']('drop',_0x5084c3=>{_0x5084c3['preventDefault'](),_0xf3c5e7=0x0,_0x60af86['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0x5084c3);});}['_handleDrop'](_0x2e44b6){const _0x29af66=_0x2e44b6['dataTransfer'];if(!_0x29af66)return;const {files:_0x524a54,hasDirectory:_0x53106a}=Ur(_0x29af66),_0x17c04d={'files':_0x524a54,'plainText':_0x29af66['getData']('text/uri-list')||_0x29af66['getData']('text/plain'),'hasDirectory':_0x53106a,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x17c04d);}};const Kr='ck-ai-chat__prompt-capabilities',Wr='ck-ai-chat-controls-button',Yr='ck-ai-chat-controls-button--commands',$r='ck-ai-chat-controls__model-selection',qr='ck-ai-chat-controls__model-selection__item-name',Qr='ck-ai-chat-controls__model-selection__item-description',Xr='ck-ai-chat-controls__model-selection__item-capabilities',zr='n';var jr=class extends _0x215f6f{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x1f97e0){super(_0x1f97e0),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',_0x50b645=>'selector'===_0x50b645),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x3719d4=>_0x3719d4?this['_modelSelectionDropdown']['buttonView']['label']:us(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x166193=>_0x166193),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x2b4831=>_0x2b4831),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x3be5bd=>us(this['locale'],_0x3be5bd?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x22fc12=>_0x22fc12),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x175de2=>us(this['locale'],_0x175de2?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[Kr]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new ct(),_0x1d523e(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x5ed1bb,_0xff902){if(_0xff902)this['set']('modelDisplayMode','hidden');else{const _0x303d2b=0x1===_0x5ed1bb['length'];this['set']('modelDisplayMode',_0x303d2b?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x5ed1bb?.['length'])for(const _0x2bc90c of _0x5ed1bb){const _0x169293=new _0x24dcce({'label':_0x2bc90c['name'],'withText':!0x0,'role':'menuitemradio','id':_0x2bc90c['id'],'model':_0x2bc90c});_0x169293['bind']('isOn')['to'](this,'activeModelId',_0x3b1ba4=>_0x3b1ba4===_0x2bc90c['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x169293,'labelView':new Jr(this['locale'],_0x2bc90c)});}}['setWebSearch'](_0xb8643e){this['set']('webSearchActive',_0xb8643e);}['setReasoning'](_0x38e273){this['set']('reasoningActive',_0x38e273);}['setModel'](_0x19be92){if(!_0x19be92)return;this['activeModelId']=_0x19be92['id'],this['activeModelName']=_0x19be92['name']||_0x19be92['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x19be92['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x19be92['name']);const _0x147bc1=_0x19be92['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x147bc1),this['_webSearchButton']['set']('isVisible',_0x147bc1);const _0x3f698f=_0x19be92['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x3f698f),this['_reasoningButton']['set']('isVisible',_0x3f698f);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x24d3b0){this['set']('modelSelectorEnabled',!0x1),_0x24d3b0&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x2255b1=new Ht();return _0x2255b1['set']({'label':us(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':at,'class':Wr+'\x20'+hn,'isToggleable':!0x0,'tooltipPosition':zr}),_0x2255b1['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x2255b1;}['_createReasoningButton'](){const _0x1d4951=new Ht();return _0x1d4951['set']({'label':us(this['locale'],'AI_CHAT_REASONING'),'icon':_0x1c8883,'class':Wr+'\x20'+hn,'isToggleable':!0x0,'tooltipPosition':zr}),_0x1d4951['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x1d4951;}['_createCommandsButton'](){const _0x4ee295=new Ht();return _0x4ee295['set']({'label':us(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x170240,'withText':!0x0,'class':Wr+'\x20'+hn,'isToggleable':!0x0,'tooltip':us(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':zr}),_0x4ee295['extendTemplate']({'attributes':{'class':[Yr]}}),_0x4ee295['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x4ee295;}['_createModelSelectionDropdown'](){const _0x39158d=_0x32dc43(this['locale']);return _0x39158d['set']({'panelPosition':'ne','class':[$r]}),_0x39158d['buttonView']['set']({'label':us(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':zr,'class':hn}),this['listenTo'](_0x39158d,'execute',_0x4e72db=>{this['fire']('selectModel',_0x4e72db['source']['model']);}),_0x39158d;}['_createModelNameView'](){const _0x1265f3=new Zr(this['locale']);return _0x1265f3['bind']('text')['to'](this,'activeModelName',_0x5d558d=>_0x5d558d??''),_0x1265f3['bind']('isVisible')['to'](this,'modelDisplayMode',_0xd35861=>'name'===_0xd35861),_0x1265f3;}},Jr=class extends Dt{constructor(_0x3f3ee3,_0x3f5a4d){super();const _0x435851=this['bindTemplate'],_0xe6c49f=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x435851['to']('style'),'id':_0x435851['to']('id')},'children':[{'tag':'div','attributes':{'class':[qr]},'children':[{'text':_0x435851['to']('text')}]},{'tag':'div','attributes':{'class':[Qr]},'children':[{'tag':'span','children':[{'text':_0x3f5a4d['description']}]}]},{'tag':'div','attributes':{'class':[Xr]},'children':_0xe6c49f}]}),_0xe6c49f['addMany'](this['_getCapabilityParts'](_0x3f3ee3,at,'AI_CHAT_SEARCH_WEB',_0x3f5a4d['capabilities']['webSearch']?.['enabled']??!0x1)),_0xe6c49f['addMany'](this['_getCapabilityParts'](_0x3f3ee3,_0x1c8883,'AI_CHAT_REASONING',_0x3f5a4d['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x3744a0,_0x419365,_0x579418,_0x4a71a2){const _0x20edfc=new Yt();_0x20edfc['content']=_0x419365;const _0x59c17f=new _0x215f6f(_0x3744a0);_0x59c17f['setTemplate']({'tag':'span','children':[{'text':us(_0x3744a0,_0x579418)+':\x20'}]});const _0x222f31=new _0x215f6f(_0x3744a0);return _0x222f31['setTemplate']({'tag':'span','children':[{'text':us(_0x3744a0,_0x4a71a2?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x20edfc,_0x59c17f,_0x222f31];}},Zr=class extends _0x215f6f{constructor(_0x456158){super(_0x456158),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x110750=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x110750['if']('isVisible','ck-hidden',_0x54b7e9=>!_0x54b7e9)]},'children':[{'text':_0x110750['to']('text')}]});}};const to='ck-ai-chat-context-controls__url-form',eo='ck-ai-chat-context-controls__url-input-section';var io=class extends _0x215f6f{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x469303){super(_0x469303),this['focusTracker']=new dt(),this['keystrokes']=new _t(),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 Gt({'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'](_0xd36b0e=>{this['focusTracker']['add'](_0xd36b0e['element']),this['keystrokes']['listenTo'](_0xd36b0e['element']);}),_0x1dbba7({'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'](_0x340dee){this['urlInputField']['errorText']=_0x340dee,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x384ffa=new Ht(this['locale']);return _0x384ffa['set']({'icon':_0x1901d7,'tooltip':us(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x5a294b,_0x3dc48a,_0x16935e)=>{_0x384ffa['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x16935e?'':'\x20ck-hidden')]});}),_0x384ffa;}['_createUrlInputField'](){const _0x129cca=new qt(this['locale'],_0x4fc470);return _0x129cca['set']({'label':us(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x129cca['fieldView']['set']({'placeholder':us(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x129cca;}['_createConfirmButton'](){const _0x3a4644=new Ht(this['locale']);return _0x3a4644['set']({'icon':_0x27c014,'tooltip':us(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x3a4644;}['_setupTemplate'](){const _0x6f154a=new Ft(this['locale'],{'label':us(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x6f154a['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':to,'tabindex':'-1'},'children':[_0x6f154a,{'tag':'div','attributes':{'class':eo},'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',_0x2360e4=>{_0x2360e4['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x62e6a6,_0x7b5ab1)=>{this['clear'](),this['fire']('cancel'),_0x7b5ab1();});}['_handleSubmit'](){const _0x116a18=this['getValue']()['trim']();_0x116a18?this['_isValidUrl'](_0x116a18)?(this['clearError'](),this['fire']('submitUrl',_0x116a18)):this['setError'](us(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](us(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x53d6d7=this['getValue']()['trim'](),_0x2d82c5=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x53d6d7['length']>0x0&&!_0x2d82c5;}['_isValidUrl'](_0x217a63){try{return!!new URL(_0x217a63);}catch{return!0x1;}}};const so='ck-ai-chat-resources__item',no='ck-ai-chat-resources__item--in-context',ro='ck-ai-chat-resources__item-title',oo='ck-ai-chat-resources__item__icon';var ao=class extends zt{['resource'];['_titleView'];['_iconView'];constructor(_0x5667c6,_0x55b811){super(_0x5667c6),this['resource']=_0x55b811,this['set']('isInContext',!!_0x55b811['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x280d45){if(_0x280d45['isInContext'])return _0x27c014;switch(_0x280d45['type']){case'document':return _0x97af05;case'web-resource':return _0x2906fb;case'file':case'text':return _0x43190a;default:return _0x31a9ab;}}['highlightText'](_0x2758fd){if(!_0x2758fd||''===_0x2758fd['trim']())return void this['_titleView']['highlightText'](null);const _0x56129c=new RegExp(_0x49ade4(_0x2758fd),'gi');this['_titleView']['highlightText'](_0x56129c);}['updateResourceState'](_0x39f93d){this['resource']['isInContext']=_0x39f93d,this['isInContext']=_0x39f93d,this['_updateIcon']();}['_createTitleView'](){const _0x3f4f1d=new Wt();return _0x3f4f1d['text']=this['resource']['label'],_0x3f4f1d['extendTemplate']({'tag':'span','attributes':{'class':[ro]}}),_0x3f4f1d;}['_createIconView'](){const _0x12c7a3=new Yt();return _0x12c7a3['content']=this['getResourceIcon'](this['resource']),_0x12c7a3;}['_setupTemplate'](){const _0x1a8257=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[so,_0x1a8257['if']('isVisible','ck-hidden',_0x8e99bb=>!_0x8e99bb),_0x1a8257['if']('isInContext',no)]},'children':[{'tag':'div','attributes':{'class':[oo]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x1a8257['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const ho='ck-ai-chat-resources__list';var co=class extends jt{['_source'];constructor(_0x53a9e8,_0x4179ce){super(_0x53a9e8),this['_source']=_0x4179ce,this['extendTemplate']({'attributes':{'class':[ho]}});}['setResources'](_0x5ab803,_0x4ba506){this['items']['clear']();let _0x28dc0f=_0x5ab803;if(this['_source']['useDefaultFiltering']&&_0x4ba506&&''!==_0x4ba506['trim']()){const _0x582e2e=new RegExp(_0x4ba506['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x28dc0f=_0x5ab803['filter'](_0x4bcd1d=>_0x582e2e['test'](_0x4bcd1d['label']));}for(const _0x2fb80a of _0x28dc0f){const _0x317df5=new ao(this['locale'],_0x2fb80a);_0x317df5['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x2fb80a);}),this['items']['add'](_0x317df5);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x4ba506);}['highlightText'](_0x3c00b0){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x573268=>{_0x573268['highlightText'](_0x3c00b0);});}['updateResourceState'](_0x50571c,_0xaaae0a){for(const _0x15d791 of this['items']){const _0x3cabd8=_0x15d791;_0x3cabd8['resource']['id']===_0x50571c&&_0x3cabd8['updateResourceState'](_0xaaae0a);}}['_handleResourceSelection'](_0x3019f3,_0x292c57){this['fire']('addResourceToContext',{'source':_0x3019f3,'resource':_0x292c57});}},lo=class extends qt{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x24375d){const t=_0x24375d['t'],_0x232942={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x4fc470,'label':us(_0x24375d,'AI_CHAT_SEARCH_RESOURCES')};super(_0x24375d,_0x232942['creator']),this['label']=_0x232942['label'],this['_viewConfig']=_0x232942,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x24375d,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x4f7009){this['fire']('search',_0x4f7009);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Yt(),this['iconView']['content']=_0x11ac1a,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x2575d4,t){this['resetButtonView']=new Ht(_0x2575d4),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x27af74,'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',_0x16e6d2=>!_0x16e6d2),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);}},uo=class extends _0x215f6f{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0x2cbc93,_0x4ca663){super(_0x2cbc93),this['_source']=_0x4ca663['source'],this['_searchInputVisibleFrom']=_0x4ca663['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 _0x498844([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}['_createSearchView'](){return new lo(this['locale']);}['_createSearchSection'](){const _0x315720=new _0x215f6f(this['locale']);return _0x315720['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x634735,_0x135eaa)=>{this['loadResources'](_0x135eaa),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x135eaa);}),_0x315720;}['_createResourcesListView'](){const _0x31799d=new co(this['locale'],this['_source']);return _0x31799d['delegate']('addResourceToContext')['to'](this),_0x31799d['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x31799d;}['_createSkeletonView'](){const _0x3f6e3a=new Xn(this['locale'],zn['aiChatResources']);return _0x3f6e3a['bind']('isVisible')['to'](this,'isLoading'),_0x3f6e3a;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x46ae5c){const _0x48a96c=vt();this['_latestLoadResourcesUid']=_0x48a96c,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x46ae5c,'uid':_0x48a96c}),this['isLoading']=!0x0;}['setResources'](_0x5ecf94,_0x1c83f2){if(_0x1c83f2&&_0x1c83f2!==this['_latestLoadResourcesUid'])return;const _0x1f819e=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x5ecf94,_0x1f819e),_0x5ecf94['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x15c216,_0x1dc813){this['_resourcesListView']['updateResourceState'](_0x15c216,_0x1dc813);}};const _o='ck-ai-chat-context-controls__source-balloon-panel',go='ck-button-icon\x20ck-button-back',Ao='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';var Io=class{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x146415,_0x3ed044,_0x24252b){this['_locale']=_0x146415,this['_bodyCollection']=_0x3ed044,this['_config']=_0x24252b;}['showSourceResourcesBalloon']({source:_0x39ebca,withBackButton:_0x3873a3}){let _0x574c64=this['_sourceResourceBalloons']['get'](_0x39ebca['id']);_0x574c64||(_0x574c64=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x39ebca['id'],_0x574c64),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x574c64)),this['_addSourceResourceContent']({'balloonPanel':_0x574c64,'source':_0x39ebca,'withBackButton':_0x3873a3}),_0x574c64['show']();const _0x55c108=this['_config']['getTargetElement']();_0x55c108&&_0x574c64['pin']({'target':_0x55c108,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x16b2de,_0x3a1337,_0x117807){const _0x2ec053=this['_sourceResourceBalloons']['get'](_0x16b2de);if(!_0x2ec053)return;const _0x19b56c=this['_getResourcesViewFromBalloon'](_0x2ec053);_0x19b56c&&(_0x19b56c['setResources'](_0x3a1337,_0x117807),_0x19b56c['once']('change:isLoading',()=>{_0x2ec053['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x55e021){const _0x2a215b=this['_sourceResourceBalloons']['get'](_0x55e021);_0x2a215b&&requestAnimationFrame(()=>{_0x2a215b['hide'](),this['_sourceResourceBalloons']['delete'](_0x55e021),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x47e944 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x47e944);}['isAnyResourceBalloonVisible'](){for(const _0x5125f5 of this['_sourceResourceBalloons']['values']())if(_0x5125f5['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x4ac40b,_0x3aab5c,_0x1271a){const _0x3c94b8=this['_sourceResourceBalloons']['get'](_0x4ac40b);if(!_0x3c94b8||!_0x3c94b8['isVisible'])return;const _0x158cd6=this['_config']['getTargetElement']();if(!_0x158cd6)return;_0x3c94b8['pin']({'target':_0x158cd6,'limiter':this['_config']['getLimiterElement']()});const _0xb8c922=this['_getResourcesViewFromBalloon'](_0x3c94b8);_0xb8c922&&_0xb8c922['updateResourceState'](_0x3aab5c,_0x1271a);}['destroy'](){for(const _0x5e3b99 of this['_sourceResourceBalloons']['values']())_0x5e3b99['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x2836c0=new yt(this['_locale']);return _0x2836c0['extendTemplate']({'attributes':{'class':_o}}),this['_bodyCollection']['add'](_0x2836c0),_0x2836c0;}['_addSourceResourceContent']({balloonPanel:_0x5bdca6,source:_0x317347,withBackButton:_0x1d4548}){_0x5bdca6['content']['clear']();const _0x2b2916=this['_createBalloonHeader']({'balloonPanel':_0x5bdca6,'source':_0x317347,'withBackButton':_0x1d4548});_0x5bdca6['content']['add'](_0x2b2916);const _0x10c6a5=this['_createBalloonResourcesView'](_0x317347);_0x5bdca6['content']['add'](_0x10c6a5);}['_createBalloonHeader']({balloonPanel:_0x418c75,source:_0x63c63,withBackButton:_0x51f0b4}){const _0x4fba98=new Ft(this['_locale'],{'label':_0x63c63['label'],'class':Ao});return _0x51f0b4&&_0x4fba98['children']['add'](this['_createBackButton'](_0x418c75),0x0),_0x4fba98;}['_createBackButton'](_0xefc740){const _0x1a3cd6=new Ht(this['_locale']);return _0x1a3cd6['set']({'icon':_0x1901d7,'tooltip':us(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':go}),_0x1a3cd6['on']('execute',()=>{_0xefc740['hide'](),this['_config']['onBackToContext']();}),_0x1a3cd6;}['_createBalloonResourcesView'](_0x53f925){const _0x1bb096=new uo(this['_locale'],{'source':_0x53f925,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x1bb096['on']('loadSourceResources',(_0x4a4390,_0x2a22ef)=>{this['_config']['onLoadSourceResources'](_0x2a22ef);}),_0x1bb096['on']('addResourceToContext',(_0x463992,_0x277ff4)=>{this['_config']['onResourceSelected'](_0x277ff4['source'],_0x277ff4['resource']),this['closeSourceResourceBalloon'](_0x53f925['id']);}),_0x1bb096;}['_getResourcesViewFromBalloon'](_0x224a05){const _0x5d5384=_0x224a05['content']['get'](0x1);return _0x5d5384 instanceof uo?_0x5d5384:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x38464f){_0x191c5a({'emitter':_0x38464f,'contextElements':[_0x38464f['element']],'callback':()=>{_0x38464f['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x38464f['isVisible']});}};const po=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],mo='ck-ai-chat-context-controls',Eo='ck-ai-chat-context-controls__pending-contexts',To='ck-ai-chat-context-controls__add-context-balloon-panel',wo='ck-ai-chat-context-controls__add-context-button',Co='ck-ai-chat-context-controls__url-balloon-panel',fo='ck-ai-chat-context-controls__balloon-button',bo='ck-ai-chat-context-controls__balloon-button-source',So='ck-ai-chat-controls-button',Ro='ck-ai-chat-context-chips-wrapper-balloon',Oo='ck-ai-chat-controls_context_show-more-button',vo='ck-ai-chat-context-controls__show-more-balloon-panel',ko='ck-ai-chat',No=[yt['defaultPositions']['northArrowSouthWest'],yt['defaultPositions']['northArrowSouth'],yt['defaultPositions']['northArrowSouthEast'],yt['defaultPositions']['southArrowNorthWest'],yt['defaultPositions']['southArrowNorth'],yt['defaultPositions']['southArrowNorthEast']];var yo=class extends _0x215f6f{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x422018,_0x3a0afe){super(_0x422018),this['bodyCollection']=_0x3a0afe['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x422018),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x422018),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x422018),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x422018,_0x3a0afe);const _0x5c0c94={'cssClasses':{'showMoreButton':Oo+'\x20'+hn,'showMoreBalloon':vo,'overflowContainer':Ro,'controlsButton':So}};this['_overflowManager']=new Cr(_0x422018,this['_currentContextsChips'],_0x5c0c94,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'](_0x45e8d2,_0x25d80e){const _0x18df6c=this['_createContextButton'](_0x45e8d2,'current',!0x0,_0x25d80e);this['_addContextToCollection'](_0x18df6c,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x16c978){this['_removeContextFromCollection'](_0x16c978,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x16c978,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x3c2c62,_0x36e0a8){let _0x409fdc=this['_currentContextsChips']['find'](_0x292540=>_0x292540['id']===_0x3c2c62);_0x409fdc||(_0x409fdc=this['_overflowManager']['overflowChips']['find'](_0x2958a1=>_0x2958a1['id']===_0x3c2c62)),_0x409fdc&&(_0x409fdc['isLoading']=_0x36e0a8);}['setConversationContext'](_0x5f3816){this['_conversationContextsChips']['clear']();for(const _0x200b5c of _0x5f3816){const _0x4e3de2=this['_createContextButton'](_0x200b5c,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x4e3de2,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x38e177,_0x141bea,_0x139d9b){this['_resourcesBalloonView']['updateResourceState'](_0x38e177,_0x141bea,_0x139d9b);}['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;}['hideAllBalloons'](){this['hideAddContextBalloonPanel'](),this['hideUrlBalloonPanel'](),this['_resourcesBalloonView']['closeAll']();}['_showSourceResourcesBalloon']({source:_0x11d960,withBackButton:_0xe11b88}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x11d960,'withBackButton':_0xe11b88}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x5147cf,_0x49ab17,_0x1fcce5,_0x14e4c2){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x5147cf,_0x1fcce5,_0x14e4c2);}['closeSourceResourceBalloon'](_0x26f55b){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x26f55b),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x33e6d1){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x33e6d1),this['_setAddContextButtonEnabled'](_0x33e6d1);}['_setAddContextButtonEnabled'](_0x54a9e9){const _0x286edf=!_0x54a9e9['document']['isHidden']&&_0x54a9e9['document']['enabled'],_0x298b6d=_0x54a9e9['urls']['enabled'],_0x3a8f74=_0x54a9e9['files']['enabled'],_0x199072=_0x54a9e9['sources']['length']>0x0,_0x5dfbf3=_0x54a9e9['customItems']&&_0x54a9e9['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x286edf||_0x298b6d||_0x3a8f74||_0x199072||_0x5dfbf3;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[mo,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':Eo},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x2b0588){const _0x4aa3ca=new Ht(_0x2b0588);return _0x4aa3ca['set']({'label':us(_0x2b0588,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':So+'\x20'+wo+'\x20'+hn,'icon':_0x14f9ee,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x4aa3ca;}['_createAddContextBalloonPanelView'](_0x59d288){return this['_createBaseBalloonPanel'](_0x59d288,To);}['_createUrlBalloonPanelView'](_0x29a25c){const _0x310ad1=this['_createBaseBalloonPanel'](_0x29a25c,Co);return this['_addUrlContent'](_0x310ad1,_0x29a25c),_0x310ad1;}['_createResourcesBalloonView'](_0x1f7f6e,_0x404daa){const _0xd582aa={'searchInputVisibleFrom':_0x404daa['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No});},'onResourceSelected':(_0x482c77,_0x248196)=>{this['fire']('addResourceToContext',{'source':_0x482c77,'resource':_0x248196});},'onLoadSourceResources':_0xc316c1=>{this['fire']('loadSourceResources',_0xc316c1);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new Io(_0x1f7f6e,_0x404daa['bodyCollection'],_0xd582aa);}['_getLimiterElement'](){return this['element']?.['closest']('.'+ko)||document['body'];}['_createBaseBalloonPanel'](_0x4caf57,_0x37ce68){const _0x55b8d9=new yt(_0x4caf57);return _0x55b8d9['extendTemplate']({'attributes':{'class':_0x37ce68}}),this['bodyCollection']['add'](_0x55b8d9),_0x55b8d9;}['_setBalloonPanelContent'](_0x5082b4,_0x17bdc6,_0x48faa5){if(_0x5082b4['content']['clear'](),!_0x48faa5['document']['isHidden']&&_0x48faa5['document']['enabled']){const _0x5e52bf=this['_createBalloonButton'](_0x17bdc6,{'label':us(_0x17bdc6,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x97af05});_0x5e52bf['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x5082b4['content']['add'](_0x5e52bf);}if(_0x48faa5['urls']['enabled']){const _0x5a4607=this['_createBalloonButton'](_0x17bdc6,{'label':us(_0x17bdc6,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x2906fb});_0x5a4607['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}),this['_urlInputView']['focus']();}),_0x5082b4['content']['add'](_0x5a4607);}if(_0x48faa5['files']['enabled']){const _0x519656=new Bt(_0x17bdc6);_0x519656['set']({'label':us(_0x17bdc6,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x50cb94,'withText':!0x0,'tooltip':!0x0,'class':fo,'allowMultipleFiles':!0x0}),_0x519656['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x519656['on']('done',(_0xdfc5c,_0x1bd76f)=>{this['fire']('addFileToContext',_0x1bd76f);}),_0x519656['tooltip']=!0x0,_0x5082b4['content']['add'](_0x519656);}for(const _0x53ed05 of _0x48faa5['sources']){const _0x3c2b07=this['_createBalloonButton'](_0x17bdc6,{'label':_0x53ed05['label'],'icon':_0x53ed05['icon']||_0x31a9ab,'type':'source'});_0x5082b4['content']['add'](_0x3c2b07),_0x3c2b07['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x53ed05,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x200440 of _0x48faa5['customItems']||[]){const _0x58c3c5=this['_createBalloonButton'](_0x17bdc6,{'label':_0x200440['label'],'icon':_0x200440['icon']||_0x31a9ab,'type':'customItem'});_0x5082b4['content']['add'](_0x58c3c5),_0x58c3c5['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x200440);});}this['_hasExactlyOneSource']=0x1===_0x5082b4['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x349630,_0x22bacb){this['_urlInputView']=new io(_0x22bacb),this['_urlInputView']['on']('submitUrl',(_0x5c84a4,_0x597c98)=>{this['_handleUrlSubmit'](_0x597c98);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No});}),_0x349630['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x13ef88,_0x3f80eb){const _0x30021d='source'===_0x3f80eb['type']?new xo(_0x13ef88):new Ht(_0x13ef88);return _0x30021d['set']({'label':_0x3f80eb['label'],'icon':_0x3f80eb['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':fo}),_0x30021d;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){_0x191c5a({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0xf48167){const _0x57e7f9=this['_addContextBalloonConfig'];_0x57e7f9['buttonView']['isOn']=_0xf48167,_0xf48167?_0x57e7f9['balloonView']['show']():_0x57e7f9['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x1d93a7,buttonView:_0x48bb98,hideMethod:_0x2ac746}=this['_addContextBalloonConfig'];_0x191c5a({'emitter':_0x1d93a7,'contextElements':[_0x1d93a7['element'],_0x48bb98['element']],'callback':()=>{_0x2ac746();},'activator':()=>_0x48bb98['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x10d8f4,_0x59dda9,_0x57239d=!0x1,_0x7acb90=!0x1){const _0x3af9af='conversation'===_0x59dda9||!0x0===_0x10d8f4['isReadOnly'],_0x114df6=new mr(this['locale'],_0x10d8f4,_0x3af9af,_0x57239d,_0x7acb90);return _0x3af9af||_0x114df6['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x114df6['id']);}),_0x114df6;}['_addContextToCollection'](_0x44c3b3,_0x401ea6){_0x401ea6['add'](_0x44c3b3,0x0);}['_removeContextFromCollection'](_0x435976,_0x1817eb){const _0x82e7c9=_0x1817eb['find'](_0x2e2534=>_0x2e2534['id']===_0x435976);_0x82e7c9&&_0x1817eb['remove'](_0x82e7c9);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x17df39){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x17df39);}},xo=class extends Ht{['arrowView'];constructor(_0x147e51){super(_0x147e51),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[bo]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x4a72e7=new Yt();return _0x4a72e7['content']=_0x20cf00,_0x4a72e7['extendTemplate']({'attributes':{'class':bo+'__arrow'}}),_0x4a72e7;}},Lo=class extends _0x215f6f{['_cancelButtonView'];['_loaderView'];constructor(_0x51143a){super(_0x51143a),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 _0x4f7587=new Ht(this['locale']);return _0x4f7587['set']({'label':us(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':an+'\x20ck-ai-button-stop-generating','icon':it}),_0x4f7587['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x4f7587;}['_createLoaderView'](){const _0x461488=new _0x215f6f(this['locale']);return _0x461488['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':us(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x461488;}},Do=class extends _0x215f6f{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0x5d4be6,_0x31ad43){super(_0x5d4be6),this['_filesEnabled']=_0x31ad43['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x5d4be6,{'bodyCollection':_0x31ad43['bodyCollection'],'searchInputVisibleFrom':_0x31ad43['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x5d4be6),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x5d4be6),this['_loaderView']=this['_createLoaderView'](_0x5d4be6),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x5d4be6),this['_dropZoneView']=new Fr(_0x5d4be6),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage','promptInputPaste')['to'](this),this['_dropZoneView']['delegate']('promptInputPaste')['to'](this),this['_dropZoneView']['on']('dragEnter',()=>this['_contextPanelView']['hideAllBalloons']()),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'](...po)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x554f8f=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x554f8f['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x554f8f['if']('isLoading','ck-hidden',_0x4a6e9d=>_0x4a6e9d||!this['isModelAvailable']),_0x554f8f['if']('isModelAvailable','ck-hidden',_0x177a89=>!_0x177a89||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x554f8f['if']('isLoading','ck-hidden',_0x4cd253=>!_0x4cd253)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x554f8f['if']('isModelAvailable','ck-hidden',_0x34fdfb=>_0x34fdfb)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0x191c5a({'emitter':this['_promptInputView'],'activator':()=>this['isLoading'],'contextElements':()=>[this['element']],'callback':()=>{this['_shouldRestorePromptInputFocus']=!0x1;}}),this['on']('change:isLoading',this['_handlePromptInputFocus'],{'priority':'low'});}['render'](){super['render'](),this['_filesEnabled']&&this['_dropZoneView']['attach'](this['element']);}['_createContextPanelView'](_0x6cb4,_0x2fc196){return new yo(_0x6cb4,_0x2fc196);}['_createPromptInputView'](_0x9c1d5e){return new Gr(_0x9c1d5e,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x56cda3){return new jr(_0x56cda3);}['_createLoaderView'](_0x1da2cb){return new Lo(_0x1da2cb);}['_createModelUnavailableMessageView'](_0x4aa28d){const _0x16ab6c=new Po(_0x4aa28d);return _0x16ab6c['delegate']('startConversation')['to'](this),_0x16ab6c;}['_handlePromptInputFocus'](_0x350663,_0x7bbe,_0x5e4daa){_0x5e4daa?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x1d05f1,_0x3b68eb){this['_contextPanelView']['addContextItem'](_0x1d05f1,_0x3b68eb);}['removeContextItem'](_0x3be1fb){this['_contextPanelView']['removeContextItem'](_0x3be1fb);}['setContextItemLoading'](_0x24178c,_0x2afb36){this['_contextPanelView']['setContextItemLoading'](_0x24178c,_0x2afb36);}['setIsUploadInProgress'](_0x2c2d9b){this['_promptInputView']['setIsUploadInProgress'](_0x2c2d9b);}['setConversationContext'](_0x59edc4){this['_contextPanelView']['setConversationContext'](_0x59edc4);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x57ff5a,_0x59ef28,_0x239c46){this['_contextPanelView']['updateResourceState'](_0x57ff5a,_0x59ef28,_0x239c46);}['setWebSearch'](_0x3b3752){this['_promptCapabilitiesView']['setWebSearch'](_0x3b3752);}['setReasoning'](_0x2c18ae){this['_promptCapabilitiesView']['setReasoning'](_0x2c18ae);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x53c3fa){this['_contextPanelView']['setAddContextOptions'](_0x53c3fa);}['setInputPlaceholder'](_0xae4fac){this['_promptInputView']['setPlaceholderText'](_0xae4fac);}['setModelList'](_0x3eaac7,_0x4f8f87){this['_promptCapabilitiesView']['setModelList'](_0x3eaac7,_0x4f8f87);}['setModel'](_0x383fd6){_0x383fd6?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x383fd6)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x3d90fe){this['_promptCapabilitiesView']['disableModelSelector'](_0x3d90fe);}['populateSourceResourceBalloon'](_0x49dcbf,_0x1a4de8,_0x496ee5,_0x22d282){this['_contextPanelView']['populateSourceResourceBalloon'](_0x49dcbf,_0x1a4de8,_0x496ee5,_0x22d282);}['closeSourceResourceBalloon'](_0x157813){this['_contextPanelView']['closeSourceResourceBalloon'](_0x157813);}['focusPromptInput'](_0xcc151=!0x1){this['_promptInputView']['focus'](_0xcc151);}['setPromptInputValue'](_0x158d83){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x158d83;}},Po=class extends _0x215f6f{constructor(_0x501ad2){super(_0x501ad2);const _0x2b399c=new Ht(_0x501ad2);_0x2b399c['set']({'label':us(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x2b399c['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':us(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x2b399c]}]});}},Ho=class extends Ft{['resizeButton'];constructor(_0x4ef842,_0x32cad2){super(_0x4ef842,{'label':_0x32cad2['label'],'class':'ck-ai-header\x20'+_0x32cad2['class'],'icon':_0x32cad2['icon']}),this['set']('isMaximized',!0x1),_0x32cad2['content']&&this['children']['add'](_0x32cad2['content']),_0x32cad2['showResizeButton']&&(this['resizeButton']=cn(_0x4ef842,this),this['children']['add'](this['resizeButton']));}},Mo=class extends _0x215f6f{constructor(_0x5af6a0){super(_0x5af6a0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':us(_0x5af6a0,'AI_DISCLAIMER_TEXT')}]}]});}};function Vo(_0x234fff,_0x5efd90){const _0x5cc8cc=new Ht(_0x234fff);return _0x5cc8cc['set']({'label':us(_0x234fff,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x3927b2,'class':'ck-ai-chat__start-conversation\x20'+an}),_0x5cc8cc['on']('execute',()=>{_0x5efd90['fire']('startConversation');}),_0x5cc8cc;}var Uo=class extends _0x215f6f{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0x8ddf7f,_0x2eaab5){super(_0x8ddf7f),this['_bodyCollection']=ln(_0x8ddf7f);const _0x5bb8bf=Vo(_0x8ddf7f,this);this['chatHeader']=new Ho(_0x8ddf7f,{'label':us(_0x8ddf7f,'AI_CHAT_HEADING'),'icon':_0x4282d3,'class':'ck-ai-header_chat','content':_0x5bb8bf,'showResizeButton':_0x2eaab5['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new Mr(_0x8ddf7f,this['_bodyCollection']),this['chatFeed']['delegate'](...yn)['to'](this),this['chatControls']=new Do(_0x8ddf7f,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x2eaab5['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x2eaab5['filesEnabled']}),this['chatControls']['delegate'](...yn)['to'](this),this['chatDisclaimer']=new Mo(_0x8ddf7f),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x8ddf7f['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x36080f,_0x203d13,_0xf89281,_0x225676){this['chatControls']['populateSourceResourceBalloon'](_0x36080f,_0x203d13,_0xf89281,_0x225676);}['closeSourceResourceBalloon'](_0x4efaa6){this['chatControls']['closeSourceResourceBalloon'](_0x4efaa6);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Bo=class extends _0x5d28a2{static get['requires'](){return[cs];}['_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(_0x580b2f){super(_0x580b2f);const _0x1be413=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new Zn(),this['_view']=new Uo(this['context']['locale'],{'showResizeButton':_0x1be413['showResizeButton'],'contextResourcesSearchInputVisibleFrom':this['context']['config']['get']('ai.chat.context.searchInputVisibleFrom'),'filesEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.files.enabled')}),this['_view']['delegate']('resizeTabs')['to'](_0x1be413),this['_view']['delegate'](...yn)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x5c8c14,{showDiff:_0x32fb98})=>{this['showDiff']=_0x32fb98;}),this['disableControls'](),_0x1be413['view']['addTab']({'id':'chat','buttonLabel':us(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x4282d3,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x1be413['view'],'isMaximized',_0x99a435=>_0x99a435),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x3c5429=>_0x3c5429),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x4b56e2){const _0x1f9973=this['context']['config']['get']('ai.chat.welcomeMessage')??us(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x4b56e2['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x1f9973}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x4794dd,staticMessage:_0x568b40}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x4794dd,'initialContent':'<p>'+_0x568b40+'</p>'});});}async['addFeedItemUserMessage'](_0x863ae8){const _0x389a90=_0x863ae8['attributes']?.['displayedPrompt']||_0x863ae8['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x863ae8['contextItems']['values']()),'initialContent':'<p>'+_0x389a90+'</p>','id':_0x863ae8['id']});});}async['addFeedItemError']({errorMessage:_0x5ab472,id:_0x4b6082}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x5ab472+'</p>','id':_0x4b6082});});}async['addFeedItemAIReply'](_0x3892f5){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x3892f5['interactionId']+':'+_0x3892f5['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x530375){const _0x52d5f0=ds(this['context']),_0x762ed=_0x52d5f0['map'](_0x2a6f38=>_0x2a6f38['config']['get']('ai.availableReplyActions')||[...er]);let _0x5df42e=_0x762ed['reduce']((_0x566ffd,_0x1f82af)=>_0x566ffd['filter'](_0x35ca00=>_0x1f82af['includes'](_0x35ca00)),_0x762ed[0x0]||[...er]);const _0x4f5c8b=_0x52d5f0['every'](_0x4658a6=>_0x4658a6['plugins']['has']('TrackChanges')),_0x4b2e31=_0x52d5f0['map'](_0x1cd091=>_0x1cd091['commands']['get']('trackChanges'));return _0x4f5c8b?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x4b2e31,'value',(..._0x2b2370)=>_0x2b2370['some'](_0x52c2ad=>_0x52c2ad))):_0x5df42e=_0x5df42e['filter'](_0x5be07d=>'insertSuggestion'!=_0x5be07d),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x530375['interactionId']+':'+_0x530375['id'],'areActionsDisabled':_0x530375['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x5df42e}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x1df191,_0x39a32c){return this['_promiseQueue']['enqueue'](async()=>{const _0x10215d=this['_view']['chatFeed']['children']['last'];if(_0x10215d instanceof yr)return this['_view']['chatFeed']['children']['remove'](_0x10215d),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x1df191['id'],'capabilities':{'isWebSearchEnabled':_0x10215d['capabilities']['isWebSearchEnabled']||_0x39a32c['isWebSearchEnabled'],'isReasoningEnabled':_0x10215d['capabilities']['isReasoningEnabled']||_0x39a32c['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x1df191['id'],'capabilities':_0x39a32c});});}async['addFeedItemCustomElement'](_0x2a87cc,_0x608d5b){let _0x23ac0c;return await this['_promiseQueue']['enqueue'](async()=>{_0x23ac0c=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x2a87cc,'id':_0x608d5b});}),_0x23ac0c;}['removeFeedItem'](_0x2a0ee0){this['_view']['chatFeed']['removeItem'](_0x2a0ee0);}['hasFeedItem'](_0x3c2c7d){return this['_view']['chatFeed']['hasItem'](_0x3c2c7d);}['updateFeedInteractionHeader'](_0x224d07){const _0x4daff0=this['_view']['chatFeed']['children']['find'](_0x1b41ce=>_0x1b41ce['options']['id']==_0x224d07['id']&&_0x1b41ce instanceof yr);_0x4daff0&&_0x4daff0['set']('isVisible',_0x224d07['isVisible']);}async['updateFeedItemAIReplyContent'](_0x2e0363){const _0x21039d=_0x2e0363['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x3d58b7=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x2e0363,'abortSignal':_0x3d58b7,'renderingStrategy':_0x21039d}),_0x2e0363['isDone']&&this['markFeedItemAsDone'](_0x2e0363['id']);});}['updateFeedItemAIReplySources'](_0x4bda55,_0x8eb1d5){this['_view']['chatFeed']['updateWebSources'](_0x4bda55,_0x8eb1d5);}async['updateFeedItemAIReplySuggestionContent'](_0x45734b){return this['_promiseQueue']['enqueue'](async _0x2b4922=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x45734b,'abortSignal':_0x2b4922}),_0x45734b['isDone']&&this['markFeedItemAsDone'](_0x45734b['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x59c7bb){this['_view']['chatFeed']['updateSuggestionPartState'](_0x59c7bb);}['setFeedItemAIReplySuggestionPartActive'](_0x3054f2){this['_view']['chatFeed']['setSuggestionPartActive'](_0x3054f2);}['markFeedItemAsDone'](_0x29f584){this['_view']['chatFeed']['markItemAsDone'](_0x29f584);}['removeFeedInteraction'](_0x5da8d5){this['_view']['chatFeed']['getItemIds']()['filter'](_0x1c321b=>_0x1c321b['startsWith'](_0x5da8d5))['forEach'](_0x5f540c=>this['_view']['chatFeed']['removeItem'](_0x5f540c));}['startInteraction'](){const _0x1d6746=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x1d6746),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x36a225){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x4aa66f=>_0x4aa66f['startsWith'](_0x36a225['id']))['forEach'](_0x46a7ff=>this['markFeedItemAsDone'](_0x46a7ff)),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'](_0x384b01,_0x54c839){this['_view']['chatControls']['addContextItem'](_0x384b01,_0x54c839);}['removeContextItem'](_0x364be0){this['_view']['chatControls']['removeContextItem'](_0x364be0);}['setContextItemLoading'](_0xb77f5e,_0x5b32cb){this['_view']['chatControls']['setContextItemLoading'](_0xb77f5e,_0x5b32cb);}['setIsUploadInProgress'](_0x4dc93b){this['_view']['chatControls']['setIsUploadInProgress'](_0x4dc93b);}['setConversationContext'](_0x1d91f5){this['_view']['chatControls']['setConversationContext'](_0x1d91f5);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x172284,_0x321542,_0x150790){this['_view']['chatControls']['updateResourceState'](_0x172284,_0x321542,_0x150790);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x3e3852){this['_view']['chatControls']['setAddContextOptions'](_0x3e3852);}['updateCapabilities'](_0x48551d){this['_view']['chatControls']['setWebSearch'](_0x48551d['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x48551d['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x48551d));}['setSelectedModel'](_0xdbb24a,_0x5714a5){this['_view']['chatControls']['setModel'](_0xdbb24a),_0x5714a5&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x44fda8){this['feedItemRenderingStrategy']=_0x44fda8;}['toggleLoadingSkeleton'](_0x22a411){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x22a411);}['resetConversationTitle'](){this['setConversationTitle'](us(this['context']['locale'],'AI_CHAT_HEADING'));}['emptyConversationTitle'](){this['setConversationTitle']('');}['setConversationTitle'](_0x14c09d,_0x1244fd=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0x1244fd&&!pt()&&_0x14c09d['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x14c09d);this['_view']['chatHeader']['label']=_0x14c09d;}['setLoadingMessage'](_0x388a5d){this['_view']['chatFeed']['setLoadingMessage'](_0x388a5d);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x1d0a4f){let _0x4a73db=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x1d0a4f[_0x4a73db],_0x4a73db++,_0x4a73db===_0x1d0a4f['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x1eebfe){return _0x1eebfe['isWebSearchEnabled']&&_0x1eebfe['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x1eebfe['isWebSearchEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x1eebfe['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x595cdc){return _0x595cdc?_0x595cdc['isWebSearchEnabled']&&_0x595cdc['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x595cdc['isWebSearchEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x595cdc['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x38a397,_0x4ca5b1,_0x5c3597,_0x48c488){this['_view']['populateSourceResourceBalloon'](_0x38a397,_0x4ca5b1,_0x5c3597,_0x48c488);}['closeSourceResourceBalloon'](_0x414c95){this['_view']['closeSourceResourceBalloon'](_0x414c95);}['setPromptInputValue'](_0x670e61){this['_view']['chatControls']['setPromptInputValue'](_0x670e61);}['focusPromptInput'](_0x478e03=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x478e03);}['scrollFeedToSuggestion'](_0x42c939,_0xfc2eba){this['_view']['chatFeed']['scrollToSuggestion'](_0x42c939,_0xfc2eba);}['startAutoScroll'](_0x3038bf={}){this['_view']['chatFeed']['startAutoScroll'](_0x3038bf);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}},Go=class extends jt{['sections'];constructor(_0x920089,_0x4acc32){super(_0x920089),this['sections']=_0x4acc32,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x4bc36e){let _0x18eb3f=0x0,_0x4ec2c0=0x0;for(const _0xf1c203 of this['sections']){const {resultsCount:_0xe03563,totalItemsCount:_0x36b4db}=_0xf1c203['filter'](_0x4bc36e);_0x18eb3f+=_0xe03563,_0x4ec2c0+=_0x36b4db;}return{'resultsCount':_0x18eb3f,'totalItemsCount':_0x4ec2c0};}},Fo=class extends zt{['title'];['itemsViews'];['_itemsListView'];constructor(_0xb81b6e,{title:_0x36d55e,items:_0xe99e71}){super(_0xb81b6e);const _0x135ddd=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x36d55e,this['itemsViews']=_0xe99e71;const _0x2c013f=new _0x215f6f(_0xb81b6e);_0x2c013f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new jt(_0xb81b6e),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x135ddd['if']('isVisible','ck-hidden',_0x421951=>!_0x421951)]},'children':[_0x2c013f,this['_itemsListView']]});}['filter'](_0x3cc0e6){const _0x177ecd=this['itemsViews']['length'];let _0x544ea7=0x0;for(const _0x39a626 of this['itemsViews'])_0x3cc0e6?(_0x39a626['isVisible']=!!_0x39a626['isMatching'](_0x3cc0e6),_0x39a626['highlightText'](_0x3cc0e6)):(_0x39a626['isVisible']=!0x0,_0x39a626['highlightText'](null)),_0x39a626['isVisible']&&_0x544ea7++;return this['isVisible']=_0x544ea7>0x0,{'resultsCount':_0x544ea7,'totalItemsCount':_0x177ecd};}['getItem'](_0x45949f){return this['itemsViews']['find'](_0x1432e9=>_0x1432e9['id']===_0x45949f);}['removeItem'](_0x20ad27){const _0x38c33b=this['itemsViews']['indexOf'](_0x20ad27);-0x1!==_0x38c33b&&(this['itemsViews']['splice'](_0x38c33b,0x1),this['_itemsListView']['items']['remove'](_0x20ad27));}};const Ko=/* #__PURE__ -- @preserve */
34
+ _0x3688b4(zt);var Wo=class AIChatHistoryListItemView extends Ko{['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(_0x44a468,_0x44e929){super(_0x44a468);const _0xa9eebe=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x44e929['pinned']),this['set']('loadingState',null),this['set']('title',_0x44e929['title']),this['id']=_0x44e929['id'];const {createdAt:_0xc0786b,active:_0x4be912=!0x1}=_0x44e929;this['_titleView']=new Wt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x32b239=this['_createCheckView'](),_0x2b21b6=this['_createPinButtonView'](_0x44a468),_0x50609c=this['_createMenuDropdownView'](),_0x3f2c80=this['_createEditInputView'](_0x44a468),_0x1a7a97=this['_createAcceptEditButtonView'](_0x44a468,_0x3f2c80),_0x24a2c7=this['_createCancelEditButtonView'](_0x44a468);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x2b21b6),this['actions']['add'](_0x50609c),this['on']('change:isEdit',(_0x5a1d4f,_0x29984c,_0x4aa925)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x4aa925?(this['actions']['add'](_0x1a7a97),this['actions']['add'](_0x24a2c7),this['mainContent']['add'](_0x3f2c80),_0x3f2c80['element']['value']=this['title']||'',_0x3f2c80['element']['focus']()):(this['actions']['add'](_0x2b21b6),this['actions']['add'](_0x50609c),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x4be912?'ck-ai-chat-history__item--active':'',_0xa9eebe['if']('isVisible','ck-hidden',_0x32dd0d=>!_0x32dd0d),_0xa9eebe['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',_0xa9eebe['if']('loadingState','ck-hidden',_0x2cf5a8=>!!_0x2cf5a8)]},'children':_0x4be912?[_0x32b239]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0xa9eebe['if']('loadingState','ck-hidden',_0x3efb73=>!_0x3efb73)]},'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',_0xa9eebe['if']('loadingState','ck-hidden',_0x3db0f8=>!!_0x3db0f8)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0xa9eebe['if']('loadingState','ck-hidden',_0x12a99a=>!_0x12a99a)]},'children':[{'text':_0xa9eebe['to']('loadingState',_0x55c84c=>_0x55c84c?us(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x55c84c]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0xc0786b]}]},{'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'](_0x5a037e){this['set']('title',_0x5a037e);}['updateLoadingState'](_0x14122c,_0x5644a6){this['set']('loadingState',_0x5644a6?_0x14122c:null);}['_createCheckView'](){const _0x16cc39=new Yt();return _0x16cc39['set']({'content':_0x27c014}),_0x16cc39;}['_createPinButtonView'](_0x13fec9){const _0x28de00=new Ht(_0x13fec9);return _0x28de00['set']({'label':us(_0x13fec9,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x1f7bdc,'withText':!0x1,'tooltip':!0x0}),_0x28de00['bind']('isOn')['to'](this,'pinned'),_0x28de00['on']('execute',()=>{const _0x107ffa=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x107ffa});}),_0x28de00;}['_createMenuDropdownView'](){const _0x588fd1=_0x32dc43(this['locale']),_0x277b79=_0x588fd1['panelView']['children'];_0x588fd1['buttonView']['set']({'label':us(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':nt}),_0x588fd1['panelPosition']='sw';const _0x3b6a23=new Ht(this['locale']);_0x3b6a23['label']=us(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x3b6a23['withText']=!0x0,_0x3b6a23['on']('execute',()=>{this['isEdit']=!0x0;});const _0x341593=new Ht(this['locale']);_0x341593['label']=us(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x341593['withText']=!0x0,_0x341593['on']('execute',()=>{this['showConfirm'](us(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x243e3d=new jt(this['locale']),_0x33e2f7=new zt(this['locale']);_0x33e2f7['children']['add'](_0x3b6a23);const _0x783494=new zt(this['locale']);return _0x783494['children']['add'](_0x341593),_0x243e3d['items']['addMany']([_0x33e2f7,_0x783494]),_0x277b79['add'](_0x243e3d),_0x588fd1;}['_createEditInputView'](_0x1939a5){const _0x4aadff=new $t(_0x1939a5),_0x1d58a9=_0x4aadff['bindTemplate'];return _0x4aadff['extendTemplate']({'on':{'keydown':_0x1d58a9['to'](_0x2668e4=>{'Enter'==_0x2668e4['key']&&this['_commitEditInputValue'](_0x4aadff);})}}),_0x4aadff;}['_createAcceptEditButtonView'](_0x525c50,_0x2fc7f9){const _0xfe670a=new Ht(_0x525c50);return _0xfe670a['set']({'icon':_0x27c014,'withText':!0x1,'tooltip':us(_0x525c50,'AI_CHAT_HISTORY_ACCEPT')}),_0xfe670a['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0xfe670a['on']('execute',()=>{this['_commitEditInputValue'](_0x2fc7f9);}),_0xfe670a;}['_commitEditInputValue'](_0x2b1bd3){const _0x1d7424=_0x2b1bd3['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x1d7424});}['_createCancelEditButtonView'](_0x1a7c4f){const _0x592668=new Ht(_0x1a7c4f);return _0x592668['set']({'icon':_0x27af74,'withText':!0x1,'tooltip':us(_0x1a7c4f,'AI_CHAT_HISTORY_CANCEL')}),_0x592668['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x592668['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x592668;}['_createSpinnerView'](){const _0x4feb68=new cr('tiny');return _0x4feb68['isVisible']=!0x0,_0x4feb68;}['isMatching'](_0x45fd1c){return'string'==typeof this['title']&&this['title']['match'](_0x45fd1c)?{'title':!0x0}:null;}['highlightText'](_0x239bfc){this['_titleView']['highlightText'](_0x239bfc);}},Yo=class extends _0x215f6f{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x55fc77,_0x2767eb){super(_0x55fc77),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x3323bb=Vo(_0x55fc77,this);this['headerView']=new Ho(_0x55fc77,{'label':us(_0x55fc77,'AI_CHAT_HISTORY_HEADING'),'icon':_0x5c358f,'class':'ck-ai-header_history','content':_0x3323bb,'showResizeButton':_0x2767eb}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Go(_0x55fc77,[]),this['sectionsView']['delegate'](...$o)['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',_0x147f11=>!_0x147f11)]}}),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 _0x466d02=new _0x27b4c4(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':us(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x2bc466=>us(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x2bc466),'secondary':us(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0xf35df0=this['_createErrorView']();return _0xf35df0['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x3df05e=>!_0x3df05e)]}}),_0x466d02['on']('render',()=>{_0x466d02['children']['add'](_0xf35df0,0x1);}),_0x466d02['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x16f04a=>!_0x16f04a)]}}),_0x466d02;}['_createSkeletonView'](){const _0x207a95=new Xn(this['locale'],zn['aiHistory']);return _0x207a95['bind']('isVisible')['to'](this,'isLoading'),_0x207a95;}['_createErrorView'](){const _0x28cb84=new _0x215f6f(this['locale']),_0x29efc4=new Ht(this['locale']);_0x29efc4['set']({'withText':!0x1,'icon':_0x27af74,'class':'ck-ai-notification_error__dismiss-button'}),_0x29efc4['bind']('isVisible')['to'](this,'hasItems',_0xdaebef=>!!_0xdaebef),_0x29efc4['on']('execute',()=>{this['errorMessage']='';});const _0x2d9db1=this['bindTemplate'];return _0x28cb84['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x2d9db1['to']('errorMessage')}]},_0x29efc4]}),_0x28cb84;}['_createEmptyStateView'](){const _0x2b85c6=new _0x215f6f(this['locale']);return _0x2b85c6['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x4da2f7=>!_0x4da2f7)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[us(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x2b85c6;}['_createListItemViews'](_0x526f9b,_0x518da6){const _0x4a690e=[];for(const _0x16f075 of _0x526f9b){const _0x256cc0=new Wo(_0x518da6,_0x16f075);_0x256cc0['delegate'](...$o)['to'](this),_0x4a690e['push'](_0x256cc0);}return _0x4a690e;}['updateHistoryItemsWithCategories'](_0x14edad){const _0x5b0dd0=this['locale']||'en',_0x2ddf82=[];for(const _0x40ee36 of _0x14edad){const _0x378bdf=this['_createListItemViews'](_0x40ee36['items'],_0x5b0dd0);_0x2ddf82['push'](new Fo(_0x5b0dd0,{'title':_0x40ee36['title'],'items':_0x378bdf}));}this['sectionsView']['sections']=_0x2ddf82,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x2ddf82),this['hasItems']=_0x14edad['some'](_0x325ea5=>_0x325ea5['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0xd1a553){for(const _0x493860 of this['sectionsView']['sections']){const _0x5f045b=_0x493860['getItem'](_0xd1a553);if(_0x5f045b){if(_0x493860['removeItem'](_0x5f045b),0x0===_0x493860['itemsViews']['length']){const _0x199f02=this['sectionsView']['sections']['indexOf'](_0x493860);-0x1!==_0x199f02&&(this['sectionsView']['sections']['splice'](_0x199f02,0x1),this['sectionsView']['items']['remove'](_0x493860));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x1eb6ae,_0x2f2fd4){for(const _0x15ed37 of this['sectionsView']['sections']){const _0x52553f=_0x15ed37['getItem'](_0x1eb6ae);if(_0x52553f){_0x52553f['updateTitle'](_0x2f2fd4);break;}}}['updateItemLoadingState'](_0x56639b,_0x2a3cb7,_0x33684b){for(const _0x269930 of this['sectionsView']['sections']){const _0x580620=_0x269930['getItem'](_0x56639b);if(_0x580620){_0x580620['updateLoadingState'](_0x2a3cb7,_0x33684b);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x3268f6=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x3268f6);}}};const $o=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var qo=class extends _0x5d28a2{static get['requires'](){return[cs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2e64d3){super(_0x2e64d3);const _0x571549=this['context']['plugins']['get']('AITabs');this['_historyView']=new Yo(this['context']['locale'],_0x571549['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x571549),this['_historyView']['delegate'](...$o)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x571549['view'],'isMaximized',_0xdff76c=>_0xdff76c),_0x571549['view']['addTab']({'id':'history','buttonLabel':us(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x5c358f,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x381e12){this['_historyView']['removeHistoryItem'](_0x381e12);}['updateItems'](_0x4e3598){this['_historyView']['updateHistoryItemsWithCategories'](_0x4e3598);}['updateItemTitle'](_0xbd6c1a,_0x19032f){this['_historyView']['updateItemTitle'](_0xbd6c1a,_0x19032f);}['updateItemLoadingState'](_0x16df53,_0x5a5269,_0x538a3b){this['_historyView']['updateItemLoadingState'](_0x16df53,_0x5a5269,_0x538a3b);}['setLoadingSkeleton'](_0x4f22b3){this['_historyView']['isLoading']=_0x4f22b3;}['showError'](_0x3726e6){this['_historyView']['errorMessage']=_0x3726e6;}['hideError'](){this['_historyView']['errorMessage']='';}};const Qo=/* #__PURE__ -- @preserve */
35
+ gt();var Xo=class extends Qo{['id'];['createdAt'];constructor({id:_0x4029e2,title:_0x2749f0,createdAt:_0x161519,updatedAt:_0x209db9,pinned:_0x2bef97}){super(),this['id']=_0x4029e2,this['createdAt']=new Date(_0x161519),this['set']('title',_0x2749f0),this['set']('updatedAt',_0x209db9?new Date(_0x209db9):null),this['set']('pinned',_0x2bef97||!0x1);}['updateTitle'](_0x1a55ba){this['set']('title',_0x1a55ba),this['updatedAt']=new Date();}['updatePinned'](_0x484c2f){this['set']('pinned',_0x484c2f),this['updatedAt']=new Date();}};const zo=/* #__PURE__ -- @preserve */
36
+ ut();var jo=class extends zo{['items']=[];['connector'];['group'];constructor({connector:_0x39ead4,group:_0x37a129}){super(),this['connector']=_0x39ead4,this['group']=_0x37a129;}async['init'](){try{const _0x4271b3=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x4271b3);}catch(_0x31c462){this['fire']('error',{'error':_0x31c462,'operation':'init'});}}['addItem'](_0x11c4b8){this['items']['push'](_0x11c4b8);}async['removeItem'](_0x45a8f1){const _0xa84a25=this['items']['findIndex'](_0x51c089=>_0x51c089['id']===_0x45a8f1);if(-0x1===_0xa84a25)return!0x1;try{return await this['connector']['deleteConversation'](_0x45a8f1)['execute'](),this['items']['splice'](_0xa84a25,0x1),this['fire']('itemRemoved',{'itemId':_0x45a8f1}),!0x0;}catch(_0x45e048){return this['fire']('error',{'error':_0x45e048,'operation':'removeItem','itemId':_0x45a8f1}),!0x1;}}['getItem'](_0x35c4b1){return this['items']['find'](_0x32d0a9=>_0x32d0a9['id']===_0x35c4b1);}async['updateItemTitle'](_0x386a74,_0x328e5e){const _0x10ad1b=this['getItem'](_0x386a74);if(!_0x10ad1b)return!0x1;try{return await this['connector']['updateConversation'](_0x386a74,{'title':_0x328e5e})['getResult'](),_0x10ad1b['updateTitle'](_0x328e5e),this['fire']('itemUpdated',{'itemId':_0x386a74,'updates':{'title':_0x328e5e}}),!0x0;}catch(_0xfe64b0){return this['fire']('error',{'error':_0xfe64b0,'operation':'updateItemTitle','itemId':_0x386a74}),!0x1;}}async['updateItemPinned'](_0xdfa182,_0x3c03b8){const _0x33adb7=this['getItem'](_0xdfa182);if(!_0x33adb7)return!0x1;try{return await this['connector']['updateConversation'](_0xdfa182,{'pinned':_0x3c03b8})['getResult'](),_0x33adb7['updatePinned'](_0x3c03b8),this['fire']('itemUpdated',{'itemId':_0xdfa182,'updates':{'pinned':_0x3c03b8}}),!0x0;}catch(_0x4c9a67){return this['fire']('error',{'error':_0x4c9a67,'operation':'updateItemPinned','itemId':_0xdfa182}),!0x1;}}['loadItems'](_0x26e55e){try{this['items']=[],_0x26e55e['map'](_0x4b3531=>{this['addItem'](new Xo(_0x4b3531));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x411f77){this['fire']('error',{'error':_0x411f77,'operation':'loadItems'});}}['getItems'](_0x16c988={}){const _0x4a0d82=void 0x0!==_0x16c988['pinned']&&_0x16c988['pinned'],_0xc8afea=_0x16c988['from']?new Date(_0x16c988['from']['getFullYear'](),_0x16c988['from']['getMonth'](),_0x16c988['from']['getDate']()):null,_0x19b1df=_0x16c988['to']?new Date(_0x16c988['to']['getFullYear'](),_0x16c988['to']['getMonth'](),_0x16c988['to']['getDate']()):null;return this['items']['filter'](_0x3edd22=>{if(_0x3edd22['pinned']!==_0x4a0d82)return!0x1;if(_0x19b1df){const _0x45c81f=new Date(_0x3edd22['createdAt']['getFullYear'](),_0x3edd22['createdAt']['getMonth'](),_0x3edd22['createdAt']['getDate']());return _0xc8afea?_0xc8afea['getTime']()===_0x19b1df['getTime']()?_0x45c81f['getTime']()===_0xc8afea['getTime']():_0x45c81f<_0x19b1df&&_0x45c81f>=_0xc8afea:_0x45c81f<_0x19b1df;}return!0x0;});}},Jo=class extends _0x5d28a2{['_aiConnector'];['_reporter'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[ls,nn,kn,qo,cs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiConnector']=this['context']['plugins']['get'](ls),this['_aiChatHistoryUi']=this['context']['plugins']['get'](qo),this['_aiChatController']=this['context']['plugins']['get'](kn),this['_reporter']=this['context']['plugins']['get'](nn)['createReporter']('aichathistory');const _0x587740=this['context']['plugins']['get'](cs);try{const _0x62c665=this['_aiChatController']['getGroupId']();this['history']=new jo({'connector':this['_aiConnector'],'group':_0x62c665}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x268cf5,_0xca9fb0)=>{this['_setItemLoading'](_0xca9fb0['id'],'remove'),this['_handleRemove'](_0xca9fb0['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x3422b1,_0x34588c)=>{this['_setItemLoading'](_0x34588c['id'],'rename'),this['_handleEditTitle'](_0x34588c['id'],_0x34588c['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x21a807,_0x330623)=>{void 0x0!==_0x330623['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x330623['itemId'],_0x330623['updates']['title']),void 0x0!==_0x330623['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x330623['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x386baf,_0x465ca4)=>{this['_aiChatController']['_handleRemovedConversation'](_0x465ca4['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x465ca4['itemId']),this['_clearItemLoading'](_0x465ca4['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x513ec3,_0x11848d)=>{this['_handleHistoryErrorUI'](_0x11848d['error'],_0x11848d['operation'],_0x11848d['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x346a1e,_0x332871)=>{this['_handleSelectConversation'](_0x332871['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x2b0f0f,_0x5858b9)=>{const _0x30703d=_0x5858b9['pinned']?'pin':'unpin';this['_setItemLoading'](_0x5858b9['id'],_0x30703d),this['_handleTogglePin'](_0x5858b9['id'],_0x5858b9['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x587740['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x587740['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x15ad67){this['_handleHistoryErrorUI'](_0x15ad67,'init');}}async['_handleEditTitle'](_0x48a3a3,_0x567209){await this['history']['updateItemTitle'](_0x48a3a3,_0x567209);}async['_handleTogglePin'](_0x5df7fa,_0x10db30){await this['history']['updateItemPinned'](_0x5df7fa,_0x10db30);}async['_handleRemove'](_0x14b5f2){await this['history']['removeItem'](_0x14b5f2);}async['_handleSelectConversation'](_0x55220b){await this['_aiChatController']['loadConversation'](_0x55220b);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0xaabf40=this['_aiChatController']['activeConversation']?.['id'],_0x260b74=this['_getCategorizedItems']()['map'](_0xb565a0=>({'title':_0xb565a0['title'],'items':_0xb565a0['items']['map'](_0x11b946=>({'id':_0x11b946['id'],'title':_0x11b946['title']||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x11b946['createdAt'])['toLocaleDateString'](),'active':_0x11b946['id']===_0xaabf40,'pinned':_0x11b946['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x260b74);}['_setItemLoading'](_0x1a8c96,_0x24ae6f){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x1a8c96,_0x24ae6f,!0x0);}['_clearItemLoading'](_0x3c9db3){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x3c9db3,null,!0x1);}['_handleHistoryErrorUI'](_0x29d995,_0x426b51,_0x2e002f){const _0x3d9f06=this['_generateErrorMessage'](_0x426b51,_0x2e002f);this['_aiChatHistoryUi']['showError'](_0x3d9f06),this['_reporter']['reportError'](_0x29d995,{'context':{'operation':_0x426b51}}),_0x2e002f&&this['_clearItemLoading'](_0x2e002f),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0xde9e68,_0x3095cc){const _0x5699f5=_0x3095cc?this['history']['getItem'](_0x3095cc):null,_0x56b780=_0x5699f5?.['title']||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0xde9e68){case'updateItemTitle':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x56b780);case'updateItemPinned':{const _0x580afe=us(this['context']['locale'],_0x5699f5?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x580afe,_0x56b780]);}case'removeItem':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x56b780);case'init':case'loadItems':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0x259d03=new Date(),_0x1fa6ae=new Date(_0x259d03['getFullYear'](),_0x259d03['getMonth'](),_0x259d03['getDate']()),_0x306df2=new Date(_0x1fa6ae);_0x306df2['setDate'](_0x306df2['getDate']()-0x1);const _0x494d93=new Date(_0x1fa6ae);_0x494d93['setDate'](_0x494d93['getDate']()-0xe);const _0x4fab43=this['history']['getItems']({'pinned':!0x0}),_0x116dc9=this['history']['getItems']({'from':_0x1fa6ae,'to':_0x1fa6ae}),_0x1be021=this['history']['getItems']({'from':_0x306df2,'to':_0x306df2}),_0x3ec583=this['history']['getItems']({'from':_0x494d93,'to':_0x306df2}),_0x145b77=this['history']['getItems']({'to':_0x494d93}),_0x12122b=[];return _0x4fab43['length']>0x0&&_0x12122b['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x4fab43}),_0x116dc9['length']>0x0&&_0x12122b['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x116dc9}),_0x1be021['length']>0x0&&_0x12122b['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x1be021}),_0x3ec583['length']>0x0&&_0x12122b['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x3ec583}),_0x145b77['length']>0x0&&_0x12122b['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x145b77}),_0x12122b;}},Zo=class extends _0x5d28a2{static get['requires'](){return[Jo,qo];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ta=class extends _0x5d28a2{static get['requires'](){return[kn,Is,Bo,Zo,tn];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xfec276){super(_0xfec276),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'sources':[],'alwaysAddSelection':!0x1,'paste':{'textThreshold':0x5dc}}),this['context']['config']['define']('ai.chat.initialConversation','new');}},ea=class extends Ht{['id'];constructor(_0x5f4a38,_0x379a65){super(_0x5f4a38);const {id:_0x5363d7,type:_0x38a756,icon:_0x25e19e}=_0x379a65;this['id']=_0x5363d7,this['set']({'label':_0x379a65['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x379a65['id']}}),_0x25e19e?this['icon']=_0x25e19e:'chat'===_0x38a756?this['icon']=_0x4282d3:'review'===_0x38a756?this['icon']=_0x5bd10a:'translate'===_0x38a756&&(this['icon']=_0x4dd947);}},ia=class extends _0x215f6f{['listView'];constructor(_0x500b2c,_0x409d38){super(_0x500b2c),this['set']('isEnabled',!0x0);const _0x48d8a9=_0x409d38['map'](_0x2be126=>{const _0x37d1bd=new zt(this['locale']),_0x278d2b=new ea(this['locale'],_0x2be126);return _0x278d2b['bind']('isEnabled')['to'](this),_0x37d1bd['children']['add'](_0x278d2b),_0x278d2b['delegate']('execute')['to'](this),_0x37d1bd;});this['listView']=new jt(this['locale']),this['listView']['items']['addMany'](_0x48d8a9),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const sa='chat-shortcuts';var na=class extends _0x5d28a2{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];['_listenedConversation'];static get['requires'](){return[Bo];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiChatUI']=this['context']['plugins']['get'](Bo),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x756d90=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x5d5afd=_0x756d90['activeConversation'];_0x5d5afd['isFromHistory']||this['_injectShortcuts'](_0x5d5afd);}),this['listenTo'](_0x756d90,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x2120d0=['chat','review','translate'];this['_shortcuts']['forEach'](_0x311348=>{let _0x4f8338=!0x0;if(_0x311348['id']&&_0x311348['label']&&_0x2120d0['includes'](_0x311348['type'])?'chat'===_0x311348['type']&&(_0x4f8338='string'==typeof _0x311348['prompt']):_0x4f8338=!0x1,!_0x4f8338)throw new ht('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x311348});});}['_injectShortcuts'](_0xefa369){this['_removeShortcuts'](),this['_shortcutsView']=new ia(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],sa),this['_shortcutsView']['on']('execute',_0x94e09a=>{const _0x5678d7=_0x94e09a['source']['id'];this['_executeShortcut'](_0x5678d7);}),this['_listenedConversation']=_0xefa369,this['listenTo'](_0xefa369,'uploadProgressChanged',(_0x50f077,_0xec1cad)=>{this['_shortcutsView']['isEnabled']=!_0xec1cad['isUploadInProgress'];});}['_removeShortcuts'](){const _0x22d456=this['context']['plugins']['get'](Bo);_0x22d456['hasFeedItem'](sa)&&_0x22d456['removeFeedItem'](sa),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x15f6b2){const _0x13af8c=this['_shortcuts']['find'](_0x31521c=>_0x31521c['id']===_0x15f6b2),_0x3cb264=_0x13af8c['type'];'chat'===_0x3cb264?this['_runChatShortcut'](_0x13af8c):'review'===_0x3cb264?_0x13af8c['commandId']?this['_runReviewShortcut'](_0x13af8c):this['_switchTab']('reviewMode'):'translate'===_0x3cb264&&(_0x13af8c['language']?this['_runTranslateShortcut'](_0x13af8c):this['_switchTab']('translate'));}['_switchTab'](_0x5c50f5){if(!this['context']['plugins']['has']('AITabs'))throw new ht('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x5c50f5});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x5c50f5);}async['_runChatShortcut']({prompt:_0x861f52,draftMode:_0x484c98,useWebSearch:_0x43ccbd=!0x1,useReasoning:_0x13c1af=!0x1,model:_0x48ffb0}){const _0x10ddb6=this['context']['plugins']['get']('AIChatController'),_0x24dffb=_0x10ddb6['activeConversation'];let _0x1bb271;_0x1bb271=_0x48ffb0?await _0x24dffb['chatModels']['getModel'](_0x48ffb0):await _0x24dffb['chatModels']['getDefault'](),_0x1bb271&&await _0x24dffb['setModel'](_0x1bb271),_0x24dffb['setWebSearch'](_0x43ccbd),_0x24dffb['setReasoning'](_0x13c1af),_0x10ddb6['addCurrentDocumentToChatContext'](),_0x484c98?(this['_aiChatUI']['setPromptInputValue'](_0x861f52),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x10ddb6['sendMessage']({'message':_0x861f52});}['_runReviewShortcut']({commandId:_0x4cc5ba,model:_0x16458d,prompt:_0xd374b0,params:_0x46d9b8}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ht('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x3c4c64={'id':_0x4cc5ba,'isCustom':'custom'===_0x4cc5ba};_0x16458d&&_0xd374b0&&(_0x3c4c64['args']={'model':_0x16458d,'prompt':_0xd374b0}),_0x46d9b8&&(_0x3c4c64['params']=_0x46d9b8),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x3c4c64);}['_runTranslateShortcut']({language:_0x3decfc}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new ht('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x3decfc,'args':{'language':_0x3decfc}});}},ra=class extends _0x24f2c3{constructor(_0x4ce865){super(_0x4ce865);const _0x1e63b6=_0x4ce865['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x1e63b6,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0x5df990=this['editor']['plugins']['get']('AITabs')['view'];_0x5df990['isVisible']=!_0x5df990['isVisible'];}},oa=class extends _0x3688ab{static get['requires'](){return[cs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x4ab69d=this['editor'];_0x4ab69d['commands']['add']('toggleAi',new ra(_0x4ab69d)),_0x4ab69d['ui']['componentFactory']['add']('toggleAi',()=>{const _0x2c1712=this['_createAIUIButton'](Ht);return _0x2c1712['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x2c1712;}),_0x4ab69d['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x1bb4cf=this['_createAIUIButton'](Jt);return _0x1bb4cf['set']({'role':'menuitemcheckbox'}),_0x1bb4cf;});}['_createAIUIButton'](_0x2cc561){const _0x28b219=this['editor'],_0x4583cf=_0x28b219['commands']['get']('toggleAi'),_0x250404=new _0x2cc561(_0x28b219['locale']);return _0x250404['set']({'label':us(_0x28b219['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x3adddc,'isToggleable':!0x0}),_0x250404['bind']('isEnabled')['to'](_0x4583cf),_0x250404['bind']('isOn')['to'](_0x4583cf,'value',_0x1df3ae=>!!_0x1df3ae),this['listenTo'](_0x250404,'execute',()=>{_0x4583cf['execute']();}),_0x250404;}};const aa=['applySuggestion','insertSuggestion','showNext','showPrevious'];var ha=class extends _0x215f6f{['_errorView'];constructor(_0x213ec5){super(_0x213ec5),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x28f6b6){this['showError'](_0x28f6b6);}['showError'](_0x410426){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x410426,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x2b6e81=new _0x215f6f(this['locale']),_0x5a9bce=new _0x215f6f(this['locale']);return _0x5a9bce['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x2b6e81['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x10cbbc=>!_0x10cbbc)]},'children':[_0x5a9bce]}),_0x2b6e81;}};const ca=0xa;var la=class extends _0x5d28a2{static get['requires'](){return[Is];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_editor'];['_isUpdatingMarkers']=!0x1;['open'](_0xce5419){const {id:_0xc89739}=this['_currentConfig']??{};this['_currentConfig']=_0xce5419,this['_editor']=_0xce5419['targetEditor'];const {id:_0x5f042a}=this['_currentConfig'];this['isOpen']&&_0xc89739===_0x5f042a?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x4bb6ee=this['_editor'];if(!_0x4bb6ee)return;const _0x523e2d=_0x4bb6ee['plugins']['get']('Dialog');_0x523e2d['isOpen']&&this['_currentConfig']&&_0x523e2d['id']===this['_currentConfig']['id']&&_0x523e2d['hide']();}['_updateDialog'](){const _0x46f890=this['_editor']['plugins']['get']('Dialog'),{icon:_0x4142f8,title:_0x416ffa}=this['_currentConfig'];_0x46f890['view']?.['headerView']&&(_0x46f890['view']['headerView']['label']=_0x416ffa,_0x46f890['view']['headerView']['iconView']&&_0x4142f8&&(_0x46f890['view']['headerView']['iconView']['content']=_0x4142f8)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x46f890['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](Is)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](Is)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x58ef97=this['_editor']['plugins']['get']('Dialog'),{id:_0x55749b,title:_0xdeecad,icon:_0x11fde3,class:_0xb8e546,mainView:_0x338780}=this['_currentConfig'];_0x338780['delegate'](...aa)['to'](this),_0x58ef97['show']({'title':_0xdeecad,'icon':_0x11fde3,'hasCloseButton':!0x0,'id':_0x55749b,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0xb8e546||''),'content':_0x338780,'onShow':_0x4bc2ea=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x4bc2ea['view']?.['updatePosition']();const _0x51c065=this['_getSelectionElements']();_0x51c065&&_0x51c065[0x0]&&Rt({'target':_0x51c065[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x4bc2ea['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x55749b});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x55749b}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x3547a7,_0x1e0036,_0x4d6876){const _0x24d837=_0x1e0036||_0x4d6876;if(!_0x24d837)return null;const _0x424e08=this['_getSelectionElements']();if(!_0x424e08||0x0===_0x424e08['length'])return{'left':Math['round'](_0x24d837['left']+_0x24d837['width']/0x2-_0x3547a7['width']/0x2),'top':Math['round'](_0x24d837['top']+_0x24d837['height']/0x2-_0x3547a7['height']/0x2)};const _0x20805e=Math['round'](_0x24d837['left']+_0x24d837['width']/0x2-_0x3547a7['width']/0x2),_0x12261=_0x424e08['map'](_0x879cec=>new At(_0x879cec)),_0x415aa2=_0x3547a7['height'];return{'left':_0x20805e,'top':this['_calculateOptimalTopPosition'](_0x12261,_0x415aa2,_0x24d837)};}['_calculateOptimalTopPosition'](_0x2484a2,_0x172528,_0x14921f){const _0xe9817=new At(Tt['window']),_0xd55b94=_0x2484a2['map'](_0x1ca0e4=>_0x1ca0e4['getVisible']())['filter'](_0x40e74a=>_0x40e74a),_0x5aa470=At['getBoundingRect'](_0xd55b94);if(!_0x5aa470)return Math['round'](_0x14921f['top']+_0x14921f['height']/0x2);const _0x571edd=_0xe9817['getIntersection'](_0x5aa470);if(!_0x571edd)return Math['round'](_0x14921f['top']+_0x14921f['height']/0x2);const _0x16adc9=_0x14921f['getVisible'](),_0x44aabd=_0x16adc9&&_0x5aa470['height']>_0x16adc9['height'],_0x3d9e90=_0x571edd['top'],_0x8cd257=_0x571edd['bottom'];if(_0x44aabd){const _0xe41023=_0xe9817['top']+_0xe9817['height']/0x2-_0x172528/0x2,_0x1023a0=_0x3d9e90-ca-_0xe9817['top'],_0x48bb76=_0xe9817['bottom']-_0x8cd257-ca;return _0x1023a0>=_0x172528?Math['max'](ca,_0x3d9e90-_0x172528-ca):_0x48bb76>=_0x172528?_0x8cd257+ca:Math['max'](ca,_0xe41023);}const _0x586924=_0x3d9e90-_0x172528,_0x323fc3=_0xe9817['bottom']-_0x8cd257-ca,_0x26a189=_0x3d9e90-ca-_0xe9817['top'];let _0x2ec8d9;return _0x2ec8d9=_0x323fc3>=_0x172528?_0x8cd257+ca:_0x26a189>=_0x172528?_0x586924-ca:_0x3d9e90+_0x5aa470['height']/0x2-_0x172528/0x2,_0x2ec8d9;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x34eca6=this['_editor'];this['listenTo'](_0x34eca6['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x10f158,data:{newRange:_0x347e0b}}of _0x34eca6['model']['document']['differ']['getChangedMarkers']())if(_0x10f158['startsWith']('ai-selection:')&&(_0x347e0b&&(_0x347e0b['start']['isEqual'](_0x347e0b['end'])||'$graveyard'==_0x347e0b['root']['rootName'])||null==_0x347e0b)){const _0x2171e7=us(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x2171e7),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0xfa87be=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0xfa87be['model']['document']);}['_getSelectionElements'](){const _0x56ebb3=this['_editor'];return _0x456453(_0x56ebb3['editing'],[..._0x56ebb3['model']['markers']['getMarkersGroup']('ai-selection'),..._0x56ebb3['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getCurrentDomRootName'](){const _0x42d9c9=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x42d9c9&&_0x42d9c9['rootName']?_0x42d9c9['rootName']:null;}},ua=class extends _0x116a57{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x213a33,_0x219f5c={}){super(_0x213a33),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x219f5c};const _0x27f542=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x27f542?'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'](_0x7b9265){this['showChangesButton']['isEnabled']=_0x7b9265;}['_setupRatingButtons'](){this['likeButton']=new Ht(this['locale']),this['likeButton']['set']({'icon':ot,'label':us(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':hn,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new Ht(this['locale']),this['dislikeButton']['set']({'icon':rt,'label':us(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':hn,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new Ht(this['locale']),this['copyButton']['set']({'icon':_0x26f268,'label':us(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+hn,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0xf8219d=new Yt();_0xf8219d['set']({'content':_0x27c014}),_0xf8219d['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'+hn,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+hn;},0x7d0);}),this['copyButton']['children']['add'](_0xf8219d);}['_setupShowChangesButton'](){this['showChangesButton']=new Ht(this['locale']),this['showChangesButton']['set']({'icon':tt,'label':us(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':hn}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x242624=>_0x242624?et:tt),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}},da=class extends ha{['children'];['nextButtonView'];['previousButtonView'];['focusCycler'];['_focusables'];['_focusTracker'];['_keystrokes'];['_config'];['_streamableContentView'];['_toolbarContainerView'];['_partToolbarView'];['_stateView'];['_miniToolbarView'];constructor(_0x4f866e,_0x259329){super(_0x4f866e);const _0x13170a=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new dt(),this['_keystrokes']=new _t(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x259329,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new qn(_0x4f866e),this['_partToolbarView']=new Wn(_0x4f866e,_0x259329['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x259329),this['_stateView']=new Fn(_0x4f866e),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new ua(_0x4f866e,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new _a(_0x4f866e,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x5777cb,_0x468713,_0x41763f,_0x564bad)=>{let _0x136314,_0x4fdaf3;'pending'===_0x564bad?(_0x136314=this['_partToolbarView'],_0x4fdaf3=this['_stateView']):(_0x136314=this['_stateView'],_0x4fdaf3=this['_partToolbarView']),this['_stateView']['setState'](_0x41763f),_0x136314['isVisible']=!0x1,_0x4fdaf3['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x13170a['to']('_state',_0x5b7ce8=>'ck-ai-chat-balloon-main_state_'+_0x5b7ce8)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x259329);});}['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'](_0x5192d8){_0x5192d8?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x5192d8);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0x53d84c){this['_state']=_0x53d84c;}['showError'](_0x114ebd){super['showError'](_0x114ebd),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x1ec724){super['showBlockingError'](_0x1ec724),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x5bebdd){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x5bebdd;}['togglePartToolbarEnabled'](_0x11a1ca){this['_partToolbarView']['isEnabled']=_0x11a1ca;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x273983,showSuggestButton:_0x3c8f71}){_0x273983=_0x273983&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x3c8f71=_0x3c8f71&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x273983,'showSuggestButton':_0x3c8f71});}['_createNextButtonView'](){const _0x4db576=new Ht(this['locale']);return _0x4db576['set']({'icon':_0x13018d,'label':us(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x4db576['on']('execute',()=>{this['fire']('showNext');}),_0x4db576;}['_createPreviousButtonView'](){const _0x4a215d=new Ht(this['locale']);return _0x4a215d['set']({'icon':_0x53c774,'label':us(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x4a215d['on']('execute',()=>{this['fire']('showPrevious');}),_0x4a215d;}},_a=class extends _0x215f6f{constructor(_0x46c109,_0x5ca3ac){super(_0x46c109),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x5ca3ac});}},ga=class extends _0x3688ab{static get['requires'](){return[Mt,la];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x3bbb37){super(_0x3bbb37),this['set']('showDiff',!0x1);}['open'](_0x174bd1){const _0x5f3426=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x5f3426['plugins']['get']('AIBalloon')['open']({..._0x174bd1,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x174bd1['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x174bd1['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x2fe4df){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x2fe4df);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x502df9){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x502df9);}['_createChatBalloonView'](){const _0x285682=this['editor'],_0x11d8d5=_0x285682['plugins']['get']('AIBalloon'),_0x205ec0=_0x285682['commands']['get']('trackChanges');let _0x23fcf9=_0x285682['config']['get']('ai.availableReplyActions')||[...er];_0x285682['plugins']['has']('TrackChanges')||(_0x23fcf9=_0x23fcf9['filter'](_0x1a7ce1=>'insertSuggestion'!=_0x1a7ce1));const _0x16bb53=new da(_0x285682['locale'],{'availableActions':_0x23fcf9,'showApplyButton':!0x0,'showSuggestButton':!!_0x205ec0});return _0x16bb53['bind']('showDiff')['to'](this),_0x16bb53['delegate'](...Nn)['to'](this),_0x16bb53['delegate']('showPrevious','showNext')['to'](this),_0x11d8d5['delegate']('dialogClosed')['to'](this),_0x16bb53['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x16bb53['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x16bb53['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x205ec0&&_0x16bb53['bind']('isTrackChangesOn')['to'](_0x205ec0,'value'),_0x16bb53['render'](),_0x16bb53;}['_toggleRotatorButtonsInDialogHeader'](_0x58f24e){const _0x116bc9=this['editor'],_0x547c24=_0x116bc9['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x58f24e),_0x547c24['has'](this['_chatBalloonView']['previousButtonView'])||(_0x547c24['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x116bc9['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x547c24['remove'](this['_chatBalloonView']['previousButtonView']),_0x547c24['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}},Aa=class extends _0x3688ab{static get['requires'](){return[oa,ga,_0x611eb6];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function Ia(_0x584a53){const {editor:_0x4c75bc,action:_0x4795d1,withText:_0x5d3a74=!0x1,withIcon:_0x18b5d3=!0x0,isInDropdown:_0x9a0abb=!0x0,shouldPreventFocus:_0x1c5507=!0x1,actionButtons:_0x38653f}=_0x584a53;return()=>{const _0x5b4271=_0x4c75bc['locale'],_0x21bb7a=new Ht(_0x5b4271),_0xdc4917=_0x21bb7a['bindTemplate'];_0x9a0abb&&_0x21bb7a['extendTemplate']({'on':{'mouseenter':_0xdc4917['to'](()=>{_0x1c5507&&_0x1c5507()||_0x21bb7a['focus']();})}}),_0x38653f['push']({'buttonView':_0x21bb7a,'action':_0x4795d1});const _0x122a85=_0x4795d1['icon']??_0x4795d1['parent']?.['icon'];return _0x21bb7a['set']({'label':_0x4795d1['label'],'withText':_0x5d3a74,'role':'menuitem','icon':_0x18b5d3?_0x122a85??_0x27a3d4:void 0x0,'tooltip':!_0x5d3a74,'class':'ck-ai-quick-actions-button','isEnabled':_0x4795d1['isEnabled']}),_0x21bb7a['on']('execute',()=>{_0x4c75bc['editing']['view']['focus'](),_0x4c75bc['commands']['execute']('aiQuickAction',_0x4795d1);}),_0x21bb7a;};}var pa=class extends Qt{['arrowView'];constructor(_0x5c1abd,_0x2b3b91){super(_0x5c1abd,_0x2b3b91);const _0xe8be58=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',_0x3d4c84=>String(_0x3d4c84)),'data-cke-tooltip-disabled':_0xe8be58['to']('isOn')},'on':{'mouseenter':_0xe8be58['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x565bd2=new Yt();return _0x565bd2['content']=_0x20cf00,_0x565bd2['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x565bd2;}},ma=class extends jt{['_allListItems'];['_allSearchableItems'];constructor(_0x1cdfe9,_0x552854,_0x954dda){super(_0x1cdfe9),this['_allListItems']=_0x552854,this['_allSearchableItems']=_0x954dda;}['filter'](_0x436820){if(!_0x436820)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0xa7926a=_0x436820['source']['toLowerCase']()['trim'](),_0x5878d9=this['_allSearchableItems']['filter'](_0xd16080=>(_0xd16080['groupLabel']?_0xd16080['label']+'\x20('+_0xd16080['groupLabel']+')':_0xd16080['label'])['toLowerCase']()['includes'](_0xa7926a));return this['items']['clear'](),this['items']['addMany'](_0x5878d9['sort']((_0x54aa7b,_0x3621a8)=>{const _0x212819=_0x54aa7b['groupLabel'],_0x11269c=_0x3621a8['groupLabel'];return _0x212819||_0x11269c?_0x212819?0x1:-0x1:0x0;})['map'](_0x5c4582=>_0x5c4582['item'])),this['_highlightQuery'](_0xa7926a,_0x5878d9),{'resultsCount':_0x5878d9['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x42487a,_0x49c772){if(!_0x42487a)return;const _0x5e5d17=new RegExp(_0x49ade4(_0x42487a),'gi');_0x49c772['forEach'](_0x20240f=>{_0x20240f['highlightViews']&&_0x20240f['highlightViews']['forEach'](_0x586613=>{'function'==typeof _0x586613['highlightText']&&_0x586613['highlightText'](_0x5e5d17);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x1ea2bd=>{_0x1ea2bd['highlightViews']&&_0x1ea2bd['highlightViews']['forEach'](_0x565d45=>{'function'==typeof _0x565d45['highlightText']&&_0x565d45['highlightText'](null);});});}};const Ea='menu',Ta='menuitem';var wa=class extends _0x215f6f{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x42bb4e,_0x45b19a,_0x1b5dbb,_0x81e7b6,_0x4d9da1=!0x1,_0x481996=[]){const _0x335bd5=_0x42bb4e['locale'];super(_0x335bd5),this['_bodyCollection']=_0x81e7b6,this['_hasSearch']=_0x4d9da1,this['_actionButtons']=_0x481996;const _0x230343=this['_createListItems'](_0x42bb4e,_0x45b19a,_0x1b5dbb);this['optionsListView']=new ma(_0x335bd5,_0x230343,this['_allSearchableItems']),this['optionsListView']['role']=Ea,this['optionsListView']['items']['addMany'](_0x230343),this['focusTracker']=new dt(),this['keystrokes']=new _t(),_0x4d9da1&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x230343,this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x4d9da1&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x394e1f=_0x4d9da1&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x498844(_0x394e1f),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x335bd5['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x27b4c4(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':us(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':us(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x3609bc=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x3609bc);}['_createListItems'](_0x29763f,_0x592ccf,_0x519650){const _0x567ec2=new _0x498844();return _0x592ccf['forEach'](_0x1e487b=>{if('actions'in _0x1e487b){const {listItem:_0x36e662}=this['_createActionGroupButton'](_0x29763f,_0x1e487b,_0x519650);_0x567ec2['add'](_0x36e662),_0x1e487b['actions']['forEach'](_0x9b5de5=>{const {listItem:_0xdd107a,highlightViews:_0xb9c29}=this['_createSearchResultActionButton'](_0x29763f,_0x9b5de5,_0x1e487b['label'],_0x1e487b['icon']);this['_allSearchableItems']['push']({'item':_0xdd107a,'label':_0x9b5de5['label'],'groupLabel':_0x1e487b['label'],'highlightViews':_0xb9c29});});}else{const {listItem:_0x4d20ba}=this['_createActionButton'](_0x29763f,_0x1e487b);_0x567ec2['add'](_0x4d20ba);const _0x8b43d2=_0x4d20ba['children']['first'];if(_0x8b43d2){const {listItem:_0x13a1df,highlightViews:_0x14f769}=this['_createSearchResultActionButton'](_0x29763f,_0x1e487b);this['_allSearchableItems']['push']({'item':_0x13a1df,'label':_0x8b43d2['label']||'','highlightViews':_0x14f769});}}}),_0x567ec2;}['_createActionButton'](_0xdfba,_0x4bfb5c,_0x1ccf9a,_0x18956f){const _0x18f658=new zt(this['locale']);if(_0x1ccf9a&&_0x18956f){const _0xfd5494=new Ht(this['locale']),_0x10f766=_0xfd5494['bindTemplate'],_0x2fe8a4=new Wt();_0x2fe8a4['text']=_0x4bfb5c['label'];const _0x41cd6c=new Wt();_0x41cd6c['text']=_0x1ccf9a;const _0x55f6d6=new Yt();_0x55f6d6['content']=_0x18956f,_0x55f6d6['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x33a90a=new _0x215f6f(this['locale']);_0x33a90a['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x3df91b=new _0x215f6f(this['locale']);return _0x3df91b['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0xfd5494['set']({'label':_0x4bfb5c['label']+'\x20('+_0x1ccf9a+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x4bfb5c['isEnabled']}),_0xfd5494['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x10f766['if']('isEnabled','ck-disabled',_0x37ba55=>!_0x37ba55)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x2fe8a4,_0x33a90a,_0x55f6d6,_0x41cd6c,_0x3df91b],'on':{'mouseenter':_0x10f766['to'](()=>{this['_isSearchFocused']()||_0xfd5494['focus']();}),'click':_0x10f766['to'](()=>{_0xfd5494['fire']('execute');})}}),_0xfd5494['on']('execute',()=>{_0xfd5494['isEnabled']&&(_0xdfba['editing']['view']['focus'](),_0xdfba['commands']['execute']('aiQuickAction',_0x4bfb5c));}),_0x18f658['children']['add'](_0xfd5494),this['_actionButtons']['push']({'buttonView':_0xfd5494,'action':_0x4bfb5c}),{'listItem':_0x18f658,'highlightViews':[_0x2fe8a4,_0x41cd6c]};}{const _0x169ae0=new Pt(),_0xb6962a=new Ht(this['locale'],_0x169ae0),_0x413108=_0xb6962a['bindTemplate'],_0x5a1a03=_0x4bfb5c['icon']??_0x4bfb5c['parent']?.['icon'],_0x49c3bd=void 0x0!==_0x4bfb5c['icon'];return _0xb6962a['set']({'label':_0x4bfb5c['label'],'withText':!0x0,'role':'menuitem','icon':_0x49c3bd?_0x5a1a03??_0x27a3d4:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x4bfb5c['isEnabled']}),_0xb6962a['extendTemplate']({'on':{'mouseenter':_0x413108['to'](()=>{this['_isSearchFocused']()||_0xb6962a['focus']();})}}),_0xb6962a['on']('execute',()=>{_0xdfba['editing']['view']['focus'](),_0xdfba['commands']['execute']('aiQuickAction',_0x4bfb5c);}),_0x18f658['children']['add'](_0xb6962a),this['_actionButtons']['push']({'buttonView':_0xb6962a,'action':_0x4bfb5c}),{'listItem':_0x18f658,'highlightViews':[_0x169ae0]};}}['_createSearchResultActionButton'](_0x565aaa,_0x257ea6,_0x540289,_0x35a08b){return _0x540289&&_0x35a08b?this['_createSearchResultGroupedActionButton'](_0x565aaa,_0x257ea6,_0x540289,_0x35a08b):this['_createSearchResultIndividualActionButton'](_0x565aaa,_0x257ea6);}['_createSearchResultGroupedActionButton'](_0x959375,_0x3235bc,_0x4c8db6,_0x51d944){const _0x55cca4=new zt(this['locale']),_0x887346=new Ht(this['locale']),_0x59bad4=_0x887346['bindTemplate'],{view:_0x48ea71,highlightView:_0xa7a1cb}=this['_createSearchResultGroupRow'](_0x4c8db6,_0x51d944),{view:_0x578899,highlightView:_0x2b592e}=this['_createSearchResultActionRow'](_0x3235bc['label']),_0x14e665=this['_createSearchResultContentView'](_0x48ea71,_0x578899);return _0x887346['set']({'label':_0x3235bc['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,'isEnabled':_0x3235bc['isEnabled']}),_0x887346['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',_0x59bad4['if']('isEnabled','ck-disabled',_0x5a6a15=>!_0x5a6a15)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x14e665],'on':{'mouseenter':_0x59bad4['to'](()=>{this['_isSearchFocused']()||_0x887346['focus']();}),'click':_0x59bad4['to'](()=>{this['_handleSearchResultButtonClick'](_0x887346);})}}),this['_setupActionButtonExecution'](_0x887346,_0x959375,_0x3235bc),_0x55cca4['children']['add'](_0x887346),this['_actionButtons']['push']({'buttonView':_0x887346,'action':_0x3235bc}),{'listItem':_0x55cca4,'highlightViews':[_0xa7a1cb,_0x2b592e]};}['_createSearchResultIndividualActionButton'](_0x417acc,_0x592e57){const _0x44732b=new zt(this['locale']),_0x32f6ec=new Pt(),_0x1cc766=new Ht(this['locale'],_0x32f6ec),_0x49811a=_0x1cc766['bindTemplate'];return _0x1cc766['set']({'label':_0x592e57['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x592e57['isEnabled']}),_0x1cc766['extendTemplate']({'on':{'mouseenter':_0x49811a['to'](()=>{this['_isSearchFocused']()||_0x1cc766['focus']();})}}),this['_setupActionButtonExecution'](_0x1cc766,_0x417acc,_0x592e57),_0x44732b['children']['add'](_0x1cc766),this['_actionButtons']['push']({'buttonView':_0x1cc766,'action':_0x592e57}),{'listItem':_0x44732b,'highlightViews':[_0x32f6ec]};}['_createSearchResultGroupRow'](_0xed535e,_0x2d8010){const _0x48a4fe=new _0x215f6f(this['locale']),_0x376eda=new Yt();_0x376eda['content']=_0x2d8010,_0x376eda['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x5f559b=new Wt();return _0x5f559b['text']=_0xed535e,_0x48a4fe['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x376eda,_0x5f559b]}),{'view':_0x48a4fe,'highlightView':_0x5f559b};}['_createSearchResultActionRow'](_0xcd17bd){const _0x26c41e=new _0x215f6f(this['locale']),_0x9a5e44=new Wt();return _0x9a5e44['text']=_0xcd17bd,_0x26c41e['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x9a5e44]}),{'view':_0x26c41e,'highlightView':_0x9a5e44};}['_createSearchResultContentView'](_0x1a042e,_0x4066e5){const _0x8579b0=new _0x215f6f(this['locale']);return _0x8579b0['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x1a042e,_0x4066e5]}),_0x8579b0;}['_setupActionButtonExecution'](_0x5f134f,_0x23f385,_0x3b88e1){_0x5f134f['on']('execute',()=>{_0x5f134f['isEnabled']&&(_0x23f385['editing']['view']['focus'](),_0x23f385['commands']['execute']('aiQuickAction',_0x3b88e1));});}['_createActionGroupButton'](_0x4e3be1,_0xd0fd1a,_0x109ac6){const _0x3f0d57=new zt(this['locale']),_0x3e8d1c=new Pt(),_0x5ebffc=new pa(this['locale'],_0x3e8d1c),_0x4f4f6d=_0x5ebffc['bindTemplate'],_0x461d8f=this['_getPanelKeystroke'](_0x109ac6),_0x2cbea5=this['_createGroupActionsList'](_0x4e3be1,_0xd0fd1a['actions'],_0x109ac6);_0x5ebffc['set']({'label':_0xd0fd1a['label'],'withText':!0x0,'role':Ta,'icon':_0xd0fd1a['icon']??_0x27a3d4,'isEnabled':_0xd0fd1a['actions']['some'](_0x3f694b=>_0x3f694b['isEnabled'])}),_0x5ebffc['extendTemplate']({'on':{'mouseenter':_0x4f4f6d['to'](()=>{this['_isSearchFocused']()||_0x5ebffc['focus']();})}});const _0xf0bddc=new yt(this['locale']);return _0xf0bddc['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x4f4f6d['to'](_0x204520=>{this['_handlePanelKeydown'](_0x204520,_0x461d8f,_0x5ebffc,_0xf0bddc);})}}),_0x5ebffc['bind']('isOn')['to'](_0xf0bddc,'isVisible'),this['_bodyCollection']['add'](_0xf0bddc),_0xf0bddc['content']['add'](_0x2cbea5),this['_setupGroupMenuBehavior'](_0x5ebffc,_0xf0bddc),_0x3f0d57['children']['add'](_0x5ebffc),this['_actionButtons']['push']({'buttonView':_0x5ebffc,'action':_0xd0fd1a}),{'listItem':_0x3f0d57,'highlightView':_0x3e8d1c};}['_createGroupActionsList'](_0x2a90fa,_0x4757f1,_0x2bf3aa){const _0x3bb53e=new jt(this['locale']);return _0x3bb53e['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x4757f1['forEach'](_0x769fa2=>{const _0x229d35=new zt(this['locale']),_0x16feae=Ia({'editor':_0x2a90fa,'action':_0x769fa2,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x229d35['children']['add'](_0x16feae),_0x2bf3aa['focusTracker']['add'](_0x16feae),_0x3bb53e['items']['add'](_0x229d35);}),_0x3bb53e;}['_setupGroupMenuBehavior'](_0x55db99,_0x30ae06){const _0x300d69=_0x55db99['bindTemplate'],_0x99adb1=this['_getButtonKeystroke'](_0x55db99);_0x55db99['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x300d69['to'](()=>{this['_showNestedPanel'](_0x30ae06,_0x55db99);}),'mouseleave':_0x300d69['to'](_0x44b9fe=>{const _0x3e9bf9=_0x44b9fe['relatedTarget'];this['_isMovingToNestedMenu'](_0x3e9bf9,_0x30ae06)||this['_hideNestedPanel'](_0x30ae06);}),'keydown':_0x300d69['to'](_0x555d04=>{_0x555d04['key']==_0x99adb1&&(this['_showNestedPanel'](_0x30ae06,_0x55db99),_0x30ae06['content']['get'](0x0)['focus']());})}}),_0x30ae06['on']('render',()=>{_0x30ae06['element']?.['addEventListener']('mouseleave',_0x1854b1=>{const _0x1a10b=_0x1854b1['relatedTarget'];_0x55db99['element']?.['contains'](_0x1a10b)||this['_isMovingToNestedMenu'](_0x1a10b,_0x30ae06)||this['_hideNestedPanel'](_0x30ae06);});});}['_showNestedPanel'](_0x4dd373,_0x3640da){this['_openNestedPanels']['forEach'](_0xb097f4=>{_0xb097f4!==_0x4dd373&&_0xb097f4['isVisible']&&_0xb097f4['hide']();}),_0x4dd373['show'](),_0x4dd373['pin']({'positions':[Ut['eastSouth']],'target':_0x3640da['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x4dd373);}['_hideNestedPanel'](_0x4eb99a){_0x4eb99a['hide'](),this['_openNestedPanels']['delete'](_0x4eb99a);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x43de34=>_0x43de34['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x5335ea,_0x11fcab){if(!_0x5335ea)return!0x1;if(_0x11fcab['element']?.['contains'](_0x5335ea))return!0x0;const _0x223586=_0x5335ea;return _0x223586['closest']&&(null!==_0x223586['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x223586['closest']('.ck-ai-quick-actions-group-list')||null!==_0x223586['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'](_0x3079d8){return'rtl'===_0x3079d8['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x5a1af2){return'rtl'===_0x5a1af2['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x23669f,_0x46f9f1,_0x4cb4f5,_0x54eabd){_0x23669f['key']==_0x46f9f1&&(_0x4cb4f5['focus'](),this['_hideNestedPanel'](_0x54eabd));}['_handleSearchResultButtonClick'](_0x12e36c){_0x12e36c['fire']('execute');}};function Ca(_0x14b981){const {editor:_0x1957cf,content:_0x3d254d,buttonDefinition:_0xa35693,bodyCollection:_0x79afeb,hasSearch:_0x487694=!0x1,actionButtons:_0x554e85}=_0x14b981;return()=>{const _0x47d8dc=_0x1957cf['locale'],_0x2087e0=_0x1957cf['commands']['get']('aiQuickAction'),_0x2b800c=_0x32dc43(_0x47d8dc);_0x2b800c['bind']('isEnabled')['to'](_0x2087e0),_0x2b800c['buttonView']['set']({'icon':_0xa35693['icon']??_0x27a3d4,'label':_0xa35693['label'],'tooltip':!0x0}),_0x2b800c['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x254f7a=new wa(_0x1957cf,_0x3d254d,_0x2b800c,_0x79afeb,_0x487694,_0x554e85);return _0x2b800c['panelView']['children']['add'](_0x254f7a),_0x487694&&_0x2b800c['on']('change:isOpen',(_0xb7895e,_0x271d43,_0x36a7e8)=>{if(_0x36a7e8){if(_0x1957cf['plugins']['has']('AIEditing')){const _0x5acd71=_0x1957cf['plugins']['get'](Is),_0x2df9bc=_0x1957cf['model']['document']['selection'],_0x39d360=Array['from'](_0x2df9bc['getRanges']());_0x39d360['length']>0x0&&_0x5acd71['showFakeVisualSelection']({'editor':_0x1957cf,'ranges':_0x39d360,'id':'quick-action','priority':0x14});}}else _0x1957cf['plugins']['has']('AIEditing')&&_0x1957cf['plugins']['get'](Is)['hideFakeVisualSelection']('quick-action'),_0x254f7a['resetSearch']();}),_0x2b800c;};}const fa='<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>',ba='<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>',Sa='<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>',Ra=/* #__PURE__ -- @preserve */
37
+ ((()=>({'chat':'AIChat','action':'AIActions'}))());var Oa=class AIQuickActionsUI extends _0x3688ab{['_actionButtons']=[];['_menuBarGroupViews']=[];['_reporter'];static get['requires'](){return[xt,ls,nn];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_reporter']=this['editor']['plugins']['get'](nn)['createReporter']('aiquickactions');const _0x181189=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x181189),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0x1a38e2){return function(_0x7bf58c){const _0x2cf7c8=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x7bf58c['uiLanguage'])||'English';return[{'id':'ask-ai','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x573020},{'id':'chat-commands','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x573020,'actions':[{'id':'explain','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':us(_0x7bf58c,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':fa['replace']('%0',_0x2cf7c8),'type':'chat'},{'id':'summarize','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':us(_0x7bf58c,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':ba['replace']('%0',_0x2cf7c8),'type':'chat'},{'id':'highlight-key-points','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':us(_0x7bf58c,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Sa['replace']('%0',_0x2cf7c8),'type':'chat'}]},{'id':'improve-writing','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x1382e4},{'id':'continue','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x33e37e},{'id':'fix-grammar','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0xc4a56a},{'id':'adjust-length','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x4bdbb4,'actions':[{'id':'make-shorter','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0xc3c3ab,'actions':[{'id':'make-tone-casual','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x4dd947,'actions':[{'id':'translate-to-english','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':us(_0x7bf58c,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x1c72b8,'actions':[]}];}(_0x1a38e2);}['_getDefaultAndCustomActions'](){const _0x1628b4=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x292f45=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x35a5cf=>({..._0x35a5cf,'type':'chat'===_0x35a5cf['type']?'chat':'action','icon':void 0x0}));return _0x1628b4['find'](_0x11be94=>'other'===_0x11be94['id'])['actions']['push'](..._0x292f45),_0x1628b4;}async['_initActionTypeQuickActions'](){try{const _0xd60cb0=new Qs({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0x2ee4d3=await _0xd60cb0['getAll'](),_0x148234=(await _0xd60cb0['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x148234),this['_enableButtonsByType']('action',_0x93ba54=>!!_0x2ee4d3['find'](_0x45b0bd=>_0x45b0bd['id']===_0x93ba54['model'])||void 0x0===_0x93ba54['model']);}catch(_0x21cfb1){const _0x59f6f5=new ht('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x21cfb1});this['_reporter']['logError'](_0x59f6f5);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x3afe8b=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x3afe8b,'change:isConversationReady',(_0xa2d3a6,_0x49bfdc,_0x471049)=>{_0x471049&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x3afe8b['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0x484179,_0x28f707){this['_quickActionsDefinition']['forEach'](_0x4236d1=>{'actions'in _0x4236d1?_0x4236d1['actions']['forEach'](_0x12d346=>{_0x12d346['type']===_0x484179&&(_0x12d346['isEnabled']=_0x28f707(_0x12d346));}):_0x4236d1['type']===_0x484179&&(_0x4236d1['isEnabled']=_0x28f707(_0x4236d1));}),this['_actionButtons']['forEach'](_0x7183d=>{if(va(_0x7183d['action']))return;if(_0x7183d['action']['type']!==_0x484179)return;const _0x36c982=_0x28f707(_0x7183d['action']);if(_0x7183d['action']['isEnabled']=_0x36c982,_0x7183d['buttonView']['isEnabled']=_0x36c982,!_0x36c982&&_0x7183d['action']['model']){const _0x397d61=new ht('ai-quick-actions-unavailable-model',this,{'actionId':_0x7183d['action']['id'],'modelId':_0x7183d['action']['model']});this['_reporter']['logError'](_0x397d61);}}),this['_actionButtons']['filter'](_0x26702c=>va(_0x26702c['action']))['forEach'](_0x19b4b2=>{_0x19b4b2['buttonView']['isEnabled']=_0x19b4b2['action']['actions']['some'](_0x39fe28=>_0x39fe28['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x1d64a8,group:_0x597a6d})=>{_0x1d64a8['isEnabled']=_0x597a6d['actions']['some'](_0x252706=>_0x252706['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0x313297){this['_actionButtons']['forEach'](_0x30b98d=>{va(_0x30b98d['action'])||'action'===_0x30b98d['action']['type']&&(_0x30b98d['action']['model']||(_0x30b98d['action']['model']=_0x313297));});}['_initializeQuickActionsComponentsAndCommands'](){const _0x3a1129=new Lt(this['editor']['locale']);_0x3a1129['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x3a1129),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x3a1129);}['_initializeQuickActionsDropdown'](_0x5a8e0a){const _0x923f44=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',Ca({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x27a3d4,'label':us(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x5a8e0a,'hasSearch':_0x923f44,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0x345850){this['_quickActionsDefinition']=_0x345850['map'](_0x39dca0=>{if('actions'in _0x39dca0){const _0x3f6a96=_0x39dca0;return{..._0x3f6a96,'actions':_0x3f6a96['actions']['map'](_0x5cc6c6=>{const {actions:_0x33482a,..._0x46b24}=_0x3f6a96;return{..._0x5cc6c6,'isEnabled':!0x1,'parent':_0x46b24};})['filter'](_0x23ed9b=>this['_shouldIncludeAction'](_0x23ed9b))};}return{..._0x39dca0,'isEnabled':!0x1};})['filter'](_0x34edde=>'actions'in _0x34edde?_0x34edde['actions']['length']>0x0:this['_shouldIncludeAction'](_0x34edde));}['_shouldIncludeAction'](_0x1dc363){const _0x56e427=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](Ra[_0x1dc363['type']])&&!_0x56e427['includes'](_0x1dc363['id'])&&!('chat'===_0x1dc363['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x4c58a9){this['_quickActionsDefinition']['forEach'](_0x98a1a1=>{if('actions'in _0x98a1a1){const _0x1b624b=Ca({'editor':this['editor'],'content':_0x98a1a1['actions'],'buttonDefinition':_0x98a1a1,'bodyCollection':_0x4c58a9,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x98a1a1['id'],_0x1b624b),_0x98a1a1['actions']['forEach'](_0x530ca2=>{const _0x5cc14c=Ia({'editor':this['editor'],'action':_0x530ca2,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x530ca2['id'],_0x5cc14c);});}else{const _0x5a0b7a=Ia({'editor':this['editor'],'action':_0x98a1a1,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x98a1a1['id'],_0x5a0b7a);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x5a5d77=>{const _0x231081=this['editor']['commands']['get']('aiQuickAction'),_0xc79c27=new _0x42746f(_0x5a5d77),_0x5172f5=us(_0x5a5d77,'AI_QUICK_ACTIONS_HEADING');_0xc79c27['buttonView']['set']({'label':_0x5172f5,'icon':_0x27a3d4});const _0x356643=new te(_0x5a5d77);return _0x356643['set']({'ariaLabel':_0x5172f5,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x284fe3=>{if('actions'in _0x284fe3){const _0x13e5fd=_0x284fe3,_0x2a3a03=new Zt(_0x5a5d77,_0xc79c27),_0x212004=new _0x42746f(_0x5a5d77),_0x82afa9=new te(_0x5a5d77);_0x212004['buttonView']['set']({'label':_0x13e5fd['label'],'icon':_0x13e5fd['icon']}),_0x13e5fd['actions']['forEach'](_0x20cae8=>{const _0x1ec055=new Zt(_0x5a5d77,_0x212004),_0x7195f4=new Jt(_0x5a5d77);_0x7195f4['set']({'label':_0x20cae8['label'],'icon':_0x20cae8['icon'],'role':'menuitem','isEnabled':_0x20cae8['isEnabled']}),_0x7195f4['on']('execute',()=>{this['_executeQuickAction'](_0x20cae8);}),this['_actionButtons']['push']({'buttonView':_0x7195f4,'action':_0x20cae8}),_0x7195f4['delegate']('execute')['to'](_0x212004),_0x1ec055['children']['add'](_0x7195f4),_0x82afa9['items']['add'](_0x1ec055);}),_0x212004['isEnabled']=_0x13e5fd['actions']['some'](_0x56a7a4=>_0x56a7a4['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x212004,'group':_0x13e5fd}),_0x212004['panelView']['children']['add'](_0x82afa9),_0x2a3a03['children']['add'](_0x212004),_0x356643['items']['add'](_0x2a3a03);}else{const _0x36e377=_0x284fe3,_0x292cc8=new Zt(_0x5a5d77,_0xc79c27),_0xb065c2=new Jt(_0x5a5d77);_0xb065c2['set']({'label':_0x36e377['label'],'icon':_0x36e377['icon'],'role':'menuitem','isEnabled':_0x36e377['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0xb065c2,'action':_0x36e377}),_0xb065c2['on']('execute',()=>{this['_executeQuickAction'](_0x36e377);}),_0xb065c2['delegate']('execute')['to'](_0xc79c27),_0x292cc8['children']['add'](_0xb065c2),_0x356643['items']['add'](_0x292cc8);}}),Object['values'](Ra)['some'](_0x5711dd=>this['editor']['plugins']['has'](_0x5711dd))?_0xc79c27['bind']('isEnabled')['to'](_0x231081):_0xc79c27['set']({'isEnabled':!0x1}),_0xc79c27['panelView']['children']['add'](_0x356643),_0xc79c27;});}['_executeQuickAction'](_0x521ddf){const _0x49dec1=this['editor'];_0x49dec1['editing']['view']['focus'](),_0x49dec1['commands']['execute']('aiQuickAction',_0x521ddf);const _0x207a76=_0x49dec1['ui']['view']['menuBarView'];_0x207a76&&_0x207a76['close']&&_0x207a76['close']();}};function va(_0x19e899){return'actions'in _0x19e899;}function ka(_0x1e8821,_0x510cb0){const _0x766ae9=_0x1e8821['plugins']['get']('AITabs')['view'];_0x766ae9['isVisible']=!0x0,_0x766ae9['activateTab'](_0x510cb0);}var Na=class extends _0x24f2c3{['execute'](_0x5767c8){switch(this['_expandSelectionIfCollapsed'](),_0x5767c8['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x3e54bc=us(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x3e54bc});}this['_handleAIChatAction'](_0x5767c8);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x57dde8=us(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x57dde8});}this['_handleAIActionsAction'](_0x5767c8);}}async['_handleAIChatAction'](_0x106c06){const _0x323005=this['editor']['plugins']['get']('AIChatController');if(ka(this['editor'],'chat'),'ask-ai'===_0x106c06['id'])_0x323005['removeSelectionFromChatContext'](),_0x323005['addSelectionToChatContext'](this['editor']),_0x323005['focusPromptInput']();else await _0x323005['startConversation']({'modelId':_0x106c06['model']}),_0x323005['removeSelectionFromChatContext'](),_0x323005['addSelectionToChatContext'](this['editor']),_0x323005['focusPromptInput'](),await _0x323005['sendMessage']({'message':_0x106c06['prompt']||_0x106c06['displayedPrompt']||_0x106c06['label'],'attributes':{'quickActionData':{'id':_0x106c06['id']},'displayedPrompt':_0x106c06['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x3f61e6=this['editor'],_0x5812b0=_0x3f61e6['model']['document']['selection'];if(!_0x5812b0['isCollapsed'])return;const _0x141e5f=mt(_0x5812b0['getSelectedBlocks']())||_0x3f61e6['model']['schema']['getLimitElement'](_0x5812b0);_0x3f61e6['model']['change'](_0x343243=>{_0x343243['setSelection'](_0x141e5f,'in');});}['_handleAIActionsActionLabel'](_0x4ed8af){return _0x4ed8af['parent']?.['label']&&'other'!==_0x4ed8af['parent']?.['id']?_0x4ed8af['parent']['label']+':\x20'+_0x4ed8af['label']:_0x4ed8af['label'];}async['_handleAIActionsAction'](_0x5e9711){const _0x576cbc=this['editor']['plugins']['get']('AIActions'),_0x5aa037=_0x5e9711['prompt']?{'userMessage':_0x5e9711['prompt'],'model':_0x5e9711['model']}:{'actionName':_0x5e9711['actionName']||_0x5e9711['id'],'args':_0x5e9711['args']},_0x2305b5=this['_handleAIActionsActionLabel'](_0x5e9711);await _0x576cbc['executeAction'](_0x5aa037,_0x2305b5,_0x5e9711['icon']);}},ya=class extends _0x3688ab{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x547347=this['editor'],_0x51e5bf=new Na(this['editor']);if(_0x547347['commands']['add']('aiQuickAction',_0x51e5bf),_0x547347['plugins']['has']('AIChat')){const _0x5ee42a=this['editor']['plugins']['get']('AIChatController');_0x547347['model']['document']['selection']['on']('change:range',(_0x183a8c,_0x1d2a21)=>{_0x1d2a21['directChange']&&_0x5ee42a['removeSelectionFromChatContext']();});}}},xa=class extends dn{['appendContent'](_0x3b31f8,_0x4deadd='text'){'modification'===this['type']&&'text'===_0x4deadd&&(_0x4deadd=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x3b31f8,_0x4deadd);}['updateChangeGroups'](_0x54abe1){const _0x5fd03b=this['parsedContent']['get'](_0x54abe1)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x54abe1,_0x5fd03b),this['changeGroups']=[],0x0==_0x5fd03b['childNodes']['length'])return;Ds(this['documentContextContent']['get'](_0x54abe1),this['parsedMergedContent']['get'](_0x54abe1));const _0x271284=_0x118114(this['documentContextContent']['get'](_0x54abe1)['children']['map'](_0xe81bba=>({'node':_0xe81bba,'id':fs(_0xe81bba,'data-id')})),_0x5fd03b['children']['map'](_0x419110=>({'node':_0x419110,'id':fs(_0x419110,'data-id')||vt()})),{'comparator':(_0x5cec35,_0x4f190b)=>_0x5cec35['id']==_0x4f190b['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x271284['length']&&_0x271284[_0x271284['length']-0x1]['removed'];)_0x271284['pop']();}const _0x40316b=_0x271284['map'](_0x426a8e=>{const _0x966466=_0x426a8e['added']?'new':_0x426a8e['removed']?'removed':'modified';return{'node':_0x426a8e['value'][0x0]['node'],'type':_0x966466,'id':_0x426a8e['value'][0x0]['id']};}),_0x10f44a=this['_documentIdToSource']['get'](_0x54abe1);this['changeGroups']['push']({'changes':_0x40316b,'state':'pending','index':this['changeGroups']['length'],'editor':_0x10f44a['editor'],'rootName':_0x10f44a['rootName'],'documentId':_0x54abe1});}['_getDifferentChangeGroups'](_0x158347,_0x1dcf79){return _0x1dcf79;}},La=class extends An{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x13246d){super(_0x13246d),this['content']=_0x13246d['content'],this['version']=_0x13246d['version'],this['editor']=_0x13246d['editor'],this['rootName']=_0x13246d['rootName'],this['actionName']=_0x13246d['actionName'],this['args']=_0x13246d['args'],this['userMessage']=_0x13246d['userMessage'],this['model']=_0x13246d['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':'document','documents':[{'id':this['id'],'content':this['content'],'version':this['version'],'rootName':this['rootName'],'sessionId':vt(),'channelId':this['editor']['config']['get']('collaboration.channelId')}],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x52a87d){const _0x2c43f3=this['editor']['config']['get']('collaboration.channelId'),_0x26d376=new xa({..._0x52a87d,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x2c43f3,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x2c43f3,this['editor']]])});return this['replies']['push'](_0x26d376),_0x26d376['delegate'](...gn)['to'](this),this['fire']('replyCreated',_0x26d376),_0x26d376;}},Da=class extends _0x116a57{constructor(_0x598b69,_0x3df8fd=!0x0,_0x5d108a=!0x0){super(_0x598b69),this['set']('isEnabled',!0x1),_0x3df8fd&&(this['applyButton']=this['_createButton'](us(_0x598b69,'AI_BALLOON_APPLY_BUTTON'),on),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x5d108a&&(this['suggestButton']=this['_createButton'](us(_0x598b69,'AI_BALLOON_SUGGEST_BUTTON'),_0x3df8fd?an:on),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x3df8fd,'showSuggestButton':_0x5d108a}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x3c270e,showSuggestButton:_0x1e2362}){this['applyButton']&&(this['applyButton']['isVisible']=_0x3c270e),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x1e2362);}['_createButton'](_0x508188,_0x514b47){const _0xe7efa2=new Ht(this['locale']);return _0xe7efa2['set']({'label':_0x508188,'class':_0x514b47,'isVisible':!0x0,'withText':!0x0}),_0xe7efa2;}},Pa=class extends _0x215f6f{constructor(_0x54c882){super(_0x54c882),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':us(_0x54c882,'AI_DISCLAIMER_TEXT')}]}]});}},Ha=class extends _0x215f6f{constructor(_0x1d0250){super(_0x1d0250),this['set']('isVisible',!0x0);const _0x445044=new cr('small');_0x445044['isVisible']=!0x0;const _0x7e7436=new _0x215f6f(this['locale']);_0x7e7436['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[us(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x1dc91d=>!_0x1dc91d)]},'children':[_0x445044,_0x7e7436]});}},Ma=class extends ha{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x535eb7,_0xe128b){super(_0x535eb7),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0xe128b,this['_focusTracker']=new dt(),this['_keystrokes']=new _t(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x498844(),this['_addContentWrapper'](_0xe128b),this['_addDisclaimerView'](),this['_addToolbar'](_0xe128b),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'](_0xe128b);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x173f9c of this['_focusables'])this['_focusTracker']['add'](_0x173f9c['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0xdf150d){-0x1===_0xdf150d?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x36842e){this['_isLoading']=_0x36842e;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x1b8600){super['showError'](_0x1b8600),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x3240ad){super['showBlockingError'](_0x3240ad),this['setErrorState']();}['addMiniToolbarItem'](_0x3fd1b8){this['_miniToolbarView']['items']['has'](_0x3fd1b8)||this['_miniToolbarView']['items']['add'](_0x3fd1b8);}['removeMiniToolbarItem'](_0x5a2b7c){this['_miniToolbarView']['items']['has'](_0x5a2b7c)&&this['_miniToolbarView']['items']['remove'](_0x5a2b7c);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x3a6700,showSuggestButton:_0x420199}){_0x3a6700=_0x3a6700&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x420199=_0x420199&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x3a6700,'showSuggestButton':_0x420199});}async['updateContent'](_0x9b8ba8){await this['_streamableContentView']['update'](_0x9b8ba8);}['finalizeContent'](){this['_streamableContentView']['cleanUpStreamingArtifacts']();}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x29de0c){this['_contentWrapper']=new _0x215f6f(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content',this['bindTemplate']['if']('_isErrorVisible','ck-hidden')]},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x29de0c['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new Pa(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x1d730f,showSuggestButton:_0x323b6e}){this['_toolbarView']=new Da(this['locale'],_0x1d730f,_0x323b6e),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',(_0x25ba34,_0x45cec4,_0x574f10)=>!(_0x25ba34||_0x45cec4||_0x574f10)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x1d730f,'showSuggestButton':_0x323b6e}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x5b6b9d){return this['_miniToolbarView']=new ua(this['locale'],_0x5b6b9d),this['_miniToolbarView']['delegate'](...Nn)['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',(_0x106f74,_0x8d63aa)=>!(_0x106f74||_0x8d63aa)),this['_miniToolbarView'];}['_createLoaderView'](){return this['_loaderView']=new Ha(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}['_createStreamableContentView'](){return this['_streamableContentView']=new qn(this['locale']),this['_streamableContentView'];}['_setupMiniToolbarButtons'](){const _0x8619e8=new Ht(this['locale']),_0x6e276b=new Ht(this['locale']),_0x2a4608=new Va(this['locale']),_0x254468=new Ht(this['locale']);_0x8619e8['set']({'icon':_0xd0bd37,'label':us(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+hn}),_0x6e276b['set']({'icon':_0x1901d7,'tooltip':us(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+hn}),_0x254468['set']({'icon':_0x1a35f7,'tooltip':us(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+hn}),_0x8619e8['bind']('isEnabled')['to'](this,'isBusy',_0xa09580=>!_0xa09580),_0x8619e8['on']('execute',()=>{this['fire']('tryAgain');}),_0x6e276b['bind']('isEnabled')['to'](this,'isBusy',_0x1b0000=>!_0x1b0000),_0x6e276b['on']('execute',()=>{this['fire']('showPrevious');}),_0x254468['bind']('isEnabled')['to'](this,'isBusy',_0x48c90b=>!_0x48c90b),_0x254468['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x6e276b,this['_navigationCounter']=_0x2a4608,this['_navigationNextButton']=_0x254468,this['_navigationTryAgainButton']=_0x8619e8;}['updateMiniToolbarButtons'](_0x21d471,_0x42faf0){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x3182df=_0x21d471>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x3182df){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x3ed1ab=_0x21d471-_0x42faf0;this['_navigationCounter']['setInteractionCount'](_0x3ed1ab+'/'+_0x21d471),this['_navigationPreviousButton']['isEnabled']=_0x42faf0<_0x21d471-0x1,this['_navigationNextButton']['isEnabled']=_0x42faf0>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'](_0x11b610){this['_isLoading']=_0x11b610;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_setupMiniToolbarPositioning'](){const _0x3a5b43=this['_streamableContentView']['element'],_0x527595=this['_miniToolbarView']['element'],_0x8a90ed=()=>{Tt['window']['requestAnimationFrame'](()=>{const _0x343bb1=_0x3a5b43['offsetWidth']-_0x3a5b43['clientWidth'];_0x527595['style']['right']='calc('+_0x343bb1+'px\x20+\x20var(--ck-spacing-large))';});};_0x8a90ed(),this['_miniToolbarResizeObserver']=new It(_0x3a5b43,()=>{_0x8a90ed();});}['_initializeScrollManager'](){const _0x11e337=this['_getScrollableElement']();_0x11e337&&!this['_scrollManager']&&(this['_scrollManager']=new Pr(_0x11e337));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}},Va=class extends _0x215f6f{constructor(_0x23a665){super(_0x23a665);const _0x29034a=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x29034a['to']('interactionCount')}]});}['setInteractionCount'](_0x41e7bb){this['set']('interactionCount',_0x41e7bb);}},Ua=class extends _0x3688ab{static get['requires'](){return[ls,nn,Mt,Is,la,_0x1cf5c4];}static get['pluginName'](){return'AIActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_aiConnector'];['_interactions']=[];['_currentInteractionIndex']=0x0;['_interactionParams'];['_balloonShowDiff']=!0x1;['_promiseQueue'];get['_interaction'](){return this['_interactions'][this['_interactions']['length']-0x1];}['_actionsBalloonView'];['_reporter'];constructor(_0x75e961){super(_0x75e961),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['_reporter']=this['editor']['plugins']['get'](nn)['createReporter']('aiactions'),this['set']('isBusy',!0x1),this['_promiseQueue']=new Zn();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x2e2738,_0x131967,_0x1df22a){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x146944,anchorData:_0x5cd27e,root:_0x2eb286}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x2e2738,_0x146944,_0x5cd27e,_0x2eb286,_0x131967,_0x1df22a);}const {modelFragment:_0x1feb72,anchorData:_0x8851de,root:_0x317905}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x2e2738,_0x1feb72,_0x8851de,_0x317905,_0x131967,_0x1df22a);}async['destroy'](){return this['_stopInteraction'](),super['destroy']();}['_createActionsBalloonView'](){const _0x3d8b64=this['editor']['plugins']['has']('TrackChanges');let _0x53163f=this['editor']['config']['get']('ai.availableReplyActions')||[...er];_0x3d8b64||(_0x53163f=_0x53163f['filter'](_0x89d4=>'insertSuggestion'!=_0x89d4));const _0xcbf5e8=this['editor']['commands']['get']('trackChanges'),_0x2e7a02=new Ma(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x3d8b64,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x53163f});return _0x2e7a02['bind']('isBusy')['to'](this),_0xcbf5e8&&_0x2e7a02['bind']('isTrackChangesOn')['to'](_0xcbf5e8,'value'),_0x2e7a02['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x2e7a02['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x2e7a02['on']('showNext',()=>{this['_navigateToNext']();}),_0x2e7a02;}['_normalizeSelectionStart'](){const _0x54de6b=this['editor']['model'],_0x3c758f=_0x54de6b['document']['selection'],_0x2dcd7d=_0x3c758f['getFirstRange']();if(!_0x2dcd7d||_0x2dcd7d['isCollapsed'])return;const _0x43f52e=mt(_0x3c758f['getSelectedBlocks']());if(!_0x43f52e)return;const _0x8e306b=_0x54de6b['createPositionAt'](_0x43f52e,0x0);_0x8e306b['isAfter'](_0x2dcd7d['start'])&&_0x54de6b['change'](_0x2d239c=>{_0x2d239c['setSelection'](_0x2d239c['createRange'](_0x8e306b,_0x2dcd7d['end']));});}['_getExecuteDataRegular'](){const _0x271bf4=this['editor']['model']['document']['selection'],_0x4ac055=_0x271bf4['getFirstRange']()['start']['root'];if(_0x271bf4['isCollapsed']){const _0x4b3879=mt(_0x271bf4['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x271bf4);this['editor']['model']['change'](_0xb054b1=>{_0xb054b1['setSelection'](_0x4b3879,'in');});}this['_normalizeSelectionStart']();const _0x3682f1=_0x271bf4['getFirstRange'](),_0x2aa2f6=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x271bf4),_0x3682f1['start'],_0x3682f1['end']);this['_copyMarkersToFragment'](_0x2aa2f6,_0x271bf4,{'isTableSelection':!0x1});const _0x2b7918=_0x271bf4['getFirstRange']()['start'],_0x345c73=new Map();let _0x34d576=_0x2aa2f6;for(let _0x5d6b9c=0x0;_0x5d6b9c<_0x2b7918['path']['length'];_0x5d6b9c++)_0x345c73['set'](_0x34d576,_0x2b7918['path'][_0x5d6b9c]),_0x34d576=_0x34d576['getChild'](0x0);return{'modelFragment':_0x2aa2f6,'anchorData':_0x345c73,'root':_0x4ac055};}['_getExecuteDataInTable'](){const _0x323079=this['editor']['model']['document']['selection'],_0x30d8b7=this['editor']['plugins']['get']('TableSelection'),_0x5410ad=_0x323079['getFirstRange']()['start']['root'],_0x1864f3=_0x30d8b7['getSelectionAsFragment'](),_0x3303da=_0x323079['getFirstRange']()['start']['parent']['parent'],_0x291b4d=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x3303da),this['editor']['model']['createPositionAfter'](_0x3303da)),_0x189d26=this['_wrapWithCommonAncestors'](_0x1864f3,_0x291b4d['start'],_0x291b4d['end']);this['_copyMarkersToFragment'](_0x189d26,_0x323079,{'isTableSelection':!0x0});const _0x111641=_0x323079['getFirstRange']()['start'],_0x4e04a8=new Map();let _0x2b1f71=_0x189d26;for(let _0x528e38=0x0;_0x528e38<_0x111641['path']['length'];_0x528e38++)if(_0x4e04a8['set'](_0x2b1f71,_0x111641['path'][_0x528e38]),_0x528e38<_0x111641['path']['length']-0x1)_0x2b1f71=_0x2b1f71['getChild'](0x0);else{let _0x4b5b92=_0x2b1f71['nextSibling'];for(;_0x4b5b92;)_0x4e04a8['set'](_0x4b5b92,_0x111641['path'][_0x528e38]),_0x4b5b92=_0x4b5b92['nextSibling'];}return{'modelFragment':_0x189d26,'anchorData':_0x4e04a8,'root':_0x5410ad};}async['_executeAction'](_0x30b601,_0x514277,_0x1dab08,_0x81c5d8,_0x4a0bc0,_0x3c7c42){const _0x5b6a2c=this['editor']['plugins']['get'](Is),_0x430692=this['editor']['plugins']['get'](la),_0x3a42f5=this['editor']['model']['document']['selection'],_0x4cb4db=await _0x5b6a2c['modelToDataWithIds'](_0x514277,this['editor']),_0x2ac90b=this['editor']['model']['document']['version'],_0x2c1c7e=[..._0x3a42f5['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x430692['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x4a0bc0,'icon':_0x3c7c42||_0x27a3d4,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x2c1c7e,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x430692),this['_interactionParams']={'action':_0x30b601,'content':_0x4cb4db,'version':_0x2ac90b,'aiBalloon':_0x430692,'modelFragment':_0x514277,'anchorData':_0x1dab08,'root':_0x81c5d8},this['_setupApplyListeners'](),this['listenTo'](_0x430692,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x430692,'dialogClosed',(_0x36cec2,{id:_0x31a0c9})=>{if('aiActionsBalloon'===_0x31a0c9){for(const _0xc28140 of this['_interactions']){if(0x0===_0xc28140['replies']['length']||_0xc28140['stoppedExplicitly'])continue;const _0x9a2064=_0xc28140['replies'][_0xc28140['replies']['length']-0x1],_0x59156c=_0x9a2064['changeGroups'][0x0];_0x59156c&&'pending'===_0x59156c['state']&&_0x9a2064['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x430692);}}),this['_createInteraction'](_0x4cb4db,_0x2ac90b,_0x430692,_0x30b601);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x1827f4,anchorData:_0x256ae1,root:_0x250ab7}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x1827f4,_0x256ae1,_0x250ab7,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x1827f4,_0x256ae1,_0x250ab7,!0x0);});}['_wrapWithCommonAncestors'](_0x13144e,_0x2a0d98,_0x24ab94){const _0x37369f=this['editor']['model']['createRange'](_0x2a0d98,_0x24ab94)['getCommonAncestor'](),_0x47df9e=_0x37369f['is']('documentFragment')?[]:_0x37369f['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x47df9e['length']){const _0x43051b=_0x47df9e['map'](_0x3f6645=>_0x3f6645['_clone'](!0x1));for(let _0x48157a=0x1;_0x48157a<_0x43051b['length'];_0x48157a++)_0x43051b[_0x48157a-0x1]['_appendChild'](_0x43051b[_0x48157a]);return _0x43051b[_0x43051b['length']-0x1]['_appendChild'](_0x13144e),new _0x2868da(_0x43051b[0x0]);}return _0x13144e;}['_copyMarkersToFragment'](_0x512c28,_0x565996,_0x2a65c0={'isTableSelection':!0x1}){const _0x689fbb=this['editor']['model'],_0x1300a4=Array['from'](_0x565996['getRanges']()),_0x630f95=_0x565996['getFirstRange']()['start'];for(const _0x5d83df of _0x689fbb['markers']){if(_0x5d83df['name']['startsWith']('ai-selection')||!_0x5d83df['affectsData'])continue;const _0x4377a5=_0x5d83df['getRange']();if(!_0x1300a4['some'](_0x3dcd7b=>_0x3dcd7b['containsRange'](_0x4377a5,!0x0)))continue;const _0x483dfd=this['_regularCalculateMarkerPath'](_0x4377a5['start'],_0x630f95,_0x2a65c0['isTableSelection']),_0x3c0b07=this['_regularCalculateMarkerPath'](_0x4377a5['end'],_0x630f95,_0x2a65c0['isTableSelection']),_0x59c9d3=_0x689fbb['createPositionFromPath'](_0x512c28,_0x483dfd),_0x57594c=_0x689fbb['createPositionFromPath'](_0x512c28,_0x3c0b07);if(!_0x59c9d3['isEqual'](_0x57594c)){const _0x31ce9a=_0x689fbb['createRange'](_0x59c9d3,_0x57594c);_0x512c28['markers']['set'](_0x5d83df['name'],_0x31ce9a);}}}['_regularCalculateMarkerPath'](_0x22210e,_0xc446d,_0x3e56a9=!0x1){const _0x40330d=[..._0x22210e['path']['slice']()];for(let _0x57910f=0x0;_0x57910f<Math['max'](_0xc446d['path']['length'],_0x22210e['path']['length']);_0x57910f++){const _0x3a4d33=_0xc446d['path'][_0x57910f]||0x0,_0x56b9ad=(_0x22210e['path'][_0x57910f]||0x0)-_0x3a4d33;if(_0x40330d[_0x57910f]=_0x56b9ad,0x0!==_0x56b9ad&&!_0x3e56a9)break;}return _0x40330d;}async['_createInteraction'](_0x46ad9a,_0x3d4b39,_0xb8a269,_0x2523ff){const _0x3f4f03=this['editor'],_0x4b3b68=_0x3f4f03['model']['document']['selection']['getFirstRange']()['start']['root'];if(!_0x30f76f(_0x3f4f03,_0x4b3b68['rootName']))return this['_actionsBalloonView']['showBlockingError'](us(this['editor']['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')),Promise['resolve']();this['_interactionParams']||(this['_interactionParams']={'action':_0x2523ff,'content':_0x46ad9a,'version':_0x3d4b39,'aiBalloon':_0xb8a269,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x4b3b68});const _0x5d86d7=new La({'connector':this['_aiConnector'],'locale':_0x3f4f03['locale'],'content':_0x46ad9a,'version':_0x3d4b39,'editor':_0x3f4f03,'rootName':_0x4b3b68['rootName'],..._0x2523ff});this['_interactions']['push'](_0x5d86d7);const _0x4f90c7=(_0x185d19,_0x57b456=!0x1,_0x484df0='streaming')=>{const {isDone:_0x378a28}=_0x185d19;return this['_promiseQueue']['enqueue'](async _0x3bd1fb=>{try{const _0x1edf4d=Vs({'changeGroups':_0x185d19['changeGroups'],'documentContextContent':_0x185d19['documentContextContent'],'showDiff':_0x57b456,'trimUnchanged':!0x1});_0x1edf4d['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x1edf4d[0x0],'renderingStrategy':_0x484df0,'abortSignal':_0x3bd1fb}),_0x378a28&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x4059a6){if(en(_0x4059a6))return;throw _0x4059a6;}});};_0x5d86d7['on']('replyCreated',(_0x28bef7,_0x62aa66)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x4f90c7(_0x62aa66)['catch'](_0x697c30=>{this['_reporter']['logError'](_0x697c30,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x5d86d7,_0x697c30);});}),_0x5d86d7['on']('replyContentUpdated',(_0x11c8a4,_0x118c99)=>{_0x4f90c7(_0x118c99)['catch'](_0x4db264=>{this['_reporter']['logError'](_0x4db264,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x5d86d7,_0x4db264);});}),_0x5d86d7['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x59141f){this['_reporter']['logError'](_0x59141f,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x5d86d7,_0x59141f);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x327186,{showDiff:_0x4da728})=>{try{this['_balloonShowDiff']=_0x4da728;const _0xb1f0d=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0xb1f0d&&await _0x4f90c7(_0xb1f0d,_0x4da728,'static');}catch(_0x5be561){this['_reporter']['logError'](_0x5be561,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x5d86d7,_0x5be561);}}),_0x5d86d7['on']('replyChangeGroupStateUpdated',()=>{const _0x1e8d76={'positiveCount':_0x5d86d7['replies']['reduce']((_0x22e4fe,_0x4d6215)=>_0x22e4fe+_0x4d6215['changeGroups']['filter'](_0x2a567c=>'accepted'===_0x2a567c['state'])['length'],0x0),'totalCount':_0x5d86d7['replies']['reduce']((_0x350f3d,_0x3b87c2)=>_0x350f3d+_0x3b87c2['changeGroups']['length'],0x0)},_0x390ed9=_0x5d86d7['actionCallId'],_0x38f4fa=_0x5d86d7['actionName'];_0x38f4fa?this['_aiConnector']['upsertAIActionRating'](_0x38f4fa,_0x390ed9,_0x1e8d76):this['_aiConnector']['upsertCustomAIActionRating'](_0x390ed9,_0x1e8d76);}),this['_setLoadingState']();try{const _0x491d84=await _0x5d86d7['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x491d84;}catch(_0x2d3271){en(_0x2d3271)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x2d3271,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x5d86d7,_0x2d3271);}}['_applyChanges'](_0x3535e4,_0x5a4a9d,_0x574074,_0xc6bce7){const _0x85b88f=this['editor'];if(_0xc6bce7&&!_0x85b88f['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',null);const _0x482f43=this['editor']['plugins']['get'](_0x1cf5c4),_0x3076dd=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x3076dd||!_0x3076dd['replies']['length'])return;const _0x2e7f6e=_0x3076dd['replies'][_0x3076dd['replies']['length']-0x1];_0x2e7f6e['setChangeGroupState'](0x0,'accepted');const _0x52f703=Rn({'documentSuggestions':On({'groups':[_0x2e7f6e['changeGroups'][0x0]],'documentContextContent':_0x2e7f6e['documentContextContent'],'documents':_0x3076dd['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x482f43,'documentCompareOptions':{'anchor':_0x85b88f['model']['createPositionAt'](_0x3535e4,0x0),'markDeletions':_0xc6bce7}})['values']()['next']()['value']??[],_0x174786=this['_filterOperationsOutsideRange'](_0x52f703,_0x5a4a9d);for(const _0x2d1eec of _0x174786)this['_anchorOperation'](_0x5a4a9d,_0x2d1eec,_0x574074);const _0x15c9fc=_0x3076dd['getDocumentContext']()['documents'][0x0]['version'],_0x2a7650=_0x29e916(_0x174786,_0x85b88f['model']['document']['history']['getOperations'](_0x15c9fc),{'document':_0x85b88f['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];zs(_0x2a7650,'quickActions');try{_0x85b88f['model']['change'](_0xc4349c=>{_0xc4349c['setSelection'](_0x85b88f['model']['document']['selection']['focus']),_0xc6bce7?_0x85b88f['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x2a7650):_0x482f43['applyOperations'](_0xc4349c,_0x2a7650);});}catch(_0x447947){throw this['_reporter']['logError'](new sn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x447947})),_0x447947;}this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x8c96cb,_0x1de15f){return _0x8c96cb['filter'](_0x176c64=>{if('rename'==_0x176c64['type']){const _0x772fbc=_0x176c64['position']['nodeAfter'];return!_0x1de15f['has'](_0x772fbc);}if(_0x176c64['type']['indexOf']('Attribute')>-0x1){const _0x3d42ca=_0x176c64['range']['start']['nodeAfter'];return!_0x1de15f['has'](_0x3d42ca);}return!0x0;});}['_anchorOperation'](_0x23c9c7,_0x55d13f,_0x13db0e){const _0x16f25a=_0x55d13f['clone']();for(const _0x3abefc in _0x55d13f){const _0x2cd749=_0x55d13f[_0x3abefc];_0x2cd749 instanceof _0x4e8468?_0x55d13f[_0x3abefc]=new _0x4e8468(_0x198765(_0x2cd749['start']),_0x198765(_0x2cd749['end'])):_0x2cd749 instanceof _0x5d12c5&&(_0x55d13f[_0x3abefc]=_0x198765(_0x2cd749));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x16f25a['type'])){if(_0x16f25a['isDocumentOperation']=!0x1,_0x16f25a['baseVersion']=null,'remove'==_0x16f25a['type']){const _0xf22f97=_0x16f25a['sourcePosition'],_0x2deabb=_0x16f25a['howMany'];new _0x50ba30(_0xf22f97,_0x2deabb)['_execute']();}else _0x16f25a['_execute']();}function _0x198765(_0x115ebc){if('$graveyard'==_0x115ebc['root']['rootName'])return _0x115ebc;const _0x4369e8=[];let _0xac1a74=_0x115ebc['root'];for(let _0x3ff8a5=0x0;_0x3ff8a5<_0x115ebc['path']['length'];_0x3ff8a5++){const _0x288c65=_0x23c9c7['get'](_0xac1a74)||0x0;_0x4369e8[_0x3ff8a5]=_0x115ebc['path'][_0x3ff8a5]+_0x288c65,_0xac1a74=_0xac1a74['getChildAtOffset'](_0x115ebc['path'][_0x3ff8a5]);}return new _0x5d12c5(_0x13db0e,_0x4369e8,_0x115ebc['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x1b61fb,content:_0x24bd84,version:_0xd631e2,aiBalloon:_0x2239cf}=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'](_0x24bd84,_0xd631e2,_0x2239cf,_0x1b61fb)['catch'](_0x449eb2=>{this['_reporter']['logError'](_0x449eb2,{'context':{'operation':'refresh-interaction'}});});}['_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 _0x5fb78d=this['_interactions']['length'];this['_currentInteractionIndex']<_0x5fb78d-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x271675){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x271675;const _0x5c0170=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x5c0170)return;if(_0x5c0170['hasError'])return this['_setErrorState'](_0x5c0170),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x5c0170['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x59435a=_0x5c0170['replies'][_0x5c0170['replies']['length']-0x1];if(_0x59435a)try{const _0x238ee5=Vs({'changeGroups':_0x59435a['changeGroups'],'documentContextContent':_0x59435a['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x287688=>setTimeout(_0x287688,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x238ee5[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x2c7abe){this['_reporter']['logError'](_0x2c7abe,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x4173ef,_0x983767){if(void 0x0!==_0x983767&&en(_0x983767))return;const _0x21f6f3=us(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x21f6f3),_0x4173ef['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);}},Ba=class extends _0x3688ab{static get['requires'](){return[Oa,ya,Ua];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x186c18){super(_0x186c18),_0x186c18['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Ga=class extends _0x215f6f{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x414857,_0x2a8565){super(_0x414857),this['id']=_0x2a8565,this['set']('status','pending'),this['set']('changeId',_0x2a8565),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',(_0x4debc5,_0x791510)=>{_0x791510&&_0x791510['target']&&'A'===_0x791510['target']['tagName']&&_0x791510['preventDefault'](),this['fire']('activateChange',{'id':_0x2a8565,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x2a8565,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x2a8565,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x4b4038=new _0x215f6f(this['locale']);return _0x4b4038['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',_0x2e5ae2=>!_0x2e5ae2)]}}),_0x4b4038;}['_createAcceptButtonView'](){const _0x18adf9=new Ht(this['locale']);return _0x18adf9['set']({'label':us(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x18adf9['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x204c7e=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x204c7e['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x52b320=>'pending'!==_0x52b320&&'accepted'!==_0x52b320),this['bindTemplate']['if']('status',an,_0x368f7b=>'pending'===_0x368f7b),this['bindTemplate']['if']('status',hn,_0x1ad420=>'pending'!==_0x1ad420),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x4bf6a0=>'accepted'===_0x4bf6a0)]}}),this['on']('change:status',(_0x36adec,_0x5a749c,_0x3897ad)=>{_0x18adf9['isEnabled']='pending'===_0x3897ad,'accepted'===_0x3897ad&&(_0x18adf9['label']=us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x18adf9['icon']=_0x27c014);}),_0x18adf9;}['_createDismissButtonView'](){const _0x414a4f=new Ht(this['locale']);return _0x414a4f['set']({'label':us(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x414a4f['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x45809d=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x45809d['stopPropagation']();})},'attributes':{'class':[hn,this['bindTemplate']['if']('status','ck-hidden',_0x80a261=>'pending'!==_0x80a261&&'rejected'!==_0x80a261),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0xc143d9=>'pending'===_0xc143d9),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x36218b=>'rejected'===_0x36218b)]}}),this['on']('change:status',(_0x40df77,_0x45fcd7,_0x4eee22)=>{_0x414a4f['isEnabled']='pending'===_0x4eee22,'rejected'===_0x4eee22&&(_0x414a4f['label']=us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x414a4f['icon']=_0x27af74);}),_0x414a4f;}['_createInfoButtonView'](){const _0x28a4ca=new Ht(this['locale']);return _0x28a4ca['set']({'label':us(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x4d8e0c,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':hn+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x28a4ca['bind']('isOn')['to'](this,'isInfoToggleOn',_0x30438e=>_0x30438e),_0x28a4ca['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x28a4ca;}['_createOutdatedButtonView'](){const _0x50ba79=new Ht(this['locale']);return _0x50ba79['set']({'label':us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0x4f2173,'withText':!0x0,'isEnabled':!0x1}),_0x50ba79['extendTemplate']({'attributes':{'class':[hn,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x4a91c3=>'outdated'!==_0x4a91c3)],'disabled':'disabled'}}),_0x50ba79;}},Fa=class extends yt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x42dab0,_0x414ee5){super(_0x42dab0),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']()),_0x414ee5['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x31ffd9){this['resultItemView']['changeId']=_0x31ffd9['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x31ffd9['contentDiffed'];}['showBalloon'](_0x10d13c,_0x3256fe,_0x2a43d1,_0x25682b,_0x330095,_0x4def4e){const _0x3097ed=_0x3256fe();if(!_0x3097ed)return;this['updateContent'](_0x10d13c),this['show']();const _0x5e5086=Array['from'](_0x3097ed['getClientRects']())['reverse'](),_0x4ac65f=this['_getPointedRectIndexFromEvent'](_0x2a43d1,_0x5e5086),_0x5dc4fc=_0x5e5086[_0x4ac65f??0x0];'click'===_0x25682b?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x3256fe(),_0x4ac65f,_0x10d13c['id'],_0x330095,_0x4def4e)||_0x5dc4fc})):'hover'===_0x25682b&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x3256fe(),_0x4ac65f,_0x10d13c['id'])||_0x5dc4fc}));}['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'](){_0x191c5a({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x25b48a=[this['element']];return this['_pinnedTargetElement']&&_0x25b48a['push'](this['_pinnedTargetElement']),_0x25b48a;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x38dad6=new _0x215f6f();return this['resultItemView']=new Ga(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x38dad6['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']]}]}),_0x38dad6;}['_getBestRectPositionOnClick'](_0x594c23,_0xb2e0c1,_0x44186e,_0x2223c7,_0x2c0684){if(!_0x594c23)return null;const _0x191612=this['position']['replace']('arrow_',''),_0x1ab00e=Array['from'](_0x594c23['getClientRects']());let _0x1fd6cc,_0x2d83e1=_0x1ab00e['reverse']();return void 0x0!==_0xb2e0c1&&this['_isPinnedRectVisible'](_0x2d83e1[_0xb2e0c1],_0x2223c7,_0x2c0684)?(_0x1fd6cc=_0x2d83e1[_0xb2e0c1],this['_pinnedRectIndex']=_0xb2e0c1):this['_isPinnedRectVisible'](_0x2d83e1[0x0],_0x2223c7,_0x2c0684)&&void 0x0===_0xb2e0c1?_0x1fd6cc=_0x2d83e1[0x0]:(_0x2d83e1='s'==_0x191612[0x0]?[..._0x1ab00e]['reverse']():_0x1ab00e,_0x2d83e1['forEach'](_0x238538=>{this['_isPinnedRectVisible'](_0x238538,_0x2223c7,_0x2c0684)&&(_0x1fd6cc=_0x238538);})),this['_pinnedTargetChangeId']=_0x44186e,this['_pinnedTargetElement']=_0x594c23,_0x1fd6cc||_0x594c23['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x560486,_0xdb4b52,_0x4dbf47){if(!_0x560486)return null;const _0x6b4586=Array['from'](_0x560486['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0xdb4b52&&this['_pinnedTargetChangeId']!==_0x4dbf47?(this['_pinnedRectIndex']=_0xdb4b52,this['_pinnedTargetElement']=_0x560486,this['_pinnedTargetChangeId']=_0x4dbf47,_0x6b4586[_0xdb4b52]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x4dbf47?_0x560486!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x6b4586[this['_pinnedRectIndex']]:void 0x0!==_0xdb4b52&&this['_pinnedTargetChangeId']!==_0x4dbf47?(this['_pinnedRectIndex']=_0xdb4b52,this['_pinnedTargetElement']=_0x560486,this['_pinnedTargetChangeId']=_0x4dbf47,_0x6b4586[_0xdb4b52]):_0x560486['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0xbeb919,_0x77f1bc){if(_0xbeb919)for(let _0x370f15=0x0;_0x370f15<_0x77f1bc['length'];_0x370f15++){const _0x3b5c66=_0x77f1bc[_0x370f15];if(_0xbeb919['clientX']>=_0x3b5c66['left']-0x3&&_0xbeb919['clientX']<=_0x3b5c66['right']+0x3&&_0xbeb919['clientY']>=_0x3b5c66['top']-0x3&&_0xbeb919['clientY']<=_0x3b5c66['bottom']+0x3)return _0x370f15;}}['_isPinnedRectVisible'](_0x5d8fb1,_0x308e32,_0xa94654){const _0xd8d9f4=new At(_0x5d8fb1),_0x528c9e=_0x308e32||document['documentElement'],_0x434c0d=_0xd8d9f4['getIntersection'](Et(_0xa94654)),_0x12fd44=new At(_0x528c9e)['getIntersection'](_0xd8d9f4);return!!(_0x434c0d&&_0x12fd44&&_0xd8d9f4['width']>0x0);}};const Ka=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var Wa=class extends _0x5d28a2{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[cs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x432ba3){super(_0x432ba3),this['_bodyCollection']=ln(this['context']['locale']),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Ka)['to'](this),this['_balloonSuggestionView']=new Fa(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x1f1865=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x1f1865);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x4f5c70){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x36843c=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x4f5c70,_0x36843c);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x231302){_0x231302&&('error-general'!==_0x231302['status']?'error-chunk'!==_0x231302['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0xa327af){this['_mainView']['addCheckRunResult'](_0xa327af);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x28d7f9){this['_mainView']['showGeneralReviewCoreErrorView'](_0x28d7f9??us(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x956919,_0x993365){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x956919,_0x993365);}['setActiveStateInResults'](_0x5cb996){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x4af95b=>{_0x4af95b['id']===_0x5cb996&&_0x4af95b['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x47ff51=>_0x47ff51['setItemAsInactive']());}['updateChangeState'](_0x53a832,_0x546dc2){'accepted'===_0x546dc2||'rejected'===_0x546dc2||'outdated'===_0x546dc2?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x53a832,_0x546dc2):this['_mainView']['reviewCheckResultsView']['showResult'](_0x53a832,_0x546dc2);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x4a38b5,_0x379f17,_0x2fed72,_0x4c321f,_0xd07056,_0x4731e5){this['_balloonSuggestionView']['showBalloon'](_0x4a38b5,_0x379f17,_0x2fed72,_0x4c321f,_0xd07056,_0x4731e5);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x21cf50){const _0x1e2409=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x22e37f=>_0x22e37f['id']===_0x21cf50);return _0x1e2409?_0x1e2409['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}},Ya=class extends _0x215f6f{constructor(_0xa3a491){super(_0xa3a491),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x5d3f77=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x5d3f77['if']('isVisible','ck-hidden',_0x50b87e=>!_0x50b87e)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x5d3f77['to']('errorMessage')}]}]});}},$a=class extends _0x215f6f{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x58960d,_0x58626a){super(_0x58960d),this['reviewCoreHeader']=_0x58626a['header'],this['generalErrorView']=new Ya(_0x58960d),this['reviewCheckListView']=_0x58626a['list'],this['reviewCheckListView']['delegate'](...Ka)['to'](this),this['reviewCheckResultsView']=_0x58626a['results'],this['reviewCheckResultsView']['delegate'](...Ka)['to'](this),this['reviewCompletedView']=_0x58626a['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'](_0x49fa7f){this['reviewCheckResultsView']['addResult'](_0x49fa7f),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'](_0xce6925){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0xce6925;}['showGeneralResultsErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}},qa=class extends Ht{constructor(_0x3c758d,_0x42614c){super(_0x42614c),this['set']({'label':_0x3c758d,'withText':!0x0,'class':on}),this['on']('execute',()=>{this['fire']('finishReview');});}},Qa=class extends zt{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x136e5b,_0x533f1f){super(_0x136e5b),this['_contents']=_0x533f1f,this['_resultViews']=new _0x498844(),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 Mo(_0x136e5b),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 _0x511f52=this['_createCombinedSkeletonLoader'](),_0x3451ed=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x3451ed['if']('isLoading','ck-ai_review__check-run_loading',_0x27dae2=>_0x27dae2),_0x3451ed['if']('isResultReady','ck-ai_review__check-run_ready',_0x314abe=>_0x314abe),_0x3451ed['if']('isVisible','ck-hidden',_0x389046=>!_0x389046)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x511f52,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x41d6bb){const _0x4dda5d=new Ga(this['locale'],_0x41d6bb['id']);_0x4dda5d['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x4dda5d),_0x4dda5d['resultResponseView']['element']['innerHTML']=_0x41d6bb['contentDiffed'];}['hideResult'](_0x4714e9,_0x45f625){if('pending'===_0x45f625)return;const _0xd51f44=this['_resultViews']['find'](_0x5418c7=>_0x5418c7['id']===_0x4714e9);_0xd51f44&&(_0xd51f44['status']=_0x45f625,_0xd51f44['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x385e97,_0x38e4b6){if('pending'!==_0x38e4b6)return;const _0x3bd5b1=this['_resultViews']['find'](_0x482592=>_0x482592['id']===_0x385e97);_0x3bd5b1&&(_0x3bd5b1['status']=_0x38e4b6,_0x3bd5b1['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x40bf53,_0xd7192c){this['headerTitle']=_0x40bf53,this['headerSubtitle']=_0xd7192c||'';}['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 Xn(this['locale'],zn['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x536372=new _0x215f6f(this['locale']),_0x54cb04=[];for(let _0x23c9f6=0x0;_0x23c9f6<0x10;_0x23c9f6++){const _0x4f2649=this['_createSkeletonLoader']();_0x4f2649['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x54cb04['push'](_0x4f2649);}return _0x536372['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x40d849=>!_0x40d849)]},'children':_0x54cb04}),_0x536372;}['_createResultsBodyView'](){const _0x27fd03=new _0x215f6f(this['locale']);return _0x27fd03['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x3602fa=>_0x3602fa)]},'children':this['_resultViews']}),_0x27fd03;}['_createErrorView'](){const _0x4a6b49=new _0x215f6f(this['locale']),_0x315da5=new Ht(this['locale']),t=this['locale']['t'];return _0x4a6b49['delegate']('retryReview')['to'](this),_0x315da5['set']({'label':t('Try\x20again'),'withText':!0x0,'class':an+'\x20ck-ai_review__check-run-error-retry-button'}),_0x315da5['on']('execute',()=>{this['fire']('retryReview');}),_0x4a6b49['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x550213=>!_0x550213),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x8e2767=>'chunk'===_0x8e2767)]},'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',_0x1bac68=>'chunk'===_0x1bac68)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x34788a=>'general'!==_0x34788a)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x338686=>'chunk'!==_0x338686)]},'children':[{'text':us(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x315da5]}),_0x4a6b49;}['_createCancelButtonView'](){const _0x15945d=new Ht(this['locale']);return _0x15945d['set']({'label':us(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[an+'\x20ck-ai-button-stop-generating'],'icon':it}),_0x15945d['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x3dd719=>_0x3dd719),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x1a9289=>_0x1a9289)]}}),_0x15945d['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x15945d;}['_createToggleDiffButtonView'](){const _0x111e21=new Ht(this['locale']);_0x111e21['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x111e21['bind']('isEnabled')['to'](this,'isError',_0x57aaa0=>!_0x57aaa0),_0x111e21['extendTemplate']({'attributes':{'class':[an,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x52be32=>!_0x52be32),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x51f964=>_0x51f964)]}});const _0x1544e5=us(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x32b5d8=us(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x111e21['bind']('isOn')['to'](this,'isToggleDiffOn',_0x163160=>_0x163160),_0x111e21['bind']('icon')['to'](this,'isToggleDiffOn',_0x52836a=>_0x52836a?_0x236ceb:_0x2ee912),_0x111e21['bind']('label')['to'](this,'isToggleDiffOn',_0x59f03e=>_0x59f03e?_0x1544e5:_0x32b5d8),_0x111e21['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x111e21;}['_createAcceptAllButtonView'](){const _0x2c7e81=new Ht(this['locale']);return _0x2c7e81['set']({'label':us(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x2c7e81['bind']('isEnabled')['to'](this,'isError',_0x19c981=>!_0x19c981),_0x2c7e81['extendTemplate']({'attributes':{'class':[on,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x1d2c98=>!_0x1d2c98),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x18110c=>_0x18110c)]}}),_0x2c7e81['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x2c7e81;}['_createExitReviewButtonView'](){const _0x1cc96d=new Ht(this['locale']);return _0x1cc96d['set']({'label':us(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x1cc96d['extendTemplate']({'attributes':{'class':[hn,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x25d122=>!_0x25d122),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x52e7e9=>_0x52e7e9)]}}),_0x1cc96d['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x1cc96d;}['_createResultHeaderView'](){const _0x2d1744=new _0x215f6f(this['locale']),_0xeaa8e7=this['_createTitleView']();return _0x2d1744['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x50c81e=>_0x50c81e)]},'children':[_0xeaa8e7,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0xd063e8=>!_0xd063e8)],'title':us(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':us(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-buttons']},'children':[this['_cancelButtonView'],this['_acceptAllButtonView'],this['_exitReviewButtonView'],this['_toggleDiffButtonView'],this['_finishReviewButtonView']]}]}),_0x2d1744;}['_createTitleView'](){const _0xec9982=new _0x215f6f(this['locale']),_0x1b97e8=new cr();return _0x1b97e8['bind']('isVisible')['to'](this,'isResultReady',_0x4a596f=>!_0x4a596f),_0xec9982['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x48f12a=>_0x48f12a)]},'children':[_0x1b97e8,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-content']},'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')}]}]}]}),_0xec9982;}['_createFinishReviewButtonView'](){const _0x6e18f8=new qa(us(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x6e18f8['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x29fd3f=>!_0x29fd3f)]}}),_0x6e18f8['delegate']('finishReview')['to'](this),_0x6e18f8;}},Xa=class extends zt{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x5a40c3,_0x2c6a5b){super(_0x5a40c3),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x2c6a5b['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x2c6a5b['headerText']);const _0x3b0824=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x3b0824['if']('isVisible','ck-hidden',_0x1d7190=>!_0x1d7190)]},'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':_0x2c6a5b['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x33b334){const _0x2a1c70=new qa(_0x33b334,this['locale']);return _0x2a1c70['delegate']('finishReview')['to'](this),_0x2a1c70;}['_createResultHeaderView'](_0x4eda49){const _0x14a267=new _0x215f6f(this['locale']);return _0x14a267['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x4eda49},'children':[{'text':_0x4eda49}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x14a267;}},za=class extends _0x215f6f{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x1afa7d,_0x98d9c7){super(_0x1afa7d),this['_defaultValue']=_0x98d9c7['default']||(_0x98d9c7['data']['length']>0x0?_0x98d9c7['data'][0x0]['id']:''),this['_defaultLabel']=_0x98d9c7['data']['find'](_0x2e014e=>_0x2e014e['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x32dc43(this['locale']);const _0x554d18=this['_prepareListOptions'](_0x98d9c7['data']);_0x1d523e(this['_dropdownView'],_0x554d18,{'role':'menu','ariaLabel':_0x98d9c7['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x2583ad=>{_0x2583ad['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x323a03=>{this['formValue']=_0x323a03['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x323a03['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'](_0x5b89de=[]){const _0x4d4efd=new ct();this['resetToDefault']();for(const _0x511368 of _0x5b89de){const _0x4d6f5f=new _0x24dcce({'label':_0x511368['label'],'withText':!0x0,'role':'menuitemradio','id':_0x511368['id'],'model':_0x511368});_0x4d6f5f['bind']('isOn')['to'](this,'formValue',_0x8498db=>_0x8498db===_0x4d6f5f['id']);const _0x1be3eb={'type':'button','model':_0x4d6f5f};_0x4d4efd['add'](_0x1be3eb);}return _0x4d4efd;}},ja=class extends zt{['_formItem']=null;constructor(_0x441ae0,_0xc6fc43,_0x58a6db){if(super(_0x441ae0),this['argsKey']=_0xc6fc43?.['argsKey'],'dropdown'===_0xc6fc43['formType'])this['_formItem']=new za(this['locale'],_0xc6fc43);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x47f593=new Kt(this['locale'],{'children':[this['_formItem']],'class':[_0x58a6db?'ck-form__row_with-submit':'']});_0x58a6db&&_0x47f593['children']['add'](_0x58a6db),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x47f593]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}},Ja=class AIReviewCorePromptInputView extends _0x5455d5{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x308adf){super(_0x308adf),this['set']('isEmpty',!0x0),this['keystrokes']=new _t(),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']);}},Za=class extends _0x215f6f{['focusTracker']=new dt();['keystrokes']=new _t();['focusCycler'];['_focusables']=new _0x498844();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0x3f267d,_0x5b2fab,_0x3fd417=!0x1){super(_0x3f267d),this['_check']=_0x5b2fab,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x5b2fab['defaultModel']?_0x5b2fab['defaultModel']['id']:'',this['_defaultLabel']=_0x5b2fab['defaultModel']?_0x5b2fab['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new qt(this['locale'],()=>new Ja(_0x3f267d)),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 ct(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0x3fd417),_0x1d523e(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new Kt(this['locale'],{'children':[this['promptInputView']]}),new Kt(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x4dc505,_0x37b064)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x37b064()):_0x37b064();}),this['focusCycler']=new Gt({'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'](_0x472dc8=>{this['_focusables']['add'](_0x472dc8),this['focusTracker']['add'](_0x472dc8['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 _0x429b6c of this['_getFormValidators']()){const _0x2a4b86=_0x429b6c();if(_0x2a4b86)return this['promptInputView']['errorText']=_0x2a4b86,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return us(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x586448=new Ht(this['locale']),t=this['locale']['t'];return _0x586448['set']({'label':t('Submit'),'withText':!0x0,'class':on}),_0x586448['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x586448;}['_createCancelButtonView'](){const _0x421a5d=new Ht(this['locale']),t=this['locale']['t'];return _0x421a5d['set']({'label':t('Cancel'),'withText':!0x0,'class':hn}),_0x421a5d['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x402646=>{_0x402646['stopPropagation']();})}}),_0x421a5d['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x421a5d;}['_setModelList'](_0x43b09b){this['_modelSelectionDropdownItems']['clear']();const _0x42e131=this['_check']['models'];if(_0x43b09b)this['set']('modelDisplayMode','hidden');else{const _0x5388f5=0x1===_0x42e131['length'];this['set']('modelDisplayMode',_0x5388f5?'name':'selector');}if(this['resetToDefault'](),_0x42e131?.['length']){0x1===_0x42e131['length']&&this['set']('activeModelName',_0x42e131[0x0]['name']||_0x42e131[0x0]['id']);for(const _0x3d34a6 of _0x42e131){const _0x4c9ba2=new _0x24dcce({'label':_0x3d34a6['name'],'withText':!0x0,'role':'menuitemradio','id':_0x3d34a6['id'],'model':_0x3d34a6});_0x4c9ba2['bind']('isOn')['to'](this,'modelId',_0x81584=>_0x81584===_0x3d34a6['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x4c9ba2,'labelView':new eh(this['locale'],_0x3d34a6)});}}}['_createModelSelectionDropdown'](){const _0x17c001=_0x32dc43(this['locale']);return _0x17c001['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x17c001['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':hn}),_0x17c001['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x193241=>'selector'===_0x193241),this['listenTo'](_0x17c001,'execute',_0x131ce7=>{this['modelId']=_0x131ce7['source']['model']['id'],_0x17c001['buttonView']['label']=_0x131ce7['source']['label'];}),_0x17c001;}['_createModelNameView'](){const _0x3c094b=new th(this['locale']);return _0x3c094b['bind']('text')['to'](this,'activeModelName',_0x22c0a9=>_0x22c0a9??''),_0x3c094b['bind']('isVisible')['to'](this,'modelDisplayMode',_0x4b0631=>'name'===_0x4b0631),_0x3c094b;}['_createActionsFooterView'](){const _0x4daf78=new _0x215f6f(this['locale']);return _0x4daf78['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']]}]}),_0x4daf78;}},th=class extends _0x215f6f{constructor(_0x556ace){super(_0x556ace),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x56e271=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x56e271['if']('isVisible','ck-hidden',_0x460a0f=>!_0x460a0f)]},'children':[{'text':_0x56e271['to']('text')}]});}},eh=class extends Dt{constructor(_0x540502,_0x29142b){super();const _0x3cfb4c=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x3cfb4c['to']('style'),'id':_0x3cfb4c['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x3cfb4c['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x29142b['description']||'']}]}]});}},ih=class extends zt{['_formItemsCollection']=new _0x498844();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0xf334e1,_0x7f1cbd,_0x3736d0,_0x1e5117=!0x1){super(_0xf334e1),this['_hideModels']=_0x1e5117,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x7f1cbd['isParameterized']);const _0x4ceaaa=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',_0x3f3bc4=>_0x3f3bc4),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0xdad81e=>_0xdad81e)],'style':{'--ck-ai-review-check-list-item-index':_0x3736d0}},'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':_0x7f1cbd['title']}]},_0x4ceaaa]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x7f1cbd['description']?[{'text':_0x7f1cbd['description']}]:[]}]}]},..._0x7f1cbd['isParameterized']?[this['_createParameterizedView'](_0x7f1cbd)]:[],...'custom'===_0x7f1cbd['id']?[this['_createCustomView'](_0x7f1cbd,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x7f1cbd['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x7f1cbd['id'],'args':_0x7f1cbd['useArgs']?_0x7f1cbd['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0x191c5a({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x2d6cf7=>{_0x2d6cf7['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x383e82=new Yt();return _0x383e82['content']=_0x1d567d,_0x383e82['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x383e82;}['_createParameterizedView'](_0x45ef22){const _0x2d7bac=new _0x215f6f(),_0x4d14f8=this['_createFormView'](_0x45ef22);return _0x2d7bac['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x9deee=>!_0x9deee)]},'children':[_0x4d14f8]}),_0x2d7bac;}['_createFormView'](_0x48d61a){const _0x41e712=new _0x215f6f(),_0x32bdba=Array['isArray'](_0x48d61a['options'])?_0x48d61a['options']:[],_0x2a6aa1=new Ht(this['locale']),t=this['locale']['t'];_0x2a6aa1['set']({'label':t('Submit'),'withText':!0x0,'class':on}),_0x2a6aa1['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x16b3d8=>{_0x16b3d8['stopPropagation']();})}}),_0x2a6aa1['on']('execute',()=>{const _0x4283a4=[],_0x258d59={};this['_formItemsCollection']['forEach'](_0x282ffa=>{_0x4283a4['push'](_0x282ffa['value']),_0x48d61a['useArgs']&&_0x48d61a['options']&&(_0x258d59[_0x282ffa['argsKey']]=_0x282ffa['value']);}),this['fire']('runReviewCheck',{'id':_0x48d61a['id'],'params':_0x4283a4['length']?_0x4283a4:void 0x0,'args':Object['keys'](_0x258d59)['length']?_0x258d59:void 0x0});});const _0x330e68=_0x32bdba['length'];return _0x32bdba['forEach']((_0x204f36,_0x915f8a)=>{const _0x49ecd1=_0x915f8a===_0x330e68-0x1;this['_formItemsCollection']['add'](new ja(this['locale'],_0x204f36,_0x49ecd1?_0x2a6aa1:null));}),_0x41e712['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x41e712;}['_createCustomView'](_0x32c18d,_0x1befa4=!0x1){return this['_customCheckView']=new Za(this['locale'],_0x32c18d,_0x1befa4),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',_0x450cd8=>!_0x450cd8)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x2d3db4,_0x5a2e68,_0x31ed7b)=>{_0x31ed7b||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},sh=class extends zt{['_checkViews'];constructor(_0x1c5e61){super(_0x1c5e61),this['_checkViews']=new _0x498844(),this['_setupTemplate']();}['setChecks'](_0x14736f,_0x519627=!0x1){this['_checkViews']['clear']();for(const [_0x1090da,_0x151c22]of _0x14736f['entries']()){const _0x228db6=new ih(this['locale'],_0x151c22,_0x1090da,_0x519627);_0x228db6['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x228db6);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x13a67f of this['_checkViews'])_0x13a67f instanceof ih&&_0x13a67f['resetToDefault']();}['_setupTemplate'](){const _0x211084=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x211084['if']('isVisible','ck-hidden',_0xefbf69=>!_0xefbf69)]},'children':this['_checkViews']});}},nh=class extends Wa{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x6b6c92=this['context']['plugins']['get']('AITabs'),_0x4d4cc4=this['context']['locale'],_0x9c6a4=new Ho(_0x4d4cc4,{'label':us(_0x4d4cc4,'AI_REVIEW_MODE'),'icon':_0x5bd10a,'class':'ck-ai-header_review','showResizeButton':_0x6b6c92['showResizeButton']});return _0x9c6a4['delegate']('resizeTabs')['to'](_0x6b6c92),_0x9c6a4['bind']('isMaximized')['to'](_0x6b6c92['view'],'isMaximized',_0x612b93=>_0x612b93),new $a(this['context']['locale'],{'header':_0x9c6a4,'list':new sh(_0x4d4cc4),'results':new Qa(_0x4d4cc4,{'generalErrorText':us(_0x4d4cc4,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new Xa(_0x4d4cc4,{'headerText':us(_0x4d4cc4,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':us(_0x4d4cc4,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':us(_0x4d4cc4,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x1658a7=this['context']['plugins']['get']('AITabs');_0x1658a7['view']['on']('activateTab',(_0x503d8e,{newTab:_0x22fb26,oldTab:_0x1bfc78})=>{'reviewMode'===_0x22fb26?this['fire']('getReviewCheckList'):'reviewMode'===_0x1bfc78&&this['fire']('leaveReview');}),_0x1658a7['view']['addTab']({'id':'reviewMode','buttonLabel':us(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x5bd10a,'order':0x0,'content':this['_mainView']});}};const rh='review-',oh=['softBreak'],ah=['htmlScript','htmlStyle','htmlCustomElement'];var hh=class extends _0x5d28a2{static get['requires'](){return[_0x1cf5c4,Is];}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(_0x2d2b65){super(_0x2d2b65),this['_domEmitter']=new(lt())(),this['_eventEmitter']=new(ut())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x4575cc=_0x477b8b=>this['_scheduleAttachReviewEditingToEditor'](_0x477b8b);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x1f7986)return void _0x4575cc(this['context']);const _0x397a8b=this['context'];for(const _0x374495 of _0x397a8b['editors'])_0x4575cc(_0x374495);this['listenTo'](_0x397a8b['editors'],'add',(_0x179fc1,_0x2939ee)=>{_0x4575cc(_0x2939ee);}),this['listenTo'](_0x397a8b['editors'],'remove',(_0x541c06,_0x339b8e)=>{for(const [_0x103808,_0x2395bd]of this['_markers'])_0x2395bd['editor']===_0x339b8e&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x103808,'changeId':_0x2395bd['groupId']}),this['_markers']['delete'](_0x103808));});}['_scheduleAttachReviewEditingToEditor'](_0x3b17a2){const _0x360804=()=>{'destroyed'!==_0x3b17a2['state']&&_0x3b17a2['conversion']&&this['_attachReviewEditingToEditor'](_0x3b17a2);};if('ready'===_0x3b17a2['state'])return void _0x360804();const _0xe4c2cb=()=>{this['stopListening'](_0x3b17a2,'ready',_0xe4c2cb),_0x360804();};this['listenTo'](_0x3b17a2,'ready',_0xe4c2cb);}['_attachReviewEditingToEditor'](_0x509389){this['_reviewEditingAttachedEditors']['has'](_0x509389)||(_0x509389['conversion']['for']('editingDowncast')['markerToElement']({'model':rh+'insert','view':(_0x2fd339,{writer:_0x3d2d5b})=>{const _0x5a103b=this['_markers']['get'](_0x2fd339['markerName']),_0x170dcf={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x5a103b?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x2fd339['markerName']};return _0x3d2d5b['createUIElement']('span',_0x170dcf,function(_0xb4de95){const _0x5f4429=this['toDomElement'](_0xb4de95);return _0x5f4429['innerHTML']=_0x5a103b?.['content']?.['asString']||'',_0x5f4429;});}}),_0x509389['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-only','view':_0x2b9cea=>{const _0x5b35e5=this['_markers']['get'](_0x2b9cea['markerName']),_0x22b773=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x5b35e5?.['id']||'')&&_0x22b773['push']('ck-ai_review__change_active'),{'classes':_0x22b773,'attributes':{'data-marker-id':_0x2b9cea['markerName']}};}}),_0x509389['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-context','view':_0xf033f5=>{const _0x30a190=this['_markers']['get'](_0xf033f5['markerName']),_0x2c70b1=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x30a190?.['id']||'')&&_0x2c70b1['push']('ck-ai_review__change_active'),{'classes':_0x2c70b1,'attributes':{'data-marker-id':_0xf033f5['markerName']}};}}),_0x509389['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-text','view':_0x3fc3ba=>{const _0x350717=this['_markers']['get'](_0x3fc3ba['markerName']),_0x56c220=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x350717?.['id']||'')&&_0x56c220['push']('ck-ai_review__change_active'),{'classes':_0x56c220,'attributes':{'data-marker-id':_0x3fc3ba['markerName']}};}}),_0x509389['conversion']['for']('dataDowncast')['markerToElement']({'model':rh+'suggestion-context','view':(_0x4bde73,{writer:_0x36a902})=>_0x36a902['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x4bde73['isOpening']?'start':'end')})}),_0x509389['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x5e92a3,'view':_0x2d4fde}),this['_updateMouseMarkerInteractionListeners'](_0x509389),this['listenTo'](_0x509389,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x509389),{'priority':'lowest'}),this['listenTo'](_0x509389,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x509389),{'priority':'lowest'}),_0x509389['model']['document']['registerPostFixer'](_0x796c7c=>this['_validateMarkers'](_0x509389,_0x796c7c)),_0x509389['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x509389)),this['_reviewEditingAttachedEditors']['add'](_0x509389));}['_updateMouseMarkerInteractionListeners'](_0x1f7852){let _0x9f1db5=this['_boundEditables']['get'](_0x1f7852);_0x9f1db5||(_0x9f1db5=new Map(),this['_boundEditables']['set'](_0x1f7852,_0x9f1db5));const _0x34e1c4=new Set(_0x1f7852['ui']['getEditableElementsNames']());for(const _0x511527 of _0x34e1c4){if(_0x9f1db5['has'](_0x511527))continue;const _0x1df22c=_0x1f7852['ui']['getEditableElement'](_0x511527);_0x9f1db5['set'](_0x511527,_0x1df22c),this['_attachMouseMarkerInteractionListeners'](_0x1df22c);}for(const [_0x30bc2d,_0x1cf6a5]of _0x9f1db5)_0x34e1c4['has'](_0x30bc2d)||(_0x9f1db5['delete'](_0x30bc2d),this['_domEmitter']['stopListening'](_0x1cf6a5));}['_attachMouseMarkerInteractionListeners'](_0x15f13b){this['_domEmitter']['listenTo'](_0x15f13b,'mouseup',(_0x526297,_0xd167ec)=>{const _0x2b662d=_0xd167ec['target'],_0x410113=this['_findMarkerElement'](_0x2b662d);if(!_0x410113)return;const _0x248208=_0x410113['getAttribute']('data-marker-id'),_0x5023fd=_0x248208['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x248208,'changeId':_0x5023fd,'markerElement':()=>this['_findMarkerElementById'](_0x248208),'domEvent':_0xd167ec});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x15f13b,'mouseover',(_0x59731b,_0x59fc74)=>{const _0x2fc52d=_0x59fc74['target'],_0x3ab5f1=_0x59fc74['relatedTarget'];let _0x339f0e=this['_findMarkerElement'](_0x2fc52d);if(!_0x339f0e&&_0x3ab5f1&&(_0x339f0e=this['_findMarkerElement'](_0x3ab5f1)),!_0x339f0e)return;const _0x356bdd=_0x339f0e['getAttribute']('data-marker-id'),_0x14bc07=_0x356bdd['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x14bc07,'markerElement':()=>this['_findMarkerElementById'](_0x356bdd),'domEvent':_0x59fc74});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x5d2c2e((_0x5b3a0d,_0x5963aa)=>{const _0x2c35e7=_0x5963aa['target'];this['_findMarkerElement'](_0x2c35e7)||_0x2c35e7['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x453ca1=this['context']['plugins']['get']('AIEditing'),_0x5097b9=ds(this['context']);if(!_0x5097b9['length'])throw new ht('ai-get-editor-from-context-no-editor',this);const _0x3682eb=new Set(),_0x3d0098=[],_0xeb844c=new Map();for(const _0x556a7c of _0x5097b9)for(const _0x29d001 of _0x556a7c['model']['document']['getRoots']()){if('$graveyard'===_0x29d001['rootName'])continue;const _0x2f93db=this['_buildDocumentDataSliceForRoot'](_0x556a7c,_0x29d001,_0x453ca1,_0x3682eb);_0x3d0098['push'](_0x2f93db['content']);for(const [_0x124fc7,_0x6c4bf0]of _0x2f93db['elements'])_0xeb844c['set'](_0x124fc7,_0x6c4bf0);}return{'elements':_0xeb844c,'content':_0x3d0098['join']('')};}['_buildDocumentDataSliceForRoot'](_0x590ff5,_0x55c5b4,_0x3530f6,_0x576af6){const _0x68688b=_0x590ff5['model'],_0x10e98e=new _0x2868da();for(const _0x3c80e8 of _0x55c5b4['getChildren']())_0x10e98e['_appendChild'](_0x3c80e8['_clone'](!0x0));for(const _0x3370f2 of _0x68688b['markers']){const _0x13d07b=_0x3370f2['getRange']();_0x13d07b&&_0x13d07b['root']['rootName']===_0x55c5b4['rootName']&&_0x10e98e['markers']['set'](_0x3370f2['name'],this['_changeRangeOwnerDocument'](_0x13d07b['clone'](),_0x10e98e));}const _0x197990=new Map(),_0x12ae4c=_0x68688b['document']['version'],_0x41aa26=new _0x143bbc({'ignoreElementEnd':!0x0,'startPosition':_0x68688b['createPositionAt'](_0x10e98e,0x0)});for(const {item:_0x36776e}of _0x41aa26){if(_0x36776e['is']('element')&&_0x36776e['name']&&ah['includes'](_0x36776e['name'])){const _0x398239=this['_upsertDataId'](_0x36776e,()=>_0x3530f6['_nextDataId'](_0x576af6));_0x576af6['add'](_0x398239);}if(!_0x36776e['is']('$textProxy'))continue;const _0x97e24=_0x36776e['parent'];if(!_0x97e24||!_0x97e24['is']('element'))continue;const _0x2db340=this['_upsertDataId'](_0x97e24,()=>_0x3530f6['_nextDataId'](_0x576af6));_0x576af6['add'](_0x2db340);for(const _0x1296b3 of _0x97e24['getChildren']())_0x1296b3['is']('element')&&(_0x1296b3['name']&&oh['includes'](_0x1296b3['name'])||_0x576af6['add'](this['_upsertDataId'](_0x1296b3,()=>_0x3530f6['_nextDataId'](_0x576af6))));let _0x20705f=_0x97e24;for(;_0x20705f['parent']&&!_0x20705f['parent']['is']('documentFragment');)_0x20705f=_0x20705f['parent'],_0x20705f['hasAttribute'](_0x5e92a3)&&_0x20705f['_removeAttribute'](_0x5e92a3);_0x197990['set'](_0x2db340,{'editor':_0x590ff5,'rootName':_0x55c5b4['rootName'],'path':_0x97e24['getPath'](),'documentVersion':_0x12ae4c,'getContent':this['_createGetContentUsingDataIdFn'](_0x20705f['_clone'](!0x0),_0x2db340,_0x590ff5['data'])}),_0x41aa26['jumpTo'](_0x68688b['createPositionAfter'](_0x97e24));}return{'content':_0x590ff5['data']['processor']['toData'](_0x590ff5['data']['toView'](_0x10e98e)),'elements':_0x197990};}['diffContent'](_0x512c54,_0x5f1d5a,_0x44d4fd,_0x3c45bd=!0x1){const {contentInitial:_0x3e64b4,contentNew:_0x1b419d}=this['_neutralizeChangesOnUnsupportedElements'](_0x5f1d5a,_0x44d4fd),_0x459566=[],_0x3273ce=_0x512c54['data']['parse'](_0x1b419d,'$documentFragment'),_0x1e7fa4=_0x512c54['data']['parse'](_0x3e64b4,'$documentFragment'),_0x8feecb=_0x512c54['model']['createPositionAt'](_0x1e7fa4,0x0);if(this['_haveSingleTopLevelElement'](_0x3273ce)){if(!this['_hasSameTopLevelElement'](_0x1e7fa4,_0x3273ce))return _0x459566;}else{const _0x1487b1=_0x512c54['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x1e7fa4,_0x1487b1)||!this['_haveOnlyInlineContent'](_0x3273ce,_0x1487b1))return _0x459566;}const _0x5158d1=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x3e64b4,_0x1b419d,{'targetEditor':_0x512c54,'anchor':_0x8feecb,'markDeletions':!0x0})['getOperations']()['filter'](_0x4adc02=>'insert'===_0x4adc02['type']||'marker'===_0x4adc02['type']&&_0x4adc02['name']['startsWith']('$markedRemove')),_0x115255=this['_groupAdjacentOperations'](_0x5158d1),_0x5de421=[];if(_0x3c45bd){if(_0x115255['length']){const _0x1e6740=_0x115255[0x0]['operations'][0x0],_0x293609='insert'===_0x1e6740['type']?_0x1e6740['position']:_0x1e6740['newRange']['start'],_0x381831=this['_getPositionLimitingRange'](_0x293609,_0x512c54,'inside'),_0x436ac8=_0x381831?_0x3273ce['getChild'](0x0)['getChildren']():_0x3273ce['getChildren'](),_0x4c341e=_0x381831||_0x512c54['model']['createRangeIn'](_0x1e7fa4),_0x1cde21=[new _0x11ea10('$markedRemove:synthetic'+vt(),null,_0x4c341e,_0x512c54['model']['document']['model']['markers'],!0x0,_0x512c54['model']['document']['version']+0x1),new _0x416680(_0x4c341e['end'],_0x436ac8,_0x512c54['model']['document']['version']+0x2)];_0x5de421['push']({'operations':_0x1cde21,'operationsIsolated':_0x1cde21,'groupOffset':0x0});}}else _0x5de421['push'](..._0x115255);let _0x401b3c=0x0;return _0x512c54['model']['change'](_0x4ae01b=>{for(let _0x303d0a=0x0;_0x303d0a<_0x5de421['length'];_0x303d0a++){const _0x50b934=_0x5de421[_0x303d0a],_0x285496=_0x4ae01b['createDocumentFragment']();for(const _0x544eef of _0x1e7fa4['getChildren']())_0x4ae01b['append'](_0x544eef['_clone'](!0x0),_0x285496);for(const _0x84daf of _0x50b934['operationsIsolated'])if('insert'===_0x84daf['type']){const _0x42e4c9=_0x84daf;_0x42e4c9['baseVersion']=null,_0x42e4c9['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x42e4c9,_0x285496),_0x4ae01b['batch']['addOperation'](_0x84daf),_0x512c54['model']['applyOperation'](_0x84daf);const _0x2ce20e='suggestion:insertion:id:authorId:'+_0x401b3c++,_0x26ab08=_0x512c54['model']['createRange'](_0x42e4c9['position'],_0x42e4c9['position']['getShiftedBy'](_0x42e4c9['howMany']));_0x285496['markers']['set'](_0x2ce20e,_0x26ab08);}else{if('marker'===_0x84daf['type']&&_0x84daf['name']['startsWith']('$markedRemove')){const _0x5edf0c=_0x84daf,_0x16dbea='suggestion:deletion:id:authorId:'+_0x401b3c++;this['_changeOperationOwnerDocument'](_0x5edf0c,_0x285496),_0x285496['markers']['set'](_0x16dbea,_0x5edf0c['newRange']);}}if(_0x3c45bd)_0x459566['push']({..._0x50b934,'context':this['_createGetContentFn'](_0x1e7fa4,_0x512c54['data']),'content':this['_createGetContentFn'](_0x1e7fa4,_0x512c54['data'])});else{const _0x35b03b=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x50b934['operationsIsolated'][0x0]),_0x285496),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x50b934['operationsIsolated'][_0x50b934['operationsIsolated']['length']-0x1]),_0x285496),_0x512c54);_0x285496['markers']['set'](rh+'suggestion-context',new _0x4e8468(_0x35b03b['start'],_0x35b03b['end'])),_0x459566['push']({..._0x50b934,'context':this['_createGetContextFn'](_0x285496,_0x512c54['data'],{'ellipsisBefore':_0x35b03b['hasContentBefore'],'ellipsisAfter':_0x35b03b['hasContentAfter']}),'content':this['_createGetContentFn'](_0x285496,_0x512c54['data'])});}}}),_0x459566;}['markChangePositionInEditorContent'](_0x3f397e,_0x1545f8){if(!_0x3f397e['length'])return;const _0x50b76c=_0x3f397e[0x0]['parent']['id'],_0x1a3784=_0x1545f8['elements']['get'](_0x50b76c);if(!_0x1a3784)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x50b76c);const _0x2fa2c9=_0x1a3784['path'],_0x1871f6=_0x1a3784['editor'],_0x3d4e27=_0x1871f6['model']['document']['getRoot'](_0x1a3784['rootName']);if(!_0x3d4e27)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x1a3784['rootName']);const _0x1aebb2=_0x1871f6['model']['document']['history']['getOperations'](_0x1a3784['documentVersion']),_0x1bb2b7=[];for(const _0x7895ce of _0x3f397e){const _0x49d581=_0x7895ce['operationsIsolated']['map'](_0x3a8581=>this['_translateOperationToEditorContent'](_0x3a8581,_0x2fa2c9,_0x3d4e27));if(!_0x49d581||!_0x49d581['length'])continue;const _0x2559da=_0x49d581['every'](_0x454ad5=>'marker'===_0x454ad5['type']&&_0x454ad5['name']['startsWith']('$markedRemove')),_0x1fc834=_0x29e916(_0x49d581,_0x1aebb2,{'document':_0x1871f6['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0x424660 of _0x1fc834)if('insert'===_0x424660['type']){const _0x15fd41=_0x424660,_0x2816dc=_0x15fd41['nodes'];_0x1871f6['model']['change'](_0x32f1eb=>{const _0x2cc4b5=_0x32f1eb['createDocumentFragment']();for(const _0x5107e7 of _0x2816dc)_0x32f1eb['append'](_0x5107e7['_clone'](!0x0),_0x2cc4b5);_0x1bb2b7['push']({'start':_0x15fd41['position'],'end':_0x15fd41['position'],'type':'insert','groupId':_0x7895ce['id'],'content':{'asString':this['_createGetContentFn'](_0x2cc4b5,_0x1871f6['data'])(),'asFragment':_0x2cc4b5}});});}else{if('marker'===_0x424660['type']&&_0x424660['name']['startsWith']('$markedRemove')){const _0x7e9926=_0x424660;let _0xe6ae73='remove-text';if(_0x2559da){const _0x24c522=this['_findAdjacentContextDistance'](_0x7e9926['newRange']['start'],'backward',_0x1871f6['model']['schema']),_0xea5e98=this['_findAdjacentContextDistance'](_0x7e9926['newRange']['end'],'forward',_0x1871f6['model']['schema']);if(_0x24c522||_0xea5e98){const _0x111120=_0x7e9926['newRange']['start']['getShiftedBy'](-_0x24c522),_0x3c74c7=_0x7e9926['newRange']['end']['getShiftedBy'](_0xea5e98);_0x1bb2b7['push']({'start':_0x111120,'end':_0x3c74c7,'groupId':_0x7895ce['id'],'type':'remove-context'});}else _0xe6ae73='remove-only';}_0x1bb2b7['push']({'start':_0x7e9926['newRange']['start'],'end':_0x7e9926['newRange']['end'],'groupId':_0x7895ce['id'],'type':_0xe6ae73});}}}this['_insertMarkers'](_0x1bb2b7,_0x1871f6);}['clearAllMarkers'](){const _0x1f143a=new Map();for(const _0x2bcc77 of this['_markers']['keys']()){const _0x5c550c=this['_markers']['get'](_0x2bcc77);_0x5c550c?.['editor']&&(_0x1f143a['has'](_0x5c550c['editor'])||_0x1f143a['set'](_0x5c550c['editor'],[]),_0x1f143a['get'](_0x5c550c['editor'])['push'](_0x2bcc77));}for(const [_0x273a82,_0x7bd1e8]of _0x1f143a)_0x273a82['model']['change'](_0x2777b9=>{for(const _0x167488 of _0x7bd1e8)_0x273a82['model']['markers']['get'](_0x167488)&&_0x2777b9['removeMarker'](_0x167488);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x4ad304 of ds(this['context']))_0x4ad304['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x5074ff of ds(this['context']))_0x5074ff['disableReadOnlyMode']('ai-review');}['applyChange'](_0x3c0f00,_0x12253f=null){const _0x538c0b=_0x3c0f00['map'](_0x9b9348=>this['_getMarkersDataForGroup'](_0x9b9348))['flat'](),_0xc8c2bb=new Map();for(const _0x1754e8 of _0x538c0b)_0xc8c2bb['has'](_0x1754e8['editor'])||_0xc8c2bb['set'](_0x1754e8['editor'],[]),_0xc8c2bb['get'](_0x1754e8['editor'])['push'](_0x1754e8);for(const [_0x238841,_0x319448]of _0xc8c2bb){const _0x303799=_0x238841['model'],_0x50ba03=_0x238841['plugins']['has']('TrackChangesEditing')?_0x238841['plugins']['get']('TrackChangesEditing'):null,_0x5a8a20=_0x12253f&&_0x50ba03?new Set(_0x50ba03['getSuggestions']()['map'](_0x292750=>_0x292750['id'])):null;_0x303799['change'](_0x4456fb=>{const _0x1b2315=_0x4456fb['batch']['operations']['length'];for(const _0x264810 of _0x319448){const _0x46645b=_0x238841['model']['markers']['get'](_0x264810['id']);if(_0x46645b){if('insert'===_0x264810['type']){if(!_0x264810['content'])continue;_0x303799['insertContent'](_0x264810['content']['asFragment']||null,_0x46645b['getRange']()['start']);}else'remove-text'!==_0x264810['type']&&'remove-only'!==_0x264810['type']||_0x303799['deleteContent'](_0x303799['createSelection'](_0x46645b['getRange']()));_0x4456fb['removeMarker'](_0x264810['id']),this['_markers']['delete'](_0x264810['id']);}}if(_0x12253f&&(zs(_0x4456fb['batch']['operations']['slice'](_0x1b2315),_0x12253f),_0x50ba03)){for(const _0x19bbbe of _0x50ba03['getSuggestions']())_0x5a8a20['has'](_0x19bbbe['id'])||_0x19bbbe['setAttribute']('@ai',{'type':_0x12253f});}});}}['rejectChange'](_0x4e44fd){const _0x510af6=this['_getMarkersDataForGroup'](_0x4e44fd),_0x251202=new Map();for(const _0x333762 of _0x510af6)_0x251202['has'](_0x333762['editor'])||_0x251202['set'](_0x333762['editor'],[]),_0x251202['get'](_0x333762['editor'])['push'](_0x333762);for(const [_0x5d3b85,_0x41fdea]of _0x251202)_0x5d3b85['model']['change'](_0x4a6dd5=>{for(const _0xd6878f of _0x41fdea)_0x4a6dd5['removeMarker'](_0xd6878f['id']),this['_markers']['delete'](_0xd6878f['id']);});}['getEditor'](){return _s(this['context']);}['getEditors'](){return ds(this['context']);}['getEditorForChange'](_0x4e047d){return this['_getMarkersDataForGroup'](_0x4e047d)[0x0]?.['editor'];}['getMarkerElementForChange'](_0x55cb9a){const _0x272c06=Array['from'](this['_markers']['values']())['filter'](_0x25f82d=>_0x25f82d['groupId']===_0x55cb9a);if(!_0x272c06['length'])return null;const _0x3eb975=0x1===_0x272c06['length']?_0x272c06[0x0]:this['_sortMarkers'](_0x272c06)[0x0],_0x56023d=_0x3eb975['editor']['model']['markers']['get'](_0x3eb975['id']);return _0x56023d?{'modelRange':_0x56023d['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x3eb975['id'])}:null;}['getContentElementForChange'](_0x1b0cc8){const _0xd0945c=Array['from'](this['_markers']['values']())['filter'](_0x8167c6=>_0x8167c6['groupId']===_0x1b0cc8);if(!_0xd0945c['length'])return null;const _0x19d3ba=0x1===_0xd0945c['length']?_0xd0945c[0x0]:this['_sortMarkers'](_0xd0945c)[0x0],_0x594300=_0x19d3ba['editor'],_0x7d2045=_0x594300['model']['markers']['get'](_0x19d3ba['id']);if(!_0x7d2045)return null;const _0x2b6617=_0x7d2045['getRange'](),_0x2408df=_0x594300['editing']['view']['getDomRoot'](_0x2b6617['root']['rootName'])||_0x594300['editing']['view']['getDomRoot']();if(!_0x2408df||!_0x2b6617)return null;let _0x4d7220=_0x2b6617['start']['parent'];for(;_0x4d7220['parent']&&!_0x4d7220['parent']['is']('rootElement');)_0x4d7220=_0x4d7220['parent'];if(!_0x4d7220||!_0x4d7220['name'])return null;const _0x59854f=_0x2408df['querySelector']('[data-marker-id=\x22'+_0x19d3ba['id']+'\x22]');if(!_0x59854f)return null;let _0x196c89=null;_0x594300['model']['change'](_0x50a96d=>{_0x196c89=_0x50a96d['createDocumentFragment'](),_0x50a96d['append'](_0x4d7220['_clone'](!0x0),_0x196c89);});const _0x54293d=_0x594300['data']['toView'](_0x196c89)['getChild'](0x0);return _0x59854f['closest'](_0x54293d['name']);}['reactivateMarkers'](_0x17a091){const _0x3c4288=this['_getMarkersDataForGroup'](_0x17a091);if(!_0x3c4288['length'])return;const _0x2621aa=Array['from'](this['_activeMarkers'])['sort'](),_0x196ca9=Array['from'](new Set(_0x3c4288['map'](_0x1922b5=>_0x1922b5['id'])))['sort']();_0x2621aa['join']('|')!==_0x196ca9['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x17a091));}['setMarkersInElementAsActive'](_0x5de44d){const _0x54b970=this['_getMarkersDataForGroup'](_0x5de44d);if(!_0x54b970['length'])return;const _0x466025=_0x54b970[0x0]['editor'],_0x524075=new Set(_0x54b970['map'](_0x1b86bb=>_0x1b86bb['id'])),_0x433cb1=Array['from'](_0x524075['values']())['map'](_0x3f1815=>_0x466025['model']['markers']['get'](_0x3f1815))['filter'](_0x5d923a=>!!_0x5d923a);_0x524075['forEach'](_0x29e167=>{this['_activeMarkers']['add'](_0x29e167);}),_0x466025['model']['change'](()=>{_0x433cb1['forEach'](_0x123a5a=>{_0x466025['editing']['reconvertMarker'](_0x123a5a);});});}['setAllMarkersAsInactive'](){const _0xc5271e=Array['from'](this['_activeMarkers']);if(!_0xc5271e['length'])return;this['_activeMarkers']['clear']();const _0x29940d=new Map();for(const _0x33aa85 of _0xc5271e){const _0x479538=this['_markers']['get'](_0x33aa85);if(!_0x479538)continue;const _0x5663a9=_0x479538['editor'],_0x67cb8f=_0x5663a9['model']['markers']['get'](_0x33aa85);_0x67cb8f&&(_0x29940d['has'](_0x5663a9)||_0x29940d['set'](_0x5663a9,[]),_0x29940d['get'](_0x5663a9)['push'](_0x67cb8f));}for(const [_0x5861bc,_0x2a302f]of _0x29940d)_0x5861bc['model']['change'](()=>{_0x2a302f['forEach'](_0xa1900=>{_0x5861bc['editing']['reconvertMarker'](_0xa1900);});});}['_getPositionLimitingRange'](_0x4d88b5,_0x5dd0ed,_0x405505='outside'){if(!_0x4d88b5)return null;let _0x1b5c0d=_0x4d88b5['parent'];for(;_0x1b5c0d&&_0x1b5c0d['parent']&&!_0x1b5c0d['parent']['is']('rootElement')&&!_0x5dd0ed['model']['schema']['isLimit'](_0x1b5c0d)&&!_0x5dd0ed['model']['schema']['isBlock'](_0x1b5c0d);)_0x1b5c0d=_0x1b5c0d['parent'];if(!_0x1b5c0d||!_0x1b5c0d['name']||_0x1b5c0d['is']('rootElement'))return null;let _0xad3a56=null;return _0x5dd0ed['model']['change'](_0x42995d=>{_0xad3a56='inside'===_0x405505?_0x42995d['createRangeIn'](_0x1b5c0d):_0x42995d['createRangeOn'](_0x1b5c0d);}),_0xad3a56;}['_validateMarkers'](_0x41e85e,_0x4c4c59){const _0x133c65=Array['from'](this['_markers']['keys']()),_0x209b6b=new Map();for(const _0x5c253a of _0x133c65){const _0x39b764=_0x41e85e['model']['markers']['get'](_0x5c253a);if(!_0x39b764)continue;const _0x403f52=_0x39b764['getStart']()['root']['rootName']+':'+_0x39b764['getStart']()['path'][0x0];_0x209b6b['has'](_0x403f52)||_0x209b6b['set'](_0x403f52,[]),_0x209b6b['get'](_0x403f52)['push'](_0x39b764);}const _0x2ce69b=new Set();for(const _0x1b5ff0 of _0x41e85e['model']['document']['differ']['getChanges']()){let _0x2e0f1e='',_0x484273=null;if('insert'===_0x1b5ff0['type'])_0x484273=new _0x4e8468(_0x1b5ff0['position'],_0x1b5ff0['position']['getShiftedBy'](_0x1b5ff0['length'])),_0x2e0f1e=_0x1b5ff0['position']['root']['rootName']+':'+_0x1b5ff0['position']['path'][0x0];else{if('remove'!==_0x1b5ff0['type'])continue;_0x484273=new _0x4e8468(_0x1b5ff0['position']),_0x2e0f1e=_0x1b5ff0['position']['root']['rootName']+':'+_0x1b5ff0['position']['path'][0x0];}const _0x4992ba=_0x209b6b['get'](_0x2e0f1e)||[];if(_0x4992ba['length']){for(const _0x20563d of _0x4992ba)if(_0x484273['root']['rootName']===_0x20563d['getRange']()['root']['rootName']&&('insert'!==_0x1b5ff0['type']||!_0x484273['containsRange'](_0x20563d['getRange']()))&&(_0x484273['isIntersecting'](_0x20563d['getRange']())||_0x484273['start']['isTouching'](_0x20563d['getRange']()['end'])||_0x484273['end']['isTouching'](_0x20563d['getRange']()['start']))){const _0xfdb3b4=this['_parseMarkerName'](_0x20563d['name']);Array['from'](this['_markers']['values']())['filter'](_0xca819c=>_0xca819c['groupId']===_0xfdb3b4['groupId'])['forEach'](_0x3b67fc=>_0x2ce69b['add'](_0x3b67fc['id']));}}}if(_0x2ce69b['size']){for(const _0xbdd01a of _0x2ce69b)_0x4c4c59['removeMarker'](_0xbdd01a);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x356507){for(const {name:_0x1c3cf1,data:_0x1d5078}of _0x356507['model']['document']['differ']['getChangedMarkers']()){if(!_0x1c3cf1['startsWith'](rh))continue;const _0x3d3148=_0x1d5078['oldRange'],_0x1517c9=_0x1d5078['newRange'],_0x3e38cc=_0x3d3148&&'$graveyard'===_0x3d3148['root']['rootName'],_0x2cc604=_0x1517c9&&'$graveyard'===_0x1517c9['root']['rootName'];if(_0x3e38cc&&_0x2cc604)continue;const _0x573f02=this['_parseMarkerName'](_0x1c3cf1);this['_markers']['get'](_0x1c3cf1)&&(_0x2cc604||!_0x1517c9?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x1c3cf1,'changeId':_0x573f02['groupId']}):_0x3e38cc&&_0x1517c9&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x1c3cf1,'changeId':_0x573f02['groupId']}));}}['_parseMarkerName'](_0x388d8e){const _0xa3a855=_0x388d8e['split'](':'),_0x367d4d=(_0xa3a855[0x1]||'')['split']('_');return{'prefix':_0xa3a855[0x0],'groupId':_0x367d4d[0x0],'suffix':_0x367d4d[0x1]};}['_translateOperationToEditorContent'](_0x9909d4,_0xf293c7,_0x532a25){if('insert'===_0x9909d4['type']){const _0x3cd6c3=_0x9909d4;return new _0x416680(this['_changePosition'](_0xf293c7['concat'](_0x3cd6c3['position']['offset']),_0x532a25),_0x3cd6c3['nodes'],_0x3cd6c3['baseVersion']);}if('marker'===_0x9909d4['type']&&_0x9909d4['name']['startsWith']('$markedRemove')){const _0x100b27=_0x9909d4;return new _0x11ea10(_0x100b27['name'],_0x100b27['oldRange'],this['_changeRange'](_0x100b27['newRange'],_0xf293c7['concat'](_0x100b27['newRange']['start']['offset']),_0xf293c7['concat'](_0x100b27['newRange']['end']['offset']),_0x532a25),_0x100b27['_markers'],_0x100b27['affectsData'],_0x100b27['baseVersion']);}return _0x9909d4;}['_groupAdjacentOperations'](_0x52bc5f){if(!_0x52bc5f['length'])return[];const _0x820566=[];let _0x54461f=0x0,_0x6aa858=0x0,_0x21aa98=[];for(let _0x5dd967=0x0;_0x5dd967<=_0x52bc5f['length'];_0x5dd967++){const _0x57be30=_0x52bc5f[_0x5dd967],_0x1b0215=_0x52bc5f[_0x5dd967-0x1];!_0x57be30||_0x1b0215&&!this['_getOperationEnd'](_0x1b0215)['isTouching'](this['_getOperationStart'](_0x57be30))?(_0x820566['push']({'operations':_0x21aa98,'operationsIsolated':_0x21aa98['map'](_0x1a4878=>this['_shiftOperation'](_0x1a4878['clone'](),-_0x6aa858)),'groupOffset':_0x54461f}),_0x21aa98=_0x57be30?[_0x57be30]:[],_0x6aa858+=_0x54461f,_0x54461f=0x0):_0x21aa98['push'](_0x57be30),_0x57be30&&'insert'===_0x57be30['type']&&(_0x54461f+=_0x57be30['howMany']);}return _0x820566;}['_findAdjacentContextDistance'](_0x470c4c,_0x2045cc,_0x441696,_0x15ec78=0x1){const _0x1f9a4e=new _0x143bbc({'startPosition':_0x470c4c,'direction':_0x2045cc});let _0x3991b2=0x0;for(let _0x360c7e=0x0;_0x360c7e<_0x15ec78;_0x360c7e++){let _0x41071d=0x0,_0x7a86be=!0x1,_0xc723df='forward'===_0x2045cc?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x1b584c}of _0x1f9a4e)if(_0x1b584c['is']('$textProxy')){const _0x4f96c7=_0xc723df['exec'](_0x1b584c['data']);if(_0x4f96c7&&_0x4f96c7['length']){if(_0x41071d+='forward'===_0x2045cc?_0x4f96c7['index']+_0x4f96c7[0x0]['length']:_0x1b584c['data']['length']-_0x4f96c7['index'],_0x4f96c7[0x0]['length']!==_0x1b584c['data']['length'])break;_0x7a86be=!0x0,_0xc723df='forward'===_0x2045cc?/^\w+/:/\w+$/;}else{if(_0x7a86be)break;_0x41071d+=_0x1b584c['offsetSize'];}}else{if(_0x1b584c['is']('element')){_0x441696['isInline'](_0x1b584c)&&!_0x7a86be&&(_0x41071d+=0x1);break;}}_0x3991b2+=_0x41071d,_0x1f9a4e['jumpTo'](_0x470c4c['getShiftedBy']('forward'===_0x2045cc?_0x3991b2:-_0x3991b2));}return _0x3991b2;}['_getChangeContext'](_0x26fdfc,_0x13ad47,_0x3b9473){const _0x5e8f24=_0x3b9473['model']['schema'],_0x26b554=this['_findAdjacentContextDistance'](_0x26fdfc,'backward',_0x5e8f24,0x6),_0x457bb8=this['_findAdjacentContextDistance'](_0x13ad47,'forward',_0x5e8f24,0x6),_0x5d0b01=_0x26fdfc['getShiftedBy'](-_0x26b554),_0x427d39=_0x13ad47['getShiftedBy'](_0x457bb8);return{'start':_0x5d0b01,'end':_0x427d39,'hasContentBefore':!_0x5d0b01['isAtStart'],'hasContentAfter':!_0x427d39['isAtEnd']};}['_insertMarkers'](_0x2ebe2c,_0x120d1b){const _0x479f12=this['context']['plugins']['get']('AIEditing'),_0x299b53=new Set();_0x120d1b['model']['change'](_0x42b19b=>{for(const _0x306f8d of _0x2ebe2c){const _0x498e4a=''+rh+_0x306f8d['type']+':'+_0x306f8d['groupId']+'_'+_0x479f12['_nextDataId'](_0x299b53);this['_markers']['set'](_0x498e4a,{'id':_0x498e4a,'groupId':_0x306f8d['groupId'],'type':_0x306f8d['type'],'content':_0x306f8d['content'],'editor':_0x120d1b}),_0x42b19b['addMarker'](_0x498e4a,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x42b19b['createRange'](_0x306f8d['start'],_0x306f8d['end'])});}});}['_createGetContextFn'](_0x358433,_0xa731bf,_0x4d9bca){let _0x5e1608='';return()=>{if(!_0x5e1608){const _0x20703f=_0xa731bf['toView'](_0x358433,{'showSuggestionHighlights':!0x0});let _0x30d13e=_0x20703f['getChild'](0x0);if(_0x30d13e['is']('containerElement')||(_0x30d13e=_0x20703f),!_0x30d13e)return'';let _0x5733d0=!0x1;const _0x5a1af9=[];for(const _0x54a7a7 of _0x30d13e['getChildren']())_0x54a7a7['is']('element','span')&&_0x54a7a7['hasClass']('ck-ai_review-marker_context-end')&&(_0x5733d0=!0x1),_0x5733d0&&_0x5a1af9['push'](_0x54a7a7),_0x54a7a7['is']('element','span')&&_0x54a7a7['hasClass']('ck-ai_review-marker_context-start')&&(_0x5733d0=!0x0);_0x30d13e['_removeChildren'](0x0,_0x30d13e['childCount']),_0x4d9bca?.['ellipsisBefore']&&_0x30d13e['_appendChild']('…'),_0x30d13e['_appendChild'](_0x5a1af9),_0x4d9bca?.['ellipsisAfter']&&_0x30d13e['_appendChild']('…');const _0x1d2327=_0xa731bf['htmlProcessor']['domConverter']['viewToDom'](_0x20703f),_0x207bbb=_0xa731bf['htmlProcessor']['htmlWriter']['getHtml'](_0x1d2327);_0x5e1608=this['_removeUnsupportedElements'](_0x207bbb);}return _0x5e1608;};}['_createGetContentFn'](_0x560bfb,_0x2332ea){let _0x542c83='';return()=>(_0x542c83||(_0x542c83=this['_removeUnsupportedElements'](_0x2332ea['stringify'](_0x560bfb,{'showSuggestionHighlights':!0x0}))),_0x542c83);}['_createGetContentUsingDataIdFn'](_0x13f28f,_0x426626,_0x1057fd){let _0x322072='';return()=>{if(!_0x322072){const _0x2d2fd4=_0x1057fd['toView'](new _0x2868da(_0x13f28f));_0x322072=_0x1057fd['htmlProcessor']['domConverter']['viewToDom'](_0x2d2fd4)['querySelector']('[data-id=\x22'+_0x426626+'\x22]')?.['outerHTML']||'';}return _0x322072;};}['_removeUnsupportedElements'](_0x5a0ad1){if(!_0x5a0ad1)return'';const _0x1adfd7=ps(_0x5a0ad1,{'decodeEntities':!0x1}),_0x1c314f=ws(_0x1adfd7);if(!_0x1c314f['length'])return _0x5a0ad1;for(const _0x3b0f94 of _0x1c314f)_0x2a7599(_0x3b0f94);return ms(_0x1adfd7,{'encodeEntities':!0x1});}['_neutralizeChangesOnUnsupportedElements'](_0xe35631,_0x424b18){const _0x4bae61=ps(_0xe35631,{'decodeEntities':!0x1}),_0xff1b42=ps(_0x424b18,{'decodeEntities':!0x1}),_0x31692a=ws(_0x4bae61),_0x597d8e=ws(_0xff1b42);if(!_0x31692a['length']&&!_0x597d8e['length'])return{'contentInitial':_0xe35631,'contentNew':_0x424b18};const _0x11b9fb=new Map();for(const _0x53d05a of _0x31692a)_0x11b9fb['set'](fs(_0x53d05a,'data-id'),_0x53d05a);for(const _0x8364e9 of _0x597d8e){const _0x52828c=fs(_0x8364e9,'data-id'),_0x2a938f=_0x52828c?_0x11b9fb['get'](_0x52828c):void 0x0;_0x2a938f?_0x43a070(_0x8364e9,_0x373861(_0x2a938f,!0x0)):_0x2a7599(_0x8364e9);}return{'contentInitial':ms(_0x4bae61,{'encodeEntities':!0x1}),'contentNew':ms(_0xff1b42,{'encodeEntities':!0x1})};}['_findMarkerElement'](_0x2aaf37,_0x370ba3=0x5){let _0x2075a4=_0x2aaf37,_0x55fd26=null;for(let _0x419bac=0x0;_0x419bac<_0x370ba3&&_0x2075a4;_0x419bac++)if(_0x2075a4['className']){if((''+_0x2075a4['className'])['includes']('ck-ai_review-marker_')){if(!_0x2075a4['getAttribute']('data-marker-id'))break;_0x55fd26=_0x2075a4;break;}_0x2075a4=_0x2075a4['parentElement'];}else _0x2075a4=_0x2075a4['parentElement'];return _0x55fd26;}['_findMarkerElementById'](_0xd7f378){const _0x3c2f8e=this['_markers']['get'](_0xd7f378);if(!_0x3c2f8e)return null;const _0x50e7eb=_0x3c2f8e['editor']['model']['markers']['get'](_0xd7f378);return _0x50e7eb?_0x5e0b30(_0x3c2f8e['editor']['editing'],_0x50e7eb):null;}['_getMarkersDataForGroup'](_0x264217){return Array['from'](this['_markers']['values']())['filter'](_0x568f9c=>_0x568f9c['groupId']===_0x264217);}['_getOperationStart'](_0xabaf30){return'insert'===_0xabaf30['type']?_0xabaf30['position']:_0xabaf30['newRange']['start'];}['_getOperationEnd'](_0x467033,_0x3cf86e=!0x1){return'insert'===_0x467033['type']?_0x3cf86e?_0x467033['position']:_0x467033['position']['getShiftedBy'](_0x467033['howMany']):_0x467033['newRange']['end'];}['_shiftOperation'](_0x364088,_0x1c1d8c){return'insert'===_0x364088['type']?_0x364088['position']=_0x364088['position']['getShiftedBy'](_0x1c1d8c):'marker'===_0x364088['type']&&_0x364088['newRange']&&(_0x364088['newRange']=new _0x4e8468(_0x364088['newRange']['start']['getShiftedBy'](_0x1c1d8c),_0x364088['newRange']['end']['getShiftedBy'](_0x1c1d8c))),_0x364088;}['_changeOperationOwnerDocument'](_0x52b635,_0x3ad44f){'insert'===_0x52b635['type']?_0x52b635['position']=this['_changePositionOwnerDocument'](_0x52b635['position'],_0x3ad44f):'marker'===_0x52b635['type']&&_0x52b635['newRange']&&(_0x52b635['newRange']=this['_changeRangeOwnerDocument'](_0x52b635['newRange'],_0x3ad44f));}['_changePositionOwnerDocument'](_0x51ade5,_0x3bf94e){return new _0x5d12c5(_0x3bf94e,_0x51ade5['path']);}['_changeRangeOwnerDocument'](_0x4a86ba,_0x32ec48){return new _0x4e8468(this['_changePositionOwnerDocument'](_0x4a86ba['start'],_0x32ec48),this['_changePositionOwnerDocument'](_0x4a86ba['end'],_0x32ec48));}['_changePosition'](_0x2ef5d6,_0x2f42ee){return new _0x5d12c5(_0x2f42ee,[..._0x2ef5d6]);}['_changeRange'](_0x5b6af9,_0x38b08a,_0xe4bd1d,_0x2ce34f){return new _0x4e8468(this['_changePosition'](_0x38b08a,_0x2ce34f),this['_changePosition'](_0xe4bd1d,_0x2ce34f));}['_sortMarkers'](_0x3aea5e){const _0x222cd8=_0x2cd6b9=>{switch(_0x2cd6b9){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x3aea5e['sort']((_0x31105a,_0xb79af5)=>_0x222cd8(_0x31105a['type'])-_0x222cd8(_0xb79af5['type']));}['_hasSameTopLevelElement'](_0x4b8fba,_0x1e0acf){const _0x1e8501=_0x4b8fba['getChild'](0x0),_0xbff150=_0x1e0acf['getChild'](0x0);return!(!_0x1e8501||!_0xbff150)&&((!_0x1e8501['is']('element')||!_0xbff150['is']('element')||_0x1e8501['name']===_0xbff150['name'])&&!(_0x1e8501['is']('element')&&!_0xbff150['is']('element')||!_0x1e8501['is']('element')&&_0xbff150['is']('element')));}['_haveSingleTopLevelElement'](_0x1b80f0){return 0x1===_0x1b80f0['childCount'];}['_haveOnlyInlineContent'](_0x3f251,_0x89134b){for(const _0x562fae of _0x3f251['getChildren']())if(_0x562fae['is']('element')&&!_0x89134b['isInline'](_0x562fae))return!0x1;return!0x0;}['_upsertDataId'](_0xff85ef,_0x4ebe1b){let _0x1bab49=_0xff85ef['getAttribute'](_0x5e92a3);return _0x1bab49||(_0x1bab49=_0x4ebe1b(),_0xff85ef['_setAttribute'](_0x5e92a3,_0x1bab49)),_0x1bab49;}};const ch=/* #__PURE__ -- @preserve */
38
+ ut();var lh=class extends ch{['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x38d447,contentNew:_0x2c8860,contentInitial:_0x336ecc,documentVersion:_0x4ddd09}){super(),this['id']=_0x38d447,this['contentNew']=_0x2c8860,this['contentInitial']=_0x336ecc,this['documentVersion']=_0x4ddd09;}};const uh=/* #__PURE__ -- @preserve */
39
+ gt();var dh=class extends uh{['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x32c048,_0x3c1bb5,_0x3050cf){super(),this['id']=_0x32c048,this['parent']=_0x3050cf,this['_data']=_0x3c1bb5,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']['slice']();}get['operationsIsolated'](){return this['_data']['operationsIsolated']['slice']();}};const _h=/* #__PURE__ -- @preserve */
40
+ gt();var gh=class extends _h{['id']=vt();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x57dffa,_0x1839fe,_0x1a4b7d,_0x1c8e22,_0xb03c34){super(),this['_sourceCheck']=_0x1839fe,this['_documentData']=_0x57dffa,this['_aiConnector']=_0x1a4b7d,this['_reviewParams']=_0x1c8e22,this['_reviewArgs']=_0xb03c34,this['on']('change:status',(_0xab1bc2,_0x3117b2,_0x13523d)=>{'aborted'==_0x13523d&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x13523d,'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'](_0x568328=>'pending'===_0x568328['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0x3244cb){this['_documentData']=_0x3244cb;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x1b3252=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x3b6449 of _0x1b3252)'unmodified'!==_0x3b6449['data']['operation']&&('error'!==_0x3b6449['data']['operation']?'review-metadata'!==_0x3b6449['event']?this['_addReviewCheckResult'](_0x3b6449['data']['dataId'],_0x3b6449['data']['textDelta']):this['callId']=_0x3b6449['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(_0x308f1f){this['_currentError']=_0x308f1f,en(_0x308f1f)?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'](_0x4c0f75,_0x3f1dff){const _0x4448b4=this['_results']['get'](_0x4c0f75);if(!_0x4448b4)return;if(0x0===_0x3f1dff['length'])return;const _0x437c85=[];_0x3f1dff['forEach']((_0x31862a,_0x52e6a9)=>{const _0x35bc72=new dh(_0x4448b4['id']+'-'+_0x52e6a9,_0x31862a,_0x4448b4);_0x35bc72['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x35bc72,'status':_0x35bc72['status']});}),_0x35bc72['on']('change:isActivated',()=>{_0x35bc72['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x35bc72}):this['fire']('reviewCheckResultDeactivated',{'change':_0x35bc72});}),this['_changes']['push'](_0x35bc72),_0x437c85['push'](_0x35bc72);}),this['fire']('reviewCheckResultReady',{'changes':_0x437c85,'result':_0x4448b4,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x4382b5){const _0x52a213=this['_changes']['find'](_0x1e6022=>_0x1e6022['id']===_0x4382b5);return!(!_0x52a213||'pending'!==_0x52a213['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x326d31=>!0x0===_0x326d31['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x3f7947=>'pending'===_0x3f7947['status']);}['getChangeById'](_0x1f83dd){return this['_changes']['find'](_0x3afc9d=>_0x3afc9d['id']===_0x1f83dd);}['markAllChangesAsAccepted'](){for(const _0x2402d2 of this['_changes'])'pending'===_0x2402d2['status']&&(_0x2402d2['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x36c7b6){const _0x13dcd0=this['_changes']['find'](_0xc5a06e=>_0xc5a06e['id']===_0x36c7b6);_0x13dcd0&&'pending'===_0x13dcd0['status']&&(_0x13dcd0['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0xc4a14d){const _0x3e3846=this['_changes']['find'](_0x431502=>_0x431502['id']===_0xc4a14d);_0x3e3846&&'pending'===_0x3e3846['status']&&(_0x3e3846['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x2c0039){const _0x1f40fb=this['_changes']['find'](_0x5d4e97=>_0x5d4e97['id']===_0x2c0039);_0x1f40fb&&'pending'===_0x1f40fb['status']&&(_0x1f40fb['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x57c668){const _0x532e0a=this['_changes']['find'](_0x23574f=>_0x23574f['id']===_0x57c668);_0x532e0a&&'outdated'===_0x532e0a['status']&&(_0x532e0a['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x5f133a){this['_changes']['filter'](_0x55c528=>_0x55c528['isActivated']&&_0x55c528['id']!==_0x5f133a)['forEach'](_0x5695fa=>{_0x5695fa['isActivated']=!0x1;});const _0x5371ee=this['_changes']['find'](_0x427b04=>_0x427b04['id']===_0x5f133a);_0x5371ee&&'pending'===_0x5371ee['status']&&(_0x5371ee['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x39609a=>_0x39609a['isActivated'])['forEach'](_0x1dbdee=>{_0x1dbdee['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x50461a){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x158b15;if(_0x50461a){const _0x532972=this['_changes']['find'](_0x2535c7=>_0x2535c7['id']===_0x50461a);if(_0x532972&&_0x532972['isRated'])return;_0x532972&&(_0x158b15=_0x532972['parent']['id'],_0x532972['isRated']=!0x0);}const _0x15fe45={'positiveCount':this['_changes']['filter'](_0xa546d=>'accepted'===_0xa546d['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x15fe45,this['callId'],_0x158b15);}['_addReviewCheckResult'](_0x5c33b5,_0x58933b){const _0x4c7388=this['_documentData']['elements']['get'](_0x5c33b5);if(!_0x4c7388)return;const _0x550e0f=_0x4c7388['getContent']();if(_0x550e0f===_0x58933b)return;const _0x2dc611=new lh({'id':_0x5c33b5,'contentInitial':_0x550e0f,'contentNew':_0x58933b,'documentVersion':_0x4c7388['documentVersion']});this['_results']['set'](_0x2dc611['id'],_0x2dc611),this['fire']('reviewCheckResultAdded',{'result':_0x2dc611,'source':this,'editor':_0x4c7388['editor']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0x2b79e4=>'pending'===_0x2b79e4['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x543e8c=>'pending'===_0x543e8c['status'])['length']&&(this['status']='finished');}},Ah=class extends gh{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x5a5a46=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x36d7f6=0x0;_0x36d7f6<this['_reviewParams']['length'];_0x36d7f6++){if(!this['_reviewParams'][_0x36d7f6]||!this['_sourceCheck']['options'][_0x36d7f6])continue;const _0x27f6e0=this['_sourceCheck']['options'][_0x36d7f6]['data']?.['find'](_0x22866e=>_0x22866e['id']===this['_reviewParams'][_0x36d7f6]);_0x27f6e0&&_0x5a5a46['push'](_0x27f6e0['label']);}return _0x5a5a46['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x2efa7e,_0x3af891,_0x3ab096){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x3af891,_0x2efa7e,_0x3ab096);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},Ih=class extends _0x5d28a2{['_aiConnector'];['_aiReviewCoreUi'];['_aiReviewCoreEditing'];['_availableReviewChecks'];['_reporter'];['_currentReviewCheckRun'];['_changeActivationSource']=null;static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_initRequiredPlugins'](),this['_initAvailableReviewChecks'](),this['_initUIListeners']();}async['_initAvailableReviewChecks'](){this['_availableReviewChecks']=await this['_getReviewChecks'](),this['_aiReviewCoreUi']['setAvailableChecks'](this['_availableReviewChecks']);}['_initUIListeners'](){this['listenTo'](this['_aiReviewCoreUi'],'getReviewCheckList',()=>{this['_availableReviewChecks']&&this['_aiReviewCoreUi']['setAvailableChecks'](this['_availableReviewChecks']);}),this['listenTo'](this['_aiReviewCoreUi'],'runReviewCheck',(_0x2e38fd,_0x1c762)=>this['runCheck'](_0x1c762)),this['listenTo'](this['_aiReviewCoreUi'],'leaveReview',()=>{this['_onReviewRunLeave']();}),this['listenTo'](this['_aiReviewCoreUi'],'leaveReviewCoreResultList',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'abortReviewStream',()=>this['abort']()),this['listenTo'](this['_aiReviewCoreUi'],'finishReview',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'acceptAllChanges',()=>{if(!this['_currentReviewCheckRun'])return;const _0x30799b=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x30799b['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x30799b['map'](_0x2e32c4=>_0x2e32c4['id']),this['_aiSource']);const _0x11781c=this['_currentReviewCheckRun'];_0x11781c['markAllChangesAsAccepted'](),_0x11781c['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x1aa0dd,_0x282ac6)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x282ac6['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x282ac6['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x282ac6['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x282ac6['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x1fe26d,_0x2994c6)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x2994c6['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x2994c6['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x2994c6['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x2994c6['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',(_0x88bb96,_0x3888ab)=>{this['_onActivateChange'](_0x3888ab);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x4a1030,_0x3a92d5)=>{this['_onDeactivateChange'](_0x3a92d5);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x3412d0,_0x549158)=>{this['_onChangeMarkerClicked'](_0x3412d0,_0x549158);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x1bf4d2,_0x2d7394)=>{this['_onChangeMarkerHovered'](_0x1bf4d2,_0x2d7394);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x3c5a91,_0x77f5af)=>{this['_onChangeMarkerRemoved'](_0x3c5a91,_0x77f5af);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x1bedb8,_0x3c7daf)=>{this['_onChangeMarkerRestored'](_0x1bedb8,_0x3c7daf);});}async['runCheck'](_0x47f4d6){if(!this['_availableReviewChecks'])return;const _0x2d47b1=this['_availableReviewChecks']['find'](_0x478101=>_0x478101['id']===_0x47f4d6['id']);if(_0x2d47b1){this['_onReviewCheckRun'](_0x47f4d6),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x47f4d6,_0x2d47b1),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x2a9b62,_0x180413)=>{switch(_0x180413['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x180413);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 ht('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new ht('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'!==_0x180413['status']&&'error-chunk'!==_0x180413['status']&&'error-general'!==_0x180413['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x5be8d9,_0x199fe6)=>{if(!this['_currentReviewCheckRun'])throw new ht('ai-review-mode-no-current-check-run',this);const _0x214410=this['_diffContent'](_0x199fe6['editor'],_0x199fe6['result']['contentInitial'],_0x199fe6['result']['contentNew']);_0x199fe6['source']['addResultChanges'](_0x199fe6['result']['id'],_0x214410);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x1e4680,_0x4d89fd)=>{for(const _0x353d25 of _0x4d89fd['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x353d25);this['_markChangePositionInEditorContent'](_0x4d89fd['changes'],_0x4d89fd['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x35285c,_0x1e7427)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x1e7427['change']['id'],_0x1e7427['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x1ba4e0,_0x5879f0)=>{this['_onReviewCheckResultActivated'](_0x5879f0);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x421e92){if(en(_0x421e92))return;_0x421e92 instanceof ht?this['_logError'](_0x421e92):this['_logError'](new ht('ai-review-mode-check-run-failed',this,void 0x0,_0x421e92));}}else this['_logError'](new ht('ai-review-mode-source-check-not-found',this,{'checkId':_0x47f4d6['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return(this['_availableReviewChecks']??[])['slice']();}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0x27e362,_0x414587){return new Ah(this['_aiReviewCoreEditing']['getDocumentData'](),_0x414587,this['_aiConnector'],_0x27e362['params'],_0x27e362['args']);}['_onChangeMarkerRemoved'](_0x3ee497,_0x13af3c){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x13af3c['changeId']);}['_onChangeMarkerRestored'](_0x121e01,_0x25dea3){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x25dea3['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](nn)['createReporter']('aireview');}['_onReviewRunLeave'](_0x353c06=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x353c06&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x3f6f5a of this['_aiReviewCoreEditing']['getEditors']())_0x3f6f5a['editing']['view']['change'](_0x2b2d80=>{for(const _0x59ef33 of _0x3f6f5a['editing']['view']['document']['getRoots']())_0x2b2d80['removeClass']('ck-ai_review-diff',_0x59ef33),_0x2b2d80['removeClass']('ck-ai_review-highlights',_0x59ef33),_0x2b2d80['removeClass']('ck-ai-translate-mode-content',_0x59ef33);});}['_logError'](_0x2f57a5){this['_reporter']['logError'](_0x2f57a5),'ai-review-mode-models-unable-to-retrieve'===function(_0x975421){return _0x975421 instanceof sn?_0x975421['code']:_0x975421 instanceof Error?_0x975421['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x2f57a5)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0x7548eb){if('content'===this['_changeActivationSource']){const _0x556fcd=this['_aiReviewCoreUi']['getChangeElement'](_0x7548eb);_0x556fcd&&St(_0x556fcd['closest']('.ck-ai_review__check-run-result')||_0x556fcd);}else{if('panel'===this['_changeActivationSource']){const _0x1e671b=this['_getChangeContentElement'](_0x7548eb);if(!_0x1e671b)return;Rt({'target':_0x1e671b,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},ph=class extends gh{['_prompt'];['_model'];constructor(_0x3283e1,_0x17f70d,_0x3e4d1a,_0x55d455,_0x1fdb4f){super(_0x3e4d1a,_0x55d455,_0x1fdb4f),this['_prompt']=_0x3283e1,this['_model']=_0x17f70d;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x1e7046,_0x4897aa,_0x33422e){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x4897aa,_0x1e7046,_0x33422e);}},mh=class{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x159226){this['id']=_0x159226['id'],this['commandId']=_0x159226['commandId'],this['title']=_0x159226['title'],this['description']=_0x159226['description'],this['isParameterized']=_0x159226['isParameterized'],this['useArgs']=_0x159226['useArgs'],this['options']=_0x159226['options'],this['args']=_0x159226['args'];}},Eh=class extends mh{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x4d8194,_0x316b1b,_0x19726c){super(_0x4d8194),this['prompt']=_0x4d8194['prompt'],this['model']=_0x4d8194['model'],this['model']?this['_defaultModel']=_0x316b1b['find'](_0x2bcaba=>_0x2bcaba['id']===this['model'])||null:this['_defaultModel']=_0x19726c;}get['defaultModel'](){return this['_defaultModel'];}},Th=class extends ph{get['subTitle'](){return'';}set['prompt'](_0x9c1a13){this['_prompt']=_0x9c1a13;}set['model'](_0x54bbb7){this['_model']=_0x54bbb7;}},wh=class extends _0x5d28a2{static get['requires'](){return[ls,nn];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];['_reporter'];['init'](){this['_reporter']=this['context']['plugins']['get'](nn)['createReporter']('aireview');}['getChecksList'](){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}};const Ch=[{'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'}]}]}],fh=/* #__PURE__ -- @preserve */
41
+ gt();var bh=class extends fh{['_checks']=[];['setupChecks'](_0x5267b6){this['_checks']=_0x5267b6['map'](_0x37cbe2=>new mh(_0x37cbe2));}get['checks'](){return this['_checks']['slice']();}['getCheckById'](_0x5edaac){return this['checks']['find'](_0x4a7849=>_0x4a7849['id']===_0x5edaac);}['removeCheckById'](_0x147701){this['_checks']=this['_checks']['filter'](_0xfe5a1=>_0xfe5a1['id']!==_0x147701);}},Sh=class extends mh{['_models']=[];['_defaultModel']=null;constructor(_0x509c23,_0x2c9a2a,_0x4396c7){super(_0x509c23),this['_models']=_0x2c9a2a,this['_defaultModel']=_0x4396c7;}get['models'](){return this['_models']['slice']();}get['defaultModel'](){return this['_defaultModel'];}},Rh=class extends bh{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x52f83b,_0x1226ee,_0xb73c6e){super(),this['_allModels']=_0x52f83b,this['_recommendedModels']=_0x1226ee,this['_defaultModel']=_0xb73c6e;}get['allModels'](){return this['_allModels']['slice']();}['setupChecks'](_0x3624a7){this['_checks']=_0x3624a7['map'](_0x442e6b=>!0x0===_0x442e6b['isExtra']?new Eh(_0x442e6b,this['_allModels'],this['_defaultModel']):'custom'===_0x442e6b['id']?new Sh(_0x442e6b,this['_recommendedModels'],this['_defaultModel']):new mh(_0x442e6b));}},Oh=class extends wh{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0x5233b0){super(_0x5233b0),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0xd3bb44=>({'id':_0xd3bb44['id'],'commandId':_0xd3bb44['id'],'title':_0xd3bb44['label'],'description':_0xd3bb44['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0xd3bb44['prompt'],'model':_0xd3bb44['model']}));}async['_loadChecksList'](){const _0x48a15c=[...Ch,...this['getExtraChecks']()]['map'](_0x27262b=>_0x27262b['isExtra']?_0x27262b:this['_translateReviewCheck'](_0x27262b)),_0x5c95b2=await this['_getModels'](),_0x1d8531=new Rh(_0x5c95b2['all'],_0x5c95b2['recommended'],_0x5c95b2['default']);return _0x1d8531['setupChecks'](_0x48a15c),_0x1d8531;}async['_getModels'](){const _0x2efbe0=this['context']['plugins']['get']('AIConnector');try{const _0x31f6ea=new Qs({'connector':_0x2efbe0,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0x3fe80a={'all':await _0x31f6ea['getAll'](),'recommended':await _0x31f6ea['getAvailableModels'](),'default':await _0x31f6ea['getDefault']()};return this['_modelsLoadError']=null,_0x3fe80a;}catch(_0x9a1241){return this['_modelsLoadError']=new ht('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x9a1241),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x3f0d3d){const _0x5e663f='AI_REVIEW_CHECK_'+_0x3f0d3d['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x51cdbb={..._0x3f0d3d,'title':this['_translate'](_0x5e663f+'_TITLE',_0x3f0d3d['title']),'description':this['_translate'](_0x5e663f+'_DESCRIPTION',_0x3f0d3d['description'])};return _0x3f0d3d['options']&&(_0x51cdbb['options']=_0x3f0d3d['options']['map'](_0x2e4e8c=>({..._0x2e4e8c,'label':this['_translate'](_0x5e663f+'_OPTIONS_LABEL',_0x2e4e8c['label']||''),'data':_0x2e4e8c['data']?_0x2e4e8c['data']['map'](_0x35033c=>({..._0x35033c,'label':this['_translate'](_0x5e663f+'_OPTIONS_DATA_'+_0x35033c['id']['toUpperCase'](),_0x35033c['label'])})):void 0x0}))),_0x51cdbb;}['_translate'](_0x3364da,_0x9d1871){const _0x3f056c=us(this['context']['locale'],_0x3364da);return _0x3f056c===_0x3364da?_0x9d1871:_0x3f056c;}},vh=class extends Ih{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[nn,Oh];}get['_aiSource'](){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0xb2d5a1){super(_0xb2d5a1),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',Ch['map'](_0x989fb1=>_0x989fb1['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x94bdde,_0xee7034)=>{this['_isDiffOn']=_0xee7034['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x55f8ab,_0x400373){if(_0x55f8ab['isCustom'])return new ph(_0x55f8ab['args']['prompt'],_0x55f8ab['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x400373,this['_aiConnector']);if(_0x400373['isExtra']){const _0x426e71=_0x400373;return new Th(_0x55f8ab['args']?.['prompt']??_0x426e71['prompt'],_0x55f8ab['args']?.['model']??_0x426e71['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x400373,this['_aiConnector']);}return new Ah(this['_aiReviewCoreEditing']['getDocumentData'](),_0x400373,this['_aiConnector'],_0x55f8ab['params'],_0x55f8ab['args']);}['_onReviewCheckResultActivated'](_0x375713){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x375713['change']['id']),this['_scrollToChange'](_0x375713['change']['id']);const _0x221dcf=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x375713['change']['id']);if(!_0x221dcf)return;const _0xed82a8=this['_aiReviewCoreEditing']['getEditorForChange'](_0x375713['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x375713['change'],()=>_0x221dcf['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0xed82a8,_0x221dcf['modelRange']['root']['rootName']),_0xed82a8?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x375713['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x500030){this['_currentReviewCheckRun']&&'click'===_0x500030['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x500030['id']));}['_onDeactivateChange'](_0x534837){this['_currentReviewCheckRun']&&'balloon'===_0x534837['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x4e383c,_0x5d24e5){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x5d24e5['changeId']);const _0x3d39fc=this['_currentReviewCheckRun']['getChangeById'](_0x5d24e5['changeId']);if(!_0x3d39fc)return;const _0x4d14d0=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x5d24e5['changeId']),_0x1c258b=this['_aiReviewCoreEditing']['getEditorForChange'](_0x5d24e5['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x3d39fc,_0x5d24e5['markerElement'],_0x5d24e5['domEvent'],'click',this['_getBalloonDomRoot'](_0x1c258b,_0x4d14d0?.['modelRange']['root']['rootName']),_0x1c258b?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x51ca8b,_0x1d57c4){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x4b23e7=this['_currentReviewCheckRun']['getChangeById'](_0x1d57c4['changeId']);if(!_0x4b23e7)return;const _0x375f27=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x1d57c4['changeId']),_0x30962c=this['_aiReviewCoreEditing']['getEditorForChange'](_0x1d57c4['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x4b23e7,_0x1d57c4['markerElement'],_0x1d57c4['domEvent'],'hover',this['_getBalloonDomRoot'](_0x30962c,_0x375f27?.['modelRange']['root']['rootName']),_0x30962c?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}['_getChangeContentElement'](_0x19c0fb){const _0x52cd6d=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x19c0fb);return _0x52cd6d?_0x52cd6d['getElement']():null;}['_markChangePositionInEditorContent'](_0x3263fb,_0x21aae1){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x3263fb,_0x21aae1);}['_diffContent'](_0x293dd1,_0x37ccc6,_0x4bcc4f){return this['_aiReviewCoreEditing']['diffContent'](_0x293dd1,_0x37ccc6,_0x4bcc4f,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x29b1c3){_0x29b1c3?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x47bbd2 of this['_aiReviewCoreEditing']['getEditors']())_0x47bbd2['editing']['view']['change'](_0x184091=>{for(const _0x2a7083 of _0x47bbd2['editing']['view']['document']['getRoots']()){for(const _0x4c9e32 of _0x2a7083['getClassNames']())_0x4c9e32['startsWith']('ck-ai_review-')&&_0x184091['removeClass'](_0x4c9e32,_0x2a7083);_0x184091['addClass'](_0x29b1c3?'ck-ai_review-diff':'ck-ai_review-highlights',_0x2a7083);}});}['_getBalloonDomRoot'](_0x4908cb,_0x14a3c8){const _0x17cbf8=_0x4908cb['editing']['view'];if(_0x14a3c8){const _0x106d46=_0x17cbf8['getDomRoot'](_0x14a3c8);if(_0x106d46)return _0x106d46;}return _0x17cbf8['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0x47cca5=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x32f76c=await _0x47cca5['getChecksList']();_0x47cca5['modelsLoadError']&&this['_logError'](_0x47cca5['modelsLoadError']);let _0x1edefe=_0x32f76c['checks'];const _0x5ebbd2=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x5ebbd2,_0x1edefe),this['_usesAvailableCommandsConfig']&&(_0x1edefe=_0x5ebbd2['map'](_0x24c2b6=>_0x1edefe['find'](_0x1f413a=>_0x1f413a['id']===_0x24c2b6))['filter'](_0x1e482a=>!!_0x1e482a)),this['_filterChecksWithMissingModel'](_0x1edefe);}['_logWarningForNonExistentChecks'](_0x2ee312,_0x21464d){const _0x4b0b51=_0x2ee312['filter'](_0x1bd141=>!_0x21464d['some'](_0xd5ad2b=>_0xd5ad2b['id']===_0x1bd141));_0x4b0b51['length']&&this['_reporter']['logError'](new sn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x4b0b51['join'](',\x20')}}));}['_filterChecksWithMissingModel'](_0x17dc24){const _0x2947ef=[];return _0x17dc24['forEach'](_0x5cc023=>{(_0x5cc023 instanceof Eh&&!_0x5cc023['defaultModel']||_0x5cc023 instanceof Sh&&!_0x5cc023['models']['length'])&&_0x2947ef['push'](_0x5cc023['id']);}),_0x2947ef['length']&&_0x2947ef['forEach'](_0x6447d2=>{_0x17dc24=_0x17dc24['filter'](_0x1f3c2c=>_0x1f3c2c['id']!==_0x6447d2),this['_reporter']['logError'](new sn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x6447d2}}));}),_0x17dc24;}};function kh(_0x4d11b5,_0x43c4de,_0x1fff12,_0x5606f9){return _0x4d11b5 instanceof ht?_0x4d11b5:new ht(_0x43c4de,_0x1fff12,_0x5606f9,_0x4d11b5);}var Nh=class extends Js{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks']['slice']();}set['affectedBlocks'](_0x3566da){this['_affectedBlocks']=_0x3566da;}},yh=class extends _0x5d28a2{static get['pluginName'](){return'AIReviewGateway';}static get['requires'](){return[hh,Oh,ls,Is,js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAllCommands'](){return(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['map'](_0x181294=>{const _0x2d3280={'id':_0x181294['id'],'title':_0x181294['title'],'description':_0x181294['description']};return'custom'!==_0x181294['id']&&_0x181294['options']?.['length']&&(_0x2d3280['parameters']=_0x181294['options'][0x0]['data']['map'](_0x1d5081=>({..._0x1d5081}))),_0x2d3280;});}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['runReview'](_0x3b3234,_0x2e558d){return await this['_runReviewCheck'](_0x3b3234,()=>this['_createReviewCheckRun'](_0x3b3234,_0x2e558d?.['parameterId']),_0x2e558d?.['signal']);}async['runCustomReview'](_0x3e1186,_0x15cc66){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x3e1186,_0x15cc66?.['model']),_0x15cc66?.['signal']);}['applyReview'](_0x4a7da2,_0x3408a0){this['context']['plugins']['get']('AIGateway')['apply'](_0x4a7da2,{'applyMethod':_0x3408a0,'aiSource':'review'});}async['_runReviewCheck'](_0xed9578,_0xf44d75,_0x83de60){const _0x3efcf7=_s(this['context']),_0x1a2d18=new Nh({'editor':_0x3efcf7,'rootName':_0x3efcf7['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x3efcf7['plugins']['get']('AIEditing')['getSessionId'](_0x3efcf7)});let _0x4a3f69,_0xc22442;if(_0x83de60){if(_0x83de60['aborted'])return _0x1a2d18['abort'](),_0x1a2d18;const _0x313bdd=()=>{_0x1a2d18['error']||(_0x1a2d18['abort'](),_0x4a3f69&&_0x4a3f69['abort']());};_0x83de60['addEventListener']('abort',_0x313bdd),_0xc22442=()=>_0x83de60['removeEventListener']('abort',_0x313bdd);}try{_0x4a3f69=await _0xf44d75(),_0x1a2d18['contentRawOld']=_0x4a3f69['documentData']['content'],_0x1a2d18['documentVersion']=Array['from'](_0x4a3f69['documentData']['elements'])['find'](([,_0x139d62])=>_0x139d62['rootName']===_0x1a2d18['rootName'])?.[0x1]['documentVersion']??0x1,_0x4a3f69['on']('reviewCheckRunUpdated',(_0x310b8d,_0x4e6f49)=>{'aborted'===_0x4e6f49['status']?_0x1a2d18['abort']():'error-general'!==_0x4e6f49['status']&&'error-chunk'!==_0x4e6f49['status']||(_0x1a2d18['error']=kh(_0x4e6f49['error'],'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0xed9578}));}),'aborted'!==_0x1a2d18['status']&&await _0x4a3f69['start']();}catch(_0xd81c74){_0x1a2d18['error']=kh(_0xd81c74,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0xed9578});}finally{_0xc22442&&_0xc22442();}if(!_0x4a3f69||'aborted'===_0x1a2d18['status']||'error'===_0x1a2d18['status'])return _0x1a2d18;_0x1a2d18['affectedBlocks']=_0x4a3f69['results']['map'](_0x5b14e4=>({'id':_0x5b14e4['id'],'content':_0x5b14e4['contentNew']}));try{_0x1a2d18['contentRawNew']=ms(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x1a2d18['affectedBlocks'],_0x1a2d18['contentRawOld'],_0x1a2d18['editor']));}catch(_0x3330bb){_0x1a2d18['error']=kh(_0x3330bb,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0xed9578});}return _0x1a2d18;}async['_createReviewCheckRun'](_0x4993f3,_0x26fcf4){const _0x200b04=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x4c2648=>_0x4c2648['id']===_0x4993f3);if(!_0x200b04)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x4993f3});if(_0x200b04 instanceof Sh)throw new ht('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x4993f3});const _0x422da8=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x450aa6=this['context']['plugins']['get']('AIConnector');if(_0x200b04 instanceof Eh){if(!_0x200b04['defaultModel']?.['id'])throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x4993f3});return new Th(_0x200b04['prompt'],_0x200b04['defaultModel']['id'],_0x422da8,_0x200b04,_0x450aa6);}return new Ah(_0x422da8,_0x200b04,_0x450aa6,_0x26fcf4?[_0x26fcf4]:void 0x0);}async['_createCustomReviewCheckRun'](_0x46a725,_0x5eb82b,_0x399d42){const _0x30c7af=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x5271eb=>_0x5271eb['id']===_0x46a725);if(!_0x30c7af)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x46a725});if(!(_0x30c7af instanceof Sh))throw new ht('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x46a725});const _0x4f6a8e=_0x399d42??_0x30c7af['defaultModel']?.['id'];if(!_0x5eb82b)throw new ht('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x46a725});if(!_0x4f6a8e)throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x46a725});return new ph(_0x5eb82b,_0x4f6a8e,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x30c7af,this['context']['plugins']['get']('AIConnector'));}},xh=class extends _0x5d28a2{static get['requires'](){return[vh,nh,hh,yh];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startReview'](_0x383f40,_0x209e47){if(this['assertStartReviewPreconditions'](_0x383f40)instanceof Sh)throw new ht('ai-reviewmode-not-a-system-command',this,{'commandId':_0x383f40});ka(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x383f40,'params':_0x209e47?.['parameterId']?[_0x209e47['parameterId']]:void 0x0});}async['startCustomReview'](_0x11638d,_0x4aac04){if(!_0x11638d)throw new ht('ai-reviewmode-missing-custom-command-prompt',this);const _0xd59e1c=Ch['find'](_0x588d2d=>'custom'===_0x588d2d['commandId'])['id'],_0x2dcb46=this['assertStartReviewPreconditions'](_0xd59e1c),_0x599362=_0x4aac04?.['model']??_0x2dcb46['defaultModel']?.['id'];if(!_0x599362)throw new ht('ai-reviewmode-missing-custom-command-model',this);ka(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0xd59e1c,'isCustom':!0x0,'args':{'prompt':_0x11638d,'model':_0x599362}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x2420fa=>{const _0x182f71={'id':_0x2420fa['id'],'title':_0x2420fa['title'],'description':_0x2420fa['description']};return'custom'!==_0x2420fa['id']&&_0x2420fa['options']?.['length']&&(_0x182f71['parameters']=_0x2420fa['options'][0x0]['data']['map'](_0x13cb24=>({..._0x13cb24}))),_0x182f71;});}['assertStartReviewPreconditions'](_0x6b7fb7){const _0x33d922=this['context']['plugins']['get']('AIReviewModeController');if(_0x33d922['getCurrentCheckRun']())throw new ht('ai-reviewmode-review-already-running',this);const _0x47234b=_0x33d922['getAvailableChecks']()['find'](_0x3f9396=>_0x3f9396['id']===_0x6b7fb7);if(!_0x47234b)throw new ht('ai-reviewmode-unknown-command',this,{'commandId':_0x6b7fb7});return _0x47234b;}},Lh=class extends Ah{['_title'];constructor(_0x2f0021,_0x304076,_0x586929,_0x2d8d7d,_0x197983,_0x1966bf){super(_0x2f0021,_0x304076,_0x586929,_0x197983,_0x1966bf),this['_title']=_0x2d8d7d;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}},Dh=class extends mh{get['apiId'](){return'translate';}},Ph=class extends bh{['setupChecks'](_0x26ced7){this['_checks']=_0x26ced7['map'](_0x10d833=>new Dh(_0x10d833));}};const Hh=[{'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'}];var Mh=class extends wh{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x3dc08c){super(_0x3dc08c),this['context']['config']['define']('ai.translate.languages',Hh);}async['_loadChecksList'](){const _0x279318=[],_0x1d6209=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x10fa48 of _0x1d6209)_0x279318['push']({'title':_0x10fa48['label'],'id':_0x10fa48['id'],'commandId':_0x10fa48['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x10fa48['id']}});const _0x3f3560=new Ph();return _0x3f3560['setupChecks'](this['_translateChecks'](_0x279318)),_0x3f3560;}['_translateChecks'](_0x13b9c4){const _0x1d5bbb=this['context']['locale'];return _0x13b9c4['map'](_0x41bf1a=>{const _0x2389d8='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x41bf1a['title']['toUpperCase']()['replaceAll']('-','_'),_0x44aa20=us(_0x1d5bbb,_0x2389d8);return{..._0x41bf1a,'title':_0x44aa20===_0x2389d8?_0x41bf1a['title']:_0x44aa20};});}},Vh=class extends Ih{static get['pluginName'](){return'AITranslateController';}static get['requires'](){return[nn,Mh];}get['_aiSource'](){return'translate';}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x1a5e63,_0x56efe5){return new Lh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x56efe5,this['_aiConnector'],us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x1a5e63['params'],_0x1a5e63['args']);}['_onReviewCheckResultActivated'](_0xb031cb){this['_aiReviewCoreUi']['setActiveStateInResults'](_0xb031cb['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0xb031cb['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x441aa6){this['_currentReviewCheckRun']&&('hover'===_0x441aa6['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x441aa6['id'])),'click'===_0x441aa6['uiInteraction']&&this['_scrollToChange'](_0x441aa6['id']));}['_onDeactivateChange'](_0x33f0ee){this['_currentReviewCheckRun']&&'panel'===_0x33f0ee['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x34fae7,_0x543ea3){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x543ea3['changeId']),this['_scrollToChange'](_0x543ea3['changeId']));}['_onChangeMarkerHovered'](_0x5aee21,_0x176b46){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x176b46['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x176b46['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x411e48){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x411e48);}['_markChangePositionInEditorContent'](_0x183c65,_0x78832a){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x183c65,_0x78832a);}['_diffContent'](_0x1d9d09,_0xc6572b,_0x3492db){return this['_aiReviewCoreEditing']['diffContent'](_0x1d9d09,_0xc6572b,_0x3492db,!0x0);}['_onReviewCheckRun'](){for(const _0x4d0af2 of this['_aiReviewCoreEditing']['getEditors']())_0x4d0af2['editing']['view']['change'](_0x5bef56=>{for(const _0x20c9d3 of _0x4d0af2['editing']['view']['document']['getRoots']())_0x5bef56['addClass']('ck-ai-translate-mode-content',_0x20c9d3);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},Uh=class extends Qa{constructor(_0x4c159e,_0x2b563e){super(_0x4c159e,_0x2b563e),this['on']('set:isLoading',(_0x314fc1,_0x147422,_0x2b5fcf)=>{_0x2b5fcf&&(this['headerTitle']=us(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x4ad601,_0x252585,_0x20c3ba)=>{_0x20c3ba&&(this['headerTitle']=us(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x2be11e=super['_createAcceptAllButtonView']();return _0x2be11e['set']('label',us(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x2be11e;}['_createExitReviewButtonView'](){const _0x4db9f4=super['_createExitReviewButtonView']();return _0x4db9f4['set']('label',us(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x4db9f4;}},Bh=class extends sh{['_setupTemplate'](){const _0x475618=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x475618['if']('isVisible','ck-hidden',_0x823372=>!_0x823372)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':us(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':us(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x475618['if']('isVisible','ck-hidden',_0x1f1611=>!_0x1f1611)]},'children':this['_checkViews']}]});}},Gh=class extends Wa{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x11e66c=this['context']['plugins']['get']('AITabs'),_0x5f570c=this['context']['locale'],_0x153bbb=new Ho(_0x5f570c,{'label':us(_0x5f570c,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x4dd947,'class':'ck-ai-header_review-translate','showResizeButton':_0x11e66c['showResizeButton']});_0x153bbb['delegate']('resizeTabs')['to'](_0x11e66c),_0x153bbb['bind']('isMaximized')['to'](_0x11e66c['view'],'isMaximized',_0x128453=>_0x128453);const _0x26813e=new $a(_0x5f570c,{'header':_0x153bbb,'list':new Bh(_0x5f570c),'results':new Uh(_0x5f570c,{'generalErrorText':us(_0x5f570c,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new Xa(_0x5f570c,{'headerText':us(_0x5f570c,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':us(_0x5f570c,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':us(_0x5f570c,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x26813e['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x26813e;}['registerTab'](){const _0x11818b=this['context']['plugins']['get']('AITabs');_0x11818b['view']['on']('activateTab',(_0x47f214,{newTab:_0x253fe1,oldTab:_0x375373})=>{'translate'===_0x253fe1?this['fire']('getReviewCheckList'):'translate'===_0x375373&&this['fire']('leaveReview');}),_0x11818b['view']['addTab']({'id':'translate','buttonLabel':us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x4dd947,'order':0x0,'content':this['_mainView']});}},Fh=class extends Js{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x3e62e2){this['_affectedBlocks']=_0x3e62e2;}},Kh=class extends _0x5d28a2{static get['pluginName'](){return'AITranslateGateway';}static get['requires'](){return[hh,ls,Is,js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['runTranslate'](_0x1310fb,_0x29f7a2){return await this['_runTranslateCheck'](_0x1310fb,()=>this['_createTranslateCheckRun'](_0x1310fb),_0x29f7a2?.['signal']);}['applyTranslate'](_0xca5703,_0x54fa40){this['context']['plugins']['get']('AIGateway')['apply'](_0xca5703,_0x54fa40);}async['_runTranslateCheck'](_0x2128d3,_0x375c1f,_0x49150a){const _0x42b1a9=_s(this['context']),_0x3a344e=new Fh({'editor':_0x42b1a9,'rootName':_0x42b1a9['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x42b1a9['plugins']['get']('AIEditing')['getSessionId'](_0x42b1a9)});let _0x4c20bf,_0x2e7d63;if(_0x49150a){if(_0x49150a['aborted'])return _0x3a344e['abort'](),_0x3a344e;const _0x42d155=()=>{_0x3a344e['error']||(_0x3a344e['abort'](),_0x4c20bf&&_0x4c20bf['abort']());};_0x49150a['addEventListener']('abort',_0x42d155),_0x2e7d63=()=>_0x49150a['removeEventListener']('abort',_0x42d155);}try{_0x4c20bf=await _0x375c1f(),_0x3a344e['contentRawOld']=_0x4c20bf['documentData']['content'],_0x3a344e['documentVersion']=Array['from'](_0x4c20bf['documentData']['elements'])['find'](([,_0x5cd460])=>_0x5cd460['rootName']===_0x3a344e['rootName'])?.[0x1]['documentVersion']??0x1,_0x4c20bf['on']('reviewCheckRunUpdated',(_0x18d9b8,_0x14cded)=>{'aborted'===_0x14cded['status']?_0x3a344e['abort']():'error-general'!==_0x14cded['status']&&'error-chunk'!==_0x14cded['status']||(_0x3a344e['error']=kh(_0x14cded['error'],'ai-translategateway-translation-run-failed',this,{'language':_0x2128d3}));}),'aborted'!==_0x3a344e['status']&&await _0x4c20bf['start']();}catch(_0x498e0d){_0x3a344e['error']=kh(_0x498e0d,'ai-translategateway-translation-run-failed',this,{'language':_0x2128d3});}finally{_0x2e7d63&&_0x2e7d63();}if(!_0x4c20bf||'aborted'===_0x3a344e['status']||'error'===_0x3a344e['status'])return _0x3a344e;_0x3a344e['affectedBlocks']=_0x4c20bf['results']['map'](_0x57e64e=>({'id':_0x57e64e['id'],'content':_0x57e64e['contentNew']}));try{_0x3a344e['contentRawNew']=ms(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x3a344e['affectedBlocks'],_0x3a344e['contentRawOld'],_0x3a344e['editor']));}catch(_0x166493){_0x3a344e['error']=kh(_0x166493,'ai-translategateway-translation-run-failed',this,{'language':_0x2128d3});}return _0x3a344e;}async['_createTranslateCheckRun'](_0x2e67aa){const _0x507fd7=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x4e4656=this['context']['plugins']['get']('AIConnector');return new Lh(_0x507fd7,new Dh({'id':_0x2e67aa,'commandId':_0x2e67aa,'title':_0x2e67aa,'description':'','isParameterized':!0x1}),_0x4e4656,us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),void 0x0,{'language':_0x2e67aa});}},Wh=class extends _0x5d28a2{static get['requires'](){return[Vh,Gh,hh,Kh];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startTranslate'](_0x54f0cc){const _0x1b4ecf=this['assertStartTranslatePreconditions'](_0x54f0cc);ka(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0x1b4ecf['id'],'args':_0x1b4ecf['useArgs']?_0x1b4ecf['args']:void 0x0});}['getAvailableLanguages'](){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x8ff4c0=>({'id':_0x8ff4c0['id'],'label':_0x8ff4c0['title']}));}['assertStartTranslatePreconditions'](_0x4e4ad7){const _0x145b47=this['context']['plugins']['get']('AITranslateController');if(_0x145b47['getCurrentCheckRun']())throw new ht('ai-translate-translation-already-running',this);const _0x252ce0=_0x145b47['getAvailableChecks']()['find'](_0x594c77=>_0x594c77['id']===_0x4e4ad7);if(!_0x252ce0)throw new ht('ai-translate-unknown-language',this,{'languageId':_0x4e4ad7});return _0x252ce0;}};export{Ua as AIActions,vi as AIAdapter,Ji as AIAssistant,Xi as AIAssistantUI,la as AIBalloon,ta as AIChat,kn as AIChatController,Hr as AIChatFeedCustomElementView,Zo as AIChatHistory,Jo as AIChatHistoryController,qo as AIChatHistoryUI,fn as AIChatInteraction,na as AIChatShortcuts,Bo as AIChatUI,ls as AIConnector,sn as AICoreError,tn as AIDocumentProcessingGateway,Zs as AIDocumentProcessingRunResult,Is as AIEditing,Aa as AIEditorIntegration,rn as AIErrorReporter,nn as AIErrorSink,js as AIGateway,An as AIInteraction,Ba as AIQuickActions,Oa as AIQuickActionsUI,dn as AIReply,ki as AIRequestError,mh as AIReviewCheck,lh as AIReviewCheckResult,dh as AIReviewCheckResultChange,gh as AIReviewCheckRun,yh as AIReviewGateway,xh as AIReviewMode,Ih as AIReviewModeController,hh as AIReviewModeEditing,nh as AIReviewModeUI,Nh as AIReviewRunResult,Js as AIRunResult,cs as AITabs,hs as AITabsMainView,rs as AITabsView,ts as AITextAdapter,oa as AIToggleButtonUI,Wh as AITranslate,Vh as AITranslateController,Kh as AITranslateGateway,Fh as AITranslateRunResult,Gh as AITranslateUI,is as AWSTextAdapter,es as OpenAITextAdapter,yi as ShowAIAssistantCommand,ra as ToggleAICommand,cn as createResizeButton,Zi as getDefaultAICommands,zs as markOperationsAsAI};