@ckeditor/ckeditor5-ai 48.4.0-alpha.0 → 48.4.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +19 -19
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.js +1 -1
- package/dist/translations/be.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/package.json +29 -29
package/dist/index.js
CHANGED
|
@@ -20,22 +20,22 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Command as _0x23b7b0,ContextPlugin as _0x898608,Editor as _0x24cd6f,Plugin as _0x622916,rootAcceptsBlocks as _0x1bd984}from'@ckeditor/ckeditor5-core';import{IconAI as _0x522884,IconAIAdjustLength as _0x55d620,IconAIAskAI as _0x2eb0d7,IconAIChangeTone as _0x173850,IconAIChat as _0x19cce7,IconAIChatCommands as _0x3bbd8f,IconAIContinueWriting as _0x123cf3,IconAIGrammarCheck as _0x37ebe4,IconAIHistory as _0x4afa16,IconAIImproveWriting as _0x448b65,IconAIOther as _0x400907,IconAIQuickActions as _0x10bb99,IconAIReview as _0x510915,IconAITranslate as _0x370c5b,IconBoxWithCheck as _0x381a45,IconBoxWithCross as _0x194390,IconBoxWithMarker as _0xf32bda,IconBrowseFiles as _0x15107d,IconBulb as _0x1e95b5,IconCancel as _0x572ba4,IconCheck as _0x48b061,IconChevronDown as _0x4e351c,IconChevronRight as _0x2fee64,IconChevronUp as _0x582ecb,IconCopy as _0xaeff50,IconDocument as _0x2d99a5,IconDocumentOutline as _0x325a2b,IconDropdownArrow as _0x1193f0,IconError as _0x309d45,IconEye as _0x112882,IconEyeCrossedOut as _0x3bafdd,IconFileUpload as _0xd6ab36,IconImage as _0x1bf77b,IconInfo as _0x41da4b,IconLink as _0x3de4d0,IconLoupe as _0x4cf30b,IconMagicWand as _0xbfdde1,IconMaximize as _0x31ef04,IconMinimize as _0x2bee5e,IconNextArrow as _0x57e767,IconOutdated as _0x157ef8,IconPaperClip as _0x3ff1a2,IconPin as _0x5b153c,IconPlus as _0x3da945,IconPreviousArrow as _0xd78e92,IconRefresh as _0x184821,IconRevisionHistory as _0x14640e,IconRobotPencil as _0x59f1b5,IconSelection as tt,IconShowChangesOff as et,IconShowChangesOn as it,IconStop as st,IconSubmit as nt,IconThreeHorizontalDots as rt,IconThumbDown as ot,IconThumbUp as at,IconWeb as ht}from'@ckeditor/ckeditor5-icons';import{CKEditorError as ct,Collection as lt,DomEmitterMixin as ut,EmitterMixin as dt,FocusTracker as _t,KeystrokeHandler as gt,ObservableMixin as At,Rect as It,ResizeObserver as pt,_isMotionReduced as Et,first as mt,getConstrainedViewportRect as Tt,global as wt,insertToPriorityArray as Ct,isVisible as ft,logError as bt,logWarning as St,scrollAncestorsToShowTarget as Rt,scrollViewportToShowTarget as Ot,toArray as vt,uid as kt,version as yt}from'@ckeditor/ckeditor5-utils';import{AutocompleteView as Nt,BalloonPanelView as xt,BalloonToolbar as Lt,BodyCollection as Pt,ButtonLabelView as Dt,ButtonLabelWithHighlightView as Ht,ButtonView as Mt,Dialog as Ut,DialogViewPosition as Vt,DropdownMenuPanelPositioningFunctions as Bt,FileDialogButtonView as Gt,FocusCycler as Ft,FormHeaderView as Kt,FormRowView as Wt,HighlightedTextView as Yt,IconView as $t,InputTextView as qt,LabeledFieldView as Qt,ListItemButtonView as Xt,ListItemGroupView as zt,ListItemView as jt,ListView as Jt,MenuBarMenuListItemButtonView as Zt,MenuBarMenuListItemView as te,MenuBarMenuListView as _0x14eb7a,MenuBarMenuView as _0x1021d4,SearchTextView as _0xdb63d9,SpinnerView as _0x14cb96,Template as _0x24e6f7,TextareaView as _0x324c99,ToolbarView as _0x54b9b5,UIModel as _0x28f92e,View as _0x56a514,ViewCollection as _0x93f04d,addListToDropdown as _0x40e721,addMenuToDropdown as _0x1ce06a,clickOutsideHandler as _0x44d1a9,createDropdown as _0x48403c,createLabeledInputText as _0x4c7fdb,createLabeledTextarea as _0x3cc43c,submitHandler as _0x2801b9}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x6355f1,ClipboardPipeline as _0x5d9c9d}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0x52fe51,MarkerOperation as _0x5bbb57,Matcher as _0x34dbd2,ModelDocumentFragment as _0x28e306,ModelPosition as _0x4febba,ModelRange as _0x2827cc,ModelTreeWalker as _0x28cad7,ViewDataTransfer as _0x1fcb27,ViewDocumentDomEventData as _0x1b1d52,ViewDowncastWriter as _0x4ccf87,ViewUpcastWriter as _0x6705a7,_DetachOperation as _0x4f656c,_insertIntoModelNodeList as _0x3ab39d,_removeFromModelNodeList as _0x168f4f,transformOperationSets as _0x5dec67}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0xddedfa,debounce as _0x5f51ae,escape as _0x15f5d8,escapeRegExp as _0x3ff1f3,omit as _0x101a20,throttle as _0x20eb7b,unescape as _0x2d8c2d}from'es-toolkit/compat';import{createParser as _0x1314f1}from'eventsource-parser';import{CloudServices as _0x46601a}from'@ckeditor/ckeditor5-cloud-services';import{parseDocument as _0x502eab}from'htmlparser2';import{append as _0x23e0ae,appendChild as _0x380486,find as _0x370e5d,findAll as _0x4615bb,findOne as _0x228c3a,getChildren as _0x27f885,getParent as _0x12306c,isComment as _0x3e0c4f,isTag as _0x545292,prepend as ti,prependChild as _0x46b9cf,removeElement as _0x47cc1f,replaceElement as _0x452856,textContent as _0xa4b40a}from'domutils';import _0x35b927 from'dom-serializer';import{Document as _0x139fbf,Element as _0x21f244,NodeWithChildren as _0x71eb2,Text as _0xa7d61f,cloneNode as _0x2a3383,isDocument as _0x23e8cf,isText as _0x5273d9}from'domhandler';import{ConfirmMixin as _0x5a953b,DATA_ID_MODEL_ATTRIBUTE as _0x4fabc2,DATA_ID_VIEW_ATTRIBUTE as _0x322962,DocumentCompare as _0x45dea0,PillView as _0x5745ee,SuggestionsConversion as _0x34a1f4,fixElementSuggestionRange as _0x49575d,getAllMarkersDomElementsSorted as _0x42da8e,getMarkerDomElement as _0x497b83,isInvalidAttributeOperation as _0x9fd625}from'@ckeditor/ckeditor5-collaboration-core';import{MarkdownGfmMdToHtml as _0x20ae64,MarkdownGfmMdToHtmlDefaultPlugins as _0x29e337}from'@ckeditor/ckeditor5-markdown-gfm';import _0x23be32 from'rehype-sanitize';import _0x29a9e2 from'morphdom';import{diffArrays as _0x11f069}from'diff';const vi='_ungrouppedCommands';function ki(_0x1cd465,_0x41925f){const _0x314168=(0x0,_0x41925f['t'])('Other');return _0x1cd465['length']?'groupId'in _0x1cd465[0x0]?_0x1cd465:[{'groupId':vi,'groupLabel':_0x314168,'order':0x1/0x0,'commands':_0x1cd465}]:[{'groupId':vi,'groupLabel':_0x314168,'order':0x1/0x0,'commands':[]}];}const yi=globalThis['DataTransfer'],Ni='ai-ui';var xi=class extends _0x622916{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const {editor:_0x1c092d}=this,_0x1bb2ca=['ck-fake-ai-selection'];_0x1c092d['config']['get']('ai.assistant.useTheme')&&_0x1bb2ca['push']('ck-ai-assistant-ui_theme'),_0x1c092d['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Ni,'view':{'classes':_0x1bb2ca,'priority':0xc}}),_0x1c092d['conversion']['for']('editingDowncast')['markerToElement']({'model':Ni,'view':(_0x5e0ed5,{writer:_0x226f9b})=>{if(!_0x5e0ed5['markerRange']['isCollapsed'])return null;const _0xdc7526=_0x226f9b['createUIElement']('span');return _0x226f9b['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0xdc7526),_0xdc7526;}});}afterInit(){!async function(_0xaf88be){const _0x34b69e='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0xd6831d=0x79128,_0x4b89cc=window['Date']['now'](),_0x3e0b68=_0xaf88be['editor'],_0x4a5594=new window['Promise'](_0x4ff2c0=>{_0x3e0b68['once']('ready',_0x4ff2c0);}),_0x15a13a={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x39dc42=_0x3e0b68['config']['get']('licenseKey');async function _0x55a5a3(){let _0x41f1f5,_0x55e589=null,_0x145eee=null;try{return'GPL'==_0x39dc42?'NotAllowed':(_0x41f1f5=_0x40d265(),_0x41f1f5?(_0x41f1f5['usageEndpoint']&&(_0x145eee=_0x50da19(_0x41f1f5['usageEndpoint'],_0x41f1f5['jti'])),await _0x3c1492()?_0x37218a()?_0x26adcf()?'Expired':_0x422b61()?('evaluation'==_0x41f1f5['licenseType']&&(_0x55e589=_0xdb996a('EvaluationLimit')),await _0x7e414a()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x26adcf(){const _0x1e6f64=['evaluation','trial']['includes'](_0x41f1f5['licenseType'])?_0x4b89cc/0x3e8:0xe10*_0xd6831d;return _0x41f1f5['exp']<_0x1e6f64;}function _0x37218a(){const _0xcd0f02=_0x41f1f5['features'];return!!_0xcd0f02&&(!!_0xcd0f02['includes']('*')||!!_0xcd0f02['includes']('AI'));}function _0x422b61(){const _0x2715d7=_0x41f1f5['licensedHosts'];if(!_0x2715d7||0x0==_0x2715d7['length'])return!0x0;const {hostname:_0x64795a}=new URL(window['location']['href']);if(_0x2715d7['includes'](_0x64795a))return!0x0;const _0x259467=_0x64795a['split']('.');return _0x2715d7['filter'](_0x4f777a=>_0x4f777a['includes']('*'))['map'](_0x33a7ca=>_0x33a7ca['split']('.'))['filter'](_0x4e2ec4=>_0x4e2ec4['length']<=_0x259467['length'])['map'](_0x39f29d=>Array(_0x259467['length']-_0x39f29d['length'])['fill']('*'===_0x39f29d[0x0]?'*':'')['concat'](_0x39f29d))['some'](_0x997dcb=>_0x259467['every']((_0x22591f,_0x3037d2)=>_0x997dcb[_0x3037d2]===_0x22591f||'*'===_0x997dcb[_0x3037d2]));}function _0x7e414a(){return _0x55e589&&_0x145eee?new window['Promise']((_0x5677c8,_0x40f7f7)=>{_0x55e589['then'](_0x5677c8,_0x40f7f7),_0x145eee['then'](_0x4a4f76=>{'Valid'!=_0x4a4f76&&_0x5677c8(_0x4a4f76);},_0x40f7f7);}):_0x55e589||_0x145eee||'Valid';}}function _0x50da19(_0x1f4657,_0x1e9f3b){return new window['Promise'](_0xd8c662=>{if(_0x364547())return _0xd8c662('Valid');_0x2444b8(),_0x3e0b68['decorate']('_sendUsageRequest');let _0x6a4d0=!0x1;const _0x13f6f5=kt();function _0x26895d(_0xac47b5){return!!_0xac47b5&&('object'==typeof _0xac47b5||'function'==typeof _0xac47b5)&&'function'==typeof _0xac47b5['then']&&'function'==typeof _0xac47b5['catch'];}function _0x212971(_0x1f94e9){_0xb6bb3c(_0x1f94e9)['then'](_0x2b1c35=>_0x2b1c35&&'ok'==_0x2b1c35['status']?_0x48d266(_0x23196d(_0x13f6f5+_0x1e9f3b))!=_0x2b1c35['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x6b16dd=>(_0x391b49(),_0x6b16dd),()=>{const _0x3cd458=_0x5cf84b();return null==_0x3cd458?(_0x391b49(),'Valid'):_0x4b89cc-_0x3cd458>0x240c8400?'UsageLimit':'Valid';})['then'](_0xd8c662)['catch'](()=>{_0xd8c662('UsageLimit');});const _0x3aa19e=0x36ee80;function _0x391b49(){const _0x4c0546='llct-'+_0x48d266(_0x23196d(_0x1f4657)),_0x27ead3=_0x777390(_0x48d266(window['Math']['ceil'](_0x4b89cc/_0x3aa19e)));window['localStorage']['setItem'](_0x4c0546,_0x27ead3);}function _0x5cf84b(){const _0x1a6ebe='llct-'+_0x48d266(_0x23196d(_0x1f4657)),_0x3ed269=window['localStorage']['getItem'](_0x1a6ebe);return _0x3ed269?window['parseInt'](_0x777390(_0x3ed269),0x10)*_0x3aa19e:null;}function _0xb6bb3c(_0x49a50d){return new window['Promise']((_0x2df24f,_0x53db51)=>{_0x49a50d['then'](_0x2df24f,_0x53db51),window['setTimeout'](_0x53db51,0x1d4c0);});}}_0x3e0b68['on']('_sendUsageRequest',(_0x3b7ffa,_0x431e96)=>{if(_0x431e96[0x0]!=_0x1f4657)return _0xd8c662('UsageLimit');_0x431e96[0x1]={..._0x431e96[0x1],'requestId':_0x13f6f5};},{'priority':'high'}),_0x3e0b68['on']('_sendUsageRequest',_0x2f767f=>{_0x26895d(_0x2f767f['return'])&&(_0x6a4d0=!0x0,_0x212971(_0x2f767f['return']));},{'priority':'low'}),_0x4a5594['then'](()=>{_0x6a4d0||_0xd8c662('UsageLimit');});});function _0x364547(){return'auto'==_0x3e0b68['editing']['view']['_overlayModeHint'];}function _0x2444b8(){_0x3e0b68['editing']['view']['_overlayModeHint']='auto';}}function _0xdb996a(_0x3a5957){const _0x36a1e8=[new window['Promise'](_0x46f80c=>setTimeout(_0x46f80c,0x93ecc)),_0x4a5594['then'](()=>new window['Promise'](_0x2afb0b=>{let _0x519741=0x0;_0x3e0b68['model']['on']('applyOperation',(_0x4a836c,_0x457da0)=>{_0x457da0[0x0]['isDocumentOperation']&&_0x519741++,0x5e8==_0x519741&&(_0x2afb0b(),_0x4a836c['off']());});}))];return window['Promise']['race'](_0x36a1e8)['then'](()=>_0x3a5957);}async function _0x57e89a(){await _0x4a5594,_0x3e0b68['model']['change']=_0x269bba,_0x3e0b68['model']['enqueueChange']=_0x269bba,_0x3e0b68['enableReadOnlyMode']('model');}function _0x501143(_0x3e3733){const _0x11f0a6=_0x37c2d4();_0x3e0b68[_0x11f0a6]='aiLicenseKey'+_0x3e3733,'Valid'!=_0x3e3733&&_0x57e89a();}function _0x37c2d4(){const _0xce0751=window['String'](window['performance']['now']())['replace']('.','');let _0x37d483='n';for(let _0x5bb09b=0x0;_0x5bb09b<_0xce0751['length'];_0x5bb09b+=0x2){let _0x4317c5=window['parseInt'](_0xce0751['substring'](_0x5bb09b,_0x5bb09b+0x2));_0x4317c5>=0x3e&&(_0x4317c5-=0x3e),_0x37d483+=_0x34b69e[_0x4317c5];}return _0x37d483;}function _0x40d265(){const _0x4282b9=_0x39dc42['split']('.');if(0x3!=_0x4282b9['length'])return null;return _0x4409e4(_0x4282b9[0x1]);function _0x4409e4(_0x47dfb9){const _0x3230ea=_0x3a96dd(_0x47dfb9);return _0x3230ea&&_0x3b596b()?_0x3230ea:null;function _0x3b596b(){const _0xc67928=_0x3230ea['jti'],_0x1c8dbd=window['parseInt'](_0xc67928['substring'](_0xc67928['length']-0x8),0x10),_0xab01f8={..._0x3230ea,'jti':_0xc67928['substring'](0x0,_0xc67928['length']-0x8)};return delete _0xab01f8['vc'],_0x23196d(_0xab01f8)==_0x1c8dbd;}}}async function _0x3c1492(){let _0x2977cb=!0x0;try{const [_0x7462bd,_0xdaec0a,_0x310bca]=_0x39dc42['split']('.');return _0x361865(_0x7462bd),await _0x9783b1(_0x7462bd,_0xdaec0a,_0x310bca),_0x2977cb;}catch{return!0x1;}function _0x361865(_0x207248){const _0x4567e3=_0x3a96dd(_0x207248);_0x4567e3&&'ES256'==_0x4567e3['alg']||(_0x2977cb=!0x1);}async function _0x9783b1(_0x34571f,_0x2b8f15,_0x3b346d){const _0x2c4f1a=window['Uint8Array']['from'](_0x3b8dfe(_0x3b346d),_0x281687=>_0x281687['charCodeAt'](0x0)),_0xb0fb98=new window['TextEncoder']()['encode'](_0x34571f+'.'+_0x2b8f15),_0x418f0=window['crypto']['subtle'];if(!_0x418f0)return;const _0x475f0e=await _0x418f0['importKey']('jwk',_0x15a13a,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x418f0['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x475f0e,_0x2c4f1a,_0xb0fb98)||(_0x2977cb=!0x1);}}function _0x3a96dd(_0x21c2c2){return _0x21c2c2['startsWith']('ey')?JSON['parse'](_0x3b8dfe(_0x21c2c2)):null;}function _0x3b8dfe(_0x4a381e){return window['atob'](_0x4a381e['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x23196d(_0x1134d3){let _0xaff9b8=0x1505;function _0x3fccca(_0x4d7391){for(let _0x5b7c5a=0x0;_0x5b7c5a<_0x4d7391['length'];_0x5b7c5a++){const _0x15042f=_0x4d7391['charCodeAt'](_0x5b7c5a);_0xaff9b8=(_0xaff9b8<<0x5)+_0xaff9b8+_0x15042f,_0xaff9b8&=_0xaff9b8;}}function _0x36dbd4(_0x2fced5){Array['isArray'](_0x2fced5)?_0x2fced5['forEach'](_0x36dbd4):_0x2fced5&&'object'==typeof _0x2fced5?Object['entries'](_0x2fced5)['sort']()['forEach'](([_0x576f6d,_0x2c21ca])=>{_0x3fccca(_0x576f6d),_0x36dbd4(_0x2c21ca);}):_0x3fccca(window['String'](_0x2fced5));}return _0x36dbd4(_0x1134d3),_0xaff9b8>>>0x0;}function _0x48d266(_0x2d736b){return _0x2d736b['toString'](0x10)['padStart'](0x8,'0');}function _0x777390(_0x2fca49){return _0x2fca49['split']('')['reverse']()['join']('');}function _0x269bba(){}_0x501143(await _0x55a5a3());}(this);}showFakeVisualSelection(){const _0x123c22=this['editor']['model'];_0x123c22['change'](_0x1be8f9=>{const _0x2068b8=_0x123c22['document']['selection']['getRanges']();let _0x34e66d=0x0;for(const _0x358e76 of _0x2068b8){const _0x27d2ee=Ni+':'+_0x34e66d;if(_0x123c22['markers']['has'](_0x27d2ee))_0x1be8f9['updateMarker'](_0x27d2ee,{'range':_0x358e76});else{if(_0x358e76['start']['isAtEnd']){const _0x3d4172=_0x358e76['start']['getLastMatchingPosition'](({item:_0x1c098a})=>!_0x123c22['schema']['isContent'](_0x1c098a),{'boundaries':_0x358e76});_0x1be8f9['addMarker'](_0x27d2ee,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x1be8f9['createRange'](_0x3d4172,_0x358e76['end'])});}else _0x1be8f9['addMarker'](_0x27d2ee,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x358e76});}_0x34e66d++;}});}hideFakeVisualSelection(){const _0x53219c=this['editor']['model'],_0x17359a=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Ni));_0x17359a['length']&&_0x53219c['change'](_0x270ead=>{_0x17359a['forEach'](_0x47fdd2=>{_0x270ead['removeMarker'](_0x47fdd2);});});}insertContent(_0x3dea1b,_0x2f43a8){const _0x3e355b=this['_getAISelection'](),_0x5714e1=_0x2f43a8||_0x3e355b['getFirstRange']();this['editor']['model']['canEditAt'](_0x5714e1)&&this['editor']['model']['change'](_0x1bcc82=>{this['hideFakeVisualSelection'](),_0x2f43a8||this['_resetContentOfSelectedTableCells'](_0x1bcc82,_0x3e355b),this['_pasteHTMLUsingClipboard']({'insertAt':_0x5714e1,'writer':_0x1bcc82,'html':_0x3dea1b});});}insertContentBelow(_0x4c7293){const {model:_0x84bc1b}=this['editor'],_0x530d7a=this['_getAISelection']();_0x84bc1b['change'](()=>{const _0x95a836=this['_prepareTableInsertBelowPosition'](_0x4c7293,_0x530d7a)||this['_getDefaultInsertBelowPosition'](_0x530d7a);this['insertContent'](_0x4c7293,_0x95a836);});}_getAISelection(){const _0x385db0=this['editor']['model'],_0x37bb3e=Array['from'](_0x385db0['markers']['getMarkersGroup'](Ni))['map'](_0x2354f7=>_0x2354f7['getRange']());return _0x385db0['createSelection'](_0x37bb3e);}_pasteHTMLUsingClipboard({writer:_0x4bc4d0,html:_0x16d9b7,insertAt:_0x143e6a}){const {view:_0x35b83d}=this['editor']['editing'],_0x17f20c=this['editor']['plugins']['get'](_0x5d9c9d),_0x34f9bd=new yi();_0x34f9bd['setData']('text/html',_0x16d9b7);const _0x2d3a8b=new _0x1b1d52(_0x35b83d,new ClipboardEvent('paste',{'clipboardData':_0x34f9bd}),{'dataTransfer':new _0x1fcb27(_0x34f9bd)});_0x4bc4d0['setSelection'](_0x143e6a);const _0x19f77b=(_0x25f1c6,_0x1309e6)=>{_0x1309e6['resultRange']&&_0x4bc4d0['setSelection'](_0x1309e6['resultRange']);};_0x17f20c['once']('contentInsertion',_0x19f77b,{'priority':'lowest'}),_0x35b83d['document']['fire']('paste',_0x2d3a8b),_0x17f20c['off']('contentInsertion',_0x19f77b);}_getDefaultInsertBelowPosition(_0x316959){const {model:_0x8c74db}=this['editor'],_0x4f794a=Array['from'](_0x316959['getSelectedBlocks']());return _0x4f794a['length']?_0x8c74db['createPositionAfter'](_0x4f794a['pop']()):_0x316959['getLastPosition']();}_prepareTableInsertBelowPosition(_0x3a53b4,_0x42ce17){const {model:_0x11e4f9,plugins:_0x1bc29b}=this['editor'];if(_0x1bc29b['has']('TableUtils')){const _0x413328=_0x1bc29b['get']('TableUtils')['getSelectedTableCells'](_0x42ce17);if(_0x413328['length']){const _0x53a046=this['_getTableRowCountFromContent'](_0x3a53b4),_0x1c64c3=this['_createEmptyTableRows'](_0x413328,_0x53a046);return _0x11e4f9['createPositionAt'](_0x1c64c3,0x0);}}return null;}_getTableRowCountFromContent(_0x7a02b9){const _0x49dcd1=this['editor']['plugins']['get']('TableUtils'),_0x4af66a=this['editor']['data']['parse'](_0x7a02b9,'$documentFragment'),_0x5a4a5a=Array['from'](_0x4af66a['getChildren']())['filter'](_0x4363df=>_0x4363df['is']('element','table'));let _0xd45ac1=0x0;return _0x5a4a5a['forEach'](_0x387363=>{_0xd45ac1+=_0x49dcd1['getRows'](_0x387363);}),_0xd45ac1;}_createEmptyTableRows(_0x4356ba,_0x13badc){const _0x3b3625=this['editor']['plugins']['get']('TableUtils'),_0x4aa3e8=_0x3b3625['getRowIndexes'](_0x4356ba),_0xb466d2=_0x3b3625['getColumnIndexes'](_0x4356ba),_0x1a333c=_0x4aa3e8['last']+0x1,_0x4e3391=_0xb466d2['first'],_0x2ddb7f=_0x4356ba[0x0]['findAncestor']('table');for(let _0x4f340b=0x0;_0x4f340b<_0x13badc;_0x4f340b++)_0x3b3625['insertRows'](_0x2ddb7f,{'at':_0x1a333c});return _0x2ddb7f['getChild'](_0x1a333c)['getChild'](_0x4e3391);}_resetContentOfSelectedTableCells(_0x39cadb,_0xa73fc0){const {plugins:_0xeeec50}=this['editor'],{model:_0x3b9fd5}=_0x39cadb;_0xeeec50['has']('TableUtils')&&_0xeeec50['get']('TableUtils')['getSelectedTableCells'](_0xa73fc0)['length']&&_0x3b9fd5['deleteContent'](_0xa73fc0);}},Li=class extends _0x622916{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}afterInit(){if(!this['textAdapter'])throw new ct('aiadapter-text-adapter-not-set',null);}},Pi=class extends Error{constructor(_0x38fff2){super(_0x38fff2),this['name']='AIRequestError';}};function Di(_0x4eea9f,_0x403531,_0x3ec55b){const t=_0x4eea9f['t'];switch(_0x403531){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',_0x3ec55b);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x3ec55b);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'},_0x3ec55b);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 _0x403531;}}var Hi=class extends _0x23b7b0{_commandDefinitions;constructor(_0x50f2d9,_0x4b43d7){super(_0x50f2d9),this['_commandDefinitions']=_0x4b43d7,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x1ee660,_0x2c82f8,_0x505fe6)=>{this['isEnabled']&&(this['enabledCommandsIds']=Mi(this['_commandDefinitions'],_0x505fe6));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0xbf2e47,_0x55816b,_0x3b3254)=>{this['enabledCommandsIds']=_0x3b3254?Mi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x39531b=this['editor']['model'];this['_hasContext']=function(_0x34a53b){const _0x5df24b=_0x34a53b['document']['selection'];return _0x5df24b['isCollapsed']?0x0!==[..._0x5df24b['getSelectedBlocks']()]['length']&&![..._0x5df24b['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x34a53b['hasContent'](_0x5df24b['getFirstRange']());}(_0x39531b);const _0x8ca639=_0x39531b['document']['selection'],_0x359de4=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x1e9e3e of _0x8ca639['getRanges']())for(const _0x808fc8 of _0x1e9e3e['getItems']())if(_0x808fc8['is']('element')&&_0x359de4['includes'](_0x808fc8['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}execute(_0x32c514='',_0x37d1ec='',_0x4ecdce='custom'){this['editor']['plugins']['get'](ts)['showUI'](_0x32c514,_0x37d1ec,_0x4ecdce);}};function Mi(_0x5259d4,_0x15ff99){const _0x1b002a=new Set();for(const _0x5cf883 of _0x5259d4['values']())(_0x15ff99||!0x1===_0x5cf883['requiresContent'])&&_0x1b002a['add'](_0x5cf883['id']);return Array['from'](_0x1b002a);}const Ui=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is'),Vi=/* #__PURE__ -- @preserve */
|
|
24
|
-
At();var Bi=class extends Vi{editor;textAdapter;['view'];_sanitizationContainer;['_domParser'];['_xmlSerializer'];constructor(_0x48c6a5,_0x42dd7e,_0x1ca583){super(),this['editor']=_0x48c6a5,this['textAdapter']=_0x42dd7e,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x1ca583,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x26112c,_0x4fc689,_0x502ced)=>{this['view']['value']=this['_sanitizeHTML'](_0x502ced);}),this['listenTo'](this['view'],'submitPrompt',(_0x356616,_0xa6f168)=>{const _0x1aced=this['currentContext']||this['initialContext'];this['_handleQuery'](_0xa6f168,_0x1aced,'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:_0x4c22db,query:_0x43672,htmlContent:_0x1ce343,label:_0x250d4d,mainActionLabel:_0x4695c2}){this['view']['prompt']=_0x250d4d,this['view']['mainAction']=_0x4695c2,this['initialContext']=_0x1ce343,_0x43672&&(this['view']['isRendered']?this['_handleQuery'](_0x43672,_0x1ce343,_0x4c22db,_0x250d4d):this['view']['once']('render',()=>{this['_handleQuery'](_0x43672,_0x1ce343,_0x4c22db,_0x250d4d);}));}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'](_0x256f66,_0x43cc47,_0x445cdd,_0x29946d){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x43cc47,this['previousQuery']=_0x256f66,this['previousLabel']=_0x29946d||_0x256f66,this['previousActionId']=_0x445cdd,new Promise(_0x1c5bf6=>{this['textAdapter']['makeRequest']({'query':_0x256f66,'context':_0x43cc47,'onData':_0x8f23c9=>{this['currentResponse']=_0x8f23c9,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x445cdd})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x417d14=>{_0x417d14 instanceof Pi?this['view']['handleError'](_0x417d14['message']):this['view']['handleError'](),_0x1c5bf6();})['finally'](()=>{this['stopProcessing'](),_0x1c5bf6();});});}_parseAndNormalizeContent(_0x446bbe,_0xcf91c8=!0x1){const _0x273b58=Ui['exec'](_0x446bbe);_0x446bbe=_0x273b58?_0x446bbe['substring'](_0x273b58[0x1]['length']):_0x446bbe['length']<0x64&&!_0xcf91c8?'':this['_stripMarkdownSyntax'](_0x446bbe);const _0x109fc5=this['_domParser']['parseFromString'](_0x446bbe,'text/html');if(_0x273b58){const _0x22a971=Array['from'](_0x109fc5['body']['childNodes']);_0x22a971['reverse']();for(const _0xf4c7b4 of _0x22a971){if(_0xf4c7b4['nodeType']==Node['ELEMENT_NODE'])break;_0xf4c7b4['remove']();}}const _0x12ee43=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x109fc5['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x12ee43);const _0x385f0e=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x4f2cf8=this['editor']['data']['toModel'](_0x12ee43);return _0x385f0e||_0x4f2cf8['markers']['clear'](),this['editor']['data']['stringify'](_0x4f2cf8);}['_normalizeResponseHeadings'](_0x11c1f7){const _0x48b193=new _0x6705a7(this['editor']['editing']['view']['document']),_0x491b37=new _0x34dbd2({'name':/^h[1-5]$/}),_0x4e4340=[];let _0x5ef88b=!0x1;for(const _0x2f7d1b of _0x11c1f7)_0x2f7d1b['is']('element')&&_0x491b37['match'](_0x2f7d1b)&&(_0x4e4340['push'](_0x2f7d1b),'h1'==_0x2f7d1b['name']&&(_0x5ef88b=!0x0));if(_0x5ef88b){for(const _0x2f7aa2 of _0x4e4340)_0x48b193['rename']('h'+(parseInt(_0x2f7aa2['name'][0x1])+0x1),_0x2f7aa2);}}_isH1TagSupportEnabled(){const {data:_0x58b0a0,editing:_0x337585}=this['editor'],_0x5d9f1d=_0x58b0a0['htmlProcessor']['toView']('<h1></h1>'),_0x5cc3dd=_0x58b0a0['toView'](_0x58b0a0['toModel'](_0x5d9f1d));return!!_0x337585['view']['domConverter']['viewToDom'](_0x5cc3dd)['querySelector']('h1');}_sanitizeHTML(_0x38d14d){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x38d14d),this['_sanitizationContainer']['innerHTML'];}_stripMarkdownSyntax(_0x36e024){const _0x30add2=_0x36e024['trim']();return _0x30add2['startsWith']('```html')?_0x30add2['endsWith']('```')?_0x30add2['substring'](0x7,_0x30add2['length']-0x3):_0x30add2['substring'](0x7):_0x36e024;}};const Gi={'REPLACE':'replace','INSERT':'insert'};var Fi=class extends _0x54b9b5{constructor(_0x336386){super(_0x336386),this['set']('isVisible',!0x1),this['set']('mainAction',Gi['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x2e5b91=>Di(_0x336386,'AI_'+_0x2e5b91['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Di(_0x336386,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Di(_0x336386,'Try\x20again')),this['stopButton']=this['_createButton'](Di(_0x336386,'Stop'));const _0x41d6db=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x41d6db['if']('isVisible','ck-hidden',_0x57d4d0=>!_0x57d4d0)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}_createButton(_0x36cd26,_0x49e9ca){const _0xb00106=new Mt(this['locale']);return _0xb00106['set']({'label':_0x36cd26,'class':_0x49e9ca||'','isVisible':!0x0,'withText':!0x0}),_0xb00106;}},Ki=class extends _0x56a514{contentFieldView;copyButtonView;constructor(_0x5101df,_0x5f2ba0=''){super(_0x5101df),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x5b374a=this['bindTemplate'];this['contentFieldView']=new Wi(_0x5101df,_0x5f2ba0),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x5b374a['if']('isVisible','ck-hidden',_0x597fe5=>!_0x597fe5)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x5b374a['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 _0x115e35=!0x1;this['on']('change:value',(_0x5b53ac,_0x426fac,_0xc14bd2)=>{const _0x3ffecb=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0xc14bd2),this['isProcessing']&&_0x3ffecb&&!_0x115e35&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x1bba47,_0xa6e97,_0x1c9453)=>{_0x115e35=!0x1,_0x1c9453?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x115e35=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x115e35=!0x0;});}['focus'](){this['element']['focus']();}_createCopyButton(){const _0x5f2871=this['locale'],_0x2a0207=new Mt(this['locale']),_0x4b76f2='ck-ai-form__copy-button';return _0x2a0207['set']({'label':Di(_0x5f2871,'Copy'),'icon':_0xaeff50,'class':_0x4b76f2,'tooltip':!0x0}),_0x2a0207['bind']('isVisible')['to'](this,'value',_0x512687=>!!_0x512687),_0x2a0207['bind']('isEnabled')['to'](this,'isProcessing',_0xd7b9e0=>!_0xd7b9e0),_0x2a0207['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x2a0207['icon']=_0x48b061,_0x2a0207['class']=_0x4b76f2+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x2a0207['icon']=_0xaeff50,_0x2a0207['class']=_0x4b76f2;},0x3e8);}),_0x2a0207;}['_copyHTMLToClipboard'](_0x5e987b){const {window:_0x732931,document:_0x3bf52e}=wt;if(_0x732931['ClipboardItem']){const {Blob:_0x333312,ClipboardItem:_0x1c9124}=_0x732931,_0x40f60f=[new _0x1c9124({'text/html':new _0x333312([_0x5e987b['innerHTML']],{'type':'text/html'}),'text/plain':new _0x333312([_0x5e987b['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x40f60f);}else{const _0x43a484=_0x3bf52e['createElement']('div');_0x43a484['style']['position']='absolute',_0x43a484['style']['left']='-9999px',_0x43a484['innerHTML']='<span>[</span>'+_0x5e987b['innerHTML']+'<span>]</span>',_0x3bf52e['body']['appendChild'](_0x43a484);const _0x2fdddb=_0x3bf52e['createRange']();_0x2fdddb['setStartAfter'](_0x43a484['firstElementChild']),_0x2fdddb['setEndBefore'](_0x43a484['lastElementChild']);const _0x55a5e9=_0x732931['getSelection']();_0x55a5e9['removeAllRanges'](),_0x55a5e9['addRange'](_0x2fdddb),_0x3bf52e['execCommand']('copy'),_0x43a484['remove']();}}},Wi=class extends _0x56a514{constructor(_0x2aaae3,_0x58bd6d=''){super(_0x2aaae3),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x58bd6d,'ck-reset_all-excluded','ck-ai-form__content-field']}});}setContent(_0x194c37){this['element']['innerHTML']=_0x194c37;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}_createLoader(){const _0x100a46=new _0x56a514(),_0xf4be68=this['locale'],_0x5bd59d=new _0x14cb96();return _0x5bd59d['isVisible']=!0x0,_0x100a46['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x5bd59d,{'text':Di(_0xf4be68,'AI\x20is\x20writing...')}]}),_0x100a46['render'](),_0x100a46;}},Yi=class extends _0x56a514{constructor(_0x63dfb0,_0x4b78a8=''){super(_0x63dfb0);const _0x4c826f=new $t(),_0xc66040=this['bindTemplate'];this['set']('text',_0x4b78a8),_0x4c826f['content']=_0x309d45,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x4c826f,{'text':_0xc66040['to']('text')}]});}},$i=class extends Nt{submitButtonView;showHistoryButtonView;constructor(_0xb76363,_0x22a3e3){super(_0xb76363,_0x22a3e3),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',(_0x45d53d,_0x425368)=>{_0x45d53d['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x425368());});}_createSubmitButton(){const _0x1e9bfc=new Mt(this['locale']),_0x737da2=this['locale'];return _0x1e9bfc['set']({'icon':nt,'label':Di(_0x737da2,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x1e9bfc['on']('execute',()=>{this['submit']();}),_0x1e9bfc['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x481a5f,_0x35aad2)=>!_0x481a5f&&_0x35aad2),_0x1e9bfc;}_createShowHistoryButton(){const _0x100f78=new Mt(this['locale']),_0x5ccbec=this['resultsView'],_0x1792f7=this['locale'];_0x100f78['set']({'label':Di(_0x1792f7,'History'),'withText':!0x1,'icon':_0x4afa16,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x100f78['bind']('isOn')['to'](_0x5ccbec,'isVisible'),_0x100f78['bind']('isEnabled')['to'](this,'isEnabled'),_0x100f78['on']('execute',()=>{_0x5ccbec['isVisible']=!_0x5ccbec['isVisible'],_0x5ccbec['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x2a43dc=()=>{wt['window']['requestAnimationFrame'](()=>{if(ft(this['element'])){const _0x42fab4=new It(this['queryView']['fieldView']['element']),_0x9e5265=_0x42fab4['width'],_0x3f243e='rtl'===_0x1792f7['uiLanguageDirection']?'left':'right';_0x42fab4['excludeScrollbarsAndBorders'](),_0x100f78['element']['style'][_0x3f243e]=_0x9e5265-_0x42fab4['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x2a43dc),this['on']('render',_0x2a43dc),_0x100f78;}submit(){const _0x1feb42=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x1feb42);}['focus'](_0x4411c1){-0x1===_0x4411c1?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},qi=class extends Jt{historyGroupView;clearHistoryButton;constructor(_0x64065d){super(_0x64065d),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new zt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Di(_0x64065d,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}filter(){let _0x27ed6e=0x0;for(const _0x34ceca of this['items'])_0x27ed6e+=_0x34ceca['items']['length'];return{'resultsCount':_0x27ed6e,'totalItemsCount':_0x27ed6e};}_createClearHistoryButton(){const _0x18f424=this['locale'],_0x4fce27=new Mt(this['locale']);return _0x4fce27['set']({'label':'('+Di(_0x18f424,'Clear')+')','withText':!0x0}),_0x4fce27['on']('execute',()=>this['fire']('clearHistory')),_0x4fce27;}},Qi=class extends jt{constructor(_0x2a8d6a){super();const _0x3a1e34=new Dt(),_0x53cb00=new Mt(this['locale'],_0x3a1e34);this['children']['add'](_0x53cb00),_0x53cb00['set']({'label':_0x2a8d6a['prompt'],'withText':!0x0}),_0x53cb00['on']('execute',()=>{this['fire']('execute',{'value':_0x2d8c2d(_0x2a8d6a['prompt'])});});}};const Xi='CKEditor/AIFormView/PromptHistory';var zi=class extends lt{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x51c9df,_0x10524a)=>{const _0x23592b=ji(_0x10524a['prompt']);for(const _0x3df424 of this)if(_0x3df424!=_0x10524a&&ji(_0x3df424['prompt'])===_0x23592b){this['remove'](_0x3df424);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}_loadFromSessionStorage(){const _0x3a972f=sessionStorage['getItem'](Xi)||'[]';this['addMany'](JSON['parse'](_0x3a972f));}_saveToSessionStorage(){sessionStorage['setItem'](Xi,JSON['stringify'](this['map'](_0x317e32=>_0x317e32)));}};function ji(_0x2cf010){return _0x2cf010['toLowerCase']()['trim']();}var Ji=class extends _0x56a514{['focusTracker'];keystrokes;contentArea;toolbar;promptView;['errorView'];['_focusables'];['focusCycler'];_promptHistory;constructor(_0x5b57c7,_0x4428fa,_0x42ac1e=''){super(_0x5b57c7),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',Gi['REPLACE']),this['_promptHistory']=new zi(),this['errorView']=new Yi(_0x5b57c7),this['contentArea']=new Ki(_0x5b57c7,_0x42ac1e),this['contentArea']['bind']('isProcessing')['to'](this),this['contentArea']['bind']('value')['to'](this),this['toolbar']=this['_createToolbar'](),this['toolbar']['bind']('mainAction')['to'](this),this['promptView']=this['_createPromptView'](),this['focusTracker']=new _t(),this['keystrokes']=new gt(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Ft({'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 _0x533760=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x4428fa],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x533760['if']('isError','ck-hidden',_0x50694e=>!_0x50694e)]},'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'](_0x21ec59=0x1){-0x1===_0x21ec59?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 _0x11724c=this['locale'],_0x4af930=new $i(_0x11724c,{'queryView':{'label':Di(_0x11724c,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x3cc43c,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Di(_0x11724c,'Empty\x20history'),'secondary':Di(_0x11724c,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x4af930['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x20487a,_0x2f049c)=>_0x20487a&&!_0x2f049c),this['listenTo'](_0x4af930,'submit',(_0xf72583,_0xa6d069)=>{this['prompt']=_0xa6d069;const _0x3a2160=_0x15f5d8(_0xa6d069);this['fire']('submitPrompt',_0x3a2160),_0xa6d069['trim']()&&this['_promptHistory']['add']({'prompt':_0x3a2160},0x0);},{'priority':'high'}),_0x4af930;}_createHistoryView(){const _0x154967=new qi(this['locale']);return _0x154967['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Qi),_0x154967['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x154967;}_createToolbar(){const _0x1d6a30=new Fi(this['locale']);return _0x1d6a30['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x381d1a,_0x52af40,_0x40bdff)=>_0x381d1a&&!_0x52af40&&!!_0x40bdff),_0x1d6a30['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x1d6a30['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x178959,_0xee9e29,_0xacf4af)=>_0x178959&&!_0xee9e29&&!!_0xacf4af),_0x1d6a30['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x1d6a30['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x111e02,_0x338eb3)=>_0x111e02&&!_0x338eb3),_0x1d6a30['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x1d6a30['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x1d6a30['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x1d6a30;}startProcessing(){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x460af4=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Di(_0x460af4,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x99371){const _0x53dc14=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x99371||Di(_0x53dc14,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const Zi=globalThis['DataTransfer'];var ts=class extends _0x622916{['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[_0x6355f1,xi,Li,Ut];}constructor(_0x2d5ef6){super(_0x2d5ef6),_0x2d5ef6['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x2d5ef6['config']['define']('ai.assistant.contentAreaCssClass',''),_0x2d5ef6['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x2d5ef6['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}init(){const {editor:_0x277b5a}=this;this['_aiAdapter']=_0x277b5a['plugins']['get'](Li),this['_dialog']=_0x277b5a['plugins']['get'](Ut),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x244854=new Hi(_0x277b5a,Array['from'](this['_commandDefinitions']['values']()));_0x277b5a['commands']['add']('showAIAssistant',_0x244854),_0x277b5a['ui']['componentFactory']['add']('aiCommands',_0x358f45=>{const _0x155991=_0x48403c(_0x358f45);return _0x155991['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x155991['buttonView']['set']({'label':Di(_0x358f45,'AI\x20Commands'),'icon':_0xbfdde1,'tooltip':!0x0}),_0x155991['on']('execute',_0x1ef60b=>this['_onExecute'](_0x1ef60b['source']['id'])),_0x1ce06a(_0x155991,_0x277b5a['ui']['view']['body'],function(_0x5e0adc){const _0x480ed6=is(_0x5e0adc,ki(_0x5e0adc['config']['get']('ai.assistant.commands'),_0x5e0adc['locale']))['filter'](_0x57bd2b=>_0x57bd2b['commands']['length']);return 0x1===_0x480ed6['length']?is(_0x5e0adc,_0x480ed6[0x0]['commands'])['map'](_0x5a475c=>({'id':_0x5a475c['id'],'label':_0x5a475c['label']})):_0x480ed6['map'](_0x2a8156=>{const {groupId:_0x20c51d,groupLabel:_0x1e24c6,commands:_0x1de4c7}=_0x2a8156,_0x12473d=is(_0x5e0adc,_0x1de4c7)['map'](_0x1fdc0d=>({'id':_0x1fdc0d['id'],'label':_0x1fdc0d['label']}));return{'id':_0x20c51d,'menu':_0x1e24c6||_0x20c51d,'children':_0x12473d};});}(_0x277b5a),{'ariaLabel':Di(_0x358f45,'AI\x20Commands')}),_0x155991['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x244854['on']('change:enabledCommandsIds',_0x198215),_0x155991['menuView']['once']('render',_0x198215),_0x155991;function _0x198215(){_0x155991['isEnabled']=_0x244854['enabledCommandsIds']['length']>0x0;for(const _0x46d3f1 of _0x155991['menuView']['buttons'])_0x46d3f1['isEnabled']=_0x244854['enabledCommandsIds']['includes'](_0x46d3f1['id']);}}),_0x277b5a['ui']['componentFactory']['add']('menuBar:aiCommands',_0x23642a=>{const _0x31e2b9=new _0x1021d4(_0x23642a);_0x31e2b9['buttonView']['set']({'label':Di(_0x23642a,'AI\x20Commands'),'icon':_0xbfdde1}),_0x31e2b9['bind']('isEnabled')['to'](_0x244854,'enabledCommandsIds',_0x4c76e0=>_0x4c76e0['length']>0x0);const _0xf52869=ki(_0x277b5a['config']['get']('ai.assistant.commands'),_0x23642a);return this['_populateMenuBarMenu'](_0x244854,_0x31e2b9,_0xf52869,_0x11c549=>this['_onExecute'](_0x11c549)),_0x31e2b9;}),_0x277b5a['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x1d31bb=this['_createAIAssistantUIButton'](Mt);return _0x1d31bb['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x1d31bb;}),_0x277b5a['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x30d559=this['_createAIAssistantUIButton'](Zt);return _0x30d559['set']({'role':'menuitemcheckbox'}),_0x30d559;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x44e4cf=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x307fc4;for(const _0x441914 in _0x44e4cf){const _0x542d06=_0x441914,_0x55633e=_0x44e4cf[_0x542d06];if('aiLicenseKeyValid'==_0x55633e||'aiLicenseKeyInvalid'==_0x55633e||'aiLicenseKeyExpired'==_0x55633e||'aiLicenseKeyDomainLimit'==_0x55633e||'aiLicenseKeyNotAllowed'==_0x55633e||'aiLicenseKeyEvaluationLimit'==_0x55633e||'aiLicenseKeyUsageLimit'==_0x55633e){delete _0x44e4cf[_0x542d06],_0x307fc4=_0x55633e,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x307fc4&&_0x44e4cf['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x307fc4&&_0x44e4cf['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x307fc4&&_0x44e4cf['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x307fc4&&_0x44e4cf['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x307fc4&&_0x44e4cf['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x307fc4&&_0x44e4cf['_showLicenseError']('usageLimit');},0x3e8);}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x3a9d79='',_0x556bc5='',_0xf76049='custom'){const _0x1745cc=this['editor'],_0x7871a7=_0x1745cc['editing']['view'],_0x34fea3=_0x1745cc['plugins']['get'](xi),_0x33886d=_0x1745cc['plugins']['get'](_0x6355f1);_0x34fea3['showFakeVisualSelection']();const _0x4369b6=new Zi(),_0x3489f2=new ClipboardEvent('copy',{'clipboardData':_0x4369b6}),_0x2fc607=new _0x1fcb27(_0x4369b6),_0x3aca91=new _0x1b1d52(_0x7871a7,_0x3489f2,{'dataTransfer':_0x2fc607});_0x33886d['_forceMarkersCopy']('comment',()=>{_0x7871a7['document']['fire']('copy',_0x3aca91);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Bi(_0x1745cc,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x2076a2=_0x2fc607['getData']('text/html');const _0x1428f5=_0x1745cc['model']['document']['selection'],_0x21d2f6=Array['from'](_0x1428f5['getRanges']());0x1===_0x21d2f6['length']&&_0x21d2f6[0x0]['isFlat']&&!_0x1428f5['getSelectedElement']()&&''!==_0x2076a2['replace'](/ /g,'')['trim']()&&(_0x2076a2='<p>'+_0x2076a2+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0xf76049,'query':_0x3a9d79,'htmlContent':_0x2076a2,'label':_0x556bc5,'mainActionLabel':Gi[_0x1745cc['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x59f1b5,'title':Di(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Vt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x34fea3['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}_getResolvedCommandsDefinitions(){const _0x498104=new Map(),_0x11821c=ki(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x4baf2b of _0x11821c)for(const _0x35b36c of _0x4baf2b['commands'])_0x498104['set'](_0x35b36c['id'],{..._0x35b36c,'groupId':_0x4baf2b['groupId'],'groupLabel':_0x4baf2b['groupLabel']||_0x4baf2b['groupId']});return _0x498104;}_createAIAssistantUIButton(_0x26d95c){const _0x1ff665=this['editor'],_0x329ef9=_0x1ff665['commands']['get']('showAIAssistant'),_0x5507cc=new _0x26d95c(_0x1ff665['locale']);return _0x5507cc['set']({'label':Di(_0x1ff665['locale'],'AI\x20Assistant'),'icon':_0x59f1b5,'isToggleable':!0x0}),_0x5507cc['bind']('isEnabled')['to'](_0x329ef9),_0x5507cc['bind']('isOn')['to'](this['_dialog'],'id',_0x1afb8f=>'aiAssistant'===_0x1afb8f),this['listenTo'](_0x5507cc,'execute',()=>{_0x5507cc['isOn']?this['hideUI']():_0x329ef9['execute']();}),_0x5507cc;}_initView(){const _0x1a8af6=this['editor']['plugins']['get'](xi);this['_formView']=new Ji(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',()=>{_0x1a8af6['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x1a8af6['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}_initAriaAiStatusChangeAnnouncements(){const {locale:_0xd7df55,ui:{ariaLiveAnnouncer:_0x57cad7}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x66121d,_0x215ea3,_0xdf0581)=>{const _0x439a3c=this['_aiAssistantController']['currentContext'];_0xdf0581?_0x57cad7['announce'](Di(_0xd7df55,'AI\x20is\x20writing')):_0x439a3c&&_0x57cad7['announce'](Di(_0xd7df55,'Generated\x20content:\x20%0',_0x439a3c),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x6ef677,_0x31d24f,_0x38bd08)=>{if(_0x38bd08){const _0x3d3676=this['_formView']['errorView']['text'];_0x57cad7['announce'](Di(_0xd7df55,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x3d3676));}});}_onExecute(_0x56df7c){const _0x4ea633=this['_commandDefinitions']['get'](_0x56df7c),_0x1e3a08=this['editor'],_0x1a9bdd=_0x1e3a08['model']['document']['selection'],_0x1a655b=_0x1e3a08['commands']['get']('showAIAssistant'),_0x10faee=_0x1e3a08['plugins']['get'](xi),_0x541024=''+('_ungrouppedCommands'!==_0x4ea633['groupId']?_0x4ea633['groupLabel']+':\x20':'')+_0x4ea633['label'];if(!0x1!==_0x4ea633['requiresContent']&&_0x1a9bdd['isCollapsed']){const _0x571b2f=mt(_0x1a9bdd['getSelectedBlocks']())||_0x1e3a08['model']['schema']['getLimitElement'](_0x1a9bdd);_0x1e3a08['model']['change'](_0x1e6be0=>{_0x1e6be0['setSelection'](_0x571b2f,'in');});}_0x10faee['showFakeVisualSelection'](),_0x1a655b['execute'](_0x4ea633['prompt'],_0x541024,'command:'+_0x56df7c);}_populateMenuBarMenu(_0x17d081,_0x42a0d9,_0x5cf087,_0xbc39f){const _0x148d68=this['editor'],_0x1627ad=_0x148d68['locale'],_0x3a9112=new _0x14eb7a(_0x1627ad),_0x261025=is(_0x148d68,_0x5cf087)['filter'](_0x198c71=>_0x198c71['commands']['length']);0x1===_0x261025['length']?this['_getMenuBarGroupButtons']({'command':_0x17d081,'commands':_0x261025[0x0]['commands'],'parentMenuView':_0x42a0d9,'onExecute':_0xbc39f})['forEach'](_0xdab92=>_0x3a9112['items']['add'](_0xdab92)):_0x261025['forEach'](({groupId:_0x489ac2,groupLabel:_0x5ec660,commands:_0x3adbc6})=>{const _0x3f7219=new te(_0x1627ad,_0x42a0d9),_0x37d3db=new _0x1021d4(_0x1627ad),_0x42fc78=new _0x14eb7a(_0x1627ad),_0x478306=this['_getMenuBarGroupButtons']({'command':_0x17d081,'commands':_0x3adbc6,'parentMenuView':_0x37d3db,'onExecute':_0xbc39f});_0x37d3db['buttonView']['set']({'label':_0x5ec660||_0x489ac2}),_0x37d3db['delegate']('execute')['to'](_0x42a0d9),_0x42fc78['items']['addMany'](_0x478306),_0x37d3db['panelView']['children']['add'](_0x42fc78),_0x3f7219['children']['add'](_0x37d3db),_0x3a9112['items']['add'](_0x3f7219);}),_0x42a0d9['panelView']['children']['add'](_0x3a9112);}_getMenuBarGroupButtons({command:_0x411e75,commands:_0x4b0a49,parentMenuView:_0x5036a1,onExecute:_0x540759}){const _0xc9a926=this['editor'],_0x1ea0c4=_0xc9a926['locale'];return is(_0xc9a926,_0x4b0a49)['map'](_0x3f94e9=>{const _0x276f31=new te(_0x1ea0c4,_0x5036a1),_0x4e75f7=new Zt(_0x1ea0c4);return _0x4e75f7['set']({'label':_0x3f94e9['label']}),_0x4e75f7['delegate']('execute')['to'](_0x5036a1),_0x4e75f7['on']('execute',()=>_0x540759(_0x3f94e9['id'])),_0x4e75f7['bind']('isEnabled')['to'](_0x411e75,'enabledCommandsIds',_0x1956af=>_0x1956af['includes'](_0x3f94e9['id'])),_0x276f31['children']['add'](_0x4e75f7),_0x276f31;});}};function es(_0x4fc6dd,_0x304a9a){return void 0x0!==_0x4fc6dd['order']&&void 0x0===_0x304a9a['order']?0x1:void 0x0===_0x4fc6dd['order']&&void 0x0!==_0x304a9a['order']?-0x1:void 0x0!==_0x4fc6dd['order']&&void 0x0!==_0x304a9a['order']?_0x4fc6dd['order']-_0x304a9a['order']:0x0;}function is(_0x114844,_0x23dd36){_0x23dd36['sort'](es);const _0x3d2ad1={},_0x2e0095=[];for(const _0x3332f6 of _0x23dd36)if(void 0x0!==_0x3332f6['order']){if(_0x3332f6['order']in _0x3d2ad1)throw new ct('ai-commands-config-order-collision',_0x114844,{'conflictingDefinitions':[_0x3332f6,_0x3d2ad1[_0x3332f6['order']]]});_0x3d2ad1[_0x3332f6['order']]=_0x3332f6,_0x2e0095['splice'](_0x3332f6['order'],0x0,_0x3332f6);}else _0x2e0095['push'](_0x3332f6);return _0x2e0095;}var ss=class extends _0x622916{static get requires(){return[ts,xi];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2ba2ee){super(_0x2ba2ee);const _0x599a95=_0x2ba2ee['config'],_0xaf74e0=_0x2ba2ee['locale'];_0x599a95['define']('ai.assistant.preserveComments',!0x0),_0x599a95['define']('ai.assistant.commands',ns(_0xaf74e0)),_0x599a95['define']('ai.assistant.extraCommandGroups',[]),_0x599a95['define']('ai.assistant.removeCommands',[]);let _0x4437be=ki(_0x599a95['get']('ai.assistant.commands'),_0xaf74e0);const _0x393b5d=_0x599a95['get']('ai.assistant.extraCommandGroups'),_0xc712dd=_0x599a95['get']('ai.assistant.removeCommands');_0x393b5d['forEach'](_0x1d852f=>{const _0x1ba354=_0x4437be['find'](_0x51c901=>_0x51c901['groupId']===_0x1d852f['groupId']);_0x1ba354?_0x1ba354['commands']=_0x1ba354['commands']['concat'](_0x1d852f['commands']):_0x4437be['push'](_0x1d852f);}),_0x4437be=_0x4437be['filter'](_0x25d2c3=>!_0xc712dd['includes'](_0x25d2c3['groupId'])),_0x4437be['forEach'](_0x1bd396=>{_0x1bd396['commands']=_0x1bd396['commands']['filter'](_0xd3be7d=>!_0xc712dd['includes'](_0xd3be7d['id']));}),_0x599a95['set']('ai.assistant.commands',_0x4437be);}};function ns(_0x1d5d19){return[{'groupId':'editOrReview','groupLabel':Di(_0x1d5d19,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Di(_0x1d5d19,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Di(_0x1d5d19,'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':Di(_0x1d5d19,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Di(_0x1d5d19,'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':Di(_0x1d5d19,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Di(_0x1d5d19,'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':Di(_0x1d5d19,'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':Di(_0x1d5d19,'Change\x20tone'),'commands':[{'id':'professional','label':Di(_0x1d5d19,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Di(_0x1d5d19,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Di(_0x1d5d19,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Di(_0x1d5d19,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Di(_0x1d5d19,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Di(_0x1d5d19,'Change\x20style'),'commands':[{'id':'business','label':Di(_0x1d5d19,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Di(_0x1d5d19,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Di(_0x1d5d19,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Di(_0x1d5d19,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Di(_0x1d5d19,'Translate'),'commands':[{'id':'translateEnglish','label':Di(_0x1d5d19,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Di(_0x1d5d19,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Di(_0x1d5d19,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Di(_0x1d5d19,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Di(_0x1d5d19,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Di(_0x1d5d19,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Di(_0x1d5d19,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Di(_0x1d5d19,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var rs=class extends _0x622916{abortController;static get requires(){return[Li];}constructor(_0x187d9f){super(_0x187d9f),this['abortController']=new AbortController();}init(){this['editor']['plugins']['get'](Li)['textAdapter']=this;}abort(){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async makeRequest(_0x511660){return this['sendRequest'](_0x511660)['catch'](_0x84b449=>{if(_0x84b449 instanceof Pi)return Promise['reject'](_0x84b449);if('AbortError'==_0x84b449['name'])return Promise['resolve']();throw console['error'](_0x84b449),new ct('aitextadapter-send-request-failed',null);});}async _prepareRequestHeaders(_0x410bfe,_0x4bd1b9){const _0x3e0ead=this['editor']['locale'],_0x17dfef={'Content-Type':'application/json'};if('object'==typeof _0x410bfe)Object['assign'](_0x17dfef,_0x410bfe);else{if(_0x410bfe)try{const _0x5a58f1=await _0x410bfe(_0x4bd1b9);Object['assign'](_0x17dfef,_0x5a58f1);}catch{return Promise['reject'](new Pi(Di(_0x3e0ead,'AI_ERROR_GET_HEADERS')));}}return _0x17dfef;}async _prepareRequestParameters(_0x31ff3b,_0x135bed){const _0x4732c6=this['editor']['locale'];if('object'==typeof _0x31ff3b)return _0x31ff3b;try{return await _0x31ff3b(_0x135bed);}catch{return Promise['reject'](new Pi(Di(_0x4732c6,'AI_ERROR_GET_PARAMETERS')));}}},os=class extends rs{['_apiUrl'];_requestHeaders;_requestParameters;static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x7e265a){super(_0x7e265a),_0x7e265a['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x7e265a['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x7e265a['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x7e265a['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x7e265a['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x7e265a['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async sendRequest({query:_0xbcb2b4,context:_0x12d72e,onData:_0x1ab670,actionId:_0x4588a7}){const _0x4bedef=this['editor']['locale'],_0x2997ca=await this['prepareMessages'](_0xbcb2b4,_0x12d72e,_0x4588a7),_0x11d985=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x4588a7),_0x42b278=await this['_prepareRequestParameters'](this['_requestParameters'],_0x4588a7),_0x44f6f6={'messages':_0x2997ca,..._0x42b278},_0x2686dc={'method':'POST','headers':_0x11d985,'body':JSON['stringify'](_0x44f6f6),'signal':this['abortController']['signal']},_0x1d2846=await fetch(this['_apiUrl'],_0x2686dc);if(_0x1d2846['ok'])return _0x42b278['stream']?await this['_readStreamableResponse'](_0x1d2846,_0x1ab670):await this['_readStaticResponse'](_0x1d2846,_0x1ab670),Promise['resolve']();{const _0x33ce59=await _0x1d2846['text']();return _0x33ce59['includes']('context_length_exceeded')?Promise['reject'](new Pi(Di(_0x4bedef,'AI_ERROR_CONTEXT_LENGTH'))):_0x33ce59['includes']('Moderation')?Promise['reject'](new Pi(Di(_0x4bedef,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x33ce59));}}async['prepareMessages'](_0x2ed1b3,_0x276f8e,_0x187940){let _0x228395,_0x4d669b;return _0x276f8e?(_0x228395='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.',_0x4d669b='Instruction:\x0a'+_0x2ed1b3+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x276f8e):(_0x228395='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.',_0x4d669b=_0x2ed1b3),[{'role':'system','content':_0x228395},{'role':'user','content':_0x4d669b}];}async _readStreamableResponse(_0x28a17d,_0x220cbe){const _0x48c8e9=_0x28a17d['body']['getReader'](),_0x5baf24=new TextDecoder();let _0x3aa9ed='',_0x103ff7='',_0x5c6af5='',_0x4b1964=!0x1;for(;!_0x4b1964;){const {done:_0x83346f,value:_0x5a5ee2}=await _0x48c8e9['read'](),_0x5841d3=_0x3aa9ed+_0x5baf24['decode'](_0x5a5ee2);let _0x2f7922;_0x4b1964=_0x83346f;try{_0x2f7922=this['_cleanUpData'](_0x5841d3),_0x3aa9ed='';}catch{_0x3aa9ed=_0x5841d3;continue;}_0x103ff7+=_0x2f7922,!_0x4b1964&&this['_isBufferIncomplete'](_0x103ff7)||_0x103ff7&&(_0x5c6af5+=_0x103ff7,_0x103ff7='',_0x220cbe(_0x5c6af5));}return Promise['resolve']();}async _readStaticResponse(_0x4dc338,_0x46f849){return _0x46f849((await _0x4dc338['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}_isBufferIncomplete(_0x9a53b0){const _0x458344=_0x9a53b0['split']('<')['length']!==_0x9a53b0['split']('>')['length'],_0xfa86e0=_0x9a53b0['length']<0x1e;return _0x458344&&_0xfa86e0;}_cleanUpData(_0x2b958f){return _0x2b958f['split'](/\n(?![^{]*\})/g)['map'](_0x172d40=>_0x172d40['replace']('data:\x20',''))['filter'](_0x4bed1c=>_0x4bed1c&&_0x4bed1c['length']>0x0&&'[DONE]'!==_0x4bed1c)['map'](_0x44e0e4=>{const {choices:_0xb5c825}=JSON['parse'](_0x44e0e4);if(_0xb5c825[0x0]?.['delta']?.['content'])return _0xb5c825[0x0]['delta']['content'];})['filter'](_0x54e123=>_0x54e123)['join']('');}},as=class extends rs{static get['pluginName'](){return'AWSTextAdapter';}init(){super['init'](),St('ai-aws-adapter-not-supported');}async sendRequest(_0x5ac51e){throw bt('ai-aws-adapter-not-supported'),new Pi(Di(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},hs=class extends Mt{constructor(_0xba2d52,_0x52a175={}){super(_0xba2d52),this['isToggleable']=!0x0,this['set']('side',_0x52a175['side']||'top');const _0xd729b=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...vt(_0x52a175['class']||[]),_0xd729b['to']('side',_0x50ba2e=>'ck-tab-button_'+_0x50ba2e),_0xd729b['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},cs=class extends _0x56a514{['children'];constructor(_0x786fd,_0xf29f83={}){super(_0x786fd);const _0x13e12c=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...vt(_0xf29f83['class']||[]),_0x13e12c['to']('class'),_0x13e12c['if']('isVisible','ck-hidden',_0x52b618=>!_0x52b618)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ls=class extends _0x56a514{buttonViews=this['createCollection']();['panelViews']=this['createCollection']();_tabs=new Map();constructor(_0x2fab01,_0xd6c61={}){super(_0x2fab01),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0xd6c61['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0xd6c61['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x44a734,_0x434e74)=>_0x44a734&&!_0x434e74);const _0x5dc6b2=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...vt(_0xd6c61['class']||[]),_0x5dc6b2['to']('side',_0x534e87=>'ck-tabs_'+_0x534e87),_0x5dc6b2['to']('class'),_0x5dc6b2['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x5dc6b2['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x5dc6b2['to']('side',_0x353db4=>'ck-tabs__buttons-container_'+_0x353db4)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x5dc6b2['to']('side',_0x16241d=>'ck-tabs__panels-container_'+_0x16241d)]},'children':this['panelViews']},...vt(_0xd6c61['children']||[])]});}getTabIds(){return[...this['_tabs']['keys']()];}getTab(_0x553ef3){const _0x2fd200=this['_tabs']['get'](_0x553ef3);return _0x2fd200||null;}['addTab'](_0x1d6687){const _0x2e0da2=this['_setupButton']({'id':_0x1d6687['id'],'label':_0x1d6687['buttonLabel'],'icon':_0x1d6687['buttonIcon'],'order':_0x1d6687['order']}),_0x228bf8=new cs(this['locale']);return _0x228bf8['render'](),_0x1d6687['content']&&_0x228bf8['children']['add'](_0x1d6687['content']),this['panelViews']['add'](_0x228bf8),this['_tabs']['set'](_0x1d6687['id'],{'button':_0x2e0da2,'panel':_0x228bf8,'order':void 0x0!==_0x1d6687['order']?_0x1d6687['order']:null}),this['fire']('addTab:'+_0x1d6687['id'],{'id':_0x1d6687['id'],'button':_0x2e0da2,'panel':_0x228bf8}),null===this['activeTab']?this['activateTab'](_0x1d6687['id']):this['_hidePanel'](_0x1d6687['id']),{'button':_0x2e0da2,'panel':_0x228bf8};}activateTab(_0x3320f6){if(null!==_0x3320f6&&!this['getTab'](_0x3320f6))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x3320f6});if(this['isCollapsed']=!0x1,this['activeTab']===_0x3320f6)return;const _0x127c30=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x3320f6,_0x3320f6&&this['_showPanel'](_0x3320f6),this['fire']('activateTab:'+_0x3320f6,{'newTab':_0x3320f6,'oldTab':_0x127c30});}toggleTabPanel(_0x56c8f3){this['activeTab']===_0x56c8f3?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x56c8f3);}['showTab'](_0x4f2bdd){if(!this['getTab'](_0x4f2bdd))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x4f2bdd});this['_showPanel'](_0x4f2bdd),this['_showButton'](_0x4f2bdd),this['fire']('show:'+_0x4f2bdd,_0x4f2bdd);}['hideTab'](_0xc0f9ae){if(!this['getTab'](_0xc0f9ae))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0xc0f9ae});const _0x2d4cc6=this['activeTab'];this['_hidePanel'](_0xc0f9ae),this['_hideButton'](_0xc0f9ae);const _0x96b789=this['getTabIds']();_0x2d4cc6===_0xc0f9ae&&_0x96b789['length']>0x1&&this['activateTab'](_0x96b789['find'](_0x751e6f=>_0x751e6f!==_0xc0f9ae)),this['fire']('hide:'+_0xc0f9ae,_0xc0f9ae);}_getPanel(_0x3f4c90){const _0x1f9878=this['_tabs']['get'](_0x3f4c90);return _0x1f9878?_0x1f9878['panel']:null;}['_showPanel'](_0x324d0b){null!==this['activeTab']&&this['activeTab']!==_0x324d0b||this['_getPanel'](_0x324d0b)['show']();}['_hidePanel'](_0xe13c4f){const _0x346ec8=this['_getPanel'](_0xe13c4f);_0x346ec8['isVisible']&&(this['activeTab']===_0xe13c4f&&(this['activeTab']=null),_0x346ec8['hide']());}_getButton(_0x32f3ca){const _0x5b321a=this['_tabs']['get'](_0x32f3ca);return _0x5b321a?_0x5b321a['button']:null;}_showButton(_0x9e4e0a){this['_getButton'](_0x9e4e0a)['show']();}_hideButton(_0x2ae12c){this['_getButton'](_0x2ae12c)['hide']();}_setupButton(_0x2f3ef3){const _0x59f0f9=new hs(this['locale'],{'side':this['side']}),_0x483d02=this['buttonViews'];if(_0x59f0f9['set']({'label':_0x2f3ef3['label'],'icon':_0x2f3ef3['icon'],'tooltip':!0x0,'withText':!0x0}),_0x59f0f9['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x1f697a,_0x4fd928)=>_0x1f697a===_0x2f3ef3['id']&&!_0x4fd928),_0x59f0f9['bind']('side')['to'](this,'side'),_0x2f3ef3['order']){const _0x54ea1b=[...this['_tabs']]['reduce']((_0x180cdf,_0x1ab333)=>{const _0xa31bf=_0x1ab333[0x0],{order:_0x243e76}=_0x1ab333[0x1];return!_0x243e76||_0x243e76>_0x2f3ef3['order']?_0x180cdf:_0x243e76>=_0x180cdf['order']?{'id':_0xa31bf,'order':_0x243e76}:_0x180cdf;},{'id':'','order':0x0}),_0x5a5639=_0x483d02['getIndex'](this['_getButton'](_0x54ea1b['id']));_0x483d02['add'](_0x59f0f9,_0x5a5639+0x1);}else _0x483d02['add'](_0x59f0f9);return _0x59f0f9['on']('execute',()=>{this['toggleTabPanel'](_0x2f3ef3['id']);}),_0x59f0f9;}};const us=['overlay','sidebar','custom'],ds=['left','right'];var _s=class extends ls{constructor(_0x303c6f,_0x35f570={}){super(_0x303c6f,_0x35f570),this['set']('type',_0x35f570['type']||'sidebar'),this['set']('side',_0x35f570['side']||'right'),this['set']('isVisible',_0x35f570['visibleByDefault']??!0x0);const _0x49910f=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x49910f['if']('type','ck-ai-tabs__overlay',_0xb01292=>'overlay'===_0xb01292),_0x49910f['if']('type','ck-ai-tabs__sidebar',_0x15ae8c=>'sidebar'===_0x15ae8c),_0x49910f['if']('isVisible','ck-hidden',_0x1e307f=>!_0x1e307f)]}}),this['buttonViews']['on']('add',(_0x1ddd99,_0xe328a3)=>{_0xe328a3['set']('withText',!0x1);});}},gs=class extends _0x898608{['view'];container=null;showResizeButton=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2cbe50){if(super(_0x2cbe50),!this['context']['config']['get']('ai.container'))throw new ct('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x5ee929=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x5ee929['showResizeButton']&&(this['showResizeButton']=_0x5ee929['showResizeButton']),'sidebar'!==_0x5ee929['type']&&'overlay'!==_0x5ee929['type']||_0x5ee929['side']&&(this['side']=_0x5ee929['side']),'sidebar'===_0x5ee929['type']){if(this['container']=_0x5ee929['element'],this['set']('type','sidebar'),!this['container'])throw new ct('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x5ee929['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new _s(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x5ee929['visibleByDefault'],'collapsible':_0x5ee929['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 _0x24cd6f&&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(_0x4d7c90){if(_0x4d7c90&&this['type']!==_0x4d7c90){if(!us['includes'](_0x4d7c90))throw new ct('ai-tabs-unsupported-ui-type');this['type']=_0x4d7c90;}}switchSide(_0x22b23b){if(_0x22b23b&&this['side']!==_0x22b23b){if(!ds['includes'](_0x22b23b))throw new ct('ai-tabs-unsupported-ui-side');this['side']=_0x22b23b;}}destroy(){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}};function As(_0x4eb4f9){return{..._0x4eb4f9,'type':'context'};}var Is=class extends _0x898608{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}_token;['_decoder'];static get requires(){return[_0x46601a];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x229ea9){if(super(_0x229ea9),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 ct('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder();}init(){const _0x508468=this['context']['plugins']['get'](_0x46601a);if(!_0x508468['token'])throw new ct('ai-missing-token',this);this['_token']=_0x508468['token'];}_getExtraHttpHeaders(){const _0x5d86f4=this['context']['config']['get']('ai.extraHttpHeaders'),_0x553dc5='function'==typeof _0x5d86f4?_0x5d86f4():_0x5d86f4;if(Array['isArray'](_0x553dc5)&&_0x553dc5['length'])return Object['fromEntries'](_0x553dc5['map'](({domain:_0x3bf43,headers:_0x3540f8})=>[_0x3bf43,_0x3540f8]));}startConversation(_0x4e0544,_0x15ade5){const _0x33e21e=this['_sendApiRequest']('/conversations','POST',{'id':_0x4e0544,'group':_0x15ade5});return{'getConversation':async()=>(await _0x33e21e['request'])['json'](),'abortController':_0x33e21e['abortController']};}queryAssistant({message:_0x33f89a,conversationId:_0x2596f9,parts:_0xa61e67,capabilities:_0x5ba9bd,model:_0x480c07,attributes:_0x13323c}){const _0x5e400e=this['_getExtraHttpHeaders'](),_0x168767={..._0x33f89a&&{'prompt':_0x33f89a},'content':_0xa61e67,'model':_0x480c07,..._0x5ba9bd&&{'capabilities':_0x5ba9bd},..._0x13323c&&{'attributes':_0x13323c},..._0x5e400e&&{'extraHttpHeaders':_0x5e400e}},_0xd9880f=this['_sendApiRequest']('/conversations/'+_0x2596f9+'/messages','POST',_0x168767,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x242fc9=(await _0xd9880f['request'])['body'];return this['_getStreamReader'](_0x242fc9);},'abortController':_0xd9880f['abortController']};}executeCustomAction({content:_0x15d659,message:_0x25c80c,model:_0x57605d,outputFormat:_0x6a6e91,contexts:_0x142c9a}){const _0x24b300={'content':[{'type':'text','content':_0x15d659}],..._0x25c80c&&{'prompt':_0x25c80c},'model':_0x57605d,'outputFormat':_0x6a6e91,...ps(_0x142c9a)},_0x5d047b=this['_sendApiRequest']('/actions/custom/calls','POST',_0x24b300);return{'getStream':async()=>{const _0x43895f=(await _0x5d047b['request'])['body'];return this['_getStreamReader'](_0x43895f);},'abortController':_0x5d047b['abortController']};}executeAction({actionName:_0x275347,content:_0x5c8c63,args:_0xeb1c25,contexts:_0x2775ae}){const _0xc28de8={'content':[{'type':'text','content':_0x5c8c63}],'args':_0xeb1c25,...ps(_0x2775ae)},_0x5609e4=this['_sendApiRequest']('/actions/system/'+_0x275347+'/calls','POST',_0xc28de8);return{'getStream':async()=>{const _0x4cb0da=(await _0x5609e4['request'])['body'];return this['_getStreamReader'](_0x4cb0da);},'abortController':_0x5609e4['abortController']};}['uploadFile'](_0x3e055a,_0x233a0c,_0x1454dc){const _0x151403=new FormData();_0x151403['append']('file',_0x233a0c,_0x233a0c['name']),_0x1454dc&&_0x151403['append']('attributes',JSON['stringify'](_0x1454dc));const _0x2ca5eb=this['_sendApiRequest']('/conversations/'+_0x3e055a+'/files','POST',_0x151403);return{'getId':async()=>(await _0x2ca5eb['request'])['json'](),'abortController':_0x2ca5eb['abortController']};}uploadDocuments(_0x38d68c,_0x4c1391){const _0x55a90e={'documents':_0x4c1391['map'](_0x139169=>({'content':_0x139169['content'],'attributes':{'version':_0x139169['version'],'sessionId':_0x139169['sessionId'],'channelId':_0x139169['channelId'],'rootName':_0x139169['rootName'],'selections':_0x139169['selections']},...void 0x0!==_0x139169['name']?{'name':_0x139169['name']}:{},...void 0x0!==_0x139169['description']?{'description':_0x139169['description']}:{}}))},_0x347348=this['_sendApiRequest']('/conversations/'+_0x38d68c+'/documents/batch','POST',_0x55a90e);return{'getIds':async()=>(await _0x347348['request'])['json'](),'abortController':_0x347348['abortController']};}fetchDocuments(_0x1cc8d6,_0x52ebcf){const _0x5a7c6a=new URLSearchParams();_0x5a7c6a['append']('documentIds',_0x52ebcf['join'](','));const _0x2412ff=this['_sendApiRequest']('/conversations/'+_0x1cc8d6+'/documents/batch?'+_0x5a7c6a['toString'](),'GET');return{'getDocuments':async()=>(await _0x2412ff['request'])['json'](),'abortController':_0x2412ff['abortController']};}fetchConversations(_0x50db09,_0x53f7f2={}){const _0x4c292a=new URLSearchParams();_0x4c292a['append']('group',_0x50db09),_0x4c292a['append']('excludeEmpty',!0x1!==_0x53f7f2['excludeEmpty']?'true':'false'),_0x4c292a['append']('limit',_0x53f7f2['limit']?_0x53f7f2['limit']['toString']():0x64['toString']()),_0x4c292a['append']('sortBy',_0x53f7f2['sortBy']?_0x53f7f2['sortBy']:'createdAt'),_0x4c292a['append']('order',_0x53f7f2['order']?_0x53f7f2['order']:'desc');const _0x55bcc9=this['_sendApiRequest']('/conversations?'+_0x4c292a['toString'](),'GET');return{'getConversations':async()=>(await(await _0x55bcc9['request'])['json']())['items'],'abortController':_0x55bcc9['abortController']};}deleteConversation(_0x241be0){const _0xccd1d3=this['_sendApiRequest']('/conversations/'+_0x241be0,'DELETE');return{'execute':async()=>{await _0xccd1d3['request'];},'abortController':_0xccd1d3['abortController']};}updateConversation(_0x1bbb4d,_0x1331af){const _0x36abac=this['_sendApiRequest']('/conversations/'+_0x1bbb4d,'PATCH',_0x1331af);return{'getResult':async()=>(await _0x36abac['request'],_0x1331af),'abortController':_0x36abac['abortController']};}fetchConversation(_0x48a966){const _0x1c42da=this['_sendApiRequest']('/conversations/'+_0x48a966,'GET');return{'getConversation':async()=>(await _0x1c42da['request'])['json'](),'abortController':_0x1c42da['abortController']};}fetchConversationMessages(_0x36db98){const _0x133da4=this['_sendApiRequest']('/conversations/'+_0x36db98+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x133da4['request'])['json']())['items'],'abortController':_0x133da4['abortController']};}['uploadUrl'](_0x2aa50e,_0x2dad3f,_0x3dffa9){const _0x1af3b9=this['_sendApiRequest']('/conversations/'+_0x2aa50e+'/web-resources','POST',{'url':_0x2dad3f,'attributes':_0x3dffa9});return{'getId':async()=>(await _0x1af3b9['request'])['json'](),'abortController':_0x1af3b9['abortController']};}getModels(_0x24cb50='en'){const _0xa6189c=new URLSearchParams();_0xa6189c['append']('language',_0x24cb50);const _0x5349f4='/models/1?'+_0xa6189c['toString'](),_0x107717=this['_sendApiRequest'](_0x5349f4,'GET');return{'list':async()=>await(await _0x107717['request'])['json'](),'abortController':_0x107717['abortController']};}listContexts(_0x2de156={}){const _0xa5d6b3=new URLSearchParams();_0xa5d6b3['append']('limit',_0x2de156['limit']?_0x2de156['limit']['toString']():0x64['toString']()),_0x2de156['cursor']&&_0xa5d6b3['append']('cursor',_0x2de156['cursor']),_0x2de156['order']&&_0xa5d6b3['append']('order',_0x2de156['order']);const _0xc84ac8=this['_sendApiRequest']('/contexts?'+_0xa5d6b3['toString'](),'GET');return{'getContexts':async()=>(await(await _0xc84ac8['request'])['json']())['items'],'abortController':_0xc84ac8['abortController']};}deleteFile(_0x33b09d,_0x43f438){const _0x30e115=this['_sendApiRequest']('/conversations/'+_0x33b09d+'/files/'+_0x43f438,'DELETE');return{'execute':async()=>{await _0x30e115['request'];},'abortController':_0x30e115['abortController']};}deleteDocument(_0x55d5ba,_0x47f52e){const _0x33f80e=this['_sendApiRequest']('/conversations/'+_0x55d5ba+'/documents/'+_0x47f52e,'DELETE');return{'execute':async()=>{await _0x33f80e['request'];},'abortController':_0x33f80e['abortController']};}deleteWebResource(_0x25d536,_0x10ca05){const _0x26c4e6=this['_sendApiRequest']('/conversations/'+_0x25d536+'/web-resources/'+_0x10ca05,'DELETE');return{'execute':async()=>{await _0x26c4e6['request'];},'abortController':_0x26c4e6['abortController']};}cancelStream(_0x2f0c5f,_0x3403f8){const _0x259bf2=this['_sendApiRequest']('/conversations/'+_0x2f0c5f+'/messages/'+_0x3403f8+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x259bf2['request'];},'abortController':_0x259bf2['abortController']};}resumeStream(_0x36be45,_0xe098b4,_0x198747='0-0'){const _0x27363f=new URLSearchParams({'lastEventId':_0x198747}),_0x1271e8=this['_sendApiRequest']('/conversations/'+_0x36be45+'/messages/'+_0xe098b4+'/stream?'+_0x27363f['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x39f62e=await _0x1271e8['request'];return this['_getStreamReader'](_0x39f62e['body']);},'abortController':_0x1271e8['abortController']};}callSystemReview({reviewName:_0x17a793,content:_0x46771a,args:_0x2d0271,contexts:_0x4f4cd9}){const _0x347cc2=this['_sendApiRequest']('/reviews/system/'+_0x17a793+'/calls','POST',{'content':[{'type':'text','content':_0x46771a}],'args':_0x2d0271,...ps(_0x4f4cd9)});return{'getStream':async()=>{const _0x3ac0b1=(await _0x347cc2['request'])['body'];return this['_getStreamReader'](_0x3ac0b1);},'abortController':_0x347cc2['abortController']};}processDocument({content:_0x1287e0,prompt:_0x29271a,model:_0x4935ed,capabilities:_0x37fc40,contexts:_0x255f47}){const _0x4570fb=this['_getExtraHttpHeaders'](),_0x2fd54a=this['_sendApiRequest']('/documents/process','POST',{'content':_0x1287e0,'prompt':_0x29271a,'model':_0x4935ed,..._0x37fc40&&{'capabilities':_0x37fc40},...ps(_0x255f47),..._0x4570fb&&{'extraHttpHeaders':_0x4570fb}});return{'getResult':async()=>(await _0x2fd54a['request'])['json'](),'abortController':_0x2fd54a['abortController']};}callCustomReview({content:_0x12893d,prompt:_0xdbba5c,model:_0x1d8e01,contexts:_0x2ab678}){const _0x1c1810=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x12893d}],..._0xdbba5c&&{'prompt':_0xdbba5c},'model':_0x1d8e01,...ps(_0x2ab678)});return{'getStream':async()=>{const _0x19a278=(await _0x1c1810['request'])['body'];return this['_getStreamReader'](_0x19a278);},'abortController':_0x1c1810['abortController']};}upsertAIChatRating(_0x4d9481,_0xef8581,_0x5467df){const _0x5460c2=this['_sendApiRequest']('/conversations/'+_0x4d9481+'/messages/'+_0xef8581+'/ratings','PUT',{'positiveCount':_0x5467df['positiveCount'],'totalCount':_0x5467df['totalCount'],'modificationId':_0x5467df['modificationId']});return{'execute':async()=>{await _0x5460c2['request'];},'abortController':_0x5460c2['abortController']};}upsertAIActionRating(_0x226a7d,_0x302948,_0x3abe64){const _0x589e46=this['_sendApiRequest']('/actions/system/'+_0x226a7d+'/calls/'+_0x302948+'/ratings','PUT',{'positiveCount':_0x3abe64['positiveCount'],'totalCount':_0x3abe64['totalCount']});return{'execute':async()=>{await _0x589e46['request'];},'abortController':_0x589e46['abortController']};}upsertCustomAIActionRating(_0xa876c6,_0x541bae){const _0x3b6f42=this['_sendApiRequest']('/actions/custom/calls/'+_0xa876c6+'/ratings','PUT',{'positiveCount':_0x541bae['positiveCount'],'totalCount':_0x541bae['totalCount']});return{'execute':async()=>{await _0x3b6f42['request'];},'abortController':_0x3b6f42['abortController']};}upsertAIReviewRating(_0xb27856,_0x31b7fc,_0x475f50,_0x3dce56){const _0x3a20dd=this['_sendApiRequest']('/reviews/system/'+_0xb27856+'/calls/'+_0x31b7fc+'/ratings','PUT',{'positiveCount':_0x475f50['positiveCount'],'totalCount':_0x475f50['totalCount'],'dataId':_0x3dce56});return{'execute':async()=>{await _0x3a20dd['request'];},'abortController':_0x3a20dd['abortController']};}upsertCustomAIReviewRating(_0x3809b8,_0x275fb1,_0x347db0){const _0x24d730=this['_sendApiRequest']('/reviews/custom/calls/'+_0x3809b8+'/ratings','PUT',{'positiveCount':_0x275fb1['positiveCount'],'totalCount':_0x275fb1['totalCount'],'dataId':_0x347db0});return{'execute':async()=>{await _0x24d730['request'];},'abortController':_0x24d730['abortController']};}_sendApiRequest(_0x54150c,_0x3f0661,_0x24b12e,_0x25acad={}){const {apiUrl:_0x3f30c2=this['_apiUrl']}=_0x25acad,_0xefd31c=new AbortController(),_0x1d95bd=_0x24b12e instanceof FormData,_0x295487={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':yt};_0x24b12e&&!_0x1d95bd&&(_0x295487['Content-Type']='application/json');const _0x3b8c69={'method':_0x3f0661,'headers':_0x295487,'signal':_0xefd31c['signal']};return _0x24b12e&&(_0x3b8c69['body']=_0x1d95bd?_0x24b12e:JSON['stringify'](_0x24b12e)),{'request':fetch(''+_0x3f30c2+_0x54150c,_0x3b8c69)['catch'](_0xddc4f9=>{this['_handleError'](_0xddc4f9);})['then'](_0x2f7a0c=>_0x2f7a0c['ok']?_0x2f7a0c:_0x2f7a0c['json']()['then'](_0x57bbc7=>{throw{'url':_0x3f30c2,'path':_0x54150c,'method':_0x3f0661,'body':_0x24b12e,'status':(_0x2f7a0c||{})['status'],'statusText':(_0x2f7a0c||{})['statusText'],'code':_0x57bbc7['code'],'message':_0x57bbc7['message'],'traceId':_0x57bbc7['traceId'],'data':_0x57bbc7['data']};})),'abortController':_0xefd31c};}async *_getStreamReader(_0x2473d1){const _0x2461f0=[],_0x488396=_0x2473d1['getReader'](),_0x18cf6e=_0x1314f1({'onError':_0x202308=>{this['_handleError'](_0x202308);},'onEvent':_0x4247d1=>{_0x4247d1['data']=JSON['parse'](_0x4247d1['data']),_0x2461f0['push'](_0x4247d1);}});try{let _0x2b6913=!0x1;for(;!_0x2b6913;){const {done:_0x2ca7e2,value:_0x2267a8}=await _0x488396['read']();_0x2ca7e2&&(_0x2b6913=!0x0),_0x18cf6e['feed'](this['_decoder']['decode'](_0x2267a8,{'stream':!0x0})),yield*_0x2461f0,_0x2461f0['length']=0x0;}}catch(_0x486948){this['_handleError'](_0x486948);}finally{_0x488396['releaseLock'](),_0x18cf6e['reset']();}}['_handleError'](_0x352fb5){if(_0x352fb5 instanceof ct)throw _0x352fb5;if(_0x352fb5 instanceof Error&&'AbortError'===_0x352fb5['name'])throw new ct('ai-request-aborted',this,{'originalError':_0x352fb5});throw new ct('ai-request-failed',this,{'originalError':_0x352fb5});}};function ps(_0x31a936){return _0x31a936?.['length']?{'contexts':_0x31a936['map'](As)}:{};}function Es(_0x3e70c0,_0x1f686b,_0x1b6940){const t=_0x3e70c0['t'];switch(_0x1f686b){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'},_0x1b6940);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_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP','string':'Created\x20for\x20a\x20previous\x20version\x20of\x20the\x20document\x20and\x20can\x20no\x20longer\x20be\x20applied.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP','string':'Created\x20for\x20content\x20that\x20no\x20longer\x20exists.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP','string':'Created\x20for\x20content\x20that\x20no\x20longer\x20exists.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP','string':'Created\x20for\x20a\x20previous\x20version\x20of\x20the\x20document\x20and\x20can\x20no\x20longer\x20be\x20applied.'});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.'},_0x1b6940);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.'},_0x1b6940);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_LIBRARY_LABEL':return t({'id':'AI_CHAT_CONTEXT_LIBRARY_LABEL','string':'Context\x20library'});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.'},_0x1b6940);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'},_0x1b6940);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x1b6940);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'},_0x1b6940);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.'},_0x1b6940);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.'},_0x1b6940);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.'},_0x1b6940);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.'},_0x1b6940);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'},_0x1b6940);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.'},_0x1b6940);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.'});default:return _0x1f686b;}}const ms=/* #__PURE__ -- @preserve */
|
|
25
|
-
dt();var Ts=class extends ms{_connector;['_config'];['_locale'];_modelList=[];_modelsRequest=null;constructor({connector:_0x790b0a,config:_0x295374,locale:_0x1e0cc9}){super(),this['_connector']=_0x790b0a,this['_config']=_0x295374,this['_locale']=_0x1e0cc9;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get _defaultModelId(){return this['_config']?.['defaultModelId'];}async getAllModels(){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()['catch'](_0x17ec90=>{throw this['_modelsRequest']=null,_0x17ec90;})),this['_modelsRequest'];}async getAvailableModels(){const _0x39b277=await this['getAllModels']();let _0x39e771;return _0x39e771=this['_availableModels']?this['_filterModels'](_0x39b277,this['_availableModels']):_0x39b277['filter'](_0x1f0120=>_0x1f0120['recommended']),_0x39e771;}async['resolveModel'](_0x4c7789){const _0x33700d=await this['getAllModels']();if(!_0x33700d['length'])return null;if(_0x4c7789){const _0x3627f2=this['_getModelById'](_0x33700d,_0x4c7789);if(_0x3627f2)return _0x3627f2;St('ai-chat-model-id-unrecognized',{'modelId':_0x4c7789,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async getDefault(){const _0x2fd308=await this['getAvailableModels']();if(!_0x2fd308['length'])return null;if(this['_defaultModelId']){const _0x36b070=this['_getModelById'](_0x2fd308,this['_defaultModelId']);if(_0x36b070)return _0x36b070;St('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x2fd308[0x0]['id']});}return _0x2fd308[0x0];}async['isAvailable'](_0x3eba40){return(await this['getAvailableModels']())['some'](_0x3ec966=>_0x3ec966['name']===_0x3eba40['name']&&_0x3ec966['provider']===_0x3eba40['provider']);}async getModel(_0x659ff8){const _0x93d23f=await this['getAllModels']();return this['_getModelById'](_0x93d23f,_0x659ff8)||null;}async _retrieveModels(){if(!this['_modelList']['length']){const _0x232ea9=this['_locale']['uiLanguage']||'en',_0x1124bc=await this['_connector']['getModels'](_0x232ea9)['list']();this['_modelList']=_0x1124bc['items']['map'](_0x25253d=>ws(_0x25253d)?{..._0x25253d,'name':Es(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x25253d);}return[...this['_modelList']];}_filterModels(_0x5d45c3,_0x4c630a){let _0x327493;if(_0x4c630a){_0x327493=[];const _0x3f79fc=new Set(),_0x3b1f1e='string'==typeof _0x4c630a?[_0x4c630a['toLocaleLowerCase']()]:_0x4c630a['map'](_0x1b8e96=>_0x1b8e96['toLocaleLowerCase']());for(const _0x47b547 of _0x3b1f1e)for(const _0x479e9a of _0x5d45c3)!_0x3f79fc['has'](_0x479e9a['id'])&&this['_isMatchingFilter'](_0x479e9a,_0x47b547)&&(_0x327493['push'](_0x479e9a),_0x3f79fc['add'](_0x479e9a['id']));}else _0x327493=_0x5d45c3;return _0x327493;}_isMatchingFilter(_0x3599b7,_0x5adba5){const _0x29a4c1=_0x3599b7['id']['toLocaleLowerCase'](),_0x17689f=_0x3599b7['name']['toLocaleLowerCase'](),_0x4ac97c=_0x3599b7['provider']['toLocaleLowerCase']();return _0x29a4c1===_0x5adba5||_0x17689f===_0x5adba5||ws(_0x3599b7)&&'auto'===_0x5adba5||_0x4ac97c===_0x5adba5||_0x29a4c1['startsWith'](_0x5adba5);}_getModelById(_0x22a9c5,_0xf7cf14){return _0x22a9c5['find'](_0x265949=>ws(_0x265949)&&'auto'===_0xf7cf14?_0x265949:_0x265949['id']===_0xf7cf14)||null;}};function ws(_0x36dc1b){return _0x36dc1b['id']['startsWith']('agent');}var Cs=class{_connector;_defaultContext;_contextsRequest=null;constructor({connector:_0x10cf57,defaultContext:_0x3474aa}){this['_connector']=_0x10cf57,this['_defaultContext']=_0x3474aa;}async getAllContexts(){return this['_contextsRequest']||(this['_contextsRequest']=this['_connector']['listContexts']()['getContexts']()['catch'](_0x41f7f9=>{throw this['_contextsRequest']=null,_0x41f7f9;})),[...await this['_contextsRequest']];}async getAvailableContexts(){const _0x1e34be=await this['getAllContexts'](),_0x3eb7f7=new Set((this['_defaultContext']??[])['map'](_0x244d8a=>_0x244d8a['id']));return _0x1e34be['filter'](_0x3ae0ce=>!_0x3eb7f7['has'](_0x3ae0ce['id']));}resolveContext({feature:_0x3ac522,ids:_0x47cce6=[],extraContexts:_0x4c9656=[],idScopedOnly:_0x2a26f6=!0x1,context:_0x5e93a2}){const _0x570112=this['_resolveDefaultContext'](_0x3ac522,_0x47cce6,_0x2a26f6);return _0x5e93a2['addDefaultContext']([..._0x570112,..._0x4c9656]),_0x5e93a2;}_resolveDefaultContext(_0x15ba5a,_0x637427,_0x51a5ca=!0x1){if(!this['_defaultContext'])return[];const _0x1dacbb=[];for(const _0x208f0e of this['_defaultContext'])this['_entryAppliesToFeature'](_0x208f0e['features'],_0x15ba5a,_0x637427)&&(_0x51a5ca&&this['_entryAppliesToFeature'](_0x208f0e['features'],_0x15ba5a,[])||_0x1dacbb['push'](this['_toContextRef'](_0x208f0e)));return _0x1dacbb;}_toContextRef(_0x37b93b){return'promptId'in _0x37b93b?{'id':_0x37b93b['id'],'promptId':_0x37b93b['promptId']}:'fileId'in _0x37b93b?{'id':_0x37b93b['id'],'fileId':_0x37b93b['fileId']}:{'id':_0x37b93b['id']};}_entryAppliesToFeature(_0x3eba2f,_0x26f47d,_0x2815d4){if(!_0x3eba2f)return!0x0;const _0x49428c=_0x3eba2f[_0x26f47d];return!!_0x49428c&&(!0x0===_0x49428c||_0x2815d4['some'](_0x131ea3=>_0x49428c['test'](_0x131ea3)));}},fs=class extends _0x898608{['models'];contextLibrary;static get['pluginName'](){return'AICore';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[Is];}init(){const _0x5de535=this['context']['plugins']['get'](Is);this['models']=new Ts({'connector':_0x5de535,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),this['contextLibrary']=new Cs({'connector':_0x5de535,'defaultContext':this['context']['config']['get']('ai.defaultContext')});}};function bs(_0x51d01b){return _0x51d01b?_0x51d01b instanceof _0x24cd6f?[_0x51d01b]:_0x51d01b['editors']&&0x0!==_0x51d01b['editors']['length']?Array['from'](_0x51d01b['editors']):[]:[];}function Ss(_0x425479){const _0x336836=bs(_0x425479);if(!_0x336836['length'])throw new ct('ai-get-editor-from-context-no-editor');if(0x1===_0x336836['length'])return _0x336836[0x0];const _0x59f870=_0x336836['find'](_0x590b7c=>_0x590b7c['ui']?.['focusTracker']?.['isFocused']);if(_0x59f870)return _0x59f870;const _0x3c803a=function(_0x4cbd6a){if(_0x4cbd6a instanceof _0x24cd6f)return;const _0x3da939=_0x4cbd6a;if(!_0x3da939['plugins']||!_0x3da939['plugins']['has']('AIEditing'))return;return _0x3da939['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x425479);return _0x3c803a&&_0x336836['includes'](_0x3c803a)?_0x3c803a:_0x336836[0x0];}function Rs(_0xd45bb3,_0x4bd7e4){return _0x502eab(_0xd45bb3,_0x4bd7e4);}function Os(_0x24535f,_0x19b621){return _0x35b927(_0x24535f,_0x19b621);}function vs(_0x4a2aa3,_0x2d796c,_0x1459e2){const _0xde0c63=null!==_0x2d796c?_0x171372=>_0x171372['attribs'][_0x4a2aa3]===_0x2d796c:_0x599d4a=>Boolean(_0x599d4a['attribs'][_0x4a2aa3]);return _0x228c3a(_0x5529c3=>_0x545292(_0x5529c3)&&_0xde0c63(_0x5529c3),_0x1459e2);}function ks(_0x1bd137,_0x53f075,_0x221e7c){const _0x48b2a7=null!==_0x53f075?_0x1c7815=>_0x1c7815['attribs'][_0x1bd137]===_0x53f075:_0x25ee82=>Boolean(_0x25ee82['attribs'][_0x1bd137]);return _0x4615bb(_0x2d5ad8=>_0x545292(_0x2d5ad8)&&_0x48b2a7(_0x2d5ad8),_0x221e7c);}function ys(_0x414102){return _0x4615bb(_0x1ed3d1=>_0x545292(_0x1ed3d1)&&function(_0x7851e6){const _0xb4f664=_0x7851e6['toLowerCase']();return'script'===_0xb4f664||'style'===_0xb4f664||_0xb4f664['includes']('-');}(_0x1ed3d1['name']),_0x414102);}const Ns=['comment-start','comment-end','suggestion-start','suggestion-end'];function xs(_0x12149b){return _0x545292(_0x12149b)&&Ns['includes'](_0x12149b['name']['toLowerCase']());}function Ls(_0x38a861){return _0x370e5d(_0x27b255=>_0x3e0c4f(_0x27b255),_0x38a861,!0x0,0x1/0x0);}function Ps(_0x3523b0,_0x75ef21){return _0x3523b0&&_0x545292(_0x3523b0)?_0x3523b0['attribs'][_0x75ef21]:null;}function Ds(_0x26defd,_0x5351aa,_0x337fd8){_0x545292(_0x26defd)&&(null===_0x337fd8?delete _0x26defd['attribs'][_0x5351aa]:_0x26defd['attribs'][_0x5351aa]=_0x337fd8);}function Hs(_0x4c7aae,_0x4d35a5,_0x33a99e){const _0x35232c=_0x4d35a5['cloneNode'](!0x0);'beforebegin'===_0x33a99e?ti(_0x4c7aae,_0x35232c):'afterbegin'===_0x33a99e?_0x46b9cf(_0x4c7aae,_0x35232c):'beforeend'===_0x33a99e?_0x380486(_0x4c7aae,_0x35232c):'afterend'===_0x33a99e&&_0x23e0ae(_0x4c7aae,_0x35232c);}function Ms(_0xe63906){const _0x5f2a7c=[];let _0x24ba1e=_0xe63906;for(;_0x24ba1e;)_0x24ba1e=_0x12306c(_0x24ba1e),_0x24ba1e&&_0x5f2a7c['push'](_0x24ba1e);return _0x5f2a7c;}function Us(_0x64d6b5){return _0x64d6b5['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function Vs(_0x454db2){let _0x1fb746=0x0;for(;_0x454db2['parentNode'];)_0x454db2=_0x454db2['parentNode'],_0x1fb746++;return _0x1fb746;}function Bs(_0x520595){const _0x5543b8=[];let _0x4ee482=_0x520595['nextSibling'];for(;_0x4ee482;)_0x5543b8['push'](_0x4ee482),_0x4ee482=_0x4ee482['nextSibling'];_0x5543b8['forEach'](_0x2de34a=>{_0x47cc1f(_0x2de34a);});}function Gs(_0xa381b0,_0x4cd01){return!!_0xa381b0['model']['document']['getRoot'](_0x4cd01)&&!_0x1bd984(_0xa381b0,_0x4cd01);}function Fs(_0x147efd,_0x505389){return'<p\x20data-id=\x22'+_0x505389+'\x22>'+_0x147efd+'</p>';}function Ks(_0xe66854){return'p'===_0xe66854['name']['toLowerCase']()&&Boolean(_0xe66854['attribs']['data-id']);}function Ws(_0x1f1fb9){const _0x21ddc5=Rs(_0x1f1fb9)['children']['filter'](_0x545292);return 0x1===_0x21ddc5['length']&&Ks(_0x21ddc5[0x0])?_0x21ddc5[0x0]['children']['map'](_0x15500f=>Os(_0x15500f))['join'](''):_0x1f1fb9;}function Ys(_0x4659c8,_0x23d9de){const _0x462e14=function(_0x212f6d){const _0x5292d4=_0x212f6d['children']['filter'](_0x545292);return 0x1===_0x5292d4['length']&&Ks(_0x5292d4[0x0])?_0x5292d4[0x0]['children']:_0x212f6d['children'];}(_0x23d9de),{blockElements:_0x588b2c}=_0x4659c8['editing']['view']['domConverter'],_0x3c4b03=_0x25b08d=>_0x25b08d['some'](_0x43db6e=>_0x545292(_0x43db6e)&&('p'!==_0x43db6e['name']['toLowerCase']()&&_0x588b2c['includes'](_0x43db6e['name']['toLowerCase']())||_0x3c4b03(_0x43db6e['children'])));if(_0x3c4b03(_0x462e14))return!0x1;const _0x42dc66=_0x462e14['map'](_0x3b4bac=>Os(_0x3b4bac))['join'](''),_0x1b2727=_0x4659c8['data']['parse'](_0x42dc66,'$root'),{schema:_0xa0b907}=_0x4659c8['model'];let _0x2f9de7=0x0;for(const {item:_0x53e5cf}of _0x4659c8['model']['createRangeIn'](_0x1b2727))if(_0x53e5cf['is']('element')&&_0xa0b907['isBlock'](_0x53e5cf)&&(++_0x2f9de7>0x1||'paragraph'!==_0x53e5cf['name']))return!0x1;return!0x0;}function $s(_0xaf34dd,_0x2d8a39){const _0x2151a2=_0x2d8a39['filter'](_0x30bd6f=>'new'!=_0x30bd6f['type'])['map'](_0x13b3c1=>vs('data-id',_0x13b3c1['id'],_0xaf34dd))['filter'](_0x1d97ab=>null!==_0x1d97ab),_0x1101a3=_0x2d8a39['filter'](_0xf589de=>'removed'!=_0xf589de['type'])['map'](_0x5dc01c=>_0x5dc01c['node']['cloneNode'](!0x0));let _0x2f7a3d=null;if(_0x2151a2['length']){_0x2f7a3d=_0x2151a2[0x0]['previousSibling'];for(let _0x5a9559=0x0;_0x5a9559<_0x2151a2['length'];_0x5a9559++)_0x47cc1f(_0x2151a2[_0x5a9559]);}if(_0x1101a3['length']){_0x2f7a3d||(_0x2d8a39[0x0]['anchorId']?_0x2f7a3d=vs('data-id',_0x2d8a39[0x0]['anchorId'],_0xaf34dd):(_0x2f7a3d=_0x1101a3['shift'](),_0x46b9cf(_0xaf34dd,_0x2f7a3d)));for(let _0x5a129e=0x0;_0x5a129e<_0x1101a3['length'];_0x5a129e++)_0x23e0ae(_0x2f7a3d,_0x1101a3[_0x5a129e]),_0x2f7a3d=_0x1101a3[_0x5a129e];}}function qs(_0x4f57e1,_0x340ff3){const _0x3f6e3d=new Set();for(const _0x59f4c6 of _0x4f57e1){if(!_0x59f4c6['editor']||'destroyed'===_0x59f4c6['editor']['state']||!Gs(_0x59f4c6['editor'],_0x59f4c6['rootName']))continue;const _0x136e1f=_0x340ff3['get'](_0x59f4c6['documentId']);let _0x2956a0;_0x136e1f?(_0x2956a0=_0x136e1f['cloneNode'](!0x0),$s(_0x2956a0,_0x59f4c6['changes'])):_0x2956a0=new _0x139fbf(_0x59f4c6['changes']['filter'](_0x46bd7a=>'removed'!=_0x46bd7a['type'])['map'](_0x2a3dda=>_0x2a3dda['node']['cloneNode'](!0x0))),Ys(_0x59f4c6['editor'],_0x2956a0)||_0x3f6e3d['add'](_0x59f4c6['index']);}return _0x3f6e3d;}function Qs(_0x8ed199,_0x6828eb,_0x2ec0f7,_0x2edf8c){return Gs(_0x8ed199,_0x6828eb)?Ys(_0x8ed199,Rs(_0x2edf8c))?{'before':Ws(_0x2ec0f7),'after':Ws(_0x2edf8c)}:null:{'before':_0x2ec0f7,'after':_0x2edf8c};}function Xs(_0x2aacfe,_0x5b36d1){return _0x101a20(_0x2aacfe,_0x5b36d1);}function zs(_0x4a8c33,_0x3dc2b1){return _0x4a8c33['map'](_0x41c24e=>null!==_0x41c24e&&'object'==typeof _0x41c24e?Xs(_0x41c24e,_0x3dc2b1):_0x41c24e);}const js=[['BlockQuoteEditing','blockQuote'],['BoldEditing','bold'],['BookmarkEditing','bookmark'],['CodeEditing','code'],['HorizontalLineEditing','horizontalLine'],['HtmlEmbedEditing','htmlEmbed'],['ItalicEditing','italic'],['MathType','math'],['PageBreakEditing','pageBreak'],['Paragraph','paragraph'],['StandardEditingModeEditing','restrictedEditing'],['StrikethroughEditing','strikethrough'],['SubscriptEditing','subscript'],['SuperscriptEditing','superscript'],['TableOfContentsEditing','tableOfContents'],['Title','title'],['TodoListEditing','todoList'],['UnderlineEditing','underline']],Js='ai-selection',Zs=['br'];var tn=class extends _0x898608{constructor(_0x49d679){super(_0x49d679),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}_outputDataProcessor;_fakeSelections=[];_sessionIdByEditor=new WeakMap();_editorsToConfigs=new WeakMap();_lastContentFocusedEditor;static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}getLastContentFocusedEditor(){return this['_lastContentFocusedEditor'];}getSessionId(_0x20b8a2){let _0x1e726d=this['_sessionIdByEditor']['get'](_0x20b8a2);return _0x1e726d||(_0x1e726d=_0x20b8a2['plugins']['has']('RealTimeCollaborationClient')&&_0x20b8a2['plugins']['get']('RealTimeCollaborationClient')['sessionId']||kt(),this['_sessionIdByEditor']['set'](_0x20b8a2,_0x1e726d)),_0x1e726d;}async getDocumentData(_0x32b485){const _0x45fe2e=bs(this['context']),_0x460477=[],_0x408173=new Set();for(const _0x1c44ca of _0x45fe2e){if(_0x32b485&&!_0x32b485['has'](_0x1c44ca['config']['get']('collaboration.channelId')))continue;const _0x2bb2e7=_0x1c44ca['config']['get']('roots')||{},_0x1e30e3=this['_getEditorSelectionSignature'](_0x1c44ca),_0x1c6b01=_0x1c44ca['config']['get']('collaboration.channelId'),_0x24bec6=this['getSessionId'](_0x1c44ca);for(const _0xb62c0a of _0x1c44ca['model']['document']['getRoots']()){if('$graveyard'===_0xb62c0a['rootName'])continue;const _0x1fd09d=await this['_getDocumentDataForEditorRoot'](_0x1c44ca,_0xb62c0a,_0x408173),_0xdfaebb=_0x2bb2e7[_0xb62c0a['rootName']],_0x52ff99=_0xb62c0a['getAttribute']('$description')??_0xdfaebb?.['description'];let _0x4e9d9e=_0xb62c0a['getAttribute']('$title')??_0xdfaebb?.['title'];_0x4e9d9e||(_0x4e9d9e=_0xb62c0a['getAttribute']('$rootEditableOptions')?.['label']??_0xdfaebb?.['label']),_0x4e9d9e||(St('ai-document-root-missing-title',{'editor':_0x1c44ca,'rootName':_0xb62c0a['rootName']}),_0x4e9d9e=_0xb62c0a['rootName']),_0x460477['push']({'editor':_0x1c44ca,'rootName':_0xb62c0a['rootName'],'content':_0x1fd09d['content'],'version':_0x1fd09d['version'],'sessionId':_0x24bec6,'channelId':_0x1c6b01,'selections':_0x1fd09d['selections'],'selectionSignature':_0x1e30e3,'editorConfig':this['_getEditorConfig'](_0x1c44ca),'name':_0x4e9d9e,'description':_0x52ff99});}}return _0x460477;}getEditorsVersions(){const _0x22b5a1=bs(this['context']),_0x4a3dbb=new Map();for(const _0x569504 of _0x22b5a1){const _0x214bbd=_0x569504['config']['get']('collaboration.channelId');_0x4a3dbb['set'](_0x214bbd,_0x569504['model']['document']['version']);}return _0x4a3dbb;}getEditorsSelections(){const _0x315898=bs(this['context']),_0x5cd052=new Map();for(const _0x44104c of _0x315898){const _0x5e226c=_0x44104c['config']['get']('collaboration.channelId'),_0x38542a=this['_getEditorSelectionSignature'](_0x44104c);_0x5cd052['set'](_0x5e226c,_0x38542a);}return _0x5cd052;}_getEditorSelectionSignature(_0x2f9442){return this['_getMarkersInDocumentOrder'](_0x2f9442)['map'](_0x2931ad=>{const _0x2d524a=_0x2931ad['getRange']();return _0x2d524a['root']['rootName']+':'+_0x2d524a['start']['path']['join']('.')+'-'+_0x2d524a['end']['path']['join']('.');})['join']('|');}async _getDocumentDataForEditorRoot(_0x19874c,_0x3cb8b4,_0x576f5e){const _0x35417b=_0x19874c['data']['toView'](_0x3cb8b4,{'convertAiChatSelectionMarker':!0x0}),_0x4ba6c3=new _0x4ccf87(_0x19874c['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x35417b,_0x4ba6c3,_0x576f5e);let _0x453bf4=await this['_getDocumentDataStringFromView'](_0x35417b,_0x19874c);Gs(_0x19874c,_0x3cb8b4['rootName'])&&(_0x453bf4=Fs(_0x453bf4,this['_nextDataId'](_0x576f5e)));const _0x26a620=this['_getMarkersInDocumentOrder'](_0x19874c,_0x3cb8b4),_0x2e4419=[];for(const _0x17d272 of _0x26a620){const _0x5a61ca='<'+_0x17d272['name']+':start></'+_0x17d272['name']+':start>',_0x1a4c38=_0x453bf4['indexOf'](_0x5a61ca);_0x453bf4=_0x453bf4['substring'](0x0,_0x1a4c38)+_0x453bf4['substring'](_0x1a4c38+_0x5a61ca['length']);const _0x3333d4='<'+_0x17d272['name']+':end></'+_0x17d272['name']+':end>',_0x30250c=_0x453bf4['indexOf'](_0x3333d4);_0x453bf4=_0x453bf4['substring'](0x0,_0x30250c)+_0x453bf4['substring'](_0x30250c+_0x3333d4['length']),_0x2e4419['push']({'markerName':_0x17d272['name'],'start':_0x1a4c38,'end':_0x30250c,'htmlFragment':_0x453bf4['substring'](_0x1a4c38,_0x30250c)});}return{'content':_0x453bf4,'version':_0x19874c['model']['document']['version'],'selections':_0x2e4419};}afterInit(){this['context']instanceof _0x24cd6f?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x1bb1f5,_0x3bf181)=>{_0x3bf181['on']('ready',()=>{this['_integrateEditor'](_0x3bf181);});});}_setOutputDataProcessor(_0x24866e){this['_outputDataProcessor']=_0x24866e;}async _getDocumentDataStringFromView(_0x2ab877,_0x3fb2f0){let _0x50fbf3;if(this['_outputDataProcessor']){const _0x3c9f7d=_0x3fb2f0['data']['processor']['domConverter']['viewToDom'](_0x2ab877),_0x569e18=await this['_outputDataProcessor'](_0x3c9f7d);_0x50fbf3=_0x3fb2f0['data']['processor']['htmlWriter']['getHtml'](_0x569e18);}else _0x50fbf3=_0x3fb2f0['data']['processor']['toData'](_0x2ab877);return _0x50fbf3;}_integrateEditor(_0x3d0bea){if(!_0x3d0bea['config']['get']('collaboration.channelId'))throw new ct('ai-missing-channel-id',_0x3d0bea);_0x3d0bea['ui']['focusTracker']['on']('change:isFocused',(_0x88ba49,_0x527a8f,_0x28ef2b)=>{_0x28ef2b&&(this['_lastContentFocusedEditor']=_0x3d0bea);}),_0x3d0bea['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x3d0bea&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x3d0bea['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Js,'view':({markerName:_0x2f104e})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x2f104e['split'](':')[0x1]],'priority':0xc})}),_0x3d0bea['conversion']['for']('dataDowncast')['markerToElement']({'model':Js+':context','view':(_0xeaf1b1,{writer:_0x252369,options:_0x13edee})=>_0x13edee['convertAiChatSelectionMarker']?_0x252369['createUIElement'](_0xeaf1b1['markerName']+':'+(_0xeaf1b1['isOpening']?'start':'end')):null});}showFakeVisualSelection(_0x40e75f){const _0x4a3172=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x40e75f);const _0x3cef77=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x4a3172,_0x3cef77);}hideFakeVisualSelection(_0x5483d6){const _0x365397=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x5483d6);const _0x157e4e=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x365397,_0x157e4e);}async modelToDataWithIds(_0x285e59,_0x12ea16,_0x15b78d){const _0x472227=_0x12ea16['data']['toView'](_0x285e59),_0xad9227=new _0x4ccf87(_0x12ea16['editing']['view']['document']),_0x215d50=new Set();this['_setDataIdsOnChildren'](_0x472227,_0xad9227,_0x215d50);const _0x25a492=await this['_getDocumentDataStringFromView'](_0x472227,_0x12ea16);return _0x15b78d&&Gs(_0x12ea16,_0x15b78d)?Fs(_0x25a492,this['_nextDataId'](_0x215d50)):_0x25a492;}_setDataIdsOnChildren(_0x5ae896,_0x1254eb,_0x55c215=new Set()){let _0x3c9a6b=!0x1;for(const _0x14a296 of _0x5ae896['getChildren']()){if(!_0x14a296['is']('view:element')||Zs['includes'](_0x14a296['name']))continue;const _0x50e2cc=_0x14a296['is']('view:containerElement'),_0x2f4320=_0x14a296['is']('view:emptyElement'),_0x2cf9be=_0x14a296['is']('view:rawElement'),_0x3811ba=this['_setDataIdsOnChildren'](_0x14a296,_0x1254eb,_0x55c215);_0x14a296['hasAttribute']('data-id')?(_0x3c9a6b=!0x0,_0x55c215['add'](_0x14a296['getAttribute']('data-id'))):(_0x50e2cc||_0x2f4320||_0x2cf9be||_0x3811ba)&&(_0x1254eb['setAttribute']('data-id',this['_nextDataId'](_0x55c215),_0x14a296),_0x3c9a6b=!0x0);}return _0x3c9a6b;}_nextDataId(_0x118339){let _0xd79087;do{_0xd79087='';for(let _0x2777c8=0x0;_0x2777c8<0x4;_0x2777c8++)_0xd79087+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x118339['has'](_0xd79087));return _0x118339['add'](_0xd79087),_0xd79087;}getSelectionText(_0x5086f2){const _0x5250b0=(_0x5086f2?_0x5086f2['model']:Ss(this['context'])['model'])['document']['selection'],_0xe9d008=[],_0x3fa6e5=Array['from'](_0x5250b0['getRanges']());_0x3fa6e5['sort']((_0x137f6b,_0x527fcc)=>_0x137f6b['start']['isBefore'](_0x527fcc['start'])?-0x1:0x1);for(const _0x5ddf56 of _0x3fa6e5)for(const _0xe04abd of _0x5ddf56['getItems']())_0xe04abd['is']('$textProxy')?_0xe9d008['push'](_0xe04abd['data']):_0xe04abd['is']('element')&&_0xe9d008['length']>0x0&&'\x20'!==_0xe9d008[_0xe9d008['length']-0x1]&&_0xe9d008['push']('\x20');return _0xe9d008['length']?'\x22'+_0xe9d008['join']('')['trim']()+'\x22':Es(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}_removeFakeSelectionById(_0x4186b6){for(let _0x15c34c=0x0;_0x15c34c<this['_fakeSelections']['length'];_0x15c34c++)if(this['_fakeSelections'][_0x15c34c]['id']==_0x4186b6)return void this['_fakeSelections']['splice'](_0x15c34c,0x1);}_addFakeSelection(_0x4c5cbf){this['_removeFakeSelectionById'](_0x4c5cbf['id']),Ct(this['_fakeSelections'],_0x4c5cbf);}_refreshFakeSelection(_0xde735f,_0x1dac2a){if(_0xde735f==_0x1dac2a)return;const _0x222ed2=_0xde735f?_0xde735f['editor']:null,_0x5ddad0=_0x1dac2a?_0x1dac2a['editor']:null,_0x7fa280=(_0x167f5c,_0xaffbed)=>{const _0x2088c0=_0xaffbed['model']['markers']['getMarkersGroup'](Js);for(const _0x3ab600 of _0x2088c0)_0x167f5c['removeMarker'](_0x3ab600);},_0x55a792=(_0x5830ca,_0x384d2d,_0xba4974)=>{const _0x264590=_0x384d2d['model'];for(let _0x449f93=0x0;_0x449f93<_0xba4974['ranges']['length'];_0x449f93++){let _0x534f70=_0xba4974['ranges'][_0x449f93];const _0x552b71=Js+':'+_0xba4974['id']+':'+_0x449f93;if(_0x534f70['start']['isAtEnd']){const _0x19dc3d=_0x534f70['start']['getLastMatchingPosition'](({item:_0x2b9a53})=>!_0x264590['schema']['isContent'](_0x2b9a53),{'boundaries':_0x534f70});_0x534f70=_0x5830ca['createRange'](_0x19dc3d,_0x534f70['end']);}_0x5830ca['addMarker'](_0x552b71,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x534f70});}};_0x222ed2&&_0x5ddad0&&_0x222ed2===_0x5ddad0&&_0x1dac2a?_0x222ed2['model']['change'](_0x219ccb=>{_0x7fa280(_0x219ccb,_0x222ed2),_0x55a792(_0x219ccb,_0x5ddad0,_0x1dac2a);}):(_0x222ed2&&_0x222ed2['model']['change'](_0x564b0f=>_0x7fa280(_0x564b0f,_0x222ed2)),_0x5ddad0&&_0x1dac2a&&_0x5ddad0['model']['change'](_0x508375=>_0x55a792(_0x508375,_0x5ddad0,_0x1dac2a)));}_getMarkersInDocumentOrder(_0x503257,_0x362bcd){const _0x458dfa=Array['from'](_0x503257['model']['markers']['getMarkersGroup'](Js+':context'));return(_0x362bcd?_0x458dfa['filter'](_0x2c0d37=>{const _0xf7e1d1=_0x2c0d37['getRange']();return _0xf7e1d1&&_0xf7e1d1['root']['rootName']===_0x362bcd['rootName'];}):_0x458dfa)['sort']((_0x5bfc42,_0x170f04)=>_0x5bfc42['getStart']()['isBefore'](_0x170f04['getStart']())?-0x1:_0x5bfc42['getStart']()['isAfter'](_0x170f04['getStart']())?0x1:0x0);}_getEditorConfig(_0x1d9a5d){let _0x15fe37=this['_editorsToConfigs']['get'](_0x1d9a5d);return _0x15fe37||(_0x15fe37=function(_0x48296d){const _0x5117cd={};if(_0x48296d['plugins']['has']('AlignmentEditing')&&(_0x5117cd['alignment']=_0x48296d['config']['get']('alignment')),_0x48296d['plugins']['has']('CodeBlockEditing')&&(_0x5117cd['codeBlock']=_0x48296d['config']['get']('codeBlock')),_0x48296d['plugins']['has']('FontBackgroundColorEditing')&&(_0x5117cd['fontBackgroundColor']=Xs(_0x48296d['config']['get']('fontBackgroundColor'),['documentColors','columns','colorPicker'])),_0x48296d['plugins']['has']('FontColorEditing')&&(_0x5117cd['fontColor']=Xs(_0x48296d['config']['get']('fontColor'),['documentColors','columns','colorPicker'])),_0x48296d['plugins']['has']('FontFamilyEditing')&&(_0x5117cd['fontFamily']=_0x48296d['config']['get']('fontFamily'),_0x5117cd['fontFamily']&&_0x5117cd['fontFamily']['options']&&(_0x5117cd['fontFamily']['options']=zs(_0x5117cd['fontFamily']['options'],['model','upcastAlso']))),_0x48296d['plugins']['has']('FontSizeEditing')&&(_0x5117cd['fontSize']=_0x48296d['config']['get']('fontSize'),_0x5117cd['fontSize']&&_0x5117cd['fontSize']['options']&&(_0x5117cd['fontSize']['options']=zs(_0x5117cd['fontSize']['options'],['upcastAlso']))),_0x48296d['plugins']['has']('FootnotesEditing')){const _0x398146=_0x48296d['config']['get']('footnotes')??{};_0x398146['footnotesProperties']&&'object'==typeof _0x398146['footnotesProperties']&&(_0x398146['footnotesProperties']=Xs(_0x398146['footnotesProperties'],['toolbar','listStyles'])),_0x5117cd['footnotes']=_0x398146;}if(_0x48296d['plugins']['has']('HeadingEditing')&&(_0x5117cd['heading']=_0x48296d['config']['get']('heading'),_0x5117cd['heading']&&_0x5117cd['heading']['options']&&(_0x5117cd['heading']['options']=zs(_0x5117cd['heading']['options'],['model','icon','class','converterPriority','upcastAlso']))),_0x48296d['plugins']['has']('HighlightEditing')&&(_0x5117cd['highlight']=_0x48296d['config']['get']('highlight'),_0x5117cd['highlight']&&_0x5117cd['highlight']['options']&&(_0x5117cd['highlight']['options']=zs(_0x5117cd['highlight']['options'],['model','color']))),_0x48296d['plugins']['has']('ImageBlockEditing')||_0x48296d['plugins']['has']('ImageInlineEditing')){const _0x360437=Xs(_0x48296d['config']['get']('image'),['toolbar','upload','insert','resizeOptions']);_0x48296d['plugins']['has']('ImageResizeEditing')||delete _0x360437['resizeUnit'],_0x48296d['plugins']['has']('ImageStyleEditing')?_0x360437['styles']?.['options']&&(_0x360437['styles']['options']=zs(_0x360437['styles']['options'],['icon'])):delete _0x360437['styles'],_0x5117cd['image']=_0x360437;}if(_0x48296d['plugins']['has']('IndentBlock')&&(_0x5117cd['indentBlock']=_0x48296d['config']['get']('indentBlock')),_0x48296d['plugins']['has']('LineHeightEditing')&&(_0x5117cd['lineHeight']=_0x48296d['config']['get']('lineHeight'),_0x5117cd['lineHeight']&&(delete _0x5117cd['lineHeight']['supportAllValues'],_0x5117cd['lineHeight']['options']&&(_0x5117cd['lineHeight']['options']=zs(_0x5117cd['lineHeight']['options'],['model'])))),_0x48296d['plugins']['has']('LinkEditing')&&(_0x5117cd['link']=Xs(_0x48296d['config']['get']('link'),['toolbar'])),_0x48296d['plugins']['has']('ListEditing')){const _0x2fbbdb=_0x48296d['config']['get']('list')??{};delete _0x2fbbdb['enableListItemMarkerFormatting'],_0x48296d['plugins']['has']('ListPropertiesEditing')?_0x2fbbdb['properties']&&_0x2fbbdb['properties']['styles']&&'object'==typeof _0x2fbbdb['properties']['styles']&&(_0x2fbbdb['properties']['styles']=Xs(_0x2fbbdb['properties']['styles'],['listStyleTypes'])):delete _0x2fbbdb['properties'],_0x5117cd['list']=_0x2fbbdb;}if(_0x48296d['plugins']['has']('MediaEmbedEditing')&&(_0x5117cd['mediaEmbed']=_0x48296d['config']['get']('mediaEmbed'),_0x5117cd['mediaEmbed']&&(delete _0x5117cd['mediaEmbed']['toolbar'],_0x48296d['plugins']['has']('MediaEmbedResizeEditing')?_0x5117cd['mediaEmbed']['resizeOptions']&&(_0x5117cd['mediaEmbed']['resizeOptions']=_0x5117cd['mediaEmbed']['resizeOptions']['map'](_0x6b6c9=>Xs(_0x6b6c9,['icon','label']))):delete _0x5117cd['mediaEmbed']['resizeOptions'],_0x48296d['plugins']['has']('MediaEmbedStyleEditing')?_0x5117cd['mediaEmbed']['styles']&&_0x5117cd['mediaEmbed']['styles']['options']&&(_0x5117cd['mediaEmbed']['styles']['options']=zs(_0x5117cd['mediaEmbed']['styles']['options'],['icon','title'])):delete _0x5117cd['mediaEmbed']['styles'])),_0x48296d['plugins']['has']('MultiLevelListEditing')&&(_0x5117cd['listMultiLevel']=_0x48296d['config']['get']('listMultiLevel')??{}),_0x48296d['plugins']['has']('MentionEditing')){const _0x40de9a=Xs(_0x48296d['config']['get']('mention'),['commitKeys','dropdownLimit']);_0x40de9a['feeds']&&(_0x40de9a['feeds']=_0x40de9a['feeds']['map'](_0x58d13e=>Xs(_0x58d13e,['minimumCharacters','itemRenderer','dropdownLimit']))),_0x5117cd['mention']=_0x40de9a;}if(_0x48296d['plugins']['has']('MergeFieldsEditing')){const _0x5b67d6=Xs(_0x48296d['config']['get']('mergeFields'),['previewModes','initialPreviewMode','previewHtmlValues','sanitizeHtml']);Array['isArray'](_0x5b67d6['definitions'])&&(_0x5b67d6['definitions']=_0x5b67d6['definitions']['map'](_0x4ccc1a=>'groupId'in _0x4ccc1a?(Array['isArray'](_0x4ccc1a['definitions'])&&(_0x4ccc1a['definitions']=_0x4ccc1a['definitions']['map'](_0x43c693=>Xs(_0x43c693,['defaultValue']))),_0x4ccc1a):Xs(_0x4ccc1a,['defaultValue']))),_0x5117cd['mergeFields']=_0x5b67d6;}if(_0x48296d['plugins']['has']('StyleEditing')&&(_0x5117cd['style']=_0x48296d['config']['get']('style')),_0x48296d['plugins']['has']('TableEditing')){const _0x871754=Xs(_0x48296d['config']['get']('table'),['contentToolbar','tableToolbar','showHiddenBorders']);_0x48296d['plugins']['has']('TablePropertiesEditing')?_0x871754['tableProperties']&&'object'==typeof _0x871754['tableProperties']&&(_0x871754['tableProperties']=Xs(_0x871754['tableProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x871754['tableProperties'],_0x48296d['plugins']['has']('TableCellPropertiesEditing')?_0x871754['tableCellProperties']&&'object'==typeof _0x871754['tableCellProperties']&&(_0x871754['tableCellProperties']=Xs(_0x871754['tableCellProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x871754['tableCellProperties'],_0x48296d['plugins']['has']('TableLayoutEditing')?_0x871754['tableLayout']||(_0x871754['tableLayout']={}):delete _0x871754['tableLayout'],_0x48296d['plugins']['has']('TableCaptionEditing')?_0x871754['tableCaption']||(_0x871754['tableCaption']={}):delete _0x871754['tableCaption'],_0x5117cd['table']=_0x871754;}_0x48296d['plugins']['has']('TextPartLanguageEditing')&&(_0x5117cd['textPartLanguage']=_0x48296d['config']['get']('language.textPartLanguage'));for(const [_0x4650ea,_0x182c08]of js)_0x48296d['plugins']['has'](_0x4650ea)&&(_0x5117cd[_0x182c08]={});return _0x5117cd;}(_0x1d9a5d),this['_editorsToConfigs']['set'](_0x1d9a5d,_0x15fe37)),_0x15fe37;}};const en=/* #__PURE__ -- @preserve */
|
|
26
|
-
At();var sn=class extends en{_generateUid;_uidCounter=0x0;_touchedNodesState={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};_existingDataIds=new Set();_referencedExistingIds=new Set();constructor(_0x181696){super(),this['_generateUid']=_0x181696||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x5197c7,_0x1d349b,_0x28381f){this['_uidCounter']=0x0;const _0x4653ec=_0x5197c7['cloneNode'](!0x0);on(_0x1d349b,_0x4653ec);const _0x21588d=_0x4653ec['childNodes'],_0x5bd5ad=Array['from'](_0x21588d)['filter'](_0x7d1a7f=>!(0x3===_0x7d1a7f['nodeType']&&''===Os(_0x7d1a7f)['trim']())),_0x3a0fc8=_0x5bd5ad['length'];this['_existingDataIds']=new Set(ks('data-id',null,_0x1d349b)['map'](_0x1be790=>Ps(_0x1be790,'data-id'))['filter'](_0x5e8e7f=>!!_0x5e8e7f));for(const _0x2168ea of _0x5bd5ad)_0x2168ea&&_0x545292(_0x2168ea)&&void 0x0===_0x2168ea['attribs']['data-id']&&Ds(_0x2168ea,'data-id','new-element');if(ks('data-id',null,_0x4653ec)['forEach'](_0x1f5b62=>{const _0x149abb=Ps(_0x1f5b62,'data-id');'new-element'===_0x149abb||this['_existingDataIds']['has'](_0x149abb)||Ds(_0x1f5b62,'data-id','new-element');}),0x0===_0x1d349b['childNodes']['length']){const _0x4df206=[];return ks('data-id','new-element',_0x4653ec)['forEach'](_0x2570bb=>{const _0x5173fc=this['_generateUid']();Ds(_0x2570bb,'data-id',_0x5173fc),_0x4df206['push'](_0x5173fc);}),this['_removeSpecialComments'](_0x4653ec),{'parsedContent':_0x4653ec,'newNodeIds':_0x4df206,'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 _0x2664c8=-0x1,_0x196e11=!0x1;for(let _0x3dae0a=0x0;_0x3dae0a<_0x3a0fc8;_0x3dae0a++){const _0x2e820d=_0x5bd5ad[_0x3dae0a],_0x1ec398=_0x5bd5ad[_0x3dae0a+0x1];if(this['_isNewNode'](_0x2e820d)){if(-0x1===_0x2664c8&&(_0x2664c8=_0x3dae0a),this['_markWrappedElements'](_0x2e820d),!this['_isNewNode'](_0x1ec398)){const [_0x3aaf0d,_0xe3a23e]=this['_findReferenceNode'](_0x2e820d,_0x196e11,_0x1d349b);if(_0x3aaf0d){const _0x1ea02b=Array['from'](_0x5bd5ad)['slice'](_0x2664c8,_0x3dae0a+0x1);this['_insertNodes'](_0x3aaf0d,_0x1ea02b,_0xe3a23e),_0x2664c8=-0x1;}}}else{if(this['_isExistingContentComment'](_0x2e820d))_0x196e11=!0x0;else{if(this['_isExistingNode'](_0x2e820d)){const _0x4a4cf9=Ps(_0x2e820d,'data-id');if(_0x4a4cf9&&this['_existingDataIds']['has'](_0x4a4cf9)){this['_referencedExistingIds']['add'](_0x4a4cf9);const _0x5907fb=vs('data-id',_0x4a4cf9,_0x1d349b);this['_replaceNode'](_0x5907fb,_0x2e820d);}}else{if(nn(_0x2e820d)){const _0x512371=rn(_0x2e820d);vs('data-id',_0x512371,_0x4653ec)||this['_touchedNodesState']['removedIds']['push'](_0x512371);}}}}}for(const _0x31bd2b of this['_touchedNodesState']['removedIds']){const _0x53f32e=vs('data-id',_0x31bd2b,_0x1d349b);_0x53f32e&&(this['_rescueUnwrappedElements'](_0x53f32e),this['_removeNode'](_0x53f32e,_0x31bd2b,_0x28381f));}if(ks('data-id','new-element',_0x1d349b)['forEach'](_0x56e382=>{const _0x4ce31d=this['_getUid'](_0x56e382);Ds(_0x56e382,'data-id',_0x4ce31d),this['_touchedNodesState']['newIds']['push'](_0x4ce31d);}),this['_removeSpecialComments'](_0x1d349b),_0x28381f&&_0x28381f['cutAfterUnstable']){const _0x278dcf=this['_findLastConfirmationPoint'](_0x5bd5ad),_0x1b920a=this['_getLastStableElement'](_0x1d349b,_0x278dcf);this['_markUnstableElements'](_0x1d349b,_0x1b920a);}if(this['_processWrappedElements'](_0x1d349b,_0x28381f),_0x28381f&&_0x28381f['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x5b162f=ks('data-id',this['_touchedNodesState']['lastTouchedId'],_0x1d349b);let _0x290c73=_0x5b162f[_0x5b162f['length']-0x1];for(;_0x290c73;)Bs(_0x290c73),_0x290c73=_0x290c73['parentNode'];}return{'parsedContent':_0x1d349b,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}_insertNodes(_0x53eae1,_0x2fa6de,_0x211aaa){for(const _0x23f702 of _0x2fa6de){const _0x4b0315=this['_getUid'](_0x23f702);Ds(_0x23f702,'data-id',_0x4b0315),this['_touchedNodesState']['newIds']['push'](_0x4b0315),this['_touchedNodesState']['lastTouchedId']=_0x4b0315;}const _0x3207f9='afterbegin'===_0x211aaa||'afterend'===_0x211aaa?_0x2fa6de['reverse']():_0x2fa6de;for(const _0x295e07 of _0x3207f9)Hs(_0x53eae1,_0x295e07,_0x211aaa);}['_replaceNode'](_0x5cd68a,_0x1c0138){if(!_0x5cd68a)return;if(_0x20c40=_0x1c0138,Us(Os(_0x5cd68a))===Us(Os(_0x20c40)))return;var _0x20c40;const _0x19923c=Ps(_0x5cd68a,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x19923c),this['_touchedNodesState']['lastTouchedId']=_0x19923c,_0x452856(_0x5cd68a,_0x1c0138['cloneNode'](!0x0));}['_removeNode'](_0x21cba9,_0x1cce13,_0xf56178){if(_0xf56178&&_0xf56178['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x1cce13;const _0xcf3ca1=_0xf56178['replaceRemovedWith']['cloneNode'](!0x0);Ds(_0xcf3ca1,'data-id',_0x1cce13),Ds(_0xcf3ca1,'data-removed','true'),_0x452856(_0x21cba9,_0xcf3ca1);}else _0x47cc1f(_0x21cba9);}['_findReferenceNode'](_0x11ca29,_0x1b0a1a,_0x26ac20){const _0x34d201=this['_findPrevElementWithDataId'](_0x11ca29,!0x1);if(_0x34d201){const _0x843686=rn(_0x34d201),_0x31decb=vs('data-id',_0x843686,_0x26ac20);if(_0x31decb)return[_0x31decb,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x843686);}const _0x4c0315=this['_findNextElementWithDataId'](_0x11ca29,!0x1);if(_0x4c0315){const _0x1a2115=rn(_0x4c0315),_0x52c0dc=vs('data-id',_0x1a2115,_0x26ac20);if(_0x52c0dc)return[_0x52c0dc,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x1a2115);}return _0x1b0a1a?_0x11ca29['nextSibling']?this['_findFallbackReferenceNode'](_0x11ca29,_0x26ac20):[_0x26ac20['childNodes'][_0x26ac20['childNodes']['length']-0x1],'afterend']:[_0x26ac20['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x5dcf59,_0x1e8caf){const _0x1545b0=[],_0x56ccfe=this['_findPrevElementWithDataId'](_0x5dcf59,!0x0);if(_0x56ccfe){const _0x2425ea=vs('data-id',rn(_0x56ccfe),_0x1e8caf);_0x2425ea&&_0x1545b0['push']([_0x2425ea,'afterend']);}const _0x3386ba=this['_findNextElementWithDataId'](_0x5dcf59,!0x0);if(_0x3386ba){const _0x8f639e=vs('data-id',rn(_0x3386ba),_0x1e8caf);_0x8f639e&&_0x1545b0['push']([_0x8f639e,'beforebegin']);}return _0x1545b0['length']>0x1?Vs(_0x1545b0[0x0][0x0])<=Vs(_0x1545b0[0x1][0x0])?_0x1545b0[0x0]:_0x1545b0[0x1]:0x1===_0x1545b0['length']?_0x1545b0[0x0]:[_0x1e8caf['lastChild'],'afterend'];}_findNextElementWithDataId(_0x28bcfe,_0x54206a){let _0x29067d=_0x28bcfe['nextSibling'],_0x22dffb=null,_0x57133b=!0x1;for(;_0x29067d;){if(_0x3e0c4f(_0x29067d)){if(nn(_0x29067d)&&(_0x22dffb=_0x29067d),this['_isExistingContentComment'](_0x29067d)&&_0x54206a&&!_0x57133b){_0x57133b=!0x0,_0x29067d=_0x29067d['nextSibling'];continue;}break;}const _0x5123ac=Ps(_0x29067d,'data-id');if(_0x5123ac&&'new-element'!==_0x5123ac&&this['_existingDataIds']['has'](_0x5123ac)){_0x22dffb=_0x29067d;break;}_0x29067d=_0x29067d['nextSibling'];}return _0x22dffb;}_findPrevElementWithDataId(_0x304bed,_0x2315c3){let _0x3f8c74=_0x304bed['previousSibling'],_0x53a679=null,_0x3bdf50=!0x1;for(;_0x3f8c74;){if(_0x3e0c4f(_0x3f8c74)){if(nn(_0x3f8c74)&&(_0x53a679=_0x3f8c74),this['_isExistingContentComment'](_0x3f8c74)&&_0x2315c3&&!_0x3bdf50){_0x3bdf50=!0x0,_0x3f8c74=_0x3f8c74['previousSibling'];continue;}break;}const _0x128976=Ps(_0x3f8c74,'data-id');if(_0x128976&&'new-element'!==_0x128976&&this['_existingDataIds']['has'](_0x128976)){_0x53a679=_0x3f8c74;break;}_0x3f8c74=_0x3f8c74['previousSibling'];}return _0x53a679;}_markWrappedElements(_0x26e4a9){_0x545292(_0x26e4a9)&&ks('data-id',null,_0x26e4a9)['forEach'](_0x3a6fdc=>{this['_isExistingNode'](_0x3a6fdc)&&(Ds(_0x3a6fdc,'data-wrapped-id',Ps(_0x3a6fdc,'data-id')),Ds(_0x3a6fdc,'data-id',null));});}_processWrappedElements(_0x25aae6,_0x116edb){ks('data-wrapped-id',null,_0x25aae6)['forEach'](_0x1dbb3a=>{const _0x2b749d=Ps(_0x1dbb3a,'data-wrapped-id');if(this['_hasUnstableParent'](_0x1dbb3a))return;const _0x21a8d7=vs('data-id',_0x2b749d,_0x25aae6);Ds(_0x1dbb3a,'data-id',_0x2b749d),_0x21a8d7&&(this['_removeNode'](_0x21a8d7,_0x2b749d,_0x116edb),this['_touchedNodesState']['removedIds']['push'](_0x2b749d),this['_touchedNodesState']['lastTouchedId']=_0x2b749d);});}_hasUnstableParent(_0x43a23f){let _0x5df5fe=_0x43a23f['parentNode'];for(;_0x5df5fe;){if(Ps(_0x5df5fe,'data-unstable'))return!0x0;_0x5df5fe=_0x5df5fe['parentNode'];}return!0x1;}_rescueUnwrappedElements(_0x54bd5a){const _0x2c23dc=new Set(this['_touchedNodesState']['removedIds']),_0x531263=new Set(this['_touchedNodesState']['newIds']);ks('data-id',null,_0x54bd5a)['forEach'](_0x460465=>{const _0x2d7697=Ps(_0x460465,'data-id'),_0x59fbe4=!!_0x2d7697&&this['_referencedExistingIds']['has'](_0x2d7697),_0x490d1d=!!_0x2d7697&&_0x531263['has'](_0x2d7697);if(!_0x2d7697||!_0x59fbe4&&!_0x490d1d)return;if(_0x2c23dc['has'](_0x2d7697))return;let _0xb0718d=_0x460465['parentNode'],_0x210b73=!0x1;for(;_0xb0718d;){if(_0xb0718d===_0x54bd5a){_0x210b73=!0x0;break;}const _0x3e0d40=Ps(_0xb0718d,'data-id');if(_0x3e0d40&&(this['_referencedExistingIds']['has'](_0x3e0d40)||_0x531263['has'](_0x3e0d40)))return;_0xb0718d=_0xb0718d['parentNode'];}if(_0x210b73){if(ti(_0x54bd5a,_0x460465),_0x59fbe4){const _0x23b9bb=this['_generateUid'](),_0x5c17fb=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x2d7697);-0x1!==_0x5c17fb&&this['_touchedNodesState']['modifiedIds']['splice'](_0x5c17fb,0x1),Ds(_0x460465,'data-unwrapped-id',_0x2d7697),Ds(_0x460465,'data-id',_0x23b9bb),this['_touchedNodesState']['newIds']['push'](_0x23b9bb),this['_touchedNodesState']['rescuedNewIds']['add'](_0x23b9bb),this['_touchedNodesState']['lastTouchedId']=_0x23b9bb;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x2d7697),this['_touchedNodesState']['lastTouchedId']=_0x2d7697;}});}_getUid(_0x5e7c44){return this['_isExistingNode'](_0x5e7c44)?Ps(_0x5e7c44,'data-id'):this['_generateUid']();}_removeSpecialComments(_0x550478){Ls(_0x550478)['filter'](_0x539592=>nn(_0x539592)||this['_isExistingContentComment'](_0x539592))['forEach'](_0x4b8fba=>{_0x47cc1f(_0x4b8fba);});}_findLastConfirmationPoint(_0x409f86){let _0x319acc=null,_0x3e5b61=null,_0x3cb578=null,_0x36e281=null;const _0x4ce549=_0x30fd6b=>{_0x30fd6b&&(_0x319acc=_0x30fd6b),_0x3cb578=null,_0x36e281=null;};for(let _0x3fcec4=0x0;_0x3fcec4<_0x409f86['length'];_0x3fcec4++){const _0x352c72=_0x409f86[_0x3fcec4];if(this['_isExistingContentComment'](_0x352c72)){_0x4ce549(_0x3e5b61);continue;}if(_0x545292(_0x352c72)){const _0x20a181=Ps(_0x352c72,'data-id'),_0x3c8ef8=_0x3fcec4===_0x409f86['length']-0x1;if(_0x20a181&&'new-element'!==_0x20a181&&this['_touchedNodesState']['modifiedIds']['includes'](_0x20a181)&&!_0x3c8ef8){_0x4ce549(_0x20a181),_0x3e5b61=_0x20a181;continue;}}let _0x159984;const _0x285021=rn(_0x352c72);if(_0x285021&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x285021))_0x3e5b61=_0x285021;else{if(_0x285021&&this['_touchedNodesState']['newIds']['includes'](_0x285021))_0x159984='N';else{if(!nn(_0x352c72))continue;_0x159984='R';}_0x159984===_0x36e281||null===_0x36e281?_0x36e281=_0x159984:null!==_0x3cb578?(_0x4ce549(_0x3e5b61),_0x36e281=_0x159984):(_0x3cb578=_0x36e281,_0x36e281=_0x159984),_0x3e5b61=_0x285021;}}const _0x24cf15=_0x409f86[_0x409f86['length']-0x1];return _0x24cf15&&!_0x545292(_0x24cf15)&&!nn(_0x24cf15)&&_0x3e5b61&&_0x4ce549(_0x3e5b61),_0x319acc;}_getLastStableElement(_0x3c11ea,_0x1b5158){if(!_0x1b5158)return null;const _0x588cc7=vs('data-id',_0x1b5158,_0x3c11ea);if(!_0x588cc7)return null;const _0x2aed6e=[_0x588cc7,...Ms(_0x588cc7)]['at'](-0x2);if(_0x2aed6e===_0x588cc7)return _0x588cc7;let _0x21dc70=_0x2aed6e['previousSibling'];for(;_0x21dc70&&!_0x545292(_0x21dc70);)_0x21dc70=_0x21dc70['previousSibling'];return _0x21dc70;}_markUnstableElements(_0x3977bd,_0x2f89fb){const _0x9b3b7c=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x5c8273=_0x2f89fb?_0x2f89fb['nextSibling']:_0x3977bd['firstChild'];for(;_0x5c8273;)_0x545292(_0x5c8273)&&(_0x9b3b7c['has'](Ps(_0x5c8273,'data-id'))||ks('data-id',null,_0x5c8273)['some'](_0x23c45f=>_0x9b3b7c['has'](Ps(_0x23c45f,'data-id'))))&&Ds(_0x5c8273,'data-unstable','true'),_0x5c8273=_0x5c8273['nextSibling'];}['_isNewNode'](_0x33e3dc){return Boolean('new-element'===Ps(_0x33e3dc,'data-id'));}_isExistingNode(_0x2d8f91){return Boolean((Ps(_0x2d8f91,'data-id')||'')['length']>0x0&&'new-element'!==Ps(_0x2d8f91,'data-id'));}_isExistingContentComment(_0x22603a){return Boolean(_0x3e0c4f(_0x22603a)&&Os(_0x22603a)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function nn(_0x1223cc){return!!_0x1223cc&&Boolean(_0x3e0c4f(_0x1223cc)&&Os(_0x1223cc)['match'](/removed[\s*-]data-id="[^"]+"/));}function rn(_0x46893b){if(!_0x46893b)return null;if(_0x545292(_0x46893b))return Ps(_0x46893b,'data-id')??null;if(_0x3e0c4f(_0x46893b)){const _0x3472d9=Os(_0x46893b)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x3472d9&&_0x3472d9[0x1])return _0x3472d9[0x1];}return null;}function on(_0x32db79,_0x415ba2){const _0x12641f=new Map();for(const _0x4d4b51 of ys(_0x32db79))xs(_0x4d4b51)||_0x12641f['set'](Ps(_0x4d4b51,'data-id'),_0x4d4b51);const _0x363438=new Set();for(const _0x1c62c7 of ys(_0x415ba2)){if(xs(_0x1c62c7))continue;const _0x241e3e=Ps(_0x1c62c7,'data-id'),_0x5c00b6=_0x241e3e?_0x12641f['get'](_0x241e3e):void 0x0;_0x5c00b6?(_0x452856(_0x1c62c7,_0x2a3383(_0x5c00b6,!0x0)),_0x363438['add'](_0x241e3e)):_0x47cc1f(_0x1c62c7);}for(const _0x35e3d1 of Ls(_0x415ba2))nn(_0x35e3d1)&&_0x12641f['has'](rn(_0x35e3d1))&&_0x47cc1f(_0x35e3d1);const _0x2fc96e=new Set(ks('data-id',null,_0x415ba2)['map'](_0x4b0375=>Ps(_0x4b0375,'data-id')));for(const [_0x491266,_0x44e37c]of _0x12641f){if(_0x363438['has'](_0x491266))continue;let _0x5c8b73=_0x44e37c['parent'],_0x262046=null;for(;_0x5c8b73&&_0x545292(_0x5c8b73);){const _0x392b78=Ps(_0x5c8b73,'data-id');if(_0x392b78&&_0x2fc96e['has'](_0x392b78)){_0x262046=_0x392b78;break;}_0x5c8b73=_0x5c8b73['parent'];}if(!_0x262046)continue;const _0x10a1aa=vs('data-id',_0x262046,_0x415ba2);_0x10a1aa&&_0x380486(_0x10a1aa,_0x2a3383(_0x44e37c,!0x0));}}const an=/* #__PURE__ -- @preserve */
|
|
27
|
-
At();var hn=class extends an{_m2html;constructor(){super();const _0x1bd40d=Object['entries'](_0x29e337),_0x2fe280=_0x1bd40d['findIndex'](([_0x330500])=>'rehypeDomRaw'===_0x330500);if(-0x1===_0x2fe280)throw new ct('ai-response-parser-unable-to-set-up-parser');_0x1bd40d['splice'](_0x2fe280+0x1,0x0,['rehypeSanitize',_0x23be32]),this['_m2html']=new _0x20ae64({'plugins':Object['fromEntries'](_0x1bd40d)});}convertMarkdownToHTML(_0x21991e){const _0xdeeef6=this['_m2html']['parse'](_0x21991e);return this['parseAndNormalizeHTML'](_0xdeeef6);}['parseAndNormalizeHTML'](_0x25c425){return this['_parseHTML'](_0x25c425);}['_parseHTML'](_0x2b5fb2){const _0x558ba3=Rs('<dummy>'+_0x2b5fb2['replace'](/<[^>]*?$/g,'')+'</dummy>');return cn(_0x558ba3),_0x558ba3['children']=_0x558ba3['children'][0x0]['children'],_0x558ba3;}};function cn(_0x3ca56a){for(const _0x42a28f of _0x3ca56a['children'])_0x545292(_0x42a28f)?'pre'!==_0x42a28f['name']&&cn(_0x42a28f):_0x5273d9(_0x42a28f)&&(_0x42a28f['data']=_0x42a28f['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function ln({changeGroups:_0x3cc61c,documentContextContent:_0x436a70,showDiff:_0x479bdf,trimUnchanged:_0x43ac77=!0x0}){const _0x22f279=qs(_0x3cc61c,_0x436a70);return _0x3cc61c['map'](_0x3787c0=>{if(!_0x3787c0['editor']||'destroyed'===_0x3787c0['editor']['state'])return null;const _0x5c70a1=Gs(_0x3787c0['editor'],_0x3787c0['rootName']),_0x5bdd53=new _0x139fbf([]),_0x5380f7=new _0x139fbf([]),_0x551a54=new Set();for(const _0x355050 of _0x3787c0['changes'])'new'==_0x355050['type']&&ks('data-id',null,_0x355050['node'])['forEach'](_0x29d8d9=>{_0x551a54['add'](Ps(_0x29d8d9,'data-id'));});for(const _0x502c68 of _0x3787c0['changes'])if('removed'!=_0x502c68['type']?_0x5380f7['children']['push'](_0x502c68['node']['cloneNode'](!0x0)):_0x479bdf||_0x551a54['has'](_0x502c68['id'])||_0x5380f7['children']['push'](_0x502c68['node']['cloneNode'](!0x0)),'new'!=_0x502c68['type']&&(_0x479bdf||'removed'!=_0x502c68['type'])){const _0x3a7bb1=_0x228c3a(_0x28c7a5=>Ps(_0x28c7a5,'data-id')==_0x502c68['id'],_0x436a70['get'](_0x3787c0['documentId']),!0x0);_0x3a7bb1&&_0x5bdd53['children']['push'](_0x3a7bb1['cloneNode'](!0x0));}if(_0x5c70a1&&_0x22f279['has'](_0x3787c0['index']))return{'type':_0x3787c0['changes'][0x0]['type'],'index':_0x3787c0['index'],'state':_0x3787c0['state'],'outdatedReason':_0x3787c0['outdatedReason'],'content':new _0x139fbf([]),'hasChanges':!0x1};let _0x2da23c,_0xc4f37,_0x5722e3;try{({content:_0x2da23c,hasChanges:_0xc4f37}=un(_0x3787c0['editor'],_0x5bdd53,_0x5380f7,_0x479bdf,_0x43ac77));}catch{return{'type':_0x3787c0['changes'][0x0]['type'],'index':_0x3787c0['index'],'state':_0x3787c0['state'],'outdatedReason':_0x3787c0['outdatedReason'],'content':new _0x139fbf([]),'hasChanges':!0x1};}if(_0x5c70a1){_0x5722e3=_0x3787c0['editor']['ui']['getEditableElement'](_0x3787c0['rootName'])?.['tagName']['toLowerCase']();const _0x533cdb=_0x2da23c['children']['filter'](_0x545292);0x1===_0x533cdb['length']&&(_0x2da23c=new _0x139fbf(_0x533cdb[0x0]['children']));}return{'type':_0x3787c0['changes'][0x0]['type'],'index':_0x3787c0['index'],'state':_0x3787c0['state'],'outdatedReason':_0x3787c0['outdatedReason'],'content':_0x2da23c,'hasChanges':_0xc4f37,'wrapperTag':_0x5722e3};})['filter'](_0x4e761a=>null!==_0x4e761a);}function un(_0x4a0c26,_0x514b6e,_0x497c40,_0x47de6d,_0x562f38=!0x0){const _0x3b450a=_0x4a0c26['plugins']['get']('DocumentCompare'),_0x1a4b69=Os(_0x514b6e),_0x54e3d4=Os(_0x497c40),_0x21be71=_0x4a0c26['data']['parse'](_0x1a4b69,'$root'),_0xe43f5e=_0x4a0c26['model']['createPositionAt'](_0x21be71,0x0),_0x3fdc25=_0x3b450a['getDiff'](_0x1a4b69,_0x54e3d4,{'anchor':_0xe43f5e,'markDeletions':_0x47de6d,'targetEditor':_0x4a0c26})['getOperations']();if(0x0==_0x3fdc25['length'])return{'content':_0x514b6e['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x47de6d?function(_0x252798,_0x1992de,_0x282c7b){if(0x0==_0x252798['length'])return;const _0x5e568b=_0x282c7b['plugins']['get']('DocumentCompare'),_0x17e025=_0x282c7b['plugins']['get']('SuggestionsConversion');_0x282c7b['model']['change'](_0x370611=>{const _0x103c9c=new Set();for(let _0xa1f884=0x0;_0xa1f884<_0x252798['length'];_0xa1f884++){const _0x260c38=_0x252798[_0xa1f884];if(_0x260c38['baseVersion']=null,_0x260c38['isDocumentOperation']=!0x1,!_0x9fd625(_0x260c38)){if(_0x5e568b['isMarkedRemoveOperation'](_0x260c38)){const _0x1897ad=_0x49575d(_0x260c38['newRange'],_0x282c7b['model']),_0x528c63='suggestion:deletion:'+kt()+':$aiSuggestion';_0x1992de['markers']['set'](_0x528c63,_0x1897ad);}else switch(_0x260c38['type']){case'rename':{if(_0x260c38['oldName']==_0x260c38['newName'])break;_0x370611['batch']['addOperation'](_0x260c38),_0x282c7b['model']['applyOperation'](_0x260c38);const _0xaa4a08='$elementName',_0x1de101=_0x260c38['position'],_0x2303b6=_0x282c7b['model']['createRange'](_0x1de101,_0x282c7b['model']['createPositionAt'](_0x1de101['nodeAfter'],'end')),_0x1b5264='suggestion:attribute:'+_0xaa4a08+':'+kt()+':$aiSuggestion';_0x1992de['markers']['set'](_0x1b5264,_0x2303b6);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x260c38['oldValue']==_0x260c38['newValue'])break;_0x370611['batch']['addOperation'](_0x260c38),_0x282c7b['model']['applyOperation'](_0x260c38);const _0x236ab0=_0x260c38['key'];if(!_0x17e025['isRegisteredAttribute'](_0x236ab0))break;const _0x49c81b=_0x49575d(_0x260c38['range'],_0x282c7b['model']),_0x4299a1='suggestion:attribute:'+_0x236ab0+':'+kt()+':$aiSuggestion';_0x1992de['markers']['set'](_0x4299a1,_0x49c81b);break;}case'insert':{if(_0x370611['batch']['addOperation'](_0x260c38),_0x282c7b['model']['applyOperation'](_0x260c38),dn(_0x1992de,_0x260c38),_0x252798[_0xa1f884+0x1]&&'move'==_0x252798[_0xa1f884+0x1]['type'])break;const _0x15727f=_0x260c38['position'],_0x440302=_0x260c38['howMany'],_0xdd7dc8=_0x49575d(_0x282c7b['model']['createRange'](_0x15727f,_0x15727f['getShiftedBy'](_0x440302)),_0x282c7b['model']),_0x3c0dce='suggestion:insertion:'+kt()+':$aiSuggestion';_0x1992de['markers']['set'](_0x3c0dce,_0xdd7dc8);break;}case'split':{_0x370611['batch']['addOperation'](_0x260c38),_0x282c7b['model']['applyOperation'](_0x260c38),dn(_0x1992de,_0x260c38);const _0x5e76b2=_0x260c38['splitPosition'],_0x228101=_0x260c38['moveTargetPosition'],_0x29eb28=_0x282c7b['model']['createRange'](_0x5e76b2,_0x228101),_0x458aec='suggestion:insertion:'+kt()+':$aiSuggestion';_0x1992de['markers']['set'](_0x458aec,_0x29eb28);break;}case'move':{_0x370611['batch']['addOperation'](_0x260c38),_0x282c7b['model']['applyOperation'](_0x260c38),dn(_0x1992de,_0x260c38);const _0x53f1c1=_0x260c38['getMovedRangeStart'](),_0x2b28f6=_0x260c38['howMany'];for(let _0x45b025=0x0;_0x45b025<_0x2b28f6;_0x45b025++){const _0x2122a6=_0x53f1c1['getShiftedBy'](_0x45b025)['nodeAfter'];_0x103c9c['add'](_0x2122a6);}break;}case'remove':{const _0x7d0a7d=_0x260c38['sourcePosition'],_0x1218c0=_0x260c38['howMany'],_0x381ebc=new _0x4f656c(_0x7d0a7d,_0x1218c0);_0x370611['batch']['addOperation'](_0x381ebc),_0x282c7b['model']['applyOperation'](_0x381ebc),dn(_0x1992de,_0x260c38);break;}}}}for(const _0x4cac2d of _0x103c9c){const _0x47f5a2=_0x282c7b['model']['createRangeOn'](_0x4cac2d),_0x4aa8f7='suggestion:formatBlock:$fakeWrap:'+kt()+':$aiSuggestion';_0x1992de['markers']['set'](_0x4aa8f7,_0x49575d(_0x47f5a2,_0x282c7b['model']));}});}(_0x3fdc25,_0x21be71,_0x4a0c26):_0x4a0c26['model']['change'](_0x2f060b=>{for(const _0x43157a of _0x3fdc25)if(!_0x9fd625(_0x43157a)){if('remove'==_0x43157a['type']){const _0x72bf9d=_0x43157a['sourcePosition'],_0x8e3aed=_0x43157a['howMany'],_0x4f721a=new _0x4f656c(_0x72bf9d,_0x8e3aed);_0x2f060b['batch']['addOperation'](_0x4f721a),_0x4a0c26['model']['applyOperation'](_0x4f721a),dn(_0x21be71,_0x43157a);}else{if('marker'==_0x43157a['type']){const _0x20a6bd=_0x43157a['name'],_0x3c1711=_0x43157a['newRange'];null!==_0x3c1711?_0x21be71['markers']['set'](_0x20a6bd,_0x3c1711):_0x21be71['markers']['delete'](_0x20a6bd);}else _0x43157a['baseVersion']=null,_0x43157a['isDocumentOperation']=!0x1,_0x2f060b['batch']['addOperation'](_0x43157a),_0x4a0c26['model']['applyOperation'](_0x43157a),dn(_0x21be71,_0x43157a);}}}),_0x562f38){const _0x37dd75=_n(_0x4a0c26,_0x3fdc25,_0x21be71);An(_0x4a0c26['model'],_0x37dd75),function(_0x131cb2,_0x4c024b){const _0xbb2e6b=_0x4c024b['getFirstRange']()['start'];let _0x4a8a66=_0x4c024b['getFirstRange']()['end'];const _0x17f909=_0xbb2e6b['root'];(_0x4a8a66['textNode']||_0x4a8a66['nodeAfter']&&_0x4a8a66['nodeAfter']['is']('$text'))&&(_0x3ab39d(_0x4a8a66,'...'),En(_0x17f909,_0x4a8a66,0x3),_0x4a8a66=_0x4a8a66['getShiftedBy'](0x3)),(_0xbb2e6b['textNode']||_0xbb2e6b['nodeBefore']&&_0xbb2e6b['nodeBefore']['is']('$text'))&&(_0x3ab39d(_0xbb2e6b,'...'),En(_0x17f909,_0xbb2e6b,0x3),_0xbb2e6b['parent']==_0x4a8a66['parent']&&(_0x4a8a66=_0x4a8a66['getShiftedBy'](0x3)));const _0x3894a5=_0x131cb2['createRange'](_0x131cb2['createPositionAt'](_0x17f909,0x0),_0xbb2e6b),_0x216ec0=_0x131cb2['createRange'](_0x4a8a66,_0x131cb2['createPositionAt'](_0x17f909,'end')),_0x447dec=[..._0x3894a5['getMinimalFlatRanges'](),..._0x216ec0['getMinimalFlatRanges']()];_0x447dec['reverse']();for(const _0x4e0e3a of _0x447dec)_0x168f4f(_0x4e0e3a),pn(_0x17f909,_0x4e0e3a);}(_0x4a0c26['model'],_0x37dd75);}return{'content':Rs(_0x4a0c26['data']['stringify'](_0x21be71,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function dn(_0x35d6e1,_0x461d78){for(const [_0x18c66c,_0x5c4d97]of _0x35d6e1['markers']){const _0x4c864a=_0x2827cc['_createFromRanges'](_0x5c4d97['getTransformedByOperation'](_0x461d78));_0x4c864a['root']==_0x35d6e1?_0x35d6e1['markers']['set'](_0x18c66c,_0x4c864a):_0x35d6e1['markers']['delete'](_0x18c66c);}}function _n(_0x12e206,_0xabc462,_0x4a97b5){const _0x744aa1=_0x12e206['plugins']['get']('DocumentCompare');let _0x10d31d=_0x12e206['model']['createPositionAt'](_0x4a97b5,Number['POSITIVE_INFINITY']),_0x45a39c=_0x12e206['model']['createPositionAt'](_0x4a97b5,0x0);for(const _0x5ef5d3 of _0xabc462){let _0x4f92e3,_0x2e5bb5;if(_0x744aa1['isMarkedRemoveOperation'](_0x5ef5d3))_0x4f92e3=_0x5ef5d3['newRange']['start'],_0x2e5bb5=_0x5ef5d3['newRange']['end'];else switch(_0x10d31d=gn(_0x10d31d,_0x5ef5d3),_0x45a39c=gn(_0x45a39c,_0x5ef5d3),_0x5ef5d3['type']){case'rename':_0x4f92e3=_0x5ef5d3['position'],_0x2e5bb5=_0x4f92e3['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x4f92e3=_0x5ef5d3['range']['start'],_0x2e5bb5=_0x5ef5d3['range']['end'];break;case'insert':_0x4f92e3=_0x5ef5d3['position'],_0x2e5bb5=_0x4f92e3['getShiftedBy'](_0x5ef5d3['howMany']);break;case'split':_0x4f92e3=_0x5ef5d3['splitPosition'],_0x2e5bb5=_0x5ef5d3['moveTargetPosition'];break;case'merge':{const _0x5f3c3d=_0x5ef5d3['targetPosition']['path']['slice'](0x0,-0x1);_0x4f92e3=_0x12e206['model']['createPositionFromPath'](_0x4a97b5,_0x5f3c3d),_0x2e5bb5=_0x4f92e3['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x2bb9aa=_0x5ef5d3['howMany'],_0x5aebce=_0x5ef5d3['sourcePosition']['_getTransformedByInsertion'](_0x5ef5d3['targetPosition'],_0x2bb9aa),_0x6edf14=_0x5ef5d3['getMovedRangeStart']();'remove'==_0x5ef5d3['type']?(_0x4f92e3=_0x5aebce,_0x2e5bb5=_0x5aebce):(_0x4f92e3=_0x6edf14,_0x2e5bb5=_0x6edf14['getShiftedBy'](_0x2bb9aa));break;}}_0x4f92e3&&_0x4f92e3['isBefore'](_0x10d31d)&&(_0x10d31d=_0x4f92e3['clone'](),_0x10d31d['stickiness']='toNone'),_0x2e5bb5&&_0x2e5bb5['isAfter'](_0x45a39c)&&(_0x45a39c=_0x2e5bb5['clone'](),_0x45a39c['stickiness']='toNone');}return _0x12e206['model']['createSelection'](_0x12e206['model']['createRange'](_0x10d31d,_0x45a39c));}function gn(_0x1342af,_0x34441c){return'move'!=_0x34441c['type']&&'remove'!=_0x34441c['type']||_0x34441c['sourceRange']['containsPosition'](_0x1342af)&&((_0x1342af=_0x34441c['sourcePosition']['clone']())['stickiness']='toNone'),_0x1342af['getTransformedByOperation'](_0x34441c);}function An(_0x2f9f1d,_0x558987){In(_0x2f9f1d,_0x558987,'forward');const _0x2f9ba6=_0x558987['getFirstRange']();_0x558987['setTo']([]),_0x558987['setTo'](_0x2f9ba6,{'backward':!0x0}),In(_0x2f9f1d,_0x558987,'backward');}function In(_0x47e1e7,_0x5dd06d,_0x3f98d7){let _0x3d8aaf=0x14;for(;_0x3d8aaf;){_0x47e1e7['modifySelection'](_0x5dd06d,{'unit':'word','direction':_0x3f98d7}),_0x3d8aaf--;const _0x322d12=_0x5dd06d['focus']['forward'==_0x3f98d7?'nodeBefore':'nodeAfter'];if(_0x322d12&&_0x322d12['is']('element')&&_0x47e1e7['schema']['isBlock'](_0x322d12)&&_0x47e1e7['schema']['isObject'](_0x322d12))break;}}function pn(_0x15b2a4,_0x413d2d){for(const [_0x3437fb,_0x473383]of _0x15b2a4['markers']){const _0x16f908=_0x473383['_getTransformedByDeletion'](_0x413d2d['start'],_0x413d2d['end']['offset']-_0x413d2d['start']['offset']);null!=_0x16f908?_0x15b2a4['markers']['set'](_0x3437fb,_0x16f908):_0x15b2a4['markers']['delete'](_0x3437fb);}}function En(_0x3a93cc,_0x2d4310,_0x1d53c9){for(let [_0x2202cf,_0x106ca9]of _0x3a93cc['markers'])_0x106ca9=_0x106ca9['_getTransformedByInsertion'](_0x2d4310,_0x1d53c9,!0x1)[0x0],_0x3a93cc['markers']['set'](_0x2202cf,_0x106ca9);}function mn(_0x2abdc1,_0x3bedec){for(const _0x43a735 of _0x2abdc1)'noop'!==_0x43a735['type']&&(_0x43a735['_aiSource']=_0x3bedec);}var Tn=class extends _0x898608{static get['pluginName'](){return'AIGateway';}static get requires(){return[_0x45dea0,fs];}get['models'](){return this['context']['plugins']['get'](fs)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['apply'](_0x17acba,_0x55976c){const {applyMethod:_0x1adbf9,roots:_0x15a931}=_0x55976c,_0x1dd475='suggest'===_0x1adbf9;if(_0x17acba['error']||!_0x17acba['results']['length'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0x17acba['status']});if(_0x15a931){if(0x0===_0x15a931['length'])throw new ct('ai-gateway-apply-empty-roots',this);for(const {channelId:_0x1427bf,rootName:_0xea00e1}of _0x15a931)if(!_0x17acba['results']['some'](_0x39dd95=>_0x39dd95['channelId']===_0x1427bf&&_0x39dd95['rootName']===_0xea00e1))throw new ct('ai-gateway-apply-root-not-found',this,{'channelId':_0x1427bf,'rootName':_0xea00e1});}const _0x47cd46=_0x17acba['results']['reduce']((_0x100f58,_0x3c03e5)=>{if(_0x15a931&&!_0x15a931['some'](_0x488668=>_0x488668['channelId']===_0x3c03e5['channelId']&&_0x488668['rootName']===_0x3c03e5['rootName']))return _0x100f58;if('completed'!==_0x3c03e5['status'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0x3c03e5['status'],'channelId':_0x3c03e5['channelId'],'rootName':_0x3c03e5['rootName']});if(_0x1dd475&&!_0x3c03e5['editor']['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',this,{'channelId':_0x3c03e5['channelId'],'rootName':_0x3c03e5['rootName']});let _0x5bd1df=_0x100f58['get'](_0x3c03e5['editor']);return _0x5bd1df||(_0x5bd1df=[],_0x100f58['set'](_0x3c03e5['editor'],_0x5bd1df)),_0x5bd1df['push'](_0x3c03e5),_0x100f58;},new Map()),_0x5144a1=this['context']['plugins']['get'](_0x45dea0);for(const [_0x6e903c,_0x928b9e]of _0x47cd46){const _0x36b8e6=_0x928b9e['map'](_0x1d92f6=>{const _0x4d791d=_0x6e903c['model']['createPositionAt'](_0x6e903c['model']['document']['getRoot'](_0x1d92f6['rootName']),0x0),_0x274a12=Qs(_0x6e903c,_0x1d92f6['rootName'],_0x1d92f6['contentRawOld'],_0x1d92f6['contentRawNew']);if(!_0x274a12)return _0x1d92f6['droppedUnsupportedInlineChange']=!0x0,null;const _0x2c64e2=_0x5144a1['getDiff'](_0x274a12['before'],_0x274a12['after'],{'anchor':_0x4d791d,'markDeletions':_0x1dd475,'targetEditor':_0x6e903c}),_0x2b7e24=_0x6e903c['model']['document']['history']['getOperations'](_0x1d92f6['documentVersion']),_0x2ad030={'document':_0x6e903c['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x1b0202=_0x5dec67(_0x2c64e2['getOperations'](),_0x2b7e24,_0x2ad030)['operationsA'];return mn(_0x1b0202,_0x55976c['aiSource']??'api'),_0x1b0202;});_0x6e903c['model']['change'](_0x2cb144=>{for(const _0x505ab5 of _0x36b8e6)_0x505ab5&&(_0x1dd475?_0x6e903c['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x505ab5):_0x5144a1['applyOperations'](_0x2cb144,_0x505ab5));});}}mergeChangesIntoContent(_0x117148,_0x49ed10,_0x11c3b1){const _0x214f75=new hn(),_0x43956e=new sn();let _0x1f0296=_0x214f75['parseAndNormalizeHTML'](_0x49ed10);for(const _0x4174df of _0x117148)try{const _0x5e2a91=_0x214f75['parseAndNormalizeHTML'](_0x4174df['content']);_0x1f0296=_0x43956e['merge'](_0x5e2a91,_0x1f0296,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x3b5ed1){throw new ct('ai-gateway-merge-failed',this,{..._0x4174df},_0x3b5ed1);}return un(_0x11c3b1,_0x214f75['parseAndNormalizeHTML'](_0x49ed10),_0x1f0296,!0x1,!0x1)['content'];}};const wn=/* #__PURE__ -- @preserve */
|
|
28
|
-
dt(),Cn=['capabilitiesUpdated'];var fn=class extends wn{['_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(
|
|
29
|
-
At();var Vn=class extends Un{['id'];interactionId;type;content=new Map();['sources']=[];parsedContent=new Map();parsedMergedContent=new Map();['changeGroups']=[];areActionsDisabled=!0x1;_outdatedReasonByDocumentId;isFromHistory=!0x1;documentContextContent;_documentIdToSource=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];cachedSuggestionContentParts={'withDiff':[],'withoutDiff':[]};constructor({type:
|
|
30
|
-
dt(),Gn=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];var Fn=class extends Bn{['id'];['replies']=[];currentReply;['messageId'];actionCallId;currentRequest;connector;isStopped=!0x1;isDestroyed=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;_channelsToEditors;constructor({connector:
|
|
31
|
-
At();var Yn=class AIContext extends Wn{['_refs'];constructor(_0x3a2ea3=[]){super(),this['_refs']=[..._0x3a2ea3];}get['refs'](){return[...this['_refs']];}get isEmpty(){return 0x0===this['_refs']['length'];}cloneWith(..._0x5c72c5){return new AIContext([...this['_refs'],..._0x5c72c5]);}addDefaultContext(_0x218b94){this['_refs']=[...this['_refs'],..._0x218b94];}toRequestParts(_0x1fafdc=[]){return[...this['_refs']['map'](As),..._0x1fafdc];}toMessageAttributes(_0x12f2a6){return this['isEmpty']?_0x12f2a6:{..._0x12f2a6,[Kn]:[...new Set(this['_refs']['map'](_0xfd784b=>_0xfd784b['id']))]};}static getDefaultContextIds(_0x5b5156){const _0x579a05=_0x5b5156&&_0x5b5156[Kn];return new Set(Array['isArray'](_0x579a05)?_0x579a05:[]);}};const $n=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']]),qn=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];var Qn=class AIChatContext extends Yn{_connector;['_config'];['_ownerId'];constructor({connector:_0x191874,config:_0x9996be,ownerId:_0x250acd}){super(),this['_connector']=_0x191874,this['_config']=_0x9996be,this['_ownerId']=_0x250acd;}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(_0x4e0a96,_0x2cb000,_0x2ef506=new Set()){const _0x37ac9d=new Map(),{contextItem:_0x568271,unmatchedDocumentIds:_0x1ff2b4}=await this['_populateDocumentContextItem'](_0x4e0a96,_0x2cb000);_0x568271&&_0x37ac9d['set'](_0x568271['id'],_0x568271);for(const _0xcdb3b1 of _0x4e0a96){if('document'===_0xcdb3b1['type'])continue;const _0x3ef856=await this['_createContextItemFromContent'](_0xcdb3b1,_0x2ef506);'context'!==_0x3ef856['type']&&this['_addToConversationContextItem'](_0x3ef856),_0x37ac9d['set'](_0x3ef856['id'],_0x3ef856);}return{'contextItems':_0x37ac9d,'hasUnmatched':_0x1ff2b4['size']>0x0,'unmatchedDocumentIds':_0x1ff2b4};}async _populateDocumentContextItem(_0x1eee3a,_0x47ebe8){const _0x5e99eb=_0x1eee3a['filter'](_0x6ba114=>'document'===_0x6ba114['type']);if(0x0===_0x5e99eb['length'])return{'unmatchedDocumentIds':new Set()};const _0x279343=_0x5e99eb['map'](_0x1274a1=>_0x1274a1['id']),_0x17d85c=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x279343)['getDocuments'](),_0x457243=new Map(_0x17d85c['map'](_0x5ad35d=>[_0x5ad35d['id'],_0x5ad35d])),_0x3edc2b=[],_0x5eef2a=new Set();for(const _0x329973 of _0x5e99eb){const _0x1add1c=_0x457243['get'](_0x329973['id']);_0x1add1c&&(this['_matchDocumentToRoot'](_0x1add1c,_0x47ebe8)||_0x5eef2a['add'](_0x1add1c['id']),_0x3edc2b['push']({'id':_0x1add1c['id'],'content':_0x1add1c['content'],'version':_0x1add1c['attributes']?.['version']??0x0,'sessionId':_0x1add1c['attributes']?.['sessionId']??null,'selection':[],'selectionSignature':'','channelId':_0x1add1c['attributes']?.['channelId']??_0x47ebe8[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x1add1c['attributes']?.['rootName']??_0x47ebe8[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??'','editorConfig':_0x329973['editorConfig']}));}const _0x3f806f={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x3edc2b};return this['_addToConversationContextItem'](_0x3f806f),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x3f806f,'unmatchedDocumentIds':_0x5eef2a};}_matchDocumentToRoot(_0x473db0,_0x57363c){const _0x5d76b1=_0x473db0['attributes']?.['channelId'],_0x4c2d7e=_0x473db0['attributes']?.['rootName'];if(_0x5d76b1&&_0x4c2d7e){for(const _0x188469 of _0x57363c)if(_0x188469['config']['get']('collaboration.channelId')===_0x5d76b1){for(const _0x574148 of _0x188469['model']['document']['getRoots']())if('$graveyard'!==_0x574148['rootName']&&_0x574148['rootName']===_0x4c2d7e)return{'editor':_0x188469,'rootName':_0x574148['rootName']};}}}async _createContextItemFromContent(_0x1ad126,_0x1b2476=new Set()){return'mcp-tool-context'===_0x1ad126['type']?{'id':_0x1ad126['id'],'uiId':_0x1ad126['id'],'label':_0x1ad126['data']?.['label']||_0x1ad126['id'],'type':'mcp-tool-context','mcpServerName':_0x1ad126['mcpServerName'],'toolName':_0x1ad126['toolName'],'data':_0x1ad126['data']||{}}:{'id':_0x1ad126['id'],'uiId':_0x1ad126['id'],'label':_0x1ad126['attributes']?.['label']||_0x1ad126['name']||_0x1ad126['url']||_0x1ad126['id'],'type':_0x1ad126['type'],..._0x1ad126?.['attributes']?.['resourceId']?{'resourceId':_0x1ad126['attributes']?.['resourceId']}:{},...'context'===_0x1ad126['type']&&_0x1b2476['has'](_0x1ad126['id'])?{'hidden':!0x0}:{}};}getSentContextItems(){return new Map(this['_conversationContextItems']);}removeFromContext(_0x3d3569){this['_pendingContextItems']['get'](_0x3d3569)?.['isReadOnly']||this['_removeContextItem'](_0x3d3569);}clearPendingContextItems(){if(0x0===this['_pendingContextItems']['size'])return;for(const _0xcc81eb of this['_pendingContextItems']['values']())'context'!==_0xcc81eb['type']&&this['_removeContextItem'](_0xcc81eb['uiId']);const _0x3638e2=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x3638e2&&this['_addContextItem']({..._0x3638e2,'isReadOnly':!0x0,'hidden':!0x0});}addToConversationContext(_0x541e0f){for(const _0xe55aae of _0x541e0f['values']())'context'!==_0xe55aae['type']&&this['_addToConversationContextItem'](_0xe55aae);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(_0x41f93f){return Array['from'](_0x41f93f['values']())['flatMap'](_0x1179f2=>this['_mapContextItemToRequestData'](_0x1179f2));}async addFilesToContext(_0x5b3ab1,_0x2c7626,_0x2e5b28='file'){const _0x35670f='files-'+kt();this['_startUploadOperation'](_0x35670f);try{await Promise['all'](_0x5b3ab1['map'](async _0x577e00=>{const _0x4766d4='file-'+kt(),_0x31f684=_0x15f5d8(_0x577e00['name']),_0x4616ea='file'===_0x2e5b28&&_0x577e00['type']['startsWith']('image/')?'image':_0x2e5b28;try{this['_addContextItem']({'type':_0x4616ea,'label':_0x2c7626?.['label']||_0x31f684,'uiId':_0x4766d4,'resourceId':_0x2c7626?.['resourceId']},!0x0);const _0x39900b=this['_connector']['uploadFile'](this['_ownerId'],_0x577e00,_0x2c7626);this['_ongoingUploads']['set'](_0x4766d4,_0x39900b['abortController']);const {id:_0x396be6}=await _0x39900b['getId']();this['_ongoingUploads']['delete'](_0x4766d4),this['_finishContextItemLoading']({'type':_0x4616ea,'id':_0x396be6,'label':_0x2c7626?.['label']||_0x31f684,'uiId':_0x4766d4,'resourceId':_0x2c7626?.['resourceId']},!0x1);}catch(_0x5d5751){if(this['_ongoingUploads']['delete'](_0x4766d4),!kn(_0x5d5751)){const _0x51cafc=new yn({'code':$n['get'](_0x5d5751['code'])||'ai-chat-file-upload-failed','cause':_0x5d5751,'context':{'fileName':_0x31f684}});this['fire']('error',{'error':_0x51cafc});}this['_removeContextItem'](_0x4766d4);}}));}finally{this['_finishUploadOperation'](_0x35670f);}}addCurrentDocumentToContext(_0x2b02c9){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x3e1533={'type':'document','uiId':'current-document','label':_0x2b02c9,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x3e1533);}getCurrentDocumentContext(){return this['_pendingContextItems']['get']('current-document');}async updateCurrentDocuments(_0x57a962,_0x4f5de2){const _0xcd437d=this['getCurrentDocumentContext']();if(!_0xcd437d)return;_0x57a962['length']>0x1&&_0x57a962['some'](_0x367443=>!_0x367443['description'])&&St('ai-chat-documents-missing-description');try{const _0x5f2d40=(_0xcd437d['documents']||[])['filter'](_0x3d2379=>_0x4f5de2['has'](_0x3d2379['channelId']));if(!_0x57a962['length'])return void(_0xcd437d['documents']=_0x5f2d40);const _0x1e2c37=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x57a962)['getIds']();if(_0x1e2c37['length']!==_0x57a962['length']||_0x1e2c37['some'](_0x28567b=>!_0x28567b?.['id'])){const _0x24e165=new ct('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x24e165});}const _0x122e6f=_0x57a962['map']((_0x43ae9d,_0x1b34d5)=>{return{'id':_0x1e2c37[_0x1b34d5]['id'],'content':_0x43ae9d['content'],'version':_0x43ae9d['version'],'sessionId':_0x43ae9d['sessionId'],'selection':(_0x59b8f8=_0x43ae9d['selections'],_0x59b8f8?_0x59b8f8['map'](_0x902607=>({'start':_0x902607['start'],'end':_0x902607['end']})):[]),'selectionSignature':_0x43ae9d['selectionSignature'],'channelId':_0x43ae9d['channelId'],'rootName':_0x43ae9d['rootName'],'editorConfig':_0x43ae9d['editorConfig']};var _0x59b8f8;});_0xcd437d['documents']=[..._0x5f2d40,..._0x122e6f];}catch(_0x6c7b67){throw new yn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x6c7b67});}}addSelectionToContext(_0x3c77d9){this['_addContextItem']({'type':'selection','label':_0x3c77d9,'uiId':'selection','content':_0x3c77d9});}removeSelectionFromContext(){this['_removeContextItem']('selection');}async addUrlToContext(_0x54e75a,_0x36d1f7){const _0x350c72='url-'+kt();this['_startUploadOperation'](_0x350c72);const _0x5751a0='url-'+kt();try{this['_addContextItem']({'type':'web-resource','label':_0x36d1f7?.['label']||_0x54e75a,'uiId':_0x5751a0,'resourceId':_0x36d1f7?.['resourceId']},!0x0);const _0x4b323d=this['_connector']['uploadUrl'](this['_ownerId'],_0x54e75a,_0x36d1f7);this['_ongoingUploads']['set'](_0x5751a0,_0x4b323d['abortController']);const {id:_0x17995c}=await _0x4b323d['getId']();this['_ongoingUploads']['delete'](_0x5751a0),this['_finishContextItemLoading']({'type':'web-resource','id':_0x17995c,'label':_0x36d1f7?.['label']||_0x54e75a,'uiId':_0x5751a0,'resourceId':_0x36d1f7?.['resourceId']},!0x1);}catch(_0x260348){this['_ongoingUploads']['delete'](_0x5751a0),kn(_0x260348)||this['fire']('error',{'error':new ct('ai-chat-url-upload-failed',this,{'url':_0x54e75a,'originalError':_0x260348}),'url':_0x54e75a}),this['_removeContextItem'](_0x5751a0);}finally{this['_finishUploadOperation'](_0x350c72);}}addToolItemToContext(_0x4ac5b5){_0x4ac5b5['id']=_0x4ac5b5['id']??kt()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x4ac5b5['uiId'],_0x4ac5b5),this['fire']('contextItemAdded',{'contextItem':_0x4ac5b5,'isLoading':!0x1});}async['loadSourceResources'](_0x1faaec,_0x172114,_0x32b03f){const _0x460f00=this['_addContextOptionsState']['sources']['find'](_0x1bbc23=>_0x1bbc23['id']===_0x1faaec);if(!_0x460f00)return this['fire']('error',{'error':new ct('ai-chat-source-not-found',this,{'sourceId':_0x1faaec}),'sourceId':_0x1faaec}),[];try{const _0x14b40d=(await _0x460f00['getResources'](_0x172114))['map'](_0x2ae798=>{const _0x357332=this['_isResourceInContext'](_0x2ae798['id']);return{..._0x2ae798,'isInContext':_0x357332};});return _0x460f00['resources']=_0x14b40d,this['fire']('sourceResourcesLoaded',{'sourceId':_0x1faaec,'source':_0x460f00,'resources':_0x14b40d,'uid':_0x32b03f}),_0x14b40d;}catch(_0x1e9e09){return this['fire']('error',{'error':new ct('ai-chat-source-resources-load-failed',this,{'sourceId':_0x1faaec,'originalError':_0x1e9e09}),'sourceId':_0x1faaec,'sourceLabel':_0x460f00['label']}),[];}}async addResourceToContext(_0x3b295b,_0x3b3384){if(this['_isResourceInContext'](_0x3b3384['id']))return;if('context'===_0x3b3384['type'])return void this['_addContextItem']({'type':'context','id':_0x3b3384['id'],'label':_0x3b3384['label'],'uiId':'context-'+kt(),'resourceId':_0x3b3384['id']});let _0x42075c=_0x3b3384['data'];if(!_0x42075c&&_0x3b295b['getData'])try{_0x42075c=await _0x3b295b['getData'](_0x3b3384['id']);}catch(_0x2e7996){return void this['fire']('error',{'error':new ct('ai-chat-resource-load-failed',this,{'resourceId':_0x3b3384['id'],'sourceId':_0x3b295b['id'],'originalError':_0x2e7996}),'resourceId':_0x3b3384['id'],'sourceId':_0x3b295b['id']});}if(_0x42075c)switch(_0x3b3384['type']){case'web-resource':if('string'!=typeof _0x42075c)return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x3b3384['id'],'sourceId':_0x3b295b['id'],'expectedType':'string','actualType':typeof _0x42075c}),'resourceId':_0x3b3384['id'],'sourceId':_0x3b295b['id']});await this['addUrlToContext'](_0x42075c,{'label':_0x3b3384['label'],'resourceId':_0x3b3384['id']});break;case'file':if(!(_0x42075c instanceof File))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x3b3384['id'],'sourceId':_0x3b295b['id'],'expectedType':'File','actualType':typeof _0x42075c}),'resourceId':_0x3b3384['id'],'sourceId':_0x3b295b['id']});await this['addFilesToContext']([_0x42075c],{'label':_0x3b3384['label'],'resourceId':_0x3b3384['id']});break;case'text':if('object'!=typeof _0x42075c||!('content'in _0x42075c)||!('type'in _0x42075c))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x3b3384['id'],'sourceId':_0x3b295b['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x42075c}),'resourceId':_0x3b3384['id'],'sourceId':_0x3b295b['id']});_0x42075c=AIChatContext['_convertTextResourceToFile'](_0x42075c,_0x3b3384['label']),await this['addFilesToContext']([_0x42075c],{'label':_0x3b3384['label'],'resourceId':_0x3b3384['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ct('ai-chat-context-unsupported-type',this,{'resourceId':_0x3b3384['id'],'sourceId':_0x3b295b['id'],'resourceType':_0x3b3384['type']}),'resourceId':_0x3b3384['id'],'sourceId':_0x3b295b['id']});}else this['fire']('error',{'error':new ct('ai-chat-resource-no-data',this,{'resourceId':_0x3b3384['id'],'sourceId':_0x3b295b['id']}),'resourceId':_0x3b3384['id'],'sourceId':_0x3b295b['id']});}addContextSource(_0x5343ab){this['_addContextOptionsState']['sources']['some'](_0x253d22=>_0x253d22['id']===_0x5343ab['id'])||(this['_addContextOptionsState']['sources']['push']({..._0x5343ab,'resources':[]}),this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']}));}toggleAddCurrentDocumentOptionVisibility(_0x1f8aa4){if(void 0x0!==_0x1f8aa4)this['_addContextOptionsState']['document']['isHidden']=!_0x1f8aa4;else{const _0x194fb0=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x194fb0;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static _convertTextResourceToFile(_0x2a92fb,_0x35fa7c){switch(_0x2a92fb['type']){case'markdown':return new File([_0x2a92fb['content']],_0x35fa7c,{'type':'text/markdown'});case'html':return new File([_0x2a92fb['content']],_0x35fa7c,{'type':'text/html'});default:return new File([_0x2a92fb['content']],_0x35fa7c,{'type':'text/plain'});}}static _mapContextItemToRequestData(_0x579ce8){switch(_0x579ce8['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x579ce8['id']}];case'web-resource':return[{'type':'web-resource','id':_0x579ce8['id']}];case'context':return[{'type':'context','id':_0x579ce8['id']}];case'document':return _0x579ce8['documents']?.['length']?_0x579ce8['documents']['map'](({id:_0x399f93,editorConfig:_0x4018b6,selection:_0x5f1bca})=>({'type':'document','id':_0x399f93,..._0x4018b6&&{'editorConfig':_0x4018b6},..._0x5f1bca?.['length']&&{'selection':_0x5f1bca}})):[];case'mcp-tool-context':{const _0x5ba773=_0x579ce8;return[{'type':'mcp-tool-context','mcpServerName':_0x5ba773['mcpServerName'],'toolName':_0x5ba773['toolName'],'data':{..._0x5ba773['data'],'label':_0x5ba773['label']||_0x5ba773['data']?.['label']||_0x5ba773['id']},'id':_0x5ba773['id']}];}default:return[];}}_addContextItem(_0x542e06,_0x3a3895=!0x1){if(this['_pendingContextItems']['set'](_0x542e06['uiId'],_0x542e06),_0x542e06['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x542e06,'isLoading':_0x3a3895}),'current-document'===_0x542e06['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x542e06['resourceId']){const _0x553b52=this['_findSourceIdsByResourceId'](_0x542e06['resourceId']);_0x553b52&&_0x553b52['forEach'](_0x154b3c=>{this['_updateResourceInContextState'](_0x154b3c,_0x542e06['resourceId'],!0x0);});}}_removeContextItem(_0x4fb561){const _0x2094cd=this['_pendingContextItems']['get'](_0x4fb561),_0xa63775=this['_ongoingUploads']['get'](_0x4fb561);if(_0xa63775&&(_0xa63775['abort'](),this['_ongoingUploads']['delete'](_0x4fb561)),_0x2094cd?.['resourceId']){const _0x48c394=this['_findSourceIdsByResourceId'](_0x2094cd['resourceId']);_0x48c394&&_0x48c394['forEach'](_0x5b45c0=>{this['_updateResourceInContextState'](_0x5b45c0,_0x2094cd['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x4fb561),this['fire']('contextItemRemoved',{'uiId':_0x4fb561,'type':_0x2094cd?.['type']}),'current-document'===_0x4fb561&&this['toggleAddCurrentDocumentOptionVisibility']();}_finishContextItemLoading(_0x57fce0,_0x23beff){if(this['_pendingContextItems']['has'](_0x57fce0['uiId'])&&(this['_pendingContextItems']['set'](_0x57fce0['uiId'],_0x57fce0),this['fire']('contextItemLoadingEnded',{'contextItem':_0x57fce0,'isLoading':_0x23beff}),_0x57fce0['resourceId'])){const _0xb94abf=this['_findSourceIdsByResourceId'](_0x57fce0['resourceId']);_0xb94abf&&_0xb94abf['forEach'](_0x5caea5=>{this['_updateResourceInContextState'](_0x5caea5,_0x57fce0['resourceId'],!0x0);});}}_addToConversationContextItem(_0x4bb44d){this['_conversationContextItems']['set'](_0x4bb44d['uiId'],_0x4bb44d);}_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'](_0x5853db=>({..._0x5853db,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}_getCustomSourcesInitialState(){return this['_config']?.['sources']?.['map'](_0x3a0626=>({..._0x3a0626,'resources':[]}))??[];}_isResourceInContext(_0x442e2b){for(const _0x3251c2 of this['_pendingContextItems']['values']())if(_0x3251c2['resourceId']===_0x442e2b)return!0x0;for(const _0xeb47c0 of this['_conversationContextItems']['values']())if(_0xeb47c0['resourceId']===_0x442e2b)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x3035d9){const _0x5e73cb=[];for(const _0xcfc41d of this['_addContextOptionsState']['sources'])_0xcfc41d['resources']['find'](_0x1e2eb2=>_0x1e2eb2['id']===_0x3035d9)&&_0x5e73cb['push'](_0xcfc41d['id']);return 0x0===_0x5e73cb['length']?null:_0x5e73cb;}_updateResourceInContextState(_0x73fa1a,_0x51e575,_0x3419fe){const _0x11c2ac=this['_addContextOptionsState']['sources']['find'](_0x247ad5=>_0x247ad5['id']===_0x73fa1a);if(!_0x11c2ac)return;const _0x487369=_0x11c2ac['resources']['find'](_0x46f177=>_0x46f177['id']===_0x51e575);_0x487369&&(_0x487369['isInContext']=_0x3419fe,this['fire']('resourceStateChanged',{'sourceId':_0x73fa1a,'resourceId':_0x51e575,'isInContext':_0x3419fe}));}_startUploadOperation(_0x10f10e){this['_ongoingUploadOperations']['set'](_0x10f10e,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}_finishUploadOperation(_0x49d78b){this['_ongoingUploadOperations']['delete'](_0x49d78b),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}},Xn=class extends Fn{['userMessage'];conversationId;contextItems=new Map();capabilities;['model'];attributes;context;constructor(_0x45a621){super(_0x45a621),this['conversationId']=_0x45a621['conversationId'],this['contextItems']=_0x45a621['contextItems'],this['capabilities']=_0x45a621['capabilities'],this['userMessage']=_0x45a621['userMessage'],this['model']=_0x45a621['model'],this['attributes']=_0x45a621['attributes'],this['context']=_0x45a621['context']??new Yn();}sendRequest(){const _0x54c732=Qn['mapContextItemsToRequestData'](this['contextItems']),_0x52b99d=this['context']['toRequestParts'](_0x54c732);return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':_0x52b99d,'capabilities':fn['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['context']['toMessageAttributes'](this['attributes'])});}getDocumentContext(){return this['contextItems']['get']('current-document');}};const zn=/* #__PURE__ -- @preserve */
|
|
32
|
-
dt();var jn=class extends zn{['id'];isStarted=!0x1;isFromHistory;interactions=[];currentInteraction;selectedModel;connector;options;_abortReject;_channelsToEditors;_getSessionId;constructor(_0x52151b){super(),this['options']=_0x52151b,this['connector']=_0x52151b['connector'],this['chatModels']=_0x52151b['chatModels'],this['id']=_0x52151b['conversationId'],this['isFromHistory']=_0x52151b['isFromHistory'],this['_channelsToEditors']=_0x52151b['channelsToEditors'],this['_getSessionId']=_0x52151b['getSessionId'];}async init(_0x3e3b84){try{this['chatContext']=new Qn({'connector':this['connector'],'config':_0x3e3b84,'ownerId':this['id']}),this['chatContext']['delegate'](...qn)['to'](this),this['chatContext']['init'](),this['options']['contextLibrary']?.['resolveContext']({'feature':'chat','extraContexts':this['options']['extraContexts'],'context':this['chatContext']}),this['chatCapabilities']=new fn(),this['chatCapabilities']['delegate'](...Cn)['to'](this),this['chatCapabilities']['init']();const _0x5b322a=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x5b322a});const _0x1a15ef=await this['chatModels']['resolveModel'](this['options']['selectedModelId']);_0x1a15ef&&await this['setModel'](_0x1a15ef);}catch(_0xbd9289){const _0x52ae2f=new yn({'code':'ai-chat-conversation-init-failed','cause':_0xbd9289,'type':'network'});this['fire']('error',{'error':_0x52ae2f});}}async start(){if(this['isStarted'])throw new ct('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new ct('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x22fe9a}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x22fe9a,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x162452){const _0x1e64ee=new yn({'code':'ai-chat-conversation-start-failed','cause':_0x162452,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x1e64ee}),_0x1e64ee;}}async['load'](_0x1e6dc9){try{const _0x379a14=await this['connector']['fetchConversation'](_0x1e6dc9)['getConversation'](),_0x39c9ef=await this['connector']['fetchConversationMessages'](_0x1e6dc9)['getMessages'](),_0x3a0477=_0x39c9ef[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x379a14['id'],'title'in _0x379a14?this['fire']('setConversationTitle',_0x379a14['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']),this['selectedModel']=await this['chatModels']['getModel'](_0x3a0477)??void 0x0,this['fire']('modelSelected',{'selectedModel':this['selectedModel'],'isDisabled':!0x0});const {streamingMessageId:_0x27a2f5}=await this['_processMessagesToInteractions'](_0x39c9ef,_0x3a0477);return _0x27a2f5&&this['currentInteraction']?this['_resumeStream'](_0x27a2f5):this['currentInteraction']=void 0x0,this;}catch(_0x1cbf81){const _0x42a80b=new yn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x1cbf81,'type':'network','context':{'conversationId':_0x1e6dc9}});throw this['fire']('error',{'error':_0x42a80b}),_0x42a80b;}}async _processMessagesToInteractions(_0x5bbec0,_0x263de1){let _0x1a9fa0,_0x309544,_0x4433b7=new Set();for(const _0x46266d of _0x5bbec0)if('user'===_0x46266d['role']){const {contextItems:_0x3aeede,unmatchedDocumentIds:_0x4ab49c}=await this['_extractContextItems'](_0x46266d);_0x4433b7=_0x4ab49c;const _0x598212={'isReasoningEnabled':Object['hasOwn'](_0x46266d['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x46266d['capabilities'],'webSearch')};_0x1a9fa0=this['createInteraction']({'userMessage':_0x46266d['prompt'],'contextItems':_0x3aeede,'capabilities':_0x598212,'modelId':_0x263de1,'attributes':_0x46266d['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x1a9fa0,_0x309544=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x46266d['role']&&_0x1a9fa0){if('streaming'===_0x46266d['status']){_0x309544=_0x46266d['id'];continue;}if('error'===_0x46266d['status'])continue;const _0x24a0a0=[];for(const _0x4cacf0 of _0x46266d['content'])switch(_0x4cacf0['type']){case'text':case'modification':{const _0x5cd779=_0x1a9fa0['getDocumentContext'](),_0x4bdab0=this['_getOutdatedReasonsByDocumentId'](_0x5cd779,_0x4433b7),_0x2fe738=_0x5cd779?.['documents']??[],_0x155ffd=_0x2fe738['length']>0x0&&_0x2fe738['every'](_0x1690ae=>_0x4bdab0['has'](_0x1690ae['id']));_0x1a9fa0['currentReply']?.['type']!==_0x4cacf0['type']&&(_0x1a9fa0['currentReply']=_0x1a9fa0['createReply']({'type':_0x4cacf0['type'],'isDone':!0x0,'interactionId':_0x1a9fa0['id'],'areActionsDisabled':_0x155ffd,'outdatedReasonByDocumentId':_0x4bdab0,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x24a0a0['length']>0x0&&(_0x1a9fa0['currentReply']['sources']=_0x24a0a0['splice'](0x0))),_0x1a9fa0['currentReply']['appendContent'](_0x4cacf0['content'],_0x4cacf0['documentId']);break;}case'url':_0x24a0a0['push'](_0x4cacf0);break;case'mcp-tool-result':{const {data:_0x1a6451,attributes:_0x268702}=JSON['parse'](_0x4cacf0['content']);_0x1a9fa0['_handleToolResultData']({'toolName':_0x4cacf0['toolName'],'data':_0x1a6451,'attributes':_0x268702});break;}}'cancelled'===_0x46266d['status']&&this['fire']('error',{'interactionId':_0x1a9fa0['id'],'error':new ct('ai-request-aborted',this)});}}return{'streamingMessageId':_0x309544};}async _resumeStream(_0x2fa41d){if(this['currentInteraction'])try{const _0xa216ee=this['connector']['resumeStream'](this['id'],_0x2fa41d);await this['currentInteraction']['resume'](_0xa216ee);}catch(_0x389337){_0x389337 instanceof ct&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x389337});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async _extractContextItems(_0x12c9b9){return _0x12c9b9['content']?this['chatContext']['populateFromMessage'](_0x12c9b9['content'],Array['from'](this['_channelsToEditors']['values']()),Yn['getDefaultContextIds'](_0x12c9b9['attributes'])):{'contextItems':new Map(),'unmatchedDocumentIds':new Set()};}async handleUserInteraction({userMessage:_0x3116d1,attributes:_0x520ce2}){if(!this['isStarted'])throw new ct('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new ct('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x41856a=new Map(this['getPendingContextItems']()),_0x1ea16a=this['chatCapabilities']['getCapabilitiesConfig'](),_0x2835cc=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x3116d1,'contextItems':_0x41856a,'capabilities':_0x1ea16a,'modelId':_0x2835cc,'attributes':_0x520ce2,'channelsToEditors':this['_channelsToEditors']}),await this['updateCurrentDocumentsInContext'](),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x290b6b){if(_0x290b6b instanceof ct)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x290b6b});else{const _0x3e51bd=$n['get'](_0x290b6b['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ct(_0x3e51bd,null,{'error':_0x290b6b})});}}finally{this['stopProcessing']();}}stopProcessing(){this['_abortReject']&&(this['_abortReject'](),this['_abortReject']=void 0x0),this['currentInteraction']&&(this['currentInteraction']['stop'](),this['currentInteraction']=void 0x0);}createInteraction({userMessage:_0x5096b6,contextItems:_0x47d227,capabilities:_0x45f574,modelId:_0x9d3617,attributes:_0x4259c3,channelsToEditors:_0x2440b0}){const _0xea3bc5=new Xn({'userMessage':_0x5096b6,'contextItems':_0x47d227,'capabilities':_0x45f574,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x9d3617,'attributes':_0x4259c3,'channelsToEditors':_0x2440b0,'context':this['chatContext']['isEmpty']?void 0x0:new Yn(this['chatContext']['refs'])});return _0xea3bc5['delegate'](...Gn)['to'](this),this['interactions']['push'](_0xea3bc5),this['fire']('interactionCreated',_0xea3bc5),_0xea3bc5;}getInteraction(_0x238d7a){return this['interactions']['find'](_0x1ab65f=>_0x1ab65f['id']===_0x238d7a);}removeInteraction(_0x45156e){const _0x57b98c=this['getInteraction'](_0x45156e);_0x57b98c&&(_0x57b98c['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x57b98c),0x1));}get lastInteraction(){return this['interactions'][this['interactions']['length']-0x1];}cancelLastInteractionStream(){const _0x2fdc5d=this['lastInteraction'];_0x2fdc5d?.['conversationId']&&_0x2fdc5d['messageId']&&this['connector']['cancelStream'](_0x2fdc5d['conversationId'],_0x2fdc5d['messageId'])['execute']()['catch'](()=>{});}addCurrentDocumentToContext(_0x2ffb53){this['chatContext']['addCurrentDocumentToContext'](_0x2ffb53);}async updateCurrentDocumentsInContext(){if(!this['isCurrentDocumentInContext']())return;const {changedIds:_0x35cfc5,unchangedIds:_0x5ebe64}=this['_compareEditorStateWithDocumentContext'](),_0x3b316c=new Promise((_0x3df4fb,_0x477987)=>{this['_abortReject']=()=>_0x477987(new ct('ai-request-aborted',this));}),_0x1d634a=await Promise['race']([this['options']['aiEditing']['getDocumentData'](_0x35cfc5),_0x3b316c]);await Promise['race']([this['chatContext']['updateCurrentDocuments'](_0x1d634a,_0x5ebe64),_0x3b316c]);}_compareEditorStateWithDocumentContext(){const _0x288f0b=new Set(),_0xeb5383=new Set(),_0xee5f68=this['options']['aiEditing']['getEditorsVersions'](),_0x263d5f=this['options']['aiEditing']['getEditorsSelections'](),_0x572b69=this['chatContext']['getCurrentDocumentContext']()['documents']||[],_0x1cf0b4=new Map(_0x572b69['map'](({channelId:_0x588485,version:_0x55cd99})=>[_0x588485,_0x55cd99])),_0x76025a=new Map(_0x572b69['map'](({channelId:_0x58b5b9,selectionSignature:_0x46c59c})=>[_0x58b5b9,_0x46c59c]));for(const [_0xed63d4,_0x55820a]of _0xee5f68){const _0x2bdbec=_0x263d5f['get'](_0xed63d4);_0x1cf0b4['get'](_0xed63d4)!=_0x55820a||_0x76025a['get'](_0xed63d4)!=_0x2bdbec?_0x288f0b['add'](_0xed63d4):_0x1cf0b4['has'](_0xed63d4)&&_0xeb5383['add'](_0xed63d4);}return{'changedIds':_0x288f0b,'unchangedIds':_0xeb5383};}toggleAddCurrentDocumentOptionVisibility(_0x311711){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x311711);}_getOutdatedReasonsByDocumentId(_0x3ac247,_0xaadc14){const _0x242a07=new Map();if(!_0x3ac247||!_0x3ac247['documents'])return _0x242a07;for(const _0x1416f1 of _0x3ac247['documents']){const _0x21c538=this['_channelsToEditors']['get'](_0x1416f1['channelId']);_0x21c538&&'destroyed'!==_0x21c538['state']?_0x1416f1['sessionId']!==this['_getSessionId'](_0x21c538)?_0x242a07['set'](_0x1416f1['id'],'session-changed'):_0xaadc14['has'](_0x1416f1['id'])&&_0x242a07['set'](_0x1416f1['id'],'content-removed'):_0x242a07['set'](_0x1416f1['id'],'editor-removed');}return _0x242a07;}addSelectionToContext(_0x7386b3){this['chatContext']['addSelectionToContext'](_0x7386b3);}removeSelectionFromContext(){this['chatContext']['removeSelectionFromContext']();}addFilesToContext(_0x460b2f){this['chatContext']['addFilesToContext'](_0x460b2f);}addUrlToContext(_0x43cd00){this['chatContext']['addUrlToContext'](_0x43cd00);}addToolItemToContext(_0x2673a5){this['chatContext']['addToolItemToContext'](_0x2673a5);}addResourceToContext(_0x59c306,_0x35e54e){this['chatContext']['addResourceToContext'](_0x59c306,_0x35e54e);}['loadSourceResources'](_0x19372f,_0x2105c5,_0x357455){return this['chatContext']['loadSourceResources'](_0x19372f,_0x2105c5,_0x357455);}removeFromContext(_0x26019c){this['chatContext']['removeFromContext'](_0x26019c);}setWebSearch(_0x1e75a6){this['chatCapabilities']['setWebSearch'](_0x1e75a6);}toggleWebSearch(){this['chatCapabilities']['toggleWebSearch']();}setReasoning(_0x134cd0){this['chatCapabilities']['setReasoning'](_0x134cd0);}toggleReasoning(){this['chatCapabilities']['toggleReasoning']();}isCurrentDocumentInContext(){return this['chatContext']['isCurrentDocumentInContext']();}isCurrentDocumentInConversation(){return this['chatContext']['isCurrentDocumentInConversation']();}isSelectionInContext(){return this['chatContext']['isSelectionInContext']();}getPendingContextItems(){return this['chatContext']['getPendingContextItems']();}addDefaultContext(_0x2f897e){_0x2f897e['length']&&this['chatContext']['addDefaultContext'](_0x2f897e);}async setModel(_0x618945){_0x618945?!0x1===await this['chatModels']['isAvailable'](_0x618945)&&(St('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x618945}),_0x618945=(await this['chatModels']['getAvailableModels']())[0x0]):(St('ai-chat-conversation-set-model-null',{'conversation':this}),_0x618945=(await this['chatModels']['getAvailableModels']())[0x0]),_0x618945['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x618945,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x618945}));}};function Jn({documentSuggestions:_0x5cf516,transform:_0x11a1e0,documentCompare:_0x3ebe35,documentCompareOptions:_0x1a7d2f}){const _0x1784ca=new Map();for(const [_0x82ecc2,{groups:_0x4c6dfd,documentContext:_0x3542fe,documentContent:_0x1f4733,editor:_0x436cf8}]of _0x5cf516){const _0x345bd2=_0x3542fe['content'],_0x5e5791=_0x3542fe['version'],_0x1ab539=_0x1f4733['cloneNode'](!0x0);for(const {changes:_0x2b5eae}of _0x4c6dfd)$s(_0x1ab539,_0x2b5eae);const _0x28656e=Os(_0x1ab539),_0x4f8fe4=Qs(_0x436cf8,_0x3542fe['rootName'],_0x345bd2,_0x28656e);if(!_0x4f8fe4)continue;const _0x28a523=_0x3ebe35['getDiff'](_0x4f8fe4['before'],_0x4f8fe4['after'],{'targetEditor':_0x436cf8,'anchor':_0x3542fe['rootName'],..._0x1a7d2f})['getOperations']();if(_0x11a1e0){const _0x575c89=_0x436cf8['model']['document']['history']['getOperations'](_0x5e5791),_0x57c627={'document':_0x436cf8['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x1784ca['set'](_0x82ecc2,_0x5dec67(_0x28a523,_0x575c89,_0x57c627)['operationsA']);}else _0x1784ca['set'](_0x82ecc2,_0x28a523);}return _0x1784ca;}function Zn({groups:_0x119723,documentContextContent:_0x2dcc57,documents:_0x1feef1}){const _0x5e8caa=new Map();for(const _0x444173 of _0x119723){const {documentId:_0x52798e}=_0x444173,_0x398070=_0x5e8caa['get'](_0x52798e);if(_0x398070)_0x398070['groups']['push'](_0x444173),_0x398070['indexes']['push'](_0x444173['index']);else{const _0x42c375=_0x1feef1['find'](_0x290d9a=>_0x290d9a['id']===_0x52798e),_0x49552d=_0x2dcc57['get'](_0x52798e);if(!_0x42c375||!_0x49552d)continue;_0x5e8caa['set'](_0x52798e,{'groups':[_0x444173],'documentContext':_0x42c375,'documentContent':_0x49552d,'editor':_0x444173['editor'],'indexes':[_0x444173['index']]});}}return _0x5e8caa;}function tr(_0x355ec0,_0x5856a1){const _0x3407da=_0x355ec0['files']['length']>0x0&&_0x355ec0['files']['every'](_0x44f99a=>_0x44f99a['type']['startsWith']('image/')),_0x18a146=_0x355ec0['plainText']['trim']()['length']>0x0;if(_0x355ec0['files']['length']>0x0&&_0x5856a1['filesEnabled']&&(!_0x3407da||!_0x18a146)){const _0x3be054=_0x355ec0['files']['filter'](_0x190c0f=>_0x190c0f['name']);return _0x3be054['length']>0x0?{'type':'file','files':_0x3be054}:null;}if(_0x5856a1['urlsEnabled']){const _0x1fbd0b=function(_0x5a2200){const _0x1a8403=_0x5a2200['trim']();if(/\s/['test'](_0x1a8403))return null;try{const _0x5850a7=new URL(_0x1a8403);return'http:'!==_0x5850a7['protocol']&&'https:'!==_0x5850a7['protocol']?null:_0x5850a7['toString']();}catch{return null;}}(_0x355ec0['plainText']);if(_0x1fbd0b)return{'type':'url','url':_0x1fbd0b};}const _0x431d4e=_0x355ec0['forceTextAttachment']?0x1:_0x5856a1['longTextThreshold']??0x1/0x0;if(_0x355ec0['plainText']['length']>=Math['max'](_0x431d4e,0x1)&&_0x5856a1['filesEnabled']){const _0x4fc6d0=_0x5856a1['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x355ec0['plainText']],_0x4fc6d0,{'type':'text/plain'})]};}return null;}var er=class extends _0x898608{activeConversation;_aiEditing;_aiConnector;_aiChatUi;['_aiModels'];_aiContextLibrary;_contextLibrarySource=null;_hasAIChatBalloon=!0x1;_activeBalloon;_reporter;_batchToChanges=new Map();_currentPreviewedChangeGroup=null;_bodyCollection;_channelsToEditors=new Map();static get requires(){return[Is,Nn,_0x45dea0,fs];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['set']('isConversationReady',!0x1),this['_bodyCollection']=Mn(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['_aiModels']=this['context']['plugins']['get'](fs)['models'],this['_aiContextLibrary']=this['context']['plugins']['get'](fs)['contextLibrary'];const _0x390c1d=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x1c078a,_0x4c7ff2)=>{this['sendMessage']({'message':_0x4c7ff2});}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',()=>{this['activeConversation']?.['stopProcessing']();}),this['listenTo'](_0x390c1d['view'],'change:activeTab',(_0x3654db,_0x10d56a,_0x4be490)=>{'chat'!==_0x4be490&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x242695,_0x385aaa)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x385aaa));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x23e2fc,_0x36d811)=>{this['activeConversation']?.['addUrlToContext'](_0x36d811);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x2b1672,_0x595704)=>{const _0xbb2ed1=this['activeConversation'];if(!_0xbb2ed1)return;_0x595704['hasDirectory']&&(_0x595704['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+kt()}));const _0x38f672=tr(_0x595704,{'pastedTextLabel':Es(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')});_0x38f672&&(_0x595704['preventDefault'](),'url'===_0x38f672['type']?_0xbb2ed1['addUrlToContext'](_0x38f672['url']):_0xbb2ed1['chatContext']['addFilesToContext'](_0x38f672['files'],void 0x0,_0x38f672['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x5ec078,_0xac78b0)=>{_0xac78b0['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x17bd65,_0x5d3ccf)=>{this['activeConversation']?.['addResourceToContext'](_0x5d3ccf['source'],_0x5d3ccf['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x3f41f0,_0x145b2e)=>{this['_removeFromContext'](_0x145b2e);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x35357b,_0x248cdb)=>{this['activeConversation']?.['loadSourceResources'](_0x248cdb['sourceId'],_0x248cdb['query'],_0x248cdb['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x20e6de,_0x4030a9)=>{this['activeConversation']?.['setModel'](_0x4030a9);}),this['listenTo'](this['_aiChatUi'],'like',(_0x3f0c40,{replyId:_0x1e5064})=>{console['log']('Liked\x20response',_0x1e5064);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x2621df,{replyId:_0x199c19})=>{console['log']('Disliked\x20response',_0x199c19);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0xd615b2,_0x51e511)=>{this['_insertSuggestion'](_0x51e511);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x2da1a3,{replyId:_0x243ae5,partIndex:_0x1517f7})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x243ae5,_0x1517f7);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x3ab93a,{replyId:_0x45fe58,partIndex:_0x2955a6})=>{const _0x4fb5d0=this['_getDocumentRangeForReplyChanges'](_0x45fe58,_0x2955a6);if(!_0x4fb5d0)return;const {reply:_0x4eeaef}=this['getInteractionAndReplyById'](_0x45fe58);'$graveyard'!=_0x4fb5d0['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x4eeaef['changeGroups'][_0x2955a6]['editor'],'ranges':[_0x4fb5d0['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x5c0f25,_0x3e09ad)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x3e09ad);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x8403f6,{replyId:_0x5a2678,showDiff:_0x2be8b5})=>{const {interaction:_0xfec765,reply:_0x2217d9}=this['getInteractionAndReplyById'](_0x5a2678),_0x1256c8=_0x2217d9['getContentParts']({'showDiff':_0x2be8b5});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0xfec765['id']+':'+_0x2217d9['id'],'parts':_0x1256c8});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x1afdf9,{replyId:_0x2d81a9,partIndex:_0x13986f})=>{this['_rejectSuggestion']({'replyId':_0x2d81a9,'partIndex':_0x13986f}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x516fe5,_0x257ab0)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x257ab0);}),this['on']('replyCreated',(_0x83a8b6,_0x1e0f1a)=>{this['_addFeedItemReply'](_0x1e0f1a);});}afterInit(){this['context']instanceof _0x24cd6f?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x2483b0,_0x252324)=>{_0x252324['on']('ready',()=>{this['_integrateEditor'](_0x252324);});}),this['context']['config']['get']('ai.chat.context')?.['contextLibrary']?.['enabled']&&this['_setUpContextLibrarySource'](),this['_initConversation']();}async _initConversation(){const _0x52fce7=this['context']['config']['get']('ai.chat.initialConversation');let _0x1384b4=_0x52fce7;('lastCreated'!=_0x52fce7||(_0x1384b4=await this['_getLastCreatedConversationId'](),_0x1384b4))&&('new'==_0x1384b4?await this['_startConversationSafely']():await this['loadConversation'](_0x1384b4));}async destroy(){return this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async loadConversation(_0x289994){this['_closeActiveBalloon'](),this['context']['plugins']['get'](gs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['_detachFromActiveConversation'](),this['_stopLastInteraction'](),this['_aiChatUi']['toggleConversationLoading'](!0x0);try{this['_aiChatUi']['emptyConversationTitle'](),await this['_aiConnector']['fetchConversation'](_0x289994)['getConversation'](),await this['_startConversationSafely']({'id':_0x289994}),await this['activeConversation']['load'](_0x289994),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext'](),this['set']('isConversationReady',!0x0),this['activeConversation']?.['currentInteraction']?this['_aiChatUi']['enableControls']():this['_aiChatUi']['toggleConversationLoading'](!0x1);}catch(_0x3f555e){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x289994}),this['_reporter']['logError'](new ct('ai-chat-conversation-not-found',this,void 0x0,_0x3f555e),{'context':{'operation':'load-conversation'}}),await this['_stopLastInteraction'](),this['_aiChatUi']['disableControls'](),this['set']('isConversationReady',!0x1),this['_aiChatUi']['resetChatBusyStateToIdle'](),this['activeConversation']?.['cancelLastInteractionStream']();}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}registerToolDataCallback(_0x5959da){let _0x1d4e32=null,_0x432505=null;this['on']('toolDataReceived',(_0x1d3c28,_0x44d047,_0xfefbfb)=>{_0xfefbfb['id']!==_0x1d4e32&&(_0x1d4e32=_0xfefbfb['id'],_0x432505=this['_getAIChatFeedAPI'](_0xfefbfb)),_0x5959da(_0x44d047,_0x432505);});}addCurrentDocumentToChatContext(){bs(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](Es(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async addSelectionToChatContext(_0x33e40c){const _0x44c443=this['_aiEditing']['getSelectionText'](_0x33e40c);this['activeConversation']?.['addSelectionToContext'](_0x44c443),this['addCurrentDocumentToChatContext']();}removeSelectionFromChatContext(){this['activeConversation']?.['removeSelectionFromContext']();}focusPromptInput(){this['_aiChatUi']['focusPromptInput']();}async startConversation(_0x258683){await this['_startConversationSafely']({'modelId':_0x258683?.['modelId'],'contexts':_0x258683?.['contexts']});}async['sendMessage']({message:_0xbcf82f,attributes:_0x1c52ea}){if(!this['activeConversation'])throw new ct('ai-chat-controller-no-active-conversation');this['activeConversation']['id']&&this['activeConversation']['isStarted']&&(this['_aiChatUi']['startInteraction'](),await this['activeConversation']['handleUserInteraction']({'userMessage':_0xbcf82f,'attributes':_0x1c52ea}));}getGroupId(){const _0x1f9c0e=this['context']['config']['get']('collaboration.channelId');if(!_0x1f9c0e)throw new ct('ai-missing-channel-id',this);return _0x1f9c0e;}_handleRemovedConversation(_0x5810fc){this['activeConversation']['id']===_0x5810fc&&this['_startConversationSafely']();}['_isGroupReadOnly'](_0x141838){return!(!_0x141838['editor']||'destroyed'===_0x141838['editor']['state']||!_0x141838['editor']['isReadOnly']);}_isGroupWriteable(_0x49661e){return!(!_0x49661e['editor']||'destroyed'===_0x49661e['editor']['state']||_0x49661e['editor']['isReadOnly']);}_computeSuggestionGating(_0x221090){const _0x5b5cc4=new Map();for(const _0x3363e9 of _0x221090['changeGroups'])_0x5b5cc4['set'](_0x3363e9['index'],this['_isGroupReadOnly'](_0x3363e9));const _0x439057=new Set(_0x221090['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']})['filter'](_0x499f95=>_0x499f95['hasChanges'])['map'](_0x35862c=>_0x35862c['index']));return{'readOnlyByIndex':_0x5b5cc4,'isAcceptAllEnabled':_0x221090['changeGroups']['some'](_0x7bb290=>'pending'===_0x7bb290['state']&&this['_isGroupWriteable'](_0x7bb290)&&_0x439057['has'](_0x7bb290['index']))};}_refreshSuggestionGating(){if(this['activeConversation']){for(const _0x29998f of this['activeConversation']['interactions'])for(const _0x2746f5 of _0x29998f['replies'])'modification'===_0x2746f5['type']&&this['_aiChatUi']['hasFeedItem'](_0x2746f5['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x2746f5['id'],this['_computeSuggestionGating'](_0x2746f5));}if(this['_activeBalloon']&&this['_currentPreviewedChangeGroup']){const {reply:_0x327603}=this['getInteractionAndReplyById'](this['_currentPreviewedChangeGroup']['replyId']),_0x28518d=_0x327603['changeGroups']['find'](_0x4added=>_0x4added['index']===this['_currentPreviewedChangeGroup']['partIndex']);_0x28518d&&this['_activeBalloon']['setTargetReadOnly'](this['_isGroupReadOnly'](_0x28518d));}}_prepareDocumentSuggestions(_0x103a70){const {reply:_0x242d8b,interaction:_0x14ed69}=this['getInteractionAndReplyById'](_0x103a70['replyId']),_0x1435e2=void 0x0!==_0x103a70['partIndex']?[_0x242d8b['changeGroups'][_0x103a70['partIndex']]]:_0x242d8b['changeGroups']['filter'](_0x4f3d4d=>'pending'===_0x4f3d4d['state']&&!this['_isGroupReadOnly'](_0x4f3d4d)),_0x3e6c20=_0x1435e2['map'](_0x128d1b=>_0x242d8b['changeGroups']['indexOf'](_0x128d1b)),_0x4eabc7=qs(_0x242d8b['changeGroups'],_0x242d8b['documentContextContent']);return _0x3e6c20['forEach'](_0xea218f=>{if(_0x4eabc7['has'](_0xea218f))return;const _0x20dc16=this['_getDocumentRangeForReplyChanges'](_0x103a70['replyId'],_0xea218f);_0x20dc16&&'$graveyard'!=_0x20dc16['range']['root']['rootName']?(_0x242d8b['setChangeGroupState'](_0xea218f,'accepted'),void 0x0!==_0x103a70['partIndex']&&this['_scrollToSuggestionRange'](_0x20dc16['range'],!0x1,_0x20dc16['targetEditor'])):_0x242d8b['setChangeGroupState'](_0xea218f,'outdated',this['_getOutdatedReason'](_0x242d8b['changeGroups'][_0xea218f]));}),Zn({'groups':_0x1435e2['filter'](_0x75ba1c=>'accepted'===_0x75ba1c['state']),'documentContextContent':_0x242d8b['documentContextContent'],'documents':_0x14ed69['getDocumentContext']()?.['documents']??[]});}_insertSuggestion(_0x25edda){const _0x417a3d=this['context']['plugins']['get'](_0x45dea0),{reply:_0x5ad4d1,interaction:_0x32e087}=this['getInteractionAndReplyById'](_0x25edda['replyId']),_0x43c1b5=this['_prepareDocumentSuggestions'](_0x25edda),_0x1b47cf=Jn({'documentSuggestions':_0x43c1b5,'transform':!0x0,'documentCompare':_0x417a3d,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0x13082c,_0x53afb7]of _0x1b47cf){const {editor:_0x74ffe7,indexes:_0x5a4a60}=_0x43c1b5['get'](_0x13082c);if(!_0x74ffe7['plugins']['has']('TrackChanges')){St('ai-no-track-changes',{'editor':_0x74ffe7});continue;}let _0x133b9f;mn(_0x53afb7,'chat'),_0x74ffe7['model']['change'](_0x1e753a=>{_0x133b9f=_0x1e753a['batch'],_0x74ffe7['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x53afb7),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x133b9f,{'interactionId':_0x32e087['id'],'replyId':_0x5ad4d1['id'],'indexes':_0x5a4a60});}this['_updateRatings'](_0x5ad4d1);}_applySuggestion(_0x338ca0){const _0x2ae70e=this['context']['plugins']['get'](_0x45dea0),{reply:_0x296e06,interaction:_0x5bd006}=this['getInteractionAndReplyById'](_0x338ca0['replyId']),_0x2215da=this['_prepareDocumentSuggestions'](_0x338ca0),_0x2fa797=Jn({'documentSuggestions':_0x2215da,'transform':!0x0,'documentCompare':_0x2ae70e,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0x5e2dd2,_0x5db22d]of _0x2fa797){const {editor:_0x29524f,indexes:_0x4ba2e4}=_0x2215da['get'](_0x5e2dd2);let _0x3c0d13;mn(_0x5db22d,'chat');try{_0x29524f['model']['change'](_0x3689f3=>{_0x3c0d13=_0x3689f3['batch'],_0x2ae70e['applyOperations'](_0x3689f3,_0x5db22d);}),this['_batchToChanges']['set'](_0x3c0d13,{'interactionId':_0x5bd006['id'],'replyId':_0x296e06['id'],'indexes':_0x4ba2e4});}catch(_0x14764a){throw this['_reporter']['logError'](new yn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x14764a})),_0x14764a;}}this['_updateRatings'](_0x296e06);}_rejectSuggestion(_0x9b063c){const {reply:_0x12678a}=this['getInteractionAndReplyById'](_0x9b063c['replyId']);_0x12678a['setChangeGroupState'](_0x9b063c['partIndex'],'rejected');}['_openBalloonFor'](_0x55ccc,_0x425262){if(!this['_hasAIChatBalloon'])return;const {reply:_0x3dce05}=this['getInteractionAndReplyById'](_0x55ccc),_0x574563=_0x3dce05['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x574563['length'])return;let _0xd8b8a4,_0x148fc6;if(void 0x0!==_0x425262?(_0x148fc6=_0x574563['find'](_0x5277b6=>_0x5277b6['index']==_0x425262),_0xd8b8a4=_0x148fc6?.['index']):(_0x148fc6=_0x574563[0x0],_0xd8b8a4=_0x148fc6['index']),!_0x148fc6)return void _0x3dce05['setChangeGroupState'](_0x425262??0x0,'outdated','editor-removed');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x55ccc&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0xd8b8a4)return;const _0x258600=this['_getUserPresentableContentPartDocumentRange'](_0x55ccc,_0x3dce05,_0x148fc6),_0x5a52c6=_0x3dce05['changeGroups']['find'](_0x2f534a=>_0x2f534a['index']==_0xd8b8a4),_0x51d79e=_0x5a52c6['editor'],_0x3e33fd=_0x51d79e['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x3e33fd&&this['_activeBalloon']['close'](),!_0x258600)return _0x3e33fd['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x3e33fd,this['_currentPreviewedChangeGroup']={'replyId':_0x55ccc,'partIndex':_0xd8b8a4},this['_scrollToSuggestionRange'](_0x258600,!0x0,_0x51d79e);const _0x2bd328=this['_getPresentableSiblingContentPartIndex'](_0x55ccc,_0xd8b8a4,'next');_0x3e33fd['clearContent'](),_0x3e33fd['updateContent']({'part':_0x148fc6,'renderingStrategy':'static'}),_0x3e33fd['open']({'index':_0xd8b8a4,'title':Es(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0xd8b8a4+0x1)['toString']()),'showRotator':null!==_0x2bd328,'ranges':[_0x258600],'areActionsDisabled':_0x3dce05['areActionsDisabled'],'targetEditor':_0x51d79e,'isTargetReadOnly':this['_isGroupReadOnly'](_0x5a52c6)}),_0x3e33fd['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x55ccc,_0xd8b8a4),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x55ccc,'index':_0xd8b8a4,'isActive':!0x0});}_closeActiveBalloon(){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}_getPresentableSiblingContentPartIndex(_0xff3018,_0x3443cf,_0xaf50a6){const {reply:_0x36cdd1}=this['getInteractionAndReplyById'](_0xff3018),_0x21a591=_0x36cdd1['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x21a591['length'])return null;const _0x58a799='next'==_0xaf50a6?0x1:-0x1;function _0x1b54e5(_0x24052a){const _0x39c3fc=(_0x24052a+_0x58a799+_0x21a591['length'])%_0x21a591['length'];return{'siblingIndex':_0x39c3fc,'siblingPart':_0x21a591[_0x39c3fc]};}const _0x5ce040=_0x21a591['findIndex'](_0x3fb182=>_0x3fb182['index']==_0x3443cf);let {siblingIndex:_0x1b23e8,siblingPart:_0x35d7d5}=_0x1b54e5(_0x5ce040);for(;!this['_getUserPresentableContentPartDocumentRange'](_0xff3018,_0x36cdd1,_0x35d7d5);)if({siblingIndex:_0x1b23e8,siblingPart:_0x35d7d5}=_0x1b54e5(_0x1b23e8),_0x1b23e8===_0x5ce040)return null;return _0x35d7d5['index'];}_getOutdatedReason(_0x2c714e){return _0x2c714e?.['editor']&&'destroyed'!==_0x2c714e['editor']['state']?'content-removed':'editor-removed';}_getUserPresentableContentPartDocumentRange(_0x2df3ba,_0x563a00,_0x3b4305){const _0x4658ec=_0x563a00['changeGroups'];if(!_0x3b4305['hasChanges'])return null;const _0xc0ca00=_0x4658ec['find'](_0x5e735e=>_0x5e735e['index']==_0x3b4305['index']);if('pending'!==_0xc0ca00?.['state'])return null;if(!_0xc0ca00?.['editor']||'destroyed'===_0xc0ca00['editor']['state'])return _0x563a00['setChangeGroupState'](_0x3b4305['index'],'outdated',this['_getOutdatedReason'](_0xc0ca00)),null;const _0x2a6ff2=this['_getDocumentRangeForReplyChanges'](_0x2df3ba,_0x3b4305['index']);if(!_0x2a6ff2)return _0x563a00['setChangeGroupState'](_0x3b4305['index'],'outdated',this['_getOutdatedReason'](_0xc0ca00)),null;const {range:_0x1bb23d,currentIndex:_0x3bd90d}=_0x2a6ff2;return'$graveyard'==_0x1bb23d['root']['rootName']?(_0x563a00['setChangeGroupState'](_0x3bd90d,'outdated',this['_getOutdatedReason'](_0xc0ca00)),null):_0x2a6ff2['range'];}_getDocumentRangeForReplyChanges(_0x5b8463,_0x34c77a){const {reply:_0x318106,interaction:_0xb712bb}=this['getInteractionAndReplyById'](_0x5b8463),_0x284877=_0x318106['changeGroups']['filter'](_0x56e8a7=>'pending'==_0x56e8a7['state']),_0x42c4b1=_0x284877['map'](_0x38a605=>_0x318106['changeGroups']['indexOf'](_0x38a605));void 0x0===_0x34c77a&&(_0x34c77a=_0x42c4b1[0x0]);const _0x20392d=_0x42c4b1['indexOf'](_0x34c77a);if(-0x1==_0x20392d)return null;const _0x4cb7a8=_0x284877[_0x20392d],_0x22ccc6=_0x4cb7a8['editor'];if(!_0x22ccc6||'destroyed'===_0x22ccc6['state'])return null;const _0x40c8b4=Gs(_0x22ccc6,_0x4cb7a8['rootName']),_0x502656=_0x318106['documentContextContent']['get'](_0x4cb7a8['documentId']),_0x3e2343=new _0x139fbf([]),_0x187511=new _0x139fbf([]);for(const _0x909f6b of _0x4cb7a8['changes'])if('removed'!=_0x909f6b['type']&&_0x187511['children']['push'](_0x909f6b['node']['cloneNode'](!0x0)),'new'!=_0x909f6b['type']){const _0x1eec3a=_0x228c3a(_0x3d13b0=>Ps(_0x3d13b0,'data-id')==_0x909f6b['id'],_0x502656,!0x0);_0x3e2343['children']['push'](_0x1eec3a['cloneNode'](!0x0));}if(0x0==_0x3e2343['children']['length']){if(_0x4cb7a8['changes'][0x0]['anchorId']){const _0x5ae39f=vs('data-id',_0x4cb7a8['changes'][0x0]['anchorId'],_0x502656);_0x3e2343['children']['unshift'](_0x5ae39f['cloneNode'](!0x0)),_0x187511['children']['unshift'](_0x5ae39f['cloneNode'](!0x0)),_0x5ae39f['nextSibling']&&(_0x3e2343['children']['push'](_0x5ae39f['nextSibling']['cloneNode'](!0x0)),_0x187511['children']['push'](_0x5ae39f['nextSibling']['cloneNode'](!0x0)));}else{const _0x5b419e=_0x502656['children'][0x0];if(!_0x5b419e)return null;_0x3e2343['children']['push'](_0x5b419e['cloneNode'](!0x0)),_0x187511['children']['push'](_0x5b419e['cloneNode'](!0x0));}}if(_0x40c8b4&&qs(_0x318106['changeGroups'],_0x318106['documentContextContent'])['has'](_0x4cb7a8['index']))return null;const _0x2d4323=_0xb712bb['getDocumentContext'](),_0x2aec6f=_0x2d4323['documents']['find'](_0x1a5c3c=>_0x1a5c3c['id']==_0x4cb7a8['documentId'])['content'],_0x4ba32d=_0x22ccc6['model']['document']['getRoot'](_0x4cb7a8['rootName']),_0x5def9d=_0x22ccc6['data']['parse'](_0x2aec6f,_0x4ba32d),_0x47abbe=_0x40c8b4?Ws(Os(_0x3e2343)):Os(_0x3e2343),_0x14284f=_0x22ccc6['data']['parse'](_0x47abbe,_0x4ba32d),_0x29d628=_0x22ccc6['data']['parse'](_0x47abbe,_0x4ba32d),_0x2bd9b2=_0x22ccc6['model']['createPositionAt'](_0x14284f,0x0),_0x487f94=_0x40c8b4?Ws(Os(_0x187511)):Os(_0x187511),_0x75ebb={'targetEditor':_0x22ccc6,'anchor':_0x2bd9b2,'markDeletions':!0x1};let _0x19e658;try{_0x19e658=_0x22ccc6['plugins']['get'](_0x45dea0)['getDiff'](_0x47abbe,_0x487f94,_0x75ebb)['getOperations']();}catch(_0x31d39e){return this['_reporter']['reportError'](new yn({'code':'ai-chat-suggestion-diff-failed','type':'runtime','severity':'warning','cause':_0x31d39e,'context':{'replyId':_0x5b8463,'partIndex':_0x34c77a}})),null;}if(!_0x19e658['length'])return null;_0x22ccc6['model']['change'](_0x4f778e=>{for(const _0x482a3e of _0x19e658)if(!_0x9fd625(_0x482a3e)){if('remove'==_0x482a3e['type']){const _0x409d4d=_0x482a3e['sourcePosition'],_0x2bd69b=_0x482a3e['howMany'],_0x51cc2d=new _0x4f656c(_0x409d4d,_0x2bd69b);_0x4f778e['batch']['addOperation'](_0x51cc2d),_0x22ccc6['model']['applyOperation'](_0x51cc2d);}else'marker'!==_0x482a3e['type']&&(_0x482a3e['baseVersion']=null,_0x482a3e['isDocumentOperation']=!0x1,_0x4f778e['batch']['addOperation'](_0x482a3e),_0x22ccc6['model']['applyOperation'](_0x482a3e));}});const _0x3dd35e=_n(_0x22ccc6,_0x19e658,_0x14284f);An(_0x22ccc6['model'],_0x3dd35e);const _0x1eee3e=_0x3dd35e['getFirstRange']()['start']['path']['slice'](),_0xcbdeac=_0x3dd35e['getFirstRange']()['end']['path']['slice'](),_0x57a4ee=[];let _0x415ed6=_0x14284f,_0x1daa15=_0x29d628;for(let _0x4d4a67=0x0;_0x4d4a67<_0xcbdeac['length'];_0x4d4a67++){const _0x1373e4=_0x415ed6['maxOffset']-_0xcbdeac[_0x4d4a67];_0x57a4ee[_0x4d4a67]=_0x1daa15['maxOffset']-_0x1373e4,_0x415ed6=_0x415ed6['getChildAtOffset'](_0xcbdeac[_0x4d4a67]),_0x1daa15=_0x1daa15['getChildAtOffset'](_0x57a4ee[_0x4d4a67]);}const _0x1e782c=_0x22ccc6['model']['createRange'](_0x22ccc6['model']['createPositionFromPath'](_0x29d628,_0x1eee3e),_0x22ccc6['model']['createPositionFromPath'](_0x29d628,_0x57a4ee)),_0x24c415=_0x1e782c['start']['path']['slice'](),_0x3103df=_0x1e782c['end']['path']['slice']();if(!_0x40c8b4){const _0x3299c9=_0x29d628['getChild'](0x0)['getAttribute'](_0x4fabc2),_0x535f8f=Array['from'](_0x5def9d['getChildren']())['find'](_0x36ecc5=>_0x36ecc5['getAttribute'](_0x4fabc2)==_0x3299c9)['getPath']();_0x24c415[0x0]=_0x535f8f[0x0]+_0x24c415[0x0],_0x3103df[0x0]=_0x535f8f[0x0]+_0x3103df[0x0];}let _0x5707e9=_0x22ccc6['model']['createRange'](_0x22ccc6['model']['createPositionFromPath'](_0x22ccc6['model']['document']['getRoot'](_0x4cb7a8['rootName']),_0x24c415),_0x22ccc6['model']['createPositionFromPath'](_0x22ccc6['model']['document']['getRoot'](_0x4cb7a8['rootName']),_0x3103df));const _0x34c40b=_0x2d4323['documents']['find'](_0x536fde=>_0x536fde['id']==_0x4cb7a8['documentId'])['version'],_0x5b56c1=_0x22ccc6['model']['document']['history']['getOperations'](_0x34c40b);for(const _0x4d5761 of _0x5b56c1)_0x5707e9=_0x2827cc['_createFromRanges'](_0x5707e9['getTransformedByOperation'](_0x4d5761));return{'range':_0x5707e9,'currentIndex':_0x34c77a,'targetEditor':_0x22ccc6};}_integrateEditorBalloon(_0x3dcfbb){if(!_0x3dcfbb['plugins']['has']('AIChatBalloon'))return;const _0x2caab3=_0x3dcfbb['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x2caab3['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x2caab3,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x520da7,partIndex:_0x9bb9dc}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x168d21}=this['getInteractionAndReplyById'](_0x520da7),_0x428c55=_0x168d21['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x9bb9dc});_0x2caab3['updateContent']({'part':_0x428c55[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x2caab3,'applySuggestion',()=>{const {replyId:_0xeddb07,partIndex:_0x2d1989}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0xeddb07,'partIndex':_0x2d1989}),_0x2caab3['setState']('accepted');}),this['listenTo'](_0x2caab3,'insertSuggestion',()=>{const {replyId:_0x39878f,partIndex:_0x3c0d3f}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x39878f,'partIndex':_0x3c0d3f}),_0x2caab3['setState']('accepted');}),this['listenTo'](_0x2caab3,'rejectSuggestion',()=>{const {replyId:_0x20443b,partIndex:_0x3c7006}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x20443b,'partIndex':_0x3c7006}),_0x2caab3['setState']('rejected');}),this['listenTo'](_0x2caab3,'showNext',()=>{const {replyId:_0xfc2b02,partIndex:_0x20c3c1}=this['_currentPreviewedChangeGroup'],_0x23e074=this['_getPresentableSiblingContentPartIndex'](_0xfc2b02,_0x20c3c1,'next');null!==_0x23e074&&this['_openBalloonFor'](_0xfc2b02,_0x23e074);}),this['listenTo'](_0x2caab3,'showPrevious',()=>{const {replyId:_0x1c8062,partIndex:_0x4de369}=this['_currentPreviewedChangeGroup'],_0x44b7c3=this['_getPresentableSiblingContentPartIndex'](_0x1c8062,_0x4de369,'previous');null!==_0x44b7c3&&this['_openBalloonFor'](_0x1c8062,_0x44b7c3);}),this['listenTo'](_0x2caab3,'dialogClosed',(_0x118ab,{id:_0x1be75b})=>{if('aiChatBalloon'!==_0x1be75b)return;const {replyId:_0x5a86a0,partIndex:_0x5078fc}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x5a86a0,'index':_0x5078fc,'isActive':!0x1}),this['_activeBalloon']===_0x2caab3&&(this['_activeBalloon']=void 0x0);});}_integrateEditor(_0x5944ef){if(this['_channelsToEditors']['set'](_0x5944ef['config']['get']('collaboration.channelId'),_0x5944ef),this['_integrateEditorBalloon'](_0x5944ef),this['addCurrentDocumentToChatContext'](),this['listenTo'](_0x5944ef,'change:isReadOnly',()=>this['_refreshSuggestionGating']()),_0x5944ef['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x5944ef['plugins']['has']('Undo')){const _0x52422e=_0x5944ef['commands']['get']('undo'),_0x52e0ec=_0x5944ef['commands']['get']('redo');this['listenTo'](_0x52422e,'revert',(_0x18ce9b,_0xab2b8c,_0x2093c8)=>{const _0x3d0556=this['_batchToChanges']['get'](_0xab2b8c);if(!_0x3d0556)return;const _0x27f76a=this['activeConversation']['getInteraction'](_0x3d0556['interactionId']),_0x101e93=_0x27f76a?.['getReply'](_0x3d0556['replyId']);this['_batchToChanges']['delete'](_0xab2b8c),_0x27f76a&&_0x101e93&&(_0x3d0556['indexes']['forEach'](_0x29ebf3=>_0x101e93['setChangeGroupState'](_0x29ebf3,'pending')),this['_batchToChanges']['set'](_0x2093c8,_0x3d0556));}),this['listenTo'](_0x52e0ec,'revert',(_0x49fa21,_0x26c5ef,_0x5f2021)=>{const _0x4be27f=this['_batchToChanges']['get'](_0x26c5ef);if(!_0x4be27f)return;const _0x451526=this['activeConversation']['getInteraction'](_0x4be27f['interactionId']),_0x5e6640=_0x451526?.['getReply'](_0x4be27f['replyId']);this['_batchToChanges']['delete'](_0x26c5ef),_0x451526&&_0x5e6640&&(_0x4be27f['indexes']['forEach'](_0x1d3028=>_0x5e6640['setChangeGroupState'](_0x1d3028,'accepted')),this['_batchToChanges']['set'](_0x5f2021,_0x4be27f));});}const _0x4bdabc=_0x5944ef['config']['get']('ai.chat.context');_0x4bdabc['alwaysAddSelection']&&_0x4bdabc['document']['enabled']&&this['listenTo'](_0x5944ef['model']['document']['selection'],'change:range',(_0x3a5934,_0x3ed177)=>{_0x3ed177['directChange']&&'chat'===_0x5944ef['plugins']['get']('AITabs')['view']['activeTab']&&(_0x5944ef['model']['hasContent'](_0x5944ef['model']['document']['selection'])?this['addSelectionToChatContext'](_0x5944ef):this['removeSelectionFromChatContext']());});}async _getLastCreatedConversationId(){const _0x4fc653=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x1cf989=await _0x4fc653['getConversations']();return _0x1cf989['length']?_0x1cf989[0x0]['id']:'new';}catch(_0x265f67){return this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':kt()}),this['_reporter']['logError'](new ct('ai-chat-conversation-init-failed',this,{'error':_0x265f67})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async _startConversationSafely(_0x4707c8={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x4707c8),_0x4707c8['id']||this['set']('isConversationReady',!0x0);}catch(_0x2ea3d4){this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x4707c8['id']||kt()}),this['_reporter']['logError'](_0x2ea3d4),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}_detachFromActiveConversation(){this['_aiChatUi']['setIsUploadInProgress'](!0x1),this['activeConversation']&&this['stopListening'](this['activeConversation']);}async _handleStartConversation({id:_0x5368b1,modelId:_0x3ef69b,contexts:_0x52e02f}={}){this['_detachFromActiveConversation'](),this['_closeActiveBalloon']();let _0x255f8e=_0x3ef69b;_0x255f8e||(_0x5368b1||!this['activeConversation']?_0x255f8e=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x255f8e=this['activeConversation']['selectedModel']?.['id'])),this['_stopLastInteraction']();const _0x3fc30c=this['getGroupId'](),_0x16b78e=_0x5368b1||kt(),_0x3cd90e=await this['_aiModels']['getAvailableModels']();let _0x5dacb3;this['activeConversation']=new jn({'connector':this['_aiConnector'],'chatModels':this['_aiModels'],'selectedModelId':_0x255f8e,'conversationId':_0x16b78e,'group':_0x3fc30c,'locale':this['context']['locale'],'isFromHistory':!!_0x5368b1,'channelsToEditors':this['_channelsToEditors'],'contextLibrary':this['_aiContextLibrary'],'extraContexts':_0x52e02f,'getSessionId':_0x247e7d=>this['_aiEditing']['getSessionId'](_0x247e7d),'aiEditing':this['_aiEditing']}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',()=>{this['_aiChatUi']['createConversation']({'availableModels':_0x3cd90e}),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x5368b1||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x19cedd,_0xf69230)=>{this['_aiChatUi']['setIsUploadInProgress'](_0xf69230['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x337786=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x337786);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0xe21202=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0xe21202);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0xbbc132,_0x5d4e8f)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x5d4e8f,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x33c8e6,_0x44e473)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x44e473,{'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',(_0x185692,_0xdc11a4)=>{this['_aiChatUi']['removeFeedInteraction'](_0xdc11a4['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x5a7f62,_0x1ccf93,_0x180197)=>{this['_updateConversationTitle'](_0x1ccf93,_0x180197);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x4a5097,_0x22b68d)=>{void 0x0!==_0x5dacb3&&_0x5dacb3!==_0x22b68d['id']&&this['_updateReplyContentThrottled']['flush'](),_0x5dacb3=_0x22b68d['id'],_0x22b68d['isFromHistory']?await this['_updateReplyContent']({'reply':_0x22b68d}):await this['_updateReplyContentThrottled']({'reply':_0x22b68d});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x22effc,{reply:_0x188927,index:_0x2168ec,state:_0x4d1163,outdatedReason:_0x325627})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x188927['id'],'index':_0x2168ec,'state':_0x4d1163,'outdatedReason':_0x325627}),this['_aiChatUi']['hasFeedItem'](_0x188927['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x188927['id'],this['_computeSuggestionGating'](_0x188927)),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x188927['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x2168ec&&this['_activeBalloon']?.['setState'](_0x4d1163,_0x325627);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x4b407f,_0x3153ad)=>{if(this['_aiChatUi']['addContextItem'](_0x3153ad['contextItem'],_0x3153ad['isLoading']),'selection'===_0x3153ad['contextItem']['type']){const _0x5b907f=Ss(this['context']),_0x4a6d0b=[..._0x5b907f['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x5b907f,'ranges':_0x4a6d0b,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0xbee8e8,_0x30f979)=>{this['_aiChatUi']['removeContextItem'](_0x30f979['uiId']),'current-document'==_0x30f979['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x30f979['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x4eaf60,_0x133f72)=>{this['_aiChatUi']['setContextItemLoading'](_0x133f72['contextItem']['uiId'],_0x133f72['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x52f418,_0x4b56ba)=>{this['_aiChatUi']['setConversationContext'](_0x4b56ba['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x4e907d,_0x4e539d)=>{this['_aiChatUi']['setAddContextOptions'](_0x4e539d['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x37df21,_0x4e7c3b)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x4e7c3b['sourceId'],_0x4e7c3b['source'],_0x4e7c3b['resources'],_0x4e7c3b['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x3c114c,_0x1d1827)=>{this['_aiChatUi']['updateResourceState'](_0x1d1827['sourceId'],_0x1d1827['resourceId'],_0x1d1827['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x2a2aa4,_0x2ec8b8)=>{this['_aiChatUi']['updateCapabilities'](_0x2ec8b8);}),this['listenTo'](this['activeConversation'],'modelSelected',(_0x203198,_0x31f351)=>{this['_aiChatUi']['setSelectedModel'](_0x31f351['selectedModel']??null,_0x31f351['isDisabled']);}),this['listenTo'](this['activeConversation'],'error',async(_0x111822,{error:_0x521780,interactionId:_0xd1ae7f,fileName:_0x3d50a9,url:_0x238608,sourceId:_0x5e203b,sourceLabel:_0x28ed1f})=>{let _0x49a5c9;const _0x1b6995=_0xd1ae7f?_0xd1ae7f+':'+kt():kt();this['_reporter']['reportError'](_0x521780),this['_aiChatUi']['startAutoScroll'](),_0x521780['message']['startsWith']('ai-request-aborted')?(this['_cancelProcessing'](),this['activeConversation']?.['cancelLastInteractionStream'](),_0x49a5c9=this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Es(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x1b6995})):_0x521780['message']['startsWith']('ai-chat-conversation-init-failed')||_0x521780['message']['startsWith']('ai-chat-conversation-start-failed')?_0x49a5c9=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x1b6995}):_0x521780['message']['startsWith']('ai-chat-file-upload-failed')?_0x49a5c9=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x3d50a9),'id':_0x1b6995}):_0x521780['message']['startsWith']('ai-chat-url-upload-failed')?_0x49a5c9=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x238608),'id':_0x1b6995}):_0x521780['message']['startsWith']('ai-chat-context-invalid-data')?_0x49a5c9=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x1b6995}):_0x521780['message']['startsWith']('ai-chat-context-unsupported-type')?_0x49a5c9=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x1b6995}):_0x521780['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x5e203b&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x5e203b),_0x49a5c9=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x28ed1f||'source'),'id':_0x1b6995})):_0x521780['message']['startsWith']('ai-chat-resource-load-failed')?_0x49a5c9=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x1b6995}):_0x521780['message']['startsWith']('ai-chat-invalid-request')?_0x49a5c9=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x1b6995}):_0x521780['message']['startsWith']('ai-chat-context-unsupported-file-type')?_0x49a5c9=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x1b6995}):_0x521780['message']['startsWith']('ai-chat-context-file-too-large')?_0x49a5c9=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x1b6995}):_0x521780['message']['startsWith']('ai-chat-context-file-too-many-pages')?_0x49a5c9=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x1b6995}):_0x521780['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?_0x49a5c9=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x1b6995}):(this['_cancelProcessing'](),_0x49a5c9=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x1b6995}));try{await Promise['race']([_0x49a5c9,this['_aiChatUi']['idleUiPromise']]);}finally{this['_aiChatUi']['isBusy']||this['_aiChatUi']['stopAutoScroll']();}}),await this['activeConversation']['init'](this['_buildConversationContextConfig']()),_0x5368b1||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']());}_buildConversationContextConfig(){const _0x1082ff=this['context']['config']['get']('ai.chat.context');return this['_contextLibrarySource']?{..._0x1082ff,'sources':[..._0x1082ff?.['sources']??[],this['_contextLibrarySource']]}:_0x1082ff;}async _setUpContextLibrarySource(){const _0x13f048=await this['_createContextLibrarySource']();_0x13f048&&(this['_contextLibrarySource']=_0x13f048,this['activeConversation']&&this['activeConversation']['chatContext']['addContextSource'](_0x13f048));}async _createContextLibrarySource(){let _0x615578;try{_0x615578=await this['_aiContextLibrary']['getAvailableContexts']();}catch{return null;}if(!_0x615578['length'])return null;const _0x362950=_0x615578['map'](_0xa74260=>({'id':_0xa74260['id'],'type':'context','label':_0xa74260['name']||_0xa74260['id']}));return{'id':'ck-ai-context-library','label':Es(this['context']['locale'],'AI_CHAT_CONTEXT_LIBRARY_LABEL'),'useDefaultFiltering':!0x0,'getResources':()=>Promise['resolve'](_0x362950)};}_removeFromContext(_0xcd111){this['activeConversation']?.['removeFromContext'](_0xcd111);}_toggleWebSearch(){this['activeConversation']?.['toggleWebSearch']();}_toggleReasoning(){this['activeConversation']?.['toggleReasoning']();}getInteractionAndReplyById(_0x3bd05e){const [_0x146227,_0xdf96cd]=_0x3bd05e['split'](':'),_0x3511de=this['activeConversation']['getInteraction'](_0x146227);return{'interaction':_0x3511de,'reply':_0x3511de['getReply'](_0xdf96cd)};}_scrollToSuggestionRange(_0x5e22a3,_0x5ede53=!0x1,_0x33610e){const _0xe3e5b3={'target':_0x33610e['editing']['view']['domConverter']['viewRangeToDom'](_0x33610e['editing']['mapper']['toViewRange'](_0x5e22a3)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x5ede53};_0x5ede53&&(_0xe3e5b3['alignToTop']=!0x0),Ot(_0xe3e5b3);}_updateConversationTitle(_0x45226f,_0x18a40e=!0x1){this['_aiChatUi']['setConversationTitle'](_0x45226f||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x18a40e);}_addFeedItemReply(_0x56e78f){'text'===_0x56e78f['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x56e78f):this['_aiChatUi']['addFeedItemAISuggestion'](_0x56e78f);}async _updateReplyContent({reply:_0x36e4d6,renderingStrategy:_0x423662}){const {id:_0x5cd4f9,interactionId:_0x238559,isDone:_0x25d06b,type:_0x1443e9,parsedContent:_0x55e12c}=_0x36e4d6,_0x3ee65f=_0x238559+':'+_0x5cd4f9;if('modification'===_0x1443e9){const _0x565f2e=_0x36e4d6['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x3ee65f,'parts':_0x565f2e,'isDone':_0x25d06b,'skipLoadingEffects':_0x36e4d6['isFromHistory']}),this['_aiChatUi']['hasFeedItem'](_0x36e4d6['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x36e4d6['id'],this['_computeSuggestionGating'](_0x36e4d6));}else'text'===_0x1443e9&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x3ee65f,'parsedContent':_0x55e12c['get']('text'),'renderingStrategy':_0x423662,'isDone':_0x25d06b});_0x25d06b&&_0x36e4d6['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x3ee65f,_0x36e4d6['sources']);}_updateReplyContentThrottled=_0x20eb7b(this['_updateReplyContent']['bind'](this),0xc8);_stopLastInteraction(){this['activeConversation']?.['stopProcessing'](),this['_aiChatUi']['stopInteraction'](this['activeConversation']?.['lastInteraction']),this['_updateReplyContentThrottled']['cancel']();}async _flushLastInteractionUI(){const _0x40b76c=this['activeConversation']?.['lastInteraction'];if(_0x40b76c){for await(const _0x4f6123 of _0x40b76c['replies'])this['_aiChatUi']['hasFeedItem'](_0x4f6123['id'])||this['_addFeedItemReply'](_0x4f6123),await this['_updateReplyContent']({'reply':_0x4f6123,'renderingStrategy':'static'});}}async['_cancelProcessing'](){this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext']();}_updateRatings(_0xe7583f){const _0x56f2d3={'positiveCount':_0xe7583f['changeGroups']['filter'](_0x5a70c4=>'accepted'===_0x5a70c4['state'])['length'],'totalCount':_0xe7583f['changeGroups']['length'],'modificationId':_0xe7583f['id']},_0x357b48=this['activeConversation']['getInteraction'](_0xe7583f['interactionId'])['messageId'];_0x357b48&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x357b48,_0x56f2d3);}_getAIChatFeedAPI(_0x16cf4e){const _0xeb845d=this['_aiChatUi'],_0x9819a8=()=>{_0x16cf4e['resetWebSearchState'](),_0x16cf4e['resetReasoningState'](),_0xeb845d['clearLoadingMessage']();},_0x3671c4=()=>{_0x16cf4e['currentReply']&&(_0x16cf4e['currentReply']['done'](),_0x16cf4e['currentReply']=void 0x0);};return{'insertTextReply':(_0xe9fc7c,_0x32c49a)=>{_0x3671c4(),_0x9819a8();const _0x143ef1=_0x16cf4e['currentReply']=_0x16cf4e['createReply']({'type':'text','interactionId':_0x16cf4e['id'],'id':_0x32c49a||kt(),'channelsToEditors':this['_channelsToEditors']});return _0x143ef1['appendContent'](_0xe9fc7c),_0x3671c4(),_0x143ef1;},'insertCustomElement':async(_0x505339,_0x257902)=>(_0x3671c4(),_0x9819a8(),_0xeb845d['addFeedItemCustomElement'](_0x505339,_0x257902||kt())),'setLoadingMessage':_0x129910=>{_0xeb845d['setLoadingMessage'](_0x129910);},'clearLoadingMessage':()=>{_0xeb845d['clearLoadingMessage']();}};}_checkRemoveCurrentDocumentFromChatContext(){bs(this['context'])['find'](_0x110a7c=>'destroyed'!==_0x110a7c['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}};const ir=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],sr=[...ir,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function nr(_0x59f52f){const _0x464e05=new AbortController();return{'promise':new Promise((_0x220c87,_0x4044ec)=>{const _0x27f822=setTimeout(_0x220c87,_0x59f52f);_0x464e05['signal']['addEventListener']('abort',()=>{clearTimeout(_0x27f822),_0x4044ec();});}),'abortController':_0x464e05};}var rr=class{options;isStreaming=!0x1;document=null;nodesList=[];currentIndex=0x0;timeoutAbortController=null;lastUpdateTime=0x0;constructor(_0x517388){this['options']={'delay':_0x517388?.['delay']??0xa,'textNodeStyle':_0x517388?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async stream({document:_0x29020d,targetElement:_0x5e849b,abortSignal:_0x48904f}){this['isStreaming']&&this['stop'](),_0x48904f?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x2a3383(_0x29020d,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x332971=0x0;_0x332971<this['currentIndex'];_0x332971++)this['nodesList'][_0x332971]['shouldBeStreamed']=!0x0;do{const _0x517263=Date['now'](),_0xdd34d6=this['nodesList'][this['currentIndex']],_0x3f1a53=_0x517263-this['lastUpdateTime'];if(_0xdd34d6){_0xdd34d6['shouldBeStreamed']=!0x0;let _0x2eb281=_0xdd34d6['parent'];for(;_0x2eb281;)_0x2eb281['shouldBeStreamed']=!0x0,_0x2eb281=_0x2eb281['parent'];}if(_0x3f1a53<this['options']['delay'])try{const {promise:_0x2bb616,abortController:_0x4a1aa5}=nr(this['options']['delay']-_0x3f1a53);this['timeoutAbortController']=_0x4a1aa5,await _0x2bb616;}catch(_0x21480b){return;}_0x29a9e2(_0x5e849b,'<'+_0x5e849b['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x5e849b['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:_0x2b1728}){Array['from'](_0x2b1728['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x36f588=>{_0x36f588['replaceWith'](_0x36f588['childNodes'][0x0]);});}stop(){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x5b54af){let _0x101036='';if(function(_0x59febc){return _0x23e8cf(_0x59febc);}(_0x5b54af)){for(const _0x4aa4cc of _0x5b54af['children'])_0x101036+=this['renderNode'](_0x4aa4cc);}else{if(hr(_0x5b54af)){if(!_0x5b54af['shouldBeStreamed'])return'';const _0x4db63a=_0x5b54af,_0x3b1d71=Object['entries'](_0x4db63a['attribs'])['map'](([_0x1c4d33,_0x5f2c67])=>_0x1c4d33+'=\x22'+_0x5f2c67+'\x22')['join']('\x20');_0x101036+='<'+_0x4db63a['tagName']+(_0x3b1d71?'\x20'+_0x3b1d71:'')+'>';for(const _0x5a7ecc of _0x27f885(_0x4db63a))_0x101036+=this['renderNode'](_0x5a7ecc);_0x101036+='</'+_0x4db63a['tagName']+'>';}else{if(!ar(_0x5b54af))return'';if(!_0x5b54af['shouldBeStreamed'])return'';!function(_0x65da16){return!(!_0x65da16['parent']||!hr(_0x65da16['parent']))&&(!!or['includes'](_0x65da16['parent']['tagName'])&&!_0xa4b40a(_0x65da16)['match'](/^\s*[<>]\s*$/));}(_0x5b54af)?_0x101036+=_0x35b927(_0x5b54af):_0x101036+=_0x35b927(new _0x21f244('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x5b54af]));}}return _0x101036;}getParsedDocumentNodeList(){const _0x4b0bbf=[];return function(_0x57b045,_0x14868a){const _0x347cff=_0x295060=>{if(_0x14868a(_0x295060),_0x295060 instanceof _0x71eb2)for(let _0x248413=0x0;_0x248413<_0x295060['children']['length'];_0x248413++){const _0x9e68a1=_0x295060['children'][_0x248413];_0x347cff(_0x9e68a1);}};for(let _0x3ee8ab=0x0;_0x3ee8ab<_0x57b045['children']['length'];_0x3ee8ab++)_0x347cff(_0x57b045['children'][_0x3ee8ab]);}(this['document'],_0xc98e0c=>{if(ar(_0xc98e0c)){const _0x1cd437=this['splitTextNodeIntoWordNodes'](_0xc98e0c);_0x1cd437['length']&&_0x4b0bbf['push'](..._0x1cd437);}_0xc98e0c['isWordSplitSource']||_0xc98e0c['isWordSplitResult']||_0x4b0bbf['push'](_0xc98e0c);}),_0x4b0bbf;}splitTextNodeIntoWordNodes(_0x1fa537){if(_0x1fa537['isWordSplitSource']||_0x1fa537['isWordSplitResult'])return[];const _0x3a6aee=_0xa4b40a(_0x1fa537)['match'](/(?:\s*\S+\s*)/g),_0x4f6957=[];if(_0x3a6aee&&_0x3a6aee['length']>0x1){for(const _0x2e322f of _0x3a6aee){const _0x38d0b9=new _0xa7d61f(_0x2e322f);_0x38d0b9['isWordSplitResult']=!0x0,ti(_0x1fa537,_0x38d0b9),_0x4f6957['push'](_0x38d0b9);}_0x1fa537['isWordSplitSource']=!0x0,_0x47cc1f(_0x1fa537);}return _0x4f6957;}};const or=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function ar(_0x4ec4cb){return _0x5273d9(_0x4ec4cb);}function hr(_0x1bb94d){return _0x545292(_0x1bb94d);}function cr(_0x1712df,_0x506edd){_0x1712df['cleanUpAnimations']({'targetElement':_0x506edd}),_0x506edd['querySelectorAll']('[data-id]')['forEach'](_0x13cacb=>{_0x13cacb['removeAttribute']('data-id');});}var lr=class extends _0x56a514{options;content='';htmlStreamer;['children'];constructor(_0x1ac921){super();const _0x3cab86=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new rr(),this['options']=_0x1ac921,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x3cab86['if']('isDone','ck-ai-chat__feed__item_done'),_0x3cab86['if']('isVisible','ck-hidden',_0x5c3140=>!_0x5c3140),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){cr(this['htmlStreamer'],this['element']),this['isDone']=!0x0;}async streamIntoElement(_0xc6cfcd,_0x4813f4,_0xa0e1f2){await this['htmlStreamer']['stream']({'document':_0xc6cfcd,'targetElement':_0x4813f4,'abortSignal':_0xa0e1f2});}},ur=class extends _0x56a514{['showChangesToggleView'];constructor(_0x2ac414,_0x150d7c){super(_0x2ac414),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new dr(_0x2ac414),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Dn,'label':Es(_0x2ac414,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x150d7c['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x43791b=>_0x43791b?it:et),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x139d71=new $t();_0x139d71['content']=_0x2d99a5,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x150d7c['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x139d71,{'tag':'span','children':[Es(_0x2ac414,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}},dr=class extends Mt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}};const _r={'accepted':_0x48b061,'rejected':_0x572ba4,'outdated':_0x14640e};var gr=class extends _0x56a514{statePillView;constructor(_0x900831){super(_0x900831);const _0x37d075=this['bindTemplate'];this['set']('state','accepted'),this['set']('outdatedReason',void 0x0),this['set']('isVisible',!0x0),this['statePillView']=new _0x5745ee(_0x900831),this['statePillView']['bind']('label')['to'](this,'state',_0x2d1c17=>function(_0x52a3b8,_0x38fbb8){return Es(_0x52a3b8,'AI_SUGGESTION_CONTENT_PART_STATE_'+_0x38fbb8['toUpperCase']());}(_0x900831,_0x2d1c17)),this['statePillView']['bind']('icon')['to'](this,'state',_0x259228=>_r[_0x259228]),this['statePillView']['bind']('class')['to'](this,'state',_0x2bd4e9=>'ck-pill_'+_0x2bd4e9),this['statePillView']['bind']('tooltip')['to'](this,'state',this,'outdatedReason',(_0x43d16f,_0x3bca71)=>function(_0x2663e5,_0x1d19d4,_0x5c77e0){if('outdated'!==_0x1d19d4)return;return Es(_0x2663e5,_0x5c77e0?Ar[_0x5c77e0]:'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP');}(_0x900831,_0x43d16f,_0x3bca71)),this['statePillView']['tooltipPosition']='s',this['statePillView']['tooltipClass']='ck-tooltip_multi-line',this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x37d075['if']('isVisible','ck-hidden',_0x1489c6=>!_0x1489c6)]},'children':[this['statePillView']]});}setState(_0x34240e,_0x2a444f){this['state']=_0x34240e,this['outdatedReason']='outdated'===_0x34240e?_0x2a444f:void 0x0;}};const Ar={'content-removed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP','editor-removed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP','session-changed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP'};var Ir=class extends _0x54b9b5{_applyButton;_suggestButton;constructor(_0x3f177b,_0x6d6273,_0x4f5719){super(_0x3f177b);const _0x4a1cda=Boolean(_0x4f5719);this['set']('isEnabled',!_0x4a1cda),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x230722=[];if(!_0x4a1cda){_0x6d6273['includes']('applySuggestion')&&(this['_applyButton']=new Mt(_0x3f177b),this['_applyButton']['set']({'label':Es(_0x3f177b,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x381a45}),this['_applyButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0x45df4a,_0x390ac7)=>_0x45df4a&&!_0x390ac7),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x320f2a=>!_0x320f2a),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x230722['push'](this['_applyButton'])),_0x6d6273['includes']('insertSuggestion')&&(this['_suggestButton']=new Mt(_0x3f177b),this['_suggestButton']['set']({'label':Es(_0x3f177b,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0xf32bda}),this['_suggestButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0x54c970,_0x2bad00)=>_0x54c970&&!_0x2bad00),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x230722['push'](this['_suggestButton']));const _0x45ab4d=new Mt(_0x3f177b);_0x45ab4d['set']({'label':Es(_0x3f177b,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x194390}),_0x45ab4d['bind']('isEnabled')['to'](this),_0x45ab4d['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x230722['push'](_0x45ab4d);}this['items']['addMany'](_0x230722);const _0x349ee3=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x349ee3['if']('isVisible','ck-hidden',_0x15783a=>!_0x15783a)]}});}setButtonsVisibility({showApplyButton:_0x29ecbe,showSuggestButton:_0x14fe69}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x29ecbe),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x14fe69);}},pr=class extends _0x56a514{toolbarView;stateView;titleLabelView;['children'];constructor(_0x3f90a5,{part:_0xe9aaf8,uiIndex:_0x33b32f,availableActions:_0x12c310,areActionsDisabled:_0x5b0f09}){super(_0x3f90a5),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['toolbarView']=new Ir(_0x3f90a5,_0x12c310,_0x5b0f09),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0xe9aaf8['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0xe9aaf8['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0xe9aaf8['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn','isTargetReadOnly')['to'](this),this['stateView']=new gr(_0x3f90a5),this['titleLabelView']=new Er(_0x3f90a5,_0x33b32f),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',(_0x459055,_0x3b861f,_0x1e2880,_0x5e7e56)=>{'pending'===_0x5e7e56?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x1e2880?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x1e2880,this['outdatedReason']),this['children']['add'](this['stateView']));});}},Er=class extends _0x56a514{constructor(_0x4f28ae,_0x2e9261){super(_0x4f28ae),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Es(_0x4f28ae,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x2e9261['toString']())]});}},mr=class extends _0x56a514{htmlStreamer;constructor(_0xfae6f0){super(_0xfae6f0),this['htmlStreamer']=new rr(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async update({part:_0x2d9a50,renderingStrategy:_0x589126,abortSignal:_0x4fa5bd}){this['_ensureHostElementTag'](_0x2d9a50['wrapperTag']||'div');const _0x460246=_0x2a3383(_0x2d9a50['content'],!0x0);for(const _0x491934 of ys(_0x460246))_0x47cc1f(_0x491934);'streaming'===_0x589126?await this['htmlStreamer']['stream']({'document':_0x460246,'targetElement':this['element'],'abortSignal':_0x4fa5bd}):_0x29a9e2(this['element'],'<'+this['element']['tagName']+'>'+Os(_0x460246)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}cleanUpStreamingArtifacts(){cr(this['htmlStreamer'],this['element']);}_ensureHostElementTag(_0x3c476d){if(!this['element']||this['element']['tagName']['toLowerCase']()===_0x3c476d)return;const _0x2178ea=new _0x24e6f7({'tag':_0x3c476d,'attributes':{'class':this['element']['className']}})['render']();this['element']['replaceWith'](_0x2178ea),this['element']=_0x2178ea;}},Tr=class extends _0x56a514{['_children'];['_headerView'];_streamableContentView;constructor(_0x5d7ea8,{part:_0x5df6a5,uiIndex:_0xe771ce,areActionsDisabled:_0x1d9ed8,availableActions:_0x509541}){super(_0x5d7ea8);const _0x4cbe4d=this['bindTemplate'];this['set']('state',_0x5df6a5['state']),this['set']('outdatedReason',_0x5df6a5['outdatedReason']),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1);const _0xd1df75=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x1d9ed8;};this['on']('change:state',_0xd1df75),this['on']('change:isDone',_0xd1df75),_0xd1df75(),this['_children']=this['createCollection'](),this['_headerView']=new pr(_0x5d7ea8,{'part':_0x5df6a5,'uiIndex':_0xe771ce,'availableActions':_0x509541,'areActionsDisabled':_0x1d9ed8}),this['_headerView']['bind']('isEnabled','outdatedReason','state','isTrackChangesOn','isTargetReadOnly')['to'](this),this['_headerView']['delegate'](...ir)['to'](this),this['_streamableContentView']=new mr(_0x5d7ea8),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x4cbe4d['to']('state',_0x4a29ee=>'ck-ai-suggestion__body__content-part_'+_0x4a29ee),_0x4cbe4d['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x4cbe4d['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x4cbe4d['if']('isVisible','ck-hidden',_0x5853fd=>!_0x5853fd)]},'children':this['_children'],'on':{'mouseenter':_0x4cbe4d['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x5df6a5['index']});}),'mouseleave':_0x4cbe4d['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x5df6a5['index']});}),'click':_0x4cbe4d['to'](_0x3268a2=>{const _0x2e35aa=_0x3268a2['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x2e35aa)&&this['fire']('showChangeInText',{'index':_0x5df6a5['index']});})}});}async updateContent({part:_0x18f75b,showUnchangedParts:_0xf9bd9e=!0x1,abortSignal:_0x15ed23}){this['partDefinition']=_0x18f75b,this['isVisible']=this['partDefinition']['hasChanges']||_0xf9bd9e,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x18f75b,'renderingStrategy':'static','abortSignal':_0x15ed23});}['markAsDone'](){this['isDone']=!0x0;}},wr=class extends _0x56a514{constructor(_0x4f149d,_0x3fad34){super(_0x4f149d),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x2b99a1=>!_0x2b99a1)]},'children':this['_createSkeletonItems'](_0x3fad34)});}_createSkeletonItems(_0x4251b9){const _0x33d024=['ck','ck-ai-skeleton__item'];return _0x4251b9['map'](_0x46ea1b=>{let _0x42afdb='';switch(_0x46ea1b['attributes']['align']){case'right':_0x42afdb='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x42afdb='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x42afdb='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x46ea1b['tag'],'attributes':{'class':[..._0x33d024,_0x46ea1b['attributes']['class']?_0x46ea1b['attributes']['class']:''],'style':'width:\x20'+_0x46ea1b['attributes']['width']+';\x20height:\x20'+_0x46ea1b['attributes']['height']+';'+_0x42afdb}};});}};const Cr={'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':fr(0x5,'100%','44px','right'),'aiChatResources':fr(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 fr(_0x5e14e8,_0x13bc0e,_0x287258,_0x27c54a){return new Array(_0x5e14e8)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x13bc0e,'height':_0x287258,'align':_0x27c54a}}));}const br=/* #__PURE__ -- @preserve */
|
|
33
|
-
dt();var Sr=class extends br{['queue']=[];['isProcessing']=!0x1;_abortController;async['enqueue'](_0xb1c40a){const _0x1e8cda=this['createTask'](_0xb1c40a);return this['queue']['push'](_0x1e8cda),this['_processQueue'](),_0x1e8cda['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(_0x4a530b=>{this['once']('_queueEmpty',()=>{_0x4a530b();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x14cbe7=this['queue']['shift']();try{await _0x14cbe7['callback'](this['_abortController']['signal']),_0x14cbe7['resolve']();}catch(_0x13fa22){_0x14cbe7['reject'](_0x13fa22);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}createTask(_0x25cd61){let _0x3e6990,_0x3ff540;const _0x294430=new Promise((_0x87f307,_0x2997eb)=>{_0x3e6990=_0x87f307,_0x3ff540=_0x2997eb;});return{'callback':_0x25cd61,'resolve':_0x3e6990,'reject':_0x3ff540,'completePromise':_0x294430};}},Rr=class extends lr{constructor(_0xe8b8a9){super(_0xe8b8a9),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0xe8b8a9['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}setContent(_0x1d3eef){this['element']['innerHTML']=_0x1d3eef;}};const Or=['applySuggestion','insertSuggestion'];var vr=class extends _0x56a514{_applyChangesButton;_insertSuggestionsButton;['children'];constructor(_0x52eb56,_0x5a1ebb=[...Or],_0x92aeb3){super(_0x52eb56);const _0x54187e=this['bindTemplate'],_0x38d426=Boolean(_0x92aeb3);this['set']('isEnabled',!_0x38d426),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x38d426||(this['_applyChangesButton']=new Mt(_0x52eb56),this['_applyChangesButton']['set']({'label':Es(_0x52eb56,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x5a1ebb['includes']('applySuggestion'),'class':Ln}),this['_insertSuggestionsButton']=new Mt(_0x52eb56),this['_insertSuggestionsButton']['set']({'label':Es(_0x52eb56,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x5a1ebb['includes']('insertSuggestion'),'class':Pn}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x391094=>{_0x391094['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',_0x54187e['if']('isVisible','ck-hidden',_0x3f04c6=>!_0x3f04c6)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}updateVisibility(_0x32e1b3){this['isVisible']=_0x32e1b3;}_switchButtonLabelsPlurality(_0x6598d3){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x6598d3?(this['_applyChangesButton']['label']=Es(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=Es(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=Es(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=Es(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}},kr=class extends _0x56a514{['children'];['balloonPanelView'];bodyCollection;constructor(_0x3c64f6,_0x5d0e0a){super(_0x3c64f6),this['bodyCollection']=_0x5d0e0a,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',_0x2cb2ee=>!_0x2cb2ee)]},'children':this['children']});const _0x5e2f07=new _0x56a514(this['locale']),_0x155695=new $t();_0x155695['content']=ht,_0x5e2f07['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x155695,{'tag':'span','children':[{'text':Es(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x5e2f07),this['_setupBalloonPanel'](_0x3c64f6);}['addSource'](_0x48fa5e){this['children']['add'](new yr(this['locale'],_0x48fa5e,this['balloonPanelView']));}_setupBalloonPanel(_0x23a8d5){this['balloonPanelView']=new xt(_0x23a8d5),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},yr=class extends Mt{['balloonPanelView'];['source'];constructor(_0x59f3a3,_0x225973,_0x4babf3){super(_0x59f3a3),this['source']=_0x225973,this['balloonPanelView']=_0x4babf3,this['set']({'label':_0x225973['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x4db084=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x4db084['to'](()=>{window['open'](_0x225973['url'],'_blank');}),'mouseenter':_0x4db084['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x4db084['to'](()=>{this['_hideTooltip']();})}}),_0x225973['favicon']){const _0x38a720=new _0x56a514(_0x59f3a3);_0x38a720['setTemplate']({'tag':'img','attributes':{'src':_0x225973['favicon']||ht,'alt':_0x225973['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x38a720);}else this['set']('icon',ht);}_createTooltipContentView(_0x82272d,_0x401fdf){const _0x109bfd=new _0x56a514(_0x82272d),_0x890f86=[];let _0x41137a;_0x401fdf?.['favicon']?(_0x41137a=new _0x56a514(_0x82272d),_0x41137a['setTemplate']({'tag':'img','attributes':{'src':_0x401fdf['favicon'],'alt':_0x401fdf['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x41137a=new $t(),_0x41137a['content']=ht,_0x41137a['extendTemplate']({'attributes':{'alt':_0x401fdf['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x890f86['push'](_0x41137a);const _0x14cd55=new _0x56a514(_0x82272d);_0x14cd55['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x401fdf['url']},'children':[{'text':new URL(_0x401fdf['url'])?.['hostname']}]}),_0x890f86['push'](_0x14cd55);const _0x387847=new _0x56a514(_0x82272d);_0x387847['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x890f86});const _0x294168=new _0x56a514(_0x82272d);return _0x294168['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x401fdf['title']['length']>0x190?_0x401fdf['title']['substring'](0x0,0x190)+'...':_0x401fdf['title']}]}),_0x109bfd['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x387847,_0x294168]}),_0x109bfd;}_showTooltip(){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[xt['defaultPositions']['northArrowSouth'],xt['defaultPositions']['northArrowSouthWest'],xt['defaultPositions']['northArrowSouthEast']],'limiter':document['querySelector']('.ck-ai-chat')}),this['balloonPanelView']['show']();}_hideTooltip(){this['balloonPanelView']['hide']();}_updateTooltipContent(){this['balloonPanelView']['content']['get'](0x0)?.['destroy'](),this['balloonPanelView']['content']['clear']();const _0x278917=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x278917);}},Nr=class extends _0x56a514{_actionsView;['_readOnlyByIndex']=new Map();['_sourcesView'];['_children'];_skeletonView;_showSkeletonDebounced=_0x5f51ae(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);_skeletonShownAt=null;_areActionsDisabled;_showUnchangedParts;_updateContentPartsPromiseQueue;_emptyPartsWarningView;_availableActions;_cachedContentParts=[];constructor(_0x3ad9e1,_0x23b448){super(_0x3ad9e1);const {areActionsDisabled:_0xcdcf3d,showUnchangedParts:_0x1968a2,availableActions:_0x40482a}=_0x23b448;this['_areActionsDisabled']=_0xcdcf3d,this['_showUnchangedParts']=_0x1968a2,this['_availableActions']=_0x40482a,this['set']('isTrackChangesOn',!0x1),this['set']('isAcceptAllEnabled',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new wr(_0x3ad9e1,Cr['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new Sr(),this['_emptyPartsWarningView']=new Rr({'id':'empty-parts-warning','initialContent':Es(_0x3ad9e1,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new vr(_0x3ad9e1,_0x23b448['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new kr(this['locale'],_0x23b448['bodyCollection']),_0x23b448['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'isAcceptAllEnabled'),this['_actionsView']['delegate'](...ir)['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'](_0x435552=>_0x435552 instanceof Tr);}async updateContentParts({parts:_0x2a2110,abortSignal:_0x14ec7e,skipLoadingEffects:_0x45ec19}){this['_cachedContentParts']['length']?_0x2a2110['forEach'](_0x269922=>{const _0x2a5074=this['_cachedContentParts']['findIndex'](_0x528312=>_0x528312['index']==_0x269922['index']);-0x1===_0x2a5074?this['_cachedContentParts']['push'](_0x269922):this['_cachedContentParts'][_0x2a5074]=_0x269922;}):this['_cachedContentParts']=_0x2a2110;const _0x498201=this['_showUnchangedParts']?_0x2a2110:_0x2a2110['filter'](_0x551d46=>_0x551d46['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x498201['length']>0x1),_0x45ec19&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x284a9c of _0x2a2110)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x42ac55=>{let _0x59db60=this['getPartView'](_0x284a9c['index']);if(_0x59db60||_0x284a9c['hasChanges']||this['_showUnchangedParts']){if(!_0x59db60){if(_0x59db60=new Tr(this['locale'],{'part':_0x284a9c,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x59db60['delegate'](...ir)['to'](this),_0x59db60['bind']('isTrackChangesOn')['to'](this),!_0x45ec19&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x42ac55),_0x42ac55['aborted']))return;_0x59db60['isTargetReadOnly']=this['_readOnlyByIndex']['get'](_0x284a9c['index'])??!0x1,this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x59db60,this['_children']['length']-0x1),_0x45ec19||this['_showSkeletonDebounced']();}await _0x59db60['updateContent']({'part':_0x284a9c,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x42ac55}),_0x59db60['markAsDone']();}});return _0x14ec7e?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}updatePartState(_0x5a26df,_0x1cf45d,_0x2b8c1f){const _0x2e30d1=this['getPartView'](_0x5a26df);_0x2e30d1&&(_0x2e30d1['outdatedReason']=_0x2b8c1f,_0x2e30d1['state']=_0x1cf45d);}setGating({readOnlyByIndex:_0x851ed1,isAcceptAllEnabled:_0x56e0e2}){this['_readOnlyByIndex']=_0x851ed1,this['isAcceptAllEnabled']=_0x56e0e2;for(const _0xc52118 of this['_contentPartViews'])_0xc52118['isTargetReadOnly']=_0x851ed1['get'](_0xc52118['partDefinition']['index'])??!0x1;}setPartActive(_0x267545,_0x35e9da){if(!0x1===_0x267545){for(const _0x459054 of this['_contentPartViews'])_0x459054['isActive']=!0x1;}else{const _0x394ce1=this['getPartView'](_0x267545);_0x394ce1&&(_0x394ce1['isActive']=_0x35e9da);}}updateSources(_0x2b96b6){_0x2b96b6['forEach'](_0x291b7c=>this['_sourcesView']['addSource'](_0x291b7c)),this['_sourcesView']['isVisible']=!0x0;}getPartView(_0x5114e7){return this['_contentPartViews']['find'](_0x4c670c=>_0x4c670c['partDefinition']['index']==_0x5114e7)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x37636b=!this['_cachedContentParts']['find'](({hasChanges:_0x4e3cc1})=>_0x4e3cc1),_0x5b0ec4=!!this['_cachedContentParts']['find'](({hasChanges:_0x33012b})=>!_0x33012b);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x5b0ec4,_0x37636b?this['_emptyPartsWarningView']['setContent'](Es(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](Es(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0xd42159=>_0xd42159['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']&&!this['_areActionsDisabled']);}async _awaitMinimumSkeletonDisplayTime(_0xc93b6b){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x20b268=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x20b268>0x0){const {promise:_0x15fa44,abortController:_0x32fa49}=nr(_0x20b268);_0xc93b6b?.['addEventListener']('abort',()=>_0x32fa49['abort']()),await _0x15fa44['catch'](()=>{});}}get hasNonEmptyParts(){return this['_contentPartViews']['filter'](_0x50b30b=>_0x50b30b['partDefinition']['hasChanges'])['length']>0x0;}},xr=class extends _0x56a514{['bodyView'];['children'];['headerView'];constructor(_0x5f0156,_0x50dbd4,_0x4d58b8){super(_0x5f0156);const {showDiff:_0xafe860,areActionsDisabled:_0x1be6e2,showUnchangedParts:_0x3eb268,availableActions:_0x30a9de}=_0x50dbd4;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new ur(_0x5f0156,{'showDiff':_0xafe860}),this['headerView']['on']('toggleShowChanges',(_0x102f92,_0x4e8e50)=>{this['areChangesVisible']=_0x4e8e50['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x4e8e50['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new Nr(_0x5f0156,{'areActionsDisabled':_0x1be6e2,'showUnchangedParts':!!_0x3eb268,'availableActions':_0x30a9de,'bodyCollection':_0x4d58b8}),this['bodyView']['delegate'](...ir)['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(_0xe4b4bc){await this['bodyView']['updateContentParts'](_0xe4b4bc);}updateSources(_0x3c1948){this['bodyView']['updateSources'](_0x3c1948);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},Lr=class extends lr{containerView;constructor(_0x425b4f,_0x57e10f,_0xd56a97){super(_0x57e10f),this['set']('isTrackChangesOn',!0x1),this['containerView']=new xr(_0x425b4f,{'showDiff':_0x57e10f['showDiff'],'areActionsDisabled':_0x57e10f['areActionsDisabled'],'availableActions':_0x57e10f['availableActions']},_0xd56a97),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x19c69e,_0x2c240b)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x2c240b['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',(_0x3d0a26,{index:_0x3be9e5})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x3be9e5});}),this['containerView']['on']('applySuggestion',(_0x400ff4,{index:_0x37380f}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x37380f});}),this['containerView']['on']('insertSuggestion',(_0x19505d,{index:_0x5db426}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x5db426});}),this['containerView']['on']('rejectSuggestion',(_0x25ffe0,{index:_0x24b3aa})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x24b3aa});}),this['containerView']['on']('mouseOverSuggestion',(_0x300a25,{index:_0x3ae716})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x3ae716});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x146182,{index:_0x34e92a})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x34e92a});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async updateContent(_0x372e85){await this['containerView']['updateContent'](_0x372e85);}updatePartState(_0x15f2c8,_0x3ac70b,_0x1b4295){this['containerView']['bodyView']['updatePartState'](_0x15f2c8,_0x3ac70b,_0x1b4295);}setPartActive(_0x968318,_0x3ca232){!0x1===_0x968318?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x968318,_0x3ca232);}updateSources(_0x1408d2){this['containerView']['updateSources'](_0x1408d2);}getPartView(_0x11e500){return this['containerView']['bodyView']['getPartView'](_0x11e500);}setGating(_0x226513){this['containerView']['bodyView']['setGating'](_0x226513);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},Pr=class extends lr{replyContainer;_bodyCollection;constructor(_0x17ef48,_0x51e343,_0x1479c2){super(_0x51e343),this['_bodyCollection']=_0x1479c2,this['locale']=_0x17ef48,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x56a514(),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':Rs(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async updateContent({parsedContent:_0x491f2a,renderingStrategy:_0x1ec014,abortSignal:_0x30543f}){'streaming'===_0x1ec014?await this['streamIntoElement'](_0x491f2a,this['replyContainer']['element'],_0x30543f):this['replyContainer']['element']['innerHTML']=_0x35b927(_0x491f2a);}updateSources(_0x4b4799){const _0x4977bd=new kr(this['locale'],this['_bodyCollection']);_0x4977bd['children']['addMany'](_0x4b4799['map'](_0x46c4c1=>new yr(this['locale'],_0x46c4c1,_0x4977bd['balloonPanelView']))),_0x4977bd['isVisible']=!0x0,this['children']['add'](_0x4977bd);}},Dr=class extends _0x14cb96{constructor(_0x196bbe=void 0x0){super();const _0x49c9bd=_0x196bbe?'ck-ai-spinner_'+_0x196bbe:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x49c9bd]}});}};const Hr={'file':_0xd6ab36,'image':_0x1bf77b,'document':_0x2d99a5,'web-resource':_0x3de4d0,'text':_0xd6ab36,'selection':tt,'mcp-tool-context':_0x2d99a5,'context':_0x2d99a5},Mr='ck-ai-chat-context-chip',Ur='ck-ai-chat-context-chip_wide',Vr='ck-ai-chat-context-chip_document',Br='ck-ai-chat-context-chip__label',Gr='ck-ai-chat-context-chip__type-icon',Fr='ck-ai-chat-context-controls__chip-tooltip',Kr='n';var Wr=class extends Mt{constructor(_0x4402c4,_0x12ad3a,_0x35dddc,_0x48a6e4,_0x59d980=!0x1){super(_0x4402c4),this['_isAnimationOnEnterEnabled']=_0x48a6e4,this['_initializeProperties'](_0x12ad3a,_0x35dddc,_0x59d980),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(_0x1c140b,_0x302307,_0x3ebb1c){this['set']('label',_0x1c140b['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x1c140b['type']),this['set']('id',_0x1c140b['uiId']),this['set']('readonly',_0x302307),this['set']('isLoading',_0x3ebb1c);}_setupTemplate(){const _0x2dad82=this['_createIconView'](),_0x4a256d=this['_createRemoveButton'](),_0x419dd5=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x419dd5),'children':this['_createTemplateChildren'](_0x2dad82,_0x4a256d,_0x419dd5)});}_createTemplateAttributes(_0x41c1bd){return{'class':[Mr,_0x41c1bd['if']('itemType',Vr,_0x4950f6=>'document'==_0x4950f6),_0x41c1bd['if']('itemType',Ur,_0x2f9ed8=>'selection'==_0x2f9ed8)],'data-cke-tooltip-text':_0x41c1bd['to']('label',Yr),'data-cke-tooltip-position':Kr,'data-cke-tooltip-class':Fr};}_createTemplateChildren(_0x6ffb81,_0x3e8347,_0x182085){const _0x28774c=this['_createLabelElement'](_0x182085),_0x290690=this['_createLoaderIcon']();return this['readonly']?[_0x6ffb81,_0x28774c]:[_0x6ffb81,_0x290690,_0x28774c,_0x3e8347];}_createLabelElement(_0x32a387){return{'tag':'span','attributes':{'class':Br},'children':[{'text':_0x32a387['to']('label')}]};}_createRemoveButton(){const _0x3653fc=new Mt(this['locale']);return _0x3653fc['set']({'label':Es(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x572ba4}),this['_setupRemoveButtonEvent'](_0x3653fc),_0x3653fc;}_setupRemoveButtonEvent(_0x2125c4){_0x2125c4['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}_createIconView(){const _0x49bc30=this['bindTemplate'],_0x49c128=new $t();return _0x49c128['content']=Hr[this['itemType']],_0x49c128['extendTemplate']({'attributes':{'class':[Gr,_0x49bc30['if']('isLoading','ck-hidden',_0xd1e37a=>_0xd1e37a)]}}),_0x49c128;}_handleAnimationEndOnce(_0x1a6ad1,_0x14b0c0){if(!_0x1a6ad1)return;const _0x5d5a38=()=>{_0x14b0c0(),_0x1a6ad1['removeEventListener']('animationend',_0x5d5a38),_0x1a6ad1['removeEventListener']('webkitAnimationEnd',_0x5d5a38);};_0x1a6ad1['addEventListener']('animationend',_0x5d5a38),_0x1a6ad1['addEventListener']('webkitAnimationEnd',_0x5d5a38);}_createLoaderIcon(){const _0x22af38=new Dr('small');return _0x22af38['bind']('isVisible')['to'](this,'isLoading',_0x58aa8b=>_0x58aa8b),_0x22af38;}};function Yr(_0x1bc1eb){if(!_0x1bc1eb)return _0x1bc1eb;if(_0x1bc1eb['length']<=0x78)return _0x1bc1eb;const _0xf9a187=_0x1bc1eb['slice'](0x0,0x78),_0x25275f=_0xf9a187['lastIndexOf']('\x20');return(_0x25275f>0x0?_0xf9a187['slice'](0x0,_0x25275f):_0xf9a187)+'…';}const $r={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},qr='300px';var Qr=class{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];_showMoreButtonView=null;['_showMoreBalloonPanelView']=null;_containerElement=null;_bodyCollection;_parentView=null;_intersectionObserver=null;_pendingCalculation=!0x1;constructor(_0x19bd19,_0x560179,_0xddd67e,_0x84d8c3,_0x1eb8d1){this['_locale']=_0x19bd19,this['_visibleChips']=_0x560179,this['_config']={...$r,..._0xddd67e,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0xddd67e['cssClasses']}},this['_overflowChips']=new lt(),this['_bodyCollection']=_0x84d8c3,this['_parentView']=_0x1eb8d1||null;}setContainerElement(_0xcc45cc){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0xcc45cc,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 _0x31d6fa=[...this['_visibleChips'],...this['_overflowChips']],_0x50eb9c=this['_createCalculationContainer'](),_0x483897=this['_calculateOverflowInContainer'](_0x50eb9c,_0x31d6fa),_0x5bd604=_0x50eb9c['_ancestorsToRestore'];_0x5bd604&&this['_restoreAncestorVisibility'](_0x5bd604),_0x50eb9c['remove'](),this['_applyOverflowResults'](_0x31d6fa,_0x483897);}_createShowMoreButton(){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0x44d1a9({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}_createShowMoreButtonView(){const _0xc878c1=new Mt(this['_locale']);_0xc878c1['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x4b938a=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x4b938a['push'](this['_config']['cssClasses']['controlsButton']),_0xc878c1['extendTemplate']({'attributes':{'class':_0x4b938a}}),_0xc878c1;}_createShowMoreBalloonPanelView(){const _0x4aee5f=new xt(this['_locale']);return _0x4aee5f['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x4aee5f),_0x4aee5f;}_updateBalloonContent(){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x5d1695=>{_0x5d1695['disableAnimationOnEnter']();});const _0x5f2475=new _0x56a514(this['_locale']);_0x5f2475['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x5f2475);}}_handleShowMoreButtonClick(){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}_updateShowMoreButtonVisibility(){const _0x356c19=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x356c19?'':'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(_0x37b014){const _0x2b55d6=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x43fbc0=this['_containerElement']?.['classList'];if(_0x43fbc0){const _0xd66447=_0x43fbc0[0x0]||'',_0x483079=_0x37b014['querySelector']('.'+_0xd66447),_0x536151=_0x37b014['querySelector'](_0x2b55d6);return _0x483079||_0x536151||_0x37b014;}return _0x37b014['querySelector'](_0x2b55d6)||_0x37b014;}_calculateContainerWidth(){const _0x508f4b=this['_parentView']?.['element']||this['_containerElement'];if(!_0x508f4b)return qr;const _0x568f27=window['getComputedStyle'](_0x508f4b)['width'];if('auto'===_0x568f27||'0px'===_0x568f27||!_0x568f27){const _0x9e5067=_0x508f4b['parentElement'];if(_0x9e5067){const _0x5973c3=window['getComputedStyle'](_0x9e5067);return'auto'!==_0x5973c3['width']?_0x5973c3['width']:qr;}return qr;}return _0x568f27;}_applyCalculationStyles(_0x149199,_0x3df71e){this['_config']['cssClasses']['calculationContainer']&&_0x149199['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x149199['style']['width']=_0x3df71e,_0x149199['style']['position']='absolute',_0x149199['style']['top']='-9999px',_0x149199['style']['left']='-9999px',_0x149199['style']['opacity']='0',_0x149199['style']['pointerEvents']='none',_0x149199['style']['zIndex']='-1',_0x149199['style']['visibility']='visible\x20!important',_0x149199['style']['display']='block\x20!important',_0x149199['style']['boxSizing']='border-box';}_restoreAncestorVisibility(_0x75935b){_0x75935b['forEach'](({element:_0x59454c,originalDisplay:_0x52ea42,originalVisibility:_0x563086})=>{_0x59454c['style']['display']=_0x52ea42,_0x59454c['style']['visibility']=_0x563086;});}_makeAncestorsVisible(_0x590f28){const _0x5699fa=[];let _0x21a51c=_0x590f28;for(;_0x21a51c&&_0x21a51c!==document['body'];){const _0xf9f0ce=window['getComputedStyle'](_0x21a51c);'none'!==_0xf9f0ce['display']&&'hidden'!==_0xf9f0ce['visibility']||(_0x5699fa['push']({'element':_0x21a51c,'originalDisplay':_0x21a51c['style']['display'],'originalVisibility':_0x21a51c['style']['visibility']}),_0x21a51c['style']['display']='block',_0x21a51c['style']['visibility']='visible'),_0x21a51c=_0x21a51c['parentElement'];}return _0x5699fa;}_createContainerElements(){let _0x15c08b,_0x53bdcf;return this['_parentView']?.['element']?(_0x15c08b=this['_parentView']['element']['cloneNode'](!0x0),_0x53bdcf=this['_findTargetContainer'](_0x15c08b)):(_0x15c08b=document['createElement']('div'),_0x53bdcf=_0x15c08b),{'calculationContainer':_0x15c08b,'targetContainer':_0x53bdcf};}_createCalculationContainer(){const {calculationContainer:_0x4c7674,targetContainer:_0x13fe02}=this['_createContainerElements'](),_0x5c5b1b=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x4c7674,_0x5c5b1b);const _0x356e1b=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0x356e1b?_0x356e1b['appendChild'](_0x4c7674):document['body']['appendChild'](_0x4c7674),_0x4c7674['_targetContainer']=_0x13fe02;const _0x363450=this['_makeAncestorsVisible'](_0x356e1b||null);return _0x4c7674['offsetWidth'],_0x4c7674['_ancestorsToRestore']=_0x363450,_0x4c7674;}_calculateOverflowInContainer(_0x12d5d1,_0x16681b){const _0x1f3039=_0x12d5d1['_targetContainer']||_0x12d5d1,_0x4e5da8=[],{rowCount:_0x143fe6}=this['_renderChipsAndCountRows'](_0x1f3039,_0x16681b);if(_0x143fe6<=this['_config']['maxVisibleRows'])return _0x4e5da8;const _0x1a0398=_0x16681b['slice']();for(;_0x1a0398['length']>0x0;){if(this['_testButtonFit'](_0x12d5d1,_0x1f3039,_0x1a0398)){const _0x558bcd=_0x16681b['filter'](_0x55f889=>!_0x1a0398['includes'](_0x55f889));_0x4e5da8['push'](..._0x558bcd);break;}if(!_0x1a0398['pop']())break;}return _0x4e5da8;}_renderChipsAndCountRows(_0xba05f7,_0xed6c43){_0xba05f7['innerHTML']='',_0xed6c43['forEach'](_0x59da17=>{if(_0x59da17['element']){const _0x40ac5a=_0x59da17['element']['cloneNode'](!0x0);_0xba05f7['appendChild'](_0x40ac5a);}}),_0xba05f7['offsetWidth'];const _0x34fe31=_0xba05f7['children'],_0x1d8c67=[];return Array['from'](_0x34fe31)['forEach'](_0x5a30f4=>{const _0x3de9e6=_0x5a30f4['getBoundingClientRect']()['top'];_0x1d8c67['some'](_0x4f42ce=>Math['abs'](_0x4f42ce-_0x3de9e6)<this['_config']['rowDetectionTolerance'])||_0x1d8c67['push'](_0x3de9e6);}),{'rowCount':_0x1d8c67['length']};}_createMockButton(){const _0x990579=document['createElement']('button');return _0x990579['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x990579['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x990579['textContent']='+\x201',_0x990579;}_testButtonFit(_0x403618,_0x138fcc,_0x4a1ede){this['_renderChipsAndCountRows'](_0x138fcc,_0x4a1ede);const _0x4f4d1b=this['_createMockButton']();_0x403618['appendChild'](_0x4f4d1b),_0x403618['offsetWidth'];const _0x45e945=[..._0x138fcc['children'],_0x4f4d1b],_0x5e23d9=[];_0x45e945['forEach'](_0x57bc1e=>{const _0x5d5aad=_0x57bc1e['getBoundingClientRect']()['top'];_0x5e23d9['some'](_0x378673=>Math['abs'](_0x378673-_0x5d5aad)<this['_config']['rowDetectionTolerance'])||_0x5e23d9['push'](_0x5d5aad);});const _0x5ee42f=_0x5e23d9['length'];return _0x4f4d1b['remove'](),_0x5ee42f<=this['_config']['maxVisibleRows'];}_distributeChips(_0x14305c,_0x1ed4fd){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x14305c['forEach'](_0x522866=>{_0x1ed4fd['includes'](_0x522866)?this['_overflowChips']['add'](_0x522866):this['_visibleChips']['add'](_0x522866);});}_updateOverflowUI(_0x24d2a8){if(_0x24d2a8>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x24d2a8>0x0&&this['_showMoreButtonView']){const _0x33d682=''+this['_config']['showMoreLabelPrefix']+(_0x24d2a8<0x63?_0x24d2a8:'99');this['_showMoreButtonView']['label']=_0x33d682;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}_applyOverflowResults(_0x47fcf3,_0x2dd5a7){this['_distributeChips'](_0x47fcf3,_0x2dd5a7),this['_updateOverflowUI'](_0x2dd5a7['length']);}_setupVisibilityObserver(){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x41d946=>{_0x41d946[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 _0x43d4f5=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x43d4f5['width']||0x0===_0x43d4f5['height'])return!0x1;const _0x50d189=window['innerHeight']||document['documentElement']['clientHeight'],_0x3c397a=window['innerWidth']||document['documentElement']['clientWidth'];return _0x43d4f5['bottom']>=-0xc8&&_0x43d4f5['top']<=_0x50d189+0xc8&&_0x43d4f5['right']>=-0xc8&&_0x43d4f5['left']<=_0x3c397a+0xc8;}};const Xr='ck-ai-chat__feed__context-chips',zr='ck-ai-chat-context-chips-wrapper',jr='ck-ai-chat-context-chips-wrapper-balloon',Jr='ck-ai-chat-controls-button',Zr='ck-ai-chat-controls_context_show-more-button',to='ck-ai-chat-context-controls__show-more-balloon-panel';var eo=class extends _0x56a514{_contextChips=this['createCollection']();['_overflowManager'];_bodyCollection;constructor(_0x4bd318,_0xdeb5c3,_0x202dd2){super(_0x4bd318),this['_bodyCollection']=_0x202dd2,this['_createContextChips'](_0xdeb5c3);const _0x4f447a={'cssClasses':{'showMoreButton':Zr+'\x20'+Dn,'showMoreBalloon':to,'overflowContainer':jr,'controlsButton':Jr}};this['_overflowManager']=new Qr(_0x4bd318,this['_contextChips'],_0x4f447a,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[Xr,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':zr},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x5b7429=this['element']['querySelector']('.'+zr);_0x5b7429&&(this['_overflowManager']['setContainerElement'](_0x5b7429),this['_overflowManager']['reorganizeChips']());}destroy(){super['destroy'](),this['_overflowManager']['destroy']();}_createContextChips(_0x399d82){for(const _0x4884f4 of _0x399d82){const _0x50aedd=new Wr(this['locale'],_0x4884f4,!0x0,!0x1);this['_contextChips']['add'](_0x50aedd);}}},io=class extends lr{_contextChipsView=null;['_locale'];_bodyCollection;_messageContentView;constructor(_0x54322e,_0x1f095f,_0x2e4e54){super(_0x1f095f),this['_locale']=_0x54322e,this['_bodyCollection']=_0x2e4e54,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 eo(this['_locale'],this['options']['contextItems']['filter'](_0x55af14=>!_0x55af14['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}_createMessageContentView(){this['_messageContentView']=new _0x56a514(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']();}},so=class extends lr{capabilities;constructor(_0x34e352,_0x1c9094){super(_0x1c9094);const {isWebSearchEnabled:_0x20cdc0,isReasoningEnabled:_0x2ed776}=_0x1c9094['capabilities'],_0x39d130=[];let _0x214809='';_0x20cdc0&&_0x2ed776?(_0x214809=Es(_0x34e352,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x39d130['push'](no(ht)),_0x39d130['push'](no(_0x1e95b5))):_0x20cdc0?(_0x214809=Es(_0x34e352,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x39d130['push'](no(ht))):_0x2ed776&&(_0x214809=Es(_0x34e352,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x39d130['push'](no(_0x1e95b5))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x214809?'':'ck-hidden']}});const _0x182cda=new _0x56a514();_0x182cda['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x39d130,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x214809]}]}),this['children']['add'](_0x182cda),this['capabilities']=_0x1c9094['capabilities'];}};function no(_0x439f48){const _0x1fe092=new $t();return _0x1fe092['content']=_0x439f48,_0x1fe092;}const ro=['wheel','touchstart','pointerdown','keydown'],oo=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var ao=class{element;animationFrameId;['isRunning'];abortController;['isUserPaused'];['scrollBehavior'];constructor(_0x513390){this['element']=_0x513390,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x14335b of ro){const _0x4fe037='keydown'!==_0x14335b;this['element']['addEventListener'](_0x14335b,this['_onUserEvent']['bind'](this),{'passive':_0x4fe037,'signal':this['abortController']['signal']});}}start({smooth:_0x20c937=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x20c937?'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(_0x117a61){if(this['isRunning']){if('keydown'===_0x117a61['type']){const _0x5c077d=_0x117a61['key'];if(!oo['includes'](_0x5c077d))return;}_0x117a61 instanceof WheelEvent?_0x117a61['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}_isAtBottom(){const {scrollTop:_0x2ad35f,scrollHeight:_0xd4a991,clientHeight:_0x22bd03}=this['element'];return _0xd4a991-_0x2ad35f-_0x22bd03<=0x5;}_rafUpdate(){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}},ho=class extends lr{constructor(_0x3eed08){super(_0x3eed08),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']);}},co=class extends _0x56a514{['children'];['scrollManager'];_bodyCollection;constructor(_0x4f4ca4,_0x34c58b){super(_0x4f4ca4),this['_bodyCollection']=_0x34c58b,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...sr)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new ao(this['element']);}destroy(){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}addItem(_0x599082,_0x426e59){let _0x53e995;return'ai-reply'===_0x599082?_0x53e995=new Pr(this['locale'],_0x426e59,this['_bodyCollection']):'ai-suggestion-reply'===_0x599082?(_0x53e995=new Lr(this['locale'],_0x426e59,this['_bodyCollection']),_0x53e995['bind']('isTrackChangesOn')['to'](this)):_0x53e995='user-message'===_0x599082?new io(this['locale'],_0x426e59,this['_bodyCollection']):'interaction-header'===_0x599082?new so(this['locale'],_0x426e59):'custom-element'===_0x599082?new ho(_0x426e59):new Rr(_0x426e59),this['children']['add'](_0x53e995),_0x53e995;}async updateReplyItem({id:_0x57618d,parsedContent:_0x303d66,renderingStrategy:_0x51d924,abortSignal:_0x480807}){const _0x1e5e82=this['getItemById'](_0x57618d);if(!(_0x1e5e82 instanceof Pr))throw new ct('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x1e5e82,'id':_0x57618d,'parsedContent':_0x303d66});await _0x1e5e82['updateContent']({'parsedContent':_0x303d66,'renderingStrategy':_0x51d924,'abortSignal':_0x480807});}async updateWebSources(_0x243367,_0x2b3e6c){const _0x593467=this['getItemById'](_0x243367);if(_0x593467 instanceof Lr)_0x593467['updateSources'](_0x2b3e6c);else{if(!(_0x593467 instanceof Pr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x593467,'id':_0x243367,'sources':_0x2b3e6c});_0x593467['updateSources'](_0x2b3e6c);}}async updateSuggestionItem({id:_0x283f8b,parts:_0x4b2c83,abortSignal:_0x4ffe7d,skipLoadingEffects:_0x4558e2}){const _0x233a11=this['getItemById'](_0x283f8b);if(!(_0x233a11 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x233a11,'id':_0x283f8b,'parts':_0x4b2c83});await _0x233a11['updateContent']({'parts':_0x4b2c83,'abortSignal':_0x4ffe7d,'skipLoadingEffects':_0x4558e2});}updateSuggestionPartState({id:_0xd74c05,index:_0x4965d2,state:_0x1afe2b,outdatedReason:_0x2ad15e}){const _0x252547=this['getItemById'](_0xd74c05);if(!(_0x252547 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0xd74c05});_0x252547['updatePartState'](_0x4965d2,_0x1afe2b,_0x2ad15e);}updateSuggestionGating(_0x2d8719,_0xcc040d){const _0x717541=this['getItemById'](_0x2d8719);if(!(_0x717541 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x2d8719});_0x717541['setGating'](_0xcc040d);}setSuggestionPartActive({id:_0x443f4,index:_0x451f73,isActive:_0x2c1ea5}){const _0x30662d=this['getItemById'](_0x443f4);if(!(_0x30662d instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x443f4});this['children']['filter'](_0x3bbca7=>_0x3bbca7 instanceof Lr)['forEach'](_0x490942=>{_0x490942['setPartActive'](!0x1);}),_0x30662d['setPartActive'](_0x451f73,_0x2c1ea5);}markItemAsDone(_0x56db5a){this['getItemById'](_0x56db5a)['markAsDone']();}getItemIds(){return this['children']['map'](_0x389637=>_0x389637['options']['id']);}removeItem(_0x5b3da8){this['children']['remove'](this['getItemById'](_0x5b3da8));}hasItem(_0x3c600a){return!!this['children']['find'](_0x3c1d51=>_0x3c1d51['options']['id']['includes'](_0x3c600a));}scrollToSuggestion(_0x467b76,_0x73bc60){const _0x3969d3=this['getItemById'](_0x467b76);if(!(_0x3969d3 instanceof Lr))return void St('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x467b76,'partIndex':_0x73bc60});const _0x251c4c=_0x3969d3['getPartView'](_0x73bc60);_0x251c4c?Rt(_0x251c4c['element'],0x14,this['element']['parentElement'],!0x0,!0x0):St('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x467b76,'partIndex':_0x73bc60});}_setupTemplate(){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}_createTemplateChildren(){const _0x18f4de=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x18f4de,this['_createFeedLoader']()];}_createSkeletonLoader(){const _0x1da2f6=new wr(this['locale'],Cr['aiFeed']);return _0x1da2f6['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x1da2f6;}_createFeedItems(){const _0x1499e1=new _0x56a514(this['locale']);return _0x1499e1['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x1499e1;}_createFeedLoader(){const _0x3a689f=new _0x56a514(this['locale']);return _0x3a689f['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x5a7735=>!_0x5a7735)]},'children':this['_createLoaderChildren']()}),_0x3a689f;}_createLoaderChildren(){const _0x318f5e=new Dr();return _0x318f5e['isVisible']=!0x0,[_0x318f5e,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}getItemById(_0x3379ed){const _0xfe5a6c=this['children']['find'](_0x4852f2=>_0x4852f2['options']['id']['includes'](_0x3379ed));if(!_0xfe5a6c)throw new ct('ai-chat-feed-view-item-not-found',this,{'id':_0x3379ed});return _0xfe5a6c;}setLoadingMessage(_0x3655ec){this['set']('loadingMessage',_0x3655ec);}toggleLoadingSkeleton(_0x143e9d){this['set']('isLoadingSkeletonVisible',_0x143e9d);}startAutoScroll(_0x57cf46={}){this['scrollManager']['start'](_0x57cf46);}stopAutoScroll(){this['scrollManager']['stop']();}},lo=class extends Jt{filter(){let _0x4e0dc6=0x0;for(const _0xcdfad of this['items'])_0x4e0dc6+=_0xcdfad['items']['length'];return{'resultsCount':_0x4e0dc6,'totalItemsCount':_0x4e0dc6};}};function uo(_0x5dad65){const _0x2ba70a=[];let _0x37c4e0=!0x1;for(const _0x1df48e of Array['from'](_0x5dad65['items'])){if('file'!==_0x1df48e['kind'])continue;if(_0x1df48e['webkitGetAsEntry']()?.['isDirectory']){_0x37c4e0=!0x0;continue;}const _0x545980=_0x1df48e['getAsFile']();_0x545980&&_0x2ba70a['push'](_0x545980);}return{'files':_0x2ba70a,'hasDirectory':_0x37c4e0};}const _o='ck-ai-chat__prompt-input_highlighted';var go=class AIChatPromptInputView extends Nt{submitButtonView;static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;_addContextButtonView;['_queryViewResizeObserver'];constructor(_0x2724f7,_0x5bc9e2){super(_0x2724f7,{'queryView':{'label':'','creator':_0x3cc43c,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new lo(_0x2724f7),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x5bc9e2,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',(_0x530737,_0x4be372)=>!_0x530737&&!_0x4be372),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x2f3fc7,_0x301ac9)=>{this['isUploadInProgress']||this['isEmpty']||_0x2f3fc7['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x301ac9());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x130223=>this['_handlePaste'](_0x130223)),this['element']['addEventListener']('drop',_0x2601c2=>this['_handleDrop'](_0x2601c2));}_handlePaste(_0x443735){const _0x261692=_0x443735['clipboardData'];if(!_0x261692)return;const {files:_0x23ba28,hasDirectory:_0x1a9756}=uo(_0x261692),_0x165f34={'files':_0x23ba28,'plainText':_0x261692['getData']('text/plain'),'hasDirectory':_0x1a9756,'forceTextAttachment':!0x1,'preventDefault':()=>_0x443735['preventDefault']()};this['fire']('promptInputPaste',_0x165f34);}['_handleDrop'](_0x598ba0){const _0x207a2a=_0x598ba0['dataTransfer'];if(!_0x207a2a)return;const _0x56998e={'files':[],'plainText':_0x207a2a['getData']('text/uri-list')||_0x207a2a['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x598ba0['preventDefault']()};this['fire']('promptInputPaste',_0x56998e);}destroy(){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}submit(){const _0x62d1f9=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x62d1f9)return this['queryView']['errorText']=Es(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x5c2e1f=_0x15f5d8(_0x62d1f9);this['fire']('sendUserMessage',_0x5c2e1f),this['queryView']['fieldView']['reset']();}setPlaceholderText(_0x46bcd9){this['queryView']['fieldView']['set']('placeholder',_0x46bcd9);}['focus'](_0x2debc8=!0x1){super['focus'](),_0x2debc8&&(this['element']['classList']['contains'](_o)||(this['element']['classList']['add'](_o),setTimeout(()=>{this['element']['classList']['remove'](_o);},0x320)));}_createSubmitButton(){const _0x2eb3d7=new Mt(this['locale']);return _0x2eb3d7['set']({'icon':nt,'label':Es(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+Ln,'isEnabled':!0x1}),_0x2eb3d7['on']('execute',()=>{this['submit']();}),_0x2eb3d7;}setIsUploadInProgress(_0x3e7e82){this['isUploadInProgress']=_0x3e7e82;}_setUpAddContextButtonPositioning(){const _0x2018fb=this['locale'],_0x25a760=()=>{wt['window']['requestAnimationFrame'](()=>{if(ft(this['element'])){const _0x37e2f0=new It(this['queryView']['fieldView']['element']),_0x1f8dd6=new It(this['_addContextButtonView']['element']),_0x1db57a=_0x37e2f0['width'],_0x88d991='rtl'===_0x2018fb['uiLanguageDirection']?'right':'left';_0x37e2f0['excludeScrollbarsAndBorders']();const _0x5b25f6=_0x1db57a-_0x37e2f0['width']+0x1;this['_addContextButtonView']['element']['style'][_0x88d991]='calc('+(_0x1db57a-_0x1f8dd6['width']-_0x5b25f6)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x25a760),this['on']('render',()=>{_0x25a760(),this['_queryViewResizeObserver']=new pt(this['queryView']['fieldView']['element'],()=>{_0x25a760();});});}},Ao=class extends _0x56a514{constructor(_0x15159a){super(_0x15159a),this['set']('isEnabled',!0x0);const _0x517cc6=new $t();_0x517cc6['content']=_0xd6ab36,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x517cc6,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':Es(_0x15159a,'AI_CHAT_DROP_ZONE_HINT')}]}]});}attach(_0x3c1ed6){let _0x3a54d1=0x0;const _0x10b4a9=()=>{_0x3c1ed6['classList']['toggle']('ck-ai-chat-controls_drag-over',this['isEnabled']&&_0x3a54d1>0x0);};this['on']('change:isEnabled',(_0x2aa8e5,_0x524c43,_0x2fb3ec)=>{_0x2fb3ec&&_0x3a54d1>0x0&&this['fire']('dragEnter'),_0x10b4a9();}),_0x3c1ed6['addEventListener']('dragenter',_0x58de53=>{_0x58de53['dataTransfer']&&(_0x3a54d1++,0x1===_0x3a54d1&&this['isEnabled']&&this['fire']('dragEnter'),_0x10b4a9());}),_0x3c1ed6['addEventListener']('dragover',_0x2bad24=>{_0x2bad24['dataTransfer']&&_0x2bad24['preventDefault']();}),_0x3c1ed6['addEventListener']('dragleave',()=>{--_0x3a54d1<0x0&&(_0x3a54d1=0x0),_0x10b4a9();}),_0x3c1ed6['addEventListener']('drop',_0x1fda22=>{_0x1fda22['preventDefault'](),_0x3a54d1=0x0,_0x10b4a9(),this['isEnabled']&&this['_handleDrop'](_0x1fda22);});}['_handleDrop'](_0x57df4a){const _0x3a98ff=_0x57df4a['dataTransfer'];if(!_0x3a98ff)return;const {files:_0x3c4254,hasDirectory:_0x296ac4}=uo(_0x3a98ff),_0x342988={'files':_0x3c4254,'plainText':_0x3a98ff['getData']('text/uri-list')||_0x3a98ff['getData']('text/plain'),'hasDirectory':_0x296ac4,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x342988);}},Io=class extends _0x56a514{['dropdownView'];['nameView'];_items;['_config'];constructor(_0x20f983,_0x4e8dc7){super(_0x20f983),this['_config']=_0x4e8dc7,this['set']('modelDisplayMode','selector'),this['set']('activeModelId',null),this['set']('activeModelName',null),this['set']('isEnabled',!0x0),this['dropdownView']=this['_createDropdown'](),this['_items']=new lt(),_0x40e721(this['dropdownView'],this['_items']),this['nameView']=new po(_0x20f983,_0x4e8dc7['nameClass']),this['nameView']['bind']('text')['to'](this,'activeModelName',_0x5d94a6=>_0x5d94a6??''),this['nameView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x4968cc=>'name'===_0x4968cc),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-model-selector']},'children':[this['dropdownView'],this['nameView']]});}setModels(_0x47ac3d,_0xc08ecd){var _0xf52e18;this['set']('modelDisplayMode',(_0xf52e18=_0x47ac3d['length'],_0xc08ecd?0x1===_0xf52e18?'name':'selector':'hidden')),this['_items']['clear'](),0x1===_0x47ac3d['length']&&this['set']('activeModelName',_0x47ac3d[0x0]['name']||_0x47ac3d[0x0]['id']);for(const _0x58af36 of _0x47ac3d){const _0x5f3015=new _0x28f92e({'label':_0x58af36['name'],'withText':!0x0,'role':'menuitemradio','id':_0x58af36['id'],'model':_0x58af36});_0x5f3015['bind']('isOn')['to'](this,'activeModelId',_0x56039c=>_0x56039c===_0x58af36['id']),this['_items']['add']({'type':'button','model':_0x5f3015,'labelView':new Eo(this['locale'],_0x58af36,{'nameClass':this['_config']['itemClasses']['name'],'descriptionClass':this['_config']['itemClasses']['description'],'capabilitiesClass':this['_config']['itemClasses']['capabilities'],'extraContent':this['_config']['showCapabilities']?mo(this['locale'],_0x58af36):void 0x0})});}}setSelectedModel(_0x5d73c9){this['set']('activeModelId',_0x5d73c9?_0x5d73c9['id']:null),this['set']('activeModelName',_0x5d73c9?_0x5d73c9['name']||_0x5d73c9['id']:null);}_createDropdown(){const _0x31e2ca=_0x48403c(this['locale']);return _0x31e2ca['set']({'panelPosition':this['_config']['panelPosition'],'class':this['_config']['dropdownClass']}),_0x31e2ca['buttonView']['set']({'withText':!0x0,'tooltipPosition':this['_config']['tooltipPosition'],'class':Dn}),_0x31e2ca['buttonView']['bind']('label')['to'](this,'activeModelName',_0x224290=>_0x224290??this['_config']['defaultLabel']??''),_0x31e2ca['buttonView']['bind']('tooltip')['to'](this,'activeModelName',this,'isEnabled',(_0x3fca7c,_0x2bceab)=>!_0x2bceab&&this['_config']['disabledTooltip']?this['_config']['disabledTooltip']:_0x3fca7c??this['_config']['defaultLabel']??''),_0x31e2ca['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x1154b9=>'selector'===_0x1154b9),_0x31e2ca['bind']('isEnabled')['to'](this,'isEnabled'),this['listenTo'](_0x31e2ca,'execute',_0x1a2e4c=>{this['fire']('selectModel',_0x1a2e4c['source']['model']);}),_0x31e2ca;}},po=class extends _0x56a514{constructor(_0x566e79,_0x1c7217){super(_0x566e79),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x1d51df=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck',_0x1c7217,_0x1d51df['if']('isVisible','ck-hidden',_0x2eeead=>!_0x2eeead)]},'children':[{'text':_0x1d51df['to']('text')}]});}},Eo=class extends Dt{constructor(_0x25369f,_0x24ce7e,_0x4ff091){super();const _0x103d48=this['bindTemplate'],_0x132a1f=[{'tag':'div','attributes':{'class':[_0x4ff091['nameClass']]},'children':[{'tag':'span','children':[{'text':_0x103d48['to']('text')}]}]},{'tag':'div','attributes':{'class':[_0x4ff091['descriptionClass']]},'children':[{'tag':'span','children':[_0x24ce7e['description']||'']}]}];_0x4ff091['extraContent']?.['length']&&_0x4ff091['capabilitiesClass']&&_0x132a1f['push']({'tag':'div','attributes':{'class':[_0x4ff091['capabilitiesClass']]},'children':_0x4ff091['extraContent']}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x103d48['to']('style'),'id':_0x103d48['to']('id')},'children':_0x132a1f});}};function mo(_0x4a6917,_0x8d1a96){return[...To(_0x4a6917,ht,'AI_CHAT_SEARCH_WEB',_0x8d1a96['capabilities']['webSearch']?.['enabled']??!0x1),...To(_0x4a6917,_0x1e95b5,'AI_CHAT_REASONING',_0x8d1a96['capabilities']['reasoning']?.['enabled']??!0x1)];}function To(_0x318937,_0x1522c1,_0xf07d6e,_0xf9ced2){const _0x2b6fea=new $t();_0x2b6fea['content']=_0x1522c1;const _0xd1c402=new _0x56a514(_0x318937);_0xd1c402['setTemplate']({'tag':'span','children':[{'text':Es(_0x318937,_0xf07d6e)+':\x20'}]});const _0x3eb6a6=new _0x56a514(_0x318937);return _0x3eb6a6['setTemplate']({'tag':'span','children':[{'text':Es(_0x318937,_0xf9ced2?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x2b6fea,_0xd1c402,_0x3eb6a6];}const wo='ck-ai-chat__prompt-capabilities',Co='ck-ai-chat-controls-button',fo='ck-ai-chat-controls-button--commands',bo='ck-ai-chat-controls__model-selection',So='ck-ai-chat-controls__model-selection__item-name',Ro='ck-ai-chat-controls__model-selection__item-description',Oo='ck-ai-chat-controls__model-selection__item-capabilities',vo='n';var ko=class extends _0x56a514{_webSearchButton;_reasoningButton;_commandsButton;_modelSelector;constructor(_0x7a1029){super(_0x7a1029),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelSelectorEnabled',!0x0),this['_modelSelector']=function(_0x1f845e){return new Io(_0x1f845e,{'panelPosition':'ne','dropdownClass':[bo],'nameClass':'ck-ai-chat-controls__model-name','itemClasses':{'name':So,'description':Ro,'capabilities':Oo},'defaultLabel':Es(_0x1f845e,'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'disabledTooltip':Es(_0x1f845e,'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP'),'tooltipPosition':vo,'showCapabilities':!0x0});}(_0x7a1029),this['_modelSelector']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x2d6550=>_0x2d6550),this['_modelSelector']['delegate']('selectModel')['to'](this),this['_webSearchButton']=this['_createWebSearchButton'](),this['_reasoningButton']=this['_createReasoningButton'](),this['_commandsButton']=this['_createCommandsButton'](),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x572f7f=>_0x572f7f),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x271a0b=>Es(this['locale'],_0x271a0b?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x2c0bf5=>_0x2c0bf5),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x2ef4db=>Es(this['locale'],_0x2ef4db?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[wo]},'children':[this['_modelSelector'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]});}setWebSearch(_0x16e300){this['set']('webSearchActive',_0x16e300);}setReasoning(_0x291dbd){this['set']('reasoningActive',_0x291dbd);}setModelList(_0xf38e15,_0x3784bc){this['_modelSelector']['setModels'](_0xf38e15,!_0x3784bc);}setModel(_0x72108a){if(!_0x72108a)return;this['_modelSelector']['setSelectedModel'](_0x72108a);const _0x3382c2=_0x72108a['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x3382c2),this['_webSearchButton']['set']('isVisible',_0x3382c2);const _0x4bdd5=_0x72108a['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x4bdd5),this['_reasoningButton']['set']('isVisible',_0x4bdd5);}enableModelSelector(){this['set']('modelSelectorEnabled',!0x0);}disableModelSelector(_0x37bf4d){this['set']('modelSelectorEnabled',!0x1),_0x37bf4d&&(this['_modelSelector']['modelDisplayMode']='hidden');}_createWebSearchButton(){const _0x212705=new Mt();return _0x212705['set']({'label':Es(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':ht,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltipPosition':vo}),_0x212705['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x212705;}_createReasoningButton(){const _0xcd7242=new Mt();return _0xcd7242['set']({'label':Es(this['locale'],'AI_CHAT_REASONING'),'icon':_0x1e95b5,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltipPosition':vo}),_0xcd7242['on']('execute',()=>{this['fire']('toggleReasoning');}),_0xcd7242;}_createCommandsButton(){const _0x12d256=new Mt();return _0x12d256['set']({'label':Es(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x522884,'withText':!0x0,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltip':Es(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':vo}),_0x12d256['extendTemplate']({'attributes':{'class':[fo]}}),_0x12d256['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x12d256;}};const yo='ck-ai-chat-context-controls__url-form',No='ck-ai-chat-context-controls__url-input-section';var xo=class extends _0x56a514{['focusTracker'];keystrokes;['_focusables'];['focusCycler'];urlInputField;backButton;confirmButton;constructor(_0x187396){super(_0x187396),this['focusTracker']=new _t(),this['keystrokes']=new gt(),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 Ft({'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'](_0x218d71=>{this['focusTracker']['add'](_0x218d71['element']),this['keystrokes']['listenTo'](_0x218d71['element']);}),_0x2801b9({'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(_0x2c72f8){this['urlInputField']['errorText']=_0x2c72f8,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}_createBackButton(){const _0x18d52e=new Mt(this['locale']);return _0x18d52e['set']({'icon':_0xd78e92,'tooltip':Es(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x258919,_0x210c35,_0x4e0e86)=>{_0x18d52e['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x4e0e86?'':'\x20ck-hidden')]});}),_0x18d52e;}_createUrlInputField(){const _0x2c11ee=new Qt(this['locale'],_0x4c7fdb);return _0x2c11ee['set']({'label':Es(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x2c11ee['fieldView']['set']({'placeholder':Es(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x2c11ee;}_createConfirmButton(){const _0x1bf37a=new Mt(this['locale']);return _0x1bf37a['set']({'icon':_0x48b061,'tooltip':Es(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x1bf37a;}_setupTemplate(){const _0x43c431=new Kt(this['locale'],{'label':Es(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x43c431['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':yo,'tabindex':'-1'},'children':[_0x43c431,{'tag':'div','attributes':{'class':No},'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',_0x10fc5a=>{_0x10fc5a['stop'](),this['_handleSubmit']();});}_setupKeystrokes(){this['keystrokes']['set']('esc',(_0x59ffc0,_0x618966)=>{this['clear'](),this['fire']('cancel'),_0x618966();});}_handleSubmit(){const _0x82c04a=this['getValue']()['trim']();_0x82c04a?this['_isValidUrl'](_0x82c04a)?(this['clearError'](),this['fire']('submitUrl',_0x82c04a)):this['setError'](Es(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Es(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}_updateConfirmButtonState(){const _0x43fced=this['getValue']()['trim'](),_0x443da9=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x43fced['length']>0x0&&!_0x443da9;}['_isValidUrl'](_0x167eee){try{return!!new URL(_0x167eee);}catch{return!0x1;}}};const Lo='ck-ai-chat-resources__item',Po='ck-ai-chat-resources__item--in-context',Do='ck-ai-chat-resources__item-title',Ho='ck-ai-chat-resources__item__icon';var Mo=class extends jt{['resource'];_titleView;['_iconView'];constructor(_0x3ca556,_0x51df3b){super(_0x3ca556),this['resource']=_0x51df3b,this['set']('isInContext',!!_0x51df3b['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}getResourceIcon(_0x419991){if(_0x419991['isInContext'])return _0x48b061;switch(_0x419991['type']){case'document':return _0x2d99a5;case'web-resource':return _0x3de4d0;case'file':case'text':return _0xd6ab36;default:return _0x325a2b;}}highlightText(_0x24964f){if(!_0x24964f||''===_0x24964f['trim']())return void this['_titleView']['highlightText'](null);const _0x288bde=new RegExp(_0x3ff1f3(_0x24964f),'gi');this['_titleView']['highlightText'](_0x288bde);}updateResourceState(_0x217428){this['resource']['isInContext']=_0x217428,this['isInContext']=_0x217428,this['_updateIcon']();}_createTitleView(){const _0x47c568=new Yt();return _0x47c568['text']=this['resource']['label'],_0x47c568['extendTemplate']({'tag':'span','attributes':{'class':[Do]}}),_0x47c568;}_createIconView(){const _0x3f33d3=new $t();return _0x3f33d3['content']=this['getResourceIcon'](this['resource']),_0x3f33d3;}_setupTemplate(){const _0x4e198d=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[Lo,_0x4e198d['if']('isVisible','ck-hidden',_0x2f872b=>!_0x2f872b),_0x4e198d['if']('isInContext',Po)]},'children':[{'tag':'div','attributes':{'class':[Ho]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x4e198d['to']('execute')}});}_updateIcon(){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const Uo='ck-ai-chat-resources__list';var Vo=class extends Jt{['_source'];constructor(_0x5d1c76,_0x18b043){super(_0x5d1c76),this['_source']=_0x18b043,this['extendTemplate']({'attributes':{'class':[Uo]}});}setResources(_0x10a5ca,_0x64a29b){this['items']['clear']();let _0x5160b5=_0x10a5ca;if(this['_source']['useDefaultFiltering']&&_0x64a29b&&''!==_0x64a29b['trim']()){const _0x2c7b4e=new RegExp(_0x64a29b['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x5160b5=_0x10a5ca['filter'](_0x374f60=>_0x2c7b4e['test'](_0x374f60['label']));}for(const _0x5d00cb of _0x5160b5){const _0x53f64a=new Mo(this['locale'],_0x5d00cb);_0x53f64a['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x5d00cb);}),this['items']['add'](_0x53f64a);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x64a29b);}highlightText(_0x32a33d){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x180701=>{_0x180701['highlightText'](_0x32a33d);});}updateResourceState(_0x2db8e2,_0x4d169f){for(const _0x215080 of this['items']){const _0x55c853=_0x215080;_0x55c853['resource']['id']===_0x2db8e2&&_0x55c853['updateResourceState'](_0x4d169f);}}_handleResourceSelection(_0x58b117,_0x3281cf){this['fire']('addResourceToContext',{'source':_0x58b117,'resource':_0x3281cf});}},Bo=class extends Qt{['iconView'];resetButtonView;['_viewConfig'];constructor(_0x2625a5){const t=_0x2625a5['t'],_0x2b886d={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x4c7fdb,'label':Es(_0x2625a5,'AI_CHAT_SEARCH_RESOURCES')};super(_0x2625a5,_0x2b886d['creator']),this['label']=_0x2b886d['label'],this['_viewConfig']=_0x2b886d,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x2625a5,t),this['_setupEventListeners']();}reset(){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x8575e2){this['fire']('search',_0x8575e2);}getQuery(){return this['fieldView']['element']?.['value']||'';}_setupSearchIcon(){this['iconView']=new $t(),this['iconView']['content']=_0x4cf30b,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}_setupResetButton(_0x2de0d4,t){this['resetButtonView']=new Mt(_0x2de0d4),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x572ba4,'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',_0x246b1c=>!_0x246b1c),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);}},Go=class extends _0x56a514{['_searchView'];_searchSection;_searchInputVisibleFrom;_resourcesListView;_skeletonLoader;['_source'];['children'];_latestLoadResourcesUid=null;constructor(_0x28575b,_0xab31f4){super(_0x28575b),this['_source']=_0xab31f4['source'],this['_searchInputVisibleFrom']=_0xab31f4['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 _0x93f04d([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}_createSearchView(){return new Bo(this['locale']);}_createSearchSection(){const _0x28b80c=new _0x56a514(this['locale']);return _0x28b80c['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x1bab9c,_0x41dfbc)=>{this['loadResources'](_0x41dfbc),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x41dfbc);}),_0x28b80c;}_createResourcesListView(){const _0x35cc75=new Vo(this['locale'],this['_source']);return _0x35cc75['delegate']('addResourceToContext')['to'](this),_0x35cc75['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x35cc75;}_createSkeletonView(){const _0x40b810=new wr(this['locale'],Cr['aiChatResources']);return _0x40b810['bind']('isVisible')['to'](this,'isLoading'),_0x40b810;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x33f08b){const _0x313d70=kt();this['_latestLoadResourcesUid']=_0x313d70,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x33f08b,'uid':_0x313d70}),this['isLoading']=!0x0;}setResources(_0x15fe34,_0x497831){if(_0x497831&&_0x497831!==this['_latestLoadResourcesUid'])return;const _0x20c4d5=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x15fe34,_0x20c4d5),_0x15fe34['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}updateResourceState(_0x5e6a5c,_0x32e65d){this['_resourcesListView']['updateResourceState'](_0x5e6a5c,_0x32e65d);}};const Fo='ck-ai-chat-context-controls__source-balloon-panel',Ko='ck-button-icon\x20ck-button-back',Wo='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';var Yo=class{['_sourceResourceBalloons']=new Map();_bodyCollection;['_locale'];['_config'];constructor(_0xbd3462,_0x34a423,_0x1fbf40){this['_locale']=_0xbd3462,this['_bodyCollection']=_0x34a423,this['_config']=_0x1fbf40;}['showSourceResourcesBalloon']({source:_0x4bc3cd,withBackButton:_0x4c0998}){let _0x6730f3=this['_sourceResourceBalloons']['get'](_0x4bc3cd['id']);_0x6730f3||(_0x6730f3=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x4bc3cd['id'],_0x6730f3),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x6730f3)),this['_addSourceResourceContent']({'balloonPanel':_0x6730f3,'source':_0x4bc3cd,'withBackButton':_0x4c0998}),_0x6730f3['show']();const _0x501b15=this['_config']['getTargetElement']();_0x501b15&&_0x6730f3['pin']({'target':_0x501b15,'limiter':this['_config']['getLimiterElement']()});}populateSourceResourceBalloon(_0xdeb68,_0x57cc46,_0x5c6bd8){const _0x3ab5ec=this['_sourceResourceBalloons']['get'](_0xdeb68);if(!_0x3ab5ec)return;const _0x401fc9=this['_getResourcesViewFromBalloon'](_0x3ab5ec);_0x401fc9&&(_0x401fc9['setResources'](_0x57cc46,_0x5c6bd8),_0x401fc9['once']('change:isLoading',()=>{_0x3ab5ec['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x5aa0db){const _0xce73e8=this['_sourceResourceBalloons']['get'](_0x5aa0db);_0xce73e8&&requestAnimationFrame(()=>{_0xce73e8['hide'](),this['_sourceResourceBalloons']['delete'](_0x5aa0db),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x48f3aa of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x48f3aa);}['isAnyResourceBalloonVisible'](){for(const _0x443f22 of this['_sourceResourceBalloons']['values']())if(_0x443f22['isVisible'])return!0x0;return!0x1;}updateResourceState(_0xb2b097,_0x222825,_0x3d3560){const _0x27014b=this['_sourceResourceBalloons']['get'](_0xb2b097);if(!_0x27014b||!_0x27014b['isVisible'])return;const _0x6886ee=this['_config']['getTargetElement']();if(!_0x6886ee)return;_0x27014b['pin']({'target':_0x6886ee,'limiter':this['_config']['getLimiterElement']()});const _0x56a129=this['_getResourcesViewFromBalloon'](_0x27014b);_0x56a129&&_0x56a129['updateResourceState'](_0x222825,_0x3d3560);}destroy(){for(const _0x5bbb53 of this['_sourceResourceBalloons']['values']())_0x5bbb53['destroy']();this['_sourceResourceBalloons']['clear']();}_createSourceResourceBalloonPanel(){const _0x4b4c85=new xt(this['_locale']);return _0x4b4c85['extendTemplate']({'attributes':{'class':Fo}}),this['_bodyCollection']['add'](_0x4b4c85),_0x4b4c85;}_addSourceResourceContent({balloonPanel:_0x551401,source:_0x382bc3,withBackButton:_0x9ffd1f}){_0x551401['content']['clear']();const _0x42e447=this['_createBalloonHeader']({'balloonPanel':_0x551401,'source':_0x382bc3,'withBackButton':_0x9ffd1f});_0x551401['content']['add'](_0x42e447);const _0x2f69de=this['_createBalloonResourcesView'](_0x382bc3);_0x551401['content']['add'](_0x2f69de);}_createBalloonHeader({balloonPanel:_0x746446,source:_0x4d4f7f,withBackButton:_0x11d417}){const _0x875737=new Kt(this['_locale'],{'label':_0x4d4f7f['label'],'class':Wo});return _0x11d417&&_0x875737['children']['add'](this['_createBackButton'](_0x746446),0x0),_0x875737;}_createBackButton(_0xa23c7b){const _0x2f30b8=new Mt(this['_locale']);return _0x2f30b8['set']({'icon':_0xd78e92,'tooltip':Es(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':Ko}),_0x2f30b8['on']('execute',()=>{_0xa23c7b['hide'](),this['_config']['onBackToContext']();}),_0x2f30b8;}_createBalloonResourcesView(_0x48572b){const _0x2d201c=new Go(this['_locale'],{'source':_0x48572b,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x2d201c['on']('loadSourceResources',(_0x3de4e8,_0x3d844e)=>{this['_config']['onLoadSourceResources'](_0x3d844e);}),_0x2d201c['on']('addResourceToContext',(_0x531316,_0x6fab8)=>{this['_config']['onResourceSelected'](_0x6fab8['source'],_0x6fab8['resource']),this['closeSourceResourceBalloon'](_0x48572b['id']);}),_0x2d201c;}_getResourcesViewFromBalloon(_0x7b3f6){const _0x4c898d=_0x7b3f6['content']['get'](0x1);return _0x4c898d instanceof Go?_0x4c898d:null;}_setupSingleResourceBalloonClickOutsideHandler(_0x1fcde9){_0x44d1a9({'emitter':_0x1fcde9,'contextElements':[_0x1fcde9['element']],'callback':()=>{_0x1fcde9['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x1fcde9['isVisible']});}};const $o=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],qo='ck-ai-chat-context-controls',Qo='ck-ai-chat-context-controls__pending-contexts',Xo='ck-ai-chat-context-controls__add-context-balloon-panel',zo='ck-ai-chat-context-controls__add-context-button',jo='ck-ai-chat-context-controls__url-balloon-panel',Jo='ck-ai-chat-context-controls__balloon-button',Zo='ck-ai-chat-context-controls__balloon-button-source',ta='ck-ai-chat-controls-button',ea='ck-ai-chat-context-chips-wrapper-balloon',ia='ck-ai-chat-controls_context_show-more-button',sa='ck-ai-chat-context-controls__show-more-balloon-panel',na='ck-ai-chat',ra=[xt['defaultPositions']['northArrowSouthWest'],xt['defaultPositions']['northArrowSouth'],xt['defaultPositions']['northArrowSouthEast'],xt['defaultPositions']['southArrowNorthWest'],xt['defaultPositions']['southArrowNorth'],xt['defaultPositions']['southArrowNorthEast']];var oa=class extends _0x56a514{addContextButtonView;_currentContextsChips=this['createCollection']();_conversationContextsChips=this['createCollection']();['_overflowManager'];_addContextBalloonPanelView;['_urlBalloonPanelView'];_urlInputView;['_resourcesBalloonView'];_addContextBalloonConfig;_hasExactlyOneSource=!0x1;bodyCollection;constructor(_0x10754b,_0xb726cc){super(_0x10754b),this['bodyCollection']=_0xb726cc['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x10754b),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x10754b),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x10754b),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x10754b,_0xb726cc);const _0x3a86bd={'cssClasses':{'showMoreButton':ia+'\x20'+Dn,'showMoreBalloon':sa,'overflowContainer':ea,'controlsButton':ta}};this['_overflowManager']=new Qr(_0x10754b,this['_currentContextsChips'],_0x3a86bd,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(_0x5592fd,_0x2254af){const _0x33dd18=this['_createContextButton'](_0x5592fd,'current',!0x0,_0x2254af);this['_addContextToCollection'](_0x33dd18,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}removeContextItem(_0x478e6e){this['_removeContextFromCollection'](_0x478e6e,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x478e6e,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}setContextItemLoading(_0x56a61b,_0x2633de){let _0x5ded39=this['_currentContextsChips']['find'](_0x47f5f7=>_0x47f5f7['id']===_0x56a61b);_0x5ded39||(_0x5ded39=this['_overflowManager']['overflowChips']['find'](_0x447b55=>_0x447b55['id']===_0x56a61b)),_0x5ded39&&(_0x5ded39['isLoading']=_0x2633de);}setConversationContext(_0x1d4eef){this['_conversationContextsChips']['clear']();for(const _0x5b7546 of _0x1d4eef){const _0x427014=this['_createContextButton'](_0x5b7546,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x427014,this['_conversationContextsChips']);}}clearCurrentContextItems(){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}clearConversationContextItems(){this['_conversationContextsChips']['clear']();}updateResourceState(_0x1c02d7,_0xa01da7,_0x1d2abf){this['_resourcesBalloonView']['updateResourceState'](_0x1c02d7,_0xa01da7,_0x1d2abf);}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:_0x38d436,withBackButton:_0x4fb4bc}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x38d436,'withBackButton':_0x4fb4bc}),this['addContextButtonView']['isOn']=!0x0;}populateSourceResourceBalloon(_0x5a2872,_0x1fe94a,_0x1ed151,_0x1b4b3a){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x5a2872,_0x1ed151,_0x1b4b3a);}['closeSourceResourceBalloon'](_0x5d52ef){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x5d52ef),this['addContextButtonView']['isOn']=!0x1;}setAddContextOptions(_0x5c34a0){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x5c34a0),this['_setAddContextButtonEnabled'](_0x5c34a0);}_setAddContextButtonEnabled(_0x55bb4b){const _0x213814=!_0x55bb4b['document']['isHidden']&&_0x55bb4b['document']['enabled'],_0x34dcfb=_0x55bb4b['urls']['enabled'],_0x56a8e2=_0x55bb4b['files']['enabled'],_0x26c596=_0x55bb4b['sources']['length']>0x0,_0x2f0482=_0x55bb4b['customItems']&&_0x55bb4b['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x213814||_0x34dcfb||_0x56a8e2||_0x26c596||_0x2f0482;}_setupTemplate(){this['setTemplate']({'tag':'div','attributes':{'class':[qo,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':Qo},'children':this['_currentContextsChips']}]});}_bindEventHandlers(){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}_createAddContextButtonView(_0x5d2609){const _0x185b14=new Mt(_0x5d2609);return _0x185b14['set']({'label':Es(_0x5d2609,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':ta+'\x20'+zo+'\x20'+Dn,'icon':_0x3ff1a2,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x185b14;}_createAddContextBalloonPanelView(_0x55b86f){return this['_createBaseBalloonPanel'](_0x55b86f,Xo);}_createUrlBalloonPanelView(_0x5ddbd7){const _0x3d81b8=this['_createBaseBalloonPanel'](_0x5ddbd7,jo);return this['_addUrlContent'](_0x3d81b8,_0x5ddbd7),_0x3d81b8;}_createResourcesBalloonView(_0x5d640b,_0x2118c2){const _0x59d097={'searchInputVisibleFrom':_0x2118c2['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra});},'onResourceSelected':(_0x23a13e,_0xbe4e23)=>{this['fire']('addResourceToContext',{'source':_0x23a13e,'resource':_0xbe4e23});},'onLoadSourceResources':_0x561e09=>{this['fire']('loadSourceResources',_0x561e09);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new Yo(_0x5d640b,_0x2118c2['bodyCollection'],_0x59d097);}_getLimiterElement(){return this['element']?.['closest']('.'+na)||document['body'];}_createBaseBalloonPanel(_0x1e052f,_0x46693f){const _0xf560d0=new xt(_0x1e052f);return _0xf560d0['extendTemplate']({'attributes':{'class':_0x46693f}}),this['bodyCollection']['add'](_0xf560d0),_0xf560d0;}_setBalloonPanelContent(_0x2fa49b,_0x1fdee7,_0x47fd72){if(_0x2fa49b['content']['clear'](),!_0x47fd72['document']['isHidden']&&_0x47fd72['document']['enabled']){const _0x217c26=this['_createBalloonButton'](_0x1fdee7,{'label':Es(_0x1fdee7,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x2d99a5});_0x217c26['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x2fa49b['content']['add'](_0x217c26);}if(_0x47fd72['urls']['enabled']){const _0x194a9f=this['_createBalloonButton'](_0x1fdee7,{'label':Es(_0x1fdee7,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x3de4d0});_0x194a9f['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra}),this['_urlInputView']['focus']();}),_0x2fa49b['content']['add'](_0x194a9f);}if(_0x47fd72['files']['enabled']){const _0x152ca6=new Gt(_0x1fdee7);_0x152ca6['set']({'label':Es(_0x1fdee7,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x15107d,'withText':!0x0,'tooltip':!0x0,'class':Jo,'allowMultipleFiles':!0x0}),_0x152ca6['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x152ca6['on']('done',(_0x511b5d,_0xa85d6b)=>{this['fire']('addFileToContext',_0xa85d6b);}),_0x152ca6['tooltip']=!0x0,_0x2fa49b['content']['add'](_0x152ca6);}for(const _0x3b0d13 of _0x47fd72['sources']){const _0x42ddfe=this['_createBalloonButton'](_0x1fdee7,{'label':_0x3b0d13['label'],'icon':_0x3b0d13['icon']||_0x325a2b,'type':'source'});_0x2fa49b['content']['add'](_0x42ddfe),_0x42ddfe['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x3b0d13,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x466efa of _0x47fd72['customItems']||[]){const _0x5d0b2c=this['_createBalloonButton'](_0x1fdee7,{'label':_0x466efa['label'],'icon':_0x466efa['icon']||_0x325a2b,'type':'customItem'});_0x2fa49b['content']['add'](_0x5d0b2c),_0x5d0b2c['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x466efa);});}this['_hasExactlyOneSource']=0x1===_0x2fa49b['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}_addUrlContent(_0x1ae121,_0x31aea5){this['_urlInputView']=new xo(_0x31aea5),this['_urlInputView']['on']('submitUrl',(_0x1e2bd1,_0x3cf1e3)=>{this['_handleUrlSubmit'](_0x3cf1e3);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra});}),_0x1ae121['content']['add'](this['_urlInputView']);}_createBalloonButton(_0x1cbcaa,_0x3e35f2){const _0x2d8c4b='source'===_0x3e35f2['type']?new aa(_0x1cbcaa):new Mt(_0x1cbcaa);return _0x2d8c4b['set']({'label':_0x3e35f2['label'],'icon':_0x3e35f2['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':Jo}),_0x2d8c4b;}_setupAllBalloonClickOutsideHandlers(){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}_setupUrlBalloonClickOutsideHandler(){_0x44d1a9({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}_toggleAddContextBalloon(_0x2b89d1){const _0x2074c3=this['_addContextBalloonConfig'];_0x2074c3['buttonView']['isOn']=_0x2b89d1,_0x2b89d1?_0x2074c3['balloonView']['show']():_0x2074c3['balloonView']['hide']();}_setupAddContextBalloonClickOutsideHandler(){const {balloonView:_0x1e2207,buttonView:_0x165b84,hideMethod:_0x23e909}=this['_addContextBalloonConfig'];_0x44d1a9({'emitter':_0x1e2207,'contextElements':[_0x1e2207['element'],_0x165b84['element']],'callback':()=>{_0x23e909();},'activator':()=>_0x165b84['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}_createContextButton(_0x4728ae,_0x4c0742,_0x7548c=!0x1,_0x407cc2=!0x1){const _0x4d0528='conversation'===_0x4c0742||!0x0===_0x4728ae['isReadOnly'],_0x283459=new Wr(this['locale'],_0x4728ae,_0x4d0528,_0x7548c,_0x407cc2);return _0x4d0528||_0x283459['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x283459['id']);}),_0x283459;}_addContextToCollection(_0x5a97d8,_0x256f24){_0x256f24['add'](_0x5a97d8,0x0);}_removeContextFromCollection(_0x3a3e29,_0x1a4ba3){const _0x5c3447=_0x1a4ba3['find'](_0x34645d=>_0x34645d['id']===_0x3a3e29);_0x5c3447&&_0x1a4ba3['remove'](_0x5c3447);}_handleAddContextButtonClick(){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}_handleUrlSubmit(_0x15c84e){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x15c84e);}},aa=class extends Mt{['arrowView'];constructor(_0x3e4b40){super(_0x3e4b40),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[Zo]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}_createArrowView(){const _0x2631f9=new $t();return _0x2631f9['content']=_0x1193f0,_0x2631f9['extendTemplate']({'attributes':{'class':Zo+'__arrow'}}),_0x2631f9;}},ha=class extends _0x56a514{_cancelButtonView;['_loaderView'];constructor(_0xd3e93e){super(_0xd3e93e),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 _0x520df6=new Mt(this['locale']);return _0x520df6['set']({'label':Es(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Pn+'\x20ck-ai-button-stop-generating','icon':st}),_0x520df6['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x520df6;}_createLoaderView(){const _0x23a2c3=new _0x56a514(this['locale']);return _0x23a2c3['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':Es(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x23a2c3;}},ca=class extends _0x56a514{_contextPanelView;_promptInputView;['_dropZoneView'];_promptCapabilitiesView;['_loaderView'];['_modelUnavailableMessageView'];_shouldRestorePromptInputFocus;['_filesEnabled'];constructor(_0xaca5c9,_0xb48cc1){super(_0xaca5c9),this['_filesEnabled']=_0xb48cc1['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0xaca5c9,{'bodyCollection':_0xb48cc1['bodyCollection'],'searchInputVisibleFrom':_0xb48cc1['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0xaca5c9),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0xaca5c9),this['_loaderView']=this['_createLoaderView'](_0xaca5c9),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0xaca5c9),this['_dropZoneView']=new Ao(_0xaca5c9),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage','promptInputPaste')['to'](this),this['_dropZoneView']['delegate']('promptInputPaste')['to'](this),this['_dropZoneView']['on']('dragEnter',()=>this['_contextPanelView']['hideAllBalloons']()),this['_dropZoneView']['bind']('isEnabled')['to'](this,'isLoading',_0x3ce71f=>!_0x3ce71f),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'](...$o)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x199796=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x199796['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x199796['if']('isLoading','ck-hidden',_0x4b7387=>_0x4b7387||!this['isModelAvailable']),_0x199796['if']('isModelAvailable','ck-hidden',_0x5d3b6d=>!_0x5d3b6d||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x199796['if']('isLoading','ck-hidden',_0x296412=>!_0x296412)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x199796['if']('isModelAvailable','ck-hidden',_0x3a82d7=>_0x3a82d7)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0x44d1a9({'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(_0x38e256,_0x5482f0){return new oa(_0x38e256,_0x5482f0);}_createPromptInputView(_0xaaa41a){return new go(_0xaaa41a,this['_contextPanelView']['addContextButtonView']);}_createPromptCapabilitiesView(_0x3bffcf){return new ko(_0x3bffcf);}_createLoaderView(_0xaefc71){return new ha(_0xaefc71);}_createModelUnavailableMessageView(_0x6a672e){const _0x5f3d20=new la(_0x6a672e);return _0x5f3d20['delegate']('startConversation')['to'](this),_0x5f3d20;}_handlePromptInputFocus(_0x3d1e1c,_0x33fb95,_0x374de0){_0x374de0?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}addContextItem(_0x2cb9c2,_0x552e77){this['_contextPanelView']['addContextItem'](_0x2cb9c2,_0x552e77);}removeContextItem(_0x1e03a8){this['_contextPanelView']['removeContextItem'](_0x1e03a8);}setContextItemLoading(_0x586885,_0x497ce3){this['_contextPanelView']['setContextItemLoading'](_0x586885,_0x497ce3);}setIsUploadInProgress(_0x5cb961){this['_promptInputView']['setIsUploadInProgress'](_0x5cb961);}setConversationContext(_0x5d2e1a){this['_contextPanelView']['setConversationContext'](_0x5d2e1a);}clearPendingContextUI(){this['_contextPanelView']['clearCurrentContextItems']();}clearConversationContextUI(){this['_contextPanelView']['clearConversationContextItems']();}updateResourceState(_0x50f7c8,_0x2f32e5,_0x5786c4){this['_contextPanelView']['updateResourceState'](_0x50f7c8,_0x2f32e5,_0x5786c4);}setWebSearch(_0x423b56){this['_promptCapabilitiesView']['setWebSearch'](_0x423b56);}setReasoning(_0x448586){this['_promptCapabilitiesView']['setReasoning'](_0x448586);}resetMessageInput(){this['_promptInputView']['reset']();}setAddContextOptions(_0x2ad29d){this['_contextPanelView']['setAddContextOptions'](_0x2ad29d);}setInputPlaceholder(_0x6c66cd){this['_promptInputView']['setPlaceholderText'](_0x6c66cd);}setModelList(_0x542dc8,_0x27743a){this['_promptCapabilitiesView']['setModelList'](_0x542dc8,_0x27743a);}setModel(_0x5649fb){_0x5649fb?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x5649fb)):this['isModelAvailable']=!0x1;}enableModelSelector(){this['_promptCapabilitiesView']['enableModelSelector']();}disableModelSelector(_0x2069cf){this['_promptCapabilitiesView']['disableModelSelector'](_0x2069cf);}populateSourceResourceBalloon(_0x379d1b,_0x11f9f9,_0x3a86fd,_0x673b55){this['_contextPanelView']['populateSourceResourceBalloon'](_0x379d1b,_0x11f9f9,_0x3a86fd,_0x673b55);}['closeSourceResourceBalloon'](_0x42e8ee){this['_contextPanelView']['closeSourceResourceBalloon'](_0x42e8ee);}focusPromptInput(_0x21596d=!0x1){this['_promptInputView']['focus'](_0x21596d);}setPromptInputValue(_0x486a88){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x486a88;}},la=class extends _0x56a514{constructor(_0x17d719){super(_0x17d719);const _0x5fb387=new Mt(_0x17d719);_0x5fb387['set']({'label':Es(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x5fb387['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':Es(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x5fb387]}]});}},ua=class extends Kt{resizeButton;constructor(_0x4d5b5d,_0x8db98f){super(_0x4d5b5d,{'label':_0x8db98f['label'],'class':'ck-ai-header\x20'+_0x8db98f['class'],'icon':_0x8db98f['icon']}),this['set']('isMaximized',!0x1),_0x8db98f['content']&&this['children']['add'](_0x8db98f['content']),_0x8db98f['showResizeButton']&&(this['resizeButton']=Hn(_0x4d5b5d,this),this['children']['add'](this['resizeButton']));}},da=class extends _0x56a514{constructor(_0x299b9f){super(_0x299b9f),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Es(_0x299b9f,'AI_DISCLAIMER_TEXT')}]}]});}};function _a(_0x2b252f,_0x23ee97){const _0x3b7d18=new Mt(_0x2b252f);return _0x3b7d18['set']({'label':Es(_0x2b252f,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x3da945,'class':'ck-ai-chat__start-conversation\x20'+Pn}),_0x3b7d18['on']('execute',()=>{_0x23ee97['fire']('startConversation');}),_0x3b7d18;}var ga=class extends _0x56a514{chatHeader;chatFeed;chatControls;chatDisclaimer;_bodyCollection;constructor(_0x2aa254,_0x52eaae){super(_0x2aa254),this['_bodyCollection']=Mn(_0x2aa254);const _0x2dee34=_a(_0x2aa254,this);this['chatHeader']=new ua(_0x2aa254,{'label':Es(_0x2aa254,'AI_CHAT_HEADING'),'icon':_0x19cce7,'class':'ck-ai-header_chat','content':_0x2dee34,'showResizeButton':_0x52eaae['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new co(_0x2aa254,this['_bodyCollection']),this['chatFeed']['delegate'](...sr)['to'](this),this['chatControls']=new ca(_0x2aa254,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x52eaae['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x52eaae['filesEnabled']}),this['chatControls']['delegate'](...sr)['to'](this),this['chatDisclaimer']=new da(_0x2aa254),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x2aa254['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}populateSourceResourceBalloon(_0x5d36d3,_0x107087,_0x545297,_0x47345c){this['chatControls']['populateSourceResourceBalloon'](_0x5d36d3,_0x107087,_0x545297,_0x47345c);}['closeSourceResourceBalloon'](_0x201129){this['chatControls']['closeSourceResourceBalloon'](_0x201129);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Aa=class extends _0x898608{static get requires(){return[gs];}['_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;get['idleUiPromise'](){return this['_promiseQueue']['queueEmptyPromise'];}constructor(_0x5c20a8){super(_0x5c20a8);const _0x5e25ba=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['set']('isChatStreaming',!0x1),this['_promiseQueue']=new Sr(),this['_view']=new ga(this['context']['locale'],{'showResizeButton':_0x5e25ba['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'](_0x5e25ba),this['_view']['delegate'](...sr)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x4efcde,{showDiff:_0x26914f})=>{this['showDiff']=_0x26914f;}),this['disableControls'](),_0x5e25ba['view']['addTab']({'id':'chat','buttonLabel':Es(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x19cce7,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x5e25ba['view'],'isMaximized',_0x49ee9b=>_0x49ee9b),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isChatStreaming',_0xc48b5e=>_0xc48b5e),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}destroy(){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}createConversation({availableModels:_0x443767}){const _0x323e97=this['context']['config']['get']('ai.chat.welcomeMessage')??Es(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x443767,!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x323e97}),this['fire']('conversationCreated');}async addFeedItemStaticMessage({id:_0xd4e613,staticMessage:_0x3fc576}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0xd4e613,'initialContent':'<p>'+_0x3fc576+'</p>'});});}async addFeedItemUserMessage(_0x381290){const _0x7914f1=_0x381290['attributes']?.['displayedPrompt']||_0x381290['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x381290['contextItems']['values']()),'initialContent':'<p>'+_0x7914f1+'</p>','id':_0x381290['id']});});}async addFeedItemError({errorMessage:_0x4987e1,id:_0x389ea5}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x4987e1+'</p>','id':_0x389ea5});});}async addFeedItemAIReply(_0xbc32ea){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0xbc32ea['interactionId']+':'+_0xbc32ea['id']}),this['clearLoadingMessage']();});}async addFeedItemAISuggestion(_0x333434){const _0x46658f=bs(this['context']),_0x5c911e=_0x46658f['map'](_0x57535c=>_0x57535c['config']['get']('ai.availableReplyActions')||[...Or]);let _0xb531df=_0x5c911e['reduce']((_0x1c63e5,_0x5a9b7b)=>_0x1c63e5['filter'](_0x5c4a7a=>_0x5a9b7b['includes'](_0x5c4a7a)),_0x5c911e[0x0]||[...Or]);const _0x4bedcb=_0x46658f['every'](_0x192044=>_0x192044['plugins']['has']('TrackChanges')),_0x15d2ff=_0x46658f['map'](_0x4a1b82=>_0x4a1b82['commands']['get']('trackChanges'));return _0x4bedcb?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x15d2ff,'value',(..._0x4b39f5)=>_0x4b39f5['some'](_0x5ac46e=>_0x5ac46e))):_0xb531df=_0xb531df['filter'](_0x126faa=>'insertSuggestion'!=_0x126faa),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x333434['interactionId']+':'+_0x333434['id'],'areActionsDisabled':_0x333434['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0xb531df}),this['clearLoadingMessage']();});}async addFeedInteractionHeader(_0x351335,_0x1127c0){return this['_promiseQueue']['enqueue'](async()=>{const _0x5d6cdf=this['_view']['chatFeed']['children']['last'];if(_0x5d6cdf instanceof so)return this['_view']['chatFeed']['children']['remove'](_0x5d6cdf),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x351335['id'],'capabilities':{'isWebSearchEnabled':_0x5d6cdf['capabilities']['isWebSearchEnabled']||_0x1127c0['isWebSearchEnabled'],'isReasoningEnabled':_0x5d6cdf['capabilities']['isReasoningEnabled']||_0x1127c0['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x351335['id'],'capabilities':_0x1127c0});});}async addFeedItemCustomElement(_0x134d49,_0x2bb6b1){let _0x5b4456;return await this['_promiseQueue']['enqueue'](async()=>{_0x5b4456=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x134d49,'id':_0x2bb6b1});}),_0x5b4456;}removeFeedItem(_0x6f9009){this['_view']['chatFeed']['removeItem'](_0x6f9009);}hasFeedItem(_0x2d495a){return this['_view']['chatFeed']['hasItem'](_0x2d495a);}updateFeedInteractionHeader(_0x2342dc){const _0x483c95=this['_view']['chatFeed']['children']['find'](_0x54d65c=>_0x54d65c['options']['id']==_0x2342dc['id']&&_0x54d65c instanceof so);_0x483c95&&_0x483c95['set']('isVisible',_0x2342dc['isVisible']);}async updateFeedItemAIReplyContent(_0x315922){const _0x2391cd=_0x315922['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x181541=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x315922,'abortSignal':_0x181541,'renderingStrategy':_0x2391cd}),_0x315922['isDone']&&this['markFeedItemAsDone'](_0x315922['id']);});}updateFeedItemAIReplySources(_0x422003,_0x396026){this['_view']['chatFeed']['updateWebSources'](_0x422003,_0x396026);}async updateFeedItemAIReplySuggestionContent(_0x42b75d){return this['_promiseQueue']['enqueue'](async _0x210570=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x42b75d,'abortSignal':_0x210570}),_0x42b75d['isDone']&&this['markFeedItemAsDone'](_0x42b75d['id']);});}updateFeedItemAIReplySuggestionPartState(_0x4a6cd8){this['_view']['chatFeed']['updateSuggestionPartState'](_0x4a6cd8);}setSuggestionGating(_0x6a8d97,_0x25595c){this['_view']['chatFeed']['updateSuggestionGating'](_0x6a8d97,_0x25595c);}setFeedItemAIReplySuggestionPartActive(_0x14a8c4){this['_view']['chatFeed']['setSuggestionPartActive'](_0x14a8c4);}markFeedItemAsDone(_0x16efc9){this['_view']['chatFeed']['markItemAsDone'](_0x16efc9);}removeFeedInteraction(_0x39118d){this['_view']['chatFeed']['getItemIds']()['filter'](_0x58711f=>_0x58711f['startsWith'](_0x39118d))['forEach'](_0x47a69c=>this['_view']['chatFeed']['removeItem'](_0x47a69c));}startInteraction(){const _0x12b81a=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x12b81a),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['isChatStreaming']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}stopInteraction(_0x4c27ed){this['_promiseQueue']['abort'](),_0x4c27ed&&this['_view']['chatFeed']['getItemIds']()['filter'](_0x40212c=>_0x40212c['startsWith'](_0x4c27ed['id']))['forEach'](_0x35bc64=>this['markFeedItemAsDone'](_0x35bc64)),this['resetChatBusyStateToIdle']();}resetChatBusyStateToIdle(){this['isBusy']=!0x1,this['isChatStreaming']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();}async finishInteraction(){return this['_promiseQueue']['queueEmptyPromise']['then'](()=>{this['resetChatBusyStateToIdle']();});}addContextItem(_0x4a5349,_0x45b2fc){this['_view']['chatControls']['addContextItem'](_0x4a5349,_0x45b2fc);}removeContextItem(_0x2bb9b2){this['_view']['chatControls']['removeContextItem'](_0x2bb9b2);}setContextItemLoading(_0x3a291b,_0x41b5e8){this['_view']['chatControls']['setContextItemLoading'](_0x3a291b,_0x41b5e8);}setIsUploadInProgress(_0x46dd43){this['_view']['chatControls']['setIsUploadInProgress'](_0x46dd43);}setConversationContext(_0xd0ce42){this['_view']['chatControls']['setConversationContext'](_0xd0ce42);}clearPendingContextUI(){this['_view']['chatControls']['clearPendingContextUI']();}clearConversationContextUI(){this['_view']['chatControls']['clearConversationContextUI']();}updateResourceState(_0x17f8ad,_0x3bebf8,_0x487038){this['_view']['chatControls']['updateResourceState'](_0x17f8ad,_0x3bebf8,_0x487038);}resetMessageInput(){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}setAddContextOptions(_0x3427c9){this['_view']['chatControls']['setAddContextOptions'](_0x3427c9);}updateCapabilities(_0x2904a3){this['_view']['chatControls']['setWebSearch'](_0x2904a3['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x2904a3['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x2904a3));}setSelectedModel(_0x3404ba,_0x460203){this['_view']['chatControls']['setModel'](_0x3404ba),_0x460203&&this['_view']['chatControls']['disableModelSelector'](!0x1);}setFeedItemRenderingStrategy(_0x21f33a){this['feedItemRenderingStrategy']=_0x21f33a;}toggleLoadingSkeleton(_0x1a9f36){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x1a9f36);}resetConversationTitle(){this['setConversationTitle'](Es(this['context']['locale'],'AI_CHAT_HEADING'));}emptyConversationTitle(){this['setConversationTitle']('');}setConversationTitle(_0x4608a6,_0x28d8fb=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0x28d8fb&&!Et()&&_0x4608a6['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x4608a6);this['_view']['chatHeader']['label']=_0x4608a6;}setLoadingMessage(_0x40b3d4){this['_view']['chatFeed']['setLoadingMessage'](_0x40b3d4);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}_animateConversationTitle(_0x18af93){let _0x2e977b=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x18af93[_0x2e977b],_0x2e977b++,_0x2e977b===_0x18af93['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x3e7664){return _0x3e7664['isWebSearchEnabled']&&_0x3e7664['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x3e7664['isWebSearchEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x3e7664['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}_getInputPlaceholder(_0x5ee36d){return _0x5ee36d?_0x5ee36d['isWebSearchEnabled']&&_0x5ee36d['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x5ee36d['isWebSearchEnabled']?Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x5ee36d['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}populateSourceResourceBalloon(_0x2f2f84,_0x48cba4,_0x13d885,_0x3e9dc7){this['_view']['populateSourceResourceBalloon'](_0x2f2f84,_0x48cba4,_0x13d885,_0x3e9dc7);}['closeSourceResourceBalloon'](_0x489d06){this['_view']['closeSourceResourceBalloon'](_0x489d06);}setPromptInputValue(_0x3f2f99){this['_view']['chatControls']['setPromptInputValue'](_0x3f2f99);}focusPromptInput(_0x3b6456=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x3b6456);}scrollFeedToSuggestion(_0x587c48,_0x7c5c0b){this['_view']['chatFeed']['scrollToSuggestion'](_0x587c48,_0x7c5c0b);}startAutoScroll(_0x2316e7={}){this['_view']['chatFeed']['startAutoScroll'](_0x2316e7);}stopAutoScroll(){this['_view']['chatFeed']['stopAutoScroll']();}disableControls(){this['_view']['chatControls']['isDisabled']=!0x0;}enableControls(){this['_view']['chatControls']['isDisabled']=!0x1;}toggleConversationLoading(_0x34e03a){_0x34e03a?(this['isBusy']=_0x34e03a,this['disableControls']()):(this['enableControls'](),this['resetChatBusyStateToIdle']());}},Ia=class extends Jt{sections;constructor(_0x1dabf2,_0xdc5473){super(_0x1dabf2),this['sections']=_0xdc5473,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}filter(_0x57138c){let _0x1249b6=0x0,_0x44e55b=0x0;for(const _0x31ded0 of this['sections']){const {resultsCount:_0x4d1153,totalItemsCount:_0x513bb3}=_0x31ded0['filter'](_0x57138c);_0x1249b6+=_0x4d1153,_0x44e55b+=_0x513bb3;}return{'resultsCount':_0x1249b6,'totalItemsCount':_0x44e55b};}},pa=class extends jt{title;itemsViews;_itemsListView;constructor(_0x19235f,{title:_0x3b7a5c,items:_0x3d8d64}){super(_0x19235f);const _0x5ad1a8=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x3b7a5c,this['itemsViews']=_0x3d8d64;const _0x1ac70d=new _0x56a514(_0x19235f);_0x1ac70d['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new Jt(_0x19235f),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x5ad1a8['if']('isVisible','ck-hidden',_0x2fc25d=>!_0x2fc25d)]},'children':[_0x1ac70d,this['_itemsListView']]});}filter(_0x412147){const _0x21ea6b=this['itemsViews']['length'];let _0x1444f0=0x0;for(const _0x4b063c of this['itemsViews'])_0x412147?(_0x4b063c['isVisible']=!!_0x4b063c['isMatching'](_0x412147),_0x4b063c['highlightText'](_0x412147)):(_0x4b063c['isVisible']=!0x0,_0x4b063c['highlightText'](null)),_0x4b063c['isVisible']&&_0x1444f0++;return this['isVisible']=_0x1444f0>0x0,{'resultsCount':_0x1444f0,'totalItemsCount':_0x21ea6b};}getItem(_0x54343f){return this['itemsViews']['find'](_0x54cfca=>_0x54cfca['id']===_0x54343f);}removeItem(_0x3b5424){const _0x299cdc=this['itemsViews']['indexOf'](_0x3b5424);-0x1!==_0x299cdc&&(this['itemsViews']['splice'](_0x299cdc,0x1),this['_itemsListView']['items']['remove'](_0x3b5424));}};const Ea=/* #__PURE__ -- @preserve */
|
|
34
|
-
_0x5a953b(jt);var ma=class AIChatHistoryListItemView extends Ea{['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(_0x217a9d,_0x5cc329){super(_0x217a9d);const _0x2f9384=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x5cc329['pinned']),this['set']('loadingState',null),this['set']('title',_0x5cc329['title']),this['id']=_0x5cc329['id'];const {createdAt:_0x21fbe2,active:_0x101085=!0x1}=_0x5cc329;this['_titleView']=new Yt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x9c07a2=this['_createCheckView'](),_0x12f43a=this['_createPinButtonView'](_0x217a9d),_0x268949=this['_createMenuDropdownView'](),_0x26c7a1=this['_createEditInputView'](_0x217a9d),_0x4c5161=this['_createAcceptEditButtonView'](_0x217a9d,_0x26c7a1),_0x22ae5f=this['_createCancelEditButtonView'](_0x217a9d);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x12f43a),this['actions']['add'](_0x268949),this['on']('change:isEdit',(_0x103800,_0x5d61ea,_0x212448)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x212448?(this['actions']['add'](_0x4c5161),this['actions']['add'](_0x22ae5f),this['mainContent']['add'](_0x26c7a1),_0x26c7a1['element']['value']=this['title']||'',_0x26c7a1['element']['focus']()):(this['actions']['add'](_0x12f43a),this['actions']['add'](_0x268949),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x101085?'ck-ai-chat-history__item--active':'',_0x2f9384['if']('isVisible','ck-hidden',_0xffa49=>!_0xffa49),_0x2f9384['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',_0x2f9384['if']('loadingState','ck-hidden',_0x1bdb29=>!!_0x1bdb29)]},'children':_0x101085?[_0x9c07a2]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x2f9384['if']('loadingState','ck-hidden',_0xcb402d=>!_0xcb402d)]},'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',_0x2f9384['if']('loadingState','ck-hidden',_0x238546=>!!_0x238546)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x2f9384['if']('loadingState','ck-hidden',_0x1b9906=>!_0x1b9906)]},'children':[{'text':_0x2f9384['to']('loadingState',_0x449388=>_0x449388?Es(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x449388]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x21fbe2]}]},{'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(_0x428adc){this['set']('title',_0x428adc);}updateLoadingState(_0x42f0aa,_0x46c046){this['set']('loadingState',_0x46c046?_0x42f0aa:null);}_createCheckView(){const _0x20bcba=new $t();return _0x20bcba['set']({'content':_0x48b061}),_0x20bcba;}_createPinButtonView(_0x16b5fa){const _0x45433c=new Mt(_0x16b5fa);return _0x45433c['set']({'label':Es(_0x16b5fa,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x5b153c,'withText':!0x1,'tooltip':!0x0}),_0x45433c['bind']('isOn')['to'](this,'pinned'),_0x45433c['on']('execute',()=>{const _0x67d8a8=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x67d8a8});}),_0x45433c;}_createMenuDropdownView(){const _0x7cc662=_0x48403c(this['locale']),_0x1b4627=_0x7cc662['panelView']['children'];_0x7cc662['buttonView']['set']({'label':Es(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':rt}),_0x7cc662['panelPosition']='sw';const _0x3b59fb=new Mt(this['locale']);_0x3b59fb['label']=Es(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x3b59fb['withText']=!0x0,_0x3b59fb['on']('execute',()=>{this['isEdit']=!0x0;});const _0x3ae52c=new Mt(this['locale']);_0x3ae52c['label']=Es(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x3ae52c['withText']=!0x0,_0x3ae52c['on']('execute',()=>{this['showConfirm'](Es(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x493731=new Jt(this['locale']),_0x2450bb=new jt(this['locale']);_0x2450bb['children']['add'](_0x3b59fb);const _0x519b55=new jt(this['locale']);return _0x519b55['children']['add'](_0x3ae52c),_0x493731['items']['addMany']([_0x2450bb,_0x519b55]),_0x1b4627['add'](_0x493731),_0x7cc662;}_createEditInputView(_0x166163){const _0x2b982b=new qt(_0x166163),_0x49dcb8=_0x2b982b['bindTemplate'];return _0x2b982b['extendTemplate']({'on':{'keydown':_0x49dcb8['to'](_0x44efb9=>{'Enter'==_0x44efb9['key']&&this['_commitEditInputValue'](_0x2b982b);})}}),_0x2b982b;}_createAcceptEditButtonView(_0x142d51,_0x3a4015){const _0x921d4a=new Mt(_0x142d51);return _0x921d4a['set']({'icon':_0x48b061,'withText':!0x1,'tooltip':Es(_0x142d51,'AI_CHAT_HISTORY_ACCEPT')}),_0x921d4a['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x921d4a['on']('execute',()=>{this['_commitEditInputValue'](_0x3a4015);}),_0x921d4a;}_commitEditInputValue(_0x11eb85){const _0x332940=_0x11eb85['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x332940});}_createCancelEditButtonView(_0x26fdfb){const _0x23cd65=new Mt(_0x26fdfb);return _0x23cd65['set']({'icon':_0x572ba4,'withText':!0x1,'tooltip':Es(_0x26fdfb,'AI_CHAT_HISTORY_CANCEL')}),_0x23cd65['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x23cd65['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x23cd65;}_createSpinnerView(){const _0x2fc812=new Dr('tiny');return _0x2fc812['isVisible']=!0x0,_0x2fc812;}isMatching(_0x326a62){return'string'==typeof this['title']&&this['title']['match'](_0x326a62)?{'title':!0x0}:null;}highlightText(_0x58f278){this['_titleView']['highlightText'](_0x58f278);}},Ta=class extends _0x56a514{['headerView'];['searchView'];['mainErrorView'];skeletonView;emptyView;sectionsView;constructor(_0x1ef502,_0x2a86c6){super(_0x1ef502),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x4633fe=_a(_0x1ef502,this);this['headerView']=new ua(_0x1ef502,{'label':Es(_0x1ef502,'AI_CHAT_HISTORY_HEADING'),'icon':_0x4afa16,'class':'ck-ai-header_history','content':_0x4633fe,'showResizeButton':_0x2a86c6}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Ia(_0x1ef502,[]),this['sectionsView']['delegate'](...wa)['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',_0x3a749d=>!_0x3a749d)]}}),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 _0x226e5f=new _0xdb63d9(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x4b8edd=>Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x4b8edd),'secondary':Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x1058f3=this['_createErrorView']();return _0x1058f3['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x19b1a6=>!_0x19b1a6)]}}),_0x226e5f['on']('render',()=>{_0x226e5f['children']['add'](_0x1058f3,0x1);}),_0x226e5f['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x5d3a7a=>!_0x5d3a7a)]}}),_0x226e5f;}_createSkeletonView(){const _0xc11ee8=new wr(this['locale'],Cr['aiHistory']);return _0xc11ee8['bind']('isVisible')['to'](this,'isLoading'),_0xc11ee8;}_createErrorView(){const _0x513c5d=new _0x56a514(this['locale']),_0x303fd3=new Mt(this['locale']);_0x303fd3['set']({'withText':!0x1,'icon':_0x572ba4,'class':'ck-ai-notification_error__dismiss-button'}),_0x303fd3['bind']('isVisible')['to'](this,'hasItems',_0x19245f=>!!_0x19245f),_0x303fd3['on']('execute',()=>{this['errorMessage']='';});const _0x36144a=this['bindTemplate'];return _0x513c5d['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x36144a['to']('errorMessage')}]},_0x303fd3]}),_0x513c5d;}_createEmptyStateView(){const _0x9fcfbd=new _0x56a514(this['locale']);return _0x9fcfbd['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x295593=>!_0x295593)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Es(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x9fcfbd;}_createListItemViews(_0x2eca43,_0x3b6c19){const _0x356dc=[];for(const _0x953a1a of _0x2eca43){const _0x40a5cf=new ma(_0x3b6c19,_0x953a1a);_0x40a5cf['delegate'](...wa)['to'](this),_0x356dc['push'](_0x40a5cf);}return _0x356dc;}updateHistoryItemsWithCategories(_0x279da7){const _0x1397c2=this['locale']||'en',_0x59c7b4=[];for(const _0x23f35e of _0x279da7){const _0x3ba54d=this['_createListItemViews'](_0x23f35e['items'],_0x1397c2);_0x59c7b4['push'](new pa(_0x1397c2,{'title':_0x23f35e['title'],'items':_0x3ba54d}));}this['sectionsView']['sections']=_0x59c7b4,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x59c7b4),this['hasItems']=_0x279da7['some'](_0x5dd84a=>_0x5dd84a['items']['length']>0x0),this['_refreshSearch']();}removeHistoryItem(_0x4640a2){for(const _0x33468a of this['sectionsView']['sections']){const _0x276ff9=_0x33468a['getItem'](_0x4640a2);if(_0x276ff9){if(_0x33468a['removeItem'](_0x276ff9),0x0===_0x33468a['itemsViews']['length']){const _0x3c5759=this['sectionsView']['sections']['indexOf'](_0x33468a);-0x1!==_0x3c5759&&(this['sectionsView']['sections']['splice'](_0x3c5759,0x1),this['sectionsView']['items']['remove'](_0x33468a));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}updateItemTitle(_0x59403d,_0x42ca2b){for(const _0x16f138 of this['sectionsView']['sections']){const _0x3e70f8=_0x16f138['getItem'](_0x59403d);if(_0x3e70f8){_0x3e70f8['updateTitle'](_0x42ca2b);break;}}}updateItemLoadingState(_0x590fbe,_0x346cb9,_0x5ae150){for(const _0x4ac78f of this['sectionsView']['sections']){const _0x4de325=_0x4ac78f['getItem'](_0x590fbe);if(_0x4de325){_0x4de325['updateLoadingState'](_0x346cb9,_0x5ae150);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x519798=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x519798);}}};const wa=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var Ca=class extends _0x898608{static get requires(){return[gs];}_historyView;static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1fe769){super(_0x1fe769);const _0x7976a1=this['context']['plugins']['get']('AITabs');this['_historyView']=new Ta(this['context']['locale'],_0x7976a1['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x7976a1),this['_historyView']['delegate'](...wa)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x7976a1['view'],'isMaximized',_0x490e5=>_0x490e5),_0x7976a1['view']['addTab']({'id':'history','buttonLabel':Es(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x4afa16,'order':0x0,'content':this['_historyView']});}removeHistoryItem(_0x5cf98b){this['_historyView']['removeHistoryItem'](_0x5cf98b);}updateItems(_0x324192){this['_historyView']['updateHistoryItemsWithCategories'](_0x324192);}updateItemTitle(_0xd732da,_0x262969){this['_historyView']['updateItemTitle'](_0xd732da,_0x262969);}updateItemLoadingState(_0x213187,_0x9c79a2,_0x182350){this['_historyView']['updateItemLoadingState'](_0x213187,_0x9c79a2,_0x182350);}setLoadingSkeleton(_0x184277){this['_historyView']['isLoading']=_0x184277;}['showError'](_0xb6ec70){this['_historyView']['errorMessage']=_0xb6ec70;}['hideError'](){this['_historyView']['errorMessage']='';}};const fa=/* #__PURE__ -- @preserve */
|
|
35
|
-
At();var ba=class extends fa{['id'];createdAt;constructor({id:
|
|
36
|
-
dt();var Ra=class extends Sa{items=[];connector;['group'];constructor({connector:_0x2943d1,group:_0x369ee9}){super(),this['connector']=_0x2943d1,this['group']=_0x369ee9;}async init(){try{const _0x1c435f=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x1c435f);}catch(_0x490e77){this['fire']('error',{'error':_0x490e77,'operation':'init'});}}addItem(_0x1ef300){this['items']['push'](_0x1ef300);}async removeItem(_0x351f14){const _0x15b060=this['items']['findIndex'](_0x4e17c4=>_0x4e17c4['id']===_0x351f14);if(-0x1===_0x15b060)return!0x1;try{return await this['connector']['deleteConversation'](_0x351f14)['execute'](),this['items']['splice'](_0x15b060,0x1),this['fire']('itemRemoved',{'itemId':_0x351f14}),!0x0;}catch(_0x359fe1){return this['fire']('error',{'error':_0x359fe1,'operation':'removeItem','itemId':_0x351f14}),!0x1;}}getItem(_0x1d1d7c){return this['items']['find'](_0x476f18=>_0x476f18['id']===_0x1d1d7c);}async updateItemTitle(_0x39d0bd,_0x5f55c9){const _0x3902c0=this['getItem'](_0x39d0bd);if(!_0x3902c0)return!0x1;try{return await this['connector']['updateConversation'](_0x39d0bd,{'title':_0x5f55c9})['getResult'](),_0x3902c0['updateTitle'](_0x5f55c9),this['fire']('itemUpdated',{'itemId':_0x39d0bd,'updates':{'title':_0x5f55c9}}),!0x0;}catch(_0x283b50){return this['fire']('error',{'error':_0x283b50,'operation':'updateItemTitle','itemId':_0x39d0bd}),!0x1;}}async updateItemPinned(_0x22cf5d,_0x5afed5){const _0xb7d944=this['getItem'](_0x22cf5d);if(!_0xb7d944)return!0x1;try{return await this['connector']['updateConversation'](_0x22cf5d,{'pinned':_0x5afed5})['getResult'](),_0xb7d944['updatePinned'](_0x5afed5),this['fire']('itemUpdated',{'itemId':_0x22cf5d,'updates':{'pinned':_0x5afed5}}),!0x0;}catch(_0x5cf34d){return this['fire']('error',{'error':_0x5cf34d,'operation':'updateItemPinned','itemId':_0x22cf5d}),!0x1;}}loadItems(_0x3f5ddb){try{this['items']=[],_0x3f5ddb['map'](_0x5021f2=>{this['addItem'](new ba(_0x5021f2));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x5f2757){this['fire']('error',{'error':_0x5f2757,'operation':'loadItems'});}}getItems(_0x1d5dba={}){const _0x1eeade=void 0x0!==_0x1d5dba['pinned']&&_0x1d5dba['pinned'],_0x709e38=_0x1d5dba['from']?new Date(_0x1d5dba['from']['getFullYear'](),_0x1d5dba['from']['getMonth'](),_0x1d5dba['from']['getDate']()):null,_0x137099=_0x1d5dba['to']?new Date(_0x1d5dba['to']['getFullYear'](),_0x1d5dba['to']['getMonth'](),_0x1d5dba['to']['getDate']()):null;return this['items']['filter'](_0x4d043b=>{if(_0x4d043b['pinned']!==_0x1eeade)return!0x1;if(_0x137099){const _0x16aa0b=new Date(_0x4d043b['createdAt']['getFullYear'](),_0x4d043b['createdAt']['getMonth'](),_0x4d043b['createdAt']['getDate']());return _0x709e38?_0x709e38['getTime']()===_0x137099['getTime']()?_0x16aa0b['getTime']()===_0x709e38['getTime']():_0x16aa0b<_0x137099&&_0x16aa0b>=_0x709e38:_0x16aa0b<_0x137099;}return!0x0;});}},Oa=class extends _0x898608{_aiConnector;_reporter;_aiChatHistoryUi;_aiChatController;static get requires(){return[Is,Nn,er,Ca,gs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_aiConnector']=this['context']['plugins']['get'](Is),this['_aiChatHistoryUi']=this['context']['plugins']['get'](Ca),this['_aiChatController']=this['context']['plugins']['get'](er),this['_reporter']=this['context']['plugins']['get'](Nn)['createReporter']('aichathistory');const _0x5b3e9f=this['context']['plugins']['get'](gs);try{const _0x5614a4=this['_aiChatController']['getGroupId']();this['history']=new Ra({'connector':this['_aiConnector'],'group':_0x5614a4}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x270da2,_0xcbaeb4)=>{this['_setItemLoading'](_0xcbaeb4['id'],'remove'),this['_handleRemove'](_0xcbaeb4['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x558267,_0x4923b9)=>{this['_setItemLoading'](_0x4923b9['id'],'rename'),this['_handleEditTitle'](_0x4923b9['id'],_0x4923b9['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x5a6dd4,_0x2f3ad9)=>{void 0x0!==_0x2f3ad9['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x2f3ad9['itemId'],_0x2f3ad9['updates']['title']),void 0x0!==_0x2f3ad9['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x2f3ad9['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x14e059,_0x492a1e)=>{this['_aiChatController']['_handleRemovedConversation'](_0x492a1e['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x492a1e['itemId']),this['_clearItemLoading'](_0x492a1e['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x198b0b,_0x757ad4)=>{this['_handleHistoryErrorUI'](_0x757ad4['error'],_0x757ad4['operation'],_0x757ad4['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x2a596b,_0x31bb3f)=>{this['_handleSelectConversation'](_0x31bb3f['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x2bbd33,_0x132091)=>{const _0x28a751=_0x132091['pinned']?'pin':'unpin';this['_setItemLoading'](_0x132091['id'],_0x28a751),this['_handleTogglePin'](_0x132091['id'],_0x132091['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x5b3e9f['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x5b3e9f['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x1723bc){this['_handleHistoryErrorUI'](_0x1723bc,'init');}}async _handleEditTitle(_0x5cefb1,_0x26af96){await this['history']['updateItemTitle'](_0x5cefb1,_0x26af96);}async['_handleTogglePin'](_0x3521e4,_0x3a98f4){await this['history']['updateItemPinned'](_0x3521e4,_0x3a98f4);}async['_handleRemove'](_0x23977a){await this['history']['removeItem'](_0x23977a);}async _handleSelectConversation(_0x39bacd){await this['_aiChatController']['loadConversation'](_0x39bacd);}async _showConversationHistory(){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_updateHistoryItemsUI(){const _0xbf4dea=this['_aiChatController']['activeConversation']?.['id'],_0x159480=this['_getCategorizedItems']()['map'](_0x251fcf=>({'title':_0x251fcf['title'],'items':_0x251fcf['items']['map'](_0x5378c7=>({'id':_0x5378c7['id'],'title':_0x5378c7['title']||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x5378c7['createdAt'])['toLocaleDateString'](),'active':_0x5378c7['id']===_0xbf4dea,'pinned':_0x5378c7['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x159480);}_setItemLoading(_0x51aad7,_0x328ad1){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x51aad7,_0x328ad1,!0x0);}_clearItemLoading(_0x46d919){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x46d919,null,!0x1);}_handleHistoryErrorUI(_0x536e19,_0x3ffa35,_0xea3463){const _0xe13562=this['_generateErrorMessage'](_0x3ffa35,_0xea3463);this['_aiChatHistoryUi']['showError'](_0xe13562),this['_reporter']['reportError'](_0x536e19,{'context':{'operation':_0x3ffa35}}),_0xea3463&&this['_clearItemLoading'](_0xea3463),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_generateErrorMessage(_0x5a7801,_0x312576){const _0xad7f56=_0x312576?this['history']['getItem'](_0x312576):null,_0x3c568b=_0xad7f56?.['title']||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x5a7801){case'updateItemTitle':return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x3c568b);case'updateItemPinned':{const _0x56aeb2=Es(this['context']['locale'],_0xad7f56?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x56aeb2,_0x3c568b]);}case'removeItem':return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x3c568b);case'init':case'loadItems':return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}_getCategorizedItems(){const _0x45fbe8=new Date(),_0x1f20d3=new Date(_0x45fbe8['getFullYear'](),_0x45fbe8['getMonth'](),_0x45fbe8['getDate']()),_0x4501fb=new Date(_0x1f20d3);_0x4501fb['setDate'](_0x4501fb['getDate']()-0x1);const _0x9be5e6=new Date(_0x1f20d3);_0x9be5e6['setDate'](_0x9be5e6['getDate']()-0xe);const _0x5c79ec=this['history']['getItems']({'pinned':!0x0}),_0x56fee7=this['history']['getItems']({'from':_0x1f20d3,'to':_0x1f20d3}),_0x27a21b=this['history']['getItems']({'from':_0x4501fb,'to':_0x4501fb}),_0x1f4dfe=this['history']['getItems']({'from':_0x9be5e6,'to':_0x4501fb}),_0x1d9f52=this['history']['getItems']({'to':_0x9be5e6}),_0x184c27=[];return _0x5c79ec['length']>0x0&&_0x184c27['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x5c79ec}),_0x56fee7['length']>0x0&&_0x184c27['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x56fee7}),_0x27a21b['length']>0x0&&_0x184c27['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x27a21b}),_0x1f4dfe['length']>0x0&&_0x184c27['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x1f4dfe}),_0x1d9f52['length']>0x0&&_0x184c27['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x1d9f52}),_0x184c27;}},va=class extends _0x898608{static get requires(){return[Oa,Ca];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ka=class extends _0x898608{static get requires(){return[er,tn,Aa,va,vn];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3c4a5d){super(_0x3c4a5d),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'contextLibrary':{'enabled':!0x1},'sources':[],'alwaysAddSelection':!0x1,'paste':{'textThreshold':0x5dc}}),this['context']['config']['define']('ai.chat.initialConversation','new');}},ya=class extends Mt{['id'];constructor(_0x505c26,_0x3c4921){super(_0x505c26);const {id:_0x4dea5d,type:_0x256c4a,icon:_0x268640}=_0x3c4921;this['id']=_0x4dea5d,this['set']({'label':_0x3c4921['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x3c4921['id']}}),_0x268640?this['icon']=_0x268640:'chat'===_0x256c4a?this['icon']=_0x19cce7:'review'===_0x256c4a?this['icon']=_0x510915:'translate'===_0x256c4a&&(this['icon']=_0x370c5b);}},Na=class extends _0x56a514{listView;constructor(_0x26238f,_0x5b011e){super(_0x26238f),this['set']('isEnabled',!0x0);const _0x271b23=_0x5b011e['map'](_0x5560da=>{const _0x9f60d5=new jt(this['locale']),_0x40ee97=new ya(this['locale'],_0x5560da);return _0x40ee97['bind']('isEnabled')['to'](this),_0x9f60d5['children']['add'](_0x40ee97),_0x40ee97['delegate']('execute')['to'](this),_0x9f60d5;});this['listView']=new Jt(this['locale']),this['listView']['items']['addMany'](_0x271b23),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const xa='chat-shortcuts';var La=class extends _0x898608{_shortcuts;_shortcutsView;_aiChatUI;_listenedConversation;static get requires(){return[Aa,fs];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_aiChatUI']=this['context']['plugins']['get'](Aa),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x23a33c=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x57075c=_0x23a33c['activeConversation'];_0x57075c['isFromHistory']||this['_injectShortcuts'](_0x57075c);}),this['listenTo'](_0x23a33c,'interactionStarted',()=>{this['_removeShortcuts']();}));}_validateShortcuts(){const _0x3c6073=['chat','review','translate'];this['_shortcuts']['forEach'](_0x434351=>{let _0x16122b=!0x0;if(_0x434351['id']&&_0x434351['label']&&_0x3c6073['includes'](_0x434351['type'])?'chat'===_0x434351['type']&&(_0x16122b='string'==typeof _0x434351['prompt']):_0x16122b=!0x1,!_0x16122b)throw new ct('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x434351});});}_injectShortcuts(_0x495202){this['_removeShortcuts'](),this['_shortcutsView']=new Na(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],xa),this['_shortcutsView']['on']('execute',_0x5f131e=>{const _0x5d0e05=_0x5f131e['source']['id'];this['_executeShortcut'](_0x5d0e05);}),this['_listenedConversation']=_0x495202,this['listenTo'](_0x495202,'uploadProgressChanged',(_0x468e0,_0x33aaec)=>{this['_shortcutsView']['isEnabled']=!_0x33aaec['isUploadInProgress'];});}_removeShortcuts(){const _0x435bfa=this['context']['plugins']['get'](Aa);_0x435bfa['hasFeedItem'](xa)&&_0x435bfa['removeFeedItem'](xa),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}_executeShortcut(_0x22c4a8){const _0x2cd41d=this['_shortcuts']['find'](_0x6b6a1f=>_0x6b6a1f['id']===_0x22c4a8),_0x2afbe1=_0x2cd41d['type'];'chat'===_0x2afbe1?this['_runChatShortcut'](_0x2cd41d):'review'===_0x2afbe1?_0x2cd41d['commandId']?this['_runReviewShortcut'](_0x2cd41d):this['_switchTab']('reviewMode'):'translate'===_0x2afbe1&&(_0x2cd41d['language']?this['_runTranslateShortcut'](_0x2cd41d):this['_switchTab']('translate'));}_switchTab(_0x48bb18){if(!this['context']['plugins']['has']('AITabs'))throw new ct('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x48bb18});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x48bb18);}async _runChatShortcut({id:_0x576c18,prompt:_0x5b8a45,draftMode:_0x37f7e5,useWebSearch:_0xea3c6c=!0x1,useReasoning:_0x22f44f=!0x1,model:_0x5b2153}){const _0x284188=this['context']['plugins']['get']('AIChatController'),_0x2352b1=_0x284188['activeConversation'],_0x58de76=this['context']['plugins']['get'](fs),_0xbeefee=await _0x58de76['models']['resolveModel'](_0x5b2153);_0xbeefee&&await _0x2352b1['setModel'](_0xbeefee),_0x2352b1['setWebSearch'](_0xea3c6c),_0x2352b1['setReasoning'](_0x22f44f);const _0x384aae=_0x58de76['contextLibrary']['resolveContext']({'feature':'chat','ids':[_0x576c18],'idScopedOnly':!0x0,'context':new Yn()});_0x2352b1['addDefaultContext'](_0x384aae['refs']),_0x284188['addCurrentDocumentToChatContext'](),_0x37f7e5?(this['_aiChatUI']['setPromptInputValue'](_0x5b8a45),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x284188['sendMessage']({'message':_0x5b8a45});}_runReviewShortcut({commandId:_0x5a4a9f,model:_0x137e51,prompt:_0x51f8d4,params:_0x337544}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ct('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x435b86={'id':_0x5a4a9f,'isCustom':'custom'===_0x5a4a9f};_0x137e51&&_0x51f8d4&&(_0x435b86['args']={'model':_0x137e51,'prompt':_0x51f8d4}),_0x337544&&(_0x435b86['params']=_0x337544),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x435b86);}_runTranslateShortcut({language:_0x5ef3c1}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new ct('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x5ef3c1,'args':{'language':_0x5ef3c1}});}},Pa=class extends _0x23b7b0{constructor(_0x2588ba){super(_0x2588ba);const _0x1b954e=_0x2588ba['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x1b954e,'isVisible'),this['isEnabled']=!0x0;}execute(){const _0x3b0ac2=this['editor']['plugins']['get']('AITabs')['view'];_0x3b0ac2['isVisible']=!_0x3b0ac2['isVisible'];}},Da=class extends _0x622916{static get requires(){return[gs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x4efafb=this['editor'];_0x4efafb['commands']['add']('toggleAi',new Pa(_0x4efafb)),_0x4efafb['ui']['componentFactory']['add']('toggleAi',()=>{const _0x26403b=this['_createAIUIButton'](Mt);return _0x26403b['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x26403b;}),_0x4efafb['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x2016bd=this['_createAIUIButton'](Zt);return _0x2016bd['set']({'role':'menuitemcheckbox'}),_0x2016bd;});}_createAIUIButton(_0x40ba03){const _0x1213f7=this['editor'],_0x56538a=_0x1213f7['commands']['get']('toggleAi'),_0xd8a777=new _0x40ba03(_0x1213f7['locale']);return _0xd8a777['set']({'label':Es(_0x1213f7['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x2eb0d7,'isToggleable':!0x0}),_0xd8a777['bind']('isEnabled')['to'](_0x56538a),_0xd8a777['bind']('isOn')['to'](_0x56538a,'value',_0x13e317=>!!_0x13e317),this['listenTo'](_0xd8a777,'execute',()=>{_0x56538a['execute']();}),_0xd8a777;}};const Ha=['applySuggestion','insertSuggestion','showNext','showPrevious'];var Ma=class extends _0x56a514{['_errorView'];constructor(_0x2a1c45){super(_0x2a1c45),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x5788a5){this['showError'](_0x5788a5);}['showError'](_0x1fac60){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x1fac60,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}_createErrorView(){const _0x5416c4=new _0x56a514(this['locale']),_0x228254=new _0x56a514(this['locale']);return _0x228254['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x5416c4['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x5be14a=>!_0x5be14a)]},'children':[_0x228254]}),_0x5416c4;}};const Ua=0xa;var Va=class extends _0x898608{static get requires(){return[tn];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;_currentConfig;_editor;_isUpdatingMarkers=!0x1;['open'](_0x14f9ac){const {id:_0x5cefff}=this['_currentConfig']??{};this['_currentConfig']=_0x14f9ac,this['_editor']=_0x14f9ac['targetEditor'];const {id:_0x5bec8d}=this['_currentConfig'];this['isOpen']&&_0x5cefff===_0x5bec8d?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x294724=this['_editor'];if(!_0x294724)return;const _0x145b25=_0x294724['plugins']['get']('Dialog');_0x145b25['isOpen']&&this['_currentConfig']&&_0x145b25['id']===this['_currentConfig']['id']&&_0x145b25['hide']();}_updateDialog(){const _0x27d32b=this['_editor']['plugins']['get']('Dialog'),{icon:_0x9cd904,title:_0x37eebb}=this['_currentConfig'];_0x27d32b['view']?.['headerView']&&(_0x27d32b['view']['headerView']['label']=_0x37eebb,_0x27d32b['view']['headerView']['iconView']&&_0x9cd904&&(_0x27d32b['view']['headerView']['iconView']['content']=_0x9cd904)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x27d32b['view']?.['updatePosition']();}_showFakeVisualSelection(){this['context']['plugins']['get'](tn)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}_hideFakeVisualSelection(){this['context']['plugins']['get'](tn)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x5d1e9d=this['_editor']['plugins']['get']('Dialog'),{id:_0x4b7e6f,title:_0x26d45e,icon:_0x97ec2,class:_0x227d45,mainView:_0x21a5c1}=this['_currentConfig'];_0x21a5c1['delegate'](...Ha)['to'](this),_0x5d1e9d['show']({'title':_0x26d45e,'icon':_0x97ec2,'hasCloseButton':!0x0,'id':_0x4b7e6f,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x227d45||''),'content':_0x21a5c1,'onShow':_0xe49561=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0xe49561['view']?.['updatePosition']();const _0x11b26d=this['_getSelectionElements']();_0x11b26d&&_0x11b26d[0x0]&&Ot({'target':_0x11b26d[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0xe49561['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x4b7e6f});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x4b7e6f}),this['isOpen']=!0x1;}});}_calculateDialogPosition(_0x179d09,_0x5c57a2,_0x9910cb){const _0x2d6314=_0x5c57a2||_0x9910cb;if(!_0x2d6314)return null;const _0x11fdfe=this['_getSelectionElements']();if(!_0x11fdfe||0x0===_0x11fdfe['length'])return{'left':Math['round'](_0x2d6314['left']+_0x2d6314['width']/0x2-_0x179d09['width']/0x2),'top':Math['round'](_0x2d6314['top']+_0x2d6314['height']/0x2-_0x179d09['height']/0x2)};const _0xdea21e=Math['round'](_0x2d6314['left']+_0x2d6314['width']/0x2-_0x179d09['width']/0x2),_0x26ee54=_0x11fdfe['map'](_0x24ffb8=>new It(_0x24ffb8)),_0x35e525=_0x179d09['height'];return{'left':_0xdea21e,'top':this['_calculateOptimalTopPosition'](_0x26ee54,_0x35e525,_0x2d6314)};}_calculateOptimalTopPosition(_0x1cd63b,_0x32ac3f,_0x900a21){const _0x1e14ad=new It(wt['window']),_0x5717a1=_0x1cd63b['map'](_0x7e1778=>_0x7e1778['getVisible']())['filter'](_0x3615bc=>_0x3615bc),_0x29d531=It['getBoundingRect'](_0x5717a1);if(!_0x29d531)return Math['round'](_0x900a21['top']+_0x900a21['height']/0x2);const _0x4168a4=_0x1e14ad['getIntersection'](_0x29d531);if(!_0x4168a4)return Math['round'](_0x900a21['top']+_0x900a21['height']/0x2);const _0x42777d=_0x900a21['getVisible'](),_0x45e9fb=_0x42777d&&_0x29d531['height']>_0x42777d['height'],_0x4030a1=_0x4168a4['top'],_0x9514f5=_0x4168a4['bottom'];if(_0x45e9fb){const _0x435eb6=_0x1e14ad['top']+_0x1e14ad['height']/0x2-_0x32ac3f/0x2,_0x2e4ae0=_0x4030a1-Ua-_0x1e14ad['top'],_0x302491=_0x1e14ad['bottom']-_0x9514f5-Ua;return _0x2e4ae0>=_0x32ac3f?Math['max'](Ua,_0x4030a1-_0x32ac3f-Ua):_0x302491>=_0x32ac3f?_0x9514f5+Ua:Math['max'](Ua,_0x435eb6);}const _0x25203e=_0x4030a1-_0x32ac3f,_0x1b0872=_0x1e14ad['bottom']-_0x9514f5-Ua,_0x2b21d1=_0x4030a1-Ua-_0x1e14ad['top'];let _0x2c7176;return _0x2c7176=_0x1b0872>=_0x32ac3f?_0x9514f5+Ua:_0x2b21d1>=_0x32ac3f?_0x25203e-Ua:_0x4030a1+_0x29d531['height']/0x2-_0x32ac3f/0x2,_0x2c7176;}_setupFakeVisualSelectionMarkerRemovalListener(){const _0x583af8=this['_editor'];this['listenTo'](_0x583af8['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x3b3d41,data:{newRange:_0x2392cd}}of _0x583af8['model']['document']['differ']['getChangedMarkers']())if(_0x3b3d41['startsWith']('ai-selection:')&&(_0x2392cd&&(_0x2392cd['start']['isEqual'](_0x2392cd['end'])||'$graveyard'==_0x2392cd['root']['rootName'])||null==_0x2392cd)){const _0x5189fa=Es(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x5189fa),this['fire']('selectionRemoved');}}});}_cleanupFakeVisualSelectionMarkerRemovalListener(){const _0xf312bf=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0xf312bf['model']['document']);}_getSelectionElements(){const _0x29f5be=this['_editor'];return _0x42da8e(_0x29f5be['editing'],[..._0x29f5be['model']['markers']['getMarkersGroup']('ai-selection'),..._0x29f5be['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}_getCurrentDomRootName(){const _0x5cd55f=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x5cd55f&&_0x5cd55f['rootName']?_0x5cd55f['rootName']:null;}},Ba=class extends _0x54b9b5{copyButton;likeButton;dislikeButton;showChangesButton;['_config'];constructor(_0x32f2ea,_0x55d59c={}){super(_0x32f2ea),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x55d59c};const _0x347699=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x347699?'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(_0x549d26){this['showChangesButton']['isEnabled']=_0x549d26;}_setupRatingButtons(){this['likeButton']=new Mt(this['locale']),this['likeButton']['set']({'icon':at,'label':Es(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':Dn,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new Mt(this['locale']),this['dislikeButton']['set']({'icon':ot,'label':Es(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':Dn,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}_setupCopyButton(){this['copyButton']=new Mt(this['locale']),this['copyButton']['set']({'icon':_0xaeff50,'label':Es(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+Dn,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x3e7cf1=new $t();_0x3e7cf1['set']({'content':_0x48b061}),_0x3e7cf1['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'+Dn,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+Dn;},0x7d0);}),this['copyButton']['children']['add'](_0x3e7cf1);}_setupShowChangesButton(){this['showChangesButton']=new Mt(this['locale']),this['showChangesButton']['set']({'icon':et,'label':Es(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':Dn}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x33e7f3=>_0x33e7f3?it:et),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}},Ga=class extends Ma{['children'];nextButtonView;previousButtonView;['focusCycler'];['_focusables'];['_focusTracker'];_keystrokes;['_config'];_streamableContentView;_toolbarContainerView;_partToolbarView;_stateView;['_miniToolbarView'];constructor(_0x4bc8c0,_0x2aba14){super(_0x4bc8c0);const _0x4d0a27=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['set']('_outdatedReason',void 0x0),this['set']('isTargetReadOnly',!0x1),this['set']('areActionsDisabled',!0x1),this['_focusTracker']=new _t(),this['_keystrokes']=new gt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x2aba14,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new mr(_0x4bc8c0),this['_partToolbarView']=new Ir(_0x4bc8c0,_0x2aba14['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_partToolbarView']['bind']('isTargetReadOnly')['to'](this),this['_partToolbarView']['bind']('isEnabled')['to'](this,'areActionsDisabled',this,'_isErrorVisible',(_0x25db62,_0xc462e9)=>!_0x25db62&&!_0xc462e9),this['_togglePartToolbarButtonsVisibility'](_0x2aba14),this['_stateView']=new gr(_0x4bc8c0),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new Ba(_0x4bc8c0,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new Fa(_0x4bc8c0,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x41cf8d,_0x419e73,_0x21cc0b,_0x261868)=>{let _0x349243,_0x17cbac;'pending'===_0x261868?(_0x349243=this['_partToolbarView'],_0x17cbac=this['_stateView']):(_0x349243=this['_stateView'],_0x17cbac=this['_partToolbarView']),this['_stateView']['setState'](_0x21cc0b,this['_outdatedReason']),_0x349243['isVisible']=!0x1,_0x17cbac['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x4d0a27['to']('_state',_0x55820e=>'ck-ai-chat-balloon-main_state_'+_0x55820e)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x2aba14);});}['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(_0xc9bdd7){_0xc9bdd7?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0xc9bdd7);}clearContent(){this['_streamableContentView']['clear']();}setState(_0x2c8805,_0x378b0f){this['_outdatedReason']=_0x378b0f,this['_state']=_0x2c8805;}['showError'](_0x2ad242){super['showError'](_0x2ad242),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}toggleRotatorButtonsVisibility(_0x7dfc64){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x7dfc64;}_togglePartToolbarButtonsVisibility({showApplyButton:_0x543d65,showSuggestButton:_0x1b29f9}){_0x543d65=_0x543d65&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x1b29f9=_0x1b29f9&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x543d65,'showSuggestButton':_0x1b29f9});}_createNextButtonView(){const _0x1fef31=new Mt(this['locale']);return _0x1fef31['set']({'icon':_0x4e351c,'label':Es(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x1fef31['on']('execute',()=>{this['fire']('showNext');}),_0x1fef31;}_createPreviousButtonView(){const _0xca25cd=new Mt(this['locale']);return _0xca25cd['set']({'icon':_0x582ecb,'label':Es(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0xca25cd['on']('execute',()=>{this['fire']('showPrevious');}),_0xca25cd;}},Fa=class extends _0x56a514{constructor(_0x2bbd57,_0x37f69c){super(_0x2bbd57),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x37f69c});}},Ka=class extends _0x622916{static get requires(){return[Ut,Va];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}_chatBalloonView;constructor(_0x24e83e){super(_0x24e83e),this['set']('showDiff',!0x1);}['open'](_0x116ab7){const _0xfb1d6=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0xfb1d6['plugins']['get']('AIBalloon')['open']({..._0x116ab7,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x116ab7['showRotator']),this['_chatBalloonView']['areActionsDisabled']=_0x116ab7['areActionsDisabled'],this['_chatBalloonView']['isTargetReadOnly']=_0x116ab7['isTargetReadOnly'],this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}updateContent(_0x432276){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x432276);}clearContent(){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}setState(_0x531c56,_0x4e61b3){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x531c56,_0x4e61b3);}setTargetReadOnly(_0x1be7aa){this['_chatBalloonView']&&(this['_chatBalloonView']['isTargetReadOnly']=_0x1be7aa);}_createChatBalloonView(){const _0x4ad38b=this['editor'],_0x103e6f=_0x4ad38b['plugins']['get']('AIBalloon'),_0x150669=_0x4ad38b['commands']['get']('trackChanges');let _0x4527be=_0x4ad38b['config']['get']('ai.availableReplyActions')||[...Or];_0x4ad38b['plugins']['has']('TrackChanges')||(_0x4527be=_0x4527be['filter'](_0x2909d0=>'insertSuggestion'!=_0x2909d0));const _0x40c417=new Ga(_0x4ad38b['locale'],{'availableActions':_0x4527be,'showApplyButton':!0x0,'showSuggestButton':!!_0x150669});return _0x40c417['bind']('showDiff')['to'](this),_0x40c417['delegate'](...ir)['to'](this),_0x40c417['delegate']('showPrevious','showNext')['to'](this),_0x103e6f['delegate']('dialogClosed')['to'](this),_0x40c417['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x40c417['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x40c417['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x150669&&_0x40c417['bind']('isTrackChangesOn')['to'](_0x150669,'value'),_0x40c417['render'](),_0x40c417;}_toggleRotatorButtonsInDialogHeader(_0x17194e){const _0x27cbbc=this['editor'],_0x6a5881=_0x27cbbc['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x17194e),_0x6a5881['has'](this['_chatBalloonView']['previousButtonView'])||(_0x6a5881['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x27cbbc['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x6a5881['remove'](this['_chatBalloonView']['previousButtonView']),_0x6a5881['remove'](this['_chatBalloonView']['nextButtonView']);}));}_restoreDefaultViewFocus(){this['_chatBalloonView']['focus']();}},Wa=class extends _0x622916{static get requires(){return[Da,Ka,_0x34a1f4];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function Ya(_0x318b19){const {editor:_0x6828d1,action:_0x4eb7b9,withText:_0x2d2b3a=!0x1,withIcon:_0x35efd8=!0x0,isInDropdown:_0x26b8b5=!0x0,shouldPreventFocus:_0x169fc4=!0x1,actionButtons:_0x52ff50}=_0x318b19;return()=>{const _0x3e3497=_0x6828d1['locale'],_0x1a0cf9=new Mt(_0x3e3497),_0xd984ec=_0x1a0cf9['bindTemplate'];_0x26b8b5&&_0x1a0cf9['extendTemplate']({'on':{'mouseenter':_0xd984ec['to'](()=>{_0x169fc4&&_0x169fc4()||_0x1a0cf9['focus']();})}}),_0x52ff50['push']({'buttonView':_0x1a0cf9,'action':_0x4eb7b9});const _0x269506=_0x4eb7b9['icon']??_0x4eb7b9['parent']?.['icon'];return _0x1a0cf9['set']({'label':_0x4eb7b9['label'],'withText':_0x2d2b3a,'role':'menuitem','icon':_0x35efd8?_0x269506??_0x10bb99:void 0x0,'tooltip':!_0x2d2b3a,'class':'ck-ai-quick-actions-button','isEnabled':_0x4eb7b9['isEnabled']}),_0x1a0cf9['on']('execute',()=>{_0x6828d1['editing']['view']['focus'](),_0x6828d1['commands']['execute']('aiQuickAction',_0x4eb7b9);}),_0x1a0cf9;};}var $a=class extends Xt{['arrowView'];constructor(_0x2dec09,_0x40b703){super(_0x2dec09,_0x40b703);const _0x116ff5=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',_0x260bb4=>String(_0x260bb4)),'data-cke-tooltip-disabled':_0x116ff5['to']('isOn')},'on':{'mouseenter':_0x116ff5['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}_createArrowView(){const _0x1cdda7=new $t();return _0x1cdda7['content']=_0x1193f0,_0x1cdda7['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x1cdda7;}},qa=class extends Jt{_allListItems;_allSearchableItems;constructor(_0x3ec9a,_0x12b99c,_0x34feab){super(_0x3ec9a),this['_allListItems']=_0x12b99c,this['_allSearchableItems']=_0x34feab;}filter(_0x59aa69){if(!_0x59aa69)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x4aaa4f=_0x59aa69['source']['toLowerCase']()['trim'](),_0x2e1e8c=this['_allSearchableItems']['filter'](_0x57a88e=>(_0x57a88e['groupLabel']?_0x57a88e['label']+'\x20('+_0x57a88e['groupLabel']+')':_0x57a88e['label'])['toLowerCase']()['includes'](_0x4aaa4f));return this['items']['clear'](),this['items']['addMany'](_0x2e1e8c['sort']((_0x34ca8f,_0x344c14)=>{const _0x16fcba=_0x34ca8f['groupLabel'],_0x571167=_0x344c14['groupLabel'];return _0x16fcba||_0x571167?_0x16fcba?0x1:-0x1:0x0;})['map'](_0xc44dce=>_0xc44dce['item'])),this['_highlightQuery'](_0x4aaa4f,_0x2e1e8c),{'resultsCount':_0x2e1e8c['length'],'totalItemsCount':this['_allSearchableItems']['length']};}_highlightQuery(_0x29fdf5,_0x213062){if(!_0x29fdf5)return;const _0x5f11de=new RegExp(_0x3ff1f3(_0x29fdf5),'gi');_0x213062['forEach'](_0x11be96=>{_0x11be96['highlightViews']&&_0x11be96['highlightViews']['forEach'](_0x3342b0=>{'function'==typeof _0x3342b0['highlightText']&&_0x3342b0['highlightText'](_0x5f11de);});});}_clearHighlight(){this['_allSearchableItems']['forEach'](_0x124f98=>{_0x124f98['highlightViews']&&_0x124f98['highlightViews']['forEach'](_0x2704f0=>{'function'==typeof _0x2704f0['highlightText']&&_0x2704f0['highlightText'](null);});});}};const Qa='menu',Xa='menuitem';var za=class extends _0x56a514{_bodyCollection;optionsListView;_searchTextView=null;_allSearchableItems=[];['children'];['focusTracker'];keystrokes;['_focusables'];['focusCycler'];_openNestedPanels=new Set();['_hasSearch'];_actionButtons;constructor(_0x506bf7,_0x4cdbe7,_0x2f9cb9,_0x2915e8,_0x4b6a02=!0x1,_0x2dc90a=[]){const _0x347c15=_0x506bf7['locale'];super(_0x347c15),this['_bodyCollection']=_0x2915e8,this['_hasSearch']=_0x4b6a02,this['_actionButtons']=_0x2dc90a;const _0x129cca=this['_createListItems'](_0x506bf7,_0x4cdbe7,_0x2f9cb9);this['optionsListView']=new qa(_0x347c15,_0x129cca,this['_allSearchableItems']),this['optionsListView']['role']=Qa,this['optionsListView']['items']['addMany'](_0x129cca),this['focusTracker']=new _t(),this['keystrokes']=new gt(),_0x4b6a02&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x129cca,this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x4b6a02&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x5ae2c6=_0x4b6a02&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x93f04d(_0x5ae2c6),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x347c15['uiLanguageDirection']},'children':this['children']});}_createSearchTextView(){return new _0xdb63d9(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':Es(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':Es(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x14442a=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x14442a);}_createListItems(_0x32ced5,_0x1c110d,_0x117f06){const _0x3068bf=new _0x93f04d();return _0x1c110d['forEach'](_0xd33a56=>{if('actions'in _0xd33a56){const {listItem:_0x9da425}=this['_createActionGroupButton'](_0x32ced5,_0xd33a56,_0x117f06);_0x3068bf['add'](_0x9da425),_0xd33a56['actions']['forEach'](_0x450dec=>{const {listItem:_0x29b622,highlightViews:_0x1d42c0}=this['_createSearchResultActionButton'](_0x32ced5,_0x450dec,_0xd33a56['label'],_0xd33a56['icon']);this['_allSearchableItems']['push']({'item':_0x29b622,'label':_0x450dec['label'],'groupLabel':_0xd33a56['label'],'highlightViews':_0x1d42c0});});}else{const {listItem:_0x42580c}=this['_createActionButton'](_0x32ced5,_0xd33a56);_0x3068bf['add'](_0x42580c);const _0x22bb76=_0x42580c['children']['first'];if(_0x22bb76){const {listItem:_0x48ad63,highlightViews:_0x508c5b}=this['_createSearchResultActionButton'](_0x32ced5,_0xd33a56);this['_allSearchableItems']['push']({'item':_0x48ad63,'label':_0x22bb76['label']||'','highlightViews':_0x508c5b});}}}),_0x3068bf;}_createActionButton(_0x2ece5a,_0x1c9f2f,_0x4efb8c,_0x5c643c){const _0x99525c=new jt(this['locale']);if(_0x4efb8c&&_0x5c643c){const _0x45ab59=new Mt(this['locale']),_0x15c72b=_0x45ab59['bindTemplate'],_0x4057b7=new Yt();_0x4057b7['text']=_0x1c9f2f['label'];const _0x26c876=new Yt();_0x26c876['text']=_0x4efb8c;const _0x1c5b8e=new $t();_0x1c5b8e['content']=_0x5c643c,_0x1c5b8e['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x3aba77=new _0x56a514(this['locale']);_0x3aba77['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x2beec2=new _0x56a514(this['locale']);return _0x2beec2['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x45ab59['set']({'label':_0x1c9f2f['label']+'\x20('+_0x4efb8c+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x1c9f2f['isEnabled']}),_0x45ab59['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x15c72b['if']('isEnabled','ck-disabled',_0xae813b=>!_0xae813b)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x4057b7,_0x3aba77,_0x1c5b8e,_0x26c876,_0x2beec2],'on':{'mouseenter':_0x15c72b['to'](()=>{this['_isSearchFocused']()||_0x45ab59['focus']();}),'click':_0x15c72b['to'](()=>{_0x45ab59['fire']('execute');})}}),_0x45ab59['on']('execute',()=>{_0x45ab59['isEnabled']&&(_0x2ece5a['editing']['view']['focus'](),_0x2ece5a['commands']['execute']('aiQuickAction',_0x1c9f2f));}),_0x99525c['children']['add'](_0x45ab59),this['_actionButtons']['push']({'buttonView':_0x45ab59,'action':_0x1c9f2f}),{'listItem':_0x99525c,'highlightViews':[_0x4057b7,_0x26c876]};}{const _0x10e1cd=new Ht(),_0x2066bb=new Mt(this['locale'],_0x10e1cd),_0x2e6549=_0x2066bb['bindTemplate'],_0x188250=_0x1c9f2f['icon']??_0x1c9f2f['parent']?.['icon'],_0x183181=void 0x0!==_0x1c9f2f['icon'];return _0x2066bb['set']({'label':_0x1c9f2f['label'],'withText':!0x0,'role':'menuitem','icon':_0x183181?_0x188250??_0x10bb99:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x1c9f2f['isEnabled']}),_0x2066bb['extendTemplate']({'on':{'mouseenter':_0x2e6549['to'](()=>{this['_isSearchFocused']()||_0x2066bb['focus']();})}}),_0x2066bb['on']('execute',()=>{_0x2ece5a['editing']['view']['focus'](),_0x2ece5a['commands']['execute']('aiQuickAction',_0x1c9f2f);}),_0x99525c['children']['add'](_0x2066bb),this['_actionButtons']['push']({'buttonView':_0x2066bb,'action':_0x1c9f2f}),{'listItem':_0x99525c,'highlightViews':[_0x10e1cd]};}}_createSearchResultActionButton(_0x168907,_0x3023fa,_0x1bc1b3,_0x5073f2){return _0x1bc1b3&&_0x5073f2?this['_createSearchResultGroupedActionButton'](_0x168907,_0x3023fa,_0x1bc1b3,_0x5073f2):this['_createSearchResultIndividualActionButton'](_0x168907,_0x3023fa);}_createSearchResultGroupedActionButton(_0x26babf,_0xfa98f3,_0x2c78f3,_0x30c44d){const _0x2eb367=new jt(this['locale']),_0x226e4e=new Mt(this['locale']),_0x1b9b7b=_0x226e4e['bindTemplate'],{view:_0x51c4ee,highlightView:_0x81d1a}=this['_createSearchResultGroupRow'](_0x2c78f3,_0x30c44d),{view:_0x3ac22b,highlightView:_0x28608c}=this['_createSearchResultActionRow'](_0xfa98f3['label']),_0x1f4e0a=this['_createSearchResultContentView'](_0x51c4ee,_0x3ac22b);return _0x226e4e['set']({'label':_0xfa98f3['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':_0xfa98f3['isEnabled']}),_0x226e4e['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',_0x1b9b7b['if']('isEnabled','ck-disabled',_0x27a071=>!_0x27a071)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x1f4e0a],'on':{'mouseenter':_0x1b9b7b['to'](()=>{this['_isSearchFocused']()||_0x226e4e['focus']();}),'click':_0x1b9b7b['to'](()=>{this['_handleSearchResultButtonClick'](_0x226e4e);})}}),this['_setupActionButtonExecution'](_0x226e4e,_0x26babf,_0xfa98f3),_0x2eb367['children']['add'](_0x226e4e),this['_actionButtons']['push']({'buttonView':_0x226e4e,'action':_0xfa98f3}),{'listItem':_0x2eb367,'highlightViews':[_0x81d1a,_0x28608c]};}_createSearchResultIndividualActionButton(_0x59f3bf,_0x3de1cb){const _0x4e7773=new jt(this['locale']),_0x5f38c7=new Ht(),_0x745949=new Mt(this['locale'],_0x5f38c7),_0x577b4b=_0x745949['bindTemplate'];return _0x745949['set']({'label':_0x3de1cb['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x3de1cb['isEnabled']}),_0x745949['extendTemplate']({'on':{'mouseenter':_0x577b4b['to'](()=>{this['_isSearchFocused']()||_0x745949['focus']();})}}),this['_setupActionButtonExecution'](_0x745949,_0x59f3bf,_0x3de1cb),_0x4e7773['children']['add'](_0x745949),this['_actionButtons']['push']({'buttonView':_0x745949,'action':_0x3de1cb}),{'listItem':_0x4e7773,'highlightViews':[_0x5f38c7]};}_createSearchResultGroupRow(_0x420aa6,_0x30752a){const _0x2ff208=new _0x56a514(this['locale']),_0x5e97b3=new $t();_0x5e97b3['content']=_0x30752a,_0x5e97b3['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x5c583f=new Yt();return _0x5c583f['text']=_0x420aa6,_0x2ff208['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x5e97b3,_0x5c583f]}),{'view':_0x2ff208,'highlightView':_0x5c583f};}_createSearchResultActionRow(_0x5c9aaf){const _0x4c5d72=new _0x56a514(this['locale']),_0x1ad3d0=new Yt();return _0x1ad3d0['text']=_0x5c9aaf,_0x4c5d72['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x1ad3d0]}),{'view':_0x4c5d72,'highlightView':_0x1ad3d0};}_createSearchResultContentView(_0x146547,_0xb77c2a){const _0x55e9aa=new _0x56a514(this['locale']);return _0x55e9aa['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x146547,_0xb77c2a]}),_0x55e9aa;}_setupActionButtonExecution(_0xcb8c77,_0x3120e0,_0x4bd7fd){_0xcb8c77['on']('execute',()=>{_0xcb8c77['isEnabled']&&(_0x3120e0['editing']['view']['focus'](),_0x3120e0['commands']['execute']('aiQuickAction',_0x4bd7fd));});}_createActionGroupButton(_0x5ebcbf,_0xd93d7a,_0x2f6c3e){const _0x17d19a=new jt(this['locale']),_0x6bb792=new Ht(),_0x322530=new $a(this['locale'],_0x6bb792),_0x28024b=_0x322530['bindTemplate'],_0x77f89=this['_getPanelKeystroke'](_0x2f6c3e),_0x423678=this['_createGroupActionsList'](_0x5ebcbf,_0xd93d7a['actions'],_0x2f6c3e);_0x322530['set']({'label':_0xd93d7a['label'],'withText':!0x0,'role':Xa,'icon':_0xd93d7a['icon']??_0x10bb99,'isEnabled':_0xd93d7a['actions']['some'](_0x3dca56=>_0x3dca56['isEnabled'])}),_0x322530['extendTemplate']({'on':{'mouseenter':_0x28024b['to'](()=>{this['_isSearchFocused']()||_0x322530['focus']();})}});const _0x2fd790=new xt(this['locale']);return _0x2fd790['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x28024b['to'](_0x801451=>{this['_handlePanelKeydown'](_0x801451,_0x77f89,_0x322530,_0x2fd790);})}}),_0x322530['bind']('isOn')['to'](_0x2fd790,'isVisible'),this['_bodyCollection']['add'](_0x2fd790),_0x2fd790['content']['add'](_0x423678),this['_setupGroupMenuBehavior'](_0x322530,_0x2fd790),_0x17d19a['children']['add'](_0x322530),this['_actionButtons']['push']({'buttonView':_0x322530,'action':_0xd93d7a}),{'listItem':_0x17d19a,'highlightView':_0x6bb792};}_createGroupActionsList(_0x5bb7a9,_0x3754ed,_0x18c54a){const _0x4c7d9d=new Jt(this['locale']);return _0x4c7d9d['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x3754ed['forEach'](_0xbfca94=>{const _0x2ee0b4=new jt(this['locale']),_0x2ba851=Ya({'editor':_0x5bb7a9,'action':_0xbfca94,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x2ee0b4['children']['add'](_0x2ba851),_0x18c54a['focusTracker']['add'](_0x2ba851),_0x4c7d9d['items']['add'](_0x2ee0b4);}),_0x4c7d9d;}_setupGroupMenuBehavior(_0x15af98,_0x17829c){const _0x265ab2=_0x15af98['bindTemplate'],_0x41f2c7=this['_getButtonKeystroke'](_0x15af98);_0x15af98['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x265ab2['to'](()=>{this['_showNestedPanel'](_0x17829c,_0x15af98);}),'mouseleave':_0x265ab2['to'](_0x2e9c47=>{const _0x4995d1=_0x2e9c47['relatedTarget'];this['_isMovingToNestedMenu'](_0x4995d1,_0x17829c)||this['_hideNestedPanel'](_0x17829c);}),'keydown':_0x265ab2['to'](_0x15e2bc=>{_0x15e2bc['key']==_0x41f2c7&&(this['_showNestedPanel'](_0x17829c,_0x15af98),_0x17829c['content']['get'](0x0)['focus']());})}}),_0x17829c['on']('render',()=>{_0x17829c['element']?.['addEventListener']('mouseleave',_0x4984ad=>{const _0xda9685=_0x4984ad['relatedTarget'];_0x15af98['element']?.['contains'](_0xda9685)||this['_isMovingToNestedMenu'](_0xda9685,_0x17829c)||this['_hideNestedPanel'](_0x17829c);});});}_showNestedPanel(_0x3a1c2d,_0x13a8e3){this['_openNestedPanels']['forEach'](_0x159f28=>{_0x159f28!==_0x3a1c2d&&_0x159f28['isVisible']&&_0x159f28['hide']();}),_0x3a1c2d['show'](),_0x3a1c2d['pin']({'positions':[Bt['eastSouth']],'target':_0x13a8e3['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x3a1c2d);}_hideNestedPanel(_0xbb03c7){_0xbb03c7['hide'](),this['_openNestedPanels']['delete'](_0xbb03c7);}_hideAllNestedPanels(){this['_openNestedPanels']['forEach'](_0x572ada=>_0x572ada['hide']()),this['_openNestedPanels']['clear']();}_isMovingToNestedMenu(_0x4bb1a0,_0x415c0e){if(!_0x4bb1a0)return!0x1;if(_0x415c0e['element']?.['contains'](_0x4bb1a0))return!0x0;const _0x2f6ead=_0x4bb1a0;return _0x2f6ead['closest']&&(null!==_0x2f6ead['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x2f6ead['closest']('.ck-ai-quick-actions-group-list')||null!==_0x2f6ead['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(_0x415e42){return'rtl'===_0x415e42['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}_getButtonKeystroke(_0x4c915a){return'rtl'===_0x4c915a['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x6ebbf4,_0x33e031,_0x2a5c3d,_0x1f7d03){_0x6ebbf4['key']==_0x33e031&&(_0x2a5c3d['focus'](),this['_hideNestedPanel'](_0x1f7d03));}_handleSearchResultButtonClick(_0x493578){_0x493578['fire']('execute');}};function ja(_0x3579d3){const {editor:_0x3c4cf0,content:_0x176e84,buttonDefinition:_0x156b3e,bodyCollection:_0x220de3,hasSearch:_0xa673a5=!0x1,actionButtons:_0x56321a}=_0x3579d3;return()=>{const _0x4a6dbc=_0x3c4cf0['locale'],_0x3c6858=_0x3c4cf0['commands']['get']('aiQuickAction'),_0x11bfaf=_0x48403c(_0x4a6dbc);_0x11bfaf['bind']('isEnabled')['to'](_0x3c6858),_0x11bfaf['buttonView']['set']({'icon':_0x156b3e['icon']??_0x10bb99,'label':_0x156b3e['label'],'tooltip':!0x0}),_0x11bfaf['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x5d0968=new za(_0x3c4cf0,_0x176e84,_0x11bfaf,_0x220de3,_0xa673a5,_0x56321a);return _0x11bfaf['panelView']['children']['add'](_0x5d0968),_0xa673a5&&_0x11bfaf['on']('change:isOpen',(_0x49a005,_0x57e343,_0x95e8d8)=>{if(_0x95e8d8){if(_0x3c4cf0['plugins']['has']('AIEditing')){const _0x1630e0=_0x3c4cf0['plugins']['get'](tn),_0x228453=_0x3c4cf0['model']['document']['selection'],_0x3d7834=Array['from'](_0x228453['getRanges']());_0x3d7834['length']>0x0&&_0x1630e0['showFakeVisualSelection']({'editor':_0x3c4cf0,'ranges':_0x3d7834,'id':'quick-action','priority':0x14});}}else _0x3c4cf0['plugins']['has']('AIEditing')&&_0x3c4cf0['plugins']['get'](tn)['hideFakeVisualSelection']('quick-action'),_0x5d0968['resetSearch']();}),_0x11bfaf;};}const Ja='<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>',Za='<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>',th='<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>',eh=/* #__PURE__ -- @preserve */
|
|
37
|
-
((()=>({'chat':'AIChat','action':'AIActions'}))());var ih=class AIQuickActionsUI extends _0x622916{_actionButtons=[];['_menuBarGroupViews']=[];_reporter;static get requires(){return[Lt,Is,Nn,fs];}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 _0x4ea121=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x4ea121),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static getDefaultQuickActions(_0x3412d6){return function(_0x3120f5){const _0x38a275=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x3120f5['uiLanguage'])||'English';return[{'id':'ask-ai','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x3bbd8f},{'id':'chat-commands','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x3bbd8f,'actions':[{'id':'explain','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Es(_0x3120f5,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':Ja['replace']('%0',_0x38a275),'type':'chat'},{'id':'summarize','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Es(_0x3120f5,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Za['replace']('%0',_0x38a275),'type':'chat'},{'id':'highlight-key-points','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Es(_0x3120f5,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':th['replace']('%0',_0x38a275),'type':'chat'}]},{'id':'improve-writing','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x448b65},{'id':'continue','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x123cf3},{'id':'fix-grammar','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x37ebe4},{'id':'adjust-length','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x55d620,'actions':[{'id':'make-shorter','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x173850,'actions':[{'id':'make-tone-casual','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x370c5b,'actions':[{'id':'translate-to-english','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Es(_0x3120f5,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x400907,'actions':[]}];}(_0x3412d6);}_getDefaultAndCustomActions(){const _0x4a177a=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0xc4d724=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x3ee4c4=>({..._0x3ee4c4,'type':'chat'===_0x3ee4c4['type']?'chat':'action','icon':void 0x0}));return _0x4a177a['find'](_0x3e7c54=>'other'===_0x3e7c54['id'])['actions']['push'](..._0xc4d724),_0x4a177a;}async _initActionTypeQuickActions(){try{const _0x51b7d4=this['editor']['plugins']['get'](fs),_0xaa284e=await _0x51b7d4['models']['getAllModels'](),_0x524d96=(await _0x51b7d4['models']['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x524d96),this['_enableButtonsByType']('action',_0x4cfde3=>!!_0xaa284e['find'](_0x5b9ef8=>_0x5b9ef8['id']===_0x4cfde3['model'])||void 0x0===_0x4cfde3['model']);}catch(_0x23e16d){const _0x14e380=new ct('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x23e16d});this['_reporter']['logError'](_0x14e380);}}_initChatTypeQuickActions(){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x44f888=this['editor']['plugins']['get']('AIChatController'),_0x428aa1=this['editor']['plugins']['has']('AIChatUI')?this['editor']['plugins']['get']('AIChatUI'):null;this['listenTo'](_0x44f888,'change:isConversationReady',(_0x34c892,_0x37385d,_0x50b109)=>{this['_enableButtonsByType']('chat',()=>_0x50b109&&!_0x428aa1?.['isBusy']);}),_0x428aa1&&this['listenTo'](_0x428aa1,'change:isBusy',(_0x56a3ba,_0x28551b,_0x55382a)=>{this['_enableButtonsByType']('chat',()=>_0x44f888['isConversationReady']&&!_0x55382a);}),this['_enableButtonsByType']('chat',()=>_0x44f888['isConversationReady']&&!_0x428aa1?.['isBusy']);}_enableButtonsByType(_0x2051f6,_0x5e368e){this['_quickActionsDefinition']['forEach'](_0x50b763=>{'actions'in _0x50b763?_0x50b763['actions']['forEach'](_0x5089da=>{_0x5089da['type']===_0x2051f6&&(_0x5089da['isEnabled']=_0x5e368e(_0x5089da));}):_0x50b763['type']===_0x2051f6&&(_0x50b763['isEnabled']=_0x5e368e(_0x50b763));}),this['_actionButtons']['forEach'](_0x363393=>{if(sh(_0x363393['action']))return;if(_0x363393['action']['type']!==_0x2051f6)return;const _0x56c10f=_0x5e368e(_0x363393['action']);if(_0x363393['action']['isEnabled']=_0x56c10f,_0x363393['buttonView']['isEnabled']=_0x56c10f,'action'===_0x2051f6&&!_0x56c10f&&_0x363393['action']['model']){const _0x1af1c9=new ct('ai-quick-actions-unavailable-model',this,{'actionId':_0x363393['action']['id'],'modelId':_0x363393['action']['model']});this['_reporter']['logError'](_0x1af1c9);}}),this['_actionButtons']['filter'](_0x2f14ce=>sh(_0x2f14ce['action']))['forEach'](_0x2fa562=>{_0x2fa562['buttonView']['isEnabled']=_0x2fa562['action']['actions']['some'](_0x5c1c45=>_0x5c1c45['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x415565,group:_0x1ab1fc})=>{_0x415565['isEnabled']=_0x1ab1fc['actions']['some'](_0x4e06ed=>_0x4e06ed['isEnabled']);});}_enableButtonById(_0x338d45,_0x2e97e8){this['_quickActionsDefinition']['forEach'](_0x27fe5c=>{'actions'in _0x27fe5c?_0x27fe5c['actions']['forEach'](_0x227786=>{_0x227786['id']===_0x338d45&&(_0x227786['isEnabled']=_0x2e97e8(_0x227786));}):_0x27fe5c['id']===_0x338d45&&(_0x27fe5c['isEnabled']=_0x2e97e8(_0x27fe5c));}),this['_actionButtons']['forEach'](_0xe8b6bb=>{if(sh(_0xe8b6bb['action']))return;if(_0xe8b6bb['action']['id']!==_0x338d45)return;const _0x232f78=_0x2e97e8(_0xe8b6bb['action']);_0xe8b6bb['action']['isEnabled']=_0x232f78,_0xe8b6bb['buttonView']['isEnabled']=_0x232f78;});}_assignDefaultModelToCustomActions(_0x6f6faa){this['_actionButtons']['forEach'](_0x4add1f=>{sh(_0x4add1f['action'])||'action'===_0x4add1f['action']['type']&&(_0x4add1f['action']['model']||(_0x4add1f['action']['model']=_0x6f6faa));});}_initializeQuickActionsComponentsAndCommands(){const _0x56655e=new Pt(this['editor']['locale']);_0x56655e['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x56655e),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x56655e);}_initializeQuickActionsDropdown(_0x85deb8){const _0x397962=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',ja({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x10bb99,'label':Es(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x85deb8,'hasSearch':_0x397962,'actionButtons':this['_actionButtons']}));}_prepareQuickActionsDefinition(_0x24925f){this['_quickActionsDefinition']=_0x24925f['map'](_0x5a5c87=>{if('actions'in _0x5a5c87){const _0x332b5f=_0x5a5c87;return{..._0x332b5f,'actions':_0x332b5f['actions']['map'](_0x3311aa=>{const {actions:_0x274718,..._0x51d49c}=_0x332b5f;return{..._0x3311aa,'isEnabled':!0x1,'parent':_0x51d49c};})['filter'](_0x15061f=>this['_shouldIncludeAction'](_0x15061f))};}return{..._0x5a5c87,'isEnabled':!0x1};})['filter'](_0x36170c=>'actions'in _0x36170c?_0x36170c['actions']['length']>0x0:this['_shouldIncludeAction'](_0x36170c));}_shouldIncludeAction(_0x45418e){const _0x2a217c=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](eh[_0x45418e['type']])&&!_0x2a217c['includes'](_0x45418e['id'])&&!('chat'===_0x45418e['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}_initializeQuickActionsComponents(_0x2f4a64){this['_quickActionsDefinition']['forEach'](_0x1e7500=>{if('actions'in _0x1e7500){const _0x47de0e=ja({'editor':this['editor'],'content':_0x1e7500['actions'],'buttonDefinition':_0x1e7500,'bodyCollection':_0x2f4a64,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x1e7500['id'],_0x47de0e),_0x1e7500['actions']['forEach'](_0x3d5b02=>{const _0x195944=Ya({'editor':this['editor'],'action':_0x3d5b02,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x3d5b02['id'],_0x195944);});}else{const _0x21fafb=Ya({'editor':this['editor'],'action':_0x1e7500,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x1e7500['id'],_0x21fafb);}});}_initializeQuickActionsMenuBar(){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x35e3e1=>{const _0x48303f=this['editor']['commands']['get']('aiQuickAction'),_0x5716ff=new _0x1021d4(_0x35e3e1),_0x1f010c=Es(_0x35e3e1,'AI_QUICK_ACTIONS_HEADING');_0x5716ff['buttonView']['set']({'label':_0x1f010c,'icon':_0x10bb99});const _0x512274=new _0x14eb7a(_0x35e3e1);return _0x512274['set']({'ariaLabel':_0x1f010c,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x2a3a2d=>{if('actions'in _0x2a3a2d){const _0x2962ee=_0x2a3a2d,_0x386eff=new te(_0x35e3e1,_0x5716ff),_0x171b3c=new _0x1021d4(_0x35e3e1),_0x1d5ced=new _0x14eb7a(_0x35e3e1);_0x171b3c['buttonView']['set']({'label':_0x2962ee['label'],'icon':_0x2962ee['icon']}),_0x2962ee['actions']['forEach'](_0xede260=>{const _0x40dcf1=new te(_0x35e3e1,_0x171b3c),_0x3b523f=new Zt(_0x35e3e1);_0x3b523f['set']({'label':_0xede260['label'],'icon':_0xede260['icon'],'role':'menuitem','isEnabled':_0xede260['isEnabled']}),_0x3b523f['on']('execute',()=>{this['_executeQuickAction'](_0xede260);}),this['_actionButtons']['push']({'buttonView':_0x3b523f,'action':_0xede260}),_0x3b523f['delegate']('execute')['to'](_0x171b3c),_0x40dcf1['children']['add'](_0x3b523f),_0x1d5ced['items']['add'](_0x40dcf1);}),_0x171b3c['isEnabled']=_0x2962ee['actions']['some'](_0x286eb2=>_0x286eb2['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x171b3c,'group':_0x2962ee}),_0x171b3c['panelView']['children']['add'](_0x1d5ced),_0x386eff['children']['add'](_0x171b3c),_0x512274['items']['add'](_0x386eff);}else{const _0x9d212c=_0x2a3a2d,_0x4ede87=new te(_0x35e3e1,_0x5716ff),_0x3d5977=new Zt(_0x35e3e1);_0x3d5977['set']({'label':_0x9d212c['label'],'icon':_0x9d212c['icon'],'role':'menuitem','isEnabled':_0x9d212c['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x3d5977,'action':_0x9d212c}),_0x3d5977['on']('execute',()=>{this['_executeQuickAction'](_0x9d212c);}),_0x3d5977['delegate']('execute')['to'](_0x5716ff),_0x4ede87['children']['add'](_0x3d5977),_0x512274['items']['add'](_0x4ede87);}}),Object['values'](eh)['some'](_0x5452fa=>this['editor']['plugins']['has'](_0x5452fa))?_0x5716ff['bind']('isEnabled')['to'](_0x48303f):_0x5716ff['set']({'isEnabled':!0x1}),_0x5716ff['panelView']['children']['add'](_0x512274),_0x5716ff;});}_executeQuickAction(_0x46e9e4){const _0x2f904c=this['editor'];_0x2f904c['editing']['view']['focus'](),_0x2f904c['commands']['execute']('aiQuickAction',_0x46e9e4);const _0x51f20f=_0x2f904c['ui']['view']['menuBarView'];_0x51f20f&&_0x51f20f['close']&&_0x51f20f['close']();}};function sh(_0x4b875b){return'actions'in _0x4b875b;}function nh(_0x20d778,_0x36902b){const _0x2b5a4a=_0x20d778['plugins']['get']('AITabs')['view'];_0x2b5a4a['isVisible']=!0x0,_0x2b5a4a['activateTab'](_0x36902b);}var rh=class extends _0x23b7b0{execute(_0x5997a8){switch(this['_expandSelectionIfCollapsed'](),_0x5997a8['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x3446c3=Es(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x3446c3});}this['_handleAIChatAction'](_0x5997a8);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x2d2fd6=Es(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x2d2fd6});}this['_handleAIActionsAction'](_0x5997a8);}}async _handleAIChatAction(_0x14ac08){const _0x4f27ad=this['editor']['plugins']['get']('AIChatController');if(nh(this['editor'],'chat'),'ask-ai'===_0x14ac08['id'])_0x4f27ad['removeSelectionFromChatContext'](),_0x4f27ad['addSelectionToChatContext'](this['editor']),_0x4f27ad['focusPromptInput']();else await _0x4f27ad['startConversation']({'modelId':_0x14ac08['model'],'contexts':this['_resolveActionContexts'](_0x14ac08)}),_0x4f27ad['removeSelectionFromChatContext'](),_0x4f27ad['addSelectionToChatContext'](this['editor']),_0x4f27ad['focusPromptInput'](),await _0x4f27ad['sendMessage']({'message':_0x14ac08['prompt']||_0x14ac08['displayedPrompt']||_0x14ac08['label'],'attributes':{'quickActionData':{'id':_0x14ac08['id']},'displayedPrompt':_0x14ac08['displayedPrompt']}});}_expandSelectionIfCollapsed(){const _0x3a08ba=this['editor'],_0x5aff8c=_0x3a08ba['model']['document']['selection'];if(!_0x5aff8c['isCollapsed'])return;const _0x15ed9a=mt(_0x5aff8c['getSelectedBlocks']())||_0x3a08ba['model']['schema']['getLimitElement'](_0x5aff8c);_0x3a08ba['model']['change'](_0x4c759c=>{_0x4c759c['setSelection'](_0x15ed9a,'in');});}_handleAIActionsActionLabel(_0x16ad50){return _0x16ad50['parent']?.['label']&&'other'!==_0x16ad50['parent']?.['id']?_0x16ad50['parent']['label']+':\x20'+_0x16ad50['label']:_0x16ad50['label'];}async _handleAIActionsAction(_0x5ab438){const _0x553d30=this['editor']['plugins']['get']('AIActions'),_0x3c3ff3=this['_resolveActionContexts'](_0x5ab438);let _0x24bd25;_0x24bd25=_0x5ab438['prompt']?{'userMessage':_0x5ab438['prompt'],'model':_0x5ab438['model'],'contexts':_0x3c3ff3}:_0x5ab438['context']?{'model':_0x5ab438['model'],'contexts':_0x3c3ff3}:{'actionName':_0x5ab438['actionName']||_0x5ab438['id'],'args':_0x5ab438['args'],'contexts':_0x3c3ff3};const _0x84589f=this['_handleAIActionsActionLabel'](_0x5ab438);await _0x553d30['executeAction'](_0x24bd25,_0x84589f,_0x5ab438['icon']);}_resolveActionContexts(_0x517f49){const _0x2f6c5e=_0x517f49['parent']?.['id']?[_0x517f49['id'],_0x517f49['parent']['id']]:[_0x517f49['id']];return this['editor']['plugins']['get'](fs)['contextLibrary']['resolveContext']({'feature':'quickActions','ids':_0x2f6c5e,'extraContexts':_0x517f49['context']?[_0x517f49['context']]:[],'context':new Yn()})['refs'];}},oh=class extends _0x622916{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x5e72ff=this['editor'],_0xe57c98=new rh(this['editor']);if(_0x5e72ff['commands']['add']('aiQuickAction',_0xe57c98),_0x5e72ff['plugins']['has']('AIChat')){const _0x4c9777=this['editor']['plugins']['get']('AIChatController');_0x5e72ff['model']['document']['selection']['on']('change:range',(_0x4940e7,_0x32c933)=>{_0x32c933['directChange']&&_0x4c9777['removeSelectionFromChatContext']();});}}},ah=class extends Vn{appendContent(_0x55ac55,_0xba8aad='text'){'modification'===this['type']&&'text'===_0xba8aad&&(_0xba8aad=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x55ac55,_0xba8aad);}updateChangeGroups(_0x4d6874){const _0x42c505=this['parsedContent']['get'](_0x4d6874)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x4d6874,_0x42c505),this['changeGroups']=[],0x0==_0x42c505['childNodes']['length'])return;on(this['documentContextContent']['get'](_0x4d6874),this['parsedMergedContent']['get'](_0x4d6874));const _0x468541=_0x11f069(this['documentContextContent']['get'](_0x4d6874)['children']['map'](_0x2674e1=>({'node':_0x2674e1,'id':Ps(_0x2674e1,'data-id')})),_0x42c505['children']['map'](_0x48d21e=>({'node':_0x48d21e,'id':Ps(_0x48d21e,'data-id')||kt()})),{'comparator':(_0x52a1b8,_0x11c41c)=>_0x52a1b8['id']==_0x11c41c['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x468541['length']&&_0x468541[_0x468541['length']-0x1]['removed'];)_0x468541['pop']();}const _0x29d600=_0x468541['map'](_0x16f2cd=>{const _0x24db9b=_0x16f2cd['added']?'new':_0x16f2cd['removed']?'removed':'modified';return{'node':_0x16f2cd['value'][0x0]['node'],'type':_0x24db9b,'id':_0x16f2cd['value'][0x0]['id']};}),_0x5317f3=this['_documentIdToSource']['get'](_0x4d6874);this['changeGroups']['push']({'changes':_0x29d600,'state':'pending','index':this['changeGroups']['length'],'editor':_0x5317f3['editor'],'rootName':_0x5317f3['rootName'],'documentId':_0x4d6874});}_getDifferentChangeGroups(_0x4da7c2,_0x5ddb81){return _0x5ddb81;}},hh=class extends Fn{content;['version'];editor;rootName;actionName;['args'];['userMessage'];['model'];contexts;['hasError']=!0x1;stoppedExplicitly=!0x1;constructor(_0x3d2723){super(_0x3d2723),this['content']=_0x3d2723['content'],this['version']=_0x3d2723['version'],this['editor']=_0x3d2723['editor'],this['rootName']=_0x3d2723['rootName'],this['actionName']=_0x3d2723['actionName'],this['args']=_0x3d2723['args'],this['userMessage']=_0x3d2723['userMessage'],this['model']=_0x3d2723['model'],this['contexts']=_0x3d2723['contexts'],this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}sendRequest(){return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args'],'contexts':this['contexts']}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html','contexts':this['contexts']});}getDocumentContext(){return{'type':'document','documents':[{'id':this['id'],'content':this['content'],'version':this['version'],'rootName':this['rootName'],'sessionId':kt(),'channelId':this['editor']['config']['get']('collaboration.channelId'),'selectionSignature':''}],'label':'Current\x20document','uiId':'current-document'};}createReply(_0x39ef90){const _0x1bf7eb=this['editor']['config']['get']('collaboration.channelId'),_0x25a6a4=new ah({..._0x39ef90,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x1bf7eb,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x1bf7eb,this['editor']]])});return this['replies']['push'](_0x25a6a4),_0x25a6a4['delegate'](...Gn)['to'](this),this['fire']('replyCreated',_0x25a6a4),_0x25a6a4;}},ch=class extends _0x54b9b5{constructor(_0x5baacd,_0x5d48b9=!0x0,_0x1cebb1=!0x0){super(_0x5baacd),this['set']('isEnabled',!0x1),_0x5d48b9&&(this['applyButton']=this['_createButton'](Es(_0x5baacd,'AI_BALLOON_APPLY_BUTTON'),Ln),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x1cebb1&&(this['suggestButton']=this['_createButton'](Es(_0x5baacd,'AI_BALLOON_SUGGEST_BUTTON'),_0x5d48b9?Pn:Ln),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x5d48b9,'showSuggestButton':_0x1cebb1}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}setButtonsVisibility({showApplyButton:_0x31ceff,showSuggestButton:_0x319095}){this['applyButton']&&(this['applyButton']['isVisible']=_0x31ceff),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x319095);}_createButton(_0x398e6c,_0x2125e6){const _0xf1eac4=new Mt(this['locale']);return _0xf1eac4['set']({'label':_0x398e6c,'class':_0x2125e6,'isVisible':!0x0,'withText':!0x0}),_0xf1eac4;}},lh=class extends _0x56a514{constructor(_0x27c1b4){super(_0x27c1b4),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':Es(_0x27c1b4,'AI_DISCLAIMER_TEXT')}]}]});}},uh=class extends _0x56a514{constructor(_0x17ae46){super(_0x17ae46),this['set']('isVisible',!0x0);const _0x10ad56=new Dr('small');_0x10ad56['isVisible']=!0x0;const _0x190335=new _0x56a514(this['locale']);_0x190335['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[Es(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x4935a1=>!_0x4935a1)]},'children':[_0x10ad56,_0x190335]});}},dh=class extends Ma{['focusCycler'];['_config'];_contentWrapper;_streamableContentView;_toolbarView;['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];_keystrokes;_dialogContent;['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];_navigationPreviousButton;_navigationNextButton;_navigationTryAgainButton;_navigationCounter;constructor(_0x29f4b4,_0x4809c5){super(_0x29f4b4),this['set']('isBusy',!0x1),this['set']('isTargetReadOnly',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x4809c5,this['_focusTracker']=new _t(),this['_keystrokes']=new gt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x93f04d(),this['_addContentWrapper'](_0x4809c5),this['_addDisclaimerView'](),this['_addToolbar'](_0x4809c5),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'](_0x4809c5);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x25529b of this['_focusables'])this['_focusTracker']['add'](_0x25529b['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}destroy(){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x3e9ec1){-0x1===_0x3e9ec1?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}setIsLoading(_0x3b33b5){this['_isLoading']=_0x3b33b5;}setErrorState(){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}clearErrorState(){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x4a8538){super['showError'](_0x4a8538),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x3c7777){super['showBlockingError'](_0x3c7777),this['setErrorState']();}addMiniToolbarItem(_0x151333){this['_miniToolbarView']['items']['has'](_0x151333)||this['_miniToolbarView']['items']['add'](_0x151333);}removeMiniToolbarItem(_0x37d1fb){this['_miniToolbarView']['items']['has'](_0x37d1fb)&&this['_miniToolbarView']['items']['remove'](_0x37d1fb);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}_toggleToolbarButtonsVisibility({showApplyButton:_0x226a74,showSuggestButton:_0x162504}){_0x226a74=_0x226a74&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x162504=_0x162504&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x226a74,'showSuggestButton':_0x162504});}async updateContent(_0x245b25){await this['_streamableContentView']['update'](_0x245b25);}finalizeContent(){this['_streamableContentView']['cleanUpStreamingArtifacts']();}clearContent(){this['_streamableContentView']['clear']();}_addContentWrapper(_0x56e833){this['_contentWrapper']=new _0x56a514(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'](_0x56e833['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new lh(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x46b71f,showSuggestButton:_0x226e4f}){this['_toolbarView']=new ch(this['locale'],_0x46b71f,_0x226e4f),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',this,'isTargetReadOnly',(_0x514aeb,_0x58bbce,_0x5cc2ca,_0x145ce5)=>!(_0x514aeb||_0x58bbce||_0x5cc2ca||_0x145ce5)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x46b71f,'showSuggestButton':_0x226e4f}),this['_dialogContent']['add'](this['_toolbarView']);}_createMiniToolbar(_0x561f1b){return this['_miniToolbarView']=new Ba(this['locale'],_0x561f1b),this['_miniToolbarView']['delegate'](...ir)['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',(_0x34e9e8,_0x155a04)=>!(_0x34e9e8||_0x155a04)),this['_miniToolbarView'];}_createLoaderView(){return this['_loaderView']=new uh(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}_createStreamableContentView(){return this['_streamableContentView']=new mr(this['locale']),this['_streamableContentView'];}_setupMiniToolbarButtons(){const _0x5e5609=new Mt(this['locale']),_0x13fc22=new Mt(this['locale']),_0x3f8535=new _h(this['locale']),_0x332e1e=new Mt(this['locale']);_0x5e5609['set']({'icon':_0x184821,'label':Es(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Dn}),_0x13fc22['set']({'icon':_0xd78e92,'tooltip':Es(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Dn}),_0x332e1e['set']({'icon':_0x57e767,'tooltip':Es(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Dn}),_0x5e5609['bind']('isEnabled')['to'](this,'isBusy',_0x5f1cd1=>!_0x5f1cd1),_0x5e5609['on']('execute',()=>{this['fire']('tryAgain');}),_0x13fc22['bind']('isEnabled')['to'](this,'isBusy',_0x5e4d03=>!_0x5e4d03),_0x13fc22['on']('execute',()=>{this['fire']('showPrevious');}),_0x332e1e['bind']('isEnabled')['to'](this,'isBusy',_0xa554e2=>!_0xa554e2),_0x332e1e['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x13fc22,this['_navigationCounter']=_0x3f8535,this['_navigationNextButton']=_0x332e1e,this['_navigationTryAgainButton']=_0x5e5609;}updateMiniToolbarButtons(_0x1a1ecc,_0x1f4a32){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x5ce479=_0x1a1ecc>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x5ce479){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x14f9ae=_0x1a1ecc-_0x1f4a32;this['_navigationCounter']['setInteractionCount'](_0x14f9ae+'/'+_0x1a1ecc),this['_navigationPreviousButton']['isEnabled']=_0x1f4a32<_0x1a1ecc-0x1,this['_navigationNextButton']['isEnabled']=_0x1f4a32>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(_0x31a424){this['_isLoading']=_0x31a424;}resetShowChangesButton(){this['_miniToolbarView']['isShowChangesOn']=!0x1;}_setupMiniToolbarPositioning(){const _0x2fa425=this['_streamableContentView']['element'],_0x495a6a=this['_miniToolbarView']['element'],_0x1dd73f=()=>{wt['window']['requestAnimationFrame'](()=>{const _0x4e9c24=_0x2fa425['offsetWidth']-_0x2fa425['clientWidth'];_0x495a6a['style']['right']='calc('+_0x4e9c24+'px\x20+\x20var(--ck-spacing-large))';});};_0x1dd73f(),this['_miniToolbarResizeObserver']=new pt(_0x2fa425,()=>{_0x1dd73f();});}_initializeScrollManager(){const _0x5ed185=this['_getScrollableElement']();_0x5ed185&&!this['_scrollManager']&&(this['_scrollManager']=new ao(_0x5ed185));}_getScrollableElement(){return this['_streamableContentView']['element'];}},_h=class extends _0x56a514{constructor(_0x4ea744){super(_0x4ea744);const _0x4ff7db=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x4ff7db['to']('interactionCount')}]});}setInteractionCount(_0x1cd175){this['set']('interactionCount',_0x1cd175);}},gh=class extends _0x622916{static get requires(){return[Is,Nn,Ut,tn,Va,_0x45dea0];}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(_0x38f0b7){super(_0x38f0b7),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['_reporter']=this['editor']['plugins']['get'](Nn)['createReporter']('aiactions'),this['set']('isBusy',!0x1),this['_promiseQueue']=new Sr();}stopInteraction(){this['_stopInteraction']();}async executeAction(_0x3d0ea0,_0x15ce3c,_0x282296){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x219dfc,anchorData:_0x1503f5,root:_0x57ea0c}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x3d0ea0,_0x219dfc,_0x1503f5,_0x57ea0c,_0x15ce3c,_0x282296);}const {modelFragment:_0x32168b,anchorData:_0x2dd88e,root:_0x3fe69d}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x3d0ea0,_0x32168b,_0x2dd88e,_0x3fe69d,_0x15ce3c,_0x282296);}async destroy(){return this['_stopInteraction'](),super['destroy']();}_createActionsBalloonView(){const _0x4372a4=this['editor']['plugins']['has']('TrackChanges');let _0x44fb79=this['editor']['config']['get']('ai.availableReplyActions')||[...Or];_0x4372a4||(_0x44fb79=_0x44fb79['filter'](_0x1ced20=>'insertSuggestion'!=_0x1ced20));const _0x537a99=this['editor']['commands']['get']('trackChanges'),_0x56e6ef=new dh(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x4372a4,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x44fb79});return _0x56e6ef['bind']('isBusy')['to'](this),_0x56e6ef['bind']('isTargetReadOnly')['to'](this['editor'],'isReadOnly'),_0x537a99&&_0x56e6ef['bind']('isTrackChangesOn')['to'](_0x537a99,'value'),_0x56e6ef['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x56e6ef['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x56e6ef['on']('showNext',()=>{this['_navigateToNext']();}),_0x56e6ef;}_normalizeSelectionStart(){const _0x3c6c1c=this['editor']['model'],_0x2cd6ee=_0x3c6c1c['document']['selection'],_0x331cc7=_0x2cd6ee['getFirstRange']();if(!_0x331cc7||_0x331cc7['isCollapsed'])return;const _0x36a804=mt(_0x2cd6ee['getSelectedBlocks']());if(!_0x36a804)return;const _0x5a83f7=_0x3c6c1c['createPositionAt'](_0x36a804,0x0);_0x5a83f7['isAfter'](_0x331cc7['start'])&&_0x3c6c1c['change'](_0x898da2=>{_0x898da2['setSelection'](_0x898da2['createRange'](_0x5a83f7,_0x331cc7['end']));});}_getExecuteDataRegular(){const _0x233489=this['editor']['model']['document']['selection'],_0x46637e=_0x233489['getFirstRange']()['start']['root'];if(_0x233489['isCollapsed']){const _0x2dd185=mt(_0x233489['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x233489);this['editor']['model']['change'](_0x2e5151=>{_0x2e5151['setSelection'](_0x2dd185,'in');});}this['_normalizeSelectionStart']();const _0x34f2c9=_0x233489['getFirstRange'](),_0x366101=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x233489),_0x34f2c9['start'],_0x34f2c9['end']);this['_copyMarkersToFragment'](_0x366101,_0x233489,{'isTableSelection':!0x1});const _0x2660c6=_0x233489['getFirstRange']()['start'],_0x169669=new Map();let _0x339b72=_0x366101;for(let _0x92ba67=0x0;_0x92ba67<_0x2660c6['path']['length'];_0x92ba67++)_0x169669['set'](_0x339b72,_0x2660c6['path'][_0x92ba67]),_0x339b72=_0x339b72['getChild'](0x0);return{'modelFragment':_0x366101,'anchorData':_0x169669,'root':_0x46637e};}_getExecuteDataInTable(){const _0x4c6d59=this['editor']['model']['document']['selection'],_0x2a8ff9=this['editor']['plugins']['get']('TableSelection'),_0x204bd0=_0x4c6d59['getFirstRange']()['start']['root'],_0x2a2827=_0x2a8ff9['getSelectionAsFragment'](),_0x2d37a1=_0x4c6d59['getFirstRange']()['start']['parent']['parent'],_0x14f430=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x2d37a1),this['editor']['model']['createPositionAfter'](_0x2d37a1)),_0x4ce7cb=this['_wrapWithCommonAncestors'](_0x2a2827,_0x14f430['start'],_0x14f430['end']);this['_copyMarkersToFragment'](_0x4ce7cb,_0x4c6d59,{'isTableSelection':!0x0});const _0x2a5271=_0x4c6d59['getFirstRange']()['start'],_0x3df788=new Map();let _0x5e0a88=_0x4ce7cb;for(let _0x298073=0x0;_0x298073<_0x2a5271['path']['length'];_0x298073++)if(_0x3df788['set'](_0x5e0a88,_0x2a5271['path'][_0x298073]),_0x298073<_0x2a5271['path']['length']-0x1)_0x5e0a88=_0x5e0a88['getChild'](0x0);else{let _0x35a89d=_0x5e0a88['nextSibling'];for(;_0x35a89d;)_0x3df788['set'](_0x35a89d,_0x2a5271['path'][_0x298073]),_0x35a89d=_0x35a89d['nextSibling'];}return{'modelFragment':_0x4ce7cb,'anchorData':_0x3df788,'root':_0x204bd0};}async _executeAction(_0x56058d,_0x185282,_0x5b5fd9,_0x4bfd87,_0x3da008,_0x187ca7){const _0x379ac2=this['editor']['plugins']['get'](tn),_0xbd967d=this['editor']['plugins']['get'](Va),_0x149c2f=this['editor']['model']['document']['selection'],_0x4a1f09=await _0x379ac2['modelToDataWithIds'](_0x185282,this['editor'],_0x4bfd87['rootName']),_0x291186=this['editor']['model']['document']['version'],_0x4176fe=[..._0x149c2f['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0xbd967d['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x3da008,'icon':_0x187ca7||_0x10bb99,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x4176fe,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0xbd967d),this['_interactionParams']={'action':_0x56058d,'content':_0x4a1f09,'version':_0x291186,'aiBalloon':_0xbd967d,'modelFragment':_0x185282,'anchorData':_0x5b5fd9,'root':_0x4bfd87},this['_setupApplyListeners'](),this['listenTo'](_0xbd967d,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0xbd967d,'dialogClosed',(_0x67eab2,{id:_0x3c8fa3})=>{if('aiActionsBalloon'===_0x3c8fa3){for(const _0x482d8f of this['_interactions']){if(0x0===_0x482d8f['replies']['length']||_0x482d8f['stoppedExplicitly'])continue;const _0x3bf97c=_0x482d8f['replies'][_0x482d8f['replies']['length']-0x1],_0xa5bcf6=_0x3bf97c['changeGroups'][0x0];_0xa5bcf6&&'pending'===_0xa5bcf6['state']&&_0x3bf97c['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0xbd967d);}}),this['_createInteraction'](_0x4a1f09,_0x291186,_0xbd967d,_0x56058d);}_setupApplyListeners(){if(!this['_interactionParams'])return;const {modelFragment:_0x541465,anchorData:_0x3cf601,root:_0x3b8c72}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x541465,_0x3cf601,_0x3b8c72,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x541465,_0x3cf601,_0x3b8c72,!0x0);});}_wrapWithCommonAncestors(_0x453833,_0x51eff8,_0x30fd03){const _0x56c380=this['editor']['model']['createRange'](_0x51eff8,_0x30fd03)['getCommonAncestor'](),_0x4cfd86=_0x56c380['is']('documentFragment')?[]:_0x56c380['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x4cfd86['length']){const _0x2b3bc1=_0x4cfd86['map'](_0x2ef266=>_0x2ef266['_clone'](!0x1));for(let _0x5d9e76=0x1;_0x5d9e76<_0x2b3bc1['length'];_0x5d9e76++)_0x2b3bc1[_0x5d9e76-0x1]['_appendChild'](_0x2b3bc1[_0x5d9e76]);return _0x2b3bc1[_0x2b3bc1['length']-0x1]['_appendChild'](_0x453833),new _0x28e306(_0x2b3bc1[0x0]);}return _0x453833;}_copyMarkersToFragment(_0x5f410c,_0x249db8,_0x619476={'isTableSelection':!0x1}){const _0x50f325=this['editor']['model'],_0x1a82c5=Array['from'](_0x249db8['getRanges']()),_0x2ad917=_0x249db8['getFirstRange']()['start'];for(const _0x56cb83 of _0x50f325['markers']){if(_0x56cb83['name']['startsWith']('ai-selection')||!_0x56cb83['affectsData'])continue;const _0x36b961=_0x56cb83['getRange']();if(!_0x1a82c5['some'](_0x447767=>_0x447767['containsRange'](_0x36b961,!0x0)))continue;const _0x8bc5f5=this['_regularCalculateMarkerPath'](_0x36b961['start'],_0x2ad917,_0x619476['isTableSelection']),_0x3befe6=this['_regularCalculateMarkerPath'](_0x36b961['end'],_0x2ad917,_0x619476['isTableSelection']),_0x1da471=_0x50f325['createPositionFromPath'](_0x5f410c,_0x8bc5f5),_0x1169ac=_0x50f325['createPositionFromPath'](_0x5f410c,_0x3befe6);if(!_0x1da471['isEqual'](_0x1169ac)){const _0x47189=_0x50f325['createRange'](_0x1da471,_0x1169ac);_0x5f410c['markers']['set'](_0x56cb83['name'],_0x47189);}}}_regularCalculateMarkerPath(_0xa6c6c5,_0x485b15,_0x1c2dce=!0x1){const _0x443676=[..._0xa6c6c5['path']['slice']()];for(let _0x54d2e2=0x0;_0x54d2e2<Math['max'](_0x485b15['path']['length'],_0xa6c6c5['path']['length']);_0x54d2e2++){const _0x3304b4=_0x485b15['path'][_0x54d2e2]||0x0,_0x522f5c=(_0xa6c6c5['path'][_0x54d2e2]||0x0)-_0x3304b4;if(_0x443676[_0x54d2e2]=_0x522f5c,0x0!==_0x522f5c&&!_0x1c2dce)break;}return _0x443676;}async _createInteraction(_0x2f0fda,_0x3d4302,_0x49fee9,_0x343cc3){const _0x52b1f1=this['editor'],_0x42abea=_0x52b1f1['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0x343cc3,'content':_0x2f0fda,'version':_0x3d4302,'aiBalloon':_0x49fee9,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x42abea});const _0x300a11=new hh({'connector':this['_aiConnector'],'locale':_0x52b1f1['locale'],'content':_0x2f0fda,'version':_0x3d4302,'editor':_0x52b1f1,'rootName':_0x42abea['rootName'],..._0x343cc3});this['_interactions']['push'](_0x300a11);const _0x230401=(_0x5bb23c,_0x37da5d=!0x1,_0x316c72='streaming')=>{const {isDone:_0x343209}=_0x5bb23c;return this['_promiseQueue']['enqueue'](async _0x1f34ef=>{try{if(this['_isUnsupportedInlineRootChange'](_0x5bb23c,_0x42abea))return this['_actionsBalloonView']['showBlockingError'](Es(_0x52b1f1['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')),void(_0x343209&&this['_actionsBalloonView']['finalizeContent']());const _0x492aac=ln({'changeGroups':_0x5bb23c['changeGroups'],'documentContextContent':_0x5bb23c['documentContextContent'],'showDiff':_0x37da5d,'trimUnchanged':!0x1});_0x492aac['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x492aac[0x0],'renderingStrategy':_0x316c72,'abortSignal':_0x1f34ef}),_0x343209&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x4181b1){if(kn(_0x4181b1))return;throw _0x4181b1;}});};_0x300a11['on']('replyCreated',(_0x343200,_0x4886bf)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x230401(_0x4886bf)['catch'](_0x27ae4d=>{this['_reporter']['logError'](_0x27ae4d,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x300a11,_0x27ae4d);});}),_0x300a11['on']('replyContentUpdated',(_0x1fb402,_0x372151)=>{_0x230401(_0x372151)['catch'](_0x410400=>{this['_reporter']['logError'](_0x410400,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x300a11,_0x410400);});}),_0x300a11['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x5b7c47){this['_reporter']['logError'](_0x5b7c47,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x300a11,_0x5b7c47);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x1bb6d3,{showDiff:_0x342d1a})=>{try{this['_balloonShowDiff']=_0x342d1a;const _0x379a68=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x379a68&&await _0x230401(_0x379a68,_0x342d1a,'static');}catch(_0x8b874e){this['_reporter']['logError'](_0x8b874e,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x300a11,_0x8b874e);}}),_0x300a11['on']('replyChangeGroupStateUpdated',()=>{const _0x653281={'positiveCount':_0x300a11['replies']['reduce']((_0xf681c2,_0x2c3641)=>_0xf681c2+_0x2c3641['changeGroups']['filter'](_0x498c37=>'accepted'===_0x498c37['state'])['length'],0x0),'totalCount':_0x300a11['replies']['reduce']((_0x2845f3,_0x26a966)=>_0x2845f3+_0x26a966['changeGroups']['length'],0x0)},_0x3c3606=_0x300a11['actionCallId'],_0x261969=_0x300a11['actionName'];_0x261969?this['_aiConnector']['upsertAIActionRating'](_0x261969,_0x3c3606,_0x653281):this['_aiConnector']['upsertCustomAIActionRating'](_0x3c3606,_0x653281);}),this['_setLoadingState']();try{const _0x3585b5=await _0x300a11['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x3585b5;}catch(_0x4f7d08){kn(_0x4f7d08)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x4f7d08,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x300a11,_0x4f7d08);}}_isUnsupportedInlineRootChange(_0xf48f2e,_0x346a0b){const _0x47e0f8=this['editor'];return!!Gs(_0x47e0f8,_0x346a0b['rootName'])&&!Ys(_0x47e0f8,new _0x139fbf((_0xf48f2e['changeGroups'][0x0]?.['changes']??[])['filter'](_0x965914=>'removed'!==_0x965914['type'])['map'](_0x305736=>_0x305736['node']['cloneNode'](!0x0))));}['_applyChanges'](_0x5d74b1,_0x392ee1,_0x1643ba,_0x4185dd){const _0x50a17c=this['editor'];if(_0x4185dd&&!_0x50a17c['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',null);const _0x5f48e8=this['editor']['plugins']['get'](_0x45dea0),_0x11ed77=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x11ed77||!_0x11ed77['replies']['length'])return;const _0x13a8ca=_0x11ed77['replies'][_0x11ed77['replies']['length']-0x1];if(this['_isUnsupportedInlineRootChange'](_0x13a8ca,_0x1643ba))return void this['_actionsBalloonView']['showBlockingError'](Es(_0x50a17c['locale'],'AI_SUGGESTION_NO_PARTS_WARNING'));_0x13a8ca['setChangeGroupState'](0x0,'accepted');const _0x7dd903=Jn({'documentSuggestions':Zn({'groups':[_0x13a8ca['changeGroups'][0x0]],'documentContextContent':_0x13a8ca['documentContextContent'],'documents':_0x11ed77['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x5f48e8,'documentCompareOptions':{'anchor':_0x50a17c['model']['createPositionAt'](_0x5d74b1,0x0),'markDeletions':_0x4185dd}})['values']()['next']()['value']??[],_0x278a69=this['_filterOperationsOutsideRange'](_0x7dd903,_0x392ee1);for(const _0x5c6879 of _0x278a69)this['_anchorOperation'](_0x392ee1,_0x5c6879,_0x1643ba);const _0x344c42=_0x11ed77['getDocumentContext']()['documents'][0x0]['version'],_0x1aa9af=_0x5dec67(_0x278a69,_0x50a17c['model']['document']['history']['getOperations'](_0x344c42),{'document':_0x50a17c['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];mn(_0x1aa9af,'quickActions');try{_0x50a17c['model']['change'](_0xe5e99b=>{_0xe5e99b['setSelection'](_0x50a17c['model']['document']['selection']['focus']),_0x4185dd?_0x50a17c['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x1aa9af):_0x5f48e8['applyOperations'](_0xe5e99b,_0x1aa9af);});}catch(_0x2dec8c){throw this['_reporter']['logError'](new yn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x2dec8c})),_0x2dec8c;}this['editor']['plugins']['get']('AIBalloon')['close']();}_filterOperationsOutsideRange(_0x3e3b34,_0x213e47){return _0x3e3b34['filter'](_0x37dd6e=>{if('rename'==_0x37dd6e['type']){const _0x4c6a95=_0x37dd6e['position']['nodeAfter'];return!_0x213e47['has'](_0x4c6a95);}if(_0x37dd6e['type']['indexOf']('Attribute')>-0x1){const _0x5d48c6=_0x37dd6e['range']['start']['nodeAfter'];return!_0x213e47['has'](_0x5d48c6);}return!0x0;});}_anchorOperation(_0x1b2256,_0x22c22b,_0x234e05){const _0x153896=_0x22c22b['clone']();for(const _0x1671a0 in _0x22c22b){const _0x20c415=_0x22c22b[_0x1671a0];_0x20c415 instanceof _0x2827cc?_0x22c22b[_0x1671a0]=new _0x2827cc(_0x2bada3(_0x20c415['start']),_0x2bada3(_0x20c415['end'])):_0x20c415 instanceof _0x4febba&&(_0x22c22b[_0x1671a0]=_0x2bada3(_0x20c415));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x153896['type'])){if(_0x153896['isDocumentOperation']=!0x1,_0x153896['baseVersion']=null,'remove'==_0x153896['type']){const _0x194db2=_0x153896['sourcePosition'],_0xa0a6f1=_0x153896['howMany'];new _0x4f656c(_0x194db2,_0xa0a6f1)['_execute']();}else _0x153896['_execute']();}function _0x2bada3(_0x5557dd){if('$graveyard'==_0x5557dd['root']['rootName'])return _0x5557dd;const _0x12c476=[];let _0x163011=_0x5557dd['root'];for(let _0x471f8a=0x0;_0x471f8a<_0x5557dd['path']['length'];_0x471f8a++){const _0x17cd1f=_0x1b2256['get'](_0x163011)||0x0;_0x12c476[_0x471f8a]=_0x5557dd['path'][_0x471f8a]+_0x17cd1f,_0x163011=_0x163011['getChildAtOffset'](_0x5557dd['path'][_0x471f8a]);}return new _0x4febba(_0x234e05,_0x12c476,_0x5557dd['stickiness']);}}_refreshInteraction(){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x4bc6b3,content:_0xb777a6,version:_0x14100e,aiBalloon:_0x176404}=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'](_0xb777a6,_0x14100e,_0x176404,_0x4bc6b3)['catch'](_0x6855c2=>{this['_reporter']['logError'](_0x6855c2,{'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 _0x5c5353=this['_interactions']['length'];this['_currentInteractionIndex']<_0x5c5353-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}_navigateToNext(){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async _displayInteractionAtIndex(_0x4d101a){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x4d101a;const _0x111c43=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x111c43)return;if(_0x111c43['hasError'])return this['_setErrorState'](_0x111c43),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x111c43['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x29cf18=_0x111c43['replies'][_0x111c43['replies']['length']-0x1];if(_0x29cf18)try{const _0x4f7790=ln({'changeGroups':_0x29cf18['changeGroups'],'documentContextContent':_0x29cf18['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x12969f=>setTimeout(_0x12969f,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x4f7790[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0xfaaba3){this['_reporter']['logError'](_0xfaaba3,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}_setLoadingState(){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async _setErrorState(_0x382408,_0x5369b2){if(void 0x0!==_0x5369b2&&kn(_0x5369b2))return;const _0x5ad12f=Es(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x5ad12f),_0x382408['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);}},Ah=class extends _0x622916{static get requires(){return[ih,oh,gh];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x51fd4e){super(_0x51fd4e),_0x51fd4e['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Ih=class extends _0x56a514{resultResponseView;acceptButtonView;dismissButtonView;infoButtonView;outdatedButtonView;constructor(_0x1e1332,_0x490eb9){super(_0x1e1332),this['id']=_0x490eb9,this['set']('status','pending'),this['set']('changeId',_0x490eb9),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',(_0x48a289,_0xb2df2c)=>{_0xb2df2c&&_0xb2df2c['target']&&'A'===_0xb2df2c['target']['tagName']&&_0xb2df2c['preventDefault'](),this['fire']('activateChange',{'id':_0x490eb9,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x490eb9,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x490eb9,'source':this});}),this['on']('change:showDiff',()=>this['_syncResponseVisibility']());}['render'](){super['render'](),this['_syncResponseVisibility']();}setItemAsActive(){this['isActive']=!0x0;}setItemAsInactive(){this['isActive']=!0x1;}_createResultResponseView(){const _0x540861=new _0x56a514(this['locale']);return _0x540861['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response']}}),_0x540861;}updateResponseContent(_0x631d8b,_0x527b34){const _0x55d626=_0x527b34||'div',_0x8b30f7=this['resultResponseView']['element'];if(_0x8b30f7['tagName']['toLowerCase']()!==_0x55d626){const _0x252077=new _0x24e6f7({'tag':_0x55d626,'attributes':{'class':_0x8b30f7['className']}})['render']();_0x8b30f7['replaceWith'](_0x252077),this['resultResponseView']['element']=_0x252077,this['_syncResponseVisibility']();}this['resultResponseView']['element']['innerHTML']=_0x631d8b;}_syncResponseVisibility(){this['resultResponseView']['element']?.['classList']['toggle']('ck-hidden',!this['showDiff']);}_createAcceptButtonView(){const _0x335fda=new Mt(this['locale']);return _0x335fda['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x335fda['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x1d38aa=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x1d38aa['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x155cae=>'pending'!==_0x155cae&&'accepted'!==_0x155cae),this['bindTemplate']['if']('status',Pn,_0x4f449b=>'pending'===_0x4f449b),this['bindTemplate']['if']('status',Dn,_0x47c749=>'pending'!==_0x47c749),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x2b85a3=>'accepted'===_0x2b85a3)]}}),this['on']('change:status',(_0x9c6e29,_0x3dfb5d,_0x4860a1)=>{_0x335fda['isEnabled']='pending'===_0x4860a1,'accepted'===_0x4860a1&&(_0x335fda['label']=Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x335fda['icon']=_0x48b061);}),_0x335fda;}_createDismissButtonView(){const _0x570a77=new Mt(this['locale']);return _0x570a77['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x570a77['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x30fd5b=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x30fd5b['stopPropagation']();})},'attributes':{'class':[Dn,this['bindTemplate']['if']('status','ck-hidden',_0x4b18cd=>'pending'!==_0x4b18cd&&'rejected'!==_0x4b18cd),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x225e90=>'pending'===_0x225e90),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x3b0566=>'rejected'===_0x3b0566)]}}),this['on']('change:status',(_0xd7f7cd,_0x450b92,_0x219d6f)=>{_0x570a77['isEnabled']='pending'===_0x219d6f,'rejected'===_0x219d6f&&(_0x570a77['label']=Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x570a77['icon']=_0x572ba4);}),_0x570a77;}_createInfoButtonView(){const _0x1a4300=new Mt(this['locale']);return _0x1a4300['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x41da4b,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Dn+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x1a4300['bind']('isOn')['to'](this,'isInfoToggleOn',_0x5618bf=>_0x5618bf),_0x1a4300['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x1a4300;}_createOutdatedButtonView(){const _0x341d91=new Mt(this['locale']);return _0x341d91['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0x157ef8,'withText':!0x0,'isEnabled':!0x1}),_0x341d91['extendTemplate']({'attributes':{'class':[Dn,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x5e4550=>'outdated'!==_0x5e4550)],'disabled':'disabled'}}),_0x341d91;}},ph=class extends xt{resultItemView;_pinnedRectIndex=void 0x0;_pinnedTargetElement=void 0x0;_pinnedTargetChangeId=void 0x0;constructor(_0x217f22,_0xc43cb){super(_0x217f22),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']()),_0xc43cb['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}updateContent(_0x2415f8){this['resultItemView']['changeId']=_0x2415f8['id'],this['resultItemView']['updateResponseContent'](_0x2415f8['contentDiffed'],_0x2415f8['wrapperTag']);}['showBalloon'](_0x233e21,_0x18e4aa,_0x1cf4c5,_0x498074,_0xd92c7f,_0x2cff36){const _0x384420=_0x18e4aa();if(!_0x384420)return;this['updateContent'](_0x233e21),this['show']();const _0x47ba34=Array['from'](_0x384420['getClientRects']())['reverse'](),_0xba1a41=this['_getPointedRectIndexFromEvent'](_0x1cf4c5,_0x47ba34),_0xcdbf6e=_0x47ba34[_0xba1a41??0x0];'click'===_0x498074?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x18e4aa(),_0xba1a41,_0x233e21['id'],_0xd92c7f,_0x2cff36)||_0xcdbf6e})):'hover'===_0x498074&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x18e4aa(),_0xba1a41,_0x233e21['id'])||_0xcdbf6e}));}['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(){_0x44d1a9({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x4be4e2=[this['element']];return this['_pinnedTargetElement']&&_0x4be4e2['push'](this['_pinnedTargetElement']),_0x4be4e2;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}_createContentView(){const _0x3690bf=new _0x56a514();return this['resultItemView']=new Ih(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x3690bf['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']]}]}),_0x3690bf;}_getBestRectPositionOnClick(_0x3cdf61,_0x5a4468,_0x4e5657,_0x46c4ff,_0x11d6ff){if(!_0x3cdf61)return null;const _0x312d09=this['position']['replace']('arrow_',''),_0x398b2c=Array['from'](_0x3cdf61['getClientRects']());let _0x2ab069,_0x3b5143=_0x398b2c['reverse']();return void 0x0!==_0x5a4468&&this['_isPinnedRectVisible'](_0x3b5143[_0x5a4468],_0x46c4ff,_0x11d6ff)?(_0x2ab069=_0x3b5143[_0x5a4468],this['_pinnedRectIndex']=_0x5a4468):this['_isPinnedRectVisible'](_0x3b5143[0x0],_0x46c4ff,_0x11d6ff)&&void 0x0===_0x5a4468?_0x2ab069=_0x3b5143[0x0]:(_0x3b5143='s'==_0x312d09[0x0]?[..._0x398b2c]['reverse']():_0x398b2c,_0x3b5143['forEach'](_0x5b089e=>{this['_isPinnedRectVisible'](_0x5b089e,_0x46c4ff,_0x11d6ff)&&(_0x2ab069=_0x5b089e);})),this['_pinnedTargetChangeId']=_0x4e5657,this['_pinnedTargetElement']=_0x3cdf61,_0x2ab069||_0x3cdf61['getBoundingClientRect']();}_getBestRectPositionOnHover(_0x2a95ca,_0x6be707,_0x590645){if(!_0x2a95ca)return null;const _0x34cee5=Array['from'](_0x2a95ca['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x6be707&&this['_pinnedTargetChangeId']!==_0x590645?(this['_pinnedRectIndex']=_0x6be707,this['_pinnedTargetElement']=_0x2a95ca,this['_pinnedTargetChangeId']=_0x590645,_0x34cee5[_0x6be707]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x590645?_0x2a95ca!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x34cee5[this['_pinnedRectIndex']]:void 0x0!==_0x6be707&&this['_pinnedTargetChangeId']!==_0x590645?(this['_pinnedRectIndex']=_0x6be707,this['_pinnedTargetElement']=_0x2a95ca,this['_pinnedTargetChangeId']=_0x590645,_0x34cee5[_0x6be707]):_0x2a95ca['getBoundingClientRect']();}_getPointedRectIndexFromEvent(_0x3abf0c,_0x289dd7){if(_0x3abf0c)for(let _0x4bc3ab=0x0;_0x4bc3ab<_0x289dd7['length'];_0x4bc3ab++){const _0x2b0d7d=_0x289dd7[_0x4bc3ab];if(_0x3abf0c['clientX']>=_0x2b0d7d['left']-0x3&&_0x3abf0c['clientX']<=_0x2b0d7d['right']+0x3&&_0x3abf0c['clientY']>=_0x2b0d7d['top']-0x3&&_0x3abf0c['clientY']<=_0x2b0d7d['bottom']+0x3)return _0x4bc3ab;}}_isPinnedRectVisible(_0x125715,_0x3a5ea5,_0x109b57){const _0x3282c5=new It(_0x125715),_0x5a8005=_0x3a5ea5||document['documentElement'],_0x536282=_0x3282c5['getIntersection'](Tt(_0x109b57)),_0x3b89b8=new It(_0x5a8005)['getIntersection'](_0x3282c5);return!!(_0x536282&&_0x3b89b8&&_0x3282c5['width']>0x0);}};const Eh=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var mh=class extends _0x898608{['_mainView'];_balloonSuggestionView;_bodyCollection;static get requires(){return[gs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2c9410){super(_0x2c9410),this['_bodyCollection']=Mn(this['context']['locale']),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Eh)['to'](this),this['_balloonSuggestionView']=new ph(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}init(){const _0x5ebd8a=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x5ebd8a);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}setAvailableChecks(_0x1e9e44){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x22c4be=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x1e9e44,_0x22c4be);}this['_mainView']['showReviewCheckListView']();}showReviewCheckList(){this['fire']('getReviewCheckList');}showCheckRunResults(_0x40a946){_0x40a946&&('error-general'!==_0x40a946['status']?'error-chunk'!==_0x40a946['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}showCheckRunResult(_0x565705){this['_mainView']['addCheckRunResult'](_0x565705);}showGeneralResultsErrorView(){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0xd138cd){this['_mainView']['showGeneralReviewCoreErrorView'](_0xd138cd??Es(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}showUnsupportedInlineChangeView(){this['_mainView']['showUnsupportedInlineChangeView']();}setCheckResultTitle(_0x352996,_0x22159e){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x352996,_0x22159e);}setAcceptAllEnabled(_0x406c33){this['_mainView']['reviewCheckResultsView']['setAcceptAllEnabled'](_0x406c33);}setActiveStateInResults(_0x384004){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x55d8b5=>{_0x55d8b5['id']===_0x384004&&_0x55d8b5['setItemAsActive']();});}resetActiveStateInResults(){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x424e0c=>_0x424e0c['setItemAsInactive']());}updateChangeState(_0x1cdd7c,_0xa7e789){'accepted'===_0xa7e789||'rejected'===_0xa7e789||'outdated'===_0xa7e789?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x1cdd7c,_0xa7e789):this['_mainView']['reviewCheckResultsView']['showResult'](_0x1cdd7c,_0xa7e789);}showReviewCompletedView(){this['_mainView']['showReviewCompletedView']();}showActionsWhenResultIsReady(){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}hideActionsWhenResultIsReady(){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x26b31f,_0x2a1ea7,_0x2d21fb,_0x26d567,_0x2b19c0,_0x1a8a87){this['_balloonSuggestionView']['showBalloon'](_0x26b31f,_0x2a1ea7,_0x2d21fb,_0x26d567,_0x2b19c0,_0x1a8a87);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}getChangeElement(_0x220851){const _0x3aefc9=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x441fc1=>_0x441fc1['id']===_0x220851);return _0x3aefc9?_0x3aefc9['element']:null;}deactivateChange(){this['_balloonSuggestionView']['deactivateChange']();}},Th=class extends _0x56a514{constructor(_0x24e47f){super(_0x24e47f),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x33d84f=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x33d84f['if']('isVisible','ck-hidden',_0x5cd6d1=>!_0x5cd6d1)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x33d84f['to']('errorMessage')}]}]});}},wh=class extends _0x56a514{['reviewCoreHeader'];['generalErrorView'];reviewCheckListView;reviewCheckResultsView;reviewCompletedView;constructor(_0x58628d,_0xd5e6c6){super(_0x58628d),this['reviewCoreHeader']=_0xd5e6c6['header'],this['generalErrorView']=new Th(_0x58628d),this['reviewCheckListView']=_0xd5e6c6['list'],this['reviewCheckListView']['delegate'](...Eh)['to'](this),this['reviewCheckResultsView']=_0xd5e6c6['results'],this['reviewCheckResultsView']['delegate'](...Eh)['to'](this),this['reviewCompletedView']=_0xd5e6c6['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(_0xb9f256){this['reviewCheckResultsView']['addResult'](_0xb9f256),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'](_0x58d038){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x58d038;}showGeneralResultsErrorView(){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}showUnsupportedInlineChangeView(){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showUnsupportedInlineChangeMessage']();}},Ch=class extends Mt{constructor(_0x164483,_0x2a542d){super(_0x2a542d),this['set']({'label':_0x164483,'withText':!0x0,'class':Ln}),this['on']('execute',()=>{this['fire']('finishReview');});}},fh=class extends jt{_resultViews;_resultsHeader;_resultsBody;['reviewDisclaimer'];_cancelButtonView;_acceptAllButtonView;_exitReviewButtonView;_toggleDiffButtonView;['_errorMessageView'];_finishReviewButtonView;_contents;constructor(_0x1bbce9,_0x2f8c50){super(_0x1bbce9),this['_contents']=_0x2f8c50,this['_resultViews']=new _0x93f04d(),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 da(_0x1bbce9),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),this['set']('isAcceptAllEnabled',!0x1),this['_acceptAllButtonView']['bind']('isEnabled')['to'](this,'isAcceptAllEnabled',this,'isError',(_0x13fc47,_0x240c7a)=>_0x13fc47&&!_0x240c7a);const _0x317085=this['_createCombinedSkeletonLoader'](),_0x564e6b=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x564e6b['if']('isLoading','ck-ai_review__check-run_loading',_0x20e0ee=>_0x20e0ee),_0x564e6b['if']('isResultReady','ck-ai_review__check-run_ready',_0xb8be7e=>_0xb8be7e),_0x564e6b['if']('isVisible','ck-hidden',_0x8d6218=>!_0x8d6218)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x317085,this['reviewDisclaimer']]});}clearResults(){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}getResults(){return this['_resultViews'];}addResult(_0x2771c8){const _0x245473=new Ih(this['locale'],_0x2771c8['id']);_0x245473['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x245473),_0x245473['updateResponseContent'](_0x2771c8['contentDiffed'],_0x2771c8['wrapperTag']);}hideResult(_0x1a6425,_0x5e161c){if('pending'===_0x5e161c)return;const _0x260750=this['_resultViews']['find'](_0x28fddd=>_0x28fddd['id']===_0x1a6425);_0x260750&&(_0x260750['status']=_0x5e161c,_0x260750['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}showResult(_0x3bfe10,_0x190921){if('pending'!==_0x190921)return;const _0x318885=this['_resultViews']['find'](_0x2c07d3=>_0x2c07d3['id']===_0x3bfe10);_0x318885&&(_0x318885['status']=_0x190921,_0x318885['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}setTitle(_0x36630b,_0x2516c1){this['headerTitle']=_0x36630b,this['headerSubtitle']=_0x2516c1||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}showUnsupportedInlineChangeMessage(){this['errorType']='unsupported-inline',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}resetErrorState(){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}setAcceptAllEnabled(_0x12f736){this['isAcceptAllEnabled']=_0x12f736;}_createSkeletonLoader(){return new wr(this['locale'],Cr['aiReviewChecks']);}_createCombinedSkeletonLoader(){const _0x1d26a3=new _0x56a514(this['locale']),_0x1edeb7=[];for(let _0x4b3d03=0x0;_0x4b3d03<0x10;_0x4b3d03++){const _0x37ad21=this['_createSkeletonLoader']();_0x37ad21['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x1edeb7['push'](_0x37ad21);}return _0x1d26a3['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x60dd1a=>!_0x60dd1a)]},'children':_0x1edeb7}),_0x1d26a3;}_createResultsBodyView(){const _0x4f57e8=new _0x56a514(this['locale']);return _0x4f57e8['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x3960e1=>_0x3960e1)]},'children':this['_resultViews']}),_0x4f57e8;}_createErrorView(){const _0x3bf517=new _0x56a514(this['locale']),_0x5c5299=new Mt(this['locale']),t=this['locale']['t'];return _0x3bf517['delegate']('retryReview')['to'](this),_0x5c5299['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Pn+'\x20ck-ai_review__check-run-error-retry-button'}),_0x5c5299['on']('execute',()=>{this['fire']('retryReview');}),_0x3bf517['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x42826c=>!_0x42826c),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x38e492=>'chunk'===_0x38e492)]},'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',_0xe82d3b=>'chunk'===_0xe82d3b||'unsupported-inline'===_0xe82d3b)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x224b26=>'general'!==_0x224b26)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x2f68cd=>'chunk'!==_0x2f68cd)]},'children':[{'text':Es(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x202ae3=>'unsupported-inline'!==_0x202ae3)]},'children':[{'text':Es(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')}]}]},_0x5c5299]}),_0x3bf517;}_createCancelButtonView(){const _0x4281d6=new Mt(this['locale']);return _0x4281d6['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Pn+'\x20ck-ai-button-stop-generating'],'icon':st}),_0x4281d6['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x4760c4=>_0x4760c4),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x791c08=>_0x791c08)]}}),_0x4281d6['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x4281d6;}_createToggleDiffButtonView(){const _0x4d7349=new Mt(this['locale']);_0x4d7349['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x4d7349['bind']('isEnabled')['to'](this,'isError',_0x5993a7=>!_0x5993a7),_0x4d7349['extendTemplate']({'attributes':{'class':[Pn,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x1758df=>!_0x1758df),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5c127f=>_0x5c127f)]}});const _0x16c0f7=Es(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x4169c4=Es(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x4d7349['bind']('isOn')['to'](this,'isToggleDiffOn',_0x422f6c=>_0x422f6c),_0x4d7349['bind']('icon')['to'](this,'isToggleDiffOn',_0x277099=>_0x277099?_0x112882:_0x3bafdd),_0x4d7349['bind']('label')['to'](this,'isToggleDiffOn',_0x409b95=>_0x409b95?_0x16c0f7:_0x4169c4),_0x4d7349['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x4d7349;}_createAcceptAllButtonView(){const _0x2ac570=new Mt(this['locale']);return _0x2ac570['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x2ac570['extendTemplate']({'attributes':{'class':[Ln,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x273fe5=>!_0x273fe5),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5f4c14=>_0x5f4c14)]}}),_0x2ac570['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x2ac570;}_createExitReviewButtonView(){const _0x41a673=new Mt(this['locale']);return _0x41a673['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x41a673['extendTemplate']({'attributes':{'class':[Dn,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x326eaf=>!_0x326eaf),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5bd87c=>_0x5bd87c)]}}),_0x41a673['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x41a673;}_createResultHeaderView(){const _0x417ef5=new _0x56a514(this['locale']),_0x4de76f=this['_createTitleView']();return _0x417ef5['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x5f16ef=>_0x5f16ef)]},'children':[_0x4de76f,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5c3ec0=>!_0x5c3ec0)],'title':Es(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':Es(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']]}]}),_0x417ef5;}_createTitleView(){const _0x9863ce=new _0x56a514(this['locale']),_0x5373d4=new Dr();return _0x5373d4['bind']('isVisible')['to'](this,'isResultReady',_0x266e11=>!_0x266e11),_0x9863ce['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x1cf89e=>_0x1cf89e)]},'children':[_0x5373d4,{'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')}]}]}]}),_0x9863ce;}_createFinishReviewButtonView(){const _0x1eca77=new Ch(Es(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x1eca77['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x1ea5d2=>!_0x1ea5d2)]}}),_0x1eca77['delegate']('finishReview')['to'](this),_0x1eca77;}},bh=class extends jt{_resultsHeader;_finishReviewButtonView;constructor(_0x1c6b7f,_0x40a390){super(_0x1c6b7f),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x40a390['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x40a390['headerText']);const _0x412ca1=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x412ca1['if']('isVisible','ck-hidden',_0x10e766=>!_0x10e766)]},'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':_0x40a390['emptyResultsText']}]}]}]});}_createFinishReviewButtonView(_0x1b3075){const _0xf667e2=new Ch(_0x1b3075,this['locale']);return _0xf667e2['delegate']('finishReview')['to'](this),_0xf667e2;}_createResultHeaderView(_0x3302f4){const _0x3c2c3f=new _0x56a514(this['locale']);return _0x3c2c3f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x3302f4},'children':[{'text':_0x3302f4}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x3c2c3f;}},Sh=class extends _0x56a514{['_dropdownView'];_defaultValue;_defaultLabel;constructor(_0x4853ac,_0x71d70d){super(_0x4853ac),this['_defaultValue']=_0x71d70d['default']||(_0x71d70d['data']['length']>0x0?_0x71d70d['data'][0x0]['id']:''),this['_defaultLabel']=_0x71d70d['data']['find'](_0x26b4a1=>_0x26b4a1['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x48403c(this['locale']);const _0x49dfc1=this['_prepareListOptions'](_0x71d70d['data']);_0x40e721(this['_dropdownView'],_0x49dfc1,{'role':'menu','ariaLabel':_0x71d70d['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x13efc6=>{_0x13efc6['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x5dd753=>{this['formValue']=_0x5dd753['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x5dd753['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(_0x469510=[]){const _0x129787=new lt();this['resetToDefault']();for(const _0x532c8a of _0x469510){const _0x2772c6=new _0x28f92e({'label':_0x532c8a['label'],'withText':!0x0,'role':'menuitemradio','id':_0x532c8a['id'],'model':_0x532c8a});_0x2772c6['bind']('isOn')['to'](this,'formValue',_0x24db0f=>_0x24db0f===_0x2772c6['id']);const _0x24bab9={'type':'button','model':_0x2772c6};_0x129787['add'](_0x24bab9);}return _0x129787;}},Rh=class extends jt{_formItem=null;constructor(_0x4b34bd,_0x43d31d,_0xa02c31){if(super(_0x4b34bd),this['argsKey']=_0x43d31d?.['argsKey'],'dropdown'===_0x43d31d['formType'])this['_formItem']=new Sh(this['locale'],_0x43d31d);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x447b78=new Wt(this['locale'],{'children':[this['_formItem']],'class':[_0xa02c31?'ck-form__row_with-submit':'']});_0xa02c31&&_0x447b78['children']['add'](_0xa02c31),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x447b78]});}resetToDefault(){this['_formItem']['resetToDefault']();}},Oh=class AIReviewCorePromptInputView extends _0x324c99{keystrokes;static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0xa5e722){super(_0xa5e722),this['set']('isEmpty',!0x0),this['keystrokes']=new gt(),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']);}},vh=class extends _0x56a514{['focusTracker']=new _t();keystrokes=new gt();['focusCycler'];['_focusables']=new _0x93f04d();submitButtonView;cancelButtonView;promptInputView;actionsFooterView;_modelSelector;['_check'];constructor(_0x498718,_0xe45d19,_0x5e4f99=!0x1){super(_0x498718),this['_check']=_0xe45d19,this['set']('prompt',''),this['set']('modelId',''),this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new Qt(this['locale'],()=>new Oh(_0x498718)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelector']=new Io(_0x498718,{'panelPosition':'se','dropdownClass':'ck-ai_review__check-list-item-model-dropdown','nameClass':'ck-ai_review__check-list-item-model-name','itemClasses':{'name':'ck-ai_review__check-list-item-model-dropdown-name','description':'ck-ai_review__check-list-item-model-dropdown-description'}}),this['listenTo'](this['_modelSelector'],'selectModel',(_0x467697,_0x3b4c55)=>{this['modelId']=_0x3b4c55['id'],this['_modelSelector']['setSelectedModel'](_0x3b4c55);}),this['_setModelList'](_0x5e4f99),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new Wt(this['locale'],{'children':[this['promptInputView']]}),new Wt(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x111596,_0x318e89)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x318e89()):_0x318e89();}),this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),[this['promptInputView'],this['_modelSelector']['dropdownView'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0x3451c2=>{this['_focusables']['add'](_0x3451c2),this['focusTracker']['add'](_0x3451c2['element']);}),this['keystrokes']['listenTo'](this['element']);}resetToDefault(){this['prompt']='',this['modelId']=this['_check']['defaultModel']?.['id']??'',this['_check']['defaultModel']&&this['_modelSelector']['setSelectedModel'](this['_check']['defaultModel']),this['resetFormValidationStatus']();}resetFormValidationStatus(){this['promptInputView']['errorText']='';}['_isValid'](){this['resetFormValidationStatus']();for(const _0x19c2a2 of this['_getFormValidators']()){const _0xe7faae=_0x19c2a2();if(_0xe7faae)return this['promptInputView']['errorText']=_0xe7faae,!0x1;}return!0x0;}_getFormValidators(){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return Es(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}_createSubmitButtonView(){const _0x3727c9=new Mt(this['locale']),t=this['locale']['t'];return _0x3727c9['set']({'label':t('Submit'),'withText':!0x0,'class':Ln}),_0x3727c9['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x3727c9;}_createCancelButtonView(){const _0x8040ca=new Mt(this['locale']),t=this['locale']['t'];return _0x8040ca['set']({'label':t('Cancel'),'withText':!0x0,'class':Dn}),_0x8040ca['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x820065=>{_0x820065['stopPropagation']();})}}),_0x8040ca['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x8040ca;}_setModelList(_0x4b09dc){this['_modelSelector']['setModels'](this['_check']['models'],!_0x4b09dc),this['resetToDefault']();}_createActionsFooterView(){const _0x5a6980=new _0x56a514(this['locale']);return _0x5a6980['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions-footer']},'children':[this['_modelSelector'],{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-custom-actions-buttons']},'children':[this['cancelButtonView'],this['submitButtonView']]}]}),_0x5a6980;}},kh=class extends jt{_formItemsCollection=new _0x93f04d();_customCheckView=null;['_hideModels']=!0x1;constructor(_0x20c85c,_0x37dc6d,_0x3111d0,_0x39dc46=!0x1){super(_0x20c85c),this['_hideModels']=_0x39dc46,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x37dc6d['isParameterized']);const _0x3f6c80=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',_0x18e0d6=>_0x18e0d6),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x439ec3=>_0x439ec3)],'style':{'--ck-ai-review-check-list-item-index':_0x3111d0}},'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':_0x37dc6d['title']}]},_0x3f6c80]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x37dc6d['description']?[{'text':_0x37dc6d['description']}]:[]}]}]},..._0x37dc6d['isParameterized']?[this['_createParameterizedView'](_0x37dc6d)]:[],...'custom'===_0x37dc6d['id']?[this['_createCustomView'](_0x37dc6d,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x37dc6d['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x37dc6d['id'],'args':_0x37dc6d['useArgs']?_0x37dc6d['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0x44d1a9({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}resetToDefault(){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x2f902c=>{_0x2f902c['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}_createIconView(){const _0x9e129f=new $t();return _0x9e129f['content']=_0x2fee64,_0x9e129f['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x9e129f;}_createParameterizedView(_0x29cca5){const _0x56bc9b=new _0x56a514(),_0x4ed031=this['_createFormView'](_0x29cca5);return _0x56bc9b['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x3eb7b0=>!_0x3eb7b0)]},'children':[_0x4ed031]}),_0x56bc9b;}_createFormView(_0x426214){const _0x1a530b=new _0x56a514(),_0x8dd717=Array['isArray'](_0x426214['options'])?_0x426214['options']:[],_0x2fa37e=new Mt(this['locale']),t=this['locale']['t'];_0x2fa37e['set']({'label':t('Submit'),'withText':!0x0,'class':Ln}),_0x2fa37e['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x4d3992=>{_0x4d3992['stopPropagation']();})}}),_0x2fa37e['on']('execute',()=>{const _0x2a5d63=[],_0x1d6919={};this['_formItemsCollection']['forEach'](_0x4c3e8c=>{_0x2a5d63['push'](_0x4c3e8c['value']),_0x426214['useArgs']&&_0x426214['options']&&(_0x1d6919[_0x4c3e8c['argsKey']]=_0x4c3e8c['value']);}),this['fire']('runReviewCheck',{'id':_0x426214['id'],'params':_0x2a5d63['length']?_0x2a5d63:void 0x0,'args':Object['keys'](_0x1d6919)['length']?_0x1d6919:void 0x0});});const _0xfdf8f1=_0x8dd717['length'];return _0x8dd717['forEach']((_0x26fdb5,_0x5b1539)=>{const _0x1e8466=_0x5b1539===_0xfdf8f1-0x1;this['_formItemsCollection']['add'](new Rh(this['locale'],_0x26fdb5,_0x1e8466?_0x2fa37e:null));}),_0x1a530b['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x1a530b;}_createCustomView(_0x338f93,_0x4be595=!0x1){return this['_customCheckView']=new vh(this['locale'],_0x338f93,_0x4be595),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',_0x2e5ec7=>!_0x2e5ec7)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x12e5fc,_0x3d53e2,_0x2b9a95)=>{_0x2b9a95||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},yh=class extends jt{['_checkViews'];constructor(_0x3119cf){super(_0x3119cf),this['_checkViews']=new _0x93f04d(),this['_setupTemplate']();}setChecks(_0x5764c5,_0xe115fc=!0x1){this['_checkViews']['clear']();for(const [_0xe91387,_0x48c34a]of _0x5764c5['entries']()){const _0x166078=new kh(this['locale'],_0x48c34a,_0xe91387,_0xe115fc);_0x166078['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x166078);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}resetAllParameterizedChecks(){for(const _0x1022af of this['_checkViews'])_0x1022af instanceof kh&&_0x1022af['resetToDefault']();}_setupTemplate(){const _0x56f363=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x56f363['if']('isVisible','ck-hidden',_0x288e6f=>!_0x288e6f)]},'children':this['_checkViews']});}},Nh=class extends mh{static get['pluginName'](){return'AIReviewModeUI';}createMainView(){const _0x2db8f6=this['context']['plugins']['get']('AITabs'),_0x182e8b=this['context']['locale'],_0x1facdf=new ua(_0x182e8b,{'label':Es(_0x182e8b,'AI_REVIEW_MODE'),'icon':_0x510915,'class':'ck-ai-header_review','showResizeButton':_0x2db8f6['showResizeButton']});return _0x1facdf['delegate']('resizeTabs')['to'](_0x2db8f6),_0x1facdf['bind']('isMaximized')['to'](_0x2db8f6['view'],'isMaximized',_0x33f97c=>_0x33f97c),new wh(this['context']['locale'],{'header':_0x1facdf,'list':new yh(_0x182e8b),'results':new fh(_0x182e8b,{'generalErrorText':Es(_0x182e8b,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new bh(_0x182e8b,{'headerText':Es(_0x182e8b,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Es(_0x182e8b,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Es(_0x182e8b,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}registerTab(){const _0x2fd9d5=this['context']['plugins']['get']('AITabs');_0x2fd9d5['view']['on']('activateTab',(_0x59ccb7,{newTab:_0x45d745,oldTab:_0x5ee703})=>{'reviewMode'===_0x45d745?this['fire']('getReviewCheckList'):'reviewMode'===_0x5ee703&&this['fire']('leaveReview');}),_0x2fd9d5['view']['addTab']({'id':'reviewMode','buttonLabel':Es(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x510915,'order':0x0,'content':this['_mainView']});}},xh=class extends Sn{_affectedBlocks=[];get affectedBlocks(){return this['_affectedBlocks']['slice']();}set affectedBlocks(_0x1904f6){this['_affectedBlocks']=_0x1904f6;}};const Lh='review-',Ph=['softBreak'],Dh=['htmlScript','htmlStyle','htmlCustomElement'];var Hh=class extends _0x898608{static get requires(){return[_0x45dea0,tn];}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();_inlineRootDataIds=new WeakMap();constructor(_0x295ffd){super(_0x295ffd),this['_domEmitter']=new(ut())(),this['_eventEmitter']=new(dt())();}get emitter(){return this['_eventEmitter'];}afterInit(){const _0x1e28c3=_0x5b6197=>this['_scheduleAttachReviewEditingToEditor'](_0x5b6197);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x24cd6f)return void _0x1e28c3(this['context']);const _0x36aa6c=this['context'];for(const _0x451029 of _0x36aa6c['editors'])_0x1e28c3(_0x451029);this['listenTo'](_0x36aa6c['editors'],'add',(_0x36e063,_0x1e94a0)=>{_0x1e28c3(_0x1e94a0);}),this['listenTo'](_0x36aa6c['editors'],'remove',(_0x26d1b6,_0x17bb7b)=>{for(const [_0x52a60b,_0x1a0716]of this['_markers'])_0x1a0716['editor']===_0x17bb7b&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x52a60b,'changeId':_0x1a0716['groupId']}),this['_markers']['delete'](_0x52a60b));});}_scheduleAttachReviewEditingToEditor(_0x1176b7){const _0x250851=()=>{'destroyed'!==_0x1176b7['state']&&_0x1176b7['conversion']&&this['_attachReviewEditingToEditor'](_0x1176b7);};if('ready'===_0x1176b7['state'])return void _0x250851();const _0x56b2fa=()=>{this['stopListening'](_0x1176b7,'ready',_0x56b2fa),_0x250851();};this['listenTo'](_0x1176b7,'ready',_0x56b2fa);}_attachReviewEditingToEditor(_0x3d468b){this['_reviewEditingAttachedEditors']['has'](_0x3d468b)||(_0x3d468b['conversion']['for']('editingDowncast')['markerToElement']({'model':Lh+'insert','view':(_0x5b5e54,{writer:_0x249de6})=>{const _0x18a721=this['_markers']['get'](_0x5b5e54['markerName']),_0xe4ee6e={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x18a721?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x5b5e54['markerName']};return _0x249de6['createUIElement']('span',_0xe4ee6e,function(_0x4a6d31){const _0x3c62ac=this['toDomElement'](_0x4a6d31);return _0x3c62ac['innerHTML']=_0x18a721?.['content']?.['asString']||'',_0x3c62ac;});}}),_0x3d468b['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-only','view':_0xea6103=>{const _0x56837b=this['_markers']['get'](_0xea6103['markerName']),_0x1542ac=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x56837b?.['id']||'')&&_0x1542ac['push']('ck-ai_review__change_active'),{'classes':_0x1542ac,'attributes':{'data-marker-id':_0xea6103['markerName']}};}}),_0x3d468b['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-context','view':_0x144cc7=>{const _0x41fe36=this['_markers']['get'](_0x144cc7['markerName']),_0xa19c2f=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x41fe36?.['id']||'')&&_0xa19c2f['push']('ck-ai_review__change_active'),{'classes':_0xa19c2f,'attributes':{'data-marker-id':_0x144cc7['markerName']}};}}),_0x3d468b['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-text','view':_0x3d39b9=>{const _0x58830e=this['_markers']['get'](_0x3d39b9['markerName']),_0x23dd86=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x58830e?.['id']||'')&&_0x23dd86['push']('ck-ai_review__change_active'),{'classes':_0x23dd86,'attributes':{'data-marker-id':_0x3d39b9['markerName']}};}}),_0x3d468b['conversion']['for']('dataDowncast')['markerToElement']({'model':Lh+'suggestion-context','view':(_0x1b64e1,{writer:_0x39a022})=>_0x39a022['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x1b64e1['isOpening']?'start':'end')})}),_0x3d468b['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x4fabc2,'view':_0x322962}),this['_updateMouseMarkerInteractionListeners'](_0x3d468b),this['listenTo'](_0x3d468b,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x3d468b),{'priority':'lowest'}),this['listenTo'](_0x3d468b,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x3d468b),{'priority':'lowest'}),_0x3d468b['model']['document']['registerPostFixer'](_0x4853a6=>this['_validateMarkers'](_0x3d468b,_0x4853a6)),_0x3d468b['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x3d468b)),this['_reviewEditingAttachedEditors']['add'](_0x3d468b));}_updateMouseMarkerInteractionListeners(_0x141573){let _0x5d14b5=this['_boundEditables']['get'](_0x141573);_0x5d14b5||(_0x5d14b5=new Map(),this['_boundEditables']['set'](_0x141573,_0x5d14b5));const _0x13da6f=new Set(_0x141573['ui']['getEditableElementsNames']());for(const _0x24bb7c of _0x13da6f){if(_0x5d14b5['has'](_0x24bb7c))continue;const _0xdcee18=_0x141573['ui']['getEditableElement'](_0x24bb7c);_0x5d14b5['set'](_0x24bb7c,_0xdcee18),this['_attachMouseMarkerInteractionListeners'](_0xdcee18);}for(const [_0x16f8fe,_0x3f8f95]of _0x5d14b5)_0x13da6f['has'](_0x16f8fe)||(_0x5d14b5['delete'](_0x16f8fe),this['_domEmitter']['stopListening'](_0x3f8f95));}_attachMouseMarkerInteractionListeners(_0x2dd0ac){this['_domEmitter']['listenTo'](_0x2dd0ac,'mouseup',(_0x117801,_0x23bcf3)=>{const _0x1d4b5c=_0x23bcf3['target'],_0x5db2ee=this['_findMarkerElement'](_0x1d4b5c);if(!_0x5db2ee)return;const _0xc055fd=_0x5db2ee['getAttribute']('data-marker-id'),_0xbfaab6=_0xc055fd['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0xc055fd,'changeId':_0xbfaab6,'markerElement':()=>this['_findMarkerElementById'](_0xc055fd),'domEvent':_0x23bcf3});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x2dd0ac,'mouseover',(_0x316f80,_0x598950)=>{const _0x2f5c01=_0x598950['target'],_0x20101f=_0x598950['relatedTarget'];let _0x1f7f82=this['_findMarkerElement'](_0x2f5c01);if(!_0x1f7f82&&_0x20101f&&(_0x1f7f82=this['_findMarkerElement'](_0x20101f)),!_0x1f7f82)return;const _0x3fbaa0=_0x1f7f82['getAttribute']('data-marker-id'),_0x4a957b=_0x3fbaa0['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x4a957b,'markerElement':()=>this['_findMarkerElementById'](_0x3fbaa0),'domEvent':_0x598950});});}_registerGlobalBalloonBlurHandler(){this['_domEmitter']['listenTo'](document,'mouseover',_0x5f51ae((_0x3f248a,_0x3402d4)=>{const _0x1244ab=_0x3402d4['target'];this['_findMarkerElement'](_0x1244ab)||_0x1244ab['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}getDocumentData(_0x414296){const _0x514e10=this['context']['plugins']['get']('AIEditing'),_0x2d1699=bs(this['context']);if(!_0x2d1699['length'])throw new ct('ai-get-editor-from-context-no-editor',this);const _0x25ca58=_0x414296?.['roots'];if(_0x25ca58&&0x0===_0x25ca58['length'])throw new ct('ai-reviewcoreediting-empty-roots',this);const _0x2be759=_0x25ca58?new Set(_0x25ca58['map'](_0x4f54c8=>_0x4f54c8['channelId']+'\x00'+_0x4f54c8['rootName'])):null,_0x1ed305=_0x2be759?new Set():null,_0x5b4a41=new Set(),_0xd52994=[],_0x4226d7=new Map(),_0x3bbc47=[];for(const _0x123d89 of _0x2d1699){const _0x176383=_0x123d89['config']['get']('collaboration.channelId');for(const _0x213a8b of _0x123d89['model']['document']['getRoots']()){const _0x39d0db=_0x176383+'\x00'+_0x213a8b['rootName'];if(_0x2be759&&!_0x2be759['has'](_0x39d0db))continue;const _0x396847=this['_buildDocumentDataSliceForRoot'](_0x123d89,_0x213a8b,_0x514e10,_0x5b4a41);_0xd52994['push'](_0x396847['content']);for(const [_0x45a066,_0x2a9cff]of _0x396847['elements'])_0x4226d7['set'](_0x45a066,_0x2a9cff);_0x3bbc47['push']({'channelId':_0x176383,'rootName':_0x213a8b['rootName']}),_0x1ed305?.['add'](_0x39d0db);}}if(_0x25ca58&&_0x1ed305['size']!==_0x2be759['size']){const _0x17e796=_0x25ca58['find'](_0xb53c1a=>!_0x1ed305['has'](_0xb53c1a['channelId']+'\x00'+_0xb53c1a['rootName']));throw new ct('ai-reviewcoreediting-root-not-found',this,{'channelId':_0x17e796['channelId'],'rootName':_0x17e796['rootName']});}return{'elements':_0x4226d7,'content':_0xd52994['join'](''),'roots':_0x3bbc47};}async['runCheck'](_0x49d059,_0x5e66c5){const _0x6f9778=new On(),_0x121ab2=_0x5e66c5?.['signal'];let _0x249edc;const _0x13ad4b=()=>{_0x6f9778['abort'](),_0x49d059['abort']();};if(_0x121ab2){if(_0x121ab2['aborted'])return _0x13ad4b(),_0x6f9778;_0x121ab2['addEventListener']('abort',_0x13ad4b),_0x249edc=()=>_0x121ab2['removeEventListener']('abort',_0x13ad4b);}const _0x5e84a0={'apiId':_0x49d059['sourceCheck']['apiId']};try{_0x49d059['on']('reviewCheckRunUpdated',(_0x9451aa,_0x22081a)=>{'aborted'===_0x22081a['status']?_0x6f9778['abort']():'error-general'!==_0x22081a['status']&&'error-chunk'!==_0x22081a['status']||(_0x6f9778['error']=bn(_0x22081a['error'],'ai-reviewcoreediting-check-run-failed',this,_0x5e84a0));}),'aborted'!==_0x6f9778['status']&&await _0x49d059['start']();}catch(_0x31ec41){_0x6f9778['error']=bn(_0x31ec41,'ai-reviewcoreediting-check-run-failed',this,_0x5e84a0);}finally{_0x249edc&&_0x249edc();}return'error'===_0x6f9778['status']||'aborted'===_0x6f9778['status']||(_0x6f9778['addResult'](...this['_buildPerRootResults'](_0x49d059)),_0x6f9778['status']='completed'),_0x6f9778;}buildErrorContext(_0x12e799){return{'apiId':_0x12e799['sourceCheck']['apiId']};}_buildPerRootResults(_0x14e9e5){const _0x3ee6ce=this['buildErrorContext'](_0x14e9e5),_0x4bbba0=this['context']['plugins']['get']('AIEditing'),_0x334b3c=this['context']['plugins']['get']('AIGateway'),_0x4bfc36=this['_groupElementsByRoot'](_0x14e9e5['documentData']['elements']),_0xff9701=new Map();for(const _0x239f2a of bs(this['context']))_0xff9701['set'](_0x239f2a['config']['get']('collaboration.channelId'),_0x239f2a);return _0x14e9e5['documentData']['roots']['map'](({channelId:_0xa4a52c,rootName:_0x3438e0})=>{const _0x3b10b5=_0xff9701['get'](_0xa4a52c),_0xd255f0=new xh({'editor':_0x3b10b5,'rootName':_0x3438e0,'channelId':_0xa4a52c,'sessionId':_0x4bbba0['getSessionId'](_0x3b10b5)}),_0xd3bbf9=_0x4bfc36['get'](_0xd255f0['editor'])?.['get'](_0xd255f0['rootName'])??[];_0xd255f0['contentRawOld']=_0xd3bbf9['map'](_0x2853c7=>_0x2853c7['getContent']())['join'](''),_0xd255f0['documentVersion']=_0xd3bbf9[0x0]?.['documentVersion']??0x1;const _0x2ab101=this['_collectResultAffectedBlocks'](_0xd255f0,_0x14e9e5['results'],_0x14e9e5['documentData']['elements']);_0xd255f0['affectedBlocks']=_0x2ab101;try{_0xd255f0['contentRawNew']=Os(_0x334b3c['mergeChangesIntoContent'](_0x2ab101,_0xd255f0['contentRawOld'],_0xd255f0['editor']));}catch(_0x59fed0){_0xd255f0['error']=bn(_0x59fed0,'ai-reviewcoreediting-check-run-failed',this,_0x3ee6ce);}return _0xd255f0;});}_collectResultAffectedBlocks(_0x5cd49a,_0x1ab86c,_0x4238ca){return _0x1ab86c['filter'](_0x175565=>{const _0x25eb30=_0x4238ca['get'](_0x175565['id']);return!!_0x25eb30&&_0x25eb30['editor']===_0x5cd49a['editor']&&_0x25eb30['rootName']===_0x5cd49a['rootName'];})['map'](_0x5baf72=>({'id':_0x5baf72['id'],'content':_0x5baf72['contentNew']}));}_groupElementsByRoot(_0xae9f93){const _0x323408=new Map();for(const _0x410f99 of _0xae9f93['values']()){let _0x23d53c=_0x323408['get'](_0x410f99['editor']);_0x23d53c||(_0x23d53c=new Map(),_0x323408['set'](_0x410f99['editor'],_0x23d53c));let _0x17ef5d=_0x23d53c['get'](_0x410f99['rootName']);_0x17ef5d||(_0x17ef5d=[],_0x23d53c['set'](_0x410f99['rootName'],_0x17ef5d)),_0x17ef5d['push'](_0x410f99);}return _0x323408;}_buildDocumentDataSliceForRoot(_0x558944,_0x1e8299,_0x46deb6,_0x2f7469){const _0x5f47d1=_0x558944['model'],_0x2fab6f=new _0x28e306();for(const _0xafbc4c of _0x1e8299['getChildren']())_0x2fab6f['_appendChild'](_0xafbc4c['_clone'](!0x0));for(const _0x17394c of _0x5f47d1['markers']){const _0x6236aa=_0x17394c['getRange']();_0x6236aa&&_0x6236aa['root']['rootName']===_0x1e8299['rootName']&&_0x2fab6f['markers']['set'](_0x17394c['name'],this['_changeRangeOwnerDocument'](_0x6236aa['clone'](),_0x2fab6f));}const _0x3d046f=new Map(),_0x53d088=_0x5f47d1['document']['version'];if(Gs(_0x558944,_0x1e8299['rootName'])){let _0x4acb8b=this['_inlineRootDataIds']['get'](_0x1e8299);_0x4acb8b?_0x2f7469['add'](_0x4acb8b):(_0x4acb8b=_0x46deb6['_nextDataId'](_0x2f7469),this['_inlineRootDataIds']['set'](_0x1e8299,_0x4acb8b));const _0x36b874=Fs(_0x558944['data']['processor']['toData'](_0x558944['data']['toView'](_0x2fab6f)),_0x4acb8b);return _0x3d046f['set'](_0x4acb8b,{'editor':_0x558944,'rootName':_0x1e8299['rootName'],'path':[],'documentVersion':_0x53d088,'getContent':()=>_0x36b874}),{'content':_0x36b874,'elements':_0x3d046f};}const _0x3d9ea1=new _0x28cad7({'ignoreElementEnd':!0x0,'startPosition':_0x5f47d1['createPositionAt'](_0x2fab6f,0x0)});for(const {item:_0x2ab3bf}of _0x3d9ea1){if(_0x2ab3bf['is']('element')&&_0x2ab3bf['name']&&Dh['includes'](_0x2ab3bf['name'])){const _0x562cb5=this['_upsertDataId'](_0x2ab3bf,()=>_0x46deb6['_nextDataId'](_0x2f7469));_0x2f7469['add'](_0x562cb5);}if(!_0x2ab3bf['is']('$textProxy'))continue;const _0x2c8cfd=_0x2ab3bf['parent'];if(!_0x2c8cfd||!_0x2c8cfd['is']('element'))continue;const _0x4d0064=this['_upsertDataId'](_0x2c8cfd,()=>_0x46deb6['_nextDataId'](_0x2f7469));_0x2f7469['add'](_0x4d0064);for(const _0x47a4a5 of _0x2c8cfd['getChildren']())_0x47a4a5['is']('element')&&(_0x47a4a5['name']&&Ph['includes'](_0x47a4a5['name'])||_0x2f7469['add'](this['_upsertDataId'](_0x47a4a5,()=>_0x46deb6['_nextDataId'](_0x2f7469))));let _0x42e545=_0x2c8cfd;for(;_0x42e545['parent']&&!_0x42e545['parent']['is']('documentFragment');)_0x42e545=_0x42e545['parent'],_0x42e545['hasAttribute'](_0x4fabc2)&&_0x42e545['_removeAttribute'](_0x4fabc2);_0x3d046f['set'](_0x4d0064,{'editor':_0x558944,'rootName':_0x1e8299['rootName'],'path':_0x2c8cfd['getPath'](),'documentVersion':_0x53d088,'getContent':this['_createGetContentUsingDataIdFn'](_0x42e545['_clone'](!0x0),_0x4d0064,_0x558944['data'])}),_0x3d9ea1['jumpTo'](_0x5f47d1['createPositionAfter'](_0x2c8cfd));}return{'content':_0x558944['data']['processor']['toData'](_0x558944['data']['toView'](_0x2fab6f)),'elements':_0x3d046f};}diffContent(_0x1d5d92,_0x3f4647,_0x37f8cf,_0x52b6c2=!0x1){const {contentInitial:_0x5442b1,contentNew:_0x310764}=this['_neutralizeChangesOnUnsupportedElements'](_0x3f4647,_0x37f8cf),_0x30806d=[],_0x3a98b3=_0x1d5d92['data']['parse'](_0x310764,'$documentFragment'),_0x135d85=_0x1d5d92['data']['parse'](_0x5442b1,'$documentFragment'),_0x54fcd2=_0x1d5d92['model']['createPositionAt'](_0x135d85,0x0);if(this['_haveSingleTopLevelElement'](_0x3a98b3)){if(!this['_hasSameTopLevelElement'](_0x135d85,_0x3a98b3))return _0x30806d;}else{const _0x5ab81d=_0x1d5d92['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x135d85,_0x5ab81d)||!this['_haveOnlyInlineContent'](_0x3a98b3,_0x5ab81d))return _0x30806d;}const _0x148106=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x5442b1,_0x310764,{'targetEditor':_0x1d5d92,'anchor':_0x54fcd2,'markDeletions':!0x0})['getOperations']()['filter'](_0x410acd=>'insert'===_0x410acd['type']||'marker'===_0x410acd['type']&&_0x410acd['name']['startsWith']('$markedRemove')),_0x3bea8b=this['_groupAdjacentOperations'](_0x148106),_0x39f03e=[];if(_0x52b6c2){if(_0x3bea8b['length']){const _0x4c15a9=_0x3bea8b[0x0]['operations'][0x0],_0xacea27='insert'===_0x4c15a9['type']?_0x4c15a9['position']:_0x4c15a9['newRange']['start'],_0x3ae813=this['_getPositionLimitingRange'](_0xacea27,_0x1d5d92,'inside'),_0x3238b2=_0x3ae813?_0x3a98b3['getChild'](0x0)['getChildren']():_0x3a98b3['getChildren'](),_0x1ffbbb=_0x3ae813||_0x1d5d92['model']['createRangeIn'](_0x135d85),_0x6414b2=[new _0x5bbb57('$markedRemove:synthetic'+kt(),null,_0x1ffbbb,_0x1d5d92['model']['document']['model']['markers'],!0x0,_0x1d5d92['model']['document']['version']+0x1),new _0x52fe51(_0x1ffbbb['end'],_0x3238b2,_0x1d5d92['model']['document']['version']+0x2)];_0x39f03e['push']({'operations':_0x6414b2,'operationsIsolated':_0x6414b2,'groupOffset':0x0});}}else _0x39f03e['push'](..._0x3bea8b);let _0x2a58f4=0x0;return _0x1d5d92['model']['change'](_0x54e7e1=>{for(let _0x3ebb29=0x0;_0x3ebb29<_0x39f03e['length'];_0x3ebb29++){const _0x2ff100=_0x39f03e[_0x3ebb29],_0xcf0337=_0x54e7e1['createDocumentFragment']();for(const _0x5e3530 of _0x135d85['getChildren']())_0x54e7e1['append'](_0x5e3530['_clone'](!0x0),_0xcf0337);for(const _0x4c067b of _0x2ff100['operationsIsolated'])if('insert'===_0x4c067b['type']){const _0x4e793c=_0x4c067b;_0x4e793c['baseVersion']=null,_0x4e793c['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x4e793c,_0xcf0337),_0x54e7e1['batch']['addOperation'](_0x4c067b),_0x1d5d92['model']['applyOperation'](_0x4c067b);const _0x559b66='suggestion:insertion:id:authorId:'+_0x2a58f4++,_0x13108a=_0x1d5d92['model']['createRange'](_0x4e793c['position'],_0x4e793c['position']['getShiftedBy'](_0x4e793c['howMany']));_0xcf0337['markers']['set'](_0x559b66,_0x13108a);}else{if('marker'===_0x4c067b['type']&&_0x4c067b['name']['startsWith']('$markedRemove')){const _0x11ba22=_0x4c067b,_0x317f81='suggestion:deletion:id:authorId:'+_0x2a58f4++;this['_changeOperationOwnerDocument'](_0x11ba22,_0xcf0337),_0xcf0337['markers']['set'](_0x317f81,_0x11ba22['newRange']);}}if(_0x52b6c2)_0x30806d['push']({..._0x2ff100,'context':this['_createGetContentFn'](_0x135d85,_0x1d5d92['data']),'content':this['_createGetContentFn'](_0x135d85,_0x1d5d92['data'])});else{const _0x1c7af1=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x2ff100['operationsIsolated'][0x0]),_0xcf0337),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x2ff100['operationsIsolated'][_0x2ff100['operationsIsolated']['length']-0x1]),_0xcf0337),_0x1d5d92);_0xcf0337['markers']['set'](Lh+'suggestion-context',new _0x2827cc(_0x1c7af1['start'],_0x1c7af1['end'])),_0x30806d['push']({..._0x2ff100,'context':this['_createGetContextFn'](_0xcf0337,_0x1d5d92['data'],{'ellipsisBefore':_0x1c7af1['hasContentBefore'],'ellipsisAfter':_0x1c7af1['hasContentAfter']}),'content':this['_createGetContentFn'](_0xcf0337,_0x1d5d92['data'])});}}}),_0x30806d;}markChangePositionInEditorContent(_0x5c8096,_0x183b06){if(!_0x5c8096['length'])return;const _0x27d38f=_0x5c8096[0x0]['parent']['id'],_0x1dcf00=_0x183b06['elements']['get'](_0x27d38f);if(!_0x1dcf00)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x27d38f);const _0x545a3f=_0x1dcf00['path'],_0x2f5c3=_0x1dcf00['editor'],_0x152bf6=_0x2f5c3['model']['document']['getRoot'](_0x1dcf00['rootName']);if(!_0x152bf6)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x1dcf00['rootName']);const _0x1cedd3=_0x2f5c3['model']['document']['history']['getOperations'](_0x1dcf00['documentVersion']),_0x1b5e1a=[];for(const _0x39df91 of _0x5c8096){const _0x4c04f5=_0x39df91['operationsIsolated']['map'](_0x4d3450=>this['_translateOperationToEditorContent'](_0x4d3450,_0x545a3f,_0x152bf6));if(!_0x4c04f5||!_0x4c04f5['length'])continue;const _0x1ea0f7=_0x4c04f5['every'](_0x29bfb6=>'marker'===_0x29bfb6['type']&&_0x29bfb6['name']['startsWith']('$markedRemove')),_0x855527=_0x5dec67(_0x4c04f5,_0x1cedd3,{'document':_0x2f5c3['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0x3971d8 of _0x855527)if('insert'===_0x3971d8['type']){const _0xb02df=_0x3971d8,_0x5d1c1c=_0xb02df['nodes'];_0x2f5c3['model']['change'](_0x1db63c=>{const _0x3ece7a=_0x1db63c['createDocumentFragment']();for(const _0x11cd0e of _0x5d1c1c)_0x1db63c['append'](_0x11cd0e['_clone'](!0x0),_0x3ece7a);_0x1b5e1a['push']({'start':_0xb02df['position'],'end':_0xb02df['position'],'type':'insert','groupId':_0x39df91['id'],'content':{'asString':this['_createGetContentFn'](_0x3ece7a,_0x2f5c3['data'])(),'asFragment':_0x3ece7a}});});}else{if('marker'===_0x3971d8['type']&&_0x3971d8['name']['startsWith']('$markedRemove')){const _0x3ea4b8=_0x3971d8;let _0x58b3df='remove-text';if(_0x1ea0f7){const _0x10b2c4=this['_findAdjacentContextDistance'](_0x3ea4b8['newRange']['start'],'backward',_0x2f5c3['model']['schema']),_0xdfa102=this['_findAdjacentContextDistance'](_0x3ea4b8['newRange']['end'],'forward',_0x2f5c3['model']['schema']);if(_0x10b2c4||_0xdfa102){const _0x338368=_0x3ea4b8['newRange']['start']['getShiftedBy'](-_0x10b2c4),_0x1496e4=_0x3ea4b8['newRange']['end']['getShiftedBy'](_0xdfa102);_0x1b5e1a['push']({'start':_0x338368,'end':_0x1496e4,'groupId':_0x39df91['id'],'type':'remove-context'});}else _0x58b3df='remove-only';}_0x1b5e1a['push']({'start':_0x3ea4b8['newRange']['start'],'end':_0x3ea4b8['newRange']['end'],'groupId':_0x39df91['id'],'type':_0x58b3df});}}}this['_insertMarkers'](_0x1b5e1a,_0x2f5c3);}['clearAllMarkers'](){const _0x4bfd74=new Map();for(const _0x2edffc of this['_markers']['keys']()){const _0x16f5d8=this['_markers']['get'](_0x2edffc);_0x16f5d8?.['editor']&&(_0x4bfd74['has'](_0x16f5d8['editor'])||_0x4bfd74['set'](_0x16f5d8['editor'],[]),_0x4bfd74['get'](_0x16f5d8['editor'])['push'](_0x2edffc));}for(const [_0x23a71e,_0x9b9e18]of _0x4bfd74)_0x23a71e['model']['change'](_0x33f003=>{for(const _0x264643 of _0x9b9e18)_0x23a71e['model']['markers']['get'](_0x264643)&&_0x33f003['removeMarker'](_0x264643);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}switchToReadOnly(){for(const _0x42ff8d of this['getEditors']())_0x42ff8d['enableReadOnlyMode']('ai-review');}switchToEdit(){for(const _0x2895a5 of this['getEditors']())_0x2895a5['disableReadOnlyMode']('ai-review');}['applyChange'](_0xac6d78,_0x3f2e5a=null){const _0xe73413=_0xac6d78['map'](_0x429aed=>this['_getMarkersDataForGroup'](_0x429aed))['flat'](),_0x1cb81e=new Map();for(const _0x540230 of _0xe73413)_0x1cb81e['has'](_0x540230['editor'])||_0x1cb81e['set'](_0x540230['editor'],[]),_0x1cb81e['get'](_0x540230['editor'])['push'](_0x540230);for(const [_0x45c821,_0x2980b9]of _0x1cb81e){const _0x52eecd=_0x45c821['model'],_0x44b43e=_0x45c821['plugins']['has']('TrackChangesEditing')?_0x45c821['plugins']['get']('TrackChangesEditing'):null,_0x550835=_0x3f2e5a&&_0x44b43e?new Set(_0x44b43e['getSuggestions']()['map'](_0x1344fb=>_0x1344fb['id'])):null;_0x52eecd['change'](_0x20fbb7=>{const _0x1b309f=_0x20fbb7['batch']['operations']['length'];for(const _0x3d1226 of _0x2980b9){const _0x30ccb3=_0x45c821['model']['markers']['get'](_0x3d1226['id']);if(_0x30ccb3){if('insert'===_0x3d1226['type']){if(!_0x3d1226['content'])continue;_0x52eecd['insertContent'](_0x3d1226['content']['asFragment']||null,_0x30ccb3['getRange']()['start']);}else'remove-text'!==_0x3d1226['type']&&'remove-only'!==_0x3d1226['type']||_0x52eecd['deleteContent'](_0x52eecd['createSelection'](_0x30ccb3['getRange']()));_0x20fbb7['removeMarker'](_0x3d1226['id']),this['_markers']['delete'](_0x3d1226['id']);}}if(_0x3f2e5a&&(mn(_0x20fbb7['batch']['operations']['slice'](_0x1b309f),_0x3f2e5a),_0x44b43e)){for(const _0x362eba of _0x44b43e['getSuggestions']())_0x550835['has'](_0x362eba['id'])||_0x362eba['setAttribute']('@ai',{'type':_0x3f2e5a});}});}}rejectChange(_0x5dd2fc){const _0x8925b4=this['_getMarkersDataForGroup'](_0x5dd2fc),_0x3a9a4f=new Map();for(const _0x2712ca of _0x8925b4)_0x3a9a4f['has'](_0x2712ca['editor'])||_0x3a9a4f['set'](_0x2712ca['editor'],[]),_0x3a9a4f['get'](_0x2712ca['editor'])['push'](_0x2712ca);for(const [_0x675db8,_0x3f9013]of _0x3a9a4f)_0x675db8['model']['change'](_0xe83c65=>{for(const _0x155af4 of _0x3f9013)_0xe83c65['removeMarker'](_0x155af4['id']),this['_markers']['delete'](_0x155af4['id']);});}getEditor(){return Ss(this['context']);}getEditors(){return bs(this['context']);}getEditorForChange(_0x24008a){return this['_getMarkersDataForGroup'](_0x24008a)[0x0]?.['editor'];}getMarkerElementForChange(_0x2d3ede){const _0x2fbc17=Array['from'](this['_markers']['values']())['filter'](_0x321da3=>_0x321da3['groupId']===_0x2d3ede);if(!_0x2fbc17['length'])return null;const _0x3423de=0x1===_0x2fbc17['length']?_0x2fbc17[0x0]:this['_sortMarkers'](_0x2fbc17)[0x0],_0x15ef64=_0x3423de['editor']['model']['markers']['get'](_0x3423de['id']);return _0x15ef64?{'modelRange':_0x15ef64['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x3423de['id'])}:null;}getContentElementForChange(_0x5c3693){const _0x334e8c=Array['from'](this['_markers']['values']())['filter'](_0xf929f8=>_0xf929f8['groupId']===_0x5c3693);if(!_0x334e8c['length'])return null;const _0x49a961=0x1===_0x334e8c['length']?_0x334e8c[0x0]:this['_sortMarkers'](_0x334e8c)[0x0],_0x2e11da=_0x49a961['editor'],_0x7619c2=_0x2e11da['model']['markers']['get'](_0x49a961['id']);if(!_0x7619c2)return null;const _0x142d0d=_0x7619c2['getRange'](),_0x4c12f5=_0x2e11da['editing']['view']['getDomRoot'](_0x142d0d['root']['rootName'])||_0x2e11da['editing']['view']['getDomRoot']();if(!_0x4c12f5||!_0x142d0d)return null;let _0x18e834=_0x142d0d['start']['parent'];for(;_0x18e834['parent']&&!_0x18e834['parent']['is']('rootElement');)_0x18e834=_0x18e834['parent'];if(!_0x18e834||!_0x18e834['name'])return null;const _0x5119f0=_0x4c12f5['querySelector']('[data-marker-id=\x22'+_0x49a961['id']+'\x22]');if(!_0x5119f0)return null;if(_0x18e834['is']('rootElement'))return _0x5119f0;let _0x2cd1f6=null;_0x2e11da['model']['change'](_0x532ae9=>{_0x2cd1f6=_0x532ae9['createDocumentFragment'](),_0x532ae9['append'](_0x18e834['_clone'](!0x0),_0x2cd1f6);});const _0x533a54=_0x2e11da['data']['toView'](_0x2cd1f6)['getChild'](0x0);return _0x5119f0['closest'](_0x533a54['name']);}reactivateMarkers(_0x17de9e){const _0x5783d7=this['_getMarkersDataForGroup'](_0x17de9e);if(!_0x5783d7['length'])return;const _0x6d53d1=Array['from'](this['_activeMarkers'])['sort'](),_0x45cb8e=Array['from'](new Set(_0x5783d7['map'](_0x4172d7=>_0x4172d7['id'])))['sort']();_0x6d53d1['join']('|')!==_0x45cb8e['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x17de9e));}setMarkersInElementAsActive(_0x19727e){const _0xcfd7a2=this['_getMarkersDataForGroup'](_0x19727e);if(!_0xcfd7a2['length'])return;const _0x1dd802=_0xcfd7a2[0x0]['editor'],_0x14223e=new Set(_0xcfd7a2['map'](_0x2fb314=>_0x2fb314['id'])),_0x9ae0e8=Array['from'](_0x14223e['values']())['map'](_0x59e4b1=>_0x1dd802['model']['markers']['get'](_0x59e4b1))['filter'](_0x4c0fb0=>!!_0x4c0fb0);_0x14223e['forEach'](_0x522832=>{this['_activeMarkers']['add'](_0x522832);}),_0x1dd802['model']['change'](()=>{_0x9ae0e8['forEach'](_0x2af4a4=>{_0x1dd802['editing']['reconvertMarker'](_0x2af4a4);});});}setAllMarkersAsInactive(){const _0x432c99=Array['from'](this['_activeMarkers']);if(!_0x432c99['length'])return;this['_activeMarkers']['clear']();const _0x334dd8=new Map();for(const _0x2d3930 of _0x432c99){const _0x17a0bd=this['_markers']['get'](_0x2d3930);if(!_0x17a0bd)continue;const _0x42c05a=_0x17a0bd['editor'],_0x4f0280=_0x42c05a['model']['markers']['get'](_0x2d3930);_0x4f0280&&(_0x334dd8['has'](_0x42c05a)||_0x334dd8['set'](_0x42c05a,[]),_0x334dd8['get'](_0x42c05a)['push'](_0x4f0280));}for(const [_0x7e4fe2,_0xbc25f9]of _0x334dd8)_0x7e4fe2['model']['change'](()=>{_0xbc25f9['forEach'](_0x45060a=>{_0x7e4fe2['editing']['reconvertMarker'](_0x45060a);});});}_getPositionLimitingRange(_0x48408f,_0x5a4369,_0x5611bf='outside'){if(!_0x48408f)return null;let _0x13b71f=_0x48408f['parent'];for(;_0x13b71f&&_0x13b71f['parent']&&!_0x13b71f['parent']['is']('rootElement')&&!_0x5a4369['model']['schema']['isLimit'](_0x13b71f)&&!_0x5a4369['model']['schema']['isBlock'](_0x13b71f);)_0x13b71f=_0x13b71f['parent'];if(!_0x13b71f||!_0x13b71f['name']||_0x13b71f['is']('rootElement'))return null;let _0x49ea63=null;return _0x5a4369['model']['change'](_0x2c1057=>{_0x49ea63='inside'===_0x5611bf?_0x2c1057['createRangeIn'](_0x13b71f):_0x2c1057['createRangeOn'](_0x13b71f);}),_0x49ea63;}_validateMarkers(_0x3a91ed,_0x462231){const _0x1cd737=Array['from'](this['_markers']['keys']()),_0x2a2fa9=new Map();for(const _0x29d976 of _0x1cd737){const _0x3a4aa2=_0x3a91ed['model']['markers']['get'](_0x29d976);if(!_0x3a4aa2)continue;const _0x17d422=_0x3a4aa2['getStart']()['root']['rootName']+':'+_0x3a4aa2['getStart']()['path'][0x0];_0x2a2fa9['has'](_0x17d422)||_0x2a2fa9['set'](_0x17d422,[]),_0x2a2fa9['get'](_0x17d422)['push'](_0x3a4aa2);}const _0x456e91=new Set();for(const _0x23ebaa of _0x3a91ed['model']['document']['differ']['getChanges']()){let _0x13b199,_0x3416a7;if('insert'===_0x23ebaa['type'])_0x3416a7=new _0x2827cc(_0x23ebaa['position'],_0x23ebaa['position']['getShiftedBy'](_0x23ebaa['length'])),_0x13b199=_0x23ebaa['position']['root']['rootName']+':'+_0x23ebaa['position']['path'][0x0];else{if('remove'!==_0x23ebaa['type'])continue;_0x3416a7=new _0x2827cc(_0x23ebaa['position']),_0x13b199=_0x23ebaa['position']['root']['rootName']+':'+_0x23ebaa['position']['path'][0x0];}const _0x4f41f9=_0x2a2fa9['get'](_0x13b199)||[];if(_0x4f41f9['length']){for(const _0xe828c4 of _0x4f41f9)if(_0x3416a7['root']['rootName']===_0xe828c4['getRange']()['root']['rootName']&&('insert'!==_0x23ebaa['type']||!_0x3416a7['containsRange'](_0xe828c4['getRange']()))&&(_0x3416a7['isIntersecting'](_0xe828c4['getRange']())||_0x3416a7['start']['isTouching'](_0xe828c4['getRange']()['end'])||_0x3416a7['end']['isTouching'](_0xe828c4['getRange']()['start']))){const _0xa833c3=this['_parseMarkerName'](_0xe828c4['name']);Array['from'](this['_markers']['values']())['filter'](_0x5898ea=>_0x5898ea['groupId']===_0xa833c3['groupId'])['forEach'](_0x29a483=>_0x456e91['add'](_0x29a483['id']));}}}if(_0x456e91['size']){for(const _0x5de87d of _0x456e91)_0x462231['removeMarker'](_0x5de87d);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0xe50ce5){for(const {name:_0x21ce95,data:_0x291be5}of _0xe50ce5['model']['document']['differ']['getChangedMarkers']()){if(!_0x21ce95['startsWith'](Lh))continue;const _0x21dce2=_0x291be5['oldRange'],_0x1e869b=_0x291be5['newRange'],_0x516d64=_0x21dce2&&'$graveyard'===_0x21dce2['root']['rootName'],_0x4a9127=_0x1e869b&&'$graveyard'===_0x1e869b['root']['rootName'];if(_0x516d64&&_0x4a9127)continue;const _0xa32d81=this['_parseMarkerName'](_0x21ce95);this['_markers']['get'](_0x21ce95)&&(_0x4a9127||!_0x1e869b?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x21ce95,'changeId':_0xa32d81['groupId']}):_0x516d64&&_0x1e869b&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x21ce95,'changeId':_0xa32d81['groupId']}));}}['_parseMarkerName'](_0x11a6fb){const _0x527999=_0x11a6fb['split'](':'),_0x45c9a1=(_0x527999[0x1]||'')['split']('_');return{'prefix':_0x527999[0x0],'groupId':_0x45c9a1[0x0],'suffix':_0x45c9a1[0x1]};}_translateOperationToEditorContent(_0x2a9caa,_0x1bd43e,_0x4019a5){if('insert'===_0x2a9caa['type']){const _0x1bd7c8=_0x2a9caa;return new _0x52fe51(this['_changePosition'](_0x1bd43e['concat'](_0x1bd7c8['position']['offset']),_0x4019a5),_0x1bd7c8['nodes'],_0x1bd7c8['baseVersion']);}if('marker'===_0x2a9caa['type']&&_0x2a9caa['name']['startsWith']('$markedRemove')){const _0x1b76a9=_0x2a9caa;return new _0x5bbb57(_0x1b76a9['name'],_0x1b76a9['oldRange'],this['_changeRange'](_0x1b76a9['newRange'],_0x1bd43e['concat'](_0x1b76a9['newRange']['start']['offset']),_0x1bd43e['concat'](_0x1b76a9['newRange']['end']['offset']),_0x4019a5),_0x1b76a9['_markers'],_0x1b76a9['affectsData'],_0x1b76a9['baseVersion']);}return _0x2a9caa;}_groupAdjacentOperations(_0x268ffa){if(!_0x268ffa['length'])return[];const _0x4eb614=[];let _0x494c82=0x0,_0x53f24a=0x0,_0x6afa40=[];for(let _0x593df9=0x0;_0x593df9<=_0x268ffa['length'];_0x593df9++){const _0x2c9292=_0x268ffa[_0x593df9],_0x3e3a24=_0x268ffa[_0x593df9-0x1];!_0x2c9292||_0x3e3a24&&!this['_getOperationEnd'](_0x3e3a24)['isTouching'](this['_getOperationStart'](_0x2c9292))?(_0x4eb614['push']({'operations':_0x6afa40,'operationsIsolated':_0x6afa40['map'](_0x54a9fc=>this['_shiftOperation'](_0x54a9fc['clone'](),-_0x53f24a)),'groupOffset':_0x494c82}),_0x6afa40=_0x2c9292?[_0x2c9292]:[],_0x53f24a+=_0x494c82,_0x494c82=0x0):_0x6afa40['push'](_0x2c9292),_0x2c9292&&'insert'===_0x2c9292['type']&&(_0x494c82+=_0x2c9292['howMany']);}return _0x4eb614;}_findAdjacentContextDistance(_0x3127f5,_0x3940c4,_0x10a388,_0x499b5e=0x1){const _0x2e2cc6=new _0x28cad7({'startPosition':_0x3127f5,'direction':_0x3940c4});let _0x5466e4=0x0;for(let _0x38042c=0x0;_0x38042c<_0x499b5e;_0x38042c++){let _0x4fbdd3=0x0,_0x4be4e0=!0x1,_0x52de4d='forward'===_0x3940c4?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x41e1bb}of _0x2e2cc6)if(_0x41e1bb['is']('$textProxy')){const _0xcf11bb=_0x52de4d['exec'](_0x41e1bb['data']);if(_0xcf11bb&&_0xcf11bb['length']){if(_0x4fbdd3+='forward'===_0x3940c4?_0xcf11bb['index']+_0xcf11bb[0x0]['length']:_0x41e1bb['data']['length']-_0xcf11bb['index'],_0xcf11bb[0x0]['length']!==_0x41e1bb['data']['length'])break;_0x4be4e0=!0x0,_0x52de4d='forward'===_0x3940c4?/^\w+/:/\w+$/;}else{if(_0x4be4e0)break;_0x4fbdd3+=_0x41e1bb['offsetSize'];}}else{if(_0x41e1bb['is']('element')){_0x10a388['isInline'](_0x41e1bb)&&!_0x4be4e0&&(_0x4fbdd3+=0x1);break;}}_0x5466e4+=_0x4fbdd3,_0x2e2cc6['jumpTo'](_0x3127f5['getShiftedBy']('forward'===_0x3940c4?_0x5466e4:-_0x5466e4));}return _0x5466e4;}_getChangeContext(_0x31bbdb,_0x220132,_0x1b0544){const _0x3815a5=_0x1b0544['model']['schema'],_0x575f88=this['_findAdjacentContextDistance'](_0x31bbdb,'backward',_0x3815a5,0x6),_0x4b1bbf=this['_findAdjacentContextDistance'](_0x220132,'forward',_0x3815a5,0x6),_0x361e74=_0x31bbdb['getShiftedBy'](-_0x575f88),_0x1067e9=_0x220132['getShiftedBy'](_0x4b1bbf);return{'start':_0x361e74,'end':_0x1067e9,'hasContentBefore':!_0x361e74['isAtStart'],'hasContentAfter':!_0x1067e9['isAtEnd']};}_insertMarkers(_0x34f630,_0x3afcd0){const _0x42deb0=this['context']['plugins']['get']('AIEditing'),_0x2f5821=new Set();_0x3afcd0['model']['change'](_0x30f92f=>{for(const _0x12e633 of _0x34f630){const _0x1ed4fe=''+Lh+_0x12e633['type']+':'+_0x12e633['groupId']+'_'+_0x42deb0['_nextDataId'](_0x2f5821);this['_markers']['set'](_0x1ed4fe,{'id':_0x1ed4fe,'groupId':_0x12e633['groupId'],'type':_0x12e633['type'],'content':_0x12e633['content'],'editor':_0x3afcd0}),_0x30f92f['addMarker'](_0x1ed4fe,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x30f92f['createRange'](_0x12e633['start'],_0x12e633['end'])});}});}_createGetContextFn(_0x23b288,_0x45634e,_0x174d0e){let _0x75dc01='';return()=>{if(!_0x75dc01){const _0x129ac8=_0x45634e['toView'](_0x23b288,{'showSuggestionHighlights':!0x0});let _0x4ef6a2=_0x129ac8['getChild'](0x0);if(_0x4ef6a2['is']('containerElement')||(_0x4ef6a2=_0x129ac8),!_0x4ef6a2)return'';let _0xfd1421=!0x1;const _0x447cef=[];for(const _0x22eed6 of _0x4ef6a2['getChildren']())_0x22eed6['is']('element','span')&&_0x22eed6['hasClass']('ck-ai_review-marker_context-end')&&(_0xfd1421=!0x1),_0xfd1421&&_0x447cef['push'](_0x22eed6),_0x22eed6['is']('element','span')&&_0x22eed6['hasClass']('ck-ai_review-marker_context-start')&&(_0xfd1421=!0x0);_0x4ef6a2['_removeChildren'](0x0,_0x4ef6a2['childCount']),_0x174d0e?.['ellipsisBefore']&&_0x4ef6a2['_appendChild']('…'),_0x4ef6a2['_appendChild'](_0x447cef),_0x174d0e?.['ellipsisAfter']&&_0x4ef6a2['_appendChild']('…');const _0x59c90a=_0x45634e['htmlProcessor']['domConverter']['viewToDom'](_0x129ac8),_0x557112=_0x45634e['htmlProcessor']['htmlWriter']['getHtml'](_0x59c90a);_0x75dc01=this['_removeUnsupportedElements'](_0x557112);}return _0x75dc01;};}_createGetContentFn(_0x1db6c5,_0x4e59ad){let _0x398498='';return()=>(_0x398498||(_0x398498=this['_removeUnsupportedElements'](_0x4e59ad['stringify'](_0x1db6c5,{'showSuggestionHighlights':!0x0}))),_0x398498);}_createGetContentUsingDataIdFn(_0x5e5f3b,_0x24300a,_0x273242){let _0x4e36a9='';return()=>{if(!_0x4e36a9){const _0x259759=_0x273242['toView'](new _0x28e306(_0x5e5f3b));_0x4e36a9=_0x273242['htmlProcessor']['domConverter']['viewToDom'](_0x259759)['querySelector']('[data-id=\x22'+_0x24300a+'\x22]')?.['outerHTML']||'';}return _0x4e36a9;};}_removeUnsupportedElements(_0x33ea51){if(!_0x33ea51)return'';const _0x263889=Rs(_0x33ea51,{'decodeEntities':!0x1}),_0x2aba53=ys(_0x263889);if(!_0x2aba53['length'])return _0x33ea51;for(const _0x22d881 of _0x2aba53)_0x47cc1f(_0x22d881);return Os(_0x263889,{'encodeEntities':!0x1});}_neutralizeChangesOnUnsupportedElements(_0x3ed590,_0x14e9e1){const _0xe86d9f=Rs(_0x3ed590,{'decodeEntities':!0x1}),_0x19d233=Rs(_0x14e9e1,{'decodeEntities':!0x1}),_0x38e518=ys(_0xe86d9f),_0x4209a9=ys(_0x19d233);if(!_0x38e518['length']&&!_0x4209a9['length'])return{'contentInitial':_0x3ed590,'contentNew':_0x14e9e1};const _0x382bb2=new Map(),_0x11b084=new Map();for(const _0x2bb952 of _0x38e518){const _0x2f14b5=Ps(_0x2bb952,'data-id');if(_0x2f14b5)_0x382bb2['set'](_0x2f14b5,_0x2bb952);else{const _0x317b7f=Os(_0x2bb952,{'encodeEntities':!0x1}),_0x2e77d7=_0x11b084['get'](_0x317b7f);_0x2e77d7?_0x2e77d7['push'](_0x2bb952):_0x11b084['set'](_0x317b7f,[_0x2bb952]);}}for(const _0x29ade7 of _0x4209a9){const _0x49f85c=Ps(_0x29ade7,'data-id');let _0x40b3ba;if(_0x49f85c)_0x40b3ba=_0x382bb2['get'](_0x49f85c);else{const _0x39001b=_0x11b084['get'](Os(_0x29ade7,{'encodeEntities':!0x1}));_0x40b3ba=_0x39001b&&_0x39001b['length']?_0x39001b['shift']():void 0x0;}_0x40b3ba?_0x452856(_0x29ade7,_0x2a3383(_0x40b3ba,!0x0)):_0x47cc1f(_0x29ade7);}return{'contentInitial':Os(_0xe86d9f,{'encodeEntities':!0x1}),'contentNew':Os(_0x19d233,{'encodeEntities':!0x1})};}_findMarkerElement(_0x4f4154,_0x4997e9=0x5){let _0x519067=_0x4f4154,_0x47d026=null;for(let _0x34224d=0x0;_0x34224d<_0x4997e9&&_0x519067;_0x34224d++)if(_0x519067['className']){if((''+_0x519067['className'])['includes']('ck-ai_review-marker_')){if(!_0x519067['getAttribute']('data-marker-id'))break;_0x47d026=_0x519067;break;}_0x519067=_0x519067['parentElement'];}else _0x519067=_0x519067['parentElement'];return _0x47d026;}_findMarkerElementById(_0x2361b9){const _0x1855fc=this['_markers']['get'](_0x2361b9);if(!_0x1855fc)return null;const _0x948901=_0x1855fc['editor']['model']['markers']['get'](_0x2361b9);return _0x948901?_0x497b83(_0x1855fc['editor']['editing'],_0x948901):null;}_getMarkersDataForGroup(_0x12f406){return Array['from'](this['_markers']['values']())['filter'](_0x2b7a44=>_0x2b7a44['groupId']===_0x12f406);}_getOperationStart(_0xa2f6ee){return'insert'===_0xa2f6ee['type']?_0xa2f6ee['position']:_0xa2f6ee['newRange']['start'];}_getOperationEnd(_0x545f76,_0xb17176=!0x1){return'insert'===_0x545f76['type']?_0xb17176?_0x545f76['position']:_0x545f76['position']['getShiftedBy'](_0x545f76['howMany']):_0x545f76['newRange']['end'];}_shiftOperation(_0x349814,_0x5cc590){return'insert'===_0x349814['type']?_0x349814['position']=_0x349814['position']['getShiftedBy'](_0x5cc590):'marker'===_0x349814['type']&&_0x349814['newRange']&&(_0x349814['newRange']=new _0x2827cc(_0x349814['newRange']['start']['getShiftedBy'](_0x5cc590),_0x349814['newRange']['end']['getShiftedBy'](_0x5cc590))),_0x349814;}_changeOperationOwnerDocument(_0x216df3,_0xd647f7){'insert'===_0x216df3['type']?_0x216df3['position']=this['_changePositionOwnerDocument'](_0x216df3['position'],_0xd647f7):'marker'===_0x216df3['type']&&_0x216df3['newRange']&&(_0x216df3['newRange']=this['_changeRangeOwnerDocument'](_0x216df3['newRange'],_0xd647f7));}_changePositionOwnerDocument(_0x4a19de,_0x5babf6){return new _0x4febba(_0x5babf6,_0x4a19de['path']);}_changeRangeOwnerDocument(_0x1c144d,_0x443c8b){return new _0x2827cc(this['_changePositionOwnerDocument'](_0x1c144d['start'],_0x443c8b),this['_changePositionOwnerDocument'](_0x1c144d['end'],_0x443c8b));}_changePosition(_0x45bb72,_0x337b01){return new _0x4febba(_0x337b01,[..._0x45bb72]);}['_changeRange'](_0x278dd5,_0x4dece2,_0x4413e5,_0x45f110){return new _0x2827cc(this['_changePosition'](_0x4dece2,_0x45f110),this['_changePosition'](_0x4413e5,_0x45f110));}_sortMarkers(_0x96f6f0){const _0x1b2fe3=_0x47d387=>{switch(_0x47d387){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x96f6f0['sort']((_0x3d7421,_0x15ef03)=>_0x1b2fe3(_0x3d7421['type'])-_0x1b2fe3(_0x15ef03['type']));}_hasSameTopLevelElement(_0x263d92,_0x4735d6){const _0x3099fb=_0x263d92['getChild'](0x0),_0x59f756=_0x4735d6['getChild'](0x0);return!(!_0x3099fb||!_0x59f756)&&((!_0x3099fb['is']('element')||!_0x59f756['is']('element')||_0x3099fb['name']===_0x59f756['name'])&&!(_0x3099fb['is']('element')&&!_0x59f756['is']('element')||!_0x3099fb['is']('element')&&_0x59f756['is']('element')));}_haveSingleTopLevelElement(_0x2305ed){return 0x1===_0x2305ed['childCount'];}_haveOnlyInlineContent(_0x1166c4,_0x3abd5b){for(const _0x4146da of _0x1166c4['getChildren']())if(_0x4146da['is']('element')&&!_0x3abd5b['isInline'](_0x4146da))return!0x1;return!0x0;}_upsertDataId(_0x37eb35,_0x13d4db){let _0x2a4c2c=_0x37eb35['getAttribute'](_0x4fabc2);return _0x2a4c2c||(_0x2a4c2c=_0x13d4db(),_0x37eb35['_setAttribute'](_0x4fabc2,_0x2a4c2c)),_0x2a4c2c;}};const Mh=/* #__PURE__ -- @preserve */
|
|
38
|
-
dt();var Uh=class extends Mh{['id'];contentNew;contentInitial;documentVersion;constructor({id:
|
|
39
|
-
At();var Bh=class extends Vh{['id'];parent;editor;_data;_editorOperations=[];constructor(
|
|
40
|
-
At();var Fh=class extends Gh{['id']=kt();['callId'];_results=new Map();['_changes']=[];_hasUnsupportedInlineChange=!0x1;['_sourceCheck'];_documentData;_aiConnector;['_reviewParams'];['_reviewArgs'];_contexts;_activeRequest=null;_currentError;_wasAborted=!0x1;constructor(_0x68a329,_0x415056,_0x2b2509,_0x31a9cd,_0x50f356,_0x3c0e3f){super(),this['_sourceCheck']=_0x415056,this['_documentData']=_0x68a329,this['_aiConnector']=_0x2b2509,this['_reviewParams']=_0x31a9cd,this['_reviewArgs']=_0x50f356,this['_contexts']=_0x3c0e3f,this['on']('change:status',(_0x427587,_0x368e21,_0x4c40a4)=>{'aborted'==_0x4c40a4&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x4c40a4,'run':this,'error':this['_currentError']});}),this['set']('status','initialized');}get documentData(){return this['_documentData'];}get['sourceCheck'](){return this['_sourceCheck'];}get processedResultsCount(){return this['_results']['size'];}get hasUnsupportedInlineChange(){return this['_hasUnsupportedInlineChange'];}get title(){return this['_sourceCheck']['title'];}get subTitle(){return'';}get['reviewName'](){return this['_sourceCheck']['id'];}get hasModifications(){return!this['_changes']['every'](_0x2f412f=>'pending'===_0x2f412f['status']);}get currentError(){return this['_currentError'];}get results(){return Array['from'](this['_results']['values']());}updateDocumentData(_0x5c9755){this['_documentData']=_0x5c9755;}async start(){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x47f426=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x2a716c of _0x47f426)'unmodified'!==_0x2a716c['data']['operation']&&('error'!==_0x2a716c['data']['operation']?'review-metadata'!==_0x2a716c['event']?this['_addReviewCheckResult'](_0x2a716c['data']['dataId'],_0x2a716c['data']['textDelta']):this['callId']=_0x2a716c['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(_0x5acdb3){this['_currentError']=_0x5acdb3,kn(_0x5acdb3)?this['status']='aborted':this['status']='error-general';}finally{this['_activeRequest']=null;}}async restart(){this['_results']['clear'](),this['_changes']['length']=0x0,this['_currentError']=void 0x0,this['_hasUnsupportedInlineChange']=!0x1,await this['start']();}addResultChanges(_0x19a589,_0x32a218){const _0x47a609=this['_results']['get'](_0x19a589);if(!_0x47a609)return;if(0x0===_0x32a218['length'])return;const _0x25f30d=this['_documentData']['elements']['get'](_0x19a589);if(!_0x25f30d)return;const _0x4969ae=[];_0x32a218['forEach']((_0x455983,_0x2e5e9f)=>{const _0x403be0=new Bh(_0x47a609['id']+'-'+_0x2e5e9f,_0x455983,_0x47a609,_0x25f30d['editor']);_0x403be0['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x403be0,'status':_0x403be0['status']});}),_0x403be0['on']('change:isActivated',()=>{_0x403be0['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x403be0}):this['fire']('reviewCheckResultDeactivated',{'change':_0x403be0});}),this['_changes']['push'](_0x403be0),_0x4969ae['push'](_0x403be0);}),this['fire']('reviewCheckResultReady',{'changes':_0x4969ae,'result':_0x47a609,'source':this});}abort(){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}isChangeActive(_0x30798e){const _0x5c9a53=this['_changes']['find'](_0x4fdba1=>_0x4fdba1['id']===_0x30798e);return!(!_0x5c9a53||'pending'!==_0x5c9a53['status']);}isAnyChangeActivated(){return this['_changes']['some'](_0x250cad=>!0x0===_0x250cad['isActivated']);}getActiveChanges(){return this['_changes']['filter'](_0x3580d3=>'pending'===_0x3580d3['status']);}getChangeById(_0x2337dc){return this['_changes']['find'](_0x27131c=>_0x27131c['id']===_0x2337dc);}markAllChangesAsAccepted(){for(const _0x18a020 of this['_changes'])'pending'===_0x18a020['status']&&(_0x18a020['status']='accepted');this['_checkIfFinished']();}markChangeAsAccepted(_0x4ab2bf){const _0x323770=this['_changes']['find'](_0xc1f4fb=>_0xc1f4fb['id']===_0x4ab2bf);_0x323770&&'pending'===_0x323770['status']&&(_0x323770['status']='accepted'),this['_checkIfFinished']();}markChangeAsRejected(_0x420749){const _0x4a0285=this['_changes']['find'](_0x2db1b5=>_0x2db1b5['id']===_0x420749);_0x4a0285&&'pending'===_0x4a0285['status']&&(_0x4a0285['status']='rejected'),this['_checkIfFinished']();}markChangeAsOutdated(_0x36a007){const _0x2f7a4b=this['_changes']['find'](_0x41a2b8=>_0x41a2b8['id']===_0x36a007);_0x2f7a4b&&'pending'===_0x2f7a4b['status']&&(_0x2f7a4b['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x373b3e){const _0x5d3de0=this['_changes']['find'](_0x29e1e9=>_0x29e1e9['id']===_0x373b3e);_0x5d3de0&&'outdated'===_0x5d3de0['status']&&(_0x5d3de0['status']='pending'),this['_checkIfFinished']();}activateChange(_0x38e955){this['_changes']['filter'](_0x23efc5=>_0x23efc5['isActivated']&&_0x23efc5['id']!==_0x38e955)['forEach'](_0x53f69d=>{_0x53f69d['isActivated']=!0x1;});const _0x1c1396=this['_changes']['find'](_0x32ff78=>_0x32ff78['id']===_0x38e955);_0x1c1396&&'pending'===_0x1c1396['status']&&(_0x1c1396['isActivated']=!0x0);}deactivateChange(){this['_changes']['filter'](_0x17bc2d=>_0x17bc2d['isActivated'])['forEach'](_0x32f488=>{_0x32f488['isActivated']=!0x1;});}forceReadyState(){this['status']='ready';}async sendRating(_0x43c4af){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x10359e;if(_0x43c4af){const _0x3257d2=this['_changes']['find'](_0x4bfe80=>_0x4bfe80['id']===_0x43c4af);if(_0x3257d2&&_0x3257d2['isRated'])return;_0x3257d2&&(_0x10359e=_0x3257d2['parent']['id'],_0x3257d2['isRated']=!0x0);}const _0x3e7127={'positiveCount':this['_changes']['filter'](_0x2726ff=>'accepted'===_0x2726ff['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x3e7127,this['callId'],_0x10359e);}_addReviewCheckResult(_0x592493,_0x3735c8){const _0x363142=this['_documentData']['elements']['get'](_0x592493);if(!_0x363142)return;if(Gs(_0x363142['editor'],_0x363142['rootName'])&&!Ys(_0x363142['editor'],Rs(_0x3735c8)))return void(this['_hasUnsupportedInlineChange']=!0x0);const _0x1d85fa=_0x363142['getContent']();if(_0x1d85fa===_0x3735c8)return;const _0x53d591=new Uh({'id':_0x592493,'contentInitial':_0x1d85fa,'contentNew':_0x3735c8,'documentVersion':_0x363142['documentVersion']});this['_results']['set'](_0x53d591['id'],_0x53d591),this['fire']('reviewCheckResultAdded',{'result':_0x53d591,'source':this,'editor':_0x363142['editor'],'rootName':_0x363142['rootName']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0x38a88d=>'pending'===_0x38a88d['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x410f07=>'pending'===_0x410f07['status'])['length']&&(this['status']='finished');}},Kh=class extends Fh{get subTitle(){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x1dcd31=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x255e55=0x0;_0x255e55<this['_reviewParams']['length'];_0x255e55++){if(!this['_reviewParams'][_0x255e55]||!this['_sourceCheck']['options'][_0x255e55])continue;const _0x1450f5=this['_sourceCheck']['options'][_0x255e55]['data']?.['find'](_0x190f80=>_0x190f80['id']===this['_reviewParams'][_0x255e55]);_0x1450f5&&_0x1dcd31['push'](_0x1450f5['label']);}return _0x1dcd31['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}_createApiRequest(){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs'],'contexts':this['_contexts']});}_sendRatingRequest(_0x3f65c2,_0x564f47,_0x1818f5){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x564f47,_0x3f65c2,_0x1818f5);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},Wh=class extends _0x898608{_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',(_0x4fd527,_0x70b29b)=>this['runCheck'](_0x70b29b)),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 _0x16ffbe=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x16ffbe['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x16ffbe['map'](_0x2089f0=>_0x2089f0['id']),this['_aiSource']);const _0x1cf8e6=this['_currentReviewCheckRun'];_0x1cf8e6['markAllChangesAsAccepted'](),_0x1cf8e6['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x43a84b,_0x11340a)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x11340a['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x11340a['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x11340a['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x11340a['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x5d9db8,_0x5b2c52)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x5b2c52['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x5b2c52['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x5b2c52['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x5b2c52['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'retryReview',async()=>{this['_currentReviewCheckRun']&&(this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreUi']['setAcceptAllEnabled'](!0x1),this['_currentReviewCheckRun']['updateDocumentData'](this['_aiReviewCoreEditing']['getDocumentData']()),await this['_currentReviewCheckRun']['restart']());}),this['listenTo'](this['_aiReviewCoreUi'],'activateChange',(_0x5b1289,_0x381622)=>{this['_onActivateChange'](_0x381622);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x2a8287,_0xec569e)=>{this['_onDeactivateChange'](_0xec569e);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x10be03,_0x11f996)=>{this['_onChangeMarkerClicked'](_0x10be03,_0x11f996);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x2ba404,_0x4ec513)=>{this['_onChangeMarkerHovered'](_0x2ba404,_0x4ec513);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x5de019,_0x562468)=>{this['_onChangeMarkerRemoved'](_0x5de019,_0x562468);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x197d86,_0x1ec56c)=>{this['_onChangeMarkerRestored'](_0x197d86,_0x1ec56c);});}async['runCheck'](_0x2b5caf){if(!this['_availableReviewChecks'])return;const _0x4dad9f=this['_availableReviewChecks']['find'](_0x3ca8f2=>_0x3ca8f2['id']===_0x2b5caf['id']);if(!_0x4dad9f)return void this['_logError'](new ct('ai-review-mode-source-check-not-found',this,{'checkId':_0x2b5caf['id']}));this['_onReviewCheckRun'](_0x2b5caf),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_aiReviewCoreUi']['setAcceptAllEnabled'](!0x1);const _0x33b0d5=this['context']['plugins']['get'](fs)['contextLibrary']['resolveContext']({'feature':this['_defaultContextFeature'],'ids':[_0x2b5caf['id']],'context':new Yn()});this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x2b5caf,_0x4dad9f,_0x33b0d5);const _0x22ce61=this['_currentReviewCheckRun'];_0x22ce61['on']('reviewCheckResultChangeStatusUpdated',(_0x49b274,_0x4fb2af)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x4fb2af['change']['id'],_0x4fb2af['status']),this['_pushAcceptAllEnabled'](_0x22ce61);}),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x1e24e2,_0x5d3e92)=>{switch(_0x5d3e92['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x5d3e92);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_currentReviewCheckRun']?.['hasUnsupportedInlineChange']?this['_aiReviewCoreUi']['showUnsupportedInlineChangeView']():this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_currentReviewCheckRun']?.['hasUnsupportedInlineChange']?this['_aiReviewCoreUi']['showUnsupportedInlineChangeView']():this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new ct('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new ct('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'!==_0x5d3e92['status']&&'error-chunk'!==_0x5d3e92['status']&&'error-general'!==_0x5d3e92['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x4aa41f,_0x2d87ba)=>{if(!this['_currentReviewCheckRun'])throw new ct('ai-review-mode-no-current-check-run',this);const _0x3b6abc=Gs(_0x2d87ba['editor'],_0x2d87ba['rootName']);let _0x4a4090=_0x2d87ba['result']['contentInitial'],_0x4095bc=_0x2d87ba['result']['contentNew'];_0x3b6abc&&(_0x4a4090=Ws(_0x4a4090),_0x4095bc=Ws(_0x4095bc));const _0x32675a=this['_diffContent'](_0x2d87ba['editor'],_0x4a4090,_0x4095bc);if(_0x3b6abc){const _0x574732=_0x2d87ba['editor']['ui']['getEditableElement'](_0x2d87ba['rootName'])?.['tagName']['toLowerCase']();for(const _0x5c6350 of _0x32675a)_0x5c6350['wrapperTag']=_0x574732;}_0x2d87ba['source']['addResultChanges'](_0x2d87ba['result']['id'],_0x32675a);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x4708f0,_0x3e9d83)=>{for(const _0x16feaf of _0x3e9d83['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x16feaf);this['_pushAcceptAllEnabled'](_0x3e9d83['source']),this['_markChangePositionInEditorContent'](_0x3e9d83['changes'],_0x3e9d83['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x4cac66,_0x4a6728)=>{this['_onReviewCheckResultActivated'](_0x4a6728);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x430521){if(kn(_0x430521))return;_0x430521 instanceof ct?this['_logError'](_0x430521):this['_logError'](new ct('ai-review-mode-check-run-failed',this,void 0x0,_0x430521));}}abort(){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}getAvailableChecks(){return(this['_availableReviewChecks']??[])['slice']();}getCurrentCheckRun(){return this['_currentReviewCheckRun'];}_pushAcceptAllEnabled(_0x2cc22d){this['_aiReviewCoreUi']['setAcceptAllEnabled'](_0x2cc22d['getActiveChanges']()['length']>0x0);}_createReviewCheckRun(_0x4db18e,_0x292d99,_0x3ab97f=new Yn()){return new Kh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x292d99,this['_aiConnector'],_0x4db18e['params'],_0x4db18e['args'],_0x3ab97f['refs']);}['_onChangeMarkerRemoved'](_0x4f50e3,_0x4fa692){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x4fa692['changeId']);}_onChangeMarkerRestored(_0x246173,_0x3ccbc3){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x3ccbc3['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}_initRequiredPlugins(){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](Nn)['createReporter']('aireview');}['_onReviewRunLeave'](_0x3f6b48=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x3f6b48&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x46cf04 of this['_aiReviewCoreEditing']['getEditors']())_0x46cf04['editing']['view']['change'](_0x3f4991=>{for(const _0x3a67cd of _0x46cf04['editing']['view']['document']['getRoots']())_0x3f4991['removeClass']('ck-ai_review-diff',_0x3a67cd),_0x3f4991['removeClass']('ck-ai_review-highlights',_0x3a67cd),_0x3f4991['removeClass']('ck-ai-translate-mode-content',_0x3a67cd);});}['_logError'](_0x26b4c8){this['_reporter']['logError'](_0x26b4c8),'ai-review-mode-models-unable-to-retrieve'===function(_0xc974a3){return _0xc974a3 instanceof yn?_0xc974a3['code']:_0xc974a3 instanceof Error?_0xc974a3['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x26b4c8)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0x1bf7b5){if('content'===this['_changeActivationSource']){const _0x40b389=this['_aiReviewCoreUi']['getChangeElement'](_0x1bf7b5);_0x40b389&&Rt(_0x40b389['closest']('.ck-ai_review__check-run-result')||_0x40b389);}else{if('panel'===this['_changeActivationSource']){const _0x331434=this['_getChangeContentElement'](_0x1bf7b5);if(!_0x331434)return;Ot({'target':_0x331434,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},Yh=class extends Fh{_prompt;['_model'];constructor(_0x50ccfa,_0x2d6a44,_0x4522c0,_0x21d765,_0xb31fab,_0x4e3e0c){super(_0x4522c0,_0x21d765,_0xb31fab,void 0x0,void 0x0,_0x4e3e0c),this['_prompt']=_0x50ccfa,this['_model']=_0x2d6a44;}get subTitle(){return this['_prompt']??'';}_createApiRequest(){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],...void 0x0!==this['_prompt']&&{'prompt':this['_prompt']},'model':this['_model'],'contexts':this['_contexts']});}_sendRatingRequest(_0x6d5cdd,_0x54af6d,_0x19e71b){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x54af6d,_0x6d5cdd,_0x19e71b);}},$h=class{['id'];['commandId'];title;description;isParameterized;['useArgs'];options;['args'];get['apiId'](){return this['commandId'];}constructor(_0x28734e){this['id']=_0x28734e['id'],this['commandId']=_0x28734e['commandId'],this['title']=_0x28734e['title'],this['description']=_0x28734e['description'],this['isParameterized']=_0x28734e['isParameterized'],this['useArgs']=_0x28734e['useArgs'],this['options']=_0x28734e['options'],this['args']=_0x28734e['args'];}},qh=class extends $h{isExtra=!0x0;prompt;context;['model'];_defaultModel=null;constructor(_0x32ae19,_0x366505,_0x40b8fe){super(_0x32ae19),this['prompt']=_0x32ae19['prompt'],this['context']=_0x32ae19['context'],this['model']=_0x32ae19['model'],this['model']?this['_defaultModel']=_0x366505['find'](_0x19990a=>_0x19990a['id']===this['model'])||null:this['_defaultModel']=_0x40b8fe;}get defaultModel(){return this['_defaultModel'];}},Qh=class extends Yh{get subTitle(){return'';}set prompt(_0xcaafa7){this['_prompt']=_0xcaafa7;}set['model'](_0x295a7c){this['_model']=_0x295a7c;}},Xh=class extends _0x898608{static get requires(){return[Is,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 zh=[{'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'}]}]}],jh=/* #__PURE__ -- @preserve */
|
|
41
|
-
At();var Jh=class extends jh{['_checks']=[];setupChecks(_0x206f97){this['_checks']=_0x206f97['map'](_0x9f523d=>new $h(_0x9f523d));}get['checks'](){return this['_checks']['slice']();}getCheckById(_0x45ed69){return this['checks']['find'](_0x31b596=>_0x31b596['id']===_0x45ed69);}['removeCheckById'](_0x4f455c){this['_checks']=this['_checks']['filter'](_0x23a832=>_0x23a832['id']!==_0x4f455c);}},Zh=class extends $h{['_models']=[];_defaultModel=null;constructor(_0x3a2ac6,_0x18311a,_0x30e65c){super(_0x3a2ac6),this['_models']=_0x18311a,this['_defaultModel']=_0x30e65c;}get['models'](){return this['_models']['slice']();}get defaultModel(){return this['_defaultModel'];}},tc=class extends Jh{['_allModels']=[];['_recommendedModels']=[];_defaultModel=null;constructor(_0x12e22f,_0x8f7b2a,_0x32c104){super(),this['_allModels']=_0x12e22f,this['_recommendedModels']=_0x8f7b2a,this['_defaultModel']=_0x32c104;}get['allModels'](){return this['_allModels']['slice']();}setupChecks(_0x5e37fc){this['_checks']=_0x5e37fc['map'](_0x11acf3=>!0x0===_0x11acf3['isExtra']?new qh(_0x11acf3,this['_allModels'],this['_defaultModel']):'custom'===_0x11acf3['id']?new Zh(_0x11acf3,this['_recommendedModels'],this['_defaultModel']):new $h(_0x11acf3));}},ec=class extends Xh{static get['pluginName'](){return'AIReviewModeCheckRegistry';}static get requires(){return[Is,Nn,fs];}['_modelsLoadError']=null;constructor(_0x2dec76){super(_0x2dec76),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}getExtraChecks(){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0xab3105=>({'id':_0xab3105['id'],'commandId':_0xab3105['id'],'title':_0xab3105['label'],'description':_0xab3105['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0xab3105['prompt'],'context':_0xab3105['context'],'model':_0xab3105['model']}));}async _loadChecksList(){const _0x580e20=[...zh,...this['getExtraChecks']()]['map'](_0x13a4b5=>_0x13a4b5['isExtra']?_0x13a4b5:this['_translateReviewCheck'](_0x13a4b5)),_0x1002fa=this['context']['plugins']['get'](fs);let _0xb54353;try{_0xb54353=new tc(await _0x1002fa['models']['getAllModels'](),await _0x1002fa['models']['getAvailableModels'](),await _0x1002fa['models']['getDefault']()),this['_modelsLoadError']=null;}catch(_0x1d359d){this['_modelsLoadError']=new ct('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x1d359d),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),_0xb54353=new tc([],[],null);}return _0xb54353['setupChecks'](_0x580e20),_0xb54353;}_translateReviewCheck(_0x52311d){const _0x38954a='AI_REVIEW_CHECK_'+_0x52311d['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x4ad601={..._0x52311d,'title':this['_translate'](_0x38954a+'_TITLE',_0x52311d['title']),'description':this['_translate'](_0x38954a+'_DESCRIPTION',_0x52311d['description'])};return _0x52311d['options']&&(_0x4ad601['options']=_0x52311d['options']['map'](_0x50394b=>({..._0x50394b,'label':this['_translate'](_0x38954a+'_OPTIONS_LABEL',_0x50394b['label']||''),'data':_0x50394b['data']?_0x50394b['data']['map'](_0x211fc8=>({..._0x211fc8,'label':this['_translate'](_0x38954a+'_OPTIONS_DATA_'+_0x211fc8['id']['toUpperCase'](),_0x211fc8['label'])})):void 0x0}))),_0x4ad601;}_translate(_0x134a5a,_0x23c7f6){const _0x54e609=Es(this['context']['locale'],_0x134a5a);return _0x54e609===_0x134a5a?_0x23c7f6:_0x54e609;}},ic=class extends Wh{static get['pluginName'](){return'AIReviewModeController';}static get requires(){return[Nn,ec,fs];}get['_aiSource'](){return'review';}get _defaultContextFeature(){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x592661){super(_0x592661),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',zh['map'](_0x58ed76=>_0x58ed76['id']));}init(){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0xaf273b,_0x28ecfd)=>{this['_isDiffOn']=_0x28ecfd['on'],this['_onDiffChange'](this['_isDiffOn']);});}_initRequiredPlugins(){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}_createReviewCheckRun(_0x6a1c8d,_0x396e6a,_0x3b18c6=new Yn()){if(_0x6a1c8d['isCustom'])return new Yh(_0x6a1c8d['args']['prompt'],_0x6a1c8d['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x396e6a,this['_aiConnector'],_0x3b18c6['refs']);if(_0x396e6a['isExtra']){const _0x1c80e1=_0x396e6a,_0x16a338=_0x1c80e1['context']?_0x3b18c6['cloneWith'](_0x1c80e1['context'])['refs']:_0x3b18c6['refs'];return new Qh(_0x6a1c8d['args']?.['prompt']??_0x1c80e1['prompt'],_0x6a1c8d['args']?.['model']??_0x1c80e1['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x396e6a,this['_aiConnector'],_0x16a338);}return new Kh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x396e6a,this['_aiConnector'],_0x6a1c8d['params'],_0x6a1c8d['args'],_0x3b18c6['refs']);}_onReviewCheckResultActivated(_0x19adb9){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x19adb9['change']['id']),this['_scrollToChange'](_0x19adb9['change']['id']);const _0x3a5161=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x19adb9['change']['id']);if(!_0x3a5161)return;const _0x592a85=this['_aiReviewCoreEditing']['getEditorForChange'](_0x19adb9['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x19adb9['change'],()=>_0x3a5161['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x592a85,_0x3a5161['modelRange']['root']['rootName']),_0x592a85?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x19adb9['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}_onActivateChange(_0xf04681){this['_currentReviewCheckRun']&&'click'===_0xf04681['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0xf04681['id']));}_onDeactivateChange(_0x1d04d6){this['_currentReviewCheckRun']&&'balloon'===_0x1d04d6['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x3f5be8,_0x3db505){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x3db505['changeId']);const _0x25fb43=this['_currentReviewCheckRun']['getChangeById'](_0x3db505['changeId']);if(!_0x25fb43)return;const _0x13c6a4=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x3db505['changeId']),_0x7ee0ef=this['_aiReviewCoreEditing']['getEditorForChange'](_0x3db505['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x25fb43,_0x3db505['markerElement'],_0x3db505['domEvent'],'click',this['_getBalloonDomRoot'](_0x7ee0ef,_0x13c6a4?.['modelRange']['root']['rootName']),_0x7ee0ef?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x47a6b4,_0x5a5355){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x101c13=this['_currentReviewCheckRun']['getChangeById'](_0x5a5355['changeId']);if(!_0x101c13)return;const _0x3494f5=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x5a5355['changeId']),_0x480c62=this['_aiReviewCoreEditing']['getEditorForChange'](_0x5a5355['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x101c13,_0x5a5355['markerElement'],_0x5a5355['domEvent'],'hover',this['_getBalloonDomRoot'](_0x480c62,_0x3494f5?.['modelRange']['root']['rootName']),_0x480c62?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}_getChangeContentElement(_0x2a66ca){const _0x4a672b=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x2a66ca);return _0x4a672b?_0x4a672b['getElement']():null;}_markChangePositionInEditorContent(_0x2ce39c,_0xc8a4cb){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x2ce39c,_0xc8a4cb);}_diffContent(_0xe45ed4,_0x189896,_0x326b20){return this['_aiReviewCoreEditing']['diffContent'](_0xe45ed4,_0x189896,_0x326b20,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0xe8fe27){_0xe8fe27?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0xf3e5d9 of this['_aiReviewCoreEditing']['getEditors']())_0xf3e5d9['editing']['view']['change'](_0x42a7d2=>{for(const _0x28d44d of _0xf3e5d9['editing']['view']['document']['getRoots']()){for(const _0x313960 of _0x28d44d['getClassNames']())_0x313960['startsWith']('ck-ai_review-')&&_0x42a7d2['removeClass'](_0x313960,_0x28d44d);_0x42a7d2['addClass'](_0xe8fe27?'ck-ai_review-diff':'ck-ai_review-highlights',_0x28d44d);}});}_getBalloonDomRoot(_0x1e77bb,_0x470961){const _0xe99966=_0x1e77bb['editing']['view'];if(_0x470961){const _0x81052a=_0xe99966['getDomRoot'](_0x470961);if(_0x81052a)return _0x81052a;}return _0xe99966['getDomRoot']()??void 0x0;}async _getReviewChecks(){const _0x51303f=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x8d478=await _0x51303f['getChecksList']();_0x51303f['modelsLoadError']&&this['_logError'](_0x51303f['modelsLoadError']);let _0x5e0fc5=_0x8d478['checks'];const _0x2abf74=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x2abf74,_0x5e0fc5),this['_usesAvailableCommandsConfig']&&(_0x5e0fc5=_0x2abf74['map'](_0x272516=>_0x5e0fc5['find'](_0x32ac93=>_0x32ac93['id']===_0x272516))['filter'](_0x6396cf=>!!_0x6396cf)),this['_filterChecksWithMissingModel'](_0x5e0fc5);}_logWarningForNonExistentChecks(_0x3642dc,_0x16a6a2){const _0x307dd8=_0x3642dc['filter'](_0xd4b5ea=>!_0x16a6a2['some'](_0x3cb6f2=>_0x3cb6f2['id']===_0xd4b5ea));_0x307dd8['length']&&this['_reporter']['logError'](new yn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x307dd8['join'](',\x20')}}));}_filterChecksWithMissingModel(_0x2174cb){const _0x2b9757=[];return _0x2174cb['forEach'](_0xffa6af=>{(_0xffa6af instanceof qh&&!_0xffa6af['defaultModel']||_0xffa6af instanceof Zh&&!_0xffa6af['models']['length'])&&_0x2b9757['push'](_0xffa6af['id']);}),_0x2b9757['length']&&_0x2b9757['forEach'](_0x41cfba=>{_0x2174cb=_0x2174cb['filter'](_0x2a3843=>_0x2a3843['id']!==_0x41cfba),this['_reporter']['logError'](new yn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x41cfba}}));}),_0x2174cb;}},sc=class extends _0x898608{static get['pluginName'](){return'AIReviewGateway';}static get requires(){return[Hh,ec,Is,tn,Tn,fs];}get['models'](){return this['context']['plugins']['get'](fs)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async getAllCommands(){return(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['map'](_0x3dd5a0=>{const _0x228fde={'id':_0x3dd5a0['id'],'title':_0x3dd5a0['title'],'description':_0x3dd5a0['description']};return'custom'!==_0x3dd5a0['id']&&_0x3dd5a0['options']?.['length']&&(_0x228fde['parameters']=_0x3dd5a0['options'][0x0]['data']['map'](_0x514866=>({..._0x514866}))),_0x228fde;});}async['runReview'](_0x291ed8,_0x272932){const _0x24f8b1=await this['_resolveReviewCheck'](_0x291ed8),_0x3ed398=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x2598ff=this['context']['plugins']['get']('AIConnector'),_0x1e0da8=_0x3ed398['getDocumentData']({'roots':_0x272932?.['roots']}),_0x2aa800=this['_createReviewCheckRun'](_0x24f8b1,_0x1e0da8,_0x2598ff,_0x272932?.['parameterId'],_0x272932?.['contexts']);return _0x3ed398['runCheck'](_0x2aa800,{'signal':_0x272932?.['signal']});}async runCustomReview(_0x505705,_0x2ec184){const {reviewCheck:_0x84af4b,resolvedModel:_0x45f2cf}=await this['_resolveCustomReviewCheck'](_0x505705,_0x2ec184?.['model']),_0x4b6290=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x12e04c=this['context']['plugins']['get']('AIConnector'),_0x56d972=new Yh(_0x505705,_0x45f2cf,_0x4b6290['getDocumentData']({'roots':_0x2ec184?.['roots']}),_0x84af4b,_0x12e04c,_0x2ec184?.['contexts']);return _0x4b6290['runCheck'](_0x56d972,{'signal':_0x2ec184?.['signal']});}['applyReview'](_0x49ae7c,_0x377d82){this['context']['plugins']['get']('AIGateway')['apply'](_0x49ae7c,{'aiSource':'review',..._0x377d82});}async['_resolveReviewCheck'](_0x234630){const _0x1f1ec4=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x13b686=>_0x13b686['id']===_0x234630);if(!_0x1f1ec4)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0x234630});if(_0x1f1ec4 instanceof Zh)throw new ct('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x234630});if(_0x1f1ec4 instanceof qh&&!_0x1f1ec4['defaultModel']?.['id'])throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x234630});return _0x1f1ec4;}async _resolveCustomReviewCheck(_0x412a42,_0x19e39a){const _0x1c86d3='custom',_0xbc0a6e=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x14804d=>_0x14804d['id']===_0x1c86d3);if(!_0xbc0a6e)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0x1c86d3});if(!(_0xbc0a6e instanceof Zh))throw new ct('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x1c86d3});if(!_0x412a42)throw new ct('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x1c86d3});const _0x20d7ab=_0x19e39a??_0xbc0a6e['defaultModel']?.['id'];if(!_0x20d7ab)throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x1c86d3});return{'reviewCheck':_0xbc0a6e,'resolvedModel':_0x20d7ab};}_createReviewCheckRun(_0x6420dc,_0x2f780c,_0x701d40,_0xecf72e,_0x4072d8=[]){if(_0x6420dc instanceof qh){const _0x477b99=_0x6420dc['context']?[..._0x4072d8,_0x6420dc['context']]:_0x4072d8;return new Qh(_0x6420dc['prompt'],_0x6420dc['defaultModel']['id'],_0x2f780c,_0x6420dc,_0x701d40,_0x477b99);}return new Kh(_0x2f780c,_0x6420dc,_0x701d40,_0xecf72e?[_0xecf72e]:void 0x0,void 0x0,_0x4072d8);}},nc=class extends _0x898608{static get requires(){return[ic,Nh,Hh,sc];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async startReview(_0x5f380b,_0x4402a8){if(this['assertStartReviewPreconditions'](_0x5f380b)instanceof Zh)throw new ct('ai-reviewmode-not-a-system-command',this,{'commandId':_0x5f380b});nh(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x5f380b,'params':_0x4402a8?.['parameterId']?[_0x4402a8['parameterId']]:void 0x0});}async startCustomReview(_0x50ba85,_0x13d9bc){if(!_0x50ba85)throw new ct('ai-reviewmode-missing-custom-command-prompt',this);const _0xa41ae2=zh['find'](_0x2eff1b=>'custom'===_0x2eff1b['commandId'])['id'],_0x3d31d7=this['assertStartReviewPreconditions'](_0xa41ae2),_0x52870c=_0x13d9bc?.['model']??_0x3d31d7['defaultModel']?.['id'];if(!_0x52870c)throw new ct('ai-reviewmode-missing-custom-command-model',this);nh(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0xa41ae2,'isCustom':!0x0,'args':{'prompt':_0x50ba85,'model':_0x52870c}});}getAvailableCommands(){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x7a590c=>{const _0x41beba={'id':_0x7a590c['id'],'title':_0x7a590c['title'],'description':_0x7a590c['description']};return'custom'!==_0x7a590c['id']&&_0x7a590c['options']?.['length']&&(_0x41beba['parameters']=_0x7a590c['options'][0x0]['data']['map'](_0x2e8e2b=>({..._0x2e8e2b}))),_0x41beba;});}assertStartReviewPreconditions(_0x472c6a){const _0x32b416=this['context']['plugins']['get']('AIReviewModeController');if(_0x32b416['getCurrentCheckRun']())throw new ct('ai-reviewmode-review-already-running',this);const _0x639f8c=_0x32b416['getAvailableChecks']()['find'](_0x54d735=>_0x54d735['id']===_0x472c6a);if(!_0x639f8c)throw new ct('ai-reviewmode-unknown-command',this,{'commandId':_0x472c6a});return _0x639f8c;}},rc=class extends Kh{_title;constructor(_0x5a064b,_0x48463d,_0x90b90e,_0x5a5bcf,_0x1c1f6b,_0x3ea3d6,_0x47ac7a){super(_0x5a064b,_0x48463d,_0x90b90e,_0x1c1f6b,_0x3ea3d6,_0x47ac7a),this['_title']=_0x5a5bcf;}get title(){return this['_title'];}get subTitle(){return this['_sourceCheck']['title'];}},oc=class extends $h{get['apiId'](){return'translate';}},ac=class extends Jh{setupChecks(_0x2991b3){this['_checks']=_0x2991b3['map'](_0x5584f8=>new oc(_0x5584f8));}};const hc=[{'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 cc=class extends Xh{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x62f28c){super(_0x62f28c),this['context']['config']['define']('ai.translate.languages',hc);}async _loadChecksList(){const _0x2f05f3=[],_0x365329=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x51784c of _0x365329)_0x2f05f3['push']({'title':_0x51784c['label'],'id':_0x51784c['id'],'commandId':_0x51784c['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x51784c['id']}});const _0x39a3ed=new ac();return _0x39a3ed['setupChecks'](this['_translateChecks'](_0x2f05f3)),_0x39a3ed;}_translateChecks(_0x52e89a){const _0x5a0f25=this['context']['locale'];return _0x52e89a['map'](_0x588928=>{const _0x4df75c='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x588928['title']['toUpperCase']()['replaceAll']('-','_'),_0x1f4ead=Es(_0x5a0f25,_0x4df75c);return{..._0x588928,'title':_0x1f4ead===_0x4df75c?_0x588928['title']:_0x1f4ead};});}},lc=class extends Wh{static get['pluginName'](){return'AITranslateController';}static get requires(){return[Nn,cc,fs];}get['_aiSource'](){return'translate';}get _defaultContextFeature(){return'translate';}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}_initRequiredPlugins(){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}_createReviewCheckRun(_0x37ff7d,_0x524346,_0x289f66){return new rc(this['_aiReviewCoreEditing']['getDocumentData'](),_0x524346,this['_aiConnector'],Es(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x37ff7d['params'],_0x37ff7d['args'],_0x289f66?.['refs']);}_onReviewCheckResultActivated(_0x558b0c){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x558b0c['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x558b0c['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}_onActivateChange(_0x1505ab){this['_currentReviewCheckRun']&&('hover'===_0x1505ab['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x1505ab['id'])),'click'===_0x1505ab['uiInteraction']&&this['_scrollToChange'](_0x1505ab['id']));}_onDeactivateChange(_0x15fedb){this['_currentReviewCheckRun']&&'panel'===_0x15fedb['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x27d457,_0x59133b){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x59133b['changeId']),this['_scrollToChange'](_0x59133b['changeId']));}['_onChangeMarkerHovered'](_0x343583,_0x13ed24){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x13ed24['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x13ed24['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}_getChangeContentElement(_0x792a0){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x792a0);}_markChangePositionInEditorContent(_0x4f791f,_0x2574f4){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x4f791f,_0x2574f4);}_diffContent(_0x208fe3,_0x105ddf,_0x1d244e){return this['_aiReviewCoreEditing']['diffContent'](_0x208fe3,_0x105ddf,_0x1d244e,!0x0);}['_onReviewCheckRun'](){for(const _0x2a5f86 of this['_aiReviewCoreEditing']['getEditors']())_0x2a5f86['editing']['view']['change'](_0x12953e=>{for(const _0xdad1d8 of _0x2a5f86['editing']['view']['document']['getRoots']())_0x12953e['addClass']('ck-ai-translate-mode-content',_0xdad1d8);});}async _getReviewChecks(){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},uc=class extends fh{constructor(_0x49653d,_0x56cd26){super(_0x49653d,_0x56cd26),this['on']('set:isLoading',(_0x1ea966,_0x2b5638,_0x321337)=>{_0x321337&&(this['headerTitle']=Es(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x2ae03f,_0x5b8aad,_0x118d68)=>{_0x118d68&&(this['headerTitle']=Es(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}_createAcceptAllButtonView(){const _0x1155f0=super['_createAcceptAllButtonView']();return _0x1155f0['set']('label',Es(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x1155f0;}_createExitReviewButtonView(){const _0x165c59=super['_createExitReviewButtonView']();return _0x165c59['set']('label',Es(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x165c59;}},dc=class extends yh{_setupTemplate(){const _0x313b9c=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x313b9c['if']('isVisible','ck-hidden',_0x36a5cd=>!_0x36a5cd)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':Es(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':Es(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x313b9c['if']('isVisible','ck-hidden',_0x3b20b0=>!_0x3b20b0)]},'children':this['_checkViews']}]});}},_c=class extends mh{static get['pluginName'](){return'AITranslateUI';}createMainView(){const _0x5916dc=this['context']['plugins']['get']('AITabs'),_0x4d4a6c=this['context']['locale'],_0x7d8c5d=new ua(_0x4d4a6c,{'label':Es(_0x4d4a6c,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x370c5b,'class':'ck-ai-header_review-translate','showResizeButton':_0x5916dc['showResizeButton']});_0x7d8c5d['delegate']('resizeTabs')['to'](_0x5916dc),_0x7d8c5d['bind']('isMaximized')['to'](_0x5916dc['view'],'isMaximized',_0x4144f1=>_0x4144f1);const _0x563849=new wh(_0x4d4a6c,{'header':_0x7d8c5d,'list':new dc(_0x4d4a6c),'results':new uc(_0x4d4a6c,{'generalErrorText':Es(_0x4d4a6c,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new bh(_0x4d4a6c,{'headerText':Es(_0x4d4a6c,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Es(_0x4d4a6c,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Es(_0x4d4a6c,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x563849['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x563849;}registerTab(){const _0x40a6f6=this['context']['plugins']['get']('AITabs');_0x40a6f6['view']['on']('activateTab',(_0x458a49,{newTab:_0x197e29,oldTab:_0x917211})=>{'translate'===_0x197e29?this['fire']('getReviewCheckList'):'translate'===_0x917211&&this['fire']('leaveReview');}),_0x40a6f6['view']['addTab']({'id':'translate','buttonLabel':Es(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x370c5b,'order':0x0,'content':this['_mainView']});}},gc=class extends _0x898608{static get['pluginName'](){return'AITranslateGateway';}static get requires(){return[Hh,Is,tn,Tn];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async runTranslate(_0x38549d,_0x11b05c){const _0x4526ac=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x1686ec=this['context']['plugins']['get']('AIConnector'),_0xf2d3b3=new oc({'id':_0x38549d,'commandId':_0x38549d,'title':_0x38549d,'description':'','isParameterized':!0x1}),_0x35e2b7=new Kh(_0x4526ac['getDocumentData']({'roots':_0x11b05c?.['roots']}),_0xf2d3b3,_0x1686ec,void 0x0,{'language':_0x38549d},_0x11b05c?.['contexts']);return _0x4526ac['runCheck'](_0x35e2b7,{'signal':_0x11b05c?.['signal']});}applyTranslate(_0x207de6,_0x44d238){this['context']['plugins']['get']('AIGateway')['apply'](_0x207de6,_0x44d238);}},Ac=class extends _0x898608{static get requires(){return[lc,_c,Hh,gc];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async startTranslate(_0x56065e){const _0x1cd0f6=this['assertStartTranslatePreconditions'](_0x56065e);nh(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0x1cd0f6['id'],'args':_0x1cd0f6['useArgs']?_0x1cd0f6['args']:void 0x0});}getAvailableLanguages(){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x1c503d=>({'id':_0x1c503d['id'],'label':_0x1c503d['title']}));}assertStartTranslatePreconditions(_0x3cb845){const _0x3839a9=this['context']['plugins']['get']('AITranslateController');if(_0x3839a9['getCurrentCheckRun']())throw new ct('ai-translate-translation-already-running',this);const _0x25ce65=_0x3839a9['getAvailableChecks']()['find'](_0x9a8eb7=>_0x9a8eb7['id']===_0x3cb845);if(!_0x25ce65)throw new ct('ai-translate-unknown-language',this,{'languageId':_0x3cb845});return _0x25ce65;}};export{gh as AIActions,Li as AIAdapter,ss as AIAssistant,ts as AIAssistantUI,Va as AIBalloon,ka as AIChat,er as AIChatController,ho as AIChatFeedCustomElementView,va as AIChatHistory,Oa as AIChatHistoryController,Ca as AIChatHistoryUI,Xn as AIChatInteraction,La as AIChatShortcuts,Aa as AIChatUI,xh as AICheckRunSingleRootResult,Is as AIConnector,Yn as AIContext,Cs as AIContextLibrary,fs as AICore,yn as AICoreError,vn as AIDocumentProcessingGateway,Rn as AIDocumentProcessingRunResult,tn as AIEditing,Wa as AIEditorIntegration,xn as AIErrorReporter,Nn as AIErrorSink,Tn as AIGateway,Fn as AIInteraction,Ts as AIModels,Ah as AIQuickActions,ih as AIQuickActionsUI,Vn as AIReply,Pi as AIRequestError,$h as AIReviewCheck,Uh as AIReviewCheckResult,Bh as AIReviewCheckResultChange,Fh as AIReviewCheckRun,sc as AIReviewGateway,nc as AIReviewMode,Wh as AIReviewModeController,Hh as AIReviewModeEditing,Nh as AIReviewModeUI,On as AIRunResult,Sn as AIRunSingleRootResult,gs as AITabs,_s as AITabsMainView,ls as AITabsView,rs as AITextAdapter,Da as AIToggleButtonUI,Ac as AITranslate,lc as AITranslateController,gc as AITranslateGateway,_c as AITranslateUI,as as AWSTextAdapter,os as OpenAITextAdapter,Hi as ShowAIAssistantCommand,Pa as ToggleAICommand,Hn as createResizeButton,ns as getDefaultAICommands,mn as markOperationsAsAI};
|
|
23
|
+
import{Command as _0x2d31d9,ContextPlugin as _0x212144,Editor as _0x2a0bfb,Plugin as _0x19488e,rootAcceptsBlocks as _0x1dc860}from'@ckeditor/ckeditor5-core';import{IconAI as _0x3236d4,IconAIAdjustLength as _0x2dada8,IconAIAskAI as _0x7ab78f,IconAIChangeTone as _0x3007be,IconAIChat as _0x23ba37,IconAIChatCommands as _0xedc76b,IconAIContinueWriting as _0x28e5af,IconAIGrammarCheck as _0x56be77,IconAIHistory as _0x462166,IconAIImproveWriting as _0x23eeb2,IconAIOther as _0x3cb71d,IconAIQuickActions as _0x13034c,IconAIReview as _0x1f8cfb,IconAITranslate as _0x1bcc6c,IconBoxWithCheck as _0xc68c2d,IconBoxWithCross as _0x17c14c,IconBoxWithMarker as _0x4745b9,IconBrowseFiles as _0x2adbc2,IconBulb as _0x588d47,IconCancel as _0xabec2d,IconCheck as _0x5517bf,IconChevronDown as _0x43d5c7,IconChevronRight as _0xec4159,IconChevronUp as _0x4c02c1,IconCopy as _0x208a90,IconDocument as _0x38d218,IconDocumentOutline as _0x17766e,IconDropdownArrow as _0x2d80b8,IconError as _0x4f387d,IconEye as _0x1d1512,IconEyeCrossedOut as _0x2e2674,IconFileUpload as _0x544acb,IconImage as _0x46256d,IconInfo as _0x4790d7,IconLink as _0x43c1c8,IconLoupe as _0x69c189,IconMagicWand as _0x49d247,IconMaximize as _0x579826,IconMinimize as _0x10e858,IconNextArrow as _0x4cec77,IconOutdated as _0xa15aa9,IconPaperClip as _0x98a188,IconPin as _0x94766d,IconPlus as _0x129a73,IconPreviousArrow as _0x202389,IconRefresh as _0x1de2fd,IconRevisionHistory as _0x57bdce,IconRobotPencil as _0x2f6a93,IconSelection as tt,IconShowChangesOff as et,IconShowChangesOn as it,IconStop as st,IconSubmit as nt,IconThreeHorizontalDots as rt,IconThumbDown as ot,IconThumbUp as at,IconWeb as ht}from'@ckeditor/ckeditor5-icons';import{CKEditorError as ct,Collection as lt,DomEmitterMixin as ut,EmitterMixin as dt,FocusTracker as _t,KeystrokeHandler as gt,ObservableMixin as At,Rect as It,ResizeObserver as pt,_isMotionReduced as Et,first as mt,getConstrainedViewportRect as Tt,global as wt,insertToPriorityArray as Ct,isVisible as ft,logError as bt,logWarning as St,scrollAncestorsToShowTarget as Rt,scrollViewportToShowTarget as Ot,toArray as vt,uid as kt,version as yt}from'@ckeditor/ckeditor5-utils';import{AutocompleteView as Nt,BalloonPanelView as xt,BalloonToolbar as Lt,BodyCollection as Pt,ButtonLabelView as Dt,ButtonLabelWithHighlightView as Ht,ButtonView as Mt,Dialog as Ut,DialogViewPosition as Vt,DropdownMenuPanelPositioningFunctions as Bt,FileDialogButtonView as Gt,FocusCycler as Ft,FormHeaderView as Kt,FormRowView as Wt,HighlightedTextView as Yt,IconView as $t,InputTextView as qt,LabeledFieldView as Qt,ListItemButtonView as Xt,ListItemGroupView as zt,ListItemView as jt,ListView as Jt,MenuBarMenuListItemButtonView as Zt,MenuBarMenuListItemView as te,MenuBarMenuListView as _0x164ccd,MenuBarMenuView as _0x4888f9,SearchTextView as _0x10e0e0,SpinnerView as _0x5a896c,Template as _0x4937f3,TextareaView as _0x3a49c8,ToolbarView as _0x24660c,UIModel as _0xd62086,View as _0x4ff2da,ViewCollection as _0x50bc02,addListToDropdown as _0x3196cc,addMenuToDropdown as _0xf691cd,clickOutsideHandler as _0x341840,createDropdown as _0x5a954d,createLabeledInputText as _0x3b9224,createLabeledTextarea as _0x293ea1,submitHandler as _0x5875a6}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x592e3f,ClipboardPipeline as _0x4c2163}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0x86d081,MarkerOperation as _0x171060,Matcher as _0x1deb35,ModelDocumentFragment as _0x5eb9f7,ModelPosition as _0x53921a,ModelRange as _0x2af2ad,ModelTreeWalker as _0x2a0ccb,ViewDataTransfer as _0x381edb,ViewDocumentDomEventData as _0x2b7cc4,ViewDowncastWriter as _0x24fafe,ViewUpcastWriter as _0x10bc29,_DetachOperation as _0x19e331,_insertIntoModelNodeList as _0x1b6802,_removeFromModelNodeList as _0x4f5333,transformOperationSets as _0x3b7a23}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x54d2c3,debounce as _0x220e40,escape as _0x34830a,escapeRegExp as _0x306a2e,omit as _0x5a008a,throttle as _0x43ff3d,unescape as _0x39f176}from'es-toolkit/compat';import{createParser as _0x4df230}from'eventsource-parser';import{CloudServices as _0x1ec8f8}from'@ckeditor/ckeditor5-cloud-services';import{parseDocument as _0x5bea4e}from'htmlparser2';import{append as _0x10069f,appendChild as _0x2cdc39,find as _0x3932c0,findAll as _0x26a2ae,findOne as _0xdb5da,getChildren as _0xe31aff,getParent as _0x1f37eb,isComment as _0x36dce3,isTag as _0x438723,prepend as ti,prependChild as _0xf08298,removeElement as _0x4ebff9,replaceElement as _0x444916,textContent as _0x39a5c5}from'domutils';import _0x3a1450 from'dom-serializer';import{Document as _0x35605c,Element as _0x5b6203,NodeWithChildren as _0x4eb033,Text as _0x5be0d8,cloneNode as _0x246402,isDocument as _0x4591e9,isText as _0x8a421e}from'domhandler';import{ConfirmMixin as _0x4002ba,DATA_ID_MODEL_ATTRIBUTE as _0x4274f2,DATA_ID_VIEW_ATTRIBUTE as _0x552318,DocumentCompare as _0x5388eb,PillView as _0x18ca88,SuggestionsConversion as _0x11ff4f,fixElementSuggestionRange as _0x283dbd,getAllMarkersDomElementsSorted as _0x37a243,getMarkerDomElement as _0x196856,isInvalidAttributeOperation as _0x22fa04}from'@ckeditor/ckeditor5-collaboration-core';import{MarkdownGfmMdToHtml as _0x37f450,MarkdownGfmMdToHtmlDefaultPlugins as _0x3d6e18}from'@ckeditor/ckeditor5-markdown-gfm';import _0x158f1a from'rehype-sanitize';import _0x1f22dd from'morphdom';import{diffArrays as _0x285f11}from'diff';const vi='_ungrouppedCommands';function ki(_0x357887,_0x268fbe){const _0x28e06d=(0x0,_0x268fbe['t'])('Other');return _0x357887['length']?'groupId'in _0x357887[0x0]?_0x357887:[{'groupId':vi,'groupLabel':_0x28e06d,'order':0x1/0x0,'commands':_0x357887}]:[{'groupId':vi,'groupLabel':_0x28e06d,'order':0x1/0x0,'commands':[]}];}const yi=globalThis['DataTransfer'],Ni='ai-ui';var xi=class extends _0x19488e{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const {editor:_0x52bfea}=this,_0x4aa43f=['ck-fake-ai-selection'];_0x52bfea['config']['get']('ai.assistant.useTheme')&&_0x4aa43f['push']('ck-ai-assistant-ui_theme'),_0x52bfea['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Ni,'view':{'classes':_0x4aa43f,'priority':0xc}}),_0x52bfea['conversion']['for']('editingDowncast')['markerToElement']({'model':Ni,'view':(_0x2a3211,{writer:_0x25e036})=>{if(!_0x2a3211['markerRange']['isCollapsed'])return null;const _0x5a59f9=_0x25e036['createUIElement']('span');return _0x25e036['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x5a59f9),_0x5a59f9;}});}afterInit(){!async function(_0x3d517d){const _0x1c49ff='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x21d760=0x79158,_0x149aef=window['Date']['now'](),_0x435adf=_0x3d517d['editor'],_0x5e30bb=new window['Promise'](_0xed3f36=>{_0x435adf['once']('ready',_0xed3f36);}),_0x1c305f={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x1778db=_0x435adf['config']['get']('licenseKey');async function _0x468413(){let _0x5f2af4,_0x33d01d=null,_0x19060e=null;try{return'GPL'==_0x1778db?'NotAllowed':(_0x5f2af4=_0x29cbb6(),_0x5f2af4?(_0x5f2af4['usageEndpoint']&&(_0x19060e=_0x1ea737(_0x5f2af4['usageEndpoint'],_0x5f2af4['jti'])),await _0x17cb48()?_0x96529c()?_0x3db2c8()?'Expired':_0xbb6f8e()?('evaluation'==_0x5f2af4['licenseType']&&(_0x33d01d=_0x52faf0('EvaluationLimit')),await _0x2267fa()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x3db2c8(){const _0x39b2d4=['evaluation','trial']['includes'](_0x5f2af4['licenseType'])?_0x149aef/0x3e8:0xe10*_0x21d760;return _0x5f2af4['exp']<_0x39b2d4;}function _0x96529c(){const _0x3659ff=_0x5f2af4['features'];return!!_0x3659ff&&(!!_0x3659ff['includes']('*')||!!_0x3659ff['includes']('AI'));}function _0xbb6f8e(){const _0x50d4bb=_0x5f2af4['licensedHosts'];if(!_0x50d4bb||0x0==_0x50d4bb['length'])return!0x0;const {hostname:_0x255005}=new URL(window['location']['href']);if(_0x50d4bb['includes'](_0x255005))return!0x0;const _0x17cac0=_0x255005['split']('.');return _0x50d4bb['filter'](_0x483026=>_0x483026['includes']('*'))['map'](_0x3e52cf=>_0x3e52cf['split']('.'))['filter'](_0x2bf42b=>_0x2bf42b['length']<=_0x17cac0['length'])['map'](_0x4986d0=>Array(_0x17cac0['length']-_0x4986d0['length'])['fill']('*'===_0x4986d0[0x0]?'*':'')['concat'](_0x4986d0))['some'](_0x2ad81a=>_0x17cac0['every']((_0x231085,_0x496b0a)=>_0x2ad81a[_0x496b0a]===_0x231085||'*'===_0x2ad81a[_0x496b0a]));}function _0x2267fa(){return _0x33d01d&&_0x19060e?new window['Promise']((_0x42ecfb,_0x22492a)=>{_0x33d01d['then'](_0x42ecfb,_0x22492a),_0x19060e['then'](_0xbf8894=>{'Valid'!=_0xbf8894&&_0x42ecfb(_0xbf8894);},_0x22492a);}):_0x33d01d||_0x19060e||'Valid';}}function _0x1ea737(_0x37bca2,_0x4bd4ea){return new window['Promise'](_0x1df9d0=>{if(_0x236e07())return _0x1df9d0('Valid');_0x4f13d0(),_0x435adf['decorate']('_sendUsageRequest');let _0x4191bb=!0x1;const _0x2f6863=kt();function _0x29870d(_0xaa6ae4){return!!_0xaa6ae4&&('object'==typeof _0xaa6ae4||'function'==typeof _0xaa6ae4)&&'function'==typeof _0xaa6ae4['then']&&'function'==typeof _0xaa6ae4['catch'];}function _0x2b1f77(_0x12b0f7){_0x2f83e2(_0x12b0f7)['then'](_0x4905b3=>_0x4905b3&&'ok'==_0x4905b3['status']?_0x423d58(_0x42b23b(_0x2f6863+_0x4bd4ea))!=_0x4905b3['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0xe69150=>(_0x36bd8e(),_0xe69150),()=>{const _0x5cc4b4=_0x4425b4();return null==_0x5cc4b4?(_0x36bd8e(),'Valid'):_0x149aef-_0x5cc4b4>0x240c8400?'UsageLimit':'Valid';})['then'](_0x1df9d0)['catch'](()=>{_0x1df9d0('UsageLimit');});const _0x3342a1=0x36ee80;function _0x36bd8e(){const _0x1a1562='llct-'+_0x423d58(_0x42b23b(_0x37bca2)),_0xb51964=_0x3be111(_0x423d58(window['Math']['ceil'](_0x149aef/_0x3342a1)));window['localStorage']['setItem'](_0x1a1562,_0xb51964);}function _0x4425b4(){const _0xaaa990='llct-'+_0x423d58(_0x42b23b(_0x37bca2)),_0x1683a7=window['localStorage']['getItem'](_0xaaa990);return _0x1683a7?window['parseInt'](_0x3be111(_0x1683a7),0x10)*_0x3342a1:null;}function _0x2f83e2(_0x3a51d1){return new window['Promise']((_0x318ba1,_0x6d5bc)=>{_0x3a51d1['then'](_0x318ba1,_0x6d5bc),window['setTimeout'](_0x6d5bc,0x1d4c0);});}}_0x435adf['on']('_sendUsageRequest',(_0x3d8b8f,_0x2f6d7b)=>{if(_0x2f6d7b[0x0]!=_0x37bca2)return _0x1df9d0('UsageLimit');_0x2f6d7b[0x1]={..._0x2f6d7b[0x1],'requestId':_0x2f6863};},{'priority':'high'}),_0x435adf['on']('_sendUsageRequest',_0x1016b0=>{_0x29870d(_0x1016b0['return'])&&(_0x4191bb=!0x0,_0x2b1f77(_0x1016b0['return']));},{'priority':'low'}),_0x5e30bb['then'](()=>{_0x4191bb||_0x1df9d0('UsageLimit');});});function _0x236e07(){return'auto'==_0x435adf['editing']['view']['_overlayModeHint'];}function _0x4f13d0(){_0x435adf['editing']['view']['_overlayModeHint']='auto';}}function _0x52faf0(_0xf35e03){const _0x2692dd=[new window['Promise'](_0x2e646f=>setTimeout(_0x2e646f,0x93ecc)),_0x5e30bb['then'](()=>new window['Promise'](_0x481eeb=>{let _0x544402=0x0;_0x435adf['model']['on']('applyOperation',(_0x24d184,_0x533dc7)=>{_0x533dc7[0x0]['isDocumentOperation']&&_0x544402++,0x5e8==_0x544402&&(_0x481eeb(),_0x24d184['off']());});}))];return window['Promise']['race'](_0x2692dd)['then'](()=>_0xf35e03);}async function _0x4c8ae3(){await _0x5e30bb,_0x435adf['model']['change']=_0x40229b,_0x435adf['model']['enqueueChange']=_0x40229b,_0x435adf['enableReadOnlyMode']('model');}function _0x3b66ab(_0x5c9ea2){const _0x86125c=_0x4c8244();_0x435adf[_0x86125c]='aiLicenseKey'+_0x5c9ea2,'Valid'!=_0x5c9ea2&&_0x4c8ae3();}function _0x4c8244(){const _0x600a20=window['String'](window['performance']['now']())['replace']('.','');let _0x1822bf='n';for(let _0x309690=0x0;_0x309690<_0x600a20['length'];_0x309690+=0x2){let _0x3b2bae=window['parseInt'](_0x600a20['substring'](_0x309690,_0x309690+0x2));_0x3b2bae>=0x3e&&(_0x3b2bae-=0x3e),_0x1822bf+=_0x1c49ff[_0x3b2bae];}return _0x1822bf;}function _0x29cbb6(){const _0x440ebc=_0x1778db['split']('.');if(0x3!=_0x440ebc['length'])return null;return _0x48a2e5(_0x440ebc[0x1]);function _0x48a2e5(_0x15b816){const _0x4e4b51=_0x44f231(_0x15b816);return _0x4e4b51&&_0x218bfa()?_0x4e4b51:null;function _0x218bfa(){const _0xcb66e1=_0x4e4b51['jti'],_0x117ed5=window['parseInt'](_0xcb66e1['substring'](_0xcb66e1['length']-0x8),0x10),_0x2dbfc3={..._0x4e4b51,'jti':_0xcb66e1['substring'](0x0,_0xcb66e1['length']-0x8)};return delete _0x2dbfc3['vc'],_0x42b23b(_0x2dbfc3)==_0x117ed5;}}}async function _0x17cb48(){let _0x2ff706=!0x0;try{const [_0x3913f7,_0xc24d01,_0x2bfd63]=_0x1778db['split']('.');return _0x1a4c02(_0x3913f7),await _0x17079b(_0x3913f7,_0xc24d01,_0x2bfd63),_0x2ff706;}catch{return!0x1;}function _0x1a4c02(_0x5747f8){const _0x1c7b28=_0x44f231(_0x5747f8);_0x1c7b28&&'ES256'==_0x1c7b28['alg']||(_0x2ff706=!0x1);}async function _0x17079b(_0x145244,_0x5b15b0,_0xc2c1b1){const _0x1ebfc0=window['Uint8Array']['from'](_0x43a028(_0xc2c1b1),_0x1d3b02=>_0x1d3b02['charCodeAt'](0x0)),_0x2d04cd=new window['TextEncoder']()['encode'](_0x145244+'.'+_0x5b15b0),_0x420dee=window['crypto']['subtle'];if(!_0x420dee)return;const _0x4d921c=await _0x420dee['importKey']('jwk',_0x1c305f,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x420dee['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x4d921c,_0x1ebfc0,_0x2d04cd)||(_0x2ff706=!0x1);}}function _0x44f231(_0xcba195){return _0xcba195['startsWith']('ey')?JSON['parse'](_0x43a028(_0xcba195)):null;}function _0x43a028(_0x357638){return window['atob'](_0x357638['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x42b23b(_0xc6f15b){let _0x5edff2=0x1505;function _0xced889(_0x20b691){for(let _0xf2c576=0x0;_0xf2c576<_0x20b691['length'];_0xf2c576++){const _0x1ef0d2=_0x20b691['charCodeAt'](_0xf2c576);_0x5edff2=(_0x5edff2<<0x5)+_0x5edff2+_0x1ef0d2,_0x5edff2&=_0x5edff2;}}function _0x14b312(_0x53e592){Array['isArray'](_0x53e592)?_0x53e592['forEach'](_0x14b312):_0x53e592&&'object'==typeof _0x53e592?Object['entries'](_0x53e592)['sort']()['forEach'](([_0x106fc7,_0x37086b])=>{_0xced889(_0x106fc7),_0x14b312(_0x37086b);}):_0xced889(window['String'](_0x53e592));}return _0x14b312(_0xc6f15b),_0x5edff2>>>0x0;}function _0x423d58(_0x423360){return _0x423360['toString'](0x10)['padStart'](0x8,'0');}function _0x3be111(_0x2407e9){return _0x2407e9['split']('')['reverse']()['join']('');}function _0x40229b(){}_0x3b66ab(await _0x468413());}(this);}showFakeVisualSelection(){const _0x70fe68=this['editor']['model'];_0x70fe68['change'](_0x2cd3e3=>{const _0x44a2f5=_0x70fe68['document']['selection']['getRanges']();let _0x3dd1f5=0x0;for(const _0x1d2f8c of _0x44a2f5){const _0x1ee7f9=Ni+':'+_0x3dd1f5;if(_0x70fe68['markers']['has'](_0x1ee7f9))_0x2cd3e3['updateMarker'](_0x1ee7f9,{'range':_0x1d2f8c});else{if(_0x1d2f8c['start']['isAtEnd']){const _0x2833ed=_0x1d2f8c['start']['getLastMatchingPosition'](({item:_0x558080})=>!_0x70fe68['schema']['isContent'](_0x558080),{'boundaries':_0x1d2f8c});_0x2cd3e3['addMarker'](_0x1ee7f9,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x2cd3e3['createRange'](_0x2833ed,_0x1d2f8c['end'])});}else _0x2cd3e3['addMarker'](_0x1ee7f9,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x1d2f8c});}_0x3dd1f5++;}});}hideFakeVisualSelection(){const _0x50f8bb=this['editor']['model'],_0x28a8d8=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Ni));_0x28a8d8['length']&&_0x50f8bb['change'](_0x29f642=>{_0x28a8d8['forEach'](_0xf7b4cb=>{_0x29f642['removeMarker'](_0xf7b4cb);});});}insertContent(_0x2647b6,_0x39591b){const _0x312eeb=this['_getAISelection'](),_0x117e82=_0x39591b||_0x312eeb['getFirstRange']();this['editor']['model']['canEditAt'](_0x117e82)&&this['editor']['model']['change'](_0x1ec9fe=>{this['hideFakeVisualSelection'](),_0x39591b||this['_resetContentOfSelectedTableCells'](_0x1ec9fe,_0x312eeb),this['_pasteHTMLUsingClipboard']({'insertAt':_0x117e82,'writer':_0x1ec9fe,'html':_0x2647b6});});}insertContentBelow(_0x430f50){const {model:_0xf1dd20}=this['editor'],_0x2d7d13=this['_getAISelection']();_0xf1dd20['change'](()=>{const _0x5a5811=this['_prepareTableInsertBelowPosition'](_0x430f50,_0x2d7d13)||this['_getDefaultInsertBelowPosition'](_0x2d7d13);this['insertContent'](_0x430f50,_0x5a5811);});}_getAISelection(){const _0x142e01=this['editor']['model'],_0x168e8c=Array['from'](_0x142e01['markers']['getMarkersGroup'](Ni))['map'](_0x3fea1f=>_0x3fea1f['getRange']());return _0x142e01['createSelection'](_0x168e8c);}_pasteHTMLUsingClipboard({writer:_0xa98a58,html:_0x1f0d57,insertAt:_0x492bf2}){const {view:_0x716878}=this['editor']['editing'],_0x26f380=this['editor']['plugins']['get'](_0x4c2163),_0x25dbf1=new yi();_0x25dbf1['setData']('text/html',_0x1f0d57);const _0x182a74=new _0x2b7cc4(_0x716878,new ClipboardEvent('paste',{'clipboardData':_0x25dbf1}),{'dataTransfer':new _0x381edb(_0x25dbf1)});_0xa98a58['setSelection'](_0x492bf2);const _0x269613=(_0x55aef9,_0x2cd437)=>{_0x2cd437['resultRange']&&_0xa98a58['setSelection'](_0x2cd437['resultRange']);};_0x26f380['once']('contentInsertion',_0x269613,{'priority':'lowest'}),_0x716878['document']['fire']('paste',_0x182a74),_0x26f380['off']('contentInsertion',_0x269613);}_getDefaultInsertBelowPosition(_0x2c1598){const {model:_0x50a60a}=this['editor'],_0xf42edb=Array['from'](_0x2c1598['getSelectedBlocks']());return _0xf42edb['length']?_0x50a60a['createPositionAfter'](_0xf42edb['pop']()):_0x2c1598['getLastPosition']();}_prepareTableInsertBelowPosition(_0x2cb961,_0x2a90f9){const {model:_0x909e43,plugins:_0x4f8bf1}=this['editor'];if(_0x4f8bf1['has']('TableUtils')){const _0x4ff77d=_0x4f8bf1['get']('TableUtils')['getSelectedTableCells'](_0x2a90f9);if(_0x4ff77d['length']){const _0x48829b=this['_getTableRowCountFromContent'](_0x2cb961),_0x262076=this['_createEmptyTableRows'](_0x4ff77d,_0x48829b);return _0x909e43['createPositionAt'](_0x262076,0x0);}}return null;}_getTableRowCountFromContent(_0x29035d){const _0x11ac89=this['editor']['plugins']['get']('TableUtils'),_0x1304fe=this['editor']['data']['parse'](_0x29035d,'$documentFragment'),_0x149053=Array['from'](_0x1304fe['getChildren']())['filter'](_0x483bc8=>_0x483bc8['is']('element','table'));let _0x45ac59=0x0;return _0x149053['forEach'](_0x2b8eb1=>{_0x45ac59+=_0x11ac89['getRows'](_0x2b8eb1);}),_0x45ac59;}_createEmptyTableRows(_0x27d15c,_0x4bd120){const _0x3d48ae=this['editor']['plugins']['get']('TableUtils'),_0x701ed5=_0x3d48ae['getRowIndexes'](_0x27d15c),_0x5a8299=_0x3d48ae['getColumnIndexes'](_0x27d15c),_0x1d127f=_0x701ed5['last']+0x1,_0x2bddc9=_0x5a8299['first'],_0x2250c3=_0x27d15c[0x0]['findAncestor']('table');for(let _0xa0ee37=0x0;_0xa0ee37<_0x4bd120;_0xa0ee37++)_0x3d48ae['insertRows'](_0x2250c3,{'at':_0x1d127f});return _0x2250c3['getChild'](_0x1d127f)['getChild'](_0x2bddc9);}_resetContentOfSelectedTableCells(_0x106ad9,_0x1ae439){const {plugins:_0x3312bb}=this['editor'],{model:_0x1c1d97}=_0x106ad9;_0x3312bb['has']('TableUtils')&&_0x3312bb['get']('TableUtils')['getSelectedTableCells'](_0x1ae439)['length']&&_0x1c1d97['deleteContent'](_0x1ae439);}},Li=class extends _0x19488e{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}afterInit(){if(!this['textAdapter'])throw new ct('aiadapter-text-adapter-not-set',null);}},Pi=class extends Error{constructor(_0x557dca){super(_0x557dca),this['name']='AIRequestError';}};function Di(_0x254e9d,_0x2b8067,_0x47d95e){const t=_0x254e9d['t'];switch(_0x2b8067){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',_0x47d95e);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x47d95e);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'},_0x47d95e);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 _0x2b8067;}}var Hi=class extends _0x2d31d9{_commandDefinitions;constructor(_0x1b8536,_0x47ebcd){super(_0x1b8536),this['_commandDefinitions']=_0x47ebcd,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x357eaa,_0x4ae7a6,_0x579070)=>{this['isEnabled']&&(this['enabledCommandsIds']=Mi(this['_commandDefinitions'],_0x579070));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x368be6,_0x56f24a,_0x4688e4)=>{this['enabledCommandsIds']=_0x4688e4?Mi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x2a4a7b=this['editor']['model'];this['_hasContext']=function(_0x52bcf5){const _0x2be887=_0x52bcf5['document']['selection'];return _0x2be887['isCollapsed']?0x0!==[..._0x2be887['getSelectedBlocks']()]['length']&&![..._0x2be887['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x52bcf5['hasContent'](_0x2be887['getFirstRange']());}(_0x2a4a7b);const _0xa2ade2=_0x2a4a7b['document']['selection'],_0x32a563=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x22d815 of _0xa2ade2['getRanges']())for(const _0x21cf15 of _0x22d815['getItems']())if(_0x21cf15['is']('element')&&_0x32a563['includes'](_0x21cf15['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}execute(_0x1e5dae='',_0x7004be='',_0x3ee9b9='custom'){this['editor']['plugins']['get'](ts)['showUI'](_0x1e5dae,_0x7004be,_0x3ee9b9);}};function Mi(_0x396496,_0x34bba7){const _0x4bae13=new Set();for(const _0x44e24d of _0x396496['values']())(_0x34bba7||!0x1===_0x44e24d['requiresContent'])&&_0x4bae13['add'](_0x44e24d['id']);return Array['from'](_0x4bae13);}const Ui=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is'),Vi=/* #__PURE__ -- @preserve */
|
|
24
|
+
At();var Bi=class extends Vi{editor;textAdapter;['view'];_sanitizationContainer;['_domParser'];['_xmlSerializer'];constructor(_0x484f5b,_0x4ac0ec,_0x363f68){super(),this['editor']=_0x484f5b,this['textAdapter']=_0x4ac0ec,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x363f68,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x150750,_0x4b5b74,_0x6707f9)=>{this['view']['value']=this['_sanitizeHTML'](_0x6707f9);}),this['listenTo'](this['view'],'submitPrompt',(_0x393d01,_0x47910b)=>{const _0x5450f5=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x47910b,_0x5450f5,'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:_0x3531e8,query:_0x3d973d,htmlContent:_0x509fa5,label:_0x2cbea4,mainActionLabel:_0x42865b}){this['view']['prompt']=_0x2cbea4,this['view']['mainAction']=_0x42865b,this['initialContext']=_0x509fa5,_0x3d973d&&(this['view']['isRendered']?this['_handleQuery'](_0x3d973d,_0x509fa5,_0x3531e8,_0x2cbea4):this['view']['once']('render',()=>{this['_handleQuery'](_0x3d973d,_0x509fa5,_0x3531e8,_0x2cbea4);}));}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'](_0x288d51,_0x2aee1d,_0x4cad55,_0x10bf6a){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x2aee1d,this['previousQuery']=_0x288d51,this['previousLabel']=_0x10bf6a||_0x288d51,this['previousActionId']=_0x4cad55,new Promise(_0xa35e43=>{this['textAdapter']['makeRequest']({'query':_0x288d51,'context':_0x2aee1d,'onData':_0x5def3e=>{this['currentResponse']=_0x5def3e,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x4cad55})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x1b01c0=>{_0x1b01c0 instanceof Pi?this['view']['handleError'](_0x1b01c0['message']):this['view']['handleError'](),_0xa35e43();})['finally'](()=>{this['stopProcessing'](),_0xa35e43();});});}_parseAndNormalizeContent(_0x613a60,_0x33af43=!0x1){const _0x3010d5=Ui['exec'](_0x613a60);_0x613a60=_0x3010d5?_0x613a60['substring'](_0x3010d5[0x1]['length']):_0x613a60['length']<0x64&&!_0x33af43?'':this['_stripMarkdownSyntax'](_0x613a60);const _0x5f4bdb=this['_domParser']['parseFromString'](_0x613a60,'text/html');if(_0x3010d5){const _0x55d0c6=Array['from'](_0x5f4bdb['body']['childNodes']);_0x55d0c6['reverse']();for(const _0x27daa7 of _0x55d0c6){if(_0x27daa7['nodeType']==Node['ELEMENT_NODE'])break;_0x27daa7['remove']();}}const _0x384f96=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x5f4bdb['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x384f96);const _0x4e2595=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x1f929e=this['editor']['data']['toModel'](_0x384f96);return _0x4e2595||_0x1f929e['markers']['clear'](),this['editor']['data']['stringify'](_0x1f929e);}['_normalizeResponseHeadings'](_0x449471){const _0x109a85=new _0x10bc29(this['editor']['editing']['view']['document']),_0x2303a0=new _0x1deb35({'name':/^h[1-5]$/}),_0x591df7=[];let _0xc61a04=!0x1;for(const _0x9ec2d5 of _0x449471)_0x9ec2d5['is']('element')&&_0x2303a0['match'](_0x9ec2d5)&&(_0x591df7['push'](_0x9ec2d5),'h1'==_0x9ec2d5['name']&&(_0xc61a04=!0x0));if(_0xc61a04){for(const _0x590824 of _0x591df7)_0x109a85['rename']('h'+(parseInt(_0x590824['name'][0x1])+0x1),_0x590824);}}_isH1TagSupportEnabled(){const {data:_0x1de5cf,editing:_0xd87017}=this['editor'],_0x475697=_0x1de5cf['htmlProcessor']['toView']('<h1></h1>'),_0x48a796=_0x1de5cf['toView'](_0x1de5cf['toModel'](_0x475697));return!!_0xd87017['view']['domConverter']['viewToDom'](_0x48a796)['querySelector']('h1');}_sanitizeHTML(_0x552711){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x552711),this['_sanitizationContainer']['innerHTML'];}_stripMarkdownSyntax(_0x105187){const _0x1e1659=_0x105187['trim']();return _0x1e1659['startsWith']('```html')?_0x1e1659['endsWith']('```')?_0x1e1659['substring'](0x7,_0x1e1659['length']-0x3):_0x1e1659['substring'](0x7):_0x105187;}};const Gi={'REPLACE':'replace','INSERT':'insert'};var Fi=class extends _0x24660c{constructor(_0x55266e){super(_0x55266e),this['set']('isVisible',!0x1),this['set']('mainAction',Gi['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x276057=>Di(_0x55266e,'AI_'+_0x276057['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Di(_0x55266e,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Di(_0x55266e,'Try\x20again')),this['stopButton']=this['_createButton'](Di(_0x55266e,'Stop'));const _0x3e709c=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x3e709c['if']('isVisible','ck-hidden',_0x97d592=>!_0x97d592)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}_createButton(_0x568593,_0x35eec5){const _0xbb1f88=new Mt(this['locale']);return _0xbb1f88['set']({'label':_0x568593,'class':_0x35eec5||'','isVisible':!0x0,'withText':!0x0}),_0xbb1f88;}},Ki=class extends _0x4ff2da{contentFieldView;copyButtonView;constructor(_0xce1471,_0x5022b7=''){super(_0xce1471),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x56bc44=this['bindTemplate'];this['contentFieldView']=new Wi(_0xce1471,_0x5022b7),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x56bc44['if']('isVisible','ck-hidden',_0x15be2c=>!_0x15be2c)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x56bc44['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 _0x556cb7=!0x1;this['on']('change:value',(_0x58b2de,_0x3e46c1,_0x4f951b)=>{const _0x4c0381=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x4f951b),this['isProcessing']&&_0x4c0381&&!_0x556cb7&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x43171a,_0x25a113,_0x169451)=>{_0x556cb7=!0x1,_0x169451?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x556cb7=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x556cb7=!0x0;});}['focus'](){this['element']['focus']();}_createCopyButton(){const _0x2a8795=this['locale'],_0x4cef5b=new Mt(this['locale']),_0x5d1edb='ck-ai-form__copy-button';return _0x4cef5b['set']({'label':Di(_0x2a8795,'Copy'),'icon':_0x208a90,'class':_0x5d1edb,'tooltip':!0x0}),_0x4cef5b['bind']('isVisible')['to'](this,'value',_0x14b113=>!!_0x14b113),_0x4cef5b['bind']('isEnabled')['to'](this,'isProcessing',_0x1457eb=>!_0x1457eb),_0x4cef5b['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x4cef5b['icon']=_0x5517bf,_0x4cef5b['class']=_0x5d1edb+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x4cef5b['icon']=_0x208a90,_0x4cef5b['class']=_0x5d1edb;},0x3e8);}),_0x4cef5b;}['_copyHTMLToClipboard'](_0x2746f4){const {window:_0x121056,document:_0x2e8b8b}=wt;if(_0x121056['ClipboardItem']){const {Blob:_0x5cd857,ClipboardItem:_0x105e9e}=_0x121056,_0x5971d7=[new _0x105e9e({'text/html':new _0x5cd857([_0x2746f4['innerHTML']],{'type':'text/html'}),'text/plain':new _0x5cd857([_0x2746f4['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x5971d7);}else{const _0x6b9616=_0x2e8b8b['createElement']('div');_0x6b9616['style']['position']='absolute',_0x6b9616['style']['left']='-9999px',_0x6b9616['innerHTML']='<span>[</span>'+_0x2746f4['innerHTML']+'<span>]</span>',_0x2e8b8b['body']['appendChild'](_0x6b9616);const _0x20da04=_0x2e8b8b['createRange']();_0x20da04['setStartAfter'](_0x6b9616['firstElementChild']),_0x20da04['setEndBefore'](_0x6b9616['lastElementChild']);const _0x2f254a=_0x121056['getSelection']();_0x2f254a['removeAllRanges'](),_0x2f254a['addRange'](_0x20da04),_0x2e8b8b['execCommand']('copy'),_0x6b9616['remove']();}}},Wi=class extends _0x4ff2da{constructor(_0x20b8df,_0x551ba0=''){super(_0x20b8df),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x551ba0,'ck-reset_all-excluded','ck-ai-form__content-field']}});}setContent(_0xf8cc5){this['element']['innerHTML']=_0xf8cc5;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}_createLoader(){const _0x9d72e2=new _0x4ff2da(),_0x31c1eb=this['locale'],_0x11898e=new _0x5a896c();return _0x11898e['isVisible']=!0x0,_0x9d72e2['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x11898e,{'text':Di(_0x31c1eb,'AI\x20is\x20writing...')}]}),_0x9d72e2['render'](),_0x9d72e2;}},Yi=class extends _0x4ff2da{constructor(_0x20f120,_0x1bba04=''){super(_0x20f120);const _0x45392f=new $t(),_0xe5f016=this['bindTemplate'];this['set']('text',_0x1bba04),_0x45392f['content']=_0x4f387d,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x45392f,{'text':_0xe5f016['to']('text')}]});}},$i=class extends Nt{submitButtonView;showHistoryButtonView;constructor(_0x5aa36a,_0x5a1804){super(_0x5aa36a,_0x5a1804),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',(_0x4eeecf,_0x161715)=>{_0x4eeecf['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x161715());});}_createSubmitButton(){const _0x37d040=new Mt(this['locale']),_0x12bf80=this['locale'];return _0x37d040['set']({'icon':nt,'label':Di(_0x12bf80,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x37d040['on']('execute',()=>{this['submit']();}),_0x37d040['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x5f4f46,_0x1a6610)=>!_0x5f4f46&&_0x1a6610),_0x37d040;}_createShowHistoryButton(){const _0x401741=new Mt(this['locale']),_0x48ad0b=this['resultsView'],_0x5b0d42=this['locale'];_0x401741['set']({'label':Di(_0x5b0d42,'History'),'withText':!0x1,'icon':_0x462166,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x401741['bind']('isOn')['to'](_0x48ad0b,'isVisible'),_0x401741['bind']('isEnabled')['to'](this,'isEnabled'),_0x401741['on']('execute',()=>{_0x48ad0b['isVisible']=!_0x48ad0b['isVisible'],_0x48ad0b['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x1d1585=()=>{wt['window']['requestAnimationFrame'](()=>{if(ft(this['element'])){const _0xda5055=new It(this['queryView']['fieldView']['element']),_0x58862b=_0xda5055['width'],_0xc3ce7f='rtl'===_0x5b0d42['uiLanguageDirection']?'left':'right';_0xda5055['excludeScrollbarsAndBorders'](),_0x401741['element']['style'][_0xc3ce7f]=_0x58862b-_0xda5055['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x1d1585),this['on']('render',_0x1d1585),_0x401741;}submit(){const _0x427a16=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x427a16);}['focus'](_0x17f4fd){-0x1===_0x17f4fd?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},qi=class extends Jt{historyGroupView;clearHistoryButton;constructor(_0x44d49d){super(_0x44d49d),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new zt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Di(_0x44d49d,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}filter(){let _0x1cb7bf=0x0;for(const _0xd540bf of this['items'])_0x1cb7bf+=_0xd540bf['items']['length'];return{'resultsCount':_0x1cb7bf,'totalItemsCount':_0x1cb7bf};}_createClearHistoryButton(){const _0x174c39=this['locale'],_0x421920=new Mt(this['locale']);return _0x421920['set']({'label':'('+Di(_0x174c39,'Clear')+')','withText':!0x0}),_0x421920['on']('execute',()=>this['fire']('clearHistory')),_0x421920;}},Qi=class extends jt{constructor(_0x2a76b3){super();const _0x204991=new Dt(),_0x466036=new Mt(this['locale'],_0x204991);this['children']['add'](_0x466036),_0x466036['set']({'label':_0x2a76b3['prompt'],'withText':!0x0}),_0x466036['on']('execute',()=>{this['fire']('execute',{'value':_0x39f176(_0x2a76b3['prompt'])});});}};const Xi='CKEditor/AIFormView/PromptHistory';var zi=class extends lt{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x5d5e1b,_0x5f18c0)=>{const _0x1c528a=ji(_0x5f18c0['prompt']);for(const _0x204962 of this)if(_0x204962!=_0x5f18c0&&ji(_0x204962['prompt'])===_0x1c528a){this['remove'](_0x204962);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}_loadFromSessionStorage(){const _0x134e06=sessionStorage['getItem'](Xi)||'[]';this['addMany'](JSON['parse'](_0x134e06));}_saveToSessionStorage(){sessionStorage['setItem'](Xi,JSON['stringify'](this['map'](_0x41c583=>_0x41c583)));}};function ji(_0x14d295){return _0x14d295['toLowerCase']()['trim']();}var Ji=class extends _0x4ff2da{['focusTracker'];keystrokes;contentArea;toolbar;promptView;['errorView'];['_focusables'];['focusCycler'];_promptHistory;constructor(_0x1be416,_0x5aca3c,_0x48b640=''){super(_0x1be416),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',Gi['REPLACE']),this['_promptHistory']=new zi(),this['errorView']=new Yi(_0x1be416),this['contentArea']=new Ki(_0x1be416,_0x48b640),this['contentArea']['bind']('isProcessing')['to'](this),this['contentArea']['bind']('value')['to'](this),this['toolbar']=this['_createToolbar'](),this['toolbar']['bind']('mainAction')['to'](this),this['promptView']=this['_createPromptView'](),this['focusTracker']=new _t(),this['keystrokes']=new gt(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Ft({'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 _0xcbde24=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x5aca3c],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0xcbde24['if']('isError','ck-hidden',_0x2ccd56=>!_0x2ccd56)]},'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'](_0x4ff7b1=0x1){-0x1===_0x4ff7b1?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 _0x3f1dac=this['locale'],_0x1b48af=new $i(_0x3f1dac,{'queryView':{'label':Di(_0x3f1dac,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x293ea1,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Di(_0x3f1dac,'Empty\x20history'),'secondary':Di(_0x3f1dac,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x1b48af['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x57afee,_0x21dd7e)=>_0x57afee&&!_0x21dd7e),this['listenTo'](_0x1b48af,'submit',(_0x35732b,_0x463ea2)=>{this['prompt']=_0x463ea2;const _0x137c80=_0x34830a(_0x463ea2);this['fire']('submitPrompt',_0x137c80),_0x463ea2['trim']()&&this['_promptHistory']['add']({'prompt':_0x137c80},0x0);},{'priority':'high'}),_0x1b48af;}_createHistoryView(){const _0x4ca751=new qi(this['locale']);return _0x4ca751['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Qi),_0x4ca751['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x4ca751;}_createToolbar(){const _0x20ba05=new Fi(this['locale']);return _0x20ba05['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0xc70851,_0x136c2d,_0x47b31e)=>_0xc70851&&!_0x136c2d&&!!_0x47b31e),_0x20ba05['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x20ba05['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x2ab3b6,_0x544de1,_0x209522)=>_0x2ab3b6&&!_0x544de1&&!!_0x209522),_0x20ba05['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x20ba05['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x308be3,_0x1b2bfd)=>_0x308be3&&!_0x1b2bfd),_0x20ba05['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x20ba05['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x20ba05['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x20ba05;}startProcessing(){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x38a364=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Di(_0x38a364,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x214736){const _0x38bc65=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x214736||Di(_0x38bc65,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const Zi=globalThis['DataTransfer'];var ts=class extends _0x19488e{['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[_0x592e3f,xi,Li,Ut];}constructor(_0x8a7496){super(_0x8a7496),_0x8a7496['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x8a7496['config']['define']('ai.assistant.contentAreaCssClass',''),_0x8a7496['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x8a7496['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}init(){const {editor:_0x318123}=this;this['_aiAdapter']=_0x318123['plugins']['get'](Li),this['_dialog']=_0x318123['plugins']['get'](Ut),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x361d3d=new Hi(_0x318123,Array['from'](this['_commandDefinitions']['values']()));_0x318123['commands']['add']('showAIAssistant',_0x361d3d),_0x318123['ui']['componentFactory']['add']('aiCommands',_0x292d4c=>{const _0x28faaa=_0x5a954d(_0x292d4c);return _0x28faaa['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x28faaa['buttonView']['set']({'label':Di(_0x292d4c,'AI\x20Commands'),'icon':_0x49d247,'tooltip':!0x0}),_0x28faaa['on']('execute',_0x2cf875=>this['_onExecute'](_0x2cf875['source']['id'])),_0xf691cd(_0x28faaa,_0x318123['ui']['view']['body'],function(_0x2b2523){const _0xe1bbee=is(_0x2b2523,ki(_0x2b2523['config']['get']('ai.assistant.commands'),_0x2b2523['locale']))['filter'](_0x59d5fb=>_0x59d5fb['commands']['length']);return 0x1===_0xe1bbee['length']?is(_0x2b2523,_0xe1bbee[0x0]['commands'])['map'](_0x25d25d=>({'id':_0x25d25d['id'],'label':_0x25d25d['label']})):_0xe1bbee['map'](_0x5838f2=>{const {groupId:_0xa05216,groupLabel:_0x556423,commands:_0x54c228}=_0x5838f2,_0xea9b5=is(_0x2b2523,_0x54c228)['map'](_0x2c7b3d=>({'id':_0x2c7b3d['id'],'label':_0x2c7b3d['label']}));return{'id':_0xa05216,'menu':_0x556423||_0xa05216,'children':_0xea9b5};});}(_0x318123),{'ariaLabel':Di(_0x292d4c,'AI\x20Commands')}),_0x28faaa['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x361d3d['on']('change:enabledCommandsIds',_0x5d12fa),_0x28faaa['menuView']['once']('render',_0x5d12fa),_0x28faaa;function _0x5d12fa(){_0x28faaa['isEnabled']=_0x361d3d['enabledCommandsIds']['length']>0x0;for(const _0x42573a of _0x28faaa['menuView']['buttons'])_0x42573a['isEnabled']=_0x361d3d['enabledCommandsIds']['includes'](_0x42573a['id']);}}),_0x318123['ui']['componentFactory']['add']('menuBar:aiCommands',_0x514a9b=>{const _0x1aabad=new _0x4888f9(_0x514a9b);_0x1aabad['buttonView']['set']({'label':Di(_0x514a9b,'AI\x20Commands'),'icon':_0x49d247}),_0x1aabad['bind']('isEnabled')['to'](_0x361d3d,'enabledCommandsIds',_0x464fd8=>_0x464fd8['length']>0x0);const _0x58d61c=ki(_0x318123['config']['get']('ai.assistant.commands'),_0x514a9b);return this['_populateMenuBarMenu'](_0x361d3d,_0x1aabad,_0x58d61c,_0x56fb1b=>this['_onExecute'](_0x56fb1b)),_0x1aabad;}),_0x318123['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x468ab3=this['_createAIAssistantUIButton'](Mt);return _0x468ab3['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x468ab3;}),_0x318123['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x1263c9=this['_createAIAssistantUIButton'](Zt);return _0x1263c9['set']({'role':'menuitemcheckbox'}),_0x1263c9;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x29c14d=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x28a8d4;for(const _0x1f9af1 in _0x29c14d){const _0x5e7614=_0x1f9af1,_0x4a4a0f=_0x29c14d[_0x5e7614];if('aiLicenseKeyValid'==_0x4a4a0f||'aiLicenseKeyInvalid'==_0x4a4a0f||'aiLicenseKeyExpired'==_0x4a4a0f||'aiLicenseKeyDomainLimit'==_0x4a4a0f||'aiLicenseKeyNotAllowed'==_0x4a4a0f||'aiLicenseKeyEvaluationLimit'==_0x4a4a0f||'aiLicenseKeyUsageLimit'==_0x4a4a0f){delete _0x29c14d[_0x5e7614],_0x28a8d4=_0x4a4a0f,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x28a8d4&&_0x29c14d['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x28a8d4&&_0x29c14d['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x28a8d4&&_0x29c14d['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x28a8d4&&_0x29c14d['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x28a8d4&&_0x29c14d['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x28a8d4&&_0x29c14d['_showLicenseError']('usageLimit');},0x3e8);}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x576066='',_0x9715d9='',_0x346155='custom'){const _0x5ef78e=this['editor'],_0x5cd5d8=_0x5ef78e['editing']['view'],_0x4e6c74=_0x5ef78e['plugins']['get'](xi),_0x19658c=_0x5ef78e['plugins']['get'](_0x592e3f);_0x4e6c74['showFakeVisualSelection']();const _0x428697=new Zi(),_0x2f785f=new ClipboardEvent('copy',{'clipboardData':_0x428697}),_0x5c9cfb=new _0x381edb(_0x428697),_0x32e5e3=new _0x2b7cc4(_0x5cd5d8,_0x2f785f,{'dataTransfer':_0x5c9cfb});_0x19658c['_forceMarkersCopy']('comment',()=>{_0x5cd5d8['document']['fire']('copy',_0x32e5e3);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Bi(_0x5ef78e,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x130846=_0x5c9cfb['getData']('text/html');const _0x43589d=_0x5ef78e['model']['document']['selection'],_0x28e3de=Array['from'](_0x43589d['getRanges']());0x1===_0x28e3de['length']&&_0x28e3de[0x0]['isFlat']&&!_0x43589d['getSelectedElement']()&&''!==_0x130846['replace'](/ /g,'')['trim']()&&(_0x130846='<p>'+_0x130846+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x346155,'query':_0x576066,'htmlContent':_0x130846,'label':_0x9715d9,'mainActionLabel':Gi[_0x5ef78e['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x2f6a93,'title':Di(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Vt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x4e6c74['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}_getResolvedCommandsDefinitions(){const _0x45727d=new Map(),_0x3b6a50=ki(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x5ba1ac of _0x3b6a50)for(const _0x2d1135 of _0x5ba1ac['commands'])_0x45727d['set'](_0x2d1135['id'],{..._0x2d1135,'groupId':_0x5ba1ac['groupId'],'groupLabel':_0x5ba1ac['groupLabel']||_0x5ba1ac['groupId']});return _0x45727d;}_createAIAssistantUIButton(_0x3eb9d2){const _0x52e106=this['editor'],_0x284088=_0x52e106['commands']['get']('showAIAssistant'),_0x1317e8=new _0x3eb9d2(_0x52e106['locale']);return _0x1317e8['set']({'label':Di(_0x52e106['locale'],'AI\x20Assistant'),'icon':_0x2f6a93,'isToggleable':!0x0}),_0x1317e8['bind']('isEnabled')['to'](_0x284088),_0x1317e8['bind']('isOn')['to'](this['_dialog'],'id',_0x5ca8ff=>'aiAssistant'===_0x5ca8ff),this['listenTo'](_0x1317e8,'execute',()=>{_0x1317e8['isOn']?this['hideUI']():_0x284088['execute']();}),_0x1317e8;}_initView(){const _0x526c6c=this['editor']['plugins']['get'](xi);this['_formView']=new Ji(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',()=>{_0x526c6c['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x526c6c['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}_initAriaAiStatusChangeAnnouncements(){const {locale:_0x511509,ui:{ariaLiveAnnouncer:_0x1ddd39}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x46784d,_0x4b251f,_0x4d6114)=>{const _0x4c5862=this['_aiAssistantController']['currentContext'];_0x4d6114?_0x1ddd39['announce'](Di(_0x511509,'AI\x20is\x20writing')):_0x4c5862&&_0x1ddd39['announce'](Di(_0x511509,'Generated\x20content:\x20%0',_0x4c5862),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x1e8224,_0x257c0c,_0x113036)=>{if(_0x113036){const _0x37f647=this['_formView']['errorView']['text'];_0x1ddd39['announce'](Di(_0x511509,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x37f647));}});}_onExecute(_0x53f71b){const _0x243923=this['_commandDefinitions']['get'](_0x53f71b),_0x4acf97=this['editor'],_0x50e6c6=_0x4acf97['model']['document']['selection'],_0x20ca81=_0x4acf97['commands']['get']('showAIAssistant'),_0x1bfe56=_0x4acf97['plugins']['get'](xi),_0x3127d5=''+('_ungrouppedCommands'!==_0x243923['groupId']?_0x243923['groupLabel']+':\x20':'')+_0x243923['label'];if(!0x1!==_0x243923['requiresContent']&&_0x50e6c6['isCollapsed']){const _0x4f9310=mt(_0x50e6c6['getSelectedBlocks']())||_0x4acf97['model']['schema']['getLimitElement'](_0x50e6c6);_0x4acf97['model']['change'](_0x5b01a8=>{_0x5b01a8['setSelection'](_0x4f9310,'in');});}_0x1bfe56['showFakeVisualSelection'](),_0x20ca81['execute'](_0x243923['prompt'],_0x3127d5,'command:'+_0x53f71b);}_populateMenuBarMenu(_0x4df5d8,_0x2038a1,_0x12e70d,_0x476489){const _0x88f432=this['editor'],_0x24afee=_0x88f432['locale'],_0x264aef=new _0x164ccd(_0x24afee),_0x2a7b23=is(_0x88f432,_0x12e70d)['filter'](_0x2529bd=>_0x2529bd['commands']['length']);0x1===_0x2a7b23['length']?this['_getMenuBarGroupButtons']({'command':_0x4df5d8,'commands':_0x2a7b23[0x0]['commands'],'parentMenuView':_0x2038a1,'onExecute':_0x476489})['forEach'](_0x5c580c=>_0x264aef['items']['add'](_0x5c580c)):_0x2a7b23['forEach'](({groupId:_0x8dceee,groupLabel:_0x68fc5,commands:_0x2a8788})=>{const _0x5256f3=new te(_0x24afee,_0x2038a1),_0x306696=new _0x4888f9(_0x24afee),_0x11d907=new _0x164ccd(_0x24afee),_0x5a2812=this['_getMenuBarGroupButtons']({'command':_0x4df5d8,'commands':_0x2a8788,'parentMenuView':_0x306696,'onExecute':_0x476489});_0x306696['buttonView']['set']({'label':_0x68fc5||_0x8dceee}),_0x306696['delegate']('execute')['to'](_0x2038a1),_0x11d907['items']['addMany'](_0x5a2812),_0x306696['panelView']['children']['add'](_0x11d907),_0x5256f3['children']['add'](_0x306696),_0x264aef['items']['add'](_0x5256f3);}),_0x2038a1['panelView']['children']['add'](_0x264aef);}_getMenuBarGroupButtons({command:_0xe3f68a,commands:_0x2d4cbc,parentMenuView:_0xa4bb83,onExecute:_0x46333b}){const _0x188e86=this['editor'],_0x5b9469=_0x188e86['locale'];return is(_0x188e86,_0x2d4cbc)['map'](_0x1c2ff4=>{const _0x19088e=new te(_0x5b9469,_0xa4bb83),_0x3378ee=new Zt(_0x5b9469);return _0x3378ee['set']({'label':_0x1c2ff4['label']}),_0x3378ee['delegate']('execute')['to'](_0xa4bb83),_0x3378ee['on']('execute',()=>_0x46333b(_0x1c2ff4['id'])),_0x3378ee['bind']('isEnabled')['to'](_0xe3f68a,'enabledCommandsIds',_0x3c9974=>_0x3c9974['includes'](_0x1c2ff4['id'])),_0x19088e['children']['add'](_0x3378ee),_0x19088e;});}};function es(_0x3c1923,_0x58064a){return void 0x0!==_0x3c1923['order']&&void 0x0===_0x58064a['order']?0x1:void 0x0===_0x3c1923['order']&&void 0x0!==_0x58064a['order']?-0x1:void 0x0!==_0x3c1923['order']&&void 0x0!==_0x58064a['order']?_0x3c1923['order']-_0x58064a['order']:0x0;}function is(_0x14998d,_0x58c2df){_0x58c2df['sort'](es);const _0x238e04={},_0x3f1937=[];for(const _0x5bc517 of _0x58c2df)if(void 0x0!==_0x5bc517['order']){if(_0x5bc517['order']in _0x238e04)throw new ct('ai-commands-config-order-collision',_0x14998d,{'conflictingDefinitions':[_0x5bc517,_0x238e04[_0x5bc517['order']]]});_0x238e04[_0x5bc517['order']]=_0x5bc517,_0x3f1937['splice'](_0x5bc517['order'],0x0,_0x5bc517);}else _0x3f1937['push'](_0x5bc517);return _0x3f1937;}var ss=class extends _0x19488e{static get requires(){return[ts,xi];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x165048){super(_0x165048);const _0x23c458=_0x165048['config'],_0x52b7aa=_0x165048['locale'];_0x23c458['define']('ai.assistant.preserveComments',!0x0),_0x23c458['define']('ai.assistant.commands',ns(_0x52b7aa)),_0x23c458['define']('ai.assistant.extraCommandGroups',[]),_0x23c458['define']('ai.assistant.removeCommands',[]);let _0x1c65b7=ki(_0x23c458['get']('ai.assistant.commands'),_0x52b7aa);const _0x3892bb=_0x23c458['get']('ai.assistant.extraCommandGroups'),_0x365ea1=_0x23c458['get']('ai.assistant.removeCommands');_0x3892bb['forEach'](_0x406686=>{const _0x1188fc=_0x1c65b7['find'](_0x2700aa=>_0x2700aa['groupId']===_0x406686['groupId']);_0x1188fc?_0x1188fc['commands']=_0x1188fc['commands']['concat'](_0x406686['commands']):_0x1c65b7['push'](_0x406686);}),_0x1c65b7=_0x1c65b7['filter'](_0x599b2a=>!_0x365ea1['includes'](_0x599b2a['groupId'])),_0x1c65b7['forEach'](_0x4f1c10=>{_0x4f1c10['commands']=_0x4f1c10['commands']['filter'](_0x279d82=>!_0x365ea1['includes'](_0x279d82['id']));}),_0x23c458['set']('ai.assistant.commands',_0x1c65b7);}};function ns(_0xc324f0){return[{'groupId':'editOrReview','groupLabel':Di(_0xc324f0,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Di(_0xc324f0,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Di(_0xc324f0,'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':Di(_0xc324f0,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Di(_0xc324f0,'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':Di(_0xc324f0,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Di(_0xc324f0,'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':Di(_0xc324f0,'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':Di(_0xc324f0,'Change\x20tone'),'commands':[{'id':'professional','label':Di(_0xc324f0,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Di(_0xc324f0,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Di(_0xc324f0,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Di(_0xc324f0,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Di(_0xc324f0,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Di(_0xc324f0,'Change\x20style'),'commands':[{'id':'business','label':Di(_0xc324f0,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Di(_0xc324f0,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Di(_0xc324f0,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Di(_0xc324f0,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Di(_0xc324f0,'Translate'),'commands':[{'id':'translateEnglish','label':Di(_0xc324f0,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Di(_0xc324f0,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Di(_0xc324f0,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Di(_0xc324f0,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Di(_0xc324f0,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Di(_0xc324f0,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Di(_0xc324f0,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Di(_0xc324f0,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var rs=class extends _0x19488e{abortController;static get requires(){return[Li];}constructor(_0x573475){super(_0x573475),this['abortController']=new AbortController();}init(){this['editor']['plugins']['get'](Li)['textAdapter']=this;}abort(){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async makeRequest(_0x37fb49){return this['sendRequest'](_0x37fb49)['catch'](_0x4e6500=>{if(_0x4e6500 instanceof Pi)return Promise['reject'](_0x4e6500);if('AbortError'==_0x4e6500['name'])return Promise['resolve']();throw console['error'](_0x4e6500),new ct('aitextadapter-send-request-failed',null);});}async _prepareRequestHeaders(_0x39af82,_0x95d098){const _0xd11a3f=this['editor']['locale'],_0x52b670={'Content-Type':'application/json'};if('object'==typeof _0x39af82)Object['assign'](_0x52b670,_0x39af82);else{if(_0x39af82)try{const _0x194846=await _0x39af82(_0x95d098);Object['assign'](_0x52b670,_0x194846);}catch{return Promise['reject'](new Pi(Di(_0xd11a3f,'AI_ERROR_GET_HEADERS')));}}return _0x52b670;}async _prepareRequestParameters(_0x49eac2,_0x8d2cdf){const _0x290983=this['editor']['locale'];if('object'==typeof _0x49eac2)return _0x49eac2;try{return await _0x49eac2(_0x8d2cdf);}catch{return Promise['reject'](new Pi(Di(_0x290983,'AI_ERROR_GET_PARAMETERS')));}}},os=class extends rs{['_apiUrl'];_requestHeaders;_requestParameters;static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x148a65){super(_0x148a65),_0x148a65['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x148a65['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x148a65['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x148a65['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x148a65['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x148a65['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async sendRequest({query:_0x338a83,context:_0x52dc74,onData:_0x5e882a,actionId:_0x2c9a5d}){const _0x2e057b=this['editor']['locale'],_0xecca14=await this['prepareMessages'](_0x338a83,_0x52dc74,_0x2c9a5d),_0x64f751=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x2c9a5d),_0x26c5ff=await this['_prepareRequestParameters'](this['_requestParameters'],_0x2c9a5d),_0x46ec5b={'messages':_0xecca14,..._0x26c5ff},_0x99ef8e={'method':'POST','headers':_0x64f751,'body':JSON['stringify'](_0x46ec5b),'signal':this['abortController']['signal']},_0x36e359=await fetch(this['_apiUrl'],_0x99ef8e);if(_0x36e359['ok'])return _0x26c5ff['stream']?await this['_readStreamableResponse'](_0x36e359,_0x5e882a):await this['_readStaticResponse'](_0x36e359,_0x5e882a),Promise['resolve']();{const _0x5a4b74=await _0x36e359['text']();return _0x5a4b74['includes']('context_length_exceeded')?Promise['reject'](new Pi(Di(_0x2e057b,'AI_ERROR_CONTEXT_LENGTH'))):_0x5a4b74['includes']('Moderation')?Promise['reject'](new Pi(Di(_0x2e057b,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x5a4b74));}}async['prepareMessages'](_0x37d903,_0x442b5e,_0x5c355f){let _0x29dfb3,_0x40e2c1;return _0x442b5e?(_0x29dfb3='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.',_0x40e2c1='Instruction:\x0a'+_0x37d903+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x442b5e):(_0x29dfb3='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.',_0x40e2c1=_0x37d903),[{'role':'system','content':_0x29dfb3},{'role':'user','content':_0x40e2c1}];}async _readStreamableResponse(_0x42606a,_0x154afd){const _0x1a212e=_0x42606a['body']['getReader'](),_0xfaec85=new TextDecoder();let _0x515b5b='',_0x5b4a98='',_0x2c6853='',_0x237932=!0x1;for(;!_0x237932;){const {done:_0x3e8558,value:_0x3e4586}=await _0x1a212e['read'](),_0x33a07c=_0x515b5b+_0xfaec85['decode'](_0x3e4586);let _0x249f98;_0x237932=_0x3e8558;try{_0x249f98=this['_cleanUpData'](_0x33a07c),_0x515b5b='';}catch{_0x515b5b=_0x33a07c;continue;}_0x5b4a98+=_0x249f98,!_0x237932&&this['_isBufferIncomplete'](_0x5b4a98)||_0x5b4a98&&(_0x2c6853+=_0x5b4a98,_0x5b4a98='',_0x154afd(_0x2c6853));}return Promise['resolve']();}async _readStaticResponse(_0x212762,_0x5d84d8){return _0x5d84d8((await _0x212762['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}_isBufferIncomplete(_0x1a7448){const _0x593141=_0x1a7448['split']('<')['length']!==_0x1a7448['split']('>')['length'],_0x4c6657=_0x1a7448['length']<0x1e;return _0x593141&&_0x4c6657;}_cleanUpData(_0x376dab){return _0x376dab['split'](/\n(?![^{]*\})/g)['map'](_0x5d1f72=>_0x5d1f72['replace']('data:\x20',''))['filter'](_0xbbb005=>_0xbbb005&&_0xbbb005['length']>0x0&&'[DONE]'!==_0xbbb005)['map'](_0x544605=>{const {choices:_0x42a1d8}=JSON['parse'](_0x544605);if(_0x42a1d8[0x0]?.['delta']?.['content'])return _0x42a1d8[0x0]['delta']['content'];})['filter'](_0x4debcc=>_0x4debcc)['join']('');}},as=class extends rs{static get['pluginName'](){return'AWSTextAdapter';}init(){super['init'](),St('ai-aws-adapter-not-supported');}async sendRequest(_0x14080e){throw bt('ai-aws-adapter-not-supported'),new Pi(Di(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},hs=class extends Mt{constructor(_0x12a49d,_0x29563d={}){super(_0x12a49d),this['isToggleable']=!0x0,this['set']('side',_0x29563d['side']||'top');const _0x1253dd=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...vt(_0x29563d['class']||[]),_0x1253dd['to']('side',_0x3a1ae8=>'ck-tab-button_'+_0x3a1ae8),_0x1253dd['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},cs=class extends _0x4ff2da{['children'];constructor(_0x5c7629,_0x1f4b21={}){super(_0x5c7629);const _0x265d74=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...vt(_0x1f4b21['class']||[]),_0x265d74['to']('class'),_0x265d74['if']('isVisible','ck-hidden',_0x4ec6a3=>!_0x4ec6a3)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ls=class extends _0x4ff2da{buttonViews=this['createCollection']();['panelViews']=this['createCollection']();_tabs=new Map();constructor(_0x164207,_0x2a8f8e={}){super(_0x164207),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x2a8f8e['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x2a8f8e['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x313cc7,_0x4037f)=>_0x313cc7&&!_0x4037f);const _0x5853a6=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...vt(_0x2a8f8e['class']||[]),_0x5853a6['to']('side',_0x9d7b49=>'ck-tabs_'+_0x9d7b49),_0x5853a6['to']('class'),_0x5853a6['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x5853a6['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x5853a6['to']('side',_0x5f44cf=>'ck-tabs__buttons-container_'+_0x5f44cf)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x5853a6['to']('side',_0x1d432b=>'ck-tabs__panels-container_'+_0x1d432b)]},'children':this['panelViews']},...vt(_0x2a8f8e['children']||[])]});}getTabIds(){return[...this['_tabs']['keys']()];}getTab(_0x3578e6){const _0x550620=this['_tabs']['get'](_0x3578e6);return _0x550620||null;}['addTab'](_0xba7e7d){const _0x31b89a=this['_setupButton']({'id':_0xba7e7d['id'],'label':_0xba7e7d['buttonLabel'],'icon':_0xba7e7d['buttonIcon'],'order':_0xba7e7d['order']}),_0x11fcbf=new cs(this['locale']);return _0x11fcbf['render'](),_0xba7e7d['content']&&_0x11fcbf['children']['add'](_0xba7e7d['content']),this['panelViews']['add'](_0x11fcbf),this['_tabs']['set'](_0xba7e7d['id'],{'button':_0x31b89a,'panel':_0x11fcbf,'order':void 0x0!==_0xba7e7d['order']?_0xba7e7d['order']:null}),this['fire']('addTab:'+_0xba7e7d['id'],{'id':_0xba7e7d['id'],'button':_0x31b89a,'panel':_0x11fcbf}),null===this['activeTab']?this['activateTab'](_0xba7e7d['id']):this['_hidePanel'](_0xba7e7d['id']),{'button':_0x31b89a,'panel':_0x11fcbf};}activateTab(_0x1789cb){if(null!==_0x1789cb&&!this['getTab'](_0x1789cb))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x1789cb});if(this['isCollapsed']=!0x1,this['activeTab']===_0x1789cb)return;const _0x1bd83c=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x1789cb,_0x1789cb&&this['_showPanel'](_0x1789cb),this['fire']('activateTab:'+_0x1789cb,{'newTab':_0x1789cb,'oldTab':_0x1bd83c});}toggleTabPanel(_0x94f28f){this['activeTab']===_0x94f28f?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x94f28f);}['showTab'](_0x2370b7){if(!this['getTab'](_0x2370b7))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x2370b7});this['_showPanel'](_0x2370b7),this['_showButton'](_0x2370b7),this['fire']('show:'+_0x2370b7,_0x2370b7);}['hideTab'](_0xce69d5){if(!this['getTab'](_0xce69d5))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0xce69d5});const _0x157423=this['activeTab'];this['_hidePanel'](_0xce69d5),this['_hideButton'](_0xce69d5);const _0x55f7cf=this['getTabIds']();_0x157423===_0xce69d5&&_0x55f7cf['length']>0x1&&this['activateTab'](_0x55f7cf['find'](_0x1611cd=>_0x1611cd!==_0xce69d5)),this['fire']('hide:'+_0xce69d5,_0xce69d5);}_getPanel(_0x260777){const _0x238200=this['_tabs']['get'](_0x260777);return _0x238200?_0x238200['panel']:null;}['_showPanel'](_0x42d2e3){null!==this['activeTab']&&this['activeTab']!==_0x42d2e3||this['_getPanel'](_0x42d2e3)['show']();}['_hidePanel'](_0x497a9a){const _0x5ab228=this['_getPanel'](_0x497a9a);_0x5ab228['isVisible']&&(this['activeTab']===_0x497a9a&&(this['activeTab']=null),_0x5ab228['hide']());}_getButton(_0x47deb0){const _0x562021=this['_tabs']['get'](_0x47deb0);return _0x562021?_0x562021['button']:null;}_showButton(_0x174cb3){this['_getButton'](_0x174cb3)['show']();}_hideButton(_0x5a0ab9){this['_getButton'](_0x5a0ab9)['hide']();}_setupButton(_0x3dd0f5){const _0x3e2a2b=new hs(this['locale'],{'side':this['side']}),_0x4ea37a=this['buttonViews'];if(_0x3e2a2b['set']({'label':_0x3dd0f5['label'],'icon':_0x3dd0f5['icon'],'tooltip':!0x0,'withText':!0x0}),_0x3e2a2b['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x1efed7,_0xe4bffb)=>_0x1efed7===_0x3dd0f5['id']&&!_0xe4bffb),_0x3e2a2b['bind']('side')['to'](this,'side'),_0x3dd0f5['order']){const _0x432e49=[...this['_tabs']]['reduce']((_0x2e8ef6,_0x516292)=>{const _0x2d0c9b=_0x516292[0x0],{order:_0x1fc131}=_0x516292[0x1];return!_0x1fc131||_0x1fc131>_0x3dd0f5['order']?_0x2e8ef6:_0x1fc131>=_0x2e8ef6['order']?{'id':_0x2d0c9b,'order':_0x1fc131}:_0x2e8ef6;},{'id':'','order':0x0}),_0x432ca3=_0x4ea37a['getIndex'](this['_getButton'](_0x432e49['id']));_0x4ea37a['add'](_0x3e2a2b,_0x432ca3+0x1);}else _0x4ea37a['add'](_0x3e2a2b);return _0x3e2a2b['on']('execute',()=>{this['toggleTabPanel'](_0x3dd0f5['id']);}),_0x3e2a2b;}};const us=['overlay','sidebar','custom'],ds=['left','right'];var _s=class extends ls{constructor(_0x1ce403,_0x1fc49c={}){super(_0x1ce403,_0x1fc49c),this['set']('type',_0x1fc49c['type']||'sidebar'),this['set']('side',_0x1fc49c['side']||'right'),this['set']('isVisible',_0x1fc49c['visibleByDefault']??!0x0);const _0x3478a0=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x3478a0['if']('type','ck-ai-tabs__overlay',_0xbce0d5=>'overlay'===_0xbce0d5),_0x3478a0['if']('type','ck-ai-tabs__sidebar',_0x5dfcfb=>'sidebar'===_0x5dfcfb),_0x3478a0['if']('isVisible','ck-hidden',_0x1597a1=>!_0x1597a1)]}}),this['buttonViews']['on']('add',(_0x487f63,_0x4b7576)=>{_0x4b7576['set']('withText',!0x1);});}},gs=class extends _0x212144{['view'];container=null;showResizeButton=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x41a6a6){if(super(_0x41a6a6),!this['context']['config']['get']('ai.container'))throw new ct('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0xed6231=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0xed6231['showResizeButton']&&(this['showResizeButton']=_0xed6231['showResizeButton']),'sidebar'!==_0xed6231['type']&&'overlay'!==_0xed6231['type']||_0xed6231['side']&&(this['side']=_0xed6231['side']),'sidebar'===_0xed6231['type']){if(this['container']=_0xed6231['element'],this['set']('type','sidebar'),!this['container'])throw new ct('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0xed6231['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new _s(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0xed6231['visibleByDefault'],'collapsible':_0xed6231['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 _0x2a0bfb&&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(_0x3a829e){if(_0x3a829e&&this['type']!==_0x3a829e){if(!us['includes'](_0x3a829e))throw new ct('ai-tabs-unsupported-ui-type');this['type']=_0x3a829e;}}switchSide(_0x400783){if(_0x400783&&this['side']!==_0x400783){if(!ds['includes'](_0x400783))throw new ct('ai-tabs-unsupported-ui-side');this['side']=_0x400783;}}destroy(){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}};function As(_0x2ea4a2){return{..._0x2ea4a2,'type':'context'};}var Is=class extends _0x212144{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}_token;['_decoder'];static get requires(){return[_0x1ec8f8];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1b82fa){if(super(_0x1b82fa),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 ct('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder();}init(){const _0x5670fa=this['context']['plugins']['get'](_0x1ec8f8);if(!_0x5670fa['token'])throw new ct('ai-missing-token',this);this['_token']=_0x5670fa['token'];}_getExtraHttpHeaders(){const _0x22dec6=this['context']['config']['get']('ai.extraHttpHeaders'),_0x1c3f20='function'==typeof _0x22dec6?_0x22dec6():_0x22dec6;if(Array['isArray'](_0x1c3f20)&&_0x1c3f20['length'])return Object['fromEntries'](_0x1c3f20['map'](({domain:_0x13930a,headers:_0xa526ff})=>[_0x13930a,_0xa526ff]));}startConversation(_0x4c65bf,_0x55a0a8){const _0x3010fa=this['_sendApiRequest']('/conversations','POST',{'id':_0x4c65bf,'group':_0x55a0a8});return{'getConversation':async()=>(await _0x3010fa['request'])['json'](),'abortController':_0x3010fa['abortController']};}queryAssistant({message:_0x1b9186,conversationId:_0x470b6d,parts:_0x3379b4,capabilities:_0x20a762,model:_0x3036f2,attributes:_0x2858f3}){const _0x4f6c47=this['_getExtraHttpHeaders'](),_0x19e6ef={..._0x1b9186&&{'prompt':_0x1b9186},'content':_0x3379b4,'model':_0x3036f2,..._0x20a762&&{'capabilities':_0x20a762},..._0x2858f3&&{'attributes':_0x2858f3},..._0x4f6c47&&{'extraHttpHeaders':_0x4f6c47}},_0x5bd69b=this['_sendApiRequest']('/conversations/'+_0x470b6d+'/messages','POST',_0x19e6ef,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x152ce9=(await _0x5bd69b['request'])['body'];return this['_getStreamReader'](_0x152ce9);},'abortController':_0x5bd69b['abortController']};}executeCustomAction({content:_0x1d62d9,message:_0x1fe4e8,model:_0x113fa7,outputFormat:_0x4af7bb,contexts:_0x4fc3fa}){const _0x51660a={'content':[{'type':'text','content':_0x1d62d9}],..._0x1fe4e8&&{'prompt':_0x1fe4e8},'model':_0x113fa7,'outputFormat':_0x4af7bb,...ps(_0x4fc3fa)},_0x39a992=this['_sendApiRequest']('/actions/custom/calls','POST',_0x51660a);return{'getStream':async()=>{const _0x49cb2d=(await _0x39a992['request'])['body'];return this['_getStreamReader'](_0x49cb2d);},'abortController':_0x39a992['abortController']};}executeAction({actionName:_0x4eb0b7,content:_0x107b59,args:_0x17b83c,contexts:_0x5c5c4f}){const _0x32ecbf={'content':[{'type':'text','content':_0x107b59}],'args':_0x17b83c,...ps(_0x5c5c4f)},_0x2226c8=this['_sendApiRequest']('/actions/system/'+_0x4eb0b7+'/calls','POST',_0x32ecbf);return{'getStream':async()=>{const _0x4fa446=(await _0x2226c8['request'])['body'];return this['_getStreamReader'](_0x4fa446);},'abortController':_0x2226c8['abortController']};}['uploadFile'](_0x440478,_0x463f39,_0x51eba8){const _0x3c6c2a=new FormData();_0x3c6c2a['append']('file',_0x463f39,_0x463f39['name']),_0x51eba8&&_0x3c6c2a['append']('attributes',JSON['stringify'](_0x51eba8));const _0x52800c=this['_sendApiRequest']('/conversations/'+_0x440478+'/files','POST',_0x3c6c2a);return{'getId':async()=>(await _0x52800c['request'])['json'](),'abortController':_0x52800c['abortController']};}uploadDocuments(_0x30bcfb,_0x1c789b){const _0x48840e={'documents':_0x1c789b['map'](_0x5e3111=>({'content':_0x5e3111['content'],'attributes':{'version':_0x5e3111['version'],'sessionId':_0x5e3111['sessionId'],'channelId':_0x5e3111['channelId'],'rootName':_0x5e3111['rootName'],'selections':_0x5e3111['selections']},...void 0x0!==_0x5e3111['name']?{'name':_0x5e3111['name']}:{},...void 0x0!==_0x5e3111['description']?{'description':_0x5e3111['description']}:{}}))},_0x37529a=this['_sendApiRequest']('/conversations/'+_0x30bcfb+'/documents/batch','POST',_0x48840e);return{'getIds':async()=>(await _0x37529a['request'])['json'](),'abortController':_0x37529a['abortController']};}fetchDocuments(_0x300475,_0x58abe4){const _0x2ab29d=new URLSearchParams();_0x2ab29d['append']('documentIds',_0x58abe4['join'](','));const _0x34e8da=this['_sendApiRequest']('/conversations/'+_0x300475+'/documents/batch?'+_0x2ab29d['toString'](),'GET');return{'getDocuments':async()=>(await _0x34e8da['request'])['json'](),'abortController':_0x34e8da['abortController']};}fetchConversations(_0x1dd4f5,_0x4fc719={}){const _0x13afbd=new URLSearchParams();_0x13afbd['append']('group',_0x1dd4f5),_0x13afbd['append']('excludeEmpty',!0x1!==_0x4fc719['excludeEmpty']?'true':'false'),_0x13afbd['append']('limit',_0x4fc719['limit']?_0x4fc719['limit']['toString']():0x64['toString']()),_0x13afbd['append']('sortBy',_0x4fc719['sortBy']?_0x4fc719['sortBy']:'createdAt'),_0x13afbd['append']('order',_0x4fc719['order']?_0x4fc719['order']:'desc');const _0x1f7eed=this['_sendApiRequest']('/conversations?'+_0x13afbd['toString'](),'GET');return{'getConversations':async()=>(await(await _0x1f7eed['request'])['json']())['items'],'abortController':_0x1f7eed['abortController']};}deleteConversation(_0x55d12f){const _0x5602bf=this['_sendApiRequest']('/conversations/'+_0x55d12f,'DELETE');return{'execute':async()=>{await _0x5602bf['request'];},'abortController':_0x5602bf['abortController']};}updateConversation(_0x27c94d,_0x5a335d){const _0x9625ff=this['_sendApiRequest']('/conversations/'+_0x27c94d,'PATCH',_0x5a335d);return{'getResult':async()=>(await _0x9625ff['request'],_0x5a335d),'abortController':_0x9625ff['abortController']};}fetchConversation(_0x1c864c){const _0x1cebeb=this['_sendApiRequest']('/conversations/'+_0x1c864c,'GET');return{'getConversation':async()=>(await _0x1cebeb['request'])['json'](),'abortController':_0x1cebeb['abortController']};}fetchConversationMessages(_0x158ad7){const _0x39765e=this['_sendApiRequest']('/conversations/'+_0x158ad7+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x39765e['request'])['json']())['items'],'abortController':_0x39765e['abortController']};}['uploadUrl'](_0x281a75,_0x50f60a,_0x535d52){const _0x2fa833=this['_sendApiRequest']('/conversations/'+_0x281a75+'/web-resources','POST',{'url':_0x50f60a,'attributes':_0x535d52});return{'getId':async()=>(await _0x2fa833['request'])['json'](),'abortController':_0x2fa833['abortController']};}getModels(_0x5c3c42='en'){const _0x28a965=new URLSearchParams();_0x28a965['append']('language',_0x5c3c42);const _0x50d834='/models/1?'+_0x28a965['toString'](),_0x4c5087=this['_sendApiRequest'](_0x50d834,'GET');return{'list':async()=>await(await _0x4c5087['request'])['json'](),'abortController':_0x4c5087['abortController']};}listContexts(_0x12c239={}){const _0x1b07ad=new URLSearchParams();_0x1b07ad['append']('limit',_0x12c239['limit']?_0x12c239['limit']['toString']():0x64['toString']()),_0x12c239['cursor']&&_0x1b07ad['append']('cursor',_0x12c239['cursor']),_0x12c239['order']&&_0x1b07ad['append']('order',_0x12c239['order']);const _0x3bec09=this['_sendApiRequest']('/contexts?'+_0x1b07ad['toString'](),'GET');return{'getContexts':async()=>(await(await _0x3bec09['request'])['json']())['items'],'abortController':_0x3bec09['abortController']};}deleteFile(_0x313239,_0x59fa25){const _0x4eac9f=this['_sendApiRequest']('/conversations/'+_0x313239+'/files/'+_0x59fa25,'DELETE');return{'execute':async()=>{await _0x4eac9f['request'];},'abortController':_0x4eac9f['abortController']};}deleteDocument(_0x55808e,_0x3585a3){const _0x3cedc8=this['_sendApiRequest']('/conversations/'+_0x55808e+'/documents/'+_0x3585a3,'DELETE');return{'execute':async()=>{await _0x3cedc8['request'];},'abortController':_0x3cedc8['abortController']};}deleteWebResource(_0x52b0a9,_0x479be7){const _0x40233a=this['_sendApiRequest']('/conversations/'+_0x52b0a9+'/web-resources/'+_0x479be7,'DELETE');return{'execute':async()=>{await _0x40233a['request'];},'abortController':_0x40233a['abortController']};}cancelStream(_0x5445ac,_0x2cdce2){const _0x52f025=this['_sendApiRequest']('/conversations/'+_0x5445ac+'/messages/'+_0x2cdce2+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x52f025['request'];},'abortController':_0x52f025['abortController']};}resumeStream(_0x38f581,_0x549822,_0x3f3958='0-0'){const _0x174969=new URLSearchParams({'lastEventId':_0x3f3958}),_0x5e2d1a=this['_sendApiRequest']('/conversations/'+_0x38f581+'/messages/'+_0x549822+'/stream?'+_0x174969['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x13aa90=await _0x5e2d1a['request'];return this['_getStreamReader'](_0x13aa90['body']);},'abortController':_0x5e2d1a['abortController']};}callSystemReview({reviewName:_0x4f7008,content:_0x4822fe,args:_0x1898a,contexts:_0x8d9821}){const _0x1f6976=this['_sendApiRequest']('/reviews/system/'+_0x4f7008+'/calls','POST',{'content':[{'type':'text','content':_0x4822fe}],'args':_0x1898a,...ps(_0x8d9821)});return{'getStream':async()=>{const _0x47f762=(await _0x1f6976['request'])['body'];return this['_getStreamReader'](_0x47f762);},'abortController':_0x1f6976['abortController']};}processDocument({content:_0x3eeadc,prompt:_0x3acde6,model:_0x2b2206,capabilities:_0x1e3039,contexts:_0x220c80}){const _0x43c485=this['_getExtraHttpHeaders'](),_0x4f4ead=this['_sendApiRequest']('/documents/process','POST',{'content':_0x3eeadc,'prompt':_0x3acde6,'model':_0x2b2206,..._0x1e3039&&{'capabilities':_0x1e3039},...ps(_0x220c80),..._0x43c485&&{'extraHttpHeaders':_0x43c485}});return{'getResult':async()=>(await _0x4f4ead['request'])['json'](),'abortController':_0x4f4ead['abortController']};}callCustomReview({content:_0x233571,prompt:_0x5d124b,model:_0x463780,contexts:_0x20bd23}){const _0x3181eb=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x233571}],..._0x5d124b&&{'prompt':_0x5d124b},'model':_0x463780,...ps(_0x20bd23)});return{'getStream':async()=>{const _0x22285d=(await _0x3181eb['request'])['body'];return this['_getStreamReader'](_0x22285d);},'abortController':_0x3181eb['abortController']};}upsertAIChatRating(_0x6c491b,_0x57413f,_0x3a8c64){const _0x20ffa8=this['_sendApiRequest']('/conversations/'+_0x6c491b+'/messages/'+_0x57413f+'/ratings','PUT',{'positiveCount':_0x3a8c64['positiveCount'],'totalCount':_0x3a8c64['totalCount'],'modificationId':_0x3a8c64['modificationId']});return{'execute':async()=>{await _0x20ffa8['request'];},'abortController':_0x20ffa8['abortController']};}upsertAIActionRating(_0x4f5dce,_0x16ec01,_0x37bb28){const _0x5ed3c8=this['_sendApiRequest']('/actions/system/'+_0x4f5dce+'/calls/'+_0x16ec01+'/ratings','PUT',{'positiveCount':_0x37bb28['positiveCount'],'totalCount':_0x37bb28['totalCount']});return{'execute':async()=>{await _0x5ed3c8['request'];},'abortController':_0x5ed3c8['abortController']};}upsertCustomAIActionRating(_0x142976,_0xb8107c){const _0xd212a2=this['_sendApiRequest']('/actions/custom/calls/'+_0x142976+'/ratings','PUT',{'positiveCount':_0xb8107c['positiveCount'],'totalCount':_0xb8107c['totalCount']});return{'execute':async()=>{await _0xd212a2['request'];},'abortController':_0xd212a2['abortController']};}upsertAIReviewRating(_0x42ea36,_0x1604c1,_0x5b16a4,_0x1a805c){const _0x175557=this['_sendApiRequest']('/reviews/system/'+_0x42ea36+'/calls/'+_0x1604c1+'/ratings','PUT',{'positiveCount':_0x5b16a4['positiveCount'],'totalCount':_0x5b16a4['totalCount'],'dataId':_0x1a805c});return{'execute':async()=>{await _0x175557['request'];},'abortController':_0x175557['abortController']};}upsertCustomAIReviewRating(_0x553133,_0x1597e4,_0x183b27){const _0x18eed3=this['_sendApiRequest']('/reviews/custom/calls/'+_0x553133+'/ratings','PUT',{'positiveCount':_0x1597e4['positiveCount'],'totalCount':_0x1597e4['totalCount'],'dataId':_0x183b27});return{'execute':async()=>{await _0x18eed3['request'];},'abortController':_0x18eed3['abortController']};}_sendApiRequest(_0x3e260e,_0x47084b,_0x5a874b,_0x35d073={}){const {apiUrl:_0x2b5f3f=this['_apiUrl']}=_0x35d073,_0x12f283=new AbortController(),_0x59cc51=_0x5a874b instanceof FormData,_0x2d278c={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':yt};_0x5a874b&&!_0x59cc51&&(_0x2d278c['Content-Type']='application/json');const _0x3c47bd={'method':_0x47084b,'headers':_0x2d278c,'signal':_0x12f283['signal']};return _0x5a874b&&(_0x3c47bd['body']=_0x59cc51?_0x5a874b:JSON['stringify'](_0x5a874b)),{'request':fetch(''+_0x2b5f3f+_0x3e260e,_0x3c47bd)['catch'](_0x2b81d6=>{this['_handleError'](_0x2b81d6);})['then'](_0x5812b6=>_0x5812b6['ok']?_0x5812b6:_0x5812b6['json']()['then'](_0x10c1df=>{throw{'url':_0x2b5f3f,'path':_0x3e260e,'method':_0x47084b,'body':_0x5a874b,'status':(_0x5812b6||{})['status'],'statusText':(_0x5812b6||{})['statusText'],'code':_0x10c1df['code'],'message':_0x10c1df['message'],'traceId':_0x10c1df['traceId'],'data':_0x10c1df['data']};})),'abortController':_0x12f283};}async *_getStreamReader(_0x103443){const _0x247c22=[],_0x213345=_0x103443['getReader'](),_0xc6f8bd=_0x4df230({'onError':_0x31c33c=>{this['_handleError'](_0x31c33c);},'onEvent':_0x38c93=>{_0x38c93['data']=JSON['parse'](_0x38c93['data']),_0x247c22['push'](_0x38c93);}});try{let _0x36c28b=!0x1;for(;!_0x36c28b;){const {done:_0x395c9c,value:_0x5bbb77}=await _0x213345['read']();_0x395c9c&&(_0x36c28b=!0x0),_0xc6f8bd['feed'](this['_decoder']['decode'](_0x5bbb77,{'stream':!0x0})),yield*_0x247c22,_0x247c22['length']=0x0;}}catch(_0x336f54){this['_handleError'](_0x336f54);}finally{_0x213345['releaseLock'](),_0xc6f8bd['reset']();}}['_handleError'](_0x33bdfc){if(_0x33bdfc instanceof ct)throw _0x33bdfc;if(_0x33bdfc instanceof Error&&'AbortError'===_0x33bdfc['name'])throw new ct('ai-request-aborted',this,{'originalError':_0x33bdfc});throw new ct('ai-request-failed',this,{'originalError':_0x33bdfc});}};function ps(_0x44285b){return _0x44285b?.['length']?{'contexts':_0x44285b['map'](As)}:{};}function Es(_0x2b8891,_0x5c3b33,_0x184d6f){const t=_0x2b8891['t'];switch(_0x5c3b33){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'},_0x184d6f);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_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP','string':'Created\x20for\x20a\x20previous\x20version\x20of\x20the\x20document\x20and\x20can\x20no\x20longer\x20be\x20applied.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP','string':'Created\x20for\x20content\x20that\x20no\x20longer\x20exists.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP','string':'Created\x20for\x20content\x20that\x20no\x20longer\x20exists.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP','string':'Created\x20for\x20a\x20previous\x20version\x20of\x20the\x20document\x20and\x20can\x20no\x20longer\x20be\x20applied.'});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.'},_0x184d6f);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.'},_0x184d6f);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_LIBRARY_LABEL':return t({'id':'AI_CHAT_CONTEXT_LIBRARY_LABEL','string':'Context\x20library'});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.'},_0x184d6f);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'},_0x184d6f);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x184d6f);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'},_0x184d6f);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.'},_0x184d6f);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.'},_0x184d6f);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.'},_0x184d6f);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.'},_0x184d6f);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'},_0x184d6f);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.'},_0x184d6f);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.'});default:return _0x5c3b33;}}const ms=/* #__PURE__ -- @preserve */
|
|
25
|
+
dt();var Ts=class extends ms{_connector;['_config'];['_locale'];_modelList=[];_modelsRequest=null;constructor({connector:_0x1a1525,config:_0x461396,locale:_0x4dfd0d}){super(),this['_connector']=_0x1a1525,this['_config']=_0x461396,this['_locale']=_0x4dfd0d;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get _defaultModelId(){return this['_config']?.['defaultModelId'];}async getAllModels(){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()['catch'](_0x384bac=>{throw this['_modelsRequest']=null,_0x384bac;})),this['_modelsRequest'];}async getAvailableModels(){const _0x52bd5f=await this['getAllModels']();let _0x57ac3f;return _0x57ac3f=this['_availableModels']?this['_filterModels'](_0x52bd5f,this['_availableModels']):_0x52bd5f['filter'](_0x24f1f9=>_0x24f1f9['recommended']),_0x57ac3f;}async['resolveModel'](_0x181a3f){const _0x2696c8=await this['getAllModels']();if(!_0x2696c8['length'])return null;if(_0x181a3f){const _0x418ac7=this['_getModelById'](_0x2696c8,_0x181a3f);if(_0x418ac7)return _0x418ac7;St('ai-chat-model-id-unrecognized',{'modelId':_0x181a3f,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async getDefault(){const _0x13a215=await this['getAvailableModels']();if(!_0x13a215['length'])return null;if(this['_defaultModelId']){const _0x590652=this['_getModelById'](_0x13a215,this['_defaultModelId']);if(_0x590652)return _0x590652;St('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x13a215[0x0]['id']});}return _0x13a215[0x0];}async['isAvailable'](_0x1e2b58){return(await this['getAvailableModels']())['some'](_0x360627=>_0x360627['name']===_0x1e2b58['name']&&_0x360627['provider']===_0x1e2b58['provider']);}async getModel(_0x37f311){const _0x3ccd4c=await this['getAllModels']();return this['_getModelById'](_0x3ccd4c,_0x37f311)||null;}async _retrieveModels(){if(!this['_modelList']['length']){const _0x229b6a=this['_locale']['uiLanguage']||'en',_0x28555d=await this['_connector']['getModels'](_0x229b6a)['list']();this['_modelList']=_0x28555d['items']['map'](_0x3aff52=>ws(_0x3aff52)?{..._0x3aff52,'name':Es(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x3aff52);}return[...this['_modelList']];}_filterModels(_0x42e510,_0x576443){let _0x5cc0fb;if(_0x576443){_0x5cc0fb=[];const _0x2af6b5=new Set(),_0x2d45c3='string'==typeof _0x576443?[_0x576443['toLocaleLowerCase']()]:_0x576443['map'](_0x5c2f33=>_0x5c2f33['toLocaleLowerCase']());for(const _0x3ce16c of _0x2d45c3)for(const _0x550f4b of _0x42e510)!_0x2af6b5['has'](_0x550f4b['id'])&&this['_isMatchingFilter'](_0x550f4b,_0x3ce16c)&&(_0x5cc0fb['push'](_0x550f4b),_0x2af6b5['add'](_0x550f4b['id']));}else _0x5cc0fb=_0x42e510;return _0x5cc0fb;}_isMatchingFilter(_0x50e700,_0x40e2eb){const _0x2f5bd5=_0x50e700['id']['toLocaleLowerCase'](),_0x4cb4e4=_0x50e700['name']['toLocaleLowerCase'](),_0x59f32a=_0x50e700['provider']['toLocaleLowerCase']();return _0x2f5bd5===_0x40e2eb||_0x4cb4e4===_0x40e2eb||ws(_0x50e700)&&'auto'===_0x40e2eb||_0x59f32a===_0x40e2eb||_0x2f5bd5['startsWith'](_0x40e2eb);}_getModelById(_0x542f90,_0x366796){return _0x542f90['find'](_0x23f3de=>ws(_0x23f3de)&&'auto'===_0x366796?_0x23f3de:_0x23f3de['id']===_0x366796)||null;}};function ws(_0x13444a){return _0x13444a['id']['startsWith']('agent');}var Cs=class{_connector;_defaultContext;_contextsRequest=null;constructor({connector:_0x74f9a1,defaultContext:_0x360eee}){this['_connector']=_0x74f9a1,this['_defaultContext']=_0x360eee;}async getAllContexts(){return this['_contextsRequest']||(this['_contextsRequest']=this['_connector']['listContexts']()['getContexts']()['catch'](_0x22d5f3=>{throw this['_contextsRequest']=null,_0x22d5f3;})),[...await this['_contextsRequest']];}async getAvailableContexts(){const _0x1e6371=await this['getAllContexts'](),_0x2db270=new Set((this['_defaultContext']??[])['map'](_0x4d979b=>_0x4d979b['id']));return _0x1e6371['filter'](_0x1beb36=>!_0x2db270['has'](_0x1beb36['id']));}resolveContext({feature:_0x4aecc5,ids:_0x2c1b52=[],extraContexts:_0x1a46b1=[],idScopedOnly:_0x5081af=!0x1,context:_0x206508}){const _0x74f8bb=this['_resolveDefaultContext'](_0x4aecc5,_0x2c1b52,_0x5081af);return _0x206508['addDefaultContext']([..._0x74f8bb,..._0x1a46b1]),_0x206508;}_resolveDefaultContext(_0x467d9f,_0x36a78a,_0x575741=!0x1){if(!this['_defaultContext'])return[];const _0x44c7a7=[];for(const _0x4b775e of this['_defaultContext'])this['_entryAppliesToFeature'](_0x4b775e['features'],_0x467d9f,_0x36a78a)&&(_0x575741&&this['_entryAppliesToFeature'](_0x4b775e['features'],_0x467d9f,[])||_0x44c7a7['push'](this['_toContextRef'](_0x4b775e)));return _0x44c7a7;}_toContextRef(_0x77bcd){return'promptId'in _0x77bcd?{'id':_0x77bcd['id'],'promptId':_0x77bcd['promptId']}:'fileId'in _0x77bcd?{'id':_0x77bcd['id'],'fileId':_0x77bcd['fileId']}:{'id':_0x77bcd['id']};}_entryAppliesToFeature(_0x5cde00,_0x114565,_0x4ea861){if(!_0x5cde00)return!0x0;const _0x2d4c47=_0x5cde00[_0x114565];return!!_0x2d4c47&&(!0x0===_0x2d4c47||_0x4ea861['some'](_0x41fa8a=>_0x2d4c47['test'](_0x41fa8a)));}},fs=class extends _0x212144{['models'];contextLibrary;static get['pluginName'](){return'AICore';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[Is];}init(){const _0x416718=this['context']['plugins']['get'](Is);this['models']=new Ts({'connector':_0x416718,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),this['contextLibrary']=new Cs({'connector':_0x416718,'defaultContext':this['context']['config']['get']('ai.defaultContext')});}};function bs(_0x3d70db){return _0x3d70db?_0x3d70db instanceof _0x2a0bfb?[_0x3d70db]:_0x3d70db['editors']&&0x0!==_0x3d70db['editors']['length']?Array['from'](_0x3d70db['editors']):[]:[];}function Ss(_0x21b2a4){const _0x4c7e27=bs(_0x21b2a4);if(!_0x4c7e27['length'])throw new ct('ai-get-editor-from-context-no-editor');if(0x1===_0x4c7e27['length'])return _0x4c7e27[0x0];const _0xbeede9=_0x4c7e27['find'](_0x2a67c9=>_0x2a67c9['ui']?.['focusTracker']?.['isFocused']);if(_0xbeede9)return _0xbeede9;const _0x50f94a=function(_0x193c24){if(_0x193c24 instanceof _0x2a0bfb)return;const _0x43bd3b=_0x193c24;if(!_0x43bd3b['plugins']||!_0x43bd3b['plugins']['has']('AIEditing'))return;return _0x43bd3b['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x21b2a4);return _0x50f94a&&_0x4c7e27['includes'](_0x50f94a)?_0x50f94a:_0x4c7e27[0x0];}function Rs(_0x15a2b0,_0x24a926){return _0x5bea4e(_0x15a2b0,_0x24a926);}function Os(_0x3c37c2,_0x1e8c8a){return _0x3a1450(_0x3c37c2,_0x1e8c8a);}function vs(_0x5485ac,_0x49c642,_0x30c71b){const _0x26a5b8=null!==_0x49c642?_0x59adb3=>_0x59adb3['attribs'][_0x5485ac]===_0x49c642:_0x210c91=>Boolean(_0x210c91['attribs'][_0x5485ac]);return _0xdb5da(_0x3c408e=>_0x438723(_0x3c408e)&&_0x26a5b8(_0x3c408e),_0x30c71b);}function ks(_0x1cf2ef,_0x2b2c82,_0x57de07){const _0x4962ef=null!==_0x2b2c82?_0x212dc0=>_0x212dc0['attribs'][_0x1cf2ef]===_0x2b2c82:_0x1a53c6=>Boolean(_0x1a53c6['attribs'][_0x1cf2ef]);return _0x26a2ae(_0x442037=>_0x438723(_0x442037)&&_0x4962ef(_0x442037),_0x57de07);}function ys(_0x297ade){return _0x26a2ae(_0x56da54=>_0x438723(_0x56da54)&&function(_0x89fcaf){const _0xa7b5b6=_0x89fcaf['toLowerCase']();return'script'===_0xa7b5b6||'style'===_0xa7b5b6||_0xa7b5b6['includes']('-');}(_0x56da54['name']),_0x297ade);}const Ns=['comment-start','comment-end','suggestion-start','suggestion-end'];function xs(_0x1cbbb2){return _0x438723(_0x1cbbb2)&&Ns['includes'](_0x1cbbb2['name']['toLowerCase']());}function Ls(_0x5240fb){return _0x3932c0(_0x5be922=>_0x36dce3(_0x5be922),_0x5240fb,!0x0,0x1/0x0);}function Ps(_0x4a1c3d,_0x4e5e1d){return _0x4a1c3d&&_0x438723(_0x4a1c3d)?_0x4a1c3d['attribs'][_0x4e5e1d]:null;}function Ds(_0x1941c5,_0x5c4fb4,_0x4f1769){_0x438723(_0x1941c5)&&(null===_0x4f1769?delete _0x1941c5['attribs'][_0x5c4fb4]:_0x1941c5['attribs'][_0x5c4fb4]=_0x4f1769);}function Hs(_0x17c437,_0x41e775,_0x457c85){const _0x188f8b=_0x41e775['cloneNode'](!0x0);'beforebegin'===_0x457c85?ti(_0x17c437,_0x188f8b):'afterbegin'===_0x457c85?_0xf08298(_0x17c437,_0x188f8b):'beforeend'===_0x457c85?_0x2cdc39(_0x17c437,_0x188f8b):'afterend'===_0x457c85&&_0x10069f(_0x17c437,_0x188f8b);}function Ms(_0x503abc){const _0x4d2a73=[];let _0xe1ee9e=_0x503abc;for(;_0xe1ee9e;)_0xe1ee9e=_0x1f37eb(_0xe1ee9e),_0xe1ee9e&&_0x4d2a73['push'](_0xe1ee9e);return _0x4d2a73;}function Us(_0x3e79ce){return _0x3e79ce['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function Vs(_0x172469){let _0x4a6f3b=0x0;for(;_0x172469['parentNode'];)_0x172469=_0x172469['parentNode'],_0x4a6f3b++;return _0x4a6f3b;}function Bs(_0x21ffa9){const _0x2904d7=[];let _0x1ef932=_0x21ffa9['nextSibling'];for(;_0x1ef932;)_0x2904d7['push'](_0x1ef932),_0x1ef932=_0x1ef932['nextSibling'];_0x2904d7['forEach'](_0x21cd6f=>{_0x4ebff9(_0x21cd6f);});}function Gs(_0x51597d,_0x11431d){return!!_0x51597d['model']['document']['getRoot'](_0x11431d)&&!_0x1dc860(_0x51597d,_0x11431d);}function Fs(_0x531b70,_0x497115){return'<p\x20data-id=\x22'+_0x497115+'\x22>'+_0x531b70+'</p>';}function Ks(_0x208bd0){return'p'===_0x208bd0['name']['toLowerCase']()&&Boolean(_0x208bd0['attribs']['data-id']);}function Ws(_0x12f191){const _0x4814eb=Rs(_0x12f191)['children']['filter'](_0x438723);return 0x1===_0x4814eb['length']&&Ks(_0x4814eb[0x0])?_0x4814eb[0x0]['children']['map'](_0x588154=>Os(_0x588154))['join'](''):_0x12f191;}function Ys(_0xfa2be7,_0x5d6ab7){const _0x464f88=function(_0x288253){const _0x10a29e=_0x288253['children']['filter'](_0x438723);return 0x1===_0x10a29e['length']&&Ks(_0x10a29e[0x0])?_0x10a29e[0x0]['children']:_0x288253['children'];}(_0x5d6ab7),{blockElements:_0x5b189e}=_0xfa2be7['editing']['view']['domConverter'],_0x431fa3=_0x1298aa=>_0x1298aa['some'](_0x230e35=>_0x438723(_0x230e35)&&('p'!==_0x230e35['name']['toLowerCase']()&&_0x5b189e['includes'](_0x230e35['name']['toLowerCase']())||_0x431fa3(_0x230e35['children'])));if(_0x431fa3(_0x464f88))return!0x1;const _0x5ac49d=_0x464f88['map'](_0x403dfa=>Os(_0x403dfa))['join'](''),_0x292aad=_0xfa2be7['data']['parse'](_0x5ac49d,'$root'),{schema:_0x786aae}=_0xfa2be7['model'];let _0x2edec7=0x0;for(const {item:_0x39bfef}of _0xfa2be7['model']['createRangeIn'](_0x292aad))if(_0x39bfef['is']('element')&&_0x786aae['isBlock'](_0x39bfef)&&(++_0x2edec7>0x1||'paragraph'!==_0x39bfef['name']))return!0x1;return!0x0;}function $s(_0x3fab1b,_0xe6535f){const _0x593d5b=_0xe6535f['filter'](_0x45a2ec=>'new'!=_0x45a2ec['type'])['map'](_0x28f83c=>vs('data-id',_0x28f83c['id'],_0x3fab1b))['filter'](_0x24d23d=>null!==_0x24d23d),_0x48467e=_0xe6535f['filter'](_0x5aecbb=>'removed'!=_0x5aecbb['type'])['map'](_0x47106d=>_0x47106d['node']['cloneNode'](!0x0));let _0x38570a=null;if(_0x593d5b['length']){_0x38570a=_0x593d5b[0x0]['previousSibling'];for(let _0x44b773=0x0;_0x44b773<_0x593d5b['length'];_0x44b773++)_0x4ebff9(_0x593d5b[_0x44b773]);}if(_0x48467e['length']){_0x38570a||(_0xe6535f[0x0]['anchorId']?_0x38570a=vs('data-id',_0xe6535f[0x0]['anchorId'],_0x3fab1b):(_0x38570a=_0x48467e['shift'](),_0xf08298(_0x3fab1b,_0x38570a)));for(let _0x37bae0=0x0;_0x37bae0<_0x48467e['length'];_0x37bae0++)_0x10069f(_0x38570a,_0x48467e[_0x37bae0]),_0x38570a=_0x48467e[_0x37bae0];}}function qs(_0x23e80c,_0x1caa0b){const _0x164c9a=new Set();for(const _0x36aba3 of _0x23e80c){if(!_0x36aba3['editor']||'destroyed'===_0x36aba3['editor']['state']||!Gs(_0x36aba3['editor'],_0x36aba3['rootName']))continue;const _0x49461e=_0x1caa0b['get'](_0x36aba3['documentId']);let _0x456346;_0x49461e?(_0x456346=_0x49461e['cloneNode'](!0x0),$s(_0x456346,_0x36aba3['changes'])):_0x456346=new _0x35605c(_0x36aba3['changes']['filter'](_0x3006bf=>'removed'!=_0x3006bf['type'])['map'](_0x4c659a=>_0x4c659a['node']['cloneNode'](!0x0))),Ys(_0x36aba3['editor'],_0x456346)||_0x164c9a['add'](_0x36aba3['index']);}return _0x164c9a;}function Qs(_0xfe17ab,_0x1009ff,_0x1a0ece,_0x1d4f38){return Gs(_0xfe17ab,_0x1009ff)?Ys(_0xfe17ab,Rs(_0x1d4f38))?{'before':Ws(_0x1a0ece),'after':Ws(_0x1d4f38)}:null:{'before':_0x1a0ece,'after':_0x1d4f38};}function Xs(_0x229637,_0x17908d){return _0x5a008a(_0x229637,_0x17908d);}function zs(_0x18c0dc,_0x59ae63){return _0x18c0dc['map'](_0x592e83=>null!==_0x592e83&&'object'==typeof _0x592e83?Xs(_0x592e83,_0x59ae63):_0x592e83);}const js=[['BlockQuoteEditing','blockQuote'],['BoldEditing','bold'],['BookmarkEditing','bookmark'],['CodeEditing','code'],['HorizontalLineEditing','horizontalLine'],['HtmlEmbedEditing','htmlEmbed'],['ItalicEditing','italic'],['MathType','math'],['PageBreakEditing','pageBreak'],['Paragraph','paragraph'],['StandardEditingModeEditing','restrictedEditing'],['StrikethroughEditing','strikethrough'],['SubscriptEditing','subscript'],['SuperscriptEditing','superscript'],['TableOfContentsEditing','tableOfContents'],['Title','title'],['TodoListEditing','todoList'],['UnderlineEditing','underline']],Js='ai-selection',Zs=['br'];var tn=class extends _0x212144{constructor(_0x1410b1){super(_0x1410b1),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}_outputDataProcessor;_fakeSelections=[];_sessionIdByEditor=new WeakMap();_editorsToConfigs=new WeakMap();_lastContentFocusedEditor;static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}getLastContentFocusedEditor(){return this['_lastContentFocusedEditor'];}getSessionId(_0x344a68){let _0x1e2eb2=this['_sessionIdByEditor']['get'](_0x344a68);return _0x1e2eb2||(_0x1e2eb2=_0x344a68['plugins']['has']('RealTimeCollaborationClient')&&_0x344a68['plugins']['get']('RealTimeCollaborationClient')['sessionId']||kt(),this['_sessionIdByEditor']['set'](_0x344a68,_0x1e2eb2)),_0x1e2eb2;}async getDocumentData(_0x146636){const _0x47fc7d=bs(this['context']),_0x1847ab=[],_0x51e793=new Set();for(const _0x411e57 of _0x47fc7d){if(_0x146636&&!_0x146636['has'](_0x411e57['config']['get']('collaboration.channelId')))continue;const _0x42720b=_0x411e57['config']['get']('roots')||{},_0x53644f=this['_getEditorSelectionSignature'](_0x411e57),_0x1b5897=_0x411e57['config']['get']('collaboration.channelId'),_0x41d06f=this['getSessionId'](_0x411e57);for(const _0x3b7fcc of _0x411e57['model']['document']['getRoots']()){if('$graveyard'===_0x3b7fcc['rootName'])continue;const _0x1f2f43=await this['_getDocumentDataForEditorRoot'](_0x411e57,_0x3b7fcc,_0x51e793),_0x2603c2=_0x42720b[_0x3b7fcc['rootName']],_0x4e1b21=_0x3b7fcc['getAttribute']('$description')??_0x2603c2?.['description'];let _0x515b38=_0x3b7fcc['getAttribute']('$title')??_0x2603c2?.['title'];_0x515b38||(_0x515b38=_0x3b7fcc['getAttribute']('$rootEditableOptions')?.['label']??_0x2603c2?.['label']),_0x515b38||(St('ai-document-root-missing-title',{'editor':_0x411e57,'rootName':_0x3b7fcc['rootName']}),_0x515b38=_0x3b7fcc['rootName']),_0x1847ab['push']({'editor':_0x411e57,'rootName':_0x3b7fcc['rootName'],'content':_0x1f2f43['content'],'version':_0x1f2f43['version'],'sessionId':_0x41d06f,'channelId':_0x1b5897,'selections':_0x1f2f43['selections'],'selectionSignature':_0x53644f,'editorConfig':this['_getEditorConfig'](_0x411e57),'name':_0x515b38,'description':_0x4e1b21});}}return _0x1847ab;}getEditorsVersions(){const _0x2219b8=bs(this['context']),_0x877356=new Map();for(const _0x400281 of _0x2219b8){const _0x2ba515=_0x400281['config']['get']('collaboration.channelId');_0x877356['set'](_0x2ba515,_0x400281['model']['document']['version']);}return _0x877356;}getEditorsSelections(){const _0x486422=bs(this['context']),_0x2527e6=new Map();for(const _0x1c919e of _0x486422){const _0x475481=_0x1c919e['config']['get']('collaboration.channelId'),_0x57c761=this['_getEditorSelectionSignature'](_0x1c919e);_0x2527e6['set'](_0x475481,_0x57c761);}return _0x2527e6;}_getEditorSelectionSignature(_0xd0a7f8){return this['_getMarkersInDocumentOrder'](_0xd0a7f8)['map'](_0x567c82=>{const _0x175785=_0x567c82['getRange']();return _0x175785['root']['rootName']+':'+_0x175785['start']['path']['join']('.')+'-'+_0x175785['end']['path']['join']('.');})['join']('|');}async _getDocumentDataForEditorRoot(_0x34f10f,_0x3499c2,_0x5f0acb){const _0x19e124=_0x34f10f['data']['toView'](_0x3499c2,{'convertAiChatSelectionMarker':!0x0}),_0x372939=new _0x24fafe(_0x34f10f['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x19e124,_0x372939,_0x5f0acb);let _0x1a2f8d=await this['_getDocumentDataStringFromView'](_0x19e124,_0x34f10f);Gs(_0x34f10f,_0x3499c2['rootName'])&&(_0x1a2f8d=Fs(_0x1a2f8d,this['_nextDataId'](_0x5f0acb)));const _0x2d1d6b=this['_getMarkersInDocumentOrder'](_0x34f10f,_0x3499c2),_0x835ee8=[];for(const _0xda4fa of _0x2d1d6b){const _0x1f2767='<'+_0xda4fa['name']+':start></'+_0xda4fa['name']+':start>',_0x42c05a=_0x1a2f8d['indexOf'](_0x1f2767);_0x1a2f8d=_0x1a2f8d['substring'](0x0,_0x42c05a)+_0x1a2f8d['substring'](_0x42c05a+_0x1f2767['length']);const _0x457a64='<'+_0xda4fa['name']+':end></'+_0xda4fa['name']+':end>',_0x21a3af=_0x1a2f8d['indexOf'](_0x457a64);_0x1a2f8d=_0x1a2f8d['substring'](0x0,_0x21a3af)+_0x1a2f8d['substring'](_0x21a3af+_0x457a64['length']),_0x835ee8['push']({'markerName':_0xda4fa['name'],'start':_0x42c05a,'end':_0x21a3af,'htmlFragment':_0x1a2f8d['substring'](_0x42c05a,_0x21a3af)});}return{'content':_0x1a2f8d,'version':_0x34f10f['model']['document']['version'],'selections':_0x835ee8};}afterInit(){this['context']instanceof _0x2a0bfb?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x28735a,_0x3bc64a)=>{_0x3bc64a['on']('ready',()=>{this['_integrateEditor'](_0x3bc64a);});});}_setOutputDataProcessor(_0x531522){this['_outputDataProcessor']=_0x531522;}async _getDocumentDataStringFromView(_0xcf4231,_0x20c23b){let _0x544011;if(this['_outputDataProcessor']){const _0x5a5128=_0x20c23b['data']['processor']['domConverter']['viewToDom'](_0xcf4231),_0x31f78a=await this['_outputDataProcessor'](_0x5a5128);_0x544011=_0x20c23b['data']['processor']['htmlWriter']['getHtml'](_0x31f78a);}else _0x544011=_0x20c23b['data']['processor']['toData'](_0xcf4231);return _0x544011;}_integrateEditor(_0xe769a4){if(!_0xe769a4['config']['get']('collaboration.channelId'))throw new ct('ai-missing-channel-id',_0xe769a4);_0xe769a4['ui']['focusTracker']['on']('change:isFocused',(_0x38d0c3,_0x5aa9fc,_0xf66ab0)=>{_0xf66ab0&&(this['_lastContentFocusedEditor']=_0xe769a4);}),_0xe769a4['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0xe769a4&&(this['_lastContentFocusedEditor']=void 0x0);}),_0xe769a4['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Js,'view':({markerName:_0x20317a})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x20317a['split'](':')[0x1]],'priority':0xc})}),_0xe769a4['conversion']['for']('dataDowncast')['markerToElement']({'model':Js+':context','view':(_0x4c4650,{writer:_0x314c1d,options:_0x551a7c})=>_0x551a7c['convertAiChatSelectionMarker']?_0x314c1d['createUIElement'](_0x4c4650['markerName']+':'+(_0x4c4650['isOpening']?'start':'end')):null});}showFakeVisualSelection(_0x4402bb){const _0x3a4f33=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x4402bb);const _0x4e253c=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x3a4f33,_0x4e253c);}hideFakeVisualSelection(_0x286415){const _0x2691bc=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x286415);const _0x538d92=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x2691bc,_0x538d92);}async modelToDataWithIds(_0x41c77b,_0x83f4fc,_0x1795b3){const _0x609cd0=_0x83f4fc['data']['toView'](_0x41c77b),_0x4f05c6=new _0x24fafe(_0x83f4fc['editing']['view']['document']),_0x5e9fd6=new Set();this['_setDataIdsOnChildren'](_0x609cd0,_0x4f05c6,_0x5e9fd6);const _0x332e5b=await this['_getDocumentDataStringFromView'](_0x609cd0,_0x83f4fc);return _0x1795b3&&Gs(_0x83f4fc,_0x1795b3)?Fs(_0x332e5b,this['_nextDataId'](_0x5e9fd6)):_0x332e5b;}_setDataIdsOnChildren(_0x48de54,_0x557c54,_0x2226f7=new Set()){let _0x1f1f09=!0x1;for(const _0x4bba44 of _0x48de54['getChildren']()){if(!_0x4bba44['is']('view:element')||Zs['includes'](_0x4bba44['name']))continue;const _0xddf4bb=_0x4bba44['is']('view:containerElement'),_0x143fdf=_0x4bba44['is']('view:emptyElement'),_0x4cc2b4=_0x4bba44['is']('view:rawElement'),_0x1a21a1=this['_setDataIdsOnChildren'](_0x4bba44,_0x557c54,_0x2226f7);_0x4bba44['hasAttribute']('data-id')?(_0x1f1f09=!0x0,_0x2226f7['add'](_0x4bba44['getAttribute']('data-id'))):(_0xddf4bb||_0x143fdf||_0x4cc2b4||_0x1a21a1)&&(_0x557c54['setAttribute']('data-id',this['_nextDataId'](_0x2226f7),_0x4bba44),_0x1f1f09=!0x0);}return _0x1f1f09;}_nextDataId(_0x3f6f6e){let _0x253fcd;do{_0x253fcd='';for(let _0x3453b0=0x0;_0x3453b0<0x4;_0x3453b0++)_0x253fcd+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x3f6f6e['has'](_0x253fcd));return _0x3f6f6e['add'](_0x253fcd),_0x253fcd;}getSelectionText(_0x18cbae){const _0x42dd14=(_0x18cbae?_0x18cbae['model']:Ss(this['context'])['model'])['document']['selection'],_0x129fac=[],_0xc3aa2a=Array['from'](_0x42dd14['getRanges']());_0xc3aa2a['sort']((_0x35e688,_0x22b1d8)=>_0x35e688['start']['isBefore'](_0x22b1d8['start'])?-0x1:0x1);for(const _0x30beb5 of _0xc3aa2a)for(const _0x2141f3 of _0x30beb5['getItems']())_0x2141f3['is']('$textProxy')?_0x129fac['push'](_0x2141f3['data']):_0x2141f3['is']('element')&&_0x129fac['length']>0x0&&'\x20'!==_0x129fac[_0x129fac['length']-0x1]&&_0x129fac['push']('\x20');return _0x129fac['length']?'\x22'+_0x129fac['join']('')['trim']()+'\x22':Es(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}_removeFakeSelectionById(_0x53b8c6){for(let _0x3cfb4e=0x0;_0x3cfb4e<this['_fakeSelections']['length'];_0x3cfb4e++)if(this['_fakeSelections'][_0x3cfb4e]['id']==_0x53b8c6)return void this['_fakeSelections']['splice'](_0x3cfb4e,0x1);}_addFakeSelection(_0x26715f){this['_removeFakeSelectionById'](_0x26715f['id']),Ct(this['_fakeSelections'],_0x26715f);}_refreshFakeSelection(_0x58c439,_0x46736b){if(_0x58c439==_0x46736b)return;const _0x2cb155=_0x58c439?_0x58c439['editor']:null,_0x3c1e78=_0x46736b?_0x46736b['editor']:null,_0x588cf5=(_0x205fef,_0x40e1ac)=>{const _0x316cbe=_0x40e1ac['model']['markers']['getMarkersGroup'](Js);for(const _0xedbd0d of _0x316cbe)_0x205fef['removeMarker'](_0xedbd0d);},_0x2385f4=(_0x295ba9,_0x140d4b,_0x302c71)=>{const _0x36597a=_0x140d4b['model'];for(let _0x429e76=0x0;_0x429e76<_0x302c71['ranges']['length'];_0x429e76++){let _0x3bb29c=_0x302c71['ranges'][_0x429e76];const _0x4ba942=Js+':'+_0x302c71['id']+':'+_0x429e76;if(_0x3bb29c['start']['isAtEnd']){const _0x31c134=_0x3bb29c['start']['getLastMatchingPosition'](({item:_0xcab5c7})=>!_0x36597a['schema']['isContent'](_0xcab5c7),{'boundaries':_0x3bb29c});_0x3bb29c=_0x295ba9['createRange'](_0x31c134,_0x3bb29c['end']);}_0x295ba9['addMarker'](_0x4ba942,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x3bb29c});}};_0x2cb155&&_0x3c1e78&&_0x2cb155===_0x3c1e78&&_0x46736b?_0x2cb155['model']['change'](_0x225b8d=>{_0x588cf5(_0x225b8d,_0x2cb155),_0x2385f4(_0x225b8d,_0x3c1e78,_0x46736b);}):(_0x2cb155&&_0x2cb155['model']['change'](_0x208a7e=>_0x588cf5(_0x208a7e,_0x2cb155)),_0x3c1e78&&_0x46736b&&_0x3c1e78['model']['change'](_0x4d7708=>_0x2385f4(_0x4d7708,_0x3c1e78,_0x46736b)));}_getMarkersInDocumentOrder(_0x345c92,_0x3539c1){const _0xd2a13f=Array['from'](_0x345c92['model']['markers']['getMarkersGroup'](Js+':context'));return(_0x3539c1?_0xd2a13f['filter'](_0x34544c=>{const _0x25514d=_0x34544c['getRange']();return _0x25514d&&_0x25514d['root']['rootName']===_0x3539c1['rootName'];}):_0xd2a13f)['sort']((_0x4c664d,_0x42f21f)=>_0x4c664d['getStart']()['isBefore'](_0x42f21f['getStart']())?-0x1:_0x4c664d['getStart']()['isAfter'](_0x42f21f['getStart']())?0x1:0x0);}_getEditorConfig(_0x2d9c07){let _0x3f9fe1=this['_editorsToConfigs']['get'](_0x2d9c07);return _0x3f9fe1||(_0x3f9fe1=function(_0x5c38a3){const _0x30beae={};if(_0x5c38a3['plugins']['has']('AlignmentEditing')&&(_0x30beae['alignment']=_0x5c38a3['config']['get']('alignment')),_0x5c38a3['plugins']['has']('CodeBlockEditing')&&(_0x30beae['codeBlock']=_0x5c38a3['config']['get']('codeBlock')),_0x5c38a3['plugins']['has']('FontBackgroundColorEditing')&&(_0x30beae['fontBackgroundColor']=Xs(_0x5c38a3['config']['get']('fontBackgroundColor'),['documentColors','columns','colorPicker'])),_0x5c38a3['plugins']['has']('FontColorEditing')&&(_0x30beae['fontColor']=Xs(_0x5c38a3['config']['get']('fontColor'),['documentColors','columns','colorPicker'])),_0x5c38a3['plugins']['has']('FontFamilyEditing')&&(_0x30beae['fontFamily']=_0x5c38a3['config']['get']('fontFamily'),_0x30beae['fontFamily']&&_0x30beae['fontFamily']['options']&&(_0x30beae['fontFamily']['options']=zs(_0x30beae['fontFamily']['options'],['model','upcastAlso']))),_0x5c38a3['plugins']['has']('FontSizeEditing')&&(_0x30beae['fontSize']=_0x5c38a3['config']['get']('fontSize'),_0x30beae['fontSize']&&_0x30beae['fontSize']['options']&&(_0x30beae['fontSize']['options']=zs(_0x30beae['fontSize']['options'],['upcastAlso']))),_0x5c38a3['plugins']['has']('FootnotesEditing')){const _0x45e804=_0x5c38a3['config']['get']('footnotes')??{};_0x45e804['footnotesProperties']&&'object'==typeof _0x45e804['footnotesProperties']&&(_0x45e804['footnotesProperties']=Xs(_0x45e804['footnotesProperties'],['toolbar','listStyles'])),_0x30beae['footnotes']=_0x45e804;}if(_0x5c38a3['plugins']['has']('HeadingEditing')&&(_0x30beae['heading']=_0x5c38a3['config']['get']('heading'),_0x30beae['heading']&&_0x30beae['heading']['options']&&(_0x30beae['heading']['options']=zs(_0x30beae['heading']['options'],['model','icon','class','converterPriority','upcastAlso']))),_0x5c38a3['plugins']['has']('HighlightEditing')&&(_0x30beae['highlight']=_0x5c38a3['config']['get']('highlight'),_0x30beae['highlight']&&_0x30beae['highlight']['options']&&(_0x30beae['highlight']['options']=zs(_0x30beae['highlight']['options'],['model','color']))),_0x5c38a3['plugins']['has']('ImageBlockEditing')||_0x5c38a3['plugins']['has']('ImageInlineEditing')){const _0x4bbdc8=Xs(_0x5c38a3['config']['get']('image'),['toolbar','upload','insert','resizeOptions']);_0x5c38a3['plugins']['has']('ImageResizeEditing')||delete _0x4bbdc8['resizeUnit'],_0x5c38a3['plugins']['has']('ImageStyleEditing')?_0x4bbdc8['styles']?.['options']&&(_0x4bbdc8['styles']['options']=zs(_0x4bbdc8['styles']['options'],['icon'])):delete _0x4bbdc8['styles'],_0x30beae['image']=_0x4bbdc8;}if(_0x5c38a3['plugins']['has']('IndentBlock')&&(_0x30beae['indentBlock']=_0x5c38a3['config']['get']('indentBlock')),_0x5c38a3['plugins']['has']('LineHeightEditing')&&(_0x30beae['lineHeight']=_0x5c38a3['config']['get']('lineHeight'),_0x30beae['lineHeight']&&(delete _0x30beae['lineHeight']['supportAllValues'],_0x30beae['lineHeight']['options']&&(_0x30beae['lineHeight']['options']=zs(_0x30beae['lineHeight']['options'],['model'])))),_0x5c38a3['plugins']['has']('LinkEditing')&&(_0x30beae['link']=Xs(_0x5c38a3['config']['get']('link'),['toolbar'])),_0x5c38a3['plugins']['has']('ListEditing')){const _0x543fee=_0x5c38a3['config']['get']('list')??{};delete _0x543fee['enableListItemMarkerFormatting'],_0x5c38a3['plugins']['has']('ListPropertiesEditing')?_0x543fee['properties']&&_0x543fee['properties']['styles']&&'object'==typeof _0x543fee['properties']['styles']&&(_0x543fee['properties']['styles']=Xs(_0x543fee['properties']['styles'],['listStyleTypes'])):delete _0x543fee['properties'],_0x30beae['list']=_0x543fee;}if(_0x5c38a3['plugins']['has']('MediaEmbedEditing')&&(_0x30beae['mediaEmbed']=_0x5c38a3['config']['get']('mediaEmbed'),_0x30beae['mediaEmbed']&&(delete _0x30beae['mediaEmbed']['toolbar'],_0x5c38a3['plugins']['has']('MediaEmbedResizeEditing')?_0x30beae['mediaEmbed']['resizeOptions']&&(_0x30beae['mediaEmbed']['resizeOptions']=_0x30beae['mediaEmbed']['resizeOptions']['map'](_0x161dbd=>Xs(_0x161dbd,['icon','label']))):delete _0x30beae['mediaEmbed']['resizeOptions'],_0x5c38a3['plugins']['has']('MediaEmbedStyleEditing')?_0x30beae['mediaEmbed']['styles']&&_0x30beae['mediaEmbed']['styles']['options']&&(_0x30beae['mediaEmbed']['styles']['options']=zs(_0x30beae['mediaEmbed']['styles']['options'],['icon','title'])):delete _0x30beae['mediaEmbed']['styles'])),_0x5c38a3['plugins']['has']('MultiLevelListEditing')&&(_0x30beae['listMultiLevel']=_0x5c38a3['config']['get']('listMultiLevel')??{}),_0x5c38a3['plugins']['has']('MentionEditing')){const _0x2527a3=Xs(_0x5c38a3['config']['get']('mention'),['commitKeys','dropdownLimit']);_0x2527a3['feeds']&&(_0x2527a3['feeds']=_0x2527a3['feeds']['map'](_0xdeab1e=>Xs(_0xdeab1e,['minimumCharacters','itemRenderer','dropdownLimit']))),_0x30beae['mention']=_0x2527a3;}if(_0x5c38a3['plugins']['has']('MergeFieldsEditing')){const _0xa35c06=Xs(_0x5c38a3['config']['get']('mergeFields'),['previewModes','initialPreviewMode','previewHtmlValues','sanitizeHtml']);Array['isArray'](_0xa35c06['definitions'])&&(_0xa35c06['definitions']=_0xa35c06['definitions']['map'](_0xe506a8=>'groupId'in _0xe506a8?(Array['isArray'](_0xe506a8['definitions'])&&(_0xe506a8['definitions']=_0xe506a8['definitions']['map'](_0x262ffd=>Xs(_0x262ffd,['defaultValue']))),_0xe506a8):Xs(_0xe506a8,['defaultValue']))),_0x30beae['mergeFields']=_0xa35c06;}if(_0x5c38a3['plugins']['has']('StyleEditing')&&(_0x30beae['style']=_0x5c38a3['config']['get']('style')),_0x5c38a3['plugins']['has']('TableEditing')){const _0x6ee9e1=Xs(_0x5c38a3['config']['get']('table'),['contentToolbar','tableToolbar','showHiddenBorders']);_0x5c38a3['plugins']['has']('TablePropertiesEditing')?_0x6ee9e1['tableProperties']&&'object'==typeof _0x6ee9e1['tableProperties']&&(_0x6ee9e1['tableProperties']=Xs(_0x6ee9e1['tableProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x6ee9e1['tableProperties'],_0x5c38a3['plugins']['has']('TableCellPropertiesEditing')?_0x6ee9e1['tableCellProperties']&&'object'==typeof _0x6ee9e1['tableCellProperties']&&(_0x6ee9e1['tableCellProperties']=Xs(_0x6ee9e1['tableCellProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x6ee9e1['tableCellProperties'],_0x5c38a3['plugins']['has']('TableLayoutEditing')?_0x6ee9e1['tableLayout']||(_0x6ee9e1['tableLayout']={}):delete _0x6ee9e1['tableLayout'],_0x5c38a3['plugins']['has']('TableCaptionEditing')?_0x6ee9e1['tableCaption']||(_0x6ee9e1['tableCaption']={}):delete _0x6ee9e1['tableCaption'],_0x30beae['table']=_0x6ee9e1;}_0x5c38a3['plugins']['has']('TextPartLanguageEditing')&&(_0x30beae['textPartLanguage']=_0x5c38a3['config']['get']('language.textPartLanguage'));for(const [_0x5a340e,_0x283ae3]of js)_0x5c38a3['plugins']['has'](_0x5a340e)&&(_0x30beae[_0x283ae3]={});return _0x30beae;}(_0x2d9c07),this['_editorsToConfigs']['set'](_0x2d9c07,_0x3f9fe1)),_0x3f9fe1;}};const en=/* #__PURE__ -- @preserve */
|
|
26
|
+
At();var sn=class extends en{_generateUid;_uidCounter=0x0;_touchedNodesState={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};_existingDataIds=new Set();_referencedExistingIds=new Set();constructor(_0x4d49aa){super(),this['_generateUid']=_0x4d49aa||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x1fcc9c,_0x2b2af5,_0x276122){this['_uidCounter']=0x0;const _0x478f0a=_0x1fcc9c['cloneNode'](!0x0);on(_0x2b2af5,_0x478f0a);const _0x94af28=_0x478f0a['childNodes'],_0x39f66c=Array['from'](_0x94af28)['filter'](_0x57d4d7=>!(0x3===_0x57d4d7['nodeType']&&''===Os(_0x57d4d7)['trim']())),_0x2f860e=_0x39f66c['length'];this['_existingDataIds']=new Set(ks('data-id',null,_0x2b2af5)['map'](_0x8f8858=>Ps(_0x8f8858,'data-id'))['filter'](_0x376111=>!!_0x376111));for(const _0x413d13 of _0x39f66c)_0x413d13&&_0x438723(_0x413d13)&&void 0x0===_0x413d13['attribs']['data-id']&&Ds(_0x413d13,'data-id','new-element');if(ks('data-id',null,_0x478f0a)['forEach'](_0x18870f=>{const _0xc688e7=Ps(_0x18870f,'data-id');'new-element'===_0xc688e7||this['_existingDataIds']['has'](_0xc688e7)||Ds(_0x18870f,'data-id','new-element');}),0x0===_0x2b2af5['childNodes']['length']){const _0x15f320=[];return ks('data-id','new-element',_0x478f0a)['forEach'](_0x49a2e1=>{const _0x45491d=this['_generateUid']();Ds(_0x49a2e1,'data-id',_0x45491d),_0x15f320['push'](_0x45491d);}),this['_removeSpecialComments'](_0x478f0a),{'parsedContent':_0x478f0a,'newNodeIds':_0x15f320,'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 _0x18bbb8=-0x1,_0x52cdc4=!0x1;for(let _0x5c4542=0x0;_0x5c4542<_0x2f860e;_0x5c4542++){const _0x59faef=_0x39f66c[_0x5c4542],_0x2be9f9=_0x39f66c[_0x5c4542+0x1];if(this['_isNewNode'](_0x59faef)){if(-0x1===_0x18bbb8&&(_0x18bbb8=_0x5c4542),this['_markWrappedElements'](_0x59faef),!this['_isNewNode'](_0x2be9f9)){const [_0x3b5b8b,_0x3b3cfa]=this['_findReferenceNode'](_0x59faef,_0x52cdc4,_0x2b2af5);if(_0x3b5b8b){const _0x32aa36=Array['from'](_0x39f66c)['slice'](_0x18bbb8,_0x5c4542+0x1);this['_insertNodes'](_0x3b5b8b,_0x32aa36,_0x3b3cfa),_0x18bbb8=-0x1;}}}else{if(this['_isExistingContentComment'](_0x59faef))_0x52cdc4=!0x0;else{if(this['_isExistingNode'](_0x59faef)){const _0x492792=Ps(_0x59faef,'data-id');if(_0x492792&&this['_existingDataIds']['has'](_0x492792)){this['_referencedExistingIds']['add'](_0x492792);const _0x25a04f=vs('data-id',_0x492792,_0x2b2af5);this['_replaceNode'](_0x25a04f,_0x59faef);}}else{if(nn(_0x59faef)){const _0x303018=rn(_0x59faef);vs('data-id',_0x303018,_0x478f0a)||this['_touchedNodesState']['removedIds']['push'](_0x303018);}}}}}for(const _0x5a25e1 of this['_touchedNodesState']['removedIds']){const _0x13786d=vs('data-id',_0x5a25e1,_0x2b2af5);_0x13786d&&(this['_rescueUnwrappedElements'](_0x13786d),this['_removeNode'](_0x13786d,_0x5a25e1,_0x276122));}if(ks('data-id','new-element',_0x2b2af5)['forEach'](_0x14a3b3=>{const _0x569fbe=this['_getUid'](_0x14a3b3);Ds(_0x14a3b3,'data-id',_0x569fbe),this['_touchedNodesState']['newIds']['push'](_0x569fbe);}),this['_removeSpecialComments'](_0x2b2af5),_0x276122&&_0x276122['cutAfterUnstable']){const _0x3fcd8e=this['_findLastConfirmationPoint'](_0x39f66c),_0x7acb4=this['_getLastStableElement'](_0x2b2af5,_0x3fcd8e);this['_markUnstableElements'](_0x2b2af5,_0x7acb4);}if(this['_processWrappedElements'](_0x2b2af5,_0x276122),_0x276122&&_0x276122['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x3bcfdf=ks('data-id',this['_touchedNodesState']['lastTouchedId'],_0x2b2af5);let _0x2ad663=_0x3bcfdf[_0x3bcfdf['length']-0x1];for(;_0x2ad663;)Bs(_0x2ad663),_0x2ad663=_0x2ad663['parentNode'];}return{'parsedContent':_0x2b2af5,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}_insertNodes(_0x3b4619,_0x115c83,_0x380542){for(const _0x48bf36 of _0x115c83){const _0x3688af=this['_getUid'](_0x48bf36);Ds(_0x48bf36,'data-id',_0x3688af),this['_touchedNodesState']['newIds']['push'](_0x3688af),this['_touchedNodesState']['lastTouchedId']=_0x3688af;}const _0x51db04='afterbegin'===_0x380542||'afterend'===_0x380542?_0x115c83['reverse']():_0x115c83;for(const _0x4d6199 of _0x51db04)Hs(_0x3b4619,_0x4d6199,_0x380542);}['_replaceNode'](_0x27e937,_0x413a7d){if(!_0x27e937)return;if(_0x3cd340=_0x413a7d,Us(Os(_0x27e937))===Us(Os(_0x3cd340)))return;var _0x3cd340;const _0x45780c=Ps(_0x27e937,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x45780c),this['_touchedNodesState']['lastTouchedId']=_0x45780c,_0x444916(_0x27e937,_0x413a7d['cloneNode'](!0x0));}['_removeNode'](_0x1b0d6d,_0x330672,_0x367e93){if(_0x367e93&&_0x367e93['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x330672;const _0x11a6c0=_0x367e93['replaceRemovedWith']['cloneNode'](!0x0);Ds(_0x11a6c0,'data-id',_0x330672),Ds(_0x11a6c0,'data-removed','true'),_0x444916(_0x1b0d6d,_0x11a6c0);}else _0x4ebff9(_0x1b0d6d);}['_findReferenceNode'](_0x343013,_0x125063,_0x2e9014){const _0x1079f3=this['_findPrevElementWithDataId'](_0x343013,!0x1);if(_0x1079f3){const _0xa6c4df=rn(_0x1079f3),_0x1c9c40=vs('data-id',_0xa6c4df,_0x2e9014);if(_0x1c9c40)return[_0x1c9c40,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0xa6c4df);}const _0xf4b66d=this['_findNextElementWithDataId'](_0x343013,!0x1);if(_0xf4b66d){const _0x2edf04=rn(_0xf4b66d),_0x3561a9=vs('data-id',_0x2edf04,_0x2e9014);if(_0x3561a9)return[_0x3561a9,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x2edf04);}return _0x125063?_0x343013['nextSibling']?this['_findFallbackReferenceNode'](_0x343013,_0x2e9014):[_0x2e9014['childNodes'][_0x2e9014['childNodes']['length']-0x1],'afterend']:[_0x2e9014['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x18e8dc,_0x570547){const _0x5591d4=[],_0xd01171=this['_findPrevElementWithDataId'](_0x18e8dc,!0x0);if(_0xd01171){const _0x2cd7c3=vs('data-id',rn(_0xd01171),_0x570547);_0x2cd7c3&&_0x5591d4['push']([_0x2cd7c3,'afterend']);}const _0x2aaccf=this['_findNextElementWithDataId'](_0x18e8dc,!0x0);if(_0x2aaccf){const _0x661144=vs('data-id',rn(_0x2aaccf),_0x570547);_0x661144&&_0x5591d4['push']([_0x661144,'beforebegin']);}return _0x5591d4['length']>0x1?Vs(_0x5591d4[0x0][0x0])<=Vs(_0x5591d4[0x1][0x0])?_0x5591d4[0x0]:_0x5591d4[0x1]:0x1===_0x5591d4['length']?_0x5591d4[0x0]:[_0x570547['lastChild'],'afterend'];}_findNextElementWithDataId(_0x23b140,_0x221726){let _0x4bbe42=_0x23b140['nextSibling'],_0x1801d0=null,_0x29f36a=!0x1;for(;_0x4bbe42;){if(_0x36dce3(_0x4bbe42)){if(nn(_0x4bbe42)&&(_0x1801d0=_0x4bbe42),this['_isExistingContentComment'](_0x4bbe42)&&_0x221726&&!_0x29f36a){_0x29f36a=!0x0,_0x4bbe42=_0x4bbe42['nextSibling'];continue;}break;}const _0x441157=Ps(_0x4bbe42,'data-id');if(_0x441157&&'new-element'!==_0x441157&&this['_existingDataIds']['has'](_0x441157)){_0x1801d0=_0x4bbe42;break;}_0x4bbe42=_0x4bbe42['nextSibling'];}return _0x1801d0;}_findPrevElementWithDataId(_0x369811,_0x48ca9b){let _0x4e71ee=_0x369811['previousSibling'],_0x21eee2=null,_0x16b79e=!0x1;for(;_0x4e71ee;){if(_0x36dce3(_0x4e71ee)){if(nn(_0x4e71ee)&&(_0x21eee2=_0x4e71ee),this['_isExistingContentComment'](_0x4e71ee)&&_0x48ca9b&&!_0x16b79e){_0x16b79e=!0x0,_0x4e71ee=_0x4e71ee['previousSibling'];continue;}break;}const _0xfe989d=Ps(_0x4e71ee,'data-id');if(_0xfe989d&&'new-element'!==_0xfe989d&&this['_existingDataIds']['has'](_0xfe989d)){_0x21eee2=_0x4e71ee;break;}_0x4e71ee=_0x4e71ee['previousSibling'];}return _0x21eee2;}_markWrappedElements(_0x53c36e){_0x438723(_0x53c36e)&&ks('data-id',null,_0x53c36e)['forEach'](_0xc5a478=>{this['_isExistingNode'](_0xc5a478)&&(Ds(_0xc5a478,'data-wrapped-id',Ps(_0xc5a478,'data-id')),Ds(_0xc5a478,'data-id',null));});}_processWrappedElements(_0x24fa54,_0x346be5){ks('data-wrapped-id',null,_0x24fa54)['forEach'](_0x33875c=>{const _0x2e9f9=Ps(_0x33875c,'data-wrapped-id');if(this['_hasUnstableParent'](_0x33875c))return;const _0x28b305=vs('data-id',_0x2e9f9,_0x24fa54);Ds(_0x33875c,'data-id',_0x2e9f9),_0x28b305&&(this['_removeNode'](_0x28b305,_0x2e9f9,_0x346be5),this['_touchedNodesState']['removedIds']['push'](_0x2e9f9),this['_touchedNodesState']['lastTouchedId']=_0x2e9f9);});}_hasUnstableParent(_0x50d385){let _0x2673c0=_0x50d385['parentNode'];for(;_0x2673c0;){if(Ps(_0x2673c0,'data-unstable'))return!0x0;_0x2673c0=_0x2673c0['parentNode'];}return!0x1;}_rescueUnwrappedElements(_0x637b26){const _0x430748=new Set(this['_touchedNodesState']['removedIds']),_0x5c9038=new Set(this['_touchedNodesState']['newIds']);ks('data-id',null,_0x637b26)['forEach'](_0x3837c0=>{const _0x17f347=Ps(_0x3837c0,'data-id'),_0xd724c5=!!_0x17f347&&this['_referencedExistingIds']['has'](_0x17f347),_0xd88a14=!!_0x17f347&&_0x5c9038['has'](_0x17f347);if(!_0x17f347||!_0xd724c5&&!_0xd88a14)return;if(_0x430748['has'](_0x17f347))return;let _0x2d4d75=_0x3837c0['parentNode'],_0x4150dd=!0x1;for(;_0x2d4d75;){if(_0x2d4d75===_0x637b26){_0x4150dd=!0x0;break;}const _0x7b5e3a=Ps(_0x2d4d75,'data-id');if(_0x7b5e3a&&(this['_referencedExistingIds']['has'](_0x7b5e3a)||_0x5c9038['has'](_0x7b5e3a)))return;_0x2d4d75=_0x2d4d75['parentNode'];}if(_0x4150dd){if(ti(_0x637b26,_0x3837c0),_0xd724c5){const _0x229526=this['_generateUid'](),_0x330c9e=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x17f347);-0x1!==_0x330c9e&&this['_touchedNodesState']['modifiedIds']['splice'](_0x330c9e,0x1),Ds(_0x3837c0,'data-unwrapped-id',_0x17f347),Ds(_0x3837c0,'data-id',_0x229526),this['_touchedNodesState']['newIds']['push'](_0x229526),this['_touchedNodesState']['rescuedNewIds']['add'](_0x229526),this['_touchedNodesState']['lastTouchedId']=_0x229526;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x17f347),this['_touchedNodesState']['lastTouchedId']=_0x17f347;}});}_getUid(_0x1a7cbb){return this['_isExistingNode'](_0x1a7cbb)?Ps(_0x1a7cbb,'data-id'):this['_generateUid']();}_removeSpecialComments(_0x4689dc){Ls(_0x4689dc)['filter'](_0x318171=>nn(_0x318171)||this['_isExistingContentComment'](_0x318171))['forEach'](_0x5a6226=>{_0x4ebff9(_0x5a6226);});}_findLastConfirmationPoint(_0x3dd782){let _0x50e685=null,_0x518c3f=null,_0x5e38a9=null,_0x48e7a6=null;const _0xd76937=_0x239c64=>{_0x239c64&&(_0x50e685=_0x239c64),_0x5e38a9=null,_0x48e7a6=null;};for(let _0x12ba5a=0x0;_0x12ba5a<_0x3dd782['length'];_0x12ba5a++){const _0x23e710=_0x3dd782[_0x12ba5a];if(this['_isExistingContentComment'](_0x23e710)){_0xd76937(_0x518c3f);continue;}if(_0x438723(_0x23e710)){const _0x4f8b=Ps(_0x23e710,'data-id'),_0xd8d634=_0x12ba5a===_0x3dd782['length']-0x1;if(_0x4f8b&&'new-element'!==_0x4f8b&&this['_touchedNodesState']['modifiedIds']['includes'](_0x4f8b)&&!_0xd8d634){_0xd76937(_0x4f8b),_0x518c3f=_0x4f8b;continue;}}let _0x5c73b5;const _0x3f1e00=rn(_0x23e710);if(_0x3f1e00&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x3f1e00))_0x518c3f=_0x3f1e00;else{if(_0x3f1e00&&this['_touchedNodesState']['newIds']['includes'](_0x3f1e00))_0x5c73b5='N';else{if(!nn(_0x23e710))continue;_0x5c73b5='R';}_0x5c73b5===_0x48e7a6||null===_0x48e7a6?_0x48e7a6=_0x5c73b5:null!==_0x5e38a9?(_0xd76937(_0x518c3f),_0x48e7a6=_0x5c73b5):(_0x5e38a9=_0x48e7a6,_0x48e7a6=_0x5c73b5),_0x518c3f=_0x3f1e00;}}const _0x151558=_0x3dd782[_0x3dd782['length']-0x1];return _0x151558&&!_0x438723(_0x151558)&&!nn(_0x151558)&&_0x518c3f&&_0xd76937(_0x518c3f),_0x50e685;}_getLastStableElement(_0x6c485b,_0x3edfc0){if(!_0x3edfc0)return null;const _0x3cf036=vs('data-id',_0x3edfc0,_0x6c485b);if(!_0x3cf036)return null;const _0x32315e=[_0x3cf036,...Ms(_0x3cf036)]['at'](-0x2);if(_0x32315e===_0x3cf036)return _0x3cf036;let _0x3e1798=_0x32315e['previousSibling'];for(;_0x3e1798&&!_0x438723(_0x3e1798);)_0x3e1798=_0x3e1798['previousSibling'];return _0x3e1798;}_markUnstableElements(_0x2d46ad,_0x1b80ae){const _0x8fad1c=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x1d22e1=_0x1b80ae?_0x1b80ae['nextSibling']:_0x2d46ad['firstChild'];for(;_0x1d22e1;)_0x438723(_0x1d22e1)&&(_0x8fad1c['has'](Ps(_0x1d22e1,'data-id'))||ks('data-id',null,_0x1d22e1)['some'](_0x211442=>_0x8fad1c['has'](Ps(_0x211442,'data-id'))))&&Ds(_0x1d22e1,'data-unstable','true'),_0x1d22e1=_0x1d22e1['nextSibling'];}['_isNewNode'](_0x3b3fbd){return Boolean('new-element'===Ps(_0x3b3fbd,'data-id'));}_isExistingNode(_0x3bb1f6){return Boolean((Ps(_0x3bb1f6,'data-id')||'')['length']>0x0&&'new-element'!==Ps(_0x3bb1f6,'data-id'));}_isExistingContentComment(_0x19da43){return Boolean(_0x36dce3(_0x19da43)&&Os(_0x19da43)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function nn(_0x5e3e3d){return!!_0x5e3e3d&&Boolean(_0x36dce3(_0x5e3e3d)&&Os(_0x5e3e3d)['match'](/removed[\s*-]data-id="[^"]+"/));}function rn(_0x90334a){if(!_0x90334a)return null;if(_0x438723(_0x90334a))return Ps(_0x90334a,'data-id')??null;if(_0x36dce3(_0x90334a)){const _0xd04b6e=Os(_0x90334a)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0xd04b6e&&_0xd04b6e[0x1])return _0xd04b6e[0x1];}return null;}function on(_0x2ca103,_0x35da74){const _0x4cae3c=new Map();for(const _0x2474f3 of ys(_0x2ca103))xs(_0x2474f3)||_0x4cae3c['set'](Ps(_0x2474f3,'data-id'),_0x2474f3);const _0xe00352=new Set();for(const _0x311116 of ys(_0x35da74)){if(xs(_0x311116))continue;const _0x582c56=Ps(_0x311116,'data-id'),_0x2b3781=_0x582c56?_0x4cae3c['get'](_0x582c56):void 0x0;_0x2b3781?(_0x444916(_0x311116,_0x246402(_0x2b3781,!0x0)),_0xe00352['add'](_0x582c56)):_0x4ebff9(_0x311116);}for(const _0x41c4a1 of Ls(_0x35da74))nn(_0x41c4a1)&&_0x4cae3c['has'](rn(_0x41c4a1))&&_0x4ebff9(_0x41c4a1);const _0x582dd1=new Set(ks('data-id',null,_0x35da74)['map'](_0x47a774=>Ps(_0x47a774,'data-id')));for(const [_0x378de5,_0x19ea85]of _0x4cae3c){if(_0xe00352['has'](_0x378de5))continue;let _0x38ca19=_0x19ea85['parent'],_0x3db831=null;for(;_0x38ca19&&_0x438723(_0x38ca19);){const _0x496355=Ps(_0x38ca19,'data-id');if(_0x496355&&_0x582dd1['has'](_0x496355)){_0x3db831=_0x496355;break;}_0x38ca19=_0x38ca19['parent'];}if(!_0x3db831)continue;const _0x1dec5d=vs('data-id',_0x3db831,_0x35da74);_0x1dec5d&&_0x2cdc39(_0x1dec5d,_0x246402(_0x19ea85,!0x0));}}const an=/* #__PURE__ -- @preserve */
|
|
27
|
+
At();var hn=class extends an{_m2html;constructor(){super();const _0xef7b18=Object['entries'](_0x3d6e18),_0x1c3acd=_0xef7b18['findIndex'](([_0x2486b2])=>'rehypeDomRaw'===_0x2486b2);if(-0x1===_0x1c3acd)throw new ct('ai-response-parser-unable-to-set-up-parser');_0xef7b18['splice'](_0x1c3acd+0x1,0x0,['rehypeSanitize',_0x158f1a]),this['_m2html']=new _0x37f450({'plugins':Object['fromEntries'](_0xef7b18)});}convertMarkdownToHTML(_0x2f7aa0){const _0x1eb687=this['_m2html']['parse'](_0x2f7aa0);return this['parseAndNormalizeHTML'](_0x1eb687);}['parseAndNormalizeHTML'](_0x492f6e){return this['_parseHTML'](_0x492f6e);}['_parseHTML'](_0x566d35){const _0x5b92f2=Rs('<dummy>'+_0x566d35['replace'](/<[^>]*?$/g,'')+'</dummy>');return cn(_0x5b92f2),_0x5b92f2['children']=_0x5b92f2['children'][0x0]['children'],_0x5b92f2;}};function cn(_0x3b7511){for(const _0x4faf7b of _0x3b7511['children'])_0x438723(_0x4faf7b)?'pre'!==_0x4faf7b['name']&&cn(_0x4faf7b):_0x8a421e(_0x4faf7b)&&(_0x4faf7b['data']=_0x4faf7b['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function ln({changeGroups:_0x674142,documentContextContent:_0x2a9a77,showDiff:_0x8caf8,trimUnchanged:_0x1e8551=!0x0}){const _0x5e1996=qs(_0x674142,_0x2a9a77);return _0x674142['map'](_0x113b55=>{if(!_0x113b55['editor']||'destroyed'===_0x113b55['editor']['state'])return null;const _0x341b53=Gs(_0x113b55['editor'],_0x113b55['rootName']),_0x487b4c=new _0x35605c([]),_0x3b19ca=new _0x35605c([]),_0x1e66b4=new Set();for(const _0x82ad4e of _0x113b55['changes'])'new'==_0x82ad4e['type']&&ks('data-id',null,_0x82ad4e['node'])['forEach'](_0x5c15c3=>{_0x1e66b4['add'](Ps(_0x5c15c3,'data-id'));});for(const _0x1b0802 of _0x113b55['changes'])if('removed'!=_0x1b0802['type']?_0x3b19ca['children']['push'](_0x1b0802['node']['cloneNode'](!0x0)):_0x8caf8||_0x1e66b4['has'](_0x1b0802['id'])||_0x3b19ca['children']['push'](_0x1b0802['node']['cloneNode'](!0x0)),'new'!=_0x1b0802['type']&&(_0x8caf8||'removed'!=_0x1b0802['type'])){const _0x4f3d99=_0xdb5da(_0x34c780=>Ps(_0x34c780,'data-id')==_0x1b0802['id'],_0x2a9a77['get'](_0x113b55['documentId']),!0x0);_0x4f3d99&&_0x487b4c['children']['push'](_0x4f3d99['cloneNode'](!0x0));}if(_0x341b53&&_0x5e1996['has'](_0x113b55['index']))return{'type':_0x113b55['changes'][0x0]['type'],'index':_0x113b55['index'],'state':_0x113b55['state'],'outdatedReason':_0x113b55['outdatedReason'],'content':new _0x35605c([]),'hasChanges':!0x1};let _0x2ca3f9,_0x128260,_0x39ccc4;try{({content:_0x2ca3f9,hasChanges:_0x128260}=un(_0x113b55['editor'],_0x487b4c,_0x3b19ca,_0x8caf8,_0x1e8551));}catch{return{'type':_0x113b55['changes'][0x0]['type'],'index':_0x113b55['index'],'state':_0x113b55['state'],'outdatedReason':_0x113b55['outdatedReason'],'content':new _0x35605c([]),'hasChanges':!0x1};}if(_0x341b53){_0x39ccc4=_0x113b55['editor']['ui']['getEditableElement'](_0x113b55['rootName'])?.['tagName']['toLowerCase']();const _0x554f69=_0x2ca3f9['children']['filter'](_0x438723);0x1===_0x554f69['length']&&(_0x2ca3f9=new _0x35605c(_0x554f69[0x0]['children']));}return{'type':_0x113b55['changes'][0x0]['type'],'index':_0x113b55['index'],'state':_0x113b55['state'],'outdatedReason':_0x113b55['outdatedReason'],'content':_0x2ca3f9,'hasChanges':_0x128260,'wrapperTag':_0x39ccc4};})['filter'](_0x246fec=>null!==_0x246fec);}function un(_0x522448,_0x229eb0,_0x3d5ecf,_0xb8d82c,_0x4f72e7=!0x0){const _0x7f2754=_0x522448['plugins']['get']('DocumentCompare'),_0x40989f=Os(_0x229eb0),_0x34daa1=Os(_0x3d5ecf),_0x4c24d1=_0x522448['data']['parse'](_0x40989f,'$root'),_0x290f7b=_0x522448['model']['createPositionAt'](_0x4c24d1,0x0),_0x2d80a2=_0x7f2754['getDiff'](_0x40989f,_0x34daa1,{'anchor':_0x290f7b,'markDeletions':_0xb8d82c,'targetEditor':_0x522448})['getOperations']();if(0x0==_0x2d80a2['length'])return{'content':_0x229eb0['cloneNode'](!0x0),'hasChanges':!0x1};if(_0xb8d82c?function(_0x344047,_0x10349f,_0x1d5776){if(0x0==_0x344047['length'])return;const _0x21aa1d=_0x1d5776['plugins']['get']('DocumentCompare'),_0xc11609=_0x1d5776['plugins']['get']('SuggestionsConversion');_0x1d5776['model']['change'](_0xd71035=>{const _0x1b5b64=new Set();for(let _0xd0a2f7=0x0;_0xd0a2f7<_0x344047['length'];_0xd0a2f7++){const _0x214bf3=_0x344047[_0xd0a2f7];if(_0x214bf3['baseVersion']=null,_0x214bf3['isDocumentOperation']=!0x1,!_0x22fa04(_0x214bf3)){if(_0x21aa1d['isMarkedRemoveOperation'](_0x214bf3)){const _0x5b9ba4=_0x283dbd(_0x214bf3['newRange'],_0x1d5776['model']),_0x26b84f='suggestion:deletion:'+kt()+':$aiSuggestion';_0x10349f['markers']['set'](_0x26b84f,_0x5b9ba4);}else switch(_0x214bf3['type']){case'rename':{if(_0x214bf3['oldName']==_0x214bf3['newName'])break;_0xd71035['batch']['addOperation'](_0x214bf3),_0x1d5776['model']['applyOperation'](_0x214bf3);const _0x12ba5f='$elementName',_0x2a65ef=_0x214bf3['position'],_0x232e9d=_0x1d5776['model']['createRange'](_0x2a65ef,_0x1d5776['model']['createPositionAt'](_0x2a65ef['nodeAfter'],'end')),_0x353f36='suggestion:attribute:'+_0x12ba5f+':'+kt()+':$aiSuggestion';_0x10349f['markers']['set'](_0x353f36,_0x232e9d);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x214bf3['oldValue']==_0x214bf3['newValue'])break;_0xd71035['batch']['addOperation'](_0x214bf3),_0x1d5776['model']['applyOperation'](_0x214bf3);const _0x19f95b=_0x214bf3['key'];if(!_0xc11609['isRegisteredAttribute'](_0x19f95b))break;const _0x2709d6=_0x283dbd(_0x214bf3['range'],_0x1d5776['model']),_0x4fa3f9='suggestion:attribute:'+_0x19f95b+':'+kt()+':$aiSuggestion';_0x10349f['markers']['set'](_0x4fa3f9,_0x2709d6);break;}case'insert':{if(_0xd71035['batch']['addOperation'](_0x214bf3),_0x1d5776['model']['applyOperation'](_0x214bf3),dn(_0x10349f,_0x214bf3),_0x344047[_0xd0a2f7+0x1]&&'move'==_0x344047[_0xd0a2f7+0x1]['type'])break;const _0x361505=_0x214bf3['position'],_0x1c9f1b=_0x214bf3['howMany'],_0x220167=_0x283dbd(_0x1d5776['model']['createRange'](_0x361505,_0x361505['getShiftedBy'](_0x1c9f1b)),_0x1d5776['model']),_0x4242a0='suggestion:insertion:'+kt()+':$aiSuggestion';_0x10349f['markers']['set'](_0x4242a0,_0x220167);break;}case'split':{_0xd71035['batch']['addOperation'](_0x214bf3),_0x1d5776['model']['applyOperation'](_0x214bf3),dn(_0x10349f,_0x214bf3);const _0x174fe=_0x214bf3['splitPosition'],_0x5d84ca=_0x214bf3['moveTargetPosition'],_0x3c0652=_0x1d5776['model']['createRange'](_0x174fe,_0x5d84ca),_0x582939='suggestion:insertion:'+kt()+':$aiSuggestion';_0x10349f['markers']['set'](_0x582939,_0x3c0652);break;}case'move':{_0xd71035['batch']['addOperation'](_0x214bf3),_0x1d5776['model']['applyOperation'](_0x214bf3),dn(_0x10349f,_0x214bf3);const _0x47de70=_0x214bf3['getMovedRangeStart'](),_0x54927e=_0x214bf3['howMany'];for(let _0x2df453=0x0;_0x2df453<_0x54927e;_0x2df453++){const _0x34c9a8=_0x47de70['getShiftedBy'](_0x2df453)['nodeAfter'];_0x1b5b64['add'](_0x34c9a8);}break;}case'remove':{const _0x5d9b83=_0x214bf3['sourcePosition'],_0x21cc14=_0x214bf3['howMany'],_0x4d6bde=new _0x19e331(_0x5d9b83,_0x21cc14);_0xd71035['batch']['addOperation'](_0x4d6bde),_0x1d5776['model']['applyOperation'](_0x4d6bde),dn(_0x10349f,_0x214bf3);break;}}}}for(const _0x570dda of _0x1b5b64){const _0x87e387=_0x1d5776['model']['createRangeOn'](_0x570dda),_0x137f62='suggestion:formatBlock:$fakeWrap:'+kt()+':$aiSuggestion';_0x10349f['markers']['set'](_0x137f62,_0x283dbd(_0x87e387,_0x1d5776['model']));}});}(_0x2d80a2,_0x4c24d1,_0x522448):_0x522448['model']['change'](_0x77dd8e=>{for(const _0x25b29f of _0x2d80a2)if(!_0x22fa04(_0x25b29f)){if('remove'==_0x25b29f['type']){const _0x1e4037=_0x25b29f['sourcePosition'],_0x505ece=_0x25b29f['howMany'],_0x466f1d=new _0x19e331(_0x1e4037,_0x505ece);_0x77dd8e['batch']['addOperation'](_0x466f1d),_0x522448['model']['applyOperation'](_0x466f1d),dn(_0x4c24d1,_0x25b29f);}else{if('marker'==_0x25b29f['type']){const _0x4d0602=_0x25b29f['name'],_0x454fbf=_0x25b29f['newRange'];null!==_0x454fbf?_0x4c24d1['markers']['set'](_0x4d0602,_0x454fbf):_0x4c24d1['markers']['delete'](_0x4d0602);}else _0x25b29f['baseVersion']=null,_0x25b29f['isDocumentOperation']=!0x1,_0x77dd8e['batch']['addOperation'](_0x25b29f),_0x522448['model']['applyOperation'](_0x25b29f),dn(_0x4c24d1,_0x25b29f);}}}),_0x4f72e7){const _0x3a57b7=_n(_0x522448,_0x2d80a2,_0x4c24d1);An(_0x522448['model'],_0x3a57b7),function(_0x36c8c2,_0x168811){const _0x16cc36=_0x168811['getFirstRange']()['start'];let _0x41baee=_0x168811['getFirstRange']()['end'];const _0x2d9f7d=_0x16cc36['root'];(_0x41baee['textNode']||_0x41baee['nodeAfter']&&_0x41baee['nodeAfter']['is']('$text'))&&(_0x1b6802(_0x41baee,'...'),En(_0x2d9f7d,_0x41baee,0x3),_0x41baee=_0x41baee['getShiftedBy'](0x3)),(_0x16cc36['textNode']||_0x16cc36['nodeBefore']&&_0x16cc36['nodeBefore']['is']('$text'))&&(_0x1b6802(_0x16cc36,'...'),En(_0x2d9f7d,_0x16cc36,0x3),_0x16cc36['parent']==_0x41baee['parent']&&(_0x41baee=_0x41baee['getShiftedBy'](0x3)));const _0x404217=_0x36c8c2['createRange'](_0x36c8c2['createPositionAt'](_0x2d9f7d,0x0),_0x16cc36),_0x2ee40c=_0x36c8c2['createRange'](_0x41baee,_0x36c8c2['createPositionAt'](_0x2d9f7d,'end')),_0x58f053=[..._0x404217['getMinimalFlatRanges'](),..._0x2ee40c['getMinimalFlatRanges']()];_0x58f053['reverse']();for(const _0x175f9d of _0x58f053)_0x4f5333(_0x175f9d),pn(_0x2d9f7d,_0x175f9d);}(_0x522448['model'],_0x3a57b7);}return{'content':Rs(_0x522448['data']['stringify'](_0x4c24d1,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function dn(_0x42cc11,_0x14bb86){for(const [_0xa95739,_0x4f2044]of _0x42cc11['markers']){const _0x857ca8=_0x2af2ad['_createFromRanges'](_0x4f2044['getTransformedByOperation'](_0x14bb86));_0x857ca8['root']==_0x42cc11?_0x42cc11['markers']['set'](_0xa95739,_0x857ca8):_0x42cc11['markers']['delete'](_0xa95739);}}function _n(_0x2eecf6,_0x295605,_0x9c4dd8){const _0x373ca4=_0x2eecf6['plugins']['get']('DocumentCompare');let _0x2513eb=_0x2eecf6['model']['createPositionAt'](_0x9c4dd8,Number['POSITIVE_INFINITY']),_0x8e7ade=_0x2eecf6['model']['createPositionAt'](_0x9c4dd8,0x0);for(const _0x33fbae of _0x295605){let _0x182278,_0x30999c;if(_0x373ca4['isMarkedRemoveOperation'](_0x33fbae))_0x182278=_0x33fbae['newRange']['start'],_0x30999c=_0x33fbae['newRange']['end'];else switch(_0x2513eb=gn(_0x2513eb,_0x33fbae),_0x8e7ade=gn(_0x8e7ade,_0x33fbae),_0x33fbae['type']){case'rename':_0x182278=_0x33fbae['position'],_0x30999c=_0x182278['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x182278=_0x33fbae['range']['start'],_0x30999c=_0x33fbae['range']['end'];break;case'insert':_0x182278=_0x33fbae['position'],_0x30999c=_0x182278['getShiftedBy'](_0x33fbae['howMany']);break;case'split':_0x182278=_0x33fbae['splitPosition'],_0x30999c=_0x33fbae['moveTargetPosition'];break;case'merge':{const _0x331cb9=_0x33fbae['targetPosition']['path']['slice'](0x0,-0x1);_0x182278=_0x2eecf6['model']['createPositionFromPath'](_0x9c4dd8,_0x331cb9),_0x30999c=_0x182278['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x20ed93=_0x33fbae['howMany'],_0x27ac23=_0x33fbae['sourcePosition']['_getTransformedByInsertion'](_0x33fbae['targetPosition'],_0x20ed93),_0x1cb485=_0x33fbae['getMovedRangeStart']();'remove'==_0x33fbae['type']?(_0x182278=_0x27ac23,_0x30999c=_0x27ac23):(_0x182278=_0x1cb485,_0x30999c=_0x1cb485['getShiftedBy'](_0x20ed93));break;}}_0x182278&&_0x182278['isBefore'](_0x2513eb)&&(_0x2513eb=_0x182278['clone'](),_0x2513eb['stickiness']='toNone'),_0x30999c&&_0x30999c['isAfter'](_0x8e7ade)&&(_0x8e7ade=_0x30999c['clone'](),_0x8e7ade['stickiness']='toNone');}return _0x2eecf6['model']['createSelection'](_0x2eecf6['model']['createRange'](_0x2513eb,_0x8e7ade));}function gn(_0x36f00f,_0x4f57c1){return'move'!=_0x4f57c1['type']&&'remove'!=_0x4f57c1['type']||_0x4f57c1['sourceRange']['containsPosition'](_0x36f00f)&&((_0x36f00f=_0x4f57c1['sourcePosition']['clone']())['stickiness']='toNone'),_0x36f00f['getTransformedByOperation'](_0x4f57c1);}function An(_0x5422f7,_0x1a7d6c){In(_0x5422f7,_0x1a7d6c,'forward');const _0x115c36=_0x1a7d6c['getFirstRange']();_0x1a7d6c['setTo']([]),_0x1a7d6c['setTo'](_0x115c36,{'backward':!0x0}),In(_0x5422f7,_0x1a7d6c,'backward');}function In(_0x5ce831,_0x3050bb,_0x487dee){let _0x349dfa=0x14;for(;_0x349dfa;){_0x5ce831['modifySelection'](_0x3050bb,{'unit':'word','direction':_0x487dee}),_0x349dfa--;const _0x267009=_0x3050bb['focus']['forward'==_0x487dee?'nodeBefore':'nodeAfter'];if(_0x267009&&_0x267009['is']('element')&&_0x5ce831['schema']['isBlock'](_0x267009)&&_0x5ce831['schema']['isObject'](_0x267009))break;}}function pn(_0x14484c,_0xc2d3c1){for(const [_0x3db7d7,_0x3c688b]of _0x14484c['markers']){const _0x4610c4=_0x3c688b['_getTransformedByDeletion'](_0xc2d3c1['start'],_0xc2d3c1['end']['offset']-_0xc2d3c1['start']['offset']);null!=_0x4610c4?_0x14484c['markers']['set'](_0x3db7d7,_0x4610c4):_0x14484c['markers']['delete'](_0x3db7d7);}}function En(_0x1733ec,_0x4c4bdd,_0x465e44){for(let [_0x144230,_0x461d81]of _0x1733ec['markers'])_0x461d81=_0x461d81['_getTransformedByInsertion'](_0x4c4bdd,_0x465e44,!0x1)[0x0],_0x1733ec['markers']['set'](_0x144230,_0x461d81);}function mn(_0x5bba3c,_0x3de167){for(const _0x59da25 of _0x5bba3c)'noop'!==_0x59da25['type']&&(_0x59da25['_aiSource']=_0x3de167);}var Tn=class extends _0x212144{static get['pluginName'](){return'AIGateway';}static get requires(){return[_0x5388eb,fs];}get['models'](){return this['context']['plugins']['get'](fs)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['apply'](_0x165c8d,_0x1f6250){const {applyMethod:_0x5e627e,roots:_0x21b729}=_0x1f6250,_0x13db04='suggest'===_0x5e627e;if(_0x165c8d['error']||!_0x165c8d['results']['length'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0x165c8d['status']});if(_0x21b729){if(0x0===_0x21b729['length'])throw new ct('ai-gateway-apply-empty-roots',this);for(const {channelId:_0x39ecec,rootName:_0x7c68e}of _0x21b729)if(!_0x165c8d['results']['some'](_0x4d4c2c=>_0x4d4c2c['channelId']===_0x39ecec&&_0x4d4c2c['rootName']===_0x7c68e))throw new ct('ai-gateway-apply-root-not-found',this,{'channelId':_0x39ecec,'rootName':_0x7c68e});}const _0x24aa9d=_0x165c8d['results']['reduce']((_0x99f627,_0x4fb3e7)=>{if(_0x21b729&&!_0x21b729['some'](_0x23281b=>_0x23281b['channelId']===_0x4fb3e7['channelId']&&_0x23281b['rootName']===_0x4fb3e7['rootName']))return _0x99f627;if('completed'!==_0x4fb3e7['status'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0x4fb3e7['status'],'channelId':_0x4fb3e7['channelId'],'rootName':_0x4fb3e7['rootName']});if(_0x13db04&&!_0x4fb3e7['editor']['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',this,{'channelId':_0x4fb3e7['channelId'],'rootName':_0x4fb3e7['rootName']});let _0x6968dc=_0x99f627['get'](_0x4fb3e7['editor']);return _0x6968dc||(_0x6968dc=[],_0x99f627['set'](_0x4fb3e7['editor'],_0x6968dc)),_0x6968dc['push'](_0x4fb3e7),_0x99f627;},new Map()),_0x451fe1=this['context']['plugins']['get'](_0x5388eb);for(const [_0x8b8334,_0x39efb9]of _0x24aa9d){const _0x4c583e=_0x39efb9['map'](_0x29c3b3=>{const _0x33175a=_0x8b8334['model']['createPositionAt'](_0x8b8334['model']['document']['getRoot'](_0x29c3b3['rootName']),0x0),_0x22bdf6=Qs(_0x8b8334,_0x29c3b3['rootName'],_0x29c3b3['contentRawOld'],_0x29c3b3['contentRawNew']);if(!_0x22bdf6)return _0x29c3b3['droppedUnsupportedInlineChange']=!0x0,null;const _0x18c1d7=_0x451fe1['getDiff'](_0x22bdf6['before'],_0x22bdf6['after'],{'anchor':_0x33175a,'markDeletions':_0x13db04,'targetEditor':_0x8b8334}),_0x142162=_0x8b8334['model']['document']['history']['getOperations'](_0x29c3b3['documentVersion']),_0x14e336={'document':_0x8b8334['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x134ad4=_0x3b7a23(_0x18c1d7['getOperations'](),_0x142162,_0x14e336)['operationsA'];return mn(_0x134ad4,_0x1f6250['aiSource']??'api'),_0x134ad4;});_0x8b8334['model']['change'](_0x57a08e=>{for(const _0x57ed3d of _0x4c583e)_0x57ed3d&&(_0x13db04?_0x8b8334['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x57ed3d):_0x451fe1['applyOperations'](_0x57a08e,_0x57ed3d));});}}mergeChangesIntoContent(_0x13e2bd,_0x50c517,_0x5da382){const _0x28bda5=new hn(),_0x149a7e=new sn();let _0x5b0896=_0x28bda5['parseAndNormalizeHTML'](_0x50c517);for(const _0x2815f9 of _0x13e2bd)try{const _0x1277b4=_0x28bda5['parseAndNormalizeHTML'](_0x2815f9['content']);_0x5b0896=_0x149a7e['merge'](_0x1277b4,_0x5b0896,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x1e826e){throw new ct('ai-gateway-merge-failed',this,{..._0x2815f9},_0x1e826e);}return un(_0x5da382,_0x28bda5['parseAndNormalizeHTML'](_0x50c517),_0x5b0896,!0x1,!0x1)['content'];}};const wn=/* #__PURE__ -- @preserve */
|
|
28
|
+
dt(),Cn=['capabilitiesUpdated'];var fn=class extends wn{['_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(_0x404b15){const _0x38a72d={};if(!_0x404b15)return _0x38a72d;('isWebSearchEnabled'in _0x404b15?_0x404b15['isWebSearchEnabled']:_0x404b15['webSearch'])&&(_0x38a72d['webSearch']={});const _0x4b538b='isReasoningEnabled'in _0x404b15?_0x404b15['isReasoningEnabled']:_0x404b15['reasoning'];return _0x4b538b&&(_0x38a72d['reasoning']='string'==typeof _0x4b538b?{'level':_0x4b538b}:{}),_0x38a72d;}toggleWebSearch(){this['setWebSearch'](!this['_isWebSearchEnabled']);}toggleReasoning(){this['setReasoning'](!this['_isReasoningEnabled']);}setWebSearch(_0x425ddf){_0x425ddf!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x425ddf,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}setReasoning(_0x4e82cc){_0x4e82cc!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x4e82cc,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}};function bn(_0x2ee7cd,_0x1f7a18,_0x5049f7,_0x4e914d){if(_0x2ee7cd instanceof ct)return _0x2ee7cd;const _0x13dbad=_0x2ee7cd?.['data'];return new ct(_0x1f7a18,_0x5049f7,void 0x0!==_0x13dbad?{..._0x4e914d,'backendData':_0x13dbad}:_0x4e914d,_0x2ee7cd);}var Sn=class{_editor;_rootName;['_channelId'];['_sessionId'];_documentVersion;_contentRawOld;_contentRawNew;['_error'];_isAborted=!0x1;_droppedUnsupportedInlineChange=!0x1;constructor(_0x163600){this['_editor']=_0x163600['editor'],this['_rootName']=_0x163600['rootName'],this['_channelId']=_0x163600['channelId'],this['_sessionId']=_0x163600['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(_0x27e11e){this['_documentVersion']=_0x27e11e;}get contentRawOld(){return this['_contentRawOld'];}set contentRawOld(_0x57a9cb){this['_contentRawOld']=_0x57a9cb;}get contentRawNew(){return this['_contentRawNew'];}set contentRawNew(_0x4e0a71){this['_contentRawNew']=_0x4e0a71;}get contentOld(){return this['_dropDataIds'](this['_contentRawOld']||'');}get contentNew(){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x148524){this['_error']=_0x148524;}get droppedUnsupportedInlineChange(){return this['_droppedUnsupportedInlineChange'];}set droppedUnsupportedInlineChange(_0x1223df){this['_droppedUnsupportedInlineChange']=_0x1223df;}abort(){this['_isAborted']=!0x0;}_dropDataIds(_0x2b1394){return _0x2b1394['replace'](/ data-id="[a-z0-9]+"/g,'');}},Rn=class extends Sn{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0x5b215e){this['_summary']=_0x5b215e;}},On=class{_results;constructor(_0x296050=[]){this['_results']=_0x296050;}_status='initialized';['_error'];abort(){'error'!==this['_status']&&(this['_status']='aborted');}get status(){return this['_status'];}set status(_0x78a5cb){this['_status']=_0x78a5cb;}get['error'](){return this['_error'];}set['error'](_0x48ffd5){this['_status']='error',this['_error']=_0x48ffd5;}get results(){return this['_results'];}addResult(..._0x4540d5){this['_results']['push'](..._0x4540d5);}},vn=class extends _0x212144{static get['pluginName'](){return'AIDocumentProcessingGateway';}static get requires(){return[Is,tn,Tn,fs];}get['models'](){return this['context']['plugins']['get'](fs)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async processDocument(_0x1a054b,_0x3e9be3){if(!_0x1a054b)throw new ct('ai-documentprocessinggateway-missing-prompt',this);const _0x28fb9b=await this['context']['plugins']['get'](tn)['getDocumentData'](),_0x3ab288=_0x3e9be3['roots'];if(0x0===(_0x3ab288??_0x28fb9b)['length'])throw new ct('ai-documentprocessinggateway-empty-roots',this);if(_0x3ab288){for(const _0x211eda of _0x3ab288)if(!_0x28fb9b['some'](_0x1f5d61=>_0x1f5d61['rootName']===_0x211eda['rootName']&&_0x1f5d61['channelId']===_0x211eda['channelId']))throw new ct('ai-documentprocessinggateway-root-not-found',this,{'channelId':_0x211eda['channelId'],'rootName':_0x211eda['rootName']});}const _0x303895=_0x3ab288?_0x28fb9b['filter'](_0x5947db=>_0x3ab288['some'](_0x34f5d1=>_0x34f5d1['rootName']===_0x5947db['rootName']&&_0x34f5d1['channelId']===_0x5947db['channelId'])):_0x28fb9b,_0x399b4c=[],_0x2e2505=[];for(const _0x40ecfd of _0x303895){const _0x575670={'editor':_0x40ecfd['editor'],'rootName':_0x40ecfd['rootName'],'sessionId':_0x40ecfd['sessionId'],'channelId':_0x40ecfd['channelId'],'contentRawOld':_0x40ecfd['content'],'documentVersion':_0x40ecfd['version']};_0x399b4c['push'](_0x575670),_0x2e2505['push']({'type':'document','content':_0x575670['contentRawOld']});}const _0x30e478=this['context']['plugins']['get']('AIConnector')['processDocument']({'content':_0x2e2505,'prompt':_0x1a054b,'model':_0x3e9be3['model'],'capabilities':fn['getCapabilitiesRequestData'](_0x3e9be3['capabilities']),'contexts':_0x3e9be3['contexts']});let _0x5c6eb5;if(_0x3e9be3?.['signal']){_0x3e9be3['signal']['aborted']&&_0x30e478['abortController']['abort']();const _0x50e68d=_0x3e9be3['signal'],_0x271f6c=()=>_0x30e478['abortController']['abort']();_0x50e68d['addEventListener']('abort',_0x271f6c),_0x5c6eb5=()=>_0x50e68d['removeEventListener']('abort',_0x271f6c);}const _0x576c07=new On();let _0x136115=[];try{if(_0x136115=(await _0x30e478['getResult']())['documents'],!(_0x136115&&_0x136115['length']>0x0))throw new ct('ai-documentprocessinggateway-empty-reply',this);if(_0x136115['length']!==_0x2e2505['length'])throw new ct('ai-documentprocessinggateway-reply-count-mismatch',this,{'expected':_0x2e2505['length'],'received':_0x136115['length']});const _0x530a49=_0x136115['findIndex'](({document:_0x21a046})=>!_0x21a046['length']);if(-0x1!==_0x530a49){const _0x4e58b8=_0x399b4c[_0x530a49];throw new ct('ai-documentprocessinggateway-empty-root-content',this,{'channelId':_0x4e58b8['channelId'],'rootName':_0x4e58b8['rootName']});}_0x576c07['status']='completed';}catch(_0x25bca4){_0x25bca4 instanceof Error&&_0x25bca4['message']['includes']('ai-request-aborted')?_0x576c07['abort']():_0x576c07['error']=bn(_0x25bca4,'ai-documentprocessinggateway-run-failed',this);}finally{_0x5c6eb5&&_0x5c6eb5();}if('completed'===_0x576c07['status'])for(const [_0x8d1a5e,_0x39fc2b]of _0x399b4c['entries']()){const {channelId:_0x541eb6,contentRawOld:_0x1a072e,documentVersion:_0x4f9ae9,editor:_0x204a37,rootName:_0x513b6c,sessionId:_0x5d4c9e}=_0x39fc2b,_0x560c82=new Rn({'channelId':_0x541eb6,'editor':_0x204a37,'rootName':_0x513b6c,'sessionId':_0x5d4c9e});_0x560c82['contentRawOld']=_0x1a072e,_0x560c82['documentVersion']=_0x4f9ae9,_0x560c82['contentRawNew']=_0x136115[_0x8d1a5e]['document'],_0x560c82['summary']=_0x136115[_0x8d1a5e]['summary'],_0x576c07['addResult'](_0x560c82);}return _0x576c07;}applyResult(_0x4baadc,_0x54136c){this['context']['plugins']['get']('AIGateway')['apply'](_0x4baadc,_0x54136c);}};function kn(_0x562a02){return _0x562a02 instanceof Error&&('AbortError'===_0x562a02['name']||('AICoreError'===_0x562a02['name']?!0x0===_0x562a02['isAbort']:_0x562a02['message']['startsWith']('ai-request-aborted')));}var yn=class extends Error{['code'];severity;type;context;isAbort;constructor(_0x78325e){super(_0x78325e['code'],_0x78325e['cause']instanceof Error?{'cause':_0x78325e['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0x78325e['code'],this['severity']=_0x78325e['severity']??'error',this['type']=_0x78325e['type']??'system',this['context']=_0x78325e['context'],this['isAbort']=_0x78325e['isAbort']??kn(_0x78325e['cause']);}},Nn=class extends _0x212144{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}createReporter(_0x35c909){return new xn(this,_0x35c909);}},xn=class{['_sink'];_component;constructor(_0x5d2d51,_0x365deb){this['_sink']=_0x5d2d51,this['_component']=_0x365deb;}['logError'](_0x4d9fcc,_0x210558={}){this['_emit'](_0x4d9fcc,_0x210558),this['_defaultLog'](_0x4d9fcc);}reportError(_0x1742a7,_0x7c7e29={}){this['_emit'](_0x1742a7,_0x7c7e29);}_emit(_0x3560b7,_0x2cb3c5){kn(_0x3560b7)||this['_sink']['fire']('error',{'error':_0x3560b7,'component':this['_component'],'context':_0x2cb3c5['context']});}_defaultLog(_0x1df7c5){if(!kn(_0x1df7c5)){if(_0x1df7c5 instanceof yn){if('user'===_0x1df7c5['type']||'network'===_0x1df7c5['type'])return;if('warning'===_0x1df7c5['severity'])return void console['warn'](this['_component'],_0x1df7c5);}console['error'](this['_component'],_0x1df7c5);}}};const Ln='ck-ai-button-primary',Pn='ck-ai-button-secondary',Dn='ck-ai-button-tertiary';function Hn(_0x110a44,_0x13acde){const _0x37c32d=new Mt(_0x110a44),_0x2731e3=Es(_0x110a44,'AI_TABS_LABEL_MINIMIZE'),_0x4e533d=Es(_0x110a44,'AI_TABS_LABEL_MAXIMIZE');return _0x37c32d['set']({'withText':!0x1,'icon':_0x579826,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+Dn}),_0x37c32d['bind']('label')['to'](_0x13acde,'isMaximized',_0x49bc26=>_0x49bc26?_0x2731e3:_0x4e533d),_0x37c32d['bind']('icon')['to'](_0x13acde,'isMaximized',_0xb93935=>_0xb93935?_0x10e858:_0x579826),_0x37c32d['bind']('isOn')['to'](_0x13acde,'isMaximized'),_0x37c32d['on']('execute',()=>{_0x13acde['fire']('resizeTabs');}),_0x37c32d;}function Mn(_0x340219){const _0x4d5848=new Pt(_0x340219);return _0x4d5848['attachToDom'](),_0x4d5848['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x4d5848;}const Un=/* #__PURE__ -- @preserve */
|
|
29
|
+
At();var Vn=class extends Un{['id'];interactionId;type;content=new Map();['sources']=[];parsedContent=new Map();parsedMergedContent=new Map();['changeGroups']=[];areActionsDisabled=!0x1;_outdatedReasonByDocumentId;isFromHistory=!0x1;documentContextContent;_documentIdToSource=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];cachedSuggestionContentParts={'withDiff':[],'withoutDiff':[]};constructor({type:_0x51e892,isDone:_0x506ac3=!0x1,isComplete:_0x57006c,interactionId:_0x17298e,areActionsDisabled:_0x5da263,outdatedReasonByDocumentId:_0x16576c,isFromHistory:_0x16240c=!0x1,documentContextContent:_0x264d53,locale:_0x2a8b43,id:_0x4aba9e,channelsToEditors:_0x51856f}){super(),this['id']=_0x4aba9e||kt(),this['interactionId']=_0x17298e,this['type']=_0x51e892,this['areActionsDisabled']=!!_0x5da263,this['_outdatedReasonByDocumentId']=_0x16576c,this['isFromHistory']=_0x16240c,this['locale']=_0x2a8b43,this['aiResponseParser']=new hn(),this['aiResponseApplier']=new sn(),this['documentContextContent']=new Map(_0x264d53?.['map'](_0x10f0cf=>[_0x10f0cf['id'],Rs(_0x10f0cf['content'])])||[]),this['_documentIdToSource']=new Map(_0x264d53?.['map'](_0xcc6b1a=>[_0xcc6b1a['id'],{'editor':_0x51856f['get'](_0xcc6b1a['channelId']),'rootName':_0xcc6b1a['rootName']}])||[]),this['set']('isDone',_0x506ac3),this['set']('isComplete',_0x57006c??_0x506ac3),'text'===this['type']&&this['content']['set']('text','');}appendContent(_0x40221d,_0x402553){const _0x29ad57='text'===this['type']?'text':_0x402553;this['content']['has'](_0x29ad57)||this['content']['set'](_0x29ad57,''),this['content']['set'](_0x29ad57,this['content']['get'](_0x29ad57)+_0x40221d),this['onContentChange'](_0x29ad57);}['done'](_0x178ad3=!0x0){this['isComplete']=_0x178ad3,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}destroy(){this['stopListening']();}setChangeGroupState(_0x21bf18,_0x1501ae,_0x5d37e4){this['changeGroups'][_0x21bf18]['state']=_0x1501ae,this['changeGroups'][_0x21bf18]['outdatedReason']=_0x5d37e4,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x21bf18,'state':_0x1501ae,'outdatedReason':_0x5d37e4});}getContentParts({showDiff:_0x4174f3,groupIndex:_0x4b34c0}){const _0x3f9505=this['_getCachedContentParts'](_0x4174f3,_0x4b34c0);if(_0x3f9505)return _0x3f9505;let _0xcfee76;if(void 0x0===_0x4b34c0)_0xcfee76=this['changeGroups'];else{const _0x109498=this['changeGroups']['find'](({index:_0x2c39b6})=>_0x2c39b6===_0x4b34c0);if(!_0x109498)throw new ct('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x4b34c0});_0xcfee76=[_0x109498];}const _0x246556=ln({'showDiff':_0x4174f3,'changeGroups':_0xcfee76,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x4174f3,_0x246556),_0x246556;}_getCachedContentParts(_0x46b0bd,_0x2d1e1b){const _0x436d12=_0x46b0bd?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x436d12]['length'])return null;const _0x217898=this['cachedSuggestionContentParts'][_0x436d12];if(void 0x0===_0x2d1e1b)return _0x217898['length']>0x0&&_0x217898['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x46b0bd,null),null):_0x54d2c3(_0x217898);{const _0xdef76d=_0x217898['find'](({index:_0x7ddfd2})=>_0x7ddfd2===_0x2d1e1b);if(_0xdef76d)return[_0x54d2c3(_0xdef76d)];}return null;}_setCachedContentParts(_0x3157fa,_0x210a35){const _0x553fbd=_0x3157fa?'withDiff':'withoutDiff';_0x210a35?_0x210a35['forEach'](_0x2a60a9=>{const _0x335f4e=this['cachedSuggestionContentParts'][_0x553fbd],_0x22c33e=_0x335f4e['find'](({index:_0x149050})=>_0x149050===_0x2a60a9['index']);if(_0x22c33e){const _0xf358cd=_0x335f4e['indexOf'](_0x22c33e);_0x335f4e['splice'](_0xf358cd,0x1,_0x2a60a9);}else _0x335f4e['push'](_0x2a60a9);}):this['cachedSuggestionContentParts'][_0x553fbd]['length']=0x0;}onContentChange(_0x1e3928){if('modification'===this['type']){if(_0x1e3928)this['parsedContent']['set'](_0x1e3928,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x1e3928)));else{for(const [_0x152ffe,_0x46fd9c]of this['content'])this['parsedContent']['set'](_0x152ffe,this['aiResponseParser']['parseAndNormalizeHTML'](_0x46fd9c));}const _0x56e4e3=this['changeGroups'];for(const _0x190a70 of this['content']['keys']())this['updateChangeGroups'](_0x190a70);const _0x176323=this['_getDifferentChangeGroups'](_0x56e4e3,this['changeGroups']);(_0x176323['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x176323),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(_0x27a516,_0x40af0c){const _0x564834=[];for(const _0x5cbdab of _0x40af0c){const _0x1ebef7=_0x27a516[_0x5cbdab['index']];_0x1ebef7?_0x1ebef7['changes']['length']!==_0x5cbdab['changes']['length']?_0x564834['push'](_0x5cbdab):_0x1ebef7['changes']['forEach']((_0x12a44d,_0x28df85)=>{const _0x5688f1=_0x5cbdab['changes'][_0x28df85];_0x12a44d['id']!==_0x5688f1['id']&&_0x564834['push'](_0x5cbdab);}):_0x564834['push'](_0x5cbdab);}return _0x564834;}updateChangeGroups(_0x449fa8){const _0x29b358=this['documentContextContent']['get'](_0x449fa8),_0xd153f8=this['parsedContent']['get'](_0x449fa8);if(!_0x29b358||!_0xd153f8)return;const _0x59ab62=new _0x5b6203('p',{},[new _0x5b6203('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x5be0d8(Es(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x4d5060=this['aiResponseApplier']['merge'](_0xd153f8,_0x29b358['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x59ab62});this['parsedMergedContent']['set'](_0x449fa8,_0x4d5060['parsedContent']);let _0xfc2d24=[];if(_0x26a2ae(_0x2e0595=>{const _0x41a422=Ps(_0x2e0595,'data-id');if(!_0x41a422||!_0x3d2743(_0x41a422))return!0x1;const _0x16b0b9=[_0x2e0595,...Ms(_0x2e0595)]['at'](-0x2);if(_0x2e0595!=_0x16b0b9){const _0x5a4949=Ps(_0x16b0b9,'data-id');_0x3d2743(_0x5a4949)||(_0xfc2d24['push']({'node':_0x16b0b9,'id':_0x5a4949,'type':'modified'}),_0x4d5060['modifiedNodeIds']['push'](_0x5a4949));}else _0x4d5060['modifiedNodeIds']['includes'](_0x41a422)?_0xfc2d24['push']({'node':_0x2e0595,'type':'modified','id':_0x41a422}):_0x4d5060['newNodeIds']['includes'](_0x41a422)?_0xfc2d24['push']({'node':_0x2e0595,'type':'new','id':_0x41a422,'anchorId':Ps(_0x2e0595['previousSibling'],'data-id')}):_0xfc2d24['push']({'node':_0x2e0595,'type':'removed','id':_0x41a422});return!0x0;},this['parsedMergedContent']['get'](_0x449fa8)),_0xfc2d24=_0xfc2d24['filter'](({node:_0x53e9f9})=>[...Ms(_0x53e9f9),_0x53e9f9]['every'](_0x390c3e=>!Ps(_0x390c3e,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x1edbb7=>_0x1edbb7['documentId']!==_0x449fa8),0x0==_0xfc2d24['length'])return;const _0x2a3dcc=[[_0xfc2d24[0x0]]];for(let _0x178929=0x1;_0x178929<_0xfc2d24['length'];_0x178929++){const _0x32c436=_0x2a3dcc[_0x2a3dcc['length']-0x1],_0x515193=_0x32c436[_0x32c436['length']-0x1];_0xfc2d24[_0x178929]['node']['previousSibling']==_0x515193['node']&&'modified'!=_0xfc2d24[_0x178929]['type']&&'modified'!=_0x515193['type']?_0x32c436['push'](_0xfc2d24[_0x178929]):_0x2a3dcc['push']([_0xfc2d24[_0x178929]]);}for(const _0x484f34 of _0x2a3dcc){const _0x360949=_0x484f34[0x0],_0x5686a6=_0x484f34[_0x484f34['length']-0x1],_0x1bfc5f=_0x35a44f(_0x360949['node']['previousSibling']);_0x1bfc5f&&_0x484f34['unshift'](_0x1bfc5f);const _0x5d1252=_0x35a44f(_0x5686a6['node']['nextSibling']);_0x5d1252&&_0x484f34['push'](_0x5d1252);}ks('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x449fa8))['forEach'](_0x38ce63=>{Ds(_0x38ce63,'data-wrapped-id',null);});const _0x2aefbc=new Map();ks('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x449fa8))['forEach'](_0x5e2d8d=>{const _0xe910f5=Ps(_0x5e2d8d,'data-unwrapped-id'),_0x3c6016=Ps(_0x5e2d8d,'data-id');_0x2aefbc['set'](_0x3c6016,_0xe910f5),Ds(_0x5e2d8d,'data-id',_0xe910f5),Ds(_0x5e2d8d,'data-unwrapped-id',null);});for(const _0x14e45c of _0xfc2d24){const _0x10ffca=_0x2aefbc['get'](_0x14e45c['id']);_0x10ffca&&(_0x14e45c['id']=_0x10ffca);}this['changeGroups']['push'](..._0x2a3dcc['map']((_0x2b29e8,_0x303f2b)=>{const _0x19eb95=this['_documentIdToSource']['get'](_0x449fa8),_0x9939fa=this['_outdatedReasonByDocumentId']?.['get'](_0x449fa8),_0x16b32f=this['areActionsDisabled']||void 0x0!==_0x9939fa;return{'changes':_0x2b29e8,'state':_0x16b32f?'outdated':'pending','outdatedReason':_0x16b32f?_0x9939fa:void 0x0,'index':_0x303f2b,'editor':_0x19eb95['editor'],'rootName':_0x19eb95['rootName'],'documentId':_0x449fa8};}));const _0x54e3a1=Array['from'](this['documentContextContent']['keys']());function _0x3d2743(_0x55bb3e){return _0x4d5060['modifiedNodeIds']['includes'](_0x55bb3e)||_0x4d5060['newNodeIds']['includes'](_0x55bb3e)||_0x4d5060['removedNodeIds']['includes'](_0x55bb3e);}function _0x35a44f(_0x5930e1){if(_0x5930e1&&Ps(_0x5930e1,'data-id')&&!Ps(_0x5930e1,'data-unstable')){const _0x1b09f0=Ps(_0x5930e1,'data-id');if(!_0x3d2743(_0x1b09f0))return{'node':_0x5930e1,'type':'context','id':_0x1b09f0};}return null;}this['changeGroups']['sort']((_0x54ef46,_0x4fa301)=>_0x54e3a1['indexOf'](_0x54ef46['documentId'])-_0x54e3a1['indexOf'](_0x4fa301['documentId'])),this['changeGroups']['forEach']((_0x3e1fc7,_0x131f8b)=>{_0x3e1fc7['index']=_0x131f8b;});}};const Bn=/* #__PURE__ -- @preserve */
|
|
30
|
+
dt(),Gn=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];var Fn=class extends Bn{['id'];['replies']=[];currentReply;['messageId'];actionCallId;currentRequest;connector;isStopped=!0x1;isDestroyed=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;_channelsToEditors;constructor({connector:_0x204a65,locale:_0x47e5af,channelsToEditors:_0x9e18b3}){super(),this['id']=kt(),this['connector']=_0x204a65,this['isStopped']=!0x0,this['locale']=_0x47e5af,this['_channelsToEditors']=_0x9e18b3||new Map();}async start(){await this['_run']();}async['resume'](_0x1531df){await this['_run'](_0x1531df);}async['_run'](_0x543c0e){const _0x40f4ea=[];let _0x41b050,_0x1ea90f,_0x296a84,_0x420821=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x543c0e||this['sendRequest'](),this['fire']('interactionStarted',this);const _0x1bcf1a=await this['currentRequest']['getStream']();for await(const _0x288767 of _0x1bcf1a){if(this['isStopped'])return;if('error'==_0x288767['event'])return void this['fire']('error',{'error':new ct('ai-chat-interaction-error',this)});switch(_0x288767['event']){case'message-metadata':this['messageId']=_0x288767['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x288767['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x288767['data']['conversationTitle'],!0x0);break;case'source':_0x40f4ea['push'](_0x288767['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'](),_0x41b050='modification-delta'==_0x288767['event']?'modification':'text',_0x1ea90f='modification-delta'==_0x288767['event']?_0x288767['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x41b050&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x41b050,'interactionId':this['id'],'id':_0x1ea90f,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x288767['event']&&{'documentId':_0x288767['data']['documentId']}}),'modification'==_0x41b050&&(this['currentReply']['sources']=_0x40f4ea['splice'](0x0))),this['currentReply']['appendContent'](_0x288767['data']['textDelta'],_0x288767['data']['documentId']);break;case'mcp-tool-result':_0x296a84=JSON['parse'](_0x288767['data']['result']),this['_handleToolResultData']({'toolName':_0x288767['data']['toolName'],'data':_0x296a84['data'],'attributes':_0x296a84['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x288767['data']['toolName'],'data':_0x288767['data']['data']});}}_0x420821=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x40f4ea['length']>0x0&&(this['currentReply']['sources']=_0x40f4ea['splice'](0x0)),this['_finalizeInteraction'](_0x420821),this['fire']('interactionFinished',this));}}stop(){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}getReply(_0x146276){return this['replies']['find'](_0xd4309a=>_0xd4309a['id']===_0x146276);}destroy(){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x1b1b60=>_0x1b1b60['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}createReply(_0x45b622){const _0x49f587=this['getDocumentContext'](),_0x5ac4d8=new Vn({'locale':this['locale'],'documentContextContent':_0x49f587?.['documents'],..._0x45b622});return this['replies']['push'](_0x5ac4d8),_0x5ac4d8['delegate'](...Gn)['to'](this),this['fire']('replyCreated',_0x5ac4d8),_0x5ac4d8;}setConversationTitle(_0x61c032,_0x39a08e=!0x1){this['fire']('setConversationTitle',_0x61c032,_0x39a08e);}resetWebSearchState(){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}resetReasoningState(){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}_handleToolResultData(_0x30aa2c){this['fire']('toolDataReceived',{'type':'result','toolName':_0x30aa2c['toolName'],'data':structuredClone(_0x30aa2c['data']||{}),'attributes':structuredClone(_0x30aa2c['attributes']||{})},this);}_handleToolNotificationData(_0x2e4e8a){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x2e4e8a['toolName'],'data':structuredClone(_0x2e4e8a['data'])},this);}_finalizeInteraction(_0x4f3142=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x4f3142),this['currentRequest']=this['currentReply']=void 0x0;}};const Kn='defaultContextIds',Wn=/* #__PURE__ -- @preserve */
|
|
31
|
+
At();var Yn=class AIContext extends Wn{['_refs'];constructor(_0x29a6ef=[]){super(),this['_refs']=[..._0x29a6ef];}get['refs'](){return[...this['_refs']];}get isEmpty(){return 0x0===this['_refs']['length'];}cloneWith(..._0x37f408){return new AIContext([...this['_refs'],..._0x37f408]);}addDefaultContext(_0x1b6600){this['_refs']=[...this['_refs'],..._0x1b6600];}toRequestParts(_0x1fd7cf=[]){return[...this['_refs']['map'](As),..._0x1fd7cf];}toMessageAttributes(_0x298e01){return this['isEmpty']?_0x298e01:{..._0x298e01,[Kn]:[...new Set(this['_refs']['map'](_0x6efe3f=>_0x6efe3f['id']))]};}static getDefaultContextIds(_0xfbda77){const _0x3e0afc=_0xfbda77&&_0xfbda77[Kn];return new Set(Array['isArray'](_0x3e0afc)?_0x3e0afc:[]);}};const $n=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']]),qn=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];var Qn=class AIChatContext extends Yn{_connector;['_config'];['_ownerId'];constructor({connector:_0x198ff2,config:_0x54fe6c,ownerId:_0xd0d9e0}){super(),this['_connector']=_0x198ff2,this['_config']=_0x54fe6c,this['_ownerId']=_0xd0d9e0;}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(_0x1164b8,_0x32e41e,_0x5272a8=new Set()){const _0x3416d1=new Map(),{contextItem:_0x1df7d4,unmatchedDocumentIds:_0x2d2191}=await this['_populateDocumentContextItem'](_0x1164b8,_0x32e41e);_0x1df7d4&&_0x3416d1['set'](_0x1df7d4['id'],_0x1df7d4);for(const _0x25fb5a of _0x1164b8){if('document'===_0x25fb5a['type'])continue;const _0x2315fe=await this['_createContextItemFromContent'](_0x25fb5a,_0x5272a8);'context'!==_0x2315fe['type']&&this['_addToConversationContextItem'](_0x2315fe),_0x3416d1['set'](_0x2315fe['id'],_0x2315fe);}return{'contextItems':_0x3416d1,'hasUnmatched':_0x2d2191['size']>0x0,'unmatchedDocumentIds':_0x2d2191};}async _populateDocumentContextItem(_0x293dd6,_0x4dd906){const _0x11c860=_0x293dd6['filter'](_0x29430f=>'document'===_0x29430f['type']);if(0x0===_0x11c860['length'])return{'unmatchedDocumentIds':new Set()};const _0x42d36e=_0x11c860['map'](_0x5848d7=>_0x5848d7['id']),_0x19a719=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x42d36e)['getDocuments'](),_0x261619=new Map(_0x19a719['map'](_0x3726df=>[_0x3726df['id'],_0x3726df])),_0x9e042c=[],_0x2f5777=new Set();for(const _0x1912e2 of _0x11c860){const _0x3cec6a=_0x261619['get'](_0x1912e2['id']);_0x3cec6a&&(this['_matchDocumentToRoot'](_0x3cec6a,_0x4dd906)||_0x2f5777['add'](_0x3cec6a['id']),_0x9e042c['push']({'id':_0x3cec6a['id'],'content':_0x3cec6a['content'],'version':_0x3cec6a['attributes']?.['version']??0x0,'sessionId':_0x3cec6a['attributes']?.['sessionId']??null,'selection':[],'selectionSignature':'','channelId':_0x3cec6a['attributes']?.['channelId']??_0x4dd906[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x3cec6a['attributes']?.['rootName']??_0x4dd906[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??'','editorConfig':_0x1912e2['editorConfig']}));}const _0x2af9c0={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x9e042c};return this['_addToConversationContextItem'](_0x2af9c0),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x2af9c0,'unmatchedDocumentIds':_0x2f5777};}_matchDocumentToRoot(_0x33778d,_0x2bc82d){const _0x95fc6d=_0x33778d['attributes']?.['channelId'],_0xc94b10=_0x33778d['attributes']?.['rootName'];if(_0x95fc6d&&_0xc94b10){for(const _0x210447 of _0x2bc82d)if(_0x210447['config']['get']('collaboration.channelId')===_0x95fc6d){for(const _0x298645 of _0x210447['model']['document']['getRoots']())if('$graveyard'!==_0x298645['rootName']&&_0x298645['rootName']===_0xc94b10)return{'editor':_0x210447,'rootName':_0x298645['rootName']};}}}async _createContextItemFromContent(_0x1e4a5e,_0x189bb2=new Set()){return'mcp-tool-context'===_0x1e4a5e['type']?{'id':_0x1e4a5e['id'],'uiId':_0x1e4a5e['id'],'label':_0x1e4a5e['data']?.['label']||_0x1e4a5e['id'],'type':'mcp-tool-context','mcpServerName':_0x1e4a5e['mcpServerName'],'toolName':_0x1e4a5e['toolName'],'data':_0x1e4a5e['data']||{}}:{'id':_0x1e4a5e['id'],'uiId':_0x1e4a5e['id'],'label':_0x1e4a5e['attributes']?.['label']||_0x1e4a5e['name']||_0x1e4a5e['url']||_0x1e4a5e['id'],'type':_0x1e4a5e['type'],..._0x1e4a5e?.['attributes']?.['resourceId']?{'resourceId':_0x1e4a5e['attributes']?.['resourceId']}:{},...'context'===_0x1e4a5e['type']&&_0x189bb2['has'](_0x1e4a5e['id'])?{'hidden':!0x0}:{}};}getSentContextItems(){return new Map(this['_conversationContextItems']);}removeFromContext(_0x151925){this['_pendingContextItems']['get'](_0x151925)?.['isReadOnly']||this['_removeContextItem'](_0x151925);}clearPendingContextItems(){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x3e561d of this['_pendingContextItems']['values']())'context'!==_0x3e561d['type']&&this['_removeContextItem'](_0x3e561d['uiId']);const _0x2431b0=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x2431b0&&this['_addContextItem']({..._0x2431b0,'isReadOnly':!0x0,'hidden':!0x0});}addToConversationContext(_0x417869){for(const _0x302f7e of _0x417869['values']())'context'!==_0x302f7e['type']&&this['_addToConversationContextItem'](_0x302f7e);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(_0x424bc1){return Array['from'](_0x424bc1['values']())['flatMap'](_0x5c3a84=>this['_mapContextItemToRequestData'](_0x5c3a84));}async addFilesToContext(_0x3dd035,_0x76d026,_0x3ead41='file'){const _0x5a4a60='files-'+kt();this['_startUploadOperation'](_0x5a4a60);try{await Promise['all'](_0x3dd035['map'](async _0xc25225=>{const _0x1b5d54='file-'+kt(),_0x3dd81f=_0x34830a(_0xc25225['name']),_0x16469c='file'===_0x3ead41&&_0xc25225['type']['startsWith']('image/')?'image':_0x3ead41;try{this['_addContextItem']({'type':_0x16469c,'label':_0x76d026?.['label']||_0x3dd81f,'uiId':_0x1b5d54,'resourceId':_0x76d026?.['resourceId']},!0x0);const _0x2c782a=this['_connector']['uploadFile'](this['_ownerId'],_0xc25225,_0x76d026);this['_ongoingUploads']['set'](_0x1b5d54,_0x2c782a['abortController']);const {id:_0x1796bb}=await _0x2c782a['getId']();this['_ongoingUploads']['delete'](_0x1b5d54),this['_finishContextItemLoading']({'type':_0x16469c,'id':_0x1796bb,'label':_0x76d026?.['label']||_0x3dd81f,'uiId':_0x1b5d54,'resourceId':_0x76d026?.['resourceId']},!0x1);}catch(_0x55ba83){if(this['_ongoingUploads']['delete'](_0x1b5d54),!kn(_0x55ba83)){const _0x2d8d26=new yn({'code':$n['get'](_0x55ba83['code'])||'ai-chat-file-upload-failed','cause':_0x55ba83,'context':{'fileName':_0x3dd81f}});this['fire']('error',{'error':_0x2d8d26});}this['_removeContextItem'](_0x1b5d54);}}));}finally{this['_finishUploadOperation'](_0x5a4a60);}}addCurrentDocumentToContext(_0x4df428){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x399734={'type':'document','uiId':'current-document','label':_0x4df428,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x399734);}getCurrentDocumentContext(){return this['_pendingContextItems']['get']('current-document');}async updateCurrentDocuments(_0x54df64,_0x6636fc){const _0x146645=this['getCurrentDocumentContext']();if(!_0x146645)return;_0x54df64['length']>0x1&&_0x54df64['some'](_0x304a43=>!_0x304a43['description'])&&St('ai-chat-documents-missing-description');try{const _0x275b27=(_0x146645['documents']||[])['filter'](_0x36bf86=>_0x6636fc['has'](_0x36bf86['channelId']));if(!_0x54df64['length'])return void(_0x146645['documents']=_0x275b27);const _0x1c44f4=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x54df64)['getIds']();if(_0x1c44f4['length']!==_0x54df64['length']||_0x1c44f4['some'](_0x16ec49=>!_0x16ec49?.['id'])){const _0x2e2241=new ct('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x2e2241});}const _0x586611=_0x54df64['map']((_0x624a2f,_0x8b13f9)=>{return{'id':_0x1c44f4[_0x8b13f9]['id'],'content':_0x624a2f['content'],'version':_0x624a2f['version'],'sessionId':_0x624a2f['sessionId'],'selection':(_0x26ab0a=_0x624a2f['selections'],_0x26ab0a?_0x26ab0a['map'](_0x336724=>({'start':_0x336724['start'],'end':_0x336724['end']})):[]),'selectionSignature':_0x624a2f['selectionSignature'],'channelId':_0x624a2f['channelId'],'rootName':_0x624a2f['rootName'],'editorConfig':_0x624a2f['editorConfig']};var _0x26ab0a;});_0x146645['documents']=[..._0x275b27,..._0x586611];}catch(_0x46311d){throw new yn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x46311d});}}addSelectionToContext(_0x1dad18){this['_addContextItem']({'type':'selection','label':_0x1dad18,'uiId':'selection','content':_0x1dad18});}removeSelectionFromContext(){this['_removeContextItem']('selection');}async addUrlToContext(_0x26265b,_0x18cb79){const _0x3a4e5e='url-'+kt();this['_startUploadOperation'](_0x3a4e5e);const _0x1bd9e5='url-'+kt();try{this['_addContextItem']({'type':'web-resource','label':_0x18cb79?.['label']||_0x26265b,'uiId':_0x1bd9e5,'resourceId':_0x18cb79?.['resourceId']},!0x0);const _0x4c61d7=this['_connector']['uploadUrl'](this['_ownerId'],_0x26265b,_0x18cb79);this['_ongoingUploads']['set'](_0x1bd9e5,_0x4c61d7['abortController']);const {id:_0x190ac9}=await _0x4c61d7['getId']();this['_ongoingUploads']['delete'](_0x1bd9e5),this['_finishContextItemLoading']({'type':'web-resource','id':_0x190ac9,'label':_0x18cb79?.['label']||_0x26265b,'uiId':_0x1bd9e5,'resourceId':_0x18cb79?.['resourceId']},!0x1);}catch(_0x64692b){this['_ongoingUploads']['delete'](_0x1bd9e5),kn(_0x64692b)||this['fire']('error',{'error':new ct('ai-chat-url-upload-failed',this,{'url':_0x26265b,'originalError':_0x64692b}),'url':_0x26265b}),this['_removeContextItem'](_0x1bd9e5);}finally{this['_finishUploadOperation'](_0x3a4e5e);}}addToolItemToContext(_0x2bb684){_0x2bb684['id']=_0x2bb684['id']??kt()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x2bb684['uiId'],_0x2bb684),this['fire']('contextItemAdded',{'contextItem':_0x2bb684,'isLoading':!0x1});}async['loadSourceResources'](_0x21d431,_0x1deea2,_0x4bb695){const _0x1b8f9b=this['_addContextOptionsState']['sources']['find'](_0x16309f=>_0x16309f['id']===_0x21d431);if(!_0x1b8f9b)return this['fire']('error',{'error':new ct('ai-chat-source-not-found',this,{'sourceId':_0x21d431}),'sourceId':_0x21d431}),[];try{const _0x3ec8b8=(await _0x1b8f9b['getResources'](_0x1deea2))['map'](_0x1ca1ac=>{const _0x91bc7b=this['_isResourceInContext'](_0x1ca1ac['id']);return{..._0x1ca1ac,'isInContext':_0x91bc7b};});return _0x1b8f9b['resources']=_0x3ec8b8,this['fire']('sourceResourcesLoaded',{'sourceId':_0x21d431,'source':_0x1b8f9b,'resources':_0x3ec8b8,'uid':_0x4bb695}),_0x3ec8b8;}catch(_0x1b4a0f){return this['fire']('error',{'error':new ct('ai-chat-source-resources-load-failed',this,{'sourceId':_0x21d431,'originalError':_0x1b4a0f}),'sourceId':_0x21d431,'sourceLabel':_0x1b8f9b['label']}),[];}}async addResourceToContext(_0x512ab7,_0x541037){if(this['_isResourceInContext'](_0x541037['id']))return;if('context'===_0x541037['type'])return void this['_addContextItem']({'type':'context','id':_0x541037['id'],'label':_0x541037['label'],'uiId':'context-'+kt(),'resourceId':_0x541037['id']});let _0x4f7c0e=_0x541037['data'];if(!_0x4f7c0e&&_0x512ab7['getData'])try{_0x4f7c0e=await _0x512ab7['getData'](_0x541037['id']);}catch(_0x32d978){return void this['fire']('error',{'error':new ct('ai-chat-resource-load-failed',this,{'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id'],'originalError':_0x32d978}),'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id']});}if(_0x4f7c0e)switch(_0x541037['type']){case'web-resource':if('string'!=typeof _0x4f7c0e)return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id'],'expectedType':'string','actualType':typeof _0x4f7c0e}),'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id']});await this['addUrlToContext'](_0x4f7c0e,{'label':_0x541037['label'],'resourceId':_0x541037['id']});break;case'file':if(!(_0x4f7c0e instanceof File))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id'],'expectedType':'File','actualType':typeof _0x4f7c0e}),'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id']});await this['addFilesToContext']([_0x4f7c0e],{'label':_0x541037['label'],'resourceId':_0x541037['id']});break;case'text':if('object'!=typeof _0x4f7c0e||!('content'in _0x4f7c0e)||!('type'in _0x4f7c0e))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x4f7c0e}),'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id']});_0x4f7c0e=AIChatContext['_convertTextResourceToFile'](_0x4f7c0e,_0x541037['label']),await this['addFilesToContext']([_0x4f7c0e],{'label':_0x541037['label'],'resourceId':_0x541037['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ct('ai-chat-context-unsupported-type',this,{'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id'],'resourceType':_0x541037['type']}),'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id']});}else this['fire']('error',{'error':new ct('ai-chat-resource-no-data',this,{'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id']}),'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id']});}addContextSource(_0x8c577e){this['_addContextOptionsState']['sources']['some'](_0x43e974=>_0x43e974['id']===_0x8c577e['id'])||(this['_addContextOptionsState']['sources']['push']({..._0x8c577e,'resources':[]}),this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']}));}toggleAddCurrentDocumentOptionVisibility(_0x4e6c26){if(void 0x0!==_0x4e6c26)this['_addContextOptionsState']['document']['isHidden']=!_0x4e6c26;else{const _0x350a9a=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x350a9a;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static _convertTextResourceToFile(_0x3b4efa,_0x2db1b9){switch(_0x3b4efa['type']){case'markdown':return new File([_0x3b4efa['content']],_0x2db1b9,{'type':'text/markdown'});case'html':return new File([_0x3b4efa['content']],_0x2db1b9,{'type':'text/html'});default:return new File([_0x3b4efa['content']],_0x2db1b9,{'type':'text/plain'});}}static _mapContextItemToRequestData(_0x21be0e){switch(_0x21be0e['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x21be0e['id']}];case'web-resource':return[{'type':'web-resource','id':_0x21be0e['id']}];case'context':return[{'type':'context','id':_0x21be0e['id']}];case'document':return _0x21be0e['documents']?.['length']?_0x21be0e['documents']['map'](({id:_0x4916c0,editorConfig:_0x715e3a,selection:_0x3bdaec})=>({'type':'document','id':_0x4916c0,..._0x715e3a&&{'editorConfig':_0x715e3a},..._0x3bdaec?.['length']&&{'selection':_0x3bdaec}})):[];case'mcp-tool-context':{const _0xba51f4=_0x21be0e;return[{'type':'mcp-tool-context','mcpServerName':_0xba51f4['mcpServerName'],'toolName':_0xba51f4['toolName'],'data':{..._0xba51f4['data'],'label':_0xba51f4['label']||_0xba51f4['data']?.['label']||_0xba51f4['id']},'id':_0xba51f4['id']}];}default:return[];}}_addContextItem(_0x3dfd97,_0x578223=!0x1){if(this['_pendingContextItems']['set'](_0x3dfd97['uiId'],_0x3dfd97),_0x3dfd97['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x3dfd97,'isLoading':_0x578223}),'current-document'===_0x3dfd97['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x3dfd97['resourceId']){const _0x2c43b6=this['_findSourceIdsByResourceId'](_0x3dfd97['resourceId']);_0x2c43b6&&_0x2c43b6['forEach'](_0x26c241=>{this['_updateResourceInContextState'](_0x26c241,_0x3dfd97['resourceId'],!0x0);});}}_removeContextItem(_0x1af91e){const _0x282cea=this['_pendingContextItems']['get'](_0x1af91e),_0x4b9e13=this['_ongoingUploads']['get'](_0x1af91e);if(_0x4b9e13&&(_0x4b9e13['abort'](),this['_ongoingUploads']['delete'](_0x1af91e)),_0x282cea?.['resourceId']){const _0x2c1622=this['_findSourceIdsByResourceId'](_0x282cea['resourceId']);_0x2c1622&&_0x2c1622['forEach'](_0xdd09f3=>{this['_updateResourceInContextState'](_0xdd09f3,_0x282cea['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x1af91e),this['fire']('contextItemRemoved',{'uiId':_0x1af91e,'type':_0x282cea?.['type']}),'current-document'===_0x1af91e&&this['toggleAddCurrentDocumentOptionVisibility']();}_finishContextItemLoading(_0x33101a,_0xc0e97){if(this['_pendingContextItems']['has'](_0x33101a['uiId'])&&(this['_pendingContextItems']['set'](_0x33101a['uiId'],_0x33101a),this['fire']('contextItemLoadingEnded',{'contextItem':_0x33101a,'isLoading':_0xc0e97}),_0x33101a['resourceId'])){const _0x3515d6=this['_findSourceIdsByResourceId'](_0x33101a['resourceId']);_0x3515d6&&_0x3515d6['forEach'](_0x143649=>{this['_updateResourceInContextState'](_0x143649,_0x33101a['resourceId'],!0x0);});}}_addToConversationContextItem(_0x330b3c){this['_conversationContextItems']['set'](_0x330b3c['uiId'],_0x330b3c);}_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'](_0x2b62cc=>({..._0x2b62cc,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}_getCustomSourcesInitialState(){return this['_config']?.['sources']?.['map'](_0x4243f3=>({..._0x4243f3,'resources':[]}))??[];}_isResourceInContext(_0x6bda6b){for(const _0x8b7a2f of this['_pendingContextItems']['values']())if(_0x8b7a2f['resourceId']===_0x6bda6b)return!0x0;for(const _0x368252 of this['_conversationContextItems']['values']())if(_0x368252['resourceId']===_0x6bda6b)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x20201f){const _0x57678e=[];for(const _0x50f3ff of this['_addContextOptionsState']['sources'])_0x50f3ff['resources']['find'](_0x10034d=>_0x10034d['id']===_0x20201f)&&_0x57678e['push'](_0x50f3ff['id']);return 0x0===_0x57678e['length']?null:_0x57678e;}_updateResourceInContextState(_0x5f128a,_0x59ae1c,_0x2caf5d){const _0x16754a=this['_addContextOptionsState']['sources']['find'](_0x52aae3=>_0x52aae3['id']===_0x5f128a);if(!_0x16754a)return;const _0x163459=_0x16754a['resources']['find'](_0x5ac902=>_0x5ac902['id']===_0x59ae1c);_0x163459&&(_0x163459['isInContext']=_0x2caf5d,this['fire']('resourceStateChanged',{'sourceId':_0x5f128a,'resourceId':_0x59ae1c,'isInContext':_0x2caf5d}));}_startUploadOperation(_0x3a85c9){this['_ongoingUploadOperations']['set'](_0x3a85c9,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}_finishUploadOperation(_0x1a43d2){this['_ongoingUploadOperations']['delete'](_0x1a43d2),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}},Xn=class extends Fn{['userMessage'];conversationId;contextItems=new Map();capabilities;['model'];attributes;context;constructor(_0x1d1d77){super(_0x1d1d77),this['conversationId']=_0x1d1d77['conversationId'],this['contextItems']=_0x1d1d77['contextItems'],this['capabilities']=_0x1d1d77['capabilities'],this['userMessage']=_0x1d1d77['userMessage'],this['model']=_0x1d1d77['model'],this['attributes']=_0x1d1d77['attributes'],this['context']=_0x1d1d77['context']??new Yn();}sendRequest(){const _0x549276=Qn['mapContextItemsToRequestData'](this['contextItems']),_0x4880fa=this['context']['toRequestParts'](_0x549276);return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':_0x4880fa,'capabilities':fn['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['context']['toMessageAttributes'](this['attributes'])});}getDocumentContext(){return this['contextItems']['get']('current-document');}};const zn=/* #__PURE__ -- @preserve */
|
|
32
|
+
dt();var jn=class extends zn{['id'];isStarted=!0x1;isFromHistory;interactions=[];currentInteraction;selectedModel;connector;options;_abortReject;_channelsToEditors;_getSessionId;constructor(_0x180afe){super(),this['options']=_0x180afe,this['connector']=_0x180afe['connector'],this['chatModels']=_0x180afe['chatModels'],this['id']=_0x180afe['conversationId'],this['isFromHistory']=_0x180afe['isFromHistory'],this['_channelsToEditors']=_0x180afe['channelsToEditors'],this['_getSessionId']=_0x180afe['getSessionId'];}async init(_0x564152){try{this['chatContext']=new Qn({'connector':this['connector'],'config':_0x564152,'ownerId':this['id']}),this['chatContext']['delegate'](...qn)['to'](this),this['chatContext']['init'](),this['options']['contextLibrary']?.['resolveContext']({'feature':'chat','extraContexts':this['options']['extraContexts'],'context':this['chatContext']}),this['chatCapabilities']=new fn(),this['chatCapabilities']['delegate'](...Cn)['to'](this),this['chatCapabilities']['init']();const _0x1fde85=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x1fde85});const _0x5420f0=await this['chatModels']['resolveModel'](this['options']['selectedModelId']);_0x5420f0&&await this['setModel'](_0x5420f0);}catch(_0x4f74fa){const _0x454516=new yn({'code':'ai-chat-conversation-init-failed','cause':_0x4f74fa,'type':'network'});this['fire']('error',{'error':_0x454516});}}async start(){if(this['isStarted'])throw new ct('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new ct('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x1d2756}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x1d2756,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x76757a){const _0x409721=new yn({'code':'ai-chat-conversation-start-failed','cause':_0x76757a,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x409721}),_0x409721;}}async['load'](_0x27f164){try{const _0x5e6e73=await this['connector']['fetchConversation'](_0x27f164)['getConversation'](),_0x26eae4=await this['connector']['fetchConversationMessages'](_0x27f164)['getMessages'](),_0x5301c2=_0x26eae4[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x5e6e73['id'],'title'in _0x5e6e73?this['fire']('setConversationTitle',_0x5e6e73['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']),this['selectedModel']=await this['chatModels']['getModel'](_0x5301c2)??void 0x0,this['fire']('modelSelected',{'selectedModel':this['selectedModel'],'isDisabled':!0x0});const {streamingMessageId:_0x45d31a}=await this['_processMessagesToInteractions'](_0x26eae4,_0x5301c2);return _0x45d31a&&this['currentInteraction']?this['_resumeStream'](_0x45d31a):this['currentInteraction']=void 0x0,this;}catch(_0x5c5e56){const _0x3db6a1=new yn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x5c5e56,'type':'network','context':{'conversationId':_0x27f164}});throw this['fire']('error',{'error':_0x3db6a1}),_0x3db6a1;}}async _processMessagesToInteractions(_0x25b4a7,_0x3f54c1){let _0x55bb96,_0x13dbe3,_0x10aaee=new Set();for(const _0x49cdb5 of _0x25b4a7)if('user'===_0x49cdb5['role']){const {contextItems:_0x140131,unmatchedDocumentIds:_0x3e05c4}=await this['_extractContextItems'](_0x49cdb5);_0x10aaee=_0x3e05c4;const _0x633e51={'isReasoningEnabled':Object['hasOwn'](_0x49cdb5['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x49cdb5['capabilities'],'webSearch')};_0x55bb96=this['createInteraction']({'userMessage':_0x49cdb5['prompt'],'contextItems':_0x140131,'capabilities':_0x633e51,'modelId':_0x3f54c1,'attributes':_0x49cdb5['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x55bb96,_0x13dbe3=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x49cdb5['role']&&_0x55bb96){if('streaming'===_0x49cdb5['status']){_0x13dbe3=_0x49cdb5['id'];continue;}if('error'===_0x49cdb5['status'])continue;const _0x3b909f=[];for(const _0x47bf5e of _0x49cdb5['content'])switch(_0x47bf5e['type']){case'text':case'modification':{const _0x3adff1=_0x55bb96['getDocumentContext'](),_0xc2b320=this['_getOutdatedReasonsByDocumentId'](_0x3adff1,_0x10aaee),_0xc7cd6b=_0x3adff1?.['documents']??[],_0x4de21e=_0xc7cd6b['length']>0x0&&_0xc7cd6b['every'](_0x3b1a1b=>_0xc2b320['has'](_0x3b1a1b['id']));_0x55bb96['currentReply']?.['type']!==_0x47bf5e['type']&&(_0x55bb96['currentReply']=_0x55bb96['createReply']({'type':_0x47bf5e['type'],'isDone':!0x0,'interactionId':_0x55bb96['id'],'areActionsDisabled':_0x4de21e,'outdatedReasonByDocumentId':_0xc2b320,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x3b909f['length']>0x0&&(_0x55bb96['currentReply']['sources']=_0x3b909f['splice'](0x0))),_0x55bb96['currentReply']['appendContent'](_0x47bf5e['content'],_0x47bf5e['documentId']);break;}case'url':_0x3b909f['push'](_0x47bf5e);break;case'mcp-tool-result':{const {data:_0x2a43a0,attributes:_0x1ceec5}=JSON['parse'](_0x47bf5e['content']);_0x55bb96['_handleToolResultData']({'toolName':_0x47bf5e['toolName'],'data':_0x2a43a0,'attributes':_0x1ceec5});break;}}'cancelled'===_0x49cdb5['status']&&this['fire']('error',{'interactionId':_0x55bb96['id'],'error':new ct('ai-request-aborted',this)});}}return{'streamingMessageId':_0x13dbe3};}async _resumeStream(_0x269abc){if(this['currentInteraction'])try{const _0x1a8793=this['connector']['resumeStream'](this['id'],_0x269abc);await this['currentInteraction']['resume'](_0x1a8793);}catch(_0x3b08cf){_0x3b08cf instanceof ct&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x3b08cf});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async _extractContextItems(_0x18d884){return _0x18d884['content']?this['chatContext']['populateFromMessage'](_0x18d884['content'],Array['from'](this['_channelsToEditors']['values']()),Yn['getDefaultContextIds'](_0x18d884['attributes'])):{'contextItems':new Map(),'unmatchedDocumentIds':new Set()};}async handleUserInteraction({userMessage:_0x1a613a,attributes:_0x48836e}){if(!this['isStarted'])throw new ct('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new ct('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x17ad85=new Map(this['getPendingContextItems']()),_0x433c64=this['chatCapabilities']['getCapabilitiesConfig'](),_0x4d63fa=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x1a613a,'contextItems':_0x17ad85,'capabilities':_0x433c64,'modelId':_0x4d63fa,'attributes':_0x48836e,'channelsToEditors':this['_channelsToEditors']}),await this['updateCurrentDocumentsInContext'](),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x538848){if(_0x538848 instanceof ct)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x538848});else{const _0x1398a9=$n['get'](_0x538848['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ct(_0x1398a9,null,{'error':_0x538848})});}}finally{this['stopProcessing']();}}stopProcessing(){this['_abortReject']&&(this['_abortReject'](),this['_abortReject']=void 0x0),this['currentInteraction']&&(this['currentInteraction']['stop'](),this['currentInteraction']=void 0x0);}createInteraction({userMessage:_0x4c6c63,contextItems:_0x23da38,capabilities:_0x4ae3b6,modelId:_0x58043a,attributes:_0xff8a43,channelsToEditors:_0x4f2ccb}){const _0x15e96e=new Xn({'userMessage':_0x4c6c63,'contextItems':_0x23da38,'capabilities':_0x4ae3b6,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x58043a,'attributes':_0xff8a43,'channelsToEditors':_0x4f2ccb,'context':this['chatContext']['isEmpty']?void 0x0:new Yn(this['chatContext']['refs'])});return _0x15e96e['delegate'](...Gn)['to'](this),this['interactions']['push'](_0x15e96e),this['fire']('interactionCreated',_0x15e96e),_0x15e96e;}getInteraction(_0x446883){return this['interactions']['find'](_0x24fc28=>_0x24fc28['id']===_0x446883);}removeInteraction(_0x3b338f){const _0x32fbdc=this['getInteraction'](_0x3b338f);_0x32fbdc&&(_0x32fbdc['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x32fbdc),0x1));}get lastInteraction(){return this['interactions'][this['interactions']['length']-0x1];}cancelLastInteractionStream(){const _0x158893=this['lastInteraction'];_0x158893?.['conversationId']&&_0x158893['messageId']&&this['connector']['cancelStream'](_0x158893['conversationId'],_0x158893['messageId'])['execute']()['catch'](()=>{});}addCurrentDocumentToContext(_0x325794){this['chatContext']['addCurrentDocumentToContext'](_0x325794);}async updateCurrentDocumentsInContext(){if(!this['isCurrentDocumentInContext']())return;const {changedIds:_0x1baeeb,unchangedIds:_0x2c6292}=this['_compareEditorStateWithDocumentContext'](),_0x4fa821=new Promise((_0x244b44,_0x325795)=>{this['_abortReject']=()=>_0x325795(new ct('ai-request-aborted',this));}),_0x5232f2=await Promise['race']([this['options']['aiEditing']['getDocumentData'](_0x1baeeb),_0x4fa821]);await Promise['race']([this['chatContext']['updateCurrentDocuments'](_0x5232f2,_0x2c6292),_0x4fa821]);}_compareEditorStateWithDocumentContext(){const _0xae2372=new Set(),_0x141bb7=new Set(),_0x11e2b7=this['options']['aiEditing']['getEditorsVersions'](),_0x577e35=this['options']['aiEditing']['getEditorsSelections'](),_0x1abd41=this['chatContext']['getCurrentDocumentContext']()['documents']||[],_0x382126=new Map(_0x1abd41['map'](({channelId:_0x4c2d9c,version:_0x8f7af5})=>[_0x4c2d9c,_0x8f7af5])),_0x44a778=new Map(_0x1abd41['map'](({channelId:_0x599ba4,selectionSignature:_0x13b415})=>[_0x599ba4,_0x13b415]));for(const [_0x30d8e9,_0x31e17b]of _0x11e2b7){const _0x8c5129=_0x577e35['get'](_0x30d8e9);_0x382126['get'](_0x30d8e9)!=_0x31e17b||_0x44a778['get'](_0x30d8e9)!=_0x8c5129?_0xae2372['add'](_0x30d8e9):_0x382126['has'](_0x30d8e9)&&_0x141bb7['add'](_0x30d8e9);}return{'changedIds':_0xae2372,'unchangedIds':_0x141bb7};}toggleAddCurrentDocumentOptionVisibility(_0x2705fe){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x2705fe);}_getOutdatedReasonsByDocumentId(_0x59c517,_0x245c64){const _0x1eaf71=new Map();if(!_0x59c517||!_0x59c517['documents'])return _0x1eaf71;for(const _0x59edb9 of _0x59c517['documents']){const _0x3989c6=this['_channelsToEditors']['get'](_0x59edb9['channelId']);_0x3989c6&&'destroyed'!==_0x3989c6['state']?_0x59edb9['sessionId']!==this['_getSessionId'](_0x3989c6)?_0x1eaf71['set'](_0x59edb9['id'],'session-changed'):_0x245c64['has'](_0x59edb9['id'])&&_0x1eaf71['set'](_0x59edb9['id'],'content-removed'):_0x1eaf71['set'](_0x59edb9['id'],'editor-removed');}return _0x1eaf71;}addSelectionToContext(_0x2f6218){this['chatContext']['addSelectionToContext'](_0x2f6218);}removeSelectionFromContext(){this['chatContext']['removeSelectionFromContext']();}addFilesToContext(_0x21fd9e){this['chatContext']['addFilesToContext'](_0x21fd9e);}addUrlToContext(_0x4152d9){this['chatContext']['addUrlToContext'](_0x4152d9);}addToolItemToContext(_0x3f90e9){this['chatContext']['addToolItemToContext'](_0x3f90e9);}addResourceToContext(_0x2465f5,_0x3f18c6){this['chatContext']['addResourceToContext'](_0x2465f5,_0x3f18c6);}['loadSourceResources'](_0xe1299e,_0x378b27,_0x36bb6a){return this['chatContext']['loadSourceResources'](_0xe1299e,_0x378b27,_0x36bb6a);}removeFromContext(_0x48669c){this['chatContext']['removeFromContext'](_0x48669c);}setWebSearch(_0x439a05){this['chatCapabilities']['setWebSearch'](_0x439a05);}toggleWebSearch(){this['chatCapabilities']['toggleWebSearch']();}setReasoning(_0x14d589){this['chatCapabilities']['setReasoning'](_0x14d589);}toggleReasoning(){this['chatCapabilities']['toggleReasoning']();}isCurrentDocumentInContext(){return this['chatContext']['isCurrentDocumentInContext']();}isCurrentDocumentInConversation(){return this['chatContext']['isCurrentDocumentInConversation']();}isSelectionInContext(){return this['chatContext']['isSelectionInContext']();}getPendingContextItems(){return this['chatContext']['getPendingContextItems']();}addDefaultContext(_0x3540d1){_0x3540d1['length']&&this['chatContext']['addDefaultContext'](_0x3540d1);}async setModel(_0x15cbe9){_0x15cbe9?!0x1===await this['chatModels']['isAvailable'](_0x15cbe9)&&(St('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x15cbe9}),_0x15cbe9=(await this['chatModels']['getAvailableModels']())[0x0]):(St('ai-chat-conversation-set-model-null',{'conversation':this}),_0x15cbe9=(await this['chatModels']['getAvailableModels']())[0x0]),_0x15cbe9['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x15cbe9,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x15cbe9}));}};function Jn({documentSuggestions:_0x22942b,transform:_0x1420aa,documentCompare:_0x37ded3,documentCompareOptions:_0x5673ef}){const _0x2bf711=new Map();for(const [_0x4a15ec,{groups:_0x1ebd05,documentContext:_0x4a7b0d,documentContent:_0x2ab0aa,editor:_0x4c784f}]of _0x22942b){const _0x409f72=_0x4a7b0d['content'],_0x484901=_0x4a7b0d['version'],_0x49ae1a=_0x2ab0aa['cloneNode'](!0x0);for(const {changes:_0x4b8127}of _0x1ebd05)$s(_0x49ae1a,_0x4b8127);const _0x5e778e=Os(_0x49ae1a),_0x26ef7a=Qs(_0x4c784f,_0x4a7b0d['rootName'],_0x409f72,_0x5e778e);if(!_0x26ef7a)continue;const _0x47202a=_0x37ded3['getDiff'](_0x26ef7a['before'],_0x26ef7a['after'],{'targetEditor':_0x4c784f,'anchor':_0x4a7b0d['rootName'],..._0x5673ef})['getOperations']();if(_0x1420aa){const _0x59eb37=_0x4c784f['model']['document']['history']['getOperations'](_0x484901),_0x2a6499={'document':_0x4c784f['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x2bf711['set'](_0x4a15ec,_0x3b7a23(_0x47202a,_0x59eb37,_0x2a6499)['operationsA']);}else _0x2bf711['set'](_0x4a15ec,_0x47202a);}return _0x2bf711;}function Zn({groups:_0x4384fb,documentContextContent:_0xa5599b,documents:_0x471f1d}){const _0x3dd770=new Map();for(const _0x2cf5f4 of _0x4384fb){const {documentId:_0xe28a94}=_0x2cf5f4,_0x1bff38=_0x3dd770['get'](_0xe28a94);if(_0x1bff38)_0x1bff38['groups']['push'](_0x2cf5f4),_0x1bff38['indexes']['push'](_0x2cf5f4['index']);else{const _0x5c8bea=_0x471f1d['find'](_0x3bde3e=>_0x3bde3e['id']===_0xe28a94),_0x2f2475=_0xa5599b['get'](_0xe28a94);if(!_0x5c8bea||!_0x2f2475)continue;_0x3dd770['set'](_0xe28a94,{'groups':[_0x2cf5f4],'documentContext':_0x5c8bea,'documentContent':_0x2f2475,'editor':_0x2cf5f4['editor'],'indexes':[_0x2cf5f4['index']]});}}return _0x3dd770;}function tr(_0x46c6c2,_0x583cd3){const _0x902cff=_0x46c6c2['files']['length']>0x0&&_0x46c6c2['files']['every'](_0x2713e8=>_0x2713e8['type']['startsWith']('image/')),_0x32bb04=_0x46c6c2['plainText']['trim']()['length']>0x0;if(_0x46c6c2['files']['length']>0x0&&_0x583cd3['filesEnabled']&&(!_0x902cff||!_0x32bb04)){const _0x3b1e75=_0x46c6c2['files']['filter'](_0x4138ae=>_0x4138ae['name']);return _0x3b1e75['length']>0x0?{'type':'file','files':_0x3b1e75}:null;}if(_0x583cd3['urlsEnabled']){const _0x148f3c=function(_0x3dc20b){const _0x3d5d05=_0x3dc20b['trim']();if(/\s/['test'](_0x3d5d05))return null;try{const _0x4685ea=new URL(_0x3d5d05);return'http:'!==_0x4685ea['protocol']&&'https:'!==_0x4685ea['protocol']?null:_0x4685ea['toString']();}catch{return null;}}(_0x46c6c2['plainText']);if(_0x148f3c)return{'type':'url','url':_0x148f3c};}const _0x30688c=_0x46c6c2['forceTextAttachment']?0x1:_0x583cd3['longTextThreshold']??0x1/0x0;if(_0x46c6c2['plainText']['length']>=Math['max'](_0x30688c,0x1)&&_0x583cd3['filesEnabled']){const _0x5e9a39=_0x583cd3['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x46c6c2['plainText']],_0x5e9a39,{'type':'text/plain'})]};}return null;}var er=class extends _0x212144{activeConversation;_aiEditing;_aiConnector;_aiChatUi;['_aiModels'];_aiContextLibrary;_contextLibrarySource=null;_hasAIChatBalloon=!0x1;_activeBalloon;_reporter;_batchToChanges=new Map();_currentPreviewedChangeGroup=null;_bodyCollection;_channelsToEditors=new Map();static get requires(){return[Is,Nn,_0x5388eb,fs];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['set']('isConversationReady',!0x1),this['_bodyCollection']=Mn(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['_aiModels']=this['context']['plugins']['get'](fs)['models'],this['_aiContextLibrary']=this['context']['plugins']['get'](fs)['contextLibrary'];const _0x4775fa=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x374160,_0x3e6e18)=>{this['sendMessage']({'message':_0x3e6e18});}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',()=>{this['activeConversation']?.['stopProcessing']();}),this['listenTo'](_0x4775fa['view'],'change:activeTab',(_0x1a27e8,_0x481673,_0x3becca)=>{'chat'!==_0x3becca&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x22424d,_0x477e99)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x477e99));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x4aad1a,_0x5742bf)=>{this['activeConversation']?.['addUrlToContext'](_0x5742bf);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x447115,_0x2c8b44)=>{const _0x367eae=this['activeConversation'];if(!_0x367eae)return;_0x2c8b44['hasDirectory']&&(_0x2c8b44['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+kt()}));const _0x2efc97=tr(_0x2c8b44,{'pastedTextLabel':Es(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')});_0x2efc97&&(_0x2c8b44['preventDefault'](),'url'===_0x2efc97['type']?_0x367eae['addUrlToContext'](_0x2efc97['url']):_0x367eae['chatContext']['addFilesToContext'](_0x2efc97['files'],void 0x0,_0x2efc97['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x5981b3,_0x57691c)=>{_0x57691c['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x17bf8a,_0x1388fc)=>{this['activeConversation']?.['addResourceToContext'](_0x1388fc['source'],_0x1388fc['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x2a7c31,_0x14728a)=>{this['_removeFromContext'](_0x14728a);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x3149ef,_0x2a83e2)=>{this['activeConversation']?.['loadSourceResources'](_0x2a83e2['sourceId'],_0x2a83e2['query'],_0x2a83e2['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x3f0a9f,_0x44996d)=>{this['activeConversation']?.['setModel'](_0x44996d);}),this['listenTo'](this['_aiChatUi'],'like',(_0x20a492,{replyId:_0x57db37})=>{console['log']('Liked\x20response',_0x57db37);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x3c41a3,{replyId:_0x4bf43f})=>{console['log']('Disliked\x20response',_0x4bf43f);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x4b39fa,_0x3971b2)=>{this['_insertSuggestion'](_0x3971b2);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x3f1652,{replyId:_0x1769cf,partIndex:_0x17447d})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x1769cf,_0x17447d);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x5ad375,{replyId:_0x4a26b3,partIndex:_0xc134ef})=>{const _0x5794f5=this['_getDocumentRangeForReplyChanges'](_0x4a26b3,_0xc134ef);if(!_0x5794f5)return;const {reply:_0x2b5c83}=this['getInteractionAndReplyById'](_0x4a26b3);'$graveyard'!=_0x5794f5['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x2b5c83['changeGroups'][_0xc134ef]['editor'],'ranges':[_0x5794f5['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x2356cd,_0x11e929)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x11e929);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x159dbb,{replyId:_0x4d8047,showDiff:_0x133465})=>{const {interaction:_0x3f9a37,reply:_0x2773d0}=this['getInteractionAndReplyById'](_0x4d8047),_0x8490b2=_0x2773d0['getContentParts']({'showDiff':_0x133465});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x3f9a37['id']+':'+_0x2773d0['id'],'parts':_0x8490b2});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x58ea0a,{replyId:_0x1e11e5,partIndex:_0x2ab041})=>{this['_rejectSuggestion']({'replyId':_0x1e11e5,'partIndex':_0x2ab041}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x54d42a,_0x39d1d8)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x39d1d8);}),this['on']('replyCreated',(_0x324ea3,_0x229468)=>{this['_addFeedItemReply'](_0x229468);});}afterInit(){this['context']instanceof _0x2a0bfb?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x546cc4,_0x2f1584)=>{_0x2f1584['on']('ready',()=>{this['_integrateEditor'](_0x2f1584);});}),this['context']['config']['get']('ai.chat.context')?.['contextLibrary']?.['enabled']&&this['_setUpContextLibrarySource'](),this['_initConversation']();}async _initConversation(){const _0x1d97b6=this['context']['config']['get']('ai.chat.initialConversation');let _0x421348=_0x1d97b6;('lastCreated'!=_0x1d97b6||(_0x421348=await this['_getLastCreatedConversationId'](),_0x421348))&&('new'==_0x421348?await this['_startConversationSafely']():await this['loadConversation'](_0x421348));}async destroy(){return this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async loadConversation(_0x322b41){this['_closeActiveBalloon'](),this['context']['plugins']['get'](gs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['_detachFromActiveConversation'](),this['_stopLastInteraction'](),this['_aiChatUi']['toggleConversationLoading'](!0x0);try{this['_aiChatUi']['emptyConversationTitle'](),await this['_aiConnector']['fetchConversation'](_0x322b41)['getConversation'](),await this['_startConversationSafely']({'id':_0x322b41}),await this['activeConversation']['load'](_0x322b41),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext'](),this['set']('isConversationReady',!0x0),this['activeConversation']?.['currentInteraction']?this['_aiChatUi']['enableControls']():this['_aiChatUi']['toggleConversationLoading'](!0x1);}catch(_0x173f8b){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x322b41}),this['_reporter']['logError'](new ct('ai-chat-conversation-not-found',this,void 0x0,_0x173f8b),{'context':{'operation':'load-conversation'}}),await this['_stopLastInteraction'](),this['_aiChatUi']['disableControls'](),this['set']('isConversationReady',!0x1),this['_aiChatUi']['resetChatBusyStateToIdle'](),this['activeConversation']?.['cancelLastInteractionStream']();}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}registerToolDataCallback(_0x1becfe){let _0x26cf72=null,_0x5efa60=null;this['on']('toolDataReceived',(_0x4a5a19,_0x3cbe71,_0x4ced28)=>{_0x4ced28['id']!==_0x26cf72&&(_0x26cf72=_0x4ced28['id'],_0x5efa60=this['_getAIChatFeedAPI'](_0x4ced28)),_0x1becfe(_0x3cbe71,_0x5efa60);});}addCurrentDocumentToChatContext(){bs(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](Es(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async addSelectionToChatContext(_0x12c75c){const _0x1ca951=this['_aiEditing']['getSelectionText'](_0x12c75c);this['activeConversation']?.['addSelectionToContext'](_0x1ca951),this['addCurrentDocumentToChatContext']();}removeSelectionFromChatContext(){this['activeConversation']?.['removeSelectionFromContext']();}focusPromptInput(){this['_aiChatUi']['focusPromptInput']();}async startConversation(_0x47d7ad){await this['_startConversationSafely']({'modelId':_0x47d7ad?.['modelId'],'contexts':_0x47d7ad?.['contexts']});}async['sendMessage']({message:_0x12652d,attributes:_0x233030}){if(!this['activeConversation'])throw new ct('ai-chat-controller-no-active-conversation');this['activeConversation']['id']&&this['activeConversation']['isStarted']&&(this['_aiChatUi']['startInteraction'](),await this['activeConversation']['handleUserInteraction']({'userMessage':_0x12652d,'attributes':_0x233030}));}getGroupId(){const _0x84f668=this['context']['config']['get']('collaboration.channelId');if(!_0x84f668)throw new ct('ai-missing-channel-id',this);return _0x84f668;}_handleRemovedConversation(_0x9c5471){this['activeConversation']['id']===_0x9c5471&&this['_startConversationSafely']();}['_isGroupReadOnly'](_0x56e3a9){return!(!_0x56e3a9['editor']||'destroyed'===_0x56e3a9['editor']['state']||!_0x56e3a9['editor']['isReadOnly']);}_isGroupWriteable(_0x3e2be1){return!(!_0x3e2be1['editor']||'destroyed'===_0x3e2be1['editor']['state']||_0x3e2be1['editor']['isReadOnly']);}_computeSuggestionGating(_0x2ee808){const _0x5a63ba=new Map();for(const _0x4e1690 of _0x2ee808['changeGroups'])_0x5a63ba['set'](_0x4e1690['index'],this['_isGroupReadOnly'](_0x4e1690));const _0x12ad3b=new Set(_0x2ee808['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']})['filter'](_0x4f98f0=>_0x4f98f0['hasChanges'])['map'](_0x3bf35b=>_0x3bf35b['index']));return{'readOnlyByIndex':_0x5a63ba,'isAcceptAllEnabled':_0x2ee808['changeGroups']['some'](_0x539eb5=>'pending'===_0x539eb5['state']&&this['_isGroupWriteable'](_0x539eb5)&&_0x12ad3b['has'](_0x539eb5['index']))};}_refreshSuggestionGating(){if(this['activeConversation']){for(const _0x31b7e3 of this['activeConversation']['interactions'])for(const _0x1159ba of _0x31b7e3['replies'])'modification'===_0x1159ba['type']&&this['_aiChatUi']['hasFeedItem'](_0x1159ba['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x1159ba['id'],this['_computeSuggestionGating'](_0x1159ba));}if(this['_activeBalloon']&&this['_currentPreviewedChangeGroup']){const {reply:_0x4bb97d}=this['getInteractionAndReplyById'](this['_currentPreviewedChangeGroup']['replyId']),_0x5ef874=_0x4bb97d['changeGroups']['find'](_0x51c562=>_0x51c562['index']===this['_currentPreviewedChangeGroup']['partIndex']);_0x5ef874&&this['_activeBalloon']['setTargetReadOnly'](this['_isGroupReadOnly'](_0x5ef874));}}_prepareDocumentSuggestions(_0x290135){const {reply:_0x32b7a5,interaction:_0x53a597}=this['getInteractionAndReplyById'](_0x290135['replyId']),_0x11abdb=void 0x0!==_0x290135['partIndex']?[_0x32b7a5['changeGroups'][_0x290135['partIndex']]]:_0x32b7a5['changeGroups']['filter'](_0x50d735=>'pending'===_0x50d735['state']&&!this['_isGroupReadOnly'](_0x50d735)),_0x1db40f=_0x11abdb['map'](_0x3c7955=>_0x32b7a5['changeGroups']['indexOf'](_0x3c7955)),_0x347d50=qs(_0x32b7a5['changeGroups'],_0x32b7a5['documentContextContent']);return _0x1db40f['forEach'](_0x5a2d92=>{if(_0x347d50['has'](_0x5a2d92))return;const _0x34189e=this['_getDocumentRangeForReplyChanges'](_0x290135['replyId'],_0x5a2d92);_0x34189e&&'$graveyard'!=_0x34189e['range']['root']['rootName']?(_0x32b7a5['setChangeGroupState'](_0x5a2d92,'accepted'),void 0x0!==_0x290135['partIndex']&&this['_scrollToSuggestionRange'](_0x34189e['range'],!0x1,_0x34189e['targetEditor'])):_0x32b7a5['setChangeGroupState'](_0x5a2d92,'outdated',this['_getOutdatedReason'](_0x32b7a5['changeGroups'][_0x5a2d92]));}),Zn({'groups':_0x11abdb['filter'](_0x43e5ad=>'accepted'===_0x43e5ad['state']),'documentContextContent':_0x32b7a5['documentContextContent'],'documents':_0x53a597['getDocumentContext']()?.['documents']??[]});}_insertSuggestion(_0x10dfc5){const _0x4fc297=this['context']['plugins']['get'](_0x5388eb),{reply:_0x211b3a,interaction:_0x393c8d}=this['getInteractionAndReplyById'](_0x10dfc5['replyId']),_0x240132=this['_prepareDocumentSuggestions'](_0x10dfc5),_0x2bced7=Jn({'documentSuggestions':_0x240132,'transform':!0x0,'documentCompare':_0x4fc297,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0x236c39,_0x5dca73]of _0x2bced7){const {editor:_0x4b0eef,indexes:_0x37cde7}=_0x240132['get'](_0x236c39);if(!_0x4b0eef['plugins']['has']('TrackChanges')){St('ai-no-track-changes',{'editor':_0x4b0eef});continue;}let _0xba2c6f;mn(_0x5dca73,'chat'),_0x4b0eef['model']['change'](_0x4cddfc=>{_0xba2c6f=_0x4cddfc['batch'],_0x4b0eef['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x5dca73),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0xba2c6f,{'interactionId':_0x393c8d['id'],'replyId':_0x211b3a['id'],'indexes':_0x37cde7});}this['_updateRatings'](_0x211b3a);}_applySuggestion(_0x4f3388){const _0x59854d=this['context']['plugins']['get'](_0x5388eb),{reply:_0x8ffbd1,interaction:_0x3e98ee}=this['getInteractionAndReplyById'](_0x4f3388['replyId']),_0x5864e3=this['_prepareDocumentSuggestions'](_0x4f3388),_0x588d15=Jn({'documentSuggestions':_0x5864e3,'transform':!0x0,'documentCompare':_0x59854d,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0xafc9ba,_0x14cc5c]of _0x588d15){const {editor:_0x3163c2,indexes:_0x5ea787}=_0x5864e3['get'](_0xafc9ba);let _0x3dd931;mn(_0x14cc5c,'chat');try{_0x3163c2['model']['change'](_0x350789=>{_0x3dd931=_0x350789['batch'],_0x59854d['applyOperations'](_0x350789,_0x14cc5c);}),this['_batchToChanges']['set'](_0x3dd931,{'interactionId':_0x3e98ee['id'],'replyId':_0x8ffbd1['id'],'indexes':_0x5ea787});}catch(_0x1b5c35){throw this['_reporter']['logError'](new yn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x1b5c35})),_0x1b5c35;}}this['_updateRatings'](_0x8ffbd1);}_rejectSuggestion(_0x5148){const {reply:_0x40e590}=this['getInteractionAndReplyById'](_0x5148['replyId']);_0x40e590['setChangeGroupState'](_0x5148['partIndex'],'rejected');}['_openBalloonFor'](_0x2dc55a,_0x46d390){if(!this['_hasAIChatBalloon'])return;const {reply:_0x3fdfef}=this['getInteractionAndReplyById'](_0x2dc55a),_0x2004c1=_0x3fdfef['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x2004c1['length'])return;let _0x2fe180,_0xc8739e;if(void 0x0!==_0x46d390?(_0xc8739e=_0x2004c1['find'](_0x54265c=>_0x54265c['index']==_0x46d390),_0x2fe180=_0xc8739e?.['index']):(_0xc8739e=_0x2004c1[0x0],_0x2fe180=_0xc8739e['index']),!_0xc8739e)return void _0x3fdfef['setChangeGroupState'](_0x46d390??0x0,'outdated','editor-removed');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x2dc55a&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x2fe180)return;const _0x151d77=this['_getUserPresentableContentPartDocumentRange'](_0x2dc55a,_0x3fdfef,_0xc8739e),_0x25bddc=_0x3fdfef['changeGroups']['find'](_0x240f99=>_0x240f99['index']==_0x2fe180),_0x477490=_0x25bddc['editor'],_0x131dcf=_0x477490['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x131dcf&&this['_activeBalloon']['close'](),!_0x151d77)return _0x131dcf['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x131dcf,this['_currentPreviewedChangeGroup']={'replyId':_0x2dc55a,'partIndex':_0x2fe180},this['_scrollToSuggestionRange'](_0x151d77,!0x0,_0x477490);const _0x2a3518=this['_getPresentableSiblingContentPartIndex'](_0x2dc55a,_0x2fe180,'next');_0x131dcf['clearContent'](),_0x131dcf['updateContent']({'part':_0xc8739e,'renderingStrategy':'static'}),_0x131dcf['open']({'index':_0x2fe180,'title':Es(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x2fe180+0x1)['toString']()),'showRotator':null!==_0x2a3518,'ranges':[_0x151d77],'areActionsDisabled':_0x3fdfef['areActionsDisabled'],'targetEditor':_0x477490,'isTargetReadOnly':this['_isGroupReadOnly'](_0x25bddc)}),_0x131dcf['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x2dc55a,_0x2fe180),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x2dc55a,'index':_0x2fe180,'isActive':!0x0});}_closeActiveBalloon(){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}_getPresentableSiblingContentPartIndex(_0x33eef3,_0x99e5e1,_0x1755bc){const {reply:_0x111dc3}=this['getInteractionAndReplyById'](_0x33eef3),_0x5efd88=_0x111dc3['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x5efd88['length'])return null;const _0x3314f0='next'==_0x1755bc?0x1:-0x1;function _0x8ee6b8(_0x4d6f42){const _0x4f7262=(_0x4d6f42+_0x3314f0+_0x5efd88['length'])%_0x5efd88['length'];return{'siblingIndex':_0x4f7262,'siblingPart':_0x5efd88[_0x4f7262]};}const _0x1fd51b=_0x5efd88['findIndex'](_0x358ca6=>_0x358ca6['index']==_0x99e5e1);let {siblingIndex:_0xbdd4b2,siblingPart:_0x580f61}=_0x8ee6b8(_0x1fd51b);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x33eef3,_0x111dc3,_0x580f61);)if({siblingIndex:_0xbdd4b2,siblingPart:_0x580f61}=_0x8ee6b8(_0xbdd4b2),_0xbdd4b2===_0x1fd51b)return null;return _0x580f61['index'];}_getOutdatedReason(_0x9d8013){return _0x9d8013?.['editor']&&'destroyed'!==_0x9d8013['editor']['state']?'content-removed':'editor-removed';}_getUserPresentableContentPartDocumentRange(_0x16f25f,_0x419f5f,_0x5b8c04){const _0x3a60b6=_0x419f5f['changeGroups'];if(!_0x5b8c04['hasChanges'])return null;const _0x29203c=_0x3a60b6['find'](_0x2efb8d=>_0x2efb8d['index']==_0x5b8c04['index']);if('pending'!==_0x29203c?.['state'])return null;if(!_0x29203c?.['editor']||'destroyed'===_0x29203c['editor']['state'])return _0x419f5f['setChangeGroupState'](_0x5b8c04['index'],'outdated',this['_getOutdatedReason'](_0x29203c)),null;const _0x748ab2=this['_getDocumentRangeForReplyChanges'](_0x16f25f,_0x5b8c04['index']);if(!_0x748ab2)return _0x419f5f['setChangeGroupState'](_0x5b8c04['index'],'outdated',this['_getOutdatedReason'](_0x29203c)),null;const {range:_0x563fd7,currentIndex:_0x21cc86}=_0x748ab2;return'$graveyard'==_0x563fd7['root']['rootName']?(_0x419f5f['setChangeGroupState'](_0x21cc86,'outdated',this['_getOutdatedReason'](_0x29203c)),null):_0x748ab2['range'];}_getDocumentRangeForReplyChanges(_0x177f8b,_0x117c3b){const {reply:_0x1158c5,interaction:_0x4cd6ba}=this['getInteractionAndReplyById'](_0x177f8b),_0x246548=_0x1158c5['changeGroups']['filter'](_0x1cc658=>'pending'==_0x1cc658['state']),_0x485251=_0x246548['map'](_0x47747d=>_0x1158c5['changeGroups']['indexOf'](_0x47747d));void 0x0===_0x117c3b&&(_0x117c3b=_0x485251[0x0]);const _0x2f2ba8=_0x485251['indexOf'](_0x117c3b);if(-0x1==_0x2f2ba8)return null;const _0x3927b3=_0x246548[_0x2f2ba8],_0xa4bb4a=_0x3927b3['editor'];if(!_0xa4bb4a||'destroyed'===_0xa4bb4a['state'])return null;const _0x5998c4=Gs(_0xa4bb4a,_0x3927b3['rootName']),_0x587125=_0x1158c5['documentContextContent']['get'](_0x3927b3['documentId']),_0x5bc2b8=new _0x35605c([]),_0x4f3a42=new _0x35605c([]);for(const _0xc7b180 of _0x3927b3['changes'])if('removed'!=_0xc7b180['type']&&_0x4f3a42['children']['push'](_0xc7b180['node']['cloneNode'](!0x0)),'new'!=_0xc7b180['type']){const _0xf6bb80=_0xdb5da(_0x47c3ff=>Ps(_0x47c3ff,'data-id')==_0xc7b180['id'],_0x587125,!0x0);_0x5bc2b8['children']['push'](_0xf6bb80['cloneNode'](!0x0));}if(0x0==_0x5bc2b8['children']['length']){if(_0x3927b3['changes'][0x0]['anchorId']){const _0x2f25a3=vs('data-id',_0x3927b3['changes'][0x0]['anchorId'],_0x587125);_0x5bc2b8['children']['unshift'](_0x2f25a3['cloneNode'](!0x0)),_0x4f3a42['children']['unshift'](_0x2f25a3['cloneNode'](!0x0)),_0x2f25a3['nextSibling']&&(_0x5bc2b8['children']['push'](_0x2f25a3['nextSibling']['cloneNode'](!0x0)),_0x4f3a42['children']['push'](_0x2f25a3['nextSibling']['cloneNode'](!0x0)));}else{const _0xd07d0a=_0x587125['children'][0x0];if(!_0xd07d0a)return null;_0x5bc2b8['children']['push'](_0xd07d0a['cloneNode'](!0x0)),_0x4f3a42['children']['push'](_0xd07d0a['cloneNode'](!0x0));}}if(_0x5998c4&&qs(_0x1158c5['changeGroups'],_0x1158c5['documentContextContent'])['has'](_0x3927b3['index']))return null;const _0x527220=_0x4cd6ba['getDocumentContext'](),_0x5320d1=_0x527220['documents']['find'](_0x4f4af8=>_0x4f4af8['id']==_0x3927b3['documentId'])['content'],_0x379ff4=_0xa4bb4a['model']['document']['getRoot'](_0x3927b3['rootName']),_0x29bb0f=_0xa4bb4a['data']['parse'](_0x5320d1,_0x379ff4),_0xb394b2=_0x5998c4?Ws(Os(_0x5bc2b8)):Os(_0x5bc2b8),_0x7321d5=_0xa4bb4a['data']['parse'](_0xb394b2,_0x379ff4),_0x5ee60d=_0xa4bb4a['data']['parse'](_0xb394b2,_0x379ff4),_0x481e84=_0xa4bb4a['model']['createPositionAt'](_0x7321d5,0x0),_0x3f3209=_0x5998c4?Ws(Os(_0x4f3a42)):Os(_0x4f3a42),_0x2a87ab={'targetEditor':_0xa4bb4a,'anchor':_0x481e84,'markDeletions':!0x1};let _0x9f6fe7;try{_0x9f6fe7=_0xa4bb4a['plugins']['get'](_0x5388eb)['getDiff'](_0xb394b2,_0x3f3209,_0x2a87ab)['getOperations']();}catch(_0x4399d4){return this['_reporter']['reportError'](new yn({'code':'ai-chat-suggestion-diff-failed','type':'runtime','severity':'warning','cause':_0x4399d4,'context':{'replyId':_0x177f8b,'partIndex':_0x117c3b}})),null;}if(!_0x9f6fe7['length'])return null;_0xa4bb4a['model']['change'](_0x51db3e=>{for(const _0x2088c7 of _0x9f6fe7)if(!_0x22fa04(_0x2088c7)){if('remove'==_0x2088c7['type']){const _0x31a1b8=_0x2088c7['sourcePosition'],_0x24ed91=_0x2088c7['howMany'],_0xf6c63=new _0x19e331(_0x31a1b8,_0x24ed91);_0x51db3e['batch']['addOperation'](_0xf6c63),_0xa4bb4a['model']['applyOperation'](_0xf6c63);}else'marker'!==_0x2088c7['type']&&(_0x2088c7['baseVersion']=null,_0x2088c7['isDocumentOperation']=!0x1,_0x51db3e['batch']['addOperation'](_0x2088c7),_0xa4bb4a['model']['applyOperation'](_0x2088c7));}});const _0x454a18=_n(_0xa4bb4a,_0x9f6fe7,_0x7321d5);An(_0xa4bb4a['model'],_0x454a18);const _0x50e4f9=_0x454a18['getFirstRange']()['start']['path']['slice'](),_0x255cc3=_0x454a18['getFirstRange']()['end']['path']['slice'](),_0x532c6b=[];let _0x4ae2cb=_0x7321d5,_0x39a4d8=_0x5ee60d;for(let _0x12addf=0x0;_0x12addf<_0x255cc3['length'];_0x12addf++){const _0x1a2dd9=_0x4ae2cb['maxOffset']-_0x255cc3[_0x12addf];_0x532c6b[_0x12addf]=_0x39a4d8['maxOffset']-_0x1a2dd9,_0x4ae2cb=_0x4ae2cb['getChildAtOffset'](_0x255cc3[_0x12addf]),_0x39a4d8=_0x39a4d8['getChildAtOffset'](_0x532c6b[_0x12addf]);}const _0x384f78=_0xa4bb4a['model']['createRange'](_0xa4bb4a['model']['createPositionFromPath'](_0x5ee60d,_0x50e4f9),_0xa4bb4a['model']['createPositionFromPath'](_0x5ee60d,_0x532c6b)),_0x596a9b=_0x384f78['start']['path']['slice'](),_0x165654=_0x384f78['end']['path']['slice']();if(!_0x5998c4){const _0x948d8a=_0x5ee60d['getChild'](0x0)['getAttribute'](_0x4274f2),_0x31e7c6=Array['from'](_0x29bb0f['getChildren']())['find'](_0x5e18b3=>_0x5e18b3['getAttribute'](_0x4274f2)==_0x948d8a)['getPath']();_0x596a9b[0x0]=_0x31e7c6[0x0]+_0x596a9b[0x0],_0x165654[0x0]=_0x31e7c6[0x0]+_0x165654[0x0];}let _0x500ce6=_0xa4bb4a['model']['createRange'](_0xa4bb4a['model']['createPositionFromPath'](_0xa4bb4a['model']['document']['getRoot'](_0x3927b3['rootName']),_0x596a9b),_0xa4bb4a['model']['createPositionFromPath'](_0xa4bb4a['model']['document']['getRoot'](_0x3927b3['rootName']),_0x165654));const _0xa9d133=_0x527220['documents']['find'](_0x586f3e=>_0x586f3e['id']==_0x3927b3['documentId'])['version'],_0x2dbcb3=_0xa4bb4a['model']['document']['history']['getOperations'](_0xa9d133);for(const _0x25a3ef of _0x2dbcb3)_0x500ce6=_0x2af2ad['_createFromRanges'](_0x500ce6['getTransformedByOperation'](_0x25a3ef));return{'range':_0x500ce6,'currentIndex':_0x117c3b,'targetEditor':_0xa4bb4a};}_integrateEditorBalloon(_0x2ebcdb){if(!_0x2ebcdb['plugins']['has']('AIChatBalloon'))return;const _0x6e4d8c=_0x2ebcdb['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x6e4d8c['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x6e4d8c,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x530adb,partIndex:_0x7130a4}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x3ce63b}=this['getInteractionAndReplyById'](_0x530adb),_0x28c94a=_0x3ce63b['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x7130a4});_0x6e4d8c['updateContent']({'part':_0x28c94a[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x6e4d8c,'applySuggestion',()=>{const {replyId:_0x3d15ff,partIndex:_0x4f2a13}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x3d15ff,'partIndex':_0x4f2a13}),_0x6e4d8c['setState']('accepted');}),this['listenTo'](_0x6e4d8c,'insertSuggestion',()=>{const {replyId:_0x38dac4,partIndex:_0x58dc5e}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x38dac4,'partIndex':_0x58dc5e}),_0x6e4d8c['setState']('accepted');}),this['listenTo'](_0x6e4d8c,'rejectSuggestion',()=>{const {replyId:_0x451f28,partIndex:_0x37e0d0}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x451f28,'partIndex':_0x37e0d0}),_0x6e4d8c['setState']('rejected');}),this['listenTo'](_0x6e4d8c,'showNext',()=>{const {replyId:_0x140acd,partIndex:_0xee5dff}=this['_currentPreviewedChangeGroup'],_0x4a6925=this['_getPresentableSiblingContentPartIndex'](_0x140acd,_0xee5dff,'next');null!==_0x4a6925&&this['_openBalloonFor'](_0x140acd,_0x4a6925);}),this['listenTo'](_0x6e4d8c,'showPrevious',()=>{const {replyId:_0x4f56af,partIndex:_0x2f8624}=this['_currentPreviewedChangeGroup'],_0x314b37=this['_getPresentableSiblingContentPartIndex'](_0x4f56af,_0x2f8624,'previous');null!==_0x314b37&&this['_openBalloonFor'](_0x4f56af,_0x314b37);}),this['listenTo'](_0x6e4d8c,'dialogClosed',(_0x30bfeb,{id:_0x5ea14e})=>{if('aiChatBalloon'!==_0x5ea14e)return;const {replyId:_0x44ea2d,partIndex:_0x39974d}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x44ea2d,'index':_0x39974d,'isActive':!0x1}),this['_activeBalloon']===_0x6e4d8c&&(this['_activeBalloon']=void 0x0);});}_integrateEditor(_0x39a789){if(this['_channelsToEditors']['set'](_0x39a789['config']['get']('collaboration.channelId'),_0x39a789),this['_integrateEditorBalloon'](_0x39a789),this['addCurrentDocumentToChatContext'](),this['listenTo'](_0x39a789,'change:isReadOnly',()=>this['_refreshSuggestionGating']()),_0x39a789['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x39a789['plugins']['has']('Undo')){const _0x41a3a5=_0x39a789['commands']['get']('undo'),_0x3f3515=_0x39a789['commands']['get']('redo');this['listenTo'](_0x41a3a5,'revert',(_0x1cf42c,_0x44595c,_0x144e32)=>{const _0x33261e=this['_batchToChanges']['get'](_0x44595c);if(!_0x33261e)return;const _0x51deda=this['activeConversation']['getInteraction'](_0x33261e['interactionId']),_0x308a57=_0x51deda?.['getReply'](_0x33261e['replyId']);this['_batchToChanges']['delete'](_0x44595c),_0x51deda&&_0x308a57&&(_0x33261e['indexes']['forEach'](_0x38eb39=>_0x308a57['setChangeGroupState'](_0x38eb39,'pending')),this['_batchToChanges']['set'](_0x144e32,_0x33261e));}),this['listenTo'](_0x3f3515,'revert',(_0x437216,_0x24d063,_0xc0df72)=>{const _0x1ae229=this['_batchToChanges']['get'](_0x24d063);if(!_0x1ae229)return;const _0x447a81=this['activeConversation']['getInteraction'](_0x1ae229['interactionId']),_0x444885=_0x447a81?.['getReply'](_0x1ae229['replyId']);this['_batchToChanges']['delete'](_0x24d063),_0x447a81&&_0x444885&&(_0x1ae229['indexes']['forEach'](_0x5b5898=>_0x444885['setChangeGroupState'](_0x5b5898,'accepted')),this['_batchToChanges']['set'](_0xc0df72,_0x1ae229));});}const _0x11a5ff=_0x39a789['config']['get']('ai.chat.context');_0x11a5ff['alwaysAddSelection']&&_0x11a5ff['document']['enabled']&&this['listenTo'](_0x39a789['model']['document']['selection'],'change:range',(_0x43755d,_0x303d65)=>{_0x303d65['directChange']&&'chat'===_0x39a789['plugins']['get']('AITabs')['view']['activeTab']&&(_0x39a789['model']['hasContent'](_0x39a789['model']['document']['selection'])?this['addSelectionToChatContext'](_0x39a789):this['removeSelectionFromChatContext']());});}async _getLastCreatedConversationId(){const _0x50dd69=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0xfc870d=await _0x50dd69['getConversations']();return _0xfc870d['length']?_0xfc870d[0x0]['id']:'new';}catch(_0x27c7bd){return this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':kt()}),this['_reporter']['logError'](new ct('ai-chat-conversation-init-failed',this,{'error':_0x27c7bd})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async _startConversationSafely(_0x4fb091={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x4fb091),_0x4fb091['id']||this['set']('isConversationReady',!0x0);}catch(_0x112982){this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x4fb091['id']||kt()}),this['_reporter']['logError'](_0x112982),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}_detachFromActiveConversation(){this['_aiChatUi']['setIsUploadInProgress'](!0x1),this['activeConversation']&&this['stopListening'](this['activeConversation']);}async _handleStartConversation({id:_0x4b33d4,modelId:_0x483a47,contexts:_0x501daf}={}){this['_detachFromActiveConversation'](),this['_closeActiveBalloon']();let _0x2864a0=_0x483a47;_0x2864a0||(_0x4b33d4||!this['activeConversation']?_0x2864a0=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x2864a0=this['activeConversation']['selectedModel']?.['id'])),this['_stopLastInteraction']();const _0x1f851a=this['getGroupId'](),_0x42e574=_0x4b33d4||kt(),_0x14695a=await this['_aiModels']['getAvailableModels']();let _0x287c05;this['activeConversation']=new jn({'connector':this['_aiConnector'],'chatModels':this['_aiModels'],'selectedModelId':_0x2864a0,'conversationId':_0x42e574,'group':_0x1f851a,'locale':this['context']['locale'],'isFromHistory':!!_0x4b33d4,'channelsToEditors':this['_channelsToEditors'],'contextLibrary':this['_aiContextLibrary'],'extraContexts':_0x501daf,'getSessionId':_0x3a6375=>this['_aiEditing']['getSessionId'](_0x3a6375),'aiEditing':this['_aiEditing']}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',()=>{this['_aiChatUi']['createConversation']({'availableModels':_0x14695a}),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x4b33d4||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x5d9539,_0x16fec4)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x16fec4['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x3ff824=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x3ff824);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x3cdcd5=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x3cdcd5);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x55faab,_0x3886df)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x3886df,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x62fa81,_0x1c9129)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x1c9129,{'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',(_0x30dc2e,_0x7d5246)=>{this['_aiChatUi']['removeFeedInteraction'](_0x7d5246['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x238a60,_0x6977c6,_0x478fdd)=>{this['_updateConversationTitle'](_0x6977c6,_0x478fdd);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x1ae2fc,_0x13e3a1)=>{void 0x0!==_0x287c05&&_0x287c05!==_0x13e3a1['id']&&this['_updateReplyContentThrottled']['flush'](),_0x287c05=_0x13e3a1['id'],_0x13e3a1['isFromHistory']?await this['_updateReplyContent']({'reply':_0x13e3a1}):await this['_updateReplyContentThrottled']({'reply':_0x13e3a1});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x275076,{reply:_0x348c8f,index:_0x41722c,state:_0x413f98,outdatedReason:_0x554eaf})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x348c8f['id'],'index':_0x41722c,'state':_0x413f98,'outdatedReason':_0x554eaf}),this['_aiChatUi']['hasFeedItem'](_0x348c8f['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x348c8f['id'],this['_computeSuggestionGating'](_0x348c8f)),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x348c8f['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x41722c&&this['_activeBalloon']?.['setState'](_0x413f98,_0x554eaf);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x3eaaf8,_0x966b37)=>{if(this['_aiChatUi']['addContextItem'](_0x966b37['contextItem'],_0x966b37['isLoading']),'selection'===_0x966b37['contextItem']['type']){const _0x23dac7=Ss(this['context']),_0x4dd085=[..._0x23dac7['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x23dac7,'ranges':_0x4dd085,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x1c0964,_0x3344b5)=>{this['_aiChatUi']['removeContextItem'](_0x3344b5['uiId']),'current-document'==_0x3344b5['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x3344b5['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0xcc74f4,_0x5c7baf)=>{this['_aiChatUi']['setContextItemLoading'](_0x5c7baf['contextItem']['uiId'],_0x5c7baf['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x272d6b,_0x26747c)=>{this['_aiChatUi']['setConversationContext'](_0x26747c['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x597154,_0x3bcebc)=>{this['_aiChatUi']['setAddContextOptions'](_0x3bcebc['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x9bf012,_0x3b752c)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x3b752c['sourceId'],_0x3b752c['source'],_0x3b752c['resources'],_0x3b752c['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x4570f0,_0x14c314)=>{this['_aiChatUi']['updateResourceState'](_0x14c314['sourceId'],_0x14c314['resourceId'],_0x14c314['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x394653,_0x40b888)=>{this['_aiChatUi']['updateCapabilities'](_0x40b888);}),this['listenTo'](this['activeConversation'],'modelSelected',(_0x45a17c,_0x4fb2ea)=>{this['_aiChatUi']['setSelectedModel'](_0x4fb2ea['selectedModel']??null,_0x4fb2ea['isDisabled']);}),this['listenTo'](this['activeConversation'],'error',async(_0x55b086,{error:_0x1ee40d,interactionId:_0x606367,fileName:_0x3c3311,url:_0xb92f0f,sourceId:_0x15d2e7,sourceLabel:_0x522c9b})=>{let _0x2c7c3b;const _0x3ee8d2=_0x606367?_0x606367+':'+kt():kt();this['_reporter']['reportError'](_0x1ee40d),this['_aiChatUi']['startAutoScroll'](),_0x1ee40d['message']['startsWith']('ai-request-aborted')?(this['_cancelProcessing'](),this['activeConversation']?.['cancelLastInteractionStream'](),_0x2c7c3b=this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Es(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x3ee8d2})):_0x1ee40d['message']['startsWith']('ai-chat-conversation-init-failed')||_0x1ee40d['message']['startsWith']('ai-chat-conversation-start-failed')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-file-upload-failed')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x3c3311),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-url-upload-failed')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0xb92f0f),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-context-invalid-data')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-context-unsupported-type')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x15d2e7&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x15d2e7),_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x522c9b||'source'),'id':_0x3ee8d2})):_0x1ee40d['message']['startsWith']('ai-chat-resource-load-failed')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-invalid-request')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-context-unsupported-file-type')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-context-file-too-large')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-context-file-too-many-pages')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x3ee8d2}):(this['_cancelProcessing'](),_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x3ee8d2}));try{await Promise['race']([_0x2c7c3b,this['_aiChatUi']['idleUiPromise']]);}finally{this['_aiChatUi']['isBusy']||this['_aiChatUi']['stopAutoScroll']();}}),await this['activeConversation']['init'](this['_buildConversationContextConfig']()),_0x4b33d4||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']());}_buildConversationContextConfig(){const _0x55d354=this['context']['config']['get']('ai.chat.context');return this['_contextLibrarySource']?{..._0x55d354,'sources':[..._0x55d354?.['sources']??[],this['_contextLibrarySource']]}:_0x55d354;}async _setUpContextLibrarySource(){const _0x319c37=await this['_createContextLibrarySource']();_0x319c37&&(this['_contextLibrarySource']=_0x319c37,this['activeConversation']&&this['activeConversation']['chatContext']['addContextSource'](_0x319c37));}async _createContextLibrarySource(){let _0x18342d;try{_0x18342d=await this['_aiContextLibrary']['getAvailableContexts']();}catch{return null;}if(!_0x18342d['length'])return null;const _0x2e4a15=_0x18342d['map'](_0x5a468a=>({'id':_0x5a468a['id'],'type':'context','label':_0x5a468a['name']||_0x5a468a['id']}));return{'id':'ck-ai-context-library','label':Es(this['context']['locale'],'AI_CHAT_CONTEXT_LIBRARY_LABEL'),'useDefaultFiltering':!0x0,'getResources':()=>Promise['resolve'](_0x2e4a15)};}_removeFromContext(_0x5c010b){this['activeConversation']?.['removeFromContext'](_0x5c010b);}_toggleWebSearch(){this['activeConversation']?.['toggleWebSearch']();}_toggleReasoning(){this['activeConversation']?.['toggleReasoning']();}getInteractionAndReplyById(_0x4314a1){const [_0x56222e,_0x3afa67]=_0x4314a1['split'](':'),_0x14e5b7=this['activeConversation']['getInteraction'](_0x56222e);return{'interaction':_0x14e5b7,'reply':_0x14e5b7['getReply'](_0x3afa67)};}_scrollToSuggestionRange(_0xe8419,_0x505381=!0x1,_0xb83e9){const _0x4b8901={'target':_0xb83e9['editing']['view']['domConverter']['viewRangeToDom'](_0xb83e9['editing']['mapper']['toViewRange'](_0xe8419)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x505381};_0x505381&&(_0x4b8901['alignToTop']=!0x0),Ot(_0x4b8901);}_updateConversationTitle(_0x5ee513,_0x22a2b6=!0x1){this['_aiChatUi']['setConversationTitle'](_0x5ee513||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x22a2b6);}_addFeedItemReply(_0xb0654d){'text'===_0xb0654d['type']?this['_aiChatUi']['addFeedItemAIReply'](_0xb0654d):this['_aiChatUi']['addFeedItemAISuggestion'](_0xb0654d);}async _updateReplyContent({reply:_0x490fc6,renderingStrategy:_0x5424b9}){const {id:_0x343f8a,interactionId:_0x22288d,isDone:_0x2ac773,type:_0x4c04a0,parsedContent:_0x56c018}=_0x490fc6,_0xaae7e7=_0x22288d+':'+_0x343f8a;if('modification'===_0x4c04a0){const _0x423017=_0x490fc6['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0xaae7e7,'parts':_0x423017,'isDone':_0x2ac773,'skipLoadingEffects':_0x490fc6['isFromHistory']}),this['_aiChatUi']['hasFeedItem'](_0x490fc6['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x490fc6['id'],this['_computeSuggestionGating'](_0x490fc6));}else'text'===_0x4c04a0&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0xaae7e7,'parsedContent':_0x56c018['get']('text'),'renderingStrategy':_0x5424b9,'isDone':_0x2ac773});_0x2ac773&&_0x490fc6['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0xaae7e7,_0x490fc6['sources']);}_updateReplyContentThrottled=_0x43ff3d(this['_updateReplyContent']['bind'](this),0xc8);_stopLastInteraction(){this['activeConversation']?.['stopProcessing'](),this['_aiChatUi']['stopInteraction'](this['activeConversation']?.['lastInteraction']),this['_updateReplyContentThrottled']['cancel']();}async _flushLastInteractionUI(){const _0x381092=this['activeConversation']?.['lastInteraction'];if(_0x381092){for await(const _0x5e637f of _0x381092['replies'])this['_aiChatUi']['hasFeedItem'](_0x5e637f['id'])||this['_addFeedItemReply'](_0x5e637f),await this['_updateReplyContent']({'reply':_0x5e637f,'renderingStrategy':'static'});}}async['_cancelProcessing'](){this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext']();}_updateRatings(_0x585ab8){const _0x372562={'positiveCount':_0x585ab8['changeGroups']['filter'](_0x3916b8=>'accepted'===_0x3916b8['state'])['length'],'totalCount':_0x585ab8['changeGroups']['length'],'modificationId':_0x585ab8['id']},_0x31dc95=this['activeConversation']['getInteraction'](_0x585ab8['interactionId'])['messageId'];_0x31dc95&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x31dc95,_0x372562);}_getAIChatFeedAPI(_0x7f16a1){const _0x26d20a=this['_aiChatUi'],_0x19c61e=()=>{_0x7f16a1['resetWebSearchState'](),_0x7f16a1['resetReasoningState'](),_0x26d20a['clearLoadingMessage']();},_0x30fc8f=()=>{_0x7f16a1['currentReply']&&(_0x7f16a1['currentReply']['done'](),_0x7f16a1['currentReply']=void 0x0);};return{'insertTextReply':(_0x5cd02a,_0xeb197c)=>{_0x30fc8f(),_0x19c61e();const _0x3ed752=_0x7f16a1['currentReply']=_0x7f16a1['createReply']({'type':'text','interactionId':_0x7f16a1['id'],'id':_0xeb197c||kt(),'channelsToEditors':this['_channelsToEditors']});return _0x3ed752['appendContent'](_0x5cd02a),_0x30fc8f(),_0x3ed752;},'insertCustomElement':async(_0x1ced56,_0x4c8606)=>(_0x30fc8f(),_0x19c61e(),_0x26d20a['addFeedItemCustomElement'](_0x1ced56,_0x4c8606||kt())),'setLoadingMessage':_0x5856fd=>{_0x26d20a['setLoadingMessage'](_0x5856fd);},'clearLoadingMessage':()=>{_0x26d20a['clearLoadingMessage']();}};}_checkRemoveCurrentDocumentFromChatContext(){bs(this['context'])['find'](_0x4361d1=>'destroyed'!==_0x4361d1['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}};const ir=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],sr=[...ir,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function nr(_0x498042){const _0x53a47d=new AbortController();return{'promise':new Promise((_0x1362ef,_0x38ccae)=>{const _0x15d44e=setTimeout(_0x1362ef,_0x498042);_0x53a47d['signal']['addEventListener']('abort',()=>{clearTimeout(_0x15d44e),_0x38ccae();});}),'abortController':_0x53a47d};}var rr=class{options;isStreaming=!0x1;document=null;nodesList=[];currentIndex=0x0;timeoutAbortController=null;lastUpdateTime=0x0;constructor(_0x133c97){this['options']={'delay':_0x133c97?.['delay']??0xa,'textNodeStyle':_0x133c97?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async stream({document:_0x5bc8e1,targetElement:_0x4dda3c,abortSignal:_0x8ac0f4}){this['isStreaming']&&this['stop'](),_0x8ac0f4?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x246402(_0x5bc8e1,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x5d1528=0x0;_0x5d1528<this['currentIndex'];_0x5d1528++)this['nodesList'][_0x5d1528]['shouldBeStreamed']=!0x0;do{const _0x5ead2c=Date['now'](),_0x7d06f=this['nodesList'][this['currentIndex']],_0x365799=_0x5ead2c-this['lastUpdateTime'];if(_0x7d06f){_0x7d06f['shouldBeStreamed']=!0x0;let _0x5c8aa0=_0x7d06f['parent'];for(;_0x5c8aa0;)_0x5c8aa0['shouldBeStreamed']=!0x0,_0x5c8aa0=_0x5c8aa0['parent'];}if(_0x365799<this['options']['delay'])try{const {promise:_0x151439,abortController:_0x3179f2}=nr(this['options']['delay']-_0x365799);this['timeoutAbortController']=_0x3179f2,await _0x151439;}catch(_0x4333a8){return;}_0x1f22dd(_0x4dda3c,'<'+_0x4dda3c['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x4dda3c['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:_0x362875}){Array['from'](_0x362875['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x4325ea=>{_0x4325ea['replaceWith'](_0x4325ea['childNodes'][0x0]);});}stop(){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x42f3fe){let _0x169514='';if(function(_0x30f336){return _0x4591e9(_0x30f336);}(_0x42f3fe)){for(const _0x31e350 of _0x42f3fe['children'])_0x169514+=this['renderNode'](_0x31e350);}else{if(hr(_0x42f3fe)){if(!_0x42f3fe['shouldBeStreamed'])return'';const _0x59e0df=_0x42f3fe,_0x6bdb4c=Object['entries'](_0x59e0df['attribs'])['map'](([_0xbbb342,_0x285288])=>_0xbbb342+'=\x22'+_0x285288+'\x22')['join']('\x20');_0x169514+='<'+_0x59e0df['tagName']+(_0x6bdb4c?'\x20'+_0x6bdb4c:'')+'>';for(const _0xd9410c of _0xe31aff(_0x59e0df))_0x169514+=this['renderNode'](_0xd9410c);_0x169514+='</'+_0x59e0df['tagName']+'>';}else{if(!ar(_0x42f3fe))return'';if(!_0x42f3fe['shouldBeStreamed'])return'';!function(_0x2068b7){return!(!_0x2068b7['parent']||!hr(_0x2068b7['parent']))&&(!!or['includes'](_0x2068b7['parent']['tagName'])&&!_0x39a5c5(_0x2068b7)['match'](/^\s*[<>]\s*$/));}(_0x42f3fe)?_0x169514+=_0x3a1450(_0x42f3fe):_0x169514+=_0x3a1450(new _0x5b6203('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x42f3fe]));}}return _0x169514;}getParsedDocumentNodeList(){const _0x35daf0=[];return function(_0x1e4046,_0x35ec82){const _0x201501=_0x3d7005=>{if(_0x35ec82(_0x3d7005),_0x3d7005 instanceof _0x4eb033)for(let _0x1a957b=0x0;_0x1a957b<_0x3d7005['children']['length'];_0x1a957b++){const _0x45aecf=_0x3d7005['children'][_0x1a957b];_0x201501(_0x45aecf);}};for(let _0x5e1607=0x0;_0x5e1607<_0x1e4046['children']['length'];_0x5e1607++)_0x201501(_0x1e4046['children'][_0x5e1607]);}(this['document'],_0x309a16=>{if(ar(_0x309a16)){const _0xe9e6da=this['splitTextNodeIntoWordNodes'](_0x309a16);_0xe9e6da['length']&&_0x35daf0['push'](..._0xe9e6da);}_0x309a16['isWordSplitSource']||_0x309a16['isWordSplitResult']||_0x35daf0['push'](_0x309a16);}),_0x35daf0;}splitTextNodeIntoWordNodes(_0xa611c3){if(_0xa611c3['isWordSplitSource']||_0xa611c3['isWordSplitResult'])return[];const _0x18b454=_0x39a5c5(_0xa611c3)['match'](/(?:\s*\S+\s*)/g),_0x1b1ee1=[];if(_0x18b454&&_0x18b454['length']>0x1){for(const _0x2de784 of _0x18b454){const _0x5a9a27=new _0x5be0d8(_0x2de784);_0x5a9a27['isWordSplitResult']=!0x0,ti(_0xa611c3,_0x5a9a27),_0x1b1ee1['push'](_0x5a9a27);}_0xa611c3['isWordSplitSource']=!0x0,_0x4ebff9(_0xa611c3);}return _0x1b1ee1;}};const or=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function ar(_0x1bb611){return _0x8a421e(_0x1bb611);}function hr(_0x5114e4){return _0x438723(_0x5114e4);}function cr(_0x5ac03d,_0x2230cc){_0x5ac03d['cleanUpAnimations']({'targetElement':_0x2230cc}),_0x2230cc['querySelectorAll']('[data-id]')['forEach'](_0x5b5f85=>{_0x5b5f85['removeAttribute']('data-id');});}var lr=class extends _0x4ff2da{options;content='';htmlStreamer;['children'];constructor(_0x35e243){super();const _0x4a4c20=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new rr(),this['options']=_0x35e243,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x4a4c20['if']('isDone','ck-ai-chat__feed__item_done'),_0x4a4c20['if']('isVisible','ck-hidden',_0x5c04d3=>!_0x5c04d3),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){cr(this['htmlStreamer'],this['element']),this['isDone']=!0x0;}async streamIntoElement(_0x3ee328,_0x2feb3b,_0x2bf7cc){await this['htmlStreamer']['stream']({'document':_0x3ee328,'targetElement':_0x2feb3b,'abortSignal':_0x2bf7cc});}},ur=class extends _0x4ff2da{['showChangesToggleView'];constructor(_0x43b9ae,_0xf60551){super(_0x43b9ae),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new dr(_0x43b9ae),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Dn,'label':Es(_0x43b9ae,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0xf60551['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x13929e=>_0x13929e?it:et),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x25fbe4=new $t();_0x25fbe4['content']=_0x38d218,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0xf60551['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x25fbe4,{'tag':'span','children':[Es(_0x43b9ae,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}},dr=class extends Mt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}};const _r={'accepted':_0x5517bf,'rejected':_0xabec2d,'outdated':_0x57bdce};var gr=class extends _0x4ff2da{statePillView;constructor(_0x12e461){super(_0x12e461);const _0x3677d5=this['bindTemplate'];this['set']('state','accepted'),this['set']('outdatedReason',void 0x0),this['set']('isVisible',!0x0),this['statePillView']=new _0x18ca88(_0x12e461),this['statePillView']['bind']('label')['to'](this,'state',_0x54e9b4=>function(_0x203b7f,_0x41669b){return Es(_0x203b7f,'AI_SUGGESTION_CONTENT_PART_STATE_'+_0x41669b['toUpperCase']());}(_0x12e461,_0x54e9b4)),this['statePillView']['bind']('icon')['to'](this,'state',_0x19a103=>_r[_0x19a103]),this['statePillView']['bind']('class')['to'](this,'state',_0x4f45c3=>'ck-pill_'+_0x4f45c3),this['statePillView']['bind']('tooltip')['to'](this,'state',this,'outdatedReason',(_0x19dc7f,_0x30e330)=>function(_0x2e950e,_0xea328b,_0x239854){if('outdated'!==_0xea328b)return;return Es(_0x2e950e,_0x239854?Ar[_0x239854]:'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP');}(_0x12e461,_0x19dc7f,_0x30e330)),this['statePillView']['tooltipPosition']='s',this['statePillView']['tooltipClass']='ck-tooltip_multi-line',this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x3677d5['if']('isVisible','ck-hidden',_0x4aa3b6=>!_0x4aa3b6)]},'children':[this['statePillView']]});}setState(_0x55d732,_0x5a019c){this['state']=_0x55d732,this['outdatedReason']='outdated'===_0x55d732?_0x5a019c:void 0x0;}};const Ar={'content-removed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP','editor-removed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP','session-changed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP'};var Ir=class extends _0x24660c{_applyButton;_suggestButton;constructor(_0x4ed7ee,_0x3ac018,_0x180625){super(_0x4ed7ee);const _0x2bd413=Boolean(_0x180625);this['set']('isEnabled',!_0x2bd413),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x209ea9=[];if(!_0x2bd413){_0x3ac018['includes']('applySuggestion')&&(this['_applyButton']=new Mt(_0x4ed7ee),this['_applyButton']['set']({'label':Es(_0x4ed7ee,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0xc68c2d}),this['_applyButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0x1e382d,_0x468285)=>_0x1e382d&&!_0x468285),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0xe7c8ab=>!_0xe7c8ab),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x209ea9['push'](this['_applyButton'])),_0x3ac018['includes']('insertSuggestion')&&(this['_suggestButton']=new Mt(_0x4ed7ee),this['_suggestButton']['set']({'label':Es(_0x4ed7ee,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x4745b9}),this['_suggestButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0x588d12,_0x189920)=>_0x588d12&&!_0x189920),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x209ea9['push'](this['_suggestButton']));const _0xda07ee=new Mt(_0x4ed7ee);_0xda07ee['set']({'label':Es(_0x4ed7ee,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x17c14c}),_0xda07ee['bind']('isEnabled')['to'](this),_0xda07ee['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x209ea9['push'](_0xda07ee);}this['items']['addMany'](_0x209ea9);const _0x98cfb4=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x98cfb4['if']('isVisible','ck-hidden',_0x55a5c4=>!_0x55a5c4)]}});}setButtonsVisibility({showApplyButton:_0x1cb232,showSuggestButton:_0x3bb57f}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x1cb232),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x3bb57f);}},pr=class extends _0x4ff2da{toolbarView;stateView;titleLabelView;['children'];constructor(_0x9e208c,{part:_0x507a98,uiIndex:_0x1475fc,availableActions:_0x14463d,areActionsDisabled:_0x19c283}){super(_0x9e208c),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['toolbarView']=new Ir(_0x9e208c,_0x14463d,_0x19c283),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x507a98['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x507a98['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x507a98['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn','isTargetReadOnly')['to'](this),this['stateView']=new gr(_0x9e208c),this['titleLabelView']=new Er(_0x9e208c,_0x1475fc),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',(_0x59cae5,_0x4fcdf9,_0x2de5b8,_0xb332c3)=>{'pending'===_0xb332c3?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x2de5b8?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x2de5b8,this['outdatedReason']),this['children']['add'](this['stateView']));});}},Er=class extends _0x4ff2da{constructor(_0x173a92,_0x2bdf77){super(_0x173a92),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Es(_0x173a92,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x2bdf77['toString']())]});}},mr=class extends _0x4ff2da{htmlStreamer;constructor(_0x2c64c5){super(_0x2c64c5),this['htmlStreamer']=new rr(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async update({part:_0x43da21,renderingStrategy:_0x565509,abortSignal:_0x5cce4d}){this['_ensureHostElementTag'](_0x43da21['wrapperTag']||'div');const _0x1146d4=_0x246402(_0x43da21['content'],!0x0);for(const _0x4cca89 of ys(_0x1146d4))_0x4ebff9(_0x4cca89);'streaming'===_0x565509?await this['htmlStreamer']['stream']({'document':_0x1146d4,'targetElement':this['element'],'abortSignal':_0x5cce4d}):_0x1f22dd(this['element'],'<'+this['element']['tagName']+'>'+Os(_0x1146d4)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}cleanUpStreamingArtifacts(){cr(this['htmlStreamer'],this['element']);}_ensureHostElementTag(_0x57a3a0){if(!this['element']||this['element']['tagName']['toLowerCase']()===_0x57a3a0)return;const _0x237f5f=new _0x4937f3({'tag':_0x57a3a0,'attributes':{'class':this['element']['className']}})['render']();this['element']['replaceWith'](_0x237f5f),this['element']=_0x237f5f;}},Tr=class extends _0x4ff2da{['_children'];['_headerView'];_streamableContentView;constructor(_0x34d3f6,{part:_0x5ac6f9,uiIndex:_0x59b4ac,areActionsDisabled:_0x2aebee,availableActions:_0x34a0e2}){super(_0x34d3f6);const _0xc5d0d6=this['bindTemplate'];this['set']('state',_0x5ac6f9['state']),this['set']('outdatedReason',_0x5ac6f9['outdatedReason']),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1);const _0x5d1cb0=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x2aebee;};this['on']('change:state',_0x5d1cb0),this['on']('change:isDone',_0x5d1cb0),_0x5d1cb0(),this['_children']=this['createCollection'](),this['_headerView']=new pr(_0x34d3f6,{'part':_0x5ac6f9,'uiIndex':_0x59b4ac,'availableActions':_0x34a0e2,'areActionsDisabled':_0x2aebee}),this['_headerView']['bind']('isEnabled','outdatedReason','state','isTrackChangesOn','isTargetReadOnly')['to'](this),this['_headerView']['delegate'](...ir)['to'](this),this['_streamableContentView']=new mr(_0x34d3f6),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0xc5d0d6['to']('state',_0x2058f3=>'ck-ai-suggestion__body__content-part_'+_0x2058f3),_0xc5d0d6['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0xc5d0d6['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0xc5d0d6['if']('isVisible','ck-hidden',_0x20a32c=>!_0x20a32c)]},'children':this['_children'],'on':{'mouseenter':_0xc5d0d6['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x5ac6f9['index']});}),'mouseleave':_0xc5d0d6['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x5ac6f9['index']});}),'click':_0xc5d0d6['to'](_0x2535f7=>{const _0x152f46=_0x2535f7['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x152f46)&&this['fire']('showChangeInText',{'index':_0x5ac6f9['index']});})}});}async updateContent({part:_0x55b773,showUnchangedParts:_0x361c19=!0x1,abortSignal:_0x24f908}){this['partDefinition']=_0x55b773,this['isVisible']=this['partDefinition']['hasChanges']||_0x361c19,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x55b773,'renderingStrategy':'static','abortSignal':_0x24f908});}['markAsDone'](){this['isDone']=!0x0;}},wr=class extends _0x4ff2da{constructor(_0xa7f974,_0x12e800){super(_0xa7f974),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x5967cd=>!_0x5967cd)]},'children':this['_createSkeletonItems'](_0x12e800)});}_createSkeletonItems(_0x26057b){const _0x3bb103=['ck','ck-ai-skeleton__item'];return _0x26057b['map'](_0x580bce=>{let _0x1dc516='';switch(_0x580bce['attributes']['align']){case'right':_0x1dc516='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x1dc516='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x1dc516='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x580bce['tag'],'attributes':{'class':[..._0x3bb103,_0x580bce['attributes']['class']?_0x580bce['attributes']['class']:''],'style':'width:\x20'+_0x580bce['attributes']['width']+';\x20height:\x20'+_0x580bce['attributes']['height']+';'+_0x1dc516}};});}};const Cr={'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':fr(0x5,'100%','44px','right'),'aiChatResources':fr(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 fr(_0x316bb6,_0xdc546d,_0x16208e,_0x5ae8ce){return new Array(_0x316bb6)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0xdc546d,'height':_0x16208e,'align':_0x5ae8ce}}));}const br=/* #__PURE__ -- @preserve */
|
|
33
|
+
dt();var Sr=class extends br{['queue']=[];['isProcessing']=!0x1;_abortController;async['enqueue'](_0x3901cc){const _0x1721b1=this['createTask'](_0x3901cc);return this['queue']['push'](_0x1721b1),this['_processQueue'](),_0x1721b1['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(_0xaf5ae0=>{this['once']('_queueEmpty',()=>{_0xaf5ae0();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x359ab2=this['queue']['shift']();try{await _0x359ab2['callback'](this['_abortController']['signal']),_0x359ab2['resolve']();}catch(_0x1ec077){_0x359ab2['reject'](_0x1ec077);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}createTask(_0x1816a0){let _0x2774ff,_0x3f450e;const _0x28513c=new Promise((_0xc05891,_0x618a08)=>{_0x2774ff=_0xc05891,_0x3f450e=_0x618a08;});return{'callback':_0x1816a0,'resolve':_0x2774ff,'reject':_0x3f450e,'completePromise':_0x28513c};}},Rr=class extends lr{constructor(_0xa7ee74){super(_0xa7ee74),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0xa7ee74['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}setContent(_0x5d26d3){this['element']['innerHTML']=_0x5d26d3;}};const Or=['applySuggestion','insertSuggestion'];var vr=class extends _0x4ff2da{_applyChangesButton;_insertSuggestionsButton;['children'];constructor(_0x1826be,_0x4b6d49=[...Or],_0x166146){super(_0x1826be);const _0x108e9b=this['bindTemplate'],_0x2e912c=Boolean(_0x166146);this['set']('isEnabled',!_0x2e912c),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x2e912c||(this['_applyChangesButton']=new Mt(_0x1826be),this['_applyChangesButton']['set']({'label':Es(_0x1826be,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x4b6d49['includes']('applySuggestion'),'class':Ln}),this['_insertSuggestionsButton']=new Mt(_0x1826be),this['_insertSuggestionsButton']['set']({'label':Es(_0x1826be,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x4b6d49['includes']('insertSuggestion'),'class':Pn}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x4c3022=>{_0x4c3022['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',_0x108e9b['if']('isVisible','ck-hidden',_0x5c9a85=>!_0x5c9a85)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}updateVisibility(_0x4364aa){this['isVisible']=_0x4364aa;}_switchButtonLabelsPlurality(_0x268c68){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x268c68?(this['_applyChangesButton']['label']=Es(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=Es(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=Es(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=Es(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}},kr=class extends _0x4ff2da{['children'];['balloonPanelView'];bodyCollection;constructor(_0x26d6ca,_0x277bac){super(_0x26d6ca),this['bodyCollection']=_0x277bac,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',_0x1dc2dc=>!_0x1dc2dc)]},'children':this['children']});const _0x623a31=new _0x4ff2da(this['locale']),_0x4cac85=new $t();_0x4cac85['content']=ht,_0x623a31['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x4cac85,{'tag':'span','children':[{'text':Es(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x623a31),this['_setupBalloonPanel'](_0x26d6ca);}['addSource'](_0x5a6f20){this['children']['add'](new yr(this['locale'],_0x5a6f20,this['balloonPanelView']));}_setupBalloonPanel(_0x315063){this['balloonPanelView']=new xt(_0x315063),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},yr=class extends Mt{['balloonPanelView'];['source'];constructor(_0x518a95,_0x492c1a,_0x5298d5){super(_0x518a95),this['source']=_0x492c1a,this['balloonPanelView']=_0x5298d5,this['set']({'label':_0x492c1a['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x1444d2=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x1444d2['to'](()=>{window['open'](_0x492c1a['url'],'_blank');}),'mouseenter':_0x1444d2['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x1444d2['to'](()=>{this['_hideTooltip']();})}}),_0x492c1a['favicon']){const _0x54c429=new _0x4ff2da(_0x518a95);_0x54c429['setTemplate']({'tag':'img','attributes':{'src':_0x492c1a['favicon']||ht,'alt':_0x492c1a['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x54c429);}else this['set']('icon',ht);}_createTooltipContentView(_0x89482e,_0x2958de){const _0x41b567=new _0x4ff2da(_0x89482e),_0x2e610d=[];let _0x2136e0;_0x2958de?.['favicon']?(_0x2136e0=new _0x4ff2da(_0x89482e),_0x2136e0['setTemplate']({'tag':'img','attributes':{'src':_0x2958de['favicon'],'alt':_0x2958de['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x2136e0=new $t(),_0x2136e0['content']=ht,_0x2136e0['extendTemplate']({'attributes':{'alt':_0x2958de['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x2e610d['push'](_0x2136e0);const _0x1b0f6d=new _0x4ff2da(_0x89482e);_0x1b0f6d['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x2958de['url']},'children':[{'text':new URL(_0x2958de['url'])?.['hostname']}]}),_0x2e610d['push'](_0x1b0f6d);const _0x101553=new _0x4ff2da(_0x89482e);_0x101553['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x2e610d});const _0x1a9060=new _0x4ff2da(_0x89482e);return _0x1a9060['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x2958de['title']['length']>0x190?_0x2958de['title']['substring'](0x0,0x190)+'...':_0x2958de['title']}]}),_0x41b567['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x101553,_0x1a9060]}),_0x41b567;}_showTooltip(){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[xt['defaultPositions']['northArrowSouth'],xt['defaultPositions']['northArrowSouthWest'],xt['defaultPositions']['northArrowSouthEast']],'limiter':document['querySelector']('.ck-ai-chat')}),this['balloonPanelView']['show']();}_hideTooltip(){this['balloonPanelView']['hide']();}_updateTooltipContent(){this['balloonPanelView']['content']['get'](0x0)?.['destroy'](),this['balloonPanelView']['content']['clear']();const _0x5c0e63=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x5c0e63);}},Nr=class extends _0x4ff2da{_actionsView;['_readOnlyByIndex']=new Map();['_sourcesView'];['_children'];_skeletonView;_showSkeletonDebounced=_0x220e40(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);_skeletonShownAt=null;_areActionsDisabled;_showUnchangedParts;_updateContentPartsPromiseQueue;_emptyPartsWarningView;_availableActions;_cachedContentParts=[];constructor(_0x127932,_0x36259f){super(_0x127932);const {areActionsDisabled:_0x354a33,showUnchangedParts:_0x18d75f,availableActions:_0x11df96}=_0x36259f;this['_areActionsDisabled']=_0x354a33,this['_showUnchangedParts']=_0x18d75f,this['_availableActions']=_0x11df96,this['set']('isTrackChangesOn',!0x1),this['set']('isAcceptAllEnabled',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new wr(_0x127932,Cr['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new Sr(),this['_emptyPartsWarningView']=new Rr({'id':'empty-parts-warning','initialContent':Es(_0x127932,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new vr(_0x127932,_0x36259f['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new kr(this['locale'],_0x36259f['bodyCollection']),_0x36259f['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'isAcceptAllEnabled'),this['_actionsView']['delegate'](...ir)['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'](_0x21964f=>_0x21964f instanceof Tr);}async updateContentParts({parts:_0x2e58a6,abortSignal:_0x34185b,skipLoadingEffects:_0x352a30}){this['_cachedContentParts']['length']?_0x2e58a6['forEach'](_0x3271cd=>{const _0x22113c=this['_cachedContentParts']['findIndex'](_0x2f8413=>_0x2f8413['index']==_0x3271cd['index']);-0x1===_0x22113c?this['_cachedContentParts']['push'](_0x3271cd):this['_cachedContentParts'][_0x22113c]=_0x3271cd;}):this['_cachedContentParts']=_0x2e58a6;const _0x27e0f2=this['_showUnchangedParts']?_0x2e58a6:_0x2e58a6['filter'](_0x516f25=>_0x516f25['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x27e0f2['length']>0x1),_0x352a30&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x414346 of _0x2e58a6)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x474792=>{let _0x3e80f3=this['getPartView'](_0x414346['index']);if(_0x3e80f3||_0x414346['hasChanges']||this['_showUnchangedParts']){if(!_0x3e80f3){if(_0x3e80f3=new Tr(this['locale'],{'part':_0x414346,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x3e80f3['delegate'](...ir)['to'](this),_0x3e80f3['bind']('isTrackChangesOn')['to'](this),!_0x352a30&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x474792),_0x474792['aborted']))return;_0x3e80f3['isTargetReadOnly']=this['_readOnlyByIndex']['get'](_0x414346['index'])??!0x1,this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x3e80f3,this['_children']['length']-0x1),_0x352a30||this['_showSkeletonDebounced']();}await _0x3e80f3['updateContent']({'part':_0x414346,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x474792}),_0x3e80f3['markAsDone']();}});return _0x34185b?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}updatePartState(_0x33f4a2,_0x312fd1,_0x1b2ac2){const _0x4e390c=this['getPartView'](_0x33f4a2);_0x4e390c&&(_0x4e390c['outdatedReason']=_0x1b2ac2,_0x4e390c['state']=_0x312fd1);}setGating({readOnlyByIndex:_0x5d98cf,isAcceptAllEnabled:_0x14b061}){this['_readOnlyByIndex']=_0x5d98cf,this['isAcceptAllEnabled']=_0x14b061;for(const _0x24175d of this['_contentPartViews'])_0x24175d['isTargetReadOnly']=_0x5d98cf['get'](_0x24175d['partDefinition']['index'])??!0x1;}setPartActive(_0x182bbc,_0x352f39){if(!0x1===_0x182bbc){for(const _0x38b113 of this['_contentPartViews'])_0x38b113['isActive']=!0x1;}else{const _0x305b58=this['getPartView'](_0x182bbc);_0x305b58&&(_0x305b58['isActive']=_0x352f39);}}updateSources(_0x550980){_0x550980['forEach'](_0x1427bf=>this['_sourcesView']['addSource'](_0x1427bf)),this['_sourcesView']['isVisible']=!0x0;}getPartView(_0x48b859){return this['_contentPartViews']['find'](_0x962826=>_0x962826['partDefinition']['index']==_0x48b859)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x31c285=!this['_cachedContentParts']['find'](({hasChanges:_0x425f48})=>_0x425f48),_0x10ddd9=!!this['_cachedContentParts']['find'](({hasChanges:_0x2daa79})=>!_0x2daa79);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x10ddd9,_0x31c285?this['_emptyPartsWarningView']['setContent'](Es(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](Es(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x3a4bb8=>_0x3a4bb8['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']&&!this['_areActionsDisabled']);}async _awaitMinimumSkeletonDisplayTime(_0x386f83){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x193ecb=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x193ecb>0x0){const {promise:_0x5ed385,abortController:_0x1f80b7}=nr(_0x193ecb);_0x386f83?.['addEventListener']('abort',()=>_0x1f80b7['abort']()),await _0x5ed385['catch'](()=>{});}}get hasNonEmptyParts(){return this['_contentPartViews']['filter'](_0x1d4c65=>_0x1d4c65['partDefinition']['hasChanges'])['length']>0x0;}},xr=class extends _0x4ff2da{['bodyView'];['children'];['headerView'];constructor(_0x2c5611,_0x3a218f,_0x5e00d6){super(_0x2c5611);const {showDiff:_0x13252e,areActionsDisabled:_0xebbddc,showUnchangedParts:_0x216c9c,availableActions:_0x2ff3fe}=_0x3a218f;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new ur(_0x2c5611,{'showDiff':_0x13252e}),this['headerView']['on']('toggleShowChanges',(_0x20575f,_0x5eade7)=>{this['areChangesVisible']=_0x5eade7['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x5eade7['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new Nr(_0x2c5611,{'areActionsDisabled':_0xebbddc,'showUnchangedParts':!!_0x216c9c,'availableActions':_0x2ff3fe,'bodyCollection':_0x5e00d6}),this['bodyView']['delegate'](...ir)['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(_0x24fe66){await this['bodyView']['updateContentParts'](_0x24fe66);}updateSources(_0x3ec4fd){this['bodyView']['updateSources'](_0x3ec4fd);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},Lr=class extends lr{containerView;constructor(_0x4efecd,_0x5e6570,_0x18dd23){super(_0x5e6570),this['set']('isTrackChangesOn',!0x1),this['containerView']=new xr(_0x4efecd,{'showDiff':_0x5e6570['showDiff'],'areActionsDisabled':_0x5e6570['areActionsDisabled'],'availableActions':_0x5e6570['availableActions']},_0x18dd23),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x484ceb,_0x3f4d03)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x3f4d03['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',(_0x146e7f,{index:_0x267533})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x267533});}),this['containerView']['on']('applySuggestion',(_0x3f9c7f,{index:_0x3fbd75}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x3fbd75});}),this['containerView']['on']('insertSuggestion',(_0x1d9582,{index:_0x11c1e8}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x11c1e8});}),this['containerView']['on']('rejectSuggestion',(_0x57c29e,{index:_0x3d099c})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x3d099c});}),this['containerView']['on']('mouseOverSuggestion',(_0xec02a7,{index:_0x4d3bf6})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x4d3bf6});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x123310,{index:_0x2daed7})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x2daed7});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async updateContent(_0x44cfaf){await this['containerView']['updateContent'](_0x44cfaf);}updatePartState(_0x50fba7,_0x2d5fb9,_0x584319){this['containerView']['bodyView']['updatePartState'](_0x50fba7,_0x2d5fb9,_0x584319);}setPartActive(_0xf1c7c9,_0x452611){!0x1===_0xf1c7c9?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0xf1c7c9,_0x452611);}updateSources(_0x18ac00){this['containerView']['updateSources'](_0x18ac00);}getPartView(_0x240cee){return this['containerView']['bodyView']['getPartView'](_0x240cee);}setGating(_0x4524f0){this['containerView']['bodyView']['setGating'](_0x4524f0);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},Pr=class extends lr{replyContainer;_bodyCollection;constructor(_0x5bc968,_0xb95d95,_0x4fdee8){super(_0xb95d95),this['_bodyCollection']=_0x4fdee8,this['locale']=_0x5bc968,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x4ff2da(),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':Rs(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async updateContent({parsedContent:_0x48d84b,renderingStrategy:_0x4c672a,abortSignal:_0x24c741}){'streaming'===_0x4c672a?await this['streamIntoElement'](_0x48d84b,this['replyContainer']['element'],_0x24c741):this['replyContainer']['element']['innerHTML']=_0x3a1450(_0x48d84b);}updateSources(_0x4b6d29){const _0x5715d1=new kr(this['locale'],this['_bodyCollection']);_0x5715d1['children']['addMany'](_0x4b6d29['map'](_0x53ef76=>new yr(this['locale'],_0x53ef76,_0x5715d1['balloonPanelView']))),_0x5715d1['isVisible']=!0x0,this['children']['add'](_0x5715d1);}},Dr=class extends _0x5a896c{constructor(_0xe6a9c4=void 0x0){super();const _0x5523c0=_0xe6a9c4?'ck-ai-spinner_'+_0xe6a9c4:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x5523c0]}});}};const Hr={'file':_0x544acb,'image':_0x46256d,'document':_0x38d218,'web-resource':_0x43c1c8,'text':_0x544acb,'selection':tt,'mcp-tool-context':_0x38d218,'context':_0x38d218},Mr='ck-ai-chat-context-chip',Ur='ck-ai-chat-context-chip_wide',Vr='ck-ai-chat-context-chip_document',Br='ck-ai-chat-context-chip__label',Gr='ck-ai-chat-context-chip__type-icon',Fr='ck-ai-chat-context-controls__chip-tooltip',Kr='n';var Wr=class extends Mt{constructor(_0x1185c1,_0x4eb01b,_0x792987,_0x1f2c24,_0x7ae9c1=!0x1){super(_0x1185c1),this['_isAnimationOnEnterEnabled']=_0x1f2c24,this['_initializeProperties'](_0x4eb01b,_0x792987,_0x7ae9c1),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(_0x106170,_0x253f35,_0x230894){this['set']('label',_0x106170['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x106170['type']),this['set']('id',_0x106170['uiId']),this['set']('readonly',_0x253f35),this['set']('isLoading',_0x230894);}_setupTemplate(){const _0x1ad1c8=this['_createIconView'](),_0x4233f6=this['_createRemoveButton'](),_0x2518ca=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x2518ca),'children':this['_createTemplateChildren'](_0x1ad1c8,_0x4233f6,_0x2518ca)});}_createTemplateAttributes(_0x423d64){return{'class':[Mr,_0x423d64['if']('itemType',Vr,_0x13f697=>'document'==_0x13f697),_0x423d64['if']('itemType',Ur,_0x1a4ec4=>'selection'==_0x1a4ec4)],'data-cke-tooltip-text':_0x423d64['to']('label',Yr),'data-cke-tooltip-position':Kr,'data-cke-tooltip-class':Fr};}_createTemplateChildren(_0x5cc22a,_0x2f05b7,_0x1f4eb0){const _0x3041f9=this['_createLabelElement'](_0x1f4eb0),_0x512089=this['_createLoaderIcon']();return this['readonly']?[_0x5cc22a,_0x3041f9]:[_0x5cc22a,_0x512089,_0x3041f9,_0x2f05b7];}_createLabelElement(_0x436263){return{'tag':'span','attributes':{'class':Br},'children':[{'text':_0x436263['to']('label')}]};}_createRemoveButton(){const _0x135303=new Mt(this['locale']);return _0x135303['set']({'label':Es(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0xabec2d}),this['_setupRemoveButtonEvent'](_0x135303),_0x135303;}_setupRemoveButtonEvent(_0x4acd1f){_0x4acd1f['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}_createIconView(){const _0x1aa537=this['bindTemplate'],_0x51c8d6=new $t();return _0x51c8d6['content']=Hr[this['itemType']],_0x51c8d6['extendTemplate']({'attributes':{'class':[Gr,_0x1aa537['if']('isLoading','ck-hidden',_0x22002f=>_0x22002f)]}}),_0x51c8d6;}_handleAnimationEndOnce(_0x3e75d8,_0x376d05){if(!_0x3e75d8)return;const _0x4dba7a=()=>{_0x376d05(),_0x3e75d8['removeEventListener']('animationend',_0x4dba7a),_0x3e75d8['removeEventListener']('webkitAnimationEnd',_0x4dba7a);};_0x3e75d8['addEventListener']('animationend',_0x4dba7a),_0x3e75d8['addEventListener']('webkitAnimationEnd',_0x4dba7a);}_createLoaderIcon(){const _0x229768=new Dr('small');return _0x229768['bind']('isVisible')['to'](this,'isLoading',_0x18680c=>_0x18680c),_0x229768;}};function Yr(_0x1640fa){if(!_0x1640fa)return _0x1640fa;if(_0x1640fa['length']<=0x78)return _0x1640fa;const _0x4f4cd2=_0x1640fa['slice'](0x0,0x78),_0x590bcb=_0x4f4cd2['lastIndexOf']('\x20');return(_0x590bcb>0x0?_0x4f4cd2['slice'](0x0,_0x590bcb):_0x4f4cd2)+'…';}const $r={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},qr='300px';var Qr=class{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];_showMoreButtonView=null;['_showMoreBalloonPanelView']=null;_containerElement=null;_bodyCollection;_parentView=null;_intersectionObserver=null;_pendingCalculation=!0x1;constructor(_0x29807a,_0xb06118,_0x3cd42e,_0x28a991,_0x43f946){this['_locale']=_0x29807a,this['_visibleChips']=_0xb06118,this['_config']={...$r,..._0x3cd42e,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x3cd42e['cssClasses']}},this['_overflowChips']=new lt(),this['_bodyCollection']=_0x28a991,this['_parentView']=_0x43f946||null;}setContainerElement(_0x47cb6d){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x47cb6d,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 _0x4953d7=[...this['_visibleChips'],...this['_overflowChips']],_0x43e65b=this['_createCalculationContainer'](),_0x550681=this['_calculateOverflowInContainer'](_0x43e65b,_0x4953d7),_0x450c26=_0x43e65b['_ancestorsToRestore'];_0x450c26&&this['_restoreAncestorVisibility'](_0x450c26),_0x43e65b['remove'](),this['_applyOverflowResults'](_0x4953d7,_0x550681);}_createShowMoreButton(){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0x341840({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}_createShowMoreButtonView(){const _0x2baae0=new Mt(this['_locale']);_0x2baae0['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x4a1ed7=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x4a1ed7['push'](this['_config']['cssClasses']['controlsButton']),_0x2baae0['extendTemplate']({'attributes':{'class':_0x4a1ed7}}),_0x2baae0;}_createShowMoreBalloonPanelView(){const _0x1c6610=new xt(this['_locale']);return _0x1c6610['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x1c6610),_0x1c6610;}_updateBalloonContent(){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x206a60=>{_0x206a60['disableAnimationOnEnter']();});const _0x5708e0=new _0x4ff2da(this['_locale']);_0x5708e0['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x5708e0);}}_handleShowMoreButtonClick(){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}_updateShowMoreButtonVisibility(){const _0x1b4336=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x1b4336?'':'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(_0x1393a5){const _0x37cfb5=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x1a2658=this['_containerElement']?.['classList'];if(_0x1a2658){const _0xe8642c=_0x1a2658[0x0]||'',_0x378f90=_0x1393a5['querySelector']('.'+_0xe8642c),_0x5379e4=_0x1393a5['querySelector'](_0x37cfb5);return _0x378f90||_0x5379e4||_0x1393a5;}return _0x1393a5['querySelector'](_0x37cfb5)||_0x1393a5;}_calculateContainerWidth(){const _0x332a8a=this['_parentView']?.['element']||this['_containerElement'];if(!_0x332a8a)return qr;const _0x583d9e=window['getComputedStyle'](_0x332a8a)['width'];if('auto'===_0x583d9e||'0px'===_0x583d9e||!_0x583d9e){const _0x57c404=_0x332a8a['parentElement'];if(_0x57c404){const _0x3da5cd=window['getComputedStyle'](_0x57c404);return'auto'!==_0x3da5cd['width']?_0x3da5cd['width']:qr;}return qr;}return _0x583d9e;}_applyCalculationStyles(_0xedbcd0,_0x2b3750){this['_config']['cssClasses']['calculationContainer']&&_0xedbcd0['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0xedbcd0['style']['width']=_0x2b3750,_0xedbcd0['style']['position']='absolute',_0xedbcd0['style']['top']='-9999px',_0xedbcd0['style']['left']='-9999px',_0xedbcd0['style']['opacity']='0',_0xedbcd0['style']['pointerEvents']='none',_0xedbcd0['style']['zIndex']='-1',_0xedbcd0['style']['visibility']='visible\x20!important',_0xedbcd0['style']['display']='block\x20!important',_0xedbcd0['style']['boxSizing']='border-box';}_restoreAncestorVisibility(_0x212ee7){_0x212ee7['forEach'](({element:_0x4237b8,originalDisplay:_0x4a4702,originalVisibility:_0x4aa41f})=>{_0x4237b8['style']['display']=_0x4a4702,_0x4237b8['style']['visibility']=_0x4aa41f;});}_makeAncestorsVisible(_0x5cbb6f){const _0x5d20fd=[];let _0x5bb933=_0x5cbb6f;for(;_0x5bb933&&_0x5bb933!==document['body'];){const _0x218114=window['getComputedStyle'](_0x5bb933);'none'!==_0x218114['display']&&'hidden'!==_0x218114['visibility']||(_0x5d20fd['push']({'element':_0x5bb933,'originalDisplay':_0x5bb933['style']['display'],'originalVisibility':_0x5bb933['style']['visibility']}),_0x5bb933['style']['display']='block',_0x5bb933['style']['visibility']='visible'),_0x5bb933=_0x5bb933['parentElement'];}return _0x5d20fd;}_createContainerElements(){let _0x161542,_0x5322cd;return this['_parentView']?.['element']?(_0x161542=this['_parentView']['element']['cloneNode'](!0x0),_0x5322cd=this['_findTargetContainer'](_0x161542)):(_0x161542=document['createElement']('div'),_0x5322cd=_0x161542),{'calculationContainer':_0x161542,'targetContainer':_0x5322cd};}_createCalculationContainer(){const {calculationContainer:_0x3f7b6a,targetContainer:_0x2b9722}=this['_createContainerElements'](),_0x34caa1=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x3f7b6a,_0x34caa1);const _0xfe209a=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0xfe209a?_0xfe209a['appendChild'](_0x3f7b6a):document['body']['appendChild'](_0x3f7b6a),_0x3f7b6a['_targetContainer']=_0x2b9722;const _0x391743=this['_makeAncestorsVisible'](_0xfe209a||null);return _0x3f7b6a['offsetWidth'],_0x3f7b6a['_ancestorsToRestore']=_0x391743,_0x3f7b6a;}_calculateOverflowInContainer(_0x2a0b3d,_0x56a624){const _0x2ab0bd=_0x2a0b3d['_targetContainer']||_0x2a0b3d,_0xc933dc=[],{rowCount:_0x417ce5}=this['_renderChipsAndCountRows'](_0x2ab0bd,_0x56a624);if(_0x417ce5<=this['_config']['maxVisibleRows'])return _0xc933dc;const _0x275f06=_0x56a624['slice']();for(;_0x275f06['length']>0x0;){if(this['_testButtonFit'](_0x2a0b3d,_0x2ab0bd,_0x275f06)){const _0x542655=_0x56a624['filter'](_0x2cfcf9=>!_0x275f06['includes'](_0x2cfcf9));_0xc933dc['push'](..._0x542655);break;}if(!_0x275f06['pop']())break;}return _0xc933dc;}_renderChipsAndCountRows(_0x3595e1,_0x120ece){_0x3595e1['innerHTML']='',_0x120ece['forEach'](_0x43bd4b=>{if(_0x43bd4b['element']){const _0x39e3c1=_0x43bd4b['element']['cloneNode'](!0x0);_0x3595e1['appendChild'](_0x39e3c1);}}),_0x3595e1['offsetWidth'];const _0x46fe79=_0x3595e1['children'],_0x541422=[];return Array['from'](_0x46fe79)['forEach'](_0x5e225e=>{const _0x5d4371=_0x5e225e['getBoundingClientRect']()['top'];_0x541422['some'](_0x9c8736=>Math['abs'](_0x9c8736-_0x5d4371)<this['_config']['rowDetectionTolerance'])||_0x541422['push'](_0x5d4371);}),{'rowCount':_0x541422['length']};}_createMockButton(){const _0x324407=document['createElement']('button');return _0x324407['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x324407['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x324407['textContent']='+\x201',_0x324407;}_testButtonFit(_0x4c8712,_0x30228d,_0x3d53dc){this['_renderChipsAndCountRows'](_0x30228d,_0x3d53dc);const _0x2c5295=this['_createMockButton']();_0x4c8712['appendChild'](_0x2c5295),_0x4c8712['offsetWidth'];const _0x13ed58=[..._0x30228d['children'],_0x2c5295],_0x179251=[];_0x13ed58['forEach'](_0x19f256=>{const _0x38074b=_0x19f256['getBoundingClientRect']()['top'];_0x179251['some'](_0x3c1ce3=>Math['abs'](_0x3c1ce3-_0x38074b)<this['_config']['rowDetectionTolerance'])||_0x179251['push'](_0x38074b);});const _0x4f3cbb=_0x179251['length'];return _0x2c5295['remove'](),_0x4f3cbb<=this['_config']['maxVisibleRows'];}_distributeChips(_0x247e77,_0xc8b700){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x247e77['forEach'](_0x1335ef=>{_0xc8b700['includes'](_0x1335ef)?this['_overflowChips']['add'](_0x1335ef):this['_visibleChips']['add'](_0x1335ef);});}_updateOverflowUI(_0x3acef7){if(_0x3acef7>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x3acef7>0x0&&this['_showMoreButtonView']){const _0x253166=''+this['_config']['showMoreLabelPrefix']+(_0x3acef7<0x63?_0x3acef7:'99');this['_showMoreButtonView']['label']=_0x253166;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}_applyOverflowResults(_0x75a1ec,_0x5c8703){this['_distributeChips'](_0x75a1ec,_0x5c8703),this['_updateOverflowUI'](_0x5c8703['length']);}_setupVisibilityObserver(){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x2c8f77=>{_0x2c8f77[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 _0x2088e4=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x2088e4['width']||0x0===_0x2088e4['height'])return!0x1;const _0x5b3f27=window['innerHeight']||document['documentElement']['clientHeight'],_0x1698d4=window['innerWidth']||document['documentElement']['clientWidth'];return _0x2088e4['bottom']>=-0xc8&&_0x2088e4['top']<=_0x5b3f27+0xc8&&_0x2088e4['right']>=-0xc8&&_0x2088e4['left']<=_0x1698d4+0xc8;}};const Xr='ck-ai-chat__feed__context-chips',zr='ck-ai-chat-context-chips-wrapper',jr='ck-ai-chat-context-chips-wrapper-balloon',Jr='ck-ai-chat-controls-button',Zr='ck-ai-chat-controls_context_show-more-button',to='ck-ai-chat-context-controls__show-more-balloon-panel';var eo=class extends _0x4ff2da{_contextChips=this['createCollection']();['_overflowManager'];_bodyCollection;constructor(_0x1c4880,_0x2caf3c,_0x288756){super(_0x1c4880),this['_bodyCollection']=_0x288756,this['_createContextChips'](_0x2caf3c);const _0x10ac8f={'cssClasses':{'showMoreButton':Zr+'\x20'+Dn,'showMoreBalloon':to,'overflowContainer':jr,'controlsButton':Jr}};this['_overflowManager']=new Qr(_0x1c4880,this['_contextChips'],_0x10ac8f,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[Xr,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':zr},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x55937d=this['element']['querySelector']('.'+zr);_0x55937d&&(this['_overflowManager']['setContainerElement'](_0x55937d),this['_overflowManager']['reorganizeChips']());}destroy(){super['destroy'](),this['_overflowManager']['destroy']();}_createContextChips(_0xbe6166){for(const _0x1e682a of _0xbe6166){const _0x2baec2=new Wr(this['locale'],_0x1e682a,!0x0,!0x1);this['_contextChips']['add'](_0x2baec2);}}},io=class extends lr{_contextChipsView=null;['_locale'];_bodyCollection;_messageContentView;constructor(_0x23b8a0,_0x1f9438,_0x7aa368){super(_0x1f9438),this['_locale']=_0x23b8a0,this['_bodyCollection']=_0x7aa368,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 eo(this['_locale'],this['options']['contextItems']['filter'](_0x528b43=>!_0x528b43['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}_createMessageContentView(){this['_messageContentView']=new _0x4ff2da(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']();}},so=class extends lr{capabilities;constructor(_0x12c2ff,_0xaf4d4d){super(_0xaf4d4d);const {isWebSearchEnabled:_0x2c470c,isReasoningEnabled:_0x504648}=_0xaf4d4d['capabilities'],_0x2e91e7=[];let _0x199184='';_0x2c470c&&_0x504648?(_0x199184=Es(_0x12c2ff,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x2e91e7['push'](no(ht)),_0x2e91e7['push'](no(_0x588d47))):_0x2c470c?(_0x199184=Es(_0x12c2ff,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x2e91e7['push'](no(ht))):_0x504648&&(_0x199184=Es(_0x12c2ff,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x2e91e7['push'](no(_0x588d47))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x199184?'':'ck-hidden']}});const _0x142f6f=new _0x4ff2da();_0x142f6f['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x2e91e7,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x199184]}]}),this['children']['add'](_0x142f6f),this['capabilities']=_0xaf4d4d['capabilities'];}};function no(_0x5f2be4){const _0x466851=new $t();return _0x466851['content']=_0x5f2be4,_0x466851;}const ro=['wheel','touchstart','pointerdown','keydown'],oo=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var ao=class{element;animationFrameId;['isRunning'];abortController;['isUserPaused'];['scrollBehavior'];constructor(_0x52625a){this['element']=_0x52625a,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x78dc23 of ro){const _0x128c55='keydown'!==_0x78dc23;this['element']['addEventListener'](_0x78dc23,this['_onUserEvent']['bind'](this),{'passive':_0x128c55,'signal':this['abortController']['signal']});}}start({smooth:_0xe19e6b=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0xe19e6b?'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(_0x552d1e){if(this['isRunning']){if('keydown'===_0x552d1e['type']){const _0xa6654d=_0x552d1e['key'];if(!oo['includes'](_0xa6654d))return;}_0x552d1e instanceof WheelEvent?_0x552d1e['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}_isAtBottom(){const {scrollTop:_0x1bf5cc,scrollHeight:_0x15bf39,clientHeight:_0x101973}=this['element'];return _0x15bf39-_0x1bf5cc-_0x101973<=0x5;}_rafUpdate(){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}},ho=class extends lr{constructor(_0x2b9da7){super(_0x2b9da7),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']);}},co=class extends _0x4ff2da{['children'];['scrollManager'];_bodyCollection;constructor(_0x221d06,_0x447557){super(_0x221d06),this['_bodyCollection']=_0x447557,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...sr)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new ao(this['element']);}destroy(){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}addItem(_0x2c3c4b,_0x2384a4){let _0x109798;return'ai-reply'===_0x2c3c4b?_0x109798=new Pr(this['locale'],_0x2384a4,this['_bodyCollection']):'ai-suggestion-reply'===_0x2c3c4b?(_0x109798=new Lr(this['locale'],_0x2384a4,this['_bodyCollection']),_0x109798['bind']('isTrackChangesOn')['to'](this)):_0x109798='user-message'===_0x2c3c4b?new io(this['locale'],_0x2384a4,this['_bodyCollection']):'interaction-header'===_0x2c3c4b?new so(this['locale'],_0x2384a4):'custom-element'===_0x2c3c4b?new ho(_0x2384a4):new Rr(_0x2384a4),this['children']['add'](_0x109798),_0x109798;}async updateReplyItem({id:_0x44761f,parsedContent:_0xbf320c,renderingStrategy:_0x4808fd,abortSignal:_0x309e21}){const _0x1528f4=this['getItemById'](_0x44761f);if(!(_0x1528f4 instanceof Pr))throw new ct('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x1528f4,'id':_0x44761f,'parsedContent':_0xbf320c});await _0x1528f4['updateContent']({'parsedContent':_0xbf320c,'renderingStrategy':_0x4808fd,'abortSignal':_0x309e21});}async updateWebSources(_0x1ac44e,_0x30738e){const _0x3554ce=this['getItemById'](_0x1ac44e);if(_0x3554ce instanceof Lr)_0x3554ce['updateSources'](_0x30738e);else{if(!(_0x3554ce instanceof Pr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x3554ce,'id':_0x1ac44e,'sources':_0x30738e});_0x3554ce['updateSources'](_0x30738e);}}async updateSuggestionItem({id:_0x205cf9,parts:_0x371ac2,abortSignal:_0x39ff4b,skipLoadingEffects:_0x1852f6}){const _0x472e92=this['getItemById'](_0x205cf9);if(!(_0x472e92 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x472e92,'id':_0x205cf9,'parts':_0x371ac2});await _0x472e92['updateContent']({'parts':_0x371ac2,'abortSignal':_0x39ff4b,'skipLoadingEffects':_0x1852f6});}updateSuggestionPartState({id:_0x4a0baf,index:_0x593a9c,state:_0x19c7ef,outdatedReason:_0xfab939}){const _0x1f9be2=this['getItemById'](_0x4a0baf);if(!(_0x1f9be2 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x4a0baf});_0x1f9be2['updatePartState'](_0x593a9c,_0x19c7ef,_0xfab939);}updateSuggestionGating(_0x29eae6,_0x195044){const _0x155c04=this['getItemById'](_0x29eae6);if(!(_0x155c04 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x29eae6});_0x155c04['setGating'](_0x195044);}setSuggestionPartActive({id:_0x5be46c,index:_0x13444e,isActive:_0x4e3046}){const _0x3b6846=this['getItemById'](_0x5be46c);if(!(_0x3b6846 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x5be46c});this['children']['filter'](_0x55a894=>_0x55a894 instanceof Lr)['forEach'](_0x4e33e6=>{_0x4e33e6['setPartActive'](!0x1);}),_0x3b6846['setPartActive'](_0x13444e,_0x4e3046);}markItemAsDone(_0x1375bf){this['getItemById'](_0x1375bf)['markAsDone']();}getItemIds(){return this['children']['map'](_0x49e0b2=>_0x49e0b2['options']['id']);}removeItem(_0x21652e){this['children']['remove'](this['getItemById'](_0x21652e));}hasItem(_0x533c0b){return!!this['children']['find'](_0x2125ef=>_0x2125ef['options']['id']['includes'](_0x533c0b));}scrollToSuggestion(_0x59a84f,_0x48eede){const _0x5ce706=this['getItemById'](_0x59a84f);if(!(_0x5ce706 instanceof Lr))return void St('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x59a84f,'partIndex':_0x48eede});const _0x1751d4=_0x5ce706['getPartView'](_0x48eede);_0x1751d4?Rt(_0x1751d4['element'],0x14,this['element']['parentElement'],!0x0,!0x0):St('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x59a84f,'partIndex':_0x48eede});}_setupTemplate(){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}_createTemplateChildren(){const _0xae7a36=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0xae7a36,this['_createFeedLoader']()];}_createSkeletonLoader(){const _0x1c8ae5=new wr(this['locale'],Cr['aiFeed']);return _0x1c8ae5['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x1c8ae5;}_createFeedItems(){const _0x48b228=new _0x4ff2da(this['locale']);return _0x48b228['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x48b228;}_createFeedLoader(){const _0x143618=new _0x4ff2da(this['locale']);return _0x143618['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x1df5e7=>!_0x1df5e7)]},'children':this['_createLoaderChildren']()}),_0x143618;}_createLoaderChildren(){const _0x37bf02=new Dr();return _0x37bf02['isVisible']=!0x0,[_0x37bf02,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}getItemById(_0x43c03a){const _0x1dd580=this['children']['find'](_0x1bbbb7=>_0x1bbbb7['options']['id']['includes'](_0x43c03a));if(!_0x1dd580)throw new ct('ai-chat-feed-view-item-not-found',this,{'id':_0x43c03a});return _0x1dd580;}setLoadingMessage(_0x11e473){this['set']('loadingMessage',_0x11e473);}toggleLoadingSkeleton(_0x551a80){this['set']('isLoadingSkeletonVisible',_0x551a80);}startAutoScroll(_0x2ee9dc={}){this['scrollManager']['start'](_0x2ee9dc);}stopAutoScroll(){this['scrollManager']['stop']();}},lo=class extends Jt{filter(){let _0x2ca69a=0x0;for(const _0x2e9d13 of this['items'])_0x2ca69a+=_0x2e9d13['items']['length'];return{'resultsCount':_0x2ca69a,'totalItemsCount':_0x2ca69a};}};function uo(_0x16800c){const _0x417a8f=[];let _0x416618=!0x1;for(const _0x2bc9ec of Array['from'](_0x16800c['items'])){if('file'!==_0x2bc9ec['kind'])continue;if(_0x2bc9ec['webkitGetAsEntry']()?.['isDirectory']){_0x416618=!0x0;continue;}const _0x1fcc05=_0x2bc9ec['getAsFile']();_0x1fcc05&&_0x417a8f['push'](_0x1fcc05);}return{'files':_0x417a8f,'hasDirectory':_0x416618};}const _o='ck-ai-chat__prompt-input_highlighted';var go=class AIChatPromptInputView extends Nt{submitButtonView;static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;_addContextButtonView;['_queryViewResizeObserver'];constructor(_0x3164d5,_0x5c26bc){super(_0x3164d5,{'queryView':{'label':'','creator':_0x293ea1,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new lo(_0x3164d5),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x5c26bc,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',(_0x295931,_0x37bffd)=>!_0x295931&&!_0x37bffd),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x550e52,_0x13d46b)=>{this['isUploadInProgress']||this['isEmpty']||_0x550e52['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x13d46b());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x8b8443=>this['_handlePaste'](_0x8b8443)),this['element']['addEventListener']('drop',_0x4e7fa1=>this['_handleDrop'](_0x4e7fa1));}_handlePaste(_0xd4fe5b){const _0x1bb0aa=_0xd4fe5b['clipboardData'];if(!_0x1bb0aa)return;const {files:_0x165807,hasDirectory:_0x3f2fb0}=uo(_0x1bb0aa),_0x14bffe={'files':_0x165807,'plainText':_0x1bb0aa['getData']('text/plain'),'hasDirectory':_0x3f2fb0,'forceTextAttachment':!0x1,'preventDefault':()=>_0xd4fe5b['preventDefault']()};this['fire']('promptInputPaste',_0x14bffe);}['_handleDrop'](_0x42edd6){const _0x58525c=_0x42edd6['dataTransfer'];if(!_0x58525c)return;const _0x883ca5={'files':[],'plainText':_0x58525c['getData']('text/uri-list')||_0x58525c['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x42edd6['preventDefault']()};this['fire']('promptInputPaste',_0x883ca5);}destroy(){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}submit(){const _0x2f671e=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x2f671e)return this['queryView']['errorText']=Es(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x189c4f=_0x34830a(_0x2f671e);this['fire']('sendUserMessage',_0x189c4f),this['queryView']['fieldView']['reset']();}setPlaceholderText(_0x559ade){this['queryView']['fieldView']['set']('placeholder',_0x559ade);}['focus'](_0x5330dd=!0x1){super['focus'](),_0x5330dd&&(this['element']['classList']['contains'](_o)||(this['element']['classList']['add'](_o),setTimeout(()=>{this['element']['classList']['remove'](_o);},0x320)));}_createSubmitButton(){const _0x40a952=new Mt(this['locale']);return _0x40a952['set']({'icon':nt,'label':Es(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+Ln,'isEnabled':!0x1}),_0x40a952['on']('execute',()=>{this['submit']();}),_0x40a952;}setIsUploadInProgress(_0x15b898){this['isUploadInProgress']=_0x15b898;}_setUpAddContextButtonPositioning(){const _0x2a6a47=this['locale'],_0x5dcdb3=()=>{wt['window']['requestAnimationFrame'](()=>{if(ft(this['element'])){const _0x3b25f7=new It(this['queryView']['fieldView']['element']),_0x23a086=new It(this['_addContextButtonView']['element']),_0x7c79cd=_0x3b25f7['width'],_0x5e1c6b='rtl'===_0x2a6a47['uiLanguageDirection']?'right':'left';_0x3b25f7['excludeScrollbarsAndBorders']();const _0xb41bb2=_0x7c79cd-_0x3b25f7['width']+0x1;this['_addContextButtonView']['element']['style'][_0x5e1c6b]='calc('+(_0x7c79cd-_0x23a086['width']-_0xb41bb2)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x5dcdb3),this['on']('render',()=>{_0x5dcdb3(),this['_queryViewResizeObserver']=new pt(this['queryView']['fieldView']['element'],()=>{_0x5dcdb3();});});}},Ao=class extends _0x4ff2da{constructor(_0x51c3af){super(_0x51c3af),this['set']('isEnabled',!0x0);const _0x2074b7=new $t();_0x2074b7['content']=_0x544acb,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x2074b7,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':Es(_0x51c3af,'AI_CHAT_DROP_ZONE_HINT')}]}]});}attach(_0x15b640){let _0x56cb1e=0x0;const _0x38d132=()=>{_0x15b640['classList']['toggle']('ck-ai-chat-controls_drag-over',this['isEnabled']&&_0x56cb1e>0x0);};this['on']('change:isEnabled',(_0x359ae7,_0x34bd89,_0x10268b)=>{_0x10268b&&_0x56cb1e>0x0&&this['fire']('dragEnter'),_0x38d132();}),_0x15b640['addEventListener']('dragenter',_0x39355c=>{_0x39355c['dataTransfer']&&(_0x56cb1e++,0x1===_0x56cb1e&&this['isEnabled']&&this['fire']('dragEnter'),_0x38d132());}),_0x15b640['addEventListener']('dragover',_0x49df93=>{_0x49df93['dataTransfer']&&_0x49df93['preventDefault']();}),_0x15b640['addEventListener']('dragleave',()=>{--_0x56cb1e<0x0&&(_0x56cb1e=0x0),_0x38d132();}),_0x15b640['addEventListener']('drop',_0x1fe3a8=>{_0x1fe3a8['preventDefault'](),_0x56cb1e=0x0,_0x38d132(),this['isEnabled']&&this['_handleDrop'](_0x1fe3a8);});}['_handleDrop'](_0x5c6e05){const _0x895c12=_0x5c6e05['dataTransfer'];if(!_0x895c12)return;const {files:_0x41dd69,hasDirectory:_0xd848a6}=uo(_0x895c12),_0x21734e={'files':_0x41dd69,'plainText':_0x895c12['getData']('text/uri-list')||_0x895c12['getData']('text/plain'),'hasDirectory':_0xd848a6,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x21734e);}},Io=class extends _0x4ff2da{['dropdownView'];['nameView'];_items;['_config'];constructor(_0xd6fd53,_0x5d494e){super(_0xd6fd53),this['_config']=_0x5d494e,this['set']('modelDisplayMode','selector'),this['set']('activeModelId',null),this['set']('activeModelName',null),this['set']('isEnabled',!0x0),this['dropdownView']=this['_createDropdown'](),this['_items']=new lt(),_0x3196cc(this['dropdownView'],this['_items']),this['nameView']=new po(_0xd6fd53,_0x5d494e['nameClass']),this['nameView']['bind']('text')['to'](this,'activeModelName',_0x54e178=>_0x54e178??''),this['nameView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x2cd805=>'name'===_0x2cd805),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-model-selector']},'children':[this['dropdownView'],this['nameView']]});}setModels(_0x300760,_0x946c7){var _0x324478;this['set']('modelDisplayMode',(_0x324478=_0x300760['length'],_0x946c7?0x1===_0x324478?'name':'selector':'hidden')),this['_items']['clear'](),0x1===_0x300760['length']&&this['set']('activeModelName',_0x300760[0x0]['name']||_0x300760[0x0]['id']);for(const _0x4826f5 of _0x300760){const _0x5402f3=new _0xd62086({'label':_0x4826f5['name'],'withText':!0x0,'role':'menuitemradio','id':_0x4826f5['id'],'model':_0x4826f5});_0x5402f3['bind']('isOn')['to'](this,'activeModelId',_0x12b7e5=>_0x12b7e5===_0x4826f5['id']),this['_items']['add']({'type':'button','model':_0x5402f3,'labelView':new Eo(this['locale'],_0x4826f5,{'nameClass':this['_config']['itemClasses']['name'],'descriptionClass':this['_config']['itemClasses']['description'],'capabilitiesClass':this['_config']['itemClasses']['capabilities'],'extraContent':this['_config']['showCapabilities']?mo(this['locale'],_0x4826f5):void 0x0})});}}setSelectedModel(_0x211903){this['set']('activeModelId',_0x211903?_0x211903['id']:null),this['set']('activeModelName',_0x211903?_0x211903['name']||_0x211903['id']:null);}_createDropdown(){const _0x2aef03=_0x5a954d(this['locale']);return _0x2aef03['set']({'panelPosition':this['_config']['panelPosition'],'class':this['_config']['dropdownClass']}),_0x2aef03['buttonView']['set']({'withText':!0x0,'tooltipPosition':this['_config']['tooltipPosition'],'class':Dn}),_0x2aef03['buttonView']['bind']('label')['to'](this,'activeModelName',_0xeac1fd=>_0xeac1fd??this['_config']['defaultLabel']??''),_0x2aef03['buttonView']['bind']('tooltip')['to'](this,'activeModelName',this,'isEnabled',(_0x26adda,_0x3c6f29)=>!_0x3c6f29&&this['_config']['disabledTooltip']?this['_config']['disabledTooltip']:_0x26adda??this['_config']['defaultLabel']??''),_0x2aef03['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x5398a2=>'selector'===_0x5398a2),_0x2aef03['bind']('isEnabled')['to'](this,'isEnabled'),this['listenTo'](_0x2aef03,'execute',_0x78fa5e=>{this['fire']('selectModel',_0x78fa5e['source']['model']);}),_0x2aef03;}},po=class extends _0x4ff2da{constructor(_0x1b891f,_0xa1bb2d){super(_0x1b891f),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x57b9ee=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck',_0xa1bb2d,_0x57b9ee['if']('isVisible','ck-hidden',_0x183a4b=>!_0x183a4b)]},'children':[{'text':_0x57b9ee['to']('text')}]});}},Eo=class extends Dt{constructor(_0x4060f8,_0x55a456,_0x2bf385){super();const _0x5141a3=this['bindTemplate'],_0x148731=[{'tag':'div','attributes':{'class':[_0x2bf385['nameClass']]},'children':[{'tag':'span','children':[{'text':_0x5141a3['to']('text')}]}]},{'tag':'div','attributes':{'class':[_0x2bf385['descriptionClass']]},'children':[{'tag':'span','children':[_0x55a456['description']||'']}]}];_0x2bf385['extraContent']?.['length']&&_0x2bf385['capabilitiesClass']&&_0x148731['push']({'tag':'div','attributes':{'class':[_0x2bf385['capabilitiesClass']]},'children':_0x2bf385['extraContent']}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x5141a3['to']('style'),'id':_0x5141a3['to']('id')},'children':_0x148731});}};function mo(_0x3af205,_0x82d6e1){return[...To(_0x3af205,ht,'AI_CHAT_SEARCH_WEB',_0x82d6e1['capabilities']['webSearch']?.['enabled']??!0x1),...To(_0x3af205,_0x588d47,'AI_CHAT_REASONING',_0x82d6e1['capabilities']['reasoning']?.['enabled']??!0x1)];}function To(_0x35b2b3,_0x1ea829,_0x5c309f,_0x5d966b){const _0x167ff3=new $t();_0x167ff3['content']=_0x1ea829;const _0x4eeff3=new _0x4ff2da(_0x35b2b3);_0x4eeff3['setTemplate']({'tag':'span','children':[{'text':Es(_0x35b2b3,_0x5c309f)+':\x20'}]});const _0x523106=new _0x4ff2da(_0x35b2b3);return _0x523106['setTemplate']({'tag':'span','children':[{'text':Es(_0x35b2b3,_0x5d966b?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x167ff3,_0x4eeff3,_0x523106];}const wo='ck-ai-chat__prompt-capabilities',Co='ck-ai-chat-controls-button',fo='ck-ai-chat-controls-button--commands',bo='ck-ai-chat-controls__model-selection',So='ck-ai-chat-controls__model-selection__item-name',Ro='ck-ai-chat-controls__model-selection__item-description',Oo='ck-ai-chat-controls__model-selection__item-capabilities',vo='n';var ko=class extends _0x4ff2da{_webSearchButton;_reasoningButton;_commandsButton;_modelSelector;constructor(_0xa5ccc3){super(_0xa5ccc3),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelSelectorEnabled',!0x0),this['_modelSelector']=function(_0x51fbd4){return new Io(_0x51fbd4,{'panelPosition':'ne','dropdownClass':[bo],'nameClass':'ck-ai-chat-controls__model-name','itemClasses':{'name':So,'description':Ro,'capabilities':Oo},'defaultLabel':Es(_0x51fbd4,'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'disabledTooltip':Es(_0x51fbd4,'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP'),'tooltipPosition':vo,'showCapabilities':!0x0});}(_0xa5ccc3),this['_modelSelector']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x37ae6f=>_0x37ae6f),this['_modelSelector']['delegate']('selectModel')['to'](this),this['_webSearchButton']=this['_createWebSearchButton'](),this['_reasoningButton']=this['_createReasoningButton'](),this['_commandsButton']=this['_createCommandsButton'](),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x40e9b2=>_0x40e9b2),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x20a66f=>Es(this['locale'],_0x20a66f?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x405ef3=>_0x405ef3),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x4ec595=>Es(this['locale'],_0x4ec595?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[wo]},'children':[this['_modelSelector'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]});}setWebSearch(_0x192caa){this['set']('webSearchActive',_0x192caa);}setReasoning(_0x23a646){this['set']('reasoningActive',_0x23a646);}setModelList(_0x5362f6,_0x4a4111){this['_modelSelector']['setModels'](_0x5362f6,!_0x4a4111);}setModel(_0x332dcf){if(!_0x332dcf)return;this['_modelSelector']['setSelectedModel'](_0x332dcf);const _0x3c2390=_0x332dcf['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x3c2390),this['_webSearchButton']['set']('isVisible',_0x3c2390);const _0x3acedd=_0x332dcf['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x3acedd),this['_reasoningButton']['set']('isVisible',_0x3acedd);}enableModelSelector(){this['set']('modelSelectorEnabled',!0x0);}disableModelSelector(_0xae30c5){this['set']('modelSelectorEnabled',!0x1),_0xae30c5&&(this['_modelSelector']['modelDisplayMode']='hidden');}_createWebSearchButton(){const _0x36030a=new Mt();return _0x36030a['set']({'label':Es(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':ht,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltipPosition':vo}),_0x36030a['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x36030a;}_createReasoningButton(){const _0x2d7ac1=new Mt();return _0x2d7ac1['set']({'label':Es(this['locale'],'AI_CHAT_REASONING'),'icon':_0x588d47,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltipPosition':vo}),_0x2d7ac1['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x2d7ac1;}_createCommandsButton(){const _0x5397ea=new Mt();return _0x5397ea['set']({'label':Es(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x3236d4,'withText':!0x0,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltip':Es(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':vo}),_0x5397ea['extendTemplate']({'attributes':{'class':[fo]}}),_0x5397ea['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x5397ea;}};const yo='ck-ai-chat-context-controls__url-form',No='ck-ai-chat-context-controls__url-input-section';var xo=class extends _0x4ff2da{['focusTracker'];keystrokes;['_focusables'];['focusCycler'];urlInputField;backButton;confirmButton;constructor(_0x492583){super(_0x492583),this['focusTracker']=new _t(),this['keystrokes']=new gt(),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 Ft({'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'](_0x5341e0=>{this['focusTracker']['add'](_0x5341e0['element']),this['keystrokes']['listenTo'](_0x5341e0['element']);}),_0x5875a6({'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(_0x36b67a){this['urlInputField']['errorText']=_0x36b67a,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}_createBackButton(){const _0x141f9b=new Mt(this['locale']);return _0x141f9b['set']({'icon':_0x202389,'tooltip':Es(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x48b077,_0x2c2f27,_0x534518)=>{_0x141f9b['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x534518?'':'\x20ck-hidden')]});}),_0x141f9b;}_createUrlInputField(){const _0x540c4c=new Qt(this['locale'],_0x3b9224);return _0x540c4c['set']({'label':Es(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x540c4c['fieldView']['set']({'placeholder':Es(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x540c4c;}_createConfirmButton(){const _0x3df65b=new Mt(this['locale']);return _0x3df65b['set']({'icon':_0x5517bf,'tooltip':Es(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x3df65b;}_setupTemplate(){const _0x3412a4=new Kt(this['locale'],{'label':Es(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x3412a4['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':yo,'tabindex':'-1'},'children':[_0x3412a4,{'tag':'div','attributes':{'class':No},'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',_0x441f53=>{_0x441f53['stop'](),this['_handleSubmit']();});}_setupKeystrokes(){this['keystrokes']['set']('esc',(_0x36b74c,_0x1fc447)=>{this['clear'](),this['fire']('cancel'),_0x1fc447();});}_handleSubmit(){const _0x36e854=this['getValue']()['trim']();_0x36e854?this['_isValidUrl'](_0x36e854)?(this['clearError'](),this['fire']('submitUrl',_0x36e854)):this['setError'](Es(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Es(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}_updateConfirmButtonState(){const _0x5b3ba3=this['getValue']()['trim'](),_0x19ccfd=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x5b3ba3['length']>0x0&&!_0x19ccfd;}['_isValidUrl'](_0x80bc58){try{return!!new URL(_0x80bc58);}catch{return!0x1;}}};const Lo='ck-ai-chat-resources__item',Po='ck-ai-chat-resources__item--in-context',Do='ck-ai-chat-resources__item-title',Ho='ck-ai-chat-resources__item__icon';var Mo=class extends jt{['resource'];_titleView;['_iconView'];constructor(_0x196af9,_0x4128c2){super(_0x196af9),this['resource']=_0x4128c2,this['set']('isInContext',!!_0x4128c2['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}getResourceIcon(_0x3584cb){if(_0x3584cb['isInContext'])return _0x5517bf;switch(_0x3584cb['type']){case'document':return _0x38d218;case'web-resource':return _0x43c1c8;case'file':case'text':return _0x544acb;default:return _0x17766e;}}highlightText(_0x5d4508){if(!_0x5d4508||''===_0x5d4508['trim']())return void this['_titleView']['highlightText'](null);const _0x1cfef8=new RegExp(_0x306a2e(_0x5d4508),'gi');this['_titleView']['highlightText'](_0x1cfef8);}updateResourceState(_0x43431b){this['resource']['isInContext']=_0x43431b,this['isInContext']=_0x43431b,this['_updateIcon']();}_createTitleView(){const _0x2ec236=new Yt();return _0x2ec236['text']=this['resource']['label'],_0x2ec236['extendTemplate']({'tag':'span','attributes':{'class':[Do]}}),_0x2ec236;}_createIconView(){const _0x32abf6=new $t();return _0x32abf6['content']=this['getResourceIcon'](this['resource']),_0x32abf6;}_setupTemplate(){const _0x12e159=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[Lo,_0x12e159['if']('isVisible','ck-hidden',_0x32386d=>!_0x32386d),_0x12e159['if']('isInContext',Po)]},'children':[{'tag':'div','attributes':{'class':[Ho]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x12e159['to']('execute')}});}_updateIcon(){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const Uo='ck-ai-chat-resources__list';var Vo=class extends Jt{['_source'];constructor(_0x4a4c84,_0xda130a){super(_0x4a4c84),this['_source']=_0xda130a,this['extendTemplate']({'attributes':{'class':[Uo]}});}setResources(_0x500736,_0x53f4f4){this['items']['clear']();let _0x3cadfc=_0x500736;if(this['_source']['useDefaultFiltering']&&_0x53f4f4&&''!==_0x53f4f4['trim']()){const _0x2ab51f=new RegExp(_0x53f4f4['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x3cadfc=_0x500736['filter'](_0x2f5086=>_0x2ab51f['test'](_0x2f5086['label']));}for(const _0x966e0d of _0x3cadfc){const _0x315eb0=new Mo(this['locale'],_0x966e0d);_0x315eb0['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x966e0d);}),this['items']['add'](_0x315eb0);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x53f4f4);}highlightText(_0x21ba2f){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x1033d5=>{_0x1033d5['highlightText'](_0x21ba2f);});}updateResourceState(_0x445a24,_0x2ff148){for(const _0x8d442e of this['items']){const _0x6e3091=_0x8d442e;_0x6e3091['resource']['id']===_0x445a24&&_0x6e3091['updateResourceState'](_0x2ff148);}}_handleResourceSelection(_0x3054f1,_0x5ba39a){this['fire']('addResourceToContext',{'source':_0x3054f1,'resource':_0x5ba39a});}},Bo=class extends Qt{['iconView'];resetButtonView;['_viewConfig'];constructor(_0x1d19d4){const t=_0x1d19d4['t'],_0x5ddc82={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x3b9224,'label':Es(_0x1d19d4,'AI_CHAT_SEARCH_RESOURCES')};super(_0x1d19d4,_0x5ddc82['creator']),this['label']=_0x5ddc82['label'],this['_viewConfig']=_0x5ddc82,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x1d19d4,t),this['_setupEventListeners']();}reset(){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x33fbc9){this['fire']('search',_0x33fbc9);}getQuery(){return this['fieldView']['element']?.['value']||'';}_setupSearchIcon(){this['iconView']=new $t(),this['iconView']['content']=_0x69c189,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}_setupResetButton(_0x2cd1e9,t){this['resetButtonView']=new Mt(_0x2cd1e9),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0xabec2d,'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',_0x499bbd=>!_0x499bbd),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);}},Go=class extends _0x4ff2da{['_searchView'];_searchSection;_searchInputVisibleFrom;_resourcesListView;_skeletonLoader;['_source'];['children'];_latestLoadResourcesUid=null;constructor(_0x20bf5c,_0x4d662a){super(_0x20bf5c),this['_source']=_0x4d662a['source'],this['_searchInputVisibleFrom']=_0x4d662a['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 _0x50bc02([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}_createSearchView(){return new Bo(this['locale']);}_createSearchSection(){const _0xf203e7=new _0x4ff2da(this['locale']);return _0xf203e7['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x2530ce,_0x5ef328)=>{this['loadResources'](_0x5ef328),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x5ef328);}),_0xf203e7;}_createResourcesListView(){const _0x277f97=new Vo(this['locale'],this['_source']);return _0x277f97['delegate']('addResourceToContext')['to'](this),_0x277f97['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x277f97;}_createSkeletonView(){const _0x146336=new wr(this['locale'],Cr['aiChatResources']);return _0x146336['bind']('isVisible')['to'](this,'isLoading'),_0x146336;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x367e3f){const _0x1298fb=kt();this['_latestLoadResourcesUid']=_0x1298fb,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x367e3f,'uid':_0x1298fb}),this['isLoading']=!0x0;}setResources(_0x242298,_0x265ada){if(_0x265ada&&_0x265ada!==this['_latestLoadResourcesUid'])return;const _0x3b2186=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x242298,_0x3b2186),_0x242298['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}updateResourceState(_0x42ea4d,_0x48caa2){this['_resourcesListView']['updateResourceState'](_0x42ea4d,_0x48caa2);}};const Fo='ck-ai-chat-context-controls__source-balloon-panel',Ko='ck-button-icon\x20ck-button-back',Wo='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';var Yo=class{['_sourceResourceBalloons']=new Map();_bodyCollection;['_locale'];['_config'];constructor(_0x3fa44f,_0xaf8e4e,_0xd39c04){this['_locale']=_0x3fa44f,this['_bodyCollection']=_0xaf8e4e,this['_config']=_0xd39c04;}['showSourceResourcesBalloon']({source:_0x97ae30,withBackButton:_0x59d1aa}){let _0xc728a=this['_sourceResourceBalloons']['get'](_0x97ae30['id']);_0xc728a||(_0xc728a=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x97ae30['id'],_0xc728a),this['_setupSingleResourceBalloonClickOutsideHandler'](_0xc728a)),this['_addSourceResourceContent']({'balloonPanel':_0xc728a,'source':_0x97ae30,'withBackButton':_0x59d1aa}),_0xc728a['show']();const _0x296f5f=this['_config']['getTargetElement']();_0x296f5f&&_0xc728a['pin']({'target':_0x296f5f,'limiter':this['_config']['getLimiterElement']()});}populateSourceResourceBalloon(_0x3c26fe,_0x154a5a,_0x215492){const _0x15d9a1=this['_sourceResourceBalloons']['get'](_0x3c26fe);if(!_0x15d9a1)return;const _0x43582c=this['_getResourcesViewFromBalloon'](_0x15d9a1);_0x43582c&&(_0x43582c['setResources'](_0x154a5a,_0x215492),_0x43582c['once']('change:isLoading',()=>{_0x15d9a1['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x4430b9){const _0x2b6df3=this['_sourceResourceBalloons']['get'](_0x4430b9);_0x2b6df3&&requestAnimationFrame(()=>{_0x2b6df3['hide'](),this['_sourceResourceBalloons']['delete'](_0x4430b9),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x1075a0 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x1075a0);}['isAnyResourceBalloonVisible'](){for(const _0x1b71e3 of this['_sourceResourceBalloons']['values']())if(_0x1b71e3['isVisible'])return!0x0;return!0x1;}updateResourceState(_0x335432,_0x41542c,_0x219999){const _0x1674e2=this['_sourceResourceBalloons']['get'](_0x335432);if(!_0x1674e2||!_0x1674e2['isVisible'])return;const _0x3de579=this['_config']['getTargetElement']();if(!_0x3de579)return;_0x1674e2['pin']({'target':_0x3de579,'limiter':this['_config']['getLimiterElement']()});const _0x473e03=this['_getResourcesViewFromBalloon'](_0x1674e2);_0x473e03&&_0x473e03['updateResourceState'](_0x41542c,_0x219999);}destroy(){for(const _0x4ae0b4 of this['_sourceResourceBalloons']['values']())_0x4ae0b4['destroy']();this['_sourceResourceBalloons']['clear']();}_createSourceResourceBalloonPanel(){const _0x29d8f3=new xt(this['_locale']);return _0x29d8f3['extendTemplate']({'attributes':{'class':Fo}}),this['_bodyCollection']['add'](_0x29d8f3),_0x29d8f3;}_addSourceResourceContent({balloonPanel:_0x4e8787,source:_0x5a021d,withBackButton:_0x496b49}){_0x4e8787['content']['clear']();const _0x115043=this['_createBalloonHeader']({'balloonPanel':_0x4e8787,'source':_0x5a021d,'withBackButton':_0x496b49});_0x4e8787['content']['add'](_0x115043);const _0x4023ce=this['_createBalloonResourcesView'](_0x5a021d);_0x4e8787['content']['add'](_0x4023ce);}_createBalloonHeader({balloonPanel:_0x182015,source:_0x40f93c,withBackButton:_0x57e661}){const _0x58156f=new Kt(this['_locale'],{'label':_0x40f93c['label'],'class':Wo});return _0x57e661&&_0x58156f['children']['add'](this['_createBackButton'](_0x182015),0x0),_0x58156f;}_createBackButton(_0x2b7e31){const _0x422e4f=new Mt(this['_locale']);return _0x422e4f['set']({'icon':_0x202389,'tooltip':Es(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':Ko}),_0x422e4f['on']('execute',()=>{_0x2b7e31['hide'](),this['_config']['onBackToContext']();}),_0x422e4f;}_createBalloonResourcesView(_0x1dd5b9){const _0x3382e9=new Go(this['_locale'],{'source':_0x1dd5b9,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x3382e9['on']('loadSourceResources',(_0x1d001d,_0x71fdef)=>{this['_config']['onLoadSourceResources'](_0x71fdef);}),_0x3382e9['on']('addResourceToContext',(_0x54d3ab,_0x13b2b9)=>{this['_config']['onResourceSelected'](_0x13b2b9['source'],_0x13b2b9['resource']),this['closeSourceResourceBalloon'](_0x1dd5b9['id']);}),_0x3382e9;}_getResourcesViewFromBalloon(_0x48c582){const _0x2f4577=_0x48c582['content']['get'](0x1);return _0x2f4577 instanceof Go?_0x2f4577:null;}_setupSingleResourceBalloonClickOutsideHandler(_0x7b1591){_0x341840({'emitter':_0x7b1591,'contextElements':[_0x7b1591['element']],'callback':()=>{_0x7b1591['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x7b1591['isVisible']});}};const $o=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],qo='ck-ai-chat-context-controls',Qo='ck-ai-chat-context-controls__pending-contexts',Xo='ck-ai-chat-context-controls__add-context-balloon-panel',zo='ck-ai-chat-context-controls__add-context-button',jo='ck-ai-chat-context-controls__url-balloon-panel',Jo='ck-ai-chat-context-controls__balloon-button',Zo='ck-ai-chat-context-controls__balloon-button-source',ta='ck-ai-chat-controls-button',ea='ck-ai-chat-context-chips-wrapper-balloon',ia='ck-ai-chat-controls_context_show-more-button',sa='ck-ai-chat-context-controls__show-more-balloon-panel',na='ck-ai-chat',ra=[xt['defaultPositions']['northArrowSouthWest'],xt['defaultPositions']['northArrowSouth'],xt['defaultPositions']['northArrowSouthEast'],xt['defaultPositions']['southArrowNorthWest'],xt['defaultPositions']['southArrowNorth'],xt['defaultPositions']['southArrowNorthEast']];var oa=class extends _0x4ff2da{addContextButtonView;_currentContextsChips=this['createCollection']();_conversationContextsChips=this['createCollection']();['_overflowManager'];_addContextBalloonPanelView;['_urlBalloonPanelView'];_urlInputView;['_resourcesBalloonView'];_addContextBalloonConfig;_hasExactlyOneSource=!0x1;bodyCollection;constructor(_0x3a602d,_0x5769b2){super(_0x3a602d),this['bodyCollection']=_0x5769b2['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x3a602d),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x3a602d),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x3a602d),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x3a602d,_0x5769b2);const _0x44c3d8={'cssClasses':{'showMoreButton':ia+'\x20'+Dn,'showMoreBalloon':sa,'overflowContainer':ea,'controlsButton':ta}};this['_overflowManager']=new Qr(_0x3a602d,this['_currentContextsChips'],_0x44c3d8,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(_0xfa8925,_0x229061){const _0x1a5f04=this['_createContextButton'](_0xfa8925,'current',!0x0,_0x229061);this['_addContextToCollection'](_0x1a5f04,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}removeContextItem(_0x15d595){this['_removeContextFromCollection'](_0x15d595,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x15d595,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}setContextItemLoading(_0x41b36b,_0x465b6f){let _0x4598e3=this['_currentContextsChips']['find'](_0x24f41b=>_0x24f41b['id']===_0x41b36b);_0x4598e3||(_0x4598e3=this['_overflowManager']['overflowChips']['find'](_0x40bf4e=>_0x40bf4e['id']===_0x41b36b)),_0x4598e3&&(_0x4598e3['isLoading']=_0x465b6f);}setConversationContext(_0x114e42){this['_conversationContextsChips']['clear']();for(const _0x5a110e of _0x114e42){const _0x486dca=this['_createContextButton'](_0x5a110e,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x486dca,this['_conversationContextsChips']);}}clearCurrentContextItems(){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}clearConversationContextItems(){this['_conversationContextsChips']['clear']();}updateResourceState(_0x358951,_0x465e61,_0x19d252){this['_resourcesBalloonView']['updateResourceState'](_0x358951,_0x465e61,_0x19d252);}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:_0x2bffa5,withBackButton:_0x54d065}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x2bffa5,'withBackButton':_0x54d065}),this['addContextButtonView']['isOn']=!0x0;}populateSourceResourceBalloon(_0x410942,_0x3a5256,_0x22ded6,_0x4feeee){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x410942,_0x22ded6,_0x4feeee);}['closeSourceResourceBalloon'](_0x21f91d){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x21f91d),this['addContextButtonView']['isOn']=!0x1;}setAddContextOptions(_0x417d65){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x417d65),this['_setAddContextButtonEnabled'](_0x417d65);}_setAddContextButtonEnabled(_0x263c3a){const _0x1e760a=!_0x263c3a['document']['isHidden']&&_0x263c3a['document']['enabled'],_0x24f335=_0x263c3a['urls']['enabled'],_0x334502=_0x263c3a['files']['enabled'],_0x49caea=_0x263c3a['sources']['length']>0x0,_0x45a32b=_0x263c3a['customItems']&&_0x263c3a['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x1e760a||_0x24f335||_0x334502||_0x49caea||_0x45a32b;}_setupTemplate(){this['setTemplate']({'tag':'div','attributes':{'class':[qo,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':Qo},'children':this['_currentContextsChips']}]});}_bindEventHandlers(){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}_createAddContextButtonView(_0x1ddcd9){const _0x191118=new Mt(_0x1ddcd9);return _0x191118['set']({'label':Es(_0x1ddcd9,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':ta+'\x20'+zo+'\x20'+Dn,'icon':_0x98a188,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x191118;}_createAddContextBalloonPanelView(_0x5ab3e3){return this['_createBaseBalloonPanel'](_0x5ab3e3,Xo);}_createUrlBalloonPanelView(_0x4da2ac){const _0x1dd1a1=this['_createBaseBalloonPanel'](_0x4da2ac,jo);return this['_addUrlContent'](_0x1dd1a1,_0x4da2ac),_0x1dd1a1;}_createResourcesBalloonView(_0x9d2e54,_0x488efa){const _0x416219={'searchInputVisibleFrom':_0x488efa['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra});},'onResourceSelected':(_0x5676b0,_0x3b4187)=>{this['fire']('addResourceToContext',{'source':_0x5676b0,'resource':_0x3b4187});},'onLoadSourceResources':_0x3b97e4=>{this['fire']('loadSourceResources',_0x3b97e4);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new Yo(_0x9d2e54,_0x488efa['bodyCollection'],_0x416219);}_getLimiterElement(){return this['element']?.['closest']('.'+na)||document['body'];}_createBaseBalloonPanel(_0xb50606,_0x88d84d){const _0x12474a=new xt(_0xb50606);return _0x12474a['extendTemplate']({'attributes':{'class':_0x88d84d}}),this['bodyCollection']['add'](_0x12474a),_0x12474a;}_setBalloonPanelContent(_0x429d42,_0x43a6db,_0x376e63){if(_0x429d42['content']['clear'](),!_0x376e63['document']['isHidden']&&_0x376e63['document']['enabled']){const _0x2693c5=this['_createBalloonButton'](_0x43a6db,{'label':Es(_0x43a6db,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x38d218});_0x2693c5['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x429d42['content']['add'](_0x2693c5);}if(_0x376e63['urls']['enabled']){const _0x20bd60=this['_createBalloonButton'](_0x43a6db,{'label':Es(_0x43a6db,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x43c1c8});_0x20bd60['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra}),this['_urlInputView']['focus']();}),_0x429d42['content']['add'](_0x20bd60);}if(_0x376e63['files']['enabled']){const _0x31eddc=new Gt(_0x43a6db);_0x31eddc['set']({'label':Es(_0x43a6db,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x2adbc2,'withText':!0x0,'tooltip':!0x0,'class':Jo,'allowMultipleFiles':!0x0}),_0x31eddc['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x31eddc['on']('done',(_0x4066b8,_0x61486e)=>{this['fire']('addFileToContext',_0x61486e);}),_0x31eddc['tooltip']=!0x0,_0x429d42['content']['add'](_0x31eddc);}for(const _0xd9641f of _0x376e63['sources']){const _0x2275a0=this['_createBalloonButton'](_0x43a6db,{'label':_0xd9641f['label'],'icon':_0xd9641f['icon']||_0x17766e,'type':'source'});_0x429d42['content']['add'](_0x2275a0),_0x2275a0['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0xd9641f,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x586130 of _0x376e63['customItems']||[]){const _0x5d34c0=this['_createBalloonButton'](_0x43a6db,{'label':_0x586130['label'],'icon':_0x586130['icon']||_0x17766e,'type':'customItem'});_0x429d42['content']['add'](_0x5d34c0),_0x5d34c0['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x586130);});}this['_hasExactlyOneSource']=0x1===_0x429d42['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}_addUrlContent(_0x86a178,_0x314713){this['_urlInputView']=new xo(_0x314713),this['_urlInputView']['on']('submitUrl',(_0x4b3d26,_0x2d341a)=>{this['_handleUrlSubmit'](_0x2d341a);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra});}),_0x86a178['content']['add'](this['_urlInputView']);}_createBalloonButton(_0x481084,_0xb00f29){const _0x569487='source'===_0xb00f29['type']?new aa(_0x481084):new Mt(_0x481084);return _0x569487['set']({'label':_0xb00f29['label'],'icon':_0xb00f29['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':Jo}),_0x569487;}_setupAllBalloonClickOutsideHandlers(){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}_setupUrlBalloonClickOutsideHandler(){_0x341840({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}_toggleAddContextBalloon(_0x33924b){const _0x2d76cf=this['_addContextBalloonConfig'];_0x2d76cf['buttonView']['isOn']=_0x33924b,_0x33924b?_0x2d76cf['balloonView']['show']():_0x2d76cf['balloonView']['hide']();}_setupAddContextBalloonClickOutsideHandler(){const {balloonView:_0x8baadf,buttonView:_0x13d934,hideMethod:_0x616220}=this['_addContextBalloonConfig'];_0x341840({'emitter':_0x8baadf,'contextElements':[_0x8baadf['element'],_0x13d934['element']],'callback':()=>{_0x616220();},'activator':()=>_0x13d934['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}_createContextButton(_0x253017,_0x26910c,_0x1335dd=!0x1,_0x21bcef=!0x1){const _0x42a696='conversation'===_0x26910c||!0x0===_0x253017['isReadOnly'],_0x55b2b2=new Wr(this['locale'],_0x253017,_0x42a696,_0x1335dd,_0x21bcef);return _0x42a696||_0x55b2b2['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x55b2b2['id']);}),_0x55b2b2;}_addContextToCollection(_0x2ebaab,_0x1a9cba){_0x1a9cba['add'](_0x2ebaab,0x0);}_removeContextFromCollection(_0x3fffd6,_0x2dfe1e){const _0x550743=_0x2dfe1e['find'](_0x4d4840=>_0x4d4840['id']===_0x3fffd6);_0x550743&&_0x2dfe1e['remove'](_0x550743);}_handleAddContextButtonClick(){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}_handleUrlSubmit(_0x3149bb){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x3149bb);}},aa=class extends Mt{['arrowView'];constructor(_0x4dfe60){super(_0x4dfe60),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[Zo]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}_createArrowView(){const _0x3eab92=new $t();return _0x3eab92['content']=_0x2d80b8,_0x3eab92['extendTemplate']({'attributes':{'class':Zo+'__arrow'}}),_0x3eab92;}},ha=class extends _0x4ff2da{_cancelButtonView;['_loaderView'];constructor(_0x175440){super(_0x175440),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 _0x1b16ab=new Mt(this['locale']);return _0x1b16ab['set']({'label':Es(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Pn+'\x20ck-ai-button-stop-generating','icon':st}),_0x1b16ab['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x1b16ab;}_createLoaderView(){const _0x79a509=new _0x4ff2da(this['locale']);return _0x79a509['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':Es(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x79a509;}},ca=class extends _0x4ff2da{_contextPanelView;_promptInputView;['_dropZoneView'];_promptCapabilitiesView;['_loaderView'];['_modelUnavailableMessageView'];_shouldRestorePromptInputFocus;['_filesEnabled'];constructor(_0x392fa9,_0x5a2f82){super(_0x392fa9),this['_filesEnabled']=_0x5a2f82['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x392fa9,{'bodyCollection':_0x5a2f82['bodyCollection'],'searchInputVisibleFrom':_0x5a2f82['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x392fa9),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x392fa9),this['_loaderView']=this['_createLoaderView'](_0x392fa9),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x392fa9),this['_dropZoneView']=new Ao(_0x392fa9),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage','promptInputPaste')['to'](this),this['_dropZoneView']['delegate']('promptInputPaste')['to'](this),this['_dropZoneView']['on']('dragEnter',()=>this['_contextPanelView']['hideAllBalloons']()),this['_dropZoneView']['bind']('isEnabled')['to'](this,'isLoading',_0x45b8c5=>!_0x45b8c5),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'](...$o)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x2600b3=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x2600b3['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x2600b3['if']('isLoading','ck-hidden',_0x5cd0e6=>_0x5cd0e6||!this['isModelAvailable']),_0x2600b3['if']('isModelAvailable','ck-hidden',_0x1160b6=>!_0x1160b6||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x2600b3['if']('isLoading','ck-hidden',_0xe8e8ea=>!_0xe8e8ea)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x2600b3['if']('isModelAvailable','ck-hidden',_0x48c6ec=>_0x48c6ec)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0x341840({'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(_0x251e17,_0x192bbc){return new oa(_0x251e17,_0x192bbc);}_createPromptInputView(_0x4c6091){return new go(_0x4c6091,this['_contextPanelView']['addContextButtonView']);}_createPromptCapabilitiesView(_0x1c5ba8){return new ko(_0x1c5ba8);}_createLoaderView(_0x49d34a){return new ha(_0x49d34a);}_createModelUnavailableMessageView(_0x411fe4){const _0x41589b=new la(_0x411fe4);return _0x41589b['delegate']('startConversation')['to'](this),_0x41589b;}_handlePromptInputFocus(_0x847807,_0x126ac6,_0x20bfb8){_0x20bfb8?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}addContextItem(_0x383a2b,_0x5cde82){this['_contextPanelView']['addContextItem'](_0x383a2b,_0x5cde82);}removeContextItem(_0x12c70f){this['_contextPanelView']['removeContextItem'](_0x12c70f);}setContextItemLoading(_0x54122c,_0x17c8c7){this['_contextPanelView']['setContextItemLoading'](_0x54122c,_0x17c8c7);}setIsUploadInProgress(_0x522b76){this['_promptInputView']['setIsUploadInProgress'](_0x522b76);}setConversationContext(_0x270468){this['_contextPanelView']['setConversationContext'](_0x270468);}clearPendingContextUI(){this['_contextPanelView']['clearCurrentContextItems']();}clearConversationContextUI(){this['_contextPanelView']['clearConversationContextItems']();}updateResourceState(_0x205f2e,_0x4bdd89,_0x4e6cdf){this['_contextPanelView']['updateResourceState'](_0x205f2e,_0x4bdd89,_0x4e6cdf);}setWebSearch(_0x19e20e){this['_promptCapabilitiesView']['setWebSearch'](_0x19e20e);}setReasoning(_0x794566){this['_promptCapabilitiesView']['setReasoning'](_0x794566);}resetMessageInput(){this['_promptInputView']['reset']();}setAddContextOptions(_0x4c5c19){this['_contextPanelView']['setAddContextOptions'](_0x4c5c19);}setInputPlaceholder(_0x2893d3){this['_promptInputView']['setPlaceholderText'](_0x2893d3);}setModelList(_0x3e025a,_0x4428ed){this['_promptCapabilitiesView']['setModelList'](_0x3e025a,_0x4428ed);}setModel(_0x4de66d){_0x4de66d?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x4de66d)):this['isModelAvailable']=!0x1;}enableModelSelector(){this['_promptCapabilitiesView']['enableModelSelector']();}disableModelSelector(_0x5217af){this['_promptCapabilitiesView']['disableModelSelector'](_0x5217af);}populateSourceResourceBalloon(_0x16eb92,_0x1aa5fe,_0x403701,_0x58908d){this['_contextPanelView']['populateSourceResourceBalloon'](_0x16eb92,_0x1aa5fe,_0x403701,_0x58908d);}['closeSourceResourceBalloon'](_0x31ac00){this['_contextPanelView']['closeSourceResourceBalloon'](_0x31ac00);}focusPromptInput(_0x460043=!0x1){this['_promptInputView']['focus'](_0x460043);}setPromptInputValue(_0x33d14d){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x33d14d;}},la=class extends _0x4ff2da{constructor(_0x1bbe77){super(_0x1bbe77);const _0x285007=new Mt(_0x1bbe77);_0x285007['set']({'label':Es(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x285007['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':Es(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x285007]}]});}},ua=class extends Kt{resizeButton;constructor(_0x3a25de,_0x169121){super(_0x3a25de,{'label':_0x169121['label'],'class':'ck-ai-header\x20'+_0x169121['class'],'icon':_0x169121['icon']}),this['set']('isMaximized',!0x1),_0x169121['content']&&this['children']['add'](_0x169121['content']),_0x169121['showResizeButton']&&(this['resizeButton']=Hn(_0x3a25de,this),this['children']['add'](this['resizeButton']));}},da=class extends _0x4ff2da{constructor(_0x58b567){super(_0x58b567),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Es(_0x58b567,'AI_DISCLAIMER_TEXT')}]}]});}};function _a(_0x50d8ef,_0x55ac10){const _0x4ebf42=new Mt(_0x50d8ef);return _0x4ebf42['set']({'label':Es(_0x50d8ef,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x129a73,'class':'ck-ai-chat__start-conversation\x20'+Pn}),_0x4ebf42['on']('execute',()=>{_0x55ac10['fire']('startConversation');}),_0x4ebf42;}var ga=class extends _0x4ff2da{chatHeader;chatFeed;chatControls;chatDisclaimer;_bodyCollection;constructor(_0x1d5135,_0x13d869){super(_0x1d5135),this['_bodyCollection']=Mn(_0x1d5135);const _0x6b527=_a(_0x1d5135,this);this['chatHeader']=new ua(_0x1d5135,{'label':Es(_0x1d5135,'AI_CHAT_HEADING'),'icon':_0x23ba37,'class':'ck-ai-header_chat','content':_0x6b527,'showResizeButton':_0x13d869['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new co(_0x1d5135,this['_bodyCollection']),this['chatFeed']['delegate'](...sr)['to'](this),this['chatControls']=new ca(_0x1d5135,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x13d869['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x13d869['filesEnabled']}),this['chatControls']['delegate'](...sr)['to'](this),this['chatDisclaimer']=new da(_0x1d5135),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x1d5135['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}populateSourceResourceBalloon(_0x5521f6,_0x267e88,_0x293a74,_0x2925f6){this['chatControls']['populateSourceResourceBalloon'](_0x5521f6,_0x267e88,_0x293a74,_0x2925f6);}['closeSourceResourceBalloon'](_0x2ad163){this['chatControls']['closeSourceResourceBalloon'](_0x2ad163);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Aa=class extends _0x212144{static get requires(){return[gs];}['_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;get['idleUiPromise'](){return this['_promiseQueue']['queueEmptyPromise'];}constructor(_0x4cf38b){super(_0x4cf38b);const _0x2cf38e=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['set']('isChatStreaming',!0x1),this['_promiseQueue']=new Sr(),this['_view']=new ga(this['context']['locale'],{'showResizeButton':_0x2cf38e['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'](_0x2cf38e),this['_view']['delegate'](...sr)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x22e53a,{showDiff:_0x3bbae3})=>{this['showDiff']=_0x3bbae3;}),this['disableControls'](),_0x2cf38e['view']['addTab']({'id':'chat','buttonLabel':Es(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x23ba37,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x2cf38e['view'],'isMaximized',_0xf43360=>_0xf43360),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isChatStreaming',_0x43f2b6=>_0x43f2b6),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}destroy(){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}createConversation({availableModels:_0x4d03c3}){const _0x1b0e1e=this['context']['config']['get']('ai.chat.welcomeMessage')??Es(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x4d03c3,!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x1b0e1e}),this['fire']('conversationCreated');}async addFeedItemStaticMessage({id:_0x35afb6,staticMessage:_0x4fe02c}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x35afb6,'initialContent':'<p>'+_0x4fe02c+'</p>'});});}async addFeedItemUserMessage(_0xecbb04){const _0x216e37=_0xecbb04['attributes']?.['displayedPrompt']||_0xecbb04['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0xecbb04['contextItems']['values']()),'initialContent':'<p>'+_0x216e37+'</p>','id':_0xecbb04['id']});});}async addFeedItemError({errorMessage:_0x163c47,id:_0x105f55}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x163c47+'</p>','id':_0x105f55});});}async addFeedItemAIReply(_0x408098){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x408098['interactionId']+':'+_0x408098['id']}),this['clearLoadingMessage']();});}async addFeedItemAISuggestion(_0x4c9e43){const _0x5c8636=bs(this['context']),_0x5c4d5=_0x5c8636['map'](_0x133e13=>_0x133e13['config']['get']('ai.availableReplyActions')||[...Or]);let _0x4dbd9b=_0x5c4d5['reduce']((_0x5b235e,_0x3b5f2c)=>_0x5b235e['filter'](_0x3dbfe4=>_0x3b5f2c['includes'](_0x3dbfe4)),_0x5c4d5[0x0]||[...Or]);const _0xd8ea86=_0x5c8636['every'](_0x391e9b=>_0x391e9b['plugins']['has']('TrackChanges')),_0x34b1bf=_0x5c8636['map'](_0x4954a7=>_0x4954a7['commands']['get']('trackChanges'));return _0xd8ea86?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x34b1bf,'value',(..._0x297d11)=>_0x297d11['some'](_0x2534b1=>_0x2534b1))):_0x4dbd9b=_0x4dbd9b['filter'](_0x44d54b=>'insertSuggestion'!=_0x44d54b),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x4c9e43['interactionId']+':'+_0x4c9e43['id'],'areActionsDisabled':_0x4c9e43['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x4dbd9b}),this['clearLoadingMessage']();});}async addFeedInteractionHeader(_0x19a5df,_0x4ad0a4){return this['_promiseQueue']['enqueue'](async()=>{const _0x30c81a=this['_view']['chatFeed']['children']['last'];if(_0x30c81a instanceof so)return this['_view']['chatFeed']['children']['remove'](_0x30c81a),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x19a5df['id'],'capabilities':{'isWebSearchEnabled':_0x30c81a['capabilities']['isWebSearchEnabled']||_0x4ad0a4['isWebSearchEnabled'],'isReasoningEnabled':_0x30c81a['capabilities']['isReasoningEnabled']||_0x4ad0a4['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x19a5df['id'],'capabilities':_0x4ad0a4});});}async addFeedItemCustomElement(_0x54eec0,_0x56e661){let _0x540896;return await this['_promiseQueue']['enqueue'](async()=>{_0x540896=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x54eec0,'id':_0x56e661});}),_0x540896;}removeFeedItem(_0x57dd1c){this['_view']['chatFeed']['removeItem'](_0x57dd1c);}hasFeedItem(_0x3370ed){return this['_view']['chatFeed']['hasItem'](_0x3370ed);}updateFeedInteractionHeader(_0x40333b){const _0x1d9b4d=this['_view']['chatFeed']['children']['find'](_0x373f9e=>_0x373f9e['options']['id']==_0x40333b['id']&&_0x373f9e instanceof so);_0x1d9b4d&&_0x1d9b4d['set']('isVisible',_0x40333b['isVisible']);}async updateFeedItemAIReplyContent(_0x5a2021){const _0x5f4d0e=_0x5a2021['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0xa142cc=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x5a2021,'abortSignal':_0xa142cc,'renderingStrategy':_0x5f4d0e}),_0x5a2021['isDone']&&this['markFeedItemAsDone'](_0x5a2021['id']);});}updateFeedItemAIReplySources(_0x4bf002,_0x37c79b){this['_view']['chatFeed']['updateWebSources'](_0x4bf002,_0x37c79b);}async updateFeedItemAIReplySuggestionContent(_0x448852){return this['_promiseQueue']['enqueue'](async _0x5583d7=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x448852,'abortSignal':_0x5583d7}),_0x448852['isDone']&&this['markFeedItemAsDone'](_0x448852['id']);});}updateFeedItemAIReplySuggestionPartState(_0x3d321c){this['_view']['chatFeed']['updateSuggestionPartState'](_0x3d321c);}setSuggestionGating(_0x441a4f,_0x96cbf9){this['_view']['chatFeed']['updateSuggestionGating'](_0x441a4f,_0x96cbf9);}setFeedItemAIReplySuggestionPartActive(_0x39439c){this['_view']['chatFeed']['setSuggestionPartActive'](_0x39439c);}markFeedItemAsDone(_0x14bd5f){this['_view']['chatFeed']['markItemAsDone'](_0x14bd5f);}removeFeedInteraction(_0x3eb036){this['_view']['chatFeed']['getItemIds']()['filter'](_0x3fa7fe=>_0x3fa7fe['startsWith'](_0x3eb036))['forEach'](_0x1acd36=>this['_view']['chatFeed']['removeItem'](_0x1acd36));}startInteraction(){const _0x3f85ca=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x3f85ca),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['isChatStreaming']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}stopInteraction(_0x2187f1){this['_promiseQueue']['abort'](),_0x2187f1&&this['_view']['chatFeed']['getItemIds']()['filter'](_0x22c95b=>_0x22c95b['startsWith'](_0x2187f1['id']))['forEach'](_0xc6db08=>this['markFeedItemAsDone'](_0xc6db08)),this['resetChatBusyStateToIdle']();}resetChatBusyStateToIdle(){this['isBusy']=!0x1,this['isChatStreaming']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();}async finishInteraction(){return this['_promiseQueue']['queueEmptyPromise']['then'](()=>{this['resetChatBusyStateToIdle']();});}addContextItem(_0x4b03a9,_0x4503d0){this['_view']['chatControls']['addContextItem'](_0x4b03a9,_0x4503d0);}removeContextItem(_0x3ea6fd){this['_view']['chatControls']['removeContextItem'](_0x3ea6fd);}setContextItemLoading(_0x536c5e,_0x3c8c1e){this['_view']['chatControls']['setContextItemLoading'](_0x536c5e,_0x3c8c1e);}setIsUploadInProgress(_0xe69730){this['_view']['chatControls']['setIsUploadInProgress'](_0xe69730);}setConversationContext(_0x46f8fd){this['_view']['chatControls']['setConversationContext'](_0x46f8fd);}clearPendingContextUI(){this['_view']['chatControls']['clearPendingContextUI']();}clearConversationContextUI(){this['_view']['chatControls']['clearConversationContextUI']();}updateResourceState(_0x2963ad,_0x5c54f4,_0x151ddd){this['_view']['chatControls']['updateResourceState'](_0x2963ad,_0x5c54f4,_0x151ddd);}resetMessageInput(){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}setAddContextOptions(_0x2840d3){this['_view']['chatControls']['setAddContextOptions'](_0x2840d3);}updateCapabilities(_0x195538){this['_view']['chatControls']['setWebSearch'](_0x195538['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x195538['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x195538));}setSelectedModel(_0x4c3cac,_0x1203f0){this['_view']['chatControls']['setModel'](_0x4c3cac),_0x1203f0&&this['_view']['chatControls']['disableModelSelector'](!0x1);}setFeedItemRenderingStrategy(_0x1395c3){this['feedItemRenderingStrategy']=_0x1395c3;}toggleLoadingSkeleton(_0x23dac6){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x23dac6);}resetConversationTitle(){this['setConversationTitle'](Es(this['context']['locale'],'AI_CHAT_HEADING'));}emptyConversationTitle(){this['setConversationTitle']('');}setConversationTitle(_0x443553,_0xd450da=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0xd450da&&!Et()&&_0x443553['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x443553);this['_view']['chatHeader']['label']=_0x443553;}setLoadingMessage(_0x2cf1d){this['_view']['chatFeed']['setLoadingMessage'](_0x2cf1d);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}_animateConversationTitle(_0x229dc7){let _0x4ccfeb=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x229dc7[_0x4ccfeb],_0x4ccfeb++,_0x4ccfeb===_0x229dc7['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x3eed94){return _0x3eed94['isWebSearchEnabled']&&_0x3eed94['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x3eed94['isWebSearchEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x3eed94['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}_getInputPlaceholder(_0x54fb44){return _0x54fb44?_0x54fb44['isWebSearchEnabled']&&_0x54fb44['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x54fb44['isWebSearchEnabled']?Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x54fb44['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}populateSourceResourceBalloon(_0x825d9f,_0x3d89fc,_0x4d7f24,_0x4fffb1){this['_view']['populateSourceResourceBalloon'](_0x825d9f,_0x3d89fc,_0x4d7f24,_0x4fffb1);}['closeSourceResourceBalloon'](_0x13f71b){this['_view']['closeSourceResourceBalloon'](_0x13f71b);}setPromptInputValue(_0x411a85){this['_view']['chatControls']['setPromptInputValue'](_0x411a85);}focusPromptInput(_0x529731=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x529731);}scrollFeedToSuggestion(_0x6f58da,_0x4afe5b){this['_view']['chatFeed']['scrollToSuggestion'](_0x6f58da,_0x4afe5b);}startAutoScroll(_0x12f352={}){this['_view']['chatFeed']['startAutoScroll'](_0x12f352);}stopAutoScroll(){this['_view']['chatFeed']['stopAutoScroll']();}disableControls(){this['_view']['chatControls']['isDisabled']=!0x0;}enableControls(){this['_view']['chatControls']['isDisabled']=!0x1;}toggleConversationLoading(_0x313df8){_0x313df8?(this['isBusy']=_0x313df8,this['disableControls']()):(this['enableControls'](),this['resetChatBusyStateToIdle']());}},Ia=class extends Jt{sections;constructor(_0x22a26f,_0x22eef2){super(_0x22a26f),this['sections']=_0x22eef2,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}filter(_0xd2b537){let _0xd4d79a=0x0,_0x200aec=0x0;for(const _0x11061d of this['sections']){const {resultsCount:_0x162086,totalItemsCount:_0x2c6f54}=_0x11061d['filter'](_0xd2b537);_0xd4d79a+=_0x162086,_0x200aec+=_0x2c6f54;}return{'resultsCount':_0xd4d79a,'totalItemsCount':_0x200aec};}},pa=class extends jt{title;itemsViews;_itemsListView;constructor(_0x47d8ac,{title:_0x5bcba,items:_0x5e5e5c}){super(_0x47d8ac);const _0x44b212=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x5bcba,this['itemsViews']=_0x5e5e5c;const _0x3eacd8=new _0x4ff2da(_0x47d8ac);_0x3eacd8['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new Jt(_0x47d8ac),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x44b212['if']('isVisible','ck-hidden',_0x30aa78=>!_0x30aa78)]},'children':[_0x3eacd8,this['_itemsListView']]});}filter(_0xe2a8a2){const _0xfa85d8=this['itemsViews']['length'];let _0x2b34aa=0x0;for(const _0x7d746a of this['itemsViews'])_0xe2a8a2?(_0x7d746a['isVisible']=!!_0x7d746a['isMatching'](_0xe2a8a2),_0x7d746a['highlightText'](_0xe2a8a2)):(_0x7d746a['isVisible']=!0x0,_0x7d746a['highlightText'](null)),_0x7d746a['isVisible']&&_0x2b34aa++;return this['isVisible']=_0x2b34aa>0x0,{'resultsCount':_0x2b34aa,'totalItemsCount':_0xfa85d8};}getItem(_0x272728){return this['itemsViews']['find'](_0x46f78e=>_0x46f78e['id']===_0x272728);}removeItem(_0x3fbabf){const _0xf90ba3=this['itemsViews']['indexOf'](_0x3fbabf);-0x1!==_0xf90ba3&&(this['itemsViews']['splice'](_0xf90ba3,0x1),this['_itemsListView']['items']['remove'](_0x3fbabf));}};const Ea=/* #__PURE__ -- @preserve */
|
|
34
|
+
_0x4002ba(jt);var ma=class AIChatHistoryListItemView extends Ea{['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(_0xf8ac81,_0x2c7faf){super(_0xf8ac81);const _0x5c5575=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x2c7faf['pinned']),this['set']('loadingState',null),this['set']('title',_0x2c7faf['title']),this['id']=_0x2c7faf['id'];const {createdAt:_0x733e0e,active:_0x358734=!0x1}=_0x2c7faf;this['_titleView']=new Yt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x3cad6e=this['_createCheckView'](),_0x4e80ff=this['_createPinButtonView'](_0xf8ac81),_0x399056=this['_createMenuDropdownView'](),_0x56b80e=this['_createEditInputView'](_0xf8ac81),_0x53f8a8=this['_createAcceptEditButtonView'](_0xf8ac81,_0x56b80e),_0x496d47=this['_createCancelEditButtonView'](_0xf8ac81);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x4e80ff),this['actions']['add'](_0x399056),this['on']('change:isEdit',(_0x40337a,_0x4d5d56,_0x4326eb)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x4326eb?(this['actions']['add'](_0x53f8a8),this['actions']['add'](_0x496d47),this['mainContent']['add'](_0x56b80e),_0x56b80e['element']['value']=this['title']||'',_0x56b80e['element']['focus']()):(this['actions']['add'](_0x4e80ff),this['actions']['add'](_0x399056),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x358734?'ck-ai-chat-history__item--active':'',_0x5c5575['if']('isVisible','ck-hidden',_0x34d7be=>!_0x34d7be),_0x5c5575['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',_0x5c5575['if']('loadingState','ck-hidden',_0x481d6b=>!!_0x481d6b)]},'children':_0x358734?[_0x3cad6e]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x5c5575['if']('loadingState','ck-hidden',_0xec8c3f=>!_0xec8c3f)]},'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',_0x5c5575['if']('loadingState','ck-hidden',_0x10c190=>!!_0x10c190)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x5c5575['if']('loadingState','ck-hidden',_0x83644f=>!_0x83644f)]},'children':[{'text':_0x5c5575['to']('loadingState',_0x12357f=>_0x12357f?Es(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x12357f]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x733e0e]}]},{'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(_0x5547c9){this['set']('title',_0x5547c9);}updateLoadingState(_0x31fa26,_0x7856de){this['set']('loadingState',_0x7856de?_0x31fa26:null);}_createCheckView(){const _0x94986e=new $t();return _0x94986e['set']({'content':_0x5517bf}),_0x94986e;}_createPinButtonView(_0x2b9cd4){const _0x2816f4=new Mt(_0x2b9cd4);return _0x2816f4['set']({'label':Es(_0x2b9cd4,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x94766d,'withText':!0x1,'tooltip':!0x0}),_0x2816f4['bind']('isOn')['to'](this,'pinned'),_0x2816f4['on']('execute',()=>{const _0x1ddf49=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x1ddf49});}),_0x2816f4;}_createMenuDropdownView(){const _0x28c874=_0x5a954d(this['locale']),_0x37e54f=_0x28c874['panelView']['children'];_0x28c874['buttonView']['set']({'label':Es(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':rt}),_0x28c874['panelPosition']='sw';const _0x410420=new Mt(this['locale']);_0x410420['label']=Es(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x410420['withText']=!0x0,_0x410420['on']('execute',()=>{this['isEdit']=!0x0;});const _0x56b03e=new Mt(this['locale']);_0x56b03e['label']=Es(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x56b03e['withText']=!0x0,_0x56b03e['on']('execute',()=>{this['showConfirm'](Es(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x52a5ec=new Jt(this['locale']),_0x20bb10=new jt(this['locale']);_0x20bb10['children']['add'](_0x410420);const _0x33626f=new jt(this['locale']);return _0x33626f['children']['add'](_0x56b03e),_0x52a5ec['items']['addMany']([_0x20bb10,_0x33626f]),_0x37e54f['add'](_0x52a5ec),_0x28c874;}_createEditInputView(_0x103bc3){const _0x48eba2=new qt(_0x103bc3),_0x4f776b=_0x48eba2['bindTemplate'];return _0x48eba2['extendTemplate']({'on':{'keydown':_0x4f776b['to'](_0x4bd487=>{'Enter'==_0x4bd487['key']&&this['_commitEditInputValue'](_0x48eba2);})}}),_0x48eba2;}_createAcceptEditButtonView(_0x11c373,_0x9f574){const _0x5183c3=new Mt(_0x11c373);return _0x5183c3['set']({'icon':_0x5517bf,'withText':!0x1,'tooltip':Es(_0x11c373,'AI_CHAT_HISTORY_ACCEPT')}),_0x5183c3['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x5183c3['on']('execute',()=>{this['_commitEditInputValue'](_0x9f574);}),_0x5183c3;}_commitEditInputValue(_0x31c0c6){const _0x393861=_0x31c0c6['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x393861});}_createCancelEditButtonView(_0x5e83e5){const _0x5e9f59=new Mt(_0x5e83e5);return _0x5e9f59['set']({'icon':_0xabec2d,'withText':!0x1,'tooltip':Es(_0x5e83e5,'AI_CHAT_HISTORY_CANCEL')}),_0x5e9f59['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x5e9f59['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x5e9f59;}_createSpinnerView(){const _0x5d414b=new Dr('tiny');return _0x5d414b['isVisible']=!0x0,_0x5d414b;}isMatching(_0x260078){return'string'==typeof this['title']&&this['title']['match'](_0x260078)?{'title':!0x0}:null;}highlightText(_0x494389){this['_titleView']['highlightText'](_0x494389);}},Ta=class extends _0x4ff2da{['headerView'];['searchView'];['mainErrorView'];skeletonView;emptyView;sectionsView;constructor(_0x2233e1,_0x41fee3){super(_0x2233e1),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x1af5a5=_a(_0x2233e1,this);this['headerView']=new ua(_0x2233e1,{'label':Es(_0x2233e1,'AI_CHAT_HISTORY_HEADING'),'icon':_0x462166,'class':'ck-ai-header_history','content':_0x1af5a5,'showResizeButton':_0x41fee3}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Ia(_0x2233e1,[]),this['sectionsView']['delegate'](...wa)['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',_0x5f5401=>!_0x5f5401)]}}),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 _0x4ea335=new _0x10e0e0(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x3bcdab=>Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x3bcdab),'secondary':Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x20164a=this['_createErrorView']();return _0x20164a['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x2ef6bf=>!_0x2ef6bf)]}}),_0x4ea335['on']('render',()=>{_0x4ea335['children']['add'](_0x20164a,0x1);}),_0x4ea335['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x49fd23=>!_0x49fd23)]}}),_0x4ea335;}_createSkeletonView(){const _0x59cdbd=new wr(this['locale'],Cr['aiHistory']);return _0x59cdbd['bind']('isVisible')['to'](this,'isLoading'),_0x59cdbd;}_createErrorView(){const _0x376d39=new _0x4ff2da(this['locale']),_0x3b1c7f=new Mt(this['locale']);_0x3b1c7f['set']({'withText':!0x1,'icon':_0xabec2d,'class':'ck-ai-notification_error__dismiss-button'}),_0x3b1c7f['bind']('isVisible')['to'](this,'hasItems',_0x1b9f1c=>!!_0x1b9f1c),_0x3b1c7f['on']('execute',()=>{this['errorMessage']='';});const _0x46d6f8=this['bindTemplate'];return _0x376d39['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x46d6f8['to']('errorMessage')}]},_0x3b1c7f]}),_0x376d39;}_createEmptyStateView(){const _0xc2b826=new _0x4ff2da(this['locale']);return _0xc2b826['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x53fe98=>!_0x53fe98)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Es(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0xc2b826;}_createListItemViews(_0x86fccd,_0x2faaf9){const _0x18d756=[];for(const _0x1c6733 of _0x86fccd){const _0xb30e6d=new ma(_0x2faaf9,_0x1c6733);_0xb30e6d['delegate'](...wa)['to'](this),_0x18d756['push'](_0xb30e6d);}return _0x18d756;}updateHistoryItemsWithCategories(_0x275881){const _0x52b5bb=this['locale']||'en',_0x59b908=[];for(const _0x2b791f of _0x275881){const _0x3b9561=this['_createListItemViews'](_0x2b791f['items'],_0x52b5bb);_0x59b908['push'](new pa(_0x52b5bb,{'title':_0x2b791f['title'],'items':_0x3b9561}));}this['sectionsView']['sections']=_0x59b908,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x59b908),this['hasItems']=_0x275881['some'](_0x3fadf7=>_0x3fadf7['items']['length']>0x0),this['_refreshSearch']();}removeHistoryItem(_0xfcd7a5){for(const _0x1c74e0 of this['sectionsView']['sections']){const _0x2da516=_0x1c74e0['getItem'](_0xfcd7a5);if(_0x2da516){if(_0x1c74e0['removeItem'](_0x2da516),0x0===_0x1c74e0['itemsViews']['length']){const _0x17dc12=this['sectionsView']['sections']['indexOf'](_0x1c74e0);-0x1!==_0x17dc12&&(this['sectionsView']['sections']['splice'](_0x17dc12,0x1),this['sectionsView']['items']['remove'](_0x1c74e0));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}updateItemTitle(_0x30c486,_0x30ed70){for(const _0x379af4 of this['sectionsView']['sections']){const _0x275b85=_0x379af4['getItem'](_0x30c486);if(_0x275b85){_0x275b85['updateTitle'](_0x30ed70);break;}}}updateItemLoadingState(_0x4dd406,_0x3e1cdb,_0x221552){for(const _0x171327 of this['sectionsView']['sections']){const _0x3eabdf=_0x171327['getItem'](_0x4dd406);if(_0x3eabdf){_0x3eabdf['updateLoadingState'](_0x3e1cdb,_0x221552);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x5bab87=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x5bab87);}}};const wa=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var Ca=class extends _0x212144{static get requires(){return[gs];}_historyView;static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2a83b8){super(_0x2a83b8);const _0x3ad8cc=this['context']['plugins']['get']('AITabs');this['_historyView']=new Ta(this['context']['locale'],_0x3ad8cc['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x3ad8cc),this['_historyView']['delegate'](...wa)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x3ad8cc['view'],'isMaximized',_0x152b80=>_0x152b80),_0x3ad8cc['view']['addTab']({'id':'history','buttonLabel':Es(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x462166,'order':0x0,'content':this['_historyView']});}removeHistoryItem(_0x1c0960){this['_historyView']['removeHistoryItem'](_0x1c0960);}updateItems(_0x1f4f26){this['_historyView']['updateHistoryItemsWithCategories'](_0x1f4f26);}updateItemTitle(_0x3489a0,_0x1a0472){this['_historyView']['updateItemTitle'](_0x3489a0,_0x1a0472);}updateItemLoadingState(_0x1d38d4,_0x8fd645,_0x963674){this['_historyView']['updateItemLoadingState'](_0x1d38d4,_0x8fd645,_0x963674);}setLoadingSkeleton(_0x7fa136){this['_historyView']['isLoading']=_0x7fa136;}['showError'](_0x14b322){this['_historyView']['errorMessage']=_0x14b322;}['hideError'](){this['_historyView']['errorMessage']='';}};const fa=/* #__PURE__ -- @preserve */
|
|
35
|
+
At();var ba=class extends fa{['id'];createdAt;constructor({id:_0x405a8e,title:_0x5b4b5,createdAt:_0x2379b1,updatedAt:_0x29c71c,pinned:_0xbd6915}){super(),this['id']=_0x405a8e,this['createdAt']=new Date(_0x2379b1),this['set']('title',_0x5b4b5),this['set']('updatedAt',_0x29c71c?new Date(_0x29c71c):null),this['set']('pinned',_0xbd6915||!0x1);}updateTitle(_0x4c7e07){this['set']('title',_0x4c7e07),this['updatedAt']=new Date();}updatePinned(_0x448702){this['set']('pinned',_0x448702),this['updatedAt']=new Date();}};const Sa=/* #__PURE__ -- @preserve */
|
|
36
|
+
dt();var Ra=class extends Sa{items=[];connector;['group'];constructor({connector:_0x1c5fc8,group:_0x35d90c}){super(),this['connector']=_0x1c5fc8,this['group']=_0x35d90c;}async init(){try{const _0x22777d=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x22777d);}catch(_0x1af2a0){this['fire']('error',{'error':_0x1af2a0,'operation':'init'});}}addItem(_0x4ebec4){this['items']['push'](_0x4ebec4);}async removeItem(_0x4f414a){const _0x4eea5c=this['items']['findIndex'](_0x1b758c=>_0x1b758c['id']===_0x4f414a);if(-0x1===_0x4eea5c)return!0x1;try{return await this['connector']['deleteConversation'](_0x4f414a)['execute'](),this['items']['splice'](_0x4eea5c,0x1),this['fire']('itemRemoved',{'itemId':_0x4f414a}),!0x0;}catch(_0x350afa){return this['fire']('error',{'error':_0x350afa,'operation':'removeItem','itemId':_0x4f414a}),!0x1;}}getItem(_0x685ea9){return this['items']['find'](_0xcedff7=>_0xcedff7['id']===_0x685ea9);}async updateItemTitle(_0x4b87bf,_0x4fdcd6){const _0x4bb620=this['getItem'](_0x4b87bf);if(!_0x4bb620)return!0x1;try{return await this['connector']['updateConversation'](_0x4b87bf,{'title':_0x4fdcd6})['getResult'](),_0x4bb620['updateTitle'](_0x4fdcd6),this['fire']('itemUpdated',{'itemId':_0x4b87bf,'updates':{'title':_0x4fdcd6}}),!0x0;}catch(_0x1a7592){return this['fire']('error',{'error':_0x1a7592,'operation':'updateItemTitle','itemId':_0x4b87bf}),!0x1;}}async updateItemPinned(_0x419982,_0x1e0d18){const _0x3ce875=this['getItem'](_0x419982);if(!_0x3ce875)return!0x1;try{return await this['connector']['updateConversation'](_0x419982,{'pinned':_0x1e0d18})['getResult'](),_0x3ce875['updatePinned'](_0x1e0d18),this['fire']('itemUpdated',{'itemId':_0x419982,'updates':{'pinned':_0x1e0d18}}),!0x0;}catch(_0x255797){return this['fire']('error',{'error':_0x255797,'operation':'updateItemPinned','itemId':_0x419982}),!0x1;}}loadItems(_0x1f3706){try{this['items']=[],_0x1f3706['map'](_0x39bda9=>{this['addItem'](new ba(_0x39bda9));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x3cf682){this['fire']('error',{'error':_0x3cf682,'operation':'loadItems'});}}getItems(_0x146ee3={}){const _0x30f206=void 0x0!==_0x146ee3['pinned']&&_0x146ee3['pinned'],_0xfea990=_0x146ee3['from']?new Date(_0x146ee3['from']['getFullYear'](),_0x146ee3['from']['getMonth'](),_0x146ee3['from']['getDate']()):null,_0x20c5d6=_0x146ee3['to']?new Date(_0x146ee3['to']['getFullYear'](),_0x146ee3['to']['getMonth'](),_0x146ee3['to']['getDate']()):null;return this['items']['filter'](_0x483567=>{if(_0x483567['pinned']!==_0x30f206)return!0x1;if(_0x20c5d6){const _0x2756bd=new Date(_0x483567['createdAt']['getFullYear'](),_0x483567['createdAt']['getMonth'](),_0x483567['createdAt']['getDate']());return _0xfea990?_0xfea990['getTime']()===_0x20c5d6['getTime']()?_0x2756bd['getTime']()===_0xfea990['getTime']():_0x2756bd<_0x20c5d6&&_0x2756bd>=_0xfea990:_0x2756bd<_0x20c5d6;}return!0x0;});}},Oa=class extends _0x212144{_aiConnector;_reporter;_aiChatHistoryUi;_aiChatController;static get requires(){return[Is,Nn,er,Ca,gs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_aiConnector']=this['context']['plugins']['get'](Is),this['_aiChatHistoryUi']=this['context']['plugins']['get'](Ca),this['_aiChatController']=this['context']['plugins']['get'](er),this['_reporter']=this['context']['plugins']['get'](Nn)['createReporter']('aichathistory');const _0x17d3fc=this['context']['plugins']['get'](gs);try{const _0x5ab0b8=this['_aiChatController']['getGroupId']();this['history']=new Ra({'connector':this['_aiConnector'],'group':_0x5ab0b8}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x13573e,_0x4bc55c)=>{this['_setItemLoading'](_0x4bc55c['id'],'remove'),this['_handleRemove'](_0x4bc55c['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x369b13,_0x146353)=>{this['_setItemLoading'](_0x146353['id'],'rename'),this['_handleEditTitle'](_0x146353['id'],_0x146353['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x1f4673,_0x5817b8)=>{void 0x0!==_0x5817b8['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x5817b8['itemId'],_0x5817b8['updates']['title']),void 0x0!==_0x5817b8['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x5817b8['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x213415,_0x495d2c)=>{this['_aiChatController']['_handleRemovedConversation'](_0x495d2c['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x495d2c['itemId']),this['_clearItemLoading'](_0x495d2c['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0xd49d80,_0x46d265)=>{this['_handleHistoryErrorUI'](_0x46d265['error'],_0x46d265['operation'],_0x46d265['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x43c9dd,_0x2cbbf1)=>{this['_handleSelectConversation'](_0x2cbbf1['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0xa99a1e,_0x110007)=>{const _0x1653ed=_0x110007['pinned']?'pin':'unpin';this['_setItemLoading'](_0x110007['id'],_0x1653ed),this['_handleTogglePin'](_0x110007['id'],_0x110007['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x17d3fc['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x17d3fc['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x205a6b){this['_handleHistoryErrorUI'](_0x205a6b,'init');}}async _handleEditTitle(_0x4cdbbb,_0x3d9fb6){await this['history']['updateItemTitle'](_0x4cdbbb,_0x3d9fb6);}async['_handleTogglePin'](_0x27d394,_0x503fe3){await this['history']['updateItemPinned'](_0x27d394,_0x503fe3);}async['_handleRemove'](_0x134478){await this['history']['removeItem'](_0x134478);}async _handleSelectConversation(_0x312350){await this['_aiChatController']['loadConversation'](_0x312350);}async _showConversationHistory(){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_updateHistoryItemsUI(){const _0x19e312=this['_aiChatController']['activeConversation']?.['id'],_0x54cb92=this['_getCategorizedItems']()['map'](_0x44314c=>({'title':_0x44314c['title'],'items':_0x44314c['items']['map'](_0x545792=>({'id':_0x545792['id'],'title':_0x545792['title']||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x545792['createdAt'])['toLocaleDateString'](),'active':_0x545792['id']===_0x19e312,'pinned':_0x545792['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x54cb92);}_setItemLoading(_0x4c1015,_0x57468e){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x4c1015,_0x57468e,!0x0);}_clearItemLoading(_0x1865dd){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x1865dd,null,!0x1);}_handleHistoryErrorUI(_0x5dfb1f,_0x217e09,_0x174666){const _0x2b18b2=this['_generateErrorMessage'](_0x217e09,_0x174666);this['_aiChatHistoryUi']['showError'](_0x2b18b2),this['_reporter']['reportError'](_0x5dfb1f,{'context':{'operation':_0x217e09}}),_0x174666&&this['_clearItemLoading'](_0x174666),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_generateErrorMessage(_0x56cea4,_0x4b2e98){const _0x200ad5=_0x4b2e98?this['history']['getItem'](_0x4b2e98):null,_0x3134cf=_0x200ad5?.['title']||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x56cea4){case'updateItemTitle':return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x3134cf);case'updateItemPinned':{const _0xf9b4b=Es(this['context']['locale'],_0x200ad5?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0xf9b4b,_0x3134cf]);}case'removeItem':return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x3134cf);case'init':case'loadItems':return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}_getCategorizedItems(){const _0x1eb7f3=new Date(),_0x1c889d=new Date(_0x1eb7f3['getFullYear'](),_0x1eb7f3['getMonth'](),_0x1eb7f3['getDate']()),_0x380dec=new Date(_0x1c889d);_0x380dec['setDate'](_0x380dec['getDate']()-0x1);const _0x2ad04f=new Date(_0x1c889d);_0x2ad04f['setDate'](_0x2ad04f['getDate']()-0xe);const _0x312b99=this['history']['getItems']({'pinned':!0x0}),_0x5c937b=this['history']['getItems']({'from':_0x1c889d,'to':_0x1c889d}),_0x5d1518=this['history']['getItems']({'from':_0x380dec,'to':_0x380dec}),_0x338b0e=this['history']['getItems']({'from':_0x2ad04f,'to':_0x380dec}),_0x8f9e16=this['history']['getItems']({'to':_0x2ad04f}),_0x4e0c5a=[];return _0x312b99['length']>0x0&&_0x4e0c5a['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x312b99}),_0x5c937b['length']>0x0&&_0x4e0c5a['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x5c937b}),_0x5d1518['length']>0x0&&_0x4e0c5a['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x5d1518}),_0x338b0e['length']>0x0&&_0x4e0c5a['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x338b0e}),_0x8f9e16['length']>0x0&&_0x4e0c5a['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x8f9e16}),_0x4e0c5a;}},va=class extends _0x212144{static get requires(){return[Oa,Ca];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ka=class extends _0x212144{static get requires(){return[er,tn,Aa,va,vn];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x25f69d){super(_0x25f69d),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'contextLibrary':{'enabled':!0x1},'sources':[],'alwaysAddSelection':!0x1,'paste':{'textThreshold':0x5dc}}),this['context']['config']['define']('ai.chat.initialConversation','new');}},ya=class extends Mt{['id'];constructor(_0x15c1a8,_0x43858e){super(_0x15c1a8);const {id:_0x348d2f,type:_0x1ea752,icon:_0x169d3a}=_0x43858e;this['id']=_0x348d2f,this['set']({'label':_0x43858e['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x43858e['id']}}),_0x169d3a?this['icon']=_0x169d3a:'chat'===_0x1ea752?this['icon']=_0x23ba37:'review'===_0x1ea752?this['icon']=_0x1f8cfb:'translate'===_0x1ea752&&(this['icon']=_0x1bcc6c);}},Na=class extends _0x4ff2da{listView;constructor(_0x4c8aca,_0x48946c){super(_0x4c8aca),this['set']('isEnabled',!0x0);const _0x5bc470=_0x48946c['map'](_0x5b099c=>{const _0x28e43d=new jt(this['locale']),_0x226a23=new ya(this['locale'],_0x5b099c);return _0x226a23['bind']('isEnabled')['to'](this),_0x28e43d['children']['add'](_0x226a23),_0x226a23['delegate']('execute')['to'](this),_0x28e43d;});this['listView']=new Jt(this['locale']),this['listView']['items']['addMany'](_0x5bc470),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const xa='chat-shortcuts';var La=class extends _0x212144{_shortcuts;_shortcutsView;_aiChatUI;_listenedConversation;static get requires(){return[Aa,fs];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_aiChatUI']=this['context']['plugins']['get'](Aa),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x2dda9a=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x169598=_0x2dda9a['activeConversation'];_0x169598['isFromHistory']||this['_injectShortcuts'](_0x169598);}),this['listenTo'](_0x2dda9a,'interactionStarted',()=>{this['_removeShortcuts']();}));}_validateShortcuts(){const _0x510e96=['chat','review','translate'];this['_shortcuts']['forEach'](_0x15026d=>{let _0x172e74=!0x0;if(_0x15026d['id']&&_0x15026d['label']&&_0x510e96['includes'](_0x15026d['type'])?'chat'===_0x15026d['type']&&(_0x172e74='string'==typeof _0x15026d['prompt']):_0x172e74=!0x1,!_0x172e74)throw new ct('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x15026d});});}_injectShortcuts(_0x55d930){this['_removeShortcuts'](),this['_shortcutsView']=new Na(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],xa),this['_shortcutsView']['on']('execute',_0x6bf96a=>{const _0x5f0a6f=_0x6bf96a['source']['id'];this['_executeShortcut'](_0x5f0a6f);}),this['_listenedConversation']=_0x55d930,this['listenTo'](_0x55d930,'uploadProgressChanged',(_0x95cf01,_0xfdb3be)=>{this['_shortcutsView']['isEnabled']=!_0xfdb3be['isUploadInProgress'];});}_removeShortcuts(){const _0x339b65=this['context']['plugins']['get'](Aa);_0x339b65['hasFeedItem'](xa)&&_0x339b65['removeFeedItem'](xa),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}_executeShortcut(_0x59e6ec){const _0x2b3edd=this['_shortcuts']['find'](_0x28d3b4=>_0x28d3b4['id']===_0x59e6ec),_0x1a7e3d=_0x2b3edd['type'];'chat'===_0x1a7e3d?this['_runChatShortcut'](_0x2b3edd):'review'===_0x1a7e3d?_0x2b3edd['commandId']?this['_runReviewShortcut'](_0x2b3edd):this['_switchTab']('reviewMode'):'translate'===_0x1a7e3d&&(_0x2b3edd['language']?this['_runTranslateShortcut'](_0x2b3edd):this['_switchTab']('translate'));}_switchTab(_0x32cc0e){if(!this['context']['plugins']['has']('AITabs'))throw new ct('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x32cc0e});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x32cc0e);}async _runChatShortcut({id:_0x5814b9,prompt:_0x133ed5,draftMode:_0x584877,useWebSearch:_0x28b0eb=!0x1,useReasoning:_0x416781=!0x1,model:_0x1c4328}){const _0x2217ac=this['context']['plugins']['get']('AIChatController'),_0x60ae15=_0x2217ac['activeConversation'],_0x22831a=this['context']['plugins']['get'](fs),_0x356595=await _0x22831a['models']['resolveModel'](_0x1c4328);_0x356595&&await _0x60ae15['setModel'](_0x356595),_0x60ae15['setWebSearch'](_0x28b0eb),_0x60ae15['setReasoning'](_0x416781);const _0x3f6c95=_0x22831a['contextLibrary']['resolveContext']({'feature':'chat','ids':[_0x5814b9],'idScopedOnly':!0x0,'context':new Yn()});_0x60ae15['addDefaultContext'](_0x3f6c95['refs']),_0x2217ac['addCurrentDocumentToChatContext'](),_0x584877?(this['_aiChatUI']['setPromptInputValue'](_0x133ed5),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x2217ac['sendMessage']({'message':_0x133ed5});}_runReviewShortcut({commandId:_0x13a56b,model:_0x17a790,prompt:_0x259e1c,params:_0x37216e}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ct('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x390590={'id':_0x13a56b,'isCustom':'custom'===_0x13a56b};_0x17a790&&_0x259e1c&&(_0x390590['args']={'model':_0x17a790,'prompt':_0x259e1c}),_0x37216e&&(_0x390590['params']=_0x37216e),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x390590);}_runTranslateShortcut({language:_0x2e14e3}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new ct('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x2e14e3,'args':{'language':_0x2e14e3}});}},Pa=class extends _0x2d31d9{constructor(_0x80d1f){super(_0x80d1f);const _0x464fcd=_0x80d1f['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x464fcd,'isVisible'),this['isEnabled']=!0x0;}execute(){const _0x4daeae=this['editor']['plugins']['get']('AITabs')['view'];_0x4daeae['isVisible']=!_0x4daeae['isVisible'];}},Da=class extends _0x19488e{static get requires(){return[gs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x175af3=this['editor'];_0x175af3['commands']['add']('toggleAi',new Pa(_0x175af3)),_0x175af3['ui']['componentFactory']['add']('toggleAi',()=>{const _0x45b184=this['_createAIUIButton'](Mt);return _0x45b184['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x45b184;}),_0x175af3['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x17119a=this['_createAIUIButton'](Zt);return _0x17119a['set']({'role':'menuitemcheckbox'}),_0x17119a;});}_createAIUIButton(_0x6d1556){const _0x494778=this['editor'],_0x2dfe02=_0x494778['commands']['get']('toggleAi'),_0xb04433=new _0x6d1556(_0x494778['locale']);return _0xb04433['set']({'label':Es(_0x494778['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x7ab78f,'isToggleable':!0x0}),_0xb04433['bind']('isEnabled')['to'](_0x2dfe02),_0xb04433['bind']('isOn')['to'](_0x2dfe02,'value',_0x5166eb=>!!_0x5166eb),this['listenTo'](_0xb04433,'execute',()=>{_0x2dfe02['execute']();}),_0xb04433;}};const Ha=['applySuggestion','insertSuggestion','showNext','showPrevious'];var Ma=class extends _0x4ff2da{['_errorView'];constructor(_0x26f2c7){super(_0x26f2c7),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x46b2f6){this['showError'](_0x46b2f6);}['showError'](_0x344ce5){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x344ce5,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}_createErrorView(){const _0x38430b=new _0x4ff2da(this['locale']),_0x4965fd=new _0x4ff2da(this['locale']);return _0x4965fd['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x38430b['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x6710c5=>!_0x6710c5)]},'children':[_0x4965fd]}),_0x38430b;}};const Ua=0xa;var Va=class extends _0x212144{static get requires(){return[tn];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;_currentConfig;_editor;_isUpdatingMarkers=!0x1;['open'](_0x5b9f56){const {id:_0x54b827}=this['_currentConfig']??{};this['_currentConfig']=_0x5b9f56,this['_editor']=_0x5b9f56['targetEditor'];const {id:_0x50807e}=this['_currentConfig'];this['isOpen']&&_0x54b827===_0x50807e?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x313467=this['_editor'];if(!_0x313467)return;const _0x1a10e7=_0x313467['plugins']['get']('Dialog');_0x1a10e7['isOpen']&&this['_currentConfig']&&_0x1a10e7['id']===this['_currentConfig']['id']&&_0x1a10e7['hide']();}_updateDialog(){const _0x3496c2=this['_editor']['plugins']['get']('Dialog'),{icon:_0x2fcb28,title:_0x330469}=this['_currentConfig'];_0x3496c2['view']?.['headerView']&&(_0x3496c2['view']['headerView']['label']=_0x330469,_0x3496c2['view']['headerView']['iconView']&&_0x2fcb28&&(_0x3496c2['view']['headerView']['iconView']['content']=_0x2fcb28)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x3496c2['view']?.['updatePosition']();}_showFakeVisualSelection(){this['context']['plugins']['get'](tn)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}_hideFakeVisualSelection(){this['context']['plugins']['get'](tn)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x4ac30b=this['_editor']['plugins']['get']('Dialog'),{id:_0x14b465,title:_0x317559,icon:_0x222110,class:_0x5c602c,mainView:_0x2ff3dd}=this['_currentConfig'];_0x2ff3dd['delegate'](...Ha)['to'](this),_0x4ac30b['show']({'title':_0x317559,'icon':_0x222110,'hasCloseButton':!0x0,'id':_0x14b465,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x5c602c||''),'content':_0x2ff3dd,'onShow':_0x40a49f=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x40a49f['view']?.['updatePosition']();const _0x104b71=this['_getSelectionElements']();_0x104b71&&_0x104b71[0x0]&&Ot({'target':_0x104b71[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x40a49f['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x14b465});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x14b465}),this['isOpen']=!0x1;}});}_calculateDialogPosition(_0x932c77,_0x4341c1,_0x23e475){const _0x32fc01=_0x4341c1||_0x23e475;if(!_0x32fc01)return null;const _0x4f6f8d=this['_getSelectionElements']();if(!_0x4f6f8d||0x0===_0x4f6f8d['length'])return{'left':Math['round'](_0x32fc01['left']+_0x32fc01['width']/0x2-_0x932c77['width']/0x2),'top':Math['round'](_0x32fc01['top']+_0x32fc01['height']/0x2-_0x932c77['height']/0x2)};const _0x4d646a=Math['round'](_0x32fc01['left']+_0x32fc01['width']/0x2-_0x932c77['width']/0x2),_0x25e6c5=_0x4f6f8d['map'](_0x5a4bbf=>new It(_0x5a4bbf)),_0x7de784=_0x932c77['height'];return{'left':_0x4d646a,'top':this['_calculateOptimalTopPosition'](_0x25e6c5,_0x7de784,_0x32fc01)};}_calculateOptimalTopPosition(_0x553bd2,_0x34ddcd,_0x189c8d){const _0x2ff1a3=new It(wt['window']),_0x2cfea3=_0x553bd2['map'](_0x1a65af=>_0x1a65af['getVisible']())['filter'](_0x105f42=>_0x105f42),_0x4cc6e9=It['getBoundingRect'](_0x2cfea3);if(!_0x4cc6e9)return Math['round'](_0x189c8d['top']+_0x189c8d['height']/0x2);const _0x408af9=_0x2ff1a3['getIntersection'](_0x4cc6e9);if(!_0x408af9)return Math['round'](_0x189c8d['top']+_0x189c8d['height']/0x2);const _0x3bd552=_0x189c8d['getVisible'](),_0x5c44d4=_0x3bd552&&_0x4cc6e9['height']>_0x3bd552['height'],_0x5d9daf=_0x408af9['top'],_0x3d8a96=_0x408af9['bottom'];if(_0x5c44d4){const _0x372eb4=_0x2ff1a3['top']+_0x2ff1a3['height']/0x2-_0x34ddcd/0x2,_0x45426b=_0x5d9daf-Ua-_0x2ff1a3['top'],_0x2f5657=_0x2ff1a3['bottom']-_0x3d8a96-Ua;return _0x45426b>=_0x34ddcd?Math['max'](Ua,_0x5d9daf-_0x34ddcd-Ua):_0x2f5657>=_0x34ddcd?_0x3d8a96+Ua:Math['max'](Ua,_0x372eb4);}const _0x21915c=_0x5d9daf-_0x34ddcd,_0x343e58=_0x2ff1a3['bottom']-_0x3d8a96-Ua,_0x56e274=_0x5d9daf-Ua-_0x2ff1a3['top'];let _0x5a1a78;return _0x5a1a78=_0x343e58>=_0x34ddcd?_0x3d8a96+Ua:_0x56e274>=_0x34ddcd?_0x21915c-Ua:_0x5d9daf+_0x4cc6e9['height']/0x2-_0x34ddcd/0x2,_0x5a1a78;}_setupFakeVisualSelectionMarkerRemovalListener(){const _0x32ac56=this['_editor'];this['listenTo'](_0x32ac56['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x450464,data:{newRange:_0x29354c}}of _0x32ac56['model']['document']['differ']['getChangedMarkers']())if(_0x450464['startsWith']('ai-selection:')&&(_0x29354c&&(_0x29354c['start']['isEqual'](_0x29354c['end'])||'$graveyard'==_0x29354c['root']['rootName'])||null==_0x29354c)){const _0x3f6fb9=Es(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x3f6fb9),this['fire']('selectionRemoved');}}});}_cleanupFakeVisualSelectionMarkerRemovalListener(){const _0x19a561=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x19a561['model']['document']);}_getSelectionElements(){const _0x174d5f=this['_editor'];return _0x37a243(_0x174d5f['editing'],[..._0x174d5f['model']['markers']['getMarkersGroup']('ai-selection'),..._0x174d5f['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}_getCurrentDomRootName(){const _0x419bb1=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x419bb1&&_0x419bb1['rootName']?_0x419bb1['rootName']:null;}},Ba=class extends _0x24660c{copyButton;likeButton;dislikeButton;showChangesButton;['_config'];constructor(_0x4ce700,_0x520e0b={}){super(_0x4ce700),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x520e0b};const _0x1861f4=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x1861f4?'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(_0x5b69a2){this['showChangesButton']['isEnabled']=_0x5b69a2;}_setupRatingButtons(){this['likeButton']=new Mt(this['locale']),this['likeButton']['set']({'icon':at,'label':Es(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':Dn,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new Mt(this['locale']),this['dislikeButton']['set']({'icon':ot,'label':Es(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':Dn,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}_setupCopyButton(){this['copyButton']=new Mt(this['locale']),this['copyButton']['set']({'icon':_0x208a90,'label':Es(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+Dn,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x1bb9ba=new $t();_0x1bb9ba['set']({'content':_0x5517bf}),_0x1bb9ba['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'+Dn,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+Dn;},0x7d0);}),this['copyButton']['children']['add'](_0x1bb9ba);}_setupShowChangesButton(){this['showChangesButton']=new Mt(this['locale']),this['showChangesButton']['set']({'icon':et,'label':Es(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':Dn}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x151832=>_0x151832?it:et),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}},Ga=class extends Ma{['children'];nextButtonView;previousButtonView;['focusCycler'];['_focusables'];['_focusTracker'];_keystrokes;['_config'];_streamableContentView;_toolbarContainerView;_partToolbarView;_stateView;['_miniToolbarView'];constructor(_0x2e555a,_0x52158a){super(_0x2e555a);const _0x1003e4=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['set']('_outdatedReason',void 0x0),this['set']('isTargetReadOnly',!0x1),this['set']('areActionsDisabled',!0x1),this['_focusTracker']=new _t(),this['_keystrokes']=new gt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x52158a,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new mr(_0x2e555a),this['_partToolbarView']=new Ir(_0x2e555a,_0x52158a['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_partToolbarView']['bind']('isTargetReadOnly')['to'](this),this['_partToolbarView']['bind']('isEnabled')['to'](this,'areActionsDisabled',this,'_isErrorVisible',(_0x38962c,_0x3161f0)=>!_0x38962c&&!_0x3161f0),this['_togglePartToolbarButtonsVisibility'](_0x52158a),this['_stateView']=new gr(_0x2e555a),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new Ba(_0x2e555a,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new Fa(_0x2e555a,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x3c5f2f,_0x3089e4,_0x506992,_0x1f44e5)=>{let _0xb518ea,_0x2e1e9b;'pending'===_0x1f44e5?(_0xb518ea=this['_partToolbarView'],_0x2e1e9b=this['_stateView']):(_0xb518ea=this['_stateView'],_0x2e1e9b=this['_partToolbarView']),this['_stateView']['setState'](_0x506992,this['_outdatedReason']),_0xb518ea['isVisible']=!0x1,_0x2e1e9b['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x1003e4['to']('_state',_0x4eab84=>'ck-ai-chat-balloon-main_state_'+_0x4eab84)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x52158a);});}['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(_0x113a31){_0x113a31?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x113a31);}clearContent(){this['_streamableContentView']['clear']();}setState(_0x5ae70e,_0x1fdfe1){this['_outdatedReason']=_0x1fdfe1,this['_state']=_0x5ae70e;}['showError'](_0x4fab8e){super['showError'](_0x4fab8e),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}toggleRotatorButtonsVisibility(_0x3cc6f5){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x3cc6f5;}_togglePartToolbarButtonsVisibility({showApplyButton:_0x4e7aba,showSuggestButton:_0x173eb8}){_0x4e7aba=_0x4e7aba&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x173eb8=_0x173eb8&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x4e7aba,'showSuggestButton':_0x173eb8});}_createNextButtonView(){const _0x36c782=new Mt(this['locale']);return _0x36c782['set']({'icon':_0x43d5c7,'label':Es(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x36c782['on']('execute',()=>{this['fire']('showNext');}),_0x36c782;}_createPreviousButtonView(){const _0x6ac44=new Mt(this['locale']);return _0x6ac44['set']({'icon':_0x4c02c1,'label':Es(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x6ac44['on']('execute',()=>{this['fire']('showPrevious');}),_0x6ac44;}},Fa=class extends _0x4ff2da{constructor(_0x3ce87d,_0x499379){super(_0x3ce87d),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x499379});}},Ka=class extends _0x19488e{static get requires(){return[Ut,Va];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}_chatBalloonView;constructor(_0x2261e2){super(_0x2261e2),this['set']('showDiff',!0x1);}['open'](_0x1cc926){const _0x14e8ea=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x14e8ea['plugins']['get']('AIBalloon')['open']({..._0x1cc926,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x1cc926['showRotator']),this['_chatBalloonView']['areActionsDisabled']=_0x1cc926['areActionsDisabled'],this['_chatBalloonView']['isTargetReadOnly']=_0x1cc926['isTargetReadOnly'],this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}updateContent(_0x4d53ef){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x4d53ef);}clearContent(){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}setState(_0x170678,_0x23c553){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x170678,_0x23c553);}setTargetReadOnly(_0x3582ff){this['_chatBalloonView']&&(this['_chatBalloonView']['isTargetReadOnly']=_0x3582ff);}_createChatBalloonView(){const _0x2c2b35=this['editor'],_0x195bc8=_0x2c2b35['plugins']['get']('AIBalloon'),_0xd7da29=_0x2c2b35['commands']['get']('trackChanges');let _0x516359=_0x2c2b35['config']['get']('ai.availableReplyActions')||[...Or];_0x2c2b35['plugins']['has']('TrackChanges')||(_0x516359=_0x516359['filter'](_0x3366b1=>'insertSuggestion'!=_0x3366b1));const _0x235072=new Ga(_0x2c2b35['locale'],{'availableActions':_0x516359,'showApplyButton':!0x0,'showSuggestButton':!!_0xd7da29});return _0x235072['bind']('showDiff')['to'](this),_0x235072['delegate'](...ir)['to'](this),_0x235072['delegate']('showPrevious','showNext')['to'](this),_0x195bc8['delegate']('dialogClosed')['to'](this),_0x235072['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x235072['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x235072['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0xd7da29&&_0x235072['bind']('isTrackChangesOn')['to'](_0xd7da29,'value'),_0x235072['render'](),_0x235072;}_toggleRotatorButtonsInDialogHeader(_0x1fca73){const _0x805ee9=this['editor'],_0x5257e8=_0x805ee9['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x1fca73),_0x5257e8['has'](this['_chatBalloonView']['previousButtonView'])||(_0x5257e8['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x805ee9['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x5257e8['remove'](this['_chatBalloonView']['previousButtonView']),_0x5257e8['remove'](this['_chatBalloonView']['nextButtonView']);}));}_restoreDefaultViewFocus(){this['_chatBalloonView']['focus']();}},Wa=class extends _0x19488e{static get requires(){return[Da,Ka,_0x11ff4f];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function Ya(_0x52a5e1){const {editor:_0x2ee9ac,action:_0x2d738a,withText:_0x2732f4=!0x1,withIcon:_0x3a4440=!0x0,isInDropdown:_0x2f8f1d=!0x0,shouldPreventFocus:_0x2cb9d0=!0x1,actionButtons:_0x2e3034}=_0x52a5e1;return()=>{const _0x1ef673=_0x2ee9ac['locale'],_0x410697=new Mt(_0x1ef673),_0x3b6fcf=_0x410697['bindTemplate'];_0x2f8f1d&&_0x410697['extendTemplate']({'on':{'mouseenter':_0x3b6fcf['to'](()=>{_0x2cb9d0&&_0x2cb9d0()||_0x410697['focus']();})}}),_0x2e3034['push']({'buttonView':_0x410697,'action':_0x2d738a});const _0x26faf7=_0x2d738a['icon']??_0x2d738a['parent']?.['icon'];return _0x410697['set']({'label':_0x2d738a['label'],'withText':_0x2732f4,'role':'menuitem','icon':_0x3a4440?_0x26faf7??_0x13034c:void 0x0,'tooltip':!_0x2732f4,'class':'ck-ai-quick-actions-button','isEnabled':_0x2d738a['isEnabled']}),_0x410697['on']('execute',()=>{_0x2ee9ac['editing']['view']['focus'](),_0x2ee9ac['commands']['execute']('aiQuickAction',_0x2d738a);}),_0x410697;};}var $a=class extends Xt{['arrowView'];constructor(_0x2d71a7,_0x3d7efa){super(_0x2d71a7,_0x3d7efa);const _0x15f819=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',_0x15f4c6=>String(_0x15f4c6)),'data-cke-tooltip-disabled':_0x15f819['to']('isOn')},'on':{'mouseenter':_0x15f819['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}_createArrowView(){const _0x4b7e3d=new $t();return _0x4b7e3d['content']=_0x2d80b8,_0x4b7e3d['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x4b7e3d;}},qa=class extends Jt{_allListItems;_allSearchableItems;constructor(_0x555244,_0x498f0f,_0x1a16cd){super(_0x555244),this['_allListItems']=_0x498f0f,this['_allSearchableItems']=_0x1a16cd;}filter(_0x40ed0d){if(!_0x40ed0d)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x369051=_0x40ed0d['source']['toLowerCase']()['trim'](),_0x480e1e=this['_allSearchableItems']['filter'](_0x5a1789=>(_0x5a1789['groupLabel']?_0x5a1789['label']+'\x20('+_0x5a1789['groupLabel']+')':_0x5a1789['label'])['toLowerCase']()['includes'](_0x369051));return this['items']['clear'](),this['items']['addMany'](_0x480e1e['sort']((_0x2d5e4e,_0x538009)=>{const _0x568639=_0x2d5e4e['groupLabel'],_0x490318=_0x538009['groupLabel'];return _0x568639||_0x490318?_0x568639?0x1:-0x1:0x0;})['map'](_0x1e67ba=>_0x1e67ba['item'])),this['_highlightQuery'](_0x369051,_0x480e1e),{'resultsCount':_0x480e1e['length'],'totalItemsCount':this['_allSearchableItems']['length']};}_highlightQuery(_0x20d9d4,_0x4f64fc){if(!_0x20d9d4)return;const _0x29662b=new RegExp(_0x306a2e(_0x20d9d4),'gi');_0x4f64fc['forEach'](_0x49e780=>{_0x49e780['highlightViews']&&_0x49e780['highlightViews']['forEach'](_0x33c2e4=>{'function'==typeof _0x33c2e4['highlightText']&&_0x33c2e4['highlightText'](_0x29662b);});});}_clearHighlight(){this['_allSearchableItems']['forEach'](_0xdc7759=>{_0xdc7759['highlightViews']&&_0xdc7759['highlightViews']['forEach'](_0x289c2e=>{'function'==typeof _0x289c2e['highlightText']&&_0x289c2e['highlightText'](null);});});}};const Qa='menu',Xa='menuitem';var za=class extends _0x4ff2da{_bodyCollection;optionsListView;_searchTextView=null;_allSearchableItems=[];['children'];['focusTracker'];keystrokes;['_focusables'];['focusCycler'];_openNestedPanels=new Set();['_hasSearch'];_actionButtons;constructor(_0x3021de,_0x29e228,_0x133f65,_0x47b44e,_0xafaef3=!0x1,_0x1a1540=[]){const _0x5e33e3=_0x3021de['locale'];super(_0x5e33e3),this['_bodyCollection']=_0x47b44e,this['_hasSearch']=_0xafaef3,this['_actionButtons']=_0x1a1540;const _0x271cfc=this['_createListItems'](_0x3021de,_0x29e228,_0x133f65);this['optionsListView']=new qa(_0x5e33e3,_0x271cfc,this['_allSearchableItems']),this['optionsListView']['role']=Qa,this['optionsListView']['items']['addMany'](_0x271cfc),this['focusTracker']=new _t(),this['keystrokes']=new gt(),_0xafaef3&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x271cfc,this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0xafaef3&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x400c9c=_0xafaef3&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x50bc02(_0x400c9c),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x5e33e3['uiLanguageDirection']},'children':this['children']});}_createSearchTextView(){return new _0x10e0e0(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':Es(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':Es(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x5e09f8=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x5e09f8);}_createListItems(_0x345d36,_0x365344,_0x28bd30){const _0x2c890f=new _0x50bc02();return _0x365344['forEach'](_0x4b01ba=>{if('actions'in _0x4b01ba){const {listItem:_0x2f03d1}=this['_createActionGroupButton'](_0x345d36,_0x4b01ba,_0x28bd30);_0x2c890f['add'](_0x2f03d1),_0x4b01ba['actions']['forEach'](_0x50e1cc=>{const {listItem:_0xad0e92,highlightViews:_0x130087}=this['_createSearchResultActionButton'](_0x345d36,_0x50e1cc,_0x4b01ba['label'],_0x4b01ba['icon']);this['_allSearchableItems']['push']({'item':_0xad0e92,'label':_0x50e1cc['label'],'groupLabel':_0x4b01ba['label'],'highlightViews':_0x130087});});}else{const {listItem:_0x975265}=this['_createActionButton'](_0x345d36,_0x4b01ba);_0x2c890f['add'](_0x975265);const _0x3e878e=_0x975265['children']['first'];if(_0x3e878e){const {listItem:_0x3910a6,highlightViews:_0x2ceb28}=this['_createSearchResultActionButton'](_0x345d36,_0x4b01ba);this['_allSearchableItems']['push']({'item':_0x3910a6,'label':_0x3e878e['label']||'','highlightViews':_0x2ceb28});}}}),_0x2c890f;}_createActionButton(_0x395e23,_0x2ce84b,_0x1f2b46,_0xa83916){const _0x4b17ea=new jt(this['locale']);if(_0x1f2b46&&_0xa83916){const _0x517cb6=new Mt(this['locale']),_0x4eb348=_0x517cb6['bindTemplate'],_0x4985e7=new Yt();_0x4985e7['text']=_0x2ce84b['label'];const _0x3dced8=new Yt();_0x3dced8['text']=_0x1f2b46;const _0x187e57=new $t();_0x187e57['content']=_0xa83916,_0x187e57['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x17d1b1=new _0x4ff2da(this['locale']);_0x17d1b1['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x51de4d=new _0x4ff2da(this['locale']);return _0x51de4d['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x517cb6['set']({'label':_0x2ce84b['label']+'\x20('+_0x1f2b46+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x2ce84b['isEnabled']}),_0x517cb6['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x4eb348['if']('isEnabled','ck-disabled',_0x15a40f=>!_0x15a40f)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x4985e7,_0x17d1b1,_0x187e57,_0x3dced8,_0x51de4d],'on':{'mouseenter':_0x4eb348['to'](()=>{this['_isSearchFocused']()||_0x517cb6['focus']();}),'click':_0x4eb348['to'](()=>{_0x517cb6['fire']('execute');})}}),_0x517cb6['on']('execute',()=>{_0x517cb6['isEnabled']&&(_0x395e23['editing']['view']['focus'](),_0x395e23['commands']['execute']('aiQuickAction',_0x2ce84b));}),_0x4b17ea['children']['add'](_0x517cb6),this['_actionButtons']['push']({'buttonView':_0x517cb6,'action':_0x2ce84b}),{'listItem':_0x4b17ea,'highlightViews':[_0x4985e7,_0x3dced8]};}{const _0x24fc52=new Ht(),_0x4c3cfe=new Mt(this['locale'],_0x24fc52),_0x355c3c=_0x4c3cfe['bindTemplate'],_0x36d538=_0x2ce84b['icon']??_0x2ce84b['parent']?.['icon'],_0x52f3f0=void 0x0!==_0x2ce84b['icon'];return _0x4c3cfe['set']({'label':_0x2ce84b['label'],'withText':!0x0,'role':'menuitem','icon':_0x52f3f0?_0x36d538??_0x13034c:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x2ce84b['isEnabled']}),_0x4c3cfe['extendTemplate']({'on':{'mouseenter':_0x355c3c['to'](()=>{this['_isSearchFocused']()||_0x4c3cfe['focus']();})}}),_0x4c3cfe['on']('execute',()=>{_0x395e23['editing']['view']['focus'](),_0x395e23['commands']['execute']('aiQuickAction',_0x2ce84b);}),_0x4b17ea['children']['add'](_0x4c3cfe),this['_actionButtons']['push']({'buttonView':_0x4c3cfe,'action':_0x2ce84b}),{'listItem':_0x4b17ea,'highlightViews':[_0x24fc52]};}}_createSearchResultActionButton(_0x28afb3,_0x1aaf55,_0x2eff5c,_0x237bce){return _0x2eff5c&&_0x237bce?this['_createSearchResultGroupedActionButton'](_0x28afb3,_0x1aaf55,_0x2eff5c,_0x237bce):this['_createSearchResultIndividualActionButton'](_0x28afb3,_0x1aaf55);}_createSearchResultGroupedActionButton(_0x1ac427,_0x43c16f,_0x25963d,_0x481f1a){const _0x44acc4=new jt(this['locale']),_0x27d387=new Mt(this['locale']),_0x3e4d18=_0x27d387['bindTemplate'],{view:_0x5a1b0e,highlightView:_0x423ef4}=this['_createSearchResultGroupRow'](_0x25963d,_0x481f1a),{view:_0x57728a,highlightView:_0x4fed03}=this['_createSearchResultActionRow'](_0x43c16f['label']),_0x4ff5ef=this['_createSearchResultContentView'](_0x5a1b0e,_0x57728a);return _0x27d387['set']({'label':_0x43c16f['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':_0x43c16f['isEnabled']}),_0x27d387['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',_0x3e4d18['if']('isEnabled','ck-disabled',_0x1d1909=>!_0x1d1909)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x4ff5ef],'on':{'mouseenter':_0x3e4d18['to'](()=>{this['_isSearchFocused']()||_0x27d387['focus']();}),'click':_0x3e4d18['to'](()=>{this['_handleSearchResultButtonClick'](_0x27d387);})}}),this['_setupActionButtonExecution'](_0x27d387,_0x1ac427,_0x43c16f),_0x44acc4['children']['add'](_0x27d387),this['_actionButtons']['push']({'buttonView':_0x27d387,'action':_0x43c16f}),{'listItem':_0x44acc4,'highlightViews':[_0x423ef4,_0x4fed03]};}_createSearchResultIndividualActionButton(_0x8513d7,_0x4d812b){const _0x516218=new jt(this['locale']),_0x462a05=new Ht(),_0x1afb70=new Mt(this['locale'],_0x462a05),_0x1882d8=_0x1afb70['bindTemplate'];return _0x1afb70['set']({'label':_0x4d812b['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x4d812b['isEnabled']}),_0x1afb70['extendTemplate']({'on':{'mouseenter':_0x1882d8['to'](()=>{this['_isSearchFocused']()||_0x1afb70['focus']();})}}),this['_setupActionButtonExecution'](_0x1afb70,_0x8513d7,_0x4d812b),_0x516218['children']['add'](_0x1afb70),this['_actionButtons']['push']({'buttonView':_0x1afb70,'action':_0x4d812b}),{'listItem':_0x516218,'highlightViews':[_0x462a05]};}_createSearchResultGroupRow(_0x162acf,_0x2671d4){const _0x15b23c=new _0x4ff2da(this['locale']),_0x175e37=new $t();_0x175e37['content']=_0x2671d4,_0x175e37['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x178c53=new Yt();return _0x178c53['text']=_0x162acf,_0x15b23c['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x175e37,_0x178c53]}),{'view':_0x15b23c,'highlightView':_0x178c53};}_createSearchResultActionRow(_0x92c329){const _0x5892ad=new _0x4ff2da(this['locale']),_0x519148=new Yt();return _0x519148['text']=_0x92c329,_0x5892ad['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x519148]}),{'view':_0x5892ad,'highlightView':_0x519148};}_createSearchResultContentView(_0x189508,_0x45db14){const _0x42db1c=new _0x4ff2da(this['locale']);return _0x42db1c['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x189508,_0x45db14]}),_0x42db1c;}_setupActionButtonExecution(_0x27fd79,_0x5e5ffd,_0x869bd0){_0x27fd79['on']('execute',()=>{_0x27fd79['isEnabled']&&(_0x5e5ffd['editing']['view']['focus'](),_0x5e5ffd['commands']['execute']('aiQuickAction',_0x869bd0));});}_createActionGroupButton(_0x1af0af,_0x288b18,_0x47cfc4){const _0x1d282b=new jt(this['locale']),_0x34b588=new Ht(),_0x34c78e=new $a(this['locale'],_0x34b588),_0x3a7161=_0x34c78e['bindTemplate'],_0x56a4ca=this['_getPanelKeystroke'](_0x47cfc4),_0x2123c1=this['_createGroupActionsList'](_0x1af0af,_0x288b18['actions'],_0x47cfc4);_0x34c78e['set']({'label':_0x288b18['label'],'withText':!0x0,'role':Xa,'icon':_0x288b18['icon']??_0x13034c,'isEnabled':_0x288b18['actions']['some'](_0x28a04f=>_0x28a04f['isEnabled'])}),_0x34c78e['extendTemplate']({'on':{'mouseenter':_0x3a7161['to'](()=>{this['_isSearchFocused']()||_0x34c78e['focus']();})}});const _0x4eb535=new xt(this['locale']);return _0x4eb535['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x3a7161['to'](_0x4f69d9=>{this['_handlePanelKeydown'](_0x4f69d9,_0x56a4ca,_0x34c78e,_0x4eb535);})}}),_0x34c78e['bind']('isOn')['to'](_0x4eb535,'isVisible'),this['_bodyCollection']['add'](_0x4eb535),_0x4eb535['content']['add'](_0x2123c1),this['_setupGroupMenuBehavior'](_0x34c78e,_0x4eb535),_0x1d282b['children']['add'](_0x34c78e),this['_actionButtons']['push']({'buttonView':_0x34c78e,'action':_0x288b18}),{'listItem':_0x1d282b,'highlightView':_0x34b588};}_createGroupActionsList(_0x339d67,_0x315149,_0x2c169d){const _0x52daaf=new Jt(this['locale']);return _0x52daaf['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x315149['forEach'](_0x515c38=>{const _0x156db0=new jt(this['locale']),_0x347139=Ya({'editor':_0x339d67,'action':_0x515c38,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x156db0['children']['add'](_0x347139),_0x2c169d['focusTracker']['add'](_0x347139),_0x52daaf['items']['add'](_0x156db0);}),_0x52daaf;}_setupGroupMenuBehavior(_0x3bc406,_0x6d6fe9){const _0xc36ce2=_0x3bc406['bindTemplate'],_0x585a94=this['_getButtonKeystroke'](_0x3bc406);_0x3bc406['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0xc36ce2['to'](()=>{this['_showNestedPanel'](_0x6d6fe9,_0x3bc406);}),'mouseleave':_0xc36ce2['to'](_0x5cd6e0=>{const _0x59d060=_0x5cd6e0['relatedTarget'];this['_isMovingToNestedMenu'](_0x59d060,_0x6d6fe9)||this['_hideNestedPanel'](_0x6d6fe9);}),'keydown':_0xc36ce2['to'](_0xe97e03=>{_0xe97e03['key']==_0x585a94&&(this['_showNestedPanel'](_0x6d6fe9,_0x3bc406),_0x6d6fe9['content']['get'](0x0)['focus']());})}}),_0x6d6fe9['on']('render',()=>{_0x6d6fe9['element']?.['addEventListener']('mouseleave',_0x389600=>{const _0x28c68c=_0x389600['relatedTarget'];_0x3bc406['element']?.['contains'](_0x28c68c)||this['_isMovingToNestedMenu'](_0x28c68c,_0x6d6fe9)||this['_hideNestedPanel'](_0x6d6fe9);});});}_showNestedPanel(_0x19d66c,_0x10a90b){this['_openNestedPanels']['forEach'](_0x5d01f0=>{_0x5d01f0!==_0x19d66c&&_0x5d01f0['isVisible']&&_0x5d01f0['hide']();}),_0x19d66c['show'](),_0x19d66c['pin']({'positions':[Bt['eastSouth']],'target':_0x10a90b['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x19d66c);}_hideNestedPanel(_0x3337cb){_0x3337cb['hide'](),this['_openNestedPanels']['delete'](_0x3337cb);}_hideAllNestedPanels(){this['_openNestedPanels']['forEach'](_0x291339=>_0x291339['hide']()),this['_openNestedPanels']['clear']();}_isMovingToNestedMenu(_0x2b27a7,_0x2adcfb){if(!_0x2b27a7)return!0x1;if(_0x2adcfb['element']?.['contains'](_0x2b27a7))return!0x0;const _0x24fdd0=_0x2b27a7;return _0x24fdd0['closest']&&(null!==_0x24fdd0['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x24fdd0['closest']('.ck-ai-quick-actions-group-list')||null!==_0x24fdd0['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(_0x491126){return'rtl'===_0x491126['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}_getButtonKeystroke(_0x395d4f){return'rtl'===_0x395d4f['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0xbe556,_0x4db901,_0x2aac53,_0x317503){_0xbe556['key']==_0x4db901&&(_0x2aac53['focus'](),this['_hideNestedPanel'](_0x317503));}_handleSearchResultButtonClick(_0xd4c9d6){_0xd4c9d6['fire']('execute');}};function ja(_0x55f52c){const {editor:_0x417b7b,content:_0x4ea39c,buttonDefinition:_0x4ad113,bodyCollection:_0x38a4a6,hasSearch:_0x54827a=!0x1,actionButtons:_0x44ce23}=_0x55f52c;return()=>{const _0x292c61=_0x417b7b['locale'],_0x785e27=_0x417b7b['commands']['get']('aiQuickAction'),_0x5d63fc=_0x5a954d(_0x292c61);_0x5d63fc['bind']('isEnabled')['to'](_0x785e27),_0x5d63fc['buttonView']['set']({'icon':_0x4ad113['icon']??_0x13034c,'label':_0x4ad113['label'],'tooltip':!0x0}),_0x5d63fc['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x544ea5=new za(_0x417b7b,_0x4ea39c,_0x5d63fc,_0x38a4a6,_0x54827a,_0x44ce23);return _0x5d63fc['panelView']['children']['add'](_0x544ea5),_0x54827a&&_0x5d63fc['on']('change:isOpen',(_0x2a8ec0,_0x341e92,_0x3b75a7)=>{if(_0x3b75a7){if(_0x417b7b['plugins']['has']('AIEditing')){const _0x58436b=_0x417b7b['plugins']['get'](tn),_0x1faff6=_0x417b7b['model']['document']['selection'],_0x18df8e=Array['from'](_0x1faff6['getRanges']());_0x18df8e['length']>0x0&&_0x58436b['showFakeVisualSelection']({'editor':_0x417b7b,'ranges':_0x18df8e,'id':'quick-action','priority':0x14});}}else _0x417b7b['plugins']['has']('AIEditing')&&_0x417b7b['plugins']['get'](tn)['hideFakeVisualSelection']('quick-action'),_0x544ea5['resetSearch']();}),_0x5d63fc;};}const Ja='<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>',Za='<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>',th='<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>',eh=/* #__PURE__ -- @preserve */
|
|
37
|
+
((()=>({'chat':'AIChat','action':'AIActions'}))());var ih=class AIQuickActionsUI extends _0x19488e{_actionButtons=[];['_menuBarGroupViews']=[];_reporter;static get requires(){return[Lt,Is,Nn,fs];}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 _0x374a9e=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x374a9e),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static getDefaultQuickActions(_0x2c4662){return function(_0x2f0718){const _0x11275f=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x2f0718['uiLanguage'])||'English';return[{'id':'ask-ai','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0xedc76b},{'id':'chat-commands','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0xedc76b,'actions':[{'id':'explain','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Es(_0x2f0718,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':Ja['replace']('%0',_0x11275f),'type':'chat'},{'id':'summarize','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Es(_0x2f0718,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Za['replace']('%0',_0x11275f),'type':'chat'},{'id':'highlight-key-points','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Es(_0x2f0718,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':th['replace']('%0',_0x11275f),'type':'chat'}]},{'id':'improve-writing','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x23eeb2},{'id':'continue','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x28e5af},{'id':'fix-grammar','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x56be77},{'id':'adjust-length','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x2dada8,'actions':[{'id':'make-shorter','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x3007be,'actions':[{'id':'make-tone-casual','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x1bcc6c,'actions':[{'id':'translate-to-english','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x3cb71d,'actions':[]}];}(_0x2c4662);}_getDefaultAndCustomActions(){const _0x1a21ce=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x3b69b1=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x9c12b6=>({..._0x9c12b6,'type':'chat'===_0x9c12b6['type']?'chat':'action','icon':void 0x0}));return _0x1a21ce['find'](_0x20c8b8=>'other'===_0x20c8b8['id'])['actions']['push'](..._0x3b69b1),_0x1a21ce;}async _initActionTypeQuickActions(){try{const _0x37433e=this['editor']['plugins']['get'](fs),_0x1d3418=await _0x37433e['models']['getAllModels'](),_0x2ec650=(await _0x37433e['models']['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x2ec650),this['_enableButtonsByType']('action',_0x274156=>!!_0x1d3418['find'](_0x7dddc2=>_0x7dddc2['id']===_0x274156['model'])||void 0x0===_0x274156['model']);}catch(_0x5d927c){const _0x4d2881=new ct('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x5d927c});this['_reporter']['logError'](_0x4d2881);}}_initChatTypeQuickActions(){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x32c95b=this['editor']['plugins']['get']('AIChatController'),_0x465895=this['editor']['plugins']['has']('AIChatUI')?this['editor']['plugins']['get']('AIChatUI'):null;this['listenTo'](_0x32c95b,'change:isConversationReady',(_0x422e64,_0x491e8c,_0x29fc7e)=>{this['_enableButtonsByType']('chat',()=>_0x29fc7e&&!_0x465895?.['isBusy']);}),_0x465895&&this['listenTo'](_0x465895,'change:isBusy',(_0x393337,_0x2cbcb5,_0x3d3a34)=>{this['_enableButtonsByType']('chat',()=>_0x32c95b['isConversationReady']&&!_0x3d3a34);}),this['_enableButtonsByType']('chat',()=>_0x32c95b['isConversationReady']&&!_0x465895?.['isBusy']);}_enableButtonsByType(_0x4ff84e,_0x1718f6){this['_quickActionsDefinition']['forEach'](_0x3adb10=>{'actions'in _0x3adb10?_0x3adb10['actions']['forEach'](_0xa3483a=>{_0xa3483a['type']===_0x4ff84e&&(_0xa3483a['isEnabled']=_0x1718f6(_0xa3483a));}):_0x3adb10['type']===_0x4ff84e&&(_0x3adb10['isEnabled']=_0x1718f6(_0x3adb10));}),this['_actionButtons']['forEach'](_0x1bf49f=>{if(sh(_0x1bf49f['action']))return;if(_0x1bf49f['action']['type']!==_0x4ff84e)return;const _0x457c14=_0x1718f6(_0x1bf49f['action']);if(_0x1bf49f['action']['isEnabled']=_0x457c14,_0x1bf49f['buttonView']['isEnabled']=_0x457c14,'action'===_0x4ff84e&&!_0x457c14&&_0x1bf49f['action']['model']){const _0xc5a2fd=new ct('ai-quick-actions-unavailable-model',this,{'actionId':_0x1bf49f['action']['id'],'modelId':_0x1bf49f['action']['model']});this['_reporter']['logError'](_0xc5a2fd);}}),this['_actionButtons']['filter'](_0x1e8cf4=>sh(_0x1e8cf4['action']))['forEach'](_0x4c65a4=>{_0x4c65a4['buttonView']['isEnabled']=_0x4c65a4['action']['actions']['some'](_0x307c98=>_0x307c98['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x26ca69,group:_0x288b47})=>{_0x26ca69['isEnabled']=_0x288b47['actions']['some'](_0x2fd79c=>_0x2fd79c['isEnabled']);});}_enableButtonById(_0x4b662f,_0x583641){this['_quickActionsDefinition']['forEach'](_0x51a9e4=>{'actions'in _0x51a9e4?_0x51a9e4['actions']['forEach'](_0x1208d6=>{_0x1208d6['id']===_0x4b662f&&(_0x1208d6['isEnabled']=_0x583641(_0x1208d6));}):_0x51a9e4['id']===_0x4b662f&&(_0x51a9e4['isEnabled']=_0x583641(_0x51a9e4));}),this['_actionButtons']['forEach'](_0xd25051=>{if(sh(_0xd25051['action']))return;if(_0xd25051['action']['id']!==_0x4b662f)return;const _0x16d4fe=_0x583641(_0xd25051['action']);_0xd25051['action']['isEnabled']=_0x16d4fe,_0xd25051['buttonView']['isEnabled']=_0x16d4fe;});}_assignDefaultModelToCustomActions(_0x4b61bf){this['_actionButtons']['forEach'](_0x436d28=>{sh(_0x436d28['action'])||'action'===_0x436d28['action']['type']&&(_0x436d28['action']['model']||(_0x436d28['action']['model']=_0x4b61bf));});}_initializeQuickActionsComponentsAndCommands(){const _0xf468db=new Pt(this['editor']['locale']);_0xf468db['attachToDom'](),this['_initializeQuickActionsDropdown'](_0xf468db),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0xf468db);}_initializeQuickActionsDropdown(_0x3079c7){const _0x4de98f=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',ja({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x13034c,'label':Es(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x3079c7,'hasSearch':_0x4de98f,'actionButtons':this['_actionButtons']}));}_prepareQuickActionsDefinition(_0x13807e){this['_quickActionsDefinition']=_0x13807e['map'](_0x2981c9=>{if('actions'in _0x2981c9){const _0x46dba4=_0x2981c9;return{..._0x46dba4,'actions':_0x46dba4['actions']['map'](_0xd162d3=>{const {actions:_0x2c08ac,..._0x936273}=_0x46dba4;return{..._0xd162d3,'isEnabled':!0x1,'parent':_0x936273};})['filter'](_0x4a8645=>this['_shouldIncludeAction'](_0x4a8645))};}return{..._0x2981c9,'isEnabled':!0x1};})['filter'](_0x3c5db6=>'actions'in _0x3c5db6?_0x3c5db6['actions']['length']>0x0:this['_shouldIncludeAction'](_0x3c5db6));}_shouldIncludeAction(_0x2dd04b){const _0x834fea=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](eh[_0x2dd04b['type']])&&!_0x834fea['includes'](_0x2dd04b['id'])&&!('chat'===_0x2dd04b['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}_initializeQuickActionsComponents(_0x599951){this['_quickActionsDefinition']['forEach'](_0x10425e=>{if('actions'in _0x10425e){const _0x1f6c9c=ja({'editor':this['editor'],'content':_0x10425e['actions'],'buttonDefinition':_0x10425e,'bodyCollection':_0x599951,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x10425e['id'],_0x1f6c9c),_0x10425e['actions']['forEach'](_0x4ba2e0=>{const _0x465d81=Ya({'editor':this['editor'],'action':_0x4ba2e0,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x4ba2e0['id'],_0x465d81);});}else{const _0x3e12f0=Ya({'editor':this['editor'],'action':_0x10425e,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x10425e['id'],_0x3e12f0);}});}_initializeQuickActionsMenuBar(){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x22706d=>{const _0x41cfcb=this['editor']['commands']['get']('aiQuickAction'),_0x150dc6=new _0x4888f9(_0x22706d),_0x5700bf=Es(_0x22706d,'AI_QUICK_ACTIONS_HEADING');_0x150dc6['buttonView']['set']({'label':_0x5700bf,'icon':_0x13034c});const _0x554bc2=new _0x164ccd(_0x22706d);return _0x554bc2['set']({'ariaLabel':_0x5700bf,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x519c20=>{if('actions'in _0x519c20){const _0x30edcb=_0x519c20,_0x3328bb=new te(_0x22706d,_0x150dc6),_0x1bee36=new _0x4888f9(_0x22706d),_0x22a0f0=new _0x164ccd(_0x22706d);_0x1bee36['buttonView']['set']({'label':_0x30edcb['label'],'icon':_0x30edcb['icon']}),_0x30edcb['actions']['forEach'](_0x46cca7=>{const _0x5e343a=new te(_0x22706d,_0x1bee36),_0xa2acb1=new Zt(_0x22706d);_0xa2acb1['set']({'label':_0x46cca7['label'],'icon':_0x46cca7['icon'],'role':'menuitem','isEnabled':_0x46cca7['isEnabled']}),_0xa2acb1['on']('execute',()=>{this['_executeQuickAction'](_0x46cca7);}),this['_actionButtons']['push']({'buttonView':_0xa2acb1,'action':_0x46cca7}),_0xa2acb1['delegate']('execute')['to'](_0x1bee36),_0x5e343a['children']['add'](_0xa2acb1),_0x22a0f0['items']['add'](_0x5e343a);}),_0x1bee36['isEnabled']=_0x30edcb['actions']['some'](_0x4ebf77=>_0x4ebf77['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x1bee36,'group':_0x30edcb}),_0x1bee36['panelView']['children']['add'](_0x22a0f0),_0x3328bb['children']['add'](_0x1bee36),_0x554bc2['items']['add'](_0x3328bb);}else{const _0x1a0b1b=_0x519c20,_0x5353fc=new te(_0x22706d,_0x150dc6),_0x119ab6=new Zt(_0x22706d);_0x119ab6['set']({'label':_0x1a0b1b['label'],'icon':_0x1a0b1b['icon'],'role':'menuitem','isEnabled':_0x1a0b1b['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x119ab6,'action':_0x1a0b1b}),_0x119ab6['on']('execute',()=>{this['_executeQuickAction'](_0x1a0b1b);}),_0x119ab6['delegate']('execute')['to'](_0x150dc6),_0x5353fc['children']['add'](_0x119ab6),_0x554bc2['items']['add'](_0x5353fc);}}),Object['values'](eh)['some'](_0x37dc5f=>this['editor']['plugins']['has'](_0x37dc5f))?_0x150dc6['bind']('isEnabled')['to'](_0x41cfcb):_0x150dc6['set']({'isEnabled':!0x1}),_0x150dc6['panelView']['children']['add'](_0x554bc2),_0x150dc6;});}_executeQuickAction(_0x4b02ec){const _0x3665cf=this['editor'];_0x3665cf['editing']['view']['focus'](),_0x3665cf['commands']['execute']('aiQuickAction',_0x4b02ec);const _0x5cd4e1=_0x3665cf['ui']['view']['menuBarView'];_0x5cd4e1&&_0x5cd4e1['close']&&_0x5cd4e1['close']();}};function sh(_0x14a4c5){return'actions'in _0x14a4c5;}function nh(_0x1a1810,_0x17aeb6){const _0x2ed0ef=_0x1a1810['plugins']['get']('AITabs')['view'];_0x2ed0ef['isVisible']=!0x0,_0x2ed0ef['activateTab'](_0x17aeb6);}var rh=class extends _0x2d31d9{execute(_0x3886c4){switch(this['_expandSelectionIfCollapsed'](),_0x3886c4['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x2dea2a=Es(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x2dea2a});}this['_handleAIChatAction'](_0x3886c4);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x54f95f=Es(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x54f95f});}this['_handleAIActionsAction'](_0x3886c4);}}async _handleAIChatAction(_0x184159){const _0x48fa5b=this['editor']['plugins']['get']('AIChatController');if(nh(this['editor'],'chat'),'ask-ai'===_0x184159['id'])_0x48fa5b['removeSelectionFromChatContext'](),_0x48fa5b['addSelectionToChatContext'](this['editor']),_0x48fa5b['focusPromptInput']();else await _0x48fa5b['startConversation']({'modelId':_0x184159['model'],'contexts':this['_resolveActionContexts'](_0x184159)}),_0x48fa5b['removeSelectionFromChatContext'](),_0x48fa5b['addSelectionToChatContext'](this['editor']),_0x48fa5b['focusPromptInput'](),await _0x48fa5b['sendMessage']({'message':_0x184159['prompt']||_0x184159['displayedPrompt']||_0x184159['label'],'attributes':{'quickActionData':{'id':_0x184159['id']},'displayedPrompt':_0x184159['displayedPrompt']}});}_expandSelectionIfCollapsed(){const _0x1e56b5=this['editor'],_0x436154=_0x1e56b5['model']['document']['selection'];if(!_0x436154['isCollapsed'])return;const _0x70021b=mt(_0x436154['getSelectedBlocks']())||_0x1e56b5['model']['schema']['getLimitElement'](_0x436154);_0x1e56b5['model']['change'](_0x1cab26=>{_0x1cab26['setSelection'](_0x70021b,'in');});}_handleAIActionsActionLabel(_0x26aceb){return _0x26aceb['parent']?.['label']&&'other'!==_0x26aceb['parent']?.['id']?_0x26aceb['parent']['label']+':\x20'+_0x26aceb['label']:_0x26aceb['label'];}async _handleAIActionsAction(_0x266caf){const _0x292857=this['editor']['plugins']['get']('AIActions'),_0x290164=this['_resolveActionContexts'](_0x266caf);let _0x9b6fa1;_0x9b6fa1=_0x266caf['prompt']?{'userMessage':_0x266caf['prompt'],'model':_0x266caf['model'],'contexts':_0x290164}:_0x266caf['context']?{'model':_0x266caf['model'],'contexts':_0x290164}:{'actionName':_0x266caf['actionName']||_0x266caf['id'],'args':_0x266caf['args'],'contexts':_0x290164};const _0x3dc324=this['_handleAIActionsActionLabel'](_0x266caf);await _0x292857['executeAction'](_0x9b6fa1,_0x3dc324,_0x266caf['icon']);}_resolveActionContexts(_0xcdbe7d){const _0x294c37=_0xcdbe7d['parent']?.['id']?[_0xcdbe7d['id'],_0xcdbe7d['parent']['id']]:[_0xcdbe7d['id']];return this['editor']['plugins']['get'](fs)['contextLibrary']['resolveContext']({'feature':'quickActions','ids':_0x294c37,'extraContexts':_0xcdbe7d['context']?[_0xcdbe7d['context']]:[],'context':new Yn()})['refs'];}},oh=class extends _0x19488e{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x1a9436=this['editor'],_0x3cfba0=new rh(this['editor']);if(_0x1a9436['commands']['add']('aiQuickAction',_0x3cfba0),_0x1a9436['plugins']['has']('AIChat')){const _0x9189d3=this['editor']['plugins']['get']('AIChatController');_0x1a9436['model']['document']['selection']['on']('change:range',(_0x30bf56,_0x345580)=>{_0x345580['directChange']&&_0x9189d3['removeSelectionFromChatContext']();});}}},ah=class extends Vn{appendContent(_0x154fff,_0x4e581='text'){'modification'===this['type']&&'text'===_0x4e581&&(_0x4e581=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x154fff,_0x4e581);}updateChangeGroups(_0x1609a3){const _0x15e173=this['parsedContent']['get'](_0x1609a3)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x1609a3,_0x15e173),this['changeGroups']=[],0x0==_0x15e173['childNodes']['length'])return;on(this['documentContextContent']['get'](_0x1609a3),this['parsedMergedContent']['get'](_0x1609a3));const _0x3372c9=_0x285f11(this['documentContextContent']['get'](_0x1609a3)['children']['map'](_0x2f1137=>({'node':_0x2f1137,'id':Ps(_0x2f1137,'data-id')})),_0x15e173['children']['map'](_0x4f4b09=>({'node':_0x4f4b09,'id':Ps(_0x4f4b09,'data-id')||kt()})),{'comparator':(_0x9a94b4,_0x3db289)=>_0x9a94b4['id']==_0x3db289['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x3372c9['length']&&_0x3372c9[_0x3372c9['length']-0x1]['removed'];)_0x3372c9['pop']();}const _0x56d6b1=_0x3372c9['map'](_0x5486ee=>{const _0x275a32=_0x5486ee['added']?'new':_0x5486ee['removed']?'removed':'modified';return{'node':_0x5486ee['value'][0x0]['node'],'type':_0x275a32,'id':_0x5486ee['value'][0x0]['id']};}),_0x3947fb=this['_documentIdToSource']['get'](_0x1609a3);this['changeGroups']['push']({'changes':_0x56d6b1,'state':'pending','index':this['changeGroups']['length'],'editor':_0x3947fb['editor'],'rootName':_0x3947fb['rootName'],'documentId':_0x1609a3});}_getDifferentChangeGroups(_0x5a5e95,_0xcaef96){return _0xcaef96;}},hh=class extends Fn{content;['version'];editor;rootName;actionName;['args'];['userMessage'];['model'];contexts;['hasError']=!0x1;stoppedExplicitly=!0x1;constructor(_0x1ffdcb){super(_0x1ffdcb),this['content']=_0x1ffdcb['content'],this['version']=_0x1ffdcb['version'],this['editor']=_0x1ffdcb['editor'],this['rootName']=_0x1ffdcb['rootName'],this['actionName']=_0x1ffdcb['actionName'],this['args']=_0x1ffdcb['args'],this['userMessage']=_0x1ffdcb['userMessage'],this['model']=_0x1ffdcb['model'],this['contexts']=_0x1ffdcb['contexts'],this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}sendRequest(){return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args'],'contexts':this['contexts']}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html','contexts':this['contexts']});}getDocumentContext(){return{'type':'document','documents':[{'id':this['id'],'content':this['content'],'version':this['version'],'rootName':this['rootName'],'sessionId':kt(),'channelId':this['editor']['config']['get']('collaboration.channelId'),'selectionSignature':''}],'label':'Current\x20document','uiId':'current-document'};}createReply(_0x1e5be7){const _0x1f4ba7=this['editor']['config']['get']('collaboration.channelId'),_0x310663=new ah({..._0x1e5be7,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x1f4ba7,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x1f4ba7,this['editor']]])});return this['replies']['push'](_0x310663),_0x310663['delegate'](...Gn)['to'](this),this['fire']('replyCreated',_0x310663),_0x310663;}},ch=class extends _0x24660c{constructor(_0x180b8f,_0x1b4324=!0x0,_0x3e1500=!0x0){super(_0x180b8f),this['set']('isEnabled',!0x1),_0x1b4324&&(this['applyButton']=this['_createButton'](Es(_0x180b8f,'AI_BALLOON_APPLY_BUTTON'),Ln),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x3e1500&&(this['suggestButton']=this['_createButton'](Es(_0x180b8f,'AI_BALLOON_SUGGEST_BUTTON'),_0x1b4324?Pn:Ln),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x1b4324,'showSuggestButton':_0x3e1500}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}setButtonsVisibility({showApplyButton:_0x2d54b8,showSuggestButton:_0x3a07e9}){this['applyButton']&&(this['applyButton']['isVisible']=_0x2d54b8),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x3a07e9);}_createButton(_0x20f004,_0x468246){const _0x38c1d6=new Mt(this['locale']);return _0x38c1d6['set']({'label':_0x20f004,'class':_0x468246,'isVisible':!0x0,'withText':!0x0}),_0x38c1d6;}},lh=class extends _0x4ff2da{constructor(_0x2357c9){super(_0x2357c9),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':Es(_0x2357c9,'AI_DISCLAIMER_TEXT')}]}]});}},uh=class extends _0x4ff2da{constructor(_0x2dae1e){super(_0x2dae1e),this['set']('isVisible',!0x0);const _0x26ed9b=new Dr('small');_0x26ed9b['isVisible']=!0x0;const _0x34b9a4=new _0x4ff2da(this['locale']);_0x34b9a4['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[Es(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x5813df=>!_0x5813df)]},'children':[_0x26ed9b,_0x34b9a4]});}},dh=class extends Ma{['focusCycler'];['_config'];_contentWrapper;_streamableContentView;_toolbarView;['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];_keystrokes;_dialogContent;['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];_navigationPreviousButton;_navigationNextButton;_navigationTryAgainButton;_navigationCounter;constructor(_0x1e15ce,_0x197b55){super(_0x1e15ce),this['set']('isBusy',!0x1),this['set']('isTargetReadOnly',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x197b55,this['_focusTracker']=new _t(),this['_keystrokes']=new gt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x50bc02(),this['_addContentWrapper'](_0x197b55),this['_addDisclaimerView'](),this['_addToolbar'](_0x197b55),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'](_0x197b55);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x399aa0 of this['_focusables'])this['_focusTracker']['add'](_0x399aa0['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}destroy(){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x13e146){-0x1===_0x13e146?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}setIsLoading(_0x27785e){this['_isLoading']=_0x27785e;}setErrorState(){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}clearErrorState(){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x1fe979){super['showError'](_0x1fe979),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x222185){super['showBlockingError'](_0x222185),this['setErrorState']();}addMiniToolbarItem(_0x3353d2){this['_miniToolbarView']['items']['has'](_0x3353d2)||this['_miniToolbarView']['items']['add'](_0x3353d2);}removeMiniToolbarItem(_0x434dd2){this['_miniToolbarView']['items']['has'](_0x434dd2)&&this['_miniToolbarView']['items']['remove'](_0x434dd2);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}_toggleToolbarButtonsVisibility({showApplyButton:_0x88f90f,showSuggestButton:_0x9be7e5}){_0x88f90f=_0x88f90f&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x9be7e5=_0x9be7e5&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x88f90f,'showSuggestButton':_0x9be7e5});}async updateContent(_0x4fa827){await this['_streamableContentView']['update'](_0x4fa827);}finalizeContent(){this['_streamableContentView']['cleanUpStreamingArtifacts']();}clearContent(){this['_streamableContentView']['clear']();}_addContentWrapper(_0x2b8cf1){this['_contentWrapper']=new _0x4ff2da(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'](_0x2b8cf1['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new lh(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x42bc9e,showSuggestButton:_0x1d81e5}){this['_toolbarView']=new ch(this['locale'],_0x42bc9e,_0x1d81e5),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',this,'isTargetReadOnly',(_0x4254e5,_0x16e3e9,_0x2cc9a3,_0x28a99f)=>!(_0x4254e5||_0x16e3e9||_0x2cc9a3||_0x28a99f)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x42bc9e,'showSuggestButton':_0x1d81e5}),this['_dialogContent']['add'](this['_toolbarView']);}_createMiniToolbar(_0x4829f4){return this['_miniToolbarView']=new Ba(this['locale'],_0x4829f4),this['_miniToolbarView']['delegate'](...ir)['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',(_0x108c8c,_0x244184)=>!(_0x108c8c||_0x244184)),this['_miniToolbarView'];}_createLoaderView(){return this['_loaderView']=new uh(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}_createStreamableContentView(){return this['_streamableContentView']=new mr(this['locale']),this['_streamableContentView'];}_setupMiniToolbarButtons(){const _0x17b1b8=new Mt(this['locale']),_0x1c4684=new Mt(this['locale']),_0xd1020c=new _h(this['locale']),_0x5a45cb=new Mt(this['locale']);_0x17b1b8['set']({'icon':_0x1de2fd,'label':Es(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Dn}),_0x1c4684['set']({'icon':_0x202389,'tooltip':Es(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Dn}),_0x5a45cb['set']({'icon':_0x4cec77,'tooltip':Es(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Dn}),_0x17b1b8['bind']('isEnabled')['to'](this,'isBusy',_0x3dec32=>!_0x3dec32),_0x17b1b8['on']('execute',()=>{this['fire']('tryAgain');}),_0x1c4684['bind']('isEnabled')['to'](this,'isBusy',_0x379f8f=>!_0x379f8f),_0x1c4684['on']('execute',()=>{this['fire']('showPrevious');}),_0x5a45cb['bind']('isEnabled')['to'](this,'isBusy',_0x1da24c=>!_0x1da24c),_0x5a45cb['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x1c4684,this['_navigationCounter']=_0xd1020c,this['_navigationNextButton']=_0x5a45cb,this['_navigationTryAgainButton']=_0x17b1b8;}updateMiniToolbarButtons(_0x974a50,_0x34383b){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x37d534=_0x974a50>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x37d534){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x4a96ad=_0x974a50-_0x34383b;this['_navigationCounter']['setInteractionCount'](_0x4a96ad+'/'+_0x974a50),this['_navigationPreviousButton']['isEnabled']=_0x34383b<_0x974a50-0x1,this['_navigationNextButton']['isEnabled']=_0x34383b>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(_0xa56728){this['_isLoading']=_0xa56728;}resetShowChangesButton(){this['_miniToolbarView']['isShowChangesOn']=!0x1;}_setupMiniToolbarPositioning(){const _0x557e27=this['_streamableContentView']['element'],_0x359adf=this['_miniToolbarView']['element'],_0x54f812=()=>{wt['window']['requestAnimationFrame'](()=>{const _0x5bacbf=_0x557e27['offsetWidth']-_0x557e27['clientWidth'];_0x359adf['style']['right']='calc('+_0x5bacbf+'px\x20+\x20var(--ck-spacing-large))';});};_0x54f812(),this['_miniToolbarResizeObserver']=new pt(_0x557e27,()=>{_0x54f812();});}_initializeScrollManager(){const _0x306ed2=this['_getScrollableElement']();_0x306ed2&&!this['_scrollManager']&&(this['_scrollManager']=new ao(_0x306ed2));}_getScrollableElement(){return this['_streamableContentView']['element'];}},_h=class extends _0x4ff2da{constructor(_0x3d344a){super(_0x3d344a);const _0xc324e8=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0xc324e8['to']('interactionCount')}]});}setInteractionCount(_0x19e3b4){this['set']('interactionCount',_0x19e3b4);}},gh=class extends _0x19488e{static get requires(){return[Is,Nn,Ut,tn,Va,_0x5388eb];}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(_0x264ea5){super(_0x264ea5),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['_reporter']=this['editor']['plugins']['get'](Nn)['createReporter']('aiactions'),this['set']('isBusy',!0x1),this['_promiseQueue']=new Sr();}stopInteraction(){this['_stopInteraction']();}async executeAction(_0x29a0b5,_0x12e06c,_0x4445cf){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0xfaffd6,anchorData:_0x7b9a14,root:_0x2b7386}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x29a0b5,_0xfaffd6,_0x7b9a14,_0x2b7386,_0x12e06c,_0x4445cf);}const {modelFragment:_0x1714b9,anchorData:_0x204c68,root:_0x2504f1}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x29a0b5,_0x1714b9,_0x204c68,_0x2504f1,_0x12e06c,_0x4445cf);}async destroy(){return this['_stopInteraction'](),super['destroy']();}_createActionsBalloonView(){const _0x2b0920=this['editor']['plugins']['has']('TrackChanges');let _0x56ab8c=this['editor']['config']['get']('ai.availableReplyActions')||[...Or];_0x2b0920||(_0x56ab8c=_0x56ab8c['filter'](_0xd1a89a=>'insertSuggestion'!=_0xd1a89a));const _0x153568=this['editor']['commands']['get']('trackChanges'),_0x4760f3=new dh(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x2b0920,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x56ab8c});return _0x4760f3['bind']('isBusy')['to'](this),_0x4760f3['bind']('isTargetReadOnly')['to'](this['editor'],'isReadOnly'),_0x153568&&_0x4760f3['bind']('isTrackChangesOn')['to'](_0x153568,'value'),_0x4760f3['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x4760f3['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x4760f3['on']('showNext',()=>{this['_navigateToNext']();}),_0x4760f3;}_normalizeSelectionStart(){const _0x35c720=this['editor']['model'],_0x110fa0=_0x35c720['document']['selection'],_0x4c6874=_0x110fa0['getFirstRange']();if(!_0x4c6874||_0x4c6874['isCollapsed'])return;const _0x4a4848=mt(_0x110fa0['getSelectedBlocks']());if(!_0x4a4848)return;const _0x2a275c=_0x35c720['createPositionAt'](_0x4a4848,0x0);_0x2a275c['isAfter'](_0x4c6874['start'])&&_0x35c720['change'](_0xd22507=>{_0xd22507['setSelection'](_0xd22507['createRange'](_0x2a275c,_0x4c6874['end']));});}_getExecuteDataRegular(){const _0xafe90c=this['editor']['model']['document']['selection'],_0x4dd915=_0xafe90c['getFirstRange']()['start']['root'];if(_0xafe90c['isCollapsed']){const _0x438eb9=mt(_0xafe90c['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0xafe90c);this['editor']['model']['change'](_0x55985b=>{_0x55985b['setSelection'](_0x438eb9,'in');});}this['_normalizeSelectionStart']();const _0x12284d=_0xafe90c['getFirstRange'](),_0x4d4641=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0xafe90c),_0x12284d['start'],_0x12284d['end']);this['_copyMarkersToFragment'](_0x4d4641,_0xafe90c,{'isTableSelection':!0x1});const _0x2da9a0=_0xafe90c['getFirstRange']()['start'],_0x2ce2db=new Map();let _0x18ef1d=_0x4d4641;for(let _0x296f2f=0x0;_0x296f2f<_0x2da9a0['path']['length'];_0x296f2f++)_0x2ce2db['set'](_0x18ef1d,_0x2da9a0['path'][_0x296f2f]),_0x18ef1d=_0x18ef1d['getChild'](0x0);return{'modelFragment':_0x4d4641,'anchorData':_0x2ce2db,'root':_0x4dd915};}_getExecuteDataInTable(){const _0x59f3a4=this['editor']['model']['document']['selection'],_0x480629=this['editor']['plugins']['get']('TableSelection'),_0x4c4733=_0x59f3a4['getFirstRange']()['start']['root'],_0x82ca7a=_0x480629['getSelectionAsFragment'](),_0x6c7901=_0x59f3a4['getFirstRange']()['start']['parent']['parent'],_0x5495f7=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x6c7901),this['editor']['model']['createPositionAfter'](_0x6c7901)),_0x5b7576=this['_wrapWithCommonAncestors'](_0x82ca7a,_0x5495f7['start'],_0x5495f7['end']);this['_copyMarkersToFragment'](_0x5b7576,_0x59f3a4,{'isTableSelection':!0x0});const _0x3ee594=_0x59f3a4['getFirstRange']()['start'],_0xeee3c3=new Map();let _0x75e050=_0x5b7576;for(let _0x396b0f=0x0;_0x396b0f<_0x3ee594['path']['length'];_0x396b0f++)if(_0xeee3c3['set'](_0x75e050,_0x3ee594['path'][_0x396b0f]),_0x396b0f<_0x3ee594['path']['length']-0x1)_0x75e050=_0x75e050['getChild'](0x0);else{let _0x212fcb=_0x75e050['nextSibling'];for(;_0x212fcb;)_0xeee3c3['set'](_0x212fcb,_0x3ee594['path'][_0x396b0f]),_0x212fcb=_0x212fcb['nextSibling'];}return{'modelFragment':_0x5b7576,'anchorData':_0xeee3c3,'root':_0x4c4733};}async _executeAction(_0x496338,_0x1fb741,_0x397224,_0x475e83,_0x2c877a,_0x585d7c){const _0x2bf472=this['editor']['plugins']['get'](tn),_0x35c8b5=this['editor']['plugins']['get'](Va),_0x24382d=this['editor']['model']['document']['selection'],_0x3454d8=await _0x2bf472['modelToDataWithIds'](_0x1fb741,this['editor'],_0x475e83['rootName']),_0x1b21a8=this['editor']['model']['document']['version'],_0x5c71f5=[..._0x24382d['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x35c8b5['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x2c877a,'icon':_0x585d7c||_0x13034c,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x5c71f5,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x35c8b5),this['_interactionParams']={'action':_0x496338,'content':_0x3454d8,'version':_0x1b21a8,'aiBalloon':_0x35c8b5,'modelFragment':_0x1fb741,'anchorData':_0x397224,'root':_0x475e83},this['_setupApplyListeners'](),this['listenTo'](_0x35c8b5,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x35c8b5,'dialogClosed',(_0x1fbdff,{id:_0x202318})=>{if('aiActionsBalloon'===_0x202318){for(const _0x153196 of this['_interactions']){if(0x0===_0x153196['replies']['length']||_0x153196['stoppedExplicitly'])continue;const _0x996862=_0x153196['replies'][_0x153196['replies']['length']-0x1],_0x51d5e7=_0x996862['changeGroups'][0x0];_0x51d5e7&&'pending'===_0x51d5e7['state']&&_0x996862['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x35c8b5);}}),this['_createInteraction'](_0x3454d8,_0x1b21a8,_0x35c8b5,_0x496338);}_setupApplyListeners(){if(!this['_interactionParams'])return;const {modelFragment:_0xe52b9e,anchorData:_0x1874de,root:_0x3b6154}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0xe52b9e,_0x1874de,_0x3b6154,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0xe52b9e,_0x1874de,_0x3b6154,!0x0);});}_wrapWithCommonAncestors(_0xc8bce7,_0x300e0f,_0x984271){const _0x19ddb1=this['editor']['model']['createRange'](_0x300e0f,_0x984271)['getCommonAncestor'](),_0x417540=_0x19ddb1['is']('documentFragment')?[]:_0x19ddb1['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x417540['length']){const _0x1e067b=_0x417540['map'](_0x1c7a7c=>_0x1c7a7c['_clone'](!0x1));for(let _0x238bab=0x1;_0x238bab<_0x1e067b['length'];_0x238bab++)_0x1e067b[_0x238bab-0x1]['_appendChild'](_0x1e067b[_0x238bab]);return _0x1e067b[_0x1e067b['length']-0x1]['_appendChild'](_0xc8bce7),new _0x5eb9f7(_0x1e067b[0x0]);}return _0xc8bce7;}_copyMarkersToFragment(_0x1f3f66,_0x6342fe,_0x2e76b0={'isTableSelection':!0x1}){const _0x599917=this['editor']['model'],_0x2406e0=Array['from'](_0x6342fe['getRanges']()),_0x47e218=_0x6342fe['getFirstRange']()['start'];for(const _0x6518f5 of _0x599917['markers']){if(_0x6518f5['name']['startsWith']('ai-selection')||!_0x6518f5['affectsData'])continue;const _0x7f564f=_0x6518f5['getRange']();if(!_0x2406e0['some'](_0x51d46b=>_0x51d46b['containsRange'](_0x7f564f,!0x0)))continue;const _0x9884d2=this['_regularCalculateMarkerPath'](_0x7f564f['start'],_0x47e218,_0x2e76b0['isTableSelection']),_0x425287=this['_regularCalculateMarkerPath'](_0x7f564f['end'],_0x47e218,_0x2e76b0['isTableSelection']),_0x1c60d2=_0x599917['createPositionFromPath'](_0x1f3f66,_0x9884d2),_0x4013d1=_0x599917['createPositionFromPath'](_0x1f3f66,_0x425287);if(!_0x1c60d2['isEqual'](_0x4013d1)){const _0x7a02fd=_0x599917['createRange'](_0x1c60d2,_0x4013d1);_0x1f3f66['markers']['set'](_0x6518f5['name'],_0x7a02fd);}}}_regularCalculateMarkerPath(_0x20458,_0xd616c8,_0x5e8cfa=!0x1){const _0x2d9408=[..._0x20458['path']['slice']()];for(let _0x5e77d4=0x0;_0x5e77d4<Math['max'](_0xd616c8['path']['length'],_0x20458['path']['length']);_0x5e77d4++){const _0x1198fe=_0xd616c8['path'][_0x5e77d4]||0x0,_0x15def9=(_0x20458['path'][_0x5e77d4]||0x0)-_0x1198fe;if(_0x2d9408[_0x5e77d4]=_0x15def9,0x0!==_0x15def9&&!_0x5e8cfa)break;}return _0x2d9408;}async _createInteraction(_0x152551,_0x4de9ab,_0x3479a7,_0xabed0d){const _0x28fe67=this['editor'],_0x421604=_0x28fe67['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0xabed0d,'content':_0x152551,'version':_0x4de9ab,'aiBalloon':_0x3479a7,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x421604});const _0x4a2cd8=new hh({'connector':this['_aiConnector'],'locale':_0x28fe67['locale'],'content':_0x152551,'version':_0x4de9ab,'editor':_0x28fe67,'rootName':_0x421604['rootName'],..._0xabed0d});this['_interactions']['push'](_0x4a2cd8);const _0x2fbe23=(_0x396360,_0x253194=!0x1,_0x20e050='streaming')=>{const {isDone:_0x475d7d}=_0x396360;return this['_promiseQueue']['enqueue'](async _0x30fb98=>{try{if(this['_isUnsupportedInlineRootChange'](_0x396360,_0x421604))return this['_actionsBalloonView']['showBlockingError'](Es(_0x28fe67['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')),void(_0x475d7d&&this['_actionsBalloonView']['finalizeContent']());const _0x3aa63b=ln({'changeGroups':_0x396360['changeGroups'],'documentContextContent':_0x396360['documentContextContent'],'showDiff':_0x253194,'trimUnchanged':!0x1});_0x3aa63b['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x3aa63b[0x0],'renderingStrategy':_0x20e050,'abortSignal':_0x30fb98}),_0x475d7d&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x35e57a){if(kn(_0x35e57a))return;throw _0x35e57a;}});};_0x4a2cd8['on']('replyCreated',(_0x5bce37,_0x5d4e81)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x2fbe23(_0x5d4e81)['catch'](_0x557c75=>{this['_reporter']['logError'](_0x557c75,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x4a2cd8,_0x557c75);});}),_0x4a2cd8['on']('replyContentUpdated',(_0x1afea9,_0x48831f)=>{_0x2fbe23(_0x48831f)['catch'](_0x1c2038=>{this['_reporter']['logError'](_0x1c2038,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x4a2cd8,_0x1c2038);});}),_0x4a2cd8['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x32c0f2){this['_reporter']['logError'](_0x32c0f2,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x4a2cd8,_0x32c0f2);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x1f18d2,{showDiff:_0x1219bb})=>{try{this['_balloonShowDiff']=_0x1219bb;const _0xc7632=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0xc7632&&await _0x2fbe23(_0xc7632,_0x1219bb,'static');}catch(_0x3b68d3){this['_reporter']['logError'](_0x3b68d3,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x4a2cd8,_0x3b68d3);}}),_0x4a2cd8['on']('replyChangeGroupStateUpdated',()=>{const _0x10006b={'positiveCount':_0x4a2cd8['replies']['reduce']((_0x1ef6ee,_0x3e77c3)=>_0x1ef6ee+_0x3e77c3['changeGroups']['filter'](_0x1de771=>'accepted'===_0x1de771['state'])['length'],0x0),'totalCount':_0x4a2cd8['replies']['reduce']((_0x37be35,_0x546ce7)=>_0x37be35+_0x546ce7['changeGroups']['length'],0x0)},_0x482080=_0x4a2cd8['actionCallId'],_0x2cd47d=_0x4a2cd8['actionName'];_0x2cd47d?this['_aiConnector']['upsertAIActionRating'](_0x2cd47d,_0x482080,_0x10006b):this['_aiConnector']['upsertCustomAIActionRating'](_0x482080,_0x10006b);}),this['_setLoadingState']();try{const _0x117c86=await _0x4a2cd8['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x117c86;}catch(_0x1891c3){kn(_0x1891c3)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x1891c3,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x4a2cd8,_0x1891c3);}}_isUnsupportedInlineRootChange(_0x297b3d,_0x4dbf4d){const _0x275c06=this['editor'];return!!Gs(_0x275c06,_0x4dbf4d['rootName'])&&!Ys(_0x275c06,new _0x35605c((_0x297b3d['changeGroups'][0x0]?.['changes']??[])['filter'](_0x801b0f=>'removed'!==_0x801b0f['type'])['map'](_0x3f8e18=>_0x3f8e18['node']['cloneNode'](!0x0))));}['_applyChanges'](_0x471f0c,_0x138c45,_0x172a39,_0x4e2893){const _0x5ebd0f=this['editor'];if(_0x4e2893&&!_0x5ebd0f['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',null);const _0x269dee=this['editor']['plugins']['get'](_0x5388eb),_0x5c4a5d=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x5c4a5d||!_0x5c4a5d['replies']['length'])return;const _0x24b06f=_0x5c4a5d['replies'][_0x5c4a5d['replies']['length']-0x1];if(this['_isUnsupportedInlineRootChange'](_0x24b06f,_0x172a39))return void this['_actionsBalloonView']['showBlockingError'](Es(_0x5ebd0f['locale'],'AI_SUGGESTION_NO_PARTS_WARNING'));_0x24b06f['setChangeGroupState'](0x0,'accepted');const _0x37907b=Jn({'documentSuggestions':Zn({'groups':[_0x24b06f['changeGroups'][0x0]],'documentContextContent':_0x24b06f['documentContextContent'],'documents':_0x5c4a5d['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x269dee,'documentCompareOptions':{'anchor':_0x5ebd0f['model']['createPositionAt'](_0x471f0c,0x0),'markDeletions':_0x4e2893}})['values']()['next']()['value']??[],_0x1a2f65=this['_filterOperationsOutsideRange'](_0x37907b,_0x138c45);for(const _0x444030 of _0x1a2f65)this['_anchorOperation'](_0x138c45,_0x444030,_0x172a39);const _0x3e3ab2=_0x5c4a5d['getDocumentContext']()['documents'][0x0]['version'],_0x5e0bad=_0x3b7a23(_0x1a2f65,_0x5ebd0f['model']['document']['history']['getOperations'](_0x3e3ab2),{'document':_0x5ebd0f['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];mn(_0x5e0bad,'quickActions');try{_0x5ebd0f['model']['change'](_0x2bb4bc=>{_0x2bb4bc['setSelection'](_0x5ebd0f['model']['document']['selection']['focus']),_0x4e2893?_0x5ebd0f['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x5e0bad):_0x269dee['applyOperations'](_0x2bb4bc,_0x5e0bad);});}catch(_0x5cee14){throw this['_reporter']['logError'](new yn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x5cee14})),_0x5cee14;}this['editor']['plugins']['get']('AIBalloon')['close']();}_filterOperationsOutsideRange(_0x1b0106,_0x352fc5){return _0x1b0106['filter'](_0x1bcf02=>{if('rename'==_0x1bcf02['type']){const _0x3c3edb=_0x1bcf02['position']['nodeAfter'];return!_0x352fc5['has'](_0x3c3edb);}if(_0x1bcf02['type']['indexOf']('Attribute')>-0x1){const _0xbf72e3=_0x1bcf02['range']['start']['nodeAfter'];return!_0x352fc5['has'](_0xbf72e3);}return!0x0;});}_anchorOperation(_0x3dd2b0,_0x291197,_0x4b7bc4){const _0x80d6b2=_0x291197['clone']();for(const _0x306b15 in _0x291197){const _0x2b742e=_0x291197[_0x306b15];_0x2b742e instanceof _0x2af2ad?_0x291197[_0x306b15]=new _0x2af2ad(_0x30581c(_0x2b742e['start']),_0x30581c(_0x2b742e['end'])):_0x2b742e instanceof _0x53921a&&(_0x291197[_0x306b15]=_0x30581c(_0x2b742e));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x80d6b2['type'])){if(_0x80d6b2['isDocumentOperation']=!0x1,_0x80d6b2['baseVersion']=null,'remove'==_0x80d6b2['type']){const _0x18441c=_0x80d6b2['sourcePosition'],_0x35e2b6=_0x80d6b2['howMany'];new _0x19e331(_0x18441c,_0x35e2b6)['_execute']();}else _0x80d6b2['_execute']();}function _0x30581c(_0x20db85){if('$graveyard'==_0x20db85['root']['rootName'])return _0x20db85;const _0x5500eb=[];let _0x44a695=_0x20db85['root'];for(let _0x29e905=0x0;_0x29e905<_0x20db85['path']['length'];_0x29e905++){const _0x1029d7=_0x3dd2b0['get'](_0x44a695)||0x0;_0x5500eb[_0x29e905]=_0x20db85['path'][_0x29e905]+_0x1029d7,_0x44a695=_0x44a695['getChildAtOffset'](_0x20db85['path'][_0x29e905]);}return new _0x53921a(_0x4b7bc4,_0x5500eb,_0x20db85['stickiness']);}}_refreshInteraction(){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x37f6f2,content:_0x109d3a,version:_0x25e383,aiBalloon:_0x23030b}=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'](_0x109d3a,_0x25e383,_0x23030b,_0x37f6f2)['catch'](_0x4014b8=>{this['_reporter']['logError'](_0x4014b8,{'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 _0x1d2466=this['_interactions']['length'];this['_currentInteractionIndex']<_0x1d2466-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}_navigateToNext(){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async _displayInteractionAtIndex(_0x11e668){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x11e668;const _0x36000b=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x36000b)return;if(_0x36000b['hasError'])return this['_setErrorState'](_0x36000b),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x36000b['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x3219e2=_0x36000b['replies'][_0x36000b['replies']['length']-0x1];if(_0x3219e2)try{const _0x289a46=ln({'changeGroups':_0x3219e2['changeGroups'],'documentContextContent':_0x3219e2['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x505d53=>setTimeout(_0x505d53,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x289a46[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x3e2e4d){this['_reporter']['logError'](_0x3e2e4d,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}_setLoadingState(){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async _setErrorState(_0x2bdff9,_0x210cf5){if(void 0x0!==_0x210cf5&&kn(_0x210cf5))return;const _0x275359=Es(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x275359),_0x2bdff9['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);}},Ah=class extends _0x19488e{static get requires(){return[ih,oh,gh];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x35f449){super(_0x35f449),_0x35f449['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Ih=class extends _0x4ff2da{resultResponseView;acceptButtonView;dismissButtonView;infoButtonView;outdatedButtonView;constructor(_0x340ca0,_0x750bd7){super(_0x340ca0),this['id']=_0x750bd7,this['set']('status','pending'),this['set']('changeId',_0x750bd7),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',(_0xff00c2,_0x5a378b)=>{_0x5a378b&&_0x5a378b['target']&&'A'===_0x5a378b['target']['tagName']&&_0x5a378b['preventDefault'](),this['fire']('activateChange',{'id':_0x750bd7,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x750bd7,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x750bd7,'source':this});}),this['on']('change:showDiff',()=>this['_syncResponseVisibility']());}['render'](){super['render'](),this['_syncResponseVisibility']();}setItemAsActive(){this['isActive']=!0x0;}setItemAsInactive(){this['isActive']=!0x1;}_createResultResponseView(){const _0x55b5d2=new _0x4ff2da(this['locale']);return _0x55b5d2['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response']}}),_0x55b5d2;}updateResponseContent(_0x1adfdb,_0x420cd0){const _0x172e9e=_0x420cd0||'div',_0x3798cb=this['resultResponseView']['element'];if(_0x3798cb['tagName']['toLowerCase']()!==_0x172e9e){const _0x40582d=new _0x4937f3({'tag':_0x172e9e,'attributes':{'class':_0x3798cb['className']}})['render']();_0x3798cb['replaceWith'](_0x40582d),this['resultResponseView']['element']=_0x40582d,this['_syncResponseVisibility']();}this['resultResponseView']['element']['innerHTML']=_0x1adfdb;}_syncResponseVisibility(){this['resultResponseView']['element']?.['classList']['toggle']('ck-hidden',!this['showDiff']);}_createAcceptButtonView(){const _0x2d6262=new Mt(this['locale']);return _0x2d6262['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x2d6262['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x567339=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x567339['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x12b7f1=>'pending'!==_0x12b7f1&&'accepted'!==_0x12b7f1),this['bindTemplate']['if']('status',Pn,_0x428605=>'pending'===_0x428605),this['bindTemplate']['if']('status',Dn,_0x41af18=>'pending'!==_0x41af18),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x41bcef=>'accepted'===_0x41bcef)]}}),this['on']('change:status',(_0x569b54,_0x38518b,_0x72b25b)=>{_0x2d6262['isEnabled']='pending'===_0x72b25b,'accepted'===_0x72b25b&&(_0x2d6262['label']=Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x2d6262['icon']=_0x5517bf);}),_0x2d6262;}_createDismissButtonView(){const _0x2285b8=new Mt(this['locale']);return _0x2285b8['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x2285b8['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x592235=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x592235['stopPropagation']();})},'attributes':{'class':[Dn,this['bindTemplate']['if']('status','ck-hidden',_0x2a8a9a=>'pending'!==_0x2a8a9a&&'rejected'!==_0x2a8a9a),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x2cbeb8=>'pending'===_0x2cbeb8),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x2e2d4a=>'rejected'===_0x2e2d4a)]}}),this['on']('change:status',(_0x448647,_0xd0f2ef,_0x5464ff)=>{_0x2285b8['isEnabled']='pending'===_0x5464ff,'rejected'===_0x5464ff&&(_0x2285b8['label']=Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x2285b8['icon']=_0xabec2d);}),_0x2285b8;}_createInfoButtonView(){const _0x424653=new Mt(this['locale']);return _0x424653['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x4790d7,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Dn+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x424653['bind']('isOn')['to'](this,'isInfoToggleOn',_0x37a330=>_0x37a330),_0x424653['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x424653;}_createOutdatedButtonView(){const _0x479568=new Mt(this['locale']);return _0x479568['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0xa15aa9,'withText':!0x0,'isEnabled':!0x1}),_0x479568['extendTemplate']({'attributes':{'class':[Dn,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x5bf8e4=>'outdated'!==_0x5bf8e4)],'disabled':'disabled'}}),_0x479568;}},ph=class extends xt{resultItemView;_pinnedRectIndex=void 0x0;_pinnedTargetElement=void 0x0;_pinnedTargetChangeId=void 0x0;constructor(_0x5d8a10,_0x2dfb83){super(_0x5d8a10),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']()),_0x2dfb83['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}updateContent(_0x3c41ca){this['resultItemView']['changeId']=_0x3c41ca['id'],this['resultItemView']['updateResponseContent'](_0x3c41ca['contentDiffed'],_0x3c41ca['wrapperTag']);}['showBalloon'](_0x403230,_0x6cd6ef,_0x471964,_0x4dba93,_0x5130ca,_0x3af775){const _0xfdc402=_0x6cd6ef();if(!_0xfdc402)return;this['updateContent'](_0x403230),this['show']();const _0x9e90ed=Array['from'](_0xfdc402['getClientRects']())['reverse'](),_0x10628e=this['_getPointedRectIndexFromEvent'](_0x471964,_0x9e90ed),_0x2f4e2f=_0x9e90ed[_0x10628e??0x0];'click'===_0x4dba93?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x6cd6ef(),_0x10628e,_0x403230['id'],_0x5130ca,_0x3af775)||_0x2f4e2f})):'hover'===_0x4dba93&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x6cd6ef(),_0x10628e,_0x403230['id'])||_0x2f4e2f}));}['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(){_0x341840({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x5cb3b3=[this['element']];return this['_pinnedTargetElement']&&_0x5cb3b3['push'](this['_pinnedTargetElement']),_0x5cb3b3;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}_createContentView(){const _0x5aec1c=new _0x4ff2da();return this['resultItemView']=new Ih(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x5aec1c['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']]}]}),_0x5aec1c;}_getBestRectPositionOnClick(_0x3814f4,_0x4a9acd,_0x1161bb,_0x3b2c55,_0x4f3e51){if(!_0x3814f4)return null;const _0x1b843f=this['position']['replace']('arrow_',''),_0x295f96=Array['from'](_0x3814f4['getClientRects']());let _0x39653c,_0x24611b=_0x295f96['reverse']();return void 0x0!==_0x4a9acd&&this['_isPinnedRectVisible'](_0x24611b[_0x4a9acd],_0x3b2c55,_0x4f3e51)?(_0x39653c=_0x24611b[_0x4a9acd],this['_pinnedRectIndex']=_0x4a9acd):this['_isPinnedRectVisible'](_0x24611b[0x0],_0x3b2c55,_0x4f3e51)&&void 0x0===_0x4a9acd?_0x39653c=_0x24611b[0x0]:(_0x24611b='s'==_0x1b843f[0x0]?[..._0x295f96]['reverse']():_0x295f96,_0x24611b['forEach'](_0x125c20=>{this['_isPinnedRectVisible'](_0x125c20,_0x3b2c55,_0x4f3e51)&&(_0x39653c=_0x125c20);})),this['_pinnedTargetChangeId']=_0x1161bb,this['_pinnedTargetElement']=_0x3814f4,_0x39653c||_0x3814f4['getBoundingClientRect']();}_getBestRectPositionOnHover(_0x3d337c,_0x179a35,_0x1e3bab){if(!_0x3d337c)return null;const _0x549dfa=Array['from'](_0x3d337c['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x179a35&&this['_pinnedTargetChangeId']!==_0x1e3bab?(this['_pinnedRectIndex']=_0x179a35,this['_pinnedTargetElement']=_0x3d337c,this['_pinnedTargetChangeId']=_0x1e3bab,_0x549dfa[_0x179a35]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x1e3bab?_0x3d337c!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x549dfa[this['_pinnedRectIndex']]:void 0x0!==_0x179a35&&this['_pinnedTargetChangeId']!==_0x1e3bab?(this['_pinnedRectIndex']=_0x179a35,this['_pinnedTargetElement']=_0x3d337c,this['_pinnedTargetChangeId']=_0x1e3bab,_0x549dfa[_0x179a35]):_0x3d337c['getBoundingClientRect']();}_getPointedRectIndexFromEvent(_0x19abe5,_0x4ea23a){if(_0x19abe5)for(let _0x22ab7f=0x0;_0x22ab7f<_0x4ea23a['length'];_0x22ab7f++){const _0xa8ad19=_0x4ea23a[_0x22ab7f];if(_0x19abe5['clientX']>=_0xa8ad19['left']-0x3&&_0x19abe5['clientX']<=_0xa8ad19['right']+0x3&&_0x19abe5['clientY']>=_0xa8ad19['top']-0x3&&_0x19abe5['clientY']<=_0xa8ad19['bottom']+0x3)return _0x22ab7f;}}_isPinnedRectVisible(_0x45f25f,_0x3841c3,_0x596055){const _0x66ccef=new It(_0x45f25f),_0x2b05b5=_0x3841c3||document['documentElement'],_0x328bad=_0x66ccef['getIntersection'](Tt(_0x596055)),_0x14463f=new It(_0x2b05b5)['getIntersection'](_0x66ccef);return!!(_0x328bad&&_0x14463f&&_0x66ccef['width']>0x0);}};const Eh=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var mh=class extends _0x212144{['_mainView'];_balloonSuggestionView;_bodyCollection;static get requires(){return[gs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x11f85c){super(_0x11f85c),this['_bodyCollection']=Mn(this['context']['locale']),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Eh)['to'](this),this['_balloonSuggestionView']=new ph(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}init(){const _0x133d97=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x133d97);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}setAvailableChecks(_0x330084){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x16e6a3=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x330084,_0x16e6a3);}this['_mainView']['showReviewCheckListView']();}showReviewCheckList(){this['fire']('getReviewCheckList');}showCheckRunResults(_0x2453a0){_0x2453a0&&('error-general'!==_0x2453a0['status']?'error-chunk'!==_0x2453a0['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}showCheckRunResult(_0x41d84b){this['_mainView']['addCheckRunResult'](_0x41d84b);}showGeneralResultsErrorView(){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x186512){this['_mainView']['showGeneralReviewCoreErrorView'](_0x186512??Es(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}showUnsupportedInlineChangeView(){this['_mainView']['showUnsupportedInlineChangeView']();}setCheckResultTitle(_0x1c476b,_0x310d4d){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x1c476b,_0x310d4d);}setAcceptAllEnabled(_0x9ff0e1){this['_mainView']['reviewCheckResultsView']['setAcceptAllEnabled'](_0x9ff0e1);}setActiveStateInResults(_0x3a1bfd){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x5651a4=>{_0x5651a4['id']===_0x3a1bfd&&_0x5651a4['setItemAsActive']();});}resetActiveStateInResults(){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x57bc61=>_0x57bc61['setItemAsInactive']());}updateChangeState(_0x110b16,_0x2669d0){'accepted'===_0x2669d0||'rejected'===_0x2669d0||'outdated'===_0x2669d0?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x110b16,_0x2669d0):this['_mainView']['reviewCheckResultsView']['showResult'](_0x110b16,_0x2669d0);}showReviewCompletedView(){this['_mainView']['showReviewCompletedView']();}showActionsWhenResultIsReady(){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}hideActionsWhenResultIsReady(){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x20ab10,_0x2f2dc2,_0x115b07,_0x514399,_0x4edd4c,_0x307f15){this['_balloonSuggestionView']['showBalloon'](_0x20ab10,_0x2f2dc2,_0x115b07,_0x514399,_0x4edd4c,_0x307f15);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}getChangeElement(_0x3ef98a){const _0x48b693=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0xb77650=>_0xb77650['id']===_0x3ef98a);return _0x48b693?_0x48b693['element']:null;}deactivateChange(){this['_balloonSuggestionView']['deactivateChange']();}},Th=class extends _0x4ff2da{constructor(_0xecd406){super(_0xecd406),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x2f7b3a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x2f7b3a['if']('isVisible','ck-hidden',_0x177b1c=>!_0x177b1c)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x2f7b3a['to']('errorMessage')}]}]});}},wh=class extends _0x4ff2da{['reviewCoreHeader'];['generalErrorView'];reviewCheckListView;reviewCheckResultsView;reviewCompletedView;constructor(_0x2f17b1,_0x98aa1d){super(_0x2f17b1),this['reviewCoreHeader']=_0x98aa1d['header'],this['generalErrorView']=new Th(_0x2f17b1),this['reviewCheckListView']=_0x98aa1d['list'],this['reviewCheckListView']['delegate'](...Eh)['to'](this),this['reviewCheckResultsView']=_0x98aa1d['results'],this['reviewCheckResultsView']['delegate'](...Eh)['to'](this),this['reviewCompletedView']=_0x98aa1d['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(_0x157585){this['reviewCheckResultsView']['addResult'](_0x157585),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'](_0x17ea9e){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x17ea9e;}showGeneralResultsErrorView(){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}showUnsupportedInlineChangeView(){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showUnsupportedInlineChangeMessage']();}},Ch=class extends Mt{constructor(_0x45e4ff,_0x29c2d5){super(_0x29c2d5),this['set']({'label':_0x45e4ff,'withText':!0x0,'class':Ln}),this['on']('execute',()=>{this['fire']('finishReview');});}},fh=class extends jt{_resultViews;_resultsHeader;_resultsBody;['reviewDisclaimer'];_cancelButtonView;_acceptAllButtonView;_exitReviewButtonView;_toggleDiffButtonView;['_errorMessageView'];_finishReviewButtonView;_contents;constructor(_0x383513,_0x2da639){super(_0x383513),this['_contents']=_0x2da639,this['_resultViews']=new _0x50bc02(),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 da(_0x383513),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),this['set']('isAcceptAllEnabled',!0x1),this['_acceptAllButtonView']['bind']('isEnabled')['to'](this,'isAcceptAllEnabled',this,'isError',(_0x28034a,_0x542648)=>_0x28034a&&!_0x542648);const _0x431439=this['_createCombinedSkeletonLoader'](),_0x1d9a47=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x1d9a47['if']('isLoading','ck-ai_review__check-run_loading',_0x5f00f1=>_0x5f00f1),_0x1d9a47['if']('isResultReady','ck-ai_review__check-run_ready',_0x55c788=>_0x55c788),_0x1d9a47['if']('isVisible','ck-hidden',_0x4556af=>!_0x4556af)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x431439,this['reviewDisclaimer']]});}clearResults(){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}getResults(){return this['_resultViews'];}addResult(_0x1021f6){const _0x1ec77f=new Ih(this['locale'],_0x1021f6['id']);_0x1ec77f['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x1ec77f),_0x1ec77f['updateResponseContent'](_0x1021f6['contentDiffed'],_0x1021f6['wrapperTag']);}hideResult(_0x5a28a0,_0xd17d78){if('pending'===_0xd17d78)return;const _0x20f974=this['_resultViews']['find'](_0x230cd0=>_0x230cd0['id']===_0x5a28a0);_0x20f974&&(_0x20f974['status']=_0xd17d78,_0x20f974['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}showResult(_0x5b0687,_0x50fa07){if('pending'!==_0x50fa07)return;const _0xed4c3a=this['_resultViews']['find'](_0x2eff85=>_0x2eff85['id']===_0x5b0687);_0xed4c3a&&(_0xed4c3a['status']=_0x50fa07,_0xed4c3a['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}setTitle(_0x46d2b7,_0x3b601f){this['headerTitle']=_0x46d2b7,this['headerSubtitle']=_0x3b601f||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}showUnsupportedInlineChangeMessage(){this['errorType']='unsupported-inline',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}resetErrorState(){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}setAcceptAllEnabled(_0x37a94c){this['isAcceptAllEnabled']=_0x37a94c;}_createSkeletonLoader(){return new wr(this['locale'],Cr['aiReviewChecks']);}_createCombinedSkeletonLoader(){const _0x1b3063=new _0x4ff2da(this['locale']),_0x2f4d1b=[];for(let _0x4856ed=0x0;_0x4856ed<0x10;_0x4856ed++){const _0x2c59df=this['_createSkeletonLoader']();_0x2c59df['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x2f4d1b['push'](_0x2c59df);}return _0x1b3063['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0xd5e942=>!_0xd5e942)]},'children':_0x2f4d1b}),_0x1b3063;}_createResultsBodyView(){const _0x1471c0=new _0x4ff2da(this['locale']);return _0x1471c0['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x45c577=>_0x45c577)]},'children':this['_resultViews']}),_0x1471c0;}_createErrorView(){const _0x26f7fa=new _0x4ff2da(this['locale']),_0x5400fb=new Mt(this['locale']),t=this['locale']['t'];return _0x26f7fa['delegate']('retryReview')['to'](this),_0x5400fb['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Pn+'\x20ck-ai_review__check-run-error-retry-button'}),_0x5400fb['on']('execute',()=>{this['fire']('retryReview');}),_0x26f7fa['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x4d9e0c=>!_0x4d9e0c),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x459293=>'chunk'===_0x459293)]},'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',_0x4da297=>'chunk'===_0x4da297||'unsupported-inline'===_0x4da297)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x48d35c=>'general'!==_0x48d35c)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x5d075b=>'chunk'!==_0x5d075b)]},'children':[{'text':Es(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0xd8eeb9=>'unsupported-inline'!==_0xd8eeb9)]},'children':[{'text':Es(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')}]}]},_0x5400fb]}),_0x26f7fa;}_createCancelButtonView(){const _0x44c4e9=new Mt(this['locale']);return _0x44c4e9['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Pn+'\x20ck-ai-button-stop-generating'],'icon':st}),_0x44c4e9['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x48a416=>_0x48a416),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5b4500=>_0x5b4500)]}}),_0x44c4e9['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x44c4e9;}_createToggleDiffButtonView(){const _0x41d68c=new Mt(this['locale']);_0x41d68c['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x41d68c['bind']('isEnabled')['to'](this,'isError',_0x529c7c=>!_0x529c7c),_0x41d68c['extendTemplate']({'attributes':{'class':[Pn,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x4f60e2=>!_0x4f60e2),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5c0473=>_0x5c0473)]}});const _0x57e803=Es(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x4ce9c4=Es(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x41d68c['bind']('isOn')['to'](this,'isToggleDiffOn',_0x59ffda=>_0x59ffda),_0x41d68c['bind']('icon')['to'](this,'isToggleDiffOn',_0xc54894=>_0xc54894?_0x1d1512:_0x2e2674),_0x41d68c['bind']('label')['to'](this,'isToggleDiffOn',_0x5602f3=>_0x5602f3?_0x57e803:_0x4ce9c4),_0x41d68c['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x41d68c;}_createAcceptAllButtonView(){const _0x560575=new Mt(this['locale']);return _0x560575['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x560575['extendTemplate']({'attributes':{'class':[Ln,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x41b7ef=>!_0x41b7ef),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x38dc51=>_0x38dc51)]}}),_0x560575['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x560575;}_createExitReviewButtonView(){const _0x13fd88=new Mt(this['locale']);return _0x13fd88['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x13fd88['extendTemplate']({'attributes':{'class':[Dn,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x52bdd6=>!_0x52bdd6),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3b4bad=>_0x3b4bad)]}}),_0x13fd88['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x13fd88;}_createResultHeaderView(){const _0x7030f8=new _0x4ff2da(this['locale']),_0x390e51=this['_createTitleView']();return _0x7030f8['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x3895b0=>_0x3895b0)]},'children':[_0x390e51,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5117b1=>!_0x5117b1)],'title':Es(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':Es(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']]}]}),_0x7030f8;}_createTitleView(){const _0x5e1a81=new _0x4ff2da(this['locale']),_0x2e7645=new Dr();return _0x2e7645['bind']('isVisible')['to'](this,'isResultReady',_0xbfa6ae=>!_0xbfa6ae),_0x5e1a81['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x53d45e=>_0x53d45e)]},'children':[_0x2e7645,{'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')}]}]}]}),_0x5e1a81;}_createFinishReviewButtonView(){const _0x3ccbab=new Ch(Es(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x3ccbab['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x300e62=>!_0x300e62)]}}),_0x3ccbab['delegate']('finishReview')['to'](this),_0x3ccbab;}},bh=class extends jt{_resultsHeader;_finishReviewButtonView;constructor(_0x1c90e0,_0x792c6e){super(_0x1c90e0),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x792c6e['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x792c6e['headerText']);const _0x336b4a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x336b4a['if']('isVisible','ck-hidden',_0x553ee2=>!_0x553ee2)]},'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':_0x792c6e['emptyResultsText']}]}]}]});}_createFinishReviewButtonView(_0x3e8456){const _0x43a5a9=new Ch(_0x3e8456,this['locale']);return _0x43a5a9['delegate']('finishReview')['to'](this),_0x43a5a9;}_createResultHeaderView(_0x45d535){const _0x57cb67=new _0x4ff2da(this['locale']);return _0x57cb67['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x45d535},'children':[{'text':_0x45d535}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x57cb67;}},Sh=class extends _0x4ff2da{['_dropdownView'];_defaultValue;_defaultLabel;constructor(_0x2fd776,_0x133955){super(_0x2fd776),this['_defaultValue']=_0x133955['default']||(_0x133955['data']['length']>0x0?_0x133955['data'][0x0]['id']:''),this['_defaultLabel']=_0x133955['data']['find'](_0x1d4962=>_0x1d4962['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x5a954d(this['locale']);const _0x670469=this['_prepareListOptions'](_0x133955['data']);_0x3196cc(this['_dropdownView'],_0x670469,{'role':'menu','ariaLabel':_0x133955['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x12833f=>{_0x12833f['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x46da17=>{this['formValue']=_0x46da17['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x46da17['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(_0x243f03=[]){const _0x3a01c0=new lt();this['resetToDefault']();for(const _0x9664fc of _0x243f03){const _0x426789=new _0xd62086({'label':_0x9664fc['label'],'withText':!0x0,'role':'menuitemradio','id':_0x9664fc['id'],'model':_0x9664fc});_0x426789['bind']('isOn')['to'](this,'formValue',_0x11a79d=>_0x11a79d===_0x426789['id']);const _0x5514db={'type':'button','model':_0x426789};_0x3a01c0['add'](_0x5514db);}return _0x3a01c0;}},Rh=class extends jt{_formItem=null;constructor(_0x3a21ee,_0x4793e8,_0x137f37){if(super(_0x3a21ee),this['argsKey']=_0x4793e8?.['argsKey'],'dropdown'===_0x4793e8['formType'])this['_formItem']=new Sh(this['locale'],_0x4793e8);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x3b586a=new Wt(this['locale'],{'children':[this['_formItem']],'class':[_0x137f37?'ck-form__row_with-submit':'']});_0x137f37&&_0x3b586a['children']['add'](_0x137f37),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x3b586a]});}resetToDefault(){this['_formItem']['resetToDefault']();}},Oh=class AIReviewCorePromptInputView extends _0x3a49c8{keystrokes;static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x5fc61c){super(_0x5fc61c),this['set']('isEmpty',!0x0),this['keystrokes']=new gt(),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']);}},vh=class extends _0x4ff2da{['focusTracker']=new _t();keystrokes=new gt();['focusCycler'];['_focusables']=new _0x50bc02();submitButtonView;cancelButtonView;promptInputView;actionsFooterView;_modelSelector;['_check'];constructor(_0x21f41b,_0x1a5787,_0xf16789=!0x1){super(_0x21f41b),this['_check']=_0x1a5787,this['set']('prompt',''),this['set']('modelId',''),this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new Qt(this['locale'],()=>new Oh(_0x21f41b)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelector']=new Io(_0x21f41b,{'panelPosition':'se','dropdownClass':'ck-ai_review__check-list-item-model-dropdown','nameClass':'ck-ai_review__check-list-item-model-name','itemClasses':{'name':'ck-ai_review__check-list-item-model-dropdown-name','description':'ck-ai_review__check-list-item-model-dropdown-description'}}),this['listenTo'](this['_modelSelector'],'selectModel',(_0x2a417e,_0x4cb550)=>{this['modelId']=_0x4cb550['id'],this['_modelSelector']['setSelectedModel'](_0x4cb550);}),this['_setModelList'](_0xf16789),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new Wt(this['locale'],{'children':[this['promptInputView']]}),new Wt(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x36ea67,_0x3f84c0)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x3f84c0()):_0x3f84c0();}),this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),[this['promptInputView'],this['_modelSelector']['dropdownView'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0x8f5041=>{this['_focusables']['add'](_0x8f5041),this['focusTracker']['add'](_0x8f5041['element']);}),this['keystrokes']['listenTo'](this['element']);}resetToDefault(){this['prompt']='',this['modelId']=this['_check']['defaultModel']?.['id']??'',this['_check']['defaultModel']&&this['_modelSelector']['setSelectedModel'](this['_check']['defaultModel']),this['resetFormValidationStatus']();}resetFormValidationStatus(){this['promptInputView']['errorText']='';}['_isValid'](){this['resetFormValidationStatus']();for(const _0x156047 of this['_getFormValidators']()){const _0x1fa68f=_0x156047();if(_0x1fa68f)return this['promptInputView']['errorText']=_0x1fa68f,!0x1;}return!0x0;}_getFormValidators(){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return Es(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}_createSubmitButtonView(){const _0xe4d6e9=new Mt(this['locale']),t=this['locale']['t'];return _0xe4d6e9['set']({'label':t('Submit'),'withText':!0x0,'class':Ln}),_0xe4d6e9['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0xe4d6e9;}_createCancelButtonView(){const _0x44df6c=new Mt(this['locale']),t=this['locale']['t'];return _0x44df6c['set']({'label':t('Cancel'),'withText':!0x0,'class':Dn}),_0x44df6c['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x398c06=>{_0x398c06['stopPropagation']();})}}),_0x44df6c['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x44df6c;}_setModelList(_0x571351){this['_modelSelector']['setModels'](this['_check']['models'],!_0x571351),this['resetToDefault']();}_createActionsFooterView(){const _0x5eab40=new _0x4ff2da(this['locale']);return _0x5eab40['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions-footer']},'children':[this['_modelSelector'],{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-custom-actions-buttons']},'children':[this['cancelButtonView'],this['submitButtonView']]}]}),_0x5eab40;}},kh=class extends jt{_formItemsCollection=new _0x50bc02();_customCheckView=null;['_hideModels']=!0x1;constructor(_0x258959,_0x40a88a,_0x297e89,_0x29af25=!0x1){super(_0x258959),this['_hideModels']=_0x29af25,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x40a88a['isParameterized']);const _0x269550=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',_0x132e6d=>_0x132e6d),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x4c40b0=>_0x4c40b0)],'style':{'--ck-ai-review-check-list-item-index':_0x297e89}},'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':_0x40a88a['title']}]},_0x269550]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x40a88a['description']?[{'text':_0x40a88a['description']}]:[]}]}]},..._0x40a88a['isParameterized']?[this['_createParameterizedView'](_0x40a88a)]:[],...'custom'===_0x40a88a['id']?[this['_createCustomView'](_0x40a88a,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x40a88a['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x40a88a['id'],'args':_0x40a88a['useArgs']?_0x40a88a['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0x341840({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}resetToDefault(){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x23b28a=>{_0x23b28a['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}_createIconView(){const _0x39fa7b=new $t();return _0x39fa7b['content']=_0xec4159,_0x39fa7b['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x39fa7b;}_createParameterizedView(_0xba9d9b){const _0x403bf4=new _0x4ff2da(),_0x363bee=this['_createFormView'](_0xba9d9b);return _0x403bf4['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x336823=>!_0x336823)]},'children':[_0x363bee]}),_0x403bf4;}_createFormView(_0x2642b0){const _0xc0f5bd=new _0x4ff2da(),_0x548f0a=Array['isArray'](_0x2642b0['options'])?_0x2642b0['options']:[],_0x429b83=new Mt(this['locale']),t=this['locale']['t'];_0x429b83['set']({'label':t('Submit'),'withText':!0x0,'class':Ln}),_0x429b83['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x4d1345=>{_0x4d1345['stopPropagation']();})}}),_0x429b83['on']('execute',()=>{const _0x4203e4=[],_0x1bcc6d={};this['_formItemsCollection']['forEach'](_0x55005f=>{_0x4203e4['push'](_0x55005f['value']),_0x2642b0['useArgs']&&_0x2642b0['options']&&(_0x1bcc6d[_0x55005f['argsKey']]=_0x55005f['value']);}),this['fire']('runReviewCheck',{'id':_0x2642b0['id'],'params':_0x4203e4['length']?_0x4203e4:void 0x0,'args':Object['keys'](_0x1bcc6d)['length']?_0x1bcc6d:void 0x0});});const _0x4669ad=_0x548f0a['length'];return _0x548f0a['forEach']((_0x2bc661,_0x5b4af8)=>{const _0x24a17b=_0x5b4af8===_0x4669ad-0x1;this['_formItemsCollection']['add'](new Rh(this['locale'],_0x2bc661,_0x24a17b?_0x429b83:null));}),_0xc0f5bd['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0xc0f5bd;}_createCustomView(_0x505097,_0x4cafee=!0x1){return this['_customCheckView']=new vh(this['locale'],_0x505097,_0x4cafee),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',_0x16fa87=>!_0x16fa87)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x91fdac,_0x7716fe,_0x1a0351)=>{_0x1a0351||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},yh=class extends jt{['_checkViews'];constructor(_0x54312e){super(_0x54312e),this['_checkViews']=new _0x50bc02(),this['_setupTemplate']();}setChecks(_0x11ebfc,_0xffdb73=!0x1){this['_checkViews']['clear']();for(const [_0x4f4e84,_0x1fa2ed]of _0x11ebfc['entries']()){const _0x13b7b8=new kh(this['locale'],_0x1fa2ed,_0x4f4e84,_0xffdb73);_0x13b7b8['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x13b7b8);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}resetAllParameterizedChecks(){for(const _0x59b3f2 of this['_checkViews'])_0x59b3f2 instanceof kh&&_0x59b3f2['resetToDefault']();}_setupTemplate(){const _0x483b7a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x483b7a['if']('isVisible','ck-hidden',_0x3a3215=>!_0x3a3215)]},'children':this['_checkViews']});}},Nh=class extends mh{static get['pluginName'](){return'AIReviewModeUI';}createMainView(){const _0x1d6d37=this['context']['plugins']['get']('AITabs'),_0x2d0f94=this['context']['locale'],_0x211afa=new ua(_0x2d0f94,{'label':Es(_0x2d0f94,'AI_REVIEW_MODE'),'icon':_0x1f8cfb,'class':'ck-ai-header_review','showResizeButton':_0x1d6d37['showResizeButton']});return _0x211afa['delegate']('resizeTabs')['to'](_0x1d6d37),_0x211afa['bind']('isMaximized')['to'](_0x1d6d37['view'],'isMaximized',_0x9a99e8=>_0x9a99e8),new wh(this['context']['locale'],{'header':_0x211afa,'list':new yh(_0x2d0f94),'results':new fh(_0x2d0f94,{'generalErrorText':Es(_0x2d0f94,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new bh(_0x2d0f94,{'headerText':Es(_0x2d0f94,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Es(_0x2d0f94,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Es(_0x2d0f94,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}registerTab(){const _0x390af2=this['context']['plugins']['get']('AITabs');_0x390af2['view']['on']('activateTab',(_0x1cc41f,{newTab:_0x4ac06e,oldTab:_0x386f99})=>{'reviewMode'===_0x4ac06e?this['fire']('getReviewCheckList'):'reviewMode'===_0x386f99&&this['fire']('leaveReview');}),_0x390af2['view']['addTab']({'id':'reviewMode','buttonLabel':Es(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x1f8cfb,'order':0x0,'content':this['_mainView']});}},xh=class extends Sn{_affectedBlocks=[];get affectedBlocks(){return this['_affectedBlocks']['slice']();}set affectedBlocks(_0x341c60){this['_affectedBlocks']=_0x341c60;}};const Lh='review-',Ph=['softBreak'],Dh=['htmlScript','htmlStyle','htmlCustomElement'];var Hh=class extends _0x212144{static get requires(){return[_0x5388eb,tn];}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();_inlineRootDataIds=new WeakMap();constructor(_0x3ffff1){super(_0x3ffff1),this['_domEmitter']=new(ut())(),this['_eventEmitter']=new(dt())();}get emitter(){return this['_eventEmitter'];}afterInit(){const _0x6b4e58=_0x5c1467=>this['_scheduleAttachReviewEditingToEditor'](_0x5c1467);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x2a0bfb)return void _0x6b4e58(this['context']);const _0x3a9040=this['context'];for(const _0x21e4e3 of _0x3a9040['editors'])_0x6b4e58(_0x21e4e3);this['listenTo'](_0x3a9040['editors'],'add',(_0x7a69e9,_0x5505a3)=>{_0x6b4e58(_0x5505a3);}),this['listenTo'](_0x3a9040['editors'],'remove',(_0x22bafd,_0x4fa6d4)=>{for(const [_0x20cc0a,_0x33e465]of this['_markers'])_0x33e465['editor']===_0x4fa6d4&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x20cc0a,'changeId':_0x33e465['groupId']}),this['_markers']['delete'](_0x20cc0a));});}_scheduleAttachReviewEditingToEditor(_0x37a264){const _0x1dd9f0=()=>{'destroyed'!==_0x37a264['state']&&_0x37a264['conversion']&&this['_attachReviewEditingToEditor'](_0x37a264);};if('ready'===_0x37a264['state'])return void _0x1dd9f0();const _0x43b8ff=()=>{this['stopListening'](_0x37a264,'ready',_0x43b8ff),_0x1dd9f0();};this['listenTo'](_0x37a264,'ready',_0x43b8ff);}_attachReviewEditingToEditor(_0xd40e){this['_reviewEditingAttachedEditors']['has'](_0xd40e)||(_0xd40e['conversion']['for']('editingDowncast')['markerToElement']({'model':Lh+'insert','view':(_0x4374c9,{writer:_0x4cf937})=>{const _0x5d2b3f=this['_markers']['get'](_0x4374c9['markerName']),_0x549d0d={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x5d2b3f?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x4374c9['markerName']};return _0x4cf937['createUIElement']('span',_0x549d0d,function(_0x1f5a53){const _0x457d1d=this['toDomElement'](_0x1f5a53);return _0x457d1d['innerHTML']=_0x5d2b3f?.['content']?.['asString']||'',_0x457d1d;});}}),_0xd40e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-only','view':_0x124f2e=>{const _0x155bd7=this['_markers']['get'](_0x124f2e['markerName']),_0x32ef26=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x155bd7?.['id']||'')&&_0x32ef26['push']('ck-ai_review__change_active'),{'classes':_0x32ef26,'attributes':{'data-marker-id':_0x124f2e['markerName']}};}}),_0xd40e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-context','view':_0x2b73cc=>{const _0x18eb26=this['_markers']['get'](_0x2b73cc['markerName']),_0x4523b9=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x18eb26?.['id']||'')&&_0x4523b9['push']('ck-ai_review__change_active'),{'classes':_0x4523b9,'attributes':{'data-marker-id':_0x2b73cc['markerName']}};}}),_0xd40e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-text','view':_0x42c3e2=>{const _0x170928=this['_markers']['get'](_0x42c3e2['markerName']),_0x1f10a2=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x170928?.['id']||'')&&_0x1f10a2['push']('ck-ai_review__change_active'),{'classes':_0x1f10a2,'attributes':{'data-marker-id':_0x42c3e2['markerName']}};}}),_0xd40e['conversion']['for']('dataDowncast')['markerToElement']({'model':Lh+'suggestion-context','view':(_0x29e181,{writer:_0x34858d})=>_0x34858d['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x29e181['isOpening']?'start':'end')})}),_0xd40e['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x4274f2,'view':_0x552318}),this['_updateMouseMarkerInteractionListeners'](_0xd40e),this['listenTo'](_0xd40e,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0xd40e),{'priority':'lowest'}),this['listenTo'](_0xd40e,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0xd40e),{'priority':'lowest'}),_0xd40e['model']['document']['registerPostFixer'](_0xbf5c98=>this['_validateMarkers'](_0xd40e,_0xbf5c98)),_0xd40e['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0xd40e)),this['_reviewEditingAttachedEditors']['add'](_0xd40e));}_updateMouseMarkerInteractionListeners(_0x2cd7b2){let _0x31344e=this['_boundEditables']['get'](_0x2cd7b2);_0x31344e||(_0x31344e=new Map(),this['_boundEditables']['set'](_0x2cd7b2,_0x31344e));const _0xd1dcf6=new Set(_0x2cd7b2['ui']['getEditableElementsNames']());for(const _0x20afb3 of _0xd1dcf6){if(_0x31344e['has'](_0x20afb3))continue;const _0x2350ca=_0x2cd7b2['ui']['getEditableElement'](_0x20afb3);_0x31344e['set'](_0x20afb3,_0x2350ca),this['_attachMouseMarkerInteractionListeners'](_0x2350ca);}for(const [_0x3a936c,_0x55a915]of _0x31344e)_0xd1dcf6['has'](_0x3a936c)||(_0x31344e['delete'](_0x3a936c),this['_domEmitter']['stopListening'](_0x55a915));}_attachMouseMarkerInteractionListeners(_0x31a0b1){this['_domEmitter']['listenTo'](_0x31a0b1,'mouseup',(_0x1a02ec,_0x2d041a)=>{const _0x51647d=_0x2d041a['target'],_0x14c25b=this['_findMarkerElement'](_0x51647d);if(!_0x14c25b)return;const _0x56a688=_0x14c25b['getAttribute']('data-marker-id'),_0x1e3683=_0x56a688['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x56a688,'changeId':_0x1e3683,'markerElement':()=>this['_findMarkerElementById'](_0x56a688),'domEvent':_0x2d041a});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x31a0b1,'mouseover',(_0x43d817,_0x765d08)=>{const _0x29cd9b=_0x765d08['target'],_0x586e41=_0x765d08['relatedTarget'];let _0x11f7ff=this['_findMarkerElement'](_0x29cd9b);if(!_0x11f7ff&&_0x586e41&&(_0x11f7ff=this['_findMarkerElement'](_0x586e41)),!_0x11f7ff)return;const _0x558ff4=_0x11f7ff['getAttribute']('data-marker-id'),_0x1ef20d=_0x558ff4['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x1ef20d,'markerElement':()=>this['_findMarkerElementById'](_0x558ff4),'domEvent':_0x765d08});});}_registerGlobalBalloonBlurHandler(){this['_domEmitter']['listenTo'](document,'mouseover',_0x220e40((_0x3fcc9e,_0x242b31)=>{const _0x20562b=_0x242b31['target'];this['_findMarkerElement'](_0x20562b)||_0x20562b['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}getDocumentData(_0x4ba5c7){const _0x3980f9=this['context']['plugins']['get']('AIEditing'),_0x3ff575=bs(this['context']);if(!_0x3ff575['length'])throw new ct('ai-get-editor-from-context-no-editor',this);const _0x42a004=_0x4ba5c7?.['roots'];if(_0x42a004&&0x0===_0x42a004['length'])throw new ct('ai-reviewcoreediting-empty-roots',this);const _0x4ed3d3=_0x42a004?new Set(_0x42a004['map'](_0x2157ba=>_0x2157ba['channelId']+'\x00'+_0x2157ba['rootName'])):null,_0x35b74d=_0x4ed3d3?new Set():null,_0x435bc2=new Set(),_0x48ebd7=[],_0x56edb5=new Map(),_0x58e89f=[];for(const _0x3742ce of _0x3ff575){const _0x239f17=_0x3742ce['config']['get']('collaboration.channelId');for(const _0x37bd75 of _0x3742ce['model']['document']['getRoots']()){const _0x5a422f=_0x239f17+'\x00'+_0x37bd75['rootName'];if(_0x4ed3d3&&!_0x4ed3d3['has'](_0x5a422f))continue;const _0x40fc25=this['_buildDocumentDataSliceForRoot'](_0x3742ce,_0x37bd75,_0x3980f9,_0x435bc2);_0x48ebd7['push'](_0x40fc25['content']);for(const [_0x275577,_0x1dfa8c]of _0x40fc25['elements'])_0x56edb5['set'](_0x275577,_0x1dfa8c);_0x58e89f['push']({'channelId':_0x239f17,'rootName':_0x37bd75['rootName']}),_0x35b74d?.['add'](_0x5a422f);}}if(_0x42a004&&_0x35b74d['size']!==_0x4ed3d3['size']){const _0x2a08c8=_0x42a004['find'](_0x29e155=>!_0x35b74d['has'](_0x29e155['channelId']+'\x00'+_0x29e155['rootName']));throw new ct('ai-reviewcoreediting-root-not-found',this,{'channelId':_0x2a08c8['channelId'],'rootName':_0x2a08c8['rootName']});}return{'elements':_0x56edb5,'content':_0x48ebd7['join'](''),'roots':_0x58e89f};}async['runCheck'](_0x48880e,_0x53bedb){const _0x92f9a0=new On(),_0x26d75f=_0x53bedb?.['signal'];let _0x12aafe;const _0x53b08c=()=>{_0x92f9a0['abort'](),_0x48880e['abort']();};if(_0x26d75f){if(_0x26d75f['aborted'])return _0x53b08c(),_0x92f9a0;_0x26d75f['addEventListener']('abort',_0x53b08c),_0x12aafe=()=>_0x26d75f['removeEventListener']('abort',_0x53b08c);}const _0x4ef11c={'apiId':_0x48880e['sourceCheck']['apiId']};try{_0x48880e['on']('reviewCheckRunUpdated',(_0x215a50,_0xde11d2)=>{'aborted'===_0xde11d2['status']?_0x92f9a0['abort']():'error-general'!==_0xde11d2['status']&&'error-chunk'!==_0xde11d2['status']||(_0x92f9a0['error']=bn(_0xde11d2['error'],'ai-reviewcoreediting-check-run-failed',this,_0x4ef11c));}),'aborted'!==_0x92f9a0['status']&&await _0x48880e['start']();}catch(_0x35902b){_0x92f9a0['error']=bn(_0x35902b,'ai-reviewcoreediting-check-run-failed',this,_0x4ef11c);}finally{_0x12aafe&&_0x12aafe();}return'error'===_0x92f9a0['status']||'aborted'===_0x92f9a0['status']||(_0x92f9a0['addResult'](...this['_buildPerRootResults'](_0x48880e)),_0x92f9a0['status']='completed'),_0x92f9a0;}buildErrorContext(_0x3378f3){return{'apiId':_0x3378f3['sourceCheck']['apiId']};}_buildPerRootResults(_0x140bf0){const _0x3623e6=this['buildErrorContext'](_0x140bf0),_0x53a036=this['context']['plugins']['get']('AIEditing'),_0xd7a5d5=this['context']['plugins']['get']('AIGateway'),_0x2d79b8=this['_groupElementsByRoot'](_0x140bf0['documentData']['elements']),_0x1717ec=new Map();for(const _0x12817a of bs(this['context']))_0x1717ec['set'](_0x12817a['config']['get']('collaboration.channelId'),_0x12817a);return _0x140bf0['documentData']['roots']['map'](({channelId:_0x2ed371,rootName:_0x5523a6})=>{const _0x3aae91=_0x1717ec['get'](_0x2ed371),_0x224470=new xh({'editor':_0x3aae91,'rootName':_0x5523a6,'channelId':_0x2ed371,'sessionId':_0x53a036['getSessionId'](_0x3aae91)}),_0x590dc2=_0x2d79b8['get'](_0x224470['editor'])?.['get'](_0x224470['rootName'])??[];_0x224470['contentRawOld']=_0x590dc2['map'](_0x22c624=>_0x22c624['getContent']())['join'](''),_0x224470['documentVersion']=_0x590dc2[0x0]?.['documentVersion']??0x1;const _0x303fa7=this['_collectResultAffectedBlocks'](_0x224470,_0x140bf0['results'],_0x140bf0['documentData']['elements']);_0x224470['affectedBlocks']=_0x303fa7;try{_0x224470['contentRawNew']=Os(_0xd7a5d5['mergeChangesIntoContent'](_0x303fa7,_0x224470['contentRawOld'],_0x224470['editor']));}catch(_0x53a0ff){_0x224470['error']=bn(_0x53a0ff,'ai-reviewcoreediting-check-run-failed',this,_0x3623e6);}return _0x224470;});}_collectResultAffectedBlocks(_0x238a26,_0x3215ba,_0x2dc600){return _0x3215ba['filter'](_0x3e5af8=>{const _0x342d3b=_0x2dc600['get'](_0x3e5af8['id']);return!!_0x342d3b&&_0x342d3b['editor']===_0x238a26['editor']&&_0x342d3b['rootName']===_0x238a26['rootName'];})['map'](_0x1df668=>({'id':_0x1df668['id'],'content':_0x1df668['contentNew']}));}_groupElementsByRoot(_0x19a97e){const _0x38be70=new Map();for(const _0x646c of _0x19a97e['values']()){let _0x1e8294=_0x38be70['get'](_0x646c['editor']);_0x1e8294||(_0x1e8294=new Map(),_0x38be70['set'](_0x646c['editor'],_0x1e8294));let _0x506f73=_0x1e8294['get'](_0x646c['rootName']);_0x506f73||(_0x506f73=[],_0x1e8294['set'](_0x646c['rootName'],_0x506f73)),_0x506f73['push'](_0x646c);}return _0x38be70;}_buildDocumentDataSliceForRoot(_0x45cc97,_0x535f5b,_0x129c4c,_0x5c0dea){const _0x38155f=_0x45cc97['model'],_0x3c3200=new _0x5eb9f7();for(const _0x4f2a72 of _0x535f5b['getChildren']())_0x3c3200['_appendChild'](_0x4f2a72['_clone'](!0x0));for(const _0x97c3a8 of _0x38155f['markers']){const _0x55cfb7=_0x97c3a8['getRange']();_0x55cfb7&&_0x55cfb7['root']['rootName']===_0x535f5b['rootName']&&_0x3c3200['markers']['set'](_0x97c3a8['name'],this['_changeRangeOwnerDocument'](_0x55cfb7['clone'](),_0x3c3200));}const _0x513a1d=new Map(),_0x4374aa=_0x38155f['document']['version'];if(Gs(_0x45cc97,_0x535f5b['rootName'])){let _0x539284=this['_inlineRootDataIds']['get'](_0x535f5b);_0x539284?_0x5c0dea['add'](_0x539284):(_0x539284=_0x129c4c['_nextDataId'](_0x5c0dea),this['_inlineRootDataIds']['set'](_0x535f5b,_0x539284));const _0x3ea096=Fs(_0x45cc97['data']['processor']['toData'](_0x45cc97['data']['toView'](_0x3c3200)),_0x539284);return _0x513a1d['set'](_0x539284,{'editor':_0x45cc97,'rootName':_0x535f5b['rootName'],'path':[],'documentVersion':_0x4374aa,'getContent':()=>_0x3ea096}),{'content':_0x3ea096,'elements':_0x513a1d};}const _0x27d082=new _0x2a0ccb({'ignoreElementEnd':!0x0,'startPosition':_0x38155f['createPositionAt'](_0x3c3200,0x0)});for(const {item:_0x10d4a1}of _0x27d082){if(_0x10d4a1['is']('element')&&_0x10d4a1['name']&&Dh['includes'](_0x10d4a1['name'])){const _0x69662c=this['_upsertDataId'](_0x10d4a1,()=>_0x129c4c['_nextDataId'](_0x5c0dea));_0x5c0dea['add'](_0x69662c);}if(!_0x10d4a1['is']('$textProxy'))continue;const _0x3f2317=_0x10d4a1['parent'];if(!_0x3f2317||!_0x3f2317['is']('element'))continue;const _0x297086=this['_upsertDataId'](_0x3f2317,()=>_0x129c4c['_nextDataId'](_0x5c0dea));_0x5c0dea['add'](_0x297086);for(const _0x3ceacb of _0x3f2317['getChildren']())_0x3ceacb['is']('element')&&(_0x3ceacb['name']&&Ph['includes'](_0x3ceacb['name'])||_0x5c0dea['add'](this['_upsertDataId'](_0x3ceacb,()=>_0x129c4c['_nextDataId'](_0x5c0dea))));let _0x4b7935=_0x3f2317;for(;_0x4b7935['parent']&&!_0x4b7935['parent']['is']('documentFragment');)_0x4b7935=_0x4b7935['parent'],_0x4b7935['hasAttribute'](_0x4274f2)&&_0x4b7935['_removeAttribute'](_0x4274f2);_0x513a1d['set'](_0x297086,{'editor':_0x45cc97,'rootName':_0x535f5b['rootName'],'path':_0x3f2317['getPath'](),'documentVersion':_0x4374aa,'getContent':this['_createGetContentUsingDataIdFn'](_0x4b7935['_clone'](!0x0),_0x297086,_0x45cc97['data'])}),_0x27d082['jumpTo'](_0x38155f['createPositionAfter'](_0x3f2317));}return{'content':_0x45cc97['data']['processor']['toData'](_0x45cc97['data']['toView'](_0x3c3200)),'elements':_0x513a1d};}diffContent(_0x328f9b,_0x5dd076,_0x181fb3,_0x21695a=!0x1){const {contentInitial:_0x588981,contentNew:_0x1313ca}=this['_neutralizeChangesOnUnsupportedElements'](_0x5dd076,_0x181fb3),_0x28fbdb=[],_0x57c852=_0x328f9b['data']['parse'](_0x1313ca,'$documentFragment'),_0x3f9de9=_0x328f9b['data']['parse'](_0x588981,'$documentFragment'),_0x28ddcc=_0x328f9b['model']['createPositionAt'](_0x3f9de9,0x0);if(this['_haveSingleTopLevelElement'](_0x57c852)){if(!this['_hasSameTopLevelElement'](_0x3f9de9,_0x57c852))return _0x28fbdb;}else{const _0x2202f8=_0x328f9b['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x3f9de9,_0x2202f8)||!this['_haveOnlyInlineContent'](_0x57c852,_0x2202f8))return _0x28fbdb;}const _0x1190cc=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x588981,_0x1313ca,{'targetEditor':_0x328f9b,'anchor':_0x28ddcc,'markDeletions':!0x0})['getOperations']()['filter'](_0x1c8c43=>'insert'===_0x1c8c43['type']||'marker'===_0x1c8c43['type']&&_0x1c8c43['name']['startsWith']('$markedRemove')),_0x297640=this['_groupAdjacentOperations'](_0x1190cc),_0x5349db=[];if(_0x21695a){if(_0x297640['length']){const _0x1b27c9=_0x297640[0x0]['operations'][0x0],_0x4f53fa='insert'===_0x1b27c9['type']?_0x1b27c9['position']:_0x1b27c9['newRange']['start'],_0x18078a=this['_getPositionLimitingRange'](_0x4f53fa,_0x328f9b,'inside'),_0x28bfd7=_0x18078a?_0x57c852['getChild'](0x0)['getChildren']():_0x57c852['getChildren'](),_0x26d581=_0x18078a||_0x328f9b['model']['createRangeIn'](_0x3f9de9),_0x5a3935=[new _0x171060('$markedRemove:synthetic'+kt(),null,_0x26d581,_0x328f9b['model']['document']['model']['markers'],!0x0,_0x328f9b['model']['document']['version']+0x1),new _0x86d081(_0x26d581['end'],_0x28bfd7,_0x328f9b['model']['document']['version']+0x2)];_0x5349db['push']({'operations':_0x5a3935,'operationsIsolated':_0x5a3935,'groupOffset':0x0});}}else _0x5349db['push'](..._0x297640);let _0xd9f53f=0x0;return _0x328f9b['model']['change'](_0x507c10=>{for(let _0x20c44b=0x0;_0x20c44b<_0x5349db['length'];_0x20c44b++){const _0x42a4ee=_0x5349db[_0x20c44b],_0x4be194=_0x507c10['createDocumentFragment']();for(const _0x3c463b of _0x3f9de9['getChildren']())_0x507c10['append'](_0x3c463b['_clone'](!0x0),_0x4be194);for(const _0x9e93bf of _0x42a4ee['operationsIsolated'])if('insert'===_0x9e93bf['type']){const _0x5427a1=_0x9e93bf;_0x5427a1['baseVersion']=null,_0x5427a1['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x5427a1,_0x4be194),_0x507c10['batch']['addOperation'](_0x9e93bf),_0x328f9b['model']['applyOperation'](_0x9e93bf);const _0x2affce='suggestion:insertion:id:authorId:'+_0xd9f53f++,_0x20d0d2=_0x328f9b['model']['createRange'](_0x5427a1['position'],_0x5427a1['position']['getShiftedBy'](_0x5427a1['howMany']));_0x4be194['markers']['set'](_0x2affce,_0x20d0d2);}else{if('marker'===_0x9e93bf['type']&&_0x9e93bf['name']['startsWith']('$markedRemove')){const _0x253a39=_0x9e93bf,_0x49d69d='suggestion:deletion:id:authorId:'+_0xd9f53f++;this['_changeOperationOwnerDocument'](_0x253a39,_0x4be194),_0x4be194['markers']['set'](_0x49d69d,_0x253a39['newRange']);}}if(_0x21695a)_0x28fbdb['push']({..._0x42a4ee,'context':this['_createGetContentFn'](_0x3f9de9,_0x328f9b['data']),'content':this['_createGetContentFn'](_0x3f9de9,_0x328f9b['data'])});else{const _0x5b1cb3=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x42a4ee['operationsIsolated'][0x0]),_0x4be194),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x42a4ee['operationsIsolated'][_0x42a4ee['operationsIsolated']['length']-0x1]),_0x4be194),_0x328f9b);_0x4be194['markers']['set'](Lh+'suggestion-context',new _0x2af2ad(_0x5b1cb3['start'],_0x5b1cb3['end'])),_0x28fbdb['push']({..._0x42a4ee,'context':this['_createGetContextFn'](_0x4be194,_0x328f9b['data'],{'ellipsisBefore':_0x5b1cb3['hasContentBefore'],'ellipsisAfter':_0x5b1cb3['hasContentAfter']}),'content':this['_createGetContentFn'](_0x4be194,_0x328f9b['data'])});}}}),_0x28fbdb;}markChangePositionInEditorContent(_0x31ca71,_0x31dc7d){if(!_0x31ca71['length'])return;const _0x4f42b3=_0x31ca71[0x0]['parent']['id'],_0x307f05=_0x31dc7d['elements']['get'](_0x4f42b3);if(!_0x307f05)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x4f42b3);const _0x2eed60=_0x307f05['path'],_0x3a6e52=_0x307f05['editor'],_0x5c8085=_0x3a6e52['model']['document']['getRoot'](_0x307f05['rootName']);if(!_0x5c8085)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x307f05['rootName']);const _0xe4c064=_0x3a6e52['model']['document']['history']['getOperations'](_0x307f05['documentVersion']),_0x43e277=[];for(const _0x268700 of _0x31ca71){const _0x53c47f=_0x268700['operationsIsolated']['map'](_0x1bcbb6=>this['_translateOperationToEditorContent'](_0x1bcbb6,_0x2eed60,_0x5c8085));if(!_0x53c47f||!_0x53c47f['length'])continue;const _0x106041=_0x53c47f['every'](_0x3b59a7=>'marker'===_0x3b59a7['type']&&_0x3b59a7['name']['startsWith']('$markedRemove')),_0x2eaf74=_0x3b7a23(_0x53c47f,_0xe4c064,{'document':_0x3a6e52['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0xf07be3 of _0x2eaf74)if('insert'===_0xf07be3['type']){const _0x91150b=_0xf07be3,_0x1ae8c2=_0x91150b['nodes'];_0x3a6e52['model']['change'](_0x44d90f=>{const _0x3c570b=_0x44d90f['createDocumentFragment']();for(const _0xdfac34 of _0x1ae8c2)_0x44d90f['append'](_0xdfac34['_clone'](!0x0),_0x3c570b);_0x43e277['push']({'start':_0x91150b['position'],'end':_0x91150b['position'],'type':'insert','groupId':_0x268700['id'],'content':{'asString':this['_createGetContentFn'](_0x3c570b,_0x3a6e52['data'])(),'asFragment':_0x3c570b}});});}else{if('marker'===_0xf07be3['type']&&_0xf07be3['name']['startsWith']('$markedRemove')){const _0x74a328=_0xf07be3;let _0x29cb66='remove-text';if(_0x106041){const _0xfe8137=this['_findAdjacentContextDistance'](_0x74a328['newRange']['start'],'backward',_0x3a6e52['model']['schema']),_0x1bf0f3=this['_findAdjacentContextDistance'](_0x74a328['newRange']['end'],'forward',_0x3a6e52['model']['schema']);if(_0xfe8137||_0x1bf0f3){const _0x5620ff=_0x74a328['newRange']['start']['getShiftedBy'](-_0xfe8137),_0x25602b=_0x74a328['newRange']['end']['getShiftedBy'](_0x1bf0f3);_0x43e277['push']({'start':_0x5620ff,'end':_0x25602b,'groupId':_0x268700['id'],'type':'remove-context'});}else _0x29cb66='remove-only';}_0x43e277['push']({'start':_0x74a328['newRange']['start'],'end':_0x74a328['newRange']['end'],'groupId':_0x268700['id'],'type':_0x29cb66});}}}this['_insertMarkers'](_0x43e277,_0x3a6e52);}['clearAllMarkers'](){const _0x5052a4=new Map();for(const _0x11d784 of this['_markers']['keys']()){const _0x50fb66=this['_markers']['get'](_0x11d784);_0x50fb66?.['editor']&&(_0x5052a4['has'](_0x50fb66['editor'])||_0x5052a4['set'](_0x50fb66['editor'],[]),_0x5052a4['get'](_0x50fb66['editor'])['push'](_0x11d784));}for(const [_0x2d919d,_0x29a268]of _0x5052a4)_0x2d919d['model']['change'](_0x14c14c=>{for(const _0x3969a2 of _0x29a268)_0x2d919d['model']['markers']['get'](_0x3969a2)&&_0x14c14c['removeMarker'](_0x3969a2);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}switchToReadOnly(){for(const _0x43b55f of this['getEditors']())_0x43b55f['enableReadOnlyMode']('ai-review');}switchToEdit(){for(const _0x42db76 of this['getEditors']())_0x42db76['disableReadOnlyMode']('ai-review');}['applyChange'](_0x2bf3f0,_0x5d87bc=null){const _0x19d98e=_0x2bf3f0['map'](_0x255429=>this['_getMarkersDataForGroup'](_0x255429))['flat'](),_0x3acb1a=new Map();for(const _0x545d1e of _0x19d98e)_0x3acb1a['has'](_0x545d1e['editor'])||_0x3acb1a['set'](_0x545d1e['editor'],[]),_0x3acb1a['get'](_0x545d1e['editor'])['push'](_0x545d1e);for(const [_0x2a9581,_0x1c1667]of _0x3acb1a){const _0x228c6e=_0x2a9581['model'],_0x4c16cb=_0x2a9581['plugins']['has']('TrackChangesEditing')?_0x2a9581['plugins']['get']('TrackChangesEditing'):null,_0x4b9750=_0x5d87bc&&_0x4c16cb?new Set(_0x4c16cb['getSuggestions']()['map'](_0x3ecb73=>_0x3ecb73['id'])):null;_0x228c6e['change'](_0xb11341=>{const _0x1b7749=_0xb11341['batch']['operations']['length'];for(const _0x1b3daf of _0x1c1667){const _0x5be233=_0x2a9581['model']['markers']['get'](_0x1b3daf['id']);if(_0x5be233){if('insert'===_0x1b3daf['type']){if(!_0x1b3daf['content'])continue;_0x228c6e['insertContent'](_0x1b3daf['content']['asFragment']||null,_0x5be233['getRange']()['start']);}else'remove-text'!==_0x1b3daf['type']&&'remove-only'!==_0x1b3daf['type']||_0x228c6e['deleteContent'](_0x228c6e['createSelection'](_0x5be233['getRange']()));_0xb11341['removeMarker'](_0x1b3daf['id']),this['_markers']['delete'](_0x1b3daf['id']);}}if(_0x5d87bc&&(mn(_0xb11341['batch']['operations']['slice'](_0x1b7749),_0x5d87bc),_0x4c16cb)){for(const _0x23061f of _0x4c16cb['getSuggestions']())_0x4b9750['has'](_0x23061f['id'])||_0x23061f['setAttribute']('@ai',{'type':_0x5d87bc});}});}}rejectChange(_0x3b6b6f){const _0x18216d=this['_getMarkersDataForGroup'](_0x3b6b6f),_0x35a4db=new Map();for(const _0xc545d4 of _0x18216d)_0x35a4db['has'](_0xc545d4['editor'])||_0x35a4db['set'](_0xc545d4['editor'],[]),_0x35a4db['get'](_0xc545d4['editor'])['push'](_0xc545d4);for(const [_0x5cda8b,_0x905f24]of _0x35a4db)_0x5cda8b['model']['change'](_0x9a738f=>{for(const _0x174699 of _0x905f24)_0x9a738f['removeMarker'](_0x174699['id']),this['_markers']['delete'](_0x174699['id']);});}getEditor(){return Ss(this['context']);}getEditors(){return bs(this['context']);}getEditorForChange(_0x1a4e07){return this['_getMarkersDataForGroup'](_0x1a4e07)[0x0]?.['editor'];}getMarkerElementForChange(_0x3fd4ab){const _0x41c2d6=Array['from'](this['_markers']['values']())['filter'](_0x4ea420=>_0x4ea420['groupId']===_0x3fd4ab);if(!_0x41c2d6['length'])return null;const _0x44f7e0=0x1===_0x41c2d6['length']?_0x41c2d6[0x0]:this['_sortMarkers'](_0x41c2d6)[0x0],_0x25f940=_0x44f7e0['editor']['model']['markers']['get'](_0x44f7e0['id']);return _0x25f940?{'modelRange':_0x25f940['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x44f7e0['id'])}:null;}getContentElementForChange(_0x2c028c){const _0xf25f5f=Array['from'](this['_markers']['values']())['filter'](_0x102c7e=>_0x102c7e['groupId']===_0x2c028c);if(!_0xf25f5f['length'])return null;const _0x278ae5=0x1===_0xf25f5f['length']?_0xf25f5f[0x0]:this['_sortMarkers'](_0xf25f5f)[0x0],_0x192ef9=_0x278ae5['editor'],_0x5be9d2=_0x192ef9['model']['markers']['get'](_0x278ae5['id']);if(!_0x5be9d2)return null;const _0x12923b=_0x5be9d2['getRange'](),_0x19f0c4=_0x192ef9['editing']['view']['getDomRoot'](_0x12923b['root']['rootName'])||_0x192ef9['editing']['view']['getDomRoot']();if(!_0x19f0c4||!_0x12923b)return null;let _0x2845b7=_0x12923b['start']['parent'];for(;_0x2845b7['parent']&&!_0x2845b7['parent']['is']('rootElement');)_0x2845b7=_0x2845b7['parent'];if(!_0x2845b7||!_0x2845b7['name'])return null;const _0x1f652a=_0x19f0c4['querySelector']('[data-marker-id=\x22'+_0x278ae5['id']+'\x22]');if(!_0x1f652a)return null;if(_0x2845b7['is']('rootElement'))return _0x1f652a;let _0x195272=null;_0x192ef9['model']['change'](_0x516cab=>{_0x195272=_0x516cab['createDocumentFragment'](),_0x516cab['append'](_0x2845b7['_clone'](!0x0),_0x195272);});const _0x59a338=_0x192ef9['data']['toView'](_0x195272)['getChild'](0x0);return _0x1f652a['closest'](_0x59a338['name']);}reactivateMarkers(_0x3cac86){const _0xa60072=this['_getMarkersDataForGroup'](_0x3cac86);if(!_0xa60072['length'])return;const _0x4afa66=Array['from'](this['_activeMarkers'])['sort'](),_0x34a187=Array['from'](new Set(_0xa60072['map'](_0x308a5e=>_0x308a5e['id'])))['sort']();_0x4afa66['join']('|')!==_0x34a187['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x3cac86));}setMarkersInElementAsActive(_0x309bf6){const _0x4051af=this['_getMarkersDataForGroup'](_0x309bf6);if(!_0x4051af['length'])return;const _0x346cf5=_0x4051af[0x0]['editor'],_0x347811=new Set(_0x4051af['map'](_0x5b6f4e=>_0x5b6f4e['id'])),_0x113098=Array['from'](_0x347811['values']())['map'](_0x245bf6=>_0x346cf5['model']['markers']['get'](_0x245bf6))['filter'](_0x1e935a=>!!_0x1e935a);_0x347811['forEach'](_0x59910c=>{this['_activeMarkers']['add'](_0x59910c);}),_0x346cf5['model']['change'](()=>{_0x113098['forEach'](_0x34e7b0=>{_0x346cf5['editing']['reconvertMarker'](_0x34e7b0);});});}setAllMarkersAsInactive(){const _0x5f4506=Array['from'](this['_activeMarkers']);if(!_0x5f4506['length'])return;this['_activeMarkers']['clear']();const _0x1c5916=new Map();for(const _0x4fb849 of _0x5f4506){const _0x4f68c8=this['_markers']['get'](_0x4fb849);if(!_0x4f68c8)continue;const _0x43ce32=_0x4f68c8['editor'],_0x539774=_0x43ce32['model']['markers']['get'](_0x4fb849);_0x539774&&(_0x1c5916['has'](_0x43ce32)||_0x1c5916['set'](_0x43ce32,[]),_0x1c5916['get'](_0x43ce32)['push'](_0x539774));}for(const [_0x47c5c3,_0x3938b1]of _0x1c5916)_0x47c5c3['model']['change'](()=>{_0x3938b1['forEach'](_0x5635f7=>{_0x47c5c3['editing']['reconvertMarker'](_0x5635f7);});});}_getPositionLimitingRange(_0x29725c,_0x347af8,_0x1013f7='outside'){if(!_0x29725c)return null;let _0x4b7bbf=_0x29725c['parent'];for(;_0x4b7bbf&&_0x4b7bbf['parent']&&!_0x4b7bbf['parent']['is']('rootElement')&&!_0x347af8['model']['schema']['isLimit'](_0x4b7bbf)&&!_0x347af8['model']['schema']['isBlock'](_0x4b7bbf);)_0x4b7bbf=_0x4b7bbf['parent'];if(!_0x4b7bbf||!_0x4b7bbf['name']||_0x4b7bbf['is']('rootElement'))return null;let _0x482057=null;return _0x347af8['model']['change'](_0x32da07=>{_0x482057='inside'===_0x1013f7?_0x32da07['createRangeIn'](_0x4b7bbf):_0x32da07['createRangeOn'](_0x4b7bbf);}),_0x482057;}_validateMarkers(_0x1e1da4,_0xa081d6){const _0x2de8e8=Array['from'](this['_markers']['keys']()),_0x5b85b4=new Map();for(const _0x26658c of _0x2de8e8){const _0x386cb8=_0x1e1da4['model']['markers']['get'](_0x26658c);if(!_0x386cb8)continue;const _0x530ba7=_0x386cb8['getStart']()['root']['rootName']+':'+_0x386cb8['getStart']()['path'][0x0];_0x5b85b4['has'](_0x530ba7)||_0x5b85b4['set'](_0x530ba7,[]),_0x5b85b4['get'](_0x530ba7)['push'](_0x386cb8);}const _0x3d57ae=new Set();for(const _0x4a4402 of _0x1e1da4['model']['document']['differ']['getChanges']()){let _0x1d2579,_0x12eb80;if('insert'===_0x4a4402['type'])_0x12eb80=new _0x2af2ad(_0x4a4402['position'],_0x4a4402['position']['getShiftedBy'](_0x4a4402['length'])),_0x1d2579=_0x4a4402['position']['root']['rootName']+':'+_0x4a4402['position']['path'][0x0];else{if('remove'!==_0x4a4402['type'])continue;_0x12eb80=new _0x2af2ad(_0x4a4402['position']),_0x1d2579=_0x4a4402['position']['root']['rootName']+':'+_0x4a4402['position']['path'][0x0];}const _0x2d8ec6=_0x5b85b4['get'](_0x1d2579)||[];if(_0x2d8ec6['length']){for(const _0x406376 of _0x2d8ec6)if(_0x12eb80['root']['rootName']===_0x406376['getRange']()['root']['rootName']&&('insert'!==_0x4a4402['type']||!_0x12eb80['containsRange'](_0x406376['getRange']()))&&(_0x12eb80['isIntersecting'](_0x406376['getRange']())||_0x12eb80['start']['isTouching'](_0x406376['getRange']()['end'])||_0x12eb80['end']['isTouching'](_0x406376['getRange']()['start']))){const _0x526109=this['_parseMarkerName'](_0x406376['name']);Array['from'](this['_markers']['values']())['filter'](_0x38b833=>_0x38b833['groupId']===_0x526109['groupId'])['forEach'](_0x1c88c8=>_0x3d57ae['add'](_0x1c88c8['id']));}}}if(_0x3d57ae['size']){for(const _0x5dfd53 of _0x3d57ae)_0xa081d6['removeMarker'](_0x5dfd53);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x3599c4){for(const {name:_0xc87313,data:_0x2a46e2}of _0x3599c4['model']['document']['differ']['getChangedMarkers']()){if(!_0xc87313['startsWith'](Lh))continue;const _0x3c9f57=_0x2a46e2['oldRange'],_0x418a68=_0x2a46e2['newRange'],_0x2ab7c5=_0x3c9f57&&'$graveyard'===_0x3c9f57['root']['rootName'],_0x13409d=_0x418a68&&'$graveyard'===_0x418a68['root']['rootName'];if(_0x2ab7c5&&_0x13409d)continue;const _0x17c028=this['_parseMarkerName'](_0xc87313);this['_markers']['get'](_0xc87313)&&(_0x13409d||!_0x418a68?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0xc87313,'changeId':_0x17c028['groupId']}):_0x2ab7c5&&_0x418a68&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0xc87313,'changeId':_0x17c028['groupId']}));}}['_parseMarkerName'](_0x485c4c){const _0x32e15f=_0x485c4c['split'](':'),_0x4fcca2=(_0x32e15f[0x1]||'')['split']('_');return{'prefix':_0x32e15f[0x0],'groupId':_0x4fcca2[0x0],'suffix':_0x4fcca2[0x1]};}_translateOperationToEditorContent(_0x150517,_0x250fc8,_0x2205fb){if('insert'===_0x150517['type']){const _0xac3dd1=_0x150517;return new _0x86d081(this['_changePosition'](_0x250fc8['concat'](_0xac3dd1['position']['offset']),_0x2205fb),_0xac3dd1['nodes'],_0xac3dd1['baseVersion']);}if('marker'===_0x150517['type']&&_0x150517['name']['startsWith']('$markedRemove')){const _0x4f101c=_0x150517;return new _0x171060(_0x4f101c['name'],_0x4f101c['oldRange'],this['_changeRange'](_0x4f101c['newRange'],_0x250fc8['concat'](_0x4f101c['newRange']['start']['offset']),_0x250fc8['concat'](_0x4f101c['newRange']['end']['offset']),_0x2205fb),_0x4f101c['_markers'],_0x4f101c['affectsData'],_0x4f101c['baseVersion']);}return _0x150517;}_groupAdjacentOperations(_0x44f8e6){if(!_0x44f8e6['length'])return[];const _0x495b27=[];let _0x5d4df1=0x0,_0x1203db=0x0,_0x20323e=[];for(let _0x5672ce=0x0;_0x5672ce<=_0x44f8e6['length'];_0x5672ce++){const _0x41e0d5=_0x44f8e6[_0x5672ce],_0x4cc9f2=_0x44f8e6[_0x5672ce-0x1];!_0x41e0d5||_0x4cc9f2&&!this['_getOperationEnd'](_0x4cc9f2)['isTouching'](this['_getOperationStart'](_0x41e0d5))?(_0x495b27['push']({'operations':_0x20323e,'operationsIsolated':_0x20323e['map'](_0x498fb5=>this['_shiftOperation'](_0x498fb5['clone'](),-_0x1203db)),'groupOffset':_0x5d4df1}),_0x20323e=_0x41e0d5?[_0x41e0d5]:[],_0x1203db+=_0x5d4df1,_0x5d4df1=0x0):_0x20323e['push'](_0x41e0d5),_0x41e0d5&&'insert'===_0x41e0d5['type']&&(_0x5d4df1+=_0x41e0d5['howMany']);}return _0x495b27;}_findAdjacentContextDistance(_0x1a919f,_0x39eb62,_0x4c2a46,_0x3e3967=0x1){const _0x5c0850=new _0x2a0ccb({'startPosition':_0x1a919f,'direction':_0x39eb62});let _0x726d2f=0x0;for(let _0x5355f1=0x0;_0x5355f1<_0x3e3967;_0x5355f1++){let _0x251850=0x0,_0x3b73cc=!0x1,_0x5cdf4e='forward'===_0x39eb62?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x1aac26}of _0x5c0850)if(_0x1aac26['is']('$textProxy')){const _0x591801=_0x5cdf4e['exec'](_0x1aac26['data']);if(_0x591801&&_0x591801['length']){if(_0x251850+='forward'===_0x39eb62?_0x591801['index']+_0x591801[0x0]['length']:_0x1aac26['data']['length']-_0x591801['index'],_0x591801[0x0]['length']!==_0x1aac26['data']['length'])break;_0x3b73cc=!0x0,_0x5cdf4e='forward'===_0x39eb62?/^\w+/:/\w+$/;}else{if(_0x3b73cc)break;_0x251850+=_0x1aac26['offsetSize'];}}else{if(_0x1aac26['is']('element')){_0x4c2a46['isInline'](_0x1aac26)&&!_0x3b73cc&&(_0x251850+=0x1);break;}}_0x726d2f+=_0x251850,_0x5c0850['jumpTo'](_0x1a919f['getShiftedBy']('forward'===_0x39eb62?_0x726d2f:-_0x726d2f));}return _0x726d2f;}_getChangeContext(_0x2d1b7a,_0x620e2b,_0x15980f){const _0x1d3e60=_0x15980f['model']['schema'],_0x3c7bda=this['_findAdjacentContextDistance'](_0x2d1b7a,'backward',_0x1d3e60,0x6),_0x95483a=this['_findAdjacentContextDistance'](_0x620e2b,'forward',_0x1d3e60,0x6),_0x56419c=_0x2d1b7a['getShiftedBy'](-_0x3c7bda),_0x2a0d25=_0x620e2b['getShiftedBy'](_0x95483a);return{'start':_0x56419c,'end':_0x2a0d25,'hasContentBefore':!_0x56419c['isAtStart'],'hasContentAfter':!_0x2a0d25['isAtEnd']};}_insertMarkers(_0x1533a0,_0x1a1228){const _0x26e2d=this['context']['plugins']['get']('AIEditing'),_0x5240b0=new Set();_0x1a1228['model']['change'](_0x21b148=>{for(const _0x42205c of _0x1533a0){const _0x5a51f7=''+Lh+_0x42205c['type']+':'+_0x42205c['groupId']+'_'+_0x26e2d['_nextDataId'](_0x5240b0);this['_markers']['set'](_0x5a51f7,{'id':_0x5a51f7,'groupId':_0x42205c['groupId'],'type':_0x42205c['type'],'content':_0x42205c['content'],'editor':_0x1a1228}),_0x21b148['addMarker'](_0x5a51f7,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x21b148['createRange'](_0x42205c['start'],_0x42205c['end'])});}});}_createGetContextFn(_0x26db13,_0x1581e6,_0x580e2b){let _0x2217d4='';return()=>{if(!_0x2217d4){const _0x4a7e0d=_0x1581e6['toView'](_0x26db13,{'showSuggestionHighlights':!0x0});let _0x3891a5=_0x4a7e0d['getChild'](0x0);if(_0x3891a5['is']('containerElement')||(_0x3891a5=_0x4a7e0d),!_0x3891a5)return'';let _0x4c2bdf=!0x1;const _0x21599b=[];for(const _0x2c28b0 of _0x3891a5['getChildren']())_0x2c28b0['is']('element','span')&&_0x2c28b0['hasClass']('ck-ai_review-marker_context-end')&&(_0x4c2bdf=!0x1),_0x4c2bdf&&_0x21599b['push'](_0x2c28b0),_0x2c28b0['is']('element','span')&&_0x2c28b0['hasClass']('ck-ai_review-marker_context-start')&&(_0x4c2bdf=!0x0);_0x3891a5['_removeChildren'](0x0,_0x3891a5['childCount']),_0x580e2b?.['ellipsisBefore']&&_0x3891a5['_appendChild']('…'),_0x3891a5['_appendChild'](_0x21599b),_0x580e2b?.['ellipsisAfter']&&_0x3891a5['_appendChild']('…');const _0x58b133=_0x1581e6['htmlProcessor']['domConverter']['viewToDom'](_0x4a7e0d),_0x295b49=_0x1581e6['htmlProcessor']['htmlWriter']['getHtml'](_0x58b133);_0x2217d4=this['_removeUnsupportedElements'](_0x295b49);}return _0x2217d4;};}_createGetContentFn(_0x241258,_0x1fe280){let _0x33af08='';return()=>(_0x33af08||(_0x33af08=this['_removeUnsupportedElements'](_0x1fe280['stringify'](_0x241258,{'showSuggestionHighlights':!0x0}))),_0x33af08);}_createGetContentUsingDataIdFn(_0xdd9fbe,_0x1d39dd,_0x1c79b8){let _0x1acda4='';return()=>{if(!_0x1acda4){const _0x30b1ea=_0x1c79b8['toView'](new _0x5eb9f7(_0xdd9fbe));_0x1acda4=_0x1c79b8['htmlProcessor']['domConverter']['viewToDom'](_0x30b1ea)['querySelector']('[data-id=\x22'+_0x1d39dd+'\x22]')?.['outerHTML']||'';}return _0x1acda4;};}_removeUnsupportedElements(_0x244a5e){if(!_0x244a5e)return'';const _0xf67c22=Rs(_0x244a5e,{'decodeEntities':!0x1}),_0x170992=ys(_0xf67c22);if(!_0x170992['length'])return _0x244a5e;for(const _0x389a25 of _0x170992)_0x4ebff9(_0x389a25);return Os(_0xf67c22,{'encodeEntities':!0x1});}_neutralizeChangesOnUnsupportedElements(_0x17dfa1,_0x2706ad){const _0x97fea0=Rs(_0x17dfa1,{'decodeEntities':!0x1}),_0x5365ee=Rs(_0x2706ad,{'decodeEntities':!0x1}),_0xe40cc1=ys(_0x97fea0),_0x4bb1a3=ys(_0x5365ee);if(!_0xe40cc1['length']&&!_0x4bb1a3['length'])return{'contentInitial':_0x17dfa1,'contentNew':_0x2706ad};const _0x58537c=new Map(),_0x494267=new Map();for(const _0x587c63 of _0xe40cc1){const _0x3017e6=Ps(_0x587c63,'data-id');if(_0x3017e6)_0x58537c['set'](_0x3017e6,_0x587c63);else{const _0x32e4d5=Os(_0x587c63,{'encodeEntities':!0x1}),_0x3d8aa7=_0x494267['get'](_0x32e4d5);_0x3d8aa7?_0x3d8aa7['push'](_0x587c63):_0x494267['set'](_0x32e4d5,[_0x587c63]);}}for(const _0x50a55a of _0x4bb1a3){const _0x1ccb83=Ps(_0x50a55a,'data-id');let _0x4f1c3a;if(_0x1ccb83)_0x4f1c3a=_0x58537c['get'](_0x1ccb83);else{const _0x589904=_0x494267['get'](Os(_0x50a55a,{'encodeEntities':!0x1}));_0x4f1c3a=_0x589904&&_0x589904['length']?_0x589904['shift']():void 0x0;}_0x4f1c3a?_0x444916(_0x50a55a,_0x246402(_0x4f1c3a,!0x0)):_0x4ebff9(_0x50a55a);}return{'contentInitial':Os(_0x97fea0,{'encodeEntities':!0x1}),'contentNew':Os(_0x5365ee,{'encodeEntities':!0x1})};}_findMarkerElement(_0x3fa6ed,_0x919512=0x5){let _0x2a435f=_0x3fa6ed,_0x54e0d6=null;for(let _0x59ac82=0x0;_0x59ac82<_0x919512&&_0x2a435f;_0x59ac82++)if(_0x2a435f['className']){if((''+_0x2a435f['className'])['includes']('ck-ai_review-marker_')){if(!_0x2a435f['getAttribute']('data-marker-id'))break;_0x54e0d6=_0x2a435f;break;}_0x2a435f=_0x2a435f['parentElement'];}else _0x2a435f=_0x2a435f['parentElement'];return _0x54e0d6;}_findMarkerElementById(_0x967ea2){const _0x3ac3e3=this['_markers']['get'](_0x967ea2);if(!_0x3ac3e3)return null;const _0x1805d4=_0x3ac3e3['editor']['model']['markers']['get'](_0x967ea2);return _0x1805d4?_0x196856(_0x3ac3e3['editor']['editing'],_0x1805d4):null;}_getMarkersDataForGroup(_0x332a44){return Array['from'](this['_markers']['values']())['filter'](_0xcf39c=>_0xcf39c['groupId']===_0x332a44);}_getOperationStart(_0x59ce16){return'insert'===_0x59ce16['type']?_0x59ce16['position']:_0x59ce16['newRange']['start'];}_getOperationEnd(_0x46f353,_0x268a0b=!0x1){return'insert'===_0x46f353['type']?_0x268a0b?_0x46f353['position']:_0x46f353['position']['getShiftedBy'](_0x46f353['howMany']):_0x46f353['newRange']['end'];}_shiftOperation(_0x44b41a,_0x4b0b29){return'insert'===_0x44b41a['type']?_0x44b41a['position']=_0x44b41a['position']['getShiftedBy'](_0x4b0b29):'marker'===_0x44b41a['type']&&_0x44b41a['newRange']&&(_0x44b41a['newRange']=new _0x2af2ad(_0x44b41a['newRange']['start']['getShiftedBy'](_0x4b0b29),_0x44b41a['newRange']['end']['getShiftedBy'](_0x4b0b29))),_0x44b41a;}_changeOperationOwnerDocument(_0x55d9fe,_0x3b8101){'insert'===_0x55d9fe['type']?_0x55d9fe['position']=this['_changePositionOwnerDocument'](_0x55d9fe['position'],_0x3b8101):'marker'===_0x55d9fe['type']&&_0x55d9fe['newRange']&&(_0x55d9fe['newRange']=this['_changeRangeOwnerDocument'](_0x55d9fe['newRange'],_0x3b8101));}_changePositionOwnerDocument(_0x2befac,_0x397563){return new _0x53921a(_0x397563,_0x2befac['path']);}_changeRangeOwnerDocument(_0x27544c,_0x1fb31c){return new _0x2af2ad(this['_changePositionOwnerDocument'](_0x27544c['start'],_0x1fb31c),this['_changePositionOwnerDocument'](_0x27544c['end'],_0x1fb31c));}_changePosition(_0x5173bb,_0x460732){return new _0x53921a(_0x460732,[..._0x5173bb]);}['_changeRange'](_0x4242cc,_0x1b0cd8,_0x52ffd9,_0x3dc90e){return new _0x2af2ad(this['_changePosition'](_0x1b0cd8,_0x3dc90e),this['_changePosition'](_0x52ffd9,_0x3dc90e));}_sortMarkers(_0x4d0923){const _0x1c6dc8=_0x2e2b2f=>{switch(_0x2e2b2f){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x4d0923['sort']((_0x19190c,_0x1b2e7a)=>_0x1c6dc8(_0x19190c['type'])-_0x1c6dc8(_0x1b2e7a['type']));}_hasSameTopLevelElement(_0x445526,_0x2eb88f){const _0x51591b=_0x445526['getChild'](0x0),_0x286df2=_0x2eb88f['getChild'](0x0);return!(!_0x51591b||!_0x286df2)&&((!_0x51591b['is']('element')||!_0x286df2['is']('element')||_0x51591b['name']===_0x286df2['name'])&&!(_0x51591b['is']('element')&&!_0x286df2['is']('element')||!_0x51591b['is']('element')&&_0x286df2['is']('element')));}_haveSingleTopLevelElement(_0x258490){return 0x1===_0x258490['childCount'];}_haveOnlyInlineContent(_0xcf2b1f,_0x13b256){for(const _0x2c63d0 of _0xcf2b1f['getChildren']())if(_0x2c63d0['is']('element')&&!_0x13b256['isInline'](_0x2c63d0))return!0x1;return!0x0;}_upsertDataId(_0x2c9a1d,_0x46b44e){let _0x2f1f8e=_0x2c9a1d['getAttribute'](_0x4274f2);return _0x2f1f8e||(_0x2f1f8e=_0x46b44e(),_0x2c9a1d['_setAttribute'](_0x4274f2,_0x2f1f8e)),_0x2f1f8e;}};const Mh=/* #__PURE__ -- @preserve */
|
|
38
|
+
dt();var Uh=class extends Mh{['id'];contentNew;contentInitial;documentVersion;constructor({id:_0x51a8c3,contentNew:_0x2ef53f,contentInitial:_0x1e6f94,documentVersion:_0x287964}){super(),this['id']=_0x51a8c3,this['contentNew']=_0x2ef53f,this['contentInitial']=_0x1e6f94,this['documentVersion']=_0x287964;}};const Vh=/* #__PURE__ -- @preserve */
|
|
39
|
+
At();var Bh=class extends Vh{['id'];parent;editor;_data;_editorOperations=[];constructor(_0x3d3b7d,_0x472a63,_0x1aef7e,_0x5001ab){super(),this['id']=_0x3d3b7d,this['parent']=_0x1aef7e,this['editor']=_0x5001ab,this['_data']=_0x472a63,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']['wrapperTag']?function(_0x15db44){const _0x283ab3=Rs(_0x15db44)['children']['filter'](_0x438723);return 0x1!==_0x283ab3['length']?_0x15db44:_0x283ab3[0x0]['children']['map'](_0x56cdfe=>Os(_0x56cdfe))['join']('');}(this['_data']['context']()):this['_data']['context']();}get['wrapperTag'](){return this['_data']['wrapperTag'];}get operations(){return this['_data']['operations']['slice']();}get operationsIsolated(){return this['_data']['operationsIsolated']['slice']();}};const Gh=/* #__PURE__ -- @preserve */
|
|
40
|
+
At();var Fh=class extends Gh{['id']=kt();['callId'];_results=new Map();['_changes']=[];_hasUnsupportedInlineChange=!0x1;['_sourceCheck'];_documentData;_aiConnector;['_reviewParams'];['_reviewArgs'];_contexts;_activeRequest=null;_currentError;_wasAborted=!0x1;constructor(_0x22edcf,_0x51c1f1,_0x32be6d,_0x3457b8,_0x775b1f,_0xa9aab5){super(),this['_sourceCheck']=_0x51c1f1,this['_documentData']=_0x22edcf,this['_aiConnector']=_0x32be6d,this['_reviewParams']=_0x3457b8,this['_reviewArgs']=_0x775b1f,this['_contexts']=_0xa9aab5,this['on']('change:status',(_0x44530c,_0x47a0a1,_0x1bbf1b)=>{'aborted'==_0x1bbf1b&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x1bbf1b,'run':this,'error':this['_currentError']});}),this['set']('status','initialized');}get documentData(){return this['_documentData'];}get['sourceCheck'](){return this['_sourceCheck'];}get processedResultsCount(){return this['_results']['size'];}get hasUnsupportedInlineChange(){return this['_hasUnsupportedInlineChange'];}get title(){return this['_sourceCheck']['title'];}get subTitle(){return'';}get['reviewName'](){return this['_sourceCheck']['id'];}get hasModifications(){return!this['_changes']['every'](_0x5e3981=>'pending'===_0x5e3981['status']);}get currentError(){return this['_currentError'];}get results(){return Array['from'](this['_results']['values']());}updateDocumentData(_0x3fd92c){this['_documentData']=_0x3fd92c;}async start(){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x5aedc4=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x171a06 of _0x5aedc4)'unmodified'!==_0x171a06['data']['operation']&&('error'!==_0x171a06['data']['operation']?'review-metadata'!==_0x171a06['event']?this['_addReviewCheckResult'](_0x171a06['data']['dataId'],_0x171a06['data']['textDelta']):this['callId']=_0x171a06['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(_0x275f4d){this['_currentError']=_0x275f4d,kn(_0x275f4d)?this['status']='aborted':this['status']='error-general';}finally{this['_activeRequest']=null;}}async restart(){this['_results']['clear'](),this['_changes']['length']=0x0,this['_currentError']=void 0x0,this['_hasUnsupportedInlineChange']=!0x1,await this['start']();}addResultChanges(_0x5521c9,_0x26438f){const _0x53c351=this['_results']['get'](_0x5521c9);if(!_0x53c351)return;if(0x0===_0x26438f['length'])return;const _0x207bbd=this['_documentData']['elements']['get'](_0x5521c9);if(!_0x207bbd)return;const _0x4c2715=[];_0x26438f['forEach']((_0x2aa830,_0x357faf)=>{const _0x4d15bb=new Bh(_0x53c351['id']+'-'+_0x357faf,_0x2aa830,_0x53c351,_0x207bbd['editor']);_0x4d15bb['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x4d15bb,'status':_0x4d15bb['status']});}),_0x4d15bb['on']('change:isActivated',()=>{_0x4d15bb['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x4d15bb}):this['fire']('reviewCheckResultDeactivated',{'change':_0x4d15bb});}),this['_changes']['push'](_0x4d15bb),_0x4c2715['push'](_0x4d15bb);}),this['fire']('reviewCheckResultReady',{'changes':_0x4c2715,'result':_0x53c351,'source':this});}abort(){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}isChangeActive(_0x220da3){const _0x2a1905=this['_changes']['find'](_0x2b3d1e=>_0x2b3d1e['id']===_0x220da3);return!(!_0x2a1905||'pending'!==_0x2a1905['status']);}isAnyChangeActivated(){return this['_changes']['some'](_0x46ee60=>!0x0===_0x46ee60['isActivated']);}getActiveChanges(){return this['_changes']['filter'](_0x16153e=>'pending'===_0x16153e['status']);}getChangeById(_0x122b1f){return this['_changes']['find'](_0x4cc1f1=>_0x4cc1f1['id']===_0x122b1f);}markAllChangesAsAccepted(){for(const _0x46398c of this['_changes'])'pending'===_0x46398c['status']&&(_0x46398c['status']='accepted');this['_checkIfFinished']();}markChangeAsAccepted(_0x275ca7){const _0x2c5f0d=this['_changes']['find'](_0x377d56=>_0x377d56['id']===_0x275ca7);_0x2c5f0d&&'pending'===_0x2c5f0d['status']&&(_0x2c5f0d['status']='accepted'),this['_checkIfFinished']();}markChangeAsRejected(_0x280569){const _0x56719f=this['_changes']['find'](_0x188e26=>_0x188e26['id']===_0x280569);_0x56719f&&'pending'===_0x56719f['status']&&(_0x56719f['status']='rejected'),this['_checkIfFinished']();}markChangeAsOutdated(_0xc37ba7){const _0x4b53cf=this['_changes']['find'](_0x387c9a=>_0x387c9a['id']===_0xc37ba7);_0x4b53cf&&'pending'===_0x4b53cf['status']&&(_0x4b53cf['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x3af95a){const _0x5d3659=this['_changes']['find'](_0x65bd38=>_0x65bd38['id']===_0x3af95a);_0x5d3659&&'outdated'===_0x5d3659['status']&&(_0x5d3659['status']='pending'),this['_checkIfFinished']();}activateChange(_0x1fe74f){this['_changes']['filter'](_0x4aa71d=>_0x4aa71d['isActivated']&&_0x4aa71d['id']!==_0x1fe74f)['forEach'](_0x256ddb=>{_0x256ddb['isActivated']=!0x1;});const _0x496a57=this['_changes']['find'](_0x2dcd17=>_0x2dcd17['id']===_0x1fe74f);_0x496a57&&'pending'===_0x496a57['status']&&(_0x496a57['isActivated']=!0x0);}deactivateChange(){this['_changes']['filter'](_0x5cc8eb=>_0x5cc8eb['isActivated'])['forEach'](_0x201631=>{_0x201631['isActivated']=!0x1;});}forceReadyState(){this['status']='ready';}async sendRating(_0x63bf95){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x3aab46;if(_0x63bf95){const _0x1dfd30=this['_changes']['find'](_0x2a8e44=>_0x2a8e44['id']===_0x63bf95);if(_0x1dfd30&&_0x1dfd30['isRated'])return;_0x1dfd30&&(_0x3aab46=_0x1dfd30['parent']['id'],_0x1dfd30['isRated']=!0x0);}const _0x3bff84={'positiveCount':this['_changes']['filter'](_0x5893c2=>'accepted'===_0x5893c2['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x3bff84,this['callId'],_0x3aab46);}_addReviewCheckResult(_0x5e4934,_0x83c69e){const _0x253897=this['_documentData']['elements']['get'](_0x5e4934);if(!_0x253897)return;if(Gs(_0x253897['editor'],_0x253897['rootName'])&&!Ys(_0x253897['editor'],Rs(_0x83c69e)))return void(this['_hasUnsupportedInlineChange']=!0x0);const _0x52f64c=_0x253897['getContent']();if(_0x52f64c===_0x83c69e)return;const _0x51aca7=new Uh({'id':_0x5e4934,'contentInitial':_0x52f64c,'contentNew':_0x83c69e,'documentVersion':_0x253897['documentVersion']});this['_results']['set'](_0x51aca7['id'],_0x51aca7),this['fire']('reviewCheckResultAdded',{'result':_0x51aca7,'source':this,'editor':_0x253897['editor'],'rootName':_0x253897['rootName']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0x49d83c=>'pending'===_0x49d83c['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x2d2b8b=>'pending'===_0x2d2b8b['status'])['length']&&(this['status']='finished');}},Kh=class extends Fh{get subTitle(){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x153475=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x41612c=0x0;_0x41612c<this['_reviewParams']['length'];_0x41612c++){if(!this['_reviewParams'][_0x41612c]||!this['_sourceCheck']['options'][_0x41612c])continue;const _0x25e77c=this['_sourceCheck']['options'][_0x41612c]['data']?.['find'](_0x206300=>_0x206300['id']===this['_reviewParams'][_0x41612c]);_0x25e77c&&_0x153475['push'](_0x25e77c['label']);}return _0x153475['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}_createApiRequest(){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs'],'contexts':this['_contexts']});}_sendRatingRequest(_0x5d37fa,_0x5069bf,_0x4677ef){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x5069bf,_0x5d37fa,_0x4677ef);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},Wh=class extends _0x212144{_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',(_0x320c61,_0x1e1be2)=>this['runCheck'](_0x1e1be2)),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 _0x2e7b7c=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x2e7b7c['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x2e7b7c['map'](_0x19e246=>_0x19e246['id']),this['_aiSource']);const _0x5d4fca=this['_currentReviewCheckRun'];_0x5d4fca['markAllChangesAsAccepted'](),_0x5d4fca['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x597968,_0x4164d3)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x4164d3['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x4164d3['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x4164d3['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x4164d3['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x3a5bee,_0x4f4ff8)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x4f4ff8['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x4f4ff8['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x4f4ff8['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x4f4ff8['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'retryReview',async()=>{this['_currentReviewCheckRun']&&(this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreUi']['setAcceptAllEnabled'](!0x1),this['_currentReviewCheckRun']['updateDocumentData'](this['_aiReviewCoreEditing']['getDocumentData']()),await this['_currentReviewCheckRun']['restart']());}),this['listenTo'](this['_aiReviewCoreUi'],'activateChange',(_0x4e195d,_0x171f11)=>{this['_onActivateChange'](_0x171f11);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x359206,_0x3d6cf4)=>{this['_onDeactivateChange'](_0x3d6cf4);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0xebf68d,_0xba26f8)=>{this['_onChangeMarkerClicked'](_0xebf68d,_0xba26f8);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x43ad40,_0x573f8a)=>{this['_onChangeMarkerHovered'](_0x43ad40,_0x573f8a);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x4b862d,_0x38419e)=>{this['_onChangeMarkerRemoved'](_0x4b862d,_0x38419e);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x19bf2c,_0x104db6)=>{this['_onChangeMarkerRestored'](_0x19bf2c,_0x104db6);});}async['runCheck'](_0x4c6e6a){if(!this['_availableReviewChecks'])return;const _0x11ebe7=this['_availableReviewChecks']['find'](_0x4a713e=>_0x4a713e['id']===_0x4c6e6a['id']);if(!_0x11ebe7)return void this['_logError'](new ct('ai-review-mode-source-check-not-found',this,{'checkId':_0x4c6e6a['id']}));this['_onReviewCheckRun'](_0x4c6e6a),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_aiReviewCoreUi']['setAcceptAllEnabled'](!0x1);const _0x46fa53=this['context']['plugins']['get'](fs)['contextLibrary']['resolveContext']({'feature':this['_defaultContextFeature'],'ids':[_0x4c6e6a['id']],'context':new Yn()});this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x4c6e6a,_0x11ebe7,_0x46fa53);const _0x88896c=this['_currentReviewCheckRun'];_0x88896c['on']('reviewCheckResultChangeStatusUpdated',(_0x20d02e,_0x5a2527)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x5a2527['change']['id'],_0x5a2527['status']),this['_pushAcceptAllEnabled'](_0x88896c);}),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x216909,_0x521258)=>{switch(_0x521258['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x521258);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_currentReviewCheckRun']?.['hasUnsupportedInlineChange']?this['_aiReviewCoreUi']['showUnsupportedInlineChangeView']():this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_currentReviewCheckRun']?.['hasUnsupportedInlineChange']?this['_aiReviewCoreUi']['showUnsupportedInlineChangeView']():this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new ct('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new ct('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'!==_0x521258['status']&&'error-chunk'!==_0x521258['status']&&'error-general'!==_0x521258['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x2977f3,_0x3f664e)=>{if(!this['_currentReviewCheckRun'])throw new ct('ai-review-mode-no-current-check-run',this);const _0x47d547=Gs(_0x3f664e['editor'],_0x3f664e['rootName']);let _0x376666=_0x3f664e['result']['contentInitial'],_0x130d07=_0x3f664e['result']['contentNew'];_0x47d547&&(_0x376666=Ws(_0x376666),_0x130d07=Ws(_0x130d07));const _0x5cc97b=this['_diffContent'](_0x3f664e['editor'],_0x376666,_0x130d07);if(_0x47d547){const _0xd045aa=_0x3f664e['editor']['ui']['getEditableElement'](_0x3f664e['rootName'])?.['tagName']['toLowerCase']();for(const _0x4c3eda of _0x5cc97b)_0x4c3eda['wrapperTag']=_0xd045aa;}_0x3f664e['source']['addResultChanges'](_0x3f664e['result']['id'],_0x5cc97b);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x59aea6,_0xb3e476)=>{for(const _0x1e1c2b of _0xb3e476['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x1e1c2b);this['_pushAcceptAllEnabled'](_0xb3e476['source']),this['_markChangePositionInEditorContent'](_0xb3e476['changes'],_0xb3e476['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x2c13d5,_0xce020f)=>{this['_onReviewCheckResultActivated'](_0xce020f);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x263f83){if(kn(_0x263f83))return;_0x263f83 instanceof ct?this['_logError'](_0x263f83):this['_logError'](new ct('ai-review-mode-check-run-failed',this,void 0x0,_0x263f83));}}abort(){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}getAvailableChecks(){return(this['_availableReviewChecks']??[])['slice']();}getCurrentCheckRun(){return this['_currentReviewCheckRun'];}_pushAcceptAllEnabled(_0x16f457){this['_aiReviewCoreUi']['setAcceptAllEnabled'](_0x16f457['getActiveChanges']()['length']>0x0);}_createReviewCheckRun(_0x23700c,_0x33a160,_0x402907=new Yn()){return new Kh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x33a160,this['_aiConnector'],_0x23700c['params'],_0x23700c['args'],_0x402907['refs']);}['_onChangeMarkerRemoved'](_0x2b2585,_0x2f4fb2){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x2f4fb2['changeId']);}_onChangeMarkerRestored(_0x59e92b,_0x2bf8e4){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x2bf8e4['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}_initRequiredPlugins(){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](Nn)['createReporter']('aireview');}['_onReviewRunLeave'](_0x26a3b5=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x26a3b5&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x2eaf72 of this['_aiReviewCoreEditing']['getEditors']())_0x2eaf72['editing']['view']['change'](_0x38f62a=>{for(const _0x2a9984 of _0x2eaf72['editing']['view']['document']['getRoots']())_0x38f62a['removeClass']('ck-ai_review-diff',_0x2a9984),_0x38f62a['removeClass']('ck-ai_review-highlights',_0x2a9984),_0x38f62a['removeClass']('ck-ai-translate-mode-content',_0x2a9984);});}['_logError'](_0x3ef0de){this['_reporter']['logError'](_0x3ef0de),'ai-review-mode-models-unable-to-retrieve'===function(_0x35bf8c){return _0x35bf8c instanceof yn?_0x35bf8c['code']:_0x35bf8c instanceof Error?_0x35bf8c['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x3ef0de)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0x5db99b){if('content'===this['_changeActivationSource']){const _0x183d3e=this['_aiReviewCoreUi']['getChangeElement'](_0x5db99b);_0x183d3e&&Rt(_0x183d3e['closest']('.ck-ai_review__check-run-result')||_0x183d3e);}else{if('panel'===this['_changeActivationSource']){const _0x3b3f40=this['_getChangeContentElement'](_0x5db99b);if(!_0x3b3f40)return;Ot({'target':_0x3b3f40,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},Yh=class extends Fh{_prompt;['_model'];constructor(_0x405b23,_0x5283df,_0x3c73ae,_0x5d0f71,_0x4e8eeb,_0x382ebb){super(_0x3c73ae,_0x5d0f71,_0x4e8eeb,void 0x0,void 0x0,_0x382ebb),this['_prompt']=_0x405b23,this['_model']=_0x5283df;}get subTitle(){return this['_prompt']??'';}_createApiRequest(){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],...void 0x0!==this['_prompt']&&{'prompt':this['_prompt']},'model':this['_model'],'contexts':this['_contexts']});}_sendRatingRequest(_0x596c4a,_0x3da051,_0xf887e3){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x3da051,_0x596c4a,_0xf887e3);}},$h=class{['id'];['commandId'];title;description;isParameterized;['useArgs'];options;['args'];get['apiId'](){return this['commandId'];}constructor(_0xc34345){this['id']=_0xc34345['id'],this['commandId']=_0xc34345['commandId'],this['title']=_0xc34345['title'],this['description']=_0xc34345['description'],this['isParameterized']=_0xc34345['isParameterized'],this['useArgs']=_0xc34345['useArgs'],this['options']=_0xc34345['options'],this['args']=_0xc34345['args'];}},qh=class extends $h{isExtra=!0x0;prompt;context;['model'];_defaultModel=null;constructor(_0x495cd3,_0x211977,_0x98dc0a){super(_0x495cd3),this['prompt']=_0x495cd3['prompt'],this['context']=_0x495cd3['context'],this['model']=_0x495cd3['model'],this['model']?this['_defaultModel']=_0x211977['find'](_0x227c15=>_0x227c15['id']===this['model'])||null:this['_defaultModel']=_0x98dc0a;}get defaultModel(){return this['_defaultModel'];}},Qh=class extends Yh{get subTitle(){return'';}set prompt(_0x54c5bb){this['_prompt']=_0x54c5bb;}set['model'](_0x24e1ee){this['_model']=_0x24e1ee;}},Xh=class extends _0x212144{static get requires(){return[Is,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 zh=[{'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'}]}]}],jh=/* #__PURE__ -- @preserve */
|
|
41
|
+
At();var Jh=class extends jh{['_checks']=[];setupChecks(_0x5ef3a9){this['_checks']=_0x5ef3a9['map'](_0x118191=>new $h(_0x118191));}get['checks'](){return this['_checks']['slice']();}getCheckById(_0x412f9e){return this['checks']['find'](_0xfae965=>_0xfae965['id']===_0x412f9e);}['removeCheckById'](_0x28807c){this['_checks']=this['_checks']['filter'](_0xa79a3f=>_0xa79a3f['id']!==_0x28807c);}},Zh=class extends $h{['_models']=[];_defaultModel=null;constructor(_0x174fc1,_0x3ba9e3,_0x33c4ab){super(_0x174fc1),this['_models']=_0x3ba9e3,this['_defaultModel']=_0x33c4ab;}get['models'](){return this['_models']['slice']();}get defaultModel(){return this['_defaultModel'];}},tc=class extends Jh{['_allModels']=[];['_recommendedModels']=[];_defaultModel=null;constructor(_0x240ae7,_0x3863bc,_0x2f2707){super(),this['_allModels']=_0x240ae7,this['_recommendedModels']=_0x3863bc,this['_defaultModel']=_0x2f2707;}get['allModels'](){return this['_allModels']['slice']();}setupChecks(_0x346763){this['_checks']=_0x346763['map'](_0x15ea47=>!0x0===_0x15ea47['isExtra']?new qh(_0x15ea47,this['_allModels'],this['_defaultModel']):'custom'===_0x15ea47['id']?new Zh(_0x15ea47,this['_recommendedModels'],this['_defaultModel']):new $h(_0x15ea47));}},ec=class extends Xh{static get['pluginName'](){return'AIReviewModeCheckRegistry';}static get requires(){return[Is,Nn,fs];}['_modelsLoadError']=null;constructor(_0x2dba09){super(_0x2dba09),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}getExtraChecks(){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x5ca1bc=>({'id':_0x5ca1bc['id'],'commandId':_0x5ca1bc['id'],'title':_0x5ca1bc['label'],'description':_0x5ca1bc['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x5ca1bc['prompt'],'context':_0x5ca1bc['context'],'model':_0x5ca1bc['model']}));}async _loadChecksList(){const _0x4b268a=[...zh,...this['getExtraChecks']()]['map'](_0x501174=>_0x501174['isExtra']?_0x501174:this['_translateReviewCheck'](_0x501174)),_0x41410a=this['context']['plugins']['get'](fs);let _0x178f88;try{_0x178f88=new tc(await _0x41410a['models']['getAllModels'](),await _0x41410a['models']['getAvailableModels'](),await _0x41410a['models']['getDefault']()),this['_modelsLoadError']=null;}catch(_0x24adce){this['_modelsLoadError']=new ct('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x24adce),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),_0x178f88=new tc([],[],null);}return _0x178f88['setupChecks'](_0x4b268a),_0x178f88;}_translateReviewCheck(_0x2b5ff2){const _0x30a129='AI_REVIEW_CHECK_'+_0x2b5ff2['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x18f324={..._0x2b5ff2,'title':this['_translate'](_0x30a129+'_TITLE',_0x2b5ff2['title']),'description':this['_translate'](_0x30a129+'_DESCRIPTION',_0x2b5ff2['description'])};return _0x2b5ff2['options']&&(_0x18f324['options']=_0x2b5ff2['options']['map'](_0x189be4=>({..._0x189be4,'label':this['_translate'](_0x30a129+'_OPTIONS_LABEL',_0x189be4['label']||''),'data':_0x189be4['data']?_0x189be4['data']['map'](_0x39c9fc=>({..._0x39c9fc,'label':this['_translate'](_0x30a129+'_OPTIONS_DATA_'+_0x39c9fc['id']['toUpperCase'](),_0x39c9fc['label'])})):void 0x0}))),_0x18f324;}_translate(_0x5903c8,_0x513368){const _0x3ee3a5=Es(this['context']['locale'],_0x5903c8);return _0x3ee3a5===_0x5903c8?_0x513368:_0x3ee3a5;}},ic=class extends Wh{static get['pluginName'](){return'AIReviewModeController';}static get requires(){return[Nn,ec,fs];}get['_aiSource'](){return'review';}get _defaultContextFeature(){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x356ff0){super(_0x356ff0),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',zh['map'](_0x184d25=>_0x184d25['id']));}init(){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0xebaa0b,_0x31c7c1)=>{this['_isDiffOn']=_0x31c7c1['on'],this['_onDiffChange'](this['_isDiffOn']);});}_initRequiredPlugins(){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}_createReviewCheckRun(_0x557ffd,_0x540d6e,_0x37b07a=new Yn()){if(_0x557ffd['isCustom'])return new Yh(_0x557ffd['args']['prompt'],_0x557ffd['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x540d6e,this['_aiConnector'],_0x37b07a['refs']);if(_0x540d6e['isExtra']){const _0xec897f=_0x540d6e,_0x107e75=_0xec897f['context']?_0x37b07a['cloneWith'](_0xec897f['context'])['refs']:_0x37b07a['refs'];return new Qh(_0x557ffd['args']?.['prompt']??_0xec897f['prompt'],_0x557ffd['args']?.['model']??_0xec897f['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x540d6e,this['_aiConnector'],_0x107e75);}return new Kh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x540d6e,this['_aiConnector'],_0x557ffd['params'],_0x557ffd['args'],_0x37b07a['refs']);}_onReviewCheckResultActivated(_0x5857d0){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x5857d0['change']['id']),this['_scrollToChange'](_0x5857d0['change']['id']);const _0x3c5ae3=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x5857d0['change']['id']);if(!_0x3c5ae3)return;const _0x5dfed1=this['_aiReviewCoreEditing']['getEditorForChange'](_0x5857d0['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x5857d0['change'],()=>_0x3c5ae3['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x5dfed1,_0x3c5ae3['modelRange']['root']['rootName']),_0x5dfed1?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x5857d0['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}_onActivateChange(_0x5b82ed){this['_currentReviewCheckRun']&&'click'===_0x5b82ed['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x5b82ed['id']));}_onDeactivateChange(_0x4a92d3){this['_currentReviewCheckRun']&&'balloon'===_0x4a92d3['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x49ce9a,_0x1dac76){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x1dac76['changeId']);const _0x41cfb3=this['_currentReviewCheckRun']['getChangeById'](_0x1dac76['changeId']);if(!_0x41cfb3)return;const _0x4a2382=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x1dac76['changeId']),_0x86da73=this['_aiReviewCoreEditing']['getEditorForChange'](_0x1dac76['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x41cfb3,_0x1dac76['markerElement'],_0x1dac76['domEvent'],'click',this['_getBalloonDomRoot'](_0x86da73,_0x4a2382?.['modelRange']['root']['rootName']),_0x86da73?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x23ca81,_0x5c4197){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0xbe6452=this['_currentReviewCheckRun']['getChangeById'](_0x5c4197['changeId']);if(!_0xbe6452)return;const _0x1eea04=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x5c4197['changeId']),_0x41ebee=this['_aiReviewCoreEditing']['getEditorForChange'](_0x5c4197['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0xbe6452,_0x5c4197['markerElement'],_0x5c4197['domEvent'],'hover',this['_getBalloonDomRoot'](_0x41ebee,_0x1eea04?.['modelRange']['root']['rootName']),_0x41ebee?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}_getChangeContentElement(_0x175ce0){const _0x3185cf=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x175ce0);return _0x3185cf?_0x3185cf['getElement']():null;}_markChangePositionInEditorContent(_0x34c69d,_0x104f3f){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x34c69d,_0x104f3f);}_diffContent(_0x278f6f,_0xfe1f8,_0x19ba54){return this['_aiReviewCoreEditing']['diffContent'](_0x278f6f,_0xfe1f8,_0x19ba54,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x1d0be5){_0x1d0be5?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x552789 of this['_aiReviewCoreEditing']['getEditors']())_0x552789['editing']['view']['change'](_0x16a6e7=>{for(const _0x37b514 of _0x552789['editing']['view']['document']['getRoots']()){for(const _0x433b24 of _0x37b514['getClassNames']())_0x433b24['startsWith']('ck-ai_review-')&&_0x16a6e7['removeClass'](_0x433b24,_0x37b514);_0x16a6e7['addClass'](_0x1d0be5?'ck-ai_review-diff':'ck-ai_review-highlights',_0x37b514);}});}_getBalloonDomRoot(_0xbf8933,_0x218142){const _0x126031=_0xbf8933['editing']['view'];if(_0x218142){const _0x41ac1c=_0x126031['getDomRoot'](_0x218142);if(_0x41ac1c)return _0x41ac1c;}return _0x126031['getDomRoot']()??void 0x0;}async _getReviewChecks(){const _0x1dbadf=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x5e588b=await _0x1dbadf['getChecksList']();_0x1dbadf['modelsLoadError']&&this['_logError'](_0x1dbadf['modelsLoadError']);let _0x3f2758=_0x5e588b['checks'];const _0x402db4=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x402db4,_0x3f2758),this['_usesAvailableCommandsConfig']&&(_0x3f2758=_0x402db4['map'](_0x28bf42=>_0x3f2758['find'](_0x2ad90d=>_0x2ad90d['id']===_0x28bf42))['filter'](_0x162bb2=>!!_0x162bb2)),this['_filterChecksWithMissingModel'](_0x3f2758);}_logWarningForNonExistentChecks(_0x121712,_0x35548b){const _0x3a126a=_0x121712['filter'](_0x32955f=>!_0x35548b['some'](_0x120772=>_0x120772['id']===_0x32955f));_0x3a126a['length']&&this['_reporter']['logError'](new yn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x3a126a['join'](',\x20')}}));}_filterChecksWithMissingModel(_0x219d23){const _0x1c647b=[];return _0x219d23['forEach'](_0x571ab5=>{(_0x571ab5 instanceof qh&&!_0x571ab5['defaultModel']||_0x571ab5 instanceof Zh&&!_0x571ab5['models']['length'])&&_0x1c647b['push'](_0x571ab5['id']);}),_0x1c647b['length']&&_0x1c647b['forEach'](_0x4b830f=>{_0x219d23=_0x219d23['filter'](_0x59525b=>_0x59525b['id']!==_0x4b830f),this['_reporter']['logError'](new yn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x4b830f}}));}),_0x219d23;}},sc=class extends _0x212144{static get['pluginName'](){return'AIReviewGateway';}static get requires(){return[Hh,ec,Is,tn,Tn,fs];}get['models'](){return this['context']['plugins']['get'](fs)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async getAllCommands(){return(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['map'](_0x4d1ea5=>{const _0x1fad13={'id':_0x4d1ea5['id'],'title':_0x4d1ea5['title'],'description':_0x4d1ea5['description']};return'custom'!==_0x4d1ea5['id']&&_0x4d1ea5['options']?.['length']&&(_0x1fad13['parameters']=_0x4d1ea5['options'][0x0]['data']['map'](_0xae901f=>({..._0xae901f}))),_0x1fad13;});}async['runReview'](_0xd6a4a8,_0x3c04e3){const _0x2aad19=await this['_resolveReviewCheck'](_0xd6a4a8),_0x5cb155=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x23d12b=this['context']['plugins']['get']('AIConnector'),_0x3cff5b=_0x5cb155['getDocumentData']({'roots':_0x3c04e3?.['roots']}),_0x36d85f=this['_createReviewCheckRun'](_0x2aad19,_0x3cff5b,_0x23d12b,_0x3c04e3?.['parameterId'],_0x3c04e3?.['contexts']);return _0x5cb155['runCheck'](_0x36d85f,{'signal':_0x3c04e3?.['signal']});}async runCustomReview(_0x206a79,_0xb1d770){const {reviewCheck:_0x4519d1,resolvedModel:_0x3223fa}=await this['_resolveCustomReviewCheck'](_0x206a79,_0xb1d770?.['model']),_0x4eb4a7=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x27a38e=this['context']['plugins']['get']('AIConnector'),_0x294a4f=new Yh(_0x206a79,_0x3223fa,_0x4eb4a7['getDocumentData']({'roots':_0xb1d770?.['roots']}),_0x4519d1,_0x27a38e,_0xb1d770?.['contexts']);return _0x4eb4a7['runCheck'](_0x294a4f,{'signal':_0xb1d770?.['signal']});}['applyReview'](_0x211d7b,_0x3f9df7){this['context']['plugins']['get']('AIGateway')['apply'](_0x211d7b,{'aiSource':'review',..._0x3f9df7});}async['_resolveReviewCheck'](_0x59ba12){const _0x3090b6=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x477cfd=>_0x477cfd['id']===_0x59ba12);if(!_0x3090b6)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0x59ba12});if(_0x3090b6 instanceof Zh)throw new ct('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x59ba12});if(_0x3090b6 instanceof qh&&!_0x3090b6['defaultModel']?.['id'])throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x59ba12});return _0x3090b6;}async _resolveCustomReviewCheck(_0x53b1ed,_0x36ae44){const _0x506d7a='custom',_0xe5c70c=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x200fb3=>_0x200fb3['id']===_0x506d7a);if(!_0xe5c70c)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0x506d7a});if(!(_0xe5c70c instanceof Zh))throw new ct('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x506d7a});if(!_0x53b1ed)throw new ct('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x506d7a});const _0x8d60d7=_0x36ae44??_0xe5c70c['defaultModel']?.['id'];if(!_0x8d60d7)throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x506d7a});return{'reviewCheck':_0xe5c70c,'resolvedModel':_0x8d60d7};}_createReviewCheckRun(_0x4417f3,_0xc07fc7,_0x4b4187,_0x5b567e,_0x29917a=[]){if(_0x4417f3 instanceof qh){const _0x4c727f=_0x4417f3['context']?[..._0x29917a,_0x4417f3['context']]:_0x29917a;return new Qh(_0x4417f3['prompt'],_0x4417f3['defaultModel']['id'],_0xc07fc7,_0x4417f3,_0x4b4187,_0x4c727f);}return new Kh(_0xc07fc7,_0x4417f3,_0x4b4187,_0x5b567e?[_0x5b567e]:void 0x0,void 0x0,_0x29917a);}},nc=class extends _0x212144{static get requires(){return[ic,Nh,Hh,sc];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async startReview(_0x55ee26,_0x125c68){if(this['assertStartReviewPreconditions'](_0x55ee26)instanceof Zh)throw new ct('ai-reviewmode-not-a-system-command',this,{'commandId':_0x55ee26});nh(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x55ee26,'params':_0x125c68?.['parameterId']?[_0x125c68['parameterId']]:void 0x0});}async startCustomReview(_0x35e5dc,_0x1d6c9d){if(!_0x35e5dc)throw new ct('ai-reviewmode-missing-custom-command-prompt',this);const _0x2e148a=zh['find'](_0x19d9e1=>'custom'===_0x19d9e1['commandId'])['id'],_0x1edda6=this['assertStartReviewPreconditions'](_0x2e148a),_0x710f40=_0x1d6c9d?.['model']??_0x1edda6['defaultModel']?.['id'];if(!_0x710f40)throw new ct('ai-reviewmode-missing-custom-command-model',this);nh(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x2e148a,'isCustom':!0x0,'args':{'prompt':_0x35e5dc,'model':_0x710f40}});}getAvailableCommands(){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x5237c9=>{const _0x102d59={'id':_0x5237c9['id'],'title':_0x5237c9['title'],'description':_0x5237c9['description']};return'custom'!==_0x5237c9['id']&&_0x5237c9['options']?.['length']&&(_0x102d59['parameters']=_0x5237c9['options'][0x0]['data']['map'](_0x245d6b=>({..._0x245d6b}))),_0x102d59;});}assertStartReviewPreconditions(_0x33a560){const _0x10b264=this['context']['plugins']['get']('AIReviewModeController');if(_0x10b264['getCurrentCheckRun']())throw new ct('ai-reviewmode-review-already-running',this);const _0xa6e862=_0x10b264['getAvailableChecks']()['find'](_0x3f06a7=>_0x3f06a7['id']===_0x33a560);if(!_0xa6e862)throw new ct('ai-reviewmode-unknown-command',this,{'commandId':_0x33a560});return _0xa6e862;}},rc=class extends Kh{_title;constructor(_0x44be6b,_0x5d05e0,_0x2fd4cc,_0x4380f6,_0x431743,_0x3898a4,_0x147cb8){super(_0x44be6b,_0x5d05e0,_0x2fd4cc,_0x431743,_0x3898a4,_0x147cb8),this['_title']=_0x4380f6;}get title(){return this['_title'];}get subTitle(){return this['_sourceCheck']['title'];}},oc=class extends $h{get['apiId'](){return'translate';}},ac=class extends Jh{setupChecks(_0x369c7b){this['_checks']=_0x369c7b['map'](_0x5dde85=>new oc(_0x5dde85));}};const hc=[{'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 cc=class extends Xh{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x1f9f90){super(_0x1f9f90),this['context']['config']['define']('ai.translate.languages',hc);}async _loadChecksList(){const _0x27073c=[],_0x207e9d=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x29cfc6 of _0x207e9d)_0x27073c['push']({'title':_0x29cfc6['label'],'id':_0x29cfc6['id'],'commandId':_0x29cfc6['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x29cfc6['id']}});const _0x10636f=new ac();return _0x10636f['setupChecks'](this['_translateChecks'](_0x27073c)),_0x10636f;}_translateChecks(_0x2458d7){const _0x16df42=this['context']['locale'];return _0x2458d7['map'](_0x4fbc21=>{const _0x27e888='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x4fbc21['title']['toUpperCase']()['replaceAll']('-','_'),_0x5d5e65=Es(_0x16df42,_0x27e888);return{..._0x4fbc21,'title':_0x5d5e65===_0x27e888?_0x4fbc21['title']:_0x5d5e65};});}},lc=class extends Wh{static get['pluginName'](){return'AITranslateController';}static get requires(){return[Nn,cc,fs];}get['_aiSource'](){return'translate';}get _defaultContextFeature(){return'translate';}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}_initRequiredPlugins(){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}_createReviewCheckRun(_0x4d8fb6,_0x4c4c67,_0x42f1ca){return new rc(this['_aiReviewCoreEditing']['getDocumentData'](),_0x4c4c67,this['_aiConnector'],Es(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x4d8fb6['params'],_0x4d8fb6['args'],_0x42f1ca?.['refs']);}_onReviewCheckResultActivated(_0x811bab){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x811bab['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x811bab['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}_onActivateChange(_0x41a533){this['_currentReviewCheckRun']&&('hover'===_0x41a533['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x41a533['id'])),'click'===_0x41a533['uiInteraction']&&this['_scrollToChange'](_0x41a533['id']));}_onDeactivateChange(_0x4ff9f8){this['_currentReviewCheckRun']&&'panel'===_0x4ff9f8['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x3c1f95,_0x3ea9a7){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x3ea9a7['changeId']),this['_scrollToChange'](_0x3ea9a7['changeId']));}['_onChangeMarkerHovered'](_0x4c03c8,_0x78db64){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x78db64['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x78db64['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}_getChangeContentElement(_0x144e44){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x144e44);}_markChangePositionInEditorContent(_0x56d154,_0x5e17b6){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x56d154,_0x5e17b6);}_diffContent(_0x206455,_0x4ced38,_0x5d1c10){return this['_aiReviewCoreEditing']['diffContent'](_0x206455,_0x4ced38,_0x5d1c10,!0x0);}['_onReviewCheckRun'](){for(const _0x22ccd9 of this['_aiReviewCoreEditing']['getEditors']())_0x22ccd9['editing']['view']['change'](_0x495707=>{for(const _0x508cf4 of _0x22ccd9['editing']['view']['document']['getRoots']())_0x495707['addClass']('ck-ai-translate-mode-content',_0x508cf4);});}async _getReviewChecks(){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},uc=class extends fh{constructor(_0x1a5216,_0x3b233b){super(_0x1a5216,_0x3b233b),this['on']('set:isLoading',(_0x32f958,_0x79fb90,_0x4a23f1)=>{_0x4a23f1&&(this['headerTitle']=Es(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x947a2c,_0x5d9cca,_0x10b9ab)=>{_0x10b9ab&&(this['headerTitle']=Es(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}_createAcceptAllButtonView(){const _0x16ed59=super['_createAcceptAllButtonView']();return _0x16ed59['set']('label',Es(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x16ed59;}_createExitReviewButtonView(){const _0x386f8d=super['_createExitReviewButtonView']();return _0x386f8d['set']('label',Es(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x386f8d;}},dc=class extends yh{_setupTemplate(){const _0x188f6d=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x188f6d['if']('isVisible','ck-hidden',_0x8bd7ed=>!_0x8bd7ed)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':Es(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':Es(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x188f6d['if']('isVisible','ck-hidden',_0x1026b1=>!_0x1026b1)]},'children':this['_checkViews']}]});}},_c=class extends mh{static get['pluginName'](){return'AITranslateUI';}createMainView(){const _0x2f3698=this['context']['plugins']['get']('AITabs'),_0x38be9c=this['context']['locale'],_0x58a57f=new ua(_0x38be9c,{'label':Es(_0x38be9c,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x1bcc6c,'class':'ck-ai-header_review-translate','showResizeButton':_0x2f3698['showResizeButton']});_0x58a57f['delegate']('resizeTabs')['to'](_0x2f3698),_0x58a57f['bind']('isMaximized')['to'](_0x2f3698['view'],'isMaximized',_0x1b42ab=>_0x1b42ab);const _0x2f9872=new wh(_0x38be9c,{'header':_0x58a57f,'list':new dc(_0x38be9c),'results':new uc(_0x38be9c,{'generalErrorText':Es(_0x38be9c,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new bh(_0x38be9c,{'headerText':Es(_0x38be9c,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Es(_0x38be9c,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Es(_0x38be9c,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x2f9872['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x2f9872;}registerTab(){const _0x39c5a1=this['context']['plugins']['get']('AITabs');_0x39c5a1['view']['on']('activateTab',(_0x53b709,{newTab:_0x3ff20e,oldTab:_0x4dc03a})=>{'translate'===_0x3ff20e?this['fire']('getReviewCheckList'):'translate'===_0x4dc03a&&this['fire']('leaveReview');}),_0x39c5a1['view']['addTab']({'id':'translate','buttonLabel':Es(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x1bcc6c,'order':0x0,'content':this['_mainView']});}},gc=class extends _0x212144{static get['pluginName'](){return'AITranslateGateway';}static get requires(){return[Hh,Is,tn,Tn];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async runTranslate(_0x52e411,_0x873227){const _0x1b4659=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x213c4f=this['context']['plugins']['get']('AIConnector'),_0x8ac477=new oc({'id':_0x52e411,'commandId':_0x52e411,'title':_0x52e411,'description':'','isParameterized':!0x1}),_0x178d9b=new Kh(_0x1b4659['getDocumentData']({'roots':_0x873227?.['roots']}),_0x8ac477,_0x213c4f,void 0x0,{'language':_0x52e411},_0x873227?.['contexts']);return _0x1b4659['runCheck'](_0x178d9b,{'signal':_0x873227?.['signal']});}applyTranslate(_0x39db61,_0x5923f4){this['context']['plugins']['get']('AIGateway')['apply'](_0x39db61,_0x5923f4);}},Ac=class extends _0x212144{static get requires(){return[lc,_c,Hh,gc];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async startTranslate(_0x156e51){const _0x5c99a0=this['assertStartTranslatePreconditions'](_0x156e51);nh(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0x5c99a0['id'],'args':_0x5c99a0['useArgs']?_0x5c99a0['args']:void 0x0});}getAvailableLanguages(){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x1a7273=>({'id':_0x1a7273['id'],'label':_0x1a7273['title']}));}assertStartTranslatePreconditions(_0x36adc9){const _0x10f9e1=this['context']['plugins']['get']('AITranslateController');if(_0x10f9e1['getCurrentCheckRun']())throw new ct('ai-translate-translation-already-running',this);const _0x3a986b=_0x10f9e1['getAvailableChecks']()['find'](_0xb605a3=>_0xb605a3['id']===_0x36adc9);if(!_0x3a986b)throw new ct('ai-translate-unknown-language',this,{'languageId':_0x36adc9});return _0x3a986b;}};export{gh as AIActions,Li as AIAdapter,ss as AIAssistant,ts as AIAssistantUI,Va as AIBalloon,ka as AIChat,er as AIChatController,ho as AIChatFeedCustomElementView,va as AIChatHistory,Oa as AIChatHistoryController,Ca as AIChatHistoryUI,Xn as AIChatInteraction,La as AIChatShortcuts,Aa as AIChatUI,xh as AICheckRunSingleRootResult,Is as AIConnector,Yn as AIContext,Cs as AIContextLibrary,fs as AICore,yn as AICoreError,vn as AIDocumentProcessingGateway,Rn as AIDocumentProcessingRunResult,tn as AIEditing,Wa as AIEditorIntegration,xn as AIErrorReporter,Nn as AIErrorSink,Tn as AIGateway,Fn as AIInteraction,Ts as AIModels,Ah as AIQuickActions,ih as AIQuickActionsUI,Vn as AIReply,Pi as AIRequestError,$h as AIReviewCheck,Uh as AIReviewCheckResult,Bh as AIReviewCheckResultChange,Fh as AIReviewCheckRun,sc as AIReviewGateway,nc as AIReviewMode,Wh as AIReviewModeController,Hh as AIReviewModeEditing,Nh as AIReviewModeUI,On as AIRunResult,Sn as AIRunSingleRootResult,gs as AITabs,_s as AITabsMainView,ls as AITabsView,rs as AITextAdapter,Da as AIToggleButtonUI,Ac as AITranslate,lc as AITranslateController,gc as AITranslateGateway,_c as AITranslateUI,as as AWSTextAdapter,os as OpenAITextAdapter,Hi as ShowAIAssistantCommand,Pa as ToggleAICommand,Hn as createResizeButton,ns as getDefaultAICommands,mn as markOperationsAsAI};
|