@ckeditor/ckeditor5-ai 48.4.0-alpha.1 → 48.4.0-alpha.3
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-editor.css +4 -0
- package/dist/index.css +4 -0
- 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 _0x3cd7f1,ContextPlugin as _0x77cfae,Editor as _0x5849ed,Plugin as _0x46bc1f,rootAcceptsBlocks as _0x2e6aed}from'@ckeditor/ckeditor5-core';import{IconAI as _0x15d9a0,IconAIAdjustLength as _0x31749f,IconAIAskAI as _0x55f0e2,IconAIChangeTone as _0x3be6bb,IconAIChat as _0x39a424,IconAIChatCommands as _0x108d0d,IconAIContinueWriting as _0xa13cd,IconAIGrammarCheck as _0x2ab9b3,IconAIHistory as _0x198287,IconAIImproveWriting as _0x5882fe,IconAIOther as _0x49182f,IconAIQuickActions as _0x5f0553,IconAIReview as _0x13ea44,IconAITranslate as _0x164672,IconBoxWithCheck as _0x57df96,IconBoxWithCross as _0x3edf99,IconBoxWithMarker as _0x2b88d0,IconBrowseFiles as _0x7ae57f,IconBulb as _0x5d171c,IconCancel as _0x40a4cb,IconCheck as _0x32ea05,IconChevronDown as _0x2c7807,IconChevronRight as _0x3601b4,IconChevronUp as _0x25db08,IconCopy as _0x4c57f5,IconDocument as _0x1e6b58,IconDocumentOutline as _0x2033c3,IconDropdownArrow as _0xd84f6e,IconError as _0x586d89,IconEye as _0x3dc8cb,IconEyeCrossedOut as _0x41b1f1,IconFileUpload as _0x7cedc0,IconImage as _0x414e6e,IconInfo as _0x31aaf1,IconLink as _0x5943de,IconLoupe as _0x2b7096,IconMagicWand as _0x1d8e78,IconMaximize as _0x4f4ffb,IconMinimize as _0x24bdae,IconNextArrow as _0x3b32e9,IconOutdated as _0x3ad071,IconPaperClip as _0x334e29,IconPin as _0x2175f6,IconPlus as _0x2ee682,IconPreviousArrow as _0x58652b,IconRefresh as _0x5527c5,IconRevisionHistory as _0x3dfa46,IconRobotPencil as _0x190c48,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 _0x1a597c,MenuBarMenuView as _0x4a3eb2,SearchTextView as _0x176ba3,SpinnerView as _0x430739,Template as _0x262be9,TextareaView as _0x34bdb4,ToolbarView as _0x258303,UIModel as _0x557175,View as _0x414492,ViewCollection as _0x215355,addListToDropdown as _0xec2131,addMenuToDropdown as _0x19f6d6,clickOutsideHandler as _0x4b6d2c,createDropdown as _0x44881d,createLabeledInputText as _0x155346,createLabeledTextarea as _0x56fb88,submitHandler as _0x3c38d9}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x58bd49,ClipboardPipeline as _0x1cc040}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0x3690bf,MarkerOperation as _0x571150,Matcher as _0x461578,ModelDocumentFragment as _0xe9fd4c,ModelPosition as _0x29cdf6,ModelRange as _0x5b86ed,ModelTreeWalker as _0x170ca4,ViewDataTransfer as _0x3e0cce,ViewDocumentDomEventData as _0x4c3ed5,ViewDowncastWriter as _0x5800bd,ViewUpcastWriter as _0x474258,_DetachOperation as _0x47f76a,_insertIntoModelNodeList as _0x470c9e,_removeFromModelNodeList as _0x10f5dd,transformOperationSets as _0x318423}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x182e99,debounce as _0x1bbda5,escape as _0x31e6fe,escapeRegExp as _0x4f4662,omit as _0x5d9ad4,throttle as _0xe640af,unescape as _0x3ab449}from'es-toolkit/compat';import{createParser as _0x419e25}from'eventsource-parser';import{CloudServices as _0x17bc00}from'@ckeditor/ckeditor5-cloud-services';import{parseDocument as _0x32b963}from'htmlparser2';import{append as _0x2de99f,appendChild as _0x3c15cc,find as _0x5bfaa4,findAll as _0xbb5ed2,findOne as _0x3aba21,getChildren as _0x346c46,getParent as _0x2e8850,isComment as _0x2cea0f,isTag as _0x40b07f,prepend as ti,prependChild as _0x3651de,removeElement as _0x5c7bf0,replaceElement as _0x2abda5,textContent as _0x4dee2d}from'domutils';import _0xa920ee from'dom-serializer';import{Document as _0x35b618,Element as _0x122249,NodeWithChildren as _0x370d1e,Text as _0x36754e,cloneNode as _0x538a60,isDocument as _0x5b65c1,isText as _0x4d4881}from'domhandler';import{ConfirmMixin as _0x15fd82,DATA_ID_MODEL_ATTRIBUTE as _0x27a049,DATA_ID_VIEW_ATTRIBUTE as _0x440ccf,DocumentCompare as _0x1ba3e1,PillView as _0x5b4e2e,SuggestionsConversion as _0x256bf3,fixElementSuggestionRange as _0x5afb7a,getAllMarkersDomElementsSorted as _0x4bbc7b,getMarkerDomElement as _0xdc273f,isInvalidAttributeOperation as _0x2355a7}from'@ckeditor/ckeditor5-collaboration-core';import{MarkdownGfmMdToHtml as _0x33f03a,MarkdownGfmMdToHtmlDefaultPlugins as _0xfbe022}from'@ckeditor/ckeditor5-markdown-gfm';import _0x2fb9c2 from'rehype-sanitize';import _0x5a6357 from'morphdom';import{diffArrays as _0x1e1781}from'diff';const vi='_ungrouppedCommands';function ki(_0x524a2b,_0x2d4be8){const _0x38a514=(0x0,_0x2d4be8['t'])('Other');return _0x524a2b['length']?'groupId'in _0x524a2b[0x0]?_0x524a2b:[{'groupId':vi,'groupLabel':_0x38a514,'order':0x1/0x0,'commands':_0x524a2b}]:[{'groupId':vi,'groupLabel':_0x38a514,'order':0x1/0x0,'commands':[]}];}const yi=globalThis['DataTransfer'],Ni='ai-ui';var xi=class extends _0x46bc1f{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const {editor:_0x7cfdf7}=this,_0x3ed015=['ck-fake-ai-selection'];_0x7cfdf7['config']['get']('ai.assistant.useTheme')&&_0x3ed015['push']('ck-ai-assistant-ui_theme'),_0x7cfdf7['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Ni,'view':{'classes':_0x3ed015,'priority':0xc}}),_0x7cfdf7['conversion']['for']('editingDowncast')['markerToElement']({'model':Ni,'view':(_0x2cacc8,{writer:_0x334970})=>{if(!_0x2cacc8['markerRange']['isCollapsed'])return null;const _0x764dfd=_0x334970['createUIElement']('span');return _0x334970['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x764dfd),_0x764dfd;}});}afterInit(){!async function(_0x52bf94){const _0x5b0041='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x364c78=0x79140,_0x362d1c=window['Date']['now'](),_0x167daf=_0x52bf94['editor'],_0x36b70c=new window['Promise'](_0x498246=>{_0x167daf['once']('ready',_0x498246);}),_0x29cab3={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x3bf9c1=_0x167daf['config']['get']('licenseKey');async function _0xdcc269(){let _0x4063cd,_0x519159=null,_0x504dbf=null;try{return'GPL'==_0x3bf9c1?'NotAllowed':(_0x4063cd=_0x28c0ce(),_0x4063cd?(_0x4063cd['usageEndpoint']&&(_0x504dbf=_0x25918f(_0x4063cd['usageEndpoint'],_0x4063cd['jti'])),await _0x4d4cc1()?_0x33827d()?_0x54421a()?'Expired':_0x153124()?('evaluation'==_0x4063cd['licenseType']&&(_0x519159=_0x34b8ad('EvaluationLimit')),await _0x5aa8b2()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x54421a(){const _0x2fdc5c=['evaluation','trial']['includes'](_0x4063cd['licenseType'])?_0x362d1c/0x3e8:0xe10*_0x364c78;return _0x4063cd['exp']<_0x2fdc5c;}function _0x33827d(){const _0x544321=_0x4063cd['features'];return!!_0x544321&&(!!_0x544321['includes']('*')||!!_0x544321['includes']('AI'));}function _0x153124(){const _0x26623b=_0x4063cd['licensedHosts'];if(!_0x26623b||0x0==_0x26623b['length'])return!0x0;const {hostname:_0x46245e}=new URL(window['location']['href']);if(_0x26623b['includes'](_0x46245e))return!0x0;const _0x2fe833=_0x46245e['split']('.');return _0x26623b['filter'](_0x9d6a9d=>_0x9d6a9d['includes']('*'))['map'](_0x46a25e=>_0x46a25e['split']('.'))['filter'](_0x369b4d=>_0x369b4d['length']<=_0x2fe833['length'])['map'](_0x5c67f1=>Array(_0x2fe833['length']-_0x5c67f1['length'])['fill']('*'===_0x5c67f1[0x0]?'*':'')['concat'](_0x5c67f1))['some'](_0x3e6cf1=>_0x2fe833['every']((_0x56b6a1,_0xdb22f7)=>_0x3e6cf1[_0xdb22f7]===_0x56b6a1||'*'===_0x3e6cf1[_0xdb22f7]));}function _0x5aa8b2(){return _0x519159&&_0x504dbf?new window['Promise']((_0x1d20c1,_0x123d69)=>{_0x519159['then'](_0x1d20c1,_0x123d69),_0x504dbf['then'](_0x43e6b=>{'Valid'!=_0x43e6b&&_0x1d20c1(_0x43e6b);},_0x123d69);}):_0x519159||_0x504dbf||'Valid';}}function _0x25918f(_0x5df200,_0xde8748){return new window['Promise'](_0x3f9deb=>{if(_0x11ee8e())return _0x3f9deb('Valid');_0x2f241c(),_0x167daf['decorate']('_sendUsageRequest');let _0x2f8166=!0x1;const _0xd3eeb0=kt();function _0x351ed4(_0x1a16ea){return!!_0x1a16ea&&('object'==typeof _0x1a16ea||'function'==typeof _0x1a16ea)&&'function'==typeof _0x1a16ea['then']&&'function'==typeof _0x1a16ea['catch'];}function _0x14965a(_0x5c7c72){_0x8fc030(_0x5c7c72)['then'](_0x54f19c=>_0x54f19c&&'ok'==_0x54f19c['status']?_0x14e9db(_0x4ef3fb(_0xd3eeb0+_0xde8748))!=_0x54f19c['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x545e84=>(_0x520d81(),_0x545e84),()=>{const _0x3fff7d=_0x1270d3();return null==_0x3fff7d?(_0x520d81(),'Valid'):_0x362d1c-_0x3fff7d>0x240c8400?'UsageLimit':'Valid';})['then'](_0x3f9deb)['catch'](()=>{_0x3f9deb('UsageLimit');});const _0x9d88ba=0x36ee80;function _0x520d81(){const _0x2fb5dc='llct-'+_0x14e9db(_0x4ef3fb(_0x5df200)),_0x4c443c=_0x1db2fd(_0x14e9db(window['Math']['ceil'](_0x362d1c/_0x9d88ba)));window['localStorage']['setItem'](_0x2fb5dc,_0x4c443c);}function _0x1270d3(){const _0x53a436='llct-'+_0x14e9db(_0x4ef3fb(_0x5df200)),_0x135906=window['localStorage']['getItem'](_0x53a436);return _0x135906?window['parseInt'](_0x1db2fd(_0x135906),0x10)*_0x9d88ba:null;}function _0x8fc030(_0x507e47){return new window['Promise']((_0x29da34,_0x12f967)=>{_0x507e47['then'](_0x29da34,_0x12f967),window['setTimeout'](_0x12f967,0x1d4c0);});}}_0x167daf['on']('_sendUsageRequest',(_0x14780e,_0x18be8d)=>{if(_0x18be8d[0x0]!=_0x5df200)return _0x3f9deb('UsageLimit');_0x18be8d[0x1]={..._0x18be8d[0x1],'requestId':_0xd3eeb0};},{'priority':'high'}),_0x167daf['on']('_sendUsageRequest',_0x1b10ca=>{_0x351ed4(_0x1b10ca['return'])&&(_0x2f8166=!0x0,_0x14965a(_0x1b10ca['return']));},{'priority':'low'}),_0x36b70c['then'](()=>{_0x2f8166||_0x3f9deb('UsageLimit');});});function _0x11ee8e(){return'auto'==_0x167daf['editing']['view']['_overlayModeHint'];}function _0x2f241c(){_0x167daf['editing']['view']['_overlayModeHint']='auto';}}function _0x34b8ad(_0x3a8f4b){const _0x515244=[new window['Promise'](_0x1139db=>setTimeout(_0x1139db,0x93ecc)),_0x36b70c['then'](()=>new window['Promise'](_0x46f00a=>{let _0x13f479=0x0;_0x167daf['model']['on']('applyOperation',(_0x13d01d,_0x3106ee)=>{_0x3106ee[0x0]['isDocumentOperation']&&_0x13f479++,0x5e8==_0x13f479&&(_0x46f00a(),_0x13d01d['off']());});}))];return window['Promise']['race'](_0x515244)['then'](()=>_0x3a8f4b);}async function _0x4f9be8(){await _0x36b70c,_0x167daf['model']['change']=_0x1f3820,_0x167daf['model']['enqueueChange']=_0x1f3820,_0x167daf['enableReadOnlyMode']('model');}function _0x35ac5c(_0xf5c7aa){const _0x566584=_0x1dc92e();_0x167daf[_0x566584]='aiLicenseKey'+_0xf5c7aa,'Valid'!=_0xf5c7aa&&_0x4f9be8();}function _0x1dc92e(){const _0x285592=window['String'](window['performance']['now']())['replace']('.','');let _0x376152='n';for(let _0x19bb61=0x0;_0x19bb61<_0x285592['length'];_0x19bb61+=0x2){let _0x1f1929=window['parseInt'](_0x285592['substring'](_0x19bb61,_0x19bb61+0x2));_0x1f1929>=0x3e&&(_0x1f1929-=0x3e),_0x376152+=_0x5b0041[_0x1f1929];}return _0x376152;}function _0x28c0ce(){const _0x21d56f=_0x3bf9c1['split']('.');if(0x3!=_0x21d56f['length'])return null;return _0x5b44e1(_0x21d56f[0x1]);function _0x5b44e1(_0x3425ae){const _0x371e7f=_0x2039e2(_0x3425ae);return _0x371e7f&&_0x206a0e()?_0x371e7f:null;function _0x206a0e(){const _0x3c4241=_0x371e7f['jti'],_0x47e4e8=window['parseInt'](_0x3c4241['substring'](_0x3c4241['length']-0x8),0x10),_0x2a1ae3={..._0x371e7f,'jti':_0x3c4241['substring'](0x0,_0x3c4241['length']-0x8)};return delete _0x2a1ae3['vc'],_0x4ef3fb(_0x2a1ae3)==_0x47e4e8;}}}async function _0x4d4cc1(){let _0x563917=!0x0;try{const [_0x22070e,_0x29e4be,_0x32c1cf]=_0x3bf9c1['split']('.');return _0x4ff230(_0x22070e),await _0x2dbaec(_0x22070e,_0x29e4be,_0x32c1cf),_0x563917;}catch{return!0x1;}function _0x4ff230(_0x54fa93){const _0x581efd=_0x2039e2(_0x54fa93);_0x581efd&&'ES256'==_0x581efd['alg']||(_0x563917=!0x1);}async function _0x2dbaec(_0x1308fd,_0x354ea2,_0x19559a){const _0x33aa20=window['Uint8Array']['from'](_0x3e4a21(_0x19559a),_0x5a1832=>_0x5a1832['charCodeAt'](0x0)),_0x2c8aa7=new window['TextEncoder']()['encode'](_0x1308fd+'.'+_0x354ea2),_0x348c9c=window['crypto']['subtle'];if(!_0x348c9c)return;const _0x53b636=await _0x348c9c['importKey']('jwk',_0x29cab3,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x348c9c['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x53b636,_0x33aa20,_0x2c8aa7)||(_0x563917=!0x1);}}function _0x2039e2(_0x2babbd){return _0x2babbd['startsWith']('ey')?JSON['parse'](_0x3e4a21(_0x2babbd)):null;}function _0x3e4a21(_0x4fe679){return window['atob'](_0x4fe679['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x4ef3fb(_0x23077b){let _0x2ddc31=0x1505;function _0x5e4369(_0x453ead){for(let _0xa9ea39=0x0;_0xa9ea39<_0x453ead['length'];_0xa9ea39++){const _0x144f6c=_0x453ead['charCodeAt'](_0xa9ea39);_0x2ddc31=(_0x2ddc31<<0x5)+_0x2ddc31+_0x144f6c,_0x2ddc31&=_0x2ddc31;}}function _0x20ca2b(_0x572404){Array['isArray'](_0x572404)?_0x572404['forEach'](_0x20ca2b):_0x572404&&'object'==typeof _0x572404?Object['entries'](_0x572404)['sort']()['forEach'](([_0x2413a5,_0x186d46])=>{_0x5e4369(_0x2413a5),_0x20ca2b(_0x186d46);}):_0x5e4369(window['String'](_0x572404));}return _0x20ca2b(_0x23077b),_0x2ddc31>>>0x0;}function _0x14e9db(_0x46c9aa){return _0x46c9aa['toString'](0x10)['padStart'](0x8,'0');}function _0x1db2fd(_0x3cae65){return _0x3cae65['split']('')['reverse']()['join']('');}function _0x1f3820(){}_0x35ac5c(await _0xdcc269());}(this);}showFakeVisualSelection(){const _0x2feb7e=this['editor']['model'];_0x2feb7e['change'](_0x5ec8f3=>{const _0x59e43e=_0x2feb7e['document']['selection']['getRanges']();let _0x233bae=0x0;for(const _0x52439f of _0x59e43e){const _0x348dbd=Ni+':'+_0x233bae;if(_0x2feb7e['markers']['has'](_0x348dbd))_0x5ec8f3['updateMarker'](_0x348dbd,{'range':_0x52439f});else{if(_0x52439f['start']['isAtEnd']){const _0x46cd55=_0x52439f['start']['getLastMatchingPosition'](({item:_0x356910})=>!_0x2feb7e['schema']['isContent'](_0x356910),{'boundaries':_0x52439f});_0x5ec8f3['addMarker'](_0x348dbd,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x5ec8f3['createRange'](_0x46cd55,_0x52439f['end'])});}else _0x5ec8f3['addMarker'](_0x348dbd,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x52439f});}_0x233bae++;}});}hideFakeVisualSelection(){const _0x740907=this['editor']['model'],_0x3f0dd8=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Ni));_0x3f0dd8['length']&&_0x740907['change'](_0x17f75c=>{_0x3f0dd8['forEach'](_0x17cacf=>{_0x17f75c['removeMarker'](_0x17cacf);});});}insertContent(_0xbffc48,_0x4f9eee){const _0x5941a6=this['_getAISelection'](),_0x80bc54=_0x4f9eee||_0x5941a6['getFirstRange']();this['editor']['model']['canEditAt'](_0x80bc54)&&this['editor']['model']['change'](_0x150465=>{this['hideFakeVisualSelection'](),_0x4f9eee||this['_resetContentOfSelectedTableCells'](_0x150465,_0x5941a6),this['_pasteHTMLUsingClipboard']({'insertAt':_0x80bc54,'writer':_0x150465,'html':_0xbffc48});});}insertContentBelow(_0x28445f){const {model:_0x10dcb3}=this['editor'],_0x4ee46c=this['_getAISelection']();_0x10dcb3['change'](()=>{const _0x41e15d=this['_prepareTableInsertBelowPosition'](_0x28445f,_0x4ee46c)||this['_getDefaultInsertBelowPosition'](_0x4ee46c);this['insertContent'](_0x28445f,_0x41e15d);});}_getAISelection(){const _0x3afc02=this['editor']['model'],_0x1732ac=Array['from'](_0x3afc02['markers']['getMarkersGroup'](Ni))['map'](_0x2e7d8f=>_0x2e7d8f['getRange']());return _0x3afc02['createSelection'](_0x1732ac);}_pasteHTMLUsingClipboard({writer:_0x493787,html:_0x585657,insertAt:_0x55b51d}){const {view:_0x1e811e}=this['editor']['editing'],_0x30b254=this['editor']['plugins']['get'](_0x1cc040),_0x55684c=new yi();_0x55684c['setData']('text/html',_0x585657);const _0x3a064c=new _0x4c3ed5(_0x1e811e,new ClipboardEvent('paste',{'clipboardData':_0x55684c}),{'dataTransfer':new _0x3e0cce(_0x55684c)});_0x493787['setSelection'](_0x55b51d);const _0x524182=(_0x4ba7a4,_0x5ba0ff)=>{_0x5ba0ff['resultRange']&&_0x493787['setSelection'](_0x5ba0ff['resultRange']);};_0x30b254['once']('contentInsertion',_0x524182,{'priority':'lowest'}),_0x1e811e['document']['fire']('paste',_0x3a064c),_0x30b254['off']('contentInsertion',_0x524182);}_getDefaultInsertBelowPosition(_0x54b6e7){const {model:_0x3035bb}=this['editor'],_0x2ceacd=Array['from'](_0x54b6e7['getSelectedBlocks']());return _0x2ceacd['length']?_0x3035bb['createPositionAfter'](_0x2ceacd['pop']()):_0x54b6e7['getLastPosition']();}_prepareTableInsertBelowPosition(_0x55eff4,_0x3d2b5b){const {model:_0x5f1848,plugins:_0x18f5b1}=this['editor'];if(_0x18f5b1['has']('TableUtils')){const _0x224680=_0x18f5b1['get']('TableUtils')['getSelectedTableCells'](_0x3d2b5b);if(_0x224680['length']){const _0xf46639=this['_getTableRowCountFromContent'](_0x55eff4),_0x16e4a8=this['_createEmptyTableRows'](_0x224680,_0xf46639);return _0x5f1848['createPositionAt'](_0x16e4a8,0x0);}}return null;}_getTableRowCountFromContent(_0x1ddbd3){const _0x17ce45=this['editor']['plugins']['get']('TableUtils'),_0x39f2e1=this['editor']['data']['parse'](_0x1ddbd3,'$documentFragment'),_0x2d444b=Array['from'](_0x39f2e1['getChildren']())['filter'](_0x1af0c4=>_0x1af0c4['is']('element','table'));let _0x53c359=0x0;return _0x2d444b['forEach'](_0x4a0e07=>{_0x53c359+=_0x17ce45['getRows'](_0x4a0e07);}),_0x53c359;}_createEmptyTableRows(_0x3a92b4,_0x47d4b6){const _0x19908e=this['editor']['plugins']['get']('TableUtils'),_0x72f24b=_0x19908e['getRowIndexes'](_0x3a92b4),_0x218717=_0x19908e['getColumnIndexes'](_0x3a92b4),_0x34f867=_0x72f24b['last']+0x1,_0x46a848=_0x218717['first'],_0x12b45f=_0x3a92b4[0x0]['findAncestor']('table');for(let _0x452ca5=0x0;_0x452ca5<_0x47d4b6;_0x452ca5++)_0x19908e['insertRows'](_0x12b45f,{'at':_0x34f867});return _0x12b45f['getChild'](_0x34f867)['getChild'](_0x46a848);}_resetContentOfSelectedTableCells(_0x368dbb,_0x3856fb){const {plugins:_0x3c47c1}=this['editor'],{model:_0xa768c8}=_0x368dbb;_0x3c47c1['has']('TableUtils')&&_0x3c47c1['get']('TableUtils')['getSelectedTableCells'](_0x3856fb)['length']&&_0xa768c8['deleteContent'](_0x3856fb);}},Li=class extends _0x46bc1f{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(_0x2d86a9){super(_0x2d86a9),this['name']='AIRequestError';}};function Di(_0x3f9539,_0x465dac,_0x35eb6e){const t=_0x3f9539['t'];switch(_0x465dac){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',_0x35eb6e);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x35eb6e);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'},_0x35eb6e);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 _0x465dac;}}var Hi=class extends _0x3cd7f1{_commandDefinitions;constructor(_0x5d6232,_0x16add2){super(_0x5d6232),this['_commandDefinitions']=_0x16add2,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0xebcda8,_0x32af73,_0x7728f7)=>{this['isEnabled']&&(this['enabledCommandsIds']=Mi(this['_commandDefinitions'],_0x7728f7));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x39f2d5,_0xe60b5e,_0xaf9945)=>{this['enabledCommandsIds']=_0xaf9945?Mi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x1392b5=this['editor']['model'];this['_hasContext']=function(_0x29e052){const _0x188018=_0x29e052['document']['selection'];return _0x188018['isCollapsed']?0x0!==[..._0x188018['getSelectedBlocks']()]['length']&&![..._0x188018['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x29e052['hasContent'](_0x188018['getFirstRange']());}(_0x1392b5);const _0x432542=_0x1392b5['document']['selection'],_0x2587dd=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x4ec03b of _0x432542['getRanges']())for(const _0x1248da of _0x4ec03b['getItems']())if(_0x1248da['is']('element')&&_0x2587dd['includes'](_0x1248da['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}execute(_0x33721d='',_0x35a677='',_0x513480='custom'){this['editor']['plugins']['get'](ts)['showUI'](_0x33721d,_0x35a677,_0x513480);}};function Mi(_0x53df2e,_0x2710cf){const _0x26bdb9=new Set();for(const _0x17b806 of _0x53df2e['values']())(_0x2710cf||!0x1===_0x17b806['requiresContent'])&&_0x26bdb9['add'](_0x17b806['id']);return Array['from'](_0x26bdb9);}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(_0x28f097,_0x5d4759,_0x37965c){super(),this['editor']=_0x28f097,this['textAdapter']=_0x5d4759,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x37965c,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x3e01da,_0x27fea9,_0x3460c2)=>{this['view']['value']=this['_sanitizeHTML'](_0x3460c2);}),this['listenTo'](this['view'],'submitPrompt',(_0x1c5dac,_0x43ff3a)=>{const _0xa3dcf8=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x43ff3a,_0xa3dcf8,'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:_0x550681,query:_0x5c5a87,htmlContent:_0x28a436,label:_0x1ddca3,mainActionLabel:_0x4e3be1}){this['view']['prompt']=_0x1ddca3,this['view']['mainAction']=_0x4e3be1,this['initialContext']=_0x28a436,_0x5c5a87&&(this['view']['isRendered']?this['_handleQuery'](_0x5c5a87,_0x28a436,_0x550681,_0x1ddca3):this['view']['once']('render',()=>{this['_handleQuery'](_0x5c5a87,_0x28a436,_0x550681,_0x1ddca3);}));}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'](_0x53d684,_0xa6d72e,_0x4f3182,_0x47e0a0){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0xa6d72e,this['previousQuery']=_0x53d684,this['previousLabel']=_0x47e0a0||_0x53d684,this['previousActionId']=_0x4f3182,new Promise(_0x4108e2=>{this['textAdapter']['makeRequest']({'query':_0x53d684,'context':_0xa6d72e,'onData':_0x16b764=>{this['currentResponse']=_0x16b764,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x4f3182})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0xe0cd6b=>{_0xe0cd6b instanceof Pi?this['view']['handleError'](_0xe0cd6b['message']):this['view']['handleError'](),_0x4108e2();})['finally'](()=>{this['stopProcessing'](),_0x4108e2();});});}_parseAndNormalizeContent(_0x231b81,_0x39ce3a=!0x1){const _0x1a2b84=Ui['exec'](_0x231b81);_0x231b81=_0x1a2b84?_0x231b81['substring'](_0x1a2b84[0x1]['length']):_0x231b81['length']<0x64&&!_0x39ce3a?'':this['_stripMarkdownSyntax'](_0x231b81);const _0x1696cf=this['_domParser']['parseFromString'](_0x231b81,'text/html');if(_0x1a2b84){const _0x904ed5=Array['from'](_0x1696cf['body']['childNodes']);_0x904ed5['reverse']();for(const _0x11f134 of _0x904ed5){if(_0x11f134['nodeType']==Node['ELEMENT_NODE'])break;_0x11f134['remove']();}}const _0xca6966=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x1696cf['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0xca6966);const _0x505a00=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x1f7cc7=this['editor']['data']['toModel'](_0xca6966);return _0x505a00||_0x1f7cc7['markers']['clear'](),this['editor']['data']['stringify'](_0x1f7cc7);}['_normalizeResponseHeadings'](_0x306440){const _0x19c567=new _0x474258(this['editor']['editing']['view']['document']),_0x4e44f7=new _0x461578({'name':/^h[1-5]$/}),_0x3f4e54=[];let _0x36b784=!0x1;for(const _0x285d6e of _0x306440)_0x285d6e['is']('element')&&_0x4e44f7['match'](_0x285d6e)&&(_0x3f4e54['push'](_0x285d6e),'h1'==_0x285d6e['name']&&(_0x36b784=!0x0));if(_0x36b784){for(const _0x5ab04c of _0x3f4e54)_0x19c567['rename']('h'+(parseInt(_0x5ab04c['name'][0x1])+0x1),_0x5ab04c);}}_isH1TagSupportEnabled(){const {data:_0x2ab8ad,editing:_0x520c82}=this['editor'],_0x3f1c6a=_0x2ab8ad['htmlProcessor']['toView']('<h1></h1>'),_0x39e217=_0x2ab8ad['toView'](_0x2ab8ad['toModel'](_0x3f1c6a));return!!_0x520c82['view']['domConverter']['viewToDom'](_0x39e217)['querySelector']('h1');}_sanitizeHTML(_0x3aa8ac){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x3aa8ac),this['_sanitizationContainer']['innerHTML'];}_stripMarkdownSyntax(_0x57174a){const _0x294e8c=_0x57174a['trim']();return _0x294e8c['startsWith']('```html')?_0x294e8c['endsWith']('```')?_0x294e8c['substring'](0x7,_0x294e8c['length']-0x3):_0x294e8c['substring'](0x7):_0x57174a;}};const Gi={'REPLACE':'replace','INSERT':'insert'};var Fi=class extends _0x258303{constructor(_0x4c88ae){super(_0x4c88ae),this['set']('isVisible',!0x1),this['set']('mainAction',Gi['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x305c74=>Di(_0x4c88ae,'AI_'+_0x305c74['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Di(_0x4c88ae,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Di(_0x4c88ae,'Try\x20again')),this['stopButton']=this['_createButton'](Di(_0x4c88ae,'Stop'));const _0x33a90e=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x33a90e['if']('isVisible','ck-hidden',_0x31983a=>!_0x31983a)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}_createButton(_0x4e3d90,_0x7c127a){const _0x244134=new Mt(this['locale']);return _0x244134['set']({'label':_0x4e3d90,'class':_0x7c127a||'','isVisible':!0x0,'withText':!0x0}),_0x244134;}},Ki=class extends _0x414492{contentFieldView;copyButtonView;constructor(_0x1ad5f7,_0x50a0ac=''){super(_0x1ad5f7),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x31de19=this['bindTemplate'];this['contentFieldView']=new Wi(_0x1ad5f7,_0x50a0ac),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x31de19['if']('isVisible','ck-hidden',_0x36a6ca=>!_0x36a6ca)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x31de19['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 _0x2217e1=!0x1;this['on']('change:value',(_0x34b3d8,_0x8b19ce,_0x3d539d)=>{const _0x52417e=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x3d539d),this['isProcessing']&&_0x52417e&&!_0x2217e1&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x14d342,_0x465362,_0x2ffbf3)=>{_0x2217e1=!0x1,_0x2ffbf3?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x2217e1=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x2217e1=!0x0;});}['focus'](){this['element']['focus']();}_createCopyButton(){const _0x49e988=this['locale'],_0x509c6f=new Mt(this['locale']),_0xbf9e7='ck-ai-form__copy-button';return _0x509c6f['set']({'label':Di(_0x49e988,'Copy'),'icon':_0x4c57f5,'class':_0xbf9e7,'tooltip':!0x0}),_0x509c6f['bind']('isVisible')['to'](this,'value',_0x419730=>!!_0x419730),_0x509c6f['bind']('isEnabled')['to'](this,'isProcessing',_0x3b5c06=>!_0x3b5c06),_0x509c6f['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x509c6f['icon']=_0x32ea05,_0x509c6f['class']=_0xbf9e7+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x509c6f['icon']=_0x4c57f5,_0x509c6f['class']=_0xbf9e7;},0x3e8);}),_0x509c6f;}['_copyHTMLToClipboard'](_0x2b5984){const {window:_0x230925,document:_0x4f734b}=wt;if(_0x230925['ClipboardItem']){const {Blob:_0x9cf11e,ClipboardItem:_0x11cd7b}=_0x230925,_0x5a75bf=[new _0x11cd7b({'text/html':new _0x9cf11e([_0x2b5984['innerHTML']],{'type':'text/html'}),'text/plain':new _0x9cf11e([_0x2b5984['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x5a75bf);}else{const _0x78e8c9=_0x4f734b['createElement']('div');_0x78e8c9['style']['position']='absolute',_0x78e8c9['style']['left']='-9999px',_0x78e8c9['innerHTML']='<span>[</span>'+_0x2b5984['innerHTML']+'<span>]</span>',_0x4f734b['body']['appendChild'](_0x78e8c9);const _0x4f6937=_0x4f734b['createRange']();_0x4f6937['setStartAfter'](_0x78e8c9['firstElementChild']),_0x4f6937['setEndBefore'](_0x78e8c9['lastElementChild']);const _0x442b63=_0x230925['getSelection']();_0x442b63['removeAllRanges'](),_0x442b63['addRange'](_0x4f6937),_0x4f734b['execCommand']('copy'),_0x78e8c9['remove']();}}},Wi=class extends _0x414492{constructor(_0x409f34,_0x3d18b4=''){super(_0x409f34),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x3d18b4,'ck-reset_all-excluded','ck-ai-form__content-field']}});}setContent(_0x1b1cc6){this['element']['innerHTML']=_0x1b1cc6;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}_createLoader(){const _0x48ff19=new _0x414492(),_0x39aabe=this['locale'],_0x9fc209=new _0x430739();return _0x9fc209['isVisible']=!0x0,_0x48ff19['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x9fc209,{'text':Di(_0x39aabe,'AI\x20is\x20writing...')}]}),_0x48ff19['render'](),_0x48ff19;}},Yi=class extends _0x414492{constructor(_0x37ee0c,_0xeb9e91=''){super(_0x37ee0c);const _0x21df87=new $t(),_0x52b248=this['bindTemplate'];this['set']('text',_0xeb9e91),_0x21df87['content']=_0x586d89,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x21df87,{'text':_0x52b248['to']('text')}]});}},$i=class extends Nt{submitButtonView;showHistoryButtonView;constructor(_0x3f6d60,_0x53c525){super(_0x3f6d60,_0x53c525),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',(_0x3c8156,_0x305286)=>{_0x3c8156['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x305286());});}_createSubmitButton(){const _0x5602e5=new Mt(this['locale']),_0x2d2363=this['locale'];return _0x5602e5['set']({'icon':nt,'label':Di(_0x2d2363,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x5602e5['on']('execute',()=>{this['submit']();}),_0x5602e5['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x9e8a45,_0x1c6300)=>!_0x9e8a45&&_0x1c6300),_0x5602e5;}_createShowHistoryButton(){const _0x32b1b7=new Mt(this['locale']),_0x5d870b=this['resultsView'],_0xf7373b=this['locale'];_0x32b1b7['set']({'label':Di(_0xf7373b,'History'),'withText':!0x1,'icon':_0x198287,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x32b1b7['bind']('isOn')['to'](_0x5d870b,'isVisible'),_0x32b1b7['bind']('isEnabled')['to'](this,'isEnabled'),_0x32b1b7['on']('execute',()=>{_0x5d870b['isVisible']=!_0x5d870b['isVisible'],_0x5d870b['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x420c92=()=>{wt['window']['requestAnimationFrame'](()=>{if(ft(this['element'])){const _0x434a05=new It(this['queryView']['fieldView']['element']),_0xd9127d=_0x434a05['width'],_0x7971ab='rtl'===_0xf7373b['uiLanguageDirection']?'left':'right';_0x434a05['excludeScrollbarsAndBorders'](),_0x32b1b7['element']['style'][_0x7971ab]=_0xd9127d-_0x434a05['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x420c92),this['on']('render',_0x420c92),_0x32b1b7;}submit(){const _0x43f7a2=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x43f7a2);}['focus'](_0x5c6418){-0x1===_0x5c6418?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},qi=class extends Jt{historyGroupView;clearHistoryButton;constructor(_0x174414){super(_0x174414),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new zt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Di(_0x174414,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}filter(){let _0x30a964=0x0;for(const _0x2b48ed of this['items'])_0x30a964+=_0x2b48ed['items']['length'];return{'resultsCount':_0x30a964,'totalItemsCount':_0x30a964};}_createClearHistoryButton(){const _0x35bad8=this['locale'],_0x2fba40=new Mt(this['locale']);return _0x2fba40['set']({'label':'('+Di(_0x35bad8,'Clear')+')','withText':!0x0}),_0x2fba40['on']('execute',()=>this['fire']('clearHistory')),_0x2fba40;}},Qi=class extends jt{constructor(_0x131c43){super();const _0x213990=new Dt(),_0x3a2816=new Mt(this['locale'],_0x213990);this['children']['add'](_0x3a2816),_0x3a2816['set']({'label':_0x131c43['prompt'],'withText':!0x0}),_0x3a2816['on']('execute',()=>{this['fire']('execute',{'value':_0x3ab449(_0x131c43['prompt'])});});}};const Xi='CKEditor/AIFormView/PromptHistory';var zi=class extends lt{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0xd7ee35,_0x282a19)=>{const _0x4c9880=ji(_0x282a19['prompt']);for(const _0x4643c6 of this)if(_0x4643c6!=_0x282a19&&ji(_0x4643c6['prompt'])===_0x4c9880){this['remove'](_0x4643c6);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}_loadFromSessionStorage(){const _0x2be040=sessionStorage['getItem'](Xi)||'[]';this['addMany'](JSON['parse'](_0x2be040));}_saveToSessionStorage(){sessionStorage['setItem'](Xi,JSON['stringify'](this['map'](_0x56acd7=>_0x56acd7)));}};function ji(_0x2297ef){return _0x2297ef['toLowerCase']()['trim']();}var Ji=class extends _0x414492{['focusTracker'];keystrokes;contentArea;toolbar;promptView;['errorView'];['_focusables'];['focusCycler'];_promptHistory;constructor(_0xe7b6e4,_0x409549,_0x4bb627=''){super(_0xe7b6e4),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(_0xe7b6e4),this['contentArea']=new Ki(_0xe7b6e4,_0x4bb627),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 _0x103d8a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x409549],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x103d8a['if']('isError','ck-hidden',_0x53342d=>!_0x53342d)]},'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'](_0x45f289=0x1){-0x1===_0x45f289?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 _0x5ed13f=this['locale'],_0x2de03a=new $i(_0x5ed13f,{'queryView':{'label':Di(_0x5ed13f,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x56fb88,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Di(_0x5ed13f,'Empty\x20history'),'secondary':Di(_0x5ed13f,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x2de03a['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x4df287,_0x2b8206)=>_0x4df287&&!_0x2b8206),this['listenTo'](_0x2de03a,'submit',(_0x3ef5ee,_0x597550)=>{this['prompt']=_0x597550;const _0x241302=_0x31e6fe(_0x597550);this['fire']('submitPrompt',_0x241302),_0x597550['trim']()&&this['_promptHistory']['add']({'prompt':_0x241302},0x0);},{'priority':'high'}),_0x2de03a;}_createHistoryView(){const _0xc8381d=new qi(this['locale']);return _0xc8381d['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Qi),_0xc8381d['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0xc8381d;}_createToolbar(){const _0x1315d5=new Fi(this['locale']);return _0x1315d5['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x26b47e,_0x9ba5,_0x245661)=>_0x26b47e&&!_0x9ba5&&!!_0x245661),_0x1315d5['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x1315d5['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x510fc8,_0x245df8,_0x37681d)=>_0x510fc8&&!_0x245df8&&!!_0x37681d),_0x1315d5['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x1315d5['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x5dec43,_0x15825f)=>_0x5dec43&&!_0x15825f),_0x1315d5['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x1315d5['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x1315d5['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x1315d5;}startProcessing(){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x57ce2f=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Di(_0x57ce2f,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x22d081){const _0x58ba15=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x22d081||Di(_0x58ba15,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const Zi=globalThis['DataTransfer'];var ts=class extends _0x46bc1f{['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[_0x58bd49,xi,Li,Ut];}constructor(_0x2ae02f){super(_0x2ae02f),_0x2ae02f['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x2ae02f['config']['define']('ai.assistant.contentAreaCssClass',''),_0x2ae02f['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x2ae02f['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}init(){const {editor:_0x3faee8}=this;this['_aiAdapter']=_0x3faee8['plugins']['get'](Li),this['_dialog']=_0x3faee8['plugins']['get'](Ut),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x47899e=new Hi(_0x3faee8,Array['from'](this['_commandDefinitions']['values']()));_0x3faee8['commands']['add']('showAIAssistant',_0x47899e),_0x3faee8['ui']['componentFactory']['add']('aiCommands',_0x23ceb8=>{const _0x46d547=_0x44881d(_0x23ceb8);return _0x46d547['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x46d547['buttonView']['set']({'label':Di(_0x23ceb8,'AI\x20Commands'),'icon':_0x1d8e78,'tooltip':!0x0}),_0x46d547['on']('execute',_0x308c53=>this['_onExecute'](_0x308c53['source']['id'])),_0x19f6d6(_0x46d547,_0x3faee8['ui']['view']['body'],function(_0x8ddfe3){const _0x888b17=is(_0x8ddfe3,ki(_0x8ddfe3['config']['get']('ai.assistant.commands'),_0x8ddfe3['locale']))['filter'](_0x3b3476=>_0x3b3476['commands']['length']);return 0x1===_0x888b17['length']?is(_0x8ddfe3,_0x888b17[0x0]['commands'])['map'](_0x2579e9=>({'id':_0x2579e9['id'],'label':_0x2579e9['label']})):_0x888b17['map'](_0x372e1b=>{const {groupId:_0x2319c3,groupLabel:_0x2e983e,commands:_0x1547fb}=_0x372e1b,_0x19a609=is(_0x8ddfe3,_0x1547fb)['map'](_0x4987b3=>({'id':_0x4987b3['id'],'label':_0x4987b3['label']}));return{'id':_0x2319c3,'menu':_0x2e983e||_0x2319c3,'children':_0x19a609};});}(_0x3faee8),{'ariaLabel':Di(_0x23ceb8,'AI\x20Commands')}),_0x46d547['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x47899e['on']('change:enabledCommandsIds',_0x113a55),_0x46d547['menuView']['once']('render',_0x113a55),_0x46d547;function _0x113a55(){_0x46d547['isEnabled']=_0x47899e['enabledCommandsIds']['length']>0x0;for(const _0x86417e of _0x46d547['menuView']['buttons'])_0x86417e['isEnabled']=_0x47899e['enabledCommandsIds']['includes'](_0x86417e['id']);}}),_0x3faee8['ui']['componentFactory']['add']('menuBar:aiCommands',_0x2d2cde=>{const _0x3d8a9e=new _0x4a3eb2(_0x2d2cde);_0x3d8a9e['buttonView']['set']({'label':Di(_0x2d2cde,'AI\x20Commands'),'icon':_0x1d8e78}),_0x3d8a9e['bind']('isEnabled')['to'](_0x47899e,'enabledCommandsIds',_0x386c68=>_0x386c68['length']>0x0);const _0x254785=ki(_0x3faee8['config']['get']('ai.assistant.commands'),_0x2d2cde);return this['_populateMenuBarMenu'](_0x47899e,_0x3d8a9e,_0x254785,_0x2da0af=>this['_onExecute'](_0x2da0af)),_0x3d8a9e;}),_0x3faee8['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x257c39=this['_createAIAssistantUIButton'](Mt);return _0x257c39['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x257c39;}),_0x3faee8['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x48a770=this['_createAIAssistantUIButton'](Zt);return _0x48a770['set']({'role':'menuitemcheckbox'}),_0x48a770;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x18015c=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x219591;for(const _0x3c9ca0 in _0x18015c){const _0x31086e=_0x3c9ca0,_0x15e8c0=_0x18015c[_0x31086e];if('aiLicenseKeyValid'==_0x15e8c0||'aiLicenseKeyInvalid'==_0x15e8c0||'aiLicenseKeyExpired'==_0x15e8c0||'aiLicenseKeyDomainLimit'==_0x15e8c0||'aiLicenseKeyNotAllowed'==_0x15e8c0||'aiLicenseKeyEvaluationLimit'==_0x15e8c0||'aiLicenseKeyUsageLimit'==_0x15e8c0){delete _0x18015c[_0x31086e],_0x219591=_0x15e8c0,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x219591&&_0x18015c['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x219591&&_0x18015c['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x219591&&_0x18015c['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x219591&&_0x18015c['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x219591&&_0x18015c['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x219591&&_0x18015c['_showLicenseError']('usageLimit');},0x3e8);}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x5baea2='',_0x342ee7='',_0x1f4750='custom'){const _0x463cc3=this['editor'],_0x161000=_0x463cc3['editing']['view'],_0x3ce9a9=_0x463cc3['plugins']['get'](xi),_0x1a8acb=_0x463cc3['plugins']['get'](_0x58bd49);_0x3ce9a9['showFakeVisualSelection']();const _0x14f03b=new Zi(),_0x45d059=new ClipboardEvent('copy',{'clipboardData':_0x14f03b}),_0x102d25=new _0x3e0cce(_0x14f03b),_0x351801=new _0x4c3ed5(_0x161000,_0x45d059,{'dataTransfer':_0x102d25});_0x1a8acb['_forceMarkersCopy']('comment',()=>{_0x161000['document']['fire']('copy',_0x351801);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Bi(_0x463cc3,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x1181b6=_0x102d25['getData']('text/html');const _0x3b4db7=_0x463cc3['model']['document']['selection'],_0x364109=Array['from'](_0x3b4db7['getRanges']());0x1===_0x364109['length']&&_0x364109[0x0]['isFlat']&&!_0x3b4db7['getSelectedElement']()&&''!==_0x1181b6['replace'](/ /g,'')['trim']()&&(_0x1181b6='<p>'+_0x1181b6+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x1f4750,'query':_0x5baea2,'htmlContent':_0x1181b6,'label':_0x342ee7,'mainActionLabel':Gi[_0x463cc3['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x190c48,'title':Di(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Vt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x3ce9a9['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}_getResolvedCommandsDefinitions(){const _0x8dad08=new Map(),_0x12c7ab=ki(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x6c82a4 of _0x12c7ab)for(const _0x13568c of _0x6c82a4['commands'])_0x8dad08['set'](_0x13568c['id'],{..._0x13568c,'groupId':_0x6c82a4['groupId'],'groupLabel':_0x6c82a4['groupLabel']||_0x6c82a4['groupId']});return _0x8dad08;}_createAIAssistantUIButton(_0x2bc116){const _0x4c1365=this['editor'],_0xa8a391=_0x4c1365['commands']['get']('showAIAssistant'),_0x4262d5=new _0x2bc116(_0x4c1365['locale']);return _0x4262d5['set']({'label':Di(_0x4c1365['locale'],'AI\x20Assistant'),'icon':_0x190c48,'isToggleable':!0x0}),_0x4262d5['bind']('isEnabled')['to'](_0xa8a391),_0x4262d5['bind']('isOn')['to'](this['_dialog'],'id',_0x28d126=>'aiAssistant'===_0x28d126),this['listenTo'](_0x4262d5,'execute',()=>{_0x4262d5['isOn']?this['hideUI']():_0xa8a391['execute']();}),_0x4262d5;}_initView(){const _0x1b1412=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',()=>{_0x1b1412['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x1b1412['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}_initAriaAiStatusChangeAnnouncements(){const {locale:_0x5b232a,ui:{ariaLiveAnnouncer:_0x1cb5db}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x214402,_0x21f1c4,_0x2300bd)=>{const _0x356e97=this['_aiAssistantController']['currentContext'];_0x2300bd?_0x1cb5db['announce'](Di(_0x5b232a,'AI\x20is\x20writing')):_0x356e97&&_0x1cb5db['announce'](Di(_0x5b232a,'Generated\x20content:\x20%0',_0x356e97),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x211b0a,_0x4df8e6,_0x413cea)=>{if(_0x413cea){const _0x4fd7ba=this['_formView']['errorView']['text'];_0x1cb5db['announce'](Di(_0x5b232a,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x4fd7ba));}});}_onExecute(_0x29e03e){const _0x313fe7=this['_commandDefinitions']['get'](_0x29e03e),_0x13e5cf=this['editor'],_0xc1c736=_0x13e5cf['model']['document']['selection'],_0x2b16e2=_0x13e5cf['commands']['get']('showAIAssistant'),_0x4fa899=_0x13e5cf['plugins']['get'](xi),_0x224093=''+('_ungrouppedCommands'!==_0x313fe7['groupId']?_0x313fe7['groupLabel']+':\x20':'')+_0x313fe7['label'];if(!0x1!==_0x313fe7['requiresContent']&&_0xc1c736['isCollapsed']){const _0x22498b=mt(_0xc1c736['getSelectedBlocks']())||_0x13e5cf['model']['schema']['getLimitElement'](_0xc1c736);_0x13e5cf['model']['change'](_0x1137e9=>{_0x1137e9['setSelection'](_0x22498b,'in');});}_0x4fa899['showFakeVisualSelection'](),_0x2b16e2['execute'](_0x313fe7['prompt'],_0x224093,'command:'+_0x29e03e);}_populateMenuBarMenu(_0x13f609,_0x3f6e39,_0x1cf0ff,_0x3dc63e){const _0x52314e=this['editor'],_0x35c162=_0x52314e['locale'],_0xdf4f30=new _0x1a597c(_0x35c162),_0x27a89f=is(_0x52314e,_0x1cf0ff)['filter'](_0x3feaaf=>_0x3feaaf['commands']['length']);0x1===_0x27a89f['length']?this['_getMenuBarGroupButtons']({'command':_0x13f609,'commands':_0x27a89f[0x0]['commands'],'parentMenuView':_0x3f6e39,'onExecute':_0x3dc63e})['forEach'](_0x24c8bf=>_0xdf4f30['items']['add'](_0x24c8bf)):_0x27a89f['forEach'](({groupId:_0x2d0d36,groupLabel:_0x4ea721,commands:_0x55257d})=>{const _0x611015=new te(_0x35c162,_0x3f6e39),_0x2078ab=new _0x4a3eb2(_0x35c162),_0x1d3e69=new _0x1a597c(_0x35c162),_0x5c3c8e=this['_getMenuBarGroupButtons']({'command':_0x13f609,'commands':_0x55257d,'parentMenuView':_0x2078ab,'onExecute':_0x3dc63e});_0x2078ab['buttonView']['set']({'label':_0x4ea721||_0x2d0d36}),_0x2078ab['delegate']('execute')['to'](_0x3f6e39),_0x1d3e69['items']['addMany'](_0x5c3c8e),_0x2078ab['panelView']['children']['add'](_0x1d3e69),_0x611015['children']['add'](_0x2078ab),_0xdf4f30['items']['add'](_0x611015);}),_0x3f6e39['panelView']['children']['add'](_0xdf4f30);}_getMenuBarGroupButtons({command:_0x3e96b2,commands:_0x1a5c01,parentMenuView:_0x36d318,onExecute:_0x55b18e}){const _0x22867b=this['editor'],_0x5cb491=_0x22867b['locale'];return is(_0x22867b,_0x1a5c01)['map'](_0x467a7d=>{const _0x227e37=new te(_0x5cb491,_0x36d318),_0x579d59=new Zt(_0x5cb491);return _0x579d59['set']({'label':_0x467a7d['label']}),_0x579d59['delegate']('execute')['to'](_0x36d318),_0x579d59['on']('execute',()=>_0x55b18e(_0x467a7d['id'])),_0x579d59['bind']('isEnabled')['to'](_0x3e96b2,'enabledCommandsIds',_0xf41c0e=>_0xf41c0e['includes'](_0x467a7d['id'])),_0x227e37['children']['add'](_0x579d59),_0x227e37;});}};function es(_0x2173c4,_0x19ad64){return void 0x0!==_0x2173c4['order']&&void 0x0===_0x19ad64['order']?0x1:void 0x0===_0x2173c4['order']&&void 0x0!==_0x19ad64['order']?-0x1:void 0x0!==_0x2173c4['order']&&void 0x0!==_0x19ad64['order']?_0x2173c4['order']-_0x19ad64['order']:0x0;}function is(_0x28e361,_0x4e6c87){_0x4e6c87['sort'](es);const _0x5d5df3={},_0x44fdbf=[];for(const _0x24aa2c of _0x4e6c87)if(void 0x0!==_0x24aa2c['order']){if(_0x24aa2c['order']in _0x5d5df3)throw new ct('ai-commands-config-order-collision',_0x28e361,{'conflictingDefinitions':[_0x24aa2c,_0x5d5df3[_0x24aa2c['order']]]});_0x5d5df3[_0x24aa2c['order']]=_0x24aa2c,_0x44fdbf['splice'](_0x24aa2c['order'],0x0,_0x24aa2c);}else _0x44fdbf['push'](_0x24aa2c);return _0x44fdbf;}var ss=class extends _0x46bc1f{static get requires(){return[ts,xi];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x29faa4){super(_0x29faa4);const _0x144d35=_0x29faa4['config'],_0x39296f=_0x29faa4['locale'];_0x144d35['define']('ai.assistant.preserveComments',!0x0),_0x144d35['define']('ai.assistant.commands',ns(_0x39296f)),_0x144d35['define']('ai.assistant.extraCommandGroups',[]),_0x144d35['define']('ai.assistant.removeCommands',[]);let _0x23f567=ki(_0x144d35['get']('ai.assistant.commands'),_0x39296f);const _0x4a347f=_0x144d35['get']('ai.assistant.extraCommandGroups'),_0x174f90=_0x144d35['get']('ai.assistant.removeCommands');_0x4a347f['forEach'](_0x4ae20e=>{const _0x58df93=_0x23f567['find'](_0x41f596=>_0x41f596['groupId']===_0x4ae20e['groupId']);_0x58df93?_0x58df93['commands']=_0x58df93['commands']['concat'](_0x4ae20e['commands']):_0x23f567['push'](_0x4ae20e);}),_0x23f567=_0x23f567['filter'](_0x2d01b2=>!_0x174f90['includes'](_0x2d01b2['groupId'])),_0x23f567['forEach'](_0x12877c=>{_0x12877c['commands']=_0x12877c['commands']['filter'](_0x40df61=>!_0x174f90['includes'](_0x40df61['id']));}),_0x144d35['set']('ai.assistant.commands',_0x23f567);}};function ns(_0xa6c9d3){return[{'groupId':'editOrReview','groupLabel':Di(_0xa6c9d3,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Di(_0xa6c9d3,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Di(_0xa6c9d3,'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(_0xa6c9d3,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Di(_0xa6c9d3,'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(_0xa6c9d3,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Di(_0xa6c9d3,'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(_0xa6c9d3,'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(_0xa6c9d3,'Change\x20tone'),'commands':[{'id':'professional','label':Di(_0xa6c9d3,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Di(_0xa6c9d3,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Di(_0xa6c9d3,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Di(_0xa6c9d3,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Di(_0xa6c9d3,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Di(_0xa6c9d3,'Change\x20style'),'commands':[{'id':'business','label':Di(_0xa6c9d3,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Di(_0xa6c9d3,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Di(_0xa6c9d3,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Di(_0xa6c9d3,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Di(_0xa6c9d3,'Translate'),'commands':[{'id':'translateEnglish','label':Di(_0xa6c9d3,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Di(_0xa6c9d3,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Di(_0xa6c9d3,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Di(_0xa6c9d3,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Di(_0xa6c9d3,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Di(_0xa6c9d3,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Di(_0xa6c9d3,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Di(_0xa6c9d3,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var rs=class extends _0x46bc1f{abortController;static get requires(){return[Li];}constructor(_0x127d17){super(_0x127d17),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(_0x6bd98a){return this['sendRequest'](_0x6bd98a)['catch'](_0x4c1bf3=>{if(_0x4c1bf3 instanceof Pi)return Promise['reject'](_0x4c1bf3);if('AbortError'==_0x4c1bf3['name'])return Promise['resolve']();throw console['error'](_0x4c1bf3),new ct('aitextadapter-send-request-failed',null);});}async _prepareRequestHeaders(_0x43b275,_0x549336){const _0x153a47=this['editor']['locale'],_0x705014={'Content-Type':'application/json'};if('object'==typeof _0x43b275)Object['assign'](_0x705014,_0x43b275);else{if(_0x43b275)try{const _0x393c3=await _0x43b275(_0x549336);Object['assign'](_0x705014,_0x393c3);}catch{return Promise['reject'](new Pi(Di(_0x153a47,'AI_ERROR_GET_HEADERS')));}}return _0x705014;}async _prepareRequestParameters(_0x380247,_0x2f07dc){const _0x585911=this['editor']['locale'];if('object'==typeof _0x380247)return _0x380247;try{return await _0x380247(_0x2f07dc);}catch{return Promise['reject'](new Pi(Di(_0x585911,'AI_ERROR_GET_PARAMETERS')));}}},os=class extends rs{['_apiUrl'];_requestHeaders;_requestParameters;static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x35831f){super(_0x35831f),_0x35831f['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x35831f['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x35831f['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x35831f['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x35831f['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x35831f['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async sendRequest({query:_0x2ea649,context:_0x1ac82f,onData:_0x521588,actionId:_0x49dffb}){const _0x3f262e=this['editor']['locale'],_0x1d2769=await this['prepareMessages'](_0x2ea649,_0x1ac82f,_0x49dffb),_0x3d5d59=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x49dffb),_0x585f34=await this['_prepareRequestParameters'](this['_requestParameters'],_0x49dffb),_0x27dc5a={'messages':_0x1d2769,..._0x585f34},_0x5a5819={'method':'POST','headers':_0x3d5d59,'body':JSON['stringify'](_0x27dc5a),'signal':this['abortController']['signal']},_0x31eec2=await fetch(this['_apiUrl'],_0x5a5819);if(_0x31eec2['ok'])return _0x585f34['stream']?await this['_readStreamableResponse'](_0x31eec2,_0x521588):await this['_readStaticResponse'](_0x31eec2,_0x521588),Promise['resolve']();{const _0x1c2c3e=await _0x31eec2['text']();return _0x1c2c3e['includes']('context_length_exceeded')?Promise['reject'](new Pi(Di(_0x3f262e,'AI_ERROR_CONTEXT_LENGTH'))):_0x1c2c3e['includes']('Moderation')?Promise['reject'](new Pi(Di(_0x3f262e,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x1c2c3e));}}async['prepareMessages'](_0x2e593c,_0x4b8258,_0x136b8d){let _0x36e51a,_0x286ffa;return _0x4b8258?(_0x36e51a='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.',_0x286ffa='Instruction:\x0a'+_0x2e593c+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x4b8258):(_0x36e51a='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.',_0x286ffa=_0x2e593c),[{'role':'system','content':_0x36e51a},{'role':'user','content':_0x286ffa}];}async _readStreamableResponse(_0x35e4a8,_0x5580a2){const _0x2e09be=_0x35e4a8['body']['getReader'](),_0x3a00ea=new TextDecoder();let _0x544c4d='',_0x1afbd1='',_0x56dd71='',_0x3e4477=!0x1;for(;!_0x3e4477;){const {done:_0x410f14,value:_0x1bfd25}=await _0x2e09be['read'](),_0x331e13=_0x544c4d+_0x3a00ea['decode'](_0x1bfd25);let _0x1842a4;_0x3e4477=_0x410f14;try{_0x1842a4=this['_cleanUpData'](_0x331e13),_0x544c4d='';}catch{_0x544c4d=_0x331e13;continue;}_0x1afbd1+=_0x1842a4,!_0x3e4477&&this['_isBufferIncomplete'](_0x1afbd1)||_0x1afbd1&&(_0x56dd71+=_0x1afbd1,_0x1afbd1='',_0x5580a2(_0x56dd71));}return Promise['resolve']();}async _readStaticResponse(_0x524bbc,_0x138286){return _0x138286((await _0x524bbc['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}_isBufferIncomplete(_0x3818e3){const _0x309c15=_0x3818e3['split']('<')['length']!==_0x3818e3['split']('>')['length'],_0x187996=_0x3818e3['length']<0x1e;return _0x309c15&&_0x187996;}_cleanUpData(_0x3cfca1){return _0x3cfca1['split'](/\n(?![^{]*\})/g)['map'](_0x509a1c=>_0x509a1c['replace']('data:\x20',''))['filter'](_0x392f27=>_0x392f27&&_0x392f27['length']>0x0&&'[DONE]'!==_0x392f27)['map'](_0x181560=>{const {choices:_0x3bdde8}=JSON['parse'](_0x181560);if(_0x3bdde8[0x0]?.['delta']?.['content'])return _0x3bdde8[0x0]['delta']['content'];})['filter'](_0x52311b=>_0x52311b)['join']('');}},as=class extends rs{static get['pluginName'](){return'AWSTextAdapter';}init(){super['init'](),St('ai-aws-adapter-not-supported');}async sendRequest(_0xf06758){throw bt('ai-aws-adapter-not-supported'),new Pi(Di(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},hs=class extends Mt{constructor(_0x2a063e,_0xaa2a5d={}){super(_0x2a063e),this['isToggleable']=!0x0,this['set']('side',_0xaa2a5d['side']||'top');const _0x422d0d=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...vt(_0xaa2a5d['class']||[]),_0x422d0d['to']('side',_0x322f01=>'ck-tab-button_'+_0x322f01),_0x422d0d['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},cs=class extends _0x414492{['children'];constructor(_0x248931,_0x220248={}){super(_0x248931);const _0x2a9384=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...vt(_0x220248['class']||[]),_0x2a9384['to']('class'),_0x2a9384['if']('isVisible','ck-hidden',_0x24e74e=>!_0x24e74e)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ls=class extends _0x414492{buttonViews=this['createCollection']();['panelViews']=this['createCollection']();_tabs=new Map();constructor(_0x5dd00b,_0x4cc07f={}){super(_0x5dd00b),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x4cc07f['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x4cc07f['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x1db1b7,_0xa2551)=>_0x1db1b7&&!_0xa2551);const _0x43eedd=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...vt(_0x4cc07f['class']||[]),_0x43eedd['to']('side',_0x317439=>'ck-tabs_'+_0x317439),_0x43eedd['to']('class'),_0x43eedd['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x43eedd['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x43eedd['to']('side',_0x5aa379=>'ck-tabs__buttons-container_'+_0x5aa379)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x43eedd['to']('side',_0x246340=>'ck-tabs__panels-container_'+_0x246340)]},'children':this['panelViews']},...vt(_0x4cc07f['children']||[])]});}getTabIds(){return[...this['_tabs']['keys']()];}getTab(_0xb3d40d){const _0x4ac3ea=this['_tabs']['get'](_0xb3d40d);return _0x4ac3ea||null;}['addTab'](_0x3089f5){const _0x2c84ce=this['_setupButton']({'id':_0x3089f5['id'],'label':_0x3089f5['buttonLabel'],'icon':_0x3089f5['buttonIcon'],'order':_0x3089f5['order']}),_0x8bf5b1=new cs(this['locale']);return _0x8bf5b1['render'](),_0x3089f5['content']&&_0x8bf5b1['children']['add'](_0x3089f5['content']),this['panelViews']['add'](_0x8bf5b1),this['_tabs']['set'](_0x3089f5['id'],{'button':_0x2c84ce,'panel':_0x8bf5b1,'order':void 0x0!==_0x3089f5['order']?_0x3089f5['order']:null}),this['fire']('addTab:'+_0x3089f5['id'],{'id':_0x3089f5['id'],'button':_0x2c84ce,'panel':_0x8bf5b1}),null===this['activeTab']?this['activateTab'](_0x3089f5['id']):this['_hidePanel'](_0x3089f5['id']),{'button':_0x2c84ce,'panel':_0x8bf5b1};}activateTab(_0x25e7e2){if(null!==_0x25e7e2&&!this['getTab'](_0x25e7e2))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x25e7e2});if(this['isCollapsed']=!0x1,this['activeTab']===_0x25e7e2)return;const _0x22a41c=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x25e7e2,_0x25e7e2&&this['_showPanel'](_0x25e7e2),this['fire']('activateTab:'+_0x25e7e2,{'newTab':_0x25e7e2,'oldTab':_0x22a41c});}toggleTabPanel(_0x1b7726){this['activeTab']===_0x1b7726?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x1b7726);}['showTab'](_0x87a4a3){if(!this['getTab'](_0x87a4a3))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x87a4a3});this['_showPanel'](_0x87a4a3),this['_showButton'](_0x87a4a3),this['fire']('show:'+_0x87a4a3,_0x87a4a3);}['hideTab'](_0x17ccd4){if(!this['getTab'](_0x17ccd4))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x17ccd4});const _0x3d6833=this['activeTab'];this['_hidePanel'](_0x17ccd4),this['_hideButton'](_0x17ccd4);const _0x88e092=this['getTabIds']();_0x3d6833===_0x17ccd4&&_0x88e092['length']>0x1&&this['activateTab'](_0x88e092['find'](_0x5d3f45=>_0x5d3f45!==_0x17ccd4)),this['fire']('hide:'+_0x17ccd4,_0x17ccd4);}_getPanel(_0x34c995){const _0x58ae4d=this['_tabs']['get'](_0x34c995);return _0x58ae4d?_0x58ae4d['panel']:null;}['_showPanel'](_0x207ad4){null!==this['activeTab']&&this['activeTab']!==_0x207ad4||this['_getPanel'](_0x207ad4)['show']();}['_hidePanel'](_0x372711){const _0x2d4637=this['_getPanel'](_0x372711);_0x2d4637['isVisible']&&(this['activeTab']===_0x372711&&(this['activeTab']=null),_0x2d4637['hide']());}_getButton(_0x463d80){const _0x13873c=this['_tabs']['get'](_0x463d80);return _0x13873c?_0x13873c['button']:null;}_showButton(_0x1efaeb){this['_getButton'](_0x1efaeb)['show']();}_hideButton(_0x4fee28){this['_getButton'](_0x4fee28)['hide']();}_setupButton(_0x1875e3){const _0x179ed8=new hs(this['locale'],{'side':this['side']}),_0x957627=this['buttonViews'];if(_0x179ed8['set']({'label':_0x1875e3['label'],'icon':_0x1875e3['icon'],'tooltip':!0x0,'withText':!0x0}),_0x179ed8['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x52dd9c,_0x3a1467)=>_0x52dd9c===_0x1875e3['id']&&!_0x3a1467),_0x179ed8['bind']('side')['to'](this,'side'),_0x1875e3['order']){const _0x3b366b=[...this['_tabs']]['reduce']((_0x1987c7,_0x463fb7)=>{const _0x39bd4b=_0x463fb7[0x0],{order:_0x362a4a}=_0x463fb7[0x1];return!_0x362a4a||_0x362a4a>_0x1875e3['order']?_0x1987c7:_0x362a4a>=_0x1987c7['order']?{'id':_0x39bd4b,'order':_0x362a4a}:_0x1987c7;},{'id':'','order':0x0}),_0x4da941=_0x957627['getIndex'](this['_getButton'](_0x3b366b['id']));_0x957627['add'](_0x179ed8,_0x4da941+0x1);}else _0x957627['add'](_0x179ed8);return _0x179ed8['on']('execute',()=>{this['toggleTabPanel'](_0x1875e3['id']);}),_0x179ed8;}};const us=['overlay','sidebar','custom'],ds=['left','right'];var _s=class extends ls{constructor(_0x5e3a71,_0x23a21c={}){super(_0x5e3a71,_0x23a21c),this['set']('type',_0x23a21c['type']||'sidebar'),this['set']('side',_0x23a21c['side']||'right'),this['set']('isVisible',_0x23a21c['visibleByDefault']??!0x0);const _0x26a999=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x26a999['if']('type','ck-ai-tabs__overlay',_0x265d66=>'overlay'===_0x265d66),_0x26a999['if']('type','ck-ai-tabs__sidebar',_0x17eb1a=>'sidebar'===_0x17eb1a),_0x26a999['if']('isVisible','ck-hidden',_0x36a0aa=>!_0x36a0aa)]}}),this['buttonViews']['on']('add',(_0x2aa38a,_0x1ff54e)=>{_0x1ff54e['set']('withText',!0x1);});}},gs=class extends _0x77cfae{['view'];container=null;showResizeButton=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x121610){if(super(_0x121610),!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 _0x4bce93=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x4bce93['showResizeButton']&&(this['showResizeButton']=_0x4bce93['showResizeButton']),'sidebar'!==_0x4bce93['type']&&'overlay'!==_0x4bce93['type']||_0x4bce93['side']&&(this['side']=_0x4bce93['side']),'sidebar'===_0x4bce93['type']){if(this['container']=_0x4bce93['element'],this['set']('type','sidebar'),!this['container'])throw new ct('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x4bce93['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':_0x4bce93['visibleByDefault'],'collapsible':_0x4bce93['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 _0x5849ed&&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(_0x1f67b2){if(_0x1f67b2&&this['type']!==_0x1f67b2){if(!us['includes'](_0x1f67b2))throw new ct('ai-tabs-unsupported-ui-type');this['type']=_0x1f67b2;}}switchSide(_0x312ef5){if(_0x312ef5&&this['side']!==_0x312ef5){if(!ds['includes'](_0x312ef5))throw new ct('ai-tabs-unsupported-ui-side');this['side']=_0x312ef5;}}destroy(){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}};function As(_0x3aec95){return{..._0x3aec95,'type':'context'};}var Is=class extends _0x77cfae{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}_token;['_decoder'];static get requires(){return[_0x17bc00];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x337d36){if(super(_0x337d36),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 _0x35b7bf=this['context']['plugins']['get'](_0x17bc00);if(!_0x35b7bf['token'])throw new ct('ai-missing-token',this);this['_token']=_0x35b7bf['token'];}_getExtraHttpHeaders(){const _0x51e2d3=this['context']['config']['get']('ai.extraHttpHeaders'),_0x2abdf5='function'==typeof _0x51e2d3?_0x51e2d3():_0x51e2d3;if(Array['isArray'](_0x2abdf5)&&_0x2abdf5['length'])return Object['fromEntries'](_0x2abdf5['map'](({domain:_0x5235df,headers:_0x20cbd4})=>[_0x5235df,_0x20cbd4]));}startConversation(_0x53e85d,_0x3e84a9){const _0x2f1720=this['_sendApiRequest']('/conversations','POST',{'id':_0x53e85d,'group':_0x3e84a9});return{'getConversation':async()=>(await _0x2f1720['request'])['json'](),'abortController':_0x2f1720['abortController']};}queryAssistant({message:_0x17573b,conversationId:_0x33edc0,parts:_0x46a21d,capabilities:_0x48c72e,model:_0x3c35b0,attributes:_0x31ba0e}){const _0x41796e=this['_getExtraHttpHeaders'](),_0x287fe9={..._0x17573b&&{'prompt':_0x17573b},'content':_0x46a21d,'model':_0x3c35b0,..._0x48c72e&&{'capabilities':_0x48c72e},..._0x31ba0e&&{'attributes':_0x31ba0e},..._0x41796e&&{'extraHttpHeaders':_0x41796e}},_0x227ba4=this['_sendApiRequest']('/conversations/'+_0x33edc0+'/messages','POST',_0x287fe9,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x1d4529=(await _0x227ba4['request'])['body'];return this['_getStreamReader'](_0x1d4529);},'abortController':_0x227ba4['abortController']};}executeCustomAction({content:_0xff8051,message:_0x30a679,model:_0x4d1ba6,outputFormat:_0x5ea463,contexts:_0x4c54a6}){const _0x49f180={'content':[{'type':'text','content':_0xff8051}],..._0x30a679&&{'prompt':_0x30a679},'model':_0x4d1ba6,'outputFormat':_0x5ea463,...ps(_0x4c54a6)},_0x313bf5=this['_sendApiRequest']('/actions/custom/calls','POST',_0x49f180);return{'getStream':async()=>{const _0x526839=(await _0x313bf5['request'])['body'];return this['_getStreamReader'](_0x526839);},'abortController':_0x313bf5['abortController']};}executeAction({actionName:_0x29ead5,content:_0x444e1b,args:_0x46b9b6,contexts:_0x4db838}){const _0x41496c={'content':[{'type':'text','content':_0x444e1b}],'args':_0x46b9b6,...ps(_0x4db838)},_0x2a32a0=this['_sendApiRequest']('/actions/system/'+_0x29ead5+'/calls','POST',_0x41496c);return{'getStream':async()=>{const _0x345b0d=(await _0x2a32a0['request'])['body'];return this['_getStreamReader'](_0x345b0d);},'abortController':_0x2a32a0['abortController']};}['uploadFile'](_0x20f535,_0x23ed0f,_0x1fad18){const _0x519727=new FormData();_0x519727['append']('file',_0x23ed0f,_0x23ed0f['name']),_0x1fad18&&_0x519727['append']('attributes',JSON['stringify'](_0x1fad18));const _0x231e11=this['_sendApiRequest']('/conversations/'+_0x20f535+'/files','POST',_0x519727);return{'getId':async()=>(await _0x231e11['request'])['json'](),'abortController':_0x231e11['abortController']};}uploadDocuments(_0x3535cc,_0x41089c){const _0x5e3cff={'documents':_0x41089c['map'](_0x1522e9=>({'content':_0x1522e9['content'],'attributes':{'version':_0x1522e9['version'],'sessionId':_0x1522e9['sessionId'],'channelId':_0x1522e9['channelId'],'rootName':_0x1522e9['rootName'],'selections':_0x1522e9['selections']},...void 0x0!==_0x1522e9['name']?{'name':_0x1522e9['name']}:{},...void 0x0!==_0x1522e9['description']?{'description':_0x1522e9['description']}:{}}))},_0x9dda0d=this['_sendApiRequest']('/conversations/'+_0x3535cc+'/documents/batch','POST',_0x5e3cff);return{'getIds':async()=>(await _0x9dda0d['request'])['json'](),'abortController':_0x9dda0d['abortController']};}fetchDocuments(_0x501c51,_0x5660bd){const _0x3aeea2=new URLSearchParams();_0x3aeea2['append']('documentIds',_0x5660bd['join'](','));const _0xb3ca4e=this['_sendApiRequest']('/conversations/'+_0x501c51+'/documents/batch?'+_0x3aeea2['toString'](),'GET');return{'getDocuments':async()=>(await _0xb3ca4e['request'])['json'](),'abortController':_0xb3ca4e['abortController']};}fetchConversations(_0x2dc059,_0xfd4df5={}){const _0x561faf=new URLSearchParams();_0x561faf['append']('group',_0x2dc059),_0x561faf['append']('excludeEmpty',!0x1!==_0xfd4df5['excludeEmpty']?'true':'false'),_0x561faf['append']('limit',_0xfd4df5['limit']?_0xfd4df5['limit']['toString']():0x64['toString']()),_0x561faf['append']('sortBy',_0xfd4df5['sortBy']?_0xfd4df5['sortBy']:'createdAt'),_0x561faf['append']('order',_0xfd4df5['order']?_0xfd4df5['order']:'desc');const _0x10f027=this['_sendApiRequest']('/conversations?'+_0x561faf['toString'](),'GET');return{'getConversations':async()=>(await(await _0x10f027['request'])['json']())['items'],'abortController':_0x10f027['abortController']};}deleteConversation(_0x1bb032){const _0x4c9d23=this['_sendApiRequest']('/conversations/'+_0x1bb032,'DELETE');return{'execute':async()=>{await _0x4c9d23['request'];},'abortController':_0x4c9d23['abortController']};}updateConversation(_0x37f14a,_0x4bbb8e){const _0x1fcc19=this['_sendApiRequest']('/conversations/'+_0x37f14a,'PATCH',_0x4bbb8e);return{'getResult':async()=>(await _0x1fcc19['request'],_0x4bbb8e),'abortController':_0x1fcc19['abortController']};}fetchConversation(_0x9e120b){const _0x4399a4=this['_sendApiRequest']('/conversations/'+_0x9e120b,'GET');return{'getConversation':async()=>(await _0x4399a4['request'])['json'](),'abortController':_0x4399a4['abortController']};}fetchConversationMessages(_0xb954af){const _0x3da8eb=this['_sendApiRequest']('/conversations/'+_0xb954af+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x3da8eb['request'])['json']())['items'],'abortController':_0x3da8eb['abortController']};}['uploadUrl'](_0x199dcb,_0x1e1aee,_0xb0207d){const _0x3f7261=this['_sendApiRequest']('/conversations/'+_0x199dcb+'/web-resources','POST',{'url':_0x1e1aee,'attributes':_0xb0207d});return{'getId':async()=>(await _0x3f7261['request'])['json'](),'abortController':_0x3f7261['abortController']};}getModels(_0xf69aa8='en'){const _0x5bad0f=new URLSearchParams();_0x5bad0f['append']('language',_0xf69aa8);const _0x19aef9='/models/1?'+_0x5bad0f['toString'](),_0x4e291e=this['_sendApiRequest'](_0x19aef9,'GET');return{'list':async()=>await(await _0x4e291e['request'])['json'](),'abortController':_0x4e291e['abortController']};}listContexts(_0x4b305a={}){const _0x30bdc7=new URLSearchParams();_0x30bdc7['append']('limit',_0x4b305a['limit']?_0x4b305a['limit']['toString']():0x64['toString']()),_0x4b305a['cursor']&&_0x30bdc7['append']('cursor',_0x4b305a['cursor']),_0x4b305a['order']&&_0x30bdc7['append']('order',_0x4b305a['order']);const _0x463908=this['_sendApiRequest']('/contexts?'+_0x30bdc7['toString'](),'GET');return{'getContexts':async()=>(await(await _0x463908['request'])['json']())['items'],'abortController':_0x463908['abortController']};}deleteFile(_0x12d946,_0x39a361){const _0x40e70f=this['_sendApiRequest']('/conversations/'+_0x12d946+'/files/'+_0x39a361,'DELETE');return{'execute':async()=>{await _0x40e70f['request'];},'abortController':_0x40e70f['abortController']};}deleteDocument(_0x3ef746,_0xcabc6f){const _0x4df98c=this['_sendApiRequest']('/conversations/'+_0x3ef746+'/documents/'+_0xcabc6f,'DELETE');return{'execute':async()=>{await _0x4df98c['request'];},'abortController':_0x4df98c['abortController']};}deleteWebResource(_0x1a25ba,_0x4b30cc){const _0x204adb=this['_sendApiRequest']('/conversations/'+_0x1a25ba+'/web-resources/'+_0x4b30cc,'DELETE');return{'execute':async()=>{await _0x204adb['request'];},'abortController':_0x204adb['abortController']};}cancelStream(_0x3db76c,_0x250064){const _0x448191=this['_sendApiRequest']('/conversations/'+_0x3db76c+'/messages/'+_0x250064+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x448191['request'];},'abortController':_0x448191['abortController']};}resumeStream(_0x2ca0ba,_0x3091e8,_0x25e78d='0-0'){const _0x1cd769=new URLSearchParams({'lastEventId':_0x25e78d}),_0x18964e=this['_sendApiRequest']('/conversations/'+_0x2ca0ba+'/messages/'+_0x3091e8+'/stream?'+_0x1cd769['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x3f432b=await _0x18964e['request'];return this['_getStreamReader'](_0x3f432b['body']);},'abortController':_0x18964e['abortController']};}callSystemReview({reviewName:_0x3f65c2,content:_0x5b7fff,args:_0x516b3c,contexts:_0x5ac666}){const _0x388bc0=this['_sendApiRequest']('/reviews/system/'+_0x3f65c2+'/calls','POST',{'content':[{'type':'text','content':_0x5b7fff}],'args':_0x516b3c,...ps(_0x5ac666)});return{'getStream':async()=>{const _0x51829f=(await _0x388bc0['request'])['body'];return this['_getStreamReader'](_0x51829f);},'abortController':_0x388bc0['abortController']};}processDocument({content:_0x16af3a,prompt:_0x2fd94e,model:_0x55166f,capabilities:_0x55ba02,contexts:_0x5a7429}){const _0x238f36=this['_getExtraHttpHeaders'](),_0x25649b=this['_sendApiRequest']('/documents/process','POST',{'content':_0x16af3a,'prompt':_0x2fd94e,'model':_0x55166f,..._0x55ba02&&{'capabilities':_0x55ba02},...ps(_0x5a7429),..._0x238f36&&{'extraHttpHeaders':_0x238f36}});return{'getResult':async()=>(await _0x25649b['request'])['json'](),'abortController':_0x25649b['abortController']};}callCustomReview({content:_0x1fb251,prompt:_0x2391da,model:_0x148e73,contexts:_0x456750}){const _0x41ab15=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x1fb251}],..._0x2391da&&{'prompt':_0x2391da},'model':_0x148e73,...ps(_0x456750)});return{'getStream':async()=>{const _0x2dea05=(await _0x41ab15['request'])['body'];return this['_getStreamReader'](_0x2dea05);},'abortController':_0x41ab15['abortController']};}upsertAIChatRating(_0x43e7b4,_0x3e0ffd,_0x20ec6f){const _0xf92d94=this['_sendApiRequest']('/conversations/'+_0x43e7b4+'/messages/'+_0x3e0ffd+'/ratings','PUT',{'positiveCount':_0x20ec6f['positiveCount'],'totalCount':_0x20ec6f['totalCount'],'modificationId':_0x20ec6f['modificationId']});return{'execute':async()=>{await _0xf92d94['request'];},'abortController':_0xf92d94['abortController']};}upsertAIActionRating(_0x1d272c,_0x2f1be6,_0x108c20){const _0x15219d=this['_sendApiRequest']('/actions/system/'+_0x1d272c+'/calls/'+_0x2f1be6+'/ratings','PUT',{'positiveCount':_0x108c20['positiveCount'],'totalCount':_0x108c20['totalCount']});return{'execute':async()=>{await _0x15219d['request'];},'abortController':_0x15219d['abortController']};}upsertCustomAIActionRating(_0x559e4f,_0x146fae){const _0x333388=this['_sendApiRequest']('/actions/custom/calls/'+_0x559e4f+'/ratings','PUT',{'positiveCount':_0x146fae['positiveCount'],'totalCount':_0x146fae['totalCount']});return{'execute':async()=>{await _0x333388['request'];},'abortController':_0x333388['abortController']};}upsertAIReviewRating(_0x3a587d,_0x32aa6d,_0x32018c,_0x4cc035){const _0x657ff1=this['_sendApiRequest']('/reviews/system/'+_0x3a587d+'/calls/'+_0x32aa6d+'/ratings','PUT',{'positiveCount':_0x32018c['positiveCount'],'totalCount':_0x32018c['totalCount'],'dataId':_0x4cc035});return{'execute':async()=>{await _0x657ff1['request'];},'abortController':_0x657ff1['abortController']};}upsertCustomAIReviewRating(_0x20c600,_0x523657,_0x5cefcc){const _0x439c67=this['_sendApiRequest']('/reviews/custom/calls/'+_0x20c600+'/ratings','PUT',{'positiveCount':_0x523657['positiveCount'],'totalCount':_0x523657['totalCount'],'dataId':_0x5cefcc});return{'execute':async()=>{await _0x439c67['request'];},'abortController':_0x439c67['abortController']};}_sendApiRequest(_0x2c344e,_0x2903d1,_0x581310,_0x56b3e3={}){const {apiUrl:_0x1ea892=this['_apiUrl']}=_0x56b3e3,_0x30427b=new AbortController(),_0x574ca7=_0x581310 instanceof FormData,_0x1be84a={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':yt};_0x581310&&!_0x574ca7&&(_0x1be84a['Content-Type']='application/json');const _0x419146={'method':_0x2903d1,'headers':_0x1be84a,'signal':_0x30427b['signal']};return _0x581310&&(_0x419146['body']=_0x574ca7?_0x581310:JSON['stringify'](_0x581310)),{'request':fetch(''+_0x1ea892+_0x2c344e,_0x419146)['catch'](_0x464a57=>{this['_handleError'](_0x464a57);})['then'](_0xd85544=>_0xd85544['ok']?_0xd85544:_0xd85544['json']()['then'](_0x2f51eb=>{throw{'url':_0x1ea892,'path':_0x2c344e,'method':_0x2903d1,'body':_0x581310,'status':(_0xd85544||{})['status'],'statusText':(_0xd85544||{})['statusText'],'code':_0x2f51eb['code'],'message':_0x2f51eb['message'],'traceId':_0x2f51eb['traceId'],'data':_0x2f51eb['data']};})),'abortController':_0x30427b};}async *_getStreamReader(_0x2c00a1){const _0x971b49=[],_0x1ae3a6=_0x2c00a1['getReader'](),_0x495c27=_0x419e25({'onError':_0x1d3a39=>{this['_handleError'](_0x1d3a39);},'onEvent':_0x2f1e65=>{_0x2f1e65['data']=JSON['parse'](_0x2f1e65['data']),_0x971b49['push'](_0x2f1e65);}});try{let _0x416a74=!0x1;for(;!_0x416a74;){const {done:_0x92c659,value:_0x55ffcd}=await _0x1ae3a6['read']();_0x92c659&&(_0x416a74=!0x0),_0x495c27['feed'](this['_decoder']['decode'](_0x55ffcd,{'stream':!0x0})),yield*_0x971b49,_0x971b49['length']=0x0;}}catch(_0x3b99c7){this['_handleError'](_0x3b99c7);}finally{_0x1ae3a6['releaseLock'](),_0x495c27['reset']();}}['_handleError'](_0x185360){if(_0x185360 instanceof ct)throw _0x185360;if(_0x185360 instanceof Error&&'AbortError'===_0x185360['name'])throw new ct('ai-request-aborted',this,{'originalError':_0x185360});throw new ct('ai-request-failed',this,{'originalError':_0x185360});}};function ps(_0x5710f3){return _0x5710f3?.['length']?{'contexts':_0x5710f3['map'](As)}:{};}function Es(_0x14716e,_0x3f928a,_0x58f8ab){const t=_0x14716e['t'];switch(_0x3f928a){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'},_0x58f8ab);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.'},_0x58f8ab);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.'},_0x58f8ab);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.'},_0x58f8ab);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'},_0x58f8ab);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x58f8ab);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'},_0x58f8ab);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.'},_0x58f8ab);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.'},_0x58f8ab);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.'},_0x58f8ab);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.'},_0x58f8ab);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'},_0x58f8ab);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.'},_0x58f8ab);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 _0x3f928a;}}const ms=/* #__PURE__ -- @preserve */
|
|
25
|
-
dt();var Ts=class extends ms{_connector;['_config'];['_locale'];_modelList=[];_modelsRequest=null;constructor({connector:_0x166cda,config:_0x5b95ea,locale:_0x2ccd45}){super(),this['_connector']=_0x166cda,this['_config']=_0x5b95ea,this['_locale']=_0x2ccd45;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get _defaultModelId(){return this['_config']?.['defaultModelId'];}async getAllModels(){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()['catch'](_0x1bacf0=>{throw this['_modelsRequest']=null,_0x1bacf0;})),this['_modelsRequest'];}async getAvailableModels(){const _0x2cc32b=await this['getAllModels']();let _0x38cbfe;return _0x38cbfe=this['_availableModels']?this['_filterModels'](_0x2cc32b,this['_availableModels']):_0x2cc32b['filter'](_0x4ec73e=>_0x4ec73e['recommended']),_0x38cbfe;}async['resolveModel'](_0x3368a9){const _0x215d54=await this['getAllModels']();if(!_0x215d54['length'])return null;if(_0x3368a9){const _0x49c516=this['_getModelById'](_0x215d54,_0x3368a9);if(_0x49c516)return _0x49c516;St('ai-chat-model-id-unrecognized',{'modelId':_0x3368a9,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async getDefault(){const _0x5cbe13=await this['getAvailableModels']();if(!_0x5cbe13['length'])return null;if(this['_defaultModelId']){const _0x554267=this['_getModelById'](_0x5cbe13,this['_defaultModelId']);if(_0x554267)return _0x554267;St('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x5cbe13[0x0]['id']});}return _0x5cbe13[0x0];}async['isAvailable'](_0x12f70a){return(await this['getAvailableModels']())['some'](_0x57d330=>_0x57d330['name']===_0x12f70a['name']&&_0x57d330['provider']===_0x12f70a['provider']);}async getModel(_0x53cb35){const _0x41a3f1=await this['getAllModels']();return this['_getModelById'](_0x41a3f1,_0x53cb35)||null;}async _retrieveModels(){if(!this['_modelList']['length']){const _0xcd56af=this['_locale']['uiLanguage']||'en',_0x8b2511=await this['_connector']['getModels'](_0xcd56af)['list']();this['_modelList']=_0x8b2511['items']['map'](_0x7e27e3=>ws(_0x7e27e3)?{..._0x7e27e3,'name':Es(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x7e27e3);}return[...this['_modelList']];}_filterModels(_0x3b7dd6,_0x1e5a3c){let _0x2378b1;if(_0x1e5a3c){_0x2378b1=[];const _0x2186f9=new Set(),_0x53b860='string'==typeof _0x1e5a3c?[_0x1e5a3c['toLocaleLowerCase']()]:_0x1e5a3c['map'](_0x517c20=>_0x517c20['toLocaleLowerCase']());for(const _0x46d9dc of _0x53b860)for(const _0xe45a65 of _0x3b7dd6)!_0x2186f9['has'](_0xe45a65['id'])&&this['_isMatchingFilter'](_0xe45a65,_0x46d9dc)&&(_0x2378b1['push'](_0xe45a65),_0x2186f9['add'](_0xe45a65['id']));}else _0x2378b1=_0x3b7dd6;return _0x2378b1;}_isMatchingFilter(_0x552aa8,_0x3f5d7f){const _0x73d8e5=_0x552aa8['id']['toLocaleLowerCase'](),_0x3f5613=_0x552aa8['name']['toLocaleLowerCase'](),_0x3afb41=_0x552aa8['provider']['toLocaleLowerCase']();return _0x73d8e5===_0x3f5d7f||_0x3f5613===_0x3f5d7f||ws(_0x552aa8)&&'auto'===_0x3f5d7f||_0x3afb41===_0x3f5d7f||_0x73d8e5['startsWith'](_0x3f5d7f);}_getModelById(_0x31551f,_0x8e4c0a){return _0x31551f['find'](_0x3bfe43=>ws(_0x3bfe43)&&'auto'===_0x8e4c0a?_0x3bfe43:_0x3bfe43['id']===_0x8e4c0a)||null;}};function ws(_0x17c7e1){return _0x17c7e1['id']['startsWith']('agent');}var Cs=class{_connector;_defaultContext;_contextsRequest=null;constructor({connector:_0x4846ec,defaultContext:_0x548543}){this['_connector']=_0x4846ec,this['_defaultContext']=_0x548543;}async getAllContexts(){return this['_contextsRequest']||(this['_contextsRequest']=this['_connector']['listContexts']()['getContexts']()['catch'](_0x45d32b=>{throw this['_contextsRequest']=null,_0x45d32b;})),[...await this['_contextsRequest']];}async getAvailableContexts(){const _0x3108f1=await this['getAllContexts'](),_0x3dc5e3=new Set((this['_defaultContext']??[])['map'](_0x5004ec=>_0x5004ec['id']));return _0x3108f1['filter'](_0x2e6810=>!_0x3dc5e3['has'](_0x2e6810['id']));}resolveContext({feature:_0x2dd417,ids:_0xfafafd=[],extraContexts:_0x45b1b9=[],idScopedOnly:_0xf929aa=!0x1,context:_0x3f9d9a}){const _0x279db3=this['_resolveDefaultContext'](_0x2dd417,_0xfafafd,_0xf929aa);return _0x3f9d9a['addDefaultContext']([..._0x279db3,..._0x45b1b9]),_0x3f9d9a;}_resolveDefaultContext(_0x4085c4,_0xc282bb,_0x4abc17=!0x1){if(!this['_defaultContext'])return[];const _0x5647d2=[];for(const _0x1fa174 of this['_defaultContext'])this['_entryAppliesToFeature'](_0x1fa174['features'],_0x4085c4,_0xc282bb)&&(_0x4abc17&&this['_entryAppliesToFeature'](_0x1fa174['features'],_0x4085c4,[])||_0x5647d2['push'](this['_toContextRef'](_0x1fa174)));return _0x5647d2;}_toContextRef(_0x43bdc0){return'promptId'in _0x43bdc0?{'id':_0x43bdc0['id'],'promptId':_0x43bdc0['promptId']}:'fileId'in _0x43bdc0?{'id':_0x43bdc0['id'],'fileId':_0x43bdc0['fileId']}:{'id':_0x43bdc0['id']};}_entryAppliesToFeature(_0x4be1de,_0x1547a5,_0x46d035){if(!_0x4be1de)return!0x0;const _0x1158d0=_0x4be1de[_0x1547a5];return!!_0x1158d0&&(!0x0===_0x1158d0||_0x46d035['some'](_0x513eae=>_0x1158d0['test'](_0x513eae)));}},fs=class extends _0x77cfae{['models'];contextLibrary;static get['pluginName'](){return'AICore';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[Is];}init(){const _0x16f148=this['context']['plugins']['get'](Is);this['models']=new Ts({'connector':_0x16f148,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),this['contextLibrary']=new Cs({'connector':_0x16f148,'defaultContext':this['context']['config']['get']('ai.defaultContext')});}};function bs(_0x15f619){return _0x15f619?_0x15f619 instanceof _0x5849ed?[_0x15f619]:_0x15f619['editors']&&0x0!==_0x15f619['editors']['length']?Array['from'](_0x15f619['editors']):[]:[];}function Ss(_0x5f3170){const _0x18eab1=bs(_0x5f3170);if(!_0x18eab1['length'])throw new ct('ai-get-editor-from-context-no-editor');if(0x1===_0x18eab1['length'])return _0x18eab1[0x0];const _0x215441=_0x18eab1['find'](_0x3e91c2=>_0x3e91c2['ui']?.['focusTracker']?.['isFocused']);if(_0x215441)return _0x215441;const _0x14301d=function(_0x30042a){if(_0x30042a instanceof _0x5849ed)return;const _0x4c6f14=_0x30042a;if(!_0x4c6f14['plugins']||!_0x4c6f14['plugins']['has']('AIEditing'))return;return _0x4c6f14['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x5f3170);return _0x14301d&&_0x18eab1['includes'](_0x14301d)?_0x14301d:_0x18eab1[0x0];}function Rs(_0x11eba0,_0x5a8e4c){return _0x32b963(_0x11eba0,_0x5a8e4c);}function Os(_0x5ef986,_0x58794b){return _0xa920ee(_0x5ef986,_0x58794b);}function vs(_0x47c8bd,_0x223762,_0x2497ee){const _0x44e20c=null!==_0x223762?_0x2882cb=>_0x2882cb['attribs'][_0x47c8bd]===_0x223762:_0x28dbd0=>Boolean(_0x28dbd0['attribs'][_0x47c8bd]);return _0x3aba21(_0x4a4862=>_0x40b07f(_0x4a4862)&&_0x44e20c(_0x4a4862),_0x2497ee);}function ks(_0x508e0f,_0x3314be,_0x523383){const _0x5daf50=null!==_0x3314be?_0x8259ce=>_0x8259ce['attribs'][_0x508e0f]===_0x3314be:_0x5cf310=>Boolean(_0x5cf310['attribs'][_0x508e0f]);return _0xbb5ed2(_0x27f671=>_0x40b07f(_0x27f671)&&_0x5daf50(_0x27f671),_0x523383);}function ys(_0x5615ed){return _0xbb5ed2(_0x147d85=>_0x40b07f(_0x147d85)&&function(_0x2c349b){const _0x1b3a22=_0x2c349b['toLowerCase']();return'script'===_0x1b3a22||'style'===_0x1b3a22||_0x1b3a22['includes']('-');}(_0x147d85['name']),_0x5615ed);}const Ns=['comment-start','comment-end','suggestion-start','suggestion-end'];function xs(_0x40af8f){return _0x40b07f(_0x40af8f)&&Ns['includes'](_0x40af8f['name']['toLowerCase']());}function Ls(_0x2feff0){return _0x5bfaa4(_0x522dda=>_0x2cea0f(_0x522dda),_0x2feff0,!0x0,0x1/0x0);}function Ps(_0x2c2d9b,_0x516f83){return _0x2c2d9b&&_0x40b07f(_0x2c2d9b)?_0x2c2d9b['attribs'][_0x516f83]:null;}function Ds(_0x532b8e,_0x28b27b,_0x286cfa){_0x40b07f(_0x532b8e)&&(null===_0x286cfa?delete _0x532b8e['attribs'][_0x28b27b]:_0x532b8e['attribs'][_0x28b27b]=_0x286cfa);}function Hs(_0xf7240,_0x2a408b,_0x134e6d){const _0x573ee9=_0x2a408b['cloneNode'](!0x0);'beforebegin'===_0x134e6d?ti(_0xf7240,_0x573ee9):'afterbegin'===_0x134e6d?_0x3651de(_0xf7240,_0x573ee9):'beforeend'===_0x134e6d?_0x3c15cc(_0xf7240,_0x573ee9):'afterend'===_0x134e6d&&_0x2de99f(_0xf7240,_0x573ee9);}function Ms(_0x3bc818){const _0x2cb571=[];let _0x3cfab0=_0x3bc818;for(;_0x3cfab0;)_0x3cfab0=_0x2e8850(_0x3cfab0),_0x3cfab0&&_0x2cb571['push'](_0x3cfab0);return _0x2cb571;}function Us(_0xd8c1b0){return _0xd8c1b0['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function Vs(_0x596379){let _0x3a90a8=0x0;for(;_0x596379['parentNode'];)_0x596379=_0x596379['parentNode'],_0x3a90a8++;return _0x3a90a8;}function Bs(_0x5cf51e){const _0x435b91=[];let _0x2fffb5=_0x5cf51e['nextSibling'];for(;_0x2fffb5;)_0x435b91['push'](_0x2fffb5),_0x2fffb5=_0x2fffb5['nextSibling'];_0x435b91['forEach'](_0x5cd4b4=>{_0x5c7bf0(_0x5cd4b4);});}function Gs(_0x31d52c,_0x4a84f0){return!!_0x31d52c['model']['document']['getRoot'](_0x4a84f0)&&!_0x2e6aed(_0x31d52c,_0x4a84f0);}function Fs(_0x1b640a,_0x36dad){return'<p\x20data-id=\x22'+_0x36dad+'\x22>'+_0x1b640a+'</p>';}function Ks(_0x4346cc){return'p'===_0x4346cc['name']['toLowerCase']()&&Boolean(_0x4346cc['attribs']['data-id']);}function Ws(_0x2d5917){const _0x17ad2b=Rs(_0x2d5917)['children']['filter'](_0x40b07f);return 0x1===_0x17ad2b['length']&&Ks(_0x17ad2b[0x0])?_0x17ad2b[0x0]['children']['map'](_0x2f808f=>Os(_0x2f808f))['join'](''):_0x2d5917;}function Ys(_0x2c71f,_0x48f2b9){const _0x235eb3=function(_0x425958){const _0x16d813=_0x425958['children']['filter'](_0x40b07f);return 0x1===_0x16d813['length']&&Ks(_0x16d813[0x0])?_0x16d813[0x0]['children']:_0x425958['children'];}(_0x48f2b9),{blockElements:_0x49f7ae}=_0x2c71f['editing']['view']['domConverter'],_0x20e05a=_0x208dee=>_0x208dee['some'](_0x4495b3=>_0x40b07f(_0x4495b3)&&('p'!==_0x4495b3['name']['toLowerCase']()&&_0x49f7ae['includes'](_0x4495b3['name']['toLowerCase']())||_0x20e05a(_0x4495b3['children'])));if(_0x20e05a(_0x235eb3))return!0x1;const _0x3b1696=_0x235eb3['map'](_0x326e94=>Os(_0x326e94))['join'](''),_0x34e83a=_0x2c71f['data']['parse'](_0x3b1696,'$root'),{schema:_0x6f6b25}=_0x2c71f['model'];let _0x170a7e=0x0;for(const {item:_0x4786e3}of _0x2c71f['model']['createRangeIn'](_0x34e83a))if(_0x4786e3['is']('element')&&_0x6f6b25['isBlock'](_0x4786e3)&&(++_0x170a7e>0x1||'paragraph'!==_0x4786e3['name']))return!0x1;return!0x0;}function $s(_0x20685b,_0x550e9a){const _0x11fc19=_0x550e9a['filter'](_0x3833c0=>'new'!=_0x3833c0['type'])['map'](_0x498c8b=>vs('data-id',_0x498c8b['id'],_0x20685b))['filter'](_0x15f2e3=>null!==_0x15f2e3),_0x34cea7=_0x550e9a['filter'](_0x587800=>'removed'!=_0x587800['type'])['map'](_0x3acac4=>_0x3acac4['node']['cloneNode'](!0x0));let _0x57075e=null;if(_0x11fc19['length']){_0x57075e=_0x11fc19[0x0]['previousSibling'];for(let _0x28fdef=0x0;_0x28fdef<_0x11fc19['length'];_0x28fdef++)_0x5c7bf0(_0x11fc19[_0x28fdef]);}if(_0x34cea7['length']){_0x57075e||(_0x550e9a[0x0]['anchorId']?_0x57075e=vs('data-id',_0x550e9a[0x0]['anchorId'],_0x20685b):(_0x57075e=_0x34cea7['shift'](),_0x3651de(_0x20685b,_0x57075e)));for(let _0x3a2db2=0x0;_0x3a2db2<_0x34cea7['length'];_0x3a2db2++)_0x2de99f(_0x57075e,_0x34cea7[_0x3a2db2]),_0x57075e=_0x34cea7[_0x3a2db2];}}function qs(_0x375b3d,_0x1831a6){const _0x37ebd9=new Set();for(const _0x2493c6 of _0x375b3d){if(!_0x2493c6['editor']||'destroyed'===_0x2493c6['editor']['state']||!Gs(_0x2493c6['editor'],_0x2493c6['rootName']))continue;const _0x12ec29=_0x1831a6['get'](_0x2493c6['documentId']);let _0xcbd83a;_0x12ec29?(_0xcbd83a=_0x12ec29['cloneNode'](!0x0),$s(_0xcbd83a,_0x2493c6['changes'])):_0xcbd83a=new _0x35b618(_0x2493c6['changes']['filter'](_0x2bc711=>'removed'!=_0x2bc711['type'])['map'](_0x34463f=>_0x34463f['node']['cloneNode'](!0x0))),Ys(_0x2493c6['editor'],_0xcbd83a)||_0x37ebd9['add'](_0x2493c6['index']);}return _0x37ebd9;}function Qs(_0x62c12,_0x251ed3,_0x4edbe1,_0x130092){return Gs(_0x62c12,_0x251ed3)?Ys(_0x62c12,Rs(_0x130092))?{'before':Ws(_0x4edbe1),'after':Ws(_0x130092)}:null:{'before':_0x4edbe1,'after':_0x130092};}function Xs(_0x4178d9,_0x4010bf){return _0x5d9ad4(_0x4178d9,_0x4010bf);}function zs(_0x326a47,_0x2aa771){return _0x326a47['map'](_0x484faa=>null!==_0x484faa&&'object'==typeof _0x484faa?Xs(_0x484faa,_0x2aa771):_0x484faa);}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 _0x77cfae{constructor(_0x54d1cf){super(_0x54d1cf),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(_0x192d04){let _0x5ed260=this['_sessionIdByEditor']['get'](_0x192d04);return _0x5ed260||(_0x5ed260=_0x192d04['plugins']['has']('RealTimeCollaborationClient')&&_0x192d04['plugins']['get']('RealTimeCollaborationClient')['sessionId']||kt(),this['_sessionIdByEditor']['set'](_0x192d04,_0x5ed260)),_0x5ed260;}async getDocumentData(_0x1ac390){const _0x1a4afe=bs(this['context']),_0x172c26=[],_0x71b643=new Set();for(const _0x28b846 of _0x1a4afe){if(_0x1ac390&&!_0x1ac390['has'](_0x28b846['config']['get']('collaboration.channelId')))continue;const _0x2284c9=_0x28b846['config']['get']('roots')||{},_0x13c26a=this['_getEditorSelectionSignature'](_0x28b846),_0x9e80fd=_0x28b846['config']['get']('collaboration.channelId'),_0x2cd39c=this['getSessionId'](_0x28b846);for(const _0x94140d of _0x28b846['model']['document']['getRoots']()){if('$graveyard'===_0x94140d['rootName'])continue;const _0x181287=await this['_getDocumentDataForEditorRoot'](_0x28b846,_0x94140d,_0x71b643),_0x5a606a=_0x2284c9[_0x94140d['rootName']],_0x1c3b9b=_0x94140d['getAttribute']('$description')??_0x5a606a?.['description'];let _0x2adfea=_0x94140d['getAttribute']('$title')??_0x5a606a?.['title'];_0x2adfea||(_0x2adfea=_0x94140d['getAttribute']('$rootEditableOptions')?.['label']??_0x5a606a?.['label']),_0x2adfea||(St('ai-document-root-missing-title',{'editor':_0x28b846,'rootName':_0x94140d['rootName']}),_0x2adfea=_0x94140d['rootName']),_0x172c26['push']({'editor':_0x28b846,'rootName':_0x94140d['rootName'],'content':_0x181287['content'],'version':_0x181287['version'],'sessionId':_0x2cd39c,'channelId':_0x9e80fd,'selections':_0x181287['selections'],'selectionSignature':_0x13c26a,'editorConfig':this['_getEditorConfig'](_0x28b846),'name':_0x2adfea,'description':_0x1c3b9b});}}return _0x172c26;}getEditorsVersions(){const _0xd61205=bs(this['context']),_0x5c2371=new Map();for(const _0x802b02 of _0xd61205){const _0x5cf9d6=_0x802b02['config']['get']('collaboration.channelId');_0x5c2371['set'](_0x5cf9d6,_0x802b02['model']['document']['version']);}return _0x5c2371;}getEditorsSelections(){const _0x2e33a6=bs(this['context']),_0x2dba0c=new Map();for(const _0x21e7d1 of _0x2e33a6){const _0x311510=_0x21e7d1['config']['get']('collaboration.channelId'),_0x1b2e84=this['_getEditorSelectionSignature'](_0x21e7d1);_0x2dba0c['set'](_0x311510,_0x1b2e84);}return _0x2dba0c;}_getEditorSelectionSignature(_0x115157){return this['_getMarkersInDocumentOrder'](_0x115157)['map'](_0x336de7=>{const _0x3494a9=_0x336de7['getRange']();return _0x3494a9['root']['rootName']+':'+_0x3494a9['start']['path']['join']('.')+'-'+_0x3494a9['end']['path']['join']('.');})['join']('|');}async _getDocumentDataForEditorRoot(_0x1dd55c,_0x1c4bbc,_0x20e426){const _0xbc33bf=_0x1dd55c['data']['toView'](_0x1c4bbc,{'convertAiChatSelectionMarker':!0x0}),_0x5326cf=new _0x5800bd(_0x1dd55c['editing']['view']['document']);this['_setDataIdsOnChildren'](_0xbc33bf,_0x5326cf,_0x20e426);let _0x367a9b=await this['_getDocumentDataStringFromView'](_0xbc33bf,_0x1dd55c);Gs(_0x1dd55c,_0x1c4bbc['rootName'])&&(_0x367a9b=Fs(_0x367a9b,this['_nextDataId'](_0x20e426)));const _0x3c2bea=this['_getMarkersInDocumentOrder'](_0x1dd55c,_0x1c4bbc),_0x4f45ba=[];for(const _0x6ec91 of _0x3c2bea){const _0x3166fb='<'+_0x6ec91['name']+':start></'+_0x6ec91['name']+':start>',_0x8fa7cc=_0x367a9b['indexOf'](_0x3166fb);_0x367a9b=_0x367a9b['substring'](0x0,_0x8fa7cc)+_0x367a9b['substring'](_0x8fa7cc+_0x3166fb['length']);const _0x223aff='<'+_0x6ec91['name']+':end></'+_0x6ec91['name']+':end>',_0x5efe65=_0x367a9b['indexOf'](_0x223aff);_0x367a9b=_0x367a9b['substring'](0x0,_0x5efe65)+_0x367a9b['substring'](_0x5efe65+_0x223aff['length']),_0x4f45ba['push']({'markerName':_0x6ec91['name'],'start':_0x8fa7cc,'end':_0x5efe65,'htmlFragment':_0x367a9b['substring'](_0x8fa7cc,_0x5efe65)});}return{'content':_0x367a9b,'version':_0x1dd55c['model']['document']['version'],'selections':_0x4f45ba};}afterInit(){this['context']instanceof _0x5849ed?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x28d1ac,_0x3c65e2)=>{_0x3c65e2['on']('ready',()=>{this['_integrateEditor'](_0x3c65e2);});});}_setOutputDataProcessor(_0x1684c7){this['_outputDataProcessor']=_0x1684c7;}async _getDocumentDataStringFromView(_0x3382e6,_0x366360){let _0x2cf014;if(this['_outputDataProcessor']){const _0xf56a84=_0x366360['data']['processor']['domConverter']['viewToDom'](_0x3382e6),_0x4a0bb3=await this['_outputDataProcessor'](_0xf56a84);_0x2cf014=_0x366360['data']['processor']['htmlWriter']['getHtml'](_0x4a0bb3);}else _0x2cf014=_0x366360['data']['processor']['toData'](_0x3382e6);return _0x2cf014;}_integrateEditor(_0x3808e4){if(!_0x3808e4['config']['get']('collaboration.channelId'))throw new ct('ai-missing-channel-id',_0x3808e4);_0x3808e4['ui']['focusTracker']['on']('change:isFocused',(_0xa4f714,_0x4a0481,_0x2a3eef)=>{_0x2a3eef&&(this['_lastContentFocusedEditor']=_0x3808e4);}),_0x3808e4['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x3808e4&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x3808e4['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Js,'view':({markerName:_0x19ea01})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x19ea01['split'](':')[0x1]],'priority':0xc})}),_0x3808e4['conversion']['for']('dataDowncast')['markerToElement']({'model':Js+':context','view':(_0xd6a0ed,{writer:_0x25bc27,options:_0x320ea3})=>_0x320ea3['convertAiChatSelectionMarker']?_0x25bc27['createUIElement'](_0xd6a0ed['markerName']+':'+(_0xd6a0ed['isOpening']?'start':'end')):null});}showFakeVisualSelection(_0x3cadcb){const _0x673d71=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x3cadcb);const _0x41690e=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x673d71,_0x41690e);}hideFakeVisualSelection(_0x1480f0){const _0x48fb8f=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x1480f0);const _0x5c0d6e=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x48fb8f,_0x5c0d6e);}async modelToDataWithIds(_0x2b0311,_0x441214,_0x26ad0e){const _0x4c3b61=_0x441214['data']['toView'](_0x2b0311),_0x2c25f3=new _0x5800bd(_0x441214['editing']['view']['document']),_0x441639=new Set();this['_setDataIdsOnChildren'](_0x4c3b61,_0x2c25f3,_0x441639);const _0x2ea299=await this['_getDocumentDataStringFromView'](_0x4c3b61,_0x441214);return _0x26ad0e&&Gs(_0x441214,_0x26ad0e)?Fs(_0x2ea299,this['_nextDataId'](_0x441639)):_0x2ea299;}_setDataIdsOnChildren(_0x20df4a,_0x6c35fe,_0x89b2d3=new Set()){let _0x164803=!0x1;for(const _0x548d97 of _0x20df4a['getChildren']()){if(!_0x548d97['is']('view:element')||Zs['includes'](_0x548d97['name']))continue;const _0x26b451=_0x548d97['is']('view:containerElement'),_0x4aa981=_0x548d97['is']('view:emptyElement'),_0x5d426a=_0x548d97['is']('view:rawElement'),_0x49e485=this['_setDataIdsOnChildren'](_0x548d97,_0x6c35fe,_0x89b2d3);_0x548d97['hasAttribute']('data-id')?(_0x164803=!0x0,_0x89b2d3['add'](_0x548d97['getAttribute']('data-id'))):(_0x26b451||_0x4aa981||_0x5d426a||_0x49e485)&&(_0x6c35fe['setAttribute']('data-id',this['_nextDataId'](_0x89b2d3),_0x548d97),_0x164803=!0x0);}return _0x164803;}_nextDataId(_0x39303a){let _0x27c4f3;do{_0x27c4f3='';for(let _0x1c1c0c=0x0;_0x1c1c0c<0x4;_0x1c1c0c++)_0x27c4f3+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x39303a['has'](_0x27c4f3));return _0x39303a['add'](_0x27c4f3),_0x27c4f3;}getSelectionText(_0x415383){const _0xc11f06=(_0x415383?_0x415383['model']:Ss(this['context'])['model'])['document']['selection'],_0x2df079=[],_0x3a80ac=Array['from'](_0xc11f06['getRanges']());_0x3a80ac['sort']((_0x319f16,_0x4eeda8)=>_0x319f16['start']['isBefore'](_0x4eeda8['start'])?-0x1:0x1);for(const _0x7cd647 of _0x3a80ac)for(const _0x189064 of _0x7cd647['getItems']())_0x189064['is']('$textProxy')?_0x2df079['push'](_0x189064['data']):_0x189064['is']('element')&&_0x2df079['length']>0x0&&'\x20'!==_0x2df079[_0x2df079['length']-0x1]&&_0x2df079['push']('\x20');return _0x2df079['length']?'\x22'+_0x2df079['join']('')['trim']()+'\x22':Es(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}_removeFakeSelectionById(_0x11448e){for(let _0x351c7c=0x0;_0x351c7c<this['_fakeSelections']['length'];_0x351c7c++)if(this['_fakeSelections'][_0x351c7c]['id']==_0x11448e)return void this['_fakeSelections']['splice'](_0x351c7c,0x1);}_addFakeSelection(_0x9964d6){this['_removeFakeSelectionById'](_0x9964d6['id']),Ct(this['_fakeSelections'],_0x9964d6);}_refreshFakeSelection(_0x402968,_0xe4ce21){if(_0x402968==_0xe4ce21)return;const _0x1ad232=_0x402968?_0x402968['editor']:null,_0x481f24=_0xe4ce21?_0xe4ce21['editor']:null,_0x34443b=(_0x30bcbb,_0x2f410)=>{const _0x2773f5=_0x2f410['model']['markers']['getMarkersGroup'](Js);for(const _0x9d8834 of _0x2773f5)_0x30bcbb['removeMarker'](_0x9d8834);},_0x5b47b1=(_0x1bddc3,_0x52f167,_0x218bad)=>{const _0x29ea00=_0x52f167['model'];for(let _0xa852e3=0x0;_0xa852e3<_0x218bad['ranges']['length'];_0xa852e3++){let _0x111f70=_0x218bad['ranges'][_0xa852e3];const _0x3f75f5=Js+':'+_0x218bad['id']+':'+_0xa852e3;if(_0x111f70['start']['isAtEnd']){const _0x3b317c=_0x111f70['start']['getLastMatchingPosition'](({item:_0x420650})=>!_0x29ea00['schema']['isContent'](_0x420650),{'boundaries':_0x111f70});_0x111f70=_0x1bddc3['createRange'](_0x3b317c,_0x111f70['end']);}_0x1bddc3['addMarker'](_0x3f75f5,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x111f70});}};_0x1ad232&&_0x481f24&&_0x1ad232===_0x481f24&&_0xe4ce21?_0x1ad232['model']['change'](_0x383deb=>{_0x34443b(_0x383deb,_0x1ad232),_0x5b47b1(_0x383deb,_0x481f24,_0xe4ce21);}):(_0x1ad232&&_0x1ad232['model']['change'](_0xf85fe0=>_0x34443b(_0xf85fe0,_0x1ad232)),_0x481f24&&_0xe4ce21&&_0x481f24['model']['change'](_0x2bf574=>_0x5b47b1(_0x2bf574,_0x481f24,_0xe4ce21)));}_getMarkersInDocumentOrder(_0x14fd49,_0x1d781b){const _0xcd0bdd=Array['from'](_0x14fd49['model']['markers']['getMarkersGroup'](Js+':context'));return(_0x1d781b?_0xcd0bdd['filter'](_0x42e179=>{const _0x20ce60=_0x42e179['getRange']();return _0x20ce60&&_0x20ce60['root']['rootName']===_0x1d781b['rootName'];}):_0xcd0bdd)['sort']((_0x27bf19,_0x3af55f)=>_0x27bf19['getStart']()['isBefore'](_0x3af55f['getStart']())?-0x1:_0x27bf19['getStart']()['isAfter'](_0x3af55f['getStart']())?0x1:0x0);}_getEditorConfig(_0x279848){let _0x38e86f=this['_editorsToConfigs']['get'](_0x279848);return _0x38e86f||(_0x38e86f=function(_0x78b10){const _0x40a1c0={};if(_0x78b10['plugins']['has']('AlignmentEditing')&&(_0x40a1c0['alignment']=_0x78b10['config']['get']('alignment')),_0x78b10['plugins']['has']('CodeBlockEditing')&&(_0x40a1c0['codeBlock']=_0x78b10['config']['get']('codeBlock')),_0x78b10['plugins']['has']('FontBackgroundColorEditing')&&(_0x40a1c0['fontBackgroundColor']=Xs(_0x78b10['config']['get']('fontBackgroundColor'),['documentColors','columns','colorPicker'])),_0x78b10['plugins']['has']('FontColorEditing')&&(_0x40a1c0['fontColor']=Xs(_0x78b10['config']['get']('fontColor'),['documentColors','columns','colorPicker'])),_0x78b10['plugins']['has']('FontFamilyEditing')&&(_0x40a1c0['fontFamily']=_0x78b10['config']['get']('fontFamily'),_0x40a1c0['fontFamily']&&_0x40a1c0['fontFamily']['options']&&(_0x40a1c0['fontFamily']['options']=zs(_0x40a1c0['fontFamily']['options'],['model','upcastAlso']))),_0x78b10['plugins']['has']('FontSizeEditing')&&(_0x40a1c0['fontSize']=_0x78b10['config']['get']('fontSize'),_0x40a1c0['fontSize']&&_0x40a1c0['fontSize']['options']&&(_0x40a1c0['fontSize']['options']=zs(_0x40a1c0['fontSize']['options'],['upcastAlso']))),_0x78b10['plugins']['has']('FootnotesEditing')){const _0x36bd9d=_0x78b10['config']['get']('footnotes')??{};_0x36bd9d['footnotesProperties']&&'object'==typeof _0x36bd9d['footnotesProperties']&&(_0x36bd9d['footnotesProperties']=Xs(_0x36bd9d['footnotesProperties'],['toolbar','listStyles'])),_0x40a1c0['footnotes']=_0x36bd9d;}if(_0x78b10['plugins']['has']('HeadingEditing')&&(_0x40a1c0['heading']=_0x78b10['config']['get']('heading'),_0x40a1c0['heading']&&_0x40a1c0['heading']['options']&&(_0x40a1c0['heading']['options']=zs(_0x40a1c0['heading']['options'],['model','icon','class','converterPriority','upcastAlso']))),_0x78b10['plugins']['has']('HighlightEditing')&&(_0x40a1c0['highlight']=_0x78b10['config']['get']('highlight'),_0x40a1c0['highlight']&&_0x40a1c0['highlight']['options']&&(_0x40a1c0['highlight']['options']=zs(_0x40a1c0['highlight']['options'],['model','color']))),_0x78b10['plugins']['has']('ImageBlockEditing')||_0x78b10['plugins']['has']('ImageInlineEditing')){const _0x250fe2=Xs(_0x78b10['config']['get']('image'),['toolbar','upload','insert','resizeOptions']);_0x78b10['plugins']['has']('ImageResizeEditing')||delete _0x250fe2['resizeUnit'],_0x78b10['plugins']['has']('ImageStyleEditing')?_0x250fe2['styles']?.['options']&&(_0x250fe2['styles']['options']=zs(_0x250fe2['styles']['options'],['icon'])):delete _0x250fe2['styles'],_0x40a1c0['image']=_0x250fe2;}if(_0x78b10['plugins']['has']('IndentBlock')&&(_0x40a1c0['indentBlock']=_0x78b10['config']['get']('indentBlock')),_0x78b10['plugins']['has']('LineHeightEditing')&&(_0x40a1c0['lineHeight']=_0x78b10['config']['get']('lineHeight'),_0x40a1c0['lineHeight']&&(delete _0x40a1c0['lineHeight']['supportAllValues'],_0x40a1c0['lineHeight']['options']&&(_0x40a1c0['lineHeight']['options']=zs(_0x40a1c0['lineHeight']['options'],['model'])))),_0x78b10['plugins']['has']('LinkEditing')&&(_0x40a1c0['link']=Xs(_0x78b10['config']['get']('link'),['toolbar'])),_0x78b10['plugins']['has']('ListEditing')){const _0x43a14d=_0x78b10['config']['get']('list')??{};delete _0x43a14d['enableListItemMarkerFormatting'],_0x78b10['plugins']['has']('ListPropertiesEditing')?_0x43a14d['properties']&&_0x43a14d['properties']['styles']&&'object'==typeof _0x43a14d['properties']['styles']&&(_0x43a14d['properties']['styles']=Xs(_0x43a14d['properties']['styles'],['listStyleTypes'])):delete _0x43a14d['properties'],_0x40a1c0['list']=_0x43a14d;}if(_0x78b10['plugins']['has']('MediaEmbedEditing')&&(_0x40a1c0['mediaEmbed']=_0x78b10['config']['get']('mediaEmbed'),_0x40a1c0['mediaEmbed']&&(delete _0x40a1c0['mediaEmbed']['toolbar'],_0x78b10['plugins']['has']('MediaEmbedResizeEditing')?_0x40a1c0['mediaEmbed']['resizeOptions']&&(_0x40a1c0['mediaEmbed']['resizeOptions']=_0x40a1c0['mediaEmbed']['resizeOptions']['map'](_0xf98d22=>Xs(_0xf98d22,['icon','label']))):delete _0x40a1c0['mediaEmbed']['resizeOptions'],_0x78b10['plugins']['has']('MediaEmbedStyleEditing')?_0x40a1c0['mediaEmbed']['styles']&&_0x40a1c0['mediaEmbed']['styles']['options']&&(_0x40a1c0['mediaEmbed']['styles']['options']=zs(_0x40a1c0['mediaEmbed']['styles']['options'],['icon','title'])):delete _0x40a1c0['mediaEmbed']['styles'])),_0x78b10['plugins']['has']('MultiLevelListEditing')&&(_0x40a1c0['listMultiLevel']=_0x78b10['config']['get']('listMultiLevel')??{}),_0x78b10['plugins']['has']('MentionEditing')){const _0x369063=Xs(_0x78b10['config']['get']('mention'),['commitKeys','dropdownLimit']);_0x369063['feeds']&&(_0x369063['feeds']=_0x369063['feeds']['map'](_0x553bf4=>Xs(_0x553bf4,['minimumCharacters','itemRenderer','dropdownLimit']))),_0x40a1c0['mention']=_0x369063;}if(_0x78b10['plugins']['has']('MergeFieldsEditing')){const _0x5f15db=Xs(_0x78b10['config']['get']('mergeFields'),['previewModes','initialPreviewMode','previewHtmlValues','sanitizeHtml']);Array['isArray'](_0x5f15db['definitions'])&&(_0x5f15db['definitions']=_0x5f15db['definitions']['map'](_0x35f1eb=>'groupId'in _0x35f1eb?(Array['isArray'](_0x35f1eb['definitions'])&&(_0x35f1eb['definitions']=_0x35f1eb['definitions']['map'](_0x55c63d=>Xs(_0x55c63d,['defaultValue']))),_0x35f1eb):Xs(_0x35f1eb,['defaultValue']))),_0x40a1c0['mergeFields']=_0x5f15db;}if(_0x78b10['plugins']['has']('StyleEditing')&&(_0x40a1c0['style']=_0x78b10['config']['get']('style')),_0x78b10['plugins']['has']('TableEditing')){const _0x59f246=Xs(_0x78b10['config']['get']('table'),['contentToolbar','tableToolbar','showHiddenBorders']);_0x78b10['plugins']['has']('TablePropertiesEditing')?_0x59f246['tableProperties']&&'object'==typeof _0x59f246['tableProperties']&&(_0x59f246['tableProperties']=Xs(_0x59f246['tableProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x59f246['tableProperties'],_0x78b10['plugins']['has']('TableCellPropertiesEditing')?_0x59f246['tableCellProperties']&&'object'==typeof _0x59f246['tableCellProperties']&&(_0x59f246['tableCellProperties']=Xs(_0x59f246['tableCellProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x59f246['tableCellProperties'],_0x78b10['plugins']['has']('TableLayoutEditing')?_0x59f246['tableLayout']||(_0x59f246['tableLayout']={}):delete _0x59f246['tableLayout'],_0x78b10['plugins']['has']('TableCaptionEditing')?_0x59f246['tableCaption']||(_0x59f246['tableCaption']={}):delete _0x59f246['tableCaption'],_0x40a1c0['table']=_0x59f246;}_0x78b10['plugins']['has']('TextPartLanguageEditing')&&(_0x40a1c0['textPartLanguage']=_0x78b10['config']['get']('language.textPartLanguage'));for(const [_0x5e71b4,_0x359113]of js)_0x78b10['plugins']['has'](_0x5e71b4)&&(_0x40a1c0[_0x359113]={});return _0x40a1c0;}(_0x279848),this['_editorsToConfigs']['set'](_0x279848,_0x38e86f)),_0x38e86f;}};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(_0x1a1da9){super(),this['_generateUid']=_0x1a1da9||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x58385a,_0x5e82d7,_0x4e88a6){this['_uidCounter']=0x0;const _0x3b7de5=_0x58385a['cloneNode'](!0x0);on(_0x5e82d7,_0x3b7de5);const _0x38cfdb=_0x3b7de5['childNodes'],_0x11362a=Array['from'](_0x38cfdb)['filter'](_0x594133=>!(0x3===_0x594133['nodeType']&&''===Os(_0x594133)['trim']())),_0xa319a0=_0x11362a['length'];this['_existingDataIds']=new Set(ks('data-id',null,_0x5e82d7)['map'](_0x1486f7=>Ps(_0x1486f7,'data-id'))['filter'](_0x5317bc=>!!_0x5317bc));for(const _0x1437da of _0x11362a)_0x1437da&&_0x40b07f(_0x1437da)&&void 0x0===_0x1437da['attribs']['data-id']&&Ds(_0x1437da,'data-id','new-element');if(ks('data-id',null,_0x3b7de5)['forEach'](_0x1586f2=>{const _0x272f77=Ps(_0x1586f2,'data-id');'new-element'===_0x272f77||this['_existingDataIds']['has'](_0x272f77)||Ds(_0x1586f2,'data-id','new-element');}),0x0===_0x5e82d7['childNodes']['length']){const _0x1b7abb=[];return ks('data-id','new-element',_0x3b7de5)['forEach'](_0xf820f6=>{const _0x3c9af8=this['_generateUid']();Ds(_0xf820f6,'data-id',_0x3c9af8),_0x1b7abb['push'](_0x3c9af8);}),this['_removeSpecialComments'](_0x3b7de5),{'parsedContent':_0x3b7de5,'newNodeIds':_0x1b7abb,'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 _0xbdcf5d=-0x1,_0x31cf2e=!0x1;for(let _0x56cc80=0x0;_0x56cc80<_0xa319a0;_0x56cc80++){const _0x5312af=_0x11362a[_0x56cc80],_0x3cc19c=_0x11362a[_0x56cc80+0x1];if(this['_isNewNode'](_0x5312af)){if(-0x1===_0xbdcf5d&&(_0xbdcf5d=_0x56cc80),this['_markWrappedElements'](_0x5312af),!this['_isNewNode'](_0x3cc19c)){const [_0x4a8bed,_0x4c8cc8]=this['_findReferenceNode'](_0x5312af,_0x31cf2e,_0x5e82d7);if(_0x4a8bed){const _0x3030e9=Array['from'](_0x11362a)['slice'](_0xbdcf5d,_0x56cc80+0x1);this['_insertNodes'](_0x4a8bed,_0x3030e9,_0x4c8cc8),_0xbdcf5d=-0x1;}}}else{if(this['_isExistingContentComment'](_0x5312af))_0x31cf2e=!0x0;else{if(this['_isExistingNode'](_0x5312af)){const _0x350b7f=Ps(_0x5312af,'data-id');if(_0x350b7f&&this['_existingDataIds']['has'](_0x350b7f)){this['_referencedExistingIds']['add'](_0x350b7f);const _0x5e550a=vs('data-id',_0x350b7f,_0x5e82d7);this['_replaceNode'](_0x5e550a,_0x5312af);}}else{if(nn(_0x5312af)){const _0x3c8950=rn(_0x5312af);vs('data-id',_0x3c8950,_0x3b7de5)||this['_touchedNodesState']['removedIds']['push'](_0x3c8950);}}}}}for(const _0x18ac16 of this['_touchedNodesState']['removedIds']){const _0x21effa=vs('data-id',_0x18ac16,_0x5e82d7);_0x21effa&&(this['_rescueUnwrappedElements'](_0x21effa),this['_removeNode'](_0x21effa,_0x18ac16,_0x4e88a6));}if(ks('data-id','new-element',_0x5e82d7)['forEach'](_0x52eb58=>{const _0x43fb77=this['_getUid'](_0x52eb58);Ds(_0x52eb58,'data-id',_0x43fb77),this['_touchedNodesState']['newIds']['push'](_0x43fb77);}),this['_removeSpecialComments'](_0x5e82d7),_0x4e88a6&&_0x4e88a6['cutAfterUnstable']){const _0xd5ec19=this['_findLastConfirmationPoint'](_0x11362a),_0x453f84=this['_getLastStableElement'](_0x5e82d7,_0xd5ec19);this['_markUnstableElements'](_0x5e82d7,_0x453f84);}if(this['_processWrappedElements'](_0x5e82d7,_0x4e88a6),_0x4e88a6&&_0x4e88a6['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x3838b5=ks('data-id',this['_touchedNodesState']['lastTouchedId'],_0x5e82d7);let _0x55e72d=_0x3838b5[_0x3838b5['length']-0x1];for(;_0x55e72d;)Bs(_0x55e72d),_0x55e72d=_0x55e72d['parentNode'];}return{'parsedContent':_0x5e82d7,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}_insertNodes(_0x858ab,_0xe399d6,_0x539438){for(const _0x55f61a of _0xe399d6){const _0x4fe0c0=this['_getUid'](_0x55f61a);Ds(_0x55f61a,'data-id',_0x4fe0c0),this['_touchedNodesState']['newIds']['push'](_0x4fe0c0),this['_touchedNodesState']['lastTouchedId']=_0x4fe0c0;}const _0x333168='afterbegin'===_0x539438||'afterend'===_0x539438?_0xe399d6['reverse']():_0xe399d6;for(const _0x104e9a of _0x333168)Hs(_0x858ab,_0x104e9a,_0x539438);}['_replaceNode'](_0x5b1466,_0x549c1a){if(!_0x5b1466)return;if(_0x3a0de1=_0x549c1a,Us(Os(_0x5b1466))===Us(Os(_0x3a0de1)))return;var _0x3a0de1;const _0x278fb5=Ps(_0x5b1466,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x278fb5),this['_touchedNodesState']['lastTouchedId']=_0x278fb5,_0x2abda5(_0x5b1466,_0x549c1a['cloneNode'](!0x0));}['_removeNode'](_0x3780e6,_0x213b13,_0x4a6a99){if(_0x4a6a99&&_0x4a6a99['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x213b13;const _0x57a0c0=_0x4a6a99['replaceRemovedWith']['cloneNode'](!0x0);Ds(_0x57a0c0,'data-id',_0x213b13),Ds(_0x57a0c0,'data-removed','true'),_0x2abda5(_0x3780e6,_0x57a0c0);}else _0x5c7bf0(_0x3780e6);}['_findReferenceNode'](_0x2bd941,_0x2f4ac7,_0x19fb07){const _0x4678fb=this['_findPrevElementWithDataId'](_0x2bd941,!0x1);if(_0x4678fb){const _0x1e2c44=rn(_0x4678fb),_0x55d1da=vs('data-id',_0x1e2c44,_0x19fb07);if(_0x55d1da)return[_0x55d1da,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x1e2c44);}const _0x269bec=this['_findNextElementWithDataId'](_0x2bd941,!0x1);if(_0x269bec){const _0x4df7df=rn(_0x269bec),_0x44d74f=vs('data-id',_0x4df7df,_0x19fb07);if(_0x44d74f)return[_0x44d74f,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x4df7df);}return _0x2f4ac7?_0x2bd941['nextSibling']?this['_findFallbackReferenceNode'](_0x2bd941,_0x19fb07):[_0x19fb07['childNodes'][_0x19fb07['childNodes']['length']-0x1],'afterend']:[_0x19fb07['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x4c5991,_0x5709d0){const _0x122002=[],_0x2e1394=this['_findPrevElementWithDataId'](_0x4c5991,!0x0);if(_0x2e1394){const _0x4c1a7=vs('data-id',rn(_0x2e1394),_0x5709d0);_0x4c1a7&&_0x122002['push']([_0x4c1a7,'afterend']);}const _0x230388=this['_findNextElementWithDataId'](_0x4c5991,!0x0);if(_0x230388){const _0x34bc91=vs('data-id',rn(_0x230388),_0x5709d0);_0x34bc91&&_0x122002['push']([_0x34bc91,'beforebegin']);}return _0x122002['length']>0x1?Vs(_0x122002[0x0][0x0])<=Vs(_0x122002[0x1][0x0])?_0x122002[0x0]:_0x122002[0x1]:0x1===_0x122002['length']?_0x122002[0x0]:[_0x5709d0['lastChild'],'afterend'];}_findNextElementWithDataId(_0x96ddec,_0x3e909f){let _0xf3f5b=_0x96ddec['nextSibling'],_0x4f9085=null,_0x2f0cef=!0x1;for(;_0xf3f5b;){if(_0x2cea0f(_0xf3f5b)){if(nn(_0xf3f5b)&&(_0x4f9085=_0xf3f5b),this['_isExistingContentComment'](_0xf3f5b)&&_0x3e909f&&!_0x2f0cef){_0x2f0cef=!0x0,_0xf3f5b=_0xf3f5b['nextSibling'];continue;}break;}const _0x1e4513=Ps(_0xf3f5b,'data-id');if(_0x1e4513&&'new-element'!==_0x1e4513&&this['_existingDataIds']['has'](_0x1e4513)){_0x4f9085=_0xf3f5b;break;}_0xf3f5b=_0xf3f5b['nextSibling'];}return _0x4f9085;}_findPrevElementWithDataId(_0x4f52ef,_0x12721a){let _0x29006d=_0x4f52ef['previousSibling'],_0x266e44=null,_0x518d6c=!0x1;for(;_0x29006d;){if(_0x2cea0f(_0x29006d)){if(nn(_0x29006d)&&(_0x266e44=_0x29006d),this['_isExistingContentComment'](_0x29006d)&&_0x12721a&&!_0x518d6c){_0x518d6c=!0x0,_0x29006d=_0x29006d['previousSibling'];continue;}break;}const _0x59884=Ps(_0x29006d,'data-id');if(_0x59884&&'new-element'!==_0x59884&&this['_existingDataIds']['has'](_0x59884)){_0x266e44=_0x29006d;break;}_0x29006d=_0x29006d['previousSibling'];}return _0x266e44;}_markWrappedElements(_0xe824e){_0x40b07f(_0xe824e)&&ks('data-id',null,_0xe824e)['forEach'](_0xf35747=>{this['_isExistingNode'](_0xf35747)&&(Ds(_0xf35747,'data-wrapped-id',Ps(_0xf35747,'data-id')),Ds(_0xf35747,'data-id',null));});}_processWrappedElements(_0x573878,_0x3e1f95){ks('data-wrapped-id',null,_0x573878)['forEach'](_0x21057e=>{const _0x20dcba=Ps(_0x21057e,'data-wrapped-id');if(this['_hasUnstableParent'](_0x21057e))return;const _0xa91d49=vs('data-id',_0x20dcba,_0x573878);Ds(_0x21057e,'data-id',_0x20dcba),_0xa91d49&&(this['_removeNode'](_0xa91d49,_0x20dcba,_0x3e1f95),this['_touchedNodesState']['removedIds']['push'](_0x20dcba),this['_touchedNodesState']['lastTouchedId']=_0x20dcba);});}_hasUnstableParent(_0x2adb50){let _0x19cf47=_0x2adb50['parentNode'];for(;_0x19cf47;){if(Ps(_0x19cf47,'data-unstable'))return!0x0;_0x19cf47=_0x19cf47['parentNode'];}return!0x1;}_rescueUnwrappedElements(_0xc284d6){const _0x39f1d5=new Set(this['_touchedNodesState']['removedIds']),_0x57f7c6=new Set(this['_touchedNodesState']['newIds']);ks('data-id',null,_0xc284d6)['forEach'](_0x16aff0=>{const _0x52bf54=Ps(_0x16aff0,'data-id'),_0x172beb=!!_0x52bf54&&this['_referencedExistingIds']['has'](_0x52bf54),_0x3b3e4e=!!_0x52bf54&&_0x57f7c6['has'](_0x52bf54);if(!_0x52bf54||!_0x172beb&&!_0x3b3e4e)return;if(_0x39f1d5['has'](_0x52bf54))return;let _0x5641b4=_0x16aff0['parentNode'],_0x31bb1f=!0x1;for(;_0x5641b4;){if(_0x5641b4===_0xc284d6){_0x31bb1f=!0x0;break;}const _0x3b798f=Ps(_0x5641b4,'data-id');if(_0x3b798f&&(this['_referencedExistingIds']['has'](_0x3b798f)||_0x57f7c6['has'](_0x3b798f)))return;_0x5641b4=_0x5641b4['parentNode'];}if(_0x31bb1f){if(ti(_0xc284d6,_0x16aff0),_0x172beb){const _0x289f65=this['_generateUid'](),_0xce63dc=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x52bf54);-0x1!==_0xce63dc&&this['_touchedNodesState']['modifiedIds']['splice'](_0xce63dc,0x1),Ds(_0x16aff0,'data-unwrapped-id',_0x52bf54),Ds(_0x16aff0,'data-id',_0x289f65),this['_touchedNodesState']['newIds']['push'](_0x289f65),this['_touchedNodesState']['rescuedNewIds']['add'](_0x289f65),this['_touchedNodesState']['lastTouchedId']=_0x289f65;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x52bf54),this['_touchedNodesState']['lastTouchedId']=_0x52bf54;}});}_getUid(_0x42b0c7){return this['_isExistingNode'](_0x42b0c7)?Ps(_0x42b0c7,'data-id'):this['_generateUid']();}_removeSpecialComments(_0x2e2005){Ls(_0x2e2005)['filter'](_0x158979=>nn(_0x158979)||this['_isExistingContentComment'](_0x158979))['forEach'](_0x327c6b=>{_0x5c7bf0(_0x327c6b);});}_findLastConfirmationPoint(_0x565e68){let _0x32a43f=null,_0x5d9379=null,_0x159300=null,_0xde00ed=null;const _0x3ee317=_0x5f4311=>{_0x5f4311&&(_0x32a43f=_0x5f4311),_0x159300=null,_0xde00ed=null;};for(let _0x4a7994=0x0;_0x4a7994<_0x565e68['length'];_0x4a7994++){const _0x36be3b=_0x565e68[_0x4a7994];if(this['_isExistingContentComment'](_0x36be3b)){_0x3ee317(_0x5d9379);continue;}if(_0x40b07f(_0x36be3b)){const _0x31101c=Ps(_0x36be3b,'data-id'),_0x18d774=_0x4a7994===_0x565e68['length']-0x1;if(_0x31101c&&'new-element'!==_0x31101c&&this['_touchedNodesState']['modifiedIds']['includes'](_0x31101c)&&!_0x18d774){_0x3ee317(_0x31101c),_0x5d9379=_0x31101c;continue;}}let _0x1f041d;const _0x53523b=rn(_0x36be3b);if(_0x53523b&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x53523b))_0x5d9379=_0x53523b;else{if(_0x53523b&&this['_touchedNodesState']['newIds']['includes'](_0x53523b))_0x1f041d='N';else{if(!nn(_0x36be3b))continue;_0x1f041d='R';}_0x1f041d===_0xde00ed||null===_0xde00ed?_0xde00ed=_0x1f041d:null!==_0x159300?(_0x3ee317(_0x5d9379),_0xde00ed=_0x1f041d):(_0x159300=_0xde00ed,_0xde00ed=_0x1f041d),_0x5d9379=_0x53523b;}}const _0x5ef571=_0x565e68[_0x565e68['length']-0x1];return _0x5ef571&&!_0x40b07f(_0x5ef571)&&!nn(_0x5ef571)&&_0x5d9379&&_0x3ee317(_0x5d9379),_0x32a43f;}_getLastStableElement(_0x1ab697,_0xde4d15){if(!_0xde4d15)return null;const _0x392321=vs('data-id',_0xde4d15,_0x1ab697);if(!_0x392321)return null;const _0xbc1ff1=[_0x392321,...Ms(_0x392321)]['at'](-0x2);if(_0xbc1ff1===_0x392321)return _0x392321;let _0x33f92b=_0xbc1ff1['previousSibling'];for(;_0x33f92b&&!_0x40b07f(_0x33f92b);)_0x33f92b=_0x33f92b['previousSibling'];return _0x33f92b;}_markUnstableElements(_0x194273,_0x5651aa){const _0x33c824=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x349928=_0x5651aa?_0x5651aa['nextSibling']:_0x194273['firstChild'];for(;_0x349928;)_0x40b07f(_0x349928)&&(_0x33c824['has'](Ps(_0x349928,'data-id'))||ks('data-id',null,_0x349928)['some'](_0x1c179b=>_0x33c824['has'](Ps(_0x1c179b,'data-id'))))&&Ds(_0x349928,'data-unstable','true'),_0x349928=_0x349928['nextSibling'];}['_isNewNode'](_0x5392c9){return Boolean('new-element'===Ps(_0x5392c9,'data-id'));}_isExistingNode(_0x3e4c24){return Boolean((Ps(_0x3e4c24,'data-id')||'')['length']>0x0&&'new-element'!==Ps(_0x3e4c24,'data-id'));}_isExistingContentComment(_0x35e4f1){return Boolean(_0x2cea0f(_0x35e4f1)&&Os(_0x35e4f1)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function nn(_0x5b15f5){return!!_0x5b15f5&&Boolean(_0x2cea0f(_0x5b15f5)&&Os(_0x5b15f5)['match'](/removed[\s*-]data-id="[^"]+"/));}function rn(_0x5758ed){if(!_0x5758ed)return null;if(_0x40b07f(_0x5758ed))return Ps(_0x5758ed,'data-id')??null;if(_0x2cea0f(_0x5758ed)){const _0x36300d=Os(_0x5758ed)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x36300d&&_0x36300d[0x1])return _0x36300d[0x1];}return null;}function on(_0x20c033,_0xd88596){const _0x4036f3=new Map();for(const _0x37da2e of ys(_0x20c033))xs(_0x37da2e)||_0x4036f3['set'](Ps(_0x37da2e,'data-id'),_0x37da2e);const _0x48c3e2=new Set();for(const _0x3cc701 of ys(_0xd88596)){if(xs(_0x3cc701))continue;const _0x43870=Ps(_0x3cc701,'data-id'),_0x3f0f18=_0x43870?_0x4036f3['get'](_0x43870):void 0x0;_0x3f0f18?(_0x2abda5(_0x3cc701,_0x538a60(_0x3f0f18,!0x0)),_0x48c3e2['add'](_0x43870)):_0x5c7bf0(_0x3cc701);}for(const _0x58f05c of Ls(_0xd88596))nn(_0x58f05c)&&_0x4036f3['has'](rn(_0x58f05c))&&_0x5c7bf0(_0x58f05c);const _0x5e2ea2=new Set(ks('data-id',null,_0xd88596)['map'](_0x30ae2e=>Ps(_0x30ae2e,'data-id')));for(const [_0x4f1c14,_0x3fe6db]of _0x4036f3){if(_0x48c3e2['has'](_0x4f1c14))continue;let _0x33c205=_0x3fe6db['parent'],_0x5f1d6d=null;for(;_0x33c205&&_0x40b07f(_0x33c205);){const _0x34b0b7=Ps(_0x33c205,'data-id');if(_0x34b0b7&&_0x5e2ea2['has'](_0x34b0b7)){_0x5f1d6d=_0x34b0b7;break;}_0x33c205=_0x33c205['parent'];}if(!_0x5f1d6d)continue;const _0x78eff7=vs('data-id',_0x5f1d6d,_0xd88596);_0x78eff7&&_0x3c15cc(_0x78eff7,_0x538a60(_0x3fe6db,!0x0));}}const an=/* #__PURE__ -- @preserve */
|
|
27
|
-
At();var hn=class extends an{_m2html;constructor(){super();const _0x411a3d=Object['entries'](_0xfbe022),_0x5deeaf=_0x411a3d['findIndex'](([_0x156569])=>'rehypeDomRaw'===_0x156569);if(-0x1===_0x5deeaf)throw new ct('ai-response-parser-unable-to-set-up-parser');_0x411a3d['splice'](_0x5deeaf+0x1,0x0,['rehypeSanitize',_0x2fb9c2]),this['_m2html']=new _0x33f03a({'plugins':Object['fromEntries'](_0x411a3d)});}convertMarkdownToHTML(_0x54d8a1){const _0x1a97c0=this['_m2html']['parse'](_0x54d8a1);return this['parseAndNormalizeHTML'](_0x1a97c0);}['parseAndNormalizeHTML'](_0x5bf1f4){return this['_parseHTML'](_0x5bf1f4);}['_parseHTML'](_0xcd5efe){const _0x58e50b=Rs('<dummy>'+_0xcd5efe['replace'](/<[^>]*?$/g,'')+'</dummy>');return cn(_0x58e50b),_0x58e50b['children']=_0x58e50b['children'][0x0]['children'],_0x58e50b;}};function cn(_0x7507c9){for(const _0x40dcb3 of _0x7507c9['children'])_0x40b07f(_0x40dcb3)?'pre'!==_0x40dcb3['name']&&cn(_0x40dcb3):_0x4d4881(_0x40dcb3)&&(_0x40dcb3['data']=_0x40dcb3['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function ln({changeGroups:_0x5013c3,documentContextContent:_0x34efa9,showDiff:_0x419e78,trimUnchanged:_0x48284d=!0x0}){const _0x52c50e=qs(_0x5013c3,_0x34efa9);return _0x5013c3['map'](_0x42924c=>{if(!_0x42924c['editor']||'destroyed'===_0x42924c['editor']['state'])return null;const _0x44af42=Gs(_0x42924c['editor'],_0x42924c['rootName']),_0x55ecbe=new _0x35b618([]),_0x233347=new _0x35b618([]),_0x215414=new Set();for(const _0x2f6a00 of _0x42924c['changes'])'new'==_0x2f6a00['type']&&ks('data-id',null,_0x2f6a00['node'])['forEach'](_0x55d5c9=>{_0x215414['add'](Ps(_0x55d5c9,'data-id'));});for(const _0x23c0bc of _0x42924c['changes'])if('removed'!=_0x23c0bc['type']?_0x233347['children']['push'](_0x23c0bc['node']['cloneNode'](!0x0)):_0x419e78||_0x215414['has'](_0x23c0bc['id'])||_0x233347['children']['push'](_0x23c0bc['node']['cloneNode'](!0x0)),'new'!=_0x23c0bc['type']&&(_0x419e78||'removed'!=_0x23c0bc['type'])){const _0xc06526=_0x3aba21(_0x5b8a21=>Ps(_0x5b8a21,'data-id')==_0x23c0bc['id'],_0x34efa9['get'](_0x42924c['documentId']),!0x0);_0xc06526&&_0x55ecbe['children']['push'](_0xc06526['cloneNode'](!0x0));}if(_0x44af42&&_0x52c50e['has'](_0x42924c['index']))return{'type':_0x42924c['changes'][0x0]['type'],'index':_0x42924c['index'],'state':_0x42924c['state'],'outdatedReason':_0x42924c['outdatedReason'],'content':new _0x35b618([]),'hasChanges':!0x1};let _0xf7c64c,_0x363aec,_0x5096dd;try{({content:_0xf7c64c,hasChanges:_0x363aec}=un(_0x42924c['editor'],_0x55ecbe,_0x233347,_0x419e78,_0x48284d));}catch{return{'type':_0x42924c['changes'][0x0]['type'],'index':_0x42924c['index'],'state':_0x42924c['state'],'outdatedReason':_0x42924c['outdatedReason'],'content':new _0x35b618([]),'hasChanges':!0x1};}if(_0x44af42){_0x5096dd=_0x42924c['editor']['ui']['getEditableElement'](_0x42924c['rootName'])?.['tagName']['toLowerCase']();const _0x1de033=_0xf7c64c['children']['filter'](_0x40b07f);0x1===_0x1de033['length']&&(_0xf7c64c=new _0x35b618(_0x1de033[0x0]['children']));}return{'type':_0x42924c['changes'][0x0]['type'],'index':_0x42924c['index'],'state':_0x42924c['state'],'outdatedReason':_0x42924c['outdatedReason'],'content':_0xf7c64c,'hasChanges':_0x363aec,'wrapperTag':_0x5096dd};})['filter'](_0x5868f3=>null!==_0x5868f3);}function un(_0x5442ea,_0xeed652,_0x441e98,_0x434f6b,_0x4257bc=!0x0){const _0x4ab10d=_0x5442ea['plugins']['get']('DocumentCompare'),_0x4490f6=Os(_0xeed652),_0x2e19ec=Os(_0x441e98),_0x174749=_0x5442ea['data']['parse'](_0x4490f6,'$root'),_0x5cb61c=_0x5442ea['model']['createPositionAt'](_0x174749,0x0),_0x5e0cc0=_0x4ab10d['getDiff'](_0x4490f6,_0x2e19ec,{'anchor':_0x5cb61c,'markDeletions':_0x434f6b,'targetEditor':_0x5442ea})['getOperations']();if(0x0==_0x5e0cc0['length'])return{'content':_0xeed652['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x434f6b?function(_0x6a82b5,_0x376040,_0x5dde3f){if(0x0==_0x6a82b5['length'])return;const _0x5222be=_0x5dde3f['plugins']['get']('DocumentCompare'),_0x33c6c0=_0x5dde3f['plugins']['get']('SuggestionsConversion');_0x5dde3f['model']['change'](_0x5e8c11=>{const _0x57d8ce=new Set();for(let _0x4d395e=0x0;_0x4d395e<_0x6a82b5['length'];_0x4d395e++){const _0x32e21c=_0x6a82b5[_0x4d395e];if(_0x32e21c['baseVersion']=null,_0x32e21c['isDocumentOperation']=!0x1,!_0x2355a7(_0x32e21c)){if(_0x5222be['isMarkedRemoveOperation'](_0x32e21c)){const _0x260c1b=_0x5afb7a(_0x32e21c['newRange'],_0x5dde3f['model']),_0x77ef69='suggestion:deletion:'+kt()+':$aiSuggestion';_0x376040['markers']['set'](_0x77ef69,_0x260c1b);}else switch(_0x32e21c['type']){case'rename':{if(_0x32e21c['oldName']==_0x32e21c['newName'])break;_0x5e8c11['batch']['addOperation'](_0x32e21c),_0x5dde3f['model']['applyOperation'](_0x32e21c);const _0x206f80='$elementName',_0x132141=_0x32e21c['position'],_0x22725f=_0x5dde3f['model']['createRange'](_0x132141,_0x5dde3f['model']['createPositionAt'](_0x132141['nodeAfter'],'end')),_0x59e648='suggestion:attribute:'+_0x206f80+':'+kt()+':$aiSuggestion';_0x376040['markers']['set'](_0x59e648,_0x22725f);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x32e21c['oldValue']==_0x32e21c['newValue'])break;_0x5e8c11['batch']['addOperation'](_0x32e21c),_0x5dde3f['model']['applyOperation'](_0x32e21c);const _0x16c587=_0x32e21c['key'];if(!_0x33c6c0['isRegisteredAttribute'](_0x16c587))break;const _0x4f9f80=_0x5afb7a(_0x32e21c['range'],_0x5dde3f['model']),_0x5a9d4b='suggestion:attribute:'+_0x16c587+':'+kt()+':$aiSuggestion';_0x376040['markers']['set'](_0x5a9d4b,_0x4f9f80);break;}case'insert':{if(_0x5e8c11['batch']['addOperation'](_0x32e21c),_0x5dde3f['model']['applyOperation'](_0x32e21c),dn(_0x376040,_0x32e21c),_0x6a82b5[_0x4d395e+0x1]&&'move'==_0x6a82b5[_0x4d395e+0x1]['type'])break;const _0x46107f=_0x32e21c['position'],_0x534de6=_0x32e21c['howMany'],_0x4706df=_0x5afb7a(_0x5dde3f['model']['createRange'](_0x46107f,_0x46107f['getShiftedBy'](_0x534de6)),_0x5dde3f['model']),_0x2e6300='suggestion:insertion:'+kt()+':$aiSuggestion';_0x376040['markers']['set'](_0x2e6300,_0x4706df);break;}case'split':{_0x5e8c11['batch']['addOperation'](_0x32e21c),_0x5dde3f['model']['applyOperation'](_0x32e21c),dn(_0x376040,_0x32e21c);const _0x397e70=_0x32e21c['splitPosition'],_0x5b0556=_0x32e21c['moveTargetPosition'],_0x549c37=_0x5dde3f['model']['createRange'](_0x397e70,_0x5b0556),_0x28c7a8='suggestion:insertion:'+kt()+':$aiSuggestion';_0x376040['markers']['set'](_0x28c7a8,_0x549c37);break;}case'move':{_0x5e8c11['batch']['addOperation'](_0x32e21c),_0x5dde3f['model']['applyOperation'](_0x32e21c),dn(_0x376040,_0x32e21c);const _0x530f22=_0x32e21c['getMovedRangeStart'](),_0x142928=_0x32e21c['howMany'];for(let _0x5bf069=0x0;_0x5bf069<_0x142928;_0x5bf069++){const _0x39bf7a=_0x530f22['getShiftedBy'](_0x5bf069)['nodeAfter'];_0x57d8ce['add'](_0x39bf7a);}break;}case'remove':{const _0xcc7855=_0x32e21c['sourcePosition'],_0x38066d=_0x32e21c['howMany'],_0x27fb17=new _0x47f76a(_0xcc7855,_0x38066d);_0x5e8c11['batch']['addOperation'](_0x27fb17),_0x5dde3f['model']['applyOperation'](_0x27fb17),dn(_0x376040,_0x32e21c);break;}}}}for(const _0x2aaded of _0x57d8ce){const _0x56d701=_0x5dde3f['model']['createRangeOn'](_0x2aaded),_0x134c0a='suggestion:formatBlock:$fakeWrap:'+kt()+':$aiSuggestion';_0x376040['markers']['set'](_0x134c0a,_0x5afb7a(_0x56d701,_0x5dde3f['model']));}});}(_0x5e0cc0,_0x174749,_0x5442ea):_0x5442ea['model']['change'](_0x37f0ab=>{for(const _0x1efa30 of _0x5e0cc0)if(!_0x2355a7(_0x1efa30)){if('remove'==_0x1efa30['type']){const _0x37718a=_0x1efa30['sourcePosition'],_0x2eea6c=_0x1efa30['howMany'],_0x4e302f=new _0x47f76a(_0x37718a,_0x2eea6c);_0x37f0ab['batch']['addOperation'](_0x4e302f),_0x5442ea['model']['applyOperation'](_0x4e302f),dn(_0x174749,_0x1efa30);}else{if('marker'==_0x1efa30['type']){const _0x559e34=_0x1efa30['name'],_0xbd7dcd=_0x1efa30['newRange'];null!==_0xbd7dcd?_0x174749['markers']['set'](_0x559e34,_0xbd7dcd):_0x174749['markers']['delete'](_0x559e34);}else _0x1efa30['baseVersion']=null,_0x1efa30['isDocumentOperation']=!0x1,_0x37f0ab['batch']['addOperation'](_0x1efa30),_0x5442ea['model']['applyOperation'](_0x1efa30),dn(_0x174749,_0x1efa30);}}}),_0x4257bc){const _0x5580eb=_n(_0x5442ea,_0x5e0cc0,_0x174749);An(_0x5442ea['model'],_0x5580eb),function(_0x57987e,_0x1bcfc8){const _0x4554ac=_0x1bcfc8['getFirstRange']()['start'];let _0x2e8b4d=_0x1bcfc8['getFirstRange']()['end'];const _0x5d6d9e=_0x4554ac['root'];(_0x2e8b4d['textNode']||_0x2e8b4d['nodeAfter']&&_0x2e8b4d['nodeAfter']['is']('$text'))&&(_0x470c9e(_0x2e8b4d,'...'),En(_0x5d6d9e,_0x2e8b4d,0x3),_0x2e8b4d=_0x2e8b4d['getShiftedBy'](0x3)),(_0x4554ac['textNode']||_0x4554ac['nodeBefore']&&_0x4554ac['nodeBefore']['is']('$text'))&&(_0x470c9e(_0x4554ac,'...'),En(_0x5d6d9e,_0x4554ac,0x3),_0x4554ac['parent']==_0x2e8b4d['parent']&&(_0x2e8b4d=_0x2e8b4d['getShiftedBy'](0x3)));const _0x57e632=_0x57987e['createRange'](_0x57987e['createPositionAt'](_0x5d6d9e,0x0),_0x4554ac),_0x56689c=_0x57987e['createRange'](_0x2e8b4d,_0x57987e['createPositionAt'](_0x5d6d9e,'end')),_0x2b224c=[..._0x57e632['getMinimalFlatRanges'](),..._0x56689c['getMinimalFlatRanges']()];_0x2b224c['reverse']();for(const _0x59398a of _0x2b224c)_0x10f5dd(_0x59398a),pn(_0x5d6d9e,_0x59398a);}(_0x5442ea['model'],_0x5580eb);}return{'content':Rs(_0x5442ea['data']['stringify'](_0x174749,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function dn(_0x80cc25,_0x1591eb){for(const [_0x5e6fea,_0x5f0fcc]of _0x80cc25['markers']){const _0x591686=_0x5b86ed['_createFromRanges'](_0x5f0fcc['getTransformedByOperation'](_0x1591eb));_0x591686['root']==_0x80cc25?_0x80cc25['markers']['set'](_0x5e6fea,_0x591686):_0x80cc25['markers']['delete'](_0x5e6fea);}}function _n(_0x448a94,_0x585d8a,_0x4a91fb){const _0x12818f=_0x448a94['plugins']['get']('DocumentCompare');let _0xafa921=_0x448a94['model']['createPositionAt'](_0x4a91fb,Number['POSITIVE_INFINITY']),_0x36e0fb=_0x448a94['model']['createPositionAt'](_0x4a91fb,0x0);for(const _0x30b166 of _0x585d8a){let _0x332fdc,_0x3047b0;if(_0x12818f['isMarkedRemoveOperation'](_0x30b166))_0x332fdc=_0x30b166['newRange']['start'],_0x3047b0=_0x30b166['newRange']['end'];else switch(_0xafa921=gn(_0xafa921,_0x30b166),_0x36e0fb=gn(_0x36e0fb,_0x30b166),_0x30b166['type']){case'rename':_0x332fdc=_0x30b166['position'],_0x3047b0=_0x332fdc['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x332fdc=_0x30b166['range']['start'],_0x3047b0=_0x30b166['range']['end'];break;case'insert':_0x332fdc=_0x30b166['position'],_0x3047b0=_0x332fdc['getShiftedBy'](_0x30b166['howMany']);break;case'split':_0x332fdc=_0x30b166['splitPosition'],_0x3047b0=_0x30b166['moveTargetPosition'];break;case'merge':{const _0x26c1c9=_0x30b166['targetPosition']['path']['slice'](0x0,-0x1);_0x332fdc=_0x448a94['model']['createPositionFromPath'](_0x4a91fb,_0x26c1c9),_0x3047b0=_0x332fdc['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x400b50=_0x30b166['howMany'],_0x5334ad=_0x30b166['sourcePosition']['_getTransformedByInsertion'](_0x30b166['targetPosition'],_0x400b50),_0x2ed0f1=_0x30b166['getMovedRangeStart']();'remove'==_0x30b166['type']?(_0x332fdc=_0x5334ad,_0x3047b0=_0x5334ad):(_0x332fdc=_0x2ed0f1,_0x3047b0=_0x2ed0f1['getShiftedBy'](_0x400b50));break;}}_0x332fdc&&_0x332fdc['isBefore'](_0xafa921)&&(_0xafa921=_0x332fdc['clone'](),_0xafa921['stickiness']='toNone'),_0x3047b0&&_0x3047b0['isAfter'](_0x36e0fb)&&(_0x36e0fb=_0x3047b0['clone'](),_0x36e0fb['stickiness']='toNone');}return _0x448a94['model']['createSelection'](_0x448a94['model']['createRange'](_0xafa921,_0x36e0fb));}function gn(_0x568d1b,_0x330eb7){return'move'!=_0x330eb7['type']&&'remove'!=_0x330eb7['type']||_0x330eb7['sourceRange']['containsPosition'](_0x568d1b)&&((_0x568d1b=_0x330eb7['sourcePosition']['clone']())['stickiness']='toNone'),_0x568d1b['getTransformedByOperation'](_0x330eb7);}function An(_0x554a7f,_0xab2867){In(_0x554a7f,_0xab2867,'forward');const _0x238fa9=_0xab2867['getFirstRange']();_0xab2867['setTo']([]),_0xab2867['setTo'](_0x238fa9,{'backward':!0x0}),In(_0x554a7f,_0xab2867,'backward');}function In(_0xfff5b8,_0x387e11,_0xa170bf){let _0x20513d=0x14;for(;_0x20513d;){_0xfff5b8['modifySelection'](_0x387e11,{'unit':'word','direction':_0xa170bf}),_0x20513d--;const _0x1c12a1=_0x387e11['focus']['forward'==_0xa170bf?'nodeBefore':'nodeAfter'];if(_0x1c12a1&&_0x1c12a1['is']('element')&&_0xfff5b8['schema']['isBlock'](_0x1c12a1)&&_0xfff5b8['schema']['isObject'](_0x1c12a1))break;}}function pn(_0x22bd18,_0x1351f9){for(const [_0x55e31b,_0x518209]of _0x22bd18['markers']){const _0x5b4e8b=_0x518209['_getTransformedByDeletion'](_0x1351f9['start'],_0x1351f9['end']['offset']-_0x1351f9['start']['offset']);null!=_0x5b4e8b?_0x22bd18['markers']['set'](_0x55e31b,_0x5b4e8b):_0x22bd18['markers']['delete'](_0x55e31b);}}function En(_0x2c8b97,_0x7ff931,_0x155cc){for(let [_0x30bf9d,_0x41c724]of _0x2c8b97['markers'])_0x41c724=_0x41c724['_getTransformedByInsertion'](_0x7ff931,_0x155cc,!0x1)[0x0],_0x2c8b97['markers']['set'](_0x30bf9d,_0x41c724);}function mn(_0x37124d,_0x1570c3){for(const _0x5ef606 of _0x37124d)'noop'!==_0x5ef606['type']&&(_0x5ef606['_aiSource']=_0x1570c3);}var Tn=class extends _0x77cfae{static get['pluginName'](){return'AIGateway';}static get requires(){return[_0x1ba3e1,fs];}get['models'](){return this['context']['plugins']['get'](fs)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['apply'](_0x1156a5,_0x119f85){const {applyMethod:_0x4d3a96,roots:_0x542964}=_0x119f85,_0x21b1d8='suggest'===_0x4d3a96;if(_0x1156a5['error']||!_0x1156a5['results']['length'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0x1156a5['status']});if(_0x542964){if(0x0===_0x542964['length'])throw new ct('ai-gateway-apply-empty-roots',this);for(const {channelId:_0x1175f9,rootName:_0x26969a}of _0x542964)if(!_0x1156a5['results']['some'](_0x40f9a2=>_0x40f9a2['channelId']===_0x1175f9&&_0x40f9a2['rootName']===_0x26969a))throw new ct('ai-gateway-apply-root-not-found',this,{'channelId':_0x1175f9,'rootName':_0x26969a});}const _0x4cb2d4=_0x1156a5['results']['reduce']((_0x120d8d,_0xcb37af)=>{if(_0x542964&&!_0x542964['some'](_0x434295=>_0x434295['channelId']===_0xcb37af['channelId']&&_0x434295['rootName']===_0xcb37af['rootName']))return _0x120d8d;if('completed'!==_0xcb37af['status'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0xcb37af['status'],'channelId':_0xcb37af['channelId'],'rootName':_0xcb37af['rootName']});if(_0x21b1d8&&!_0xcb37af['editor']['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',this,{'channelId':_0xcb37af['channelId'],'rootName':_0xcb37af['rootName']});let _0x3d0470=_0x120d8d['get'](_0xcb37af['editor']);return _0x3d0470||(_0x3d0470=[],_0x120d8d['set'](_0xcb37af['editor'],_0x3d0470)),_0x3d0470['push'](_0xcb37af),_0x120d8d;},new Map()),_0x2a74dd=this['context']['plugins']['get'](_0x1ba3e1);for(const [_0x5e5f37,_0x1db026]of _0x4cb2d4){const _0x33b482=_0x1db026['map'](_0x2049b3=>{const _0x2be2d3=_0x5e5f37['model']['createPositionAt'](_0x5e5f37['model']['document']['getRoot'](_0x2049b3['rootName']),0x0),_0x175db0=Qs(_0x5e5f37,_0x2049b3['rootName'],_0x2049b3['contentRawOld'],_0x2049b3['contentRawNew']);if(!_0x175db0)return _0x2049b3['droppedUnsupportedInlineChange']=!0x0,null;const _0x3d9360=_0x2a74dd['getDiff'](_0x175db0['before'],_0x175db0['after'],{'anchor':_0x2be2d3,'markDeletions':_0x21b1d8,'targetEditor':_0x5e5f37}),_0x2664c7=_0x5e5f37['model']['document']['history']['getOperations'](_0x2049b3['documentVersion']),_0x6270b3={'document':_0x5e5f37['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x2b93ba=_0x318423(_0x3d9360['getOperations'](),_0x2664c7,_0x6270b3)['operationsA'];return mn(_0x2b93ba,_0x119f85['aiSource']??'api'),_0x2b93ba;});_0x5e5f37['model']['change'](_0x12651a=>{for(const _0x3caba0 of _0x33b482)_0x3caba0&&(_0x21b1d8?_0x5e5f37['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x3caba0):_0x2a74dd['applyOperations'](_0x12651a,_0x3caba0));});}}mergeChangesIntoContent(_0x1d01b3,_0x37427a,_0x424901){const _0x44073e=new hn(),_0x20f3bb=new sn();let _0x45cd9a=_0x44073e['parseAndNormalizeHTML'](_0x37427a);for(const _0x11087d of _0x1d01b3)try{const _0x4c9a47=_0x44073e['parseAndNormalizeHTML'](_0x11087d['content']);_0x45cd9a=_0x20f3bb['merge'](_0x4c9a47,_0x45cd9a,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x59b7da){throw new ct('ai-gateway-merge-failed',this,{..._0x11087d},_0x59b7da);}return un(_0x424901,_0x44073e['parseAndNormalizeHTML'](_0x37427a),_0x45cd9a,!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(_0x3badde=[]){super(),this['_refs']=[..._0x3badde];}get['refs'](){return[...this['_refs']];}get isEmpty(){return 0x0===this['_refs']['length'];}cloneWith(..._0x48b156){return new AIContext([...this['_refs'],..._0x48b156]);}addDefaultContext(_0x2f97ae){this['_refs']=[...this['_refs'],..._0x2f97ae];}toRequestParts(_0x763dc0=[]){return[...this['_refs']['map'](As),..._0x763dc0];}toMessageAttributes(_0x21bd08){return this['isEmpty']?_0x21bd08:{..._0x21bd08,[Kn]:[...new Set(this['_refs']['map'](_0x383919=>_0x383919['id']))]};}static getDefaultContextIds(_0x1f0051){const _0x50567b=_0x1f0051&&_0x1f0051[Kn];return new Set(Array['isArray'](_0x50567b)?_0x50567b:[]);}};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:_0xbc4a3c,config:_0x2a3912,ownerId:_0x13beac}){super(),this['_connector']=_0xbc4a3c,this['_config']=_0x2a3912,this['_ownerId']=_0x13beac;}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(_0x26c7be,_0x5842b4,_0x17a581=new Set()){const _0x2c86ac=new Map(),{contextItem:_0x1ed1f0,unmatchedDocumentIds:_0x2822a7}=await this['_populateDocumentContextItem'](_0x26c7be,_0x5842b4);_0x1ed1f0&&_0x2c86ac['set'](_0x1ed1f0['id'],_0x1ed1f0);for(const _0x9ed9f6 of _0x26c7be){if('document'===_0x9ed9f6['type'])continue;const _0x576bdb=await this['_createContextItemFromContent'](_0x9ed9f6,_0x17a581);'context'!==_0x576bdb['type']&&this['_addToConversationContextItem'](_0x576bdb),_0x2c86ac['set'](_0x576bdb['id'],_0x576bdb);}return{'contextItems':_0x2c86ac,'hasUnmatched':_0x2822a7['size']>0x0,'unmatchedDocumentIds':_0x2822a7};}async _populateDocumentContextItem(_0x4809e2,_0x2ed257){const _0x3fb3b6=_0x4809e2['filter'](_0x4eb58c=>'document'===_0x4eb58c['type']);if(0x0===_0x3fb3b6['length'])return{'unmatchedDocumentIds':new Set()};const _0x2aa932=_0x3fb3b6['map'](_0x232405=>_0x232405['id']),_0x2f9232=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x2aa932)['getDocuments'](),_0x4553b1=new Map(_0x2f9232['map'](_0x282a27=>[_0x282a27['id'],_0x282a27])),_0xa8109f=[],_0x5ca071=new Set();for(const _0x118559 of _0x3fb3b6){const _0x48a550=_0x4553b1['get'](_0x118559['id']);_0x48a550&&(this['_matchDocumentToRoot'](_0x48a550,_0x2ed257)||_0x5ca071['add'](_0x48a550['id']),_0xa8109f['push']({'id':_0x48a550['id'],'content':_0x48a550['content'],'version':_0x48a550['attributes']?.['version']??0x0,'sessionId':_0x48a550['attributes']?.['sessionId']??null,'selection':[],'selectionSignature':'','channelId':_0x48a550['attributes']?.['channelId']??_0x2ed257[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x48a550['attributes']?.['rootName']??_0x2ed257[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??'','editorConfig':_0x118559['editorConfig']}));}const _0x290fdf={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0xa8109f};return this['_addToConversationContextItem'](_0x290fdf),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x290fdf,'unmatchedDocumentIds':_0x5ca071};}_matchDocumentToRoot(_0x5c55f4,_0x4f7f19){const _0x1bd949=_0x5c55f4['attributes']?.['channelId'],_0x545a74=_0x5c55f4['attributes']?.['rootName'];if(_0x1bd949&&_0x545a74){for(const _0x503be1 of _0x4f7f19)if(_0x503be1['config']['get']('collaboration.channelId')===_0x1bd949){for(const _0x55ba15 of _0x503be1['model']['document']['getRoots']())if('$graveyard'!==_0x55ba15['rootName']&&_0x55ba15['rootName']===_0x545a74)return{'editor':_0x503be1,'rootName':_0x55ba15['rootName']};}}}async _createContextItemFromContent(_0x2f41d4,_0x1df7f4=new Set()){return'mcp-tool-context'===_0x2f41d4['type']?{'id':_0x2f41d4['id'],'uiId':_0x2f41d4['id'],'label':_0x2f41d4['data']?.['label']||_0x2f41d4['id'],'type':'mcp-tool-context','mcpServerName':_0x2f41d4['mcpServerName'],'toolName':_0x2f41d4['toolName'],'data':_0x2f41d4['data']||{}}:{'id':_0x2f41d4['id'],'uiId':_0x2f41d4['id'],'label':_0x2f41d4['attributes']?.['label']||_0x2f41d4['name']||_0x2f41d4['url']||_0x2f41d4['id'],'type':_0x2f41d4['type'],..._0x2f41d4?.['attributes']?.['resourceId']?{'resourceId':_0x2f41d4['attributes']?.['resourceId']}:{},...'context'===_0x2f41d4['type']&&_0x1df7f4['has'](_0x2f41d4['id'])?{'hidden':!0x0}:{}};}getSentContextItems(){return new Map(this['_conversationContextItems']);}removeFromContext(_0x51adc2){this['_pendingContextItems']['get'](_0x51adc2)?.['isReadOnly']||this['_removeContextItem'](_0x51adc2);}clearPendingContextItems(){if(0x0===this['_pendingContextItems']['size'])return;for(const _0xeeda68 of this['_pendingContextItems']['values']())'context'!==_0xeeda68['type']&&this['_removeContextItem'](_0xeeda68['uiId']);const _0x203c12=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x203c12&&this['_addContextItem']({..._0x203c12,'isReadOnly':!0x0,'hidden':!0x0});}addToConversationContext(_0x3d3af4){for(const _0x1afbe0 of _0x3d3af4['values']())'context'!==_0x1afbe0['type']&&this['_addToConversationContextItem'](_0x1afbe0);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(_0x1c3cae){return Array['from'](_0x1c3cae['values']())['flatMap'](_0x302fb6=>this['_mapContextItemToRequestData'](_0x302fb6));}async addFilesToContext(_0x50515d,_0x8caf59,_0x157794='file'){const _0x1e1d69='files-'+kt();this['_startUploadOperation'](_0x1e1d69);try{await Promise['all'](_0x50515d['map'](async _0xb45367=>{const _0x45e35f='file-'+kt(),_0x56feeb=_0x31e6fe(_0xb45367['name']),_0x4cd59b='file'===_0x157794&&_0xb45367['type']['startsWith']('image/')?'image':_0x157794;try{this['_addContextItem']({'type':_0x4cd59b,'label':_0x8caf59?.['label']||_0x56feeb,'uiId':_0x45e35f,'resourceId':_0x8caf59?.['resourceId']},!0x0);const _0x5219c4=this['_connector']['uploadFile'](this['_ownerId'],_0xb45367,_0x8caf59);this['_ongoingUploads']['set'](_0x45e35f,_0x5219c4['abortController']);const {id:_0x35e48a}=await _0x5219c4['getId']();this['_ongoingUploads']['delete'](_0x45e35f),this['_finishContextItemLoading']({'type':_0x4cd59b,'id':_0x35e48a,'label':_0x8caf59?.['label']||_0x56feeb,'uiId':_0x45e35f,'resourceId':_0x8caf59?.['resourceId']},!0x1);}catch(_0x2bca02){if(this['_ongoingUploads']['delete'](_0x45e35f),!kn(_0x2bca02)){const _0x2fb4c3=new yn({'code':$n['get'](_0x2bca02['code'])||'ai-chat-file-upload-failed','cause':_0x2bca02,'context':{'fileName':_0x56feeb}});this['fire']('error',{'error':_0x2fb4c3});}this['_removeContextItem'](_0x45e35f);}}));}finally{this['_finishUploadOperation'](_0x1e1d69);}}addCurrentDocumentToContext(_0x310245){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x239c56={'type':'document','uiId':'current-document','label':_0x310245,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x239c56);}getCurrentDocumentContext(){return this['_pendingContextItems']['get']('current-document');}async updateCurrentDocuments(_0x536a4f,_0x443369){const _0x3ac826=this['getCurrentDocumentContext']();if(!_0x3ac826)return;_0x536a4f['length']>0x1&&_0x536a4f['some'](_0x4161df=>!_0x4161df['description'])&&St('ai-chat-documents-missing-description');try{const _0x441fcc=(_0x3ac826['documents']||[])['filter'](_0x298fe4=>_0x443369['has'](_0x298fe4['channelId']));if(!_0x536a4f['length'])return void(_0x3ac826['documents']=_0x441fcc);const _0x763c85=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x536a4f)['getIds']();if(_0x763c85['length']!==_0x536a4f['length']||_0x763c85['some'](_0x35828f=>!_0x35828f?.['id'])){const _0x4fb5d6=new ct('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x4fb5d6});}const _0x303be1=_0x536a4f['map']((_0x4e959c,_0x3e8e78)=>{return{'id':_0x763c85[_0x3e8e78]['id'],'content':_0x4e959c['content'],'version':_0x4e959c['version'],'sessionId':_0x4e959c['sessionId'],'selection':(_0x192b01=_0x4e959c['selections'],_0x192b01?_0x192b01['map'](_0x57f3df=>({'start':_0x57f3df['start'],'end':_0x57f3df['end']})):[]),'selectionSignature':_0x4e959c['selectionSignature'],'channelId':_0x4e959c['channelId'],'rootName':_0x4e959c['rootName'],'editorConfig':_0x4e959c['editorConfig']};var _0x192b01;});_0x3ac826['documents']=[..._0x441fcc,..._0x303be1];}catch(_0x2485b4){throw new yn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x2485b4});}}addSelectionToContext(_0x404288){this['_addContextItem']({'type':'selection','label':_0x404288,'uiId':'selection','content':_0x404288});}removeSelectionFromContext(){this['_removeContextItem']('selection');}async addUrlToContext(_0x2836c1,_0x3bfc43){const _0x2eacf1='url-'+kt();this['_startUploadOperation'](_0x2eacf1);const _0x2b589d='url-'+kt();try{this['_addContextItem']({'type':'web-resource','label':_0x3bfc43?.['label']||_0x2836c1,'uiId':_0x2b589d,'resourceId':_0x3bfc43?.['resourceId']},!0x0);const _0x408ba6=this['_connector']['uploadUrl'](this['_ownerId'],_0x2836c1,_0x3bfc43);this['_ongoingUploads']['set'](_0x2b589d,_0x408ba6['abortController']);const {id:_0x1d2084}=await _0x408ba6['getId']();this['_ongoingUploads']['delete'](_0x2b589d),this['_finishContextItemLoading']({'type':'web-resource','id':_0x1d2084,'label':_0x3bfc43?.['label']||_0x2836c1,'uiId':_0x2b589d,'resourceId':_0x3bfc43?.['resourceId']},!0x1);}catch(_0x2b92fc){this['_ongoingUploads']['delete'](_0x2b589d),kn(_0x2b92fc)||this['fire']('error',{'error':new ct('ai-chat-url-upload-failed',this,{'url':_0x2836c1,'originalError':_0x2b92fc}),'url':_0x2836c1}),this['_removeContextItem'](_0x2b589d);}finally{this['_finishUploadOperation'](_0x2eacf1);}}addToolItemToContext(_0x1583ff){_0x1583ff['id']=_0x1583ff['id']??kt()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x1583ff['uiId'],_0x1583ff),this['fire']('contextItemAdded',{'contextItem':_0x1583ff,'isLoading':!0x1});}async['loadSourceResources'](_0x136ce9,_0x31b9d0,_0x37e64b){const _0x2642d0=this['_addContextOptionsState']['sources']['find'](_0x2fa14b=>_0x2fa14b['id']===_0x136ce9);if(!_0x2642d0)return this['fire']('error',{'error':new ct('ai-chat-source-not-found',this,{'sourceId':_0x136ce9}),'sourceId':_0x136ce9}),[];try{const _0x27947a=(await _0x2642d0['getResources'](_0x31b9d0))['map'](_0x214790=>{const _0x4b33aa=this['_isResourceInContext'](_0x214790['id']);return{..._0x214790,'isInContext':_0x4b33aa};});return _0x2642d0['resources']=_0x27947a,this['fire']('sourceResourcesLoaded',{'sourceId':_0x136ce9,'source':_0x2642d0,'resources':_0x27947a,'uid':_0x37e64b}),_0x27947a;}catch(_0x37cac8){return this['fire']('error',{'error':new ct('ai-chat-source-resources-load-failed',this,{'sourceId':_0x136ce9,'originalError':_0x37cac8}),'sourceId':_0x136ce9,'sourceLabel':_0x2642d0['label']}),[];}}async addResourceToContext(_0x280d07,_0x92b67c){if(this['_isResourceInContext'](_0x92b67c['id']))return;if('context'===_0x92b67c['type'])return void this['_addContextItem']({'type':'context','id':_0x92b67c['id'],'label':_0x92b67c['label'],'uiId':'context-'+kt(),'resourceId':_0x92b67c['id']});let _0x3c8574=_0x92b67c['data'];if(!_0x3c8574&&_0x280d07['getData'])try{_0x3c8574=await _0x280d07['getData'](_0x92b67c['id']);}catch(_0x3b5d30){return void this['fire']('error',{'error':new ct('ai-chat-resource-load-failed',this,{'resourceId':_0x92b67c['id'],'sourceId':_0x280d07['id'],'originalError':_0x3b5d30}),'resourceId':_0x92b67c['id'],'sourceId':_0x280d07['id']});}if(_0x3c8574)switch(_0x92b67c['type']){case'web-resource':if('string'!=typeof _0x3c8574)return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x92b67c['id'],'sourceId':_0x280d07['id'],'expectedType':'string','actualType':typeof _0x3c8574}),'resourceId':_0x92b67c['id'],'sourceId':_0x280d07['id']});await this['addUrlToContext'](_0x3c8574,{'label':_0x92b67c['label'],'resourceId':_0x92b67c['id']});break;case'file':if(!(_0x3c8574 instanceof File))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x92b67c['id'],'sourceId':_0x280d07['id'],'expectedType':'File','actualType':typeof _0x3c8574}),'resourceId':_0x92b67c['id'],'sourceId':_0x280d07['id']});await this['addFilesToContext']([_0x3c8574],{'label':_0x92b67c['label'],'resourceId':_0x92b67c['id']});break;case'text':if('object'!=typeof _0x3c8574||!('content'in _0x3c8574)||!('type'in _0x3c8574))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x92b67c['id'],'sourceId':_0x280d07['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x3c8574}),'resourceId':_0x92b67c['id'],'sourceId':_0x280d07['id']});_0x3c8574=AIChatContext['_convertTextResourceToFile'](_0x3c8574,_0x92b67c['label']),await this['addFilesToContext']([_0x3c8574],{'label':_0x92b67c['label'],'resourceId':_0x92b67c['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ct('ai-chat-context-unsupported-type',this,{'resourceId':_0x92b67c['id'],'sourceId':_0x280d07['id'],'resourceType':_0x92b67c['type']}),'resourceId':_0x92b67c['id'],'sourceId':_0x280d07['id']});}else this['fire']('error',{'error':new ct('ai-chat-resource-no-data',this,{'resourceId':_0x92b67c['id'],'sourceId':_0x280d07['id']}),'resourceId':_0x92b67c['id'],'sourceId':_0x280d07['id']});}addContextSource(_0x19363c){this['_addContextOptionsState']['sources']['some'](_0x4cffb8=>_0x4cffb8['id']===_0x19363c['id'])||(this['_addContextOptionsState']['sources']['push']({..._0x19363c,'resources':[]}),this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']}));}toggleAddCurrentDocumentOptionVisibility(_0x39ee5d){if(void 0x0!==_0x39ee5d)this['_addContextOptionsState']['document']['isHidden']=!_0x39ee5d;else{const _0xc67f1e=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0xc67f1e;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static _convertTextResourceToFile(_0x294f61,_0x4ce2e2){switch(_0x294f61['type']){case'markdown':return new File([_0x294f61['content']],_0x4ce2e2,{'type':'text/markdown'});case'html':return new File([_0x294f61['content']],_0x4ce2e2,{'type':'text/html'});default:return new File([_0x294f61['content']],_0x4ce2e2,{'type':'text/plain'});}}static _mapContextItemToRequestData(_0xfbd9b7){switch(_0xfbd9b7['type']){case'file':case'image':case'text':return[{'type':'file','id':_0xfbd9b7['id']}];case'web-resource':return[{'type':'web-resource','id':_0xfbd9b7['id']}];case'context':return[{'type':'context','id':_0xfbd9b7['id']}];case'document':return _0xfbd9b7['documents']?.['length']?_0xfbd9b7['documents']['map'](({id:_0x461c3a,editorConfig:_0x1b1452,selection:_0x4a0914})=>({'type':'document','id':_0x461c3a,..._0x1b1452&&{'editorConfig':_0x1b1452},..._0x4a0914?.['length']&&{'selection':_0x4a0914}})):[];case'mcp-tool-context':{const _0x2daa3a=_0xfbd9b7;return[{'type':'mcp-tool-context','mcpServerName':_0x2daa3a['mcpServerName'],'toolName':_0x2daa3a['toolName'],'data':{..._0x2daa3a['data'],'label':_0x2daa3a['label']||_0x2daa3a['data']?.['label']||_0x2daa3a['id']},'id':_0x2daa3a['id']}];}default:return[];}}_addContextItem(_0x29a7ed,_0x16839b=!0x1){if(this['_pendingContextItems']['set'](_0x29a7ed['uiId'],_0x29a7ed),_0x29a7ed['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x29a7ed,'isLoading':_0x16839b}),'current-document'===_0x29a7ed['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x29a7ed['resourceId']){const _0x13ea96=this['_findSourceIdsByResourceId'](_0x29a7ed['resourceId']);_0x13ea96&&_0x13ea96['forEach'](_0xad0b0f=>{this['_updateResourceInContextState'](_0xad0b0f,_0x29a7ed['resourceId'],!0x0);});}}_removeContextItem(_0x217d13){const _0x1a3c07=this['_pendingContextItems']['get'](_0x217d13),_0x350942=this['_ongoingUploads']['get'](_0x217d13);if(_0x350942&&(_0x350942['abort'](),this['_ongoingUploads']['delete'](_0x217d13)),_0x1a3c07?.['resourceId']){const _0x1338f0=this['_findSourceIdsByResourceId'](_0x1a3c07['resourceId']);_0x1338f0&&_0x1338f0['forEach'](_0x229a71=>{this['_updateResourceInContextState'](_0x229a71,_0x1a3c07['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x217d13),this['fire']('contextItemRemoved',{'uiId':_0x217d13,'type':_0x1a3c07?.['type']}),'current-document'===_0x217d13&&this['toggleAddCurrentDocumentOptionVisibility']();}_finishContextItemLoading(_0x3f4204,_0x20d637){if(this['_pendingContextItems']['has'](_0x3f4204['uiId'])&&(this['_pendingContextItems']['set'](_0x3f4204['uiId'],_0x3f4204),this['fire']('contextItemLoadingEnded',{'contextItem':_0x3f4204,'isLoading':_0x20d637}),_0x3f4204['resourceId'])){const _0x27f16f=this['_findSourceIdsByResourceId'](_0x3f4204['resourceId']);_0x27f16f&&_0x27f16f['forEach'](_0xb44023=>{this['_updateResourceInContextState'](_0xb44023,_0x3f4204['resourceId'],!0x0);});}}_addToConversationContextItem(_0x36dd5a){this['_conversationContextItems']['set'](_0x36dd5a['uiId'],_0x36dd5a);}_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'](_0x4800d4=>({..._0x4800d4,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}_getCustomSourcesInitialState(){return this['_config']?.['sources']?.['map'](_0x2fccec=>({..._0x2fccec,'resources':[]}))??[];}_isResourceInContext(_0x445339){for(const _0x565c82 of this['_pendingContextItems']['values']())if(_0x565c82['resourceId']===_0x445339)return!0x0;for(const _0x27912a of this['_conversationContextItems']['values']())if(_0x27912a['resourceId']===_0x445339)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x655068){const _0x3bc88e=[];for(const _0xde8f12 of this['_addContextOptionsState']['sources'])_0xde8f12['resources']['find'](_0x4fceea=>_0x4fceea['id']===_0x655068)&&_0x3bc88e['push'](_0xde8f12['id']);return 0x0===_0x3bc88e['length']?null:_0x3bc88e;}_updateResourceInContextState(_0x434b5b,_0x8f92e7,_0x30c77a){const _0x48be2c=this['_addContextOptionsState']['sources']['find'](_0x5704a1=>_0x5704a1['id']===_0x434b5b);if(!_0x48be2c)return;const _0x3d69c2=_0x48be2c['resources']['find'](_0x164478=>_0x164478['id']===_0x8f92e7);_0x3d69c2&&(_0x3d69c2['isInContext']=_0x30c77a,this['fire']('resourceStateChanged',{'sourceId':_0x434b5b,'resourceId':_0x8f92e7,'isInContext':_0x30c77a}));}_startUploadOperation(_0x132f9b){this['_ongoingUploadOperations']['set'](_0x132f9b,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}_finishUploadOperation(_0x296a76){this['_ongoingUploadOperations']['delete'](_0x296a76),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}},Xn=class extends Fn{['userMessage'];conversationId;contextItems=new Map();capabilities;['model'];attributes;context;constructor(_0x2b633d){super(_0x2b633d),this['conversationId']=_0x2b633d['conversationId'],this['contextItems']=_0x2b633d['contextItems'],this['capabilities']=_0x2b633d['capabilities'],this['userMessage']=_0x2b633d['userMessage'],this['model']=_0x2b633d['model'],this['attributes']=_0x2b633d['attributes'],this['context']=_0x2b633d['context']??new Yn();}sendRequest(){const _0x59e1be=Qn['mapContextItemsToRequestData'](this['contextItems']),_0x4af706=this['context']['toRequestParts'](_0x59e1be);return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':_0x4af706,'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(_0xc4449d){super(),this['options']=_0xc4449d,this['connector']=_0xc4449d['connector'],this['chatModels']=_0xc4449d['chatModels'],this['id']=_0xc4449d['conversationId'],this['isFromHistory']=_0xc4449d['isFromHistory'],this['_channelsToEditors']=_0xc4449d['channelsToEditors'],this['_getSessionId']=_0xc4449d['getSessionId'];}async init(_0x3038a5){try{this['chatContext']=new Qn({'connector':this['connector'],'config':_0x3038a5,'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 _0x5c78a8=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x5c78a8});const _0x50c315=await this['chatModels']['resolveModel'](this['options']['selectedModelId']);_0x50c315&&await this['setModel'](_0x50c315);}catch(_0x2ba813){const _0x402cf6=new yn({'code':'ai-chat-conversation-init-failed','cause':_0x2ba813,'type':'network'});this['fire']('error',{'error':_0x402cf6});}}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:_0x2622e5}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x2622e5,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x5d803c){const _0x3f85ad=new yn({'code':'ai-chat-conversation-start-failed','cause':_0x5d803c,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x3f85ad}),_0x3f85ad;}}async['load'](_0x203e3c){try{const _0xd1d7fd=await this['connector']['fetchConversation'](_0x203e3c)['getConversation'](),_0x30bd93=await this['connector']['fetchConversationMessages'](_0x203e3c)['getMessages'](),_0x1fe7b4=_0x30bd93[0x0]['model'];this['isStarted']=!0x0,this['id']=_0xd1d7fd['id'],'title'in _0xd1d7fd?this['fire']('setConversationTitle',_0xd1d7fd['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']),this['selectedModel']=await this['chatModels']['getModel'](_0x1fe7b4)??void 0x0,this['fire']('modelSelected',{'selectedModel':this['selectedModel'],'isDisabled':!0x0});const {streamingMessageId:_0x46f11a}=await this['_processMessagesToInteractions'](_0x30bd93,_0x1fe7b4);return _0x46f11a&&this['currentInteraction']?this['_resumeStream'](_0x46f11a):this['currentInteraction']=void 0x0,this;}catch(_0x20c188){const _0x2fd6e6=new yn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x20c188,'type':'network','context':{'conversationId':_0x203e3c}});throw this['fire']('error',{'error':_0x2fd6e6}),_0x2fd6e6;}}async _processMessagesToInteractions(_0x2b0484,_0x4a2f15){let _0x490e62,_0x5ded1b,_0x162e7b=new Set();for(const _0xa1cc33 of _0x2b0484)if('user'===_0xa1cc33['role']){const {contextItems:_0x407a1e,unmatchedDocumentIds:_0x177b46}=await this['_extractContextItems'](_0xa1cc33);_0x162e7b=_0x177b46;const _0x5a809c={'isReasoningEnabled':Object['hasOwn'](_0xa1cc33['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0xa1cc33['capabilities'],'webSearch')};_0x490e62=this['createInteraction']({'userMessage':_0xa1cc33['prompt'],'contextItems':_0x407a1e,'capabilities':_0x5a809c,'modelId':_0x4a2f15,'attributes':_0xa1cc33['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x490e62,_0x5ded1b=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0xa1cc33['role']&&_0x490e62){if('streaming'===_0xa1cc33['status']){_0x5ded1b=_0xa1cc33['id'];continue;}if('error'===_0xa1cc33['status'])continue;const _0x50f4f0=[];for(const _0x3dd21c of _0xa1cc33['content'])switch(_0x3dd21c['type']){case'text':case'modification':{const _0x1294e1=_0x490e62['getDocumentContext'](),_0x356ef1=this['_getOutdatedReasonsByDocumentId'](_0x1294e1,_0x162e7b),_0x47eb53=_0x1294e1?.['documents']??[],_0x9f021d=_0x47eb53['length']>0x0&&_0x47eb53['every'](_0x40e34a=>_0x356ef1['has'](_0x40e34a['id']));_0x490e62['currentReply']?.['type']!==_0x3dd21c['type']&&(_0x490e62['currentReply']=_0x490e62['createReply']({'type':_0x3dd21c['type'],'isDone':!0x0,'interactionId':_0x490e62['id'],'areActionsDisabled':_0x9f021d,'outdatedReasonByDocumentId':_0x356ef1,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x50f4f0['length']>0x0&&(_0x490e62['currentReply']['sources']=_0x50f4f0['splice'](0x0))),_0x490e62['currentReply']['appendContent'](_0x3dd21c['content'],_0x3dd21c['documentId']);break;}case'url':_0x50f4f0['push'](_0x3dd21c);break;case'mcp-tool-result':{const {data:_0x330a69,attributes:_0x3530a1}=JSON['parse'](_0x3dd21c['content']);_0x490e62['_handleToolResultData']({'toolName':_0x3dd21c['toolName'],'data':_0x330a69,'attributes':_0x3530a1});break;}}'cancelled'===_0xa1cc33['status']&&this['fire']('error',{'interactionId':_0x490e62['id'],'error':new ct('ai-request-aborted',this)});}}return{'streamingMessageId':_0x5ded1b};}async _resumeStream(_0x1481b1){if(this['currentInteraction'])try{const _0x11659a=this['connector']['resumeStream'](this['id'],_0x1481b1);await this['currentInteraction']['resume'](_0x11659a);}catch(_0x370c15){_0x370c15 instanceof ct&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x370c15});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async _extractContextItems(_0x9a34f5){return _0x9a34f5['content']?this['chatContext']['populateFromMessage'](_0x9a34f5['content'],Array['from'](this['_channelsToEditors']['values']()),Yn['getDefaultContextIds'](_0x9a34f5['attributes'])):{'contextItems':new Map(),'unmatchedDocumentIds':new Set()};}async handleUserInteraction({userMessage:_0x900990,attributes:_0x31b185}){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 _0x2da099=new Map(this['getPendingContextItems']()),_0x37f000=this['chatCapabilities']['getCapabilitiesConfig'](),_0x53541a=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x900990,'contextItems':_0x2da099,'capabilities':_0x37f000,'modelId':_0x53541a,'attributes':_0x31b185,'channelsToEditors':this['_channelsToEditors']}),await this['updateCurrentDocumentsInContext'](),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x97d06c){if(_0x97d06c instanceof ct)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x97d06c});else{const _0x3db58a=$n['get'](_0x97d06c['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ct(_0x3db58a,null,{'error':_0x97d06c})});}}finally{this['stopProcessing']();}}stopProcessing(){this['_abortReject']&&(this['_abortReject'](),this['_abortReject']=void 0x0),this['currentInteraction']&&(this['currentInteraction']['stop'](),this['currentInteraction']=void 0x0);}createInteraction({userMessage:_0x5458ff,contextItems:_0x513c16,capabilities:_0x405fd0,modelId:_0x55ec1d,attributes:_0x2bdeaf,channelsToEditors:_0x3eaa7a}){const _0x42665f=new Xn({'userMessage':_0x5458ff,'contextItems':_0x513c16,'capabilities':_0x405fd0,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x55ec1d,'attributes':_0x2bdeaf,'channelsToEditors':_0x3eaa7a,'context':this['chatContext']['isEmpty']?void 0x0:new Yn(this['chatContext']['refs'])});return _0x42665f['delegate'](...Gn)['to'](this),this['interactions']['push'](_0x42665f),this['fire']('interactionCreated',_0x42665f),_0x42665f;}getInteraction(_0x1e98e7){return this['interactions']['find'](_0x4a0ab1=>_0x4a0ab1['id']===_0x1e98e7);}removeInteraction(_0x299d0f){const _0x21b457=this['getInteraction'](_0x299d0f);_0x21b457&&(_0x21b457['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x21b457),0x1));}get lastInteraction(){return this['interactions'][this['interactions']['length']-0x1];}cancelLastInteractionStream(){const _0x55fc8b=this['lastInteraction'];_0x55fc8b?.['conversationId']&&_0x55fc8b['messageId']&&this['connector']['cancelStream'](_0x55fc8b['conversationId'],_0x55fc8b['messageId'])['execute']()['catch'](()=>{});}addCurrentDocumentToContext(_0x1258ae){this['chatContext']['addCurrentDocumentToContext'](_0x1258ae);}async updateCurrentDocumentsInContext(){if(!this['isCurrentDocumentInContext']())return;const {changedIds:_0x3f6671,unchangedIds:_0x50e268}=this['_compareEditorStateWithDocumentContext'](),_0x5c09df=new Promise((_0x3c5568,_0x39a566)=>{this['_abortReject']=()=>_0x39a566(new ct('ai-request-aborted',this));}),_0x174bc3=await Promise['race']([this['options']['aiEditing']['getDocumentData'](_0x3f6671),_0x5c09df]);await Promise['race']([this['chatContext']['updateCurrentDocuments'](_0x174bc3,_0x50e268),_0x5c09df]);}_compareEditorStateWithDocumentContext(){const _0x4bcab8=new Set(),_0xc97cf4=new Set(),_0x1548df=this['options']['aiEditing']['getEditorsVersions'](),_0xc2fa39=this['options']['aiEditing']['getEditorsSelections'](),_0x4a437b=this['chatContext']['getCurrentDocumentContext']()['documents']||[],_0xbfe044=new Map(_0x4a437b['map'](({channelId:_0x1c3e7a,version:_0x441a1b})=>[_0x1c3e7a,_0x441a1b])),_0x26fe04=new Map(_0x4a437b['map'](({channelId:_0x844527,selectionSignature:_0xe8d715})=>[_0x844527,_0xe8d715]));for(const [_0x1d7fe7,_0x2fdfbd]of _0x1548df){const _0x2fdf20=_0xc2fa39['get'](_0x1d7fe7);_0xbfe044['get'](_0x1d7fe7)!=_0x2fdfbd||_0x26fe04['get'](_0x1d7fe7)!=_0x2fdf20?_0x4bcab8['add'](_0x1d7fe7):_0xbfe044['has'](_0x1d7fe7)&&_0xc97cf4['add'](_0x1d7fe7);}return{'changedIds':_0x4bcab8,'unchangedIds':_0xc97cf4};}toggleAddCurrentDocumentOptionVisibility(_0x5c46d2){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x5c46d2);}_getOutdatedReasonsByDocumentId(_0x2b6e40,_0x48e4d2){const _0x14d277=new Map();if(!_0x2b6e40||!_0x2b6e40['documents'])return _0x14d277;for(const _0x4f9bf9 of _0x2b6e40['documents']){const _0x10d3cf=this['_channelsToEditors']['get'](_0x4f9bf9['channelId']);_0x10d3cf&&'destroyed'!==_0x10d3cf['state']?_0x4f9bf9['sessionId']!==this['_getSessionId'](_0x10d3cf)?_0x14d277['set'](_0x4f9bf9['id'],'session-changed'):_0x48e4d2['has'](_0x4f9bf9['id'])&&_0x14d277['set'](_0x4f9bf9['id'],'content-removed'):_0x14d277['set'](_0x4f9bf9['id'],'editor-removed');}return _0x14d277;}addSelectionToContext(_0x592b20){this['chatContext']['addSelectionToContext'](_0x592b20);}removeSelectionFromContext(){this['chatContext']['removeSelectionFromContext']();}addFilesToContext(_0x16de6c){this['chatContext']['addFilesToContext'](_0x16de6c);}addUrlToContext(_0x1ef7e3){this['chatContext']['addUrlToContext'](_0x1ef7e3);}addToolItemToContext(_0x27ec57){this['chatContext']['addToolItemToContext'](_0x27ec57);}addResourceToContext(_0x37e36e,_0x52f3a8){this['chatContext']['addResourceToContext'](_0x37e36e,_0x52f3a8);}['loadSourceResources'](_0x2abfb0,_0x2199ac,_0x44025){return this['chatContext']['loadSourceResources'](_0x2abfb0,_0x2199ac,_0x44025);}removeFromContext(_0x4486b4){this['chatContext']['removeFromContext'](_0x4486b4);}setWebSearch(_0x42f66a){this['chatCapabilities']['setWebSearch'](_0x42f66a);}toggleWebSearch(){this['chatCapabilities']['toggleWebSearch']();}setReasoning(_0x325d8e){this['chatCapabilities']['setReasoning'](_0x325d8e);}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(_0x14a69b){_0x14a69b['length']&&this['chatContext']['addDefaultContext'](_0x14a69b);}async setModel(_0x4e0840){_0x4e0840?!0x1===await this['chatModels']['isAvailable'](_0x4e0840)&&(St('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x4e0840}),_0x4e0840=(await this['chatModels']['getAvailableModels']())[0x0]):(St('ai-chat-conversation-set-model-null',{'conversation':this}),_0x4e0840=(await this['chatModels']['getAvailableModels']())[0x0]),_0x4e0840['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x4e0840,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x4e0840}));}};function Jn({documentSuggestions:_0x227dfe,transform:_0x5cdc7f,documentCompare:_0x4cead3,documentCompareOptions:_0x1b8393}){const _0x441baa=new Map();for(const [_0x310f9c,{groups:_0x4fb476,documentContext:_0xb3dc6,documentContent:_0x2875f0,editor:_0x566745}]of _0x227dfe){const _0x15dab4=_0xb3dc6['content'],_0x140e6e=_0xb3dc6['version'],_0x4977ab=_0x2875f0['cloneNode'](!0x0);for(const {changes:_0x7f92be}of _0x4fb476)$s(_0x4977ab,_0x7f92be);const _0x12cc7a=Os(_0x4977ab),_0x1f40fc=Qs(_0x566745,_0xb3dc6['rootName'],_0x15dab4,_0x12cc7a);if(!_0x1f40fc)continue;const _0x580b3e=_0x4cead3['getDiff'](_0x1f40fc['before'],_0x1f40fc['after'],{'targetEditor':_0x566745,'anchor':_0xb3dc6['rootName'],..._0x1b8393})['getOperations']();if(_0x5cdc7f){const _0x23b6ee=_0x566745['model']['document']['history']['getOperations'](_0x140e6e),_0x329638={'document':_0x566745['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x441baa['set'](_0x310f9c,_0x318423(_0x580b3e,_0x23b6ee,_0x329638)['operationsA']);}else _0x441baa['set'](_0x310f9c,_0x580b3e);}return _0x441baa;}function Zn({groups:_0x5f7e51,documentContextContent:_0x4f794a,documents:_0x153c35}){const _0x3b02f3=new Map();for(const _0x35474f of _0x5f7e51){const {documentId:_0x2b6b98}=_0x35474f,_0x2f3520=_0x3b02f3['get'](_0x2b6b98);if(_0x2f3520)_0x2f3520['groups']['push'](_0x35474f),_0x2f3520['indexes']['push'](_0x35474f['index']);else{const _0x2c2543=_0x153c35['find'](_0x5e25c8=>_0x5e25c8['id']===_0x2b6b98),_0x362297=_0x4f794a['get'](_0x2b6b98);if(!_0x2c2543||!_0x362297)continue;_0x3b02f3['set'](_0x2b6b98,{'groups':[_0x35474f],'documentContext':_0x2c2543,'documentContent':_0x362297,'editor':_0x35474f['editor'],'indexes':[_0x35474f['index']]});}}return _0x3b02f3;}function tr(_0x45854b,_0x3c22a4){const _0x40a32c=_0x45854b['files']['length']>0x0&&_0x45854b['files']['every'](_0x255ded=>_0x255ded['type']['startsWith']('image/')),_0x4cdd4b=_0x45854b['plainText']['trim']()['length']>0x0;if(_0x45854b['files']['length']>0x0&&_0x3c22a4['filesEnabled']&&(!_0x40a32c||!_0x4cdd4b)){const _0x8b2803=_0x45854b['files']['filter'](_0x169f2d=>_0x169f2d['name']);return _0x8b2803['length']>0x0?{'type':'file','files':_0x8b2803}:null;}if(_0x3c22a4['urlsEnabled']){const _0x4286db=function(_0x1500ba){const _0xa66601=_0x1500ba['trim']();if(/\s/['test'](_0xa66601))return null;try{const _0x53664c=new URL(_0xa66601);return'http:'!==_0x53664c['protocol']&&'https:'!==_0x53664c['protocol']?null:_0x53664c['toString']();}catch{return null;}}(_0x45854b['plainText']);if(_0x4286db)return{'type':'url','url':_0x4286db};}const _0x104bc1=_0x45854b['forceTextAttachment']?0x1:_0x3c22a4['longTextThreshold']??0x1/0x0;if(_0x45854b['plainText']['length']>=Math['max'](_0x104bc1,0x1)&&_0x3c22a4['filesEnabled']){const _0x3e6415=_0x3c22a4['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x45854b['plainText']],_0x3e6415,{'type':'text/plain'})]};}return null;}var er=class extends _0x77cfae{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,_0x1ba3e1,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 _0x1c45d6=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0xbc3300,_0x117668)=>{this['sendMessage']({'message':_0x117668});}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',()=>{this['activeConversation']?.['stopProcessing']();}),this['listenTo'](_0x1c45d6['view'],'change:activeTab',(_0x46948a,_0x3c7225,_0x5e49c3)=>{'chat'!==_0x5e49c3&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x48fecd,_0x202583)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x202583));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x130839,_0x3a0181)=>{this['activeConversation']?.['addUrlToContext'](_0x3a0181);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x1536fb,_0x19c295)=>{const _0x56b5fc=this['activeConversation'];if(!_0x56b5fc)return;_0x19c295['hasDirectory']&&(_0x19c295['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+kt()}));const _0x319cbf=tr(_0x19c295,{'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')});_0x319cbf&&(_0x19c295['preventDefault'](),'url'===_0x319cbf['type']?_0x56b5fc['addUrlToContext'](_0x319cbf['url']):_0x56b5fc['chatContext']['addFilesToContext'](_0x319cbf['files'],void 0x0,_0x319cbf['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x502898,_0x26bf86)=>{_0x26bf86['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x64c370,_0x390739)=>{this['activeConversation']?.['addResourceToContext'](_0x390739['source'],_0x390739['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x3287da,_0x26bca7)=>{this['_removeFromContext'](_0x26bca7);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x47a0be,_0x20851d)=>{this['activeConversation']?.['loadSourceResources'](_0x20851d['sourceId'],_0x20851d['query'],_0x20851d['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x1fe23e,_0x32e06b)=>{this['activeConversation']?.['setModel'](_0x32e06b);}),this['listenTo'](this['_aiChatUi'],'like',(_0x4dea1d,{replyId:_0x3680db})=>{console['log']('Liked\x20response',_0x3680db);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x13ef69,{replyId:_0x392f6d})=>{console['log']('Disliked\x20response',_0x392f6d);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0xda55ac,_0x5ea3df)=>{this['_insertSuggestion'](_0x5ea3df);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x1c4bfa,{replyId:_0x2975d3,partIndex:_0x2b9c6e})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x2975d3,_0x2b9c6e);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x51bc34,{replyId:_0x294333,partIndex:_0x5bf0ec})=>{const _0x3a9040=this['_getDocumentRangeForReplyChanges'](_0x294333,_0x5bf0ec);if(!_0x3a9040)return;const {reply:_0x2d4a58}=this['getInteractionAndReplyById'](_0x294333);'$graveyard'!=_0x3a9040['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x2d4a58['changeGroups'][_0x5bf0ec]['editor'],'ranges':[_0x3a9040['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x46fdc1,_0x1201bb)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x1201bb);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0xede437,{replyId:_0x1e1590,showDiff:_0x399d5e})=>{const {interaction:_0x5854a9,reply:_0x74833b}=this['getInteractionAndReplyById'](_0x1e1590),_0x1daef4=_0x74833b['getContentParts']({'showDiff':_0x399d5e});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x5854a9['id']+':'+_0x74833b['id'],'parts':_0x1daef4});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x3346e5,{replyId:_0x4b738b,partIndex:_0x22f591})=>{this['_rejectSuggestion']({'replyId':_0x4b738b,'partIndex':_0x22f591}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x3a8ee9,_0xd074e5)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0xd074e5);}),this['on']('replyCreated',(_0x107128,_0x4aeb6f)=>{this['_addFeedItemReply'](_0x4aeb6f);});}afterInit(){this['context']instanceof _0x5849ed?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x3db579,_0x197e68)=>{_0x197e68['on']('ready',()=>{this['_integrateEditor'](_0x197e68);});}),this['context']['config']['get']('ai.chat.context')?.['contextLibrary']?.['enabled']&&this['_setUpContextLibrarySource'](),this['_initConversation']();}async _initConversation(){const _0x3f8785=this['context']['config']['get']('ai.chat.initialConversation');let _0x3d12ed=_0x3f8785;('lastCreated'!=_0x3f8785||(_0x3d12ed=await this['_getLastCreatedConversationId'](),_0x3d12ed))&&('new'==_0x3d12ed?await this['_startConversationSafely']():await this['loadConversation'](_0x3d12ed));}async destroy(){return this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async loadConversation(_0x33d8cb){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'](_0x33d8cb)['getConversation'](),await this['_startConversationSafely']({'id':_0x33d8cb}),await this['activeConversation']['load'](_0x33d8cb),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext'](),this['set']('isConversationReady',!0x0),this['activeConversation']?.['currentInteraction']?this['_aiChatUi']['enableControls']():this['_aiChatUi']['toggleConversationLoading'](!0x1);}catch(_0x4d21fc){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x33d8cb}),this['_reporter']['logError'](new ct('ai-chat-conversation-not-found',this,void 0x0,_0x4d21fc),{'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(_0x24fd00){let _0x5af031=null,_0x44c904=null;this['on']('toolDataReceived',(_0x31f5f8,_0x12cd04,_0x2c9693)=>{_0x2c9693['id']!==_0x5af031&&(_0x5af031=_0x2c9693['id'],_0x44c904=this['_getAIChatFeedAPI'](_0x2c9693)),_0x24fd00(_0x12cd04,_0x44c904);});}addCurrentDocumentToChatContext(){bs(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](Es(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async addSelectionToChatContext(_0x26fc97){const _0x195ce7=this['_aiEditing']['getSelectionText'](_0x26fc97);this['activeConversation']?.['addSelectionToContext'](_0x195ce7),this['addCurrentDocumentToChatContext']();}removeSelectionFromChatContext(){this['activeConversation']?.['removeSelectionFromContext']();}focusPromptInput(){this['_aiChatUi']['focusPromptInput']();}async startConversation(_0x13569c){await this['_startConversationSafely']({'modelId':_0x13569c?.['modelId'],'contexts':_0x13569c?.['contexts']});}async['sendMessage']({message:_0x4a9d4c,attributes:_0x3c9ad3}){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':_0x4a9d4c,'attributes':_0x3c9ad3}));}getGroupId(){const _0x441893=this['context']['config']['get']('collaboration.channelId');if(!_0x441893)throw new ct('ai-missing-channel-id',this);return _0x441893;}_handleRemovedConversation(_0x579e95){this['activeConversation']['id']===_0x579e95&&this['_startConversationSafely']();}['_isGroupReadOnly'](_0x183595){return!(!_0x183595['editor']||'destroyed'===_0x183595['editor']['state']||!_0x183595['editor']['isReadOnly']);}_isGroupWriteable(_0xbec8b){return!(!_0xbec8b['editor']||'destroyed'===_0xbec8b['editor']['state']||_0xbec8b['editor']['isReadOnly']);}_computeSuggestionGating(_0xd290de){const _0x44f640=new Map();for(const _0x3aefcd of _0xd290de['changeGroups'])_0x44f640['set'](_0x3aefcd['index'],this['_isGroupReadOnly'](_0x3aefcd));const _0xbda434=new Set(_0xd290de['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']})['filter'](_0xb90707=>_0xb90707['hasChanges'])['map'](_0x430ade=>_0x430ade['index']));return{'readOnlyByIndex':_0x44f640,'isAcceptAllEnabled':_0xd290de['changeGroups']['some'](_0x2f6433=>'pending'===_0x2f6433['state']&&this['_isGroupWriteable'](_0x2f6433)&&_0xbda434['has'](_0x2f6433['index']))};}_refreshSuggestionGating(){if(this['activeConversation']){for(const _0x3ecbe6 of this['activeConversation']['interactions'])for(const _0x434c76 of _0x3ecbe6['replies'])'modification'===_0x434c76['type']&&this['_aiChatUi']['hasFeedItem'](_0x434c76['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x434c76['id'],this['_computeSuggestionGating'](_0x434c76));}if(this['_activeBalloon']&&this['_currentPreviewedChangeGroup']){const {reply:_0x4bb138}=this['getInteractionAndReplyById'](this['_currentPreviewedChangeGroup']['replyId']),_0x1a9a0f=_0x4bb138['changeGroups']['find'](_0x656865=>_0x656865['index']===this['_currentPreviewedChangeGroup']['partIndex']);_0x1a9a0f&&this['_activeBalloon']['setTargetReadOnly'](this['_isGroupReadOnly'](_0x1a9a0f));}}_prepareDocumentSuggestions(_0x46c1f0){const {reply:_0x1ce93d,interaction:_0x1dab11}=this['getInteractionAndReplyById'](_0x46c1f0['replyId']),_0x480c7d=void 0x0!==_0x46c1f0['partIndex']?[_0x1ce93d['changeGroups'][_0x46c1f0['partIndex']]]:_0x1ce93d['changeGroups']['filter'](_0x19336b=>'pending'===_0x19336b['state']&&!this['_isGroupReadOnly'](_0x19336b)),_0x4056c1=_0x480c7d['map'](_0x3115d7=>_0x1ce93d['changeGroups']['indexOf'](_0x3115d7)),_0x208351=qs(_0x1ce93d['changeGroups'],_0x1ce93d['documentContextContent']);return _0x4056c1['forEach'](_0x55ab42=>{if(_0x208351['has'](_0x55ab42))return;const _0x34252b=this['_getDocumentRangeForReplyChanges'](_0x46c1f0['replyId'],_0x55ab42);_0x34252b&&'$graveyard'!=_0x34252b['range']['root']['rootName']?(_0x1ce93d['setChangeGroupState'](_0x55ab42,'accepted'),void 0x0!==_0x46c1f0['partIndex']&&this['_scrollToSuggestionRange'](_0x34252b['range'],!0x1,_0x34252b['targetEditor'])):_0x1ce93d['setChangeGroupState'](_0x55ab42,'outdated',this['_getOutdatedReason'](_0x1ce93d['changeGroups'][_0x55ab42]));}),Zn({'groups':_0x480c7d['filter'](_0x2c015b=>'accepted'===_0x2c015b['state']),'documentContextContent':_0x1ce93d['documentContextContent'],'documents':_0x1dab11['getDocumentContext']()?.['documents']??[]});}_insertSuggestion(_0x51e341){const _0x3bfb74=this['context']['plugins']['get'](_0x1ba3e1),{reply:_0x15758b,interaction:_0x8d761a}=this['getInteractionAndReplyById'](_0x51e341['replyId']),_0x13bdd4=this['_prepareDocumentSuggestions'](_0x51e341),_0x53b481=Jn({'documentSuggestions':_0x13bdd4,'transform':!0x0,'documentCompare':_0x3bfb74,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0xf3faa7,_0x21a4d5]of _0x53b481){const {editor:_0x27982a,indexes:_0x2ea4df}=_0x13bdd4['get'](_0xf3faa7);if(!_0x27982a['plugins']['has']('TrackChanges')){St('ai-no-track-changes',{'editor':_0x27982a});continue;}let _0x48a266;mn(_0x21a4d5,'chat'),_0x27982a['model']['change'](_0x4bac4d=>{_0x48a266=_0x4bac4d['batch'],_0x27982a['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x21a4d5),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x48a266,{'interactionId':_0x8d761a['id'],'replyId':_0x15758b['id'],'indexes':_0x2ea4df});}this['_updateRatings'](_0x15758b);}_applySuggestion(_0x3a6e49){const _0x16eeb1=this['context']['plugins']['get'](_0x1ba3e1),{reply:_0xc9eae2,interaction:_0x2bbc64}=this['getInteractionAndReplyById'](_0x3a6e49['replyId']),_0x5bcbca=this['_prepareDocumentSuggestions'](_0x3a6e49),_0x449962=Jn({'documentSuggestions':_0x5bcbca,'transform':!0x0,'documentCompare':_0x16eeb1,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0x380671,_0x4eb337]of _0x449962){const {editor:_0x4e5a94,indexes:_0x20dd34}=_0x5bcbca['get'](_0x380671);let _0x2143b6;mn(_0x4eb337,'chat');try{_0x4e5a94['model']['change'](_0x842e4=>{_0x2143b6=_0x842e4['batch'],_0x16eeb1['applyOperations'](_0x842e4,_0x4eb337);}),this['_batchToChanges']['set'](_0x2143b6,{'interactionId':_0x2bbc64['id'],'replyId':_0xc9eae2['id'],'indexes':_0x20dd34});}catch(_0xaeb40f){throw this['_reporter']['logError'](new yn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0xaeb40f})),_0xaeb40f;}}this['_updateRatings'](_0xc9eae2);}_rejectSuggestion(_0x43a77d){const {reply:_0x9b79e4}=this['getInteractionAndReplyById'](_0x43a77d['replyId']);_0x9b79e4['setChangeGroupState'](_0x43a77d['partIndex'],'rejected');}['_openBalloonFor'](_0xa59a34,_0x2da0c9){if(!this['_hasAIChatBalloon'])return;const {reply:_0x18bc47}=this['getInteractionAndReplyById'](_0xa59a34),_0x3fe5d8=_0x18bc47['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x3fe5d8['length'])return;let _0x4e0821,_0x20c1f0;if(void 0x0!==_0x2da0c9?(_0x20c1f0=_0x3fe5d8['find'](_0x1cd0b3=>_0x1cd0b3['index']==_0x2da0c9),_0x4e0821=_0x20c1f0?.['index']):(_0x20c1f0=_0x3fe5d8[0x0],_0x4e0821=_0x20c1f0['index']),!_0x20c1f0)return void _0x18bc47['setChangeGroupState'](_0x2da0c9??0x0,'outdated','editor-removed');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0xa59a34&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x4e0821)return;const _0x1550af=this['_getUserPresentableContentPartDocumentRange'](_0xa59a34,_0x18bc47,_0x20c1f0),_0x3cf7ee=_0x18bc47['changeGroups']['find'](_0x1072d7=>_0x1072d7['index']==_0x4e0821),_0x16fa1e=_0x3cf7ee['editor'],_0x449574=_0x16fa1e['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x449574&&this['_activeBalloon']['close'](),!_0x1550af)return _0x449574['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x449574,this['_currentPreviewedChangeGroup']={'replyId':_0xa59a34,'partIndex':_0x4e0821},this['_scrollToSuggestionRange'](_0x1550af,!0x0,_0x16fa1e);const _0x254fd0=this['_getPresentableSiblingContentPartIndex'](_0xa59a34,_0x4e0821,'next');_0x449574['clearContent'](),_0x449574['updateContent']({'part':_0x20c1f0,'renderingStrategy':'static'}),_0x449574['open']({'index':_0x4e0821,'title':Es(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x4e0821+0x1)['toString']()),'showRotator':null!==_0x254fd0,'ranges':[_0x1550af],'areActionsDisabled':_0x18bc47['areActionsDisabled'],'targetEditor':_0x16fa1e,'isTargetReadOnly':this['_isGroupReadOnly'](_0x3cf7ee)}),_0x449574['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0xa59a34,_0x4e0821),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0xa59a34,'index':_0x4e0821,'isActive':!0x0});}_closeActiveBalloon(){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}_getPresentableSiblingContentPartIndex(_0x3bdd5d,_0x22385f,_0x13ee2e){const {reply:_0x120984}=this['getInteractionAndReplyById'](_0x3bdd5d),_0x4bbeff=_0x120984['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x4bbeff['length'])return null;const _0x440ee3='next'==_0x13ee2e?0x1:-0x1;function _0x24553a(_0x33a6dd){const _0x77f0b8=(_0x33a6dd+_0x440ee3+_0x4bbeff['length'])%_0x4bbeff['length'];return{'siblingIndex':_0x77f0b8,'siblingPart':_0x4bbeff[_0x77f0b8]};}const _0x1b058e=_0x4bbeff['findIndex'](_0x13f2f4=>_0x13f2f4['index']==_0x22385f);let {siblingIndex:_0x1ffea2,siblingPart:_0x3d3394}=_0x24553a(_0x1b058e);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x3bdd5d,_0x120984,_0x3d3394);)if({siblingIndex:_0x1ffea2,siblingPart:_0x3d3394}=_0x24553a(_0x1ffea2),_0x1ffea2===_0x1b058e)return null;return _0x3d3394['index'];}_getOutdatedReason(_0x50a1bf){return _0x50a1bf?.['editor']&&'destroyed'!==_0x50a1bf['editor']['state']?'content-removed':'editor-removed';}_getUserPresentableContentPartDocumentRange(_0x173d66,_0x2e85bd,_0x5cf204){const _0x225e73=_0x2e85bd['changeGroups'];if(!_0x5cf204['hasChanges'])return null;const _0x3813db=_0x225e73['find'](_0x1132c0=>_0x1132c0['index']==_0x5cf204['index']);if('pending'!==_0x3813db?.['state'])return null;if(!_0x3813db?.['editor']||'destroyed'===_0x3813db['editor']['state'])return _0x2e85bd['setChangeGroupState'](_0x5cf204['index'],'outdated',this['_getOutdatedReason'](_0x3813db)),null;const _0x29c404=this['_getDocumentRangeForReplyChanges'](_0x173d66,_0x5cf204['index']);if(!_0x29c404)return _0x2e85bd['setChangeGroupState'](_0x5cf204['index'],'outdated',this['_getOutdatedReason'](_0x3813db)),null;const {range:_0x5b66d5,currentIndex:_0x3f8cad}=_0x29c404;return'$graveyard'==_0x5b66d5['root']['rootName']?(_0x2e85bd['setChangeGroupState'](_0x3f8cad,'outdated',this['_getOutdatedReason'](_0x3813db)),null):_0x29c404['range'];}_getDocumentRangeForReplyChanges(_0xe8be4a,_0x479ad7){const {reply:_0x27f18f,interaction:_0x449144}=this['getInteractionAndReplyById'](_0xe8be4a),_0x239ad2=_0x27f18f['changeGroups']['filter'](_0x182e92=>'pending'==_0x182e92['state']),_0x2e6b26=_0x239ad2['map'](_0x1cf896=>_0x27f18f['changeGroups']['indexOf'](_0x1cf896));void 0x0===_0x479ad7&&(_0x479ad7=_0x2e6b26[0x0]);const _0x1b35f0=_0x2e6b26['indexOf'](_0x479ad7);if(-0x1==_0x1b35f0)return null;const _0x662e75=_0x239ad2[_0x1b35f0],_0x3fe746=_0x662e75['editor'];if(!_0x3fe746||'destroyed'===_0x3fe746['state'])return null;const _0x24172a=Gs(_0x3fe746,_0x662e75['rootName']),_0x25e2de=_0x27f18f['documentContextContent']['get'](_0x662e75['documentId']),_0x5afbc5=new _0x35b618([]),_0x508c15=new _0x35b618([]);for(const _0x565c47 of _0x662e75['changes'])if('removed'!=_0x565c47['type']&&_0x508c15['children']['push'](_0x565c47['node']['cloneNode'](!0x0)),'new'!=_0x565c47['type']){const _0x3f0895=_0x3aba21(_0x426fc9=>Ps(_0x426fc9,'data-id')==_0x565c47['id'],_0x25e2de,!0x0);_0x5afbc5['children']['push'](_0x3f0895['cloneNode'](!0x0));}if(0x0==_0x5afbc5['children']['length']){if(_0x662e75['changes'][0x0]['anchorId']){const _0x37bee8=vs('data-id',_0x662e75['changes'][0x0]['anchorId'],_0x25e2de);_0x5afbc5['children']['unshift'](_0x37bee8['cloneNode'](!0x0)),_0x508c15['children']['unshift'](_0x37bee8['cloneNode'](!0x0)),_0x37bee8['nextSibling']&&(_0x5afbc5['children']['push'](_0x37bee8['nextSibling']['cloneNode'](!0x0)),_0x508c15['children']['push'](_0x37bee8['nextSibling']['cloneNode'](!0x0)));}else{const _0x1ecd61=_0x25e2de['children'][0x0];if(!_0x1ecd61)return null;_0x5afbc5['children']['push'](_0x1ecd61['cloneNode'](!0x0)),_0x508c15['children']['push'](_0x1ecd61['cloneNode'](!0x0));}}if(_0x24172a&&qs(_0x27f18f['changeGroups'],_0x27f18f['documentContextContent'])['has'](_0x662e75['index']))return null;const _0x340640=_0x449144['getDocumentContext'](),_0x152d3f=_0x340640['documents']['find'](_0x506698=>_0x506698['id']==_0x662e75['documentId'])['content'],_0x493ed5=_0x3fe746['model']['document']['getRoot'](_0x662e75['rootName']),_0x16da30=_0x3fe746['data']['parse'](_0x152d3f,_0x493ed5),_0x5dbf11=_0x24172a?Ws(Os(_0x5afbc5)):Os(_0x5afbc5),_0x1a96e1=_0x3fe746['data']['parse'](_0x5dbf11,_0x493ed5),_0x2334db=_0x3fe746['data']['parse'](_0x5dbf11,_0x493ed5),_0x7f5619=_0x3fe746['model']['createPositionAt'](_0x1a96e1,0x0),_0x3e6844=_0x24172a?Ws(Os(_0x508c15)):Os(_0x508c15),_0x2a9916={'targetEditor':_0x3fe746,'anchor':_0x7f5619,'markDeletions':!0x1};let _0x4e6855;try{_0x4e6855=_0x3fe746['plugins']['get'](_0x1ba3e1)['getDiff'](_0x5dbf11,_0x3e6844,_0x2a9916)['getOperations']();}catch(_0x1851eb){return this['_reporter']['reportError'](new yn({'code':'ai-chat-suggestion-diff-failed','type':'runtime','severity':'warning','cause':_0x1851eb,'context':{'replyId':_0xe8be4a,'partIndex':_0x479ad7}})),null;}if(!_0x4e6855['length'])return null;_0x3fe746['model']['change'](_0x51ecb9=>{for(const _0x6c09e5 of _0x4e6855)if(!_0x2355a7(_0x6c09e5)){if('remove'==_0x6c09e5['type']){const _0x188fa1=_0x6c09e5['sourcePosition'],_0x33d74c=_0x6c09e5['howMany'],_0x692ae6=new _0x47f76a(_0x188fa1,_0x33d74c);_0x51ecb9['batch']['addOperation'](_0x692ae6),_0x3fe746['model']['applyOperation'](_0x692ae6);}else'marker'!==_0x6c09e5['type']&&(_0x6c09e5['baseVersion']=null,_0x6c09e5['isDocumentOperation']=!0x1,_0x51ecb9['batch']['addOperation'](_0x6c09e5),_0x3fe746['model']['applyOperation'](_0x6c09e5));}});const _0x565e2a=_n(_0x3fe746,_0x4e6855,_0x1a96e1);An(_0x3fe746['model'],_0x565e2a);const _0x2d52c9=_0x565e2a['getFirstRange']()['start']['path']['slice'](),_0xb562b=_0x565e2a['getFirstRange']()['end']['path']['slice'](),_0x176867=[];let _0x4ef6ff=_0x1a96e1,_0x2caf3a=_0x2334db;for(let _0x432e7f=0x0;_0x432e7f<_0xb562b['length'];_0x432e7f++){const _0x522d70=_0x4ef6ff['maxOffset']-_0xb562b[_0x432e7f];_0x176867[_0x432e7f]=_0x2caf3a['maxOffset']-_0x522d70,_0x4ef6ff=_0x4ef6ff['getChildAtOffset'](_0xb562b[_0x432e7f]),_0x2caf3a=_0x2caf3a['getChildAtOffset'](_0x176867[_0x432e7f]);}const _0x5356b5=_0x3fe746['model']['createRange'](_0x3fe746['model']['createPositionFromPath'](_0x2334db,_0x2d52c9),_0x3fe746['model']['createPositionFromPath'](_0x2334db,_0x176867)),_0x3ef662=_0x5356b5['start']['path']['slice'](),_0xe8751c=_0x5356b5['end']['path']['slice']();if(!_0x24172a){const _0x44c7c1=_0x2334db['getChild'](0x0)['getAttribute'](_0x27a049),_0x39ae00=Array['from'](_0x16da30['getChildren']())['find'](_0x34b6db=>_0x34b6db['getAttribute'](_0x27a049)==_0x44c7c1)['getPath']();_0x3ef662[0x0]=_0x39ae00[0x0]+_0x3ef662[0x0],_0xe8751c[0x0]=_0x39ae00[0x0]+_0xe8751c[0x0];}let _0x24d53e=_0x3fe746['model']['createRange'](_0x3fe746['model']['createPositionFromPath'](_0x3fe746['model']['document']['getRoot'](_0x662e75['rootName']),_0x3ef662),_0x3fe746['model']['createPositionFromPath'](_0x3fe746['model']['document']['getRoot'](_0x662e75['rootName']),_0xe8751c));const _0x1dc013=_0x340640['documents']['find'](_0x4af8b2=>_0x4af8b2['id']==_0x662e75['documentId'])['version'],_0x19d037=_0x3fe746['model']['document']['history']['getOperations'](_0x1dc013);for(const _0x4f2741 of _0x19d037)_0x24d53e=_0x5b86ed['_createFromRanges'](_0x24d53e['getTransformedByOperation'](_0x4f2741));return{'range':_0x24d53e,'currentIndex':_0x479ad7,'targetEditor':_0x3fe746};}_integrateEditorBalloon(_0x514309){if(!_0x514309['plugins']['has']('AIChatBalloon'))return;const _0x3099f3=_0x514309['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x3099f3['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x3099f3,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x1f3539,partIndex:_0x272987}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x5d08eb}=this['getInteractionAndReplyById'](_0x1f3539),_0x114a6c=_0x5d08eb['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x272987});_0x3099f3['updateContent']({'part':_0x114a6c[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x3099f3,'applySuggestion',()=>{const {replyId:_0x5160a4,partIndex:_0x32542d}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x5160a4,'partIndex':_0x32542d}),_0x3099f3['setState']('accepted');}),this['listenTo'](_0x3099f3,'insertSuggestion',()=>{const {replyId:_0x473db4,partIndex:_0x27bdba}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x473db4,'partIndex':_0x27bdba}),_0x3099f3['setState']('accepted');}),this['listenTo'](_0x3099f3,'rejectSuggestion',()=>{const {replyId:_0x5acfb3,partIndex:_0x44f922}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x5acfb3,'partIndex':_0x44f922}),_0x3099f3['setState']('rejected');}),this['listenTo'](_0x3099f3,'showNext',()=>{const {replyId:_0x33d11e,partIndex:_0x11bdb5}=this['_currentPreviewedChangeGroup'],_0x498b51=this['_getPresentableSiblingContentPartIndex'](_0x33d11e,_0x11bdb5,'next');null!==_0x498b51&&this['_openBalloonFor'](_0x33d11e,_0x498b51);}),this['listenTo'](_0x3099f3,'showPrevious',()=>{const {replyId:_0xeb6a84,partIndex:_0x13bd98}=this['_currentPreviewedChangeGroup'],_0x1c11b5=this['_getPresentableSiblingContentPartIndex'](_0xeb6a84,_0x13bd98,'previous');null!==_0x1c11b5&&this['_openBalloonFor'](_0xeb6a84,_0x1c11b5);}),this['listenTo'](_0x3099f3,'dialogClosed',(_0x30e028,{id:_0x20a4b7})=>{if('aiChatBalloon'!==_0x20a4b7)return;const {replyId:_0x487959,partIndex:_0x397e69}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x487959,'index':_0x397e69,'isActive':!0x1}),this['_activeBalloon']===_0x3099f3&&(this['_activeBalloon']=void 0x0);});}_integrateEditor(_0x52c8b6){if(this['_channelsToEditors']['set'](_0x52c8b6['config']['get']('collaboration.channelId'),_0x52c8b6),this['_integrateEditorBalloon'](_0x52c8b6),this['addCurrentDocumentToChatContext'](),this['listenTo'](_0x52c8b6,'change:isReadOnly',()=>this['_refreshSuggestionGating']()),_0x52c8b6['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x52c8b6['plugins']['has']('Undo')){const _0x13e9f5=_0x52c8b6['commands']['get']('undo'),_0x63ece7=_0x52c8b6['commands']['get']('redo');this['listenTo'](_0x13e9f5,'revert',(_0x1189d2,_0x518f7d,_0x53ec8b)=>{const _0x1f1097=this['_batchToChanges']['get'](_0x518f7d);if(!_0x1f1097)return;const _0x2566d5=this['activeConversation']['getInteraction'](_0x1f1097['interactionId']),_0x19a1c1=_0x2566d5?.['getReply'](_0x1f1097['replyId']);this['_batchToChanges']['delete'](_0x518f7d),_0x2566d5&&_0x19a1c1&&(_0x1f1097['indexes']['forEach'](_0x3e172e=>_0x19a1c1['setChangeGroupState'](_0x3e172e,'pending')),this['_batchToChanges']['set'](_0x53ec8b,_0x1f1097));}),this['listenTo'](_0x63ece7,'revert',(_0x3b052b,_0x459526,_0x301c5d)=>{const _0x146f69=this['_batchToChanges']['get'](_0x459526);if(!_0x146f69)return;const _0x104fad=this['activeConversation']['getInteraction'](_0x146f69['interactionId']),_0x4657d0=_0x104fad?.['getReply'](_0x146f69['replyId']);this['_batchToChanges']['delete'](_0x459526),_0x104fad&&_0x4657d0&&(_0x146f69['indexes']['forEach'](_0x2f20b0=>_0x4657d0['setChangeGroupState'](_0x2f20b0,'accepted')),this['_batchToChanges']['set'](_0x301c5d,_0x146f69));});}const _0x410c53=_0x52c8b6['config']['get']('ai.chat.context');_0x410c53['alwaysAddSelection']&&_0x410c53['document']['enabled']&&this['listenTo'](_0x52c8b6['model']['document']['selection'],'change:range',(_0x40f91f,_0x474dbe)=>{_0x474dbe['directChange']&&'chat'===_0x52c8b6['plugins']['get']('AITabs')['view']['activeTab']&&(_0x52c8b6['model']['hasContent'](_0x52c8b6['model']['document']['selection'])?this['addSelectionToChatContext'](_0x52c8b6):this['removeSelectionFromChatContext']());});}async _getLastCreatedConversationId(){const _0x1c3808=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x17bd4d=await _0x1c3808['getConversations']();return _0x17bd4d['length']?_0x17bd4d[0x0]['id']:'new';}catch(_0x33398b){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':_0x33398b})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async _startConversationSafely(_0x200c8b={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x200c8b),_0x200c8b['id']||this['set']('isConversationReady',!0x0);}catch(_0x279282){this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x200c8b['id']||kt()}),this['_reporter']['logError'](_0x279282),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}_detachFromActiveConversation(){this['_aiChatUi']['setIsUploadInProgress'](!0x1),this['activeConversation']&&this['stopListening'](this['activeConversation']);}async _handleStartConversation({id:_0x490782,modelId:_0x47b7c2,contexts:_0x48bde5}={}){this['_detachFromActiveConversation'](),this['_closeActiveBalloon']();let _0x181432=_0x47b7c2;_0x181432||(_0x490782||!this['activeConversation']?_0x181432=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x181432=this['activeConversation']['selectedModel']?.['id'])),this['_stopLastInteraction']();const _0x4f57a8=this['getGroupId'](),_0x3abc3b=_0x490782||kt(),_0x3dde28=await this['_aiModels']['getAvailableModels']();let _0x1a18c0;this['activeConversation']=new jn({'connector':this['_aiConnector'],'chatModels':this['_aiModels'],'selectedModelId':_0x181432,'conversationId':_0x3abc3b,'group':_0x4f57a8,'locale':this['context']['locale'],'isFromHistory':!!_0x490782,'channelsToEditors':this['_channelsToEditors'],'contextLibrary':this['_aiContextLibrary'],'extraContexts':_0x48bde5,'getSessionId':_0x3c685b=>this['_aiEditing']['getSessionId'](_0x3c685b),'aiEditing':this['_aiEditing']}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',()=>{this['_aiChatUi']['createConversation']({'availableModels':_0x3dde28}),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x490782||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x1ce0e9,_0x2e8b16)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x2e8b16['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x3d8bb7=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x3d8bb7);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x22b820=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x22b820);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x24b48d,_0x125487)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x125487,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x441cd8,_0x3037eb)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x3037eb,{'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',(_0x17032b,_0x428b3f)=>{this['_aiChatUi']['removeFeedInteraction'](_0x428b3f['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x31911a,_0x2f8a11,_0x24658f)=>{this['_updateConversationTitle'](_0x2f8a11,_0x24658f);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x3c3225,_0x327f1f)=>{void 0x0!==_0x1a18c0&&_0x1a18c0!==_0x327f1f['id']&&this['_updateReplyContentThrottled']['flush'](),_0x1a18c0=_0x327f1f['id'],_0x327f1f['isFromHistory']?await this['_updateReplyContent']({'reply':_0x327f1f}):await this['_updateReplyContentThrottled']({'reply':_0x327f1f});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0xf8eb83,{reply:_0x67e0b9,index:_0x14704d,state:_0x33ce71,outdatedReason:_0x15fb25})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x67e0b9['id'],'index':_0x14704d,'state':_0x33ce71,'outdatedReason':_0x15fb25}),this['_aiChatUi']['hasFeedItem'](_0x67e0b9['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x67e0b9['id'],this['_computeSuggestionGating'](_0x67e0b9)),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x67e0b9['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x14704d&&this['_activeBalloon']?.['setState'](_0x33ce71,_0x15fb25);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x45bfac,_0x2cc4a8)=>{if(this['_aiChatUi']['addContextItem'](_0x2cc4a8['contextItem'],_0x2cc4a8['isLoading']),'selection'===_0x2cc4a8['contextItem']['type']){const _0x3b965c=Ss(this['context']),_0x1ae830=[..._0x3b965c['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x3b965c,'ranges':_0x1ae830,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x23be41,_0x2c738e)=>{this['_aiChatUi']['removeContextItem'](_0x2c738e['uiId']),'current-document'==_0x2c738e['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x2c738e['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x485c06,_0xd575c3)=>{this['_aiChatUi']['setContextItemLoading'](_0xd575c3['contextItem']['uiId'],_0xd575c3['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x4887d5,_0x2ae0f6)=>{this['_aiChatUi']['setConversationContext'](_0x2ae0f6['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x582cf7,_0x3991e3)=>{this['_aiChatUi']['setAddContextOptions'](_0x3991e3['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x5999c3,_0x54d3bb)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x54d3bb['sourceId'],_0x54d3bb['source'],_0x54d3bb['resources'],_0x54d3bb['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x21a2df,_0x2c74ea)=>{this['_aiChatUi']['updateResourceState'](_0x2c74ea['sourceId'],_0x2c74ea['resourceId'],_0x2c74ea['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x4b604a,_0x4c3467)=>{this['_aiChatUi']['updateCapabilities'](_0x4c3467);}),this['listenTo'](this['activeConversation'],'modelSelected',(_0x9f63f4,_0x3395e8)=>{this['_aiChatUi']['setSelectedModel'](_0x3395e8['selectedModel']??null,_0x3395e8['isDisabled']);}),this['listenTo'](this['activeConversation'],'error',async(_0x46160c,{error:_0x249552,interactionId:_0x3033b0,fileName:_0x321b80,url:_0x21f881,sourceId:_0x550de4,sourceLabel:_0x39bcdd})=>{let _0x4c75f8;const _0x52ef66=_0x3033b0?_0x3033b0+':'+kt():kt();this['_reporter']['reportError'](_0x249552),this['_aiChatUi']['startAutoScroll'](),_0x249552['message']['startsWith']('ai-request-aborted')?(this['_cancelProcessing'](),this['activeConversation']?.['cancelLastInteractionStream'](),_0x4c75f8=this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Es(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x52ef66})):_0x249552['message']['startsWith']('ai-chat-conversation-init-failed')||_0x249552['message']['startsWith']('ai-chat-conversation-start-failed')?_0x4c75f8=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x52ef66}):_0x249552['message']['startsWith']('ai-chat-file-upload-failed')?_0x4c75f8=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x321b80),'id':_0x52ef66}):_0x249552['message']['startsWith']('ai-chat-url-upload-failed')?_0x4c75f8=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x21f881),'id':_0x52ef66}):_0x249552['message']['startsWith']('ai-chat-context-invalid-data')?_0x4c75f8=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x52ef66}):_0x249552['message']['startsWith']('ai-chat-context-unsupported-type')?_0x4c75f8=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x52ef66}):_0x249552['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x550de4&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x550de4),_0x4c75f8=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x39bcdd||'source'),'id':_0x52ef66})):_0x249552['message']['startsWith']('ai-chat-resource-load-failed')?_0x4c75f8=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x52ef66}):_0x249552['message']['startsWith']('ai-chat-invalid-request')?_0x4c75f8=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x52ef66}):_0x249552['message']['startsWith']('ai-chat-context-unsupported-file-type')?_0x4c75f8=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x52ef66}):_0x249552['message']['startsWith']('ai-chat-context-file-too-large')?_0x4c75f8=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x52ef66}):_0x249552['message']['startsWith']('ai-chat-context-file-too-many-pages')?_0x4c75f8=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x52ef66}):_0x249552['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?_0x4c75f8=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x52ef66}):(this['_cancelProcessing'](),_0x4c75f8=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x52ef66}));try{await Promise['race']([_0x4c75f8,this['_aiChatUi']['idleUiPromise']]);}finally{this['_aiChatUi']['isBusy']||this['_aiChatUi']['stopAutoScroll']();}}),await this['activeConversation']['init'](this['_buildConversationContextConfig']()),_0x490782||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']());}_buildConversationContextConfig(){const _0x2dd0c9=this['context']['config']['get']('ai.chat.context');return this['_contextLibrarySource']?{..._0x2dd0c9,'sources':[..._0x2dd0c9?.['sources']??[],this['_contextLibrarySource']]}:_0x2dd0c9;}async _setUpContextLibrarySource(){const _0x9248e1=await this['_createContextLibrarySource']();_0x9248e1&&(this['_contextLibrarySource']=_0x9248e1,this['activeConversation']&&this['activeConversation']['chatContext']['addContextSource'](_0x9248e1));}async _createContextLibrarySource(){let _0x3d5dfa;try{_0x3d5dfa=await this['_aiContextLibrary']['getAvailableContexts']();}catch{return null;}if(!_0x3d5dfa['length'])return null;const _0x4e46b9=_0x3d5dfa['map'](_0x16f36e=>({'id':_0x16f36e['id'],'type':'context','label':_0x16f36e['name']||_0x16f36e['id']}));return{'id':'ck-ai-context-library','label':Es(this['context']['locale'],'AI_CHAT_CONTEXT_LIBRARY_LABEL'),'useDefaultFiltering':!0x0,'getResources':()=>Promise['resolve'](_0x4e46b9)};}_removeFromContext(_0x540cfc){this['activeConversation']?.['removeFromContext'](_0x540cfc);}_toggleWebSearch(){this['activeConversation']?.['toggleWebSearch']();}_toggleReasoning(){this['activeConversation']?.['toggleReasoning']();}getInteractionAndReplyById(_0x3f4b87){const [_0x56a6b3,_0x501ebe]=_0x3f4b87['split'](':'),_0x26d621=this['activeConversation']['getInteraction'](_0x56a6b3);return{'interaction':_0x26d621,'reply':_0x26d621['getReply'](_0x501ebe)};}_scrollToSuggestionRange(_0x22b644,_0x279b03=!0x1,_0x34994a){const _0x4ce015={'target':_0x34994a['editing']['view']['domConverter']['viewRangeToDom'](_0x34994a['editing']['mapper']['toViewRange'](_0x22b644)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x279b03};_0x279b03&&(_0x4ce015['alignToTop']=!0x0),Ot(_0x4ce015);}_updateConversationTitle(_0x2e5dd5,_0x4a5f97=!0x1){this['_aiChatUi']['setConversationTitle'](_0x2e5dd5||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x4a5f97);}_addFeedItemReply(_0x4b8110){'text'===_0x4b8110['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x4b8110):this['_aiChatUi']['addFeedItemAISuggestion'](_0x4b8110);}async _updateReplyContent({reply:_0x17b38b,renderingStrategy:_0x4bf0fa}){const {id:_0x50fd02,interactionId:_0x44ee8d,isDone:_0x486323,type:_0x42242d,parsedContent:_0x13a8ef}=_0x17b38b,_0x8ce4a5=_0x44ee8d+':'+_0x50fd02;if('modification'===_0x42242d){const _0x50a9d6=_0x17b38b['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x8ce4a5,'parts':_0x50a9d6,'isDone':_0x486323,'skipLoadingEffects':_0x17b38b['isFromHistory']}),this['_aiChatUi']['hasFeedItem'](_0x17b38b['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x17b38b['id'],this['_computeSuggestionGating'](_0x17b38b));}else'text'===_0x42242d&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x8ce4a5,'parsedContent':_0x13a8ef['get']('text'),'renderingStrategy':_0x4bf0fa,'isDone':_0x486323});_0x486323&&_0x17b38b['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x8ce4a5,_0x17b38b['sources']);}_updateReplyContentThrottled=_0xe640af(this['_updateReplyContent']['bind'](this),0xc8);_stopLastInteraction(){this['activeConversation']?.['stopProcessing'](),this['_aiChatUi']['stopInteraction'](this['activeConversation']?.['lastInteraction']),this['_updateReplyContentThrottled']['cancel']();}async _flushLastInteractionUI(){const _0xc6a479=this['activeConversation']?.['lastInteraction'];if(_0xc6a479){for await(const _0x17f238 of _0xc6a479['replies'])this['_aiChatUi']['hasFeedItem'](_0x17f238['id'])||this['_addFeedItemReply'](_0x17f238),await this['_updateReplyContent']({'reply':_0x17f238,'renderingStrategy':'static'});}}async['_cancelProcessing'](){this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext']();}_updateRatings(_0x18f18f){const _0x37cdc6={'positiveCount':_0x18f18f['changeGroups']['filter'](_0x331ea9=>'accepted'===_0x331ea9['state'])['length'],'totalCount':_0x18f18f['changeGroups']['length'],'modificationId':_0x18f18f['id']},_0x28da6e=this['activeConversation']['getInteraction'](_0x18f18f['interactionId'])['messageId'];_0x28da6e&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x28da6e,_0x37cdc6);}_getAIChatFeedAPI(_0x186d4f){const _0x6bfae5=this['_aiChatUi'],_0x5e5940=()=>{_0x186d4f['resetWebSearchState'](),_0x186d4f['resetReasoningState'](),_0x6bfae5['clearLoadingMessage']();},_0x25ac3d=()=>{_0x186d4f['currentReply']&&(_0x186d4f['currentReply']['done'](),_0x186d4f['currentReply']=void 0x0);};return{'insertTextReply':(_0x377ed0,_0xc3edde)=>{_0x25ac3d(),_0x5e5940();const _0x3f2e38=_0x186d4f['currentReply']=_0x186d4f['createReply']({'type':'text','interactionId':_0x186d4f['id'],'id':_0xc3edde||kt(),'channelsToEditors':this['_channelsToEditors']});return _0x3f2e38['appendContent'](_0x377ed0),_0x25ac3d(),_0x3f2e38;},'insertCustomElement':async(_0x465eac,_0x3ccc80)=>(_0x25ac3d(),_0x5e5940(),_0x6bfae5['addFeedItemCustomElement'](_0x465eac,_0x3ccc80||kt())),'setLoadingMessage':_0x1d79c2=>{_0x6bfae5['setLoadingMessage'](_0x1d79c2);},'clearLoadingMessage':()=>{_0x6bfae5['clearLoadingMessage']();}};}_checkRemoveCurrentDocumentFromChatContext(){bs(this['context'])['find'](_0x520c36=>'destroyed'!==_0x520c36['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(_0x4a86c6){const _0x5dc554=new AbortController();return{'promise':new Promise((_0x288f31,_0x227631)=>{const _0x28452d=setTimeout(_0x288f31,_0x4a86c6);_0x5dc554['signal']['addEventListener']('abort',()=>{clearTimeout(_0x28452d),_0x227631();});}),'abortController':_0x5dc554};}var rr=class{options;isStreaming=!0x1;document=null;nodesList=[];currentIndex=0x0;timeoutAbortController=null;lastUpdateTime=0x0;constructor(_0x5281d7){this['options']={'delay':_0x5281d7?.['delay']??0xa,'textNodeStyle':_0x5281d7?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async stream({document:_0x55a42e,targetElement:_0x1c93ec,abortSignal:_0x46148a}){this['isStreaming']&&this['stop'](),_0x46148a?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x538a60(_0x55a42e,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x309bdf=0x0;_0x309bdf<this['currentIndex'];_0x309bdf++)this['nodesList'][_0x309bdf]['shouldBeStreamed']=!0x0;do{const _0x34a175=Date['now'](),_0x1e88a2=this['nodesList'][this['currentIndex']],_0x51527e=_0x34a175-this['lastUpdateTime'];if(_0x1e88a2){_0x1e88a2['shouldBeStreamed']=!0x0;let _0x344e23=_0x1e88a2['parent'];for(;_0x344e23;)_0x344e23['shouldBeStreamed']=!0x0,_0x344e23=_0x344e23['parent'];}if(_0x51527e<this['options']['delay'])try{const {promise:_0x36a4fa,abortController:_0x18e6f3}=nr(this['options']['delay']-_0x51527e);this['timeoutAbortController']=_0x18e6f3,await _0x36a4fa;}catch(_0x22a738){return;}_0x5a6357(_0x1c93ec,'<'+_0x1c93ec['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x1c93ec['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:_0x34c4cd}){Array['from'](_0x34c4cd['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x316495=>{_0x316495['replaceWith'](_0x316495['childNodes'][0x0]);});}stop(){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x37d09e){let _0x2b227f='';if(function(_0x17b125){return _0x5b65c1(_0x17b125);}(_0x37d09e)){for(const _0x17404a of _0x37d09e['children'])_0x2b227f+=this['renderNode'](_0x17404a);}else{if(hr(_0x37d09e)){if(!_0x37d09e['shouldBeStreamed'])return'';const _0x504066=_0x37d09e,_0xb2520=Object['entries'](_0x504066['attribs'])['map'](([_0x1a7d6b,_0x59bb73])=>_0x1a7d6b+'=\x22'+_0x59bb73+'\x22')['join']('\x20');_0x2b227f+='<'+_0x504066['tagName']+(_0xb2520?'\x20'+_0xb2520:'')+'>';for(const _0x52deae of _0x346c46(_0x504066))_0x2b227f+=this['renderNode'](_0x52deae);_0x2b227f+='</'+_0x504066['tagName']+'>';}else{if(!ar(_0x37d09e))return'';if(!_0x37d09e['shouldBeStreamed'])return'';!function(_0x13a363){return!(!_0x13a363['parent']||!hr(_0x13a363['parent']))&&(!!or['includes'](_0x13a363['parent']['tagName'])&&!_0x4dee2d(_0x13a363)['match'](/^\s*[<>]\s*$/));}(_0x37d09e)?_0x2b227f+=_0xa920ee(_0x37d09e):_0x2b227f+=_0xa920ee(new _0x122249('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x37d09e]));}}return _0x2b227f;}getParsedDocumentNodeList(){const _0x1e9af7=[];return function(_0x449b9b,_0x37811d){const _0x51d113=_0x13a975=>{if(_0x37811d(_0x13a975),_0x13a975 instanceof _0x370d1e)for(let _0x53f68b=0x0;_0x53f68b<_0x13a975['children']['length'];_0x53f68b++){const _0x1c495b=_0x13a975['children'][_0x53f68b];_0x51d113(_0x1c495b);}};for(let _0x40ae5b=0x0;_0x40ae5b<_0x449b9b['children']['length'];_0x40ae5b++)_0x51d113(_0x449b9b['children'][_0x40ae5b]);}(this['document'],_0xf2c633=>{if(ar(_0xf2c633)){const _0x121c48=this['splitTextNodeIntoWordNodes'](_0xf2c633);_0x121c48['length']&&_0x1e9af7['push'](..._0x121c48);}_0xf2c633['isWordSplitSource']||_0xf2c633['isWordSplitResult']||_0x1e9af7['push'](_0xf2c633);}),_0x1e9af7;}splitTextNodeIntoWordNodes(_0xa1a27b){if(_0xa1a27b['isWordSplitSource']||_0xa1a27b['isWordSplitResult'])return[];const _0x3610d5=_0x4dee2d(_0xa1a27b)['match'](/(?:\s*\S+\s*)/g),_0x2270e5=[];if(_0x3610d5&&_0x3610d5['length']>0x1){for(const _0x36560a of _0x3610d5){const _0x59a052=new _0x36754e(_0x36560a);_0x59a052['isWordSplitResult']=!0x0,ti(_0xa1a27b,_0x59a052),_0x2270e5['push'](_0x59a052);}_0xa1a27b['isWordSplitSource']=!0x0,_0x5c7bf0(_0xa1a27b);}return _0x2270e5;}};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(_0x4889c8){return _0x4d4881(_0x4889c8);}function hr(_0x533629){return _0x40b07f(_0x533629);}function cr(_0x398007,_0x117d7d){_0x398007['cleanUpAnimations']({'targetElement':_0x117d7d}),_0x117d7d['querySelectorAll']('[data-id]')['forEach'](_0xc54332=>{_0xc54332['removeAttribute']('data-id');});}var lr=class extends _0x414492{options;content='';htmlStreamer;['children'];constructor(_0x45c936){super();const _0x1e403d=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new rr(),this['options']=_0x45c936,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x1e403d['if']('isDone','ck-ai-chat__feed__item_done'),_0x1e403d['if']('isVisible','ck-hidden',_0x1d9054=>!_0x1d9054),'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(_0x3c1ba7,_0x506ee8,_0x11d127){await this['htmlStreamer']['stream']({'document':_0x3c1ba7,'targetElement':_0x506ee8,'abortSignal':_0x11d127});}},ur=class extends _0x414492{['showChangesToggleView'];constructor(_0x738c6a,_0x1e10f6){super(_0x738c6a),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new dr(_0x738c6a),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Dn,'label':Es(_0x738c6a,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x1e10f6['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x39c716=>_0x39c716?it:et),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x14eb9a=new $t();_0x14eb9a['content']=_0x1e6b58,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x1e10f6['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x14eb9a,{'tag':'span','children':[Es(_0x738c6a,'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':_0x32ea05,'rejected':_0x40a4cb,'outdated':_0x3dfa46};var gr=class extends _0x414492{statePillView;constructor(_0xc7cc1d){super(_0xc7cc1d);const _0x52dfb8=this['bindTemplate'];this['set']('state','accepted'),this['set']('outdatedReason',void 0x0),this['set']('isVisible',!0x0),this['statePillView']=new _0x5b4e2e(_0xc7cc1d),this['statePillView']['bind']('label')['to'](this,'state',_0x4c7cc6=>function(_0x316dca,_0x48c3f1){return Es(_0x316dca,'AI_SUGGESTION_CONTENT_PART_STATE_'+_0x48c3f1['toUpperCase']());}(_0xc7cc1d,_0x4c7cc6)),this['statePillView']['bind']('icon')['to'](this,'state',_0xa9c3ac=>_r[_0xa9c3ac]),this['statePillView']['bind']('class')['to'](this,'state',_0x3a3038=>'ck-pill_'+_0x3a3038),this['statePillView']['bind']('tooltip')['to'](this,'state',this,'outdatedReason',(_0x3e27e8,_0x297ab4)=>function(_0x392e19,_0x251f47,_0x488478){if('outdated'!==_0x251f47)return;return Es(_0x392e19,_0x488478?Ar[_0x488478]:'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP');}(_0xc7cc1d,_0x3e27e8,_0x297ab4)),this['statePillView']['tooltipPosition']='s',this['statePillView']['tooltipClass']='ck-tooltip_multi-line',this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x52dfb8['if']('isVisible','ck-hidden',_0x2cbee9=>!_0x2cbee9)]},'children':[this['statePillView']]});}setState(_0x5ebb06,_0x54d8c0){this['state']=_0x5ebb06,this['outdatedReason']='outdated'===_0x5ebb06?_0x54d8c0: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 _0x258303{_applyButton;_suggestButton;constructor(_0x40e2f4,_0x47ea8d,_0x2c10cc){super(_0x40e2f4);const _0x200aab=Boolean(_0x2c10cc);this['set']('isEnabled',!_0x200aab),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x4cac52=[];if(!_0x200aab){_0x47ea8d['includes']('applySuggestion')&&(this['_applyButton']=new Mt(_0x40e2f4),this['_applyButton']['set']({'label':Es(_0x40e2f4,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x57df96}),this['_applyButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0x2b6d0a,_0x26627d)=>_0x2b6d0a&&!_0x26627d),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x46b8b3=>!_0x46b8b3),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x4cac52['push'](this['_applyButton'])),_0x47ea8d['includes']('insertSuggestion')&&(this['_suggestButton']=new Mt(_0x40e2f4),this['_suggestButton']['set']({'label':Es(_0x40e2f4,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x2b88d0}),this['_suggestButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0x924633,_0x2d27d8)=>_0x924633&&!_0x2d27d8),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x4cac52['push'](this['_suggestButton']));const _0x29136b=new Mt(_0x40e2f4);_0x29136b['set']({'label':Es(_0x40e2f4,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x3edf99}),_0x29136b['bind']('isEnabled')['to'](this),_0x29136b['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x4cac52['push'](_0x29136b);}this['items']['addMany'](_0x4cac52);const _0x2f41f2=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x2f41f2['if']('isVisible','ck-hidden',_0xd1aca8=>!_0xd1aca8)]}});}setButtonsVisibility({showApplyButton:_0x3d0913,showSuggestButton:_0x43e033}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x3d0913),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x43e033);}},pr=class extends _0x414492{toolbarView;stateView;titleLabelView;['children'];constructor(_0x30141e,{part:_0x258a24,uiIndex:_0x1ce497,availableActions:_0x3dda23,areActionsDisabled:_0x5030cf}){super(_0x30141e),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['toolbarView']=new Ir(_0x30141e,_0x3dda23,_0x5030cf),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x258a24['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x258a24['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x258a24['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn','isTargetReadOnly')['to'](this),this['stateView']=new gr(_0x30141e),this['titleLabelView']=new Er(_0x30141e,_0x1ce497),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',(_0x335438,_0x4db0d4,_0x3a0005,_0xa53550)=>{'pending'===_0xa53550?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x3a0005?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x3a0005,this['outdatedReason']),this['children']['add'](this['stateView']));});}},Er=class extends _0x414492{constructor(_0x255e06,_0x30b3ae){super(_0x255e06),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Es(_0x255e06,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x30b3ae['toString']())]});}},mr=class extends _0x414492{htmlStreamer;constructor(_0x29f76b){super(_0x29f76b),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:_0x109809,renderingStrategy:_0x7c4b5a,abortSignal:_0x5b88d1}){this['_ensureHostElementTag'](_0x109809['wrapperTag']||'div');const _0x5edef4=_0x538a60(_0x109809['content'],!0x0);for(const _0x7f151f of ys(_0x5edef4))_0x5c7bf0(_0x7f151f);'streaming'===_0x7c4b5a?await this['htmlStreamer']['stream']({'document':_0x5edef4,'targetElement':this['element'],'abortSignal':_0x5b88d1}):_0x5a6357(this['element'],'<'+this['element']['tagName']+'>'+Os(_0x5edef4)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}cleanUpStreamingArtifacts(){cr(this['htmlStreamer'],this['element']);}_ensureHostElementTag(_0x1311d8){if(!this['element']||this['element']['tagName']['toLowerCase']()===_0x1311d8)return;const _0x356e34=new _0x262be9({'tag':_0x1311d8,'attributes':{'class':this['element']['className']}})['render']();this['element']['replaceWith'](_0x356e34),this['element']=_0x356e34;}},Tr=class extends _0x414492{['_children'];['_headerView'];_streamableContentView;constructor(_0x2afdbb,{part:_0x4743e6,uiIndex:_0x1c4585,areActionsDisabled:_0x57e90b,availableActions:_0x2020c2}){super(_0x2afdbb);const _0x238e8f=this['bindTemplate'];this['set']('state',_0x4743e6['state']),this['set']('outdatedReason',_0x4743e6['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 _0x578e73=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x57e90b;};this['on']('change:state',_0x578e73),this['on']('change:isDone',_0x578e73),_0x578e73(),this['_children']=this['createCollection'](),this['_headerView']=new pr(_0x2afdbb,{'part':_0x4743e6,'uiIndex':_0x1c4585,'availableActions':_0x2020c2,'areActionsDisabled':_0x57e90b}),this['_headerView']['bind']('isEnabled','outdatedReason','state','isTrackChangesOn','isTargetReadOnly')['to'](this),this['_headerView']['delegate'](...ir)['to'](this),this['_streamableContentView']=new mr(_0x2afdbb),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x238e8f['to']('state',_0x411f58=>'ck-ai-suggestion__body__content-part_'+_0x411f58),_0x238e8f['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x238e8f['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x238e8f['if']('isVisible','ck-hidden',_0x552948=>!_0x552948)]},'children':this['_children'],'on':{'mouseenter':_0x238e8f['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x4743e6['index']});}),'mouseleave':_0x238e8f['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x4743e6['index']});}),'click':_0x238e8f['to'](_0x2ff2c9=>{const _0x25a489=_0x2ff2c9['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x25a489)&&this['fire']('showChangeInText',{'index':_0x4743e6['index']});})}});}async updateContent({part:_0x2b1d5b,showUnchangedParts:_0x3aa939=!0x1,abortSignal:_0x4755c5}){this['partDefinition']=_0x2b1d5b,this['isVisible']=this['partDefinition']['hasChanges']||_0x3aa939,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x2b1d5b,'renderingStrategy':'static','abortSignal':_0x4755c5});}['markAsDone'](){this['isDone']=!0x0;}},wr=class extends _0x414492{constructor(_0x11b1e5,_0xf72fc5){super(_0x11b1e5),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x480e4a=>!_0x480e4a)]},'children':this['_createSkeletonItems'](_0xf72fc5)});}_createSkeletonItems(_0x18fbb8){const _0x552ec9=['ck','ck-ai-skeleton__item'];return _0x18fbb8['map'](_0x507ff0=>{let _0x360b1f='';switch(_0x507ff0['attributes']['align']){case'right':_0x360b1f='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x360b1f='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x360b1f='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x507ff0['tag'],'attributes':{'class':[..._0x552ec9,_0x507ff0['attributes']['class']?_0x507ff0['attributes']['class']:''],'style':'width:\x20'+_0x507ff0['attributes']['width']+';\x20height:\x20'+_0x507ff0['attributes']['height']+';'+_0x360b1f}};});}};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(_0x1d7b08,_0xb9631b,_0x429bb8,_0x329f5e){return new Array(_0x1d7b08)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0xb9631b,'height':_0x429bb8,'align':_0x329f5e}}));}const br=/* #__PURE__ -- @preserve */
|
|
33
|
-
dt();var Sr=class extends br{['queue']=[];['isProcessing']=!0x1;_abortController;async['enqueue'](_0x98557){const _0x18eaf1=this['createTask'](_0x98557);return this['queue']['push'](_0x18eaf1),this['_processQueue'](),_0x18eaf1['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(_0x4816d5=>{this['once']('_queueEmpty',()=>{_0x4816d5();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x20ce06=this['queue']['shift']();try{await _0x20ce06['callback'](this['_abortController']['signal']),_0x20ce06['resolve']();}catch(_0x550334){_0x20ce06['reject'](_0x550334);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}createTask(_0x56f7a0){let _0x253722,_0x4f09b0;const _0x27e57f=new Promise((_0x468a4f,_0x1e918b)=>{_0x253722=_0x468a4f,_0x4f09b0=_0x1e918b;});return{'callback':_0x56f7a0,'resolve':_0x253722,'reject':_0x4f09b0,'completePromise':_0x27e57f};}},Rr=class extends lr{constructor(_0x5164a8){super(_0x5164a8),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x5164a8['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}setContent(_0x585e20){this['element']['innerHTML']=_0x585e20;}};const Or=['applySuggestion','insertSuggestion'];var vr=class extends _0x414492{_applyChangesButton;_insertSuggestionsButton;['children'];constructor(_0x52a8fc,_0x5ecad5=[...Or],_0x1967eb){super(_0x52a8fc);const _0xa0947a=this['bindTemplate'],_0x14d468=Boolean(_0x1967eb);this['set']('isEnabled',!_0x14d468),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x14d468||(this['_applyChangesButton']=new Mt(_0x52a8fc),this['_applyChangesButton']['set']({'label':Es(_0x52a8fc,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x5ecad5['includes']('applySuggestion'),'class':Ln}),this['_insertSuggestionsButton']=new Mt(_0x52a8fc),this['_insertSuggestionsButton']['set']({'label':Es(_0x52a8fc,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x5ecad5['includes']('insertSuggestion'),'class':Pn}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x296508=>{_0x296508['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',_0xa0947a['if']('isVisible','ck-hidden',_0x519e44=>!_0x519e44)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}updateVisibility(_0x5175d8){this['isVisible']=_0x5175d8;}_switchButtonLabelsPlurality(_0x4fda76){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x4fda76?(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 _0x414492{['children'];['balloonPanelView'];bodyCollection;constructor(_0x10503e,_0x4e97ae){super(_0x10503e),this['bodyCollection']=_0x4e97ae,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',_0x50715e=>!_0x50715e)]},'children':this['children']});const _0x12461a=new _0x414492(this['locale']),_0x33e863=new $t();_0x33e863['content']=ht,_0x12461a['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x33e863,{'tag':'span','children':[{'text':Es(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x12461a),this['_setupBalloonPanel'](_0x10503e);}['addSource'](_0x672225){this['children']['add'](new yr(this['locale'],_0x672225,this['balloonPanelView']));}_setupBalloonPanel(_0x51c62d){this['balloonPanelView']=new xt(_0x51c62d),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},yr=class extends Mt{['balloonPanelView'];['source'];constructor(_0x4ca2a,_0x20a835,_0x4cc028){super(_0x4ca2a),this['source']=_0x20a835,this['balloonPanelView']=_0x4cc028,this['set']({'label':_0x20a835['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0xf1c37d=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0xf1c37d['to'](()=>{window['open'](_0x20a835['url'],'_blank');}),'mouseenter':_0xf1c37d['to'](()=>{this['_showTooltip']();}),'mouseleave':_0xf1c37d['to'](()=>{this['_hideTooltip']();})}}),_0x20a835['favicon']){const _0x2c2faa=new _0x414492(_0x4ca2a);_0x2c2faa['setTemplate']({'tag':'img','attributes':{'src':_0x20a835['favicon']||ht,'alt':_0x20a835['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x2c2faa);}else this['set']('icon',ht);}_createTooltipContentView(_0x2157d7,_0x2ea1da){const _0x49c9b4=new _0x414492(_0x2157d7),_0x4ce37c=[];let _0x3a7280;_0x2ea1da?.['favicon']?(_0x3a7280=new _0x414492(_0x2157d7),_0x3a7280['setTemplate']({'tag':'img','attributes':{'src':_0x2ea1da['favicon'],'alt':_0x2ea1da['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x3a7280=new $t(),_0x3a7280['content']=ht,_0x3a7280['extendTemplate']({'attributes':{'alt':_0x2ea1da['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x4ce37c['push'](_0x3a7280);const _0x2286d6=new _0x414492(_0x2157d7);_0x2286d6['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x2ea1da['url']},'children':[{'text':new URL(_0x2ea1da['url'])?.['hostname']}]}),_0x4ce37c['push'](_0x2286d6);const _0x14f11b=new _0x414492(_0x2157d7);_0x14f11b['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x4ce37c});const _0x1172be=new _0x414492(_0x2157d7);return _0x1172be['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x2ea1da['title']['length']>0x190?_0x2ea1da['title']['substring'](0x0,0x190)+'...':_0x2ea1da['title']}]}),_0x49c9b4['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x14f11b,_0x1172be]}),_0x49c9b4;}_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 _0xb0a35e=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0xb0a35e);}},Nr=class extends _0x414492{_actionsView;['_readOnlyByIndex']=new Map();['_sourcesView'];['_children'];_skeletonView;_showSkeletonDebounced=_0x1bbda5(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);_skeletonShownAt=null;_areActionsDisabled;_showUnchangedParts;_updateContentPartsPromiseQueue;_emptyPartsWarningView;_availableActions;_cachedContentParts=[];constructor(_0x339dcf,_0xf4b732){super(_0x339dcf);const {areActionsDisabled:_0x42d1d8,showUnchangedParts:_0x1a7845,availableActions:_0x197954}=_0xf4b732;this['_areActionsDisabled']=_0x42d1d8,this['_showUnchangedParts']=_0x1a7845,this['_availableActions']=_0x197954,this['set']('isTrackChangesOn',!0x1),this['set']('isAcceptAllEnabled',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new wr(_0x339dcf,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(_0x339dcf,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new vr(_0x339dcf,_0xf4b732['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new kr(this['locale'],_0xf4b732['bodyCollection']),_0xf4b732['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'](_0x47bc89=>_0x47bc89 instanceof Tr);}async updateContentParts({parts:_0x1166b8,abortSignal:_0x4a2721,skipLoadingEffects:_0x2a905f}){this['_cachedContentParts']['length']?_0x1166b8['forEach'](_0xff676a=>{const _0xbe496=this['_cachedContentParts']['findIndex'](_0x1f5232=>_0x1f5232['index']==_0xff676a['index']);-0x1===_0xbe496?this['_cachedContentParts']['push'](_0xff676a):this['_cachedContentParts'][_0xbe496]=_0xff676a;}):this['_cachedContentParts']=_0x1166b8;const _0x2a3f4f=this['_showUnchangedParts']?_0x1166b8:_0x1166b8['filter'](_0x4f7b45=>_0x4f7b45['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x2a3f4f['length']>0x1),_0x2a905f&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x21ed00 of _0x1166b8)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x28a07d=>{let _0x1b721f=this['getPartView'](_0x21ed00['index']);if(_0x1b721f||_0x21ed00['hasChanges']||this['_showUnchangedParts']){if(!_0x1b721f){if(_0x1b721f=new Tr(this['locale'],{'part':_0x21ed00,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x1b721f['delegate'](...ir)['to'](this),_0x1b721f['bind']('isTrackChangesOn')['to'](this),!_0x2a905f&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x28a07d),_0x28a07d['aborted']))return;_0x1b721f['isTargetReadOnly']=this['_readOnlyByIndex']['get'](_0x21ed00['index'])??!0x1,this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x1b721f,this['_children']['length']-0x1),_0x2a905f||this['_showSkeletonDebounced']();}await _0x1b721f['updateContent']({'part':_0x21ed00,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x28a07d}),_0x1b721f['markAsDone']();}});return _0x4a2721?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}updatePartState(_0x562df8,_0x409113,_0x548f65){const _0x3dbf90=this['getPartView'](_0x562df8);_0x3dbf90&&(_0x3dbf90['outdatedReason']=_0x548f65,_0x3dbf90['state']=_0x409113);}setGating({readOnlyByIndex:_0x12ac04,isAcceptAllEnabled:_0x38aa33}){this['_readOnlyByIndex']=_0x12ac04,this['isAcceptAllEnabled']=_0x38aa33;for(const _0x35f81b of this['_contentPartViews'])_0x35f81b['isTargetReadOnly']=_0x12ac04['get'](_0x35f81b['partDefinition']['index'])??!0x1;}setPartActive(_0x4b196c,_0x4d3c9d){if(!0x1===_0x4b196c){for(const _0x506c6d of this['_contentPartViews'])_0x506c6d['isActive']=!0x1;}else{const _0x1c4754=this['getPartView'](_0x4b196c);_0x1c4754&&(_0x1c4754['isActive']=_0x4d3c9d);}}updateSources(_0x18b70e){_0x18b70e['forEach'](_0x1ae452=>this['_sourcesView']['addSource'](_0x1ae452)),this['_sourcesView']['isVisible']=!0x0;}getPartView(_0x279ab5){return this['_contentPartViews']['find'](_0x4d0777=>_0x4d0777['partDefinition']['index']==_0x279ab5)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x5c1c2f=!this['_cachedContentParts']['find'](({hasChanges:_0x4dcb91})=>_0x4dcb91),_0xe3d177=!!this['_cachedContentParts']['find'](({hasChanges:_0xa9c1f2})=>!_0xa9c1f2);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0xe3d177,_0x5c1c2f?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'](_0x40104c=>_0x40104c['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']&&!this['_areActionsDisabled']);}async _awaitMinimumSkeletonDisplayTime(_0x42fec9){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x242cf8=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x242cf8>0x0){const {promise:_0x27ceac,abortController:_0x4a57cd}=nr(_0x242cf8);_0x42fec9?.['addEventListener']('abort',()=>_0x4a57cd['abort']()),await _0x27ceac['catch'](()=>{});}}get hasNonEmptyParts(){return this['_contentPartViews']['filter'](_0x22486d=>_0x22486d['partDefinition']['hasChanges'])['length']>0x0;}},xr=class extends _0x414492{['bodyView'];['children'];['headerView'];constructor(_0x4d7549,_0x330f40,_0x5131e1){super(_0x4d7549);const {showDiff:_0x3113da,areActionsDisabled:_0x522592,showUnchangedParts:_0x1cdf4f,availableActions:_0x129e88}=_0x330f40;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new ur(_0x4d7549,{'showDiff':_0x3113da}),this['headerView']['on']('toggleShowChanges',(_0x377e77,_0x3ede05)=>{this['areChangesVisible']=_0x3ede05['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x3ede05['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new Nr(_0x4d7549,{'areActionsDisabled':_0x522592,'showUnchangedParts':!!_0x1cdf4f,'availableActions':_0x129e88,'bodyCollection':_0x5131e1}),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(_0x97a26b){await this['bodyView']['updateContentParts'](_0x97a26b);}updateSources(_0x352cb4){this['bodyView']['updateSources'](_0x352cb4);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},Lr=class extends lr{containerView;constructor(_0x170856,_0x1b5ff1,_0xd617be){super(_0x1b5ff1),this['set']('isTrackChangesOn',!0x1),this['containerView']=new xr(_0x170856,{'showDiff':_0x1b5ff1['showDiff'],'areActionsDisabled':_0x1b5ff1['areActionsDisabled'],'availableActions':_0x1b5ff1['availableActions']},_0xd617be),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x2d6c68,_0x38b445)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x38b445['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',(_0xd492d7,{index:_0x1335e2})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x1335e2});}),this['containerView']['on']('applySuggestion',(_0x3431ec,{index:_0x460da8}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x460da8});}),this['containerView']['on']('insertSuggestion',(_0x1774fd,{index:_0x46b265}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x46b265});}),this['containerView']['on']('rejectSuggestion',(_0x277921,{index:_0x5ebe82})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x5ebe82});}),this['containerView']['on']('mouseOverSuggestion',(_0x4a9e86,{index:_0x2d389e})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x2d389e});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x4536b9,{index:_0x529222})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x529222});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async updateContent(_0x5512fc){await this['containerView']['updateContent'](_0x5512fc);}updatePartState(_0x39bd9d,_0x3f325b,_0x289b26){this['containerView']['bodyView']['updatePartState'](_0x39bd9d,_0x3f325b,_0x289b26);}setPartActive(_0x70f8a,_0x4f6294){!0x1===_0x70f8a?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x70f8a,_0x4f6294);}updateSources(_0x55b8da){this['containerView']['updateSources'](_0x55b8da);}getPartView(_0x11e33b){return this['containerView']['bodyView']['getPartView'](_0x11e33b);}setGating(_0x4a0145){this['containerView']['bodyView']['setGating'](_0x4a0145);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},Pr=class extends lr{replyContainer;_bodyCollection;constructor(_0x17e31e,_0x55a3da,_0x56f908){super(_0x55a3da),this['_bodyCollection']=_0x56f908,this['locale']=_0x17e31e,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x414492(),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:_0x38b264,renderingStrategy:_0x8c2dc1,abortSignal:_0x7d0e}){'streaming'===_0x8c2dc1?await this['streamIntoElement'](_0x38b264,this['replyContainer']['element'],_0x7d0e):this['replyContainer']['element']['innerHTML']=_0xa920ee(_0x38b264);}updateSources(_0x223412){const _0x22248d=new kr(this['locale'],this['_bodyCollection']);_0x22248d['children']['addMany'](_0x223412['map'](_0x43a629=>new yr(this['locale'],_0x43a629,_0x22248d['balloonPanelView']))),_0x22248d['isVisible']=!0x0,this['children']['add'](_0x22248d);}},Dr=class extends _0x430739{constructor(_0x49b825=void 0x0){super();const _0x3e152e=_0x49b825?'ck-ai-spinner_'+_0x49b825:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x3e152e]}});}};const Hr={'file':_0x7cedc0,'image':_0x414e6e,'document':_0x1e6b58,'web-resource':_0x5943de,'text':_0x7cedc0,'selection':tt,'mcp-tool-context':_0x1e6b58,'context':_0x1e6b58},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(_0x25f684,_0x3453a6,_0x2e6275,_0xaf7cdc,_0x117139=!0x1){super(_0x25f684),this['_isAnimationOnEnterEnabled']=_0xaf7cdc,this['_initializeProperties'](_0x3453a6,_0x2e6275,_0x117139),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(_0x207dec,_0x53009b,_0x368087){this['set']('label',_0x207dec['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x207dec['type']),this['set']('id',_0x207dec['uiId']),this['set']('readonly',_0x53009b),this['set']('isLoading',_0x368087);}_setupTemplate(){const _0x35abec=this['_createIconView'](),_0x46b775=this['_createRemoveButton'](),_0x1c211b=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x1c211b),'children':this['_createTemplateChildren'](_0x35abec,_0x46b775,_0x1c211b)});}_createTemplateAttributes(_0x1c0620){return{'class':[Mr,_0x1c0620['if']('itemType',Vr,_0x5633ac=>'document'==_0x5633ac),_0x1c0620['if']('itemType',Ur,_0xa02c0d=>'selection'==_0xa02c0d)],'data-cke-tooltip-text':_0x1c0620['to']('label',Yr),'data-cke-tooltip-position':Kr,'data-cke-tooltip-class':Fr};}_createTemplateChildren(_0x120d35,_0x14ccc7,_0x19fc4d){const _0x5ac8b1=this['_createLabelElement'](_0x19fc4d),_0x54a121=this['_createLoaderIcon']();return this['readonly']?[_0x120d35,_0x5ac8b1]:[_0x120d35,_0x54a121,_0x5ac8b1,_0x14ccc7];}_createLabelElement(_0x499be3){return{'tag':'span','attributes':{'class':Br},'children':[{'text':_0x499be3['to']('label')}]};}_createRemoveButton(){const _0x541a5b=new Mt(this['locale']);return _0x541a5b['set']({'label':Es(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x40a4cb}),this['_setupRemoveButtonEvent'](_0x541a5b),_0x541a5b;}_setupRemoveButtonEvent(_0x513841){_0x513841['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}_createIconView(){const _0x3e0354=this['bindTemplate'],_0x2b4638=new $t();return _0x2b4638['content']=Hr[this['itemType']],_0x2b4638['extendTemplate']({'attributes':{'class':[Gr,_0x3e0354['if']('isLoading','ck-hidden',_0x1cc6c6=>_0x1cc6c6)]}}),_0x2b4638;}_handleAnimationEndOnce(_0x1165d4,_0x36c476){if(!_0x1165d4)return;const _0x183398=()=>{_0x36c476(),_0x1165d4['removeEventListener']('animationend',_0x183398),_0x1165d4['removeEventListener']('webkitAnimationEnd',_0x183398);};_0x1165d4['addEventListener']('animationend',_0x183398),_0x1165d4['addEventListener']('webkitAnimationEnd',_0x183398);}_createLoaderIcon(){const _0x55bb63=new Dr('small');return _0x55bb63['bind']('isVisible')['to'](this,'isLoading',_0x2dce0d=>_0x2dce0d),_0x55bb63;}};function Yr(_0x31e86a){if(!_0x31e86a)return _0x31e86a;if(_0x31e86a['length']<=0x78)return _0x31e86a;const _0x4ea5b1=_0x31e86a['slice'](0x0,0x78),_0x2955e3=_0x4ea5b1['lastIndexOf']('\x20');return(_0x2955e3>0x0?_0x4ea5b1['slice'](0x0,_0x2955e3):_0x4ea5b1)+'…';}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(_0x278ba3,_0x6b19d6,_0x55b8e5,_0x240301,_0x2d61b3){this['_locale']=_0x278ba3,this['_visibleChips']=_0x6b19d6,this['_config']={...$r,..._0x55b8e5,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x55b8e5['cssClasses']}},this['_overflowChips']=new lt(),this['_bodyCollection']=_0x240301,this['_parentView']=_0x2d61b3||null;}setContainerElement(_0x834c35){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x834c35,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 _0x38ea00=[...this['_visibleChips'],...this['_overflowChips']],_0x193011=this['_createCalculationContainer'](),_0x86df50=this['_calculateOverflowInContainer'](_0x193011,_0x38ea00),_0x467335=_0x193011['_ancestorsToRestore'];_0x467335&&this['_restoreAncestorVisibility'](_0x467335),_0x193011['remove'](),this['_applyOverflowResults'](_0x38ea00,_0x86df50);}_createShowMoreButton(){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0x4b6d2c({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}_createShowMoreButtonView(){const _0x16224b=new Mt(this['_locale']);_0x16224b['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x16ce41=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x16ce41['push'](this['_config']['cssClasses']['controlsButton']),_0x16224b['extendTemplate']({'attributes':{'class':_0x16ce41}}),_0x16224b;}_createShowMoreBalloonPanelView(){const _0x4214d0=new xt(this['_locale']);return _0x4214d0['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x4214d0),_0x4214d0;}_updateBalloonContent(){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x2fe928=>{_0x2fe928['disableAnimationOnEnter']();});const _0x16834c=new _0x414492(this['_locale']);_0x16834c['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x16834c);}}_handleShowMoreButtonClick(){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}_updateShowMoreButtonVisibility(){const _0x3da7c4=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x3da7c4?'':'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(_0x4c94f5){const _0xdae14a=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x37ced6=this['_containerElement']?.['classList'];if(_0x37ced6){const _0x135b68=_0x37ced6[0x0]||'',_0x5252c8=_0x4c94f5['querySelector']('.'+_0x135b68),_0x1ca97f=_0x4c94f5['querySelector'](_0xdae14a);return _0x5252c8||_0x1ca97f||_0x4c94f5;}return _0x4c94f5['querySelector'](_0xdae14a)||_0x4c94f5;}_calculateContainerWidth(){const _0x4a68b2=this['_parentView']?.['element']||this['_containerElement'];if(!_0x4a68b2)return qr;const _0x52230d=window['getComputedStyle'](_0x4a68b2)['width'];if('auto'===_0x52230d||'0px'===_0x52230d||!_0x52230d){const _0x3c4aab=_0x4a68b2['parentElement'];if(_0x3c4aab){const _0x515b0a=window['getComputedStyle'](_0x3c4aab);return'auto'!==_0x515b0a['width']?_0x515b0a['width']:qr;}return qr;}return _0x52230d;}_applyCalculationStyles(_0x45b490,_0x3dbb28){this['_config']['cssClasses']['calculationContainer']&&_0x45b490['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x45b490['style']['width']=_0x3dbb28,_0x45b490['style']['position']='absolute',_0x45b490['style']['top']='-9999px',_0x45b490['style']['left']='-9999px',_0x45b490['style']['opacity']='0',_0x45b490['style']['pointerEvents']='none',_0x45b490['style']['zIndex']='-1',_0x45b490['style']['visibility']='visible\x20!important',_0x45b490['style']['display']='block\x20!important',_0x45b490['style']['boxSizing']='border-box';}_restoreAncestorVisibility(_0x248333){_0x248333['forEach'](({element:_0x335c12,originalDisplay:_0x22c0cd,originalVisibility:_0x3641f9})=>{_0x335c12['style']['display']=_0x22c0cd,_0x335c12['style']['visibility']=_0x3641f9;});}_makeAncestorsVisible(_0x5bf4b5){const _0x1d1069=[];let _0x1c01ca=_0x5bf4b5;for(;_0x1c01ca&&_0x1c01ca!==document['body'];){const _0x4753a8=window['getComputedStyle'](_0x1c01ca);'none'!==_0x4753a8['display']&&'hidden'!==_0x4753a8['visibility']||(_0x1d1069['push']({'element':_0x1c01ca,'originalDisplay':_0x1c01ca['style']['display'],'originalVisibility':_0x1c01ca['style']['visibility']}),_0x1c01ca['style']['display']='block',_0x1c01ca['style']['visibility']='visible'),_0x1c01ca=_0x1c01ca['parentElement'];}return _0x1d1069;}_createContainerElements(){let _0x112b5b,_0x2ac953;return this['_parentView']?.['element']?(_0x112b5b=this['_parentView']['element']['cloneNode'](!0x0),_0x2ac953=this['_findTargetContainer'](_0x112b5b)):(_0x112b5b=document['createElement']('div'),_0x2ac953=_0x112b5b),{'calculationContainer':_0x112b5b,'targetContainer':_0x2ac953};}_createCalculationContainer(){const {calculationContainer:_0x497c18,targetContainer:_0x4c867a}=this['_createContainerElements'](),_0x11a550=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x497c18,_0x11a550);const _0x4fcd72=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0x4fcd72?_0x4fcd72['appendChild'](_0x497c18):document['body']['appendChild'](_0x497c18),_0x497c18['_targetContainer']=_0x4c867a;const _0x4b55d9=this['_makeAncestorsVisible'](_0x4fcd72||null);return _0x497c18['offsetWidth'],_0x497c18['_ancestorsToRestore']=_0x4b55d9,_0x497c18;}_calculateOverflowInContainer(_0x877799,_0x56ae56){const _0x4f2841=_0x877799['_targetContainer']||_0x877799,_0x5b6bc5=[],{rowCount:_0x4c78bf}=this['_renderChipsAndCountRows'](_0x4f2841,_0x56ae56);if(_0x4c78bf<=this['_config']['maxVisibleRows'])return _0x5b6bc5;const _0x55f15b=_0x56ae56['slice']();for(;_0x55f15b['length']>0x0;){if(this['_testButtonFit'](_0x877799,_0x4f2841,_0x55f15b)){const _0x41fd36=_0x56ae56['filter'](_0x368bfe=>!_0x55f15b['includes'](_0x368bfe));_0x5b6bc5['push'](..._0x41fd36);break;}if(!_0x55f15b['pop']())break;}return _0x5b6bc5;}_renderChipsAndCountRows(_0x3aafce,_0x243a47){_0x3aafce['innerHTML']='',_0x243a47['forEach'](_0x3061a9=>{if(_0x3061a9['element']){const _0x2ab5de=_0x3061a9['element']['cloneNode'](!0x0);_0x3aafce['appendChild'](_0x2ab5de);}}),_0x3aafce['offsetWidth'];const _0x4e038e=_0x3aafce['children'],_0x5b7bf6=[];return Array['from'](_0x4e038e)['forEach'](_0x29d147=>{const _0xcf3c2b=_0x29d147['getBoundingClientRect']()['top'];_0x5b7bf6['some'](_0xd1af5b=>Math['abs'](_0xd1af5b-_0xcf3c2b)<this['_config']['rowDetectionTolerance'])||_0x5b7bf6['push'](_0xcf3c2b);}),{'rowCount':_0x5b7bf6['length']};}_createMockButton(){const _0x182ade=document['createElement']('button');return _0x182ade['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x182ade['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x182ade['textContent']='+\x201',_0x182ade;}_testButtonFit(_0x27842c,_0x14069b,_0x282fa3){this['_renderChipsAndCountRows'](_0x14069b,_0x282fa3);const _0x28fa4e=this['_createMockButton']();_0x27842c['appendChild'](_0x28fa4e),_0x27842c['offsetWidth'];const _0xe92ca0=[..._0x14069b['children'],_0x28fa4e],_0x19d0e3=[];_0xe92ca0['forEach'](_0x43965b=>{const _0x4ad33b=_0x43965b['getBoundingClientRect']()['top'];_0x19d0e3['some'](_0x10ec75=>Math['abs'](_0x10ec75-_0x4ad33b)<this['_config']['rowDetectionTolerance'])||_0x19d0e3['push'](_0x4ad33b);});const _0x3d410f=_0x19d0e3['length'];return _0x28fa4e['remove'](),_0x3d410f<=this['_config']['maxVisibleRows'];}_distributeChips(_0x1ba336,_0x318609){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x1ba336['forEach'](_0x5b4d11=>{_0x318609['includes'](_0x5b4d11)?this['_overflowChips']['add'](_0x5b4d11):this['_visibleChips']['add'](_0x5b4d11);});}_updateOverflowUI(_0x9fa8d9){if(_0x9fa8d9>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x9fa8d9>0x0&&this['_showMoreButtonView']){const _0x4c30ca=''+this['_config']['showMoreLabelPrefix']+(_0x9fa8d9<0x63?_0x9fa8d9:'99');this['_showMoreButtonView']['label']=_0x4c30ca;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}_applyOverflowResults(_0x12b20b,_0x452ca9){this['_distributeChips'](_0x12b20b,_0x452ca9),this['_updateOverflowUI'](_0x452ca9['length']);}_setupVisibilityObserver(){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x1d8443=>{_0x1d8443[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 _0x580b9c=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x580b9c['width']||0x0===_0x580b9c['height'])return!0x1;const _0x3962e2=window['innerHeight']||document['documentElement']['clientHeight'],_0x55f78e=window['innerWidth']||document['documentElement']['clientWidth'];return _0x580b9c['bottom']>=-0xc8&&_0x580b9c['top']<=_0x3962e2+0xc8&&_0x580b9c['right']>=-0xc8&&_0x580b9c['left']<=_0x55f78e+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 _0x414492{_contextChips=this['createCollection']();['_overflowManager'];_bodyCollection;constructor(_0x1aedc7,_0x44392c,_0xfbaccc){super(_0x1aedc7),this['_bodyCollection']=_0xfbaccc,this['_createContextChips'](_0x44392c);const _0x347aaa={'cssClasses':{'showMoreButton':Zr+'\x20'+Dn,'showMoreBalloon':to,'overflowContainer':jr,'controlsButton':Jr}};this['_overflowManager']=new Qr(_0x1aedc7,this['_contextChips'],_0x347aaa,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 _0x2482a6=this['element']['querySelector']('.'+zr);_0x2482a6&&(this['_overflowManager']['setContainerElement'](_0x2482a6),this['_overflowManager']['reorganizeChips']());}destroy(){super['destroy'](),this['_overflowManager']['destroy']();}_createContextChips(_0x567854){for(const _0x5cea7d of _0x567854){const _0xfbf7cc=new Wr(this['locale'],_0x5cea7d,!0x0,!0x1);this['_contextChips']['add'](_0xfbf7cc);}}},io=class extends lr{_contextChipsView=null;['_locale'];_bodyCollection;_messageContentView;constructor(_0x3df0a0,_0x4ec3ff,_0x41da07){super(_0x4ec3ff),this['_locale']=_0x3df0a0,this['_bodyCollection']=_0x41da07,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'](_0x11d481=>!_0x11d481['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}_createMessageContentView(){this['_messageContentView']=new _0x414492(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(_0x1bcdde,_0x526ca){super(_0x526ca);const {isWebSearchEnabled:_0x2fbad8,isReasoningEnabled:_0x3f48be}=_0x526ca['capabilities'],_0x38ea8f=[];let _0x5f53d6='';_0x2fbad8&&_0x3f48be?(_0x5f53d6=Es(_0x1bcdde,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x38ea8f['push'](no(ht)),_0x38ea8f['push'](no(_0x5d171c))):_0x2fbad8?(_0x5f53d6=Es(_0x1bcdde,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x38ea8f['push'](no(ht))):_0x3f48be&&(_0x5f53d6=Es(_0x1bcdde,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x38ea8f['push'](no(_0x5d171c))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x5f53d6?'':'ck-hidden']}});const _0x129bb0=new _0x414492();_0x129bb0['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x38ea8f,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x5f53d6]}]}),this['children']['add'](_0x129bb0),this['capabilities']=_0x526ca['capabilities'];}};function no(_0x267ca9){const _0x18ec6a=new $t();return _0x18ec6a['content']=_0x267ca9,_0x18ec6a;}const ro=['wheel','touchstart','pointerdown','keydown'],oo=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var ao=class{element;animationFrameId;['isRunning'];abortController;['isUserPaused'];['scrollBehavior'];constructor(_0x2c5358){this['element']=_0x2c5358,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x18c431 of ro){const _0x59b91a='keydown'!==_0x18c431;this['element']['addEventListener'](_0x18c431,this['_onUserEvent']['bind'](this),{'passive':_0x59b91a,'signal':this['abortController']['signal']});}}start({smooth:_0x499a6d=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x499a6d?'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(_0x4ea043){if(this['isRunning']){if('keydown'===_0x4ea043['type']){const _0x5493c8=_0x4ea043['key'];if(!oo['includes'](_0x5493c8))return;}_0x4ea043 instanceof WheelEvent?_0x4ea043['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}_isAtBottom(){const {scrollTop:_0x14e684,scrollHeight:_0x58512d,clientHeight:_0x222bcb}=this['element'];return _0x58512d-_0x14e684-_0x222bcb<=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(_0x241c7f){super(_0x241c7f),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 _0x414492{['children'];['scrollManager'];_bodyCollection;constructor(_0x50454a,_0x293e68){super(_0x50454a),this['_bodyCollection']=_0x293e68,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(_0x405042,_0x5c07be){let _0x187a1d;return'ai-reply'===_0x405042?_0x187a1d=new Pr(this['locale'],_0x5c07be,this['_bodyCollection']):'ai-suggestion-reply'===_0x405042?(_0x187a1d=new Lr(this['locale'],_0x5c07be,this['_bodyCollection']),_0x187a1d['bind']('isTrackChangesOn')['to'](this)):_0x187a1d='user-message'===_0x405042?new io(this['locale'],_0x5c07be,this['_bodyCollection']):'interaction-header'===_0x405042?new so(this['locale'],_0x5c07be):'custom-element'===_0x405042?new ho(_0x5c07be):new Rr(_0x5c07be),this['children']['add'](_0x187a1d),_0x187a1d;}async updateReplyItem({id:_0x3641c0,parsedContent:_0x1adea2,renderingStrategy:_0x29d143,abortSignal:_0x47916c}){const _0x21d77d=this['getItemById'](_0x3641c0);if(!(_0x21d77d instanceof Pr))throw new ct('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x21d77d,'id':_0x3641c0,'parsedContent':_0x1adea2});await _0x21d77d['updateContent']({'parsedContent':_0x1adea2,'renderingStrategy':_0x29d143,'abortSignal':_0x47916c});}async updateWebSources(_0x501751,_0x536236){const _0x55951c=this['getItemById'](_0x501751);if(_0x55951c instanceof Lr)_0x55951c['updateSources'](_0x536236);else{if(!(_0x55951c instanceof Pr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x55951c,'id':_0x501751,'sources':_0x536236});_0x55951c['updateSources'](_0x536236);}}async updateSuggestionItem({id:_0x52fdfc,parts:_0x2c6935,abortSignal:_0x260347,skipLoadingEffects:_0x3064f2}){const _0x2bf949=this['getItemById'](_0x52fdfc);if(!(_0x2bf949 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x2bf949,'id':_0x52fdfc,'parts':_0x2c6935});await _0x2bf949['updateContent']({'parts':_0x2c6935,'abortSignal':_0x260347,'skipLoadingEffects':_0x3064f2});}updateSuggestionPartState({id:_0x3d9059,index:_0x2a3e47,state:_0x1ab83a,outdatedReason:_0x3d4e54}){const _0x4dea5c=this['getItemById'](_0x3d9059);if(!(_0x4dea5c instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x3d9059});_0x4dea5c['updatePartState'](_0x2a3e47,_0x1ab83a,_0x3d4e54);}updateSuggestionGating(_0x3c8510,_0x2b0da9){const _0x393603=this['getItemById'](_0x3c8510);if(!(_0x393603 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x3c8510});_0x393603['setGating'](_0x2b0da9);}setSuggestionPartActive({id:_0x5042af,index:_0x56d108,isActive:_0x5d7380}){const _0x41a7be=this['getItemById'](_0x5042af);if(!(_0x41a7be instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x5042af});this['children']['filter'](_0x2cecbb=>_0x2cecbb instanceof Lr)['forEach'](_0x50f726=>{_0x50f726['setPartActive'](!0x1);}),_0x41a7be['setPartActive'](_0x56d108,_0x5d7380);}markItemAsDone(_0x19add7){this['getItemById'](_0x19add7)['markAsDone']();}getItemIds(){return this['children']['map'](_0x42a7e3=>_0x42a7e3['options']['id']);}removeItem(_0x1a3292){this['children']['remove'](this['getItemById'](_0x1a3292));}hasItem(_0x129d8a){return!!this['children']['find'](_0x4e38f3=>_0x4e38f3['options']['id']['includes'](_0x129d8a));}scrollToSuggestion(_0x4120f7,_0x1b3805){const _0x3fd460=this['getItemById'](_0x4120f7);if(!(_0x3fd460 instanceof Lr))return void St('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x4120f7,'partIndex':_0x1b3805});const _0x173629=_0x3fd460['getPartView'](_0x1b3805);_0x173629?Rt(_0x173629['element'],0x14,this['element']['parentElement'],!0x0,!0x0):St('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x4120f7,'partIndex':_0x1b3805});}_setupTemplate(){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}_createTemplateChildren(){const _0x269b85=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x269b85,this['_createFeedLoader']()];}_createSkeletonLoader(){const _0x2a0590=new wr(this['locale'],Cr['aiFeed']);return _0x2a0590['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x2a0590;}_createFeedItems(){const _0x49b02c=new _0x414492(this['locale']);return _0x49b02c['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x49b02c;}_createFeedLoader(){const _0x349147=new _0x414492(this['locale']);return _0x349147['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x5ef0f0=>!_0x5ef0f0)]},'children':this['_createLoaderChildren']()}),_0x349147;}_createLoaderChildren(){const _0x2013d5=new Dr();return _0x2013d5['isVisible']=!0x0,[_0x2013d5,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}getItemById(_0x549e07){const _0xe26d5f=this['children']['find'](_0x48d5b3=>_0x48d5b3['options']['id']['includes'](_0x549e07));if(!_0xe26d5f)throw new ct('ai-chat-feed-view-item-not-found',this,{'id':_0x549e07});return _0xe26d5f;}setLoadingMessage(_0x54c9de){this['set']('loadingMessage',_0x54c9de);}toggleLoadingSkeleton(_0x181a8b){this['set']('isLoadingSkeletonVisible',_0x181a8b);}startAutoScroll(_0x5e2c12={}){this['scrollManager']['start'](_0x5e2c12);}stopAutoScroll(){this['scrollManager']['stop']();}},lo=class extends Jt{filter(){let _0x287425=0x0;for(const _0x3e5f1e of this['items'])_0x287425+=_0x3e5f1e['items']['length'];return{'resultsCount':_0x287425,'totalItemsCount':_0x287425};}};function uo(_0x13ecc3){const _0x2ac79b=[];let _0x4f04a7=!0x1;for(const _0x141d6f of Array['from'](_0x13ecc3['items'])){if('file'!==_0x141d6f['kind'])continue;if(_0x141d6f['webkitGetAsEntry']()?.['isDirectory']){_0x4f04a7=!0x0;continue;}const _0x154c59=_0x141d6f['getAsFile']();_0x154c59&&_0x2ac79b['push'](_0x154c59);}return{'files':_0x2ac79b,'hasDirectory':_0x4f04a7};}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(_0xf7e2e3,_0xa321c2){super(_0xf7e2e3,{'queryView':{'label':'','creator':_0x56fb88,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new lo(_0xf7e2e3),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0xa321c2,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',(_0x4d7ba4,_0x1008b5)=>!_0x4d7ba4&&!_0x1008b5),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x2d20ae,_0x2cd740)=>{this['isUploadInProgress']||this['isEmpty']||_0x2d20ae['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x2cd740());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x38202c=>this['_handlePaste'](_0x38202c)),this['element']['addEventListener']('drop',_0x30c6a0=>this['_handleDrop'](_0x30c6a0));}_handlePaste(_0x502c9f){const _0xd065f7=_0x502c9f['clipboardData'];if(!_0xd065f7)return;const {files:_0x1c25a8,hasDirectory:_0x507833}=uo(_0xd065f7),_0x2d1d0d={'files':_0x1c25a8,'plainText':_0xd065f7['getData']('text/plain'),'hasDirectory':_0x507833,'forceTextAttachment':!0x1,'preventDefault':()=>_0x502c9f['preventDefault']()};this['fire']('promptInputPaste',_0x2d1d0d);}['_handleDrop'](_0xdd75e1){const _0x590420=_0xdd75e1['dataTransfer'];if(!_0x590420)return;const _0x39289d={'files':[],'plainText':_0x590420['getData']('text/uri-list')||_0x590420['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0xdd75e1['preventDefault']()};this['fire']('promptInputPaste',_0x39289d);}destroy(){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}submit(){const _0x3494d3=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x3494d3)return this['queryView']['errorText']=Es(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x389884=_0x31e6fe(_0x3494d3);this['fire']('sendUserMessage',_0x389884),this['queryView']['fieldView']['reset']();}setPlaceholderText(_0x1ae4cc){this['queryView']['fieldView']['set']('placeholder',_0x1ae4cc);}['focus'](_0x302d3e=!0x1){super['focus'](),_0x302d3e&&(this['element']['classList']['contains'](_o)||(this['element']['classList']['add'](_o),setTimeout(()=>{this['element']['classList']['remove'](_o);},0x320)));}_createSubmitButton(){const _0x28d5b1=new Mt(this['locale']);return _0x28d5b1['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}),_0x28d5b1['on']('execute',()=>{this['submit']();}),_0x28d5b1;}setIsUploadInProgress(_0x1147c5){this['isUploadInProgress']=_0x1147c5;}_setUpAddContextButtonPositioning(){const _0x3d22d8=this['locale'],_0x3b394e=()=>{wt['window']['requestAnimationFrame'](()=>{if(ft(this['element'])){const _0x34a0ef=new It(this['queryView']['fieldView']['element']),_0x20d69a=new It(this['_addContextButtonView']['element']),_0x192e0c=_0x34a0ef['width'],_0x4ba41f='rtl'===_0x3d22d8['uiLanguageDirection']?'right':'left';_0x34a0ef['excludeScrollbarsAndBorders']();const _0x2d42ef=_0x192e0c-_0x34a0ef['width']+0x1;this['_addContextButtonView']['element']['style'][_0x4ba41f]='calc('+(_0x192e0c-_0x20d69a['width']-_0x2d42ef)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x3b394e),this['on']('render',()=>{_0x3b394e(),this['_queryViewResizeObserver']=new pt(this['queryView']['fieldView']['element'],()=>{_0x3b394e();});});}},Ao=class extends _0x414492{constructor(_0x3fd318){super(_0x3fd318),this['set']('isEnabled',!0x0);const _0x2a82d3=new $t();_0x2a82d3['content']=_0x7cedc0,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x2a82d3,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':Es(_0x3fd318,'AI_CHAT_DROP_ZONE_HINT')}]}]});}attach(_0x1426ec){let _0x1873fe=0x0;const _0xe23e59=()=>{_0x1426ec['classList']['toggle']('ck-ai-chat-controls_drag-over',this['isEnabled']&&_0x1873fe>0x0);};this['on']('change:isEnabled',(_0x14f9d6,_0x4b466e,_0x5c421f)=>{_0x5c421f&&_0x1873fe>0x0&&this['fire']('dragEnter'),_0xe23e59();}),_0x1426ec['addEventListener']('dragenter',_0x5d9301=>{_0x5d9301['dataTransfer']&&(_0x1873fe++,0x1===_0x1873fe&&this['isEnabled']&&this['fire']('dragEnter'),_0xe23e59());}),_0x1426ec['addEventListener']('dragover',_0x132e0a=>{_0x132e0a['dataTransfer']&&_0x132e0a['preventDefault']();}),_0x1426ec['addEventListener']('dragleave',()=>{--_0x1873fe<0x0&&(_0x1873fe=0x0),_0xe23e59();}),_0x1426ec['addEventListener']('drop',_0x3892be=>{_0x3892be['preventDefault'](),_0x1873fe=0x0,_0xe23e59(),this['isEnabled']&&this['_handleDrop'](_0x3892be);});}['_handleDrop'](_0x3caa08){const _0x15f558=_0x3caa08['dataTransfer'];if(!_0x15f558)return;const {files:_0x5cb2bd,hasDirectory:_0x3b81b9}=uo(_0x15f558),_0x484043={'files':_0x5cb2bd,'plainText':_0x15f558['getData']('text/uri-list')||_0x15f558['getData']('text/plain'),'hasDirectory':_0x3b81b9,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x484043);}},Io=class extends _0x414492{['dropdownView'];['nameView'];_items;['_config'];constructor(_0x271e13,_0x6f61d8){super(_0x271e13),this['_config']=_0x6f61d8,this['set']('modelDisplayMode','selector'),this['set']('activeModelId',null),this['set']('activeModelName',null),this['set']('isEnabled',!0x0),this['dropdownView']=this['_createDropdown'](),this['_items']=new lt(),_0xec2131(this['dropdownView'],this['_items']),this['nameView']=new po(_0x271e13,_0x6f61d8['nameClass']),this['nameView']['bind']('text')['to'](this,'activeModelName',_0x21db4f=>_0x21db4f??''),this['nameView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x34dc42=>'name'===_0x34dc42),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-model-selector']},'children':[this['dropdownView'],this['nameView']]});}setModels(_0x4f19b2,_0x51fa6f){var _0x433b4b;this['set']('modelDisplayMode',(_0x433b4b=_0x4f19b2['length'],_0x51fa6f?0x1===_0x433b4b?'name':'selector':'hidden')),this['_items']['clear'](),0x1===_0x4f19b2['length']&&this['set']('activeModelName',_0x4f19b2[0x0]['name']||_0x4f19b2[0x0]['id']);for(const _0x45288a of _0x4f19b2){const _0x49498c=new _0x557175({'label':_0x45288a['name'],'withText':!0x0,'role':'menuitemradio','id':_0x45288a['id'],'model':_0x45288a});_0x49498c['bind']('isOn')['to'](this,'activeModelId',_0x3c6664=>_0x3c6664===_0x45288a['id']),this['_items']['add']({'type':'button','model':_0x49498c,'labelView':new Eo(this['locale'],_0x45288a,{'nameClass':this['_config']['itemClasses']['name'],'descriptionClass':this['_config']['itemClasses']['description'],'capabilitiesClass':this['_config']['itemClasses']['capabilities'],'extraContent':this['_config']['showCapabilities']?mo(this['locale'],_0x45288a):void 0x0})});}}setSelectedModel(_0x594f10){this['set']('activeModelId',_0x594f10?_0x594f10['id']:null),this['set']('activeModelName',_0x594f10?_0x594f10['name']||_0x594f10['id']:null);}_createDropdown(){const _0x197fd8=_0x44881d(this['locale']);return _0x197fd8['set']({'panelPosition':this['_config']['panelPosition'],'class':this['_config']['dropdownClass']}),_0x197fd8['buttonView']['set']({'withText':!0x0,'tooltipPosition':this['_config']['tooltipPosition'],'class':Dn}),_0x197fd8['buttonView']['bind']('label')['to'](this,'activeModelName',_0x54be61=>_0x54be61??this['_config']['defaultLabel']??''),_0x197fd8['buttonView']['bind']('tooltip')['to'](this,'activeModelName',this,'isEnabled',(_0x356106,_0xd3f671)=>!_0xd3f671&&this['_config']['disabledTooltip']?this['_config']['disabledTooltip']:_0x356106??this['_config']['defaultLabel']??''),_0x197fd8['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x5f5229=>'selector'===_0x5f5229),_0x197fd8['bind']('isEnabled')['to'](this,'isEnabled'),this['listenTo'](_0x197fd8,'execute',_0x2e33a1=>{this['fire']('selectModel',_0x2e33a1['source']['model']);}),_0x197fd8;}},po=class extends _0x414492{constructor(_0x191030,_0x2a1ce9){super(_0x191030),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x16c2a1=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck',_0x2a1ce9,_0x16c2a1['if']('isVisible','ck-hidden',_0x122951=>!_0x122951)]},'children':[{'text':_0x16c2a1['to']('text')}]});}},Eo=class extends Dt{constructor(_0x9f2e38,_0x43a08b,_0x518407){super();const _0x4ab3b8=this['bindTemplate'],_0x18b07f=[{'tag':'div','attributes':{'class':[_0x518407['nameClass']]},'children':[{'tag':'span','children':[{'text':_0x4ab3b8['to']('text')}]}]},{'tag':'div','attributes':{'class':[_0x518407['descriptionClass']]},'children':[{'tag':'span','children':[_0x43a08b['description']||'']}]}];_0x518407['extraContent']?.['length']&&_0x518407['capabilitiesClass']&&_0x18b07f['push']({'tag':'div','attributes':{'class':[_0x518407['capabilitiesClass']]},'children':_0x518407['extraContent']}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x4ab3b8['to']('style'),'id':_0x4ab3b8['to']('id')},'children':_0x18b07f});}};function mo(_0x27250f,_0x2b503a){return[...To(_0x27250f,ht,'AI_CHAT_SEARCH_WEB',_0x2b503a['capabilities']['webSearch']?.['enabled']??!0x1),...To(_0x27250f,_0x5d171c,'AI_CHAT_REASONING',_0x2b503a['capabilities']['reasoning']?.['enabled']??!0x1)];}function To(_0x5bf057,_0x46d50f,_0x3c2d5d,_0x59ab22){const _0x2654b4=new $t();_0x2654b4['content']=_0x46d50f;const _0x1c8de9=new _0x414492(_0x5bf057);_0x1c8de9['setTemplate']({'tag':'span','children':[{'text':Es(_0x5bf057,_0x3c2d5d)+':\x20'}]});const _0x51e44d=new _0x414492(_0x5bf057);return _0x51e44d['setTemplate']({'tag':'span','children':[{'text':Es(_0x5bf057,_0x59ab22?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x2654b4,_0x1c8de9,_0x51e44d];}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 _0x414492{_webSearchButton;_reasoningButton;_commandsButton;_modelSelector;constructor(_0x58eedc){super(_0x58eedc),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelSelectorEnabled',!0x0),this['_modelSelector']=function(_0x13b60f){return new Io(_0x13b60f,{'panelPosition':'ne','dropdownClass':[bo],'nameClass':'ck-ai-chat-controls__model-name','itemClasses':{'name':So,'description':Ro,'capabilities':Oo},'defaultLabel':Es(_0x13b60f,'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'disabledTooltip':Es(_0x13b60f,'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP'),'tooltipPosition':vo,'showCapabilities':!0x0});}(_0x58eedc),this['_modelSelector']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x5a8f75=>_0x5a8f75),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',_0x1d0b9e=>_0x1d0b9e),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x4ebcc8=>Es(this['locale'],_0x4ebcc8?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x21453f=>_0x21453f),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x3afaeb=>Es(this['locale'],_0x3afaeb?'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(_0x37be24){this['set']('webSearchActive',_0x37be24);}setReasoning(_0x335640){this['set']('reasoningActive',_0x335640);}setModelList(_0x3d179e,_0x27a2fb){this['_modelSelector']['setModels'](_0x3d179e,!_0x27a2fb);}setModel(_0x2dfc3e){if(!_0x2dfc3e)return;this['_modelSelector']['setSelectedModel'](_0x2dfc3e);const _0x2c26a8=_0x2dfc3e['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x2c26a8),this['_webSearchButton']['set']('isVisible',_0x2c26a8);const _0x438a11=_0x2dfc3e['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x438a11),this['_reasoningButton']['set']('isVisible',_0x438a11);}enableModelSelector(){this['set']('modelSelectorEnabled',!0x0);}disableModelSelector(_0x3cac11){this['set']('modelSelectorEnabled',!0x1),_0x3cac11&&(this['_modelSelector']['modelDisplayMode']='hidden');}_createWebSearchButton(){const _0x2b1a36=new Mt();return _0x2b1a36['set']({'label':Es(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':ht,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltipPosition':vo}),_0x2b1a36['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x2b1a36;}_createReasoningButton(){const _0x1065a9=new Mt();return _0x1065a9['set']({'label':Es(this['locale'],'AI_CHAT_REASONING'),'icon':_0x5d171c,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltipPosition':vo}),_0x1065a9['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x1065a9;}_createCommandsButton(){const _0x40f603=new Mt();return _0x40f603['set']({'label':Es(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x15d9a0,'withText':!0x0,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltip':Es(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':vo}),_0x40f603['extendTemplate']({'attributes':{'class':[fo]}}),_0x40f603['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x40f603;}};const yo='ck-ai-chat-context-controls__url-form',No='ck-ai-chat-context-controls__url-input-section';var xo=class extends _0x414492{['focusTracker'];keystrokes;['_focusables'];['focusCycler'];urlInputField;backButton;confirmButton;constructor(_0x1c5993){super(_0x1c5993),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'](_0x1cde05=>{this['focusTracker']['add'](_0x1cde05['element']),this['keystrokes']['listenTo'](_0x1cde05['element']);}),_0x3c38d9({'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(_0x4400c7){this['urlInputField']['errorText']=_0x4400c7,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}_createBackButton(){const _0x4e53fb=new Mt(this['locale']);return _0x4e53fb['set']({'icon':_0x58652b,'tooltip':Es(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x4d84e5,_0xe474a,_0xef8ab7)=>{_0x4e53fb['set']({'class':['ck-button-icon\x20ck-button-back'+(_0xef8ab7?'':'\x20ck-hidden')]});}),_0x4e53fb;}_createUrlInputField(){const _0x2f6027=new Qt(this['locale'],_0x155346);return _0x2f6027['set']({'label':Es(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x2f6027['fieldView']['set']({'placeholder':Es(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x2f6027;}_createConfirmButton(){const _0x2c504f=new Mt(this['locale']);return _0x2c504f['set']({'icon':_0x32ea05,'tooltip':Es(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x2c504f;}_setupTemplate(){const _0x1e293e=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'});_0x1e293e['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':yo,'tabindex':'-1'},'children':[_0x1e293e,{'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',_0x23c081=>{_0x23c081['stop'](),this['_handleSubmit']();});}_setupKeystrokes(){this['keystrokes']['set']('esc',(_0x1ecefd,_0x5a7526)=>{this['clear'](),this['fire']('cancel'),_0x5a7526();});}_handleSubmit(){const _0x426429=this['getValue']()['trim']();_0x426429?this['_isValidUrl'](_0x426429)?(this['clearError'](),this['fire']('submitUrl',_0x426429)):this['setError'](Es(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Es(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}_updateConfirmButtonState(){const _0xb373c0=this['getValue']()['trim'](),_0x440f1f=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0xb373c0['length']>0x0&&!_0x440f1f;}['_isValidUrl'](_0x2cb2ba){try{return!!new URL(_0x2cb2ba);}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(_0x599218,_0x27bbe5){super(_0x599218),this['resource']=_0x27bbe5,this['set']('isInContext',!!_0x27bbe5['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}getResourceIcon(_0x5a1c1c){if(_0x5a1c1c['isInContext'])return _0x32ea05;switch(_0x5a1c1c['type']){case'document':return _0x1e6b58;case'web-resource':return _0x5943de;case'file':case'text':return _0x7cedc0;default:return _0x2033c3;}}highlightText(_0x42628b){if(!_0x42628b||''===_0x42628b['trim']())return void this['_titleView']['highlightText'](null);const _0x126670=new RegExp(_0x4f4662(_0x42628b),'gi');this['_titleView']['highlightText'](_0x126670);}updateResourceState(_0x25b199){this['resource']['isInContext']=_0x25b199,this['isInContext']=_0x25b199,this['_updateIcon']();}_createTitleView(){const _0x4ba2b7=new Yt();return _0x4ba2b7['text']=this['resource']['label'],_0x4ba2b7['extendTemplate']({'tag':'span','attributes':{'class':[Do]}}),_0x4ba2b7;}_createIconView(){const _0x4211d7=new $t();return _0x4211d7['content']=this['getResourceIcon'](this['resource']),_0x4211d7;}_setupTemplate(){const _0x1df2de=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[Lo,_0x1df2de['if']('isVisible','ck-hidden',_0x368f2b=>!_0x368f2b),_0x1df2de['if']('isInContext',Po)]},'children':[{'tag':'div','attributes':{'class':[Ho]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x1df2de['to']('execute')}});}_updateIcon(){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const Uo='ck-ai-chat-resources__list';var Vo=class extends Jt{['_source'];constructor(_0x5ca582,_0x5fe7f3){super(_0x5ca582),this['_source']=_0x5fe7f3,this['extendTemplate']({'attributes':{'class':[Uo]}});}setResources(_0x259b97,_0x4f7b96){this['items']['clear']();let _0x101df9=_0x259b97;if(this['_source']['useDefaultFiltering']&&_0x4f7b96&&''!==_0x4f7b96['trim']()){const _0x4f20bb=new RegExp(_0x4f7b96['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x101df9=_0x259b97['filter'](_0x46b206=>_0x4f20bb['test'](_0x46b206['label']));}for(const _0x94d694 of _0x101df9){const _0xdb2be2=new Mo(this['locale'],_0x94d694);_0xdb2be2['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x94d694);}),this['items']['add'](_0xdb2be2);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x4f7b96);}highlightText(_0x2f2f81){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x1914dc=>{_0x1914dc['highlightText'](_0x2f2f81);});}updateResourceState(_0x2d5be7,_0x1d333c){for(const _0x1920bc of this['items']){const _0x319db8=_0x1920bc;_0x319db8['resource']['id']===_0x2d5be7&&_0x319db8['updateResourceState'](_0x1d333c);}}_handleResourceSelection(_0x4aca82,_0x423d17){this['fire']('addResourceToContext',{'source':_0x4aca82,'resource':_0x423d17});}},Bo=class extends Qt{['iconView'];resetButtonView;['_viewConfig'];constructor(_0x7bcdbb){const t=_0x7bcdbb['t'],_0x56f14e={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x155346,'label':Es(_0x7bcdbb,'AI_CHAT_SEARCH_RESOURCES')};super(_0x7bcdbb,_0x56f14e['creator']),this['label']=_0x56f14e['label'],this['_viewConfig']=_0x56f14e,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x7bcdbb,t),this['_setupEventListeners']();}reset(){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x30cdb){this['fire']('search',_0x30cdb);}getQuery(){return this['fieldView']['element']?.['value']||'';}_setupSearchIcon(){this['iconView']=new $t(),this['iconView']['content']=_0x2b7096,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}_setupResetButton(_0x300a7b,t){this['resetButtonView']=new Mt(_0x300a7b),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x40a4cb,'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',_0x3b5be9=>!_0x3b5be9),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 _0x414492{['_searchView'];_searchSection;_searchInputVisibleFrom;_resourcesListView;_skeletonLoader;['_source'];['children'];_latestLoadResourcesUid=null;constructor(_0xaa0070,_0x5aa131){super(_0xaa0070),this['_source']=_0x5aa131['source'],this['_searchInputVisibleFrom']=_0x5aa131['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 _0x215355([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 _0x214583=new _0x414492(this['locale']);return _0x214583['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x5242ce,_0x1be0bd)=>{this['loadResources'](_0x1be0bd),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x1be0bd);}),_0x214583;}_createResourcesListView(){const _0x3b4da6=new Vo(this['locale'],this['_source']);return _0x3b4da6['delegate']('addResourceToContext')['to'](this),_0x3b4da6['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x3b4da6;}_createSkeletonView(){const _0x2180df=new wr(this['locale'],Cr['aiChatResources']);return _0x2180df['bind']('isVisible')['to'](this,'isLoading'),_0x2180df;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x4d91){const _0x5ae4ff=kt();this['_latestLoadResourcesUid']=_0x5ae4ff,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x4d91,'uid':_0x5ae4ff}),this['isLoading']=!0x0;}setResources(_0x2ff074,_0x2e4e85){if(_0x2e4e85&&_0x2e4e85!==this['_latestLoadResourcesUid'])return;const _0x5be7f2=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x2ff074,_0x5be7f2),_0x2ff074['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}updateResourceState(_0x1a43df,_0x24cd63){this['_resourcesListView']['updateResourceState'](_0x1a43df,_0x24cd63);}};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(_0x3161bd,_0x5111f4,_0x5e4b79){this['_locale']=_0x3161bd,this['_bodyCollection']=_0x5111f4,this['_config']=_0x5e4b79;}['showSourceResourcesBalloon']({source:_0x2f2ccb,withBackButton:_0x3c5402}){let _0x5386b0=this['_sourceResourceBalloons']['get'](_0x2f2ccb['id']);_0x5386b0||(_0x5386b0=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x2f2ccb['id'],_0x5386b0),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x5386b0)),this['_addSourceResourceContent']({'balloonPanel':_0x5386b0,'source':_0x2f2ccb,'withBackButton':_0x3c5402}),_0x5386b0['show']();const _0x332360=this['_config']['getTargetElement']();_0x332360&&_0x5386b0['pin']({'target':_0x332360,'limiter':this['_config']['getLimiterElement']()});}populateSourceResourceBalloon(_0x2202b3,_0x2aa78b,_0x39997e){const _0x4338ac=this['_sourceResourceBalloons']['get'](_0x2202b3);if(!_0x4338ac)return;const _0x469d1d=this['_getResourcesViewFromBalloon'](_0x4338ac);_0x469d1d&&(_0x469d1d['setResources'](_0x2aa78b,_0x39997e),_0x469d1d['once']('change:isLoading',()=>{_0x4338ac['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x255676){const _0x119c19=this['_sourceResourceBalloons']['get'](_0x255676);_0x119c19&&requestAnimationFrame(()=>{_0x119c19['hide'](),this['_sourceResourceBalloons']['delete'](_0x255676),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x2c3a0e of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x2c3a0e);}['isAnyResourceBalloonVisible'](){for(const _0x4eea6a of this['_sourceResourceBalloons']['values']())if(_0x4eea6a['isVisible'])return!0x0;return!0x1;}updateResourceState(_0x3b7e9a,_0x323851,_0x36fca0){const _0x26550c=this['_sourceResourceBalloons']['get'](_0x3b7e9a);if(!_0x26550c||!_0x26550c['isVisible'])return;const _0x2a6d1d=this['_config']['getTargetElement']();if(!_0x2a6d1d)return;_0x26550c['pin']({'target':_0x2a6d1d,'limiter':this['_config']['getLimiterElement']()});const _0x2e5872=this['_getResourcesViewFromBalloon'](_0x26550c);_0x2e5872&&_0x2e5872['updateResourceState'](_0x323851,_0x36fca0);}destroy(){for(const _0x85b89d of this['_sourceResourceBalloons']['values']())_0x85b89d['destroy']();this['_sourceResourceBalloons']['clear']();}_createSourceResourceBalloonPanel(){const _0x2140b0=new xt(this['_locale']);return _0x2140b0['extendTemplate']({'attributes':{'class':Fo}}),this['_bodyCollection']['add'](_0x2140b0),_0x2140b0;}_addSourceResourceContent({balloonPanel:_0x14041f,source:_0xd88b3,withBackButton:_0x106d46}){_0x14041f['content']['clear']();const _0x5b0671=this['_createBalloonHeader']({'balloonPanel':_0x14041f,'source':_0xd88b3,'withBackButton':_0x106d46});_0x14041f['content']['add'](_0x5b0671);const _0x200330=this['_createBalloonResourcesView'](_0xd88b3);_0x14041f['content']['add'](_0x200330);}_createBalloonHeader({balloonPanel:_0x263831,source:_0x2f85de,withBackButton:_0x25a7e1}){const _0x25c2c7=new Kt(this['_locale'],{'label':_0x2f85de['label'],'class':Wo});return _0x25a7e1&&_0x25c2c7['children']['add'](this['_createBackButton'](_0x263831),0x0),_0x25c2c7;}_createBackButton(_0x5eadb8){const _0x3eb122=new Mt(this['_locale']);return _0x3eb122['set']({'icon':_0x58652b,'tooltip':Es(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':Ko}),_0x3eb122['on']('execute',()=>{_0x5eadb8['hide'](),this['_config']['onBackToContext']();}),_0x3eb122;}_createBalloonResourcesView(_0x548d7d){const _0x43ee69=new Go(this['_locale'],{'source':_0x548d7d,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x43ee69['on']('loadSourceResources',(_0x3e9dec,_0x2b10b0)=>{this['_config']['onLoadSourceResources'](_0x2b10b0);}),_0x43ee69['on']('addResourceToContext',(_0x7fc1d1,_0x36f903)=>{this['_config']['onResourceSelected'](_0x36f903['source'],_0x36f903['resource']),this['closeSourceResourceBalloon'](_0x548d7d['id']);}),_0x43ee69;}_getResourcesViewFromBalloon(_0x6ef75e){const _0x9ae208=_0x6ef75e['content']['get'](0x1);return _0x9ae208 instanceof Go?_0x9ae208:null;}_setupSingleResourceBalloonClickOutsideHandler(_0x968994){_0x4b6d2c({'emitter':_0x968994,'contextElements':[_0x968994['element']],'callback':()=>{_0x968994['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x968994['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 _0x414492{addContextButtonView;_currentContextsChips=this['createCollection']();_conversationContextsChips=this['createCollection']();['_overflowManager'];_addContextBalloonPanelView;['_urlBalloonPanelView'];_urlInputView;['_resourcesBalloonView'];_addContextBalloonConfig;_hasExactlyOneSource=!0x1;bodyCollection;constructor(_0x22ccb4,_0x1e5738){super(_0x22ccb4),this['bodyCollection']=_0x1e5738['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x22ccb4),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x22ccb4),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x22ccb4),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x22ccb4,_0x1e5738);const _0x3ec8fc={'cssClasses':{'showMoreButton':ia+'\x20'+Dn,'showMoreBalloon':sa,'overflowContainer':ea,'controlsButton':ta}};this['_overflowManager']=new Qr(_0x22ccb4,this['_currentContextsChips'],_0x3ec8fc,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(_0x2aced8,_0x1c9fad){const _0xbe7b70=this['_createContextButton'](_0x2aced8,'current',!0x0,_0x1c9fad);this['_addContextToCollection'](_0xbe7b70,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}removeContextItem(_0x2cf35e){this['_removeContextFromCollection'](_0x2cf35e,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x2cf35e,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}setContextItemLoading(_0x2c2e1e,_0x3684bd){let _0x17f2a8=this['_currentContextsChips']['find'](_0x13bbde=>_0x13bbde['id']===_0x2c2e1e);_0x17f2a8||(_0x17f2a8=this['_overflowManager']['overflowChips']['find'](_0x364106=>_0x364106['id']===_0x2c2e1e)),_0x17f2a8&&(_0x17f2a8['isLoading']=_0x3684bd);}setConversationContext(_0x4bb649){this['_conversationContextsChips']['clear']();for(const _0x2dd18b of _0x4bb649){const _0x3b4faf=this['_createContextButton'](_0x2dd18b,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x3b4faf,this['_conversationContextsChips']);}}clearCurrentContextItems(){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}clearConversationContextItems(){this['_conversationContextsChips']['clear']();}updateResourceState(_0x1391ae,_0x59a56b,_0x249d1f){this['_resourcesBalloonView']['updateResourceState'](_0x1391ae,_0x59a56b,_0x249d1f);}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:_0x4614f0,withBackButton:_0x2bf540}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x4614f0,'withBackButton':_0x2bf540}),this['addContextButtonView']['isOn']=!0x0;}populateSourceResourceBalloon(_0x3c01ee,_0x2d2809,_0x15a3b4,_0x3dd3ef){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x3c01ee,_0x15a3b4,_0x3dd3ef);}['closeSourceResourceBalloon'](_0xba6bc9){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0xba6bc9),this['addContextButtonView']['isOn']=!0x1;}setAddContextOptions(_0x437d7e){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x437d7e),this['_setAddContextButtonEnabled'](_0x437d7e);}_setAddContextButtonEnabled(_0x33bc0d){const _0x2c1af4=!_0x33bc0d['document']['isHidden']&&_0x33bc0d['document']['enabled'],_0x4c8b98=_0x33bc0d['urls']['enabled'],_0x576787=_0x33bc0d['files']['enabled'],_0xb1bdc=_0x33bc0d['sources']['length']>0x0,_0x28f3ab=_0x33bc0d['customItems']&&_0x33bc0d['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x2c1af4||_0x4c8b98||_0x576787||_0xb1bdc||_0x28f3ab;}_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(_0x21f42e){const _0x152373=new Mt(_0x21f42e);return _0x152373['set']({'label':Es(_0x21f42e,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':ta+'\x20'+zo+'\x20'+Dn,'icon':_0x334e29,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x152373;}_createAddContextBalloonPanelView(_0x4c13ea){return this['_createBaseBalloonPanel'](_0x4c13ea,Xo);}_createUrlBalloonPanelView(_0x46966d){const _0x18263d=this['_createBaseBalloonPanel'](_0x46966d,jo);return this['_addUrlContent'](_0x18263d,_0x46966d),_0x18263d;}_createResourcesBalloonView(_0x5b9c81,_0x45eff0){const _0x4b1443={'searchInputVisibleFrom':_0x45eff0['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra});},'onResourceSelected':(_0x44dea3,_0x4b8693)=>{this['fire']('addResourceToContext',{'source':_0x44dea3,'resource':_0x4b8693});},'onLoadSourceResources':_0x17536b=>{this['fire']('loadSourceResources',_0x17536b);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new Yo(_0x5b9c81,_0x45eff0['bodyCollection'],_0x4b1443);}_getLimiterElement(){return this['element']?.['closest']('.'+na)||document['body'];}_createBaseBalloonPanel(_0x2626ea,_0x4328c8){const _0x23770d=new xt(_0x2626ea);return _0x23770d['extendTemplate']({'attributes':{'class':_0x4328c8}}),this['bodyCollection']['add'](_0x23770d),_0x23770d;}_setBalloonPanelContent(_0x41dd78,_0xc39f3a,_0x1e692f){if(_0x41dd78['content']['clear'](),!_0x1e692f['document']['isHidden']&&_0x1e692f['document']['enabled']){const _0x559ec5=this['_createBalloonButton'](_0xc39f3a,{'label':Es(_0xc39f3a,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x1e6b58});_0x559ec5['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x41dd78['content']['add'](_0x559ec5);}if(_0x1e692f['urls']['enabled']){const _0x152720=this['_createBalloonButton'](_0xc39f3a,{'label':Es(_0xc39f3a,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x5943de});_0x152720['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra}),this['_urlInputView']['focus']();}),_0x41dd78['content']['add'](_0x152720);}if(_0x1e692f['files']['enabled']){const _0x11e83f=new Gt(_0xc39f3a);_0x11e83f['set']({'label':Es(_0xc39f3a,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x7ae57f,'withText':!0x0,'tooltip':!0x0,'class':Jo,'allowMultipleFiles':!0x0}),_0x11e83f['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x11e83f['on']('done',(_0x5b635a,_0x599cbc)=>{this['fire']('addFileToContext',_0x599cbc);}),_0x11e83f['tooltip']=!0x0,_0x41dd78['content']['add'](_0x11e83f);}for(const _0x2f59fb of _0x1e692f['sources']){const _0x14c8e7=this['_createBalloonButton'](_0xc39f3a,{'label':_0x2f59fb['label'],'icon':_0x2f59fb['icon']||_0x2033c3,'type':'source'});_0x41dd78['content']['add'](_0x14c8e7),_0x14c8e7['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x2f59fb,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x2f7a7a of _0x1e692f['customItems']||[]){const _0x2593ef=this['_createBalloonButton'](_0xc39f3a,{'label':_0x2f7a7a['label'],'icon':_0x2f7a7a['icon']||_0x2033c3,'type':'customItem'});_0x41dd78['content']['add'](_0x2593ef),_0x2593ef['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x2f7a7a);});}this['_hasExactlyOneSource']=0x1===_0x41dd78['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}_addUrlContent(_0x3cef46,_0x152564){this['_urlInputView']=new xo(_0x152564),this['_urlInputView']['on']('submitUrl',(_0x48902a,_0x48013f)=>{this['_handleUrlSubmit'](_0x48013f);}),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});}),_0x3cef46['content']['add'](this['_urlInputView']);}_createBalloonButton(_0xbadc9b,_0xe73975){const _0xe76cba='source'===_0xe73975['type']?new aa(_0xbadc9b):new Mt(_0xbadc9b);return _0xe76cba['set']({'label':_0xe73975['label'],'icon':_0xe73975['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':Jo}),_0xe76cba;}_setupAllBalloonClickOutsideHandlers(){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}_setupUrlBalloonClickOutsideHandler(){_0x4b6d2c({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}_toggleAddContextBalloon(_0x12cd8d){const _0x593b79=this['_addContextBalloonConfig'];_0x593b79['buttonView']['isOn']=_0x12cd8d,_0x12cd8d?_0x593b79['balloonView']['show']():_0x593b79['balloonView']['hide']();}_setupAddContextBalloonClickOutsideHandler(){const {balloonView:_0x62b72d,buttonView:_0xbac6c0,hideMethod:_0x3d07bf}=this['_addContextBalloonConfig'];_0x4b6d2c({'emitter':_0x62b72d,'contextElements':[_0x62b72d['element'],_0xbac6c0['element']],'callback':()=>{_0x3d07bf();},'activator':()=>_0xbac6c0['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}_createContextButton(_0x1e9e1f,_0x44b288,_0x3e27d3=!0x1,_0x1a5a0c=!0x1){const _0x304e80='conversation'===_0x44b288||!0x0===_0x1e9e1f['isReadOnly'],_0x49cf8f=new Wr(this['locale'],_0x1e9e1f,_0x304e80,_0x3e27d3,_0x1a5a0c);return _0x304e80||_0x49cf8f['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x49cf8f['id']);}),_0x49cf8f;}_addContextToCollection(_0x436bbc,_0xee0802){_0xee0802['add'](_0x436bbc,0x0);}_removeContextFromCollection(_0x294549,_0x30735f){const _0x1d0ac0=_0x30735f['find'](_0x527600=>_0x527600['id']===_0x294549);_0x1d0ac0&&_0x30735f['remove'](_0x1d0ac0);}_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(_0x46b5b1){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x46b5b1);}},aa=class extends Mt{['arrowView'];constructor(_0x57f3a0){super(_0x57f3a0),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 _0x1a9140=new $t();return _0x1a9140['content']=_0xd84f6e,_0x1a9140['extendTemplate']({'attributes':{'class':Zo+'__arrow'}}),_0x1a9140;}},ha=class extends _0x414492{_cancelButtonView;['_loaderView'];constructor(_0x113b5d){super(_0x113b5d),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 _0x547a4b=new Mt(this['locale']);return _0x547a4b['set']({'label':Es(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Pn+'\x20ck-ai-button-stop-generating','icon':st}),_0x547a4b['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x547a4b;}_createLoaderView(){const _0x28ccfd=new _0x414492(this['locale']);return _0x28ccfd['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')}]}),_0x28ccfd;}},ca=class extends _0x414492{_contextPanelView;_promptInputView;['_dropZoneView'];_promptCapabilitiesView;['_loaderView'];['_modelUnavailableMessageView'];_shouldRestorePromptInputFocus;['_filesEnabled'];constructor(_0x1c83d7,_0x4c26f4){super(_0x1c83d7),this['_filesEnabled']=_0x4c26f4['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x1c83d7,{'bodyCollection':_0x4c26f4['bodyCollection'],'searchInputVisibleFrom':_0x4c26f4['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x1c83d7),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x1c83d7),this['_loaderView']=this['_createLoaderView'](_0x1c83d7),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x1c83d7),this['_dropZoneView']=new Ao(_0x1c83d7),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',_0xa60e7c=>!_0xa60e7c),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 _0x7ea197=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x7ea197['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x7ea197['if']('isLoading','ck-hidden',_0xe99088=>_0xe99088||!this['isModelAvailable']),_0x7ea197['if']('isModelAvailable','ck-hidden',_0x539fc4=>!_0x539fc4||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x7ea197['if']('isLoading','ck-hidden',_0x5eb199=>!_0x5eb199)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x7ea197['if']('isModelAvailable','ck-hidden',_0x4e1ba5=>_0x4e1ba5)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0x4b6d2c({'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(_0xc8a8dd,_0x288525){return new oa(_0xc8a8dd,_0x288525);}_createPromptInputView(_0x75ee72){return new go(_0x75ee72,this['_contextPanelView']['addContextButtonView']);}_createPromptCapabilitiesView(_0x29c253){return new ko(_0x29c253);}_createLoaderView(_0x3eed0b){return new ha(_0x3eed0b);}_createModelUnavailableMessageView(_0x18fe80){const _0x4667d4=new la(_0x18fe80);return _0x4667d4['delegate']('startConversation')['to'](this),_0x4667d4;}_handlePromptInputFocus(_0xb55b82,_0x148026,_0x85e06c){_0x85e06c?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}addContextItem(_0x2f60e9,_0x3f5354){this['_contextPanelView']['addContextItem'](_0x2f60e9,_0x3f5354);}removeContextItem(_0x254bf4){this['_contextPanelView']['removeContextItem'](_0x254bf4);}setContextItemLoading(_0x4f33b9,_0x3eb17f){this['_contextPanelView']['setContextItemLoading'](_0x4f33b9,_0x3eb17f);}setIsUploadInProgress(_0x21f784){this['_promptInputView']['setIsUploadInProgress'](_0x21f784);}setConversationContext(_0x42db4d){this['_contextPanelView']['setConversationContext'](_0x42db4d);}clearPendingContextUI(){this['_contextPanelView']['clearCurrentContextItems']();}clearConversationContextUI(){this['_contextPanelView']['clearConversationContextItems']();}updateResourceState(_0x5deb65,_0x44e109,_0x59440a){this['_contextPanelView']['updateResourceState'](_0x5deb65,_0x44e109,_0x59440a);}setWebSearch(_0x43043c){this['_promptCapabilitiesView']['setWebSearch'](_0x43043c);}setReasoning(_0x31af75){this['_promptCapabilitiesView']['setReasoning'](_0x31af75);}resetMessageInput(){this['_promptInputView']['reset']();}setAddContextOptions(_0x3079b2){this['_contextPanelView']['setAddContextOptions'](_0x3079b2);}setInputPlaceholder(_0x42b93f){this['_promptInputView']['setPlaceholderText'](_0x42b93f);}setModelList(_0xa52bfa,_0x20571d){this['_promptCapabilitiesView']['setModelList'](_0xa52bfa,_0x20571d);}setModel(_0x326c19){_0x326c19?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x326c19)):this['isModelAvailable']=!0x1;}enableModelSelector(){this['_promptCapabilitiesView']['enableModelSelector']();}disableModelSelector(_0xfd9833){this['_promptCapabilitiesView']['disableModelSelector'](_0xfd9833);}populateSourceResourceBalloon(_0x35666f,_0x415a4c,_0x1a399c,_0x5b687d){this['_contextPanelView']['populateSourceResourceBalloon'](_0x35666f,_0x415a4c,_0x1a399c,_0x5b687d);}['closeSourceResourceBalloon'](_0x57d8f9){this['_contextPanelView']['closeSourceResourceBalloon'](_0x57d8f9);}focusPromptInput(_0x5c0b0e=!0x1){this['_promptInputView']['focus'](_0x5c0b0e);}setPromptInputValue(_0x53f6f8){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x53f6f8;}},la=class extends _0x414492{constructor(_0x102627){super(_0x102627);const _0x5c2094=new Mt(_0x102627);_0x5c2094['set']({'label':Es(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x5c2094['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'},_0x5c2094]}]});}},ua=class extends Kt{resizeButton;constructor(_0x3f767e,_0x1c7de2){super(_0x3f767e,{'label':_0x1c7de2['label'],'class':'ck-ai-header\x20'+_0x1c7de2['class'],'icon':_0x1c7de2['icon']}),this['set']('isMaximized',!0x1),_0x1c7de2['content']&&this['children']['add'](_0x1c7de2['content']),_0x1c7de2['showResizeButton']&&(this['resizeButton']=Hn(_0x3f767e,this),this['children']['add'](this['resizeButton']));}},da=class extends _0x414492{constructor(_0x973ab0){super(_0x973ab0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Es(_0x973ab0,'AI_DISCLAIMER_TEXT')}]}]});}};function _a(_0xef5d7d,_0x32f6ae){const _0x18efe6=new Mt(_0xef5d7d);return _0x18efe6['set']({'label':Es(_0xef5d7d,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x2ee682,'class':'ck-ai-chat__start-conversation\x20'+Pn}),_0x18efe6['on']('execute',()=>{_0x32f6ae['fire']('startConversation');}),_0x18efe6;}var ga=class extends _0x414492{chatHeader;chatFeed;chatControls;chatDisclaimer;_bodyCollection;constructor(_0x244198,_0x4546f3){super(_0x244198),this['_bodyCollection']=Mn(_0x244198);const _0x196d3c=_a(_0x244198,this);this['chatHeader']=new ua(_0x244198,{'label':Es(_0x244198,'AI_CHAT_HEADING'),'icon':_0x39a424,'class':'ck-ai-header_chat','content':_0x196d3c,'showResizeButton':_0x4546f3['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new co(_0x244198,this['_bodyCollection']),this['chatFeed']['delegate'](...sr)['to'](this),this['chatControls']=new ca(_0x244198,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x4546f3['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x4546f3['filesEnabled']}),this['chatControls']['delegate'](...sr)['to'](this),this['chatDisclaimer']=new da(_0x244198),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x244198['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}populateSourceResourceBalloon(_0x22796c,_0x20c47e,_0x513cf5,_0xd5ef75){this['chatControls']['populateSourceResourceBalloon'](_0x22796c,_0x20c47e,_0x513cf5,_0xd5ef75);}['closeSourceResourceBalloon'](_0xef7af6){this['chatControls']['closeSourceResourceBalloon'](_0xef7af6);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Aa=class extends _0x77cfae{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(_0xa4c970){super(_0xa4c970);const _0x5c9f8f=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':_0x5c9f8f['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'](_0x5c9f8f),this['_view']['delegate'](...sr)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x362f35,{showDiff:_0x46fdf0})=>{this['showDiff']=_0x46fdf0;}),this['disableControls'](),_0x5c9f8f['view']['addTab']({'id':'chat','buttonLabel':Es(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x39a424,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x5c9f8f['view'],'isMaximized',_0x594195=>_0x594195),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isChatStreaming',_0x1be5ef=>_0x1be5ef),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}destroy(){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}createConversation({availableModels:_0x1de166}){const _0x7e9975=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'](_0x1de166,!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x7e9975}),this['fire']('conversationCreated');}async addFeedItemStaticMessage({id:_0x219c83,staticMessage:_0x1cb442}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x219c83,'initialContent':'<p>'+_0x1cb442+'</p>'});});}async addFeedItemUserMessage(_0x226d3e){const _0xe2bc4b=_0x226d3e['attributes']?.['displayedPrompt']||_0x226d3e['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x226d3e['contextItems']['values']()),'initialContent':'<p>'+_0xe2bc4b+'</p>','id':_0x226d3e['id']});});}async addFeedItemError({errorMessage:_0x219e03,id:_0x345e24}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x219e03+'</p>','id':_0x345e24});});}async addFeedItemAIReply(_0x18b274){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x18b274['interactionId']+':'+_0x18b274['id']}),this['clearLoadingMessage']();});}async addFeedItemAISuggestion(_0x3c9ef4){const _0x10c610=bs(this['context']),_0x4fcf8b=_0x10c610['map'](_0x2aab0f=>_0x2aab0f['config']['get']('ai.availableReplyActions')||[...Or]);let _0x3bb9bc=_0x4fcf8b['reduce']((_0x49b60f,_0x38cd2d)=>_0x49b60f['filter'](_0x50af80=>_0x38cd2d['includes'](_0x50af80)),_0x4fcf8b[0x0]||[...Or]);const _0x240ef2=_0x10c610['every'](_0x44bd60=>_0x44bd60['plugins']['has']('TrackChanges')),_0x115e39=_0x10c610['map'](_0x1a1ced=>_0x1a1ced['commands']['get']('trackChanges'));return _0x240ef2?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x115e39,'value',(..._0x128c40)=>_0x128c40['some'](_0x4e3be4=>_0x4e3be4))):_0x3bb9bc=_0x3bb9bc['filter'](_0x3a0c4d=>'insertSuggestion'!=_0x3a0c4d),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x3c9ef4['interactionId']+':'+_0x3c9ef4['id'],'areActionsDisabled':_0x3c9ef4['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x3bb9bc}),this['clearLoadingMessage']();});}async addFeedInteractionHeader(_0x4ea9e5,_0x349794){return this['_promiseQueue']['enqueue'](async()=>{const _0x45938a=this['_view']['chatFeed']['children']['last'];if(_0x45938a instanceof so)return this['_view']['chatFeed']['children']['remove'](_0x45938a),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x4ea9e5['id'],'capabilities':{'isWebSearchEnabled':_0x45938a['capabilities']['isWebSearchEnabled']||_0x349794['isWebSearchEnabled'],'isReasoningEnabled':_0x45938a['capabilities']['isReasoningEnabled']||_0x349794['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x4ea9e5['id'],'capabilities':_0x349794});});}async addFeedItemCustomElement(_0x616653,_0x11b3b3){let _0x36f727;return await this['_promiseQueue']['enqueue'](async()=>{_0x36f727=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x616653,'id':_0x11b3b3});}),_0x36f727;}removeFeedItem(_0x2bfc90){this['_view']['chatFeed']['removeItem'](_0x2bfc90);}hasFeedItem(_0x5ba4e6){return this['_view']['chatFeed']['hasItem'](_0x5ba4e6);}updateFeedInteractionHeader(_0x220eb2){const _0x366073=this['_view']['chatFeed']['children']['find'](_0x2de3d5=>_0x2de3d5['options']['id']==_0x220eb2['id']&&_0x2de3d5 instanceof so);_0x366073&&_0x366073['set']('isVisible',_0x220eb2['isVisible']);}async updateFeedItemAIReplyContent(_0x4e5973){const _0x1ea478=_0x4e5973['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x1a17e9=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x4e5973,'abortSignal':_0x1a17e9,'renderingStrategy':_0x1ea478}),_0x4e5973['isDone']&&this['markFeedItemAsDone'](_0x4e5973['id']);});}updateFeedItemAIReplySources(_0x223c37,_0x710dab){this['_view']['chatFeed']['updateWebSources'](_0x223c37,_0x710dab);}async updateFeedItemAIReplySuggestionContent(_0x1b6f1d){return this['_promiseQueue']['enqueue'](async _0x451027=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x1b6f1d,'abortSignal':_0x451027}),_0x1b6f1d['isDone']&&this['markFeedItemAsDone'](_0x1b6f1d['id']);});}updateFeedItemAIReplySuggestionPartState(_0x32fd6f){this['_view']['chatFeed']['updateSuggestionPartState'](_0x32fd6f);}setSuggestionGating(_0x4315e9,_0x2b882d){this['_view']['chatFeed']['updateSuggestionGating'](_0x4315e9,_0x2b882d);}setFeedItemAIReplySuggestionPartActive(_0x10ac89){this['_view']['chatFeed']['setSuggestionPartActive'](_0x10ac89);}markFeedItemAsDone(_0x47fad4){this['_view']['chatFeed']['markItemAsDone'](_0x47fad4);}removeFeedInteraction(_0x28c3e7){this['_view']['chatFeed']['getItemIds']()['filter'](_0x583ea6=>_0x583ea6['startsWith'](_0x28c3e7))['forEach'](_0x265dd1=>this['_view']['chatFeed']['removeItem'](_0x265dd1));}startInteraction(){const _0x1e30e4=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x1e30e4),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['isChatStreaming']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}stopInteraction(_0x2face1){this['_promiseQueue']['abort'](),_0x2face1&&this['_view']['chatFeed']['getItemIds']()['filter'](_0x4a28c2=>_0x4a28c2['startsWith'](_0x2face1['id']))['forEach'](_0x3f3491=>this['markFeedItemAsDone'](_0x3f3491)),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(_0x4c0504,_0x4184fd){this['_view']['chatControls']['addContextItem'](_0x4c0504,_0x4184fd);}removeContextItem(_0x505524){this['_view']['chatControls']['removeContextItem'](_0x505524);}setContextItemLoading(_0x360a5e,_0x5bcd98){this['_view']['chatControls']['setContextItemLoading'](_0x360a5e,_0x5bcd98);}setIsUploadInProgress(_0x425eac){this['_view']['chatControls']['setIsUploadInProgress'](_0x425eac);}setConversationContext(_0x29d0de){this['_view']['chatControls']['setConversationContext'](_0x29d0de);}clearPendingContextUI(){this['_view']['chatControls']['clearPendingContextUI']();}clearConversationContextUI(){this['_view']['chatControls']['clearConversationContextUI']();}updateResourceState(_0xa096c7,_0xdcf16d,_0x1d911f){this['_view']['chatControls']['updateResourceState'](_0xa096c7,_0xdcf16d,_0x1d911f);}resetMessageInput(){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}setAddContextOptions(_0x278f07){this['_view']['chatControls']['setAddContextOptions'](_0x278f07);}updateCapabilities(_0x3d8ab0){this['_view']['chatControls']['setWebSearch'](_0x3d8ab0['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x3d8ab0['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x3d8ab0));}setSelectedModel(_0x2c7231,_0x4fc639){this['_view']['chatControls']['setModel'](_0x2c7231),_0x4fc639&&this['_view']['chatControls']['disableModelSelector'](!0x1);}setFeedItemRenderingStrategy(_0x4f473d){this['feedItemRenderingStrategy']=_0x4f473d;}toggleLoadingSkeleton(_0x51a500){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x51a500);}resetConversationTitle(){this['setConversationTitle'](Es(this['context']['locale'],'AI_CHAT_HEADING'));}emptyConversationTitle(){this['setConversationTitle']('');}setConversationTitle(_0x1e41be,_0x118985=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0x118985&&!Et()&&_0x1e41be['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x1e41be);this['_view']['chatHeader']['label']=_0x1e41be;}setLoadingMessage(_0x4b694b){this['_view']['chatFeed']['setLoadingMessage'](_0x4b694b);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}_animateConversationTitle(_0x41fa1f){let _0xb073dd=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x41fa1f[_0xb073dd],_0xb073dd++,_0xb073dd===_0x41fa1f['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x1aae38){return _0x1aae38['isWebSearchEnabled']&&_0x1aae38['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x1aae38['isWebSearchEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x1aae38['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}_getInputPlaceholder(_0x43d0c4){return _0x43d0c4?_0x43d0c4['isWebSearchEnabled']&&_0x43d0c4['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x43d0c4['isWebSearchEnabled']?Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x43d0c4['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(_0x565626,_0x575cbd,_0x37e118,_0x5f121f){this['_view']['populateSourceResourceBalloon'](_0x565626,_0x575cbd,_0x37e118,_0x5f121f);}['closeSourceResourceBalloon'](_0x23933d){this['_view']['closeSourceResourceBalloon'](_0x23933d);}setPromptInputValue(_0x5c2021){this['_view']['chatControls']['setPromptInputValue'](_0x5c2021);}focusPromptInput(_0x13ef54=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x13ef54);}scrollFeedToSuggestion(_0x31e681,_0x5de7bc){this['_view']['chatFeed']['scrollToSuggestion'](_0x31e681,_0x5de7bc);}startAutoScroll(_0x516e5e={}){this['_view']['chatFeed']['startAutoScroll'](_0x516e5e);}stopAutoScroll(){this['_view']['chatFeed']['stopAutoScroll']();}disableControls(){this['_view']['chatControls']['isDisabled']=!0x0;}enableControls(){this['_view']['chatControls']['isDisabled']=!0x1;}toggleConversationLoading(_0x496525){_0x496525?(this['isBusy']=_0x496525,this['disableControls']()):(this['enableControls'](),this['resetChatBusyStateToIdle']());}},Ia=class extends Jt{sections;constructor(_0x336142,_0x12cdea){super(_0x336142),this['sections']=_0x12cdea,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}filter(_0x440961){let _0x1cef2a=0x0,_0x24971d=0x0;for(const _0x40b944 of this['sections']){const {resultsCount:_0x24090b,totalItemsCount:_0x395c14}=_0x40b944['filter'](_0x440961);_0x1cef2a+=_0x24090b,_0x24971d+=_0x395c14;}return{'resultsCount':_0x1cef2a,'totalItemsCount':_0x24971d};}},pa=class extends jt{title;itemsViews;_itemsListView;constructor(_0x412e58,{title:_0x451718,items:_0x10f5c3}){super(_0x412e58);const _0x26f3d7=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x451718,this['itemsViews']=_0x10f5c3;const _0x16c07b=new _0x414492(_0x412e58);_0x16c07b['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new Jt(_0x412e58),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x26f3d7['if']('isVisible','ck-hidden',_0x369c07=>!_0x369c07)]},'children':[_0x16c07b,this['_itemsListView']]});}filter(_0x3008a6){const _0x45f7ec=this['itemsViews']['length'];let _0x107e8e=0x0;for(const _0x40f246 of this['itemsViews'])_0x3008a6?(_0x40f246['isVisible']=!!_0x40f246['isMatching'](_0x3008a6),_0x40f246['highlightText'](_0x3008a6)):(_0x40f246['isVisible']=!0x0,_0x40f246['highlightText'](null)),_0x40f246['isVisible']&&_0x107e8e++;return this['isVisible']=_0x107e8e>0x0,{'resultsCount':_0x107e8e,'totalItemsCount':_0x45f7ec};}getItem(_0x30e96c){return this['itemsViews']['find'](_0x176845=>_0x176845['id']===_0x30e96c);}removeItem(_0x3309da){const _0x1d051a=this['itemsViews']['indexOf'](_0x3309da);-0x1!==_0x1d051a&&(this['itemsViews']['splice'](_0x1d051a,0x1),this['_itemsListView']['items']['remove'](_0x3309da));}};const Ea=/* #__PURE__ -- @preserve */
|
|
34
|
-
_0x15fd82(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(_0x5ce5e2,_0x3085d9){super(_0x5ce5e2);const _0x140b47=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x3085d9['pinned']),this['set']('loadingState',null),this['set']('title',_0x3085d9['title']),this['id']=_0x3085d9['id'];const {createdAt:_0x24ab2e,active:_0x5a2a65=!0x1}=_0x3085d9;this['_titleView']=new Yt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x5cdd3f=this['_createCheckView'](),_0x48e2ac=this['_createPinButtonView'](_0x5ce5e2),_0x3562d=this['_createMenuDropdownView'](),_0x2af1bb=this['_createEditInputView'](_0x5ce5e2),_0x3028f1=this['_createAcceptEditButtonView'](_0x5ce5e2,_0x2af1bb),_0x437141=this['_createCancelEditButtonView'](_0x5ce5e2);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x48e2ac),this['actions']['add'](_0x3562d),this['on']('change:isEdit',(_0x7e46c,_0x456628,_0xaf17e2)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0xaf17e2?(this['actions']['add'](_0x3028f1),this['actions']['add'](_0x437141),this['mainContent']['add'](_0x2af1bb),_0x2af1bb['element']['value']=this['title']||'',_0x2af1bb['element']['focus']()):(this['actions']['add'](_0x48e2ac),this['actions']['add'](_0x3562d),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x5a2a65?'ck-ai-chat-history__item--active':'',_0x140b47['if']('isVisible','ck-hidden',_0x2e93b9=>!_0x2e93b9),_0x140b47['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',_0x140b47['if']('loadingState','ck-hidden',_0xc752fe=>!!_0xc752fe)]},'children':_0x5a2a65?[_0x5cdd3f]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x140b47['if']('loadingState','ck-hidden',_0x579baa=>!_0x579baa)]},'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',_0x140b47['if']('loadingState','ck-hidden',_0x47bce2=>!!_0x47bce2)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x140b47['if']('loadingState','ck-hidden',_0xea31ba=>!_0xea31ba)]},'children':[{'text':_0x140b47['to']('loadingState',_0x48ef4b=>_0x48ef4b?Es(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x48ef4b]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x24ab2e]}]},{'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(_0x473c90){this['set']('title',_0x473c90);}updateLoadingState(_0x23e87a,_0x3c9acf){this['set']('loadingState',_0x3c9acf?_0x23e87a:null);}_createCheckView(){const _0x4772b2=new $t();return _0x4772b2['set']({'content':_0x32ea05}),_0x4772b2;}_createPinButtonView(_0x892e91){const _0xce64a7=new Mt(_0x892e91);return _0xce64a7['set']({'label':Es(_0x892e91,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x2175f6,'withText':!0x1,'tooltip':!0x0}),_0xce64a7['bind']('isOn')['to'](this,'pinned'),_0xce64a7['on']('execute',()=>{const _0x1b2467=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x1b2467});}),_0xce64a7;}_createMenuDropdownView(){const _0x4a2749=_0x44881d(this['locale']),_0x1a5530=_0x4a2749['panelView']['children'];_0x4a2749['buttonView']['set']({'label':Es(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':rt}),_0x4a2749['panelPosition']='sw';const _0x4e8973=new Mt(this['locale']);_0x4e8973['label']=Es(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x4e8973['withText']=!0x0,_0x4e8973['on']('execute',()=>{this['isEdit']=!0x0;});const _0x51ed92=new Mt(this['locale']);_0x51ed92['label']=Es(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x51ed92['withText']=!0x0,_0x51ed92['on']('execute',()=>{this['showConfirm'](Es(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x213cfb=new Jt(this['locale']),_0x28826d=new jt(this['locale']);_0x28826d['children']['add'](_0x4e8973);const _0x205e8c=new jt(this['locale']);return _0x205e8c['children']['add'](_0x51ed92),_0x213cfb['items']['addMany']([_0x28826d,_0x205e8c]),_0x1a5530['add'](_0x213cfb),_0x4a2749;}_createEditInputView(_0x2e0d93){const _0x46183a=new qt(_0x2e0d93),_0xef16be=_0x46183a['bindTemplate'];return _0x46183a['extendTemplate']({'on':{'keydown':_0xef16be['to'](_0x36894a=>{'Enter'==_0x36894a['key']&&this['_commitEditInputValue'](_0x46183a);})}}),_0x46183a;}_createAcceptEditButtonView(_0x2580c1,_0x55297f){const _0x56c7be=new Mt(_0x2580c1);return _0x56c7be['set']({'icon':_0x32ea05,'withText':!0x1,'tooltip':Es(_0x2580c1,'AI_CHAT_HISTORY_ACCEPT')}),_0x56c7be['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x56c7be['on']('execute',()=>{this['_commitEditInputValue'](_0x55297f);}),_0x56c7be;}_commitEditInputValue(_0x1eba34){const _0x324c7=_0x1eba34['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x324c7});}_createCancelEditButtonView(_0x1473f8){const _0x90989a=new Mt(_0x1473f8);return _0x90989a['set']({'icon':_0x40a4cb,'withText':!0x1,'tooltip':Es(_0x1473f8,'AI_CHAT_HISTORY_CANCEL')}),_0x90989a['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x90989a['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x90989a;}_createSpinnerView(){const _0x3ceeb7=new Dr('tiny');return _0x3ceeb7['isVisible']=!0x0,_0x3ceeb7;}isMatching(_0x26b419){return'string'==typeof this['title']&&this['title']['match'](_0x26b419)?{'title':!0x0}:null;}highlightText(_0x122b40){this['_titleView']['highlightText'](_0x122b40);}},Ta=class extends _0x414492{['headerView'];['searchView'];['mainErrorView'];skeletonView;emptyView;sectionsView;constructor(_0x511a5f,_0x5b8cac){super(_0x511a5f),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x13e5f6=_a(_0x511a5f,this);this['headerView']=new ua(_0x511a5f,{'label':Es(_0x511a5f,'AI_CHAT_HISTORY_HEADING'),'icon':_0x198287,'class':'ck-ai-header_history','content':_0x13e5f6,'showResizeButton':_0x5b8cac}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Ia(_0x511a5f,[]),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',_0x439eb5=>!_0x439eb5)]}}),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 _0x56a255=new _0x176ba3(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x39a2bf=>Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x39a2bf),'secondary':Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x54fa20=this['_createErrorView']();return _0x54fa20['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x505463=>!_0x505463)]}}),_0x56a255['on']('render',()=>{_0x56a255['children']['add'](_0x54fa20,0x1);}),_0x56a255['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x2bbc5c=>!_0x2bbc5c)]}}),_0x56a255;}_createSkeletonView(){const _0x4ec15d=new wr(this['locale'],Cr['aiHistory']);return _0x4ec15d['bind']('isVisible')['to'](this,'isLoading'),_0x4ec15d;}_createErrorView(){const _0x5b9dc8=new _0x414492(this['locale']),_0x2f01e0=new Mt(this['locale']);_0x2f01e0['set']({'withText':!0x1,'icon':_0x40a4cb,'class':'ck-ai-notification_error__dismiss-button'}),_0x2f01e0['bind']('isVisible')['to'](this,'hasItems',_0x51df5d=>!!_0x51df5d),_0x2f01e0['on']('execute',()=>{this['errorMessage']='';});const _0xc76912=this['bindTemplate'];return _0x5b9dc8['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0xc76912['to']('errorMessage')}]},_0x2f01e0]}),_0x5b9dc8;}_createEmptyStateView(){const _0x132550=new _0x414492(this['locale']);return _0x132550['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x4a1678=>!_0x4a1678)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Es(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x132550;}_createListItemViews(_0x58480a,_0x44fc30){const _0x3620a4=[];for(const _0x12c8ff of _0x58480a){const _0x5eb033=new ma(_0x44fc30,_0x12c8ff);_0x5eb033['delegate'](...wa)['to'](this),_0x3620a4['push'](_0x5eb033);}return _0x3620a4;}updateHistoryItemsWithCategories(_0x26137d){const _0x40cfaa=this['locale']||'en',_0x247222=[];for(const _0x42bef7 of _0x26137d){const _0x5cd91a=this['_createListItemViews'](_0x42bef7['items'],_0x40cfaa);_0x247222['push'](new pa(_0x40cfaa,{'title':_0x42bef7['title'],'items':_0x5cd91a}));}this['sectionsView']['sections']=_0x247222,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x247222),this['hasItems']=_0x26137d['some'](_0x1fe09c=>_0x1fe09c['items']['length']>0x0),this['_refreshSearch']();}removeHistoryItem(_0x3f9d84){for(const _0x4d1073 of this['sectionsView']['sections']){const _0x37ba9f=_0x4d1073['getItem'](_0x3f9d84);if(_0x37ba9f){if(_0x4d1073['removeItem'](_0x37ba9f),0x0===_0x4d1073['itemsViews']['length']){const _0xcf80b1=this['sectionsView']['sections']['indexOf'](_0x4d1073);-0x1!==_0xcf80b1&&(this['sectionsView']['sections']['splice'](_0xcf80b1,0x1),this['sectionsView']['items']['remove'](_0x4d1073));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}updateItemTitle(_0x406569,_0x26d1c3){for(const _0x3c6a59 of this['sectionsView']['sections']){const _0x36ab6f=_0x3c6a59['getItem'](_0x406569);if(_0x36ab6f){_0x36ab6f['updateTitle'](_0x26d1c3);break;}}}updateItemLoadingState(_0x409a82,_0x3a4099,_0x22e1cd){for(const _0x273f60 of this['sectionsView']['sections']){const _0x2d3043=_0x273f60['getItem'](_0x409a82);if(_0x2d3043){_0x2d3043['updateLoadingState'](_0x3a4099,_0x22e1cd);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x3ed300=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x3ed300);}}};const wa=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var Ca=class extends _0x77cfae{static get requires(){return[gs];}_historyView;static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x55cb3b){super(_0x55cb3b);const _0x565069=this['context']['plugins']['get']('AITabs');this['_historyView']=new Ta(this['context']['locale'],_0x565069['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x565069),this['_historyView']['delegate'](...wa)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x565069['view'],'isMaximized',_0x274e21=>_0x274e21),_0x565069['view']['addTab']({'id':'history','buttonLabel':Es(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x198287,'order':0x0,'content':this['_historyView']});}removeHistoryItem(_0x4a7a63){this['_historyView']['removeHistoryItem'](_0x4a7a63);}updateItems(_0x17e56c){this['_historyView']['updateHistoryItemsWithCategories'](_0x17e56c);}updateItemTitle(_0x47e9c6,_0x4c4460){this['_historyView']['updateItemTitle'](_0x47e9c6,_0x4c4460);}updateItemLoadingState(_0x1499e1,_0x472ab4,_0x572709){this['_historyView']['updateItemLoadingState'](_0x1499e1,_0x472ab4,_0x572709);}setLoadingSkeleton(_0x2e7bc5){this['_historyView']['isLoading']=_0x2e7bc5;}['showError'](_0x81d846){this['_historyView']['errorMessage']=_0x81d846;}['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:_0x35d2b5,group:_0x73e580}){super(),this['connector']=_0x35d2b5,this['group']=_0x73e580;}async init(){try{const _0x16d468=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x16d468);}catch(_0x452ece){this['fire']('error',{'error':_0x452ece,'operation':'init'});}}addItem(_0x55a4f4){this['items']['push'](_0x55a4f4);}async removeItem(_0x5621ee){const _0x2aa824=this['items']['findIndex'](_0x5a7ce0=>_0x5a7ce0['id']===_0x5621ee);if(-0x1===_0x2aa824)return!0x1;try{return await this['connector']['deleteConversation'](_0x5621ee)['execute'](),this['items']['splice'](_0x2aa824,0x1),this['fire']('itemRemoved',{'itemId':_0x5621ee}),!0x0;}catch(_0x2ad17f){return this['fire']('error',{'error':_0x2ad17f,'operation':'removeItem','itemId':_0x5621ee}),!0x1;}}getItem(_0x5df8b4){return this['items']['find'](_0x49a856=>_0x49a856['id']===_0x5df8b4);}async updateItemTitle(_0x26a39b,_0x532743){const _0x3c4100=this['getItem'](_0x26a39b);if(!_0x3c4100)return!0x1;try{return await this['connector']['updateConversation'](_0x26a39b,{'title':_0x532743})['getResult'](),_0x3c4100['updateTitle'](_0x532743),this['fire']('itemUpdated',{'itemId':_0x26a39b,'updates':{'title':_0x532743}}),!0x0;}catch(_0x53d9e8){return this['fire']('error',{'error':_0x53d9e8,'operation':'updateItemTitle','itemId':_0x26a39b}),!0x1;}}async updateItemPinned(_0x1b8384,_0x4a085c){const _0x642f=this['getItem'](_0x1b8384);if(!_0x642f)return!0x1;try{return await this['connector']['updateConversation'](_0x1b8384,{'pinned':_0x4a085c})['getResult'](),_0x642f['updatePinned'](_0x4a085c),this['fire']('itemUpdated',{'itemId':_0x1b8384,'updates':{'pinned':_0x4a085c}}),!0x0;}catch(_0x1d9dce){return this['fire']('error',{'error':_0x1d9dce,'operation':'updateItemPinned','itemId':_0x1b8384}),!0x1;}}loadItems(_0x25ae05){try{this['items']=[],_0x25ae05['map'](_0x3db141=>{this['addItem'](new ba(_0x3db141));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x2048a7){this['fire']('error',{'error':_0x2048a7,'operation':'loadItems'});}}getItems(_0x301974={}){const _0x5bd2ed=void 0x0!==_0x301974['pinned']&&_0x301974['pinned'],_0x47f081=_0x301974['from']?new Date(_0x301974['from']['getFullYear'](),_0x301974['from']['getMonth'](),_0x301974['from']['getDate']()):null,_0x30ea7=_0x301974['to']?new Date(_0x301974['to']['getFullYear'](),_0x301974['to']['getMonth'](),_0x301974['to']['getDate']()):null;return this['items']['filter'](_0x916696=>{if(_0x916696['pinned']!==_0x5bd2ed)return!0x1;if(_0x30ea7){const _0x4eb2df=new Date(_0x916696['createdAt']['getFullYear'](),_0x916696['createdAt']['getMonth'](),_0x916696['createdAt']['getDate']());return _0x47f081?_0x47f081['getTime']()===_0x30ea7['getTime']()?_0x4eb2df['getTime']()===_0x47f081['getTime']():_0x4eb2df<_0x30ea7&&_0x4eb2df>=_0x47f081:_0x4eb2df<_0x30ea7;}return!0x0;});}},Oa=class extends _0x77cfae{_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 _0x33b009=this['context']['plugins']['get'](gs);try{const _0x105c5c=this['_aiChatController']['getGroupId']();this['history']=new Ra({'connector':this['_aiConnector'],'group':_0x105c5c}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x27566b,_0x5460f1)=>{this['_setItemLoading'](_0x5460f1['id'],'remove'),this['_handleRemove'](_0x5460f1['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x589b02,_0x3574aa)=>{this['_setItemLoading'](_0x3574aa['id'],'rename'),this['_handleEditTitle'](_0x3574aa['id'],_0x3574aa['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x51d34b,_0x1dfb71)=>{void 0x0!==_0x1dfb71['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x1dfb71['itemId'],_0x1dfb71['updates']['title']),void 0x0!==_0x1dfb71['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x1dfb71['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x5f2291,_0x5329c0)=>{this['_aiChatController']['_handleRemovedConversation'](_0x5329c0['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x5329c0['itemId']),this['_clearItemLoading'](_0x5329c0['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x213427,_0x1d244b)=>{this['_handleHistoryErrorUI'](_0x1d244b['error'],_0x1d244b['operation'],_0x1d244b['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x1bd7f1,_0x4726e8)=>{this['_handleSelectConversation'](_0x4726e8['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x5203ac,_0x25938e)=>{const _0x32b678=_0x25938e['pinned']?'pin':'unpin';this['_setItemLoading'](_0x25938e['id'],_0x32b678),this['_handleTogglePin'](_0x25938e['id'],_0x25938e['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x33b009['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x33b009['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x458785){this['_handleHistoryErrorUI'](_0x458785,'init');}}async _handleEditTitle(_0x12792d,_0x2bf6b5){await this['history']['updateItemTitle'](_0x12792d,_0x2bf6b5);}async['_handleTogglePin'](_0x3fa109,_0x51045){await this['history']['updateItemPinned'](_0x3fa109,_0x51045);}async['_handleRemove'](_0x48210b){await this['history']['removeItem'](_0x48210b);}async _handleSelectConversation(_0x2bef98){await this['_aiChatController']['loadConversation'](_0x2bef98);}async _showConversationHistory(){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_updateHistoryItemsUI(){const _0x206ed3=this['_aiChatController']['activeConversation']?.['id'],_0x6097da=this['_getCategorizedItems']()['map'](_0x2bff9e=>({'title':_0x2bff9e['title'],'items':_0x2bff9e['items']['map'](_0x2093e2=>({'id':_0x2093e2['id'],'title':_0x2093e2['title']||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x2093e2['createdAt'])['toLocaleDateString'](),'active':_0x2093e2['id']===_0x206ed3,'pinned':_0x2093e2['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x6097da);}_setItemLoading(_0x2e6368,_0x3d377e){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x2e6368,_0x3d377e,!0x0);}_clearItemLoading(_0x88196b){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x88196b,null,!0x1);}_handleHistoryErrorUI(_0x157701,_0x587e95,_0x45fadf){const _0x4f15c1=this['_generateErrorMessage'](_0x587e95,_0x45fadf);this['_aiChatHistoryUi']['showError'](_0x4f15c1),this['_reporter']['reportError'](_0x157701,{'context':{'operation':_0x587e95}}),_0x45fadf&&this['_clearItemLoading'](_0x45fadf),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_generateErrorMessage(_0x4d92b3,_0x18b66b){const _0x385205=_0x18b66b?this['history']['getItem'](_0x18b66b):null,_0x101a57=_0x385205?.['title']||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x4d92b3){case'updateItemTitle':return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x101a57);case'updateItemPinned':{const _0x324885=Es(this['context']['locale'],_0x385205?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x324885,_0x101a57]);}case'removeItem':return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x101a57);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 _0x49a72f=new Date(),_0x2f31ae=new Date(_0x49a72f['getFullYear'](),_0x49a72f['getMonth'](),_0x49a72f['getDate']()),_0x1b9851=new Date(_0x2f31ae);_0x1b9851['setDate'](_0x1b9851['getDate']()-0x1);const _0x33f366=new Date(_0x2f31ae);_0x33f366['setDate'](_0x33f366['getDate']()-0xe);const _0x175ee4=this['history']['getItems']({'pinned':!0x0}),_0x4d5884=this['history']['getItems']({'from':_0x2f31ae,'to':_0x2f31ae}),_0xb876fb=this['history']['getItems']({'from':_0x1b9851,'to':_0x1b9851}),_0x4e373d=this['history']['getItems']({'from':_0x33f366,'to':_0x1b9851}),_0x52dd93=this['history']['getItems']({'to':_0x33f366}),_0xbf6f0b=[];return _0x175ee4['length']>0x0&&_0xbf6f0b['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x175ee4}),_0x4d5884['length']>0x0&&_0xbf6f0b['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x4d5884}),_0xb876fb['length']>0x0&&_0xbf6f0b['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0xb876fb}),_0x4e373d['length']>0x0&&_0xbf6f0b['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x4e373d}),_0x52dd93['length']>0x0&&_0xbf6f0b['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x52dd93}),_0xbf6f0b;}},va=class extends _0x77cfae{static get requires(){return[Oa,Ca];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ka=class extends _0x77cfae{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(_0xf09a9e){super(_0xf09a9e),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(_0x5425ba,_0x3b7460){super(_0x5425ba);const {id:_0x56dd25,type:_0x3ba205,icon:_0x2f8152}=_0x3b7460;this['id']=_0x56dd25,this['set']({'label':_0x3b7460['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x3b7460['id']}}),_0x2f8152?this['icon']=_0x2f8152:'chat'===_0x3ba205?this['icon']=_0x39a424:'review'===_0x3ba205?this['icon']=_0x13ea44:'translate'===_0x3ba205&&(this['icon']=_0x164672);}},Na=class extends _0x414492{listView;constructor(_0x143459,_0x2260a9){super(_0x143459),this['set']('isEnabled',!0x0);const _0x3d4767=_0x2260a9['map'](_0x4c8c38=>{const _0x486cb4=new jt(this['locale']),_0x56a896=new ya(this['locale'],_0x4c8c38);return _0x56a896['bind']('isEnabled')['to'](this),_0x486cb4['children']['add'](_0x56a896),_0x56a896['delegate']('execute')['to'](this),_0x486cb4;});this['listView']=new Jt(this['locale']),this['listView']['items']['addMany'](_0x3d4767),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const xa='chat-shortcuts';var La=class extends _0x77cfae{_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 _0x11e6a0=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x41ad00=_0x11e6a0['activeConversation'];_0x41ad00['isFromHistory']||this['_injectShortcuts'](_0x41ad00);}),this['listenTo'](_0x11e6a0,'interactionStarted',()=>{this['_removeShortcuts']();}));}_validateShortcuts(){const _0x5903f5=['chat','review','translate'];this['_shortcuts']['forEach'](_0x274b5b=>{let _0x3c9647=!0x0;if(_0x274b5b['id']&&_0x274b5b['label']&&_0x5903f5['includes'](_0x274b5b['type'])?'chat'===_0x274b5b['type']&&(_0x3c9647='string'==typeof _0x274b5b['prompt']):_0x3c9647=!0x1,!_0x3c9647)throw new ct('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x274b5b});});}_injectShortcuts(_0x3025ef){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',_0x22657b=>{const _0x139dff=_0x22657b['source']['id'];this['_executeShortcut'](_0x139dff);}),this['_listenedConversation']=_0x3025ef,this['listenTo'](_0x3025ef,'uploadProgressChanged',(_0x3afad8,_0x39237b)=>{this['_shortcutsView']['isEnabled']=!_0x39237b['isUploadInProgress'];});}_removeShortcuts(){const _0x55f6ec=this['context']['plugins']['get'](Aa);_0x55f6ec['hasFeedItem'](xa)&&_0x55f6ec['removeFeedItem'](xa),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}_executeShortcut(_0x294932){const _0x4e32ac=this['_shortcuts']['find'](_0x5bab94=>_0x5bab94['id']===_0x294932),_0x1bb2ea=_0x4e32ac['type'];'chat'===_0x1bb2ea?this['_runChatShortcut'](_0x4e32ac):'review'===_0x1bb2ea?_0x4e32ac['commandId']?this['_runReviewShortcut'](_0x4e32ac):this['_switchTab']('reviewMode'):'translate'===_0x1bb2ea&&(_0x4e32ac['language']?this['_runTranslateShortcut'](_0x4e32ac):this['_switchTab']('translate'));}_switchTab(_0x351cbf){if(!this['context']['plugins']['has']('AITabs'))throw new ct('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x351cbf});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x351cbf);}async _runChatShortcut({id:_0xb59acb,prompt:_0x524b37,draftMode:_0x588f63,useWebSearch:_0x32eb45=!0x1,useReasoning:_0x5a8ff6=!0x1,model:_0x4a8053}){const _0x2bdb06=this['context']['plugins']['get']('AIChatController'),_0x1ef1fa=_0x2bdb06['activeConversation'],_0x1c588e=this['context']['plugins']['get'](fs),_0x1e8f5f=await _0x1c588e['models']['resolveModel'](_0x4a8053);_0x1e8f5f&&await _0x1ef1fa['setModel'](_0x1e8f5f),_0x1ef1fa['setWebSearch'](_0x32eb45),_0x1ef1fa['setReasoning'](_0x5a8ff6);const _0x29da4c=_0x1c588e['contextLibrary']['resolveContext']({'feature':'chat','ids':[_0xb59acb],'idScopedOnly':!0x0,'context':new Yn()});_0x1ef1fa['addDefaultContext'](_0x29da4c['refs']),_0x2bdb06['addCurrentDocumentToChatContext'](),_0x588f63?(this['_aiChatUI']['setPromptInputValue'](_0x524b37),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x2bdb06['sendMessage']({'message':_0x524b37});}_runReviewShortcut({commandId:_0x9fbc77,model:_0x268c8e,prompt:_0x17a642,params:_0x1236ce}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ct('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x411c95={'id':_0x9fbc77,'isCustom':'custom'===_0x9fbc77};_0x268c8e&&_0x17a642&&(_0x411c95['args']={'model':_0x268c8e,'prompt':_0x17a642}),_0x1236ce&&(_0x411c95['params']=_0x1236ce),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x411c95);}_runTranslateShortcut({language:_0x4ed43c}){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':_0x4ed43c,'args':{'language':_0x4ed43c}});}},Pa=class extends _0x3cd7f1{constructor(_0x10d0a8){super(_0x10d0a8);const _0x1bb6f6=_0x10d0a8['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x1bb6f6,'isVisible'),this['isEnabled']=!0x0;}execute(){const _0x2d5b67=this['editor']['plugins']['get']('AITabs')['view'];_0x2d5b67['isVisible']=!_0x2d5b67['isVisible'];}},Da=class extends _0x46bc1f{static get requires(){return[gs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x542f2b=this['editor'];_0x542f2b['commands']['add']('toggleAi',new Pa(_0x542f2b)),_0x542f2b['ui']['componentFactory']['add']('toggleAi',()=>{const _0xeacf7e=this['_createAIUIButton'](Mt);return _0xeacf7e['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0xeacf7e;}),_0x542f2b['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x3b0036=this['_createAIUIButton'](Zt);return _0x3b0036['set']({'role':'menuitemcheckbox'}),_0x3b0036;});}_createAIUIButton(_0x4581e3){const _0x5e3146=this['editor'],_0x410597=_0x5e3146['commands']['get']('toggleAi'),_0x12c61b=new _0x4581e3(_0x5e3146['locale']);return _0x12c61b['set']({'label':Es(_0x5e3146['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x55f0e2,'isToggleable':!0x0}),_0x12c61b['bind']('isEnabled')['to'](_0x410597),_0x12c61b['bind']('isOn')['to'](_0x410597,'value',_0x3b7b2d=>!!_0x3b7b2d),this['listenTo'](_0x12c61b,'execute',()=>{_0x410597['execute']();}),_0x12c61b;}};const Ha=['applySuggestion','insertSuggestion','showNext','showPrevious'];var Ma=class extends _0x414492{['_errorView'];constructor(_0x22bbe7){super(_0x22bbe7),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x1a5ba6){this['showError'](_0x1a5ba6);}['showError'](_0xba62de){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0xba62de,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}_createErrorView(){const _0x7dcdbd=new _0x414492(this['locale']),_0x13f535=new _0x414492(this['locale']);return _0x13f535['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x7dcdbd['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x294908=>!_0x294908)]},'children':[_0x13f535]}),_0x7dcdbd;}};const Ua=0xa;var Va=class extends _0x77cfae{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'](_0xdae815){const {id:_0xe8a574}=this['_currentConfig']??{};this['_currentConfig']=_0xdae815,this['_editor']=_0xdae815['targetEditor'];const {id:_0x47547e}=this['_currentConfig'];this['isOpen']&&_0xe8a574===_0x47547e?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x3a5b01=this['_editor'];if(!_0x3a5b01)return;const _0xae6e38=_0x3a5b01['plugins']['get']('Dialog');_0xae6e38['isOpen']&&this['_currentConfig']&&_0xae6e38['id']===this['_currentConfig']['id']&&_0xae6e38['hide']();}_updateDialog(){const _0x36d961=this['_editor']['plugins']['get']('Dialog'),{icon:_0x47117d,title:_0x3b7baf}=this['_currentConfig'];_0x36d961['view']?.['headerView']&&(_0x36d961['view']['headerView']['label']=_0x3b7baf,_0x36d961['view']['headerView']['iconView']&&_0x47117d&&(_0x36d961['view']['headerView']['iconView']['content']=_0x47117d)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x36d961['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 _0x295cb8=this['_editor']['plugins']['get']('Dialog'),{id:_0x254752,title:_0x5ea38f,icon:_0x4e2edc,class:_0x3c5bb6,mainView:_0x77ea0a}=this['_currentConfig'];_0x77ea0a['delegate'](...Ha)['to'](this),_0x295cb8['show']({'title':_0x5ea38f,'icon':_0x4e2edc,'hasCloseButton':!0x0,'id':_0x254752,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x3c5bb6||''),'content':_0x77ea0a,'onShow':_0x3d58ad=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x3d58ad['view']?.['updatePosition']();const _0xdbd280=this['_getSelectionElements']();_0xdbd280&&_0xdbd280[0x0]&&Ot({'target':_0xdbd280[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x3d58ad['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x254752});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x254752}),this['isOpen']=!0x1;}});}_calculateDialogPosition(_0x5921a2,_0x5267d9,_0x450158){const _0x3f4b50=_0x5267d9||_0x450158;if(!_0x3f4b50)return null;const _0x1be2ae=this['_getSelectionElements']();if(!_0x1be2ae||0x0===_0x1be2ae['length'])return{'left':Math['round'](_0x3f4b50['left']+_0x3f4b50['width']/0x2-_0x5921a2['width']/0x2),'top':Math['round'](_0x3f4b50['top']+_0x3f4b50['height']/0x2-_0x5921a2['height']/0x2)};const _0x4126b3=Math['round'](_0x3f4b50['left']+_0x3f4b50['width']/0x2-_0x5921a2['width']/0x2),_0x182f48=_0x1be2ae['map'](_0x3281b1=>new It(_0x3281b1)),_0x20da1a=_0x5921a2['height'];return{'left':_0x4126b3,'top':this['_calculateOptimalTopPosition'](_0x182f48,_0x20da1a,_0x3f4b50)};}_calculateOptimalTopPosition(_0x5edc91,_0x315270,_0x310185){const _0x20720a=new It(wt['window']),_0x2c693d=_0x5edc91['map'](_0x177b40=>_0x177b40['getVisible']())['filter'](_0x5a24cc=>_0x5a24cc),_0x585756=It['getBoundingRect'](_0x2c693d);if(!_0x585756)return Math['round'](_0x310185['top']+_0x310185['height']/0x2);const _0x5bfb57=_0x20720a['getIntersection'](_0x585756);if(!_0x5bfb57)return Math['round'](_0x310185['top']+_0x310185['height']/0x2);const _0x2c8cb5=_0x310185['getVisible'](),_0x3345d8=_0x2c8cb5&&_0x585756['height']>_0x2c8cb5['height'],_0x2defcf=_0x5bfb57['top'],_0x23ba9e=_0x5bfb57['bottom'];if(_0x3345d8){const _0x342add=_0x20720a['top']+_0x20720a['height']/0x2-_0x315270/0x2,_0x52f32b=_0x2defcf-Ua-_0x20720a['top'],_0x4accc8=_0x20720a['bottom']-_0x23ba9e-Ua;return _0x52f32b>=_0x315270?Math['max'](Ua,_0x2defcf-_0x315270-Ua):_0x4accc8>=_0x315270?_0x23ba9e+Ua:Math['max'](Ua,_0x342add);}const _0x9b304b=_0x2defcf-_0x315270,_0x3cda47=_0x20720a['bottom']-_0x23ba9e-Ua,_0x2c041b=_0x2defcf-Ua-_0x20720a['top'];let _0x4e8b0f;return _0x4e8b0f=_0x3cda47>=_0x315270?_0x23ba9e+Ua:_0x2c041b>=_0x315270?_0x9b304b-Ua:_0x2defcf+_0x585756['height']/0x2-_0x315270/0x2,_0x4e8b0f;}_setupFakeVisualSelectionMarkerRemovalListener(){const _0x5c73e0=this['_editor'];this['listenTo'](_0x5c73e0['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x2a4eb7,data:{newRange:_0x2a7af0}}of _0x5c73e0['model']['document']['differ']['getChangedMarkers']())if(_0x2a4eb7['startsWith']('ai-selection:')&&(_0x2a7af0&&(_0x2a7af0['start']['isEqual'](_0x2a7af0['end'])||'$graveyard'==_0x2a7af0['root']['rootName'])||null==_0x2a7af0)){const _0x36e150=Es(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x36e150),this['fire']('selectionRemoved');}}});}_cleanupFakeVisualSelectionMarkerRemovalListener(){const _0x2172e3=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x2172e3['model']['document']);}_getSelectionElements(){const _0x578cd4=this['_editor'];return _0x4bbc7b(_0x578cd4['editing'],[..._0x578cd4['model']['markers']['getMarkersGroup']('ai-selection'),..._0x578cd4['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}_getCurrentDomRootName(){const _0x5d2c67=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x5d2c67&&_0x5d2c67['rootName']?_0x5d2c67['rootName']:null;}},Ba=class extends _0x258303{copyButton;likeButton;dislikeButton;showChangesButton;['_config'];constructor(_0x340cd1,_0x1e9d95={}){super(_0x340cd1),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x1e9d95};const _0x453941=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x453941?'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(_0x5d4c1c){this['showChangesButton']['isEnabled']=_0x5d4c1c;}_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':_0x4c57f5,'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 _0x12a121=new $t();_0x12a121['set']({'content':_0x32ea05}),_0x12a121['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'](_0x12a121);}_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',_0x1460c7=>_0x1460c7?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(_0x5b7176,_0x5513f1){super(_0x5b7176);const _0x44ce96=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']=_0x5513f1,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new mr(_0x5b7176),this['_partToolbarView']=new Ir(_0x5b7176,_0x5513f1['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_partToolbarView']['bind']('isTargetReadOnly')['to'](this),this['_partToolbarView']['bind']('isEnabled')['to'](this,'areActionsDisabled',this,'_isErrorVisible',(_0x524fb9,_0x406e6b)=>!_0x524fb9&&!_0x406e6b),this['_togglePartToolbarButtonsVisibility'](_0x5513f1),this['_stateView']=new gr(_0x5b7176),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new Ba(_0x5b7176,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new Fa(_0x5b7176,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0xfc828a,_0x5699f0,_0x1da97f,_0x4751ff)=>{let _0x24b033,_0x7f2767;'pending'===_0x4751ff?(_0x24b033=this['_partToolbarView'],_0x7f2767=this['_stateView']):(_0x24b033=this['_stateView'],_0x7f2767=this['_partToolbarView']),this['_stateView']['setState'](_0x1da97f,this['_outdatedReason']),_0x24b033['isVisible']=!0x1,_0x7f2767['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x44ce96['to']('_state',_0x55e519=>'ck-ai-chat-balloon-main_state_'+_0x55e519)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x5513f1);});}['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(_0x26cc05){_0x26cc05?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x26cc05);}clearContent(){this['_streamableContentView']['clear']();}setState(_0x432ddb,_0x432750){this['_outdatedReason']=_0x432750,this['_state']=_0x432ddb;}['showError'](_0x4b4930){super['showError'](_0x4b4930),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}toggleRotatorButtonsVisibility(_0x4b3f35){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x4b3f35;}_togglePartToolbarButtonsVisibility({showApplyButton:_0x461050,showSuggestButton:_0x3594a7}){_0x461050=_0x461050&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x3594a7=_0x3594a7&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x461050,'showSuggestButton':_0x3594a7});}_createNextButtonView(){const _0x47b5ad=new Mt(this['locale']);return _0x47b5ad['set']({'icon':_0x2c7807,'label':Es(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x47b5ad['on']('execute',()=>{this['fire']('showNext');}),_0x47b5ad;}_createPreviousButtonView(){const _0x18611d=new Mt(this['locale']);return _0x18611d['set']({'icon':_0x25db08,'label':Es(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x18611d['on']('execute',()=>{this['fire']('showPrevious');}),_0x18611d;}},Fa=class extends _0x414492{constructor(_0x59bd4a,_0x90503e){super(_0x59bd4a),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x90503e});}},Ka=class extends _0x46bc1f{static get requires(){return[Ut,Va];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}_chatBalloonView;constructor(_0x4df976){super(_0x4df976),this['set']('showDiff',!0x1);}['open'](_0x555d21){const _0x2fd337=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x2fd337['plugins']['get']('AIBalloon')['open']({..._0x555d21,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x555d21['showRotator']),this['_chatBalloonView']['areActionsDisabled']=_0x555d21['areActionsDisabled'],this['_chatBalloonView']['isTargetReadOnly']=_0x555d21['isTargetReadOnly'],this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}updateContent(_0xc9f2e4){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0xc9f2e4);}clearContent(){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}setState(_0xe1faa9,_0x3f21ed){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0xe1faa9,_0x3f21ed);}setTargetReadOnly(_0x550cfc){this['_chatBalloonView']&&(this['_chatBalloonView']['isTargetReadOnly']=_0x550cfc);}_createChatBalloonView(){const _0x1806f2=this['editor'],_0x3c513c=_0x1806f2['plugins']['get']('AIBalloon'),_0x1358a5=_0x1806f2['commands']['get']('trackChanges');let _0x18daa4=_0x1806f2['config']['get']('ai.availableReplyActions')||[...Or];_0x1806f2['plugins']['has']('TrackChanges')||(_0x18daa4=_0x18daa4['filter'](_0x5d55de=>'insertSuggestion'!=_0x5d55de));const _0x1d14b2=new Ga(_0x1806f2['locale'],{'availableActions':_0x18daa4,'showApplyButton':!0x0,'showSuggestButton':!!_0x1358a5});return _0x1d14b2['bind']('showDiff')['to'](this),_0x1d14b2['delegate'](...ir)['to'](this),_0x1d14b2['delegate']('showPrevious','showNext')['to'](this),_0x3c513c['delegate']('dialogClosed')['to'](this),_0x1d14b2['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x1d14b2['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x1d14b2['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x1358a5&&_0x1d14b2['bind']('isTrackChangesOn')['to'](_0x1358a5,'value'),_0x1d14b2['render'](),_0x1d14b2;}_toggleRotatorButtonsInDialogHeader(_0xbf8abe){const _0x5188b4=this['editor'],_0x22fdf1=_0x5188b4['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0xbf8abe),_0x22fdf1['has'](this['_chatBalloonView']['previousButtonView'])||(_0x22fdf1['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x5188b4['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x22fdf1['remove'](this['_chatBalloonView']['previousButtonView']),_0x22fdf1['remove'](this['_chatBalloonView']['nextButtonView']);}));}_restoreDefaultViewFocus(){this['_chatBalloonView']['focus']();}},Wa=class extends _0x46bc1f{static get requires(){return[Da,Ka,_0x256bf3];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function Ya(_0x244856){const {editor:_0x3c3d12,action:_0x21f67a,withText:_0x50472a=!0x1,withIcon:_0x3701bf=!0x0,isInDropdown:_0x592430=!0x0,shouldPreventFocus:_0x45475a=!0x1,actionButtons:_0x2a3542}=_0x244856;return()=>{const _0x18a66f=_0x3c3d12['locale'],_0x346b10=new Mt(_0x18a66f),_0xbe6812=_0x346b10['bindTemplate'];_0x592430&&_0x346b10['extendTemplate']({'on':{'mouseenter':_0xbe6812['to'](()=>{_0x45475a&&_0x45475a()||_0x346b10['focus']();})}}),_0x2a3542['push']({'buttonView':_0x346b10,'action':_0x21f67a});const _0x199b97=_0x21f67a['icon']??_0x21f67a['parent']?.['icon'];return _0x346b10['set']({'label':_0x21f67a['label'],'withText':_0x50472a,'role':'menuitem','icon':_0x3701bf?_0x199b97??_0x5f0553:void 0x0,'tooltip':!_0x50472a,'class':'ck-ai-quick-actions-button','isEnabled':_0x21f67a['isEnabled']}),_0x346b10['on']('execute',()=>{_0x3c3d12['editing']['view']['focus'](),_0x3c3d12['commands']['execute']('aiQuickAction',_0x21f67a);}),_0x346b10;};}var $a=class extends Xt{['arrowView'];constructor(_0x1403ae,_0x9274e){super(_0x1403ae,_0x9274e);const _0xa668e9=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',_0x4ffe69=>String(_0x4ffe69)),'data-cke-tooltip-disabled':_0xa668e9['to']('isOn')},'on':{'mouseenter':_0xa668e9['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}_createArrowView(){const _0x26b546=new $t();return _0x26b546['content']=_0xd84f6e,_0x26b546['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x26b546;}},qa=class extends Jt{_allListItems;_allSearchableItems;constructor(_0x622dc5,_0xb4b83d,_0x3258c6){super(_0x622dc5),this['_allListItems']=_0xb4b83d,this['_allSearchableItems']=_0x3258c6;}filter(_0x49a535){if(!_0x49a535)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x4a0480=_0x49a535['source']['toLowerCase']()['trim'](),_0x3409a4=this['_allSearchableItems']['filter'](_0x1b923e=>(_0x1b923e['groupLabel']?_0x1b923e['label']+'\x20('+_0x1b923e['groupLabel']+')':_0x1b923e['label'])['toLowerCase']()['includes'](_0x4a0480));return this['items']['clear'](),this['items']['addMany'](_0x3409a4['sort']((_0x50bc99,_0x444ed2)=>{const _0x400488=_0x50bc99['groupLabel'],_0x2211b4=_0x444ed2['groupLabel'];return _0x400488||_0x2211b4?_0x400488?0x1:-0x1:0x0;})['map'](_0x493767=>_0x493767['item'])),this['_highlightQuery'](_0x4a0480,_0x3409a4),{'resultsCount':_0x3409a4['length'],'totalItemsCount':this['_allSearchableItems']['length']};}_highlightQuery(_0x121e53,_0x10cf1b){if(!_0x121e53)return;const _0x24927d=new RegExp(_0x4f4662(_0x121e53),'gi');_0x10cf1b['forEach'](_0x255c5d=>{_0x255c5d['highlightViews']&&_0x255c5d['highlightViews']['forEach'](_0x34d999=>{'function'==typeof _0x34d999['highlightText']&&_0x34d999['highlightText'](_0x24927d);});});}_clearHighlight(){this['_allSearchableItems']['forEach'](_0x1b18b9=>{_0x1b18b9['highlightViews']&&_0x1b18b9['highlightViews']['forEach'](_0x53c736=>{'function'==typeof _0x53c736['highlightText']&&_0x53c736['highlightText'](null);});});}};const Qa='menu',Xa='menuitem';var za=class extends _0x414492{_bodyCollection;optionsListView;_searchTextView=null;_allSearchableItems=[];['children'];['focusTracker'];keystrokes;['_focusables'];['focusCycler'];_openNestedPanels=new Set();['_hasSearch'];_actionButtons;constructor(_0x4204c1,_0x545223,_0x78a958,_0x2bdeba,_0x219efa=!0x1,_0xfdb3f5=[]){const _0xb818c0=_0x4204c1['locale'];super(_0xb818c0),this['_bodyCollection']=_0x2bdeba,this['_hasSearch']=_0x219efa,this['_actionButtons']=_0xfdb3f5;const _0x210ba5=this['_createListItems'](_0x4204c1,_0x545223,_0x78a958);this['optionsListView']=new qa(_0xb818c0,_0x210ba5,this['_allSearchableItems']),this['optionsListView']['role']=Qa,this['optionsListView']['items']['addMany'](_0x210ba5),this['focusTracker']=new _t(),this['keystrokes']=new gt(),_0x219efa&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x210ba5,this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x219efa&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x2f28a4=_0x219efa&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x215355(_0x2f28a4),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0xb818c0['uiLanguageDirection']},'children':this['children']});}_createSearchTextView(){return new _0x176ba3(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 _0x387018=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x387018);}_createListItems(_0x1f8f7c,_0x1c6760,_0x394445){const _0x1723c2=new _0x215355();return _0x1c6760['forEach'](_0x557df8=>{if('actions'in _0x557df8){const {listItem:_0x1ca7c8}=this['_createActionGroupButton'](_0x1f8f7c,_0x557df8,_0x394445);_0x1723c2['add'](_0x1ca7c8),_0x557df8['actions']['forEach'](_0x3f5c43=>{const {listItem:_0x407737,highlightViews:_0x159800}=this['_createSearchResultActionButton'](_0x1f8f7c,_0x3f5c43,_0x557df8['label'],_0x557df8['icon']);this['_allSearchableItems']['push']({'item':_0x407737,'label':_0x3f5c43['label'],'groupLabel':_0x557df8['label'],'highlightViews':_0x159800});});}else{const {listItem:_0x4ba613}=this['_createActionButton'](_0x1f8f7c,_0x557df8);_0x1723c2['add'](_0x4ba613);const _0x443ab4=_0x4ba613['children']['first'];if(_0x443ab4){const {listItem:_0x24e572,highlightViews:_0x14d003}=this['_createSearchResultActionButton'](_0x1f8f7c,_0x557df8);this['_allSearchableItems']['push']({'item':_0x24e572,'label':_0x443ab4['label']||'','highlightViews':_0x14d003});}}}),_0x1723c2;}_createActionButton(_0x272401,_0x49eaea,_0x4bdbfa,_0x325a1e){const _0x169f10=new jt(this['locale']);if(_0x4bdbfa&&_0x325a1e){const _0x35fea0=new Mt(this['locale']),_0x5bfd37=_0x35fea0['bindTemplate'],_0x477152=new Yt();_0x477152['text']=_0x49eaea['label'];const _0x52a29a=new Yt();_0x52a29a['text']=_0x4bdbfa;const _0x58e48f=new $t();_0x58e48f['content']=_0x325a1e,_0x58e48f['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x4ea03b=new _0x414492(this['locale']);_0x4ea03b['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x1d08d4=new _0x414492(this['locale']);return _0x1d08d4['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x35fea0['set']({'label':_0x49eaea['label']+'\x20('+_0x4bdbfa+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x49eaea['isEnabled']}),_0x35fea0['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x5bfd37['if']('isEnabled','ck-disabled',_0x340d87=>!_0x340d87)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x477152,_0x4ea03b,_0x58e48f,_0x52a29a,_0x1d08d4],'on':{'mouseenter':_0x5bfd37['to'](()=>{this['_isSearchFocused']()||_0x35fea0['focus']();}),'click':_0x5bfd37['to'](()=>{_0x35fea0['fire']('execute');})}}),_0x35fea0['on']('execute',()=>{_0x35fea0['isEnabled']&&(_0x272401['editing']['view']['focus'](),_0x272401['commands']['execute']('aiQuickAction',_0x49eaea));}),_0x169f10['children']['add'](_0x35fea0),this['_actionButtons']['push']({'buttonView':_0x35fea0,'action':_0x49eaea}),{'listItem':_0x169f10,'highlightViews':[_0x477152,_0x52a29a]};}{const _0x549a6d=new Ht(),_0x698a76=new Mt(this['locale'],_0x549a6d),_0x3aaa12=_0x698a76['bindTemplate'],_0x481ce0=_0x49eaea['icon']??_0x49eaea['parent']?.['icon'],_0x3beee2=void 0x0!==_0x49eaea['icon'];return _0x698a76['set']({'label':_0x49eaea['label'],'withText':!0x0,'role':'menuitem','icon':_0x3beee2?_0x481ce0??_0x5f0553:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x49eaea['isEnabled']}),_0x698a76['extendTemplate']({'on':{'mouseenter':_0x3aaa12['to'](()=>{this['_isSearchFocused']()||_0x698a76['focus']();})}}),_0x698a76['on']('execute',()=>{_0x272401['editing']['view']['focus'](),_0x272401['commands']['execute']('aiQuickAction',_0x49eaea);}),_0x169f10['children']['add'](_0x698a76),this['_actionButtons']['push']({'buttonView':_0x698a76,'action':_0x49eaea}),{'listItem':_0x169f10,'highlightViews':[_0x549a6d]};}}_createSearchResultActionButton(_0x50cca1,_0x5d7c2c,_0x1b5009,_0x56f6c6){return _0x1b5009&&_0x56f6c6?this['_createSearchResultGroupedActionButton'](_0x50cca1,_0x5d7c2c,_0x1b5009,_0x56f6c6):this['_createSearchResultIndividualActionButton'](_0x50cca1,_0x5d7c2c);}_createSearchResultGroupedActionButton(_0x52cae4,_0x4bf176,_0x29c8b6,_0x591ea1){const _0xbbc5b2=new jt(this['locale']),_0xd512f4=new Mt(this['locale']),_0x1d404b=_0xd512f4['bindTemplate'],{view:_0x1a1f78,highlightView:_0x1664d8}=this['_createSearchResultGroupRow'](_0x29c8b6,_0x591ea1),{view:_0x3ccb1c,highlightView:_0x43e56b}=this['_createSearchResultActionRow'](_0x4bf176['label']),_0x5ee604=this['_createSearchResultContentView'](_0x1a1f78,_0x3ccb1c);return _0xd512f4['set']({'label':_0x4bf176['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':_0x4bf176['isEnabled']}),_0xd512f4['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',_0x1d404b['if']('isEnabled','ck-disabled',_0x40e130=>!_0x40e130)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x5ee604],'on':{'mouseenter':_0x1d404b['to'](()=>{this['_isSearchFocused']()||_0xd512f4['focus']();}),'click':_0x1d404b['to'](()=>{this['_handleSearchResultButtonClick'](_0xd512f4);})}}),this['_setupActionButtonExecution'](_0xd512f4,_0x52cae4,_0x4bf176),_0xbbc5b2['children']['add'](_0xd512f4),this['_actionButtons']['push']({'buttonView':_0xd512f4,'action':_0x4bf176}),{'listItem':_0xbbc5b2,'highlightViews':[_0x1664d8,_0x43e56b]};}_createSearchResultIndividualActionButton(_0x25f750,_0x5bc977){const _0x3da9e0=new jt(this['locale']),_0x28bc4c=new Ht(),_0x1bbfe4=new Mt(this['locale'],_0x28bc4c),_0x56048e=_0x1bbfe4['bindTemplate'];return _0x1bbfe4['set']({'label':_0x5bc977['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x5bc977['isEnabled']}),_0x1bbfe4['extendTemplate']({'on':{'mouseenter':_0x56048e['to'](()=>{this['_isSearchFocused']()||_0x1bbfe4['focus']();})}}),this['_setupActionButtonExecution'](_0x1bbfe4,_0x25f750,_0x5bc977),_0x3da9e0['children']['add'](_0x1bbfe4),this['_actionButtons']['push']({'buttonView':_0x1bbfe4,'action':_0x5bc977}),{'listItem':_0x3da9e0,'highlightViews':[_0x28bc4c]};}_createSearchResultGroupRow(_0x1b1f9f,_0x449df9){const _0x57caad=new _0x414492(this['locale']),_0x139a4b=new $t();_0x139a4b['content']=_0x449df9,_0x139a4b['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x4b0fb5=new Yt();return _0x4b0fb5['text']=_0x1b1f9f,_0x57caad['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x139a4b,_0x4b0fb5]}),{'view':_0x57caad,'highlightView':_0x4b0fb5};}_createSearchResultActionRow(_0x397a8e){const _0x585d58=new _0x414492(this['locale']),_0x416470=new Yt();return _0x416470['text']=_0x397a8e,_0x585d58['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x416470]}),{'view':_0x585d58,'highlightView':_0x416470};}_createSearchResultContentView(_0x43a87b,_0x67aa){const _0x5c6cec=new _0x414492(this['locale']);return _0x5c6cec['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x43a87b,_0x67aa]}),_0x5c6cec;}_setupActionButtonExecution(_0x2a9292,_0xce839b,_0x31bf60){_0x2a9292['on']('execute',()=>{_0x2a9292['isEnabled']&&(_0xce839b['editing']['view']['focus'](),_0xce839b['commands']['execute']('aiQuickAction',_0x31bf60));});}_createActionGroupButton(_0x5c18bd,_0x1a8929,_0x26b497){const _0x590230=new jt(this['locale']),_0x45fa23=new Ht(),_0x3ee5ee=new $a(this['locale'],_0x45fa23),_0x4688a9=_0x3ee5ee['bindTemplate'],_0x1aef74=this['_getPanelKeystroke'](_0x26b497),_0x2093cf=this['_createGroupActionsList'](_0x5c18bd,_0x1a8929['actions'],_0x26b497);_0x3ee5ee['set']({'label':_0x1a8929['label'],'withText':!0x0,'role':Xa,'icon':_0x1a8929['icon']??_0x5f0553,'isEnabled':_0x1a8929['actions']['some'](_0x522c12=>_0x522c12['isEnabled'])}),_0x3ee5ee['extendTemplate']({'on':{'mouseenter':_0x4688a9['to'](()=>{this['_isSearchFocused']()||_0x3ee5ee['focus']();})}});const _0x325da8=new xt(this['locale']);return _0x325da8['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x4688a9['to'](_0x3bd876=>{this['_handlePanelKeydown'](_0x3bd876,_0x1aef74,_0x3ee5ee,_0x325da8);})}}),_0x3ee5ee['bind']('isOn')['to'](_0x325da8,'isVisible'),this['_bodyCollection']['add'](_0x325da8),_0x325da8['content']['add'](_0x2093cf),this['_setupGroupMenuBehavior'](_0x3ee5ee,_0x325da8),_0x590230['children']['add'](_0x3ee5ee),this['_actionButtons']['push']({'buttonView':_0x3ee5ee,'action':_0x1a8929}),{'listItem':_0x590230,'highlightView':_0x45fa23};}_createGroupActionsList(_0x480ab6,_0x44ba9b,_0x1864bc){const _0x4ed69f=new Jt(this['locale']);return _0x4ed69f['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x44ba9b['forEach'](_0x41893b=>{const _0x2a865d=new jt(this['locale']),_0x5af7e0=Ya({'editor':_0x480ab6,'action':_0x41893b,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x2a865d['children']['add'](_0x5af7e0),_0x1864bc['focusTracker']['add'](_0x5af7e0),_0x4ed69f['items']['add'](_0x2a865d);}),_0x4ed69f;}_setupGroupMenuBehavior(_0x2b77c1,_0x5637dc){const _0x348478=_0x2b77c1['bindTemplate'],_0x5665ca=this['_getButtonKeystroke'](_0x2b77c1);_0x2b77c1['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x348478['to'](()=>{this['_showNestedPanel'](_0x5637dc,_0x2b77c1);}),'mouseleave':_0x348478['to'](_0x2f2660=>{const _0x383469=_0x2f2660['relatedTarget'];this['_isMovingToNestedMenu'](_0x383469,_0x5637dc)||this['_hideNestedPanel'](_0x5637dc);}),'keydown':_0x348478['to'](_0x38046d=>{_0x38046d['key']==_0x5665ca&&(this['_showNestedPanel'](_0x5637dc,_0x2b77c1),_0x5637dc['content']['get'](0x0)['focus']());})}}),_0x5637dc['on']('render',()=>{_0x5637dc['element']?.['addEventListener']('mouseleave',_0x56e2ef=>{const _0x6204b4=_0x56e2ef['relatedTarget'];_0x2b77c1['element']?.['contains'](_0x6204b4)||this['_isMovingToNestedMenu'](_0x6204b4,_0x5637dc)||this['_hideNestedPanel'](_0x5637dc);});});}_showNestedPanel(_0xf574d2,_0x5b847d){this['_openNestedPanels']['forEach'](_0x3e2d53=>{_0x3e2d53!==_0xf574d2&&_0x3e2d53['isVisible']&&_0x3e2d53['hide']();}),_0xf574d2['show'](),_0xf574d2['pin']({'positions':[Bt['eastSouth']],'target':_0x5b847d['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0xf574d2);}_hideNestedPanel(_0xe648af){_0xe648af['hide'](),this['_openNestedPanels']['delete'](_0xe648af);}_hideAllNestedPanels(){this['_openNestedPanels']['forEach'](_0x5eaebb=>_0x5eaebb['hide']()),this['_openNestedPanels']['clear']();}_isMovingToNestedMenu(_0x40c076,_0x520fe8){if(!_0x40c076)return!0x1;if(_0x520fe8['element']?.['contains'](_0x40c076))return!0x0;const _0xd4cdaa=_0x40c076;return _0xd4cdaa['closest']&&(null!==_0xd4cdaa['closest']('.ck-ai-quick-actions-group-panel')||null!==_0xd4cdaa['closest']('.ck-ai-quick-actions-group-list')||null!==_0xd4cdaa['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(_0x3421d8){return'rtl'===_0x3421d8['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}_getButtonKeystroke(_0x4953e9){return'rtl'===_0x4953e9['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x585cfb,_0x931a3e,_0xd98d03,_0xcb3eb3){_0x585cfb['key']==_0x931a3e&&(_0xd98d03['focus'](),this['_hideNestedPanel'](_0xcb3eb3));}_handleSearchResultButtonClick(_0x481fcb){_0x481fcb['fire']('execute');}};function ja(_0x384c26){const {editor:_0x458527,content:_0x5b991d,buttonDefinition:_0x1e5545,bodyCollection:_0x293b6f,hasSearch:_0x102004=!0x1,actionButtons:_0x1e62c5}=_0x384c26;return()=>{const _0xb66934=_0x458527['locale'],_0x181980=_0x458527['commands']['get']('aiQuickAction'),_0x3ba244=_0x44881d(_0xb66934);_0x3ba244['bind']('isEnabled')['to'](_0x181980),_0x3ba244['buttonView']['set']({'icon':_0x1e5545['icon']??_0x5f0553,'label':_0x1e5545['label'],'tooltip':!0x0}),_0x3ba244['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x441709=new za(_0x458527,_0x5b991d,_0x3ba244,_0x293b6f,_0x102004,_0x1e62c5);return _0x3ba244['panelView']['children']['add'](_0x441709),_0x102004&&_0x3ba244['on']('change:isOpen',(_0x4e77ba,_0x18049e,_0x4f489a)=>{if(_0x4f489a){if(_0x458527['plugins']['has']('AIEditing')){const _0x9d7fbf=_0x458527['plugins']['get'](tn),_0x5e0cf8=_0x458527['model']['document']['selection'],_0x133834=Array['from'](_0x5e0cf8['getRanges']());_0x133834['length']>0x0&&_0x9d7fbf['showFakeVisualSelection']({'editor':_0x458527,'ranges':_0x133834,'id':'quick-action','priority':0x14});}}else _0x458527['plugins']['has']('AIEditing')&&_0x458527['plugins']['get'](tn)['hideFakeVisualSelection']('quick-action'),_0x441709['resetSearch']();}),_0x3ba244;};}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 _0x46bc1f{_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 _0x2f8722=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x2f8722),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static getDefaultQuickActions(_0x371f8b){return function(_0x3268e8){const _0x42759a=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x3268e8['uiLanguage'])||'English';return[{'id':'ask-ai','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x108d0d},{'id':'chat-commands','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x108d0d,'actions':[{'id':'explain','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Es(_0x3268e8,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':Ja['replace']('%0',_0x42759a),'type':'chat'},{'id':'summarize','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Es(_0x3268e8,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Za['replace']('%0',_0x42759a),'type':'chat'},{'id':'highlight-key-points','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Es(_0x3268e8,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':th['replace']('%0',_0x42759a),'type':'chat'}]},{'id':'improve-writing','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x5882fe},{'id':'continue','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0xa13cd},{'id':'fix-grammar','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x2ab9b3},{'id':'adjust-length','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x31749f,'actions':[{'id':'make-shorter','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x3be6bb,'actions':[{'id':'make-tone-casual','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x164672,'actions':[{'id':'translate-to-english','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Es(_0x3268e8,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x49182f,'actions':[]}];}(_0x371f8b);}_getDefaultAndCustomActions(){const _0x377ddc=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x2af258=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x28fe47=>({..._0x28fe47,'type':'chat'===_0x28fe47['type']?'chat':'action','icon':void 0x0}));return _0x377ddc['find'](_0x2431b0=>'other'===_0x2431b0['id'])['actions']['push'](..._0x2af258),_0x377ddc;}async _initActionTypeQuickActions(){try{const _0x1b60f2=this['editor']['plugins']['get'](fs),_0x50654c=await _0x1b60f2['models']['getAllModels'](),_0x227553=(await _0x1b60f2['models']['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x227553),this['_enableButtonsByType']('action',_0x23c448=>!!_0x50654c['find'](_0x234f2b=>_0x234f2b['id']===_0x23c448['model'])||void 0x0===_0x23c448['model']);}catch(_0x14d58b){const _0x555d31=new ct('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x14d58b});this['_reporter']['logError'](_0x555d31);}}_initChatTypeQuickActions(){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x4750fe=this['editor']['plugins']['get']('AIChatController'),_0x58bef8=this['editor']['plugins']['has']('AIChatUI')?this['editor']['plugins']['get']('AIChatUI'):null;this['listenTo'](_0x4750fe,'change:isConversationReady',(_0x23888f,_0x95d129,_0x495d09)=>{this['_enableButtonsByType']('chat',()=>_0x495d09&&!_0x58bef8?.['isBusy']);}),_0x58bef8&&this['listenTo'](_0x58bef8,'change:isBusy',(_0x166a2e,_0x56f533,_0x45b803)=>{this['_enableButtonsByType']('chat',()=>_0x4750fe['isConversationReady']&&!_0x45b803);}),this['_enableButtonsByType']('chat',()=>_0x4750fe['isConversationReady']&&!_0x58bef8?.['isBusy']);}_enableButtonsByType(_0x4d037c,_0x1b80ec){this['_quickActionsDefinition']['forEach'](_0x4ba714=>{'actions'in _0x4ba714?_0x4ba714['actions']['forEach'](_0x1d7eee=>{_0x1d7eee['type']===_0x4d037c&&(_0x1d7eee['isEnabled']=_0x1b80ec(_0x1d7eee));}):_0x4ba714['type']===_0x4d037c&&(_0x4ba714['isEnabled']=_0x1b80ec(_0x4ba714));}),this['_actionButtons']['forEach'](_0x10b18f=>{if(sh(_0x10b18f['action']))return;if(_0x10b18f['action']['type']!==_0x4d037c)return;const _0x326c56=_0x1b80ec(_0x10b18f['action']);if(_0x10b18f['action']['isEnabled']=_0x326c56,_0x10b18f['buttonView']['isEnabled']=_0x326c56,'action'===_0x4d037c&&!_0x326c56&&_0x10b18f['action']['model']){const _0x2f75a2=new ct('ai-quick-actions-unavailable-model',this,{'actionId':_0x10b18f['action']['id'],'modelId':_0x10b18f['action']['model']});this['_reporter']['logError'](_0x2f75a2);}}),this['_actionButtons']['filter'](_0x28bf7e=>sh(_0x28bf7e['action']))['forEach'](_0x26f714=>{_0x26f714['buttonView']['isEnabled']=_0x26f714['action']['actions']['some'](_0x51b7fc=>_0x51b7fc['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x2ff082,group:_0x569f70})=>{_0x2ff082['isEnabled']=_0x569f70['actions']['some'](_0x111068=>_0x111068['isEnabled']);});}_enableButtonById(_0x420462,_0x1827fe){this['_quickActionsDefinition']['forEach'](_0x26c1be=>{'actions'in _0x26c1be?_0x26c1be['actions']['forEach'](_0x2e538d=>{_0x2e538d['id']===_0x420462&&(_0x2e538d['isEnabled']=_0x1827fe(_0x2e538d));}):_0x26c1be['id']===_0x420462&&(_0x26c1be['isEnabled']=_0x1827fe(_0x26c1be));}),this['_actionButtons']['forEach'](_0x3854e6=>{if(sh(_0x3854e6['action']))return;if(_0x3854e6['action']['id']!==_0x420462)return;const _0x2bc445=_0x1827fe(_0x3854e6['action']);_0x3854e6['action']['isEnabled']=_0x2bc445,_0x3854e6['buttonView']['isEnabled']=_0x2bc445;});}_assignDefaultModelToCustomActions(_0x5189e4){this['_actionButtons']['forEach'](_0x5c33e4=>{sh(_0x5c33e4['action'])||'action'===_0x5c33e4['action']['type']&&(_0x5c33e4['action']['model']||(_0x5c33e4['action']['model']=_0x5189e4));});}_initializeQuickActionsComponentsAndCommands(){const _0x18b124=new Pt(this['editor']['locale']);_0x18b124['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x18b124),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x18b124);}_initializeQuickActionsDropdown(_0x5e3558){const _0x1848e4=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',ja({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x5f0553,'label':Es(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x5e3558,'hasSearch':_0x1848e4,'actionButtons':this['_actionButtons']}));}_prepareQuickActionsDefinition(_0x48fd97){this['_quickActionsDefinition']=_0x48fd97['map'](_0x3da48d=>{if('actions'in _0x3da48d){const _0xac2ef6=_0x3da48d;return{..._0xac2ef6,'actions':_0xac2ef6['actions']['map'](_0xfafaf1=>{const {actions:_0x41cac6,..._0x51a953}=_0xac2ef6;return{..._0xfafaf1,'isEnabled':!0x1,'parent':_0x51a953};})['filter'](_0x58dc0e=>this['_shouldIncludeAction'](_0x58dc0e))};}return{..._0x3da48d,'isEnabled':!0x1};})['filter'](_0x11e16c=>'actions'in _0x11e16c?_0x11e16c['actions']['length']>0x0:this['_shouldIncludeAction'](_0x11e16c));}_shouldIncludeAction(_0x283963){const _0x2e8c69=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](eh[_0x283963['type']])&&!_0x2e8c69['includes'](_0x283963['id'])&&!('chat'===_0x283963['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}_initializeQuickActionsComponents(_0x5a23b2){this['_quickActionsDefinition']['forEach'](_0x85b854=>{if('actions'in _0x85b854){const _0x3e4b6d=ja({'editor':this['editor'],'content':_0x85b854['actions'],'buttonDefinition':_0x85b854,'bodyCollection':_0x5a23b2,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x85b854['id'],_0x3e4b6d),_0x85b854['actions']['forEach'](_0x41d923=>{const _0x3c273e=Ya({'editor':this['editor'],'action':_0x41d923,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x41d923['id'],_0x3c273e);});}else{const _0x1fb9d6=Ya({'editor':this['editor'],'action':_0x85b854,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x85b854['id'],_0x1fb9d6);}});}_initializeQuickActionsMenuBar(){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x402c62=>{const _0x57475e=this['editor']['commands']['get']('aiQuickAction'),_0x4a094e=new _0x4a3eb2(_0x402c62),_0x4b3fea=Es(_0x402c62,'AI_QUICK_ACTIONS_HEADING');_0x4a094e['buttonView']['set']({'label':_0x4b3fea,'icon':_0x5f0553});const _0x38599b=new _0x1a597c(_0x402c62);return _0x38599b['set']({'ariaLabel':_0x4b3fea,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x47e42a=>{if('actions'in _0x47e42a){const _0x23ad56=_0x47e42a,_0x3b0f6f=new te(_0x402c62,_0x4a094e),_0x37df41=new _0x4a3eb2(_0x402c62),_0x1d2fb0=new _0x1a597c(_0x402c62);_0x37df41['buttonView']['set']({'label':_0x23ad56['label'],'icon':_0x23ad56['icon']}),_0x23ad56['actions']['forEach'](_0x5e60c0=>{const _0x38667f=new te(_0x402c62,_0x37df41),_0x490380=new Zt(_0x402c62);_0x490380['set']({'label':_0x5e60c0['label'],'icon':_0x5e60c0['icon'],'role':'menuitem','isEnabled':_0x5e60c0['isEnabled']}),_0x490380['on']('execute',()=>{this['_executeQuickAction'](_0x5e60c0);}),this['_actionButtons']['push']({'buttonView':_0x490380,'action':_0x5e60c0}),_0x490380['delegate']('execute')['to'](_0x37df41),_0x38667f['children']['add'](_0x490380),_0x1d2fb0['items']['add'](_0x38667f);}),_0x37df41['isEnabled']=_0x23ad56['actions']['some'](_0x3e231c=>_0x3e231c['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x37df41,'group':_0x23ad56}),_0x37df41['panelView']['children']['add'](_0x1d2fb0),_0x3b0f6f['children']['add'](_0x37df41),_0x38599b['items']['add'](_0x3b0f6f);}else{const _0x2addcc=_0x47e42a,_0xb608e3=new te(_0x402c62,_0x4a094e),_0x2f6961=new Zt(_0x402c62);_0x2f6961['set']({'label':_0x2addcc['label'],'icon':_0x2addcc['icon'],'role':'menuitem','isEnabled':_0x2addcc['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x2f6961,'action':_0x2addcc}),_0x2f6961['on']('execute',()=>{this['_executeQuickAction'](_0x2addcc);}),_0x2f6961['delegate']('execute')['to'](_0x4a094e),_0xb608e3['children']['add'](_0x2f6961),_0x38599b['items']['add'](_0xb608e3);}}),Object['values'](eh)['some'](_0x28cf73=>this['editor']['plugins']['has'](_0x28cf73))?_0x4a094e['bind']('isEnabled')['to'](_0x57475e):_0x4a094e['set']({'isEnabled':!0x1}),_0x4a094e['panelView']['children']['add'](_0x38599b),_0x4a094e;});}_executeQuickAction(_0x1b404f){const _0x5e9457=this['editor'];_0x5e9457['editing']['view']['focus'](),_0x5e9457['commands']['execute']('aiQuickAction',_0x1b404f);const _0x1f4d84=_0x5e9457['ui']['view']['menuBarView'];_0x1f4d84&&_0x1f4d84['close']&&_0x1f4d84['close']();}};function sh(_0x323cc2){return'actions'in _0x323cc2;}function nh(_0x36956f,_0x5e93d1){const _0x35013b=_0x36956f['plugins']['get']('AITabs')['view'];_0x35013b['isVisible']=!0x0,_0x35013b['activateTab'](_0x5e93d1);}var rh=class extends _0x3cd7f1{execute(_0x124be3){switch(this['_expandSelectionIfCollapsed'](),_0x124be3['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x301d36=Es(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x301d36});}this['_handleAIChatAction'](_0x124be3);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x37042f=Es(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x37042f});}this['_handleAIActionsAction'](_0x124be3);}}async _handleAIChatAction(_0x5d9ea1){const _0x496a08=this['editor']['plugins']['get']('AIChatController');if(nh(this['editor'],'chat'),'ask-ai'===_0x5d9ea1['id'])_0x496a08['removeSelectionFromChatContext'](),_0x496a08['addSelectionToChatContext'](this['editor']),_0x496a08['focusPromptInput']();else await _0x496a08['startConversation']({'modelId':_0x5d9ea1['model'],'contexts':this['_resolveActionContexts'](_0x5d9ea1)}),_0x496a08['removeSelectionFromChatContext'](),_0x496a08['addSelectionToChatContext'](this['editor']),_0x496a08['focusPromptInput'](),await _0x496a08['sendMessage']({'message':_0x5d9ea1['prompt']||_0x5d9ea1['displayedPrompt']||_0x5d9ea1['label'],'attributes':{'quickActionData':{'id':_0x5d9ea1['id']},'displayedPrompt':_0x5d9ea1['displayedPrompt']}});}_expandSelectionIfCollapsed(){const _0x2810f2=this['editor'],_0x77d2da=_0x2810f2['model']['document']['selection'];if(!_0x77d2da['isCollapsed'])return;const _0x114b2a=mt(_0x77d2da['getSelectedBlocks']())||_0x2810f2['model']['schema']['getLimitElement'](_0x77d2da);_0x2810f2['model']['change'](_0x99b050=>{_0x99b050['setSelection'](_0x114b2a,'in');});}_handleAIActionsActionLabel(_0xaf9cd3){return _0xaf9cd3['parent']?.['label']&&'other'!==_0xaf9cd3['parent']?.['id']?_0xaf9cd3['parent']['label']+':\x20'+_0xaf9cd3['label']:_0xaf9cd3['label'];}async _handleAIActionsAction(_0xec4f17){const _0x29f355=this['editor']['plugins']['get']('AIActions'),_0x5efc47=this['_resolveActionContexts'](_0xec4f17);let _0x1174e4;_0x1174e4=_0xec4f17['prompt']?{'userMessage':_0xec4f17['prompt'],'model':_0xec4f17['model'],'contexts':_0x5efc47}:_0xec4f17['context']?{'model':_0xec4f17['model'],'contexts':_0x5efc47}:{'actionName':_0xec4f17['actionName']||_0xec4f17['id'],'args':_0xec4f17['args'],'contexts':_0x5efc47};const _0x28c3a6=this['_handleAIActionsActionLabel'](_0xec4f17);await _0x29f355['executeAction'](_0x1174e4,_0x28c3a6,_0xec4f17['icon']);}_resolveActionContexts(_0x4985c){const _0x54aef1=_0x4985c['parent']?.['id']?[_0x4985c['id'],_0x4985c['parent']['id']]:[_0x4985c['id']];return this['editor']['plugins']['get'](fs)['contextLibrary']['resolveContext']({'feature':'quickActions','ids':_0x54aef1,'extraContexts':_0x4985c['context']?[_0x4985c['context']]:[],'context':new Yn()})['refs'];}},oh=class extends _0x46bc1f{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x378526=this['editor'],_0x2d8219=new rh(this['editor']);if(_0x378526['commands']['add']('aiQuickAction',_0x2d8219),_0x378526['plugins']['has']('AIChat')){const _0x217113=this['editor']['plugins']['get']('AIChatController');_0x378526['model']['document']['selection']['on']('change:range',(_0x7ed33f,_0x178965)=>{_0x178965['directChange']&&_0x217113['removeSelectionFromChatContext']();});}}},ah=class extends Vn{appendContent(_0x11638d,_0x5025a5='text'){'modification'===this['type']&&'text'===_0x5025a5&&(_0x5025a5=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x11638d,_0x5025a5);}updateChangeGroups(_0x300915){const _0x4db789=this['parsedContent']['get'](_0x300915)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x300915,_0x4db789),this['changeGroups']=[],0x0==_0x4db789['childNodes']['length'])return;on(this['documentContextContent']['get'](_0x300915),this['parsedMergedContent']['get'](_0x300915));const _0x282438=_0x1e1781(this['documentContextContent']['get'](_0x300915)['children']['map'](_0x451389=>({'node':_0x451389,'id':Ps(_0x451389,'data-id')})),_0x4db789['children']['map'](_0x36863d=>({'node':_0x36863d,'id':Ps(_0x36863d,'data-id')||kt()})),{'comparator':(_0x325da9,_0x55eff5)=>_0x325da9['id']==_0x55eff5['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x282438['length']&&_0x282438[_0x282438['length']-0x1]['removed'];)_0x282438['pop']();}const _0x1ef144=_0x282438['map'](_0x2382b4=>{const _0x452ccd=_0x2382b4['added']?'new':_0x2382b4['removed']?'removed':'modified';return{'node':_0x2382b4['value'][0x0]['node'],'type':_0x452ccd,'id':_0x2382b4['value'][0x0]['id']};}),_0x2a885a=this['_documentIdToSource']['get'](_0x300915);this['changeGroups']['push']({'changes':_0x1ef144,'state':'pending','index':this['changeGroups']['length'],'editor':_0x2a885a['editor'],'rootName':_0x2a885a['rootName'],'documentId':_0x300915});}_getDifferentChangeGroups(_0x427625,_0x494211){return _0x494211;}},hh=class extends Fn{content;['version'];editor;rootName;actionName;['args'];['userMessage'];['model'];contexts;['hasError']=!0x1;stoppedExplicitly=!0x1;constructor(_0x1146de){super(_0x1146de),this['content']=_0x1146de['content'],this['version']=_0x1146de['version'],this['editor']=_0x1146de['editor'],this['rootName']=_0x1146de['rootName'],this['actionName']=_0x1146de['actionName'],this['args']=_0x1146de['args'],this['userMessage']=_0x1146de['userMessage'],this['model']=_0x1146de['model'],this['contexts']=_0x1146de['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(_0x33a8fc){const _0xdaea38=this['editor']['config']['get']('collaboration.channelId'),_0x4c6f69=new ah({..._0x33a8fc,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0xdaea38,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0xdaea38,this['editor']]])});return this['replies']['push'](_0x4c6f69),_0x4c6f69['delegate'](...Gn)['to'](this),this['fire']('replyCreated',_0x4c6f69),_0x4c6f69;}},ch=class extends _0x258303{constructor(_0x5b48ec,_0x1dbd65=!0x0,_0x89d841=!0x0){super(_0x5b48ec),this['set']('isEnabled',!0x1),_0x1dbd65&&(this['applyButton']=this['_createButton'](Es(_0x5b48ec,'AI_BALLOON_APPLY_BUTTON'),Ln),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x89d841&&(this['suggestButton']=this['_createButton'](Es(_0x5b48ec,'AI_BALLOON_SUGGEST_BUTTON'),_0x1dbd65?Pn:Ln),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x1dbd65,'showSuggestButton':_0x89d841}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}setButtonsVisibility({showApplyButton:_0x5cbdb8,showSuggestButton:_0x229616}){this['applyButton']&&(this['applyButton']['isVisible']=_0x5cbdb8),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x229616);}_createButton(_0x196bb9,_0x1970f8){const _0x4dc4cf=new Mt(this['locale']);return _0x4dc4cf['set']({'label':_0x196bb9,'class':_0x1970f8,'isVisible':!0x0,'withText':!0x0}),_0x4dc4cf;}},lh=class extends _0x414492{constructor(_0x1bbc07){super(_0x1bbc07),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(_0x1bbc07,'AI_DISCLAIMER_TEXT')}]}]});}},uh=class extends _0x414492{constructor(_0xfff194){super(_0xfff194),this['set']('isVisible',!0x0);const _0x51a271=new Dr('small');_0x51a271['isVisible']=!0x0;const _0x240469=new _0x414492(this['locale']);_0x240469['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',_0x2b11ed=>!_0x2b11ed)]},'children':[_0x51a271,_0x240469]});}},dh=class extends Ma{['focusCycler'];['_config'];_contentWrapper;_streamableContentView;_toolbarView;['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];_keystrokes;_dialogContent;['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];_navigationPreviousButton;_navigationNextButton;_navigationTryAgainButton;_navigationCounter;constructor(_0x2c9994,_0xbc0a8a){super(_0x2c9994),this['set']('isBusy',!0x1),this['set']('isTargetReadOnly',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0xbc0a8a,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 _0x215355(),this['_addContentWrapper'](_0xbc0a8a),this['_addDisclaimerView'](),this['_addToolbar'](_0xbc0a8a),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'](_0xbc0a8a);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0xf6bcee of this['_focusables'])this['_focusTracker']['add'](_0xf6bcee['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}destroy(){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x32044e){-0x1===_0x32044e?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}setIsLoading(_0x3930b1){this['_isLoading']=_0x3930b1;}setErrorState(){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}clearErrorState(){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x429ad9){super['showError'](_0x429ad9),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x228a9c){super['showBlockingError'](_0x228a9c),this['setErrorState']();}addMiniToolbarItem(_0x518207){this['_miniToolbarView']['items']['has'](_0x518207)||this['_miniToolbarView']['items']['add'](_0x518207);}removeMiniToolbarItem(_0x45fa3c){this['_miniToolbarView']['items']['has'](_0x45fa3c)&&this['_miniToolbarView']['items']['remove'](_0x45fa3c);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}_toggleToolbarButtonsVisibility({showApplyButton:_0x1059a9,showSuggestButton:_0x33b0db}){_0x1059a9=_0x1059a9&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x33b0db=_0x33b0db&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x1059a9,'showSuggestButton':_0x33b0db});}async updateContent(_0x3cc5cd){await this['_streamableContentView']['update'](_0x3cc5cd);}finalizeContent(){this['_streamableContentView']['cleanUpStreamingArtifacts']();}clearContent(){this['_streamableContentView']['clear']();}_addContentWrapper(_0x33ce01){this['_contentWrapper']=new _0x414492(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'](_0x33ce01['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new lh(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x1cbe0e,showSuggestButton:_0x2eb254}){this['_toolbarView']=new ch(this['locale'],_0x1cbe0e,_0x2eb254),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',(_0xd928c8,_0x17c393,_0x27177b,_0x33540e)=>!(_0xd928c8||_0x17c393||_0x27177b||_0x33540e)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x1cbe0e,'showSuggestButton':_0x2eb254}),this['_dialogContent']['add'](this['_toolbarView']);}_createMiniToolbar(_0x1e62dd){return this['_miniToolbarView']=new Ba(this['locale'],_0x1e62dd),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',(_0x8d728b,_0x19a550)=>!(_0x8d728b||_0x19a550)),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 _0x26c978=new Mt(this['locale']),_0x750014=new Mt(this['locale']),_0x40a75f=new _h(this['locale']),_0x250424=new Mt(this['locale']);_0x26c978['set']({'icon':_0x5527c5,'label':Es(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Dn}),_0x750014['set']({'icon':_0x58652b,'tooltip':Es(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Dn}),_0x250424['set']({'icon':_0x3b32e9,'tooltip':Es(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Dn}),_0x26c978['bind']('isEnabled')['to'](this,'isBusy',_0x419958=>!_0x419958),_0x26c978['on']('execute',()=>{this['fire']('tryAgain');}),_0x750014['bind']('isEnabled')['to'](this,'isBusy',_0x3d0e2c=>!_0x3d0e2c),_0x750014['on']('execute',()=>{this['fire']('showPrevious');}),_0x250424['bind']('isEnabled')['to'](this,'isBusy',_0x3d74b7=>!_0x3d74b7),_0x250424['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x750014,this['_navigationCounter']=_0x40a75f,this['_navigationNextButton']=_0x250424,this['_navigationTryAgainButton']=_0x26c978;}updateMiniToolbarButtons(_0xb53850,_0x1e4f44){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x4ae523=_0xb53850>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x4ae523){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0xbb069e=_0xb53850-_0x1e4f44;this['_navigationCounter']['setInteractionCount'](_0xbb069e+'/'+_0xb53850),this['_navigationPreviousButton']['isEnabled']=_0x1e4f44<_0xb53850-0x1,this['_navigationNextButton']['isEnabled']=_0x1e4f44>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(_0x5620f5){this['_isLoading']=_0x5620f5;}resetShowChangesButton(){this['_miniToolbarView']['isShowChangesOn']=!0x1;}_setupMiniToolbarPositioning(){const _0x398c5c=this['_streamableContentView']['element'],_0x1b755e=this['_miniToolbarView']['element'],_0x5c8fc7=()=>{wt['window']['requestAnimationFrame'](()=>{const _0x564ad9=_0x398c5c['offsetWidth']-_0x398c5c['clientWidth'];_0x1b755e['style']['right']='calc('+_0x564ad9+'px\x20+\x20var(--ck-spacing-large))';});};_0x5c8fc7(),this['_miniToolbarResizeObserver']=new pt(_0x398c5c,()=>{_0x5c8fc7();});}_initializeScrollManager(){const _0x4f8f96=this['_getScrollableElement']();_0x4f8f96&&!this['_scrollManager']&&(this['_scrollManager']=new ao(_0x4f8f96));}_getScrollableElement(){return this['_streamableContentView']['element'];}},_h=class extends _0x414492{constructor(_0x1e3e98){super(_0x1e3e98);const _0x1e9f04=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x1e9f04['to']('interactionCount')}]});}setInteractionCount(_0xac411a){this['set']('interactionCount',_0xac411a);}},gh=class extends _0x46bc1f{static get requires(){return[Is,Nn,Ut,tn,Va,_0x1ba3e1];}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(_0x4eca05){super(_0x4eca05),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(_0x9d5ebf,_0x4c7c90,_0x16de60){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x149464,anchorData:_0x5fc1ad,root:_0x47d075}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x9d5ebf,_0x149464,_0x5fc1ad,_0x47d075,_0x4c7c90,_0x16de60);}const {modelFragment:_0x259641,anchorData:_0x3098ea,root:_0x4e7b8d}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x9d5ebf,_0x259641,_0x3098ea,_0x4e7b8d,_0x4c7c90,_0x16de60);}async destroy(){return this['_stopInteraction'](),super['destroy']();}_createActionsBalloonView(){const _0x5beec4=this['editor']['plugins']['has']('TrackChanges');let _0x5b8b8a=this['editor']['config']['get']('ai.availableReplyActions')||[...Or];_0x5beec4||(_0x5b8b8a=_0x5b8b8a['filter'](_0xbc122b=>'insertSuggestion'!=_0xbc122b));const _0x4713f4=this['editor']['commands']['get']('trackChanges'),_0x2c6917=new dh(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x5beec4,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x5b8b8a});return _0x2c6917['bind']('isBusy')['to'](this),_0x2c6917['bind']('isTargetReadOnly')['to'](this['editor'],'isReadOnly'),_0x4713f4&&_0x2c6917['bind']('isTrackChangesOn')['to'](_0x4713f4,'value'),_0x2c6917['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x2c6917['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x2c6917['on']('showNext',()=>{this['_navigateToNext']();}),_0x2c6917;}_normalizeSelectionStart(){const _0xa0bf8f=this['editor']['model'],_0x2de424=_0xa0bf8f['document']['selection'],_0x13188b=_0x2de424['getFirstRange']();if(!_0x13188b||_0x13188b['isCollapsed'])return;const _0x1afb39=mt(_0x2de424['getSelectedBlocks']());if(!_0x1afb39)return;const _0x379250=_0xa0bf8f['createPositionAt'](_0x1afb39,0x0);_0x379250['isAfter'](_0x13188b['start'])&&_0xa0bf8f['change'](_0x9a9c94=>{_0x9a9c94['setSelection'](_0x9a9c94['createRange'](_0x379250,_0x13188b['end']));});}_getExecuteDataRegular(){const _0x161622=this['editor']['model']['document']['selection'],_0x5094f2=_0x161622['getFirstRange']()['start']['root'];if(_0x161622['isCollapsed']){const _0x338ef4=mt(_0x161622['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x161622);this['editor']['model']['change'](_0x5d7bc9=>{_0x5d7bc9['setSelection'](_0x338ef4,'in');});}this['_normalizeSelectionStart']();const _0x5ba236=_0x161622['getFirstRange'](),_0x43c01e=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x161622),_0x5ba236['start'],_0x5ba236['end']);this['_copyMarkersToFragment'](_0x43c01e,_0x161622,{'isTableSelection':!0x1});const _0x516432=_0x161622['getFirstRange']()['start'],_0x745c69=new Map();let _0x1c9cd8=_0x43c01e;for(let _0x14b305=0x0;_0x14b305<_0x516432['path']['length'];_0x14b305++)_0x745c69['set'](_0x1c9cd8,_0x516432['path'][_0x14b305]),_0x1c9cd8=_0x1c9cd8['getChild'](0x0);return{'modelFragment':_0x43c01e,'anchorData':_0x745c69,'root':_0x5094f2};}_getExecuteDataInTable(){const _0x13c12f=this['editor']['model']['document']['selection'],_0x157b96=this['editor']['plugins']['get']('TableSelection'),_0x46a12c=_0x13c12f['getFirstRange']()['start']['root'],_0x3deec1=_0x157b96['getSelectionAsFragment'](),_0x83453e=_0x13c12f['getFirstRange']()['start']['parent']['parent'],_0x5b3ffc=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x83453e),this['editor']['model']['createPositionAfter'](_0x83453e)),_0x57d6da=this['_wrapWithCommonAncestors'](_0x3deec1,_0x5b3ffc['start'],_0x5b3ffc['end']);this['_copyMarkersToFragment'](_0x57d6da,_0x13c12f,{'isTableSelection':!0x0});const _0x476144=_0x13c12f['getFirstRange']()['start'],_0x32f80d=new Map();let _0x2d81d7=_0x57d6da;for(let _0x47bb04=0x0;_0x47bb04<_0x476144['path']['length'];_0x47bb04++)if(_0x32f80d['set'](_0x2d81d7,_0x476144['path'][_0x47bb04]),_0x47bb04<_0x476144['path']['length']-0x1)_0x2d81d7=_0x2d81d7['getChild'](0x0);else{let _0xfba4cb=_0x2d81d7['nextSibling'];for(;_0xfba4cb;)_0x32f80d['set'](_0xfba4cb,_0x476144['path'][_0x47bb04]),_0xfba4cb=_0xfba4cb['nextSibling'];}return{'modelFragment':_0x57d6da,'anchorData':_0x32f80d,'root':_0x46a12c};}async _executeAction(_0x14005f,_0x3b672a,_0x5e188e,_0x225015,_0x45f2f9,_0x3b256b){const _0xb1dc5e=this['editor']['plugins']['get'](tn),_0x24041d=this['editor']['plugins']['get'](Va),_0x1ca3af=this['editor']['model']['document']['selection'],_0x343353=await _0xb1dc5e['modelToDataWithIds'](_0x3b672a,this['editor'],_0x225015['rootName']),_0x22b72d=this['editor']['model']['document']['version'],_0x2337bd=[..._0x1ca3af['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x24041d['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x45f2f9,'icon':_0x3b256b||_0x5f0553,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x2337bd,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x24041d),this['_interactionParams']={'action':_0x14005f,'content':_0x343353,'version':_0x22b72d,'aiBalloon':_0x24041d,'modelFragment':_0x3b672a,'anchorData':_0x5e188e,'root':_0x225015},this['_setupApplyListeners'](),this['listenTo'](_0x24041d,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x24041d,'dialogClosed',(_0x38ffc6,{id:_0x12cc2d})=>{if('aiActionsBalloon'===_0x12cc2d){for(const _0x399218 of this['_interactions']){if(0x0===_0x399218['replies']['length']||_0x399218['stoppedExplicitly'])continue;const _0x1f4f3c=_0x399218['replies'][_0x399218['replies']['length']-0x1],_0x2b36c3=_0x1f4f3c['changeGroups'][0x0];_0x2b36c3&&'pending'===_0x2b36c3['state']&&_0x1f4f3c['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x24041d);}}),this['_createInteraction'](_0x343353,_0x22b72d,_0x24041d,_0x14005f);}_setupApplyListeners(){if(!this['_interactionParams'])return;const {modelFragment:_0x3bce5f,anchorData:_0x462e9a,root:_0x456680}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x3bce5f,_0x462e9a,_0x456680,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x3bce5f,_0x462e9a,_0x456680,!0x0);});}_wrapWithCommonAncestors(_0x388779,_0x457d4d,_0x1815f4){const _0x31b6b8=this['editor']['model']['createRange'](_0x457d4d,_0x1815f4)['getCommonAncestor'](),_0x18bbac=_0x31b6b8['is']('documentFragment')?[]:_0x31b6b8['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x18bbac['length']){const _0x3ca365=_0x18bbac['map'](_0x3ce03d=>_0x3ce03d['_clone'](!0x1));for(let _0x1bb657=0x1;_0x1bb657<_0x3ca365['length'];_0x1bb657++)_0x3ca365[_0x1bb657-0x1]['_appendChild'](_0x3ca365[_0x1bb657]);return _0x3ca365[_0x3ca365['length']-0x1]['_appendChild'](_0x388779),new _0xe9fd4c(_0x3ca365[0x0]);}return _0x388779;}_copyMarkersToFragment(_0x263244,_0x512300,_0xb34c0a={'isTableSelection':!0x1}){const _0x281e66=this['editor']['model'],_0x33ad62=Array['from'](_0x512300['getRanges']()),_0x171ca9=_0x512300['getFirstRange']()['start'];for(const _0x234fb2 of _0x281e66['markers']){if(_0x234fb2['name']['startsWith']('ai-selection')||!_0x234fb2['affectsData'])continue;const _0x336c8e=_0x234fb2['getRange']();if(!_0x33ad62['some'](_0x194f8c=>_0x194f8c['containsRange'](_0x336c8e,!0x0)))continue;const _0xe28cd4=this['_regularCalculateMarkerPath'](_0x336c8e['start'],_0x171ca9,_0xb34c0a['isTableSelection']),_0xcafa69=this['_regularCalculateMarkerPath'](_0x336c8e['end'],_0x171ca9,_0xb34c0a['isTableSelection']),_0x580aa9=_0x281e66['createPositionFromPath'](_0x263244,_0xe28cd4),_0x455784=_0x281e66['createPositionFromPath'](_0x263244,_0xcafa69);if(!_0x580aa9['isEqual'](_0x455784)){const _0x18e142=_0x281e66['createRange'](_0x580aa9,_0x455784);_0x263244['markers']['set'](_0x234fb2['name'],_0x18e142);}}}_regularCalculateMarkerPath(_0xf89ca3,_0x578c77,_0x4fd1b5=!0x1){const _0x2e57b4=[..._0xf89ca3['path']['slice']()];for(let _0x180c87=0x0;_0x180c87<Math['max'](_0x578c77['path']['length'],_0xf89ca3['path']['length']);_0x180c87++){const _0x1da3b4=_0x578c77['path'][_0x180c87]||0x0,_0x3b57c9=(_0xf89ca3['path'][_0x180c87]||0x0)-_0x1da3b4;if(_0x2e57b4[_0x180c87]=_0x3b57c9,0x0!==_0x3b57c9&&!_0x4fd1b5)break;}return _0x2e57b4;}async _createInteraction(_0x4565ed,_0x5bb762,_0x4c3d5c,_0x34ce48){const _0x49b5bb=this['editor'],_0x38a07e=_0x49b5bb['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0x34ce48,'content':_0x4565ed,'version':_0x5bb762,'aiBalloon':_0x4c3d5c,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x38a07e});const _0x3c19c3=new hh({'connector':this['_aiConnector'],'locale':_0x49b5bb['locale'],'content':_0x4565ed,'version':_0x5bb762,'editor':_0x49b5bb,'rootName':_0x38a07e['rootName'],..._0x34ce48});this['_interactions']['push'](_0x3c19c3);const _0x512b95=(_0x59b322,_0x4609e6=!0x1,_0x476460='streaming')=>{const {isDone:_0x160d9a}=_0x59b322;return this['_promiseQueue']['enqueue'](async _0x57539d=>{try{if(this['_isUnsupportedInlineRootChange'](_0x59b322,_0x38a07e))return this['_actionsBalloonView']['showBlockingError'](Es(_0x49b5bb['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')),void(_0x160d9a&&this['_actionsBalloonView']['finalizeContent']());const _0x1433db=ln({'changeGroups':_0x59b322['changeGroups'],'documentContextContent':_0x59b322['documentContextContent'],'showDiff':_0x4609e6,'trimUnchanged':!0x1});_0x1433db['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x1433db[0x0],'renderingStrategy':_0x476460,'abortSignal':_0x57539d}),_0x160d9a&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x60fb0e){if(kn(_0x60fb0e))return;throw _0x60fb0e;}});};_0x3c19c3['on']('replyCreated',(_0x2daa11,_0x43089f)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x512b95(_0x43089f)['catch'](_0x22d468=>{this['_reporter']['logError'](_0x22d468,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x3c19c3,_0x22d468);});}),_0x3c19c3['on']('replyContentUpdated',(_0x30899e,_0x4f12ae)=>{_0x512b95(_0x4f12ae)['catch'](_0xc1cc4e=>{this['_reporter']['logError'](_0xc1cc4e,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x3c19c3,_0xc1cc4e);});}),_0x3c19c3['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x13015a){this['_reporter']['logError'](_0x13015a,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x3c19c3,_0x13015a);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x5584e1,{showDiff:_0x2c52a5})=>{try{this['_balloonShowDiff']=_0x2c52a5;const _0x5835a6=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x5835a6&&await _0x512b95(_0x5835a6,_0x2c52a5,'static');}catch(_0x40d659){this['_reporter']['logError'](_0x40d659,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x3c19c3,_0x40d659);}}),_0x3c19c3['on']('replyChangeGroupStateUpdated',()=>{const _0x28e832={'positiveCount':_0x3c19c3['replies']['reduce']((_0x53ff9a,_0x3152d6)=>_0x53ff9a+_0x3152d6['changeGroups']['filter'](_0x19ed0e=>'accepted'===_0x19ed0e['state'])['length'],0x0),'totalCount':_0x3c19c3['replies']['reduce']((_0x4a4ddd,_0x243f33)=>_0x4a4ddd+_0x243f33['changeGroups']['length'],0x0)},_0x33332b=_0x3c19c3['actionCallId'],_0x43fb92=_0x3c19c3['actionName'];_0x43fb92?this['_aiConnector']['upsertAIActionRating'](_0x43fb92,_0x33332b,_0x28e832):this['_aiConnector']['upsertCustomAIActionRating'](_0x33332b,_0x28e832);}),this['_setLoadingState']();try{const _0x5980d3=await _0x3c19c3['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x5980d3;}catch(_0x3a9419){kn(_0x3a9419)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x3a9419,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x3c19c3,_0x3a9419);}}_isUnsupportedInlineRootChange(_0x4defe5,_0xd5aa03){const _0x34555c=this['editor'];return!!Gs(_0x34555c,_0xd5aa03['rootName'])&&!Ys(_0x34555c,new _0x35b618((_0x4defe5['changeGroups'][0x0]?.['changes']??[])['filter'](_0x1e79d2=>'removed'!==_0x1e79d2['type'])['map'](_0x5cc868=>_0x5cc868['node']['cloneNode'](!0x0))));}['_applyChanges'](_0x2ce275,_0x1e1904,_0x506619,_0x26b73f){const _0x3dea21=this['editor'];if(_0x26b73f&&!_0x3dea21['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',null);const _0x59b75c=this['editor']['plugins']['get'](_0x1ba3e1),_0x36a87f=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x36a87f||!_0x36a87f['replies']['length'])return;const _0x85a8a0=_0x36a87f['replies'][_0x36a87f['replies']['length']-0x1];if(this['_isUnsupportedInlineRootChange'](_0x85a8a0,_0x506619))return void this['_actionsBalloonView']['showBlockingError'](Es(_0x3dea21['locale'],'AI_SUGGESTION_NO_PARTS_WARNING'));_0x85a8a0['setChangeGroupState'](0x0,'accepted');const _0x1edef3=Jn({'documentSuggestions':Zn({'groups':[_0x85a8a0['changeGroups'][0x0]],'documentContextContent':_0x85a8a0['documentContextContent'],'documents':_0x36a87f['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x59b75c,'documentCompareOptions':{'anchor':_0x3dea21['model']['createPositionAt'](_0x2ce275,0x0),'markDeletions':_0x26b73f}})['values']()['next']()['value']??[],_0x5ec9b2=this['_filterOperationsOutsideRange'](_0x1edef3,_0x1e1904);for(const _0x58ced5 of _0x5ec9b2)this['_anchorOperation'](_0x1e1904,_0x58ced5,_0x506619);const _0xc506b6=_0x36a87f['getDocumentContext']()['documents'][0x0]['version'],_0x40fde0=_0x318423(_0x5ec9b2,_0x3dea21['model']['document']['history']['getOperations'](_0xc506b6),{'document':_0x3dea21['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];mn(_0x40fde0,'quickActions');try{_0x3dea21['model']['change'](_0x442e13=>{_0x442e13['setSelection'](_0x3dea21['model']['document']['selection']['focus']),_0x26b73f?_0x3dea21['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x40fde0):_0x59b75c['applyOperations'](_0x442e13,_0x40fde0);});}catch(_0x1bb3f3){throw this['_reporter']['logError'](new yn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x1bb3f3})),_0x1bb3f3;}this['editor']['plugins']['get']('AIBalloon')['close']();}_filterOperationsOutsideRange(_0x2bcf71,_0x1f665c){return _0x2bcf71['filter'](_0x31a374=>{if('rename'==_0x31a374['type']){const _0x341585=_0x31a374['position']['nodeAfter'];return!_0x1f665c['has'](_0x341585);}if(_0x31a374['type']['indexOf']('Attribute')>-0x1){const _0xab6196=_0x31a374['range']['start']['nodeAfter'];return!_0x1f665c['has'](_0xab6196);}return!0x0;});}_anchorOperation(_0x47b92f,_0x11d2e3,_0x2a2878){const _0x254321=_0x11d2e3['clone']();for(const _0x2c4bb7 in _0x11d2e3){const _0x5965e2=_0x11d2e3[_0x2c4bb7];_0x5965e2 instanceof _0x5b86ed?_0x11d2e3[_0x2c4bb7]=new _0x5b86ed(_0x5af187(_0x5965e2['start']),_0x5af187(_0x5965e2['end'])):_0x5965e2 instanceof _0x29cdf6&&(_0x11d2e3[_0x2c4bb7]=_0x5af187(_0x5965e2));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x254321['type'])){if(_0x254321['isDocumentOperation']=!0x1,_0x254321['baseVersion']=null,'remove'==_0x254321['type']){const _0x131a52=_0x254321['sourcePosition'],_0x839c2d=_0x254321['howMany'];new _0x47f76a(_0x131a52,_0x839c2d)['_execute']();}else _0x254321['_execute']();}function _0x5af187(_0x38c9b6){if('$graveyard'==_0x38c9b6['root']['rootName'])return _0x38c9b6;const _0xbe675a=[];let _0x386f5a=_0x38c9b6['root'];for(let _0x509b91=0x0;_0x509b91<_0x38c9b6['path']['length'];_0x509b91++){const _0xf17c5=_0x47b92f['get'](_0x386f5a)||0x0;_0xbe675a[_0x509b91]=_0x38c9b6['path'][_0x509b91]+_0xf17c5,_0x386f5a=_0x386f5a['getChildAtOffset'](_0x38c9b6['path'][_0x509b91]);}return new _0x29cdf6(_0x2a2878,_0xbe675a,_0x38c9b6['stickiness']);}}_refreshInteraction(){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0xc1a4df,content:_0x338943,version:_0x11b9b1,aiBalloon:_0x5d8612}=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'](_0x338943,_0x11b9b1,_0x5d8612,_0xc1a4df)['catch'](_0x3b9f5a=>{this['_reporter']['logError'](_0x3b9f5a,{'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 _0x5a3907=this['_interactions']['length'];this['_currentInteractionIndex']<_0x5a3907-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}_navigateToNext(){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async _displayInteractionAtIndex(_0x4ea2c9){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x4ea2c9;const _0x38e967=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x38e967)return;if(_0x38e967['hasError'])return this['_setErrorState'](_0x38e967),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x38e967['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x50379a=_0x38e967['replies'][_0x38e967['replies']['length']-0x1];if(_0x50379a)try{const _0x4387ff=ln({'changeGroups':_0x50379a['changeGroups'],'documentContextContent':_0x50379a['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x22532b=>setTimeout(_0x22532b,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x4387ff[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x4baea5){this['_reporter']['logError'](_0x4baea5,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}_setLoadingState(){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async _setErrorState(_0x699e9c,_0x2c917f){if(void 0x0!==_0x2c917f&&kn(_0x2c917f))return;const _0x5245cd=Es(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x5245cd),_0x699e9c['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 _0x46bc1f{static get requires(){return[ih,oh,gh];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1cd523){super(_0x1cd523),_0x1cd523['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Ih=class extends _0x414492{resultResponseView;acceptButtonView;dismissButtonView;infoButtonView;outdatedButtonView;constructor(_0x3d2ec7,_0x1dc2c5){super(_0x3d2ec7),this['id']=_0x1dc2c5,this['set']('status','pending'),this['set']('changeId',_0x1dc2c5),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',(_0x103c01,_0x124a94)=>{_0x124a94&&_0x124a94['target']&&'A'===_0x124a94['target']['tagName']&&_0x124a94['preventDefault'](),this['fire']('activateChange',{'id':_0x1dc2c5,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x1dc2c5,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x1dc2c5,'source':this});}),this['on']('change:showDiff',()=>this['_syncResponseVisibility']());}['render'](){super['render'](),this['_syncResponseVisibility']();}setItemAsActive(){this['isActive']=!0x0;}setItemAsInactive(){this['isActive']=!0x1;}_createResultResponseView(){const _0x3e401e=new _0x414492(this['locale']);return _0x3e401e['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response']}}),_0x3e401e;}updateResponseContent(_0x16b430,_0x227420){const _0x1be9dc=_0x227420||'div',_0x3721e7=this['resultResponseView']['element'];if(_0x3721e7['tagName']['toLowerCase']()!==_0x1be9dc){const _0x9b6d6e=new _0x262be9({'tag':_0x1be9dc,'attributes':{'class':_0x3721e7['className']}})['render']();_0x3721e7['replaceWith'](_0x9b6d6e),this['resultResponseView']['element']=_0x9b6d6e,this['_syncResponseVisibility']();}this['resultResponseView']['element']['innerHTML']=_0x16b430;}_syncResponseVisibility(){this['resultResponseView']['element']?.['classList']['toggle']('ck-hidden',!this['showDiff']);}_createAcceptButtonView(){const _0x26a36d=new Mt(this['locale']);return _0x26a36d['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x26a36d['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x32b737=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x32b737['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x13295b=>'pending'!==_0x13295b&&'accepted'!==_0x13295b),this['bindTemplate']['if']('status',Pn,_0x58efbb=>'pending'===_0x58efbb),this['bindTemplate']['if']('status',Dn,_0x2edbc1=>'pending'!==_0x2edbc1),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0xca6d8e=>'accepted'===_0xca6d8e)]}}),this['on']('change:status',(_0x13f2af,_0x9662fa,_0x523c74)=>{_0x26a36d['isEnabled']='pending'===_0x523c74,'accepted'===_0x523c74&&(_0x26a36d['label']=Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x26a36d['icon']=_0x32ea05);}),_0x26a36d;}_createDismissButtonView(){const _0xaabca5=new Mt(this['locale']);return _0xaabca5['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0xaabca5['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x216b9d=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x216b9d['stopPropagation']();})},'attributes':{'class':[Dn,this['bindTemplate']['if']('status','ck-hidden',_0x28a02e=>'pending'!==_0x28a02e&&'rejected'!==_0x28a02e),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x47290e=>'pending'===_0x47290e),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0xa3f4d4=>'rejected'===_0xa3f4d4)]}}),this['on']('change:status',(_0x876c25,_0x5a6185,_0x252cd7)=>{_0xaabca5['isEnabled']='pending'===_0x252cd7,'rejected'===_0x252cd7&&(_0xaabca5['label']=Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0xaabca5['icon']=_0x40a4cb);}),_0xaabca5;}_createInfoButtonView(){const _0x2fe2ed=new Mt(this['locale']);return _0x2fe2ed['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x31aaf1,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Dn+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x2fe2ed['bind']('isOn')['to'](this,'isInfoToggleOn',_0x12657b=>_0x12657b),_0x2fe2ed['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x2fe2ed;}_createOutdatedButtonView(){const _0x21f29c=new Mt(this['locale']);return _0x21f29c['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0x3ad071,'withText':!0x0,'isEnabled':!0x1}),_0x21f29c['extendTemplate']({'attributes':{'class':[Dn,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x39d972=>'outdated'!==_0x39d972)],'disabled':'disabled'}}),_0x21f29c;}},ph=class extends xt{resultItemView;_pinnedRectIndex=void 0x0;_pinnedTargetElement=void 0x0;_pinnedTargetChangeId=void 0x0;constructor(_0x32678a,_0x153f75){super(_0x32678a),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']()),_0x153f75['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}updateContent(_0x18a7df){this['resultItemView']['changeId']=_0x18a7df['id'],this['resultItemView']['updateResponseContent'](_0x18a7df['contentDiffed'],_0x18a7df['wrapperTag']);}['showBalloon'](_0x382261,_0x6ec1e5,_0x6da514,_0x3fcb87,_0x11a702,_0x43c8ee){const _0x3e8db6=_0x6ec1e5();if(!_0x3e8db6)return;this['updateContent'](_0x382261),this['show']();const _0x26c2fb=Array['from'](_0x3e8db6['getClientRects']())['reverse'](),_0xefd3b8=this['_getPointedRectIndexFromEvent'](_0x6da514,_0x26c2fb),_0x29e516=_0x26c2fb[_0xefd3b8??0x0];'click'===_0x3fcb87?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x6ec1e5(),_0xefd3b8,_0x382261['id'],_0x11a702,_0x43c8ee)||_0x29e516})):'hover'===_0x3fcb87&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x6ec1e5(),_0xefd3b8,_0x382261['id'])||_0x29e516}));}['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(){_0x4b6d2c({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x40366f=[this['element']];return this['_pinnedTargetElement']&&_0x40366f['push'](this['_pinnedTargetElement']),_0x40366f;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}_createContentView(){const _0x3f7c95=new _0x414492();return this['resultItemView']=new Ih(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x3f7c95['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']]}]}),_0x3f7c95;}_getBestRectPositionOnClick(_0x5352fc,_0x30781d,_0x2549d1,_0x5cf6a4,_0x3dc65e){if(!_0x5352fc)return null;const _0x57fd22=this['position']['replace']('arrow_',''),_0x2dd6c0=Array['from'](_0x5352fc['getClientRects']());let _0x5d6744,_0x581c71=_0x2dd6c0['reverse']();return void 0x0!==_0x30781d&&this['_isPinnedRectVisible'](_0x581c71[_0x30781d],_0x5cf6a4,_0x3dc65e)?(_0x5d6744=_0x581c71[_0x30781d],this['_pinnedRectIndex']=_0x30781d):this['_isPinnedRectVisible'](_0x581c71[0x0],_0x5cf6a4,_0x3dc65e)&&void 0x0===_0x30781d?_0x5d6744=_0x581c71[0x0]:(_0x581c71='s'==_0x57fd22[0x0]?[..._0x2dd6c0]['reverse']():_0x2dd6c0,_0x581c71['forEach'](_0x197436=>{this['_isPinnedRectVisible'](_0x197436,_0x5cf6a4,_0x3dc65e)&&(_0x5d6744=_0x197436);})),this['_pinnedTargetChangeId']=_0x2549d1,this['_pinnedTargetElement']=_0x5352fc,_0x5d6744||_0x5352fc['getBoundingClientRect']();}_getBestRectPositionOnHover(_0x3a4528,_0xe49acb,_0x22f0a4){if(!_0x3a4528)return null;const _0x28c528=Array['from'](_0x3a4528['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0xe49acb&&this['_pinnedTargetChangeId']!==_0x22f0a4?(this['_pinnedRectIndex']=_0xe49acb,this['_pinnedTargetElement']=_0x3a4528,this['_pinnedTargetChangeId']=_0x22f0a4,_0x28c528[_0xe49acb]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x22f0a4?_0x3a4528!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x28c528[this['_pinnedRectIndex']]:void 0x0!==_0xe49acb&&this['_pinnedTargetChangeId']!==_0x22f0a4?(this['_pinnedRectIndex']=_0xe49acb,this['_pinnedTargetElement']=_0x3a4528,this['_pinnedTargetChangeId']=_0x22f0a4,_0x28c528[_0xe49acb]):_0x3a4528['getBoundingClientRect']();}_getPointedRectIndexFromEvent(_0x3d75c6,_0x15c2eb){if(_0x3d75c6)for(let _0x2ae005=0x0;_0x2ae005<_0x15c2eb['length'];_0x2ae005++){const _0x1e3b94=_0x15c2eb[_0x2ae005];if(_0x3d75c6['clientX']>=_0x1e3b94['left']-0x3&&_0x3d75c6['clientX']<=_0x1e3b94['right']+0x3&&_0x3d75c6['clientY']>=_0x1e3b94['top']-0x3&&_0x3d75c6['clientY']<=_0x1e3b94['bottom']+0x3)return _0x2ae005;}}_isPinnedRectVisible(_0x19d46c,_0x96318e,_0x4268a){const _0x2779cc=new It(_0x19d46c),_0x1d28ee=_0x96318e||document['documentElement'],_0xa15fca=_0x2779cc['getIntersection'](Tt(_0x4268a)),_0x2cc5f1=new It(_0x1d28ee)['getIntersection'](_0x2779cc);return!!(_0xa15fca&&_0x2cc5f1&&_0x2779cc['width']>0x0);}};const Eh=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var mh=class extends _0x77cfae{['_mainView'];_balloonSuggestionView;_bodyCollection;static get requires(){return[gs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x260b09){super(_0x260b09),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 _0x4b05f7=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x4b05f7);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}setAvailableChecks(_0x23d776){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x5abc60=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x23d776,_0x5abc60);}this['_mainView']['showReviewCheckListView']();}showReviewCheckList(){this['fire']('getReviewCheckList');}showCheckRunResults(_0x132bda){_0x132bda&&('error-general'!==_0x132bda['status']?'error-chunk'!==_0x132bda['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}showCheckRunResult(_0x272de6){this['_mainView']['addCheckRunResult'](_0x272de6);}showGeneralResultsErrorView(){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x27034a){this['_mainView']['showGeneralReviewCoreErrorView'](_0x27034a??Es(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}showUnsupportedInlineChangeView(){this['_mainView']['showUnsupportedInlineChangeView']();}setCheckResultTitle(_0x5d5227,_0x17b1b6){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x5d5227,_0x17b1b6);}setAcceptAllEnabled(_0x538340){this['_mainView']['reviewCheckResultsView']['setAcceptAllEnabled'](_0x538340);}setActiveStateInResults(_0x177c24){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x183c65=>{_0x183c65['id']===_0x177c24&&_0x183c65['setItemAsActive']();});}resetActiveStateInResults(){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x5bfc4c=>_0x5bfc4c['setItemAsInactive']());}updateChangeState(_0x1d6bfb,_0x1a85d9){'accepted'===_0x1a85d9||'rejected'===_0x1a85d9||'outdated'===_0x1a85d9?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x1d6bfb,_0x1a85d9):this['_mainView']['reviewCheckResultsView']['showResult'](_0x1d6bfb,_0x1a85d9);}showReviewCompletedView(){this['_mainView']['showReviewCompletedView']();}showActionsWhenResultIsReady(){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}hideActionsWhenResultIsReady(){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x20eed1,_0x43308f,_0x6b7f0e,_0x5c0dda,_0x1d97db,_0x24219c){this['_balloonSuggestionView']['showBalloon'](_0x20eed1,_0x43308f,_0x6b7f0e,_0x5c0dda,_0x1d97db,_0x24219c);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}getChangeElement(_0x531b9e){const _0x2b9d78=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x44e79d=>_0x44e79d['id']===_0x531b9e);return _0x2b9d78?_0x2b9d78['element']:null;}deactivateChange(){this['_balloonSuggestionView']['deactivateChange']();}},Th=class extends _0x414492{constructor(_0x4680df){super(_0x4680df),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0xbdf843=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0xbdf843['if']('isVisible','ck-hidden',_0x53b021=>!_0x53b021)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0xbdf843['to']('errorMessage')}]}]});}},wh=class extends _0x414492{['reviewCoreHeader'];['generalErrorView'];reviewCheckListView;reviewCheckResultsView;reviewCompletedView;constructor(_0x21745a,_0x4e944d){super(_0x21745a),this['reviewCoreHeader']=_0x4e944d['header'],this['generalErrorView']=new Th(_0x21745a),this['reviewCheckListView']=_0x4e944d['list'],this['reviewCheckListView']['delegate'](...Eh)['to'](this),this['reviewCheckResultsView']=_0x4e944d['results'],this['reviewCheckResultsView']['delegate'](...Eh)['to'](this),this['reviewCompletedView']=_0x4e944d['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(_0x491f10){this['reviewCheckResultsView']['addResult'](_0x491f10),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'](_0x1ec069){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x1ec069;}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(_0x3345bd,_0x348aa8){super(_0x348aa8),this['set']({'label':_0x3345bd,'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(_0x1ddccb,_0x5eed8f){super(_0x1ddccb),this['_contents']=_0x5eed8f,this['_resultViews']=new _0x215355(),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(_0x1ddccb),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',(_0x334928,_0x100284)=>_0x334928&&!_0x100284);const _0x223b88=this['_createCombinedSkeletonLoader'](),_0x2de09f=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x2de09f['if']('isLoading','ck-ai_review__check-run_loading',_0x1a1913=>_0x1a1913),_0x2de09f['if']('isResultReady','ck-ai_review__check-run_ready',_0x291b21=>_0x291b21),_0x2de09f['if']('isVisible','ck-hidden',_0xf4be1f=>!_0xf4be1f)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x223b88,this['reviewDisclaimer']]});}clearResults(){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}getResults(){return this['_resultViews'];}addResult(_0x1f987b){const _0x38087b=new Ih(this['locale'],_0x1f987b['id']);_0x38087b['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x38087b),_0x38087b['updateResponseContent'](_0x1f987b['contentDiffed'],_0x1f987b['wrapperTag']);}hideResult(_0x99e9d4,_0x1b6186){if('pending'===_0x1b6186)return;const _0x43b563=this['_resultViews']['find'](_0x48bb4b=>_0x48bb4b['id']===_0x99e9d4);_0x43b563&&(_0x43b563['status']=_0x1b6186,_0x43b563['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}showResult(_0x78039b,_0x29e5c3){if('pending'!==_0x29e5c3)return;const _0xf51588=this['_resultViews']['find'](_0x5d18dd=>_0x5d18dd['id']===_0x78039b);_0xf51588&&(_0xf51588['status']=_0x29e5c3,_0xf51588['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}setTitle(_0x1e79c2,_0x2468c3){this['headerTitle']=_0x1e79c2,this['headerSubtitle']=_0x2468c3||'';}['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(_0x4f363f){this['isAcceptAllEnabled']=_0x4f363f;}_createSkeletonLoader(){return new wr(this['locale'],Cr['aiReviewChecks']);}_createCombinedSkeletonLoader(){const _0xe7fcb8=new _0x414492(this['locale']),_0x346a6b=[];for(let _0x173e81=0x0;_0x173e81<0x10;_0x173e81++){const _0x45b777=this['_createSkeletonLoader']();_0x45b777['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x346a6b['push'](_0x45b777);}return _0xe7fcb8['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x1e79fb=>!_0x1e79fb)]},'children':_0x346a6b}),_0xe7fcb8;}_createResultsBodyView(){const _0x442c7e=new _0x414492(this['locale']);return _0x442c7e['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x3c3f90=>_0x3c3f90)]},'children':this['_resultViews']}),_0x442c7e;}_createErrorView(){const _0x1a4d02=new _0x414492(this['locale']),_0x2890f9=new Mt(this['locale']),t=this['locale']['t'];return _0x1a4d02['delegate']('retryReview')['to'](this),_0x2890f9['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Pn+'\x20ck-ai_review__check-run-error-retry-button'}),_0x2890f9['on']('execute',()=>{this['fire']('retryReview');}),_0x1a4d02['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x30a6ee=>!_0x30a6ee),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x3f346f=>'chunk'===_0x3f346f)]},'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',_0x55bd14=>'chunk'===_0x55bd14||'unsupported-inline'===_0x55bd14)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x49ae67=>'general'!==_0x49ae67)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x220e52=>'chunk'!==_0x220e52)]},'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',_0x462c1a=>'unsupported-inline'!==_0x462c1a)]},'children':[{'text':Es(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')}]}]},_0x2890f9]}),_0x1a4d02;}_createCancelButtonView(){const _0x5f2514=new Mt(this['locale']);return _0x5f2514['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Pn+'\x20ck-ai-button-stop-generating'],'icon':st}),_0x5f2514['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x3a0a53=>_0x3a0a53),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x590b72=>_0x590b72)]}}),_0x5f2514['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x5f2514;}_createToggleDiffButtonView(){const _0x1d39e2=new Mt(this['locale']);_0x1d39e2['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x1d39e2['bind']('isEnabled')['to'](this,'isError',_0x28f43c=>!_0x28f43c),_0x1d39e2['extendTemplate']({'attributes':{'class':[Pn,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x1b0c40=>!_0x1b0c40),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2914b8=>_0x2914b8)]}});const _0xc641d0=Es(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x5adf32=Es(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x1d39e2['bind']('isOn')['to'](this,'isToggleDiffOn',_0x473f88=>_0x473f88),_0x1d39e2['bind']('icon')['to'](this,'isToggleDiffOn',_0x3b9fda=>_0x3b9fda?_0x3dc8cb:_0x41b1f1),_0x1d39e2['bind']('label')['to'](this,'isToggleDiffOn',_0x6506f6=>_0x6506f6?_0xc641d0:_0x5adf32),_0x1d39e2['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x1d39e2;}_createAcceptAllButtonView(){const _0xec4999=new Mt(this['locale']);return _0xec4999['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0xec4999['extendTemplate']({'attributes':{'class':[Ln,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x1c81ce=>!_0x1c81ce),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3e7a3c=>_0x3e7a3c)]}}),_0xec4999['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0xec4999;}_createExitReviewButtonView(){const _0x4387a2=new Mt(this['locale']);return _0x4387a2['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x4387a2['extendTemplate']({'attributes':{'class':[Dn,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x29b201=>!_0x29b201),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x43f452=>_0x43f452)]}}),_0x4387a2['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x4387a2;}_createResultHeaderView(){const _0x5d0edf=new _0x414492(this['locale']),_0x424311=this['_createTitleView']();return _0x5d0edf['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x450761=>_0x450761)]},'children':[_0x424311,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x4fe8f6=>!_0x4fe8f6)],'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']]}]}),_0x5d0edf;}_createTitleView(){const _0x4fc84b=new _0x414492(this['locale']),_0x58c1ea=new Dr();return _0x58c1ea['bind']('isVisible')['to'](this,'isResultReady',_0x57675e=>!_0x57675e),_0x4fc84b['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x50c02d=>_0x50c02d)]},'children':[_0x58c1ea,{'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')}]}]}]}),_0x4fc84b;}_createFinishReviewButtonView(){const _0x281631=new Ch(Es(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x281631['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2062b1=>!_0x2062b1)]}}),_0x281631['delegate']('finishReview')['to'](this),_0x281631;}},bh=class extends jt{_resultsHeader;_finishReviewButtonView;constructor(_0x25af99,_0x445559){super(_0x25af99),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x445559['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x445559['headerText']);const _0x33c993=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x33c993['if']('isVisible','ck-hidden',_0x484347=>!_0x484347)]},'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':_0x445559['emptyResultsText']}]}]}]});}_createFinishReviewButtonView(_0x5c8def){const _0x198875=new Ch(_0x5c8def,this['locale']);return _0x198875['delegate']('finishReview')['to'](this),_0x198875;}_createResultHeaderView(_0x5bf1df){const _0x5327a3=new _0x414492(this['locale']);return _0x5327a3['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x5bf1df},'children':[{'text':_0x5bf1df}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x5327a3;}},Sh=class extends _0x414492{['_dropdownView'];_defaultValue;_defaultLabel;constructor(_0x1c748c,_0x9f7df6){super(_0x1c748c),this['_defaultValue']=_0x9f7df6['default']||(_0x9f7df6['data']['length']>0x0?_0x9f7df6['data'][0x0]['id']:''),this['_defaultLabel']=_0x9f7df6['data']['find'](_0x18739e=>_0x18739e['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x44881d(this['locale']);const _0x4b9ba8=this['_prepareListOptions'](_0x9f7df6['data']);_0xec2131(this['_dropdownView'],_0x4b9ba8,{'role':'menu','ariaLabel':_0x9f7df6['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x346d86=>{_0x346d86['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x2f0509=>{this['formValue']=_0x2f0509['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x2f0509['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(_0x5721ec=[]){const _0x48ce2d=new lt();this['resetToDefault']();for(const _0x250513 of _0x5721ec){const _0x3f0e3f=new _0x557175({'label':_0x250513['label'],'withText':!0x0,'role':'menuitemradio','id':_0x250513['id'],'model':_0x250513});_0x3f0e3f['bind']('isOn')['to'](this,'formValue',_0x22b7fa=>_0x22b7fa===_0x3f0e3f['id']);const _0x4529e3={'type':'button','model':_0x3f0e3f};_0x48ce2d['add'](_0x4529e3);}return _0x48ce2d;}},Rh=class extends jt{_formItem=null;constructor(_0x34341f,_0x407a45,_0x44a962){if(super(_0x34341f),this['argsKey']=_0x407a45?.['argsKey'],'dropdown'===_0x407a45['formType'])this['_formItem']=new Sh(this['locale'],_0x407a45);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x5afd2d=new Wt(this['locale'],{'children':[this['_formItem']],'class':[_0x44a962?'ck-form__row_with-submit':'']});_0x44a962&&_0x5afd2d['children']['add'](_0x44a962),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x5afd2d]});}resetToDefault(){this['_formItem']['resetToDefault']();}},Oh=class AIReviewCorePromptInputView extends _0x34bdb4{keystrokes;static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x4f8bdd){super(_0x4f8bdd),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 _0x414492{['focusTracker']=new _t();keystrokes=new gt();['focusCycler'];['_focusables']=new _0x215355();submitButtonView;cancelButtonView;promptInputView;actionsFooterView;_modelSelector;['_check'];constructor(_0x359fdb,_0x371b66,_0x1356bd=!0x1){super(_0x359fdb),this['_check']=_0x371b66,this['set']('prompt',''),this['set']('modelId',''),this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new Qt(this['locale'],()=>new Oh(_0x359fdb)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelector']=new Io(_0x359fdb,{'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',(_0x204161,_0x1487f9)=>{this['modelId']=_0x1487f9['id'],this['_modelSelector']['setSelectedModel'](_0x1487f9);}),this['_setModelList'](_0x1356bd),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',(_0x2bb07a,_0x55787e)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x55787e()):_0x55787e();}),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'](_0xe2ee6f=>{this['_focusables']['add'](_0xe2ee6f),this['focusTracker']['add'](_0xe2ee6f['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 _0x4fdcc8 of this['_getFormValidators']()){const _0x40b226=_0x4fdcc8();if(_0x40b226)return this['promptInputView']['errorText']=_0x40b226,!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 _0x4fdec7=new Mt(this['locale']),t=this['locale']['t'];return _0x4fdec7['set']({'label':t('Submit'),'withText':!0x0,'class':Ln}),_0x4fdec7['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x4fdec7;}_createCancelButtonView(){const _0x3b85eb=new Mt(this['locale']),t=this['locale']['t'];return _0x3b85eb['set']({'label':t('Cancel'),'withText':!0x0,'class':Dn}),_0x3b85eb['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x29e007=>{_0x29e007['stopPropagation']();})}}),_0x3b85eb['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x3b85eb;}_setModelList(_0x20d4f3){this['_modelSelector']['setModels'](this['_check']['models'],!_0x20d4f3),this['resetToDefault']();}_createActionsFooterView(){const _0x1a25af=new _0x414492(this['locale']);return _0x1a25af['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']]}]}),_0x1a25af;}},kh=class extends jt{_formItemsCollection=new _0x215355();_customCheckView=null;['_hideModels']=!0x1;constructor(_0x67bbdb,_0x26f34c,_0x418c05,_0x34a1fc=!0x1){super(_0x67bbdb),this['_hideModels']=_0x34a1fc,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x26f34c['isParameterized']);const _0x35260e=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',_0x2a9aae=>_0x2a9aae),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0xc89175=>_0xc89175)],'style':{'--ck-ai-review-check-list-item-index':_0x418c05}},'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':_0x26f34c['title']}]},_0x35260e]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x26f34c['description']?[{'text':_0x26f34c['description']}]:[]}]}]},..._0x26f34c['isParameterized']?[this['_createParameterizedView'](_0x26f34c)]:[],...'custom'===_0x26f34c['id']?[this['_createCustomView'](_0x26f34c,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x26f34c['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x26f34c['id'],'args':_0x26f34c['useArgs']?_0x26f34c['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0x4b6d2c({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}resetToDefault(){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x23c7f8=>{_0x23c7f8['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}_createIconView(){const _0x3a3605=new $t();return _0x3a3605['content']=_0x3601b4,_0x3a3605['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x3a3605;}_createParameterizedView(_0x47efb2){const _0x45813b=new _0x414492(),_0x115e97=this['_createFormView'](_0x47efb2);return _0x45813b['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x3de5fd=>!_0x3de5fd)]},'children':[_0x115e97]}),_0x45813b;}_createFormView(_0x5c63ad){const _0x4ed777=new _0x414492(),_0x243dd3=Array['isArray'](_0x5c63ad['options'])?_0x5c63ad['options']:[],_0x2c5a80=new Mt(this['locale']),t=this['locale']['t'];_0x2c5a80['set']({'label':t('Submit'),'withText':!0x0,'class':Ln}),_0x2c5a80['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x2fb914=>{_0x2fb914['stopPropagation']();})}}),_0x2c5a80['on']('execute',()=>{const _0x16c1f9=[],_0xb20c3a={};this['_formItemsCollection']['forEach'](_0x1ffab3=>{_0x16c1f9['push'](_0x1ffab3['value']),_0x5c63ad['useArgs']&&_0x5c63ad['options']&&(_0xb20c3a[_0x1ffab3['argsKey']]=_0x1ffab3['value']);}),this['fire']('runReviewCheck',{'id':_0x5c63ad['id'],'params':_0x16c1f9['length']?_0x16c1f9:void 0x0,'args':Object['keys'](_0xb20c3a)['length']?_0xb20c3a:void 0x0});});const _0x2ab790=_0x243dd3['length'];return _0x243dd3['forEach']((_0x38fa4f,_0x46466c)=>{const _0x498580=_0x46466c===_0x2ab790-0x1;this['_formItemsCollection']['add'](new Rh(this['locale'],_0x38fa4f,_0x498580?_0x2c5a80:null));}),_0x4ed777['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x4ed777;}_createCustomView(_0x4ce0ac,_0x2e117e=!0x1){return this['_customCheckView']=new vh(this['locale'],_0x4ce0ac,_0x2e117e),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',_0x17e90a=>!_0x17e90a)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x176187,_0x278694,_0x2411c8)=>{_0x2411c8||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},yh=class extends jt{['_checkViews'];constructor(_0x327bec){super(_0x327bec),this['_checkViews']=new _0x215355(),this['_setupTemplate']();}setChecks(_0x2e8ed2,_0x160d3a=!0x1){this['_checkViews']['clear']();for(const [_0x41ddeb,_0x231430]of _0x2e8ed2['entries']()){const _0x4eba5f=new kh(this['locale'],_0x231430,_0x41ddeb,_0x160d3a);_0x4eba5f['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x4eba5f);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}resetAllParameterizedChecks(){for(const _0x5539eb of this['_checkViews'])_0x5539eb instanceof kh&&_0x5539eb['resetToDefault']();}_setupTemplate(){const _0x3ea913=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x3ea913['if']('isVisible','ck-hidden',_0xe6aa15=>!_0xe6aa15)]},'children':this['_checkViews']});}},Nh=class extends mh{static get['pluginName'](){return'AIReviewModeUI';}createMainView(){const _0x4734bf=this['context']['plugins']['get']('AITabs'),_0x46240e=this['context']['locale'],_0x4d9974=new ua(_0x46240e,{'label':Es(_0x46240e,'AI_REVIEW_MODE'),'icon':_0x13ea44,'class':'ck-ai-header_review','showResizeButton':_0x4734bf['showResizeButton']});return _0x4d9974['delegate']('resizeTabs')['to'](_0x4734bf),_0x4d9974['bind']('isMaximized')['to'](_0x4734bf['view'],'isMaximized',_0x192d93=>_0x192d93),new wh(this['context']['locale'],{'header':_0x4d9974,'list':new yh(_0x46240e),'results':new fh(_0x46240e,{'generalErrorText':Es(_0x46240e,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new bh(_0x46240e,{'headerText':Es(_0x46240e,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Es(_0x46240e,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Es(_0x46240e,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}registerTab(){const _0x332e70=this['context']['plugins']['get']('AITabs');_0x332e70['view']['on']('activateTab',(_0x434adf,{newTab:_0x5871a4,oldTab:_0x4ae9b7})=>{'reviewMode'===_0x5871a4?this['fire']('getReviewCheckList'):'reviewMode'===_0x4ae9b7&&this['fire']('leaveReview');}),_0x332e70['view']['addTab']({'id':'reviewMode','buttonLabel':Es(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x13ea44,'order':0x0,'content':this['_mainView']});}},xh=class extends Sn{_affectedBlocks=[];get affectedBlocks(){return this['_affectedBlocks']['slice']();}set affectedBlocks(_0x3ea823){this['_affectedBlocks']=_0x3ea823;}};const Lh='review-',Ph=['softBreak'],Dh=['htmlScript','htmlStyle','htmlCustomElement'];var Hh=class extends _0x77cfae{static get requires(){return[_0x1ba3e1,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(_0x3669c0){super(_0x3669c0),this['_domEmitter']=new(ut())(),this['_eventEmitter']=new(dt())();}get emitter(){return this['_eventEmitter'];}afterInit(){const _0x1a2724=_0x22c87f=>this['_scheduleAttachReviewEditingToEditor'](_0x22c87f);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x5849ed)return void _0x1a2724(this['context']);const _0x28a31a=this['context'];for(const _0x8fd646 of _0x28a31a['editors'])_0x1a2724(_0x8fd646);this['listenTo'](_0x28a31a['editors'],'add',(_0x234ffb,_0x2bcbc8)=>{_0x1a2724(_0x2bcbc8);}),this['listenTo'](_0x28a31a['editors'],'remove',(_0x2df034,_0x899573)=>{for(const [_0x3d6a07,_0xa275ed]of this['_markers'])_0xa275ed['editor']===_0x899573&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x3d6a07,'changeId':_0xa275ed['groupId']}),this['_markers']['delete'](_0x3d6a07));});}_scheduleAttachReviewEditingToEditor(_0x2f1a39){const _0x336198=()=>{'destroyed'!==_0x2f1a39['state']&&_0x2f1a39['conversion']&&this['_attachReviewEditingToEditor'](_0x2f1a39);};if('ready'===_0x2f1a39['state'])return void _0x336198();const _0xe2b8e3=()=>{this['stopListening'](_0x2f1a39,'ready',_0xe2b8e3),_0x336198();};this['listenTo'](_0x2f1a39,'ready',_0xe2b8e3);}_attachReviewEditingToEditor(_0x2c1a33){this['_reviewEditingAttachedEditors']['has'](_0x2c1a33)||(_0x2c1a33['conversion']['for']('editingDowncast')['markerToElement']({'model':Lh+'insert','view':(_0x5dc8cf,{writer:_0x53d72f})=>{const _0x139653=this['_markers']['get'](_0x5dc8cf['markerName']),_0x266f83={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x139653?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x5dc8cf['markerName']};return _0x53d72f['createUIElement']('span',_0x266f83,function(_0x97f1c2){const _0x21b812=this['toDomElement'](_0x97f1c2);return _0x21b812['innerHTML']=_0x139653?.['content']?.['asString']||'',_0x21b812;});}}),_0x2c1a33['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-only','view':_0x1d523a=>{const _0x2b86c4=this['_markers']['get'](_0x1d523a['markerName']),_0x47fb0e=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x2b86c4?.['id']||'')&&_0x47fb0e['push']('ck-ai_review__change_active'),{'classes':_0x47fb0e,'attributes':{'data-marker-id':_0x1d523a['markerName']}};}}),_0x2c1a33['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-context','view':_0xc85ffd=>{const _0x1fa6ce=this['_markers']['get'](_0xc85ffd['markerName']),_0x1fc716=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x1fa6ce?.['id']||'')&&_0x1fc716['push']('ck-ai_review__change_active'),{'classes':_0x1fc716,'attributes':{'data-marker-id':_0xc85ffd['markerName']}};}}),_0x2c1a33['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-text','view':_0x2fb92d=>{const _0x43de64=this['_markers']['get'](_0x2fb92d['markerName']),_0x22d06c=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x43de64?.['id']||'')&&_0x22d06c['push']('ck-ai_review__change_active'),{'classes':_0x22d06c,'attributes':{'data-marker-id':_0x2fb92d['markerName']}};}}),_0x2c1a33['conversion']['for']('dataDowncast')['markerToElement']({'model':Lh+'suggestion-context','view':(_0x57b1df,{writer:_0x1caac9})=>_0x1caac9['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x57b1df['isOpening']?'start':'end')})}),_0x2c1a33['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x27a049,'view':_0x440ccf}),this['_updateMouseMarkerInteractionListeners'](_0x2c1a33),this['listenTo'](_0x2c1a33,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x2c1a33),{'priority':'lowest'}),this['listenTo'](_0x2c1a33,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x2c1a33),{'priority':'lowest'}),_0x2c1a33['model']['document']['registerPostFixer'](_0x117f35=>this['_validateMarkers'](_0x2c1a33,_0x117f35)),_0x2c1a33['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x2c1a33)),this['_reviewEditingAttachedEditors']['add'](_0x2c1a33));}_updateMouseMarkerInteractionListeners(_0xe0cb73){let _0x51d42c=this['_boundEditables']['get'](_0xe0cb73);_0x51d42c||(_0x51d42c=new Map(),this['_boundEditables']['set'](_0xe0cb73,_0x51d42c));const _0x352089=new Set(_0xe0cb73['ui']['getEditableElementsNames']());for(const _0x4255e6 of _0x352089){if(_0x51d42c['has'](_0x4255e6))continue;const _0x244112=_0xe0cb73['ui']['getEditableElement'](_0x4255e6);_0x51d42c['set'](_0x4255e6,_0x244112),this['_attachMouseMarkerInteractionListeners'](_0x244112);}for(const [_0x2afee4,_0x3b224e]of _0x51d42c)_0x352089['has'](_0x2afee4)||(_0x51d42c['delete'](_0x2afee4),this['_domEmitter']['stopListening'](_0x3b224e));}_attachMouseMarkerInteractionListeners(_0xd19ca0){this['_domEmitter']['listenTo'](_0xd19ca0,'mouseup',(_0x5d896f,_0x4b928f)=>{const _0x4b2b69=_0x4b928f['target'],_0x2266da=this['_findMarkerElement'](_0x4b2b69);if(!_0x2266da)return;const _0x1f21c2=_0x2266da['getAttribute']('data-marker-id'),_0x3df26b=_0x1f21c2['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x1f21c2,'changeId':_0x3df26b,'markerElement':()=>this['_findMarkerElementById'](_0x1f21c2),'domEvent':_0x4b928f});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0xd19ca0,'mouseover',(_0xf7331d,_0x215706)=>{const _0x347c95=_0x215706['target'],_0x21281a=_0x215706['relatedTarget'];let _0x2248b2=this['_findMarkerElement'](_0x347c95);if(!_0x2248b2&&_0x21281a&&(_0x2248b2=this['_findMarkerElement'](_0x21281a)),!_0x2248b2)return;const _0x439f00=_0x2248b2['getAttribute']('data-marker-id'),_0x16bd62=_0x439f00['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x16bd62,'markerElement':()=>this['_findMarkerElementById'](_0x439f00),'domEvent':_0x215706});});}_registerGlobalBalloonBlurHandler(){this['_domEmitter']['listenTo'](document,'mouseover',_0x1bbda5((_0x41fca0,_0x57f607)=>{const _0x23164b=_0x57f607['target'];this['_findMarkerElement'](_0x23164b)||_0x23164b['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}getDocumentData(_0x5be965){const _0x27b94c=this['context']['plugins']['get']('AIEditing'),_0x24f101=bs(this['context']);if(!_0x24f101['length'])throw new ct('ai-get-editor-from-context-no-editor',this);const _0x567162=_0x5be965?.['roots'];if(_0x567162&&0x0===_0x567162['length'])throw new ct('ai-reviewcoreediting-empty-roots',this);const _0x22628f=_0x567162?new Set(_0x567162['map'](_0x5a0d35=>_0x5a0d35['channelId']+'\x00'+_0x5a0d35['rootName'])):null,_0x3ffb6a=_0x22628f?new Set():null,_0x5344e9=new Set(),_0x273213=[],_0x122b0c=new Map(),_0x2ef54d=[];for(const _0x560c05 of _0x24f101){const _0x176bc8=_0x560c05['config']['get']('collaboration.channelId');for(const _0x2a2d4b of _0x560c05['model']['document']['getRoots']()){const _0x53c89f=_0x176bc8+'\x00'+_0x2a2d4b['rootName'];if(_0x22628f&&!_0x22628f['has'](_0x53c89f))continue;const _0x2f594b=this['_buildDocumentDataSliceForRoot'](_0x560c05,_0x2a2d4b,_0x27b94c,_0x5344e9);_0x273213['push'](_0x2f594b['content']);for(const [_0x1a3977,_0x475bb9]of _0x2f594b['elements'])_0x122b0c['set'](_0x1a3977,_0x475bb9);_0x2ef54d['push']({'channelId':_0x176bc8,'rootName':_0x2a2d4b['rootName']}),_0x3ffb6a?.['add'](_0x53c89f);}}if(_0x567162&&_0x3ffb6a['size']!==_0x22628f['size']){const _0x58a181=_0x567162['find'](_0x83022b=>!_0x3ffb6a['has'](_0x83022b['channelId']+'\x00'+_0x83022b['rootName']));throw new ct('ai-reviewcoreediting-root-not-found',this,{'channelId':_0x58a181['channelId'],'rootName':_0x58a181['rootName']});}return{'elements':_0x122b0c,'content':_0x273213['join'](''),'roots':_0x2ef54d};}async['runCheck'](_0x4c9206,_0x2ca01e){const _0x3a355d=new On(),_0x1c9caf=_0x2ca01e?.['signal'];let _0x2d81c7;const _0x1c316f=()=>{_0x3a355d['abort'](),_0x4c9206['abort']();};if(_0x1c9caf){if(_0x1c9caf['aborted'])return _0x1c316f(),_0x3a355d;_0x1c9caf['addEventListener']('abort',_0x1c316f),_0x2d81c7=()=>_0x1c9caf['removeEventListener']('abort',_0x1c316f);}const _0x3bacf2={'apiId':_0x4c9206['sourceCheck']['apiId']};try{_0x4c9206['on']('reviewCheckRunUpdated',(_0x3e9706,_0x475f78)=>{'aborted'===_0x475f78['status']?_0x3a355d['abort']():'error-general'!==_0x475f78['status']&&'error-chunk'!==_0x475f78['status']||(_0x3a355d['error']=bn(_0x475f78['error'],'ai-reviewcoreediting-check-run-failed',this,_0x3bacf2));}),'aborted'!==_0x3a355d['status']&&await _0x4c9206['start']();}catch(_0x1bf002){_0x3a355d['error']=bn(_0x1bf002,'ai-reviewcoreediting-check-run-failed',this,_0x3bacf2);}finally{_0x2d81c7&&_0x2d81c7();}return'error'===_0x3a355d['status']||'aborted'===_0x3a355d['status']||(_0x3a355d['addResult'](...this['_buildPerRootResults'](_0x4c9206)),_0x3a355d['status']='completed'),_0x3a355d;}buildErrorContext(_0x4ea18c){return{'apiId':_0x4ea18c['sourceCheck']['apiId']};}_buildPerRootResults(_0x3078bb){const _0x4a491b=this['buildErrorContext'](_0x3078bb),_0x30c5b6=this['context']['plugins']['get']('AIEditing'),_0x3914b4=this['context']['plugins']['get']('AIGateway'),_0x485209=this['_groupElementsByRoot'](_0x3078bb['documentData']['elements']),_0xb51137=new Map();for(const _0x1c429b of bs(this['context']))_0xb51137['set'](_0x1c429b['config']['get']('collaboration.channelId'),_0x1c429b);return _0x3078bb['documentData']['roots']['map'](({channelId:_0xc2b51d,rootName:_0x1653db})=>{const _0x2c0e4e=_0xb51137['get'](_0xc2b51d),_0x517093=new xh({'editor':_0x2c0e4e,'rootName':_0x1653db,'channelId':_0xc2b51d,'sessionId':_0x30c5b6['getSessionId'](_0x2c0e4e)}),_0x27b4e0=_0x485209['get'](_0x517093['editor'])?.['get'](_0x517093['rootName'])??[];_0x517093['contentRawOld']=_0x27b4e0['map'](_0x192182=>_0x192182['getContent']())['join'](''),_0x517093['documentVersion']=_0x27b4e0[0x0]?.['documentVersion']??0x1;const _0x3a03c3=this['_collectResultAffectedBlocks'](_0x517093,_0x3078bb['results'],_0x3078bb['documentData']['elements']);_0x517093['affectedBlocks']=_0x3a03c3;try{_0x517093['contentRawNew']=Os(_0x3914b4['mergeChangesIntoContent'](_0x3a03c3,_0x517093['contentRawOld'],_0x517093['editor']));}catch(_0x2f61b3){_0x517093['error']=bn(_0x2f61b3,'ai-reviewcoreediting-check-run-failed',this,_0x4a491b);}return _0x517093;});}_collectResultAffectedBlocks(_0x56490f,_0x38fe30,_0x2e2416){return _0x38fe30['filter'](_0x453d26=>{const _0x7ef053=_0x2e2416['get'](_0x453d26['id']);return!!_0x7ef053&&_0x7ef053['editor']===_0x56490f['editor']&&_0x7ef053['rootName']===_0x56490f['rootName'];})['map'](_0x551368=>({'id':_0x551368['id'],'content':_0x551368['contentNew']}));}_groupElementsByRoot(_0x4c7d1a){const _0x2c1a27=new Map();for(const _0x1bb1b4 of _0x4c7d1a['values']()){let _0x43e677=_0x2c1a27['get'](_0x1bb1b4['editor']);_0x43e677||(_0x43e677=new Map(),_0x2c1a27['set'](_0x1bb1b4['editor'],_0x43e677));let _0x5eaa9e=_0x43e677['get'](_0x1bb1b4['rootName']);_0x5eaa9e||(_0x5eaa9e=[],_0x43e677['set'](_0x1bb1b4['rootName'],_0x5eaa9e)),_0x5eaa9e['push'](_0x1bb1b4);}return _0x2c1a27;}_buildDocumentDataSliceForRoot(_0x1a34bb,_0x28c783,_0x3734ae,_0x459886){const _0x2e360f=_0x1a34bb['model'],_0x2a3d01=new _0xe9fd4c();for(const _0x1f6159 of _0x28c783['getChildren']())_0x2a3d01['_appendChild'](_0x1f6159['_clone'](!0x0));for(const _0x43599c of _0x2e360f['markers']){const _0x187c78=_0x43599c['getRange']();_0x187c78&&_0x187c78['root']['rootName']===_0x28c783['rootName']&&_0x2a3d01['markers']['set'](_0x43599c['name'],this['_changeRangeOwnerDocument'](_0x187c78['clone'](),_0x2a3d01));}const _0x232732=new Map(),_0x1f6d52=_0x2e360f['document']['version'];if(Gs(_0x1a34bb,_0x28c783['rootName'])){let _0x54bd28=this['_inlineRootDataIds']['get'](_0x28c783);_0x54bd28?_0x459886['add'](_0x54bd28):(_0x54bd28=_0x3734ae['_nextDataId'](_0x459886),this['_inlineRootDataIds']['set'](_0x28c783,_0x54bd28));const _0x174bf9=Fs(_0x1a34bb['data']['processor']['toData'](_0x1a34bb['data']['toView'](_0x2a3d01)),_0x54bd28);return _0x232732['set'](_0x54bd28,{'editor':_0x1a34bb,'rootName':_0x28c783['rootName'],'path':[],'documentVersion':_0x1f6d52,'getContent':()=>_0x174bf9}),{'content':_0x174bf9,'elements':_0x232732};}const _0x21910d=new _0x170ca4({'ignoreElementEnd':!0x0,'startPosition':_0x2e360f['createPositionAt'](_0x2a3d01,0x0)});for(const {item:_0x2a8257}of _0x21910d){if(_0x2a8257['is']('element')&&_0x2a8257['name']&&Dh['includes'](_0x2a8257['name'])){const _0x2b9ebc=this['_upsertDataId'](_0x2a8257,()=>_0x3734ae['_nextDataId'](_0x459886));_0x459886['add'](_0x2b9ebc);}if(!_0x2a8257['is']('$textProxy'))continue;const _0x5f4202=_0x2a8257['parent'];if(!_0x5f4202||!_0x5f4202['is']('element'))continue;const _0x25fdc1=this['_upsertDataId'](_0x5f4202,()=>_0x3734ae['_nextDataId'](_0x459886));_0x459886['add'](_0x25fdc1);for(const _0x5d2939 of _0x5f4202['getChildren']())_0x5d2939['is']('element')&&(_0x5d2939['name']&&Ph['includes'](_0x5d2939['name'])||_0x459886['add'](this['_upsertDataId'](_0x5d2939,()=>_0x3734ae['_nextDataId'](_0x459886))));let _0x2d5fb6=_0x5f4202;for(;_0x2d5fb6['parent']&&!_0x2d5fb6['parent']['is']('documentFragment');)_0x2d5fb6=_0x2d5fb6['parent'],_0x2d5fb6['hasAttribute'](_0x27a049)&&_0x2d5fb6['_removeAttribute'](_0x27a049);_0x232732['set'](_0x25fdc1,{'editor':_0x1a34bb,'rootName':_0x28c783['rootName'],'path':_0x5f4202['getPath'](),'documentVersion':_0x1f6d52,'getContent':this['_createGetContentUsingDataIdFn'](_0x2d5fb6['_clone'](!0x0),_0x25fdc1,_0x1a34bb['data'])}),_0x21910d['jumpTo'](_0x2e360f['createPositionAfter'](_0x5f4202));}return{'content':_0x1a34bb['data']['processor']['toData'](_0x1a34bb['data']['toView'](_0x2a3d01)),'elements':_0x232732};}diffContent(_0x4e02a0,_0x4aa317,_0x3fd213,_0x483874=!0x1){const {contentInitial:_0x8df1d4,contentNew:_0x56d28c}=this['_neutralizeChangesOnUnsupportedElements'](_0x4aa317,_0x3fd213),_0x266d9b=[],_0x419548=_0x4e02a0['data']['parse'](_0x56d28c,'$documentFragment'),_0x719ebe=_0x4e02a0['data']['parse'](_0x8df1d4,'$documentFragment'),_0x702bd6=_0x4e02a0['model']['createPositionAt'](_0x719ebe,0x0);if(this['_haveSingleTopLevelElement'](_0x419548)){if(!this['_hasSameTopLevelElement'](_0x719ebe,_0x419548))return _0x266d9b;}else{const _0x5a8566=_0x4e02a0['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x719ebe,_0x5a8566)||!this['_haveOnlyInlineContent'](_0x419548,_0x5a8566))return _0x266d9b;}const _0x4a61c8=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x8df1d4,_0x56d28c,{'targetEditor':_0x4e02a0,'anchor':_0x702bd6,'markDeletions':!0x0})['getOperations']()['filter'](_0x435db7=>'insert'===_0x435db7['type']||'marker'===_0x435db7['type']&&_0x435db7['name']['startsWith']('$markedRemove')),_0x30f307=this['_groupAdjacentOperations'](_0x4a61c8),_0x44c0b3=[];if(_0x483874){if(_0x30f307['length']){const _0x4bb774=_0x30f307[0x0]['operations'][0x0],_0x65c812='insert'===_0x4bb774['type']?_0x4bb774['position']:_0x4bb774['newRange']['start'],_0x1afcc3=this['_getPositionLimitingRange'](_0x65c812,_0x4e02a0,'inside'),_0x3afe36=_0x1afcc3?_0x419548['getChild'](0x0)['getChildren']():_0x419548['getChildren'](),_0x1279da=_0x1afcc3||_0x4e02a0['model']['createRangeIn'](_0x719ebe),_0x6430c3=[new _0x571150('$markedRemove:synthetic'+kt(),null,_0x1279da,_0x4e02a0['model']['document']['model']['markers'],!0x0,_0x4e02a0['model']['document']['version']+0x1),new _0x3690bf(_0x1279da['end'],_0x3afe36,_0x4e02a0['model']['document']['version']+0x2)];_0x44c0b3['push']({'operations':_0x6430c3,'operationsIsolated':_0x6430c3,'groupOffset':0x0});}}else _0x44c0b3['push'](..._0x30f307);let _0x144cc0=0x0;return _0x4e02a0['model']['change'](_0x1e197d=>{for(let _0xf5294c=0x0;_0xf5294c<_0x44c0b3['length'];_0xf5294c++){const _0x3e5ebd=_0x44c0b3[_0xf5294c],_0x102037=_0x1e197d['createDocumentFragment']();for(const _0x14bce2 of _0x719ebe['getChildren']())_0x1e197d['append'](_0x14bce2['_clone'](!0x0),_0x102037);for(const _0x171f55 of _0x3e5ebd['operationsIsolated'])if('insert'===_0x171f55['type']){const _0x5d9266=_0x171f55;_0x5d9266['baseVersion']=null,_0x5d9266['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x5d9266,_0x102037),_0x1e197d['batch']['addOperation'](_0x171f55),_0x4e02a0['model']['applyOperation'](_0x171f55);const _0x588216='suggestion:insertion:id:authorId:'+_0x144cc0++,_0x1089d3=_0x4e02a0['model']['createRange'](_0x5d9266['position'],_0x5d9266['position']['getShiftedBy'](_0x5d9266['howMany']));_0x102037['markers']['set'](_0x588216,_0x1089d3);}else{if('marker'===_0x171f55['type']&&_0x171f55['name']['startsWith']('$markedRemove')){const _0x4dd759=_0x171f55,_0x5b257d='suggestion:deletion:id:authorId:'+_0x144cc0++;this['_changeOperationOwnerDocument'](_0x4dd759,_0x102037),_0x102037['markers']['set'](_0x5b257d,_0x4dd759['newRange']);}}if(_0x483874)_0x266d9b['push']({..._0x3e5ebd,'context':this['_createGetContentFn'](_0x719ebe,_0x4e02a0['data']),'content':this['_createGetContentFn'](_0x719ebe,_0x4e02a0['data'])});else{const _0x518841=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x3e5ebd['operationsIsolated'][0x0]),_0x102037),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x3e5ebd['operationsIsolated'][_0x3e5ebd['operationsIsolated']['length']-0x1]),_0x102037),_0x4e02a0);_0x102037['markers']['set'](Lh+'suggestion-context',new _0x5b86ed(_0x518841['start'],_0x518841['end'])),_0x266d9b['push']({..._0x3e5ebd,'context':this['_createGetContextFn'](_0x102037,_0x4e02a0['data'],{'ellipsisBefore':_0x518841['hasContentBefore'],'ellipsisAfter':_0x518841['hasContentAfter']}),'content':this['_createGetContentFn'](_0x102037,_0x4e02a0['data'])});}}}),_0x266d9b;}markChangePositionInEditorContent(_0x4c793c,_0x5023cd){if(!_0x4c793c['length'])return;const _0x2ded1e=_0x4c793c[0x0]['parent']['id'],_0x33bd79=_0x5023cd['elements']['get'](_0x2ded1e);if(!_0x33bd79)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x2ded1e);const _0x32ac69=_0x33bd79['path'],_0x10edf2=_0x33bd79['editor'],_0x3a703e=_0x10edf2['model']['document']['getRoot'](_0x33bd79['rootName']);if(!_0x3a703e)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x33bd79['rootName']);const _0x5bdc7a=_0x10edf2['model']['document']['history']['getOperations'](_0x33bd79['documentVersion']),_0x4bc1d3=[];for(const _0x48c7b7 of _0x4c793c){const _0x55b3f7=_0x48c7b7['operationsIsolated']['map'](_0x2ab26b=>this['_translateOperationToEditorContent'](_0x2ab26b,_0x32ac69,_0x3a703e));if(!_0x55b3f7||!_0x55b3f7['length'])continue;const _0xa027ca=_0x55b3f7['every'](_0x59bdf2=>'marker'===_0x59bdf2['type']&&_0x59bdf2['name']['startsWith']('$markedRemove')),_0x35ad10=_0x318423(_0x55b3f7,_0x5bdc7a,{'document':_0x10edf2['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0x5af550 of _0x35ad10)if('insert'===_0x5af550['type']){const _0x238452=_0x5af550,_0x1682b7=_0x238452['nodes'];_0x10edf2['model']['change'](_0xfce0c5=>{const _0x4907bb=_0xfce0c5['createDocumentFragment']();for(const _0x223bb9 of _0x1682b7)_0xfce0c5['append'](_0x223bb9['_clone'](!0x0),_0x4907bb);_0x4bc1d3['push']({'start':_0x238452['position'],'end':_0x238452['position'],'type':'insert','groupId':_0x48c7b7['id'],'content':{'asString':this['_createGetContentFn'](_0x4907bb,_0x10edf2['data'])(),'asFragment':_0x4907bb}});});}else{if('marker'===_0x5af550['type']&&_0x5af550['name']['startsWith']('$markedRemove')){const _0xf56b96=_0x5af550;let _0x123cb7='remove-text';if(_0xa027ca){const _0x12688a=this['_findAdjacentContextDistance'](_0xf56b96['newRange']['start'],'backward',_0x10edf2['model']['schema']),_0x3ff6f8=this['_findAdjacentContextDistance'](_0xf56b96['newRange']['end'],'forward',_0x10edf2['model']['schema']);if(_0x12688a||_0x3ff6f8){const _0x3a34bc=_0xf56b96['newRange']['start']['getShiftedBy'](-_0x12688a),_0x4eb167=_0xf56b96['newRange']['end']['getShiftedBy'](_0x3ff6f8);_0x4bc1d3['push']({'start':_0x3a34bc,'end':_0x4eb167,'groupId':_0x48c7b7['id'],'type':'remove-context'});}else _0x123cb7='remove-only';}_0x4bc1d3['push']({'start':_0xf56b96['newRange']['start'],'end':_0xf56b96['newRange']['end'],'groupId':_0x48c7b7['id'],'type':_0x123cb7});}}}this['_insertMarkers'](_0x4bc1d3,_0x10edf2);}['clearAllMarkers'](){const _0x2eb6c9=new Map();for(const _0x3c9712 of this['_markers']['keys']()){const _0x403412=this['_markers']['get'](_0x3c9712);_0x403412?.['editor']&&(_0x2eb6c9['has'](_0x403412['editor'])||_0x2eb6c9['set'](_0x403412['editor'],[]),_0x2eb6c9['get'](_0x403412['editor'])['push'](_0x3c9712));}for(const [_0x52d4bc,_0x183209]of _0x2eb6c9)_0x52d4bc['model']['change'](_0x44a5a2=>{for(const _0x461256 of _0x183209)_0x52d4bc['model']['markers']['get'](_0x461256)&&_0x44a5a2['removeMarker'](_0x461256);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}switchToReadOnly(){for(const _0x3d03c1 of this['getEditors']())_0x3d03c1['enableReadOnlyMode']('ai-review');}switchToEdit(){for(const _0x96ee3c of this['getEditors']())_0x96ee3c['disableReadOnlyMode']('ai-review');}['applyChange'](_0x5d9f39,_0xd8dac0=null){const _0x180a42=_0x5d9f39['map'](_0x5b2374=>this['_getMarkersDataForGroup'](_0x5b2374))['flat'](),_0x1116b8=new Map();for(const _0xa0815c of _0x180a42)_0x1116b8['has'](_0xa0815c['editor'])||_0x1116b8['set'](_0xa0815c['editor'],[]),_0x1116b8['get'](_0xa0815c['editor'])['push'](_0xa0815c);for(const [_0x1680dc,_0x287cc1]of _0x1116b8){const _0x1e3879=_0x1680dc['model'],_0x35582f=_0x1680dc['plugins']['has']('TrackChangesEditing')?_0x1680dc['plugins']['get']('TrackChangesEditing'):null,_0x5ae513=_0xd8dac0&&_0x35582f?new Set(_0x35582f['getSuggestions']()['map'](_0x41b1d8=>_0x41b1d8['id'])):null;_0x1e3879['change'](_0x47a5d5=>{const _0x28bb5f=_0x47a5d5['batch']['operations']['length'];for(const _0x1f62bd of _0x287cc1){const _0x36032c=_0x1680dc['model']['markers']['get'](_0x1f62bd['id']);if(_0x36032c){if('insert'===_0x1f62bd['type']){if(!_0x1f62bd['content'])continue;_0x1e3879['insertContent'](_0x1f62bd['content']['asFragment']||null,_0x36032c['getRange']()['start']);}else'remove-text'!==_0x1f62bd['type']&&'remove-only'!==_0x1f62bd['type']||_0x1e3879['deleteContent'](_0x1e3879['createSelection'](_0x36032c['getRange']()));_0x47a5d5['removeMarker'](_0x1f62bd['id']),this['_markers']['delete'](_0x1f62bd['id']);}}if(_0xd8dac0&&(mn(_0x47a5d5['batch']['operations']['slice'](_0x28bb5f),_0xd8dac0),_0x35582f)){for(const _0x52d512 of _0x35582f['getSuggestions']())_0x5ae513['has'](_0x52d512['id'])||_0x52d512['setAttribute']('@ai',{'type':_0xd8dac0});}});}}rejectChange(_0x3971a7){const _0x13904c=this['_getMarkersDataForGroup'](_0x3971a7),_0x348e9c=new Map();for(const _0x5f5013 of _0x13904c)_0x348e9c['has'](_0x5f5013['editor'])||_0x348e9c['set'](_0x5f5013['editor'],[]),_0x348e9c['get'](_0x5f5013['editor'])['push'](_0x5f5013);for(const [_0xe413f8,_0x403ffd]of _0x348e9c)_0xe413f8['model']['change'](_0x30e3f0=>{for(const _0x1ac4bc of _0x403ffd)_0x30e3f0['removeMarker'](_0x1ac4bc['id']),this['_markers']['delete'](_0x1ac4bc['id']);});}getEditor(){return Ss(this['context']);}getEditors(){return bs(this['context']);}getEditorForChange(_0x1a86bf){return this['_getMarkersDataForGroup'](_0x1a86bf)[0x0]?.['editor'];}getMarkerElementForChange(_0x2dd023){const _0x21a0a6=Array['from'](this['_markers']['values']())['filter'](_0x459587=>_0x459587['groupId']===_0x2dd023);if(!_0x21a0a6['length'])return null;const _0x52d0ac=0x1===_0x21a0a6['length']?_0x21a0a6[0x0]:this['_sortMarkers'](_0x21a0a6)[0x0],_0x458e5e=_0x52d0ac['editor']['model']['markers']['get'](_0x52d0ac['id']);return _0x458e5e?{'modelRange':_0x458e5e['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x52d0ac['id'])}:null;}getContentElementForChange(_0x90a8cf){const _0x360053=Array['from'](this['_markers']['values']())['filter'](_0x3e9048=>_0x3e9048['groupId']===_0x90a8cf);if(!_0x360053['length'])return null;const _0x4e8370=0x1===_0x360053['length']?_0x360053[0x0]:this['_sortMarkers'](_0x360053)[0x0],_0x34ed44=_0x4e8370['editor'],_0x2423c2=_0x34ed44['model']['markers']['get'](_0x4e8370['id']);if(!_0x2423c2)return null;const _0x49d337=_0x2423c2['getRange'](),_0x1be43a=_0x34ed44['editing']['view']['getDomRoot'](_0x49d337['root']['rootName'])||_0x34ed44['editing']['view']['getDomRoot']();if(!_0x1be43a||!_0x49d337)return null;let _0x1a7bac=_0x49d337['start']['parent'];for(;_0x1a7bac['parent']&&!_0x1a7bac['parent']['is']('rootElement');)_0x1a7bac=_0x1a7bac['parent'];if(!_0x1a7bac||!_0x1a7bac['name'])return null;const _0x10eaf1=_0x1be43a['querySelector']('[data-marker-id=\x22'+_0x4e8370['id']+'\x22]');if(!_0x10eaf1)return null;if(_0x1a7bac['is']('rootElement'))return _0x10eaf1;let _0x350ca0=null;_0x34ed44['model']['change'](_0x39f43b=>{_0x350ca0=_0x39f43b['createDocumentFragment'](),_0x39f43b['append'](_0x1a7bac['_clone'](!0x0),_0x350ca0);});const _0x5605df=_0x34ed44['data']['toView'](_0x350ca0)['getChild'](0x0);return _0x10eaf1['closest'](_0x5605df['name']);}reactivateMarkers(_0x11075d){const _0x3e872f=this['_getMarkersDataForGroup'](_0x11075d);if(!_0x3e872f['length'])return;const _0x4e2279=Array['from'](this['_activeMarkers'])['sort'](),_0x40524f=Array['from'](new Set(_0x3e872f['map'](_0x57fdec=>_0x57fdec['id'])))['sort']();_0x4e2279['join']('|')!==_0x40524f['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x11075d));}setMarkersInElementAsActive(_0x316f8a){const _0x50460f=this['_getMarkersDataForGroup'](_0x316f8a);if(!_0x50460f['length'])return;const _0x241a59=_0x50460f[0x0]['editor'],_0x1bb474=new Set(_0x50460f['map'](_0x480ceb=>_0x480ceb['id'])),_0x599097=Array['from'](_0x1bb474['values']())['map'](_0x46b5a1=>_0x241a59['model']['markers']['get'](_0x46b5a1))['filter'](_0x15eed7=>!!_0x15eed7);_0x1bb474['forEach'](_0x4702bf=>{this['_activeMarkers']['add'](_0x4702bf);}),_0x241a59['model']['change'](()=>{_0x599097['forEach'](_0x361134=>{_0x241a59['editing']['reconvertMarker'](_0x361134);});});}setAllMarkersAsInactive(){const _0x1f168f=Array['from'](this['_activeMarkers']);if(!_0x1f168f['length'])return;this['_activeMarkers']['clear']();const _0x28f1bc=new Map();for(const _0x23c767 of _0x1f168f){const _0x50057d=this['_markers']['get'](_0x23c767);if(!_0x50057d)continue;const _0xeb58e8=_0x50057d['editor'],_0x331f4b=_0xeb58e8['model']['markers']['get'](_0x23c767);_0x331f4b&&(_0x28f1bc['has'](_0xeb58e8)||_0x28f1bc['set'](_0xeb58e8,[]),_0x28f1bc['get'](_0xeb58e8)['push'](_0x331f4b));}for(const [_0x40c661,_0x23f1b2]of _0x28f1bc)_0x40c661['model']['change'](()=>{_0x23f1b2['forEach'](_0x523183=>{_0x40c661['editing']['reconvertMarker'](_0x523183);});});}_getPositionLimitingRange(_0x9df3db,_0x2d6c54,_0x264b44='outside'){if(!_0x9df3db)return null;let _0x2711fd=_0x9df3db['parent'];for(;_0x2711fd&&_0x2711fd['parent']&&!_0x2711fd['parent']['is']('rootElement')&&!_0x2d6c54['model']['schema']['isLimit'](_0x2711fd)&&!_0x2d6c54['model']['schema']['isBlock'](_0x2711fd);)_0x2711fd=_0x2711fd['parent'];if(!_0x2711fd||!_0x2711fd['name']||_0x2711fd['is']('rootElement'))return null;let _0x32ae5f=null;return _0x2d6c54['model']['change'](_0x29b6bd=>{_0x32ae5f='inside'===_0x264b44?_0x29b6bd['createRangeIn'](_0x2711fd):_0x29b6bd['createRangeOn'](_0x2711fd);}),_0x32ae5f;}_validateMarkers(_0x5109c3,_0x2b54e2){const _0x17176f=Array['from'](this['_markers']['keys']()),_0x5587d2=new Map();for(const _0xf5ed54 of _0x17176f){const _0x4ab520=_0x5109c3['model']['markers']['get'](_0xf5ed54);if(!_0x4ab520)continue;const _0x47a649=_0x4ab520['getStart']()['root']['rootName']+':'+_0x4ab520['getStart']()['path'][0x0];_0x5587d2['has'](_0x47a649)||_0x5587d2['set'](_0x47a649,[]),_0x5587d2['get'](_0x47a649)['push'](_0x4ab520);}const _0x18f179=new Set();for(const _0x51b8de of _0x5109c3['model']['document']['differ']['getChanges']()){let _0x4204c8,_0x2a3678;if('insert'===_0x51b8de['type'])_0x2a3678=new _0x5b86ed(_0x51b8de['position'],_0x51b8de['position']['getShiftedBy'](_0x51b8de['length'])),_0x4204c8=_0x51b8de['position']['root']['rootName']+':'+_0x51b8de['position']['path'][0x0];else{if('remove'!==_0x51b8de['type'])continue;_0x2a3678=new _0x5b86ed(_0x51b8de['position']),_0x4204c8=_0x51b8de['position']['root']['rootName']+':'+_0x51b8de['position']['path'][0x0];}const _0x2695cb=_0x5587d2['get'](_0x4204c8)||[];if(_0x2695cb['length']){for(const _0x2a8c41 of _0x2695cb)if(_0x2a3678['root']['rootName']===_0x2a8c41['getRange']()['root']['rootName']&&('insert'!==_0x51b8de['type']||!_0x2a3678['containsRange'](_0x2a8c41['getRange']()))&&(_0x2a3678['isIntersecting'](_0x2a8c41['getRange']())||_0x2a3678['start']['isTouching'](_0x2a8c41['getRange']()['end'])||_0x2a3678['end']['isTouching'](_0x2a8c41['getRange']()['start']))){const _0x2bff47=this['_parseMarkerName'](_0x2a8c41['name']);Array['from'](this['_markers']['values']())['filter'](_0x1acf68=>_0x1acf68['groupId']===_0x2bff47['groupId'])['forEach'](_0x3fd623=>_0x18f179['add'](_0x3fd623['id']));}}}if(_0x18f179['size']){for(const _0x4fed94 of _0x18f179)_0x2b54e2['removeMarker'](_0x4fed94);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x341ca9){for(const {name:_0x4adc35,data:_0x87e854}of _0x341ca9['model']['document']['differ']['getChangedMarkers']()){if(!_0x4adc35['startsWith'](Lh))continue;const _0x5ec201=_0x87e854['oldRange'],_0x454cf6=_0x87e854['newRange'],_0x597c69=_0x5ec201&&'$graveyard'===_0x5ec201['root']['rootName'],_0xb398e9=_0x454cf6&&'$graveyard'===_0x454cf6['root']['rootName'];if(_0x597c69&&_0xb398e9)continue;const _0x182367=this['_parseMarkerName'](_0x4adc35);this['_markers']['get'](_0x4adc35)&&(_0xb398e9||!_0x454cf6?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x4adc35,'changeId':_0x182367['groupId']}):_0x597c69&&_0x454cf6&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x4adc35,'changeId':_0x182367['groupId']}));}}['_parseMarkerName'](_0x5b849d){const _0x4786d9=_0x5b849d['split'](':'),_0x49bb0e=(_0x4786d9[0x1]||'')['split']('_');return{'prefix':_0x4786d9[0x0],'groupId':_0x49bb0e[0x0],'suffix':_0x49bb0e[0x1]};}_translateOperationToEditorContent(_0xe29ee7,_0x309c8d,_0x423d54){if('insert'===_0xe29ee7['type']){const _0x279aaf=_0xe29ee7;return new _0x3690bf(this['_changePosition'](_0x309c8d['concat'](_0x279aaf['position']['offset']),_0x423d54),_0x279aaf['nodes'],_0x279aaf['baseVersion']);}if('marker'===_0xe29ee7['type']&&_0xe29ee7['name']['startsWith']('$markedRemove')){const _0x9ae86e=_0xe29ee7;return new _0x571150(_0x9ae86e['name'],_0x9ae86e['oldRange'],this['_changeRange'](_0x9ae86e['newRange'],_0x309c8d['concat'](_0x9ae86e['newRange']['start']['offset']),_0x309c8d['concat'](_0x9ae86e['newRange']['end']['offset']),_0x423d54),_0x9ae86e['_markers'],_0x9ae86e['affectsData'],_0x9ae86e['baseVersion']);}return _0xe29ee7;}_groupAdjacentOperations(_0x165bb9){if(!_0x165bb9['length'])return[];const _0x48cfbf=[];let _0x9d066a=0x0,_0x2be0fe=0x0,_0x311a06=[];for(let _0x475eda=0x0;_0x475eda<=_0x165bb9['length'];_0x475eda++){const _0x531bf4=_0x165bb9[_0x475eda],_0x3013c0=_0x165bb9[_0x475eda-0x1];!_0x531bf4||_0x3013c0&&!this['_getOperationEnd'](_0x3013c0)['isTouching'](this['_getOperationStart'](_0x531bf4))?(_0x48cfbf['push']({'operations':_0x311a06,'operationsIsolated':_0x311a06['map'](_0x233400=>this['_shiftOperation'](_0x233400['clone'](),-_0x2be0fe)),'groupOffset':_0x9d066a}),_0x311a06=_0x531bf4?[_0x531bf4]:[],_0x2be0fe+=_0x9d066a,_0x9d066a=0x0):_0x311a06['push'](_0x531bf4),_0x531bf4&&'insert'===_0x531bf4['type']&&(_0x9d066a+=_0x531bf4['howMany']);}return _0x48cfbf;}_findAdjacentContextDistance(_0x423c94,_0x41cc60,_0x55985f,_0x4d1f3a=0x1){const _0x96cf7a=new _0x170ca4({'startPosition':_0x423c94,'direction':_0x41cc60});let _0x24ba4b=0x0;for(let _0x43edad=0x0;_0x43edad<_0x4d1f3a;_0x43edad++){let _0x482443=0x0,_0x47d0d4=!0x1,_0x3a9c79='forward'===_0x41cc60?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x13f259}of _0x96cf7a)if(_0x13f259['is']('$textProxy')){const _0x42139d=_0x3a9c79['exec'](_0x13f259['data']);if(_0x42139d&&_0x42139d['length']){if(_0x482443+='forward'===_0x41cc60?_0x42139d['index']+_0x42139d[0x0]['length']:_0x13f259['data']['length']-_0x42139d['index'],_0x42139d[0x0]['length']!==_0x13f259['data']['length'])break;_0x47d0d4=!0x0,_0x3a9c79='forward'===_0x41cc60?/^\w+/:/\w+$/;}else{if(_0x47d0d4)break;_0x482443+=_0x13f259['offsetSize'];}}else{if(_0x13f259['is']('element')){_0x55985f['isInline'](_0x13f259)&&!_0x47d0d4&&(_0x482443+=0x1);break;}}_0x24ba4b+=_0x482443,_0x96cf7a['jumpTo'](_0x423c94['getShiftedBy']('forward'===_0x41cc60?_0x24ba4b:-_0x24ba4b));}return _0x24ba4b;}_getChangeContext(_0x2750a2,_0x4bc602,_0x4eda1b){const _0x37c841=_0x4eda1b['model']['schema'],_0x51ec4e=this['_findAdjacentContextDistance'](_0x2750a2,'backward',_0x37c841,0x6),_0x4abffd=this['_findAdjacentContextDistance'](_0x4bc602,'forward',_0x37c841,0x6),_0x929ee=_0x2750a2['getShiftedBy'](-_0x51ec4e),_0x508d68=_0x4bc602['getShiftedBy'](_0x4abffd);return{'start':_0x929ee,'end':_0x508d68,'hasContentBefore':!_0x929ee['isAtStart'],'hasContentAfter':!_0x508d68['isAtEnd']};}_insertMarkers(_0x5c50ce,_0x10d560){const _0x1b065e=this['context']['plugins']['get']('AIEditing'),_0x3b7e5c=new Set();_0x10d560['model']['change'](_0x4a8f8f=>{for(const _0x5ba48f of _0x5c50ce){const _0x426b06=''+Lh+_0x5ba48f['type']+':'+_0x5ba48f['groupId']+'_'+_0x1b065e['_nextDataId'](_0x3b7e5c);this['_markers']['set'](_0x426b06,{'id':_0x426b06,'groupId':_0x5ba48f['groupId'],'type':_0x5ba48f['type'],'content':_0x5ba48f['content'],'editor':_0x10d560}),_0x4a8f8f['addMarker'](_0x426b06,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x4a8f8f['createRange'](_0x5ba48f['start'],_0x5ba48f['end'])});}});}_createGetContextFn(_0x1b4f26,_0x400803,_0x16aae8){let _0x2e2978='';return()=>{if(!_0x2e2978){const _0xe68548=_0x400803['toView'](_0x1b4f26,{'showSuggestionHighlights':!0x0});let _0x416660=_0xe68548['getChild'](0x0);if(_0x416660['is']('containerElement')||(_0x416660=_0xe68548),!_0x416660)return'';let _0x2a7dbd=!0x1;const _0x2fa7b9=[];for(const _0x5ad88a of _0x416660['getChildren']())_0x5ad88a['is']('element','span')&&_0x5ad88a['hasClass']('ck-ai_review-marker_context-end')&&(_0x2a7dbd=!0x1),_0x2a7dbd&&_0x2fa7b9['push'](_0x5ad88a),_0x5ad88a['is']('element','span')&&_0x5ad88a['hasClass']('ck-ai_review-marker_context-start')&&(_0x2a7dbd=!0x0);_0x416660['_removeChildren'](0x0,_0x416660['childCount']),_0x16aae8?.['ellipsisBefore']&&_0x416660['_appendChild']('…'),_0x416660['_appendChild'](_0x2fa7b9),_0x16aae8?.['ellipsisAfter']&&_0x416660['_appendChild']('…');const _0x25996d=_0x400803['htmlProcessor']['domConverter']['viewToDom'](_0xe68548),_0x9572e1=_0x400803['htmlProcessor']['htmlWriter']['getHtml'](_0x25996d);_0x2e2978=this['_removeUnsupportedElements'](_0x9572e1);}return _0x2e2978;};}_createGetContentFn(_0x1fd92b,_0x2e375d){let _0x5e824a='';return()=>(_0x5e824a||(_0x5e824a=this['_removeUnsupportedElements'](_0x2e375d['stringify'](_0x1fd92b,{'showSuggestionHighlights':!0x0}))),_0x5e824a);}_createGetContentUsingDataIdFn(_0x4c0adc,_0x1dcaca,_0x3a361f){let _0x2d54de='';return()=>{if(!_0x2d54de){const _0x42dc5b=_0x3a361f['toView'](new _0xe9fd4c(_0x4c0adc));_0x2d54de=_0x3a361f['htmlProcessor']['domConverter']['viewToDom'](_0x42dc5b)['querySelector']('[data-id=\x22'+_0x1dcaca+'\x22]')?.['outerHTML']||'';}return _0x2d54de;};}_removeUnsupportedElements(_0x21bc9e){if(!_0x21bc9e)return'';const _0x1c5883=Rs(_0x21bc9e,{'decodeEntities':!0x1}),_0x37f63c=ys(_0x1c5883);if(!_0x37f63c['length'])return _0x21bc9e;for(const _0x405614 of _0x37f63c)_0x5c7bf0(_0x405614);return Os(_0x1c5883,{'encodeEntities':!0x1});}_neutralizeChangesOnUnsupportedElements(_0x2be50c,_0x2385e9){const _0x5d2d81=Rs(_0x2be50c,{'decodeEntities':!0x1}),_0x29319d=Rs(_0x2385e9,{'decodeEntities':!0x1}),_0x3e9544=ys(_0x5d2d81),_0x3b4883=ys(_0x29319d);if(!_0x3e9544['length']&&!_0x3b4883['length'])return{'contentInitial':_0x2be50c,'contentNew':_0x2385e9};const _0x2ac630=new Map(),_0x3df056=new Map();for(const _0x17f6f1 of _0x3e9544){const _0x422a84=Ps(_0x17f6f1,'data-id');if(_0x422a84)_0x2ac630['set'](_0x422a84,_0x17f6f1);else{const _0x1e6045=Os(_0x17f6f1,{'encodeEntities':!0x1}),_0x47f42f=_0x3df056['get'](_0x1e6045);_0x47f42f?_0x47f42f['push'](_0x17f6f1):_0x3df056['set'](_0x1e6045,[_0x17f6f1]);}}for(const _0x227169 of _0x3b4883){const _0x2e00e8=Ps(_0x227169,'data-id');let _0x3998c9;if(_0x2e00e8)_0x3998c9=_0x2ac630['get'](_0x2e00e8);else{const _0x2dafb2=_0x3df056['get'](Os(_0x227169,{'encodeEntities':!0x1}));_0x3998c9=_0x2dafb2&&_0x2dafb2['length']?_0x2dafb2['shift']():void 0x0;}_0x3998c9?_0x2abda5(_0x227169,_0x538a60(_0x3998c9,!0x0)):_0x5c7bf0(_0x227169);}return{'contentInitial':Os(_0x5d2d81,{'encodeEntities':!0x1}),'contentNew':Os(_0x29319d,{'encodeEntities':!0x1})};}_findMarkerElement(_0x3b75d9,_0x31337f=0x5){let _0x5b4946=_0x3b75d9,_0x1d9a6d=null;for(let _0x1a05b5=0x0;_0x1a05b5<_0x31337f&&_0x5b4946;_0x1a05b5++)if(_0x5b4946['className']){if((''+_0x5b4946['className'])['includes']('ck-ai_review-marker_')){if(!_0x5b4946['getAttribute']('data-marker-id'))break;_0x1d9a6d=_0x5b4946;break;}_0x5b4946=_0x5b4946['parentElement'];}else _0x5b4946=_0x5b4946['parentElement'];return _0x1d9a6d;}_findMarkerElementById(_0x3d1cbe){const _0x265d6e=this['_markers']['get'](_0x3d1cbe);if(!_0x265d6e)return null;const _0x43b254=_0x265d6e['editor']['model']['markers']['get'](_0x3d1cbe);return _0x43b254?_0xdc273f(_0x265d6e['editor']['editing'],_0x43b254):null;}_getMarkersDataForGroup(_0x1f9c4c){return Array['from'](this['_markers']['values']())['filter'](_0x110881=>_0x110881['groupId']===_0x1f9c4c);}_getOperationStart(_0x4a2a24){return'insert'===_0x4a2a24['type']?_0x4a2a24['position']:_0x4a2a24['newRange']['start'];}_getOperationEnd(_0x44f0e8,_0x2b5999=!0x1){return'insert'===_0x44f0e8['type']?_0x2b5999?_0x44f0e8['position']:_0x44f0e8['position']['getShiftedBy'](_0x44f0e8['howMany']):_0x44f0e8['newRange']['end'];}_shiftOperation(_0xd33124,_0x21fb75){return'insert'===_0xd33124['type']?_0xd33124['position']=_0xd33124['position']['getShiftedBy'](_0x21fb75):'marker'===_0xd33124['type']&&_0xd33124['newRange']&&(_0xd33124['newRange']=new _0x5b86ed(_0xd33124['newRange']['start']['getShiftedBy'](_0x21fb75),_0xd33124['newRange']['end']['getShiftedBy'](_0x21fb75))),_0xd33124;}_changeOperationOwnerDocument(_0x1cca4b,_0x53defe){'insert'===_0x1cca4b['type']?_0x1cca4b['position']=this['_changePositionOwnerDocument'](_0x1cca4b['position'],_0x53defe):'marker'===_0x1cca4b['type']&&_0x1cca4b['newRange']&&(_0x1cca4b['newRange']=this['_changeRangeOwnerDocument'](_0x1cca4b['newRange'],_0x53defe));}_changePositionOwnerDocument(_0x3381c4,_0x19d63d){return new _0x29cdf6(_0x19d63d,_0x3381c4['path']);}_changeRangeOwnerDocument(_0x50df22,_0x682431){return new _0x5b86ed(this['_changePositionOwnerDocument'](_0x50df22['start'],_0x682431),this['_changePositionOwnerDocument'](_0x50df22['end'],_0x682431));}_changePosition(_0xa836b1,_0x2e1a21){return new _0x29cdf6(_0x2e1a21,[..._0xa836b1]);}['_changeRange'](_0x44e7f6,_0x4a26c3,_0x46fadd,_0xcc1212){return new _0x5b86ed(this['_changePosition'](_0x4a26c3,_0xcc1212),this['_changePosition'](_0x46fadd,_0xcc1212));}_sortMarkers(_0x457232){const _0x156505=_0x4bec41=>{switch(_0x4bec41){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x457232['sort']((_0x3f86d3,_0x1078ff)=>_0x156505(_0x3f86d3['type'])-_0x156505(_0x1078ff['type']));}_hasSameTopLevelElement(_0x618d65,_0x4544d0){const _0x5d21ef=_0x618d65['getChild'](0x0),_0x29d996=_0x4544d0['getChild'](0x0);return!(!_0x5d21ef||!_0x29d996)&&((!_0x5d21ef['is']('element')||!_0x29d996['is']('element')||_0x5d21ef['name']===_0x29d996['name'])&&!(_0x5d21ef['is']('element')&&!_0x29d996['is']('element')||!_0x5d21ef['is']('element')&&_0x29d996['is']('element')));}_haveSingleTopLevelElement(_0x66164d){return 0x1===_0x66164d['childCount'];}_haveOnlyInlineContent(_0x3606a2,_0x5278ab){for(const _0x602ddd of _0x3606a2['getChildren']())if(_0x602ddd['is']('element')&&!_0x5278ab['isInline'](_0x602ddd))return!0x1;return!0x0;}_upsertDataId(_0x17be80,_0x5c5478){let _0xb9787a=_0x17be80['getAttribute'](_0x27a049);return _0xb9787a||(_0xb9787a=_0x5c5478(),_0x17be80['_setAttribute'](_0x27a049,_0xb9787a)),_0xb9787a;}};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(_0x1a9399,_0x3c8c39,_0x218bf4,_0x29dbe3,_0x3a8d14,_0x1645f2){super(),this['_sourceCheck']=_0x3c8c39,this['_documentData']=_0x1a9399,this['_aiConnector']=_0x218bf4,this['_reviewParams']=_0x29dbe3,this['_reviewArgs']=_0x3a8d14,this['_contexts']=_0x1645f2,this['on']('change:status',(_0x144d24,_0x4cd36b,_0x1ca5a4)=>{'aborted'==_0x1ca5a4&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x1ca5a4,'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'](_0x253846=>'pending'===_0x253846['status']);}get currentError(){return this['_currentError'];}get results(){return Array['from'](this['_results']['values']());}updateDocumentData(_0x2d17b8){this['_documentData']=_0x2d17b8;}async start(){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x4de369=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x18b20d of _0x4de369)'unmodified'!==_0x18b20d['data']['operation']&&('error'!==_0x18b20d['data']['operation']?'review-metadata'!==_0x18b20d['event']?this['_addReviewCheckResult'](_0x18b20d['data']['dataId'],_0x18b20d['data']['textDelta']):this['callId']=_0x18b20d['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(_0x197993){this['_currentError']=_0x197993,kn(_0x197993)?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(_0x4a526d,_0x521f46){const _0x2b498d=this['_results']['get'](_0x4a526d);if(!_0x2b498d)return;if(0x0===_0x521f46['length'])return;const _0x4fde66=this['_documentData']['elements']['get'](_0x4a526d);if(!_0x4fde66)return;const _0x4e489b=[];_0x521f46['forEach']((_0x1fdd14,_0x6d7c0d)=>{const _0x4476b0=new Bh(_0x2b498d['id']+'-'+_0x6d7c0d,_0x1fdd14,_0x2b498d,_0x4fde66['editor']);_0x4476b0['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x4476b0,'status':_0x4476b0['status']});}),_0x4476b0['on']('change:isActivated',()=>{_0x4476b0['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x4476b0}):this['fire']('reviewCheckResultDeactivated',{'change':_0x4476b0});}),this['_changes']['push'](_0x4476b0),_0x4e489b['push'](_0x4476b0);}),this['fire']('reviewCheckResultReady',{'changes':_0x4e489b,'result':_0x2b498d,'source':this});}abort(){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}isChangeActive(_0x4e6e27){const _0x11cb74=this['_changes']['find'](_0x25d916=>_0x25d916['id']===_0x4e6e27);return!(!_0x11cb74||'pending'!==_0x11cb74['status']);}isAnyChangeActivated(){return this['_changes']['some'](_0x4ccbf9=>!0x0===_0x4ccbf9['isActivated']);}getActiveChanges(){return this['_changes']['filter'](_0x3e30a9=>'pending'===_0x3e30a9['status']);}getChangeById(_0xbcf2){return this['_changes']['find'](_0x5b8a0b=>_0x5b8a0b['id']===_0xbcf2);}markAllChangesAsAccepted(){for(const _0x583a46 of this['_changes'])'pending'===_0x583a46['status']&&(_0x583a46['status']='accepted');this['_checkIfFinished']();}markChangeAsAccepted(_0xba236e){const _0x1e51b5=this['_changes']['find'](_0x48a138=>_0x48a138['id']===_0xba236e);_0x1e51b5&&'pending'===_0x1e51b5['status']&&(_0x1e51b5['status']='accepted'),this['_checkIfFinished']();}markChangeAsRejected(_0x34eea7){const _0x370c8a=this['_changes']['find'](_0x22ea06=>_0x22ea06['id']===_0x34eea7);_0x370c8a&&'pending'===_0x370c8a['status']&&(_0x370c8a['status']='rejected'),this['_checkIfFinished']();}markChangeAsOutdated(_0x579365){const _0x3d7b41=this['_changes']['find'](_0x558422=>_0x558422['id']===_0x579365);_0x3d7b41&&'pending'===_0x3d7b41['status']&&(_0x3d7b41['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x37be72){const _0x51768b=this['_changes']['find'](_0xdd197=>_0xdd197['id']===_0x37be72);_0x51768b&&'outdated'===_0x51768b['status']&&(_0x51768b['status']='pending'),this['_checkIfFinished']();}activateChange(_0x484611){this['_changes']['filter'](_0x188c13=>_0x188c13['isActivated']&&_0x188c13['id']!==_0x484611)['forEach'](_0x4c86a1=>{_0x4c86a1['isActivated']=!0x1;});const _0x166360=this['_changes']['find'](_0x17e1f8=>_0x17e1f8['id']===_0x484611);_0x166360&&'pending'===_0x166360['status']&&(_0x166360['isActivated']=!0x0);}deactivateChange(){this['_changes']['filter'](_0x4f684c=>_0x4f684c['isActivated'])['forEach'](_0x18984d=>{_0x18984d['isActivated']=!0x1;});}forceReadyState(){this['status']='ready';}async sendRating(_0x11b369){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x49a7c3;if(_0x11b369){const _0xa9b8ad=this['_changes']['find'](_0xaf1764=>_0xaf1764['id']===_0x11b369);if(_0xa9b8ad&&_0xa9b8ad['isRated'])return;_0xa9b8ad&&(_0x49a7c3=_0xa9b8ad['parent']['id'],_0xa9b8ad['isRated']=!0x0);}const _0x8334={'positiveCount':this['_changes']['filter'](_0x52b114=>'accepted'===_0x52b114['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x8334,this['callId'],_0x49a7c3);}_addReviewCheckResult(_0x586ee1,_0x306fa9){const _0x52e135=this['_documentData']['elements']['get'](_0x586ee1);if(!_0x52e135)return;if(Gs(_0x52e135['editor'],_0x52e135['rootName'])&&!Ys(_0x52e135['editor'],Rs(_0x306fa9)))return void(this['_hasUnsupportedInlineChange']=!0x0);const _0x59dbb7=_0x52e135['getContent']();if(_0x59dbb7===_0x306fa9)return;const _0x4d663b=new Uh({'id':_0x586ee1,'contentInitial':_0x59dbb7,'contentNew':_0x306fa9,'documentVersion':_0x52e135['documentVersion']});this['_results']['set'](_0x4d663b['id'],_0x4d663b),this['fire']('reviewCheckResultAdded',{'result':_0x4d663b,'source':this,'editor':_0x52e135['editor'],'rootName':_0x52e135['rootName']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0x500779=>'pending'===_0x500779['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x30433e=>'pending'===_0x30433e['status'])['length']&&(this['status']='finished');}},Kh=class extends Fh{get subTitle(){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x4f9661=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x3e2db2=0x0;_0x3e2db2<this['_reviewParams']['length'];_0x3e2db2++){if(!this['_reviewParams'][_0x3e2db2]||!this['_sourceCheck']['options'][_0x3e2db2])continue;const _0x1b778f=this['_sourceCheck']['options'][_0x3e2db2]['data']?.['find'](_0x4ba2c4=>_0x4ba2c4['id']===this['_reviewParams'][_0x3e2db2]);_0x1b778f&&_0x4f9661['push'](_0x1b778f['label']);}return _0x4f9661['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(_0x584a74,_0x5cb968,_0x152073){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x5cb968,_0x584a74,_0x152073);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},Wh=class extends _0x77cfae{_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',(_0x4d102f,_0x2db198)=>this['runCheck'](_0x2db198)),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 _0x333bd4=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x333bd4['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x333bd4['map'](_0x5e1cc6=>_0x5e1cc6['id']),this['_aiSource']);const _0xa37436=this['_currentReviewCheckRun'];_0xa37436['markAllChangesAsAccepted'](),_0xa37436['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x3befd5,_0x15a36d)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x15a36d['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x15a36d['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x15a36d['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x15a36d['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x481c63,_0x4d815d)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x4d815d['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x4d815d['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x4d815d['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x4d815d['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',(_0x58c821,_0x174309)=>{this['_onActivateChange'](_0x174309);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x2c08d8,_0x22dbc4)=>{this['_onDeactivateChange'](_0x22dbc4);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x4e43ab,_0x41fdf6)=>{this['_onChangeMarkerClicked'](_0x4e43ab,_0x41fdf6);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x24a396,_0x4e5753)=>{this['_onChangeMarkerHovered'](_0x24a396,_0x4e5753);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x427da2,_0x21147e)=>{this['_onChangeMarkerRemoved'](_0x427da2,_0x21147e);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x44e9fd,_0x2b52a2)=>{this['_onChangeMarkerRestored'](_0x44e9fd,_0x2b52a2);});}async['runCheck'](_0x229e26){if(!this['_availableReviewChecks'])return;const _0x26fbfb=this['_availableReviewChecks']['find'](_0x39483b=>_0x39483b['id']===_0x229e26['id']);if(!_0x26fbfb)return void this['_logError'](new ct('ai-review-mode-source-check-not-found',this,{'checkId':_0x229e26['id']}));this['_onReviewCheckRun'](_0x229e26),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_aiReviewCoreUi']['setAcceptAllEnabled'](!0x1);const _0x75e84=this['context']['plugins']['get'](fs)['contextLibrary']['resolveContext']({'feature':this['_defaultContextFeature'],'ids':[_0x229e26['id']],'context':new Yn()});this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x229e26,_0x26fbfb,_0x75e84);const _0x3f1364=this['_currentReviewCheckRun'];_0x3f1364['on']('reviewCheckResultChangeStatusUpdated',(_0x155d18,_0x351689)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x351689['change']['id'],_0x351689['status']),this['_pushAcceptAllEnabled'](_0x3f1364);}),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x170bef,_0x324732)=>{switch(_0x324732['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x324732);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'!==_0x324732['status']&&'error-chunk'!==_0x324732['status']&&'error-general'!==_0x324732['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x5c6657,_0x484990)=>{if(!this['_currentReviewCheckRun'])throw new ct('ai-review-mode-no-current-check-run',this);const _0x2b389c=Gs(_0x484990['editor'],_0x484990['rootName']);let _0x3d1fc4=_0x484990['result']['contentInitial'],_0x7e93e6=_0x484990['result']['contentNew'];_0x2b389c&&(_0x3d1fc4=Ws(_0x3d1fc4),_0x7e93e6=Ws(_0x7e93e6));const _0x3ce1d1=this['_diffContent'](_0x484990['editor'],_0x3d1fc4,_0x7e93e6);if(_0x2b389c){const _0x1d74c5=_0x484990['editor']['ui']['getEditableElement'](_0x484990['rootName'])?.['tagName']['toLowerCase']();for(const _0x5f5044 of _0x3ce1d1)_0x5f5044['wrapperTag']=_0x1d74c5;}_0x484990['source']['addResultChanges'](_0x484990['result']['id'],_0x3ce1d1);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x15b8d2,_0x59d018)=>{for(const _0x5e8f17 of _0x59d018['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x5e8f17);this['_pushAcceptAllEnabled'](_0x59d018['source']),this['_markChangePositionInEditorContent'](_0x59d018['changes'],_0x59d018['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x467ca3,_0x260d80)=>{this['_onReviewCheckResultActivated'](_0x260d80);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x4fcc43){if(kn(_0x4fcc43))return;_0x4fcc43 instanceof ct?this['_logError'](_0x4fcc43):this['_logError'](new ct('ai-review-mode-check-run-failed',this,void 0x0,_0x4fcc43));}}abort(){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}getAvailableChecks(){return(this['_availableReviewChecks']??[])['slice']();}getCurrentCheckRun(){return this['_currentReviewCheckRun'];}_pushAcceptAllEnabled(_0x2681ea){this['_aiReviewCoreUi']['setAcceptAllEnabled'](_0x2681ea['getActiveChanges']()['length']>0x0);}_createReviewCheckRun(_0x4091a4,_0x5e420c,_0x2e7610=new Yn()){return new Kh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x5e420c,this['_aiConnector'],_0x4091a4['params'],_0x4091a4['args'],_0x2e7610['refs']);}['_onChangeMarkerRemoved'](_0x493fef,_0x5c1b23){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x5c1b23['changeId']);}_onChangeMarkerRestored(_0x19b67e,_0x41ef40){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x41ef40['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}_initRequiredPlugins(){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](Nn)['createReporter']('aireview');}['_onReviewRunLeave'](_0x400f99=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x400f99&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x57f123 of this['_aiReviewCoreEditing']['getEditors']())_0x57f123['editing']['view']['change'](_0x321871=>{for(const _0x1938a0 of _0x57f123['editing']['view']['document']['getRoots']())_0x321871['removeClass']('ck-ai_review-diff',_0x1938a0),_0x321871['removeClass']('ck-ai_review-highlights',_0x1938a0),_0x321871['removeClass']('ck-ai-translate-mode-content',_0x1938a0);});}['_logError'](_0x31653d){this['_reporter']['logError'](_0x31653d),'ai-review-mode-models-unable-to-retrieve'===function(_0x5eb75d){return _0x5eb75d instanceof yn?_0x5eb75d['code']:_0x5eb75d instanceof Error?_0x5eb75d['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x31653d)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0xd54c38){if('content'===this['_changeActivationSource']){const _0x25c17e=this['_aiReviewCoreUi']['getChangeElement'](_0xd54c38);_0x25c17e&&Rt(_0x25c17e['closest']('.ck-ai_review__check-run-result')||_0x25c17e);}else{if('panel'===this['_changeActivationSource']){const _0x33970d=this['_getChangeContentElement'](_0xd54c38);if(!_0x33970d)return;Ot({'target':_0x33970d,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},Yh=class extends Fh{_prompt;['_model'];constructor(_0xa6e497,_0x336b43,_0x583434,_0x522f48,_0x202531,_0x17aa57){super(_0x583434,_0x522f48,_0x202531,void 0x0,void 0x0,_0x17aa57),this['_prompt']=_0xa6e497,this['_model']=_0x336b43;}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(_0x388b57,_0xf2bb38,_0x30850e){return this['_aiConnector']['upsertCustomAIReviewRating'](_0xf2bb38,_0x388b57,_0x30850e);}},$h=class{['id'];['commandId'];title;description;isParameterized;['useArgs'];options;['args'];get['apiId'](){return this['commandId'];}constructor(_0x29379e){this['id']=_0x29379e['id'],this['commandId']=_0x29379e['commandId'],this['title']=_0x29379e['title'],this['description']=_0x29379e['description'],this['isParameterized']=_0x29379e['isParameterized'],this['useArgs']=_0x29379e['useArgs'],this['options']=_0x29379e['options'],this['args']=_0x29379e['args'];}},qh=class extends $h{isExtra=!0x0;prompt;context;['model'];_defaultModel=null;constructor(_0xfe1cbc,_0x1dab53,_0x55482d){super(_0xfe1cbc),this['prompt']=_0xfe1cbc['prompt'],this['context']=_0xfe1cbc['context'],this['model']=_0xfe1cbc['model'],this['model']?this['_defaultModel']=_0x1dab53['find'](_0x39dbd1=>_0x39dbd1['id']===this['model'])||null:this['_defaultModel']=_0x55482d;}get defaultModel(){return this['_defaultModel'];}},Qh=class extends Yh{get subTitle(){return'';}set prompt(_0x52e921){this['_prompt']=_0x52e921;}set['model'](_0x217fa5){this['_model']=_0x217fa5;}},Xh=class extends _0x77cfae{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(_0x2ba58b){this['_checks']=_0x2ba58b['map'](_0x5213ed=>new $h(_0x5213ed));}get['checks'](){return this['_checks']['slice']();}getCheckById(_0x1a70fb){return this['checks']['find'](_0x3f9ce8=>_0x3f9ce8['id']===_0x1a70fb);}['removeCheckById'](_0xfa523a){this['_checks']=this['_checks']['filter'](_0x2f638a=>_0x2f638a['id']!==_0xfa523a);}},Zh=class extends $h{['_models']=[];_defaultModel=null;constructor(_0x449d7c,_0x30ec29,_0x149ae4){super(_0x449d7c),this['_models']=_0x30ec29,this['_defaultModel']=_0x149ae4;}get['models'](){return this['_models']['slice']();}get defaultModel(){return this['_defaultModel'];}},tc=class extends Jh{['_allModels']=[];['_recommendedModels']=[];_defaultModel=null;constructor(_0x195ef4,_0x54289a,_0x365196){super(),this['_allModels']=_0x195ef4,this['_recommendedModels']=_0x54289a,this['_defaultModel']=_0x365196;}get['allModels'](){return this['_allModels']['slice']();}setupChecks(_0x4c5f3d){this['_checks']=_0x4c5f3d['map'](_0x23a7b8=>!0x0===_0x23a7b8['isExtra']?new qh(_0x23a7b8,this['_allModels'],this['_defaultModel']):'custom'===_0x23a7b8['id']?new Zh(_0x23a7b8,this['_recommendedModels'],this['_defaultModel']):new $h(_0x23a7b8));}},ec=class extends Xh{static get['pluginName'](){return'AIReviewModeCheckRegistry';}static get requires(){return[Is,Nn,fs];}['_modelsLoadError']=null;constructor(_0x81d868){super(_0x81d868),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}getExtraChecks(){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x4d9560=>({'id':_0x4d9560['id'],'commandId':_0x4d9560['id'],'title':_0x4d9560['label'],'description':_0x4d9560['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x4d9560['prompt'],'context':_0x4d9560['context'],'model':_0x4d9560['model']}));}async _loadChecksList(){const _0x41a424=[...zh,...this['getExtraChecks']()]['map'](_0x1f5fc9=>_0x1f5fc9['isExtra']?_0x1f5fc9:this['_translateReviewCheck'](_0x1f5fc9)),_0x267705=this['context']['plugins']['get'](fs);let _0x1dc406;try{_0x1dc406=new tc(await _0x267705['models']['getAllModels'](),await _0x267705['models']['getAvailableModels'](),await _0x267705['models']['getDefault']()),this['_modelsLoadError']=null;}catch(_0x32b0b2){this['_modelsLoadError']=new ct('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x32b0b2),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),_0x1dc406=new tc([],[],null);}return _0x1dc406['setupChecks'](_0x41a424),_0x1dc406;}_translateReviewCheck(_0x12d864){const _0x9b13f3='AI_REVIEW_CHECK_'+_0x12d864['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x102829={..._0x12d864,'title':this['_translate'](_0x9b13f3+'_TITLE',_0x12d864['title']),'description':this['_translate'](_0x9b13f3+'_DESCRIPTION',_0x12d864['description'])};return _0x12d864['options']&&(_0x102829['options']=_0x12d864['options']['map'](_0x30b8bd=>({..._0x30b8bd,'label':this['_translate'](_0x9b13f3+'_OPTIONS_LABEL',_0x30b8bd['label']||''),'data':_0x30b8bd['data']?_0x30b8bd['data']['map'](_0x2272e2=>({..._0x2272e2,'label':this['_translate'](_0x9b13f3+'_OPTIONS_DATA_'+_0x2272e2['id']['toUpperCase'](),_0x2272e2['label'])})):void 0x0}))),_0x102829;}_translate(_0x342a46,_0x5522cd){const _0x497481=Es(this['context']['locale'],_0x342a46);return _0x497481===_0x342a46?_0x5522cd:_0x497481;}},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(_0xa6409){super(_0xa6409),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',zh['map'](_0x571701=>_0x571701['id']));}init(){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x4f3672,_0x13461b)=>{this['_isDiffOn']=_0x13461b['on'],this['_onDiffChange'](this['_isDiffOn']);});}_initRequiredPlugins(){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}_createReviewCheckRun(_0xaf2580,_0x47728d,_0x264241=new Yn()){if(_0xaf2580['isCustom'])return new Yh(_0xaf2580['args']['prompt'],_0xaf2580['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x47728d,this['_aiConnector'],_0x264241['refs']);if(_0x47728d['isExtra']){const _0x12f419=_0x47728d,_0x17a547=_0x12f419['context']?_0x264241['cloneWith'](_0x12f419['context'])['refs']:_0x264241['refs'];return new Qh(_0xaf2580['args']?.['prompt']??_0x12f419['prompt'],_0xaf2580['args']?.['model']??_0x12f419['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x47728d,this['_aiConnector'],_0x17a547);}return new Kh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x47728d,this['_aiConnector'],_0xaf2580['params'],_0xaf2580['args'],_0x264241['refs']);}_onReviewCheckResultActivated(_0x263ae6){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x263ae6['change']['id']),this['_scrollToChange'](_0x263ae6['change']['id']);const _0x57d124=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x263ae6['change']['id']);if(!_0x57d124)return;const _0x52dea4=this['_aiReviewCoreEditing']['getEditorForChange'](_0x263ae6['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x263ae6['change'],()=>_0x57d124['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x52dea4,_0x57d124['modelRange']['root']['rootName']),_0x52dea4?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x263ae6['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}_onActivateChange(_0xa615fb){this['_currentReviewCheckRun']&&'click'===_0xa615fb['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0xa615fb['id']));}_onDeactivateChange(_0x4cad47){this['_currentReviewCheckRun']&&'balloon'===_0x4cad47['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x18e613,_0x1eb423){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x1eb423['changeId']);const _0x50f04e=this['_currentReviewCheckRun']['getChangeById'](_0x1eb423['changeId']);if(!_0x50f04e)return;const _0x508c56=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x1eb423['changeId']),_0x3dc867=this['_aiReviewCoreEditing']['getEditorForChange'](_0x1eb423['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x50f04e,_0x1eb423['markerElement'],_0x1eb423['domEvent'],'click',this['_getBalloonDomRoot'](_0x3dc867,_0x508c56?.['modelRange']['root']['rootName']),_0x3dc867?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x42ef53,_0x4bf8bc){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x105dc7=this['_currentReviewCheckRun']['getChangeById'](_0x4bf8bc['changeId']);if(!_0x105dc7)return;const _0x3edd6d=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x4bf8bc['changeId']),_0x39448c=this['_aiReviewCoreEditing']['getEditorForChange'](_0x4bf8bc['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x105dc7,_0x4bf8bc['markerElement'],_0x4bf8bc['domEvent'],'hover',this['_getBalloonDomRoot'](_0x39448c,_0x3edd6d?.['modelRange']['root']['rootName']),_0x39448c?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}_getChangeContentElement(_0x477f2e){const _0x334ecf=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x477f2e);return _0x334ecf?_0x334ecf['getElement']():null;}_markChangePositionInEditorContent(_0x443323,_0x403719){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x443323,_0x403719);}_diffContent(_0x177af8,_0x37fafe,_0x498831){return this['_aiReviewCoreEditing']['diffContent'](_0x177af8,_0x37fafe,_0x498831,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x5d368b){_0x5d368b?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x2cba97 of this['_aiReviewCoreEditing']['getEditors']())_0x2cba97['editing']['view']['change'](_0xc920a2=>{for(const _0x538fc6 of _0x2cba97['editing']['view']['document']['getRoots']()){for(const _0x4cda68 of _0x538fc6['getClassNames']())_0x4cda68['startsWith']('ck-ai_review-')&&_0xc920a2['removeClass'](_0x4cda68,_0x538fc6);_0xc920a2['addClass'](_0x5d368b?'ck-ai_review-diff':'ck-ai_review-highlights',_0x538fc6);}});}_getBalloonDomRoot(_0x436aee,_0x2ee56a){const _0x5513cd=_0x436aee['editing']['view'];if(_0x2ee56a){const _0x146148=_0x5513cd['getDomRoot'](_0x2ee56a);if(_0x146148)return _0x146148;}return _0x5513cd['getDomRoot']()??void 0x0;}async _getReviewChecks(){const _0x523da8=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x45a558=await _0x523da8['getChecksList']();_0x523da8['modelsLoadError']&&this['_logError'](_0x523da8['modelsLoadError']);let _0x14de6f=_0x45a558['checks'];const _0x4e6940=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x4e6940,_0x14de6f),this['_usesAvailableCommandsConfig']&&(_0x14de6f=_0x4e6940['map'](_0x3f805d=>_0x14de6f['find'](_0x693ffb=>_0x693ffb['id']===_0x3f805d))['filter'](_0x43484c=>!!_0x43484c)),this['_filterChecksWithMissingModel'](_0x14de6f);}_logWarningForNonExistentChecks(_0x53a422,_0x6d2de1){const _0xbf72b8=_0x53a422['filter'](_0x5a3463=>!_0x6d2de1['some'](_0x275e05=>_0x275e05['id']===_0x5a3463));_0xbf72b8['length']&&this['_reporter']['logError'](new yn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0xbf72b8['join'](',\x20')}}));}_filterChecksWithMissingModel(_0x509cf4){const _0x137a3a=[];return _0x509cf4['forEach'](_0x30bfa7=>{(_0x30bfa7 instanceof qh&&!_0x30bfa7['defaultModel']||_0x30bfa7 instanceof Zh&&!_0x30bfa7['models']['length'])&&_0x137a3a['push'](_0x30bfa7['id']);}),_0x137a3a['length']&&_0x137a3a['forEach'](_0x46c8b2=>{_0x509cf4=_0x509cf4['filter'](_0x5b8732=>_0x5b8732['id']!==_0x46c8b2),this['_reporter']['logError'](new yn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x46c8b2}}));}),_0x509cf4;}},sc=class extends _0x77cfae{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'](_0x26feaa=>{const _0x45fcdb={'id':_0x26feaa['id'],'title':_0x26feaa['title'],'description':_0x26feaa['description']};return'custom'!==_0x26feaa['id']&&_0x26feaa['options']?.['length']&&(_0x45fcdb['parameters']=_0x26feaa['options'][0x0]['data']['map'](_0x139011=>({..._0x139011}))),_0x45fcdb;});}async['runReview'](_0x3415d8,_0x1d028d){const _0x373a36=await this['_resolveReviewCheck'](_0x3415d8),_0x26945e=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x540381=this['context']['plugins']['get']('AIConnector'),_0x2c0cde=_0x26945e['getDocumentData']({'roots':_0x1d028d?.['roots']}),_0x46e9f1=this['_createReviewCheckRun'](_0x373a36,_0x2c0cde,_0x540381,_0x1d028d?.['parameterId'],_0x1d028d?.['contexts']);return _0x26945e['runCheck'](_0x46e9f1,{'signal':_0x1d028d?.['signal']});}async runCustomReview(_0x4c4b20,_0x1cb8f4){const {reviewCheck:_0x583900,resolvedModel:_0x4864ad}=await this['_resolveCustomReviewCheck'](_0x4c4b20,_0x1cb8f4?.['model']),_0x444d6b=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x5affe9=this['context']['plugins']['get']('AIConnector'),_0x48f50b=new Yh(_0x4c4b20,_0x4864ad,_0x444d6b['getDocumentData']({'roots':_0x1cb8f4?.['roots']}),_0x583900,_0x5affe9,_0x1cb8f4?.['contexts']);return _0x444d6b['runCheck'](_0x48f50b,{'signal':_0x1cb8f4?.['signal']});}['applyReview'](_0xd49c99,_0x20ad21){this['context']['plugins']['get']('AIGateway')['apply'](_0xd49c99,{'aiSource':'review',..._0x20ad21});}async['_resolveReviewCheck'](_0xaa81f6){const _0x3b4f58=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x1b533d=>_0x1b533d['id']===_0xaa81f6);if(!_0x3b4f58)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0xaa81f6});if(_0x3b4f58 instanceof Zh)throw new ct('ai-reviewgateway-not-a-system-command',this,{'checkId':_0xaa81f6});if(_0x3b4f58 instanceof qh&&!_0x3b4f58['defaultModel']?.['id'])throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0xaa81f6});return _0x3b4f58;}async _resolveCustomReviewCheck(_0x1cf441,_0x4c412d){const _0x5ae28b='custom',_0x39bfeb=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x5c17c5=>_0x5c17c5['id']===_0x5ae28b);if(!_0x39bfeb)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0x5ae28b});if(!(_0x39bfeb instanceof Zh))throw new ct('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x5ae28b});if(!_0x1cf441)throw new ct('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x5ae28b});const _0x46d709=_0x4c412d??_0x39bfeb['defaultModel']?.['id'];if(!_0x46d709)throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x5ae28b});return{'reviewCheck':_0x39bfeb,'resolvedModel':_0x46d709};}_createReviewCheckRun(_0x2ecfb6,_0x561404,_0x1c93ba,_0x32a7b0,_0x5085f4=[]){if(_0x2ecfb6 instanceof qh){const _0xb409fe=_0x2ecfb6['context']?[..._0x5085f4,_0x2ecfb6['context']]:_0x5085f4;return new Qh(_0x2ecfb6['prompt'],_0x2ecfb6['defaultModel']['id'],_0x561404,_0x2ecfb6,_0x1c93ba,_0xb409fe);}return new Kh(_0x561404,_0x2ecfb6,_0x1c93ba,_0x32a7b0?[_0x32a7b0]:void 0x0,void 0x0,_0x5085f4);}},nc=class extends _0x77cfae{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(_0xa7f0c7,_0x56aa5f){if(this['assertStartReviewPreconditions'](_0xa7f0c7)instanceof Zh)throw new ct('ai-reviewmode-not-a-system-command',this,{'commandId':_0xa7f0c7});nh(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0xa7f0c7,'params':_0x56aa5f?.['parameterId']?[_0x56aa5f['parameterId']]:void 0x0});}async startCustomReview(_0x2140f4,_0x5a4fe7){if(!_0x2140f4)throw new ct('ai-reviewmode-missing-custom-command-prompt',this);const _0x400aa0=zh['find'](_0x1c5be7=>'custom'===_0x1c5be7['commandId'])['id'],_0x4d83d9=this['assertStartReviewPreconditions'](_0x400aa0),_0xbfa885=_0x5a4fe7?.['model']??_0x4d83d9['defaultModel']?.['id'];if(!_0xbfa885)throw new ct('ai-reviewmode-missing-custom-command-model',this);nh(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x400aa0,'isCustom':!0x0,'args':{'prompt':_0x2140f4,'model':_0xbfa885}});}getAvailableCommands(){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x543d50=>{const _0x141ce4={'id':_0x543d50['id'],'title':_0x543d50['title'],'description':_0x543d50['description']};return'custom'!==_0x543d50['id']&&_0x543d50['options']?.['length']&&(_0x141ce4['parameters']=_0x543d50['options'][0x0]['data']['map'](_0x4bc3aa=>({..._0x4bc3aa}))),_0x141ce4;});}assertStartReviewPreconditions(_0x313bd4){const _0x1636e3=this['context']['plugins']['get']('AIReviewModeController');if(_0x1636e3['getCurrentCheckRun']())throw new ct('ai-reviewmode-review-already-running',this);const _0x20e3ea=_0x1636e3['getAvailableChecks']()['find'](_0xd42b3f=>_0xd42b3f['id']===_0x313bd4);if(!_0x20e3ea)throw new ct('ai-reviewmode-unknown-command',this,{'commandId':_0x313bd4});return _0x20e3ea;}},rc=class extends Kh{_title;constructor(_0x265a52,_0x16a432,_0x1304c0,_0xc2d9e6,_0x639dc2,_0xdf648e,_0x339268){super(_0x265a52,_0x16a432,_0x1304c0,_0x639dc2,_0xdf648e,_0x339268),this['_title']=_0xc2d9e6;}get title(){return this['_title'];}get subTitle(){return this['_sourceCheck']['title'];}},oc=class extends $h{get['apiId'](){return'translate';}},ac=class extends Jh{setupChecks(_0x40e894){this['_checks']=_0x40e894['map'](_0x4d2b64=>new oc(_0x4d2b64));}};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(_0x5efaac){super(_0x5efaac),this['context']['config']['define']('ai.translate.languages',hc);}async _loadChecksList(){const _0x2c06ae=[],_0x5ec4fb=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x497693 of _0x5ec4fb)_0x2c06ae['push']({'title':_0x497693['label'],'id':_0x497693['id'],'commandId':_0x497693['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x497693['id']}});const _0x520095=new ac();return _0x520095['setupChecks'](this['_translateChecks'](_0x2c06ae)),_0x520095;}_translateChecks(_0x3ccf31){const _0x3b7786=this['context']['locale'];return _0x3ccf31['map'](_0x576a0f=>{const _0x4161e5='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x576a0f['title']['toUpperCase']()['replaceAll']('-','_'),_0x363f36=Es(_0x3b7786,_0x4161e5);return{..._0x576a0f,'title':_0x363f36===_0x4161e5?_0x576a0f['title']:_0x363f36};});}},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(_0x566980,_0x260774,_0x8ed797){return new rc(this['_aiReviewCoreEditing']['getDocumentData'](),_0x260774,this['_aiConnector'],Es(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x566980['params'],_0x566980['args'],_0x8ed797?.['refs']);}_onReviewCheckResultActivated(_0x1a4cd9){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x1a4cd9['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x1a4cd9['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}_onActivateChange(_0xfd7603){this['_currentReviewCheckRun']&&('hover'===_0xfd7603['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0xfd7603['id'])),'click'===_0xfd7603['uiInteraction']&&this['_scrollToChange'](_0xfd7603['id']));}_onDeactivateChange(_0x4dbcd7){this['_currentReviewCheckRun']&&'panel'===_0x4dbcd7['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x4a00ad,_0x10de07){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x10de07['changeId']),this['_scrollToChange'](_0x10de07['changeId']));}['_onChangeMarkerHovered'](_0x34da06,_0x2e53ac){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x2e53ac['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x2e53ac['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}_getChangeContentElement(_0x2a2715){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x2a2715);}_markChangePositionInEditorContent(_0x47ea3d,_0x474955){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x47ea3d,_0x474955);}_diffContent(_0x34654f,_0x47b4f2,_0x4b47b6){return this['_aiReviewCoreEditing']['diffContent'](_0x34654f,_0x47b4f2,_0x4b47b6,!0x0);}['_onReviewCheckRun'](){for(const _0x3c395a of this['_aiReviewCoreEditing']['getEditors']())_0x3c395a['editing']['view']['change'](_0x220b3a=>{for(const _0x2650d8 of _0x3c395a['editing']['view']['document']['getRoots']())_0x220b3a['addClass']('ck-ai-translate-mode-content',_0x2650d8);});}async _getReviewChecks(){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},uc=class extends fh{constructor(_0x5e309c,_0x46883d){super(_0x5e309c,_0x46883d),this['on']('set:isLoading',(_0x1a2628,_0x4d1491,_0x19f1a9)=>{_0x19f1a9&&(this['headerTitle']=Es(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x454e33,_0x4fb0a9,_0xc038a4)=>{_0xc038a4&&(this['headerTitle']=Es(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}_createAcceptAllButtonView(){const _0x37372b=super['_createAcceptAllButtonView']();return _0x37372b['set']('label',Es(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x37372b;}_createExitReviewButtonView(){const _0x32532f=super['_createExitReviewButtonView']();return _0x32532f['set']('label',Es(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x32532f;}},dc=class extends yh{_setupTemplate(){const _0x1fde4e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x1fde4e['if']('isVisible','ck-hidden',_0x1a6759=>!_0x1a6759)]},'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',_0x1fde4e['if']('isVisible','ck-hidden',_0x1b9649=>!_0x1b9649)]},'children':this['_checkViews']}]});}},_c=class extends mh{static get['pluginName'](){return'AITranslateUI';}createMainView(){const _0x2fe2af=this['context']['plugins']['get']('AITabs'),_0x26f304=this['context']['locale'],_0x88a50b=new ua(_0x26f304,{'label':Es(_0x26f304,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x164672,'class':'ck-ai-header_review-translate','showResizeButton':_0x2fe2af['showResizeButton']});_0x88a50b['delegate']('resizeTabs')['to'](_0x2fe2af),_0x88a50b['bind']('isMaximized')['to'](_0x2fe2af['view'],'isMaximized',_0x25df5c=>_0x25df5c);const _0x53a22a=new wh(_0x26f304,{'header':_0x88a50b,'list':new dc(_0x26f304),'results':new uc(_0x26f304,{'generalErrorText':Es(_0x26f304,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new bh(_0x26f304,{'headerText':Es(_0x26f304,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Es(_0x26f304,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Es(_0x26f304,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x53a22a['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x53a22a;}registerTab(){const _0x505851=this['context']['plugins']['get']('AITabs');_0x505851['view']['on']('activateTab',(_0x341c2b,{newTab:_0x19056f,oldTab:_0x548e1f})=>{'translate'===_0x19056f?this['fire']('getReviewCheckList'):'translate'===_0x548e1f&&this['fire']('leaveReview');}),_0x505851['view']['addTab']({'id':'translate','buttonLabel':Es(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x164672,'order':0x0,'content':this['_mainView']});}},gc=class extends _0x77cfae{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(_0x58d859,_0x2cdf77){const _0x4c3859=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x5a2e17=this['context']['plugins']['get']('AIConnector'),_0x2839c9=new oc({'id':_0x58d859,'commandId':_0x58d859,'title':_0x58d859,'description':'','isParameterized':!0x1}),_0x32f094=new Kh(_0x4c3859['getDocumentData']({'roots':_0x2cdf77?.['roots']}),_0x2839c9,_0x5a2e17,void 0x0,{'language':_0x58d859},_0x2cdf77?.['contexts']);return _0x4c3859['runCheck'](_0x32f094,{'signal':_0x2cdf77?.['signal']});}applyTranslate(_0x59458d,_0x7f7099){this['context']['plugins']['get']('AIGateway')['apply'](_0x59458d,_0x7f7099);}},Ac=class extends _0x77cfae{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(_0x3eb519){const _0x55fc2b=this['assertStartTranslatePreconditions'](_0x3eb519);nh(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0x55fc2b['id'],'args':_0x55fc2b['useArgs']?_0x55fc2b['args']:void 0x0});}getAvailableLanguages(){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x1042e5=>({'id':_0x1042e5['id'],'label':_0x1042e5['title']}));}assertStartTranslatePreconditions(_0x5463fb){const _0x27f282=this['context']['plugins']['get']('AITranslateController');if(_0x27f282['getCurrentCheckRun']())throw new ct('ai-translate-translation-already-running',this);const _0x532ab0=_0x27f282['getAvailableChecks']()['find'](_0x586852=>_0x586852['id']===_0x5463fb);if(!_0x532ab0)throw new ct('ai-translate-unknown-language',this,{'languageId':_0x5463fb});return _0x532ab0;}};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 _0x15beea,ContextPlugin as _0x57f218,Editor as _0x38520b,Plugin as _0x4e7480,rootAcceptsBlocks as _0x3c9aa8}from'@ckeditor/ckeditor5-core';import{IconAI as _0x442f7b,IconAIAdjustLength as _0x480192,IconAIAskAI as _0x180f97,IconAIChangeTone as _0x2e4961,IconAIChat as _0x4f3da7,IconAIChatCommands as _0x3cb8c5,IconAIContinueWriting as _0x77ad9c,IconAIGrammarCheck as _0x264e7a,IconAIHistory as _0x3b2c76,IconAIImproveWriting as _0x189daa,IconAIOther as _0x46dd3b,IconAIQuickActions as _0x4b081c,IconAIReview as _0x5a8e02,IconAITranslate as _0x1895f8,IconBoxWithCheck as _0x38bf23,IconBoxWithCross as _0x370aca,IconBoxWithMarker as _0x2e4b78,IconBrowseFiles as _0x281725,IconBulb as _0xa0a8e6,IconCancel as _0x1e5963,IconCheck as _0x4ae57d,IconChevronDown as _0x5c20b7,IconChevronRight as _0x26c371,IconChevronUp as _0x593583,IconCopy as _0xe37cc4,IconDocument as _0x3495c4,IconDocumentOutline as _0xa2ab13,IconDropdownArrow as _0x3230ae,IconError as _0x5d48e6,IconEye as _0x54707b,IconEyeCrossedOut as _0xfd4424,IconFileUpload as _0x31280d,IconImage as _0x39a2ad,IconInfo as _0x33bdef,IconLink as _0x2bc60f,IconLoupe as _0x28df85,IconMagicWand as _0x53ad6a,IconMaximize as _0x325ee5,IconMinimize as _0x2e031c,IconNextArrow as _0x43814d,IconOutdated as _0x30ead8,IconPaperClip as _0xf5684a,IconPin as _0x30ea52,IconPlus as _0x38a2ad,IconPreviousArrow as _0x212a4e,IconRefresh as _0x2a5ea3,IconRevisionHistory as _0x3dc3e9,IconRobotPencil as _0xfc2f78,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 _0x20ae77,MenuBarMenuView as _0x502992,SearchTextView as _0x197330,SpinnerView as _0x1e0c92,Template as _0x165444,TextareaView as _0x195e86,ToolbarView as _0x5d2e05,UIModel as _0x1a683d,View as _0x3a2edc,ViewCollection as _0x16cf3f,addListToDropdown as _0x59425e,addMenuToDropdown as _0x3fc36d,clickOutsideHandler as _0x5b168d,createDropdown as _0x295fea,createLabeledInputText as _0x5230ce,createLabeledTextarea as _0x209c0f,submitHandler as _0x45fbdb}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x40d824,ClipboardPipeline as _0x4c4e21}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0xdb67b4,MarkerOperation as _0x508b00,Matcher as _0x3cc0dc,ModelDocumentFragment as _0x5a34ce,ModelPosition as _0x3a6639,ModelRange as _0x4b6f52,ModelTreeWalker as _0x508ddf,ViewDataTransfer as _0x5b2884,ViewDocumentDomEventData as _0x3e38b5,ViewDowncastWriter as _0x5f45e0,ViewUpcastWriter as _0x32aa17,_DetachOperation as _0x150372,_insertIntoModelNodeList as _0x24aa70,_removeFromModelNodeList as _0x12f258,transformOperationSets as _0x1b55c4}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x2e2ade,debounce as _0x280a1b,escape as _0x483082,escapeRegExp as _0x5c6661,omit as _0x67b283,throttle as _0x4e27fd,unescape as _0x23a99f}from'es-toolkit/compat';import{createParser as _0x26568d}from'eventsource-parser';import{CloudServices as _0x532081}from'@ckeditor/ckeditor5-cloud-services';import{parseDocument as _0x4b2021}from'htmlparser2';import{append as _0x44f81b,appendChild as _0x49bdc9,find as _0x35ff9d,findAll as _0x10faf7,findOne as _0x43283b,getChildren as _0x1b1092,getParent as _0x2a102,isComment as _0x1b9e99,isTag as _0x2159f2,prepend as ti,prependChild as _0x97bf1a,removeElement as _0x356c4e,replaceElement as _0x147a80,textContent as _0x1347c6}from'domutils';import _0x4a5d1b from'dom-serializer';import{Document as _0x577dfe,Element as _0x4f2bc5,NodeWithChildren as _0x7ae23c,Text as _0x2c4665,cloneNode as _0x34616a,isDocument as _0x67f576,isText as _0x37569a}from'domhandler';import{ConfirmMixin as _0x24339b,DATA_ID_MODEL_ATTRIBUTE as _0x19f2f9,DATA_ID_VIEW_ATTRIBUTE as _0x5f0ba7,DocumentCompare as _0x14613c,PillView as _0x55e383,SuggestionsConversion as _0x4978a0,fixElementSuggestionRange as _0x259db7,getAllMarkersDomElementsSorted as _0x5a452e,getMarkerDomElement as _0x59f2a2,isInvalidAttributeOperation as _0x4e897d}from'@ckeditor/ckeditor5-collaboration-core';import{MarkdownGfmMdToHtml as _0x570576,MarkdownGfmMdToHtmlDefaultPlugins as _0x98e2e5}from'@ckeditor/ckeditor5-markdown-gfm';import _0x5265c1 from'rehype-sanitize';import _0x45c20f from'morphdom';import{diffArrays as _0x3f58d0}from'diff';const vi='_ungrouppedCommands';function ki(_0x242259,_0x238d2e){const _0x416c22=(0x0,_0x238d2e['t'])('Other');return _0x242259['length']?'groupId'in _0x242259[0x0]?_0x242259:[{'groupId':vi,'groupLabel':_0x416c22,'order':0x1/0x0,'commands':_0x242259}]:[{'groupId':vi,'groupLabel':_0x416c22,'order':0x1/0x0,'commands':[]}];}const yi=globalThis['DataTransfer'],Ni='ai-ui';var xi=class extends _0x4e7480{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const {editor:_0x2202a6}=this,_0x7ee327=['ck-fake-ai-selection'];_0x2202a6['config']['get']('ai.assistant.useTheme')&&_0x7ee327['push']('ck-ai-assistant-ui_theme'),_0x2202a6['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Ni,'view':{'classes':_0x7ee327,'priority':0xc}}),_0x2202a6['conversion']['for']('editingDowncast')['markerToElement']({'model':Ni,'view':(_0x22bd31,{writer:_0x32a199})=>{if(!_0x22bd31['markerRange']['isCollapsed'])return null;const _0x521337=_0x32a199['createUIElement']('span');return _0x32a199['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x521337),_0x521337;}});}afterInit(){!async function(_0x18ade5){const _0xc631f2='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0xefd054=0x79170,_0x315e4b=window['Date']['now'](),_0x38eae6=_0x18ade5['editor'],_0x107e7c=new window['Promise'](_0x220fd6=>{_0x38eae6['once']('ready',_0x220fd6);}),_0x577d50={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x2499aa=_0x38eae6['config']['get']('licenseKey');async function _0x445ed9(){let _0x1dd959,_0x526519=null,_0x2e043a=null;try{return'GPL'==_0x2499aa?'NotAllowed':(_0x1dd959=_0x32dc32(),_0x1dd959?(_0x1dd959['usageEndpoint']&&(_0x2e043a=_0x58c720(_0x1dd959['usageEndpoint'],_0x1dd959['jti'])),await _0x1873ee()?_0x209c46()?_0x53e5de()?'Expired':_0x4ccb53()?('evaluation'==_0x1dd959['licenseType']&&(_0x526519=_0x37a584('EvaluationLimit')),await _0x4870f5()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x53e5de(){const _0x33c791=['evaluation','trial']['includes'](_0x1dd959['licenseType'])?_0x315e4b/0x3e8:0xe10*_0xefd054;return _0x1dd959['exp']<_0x33c791;}function _0x209c46(){const _0x5a7dbf=_0x1dd959['features'];return!!_0x5a7dbf&&(!!_0x5a7dbf['includes']('*')||!!_0x5a7dbf['includes']('AI'));}function _0x4ccb53(){const _0x26fe66=_0x1dd959['licensedHosts'];if(!_0x26fe66||0x0==_0x26fe66['length'])return!0x0;const {hostname:_0x1c6a12}=new URL(window['location']['href']);if(_0x26fe66['includes'](_0x1c6a12))return!0x0;const _0x3f9007=_0x1c6a12['split']('.');return _0x26fe66['filter'](_0x4a0678=>_0x4a0678['includes']('*'))['map'](_0x1f5a8f=>_0x1f5a8f['split']('.'))['filter'](_0x3272ec=>_0x3272ec['length']<=_0x3f9007['length'])['map'](_0xe73f7=>Array(_0x3f9007['length']-_0xe73f7['length'])['fill']('*'===_0xe73f7[0x0]?'*':'')['concat'](_0xe73f7))['some'](_0x326d94=>_0x3f9007['every']((_0x1aa82f,_0x150a49)=>_0x326d94[_0x150a49]===_0x1aa82f||'*'===_0x326d94[_0x150a49]));}function _0x4870f5(){return _0x526519&&_0x2e043a?new window['Promise']((_0x3e1714,_0x57ed32)=>{_0x526519['then'](_0x3e1714,_0x57ed32),_0x2e043a['then'](_0x484134=>{'Valid'!=_0x484134&&_0x3e1714(_0x484134);},_0x57ed32);}):_0x526519||_0x2e043a||'Valid';}}function _0x58c720(_0x186692,_0x33570d){return new window['Promise'](_0x316c90=>{if(_0x7c0a85())return _0x316c90('Valid');_0x306d9e(),_0x38eae6['decorate']('_sendUsageRequest');let _0xdcf104=!0x1;const _0x25f764=kt();function _0x559029(_0xf503fe){return!!_0xf503fe&&('object'==typeof _0xf503fe||'function'==typeof _0xf503fe)&&'function'==typeof _0xf503fe['then']&&'function'==typeof _0xf503fe['catch'];}function _0x3701f1(_0x3775e5){_0x293f3f(_0x3775e5)['then'](_0x5987a4=>_0x5987a4&&'ok'==_0x5987a4['status']?_0x4c49c8(_0xef75bd(_0x25f764+_0x33570d))!=_0x5987a4['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x1289ef=>(_0x5db97e(),_0x1289ef),()=>{const _0x4bb25a=_0x3bb601();return null==_0x4bb25a?(_0x5db97e(),'Valid'):_0x315e4b-_0x4bb25a>0x240c8400?'UsageLimit':'Valid';})['then'](_0x316c90)['catch'](()=>{_0x316c90('UsageLimit');});const _0x7c0ab8=0x36ee80;function _0x5db97e(){const _0xc31230='llct-'+_0x4c49c8(_0xef75bd(_0x186692)),_0x328915=_0x499f43(_0x4c49c8(window['Math']['ceil'](_0x315e4b/_0x7c0ab8)));window['localStorage']['setItem'](_0xc31230,_0x328915);}function _0x3bb601(){const _0xc2b834='llct-'+_0x4c49c8(_0xef75bd(_0x186692)),_0x47b279=window['localStorage']['getItem'](_0xc2b834);return _0x47b279?window['parseInt'](_0x499f43(_0x47b279),0x10)*_0x7c0ab8:null;}function _0x293f3f(_0x43ac2d){return new window['Promise']((_0x2bc275,_0x584267)=>{_0x43ac2d['then'](_0x2bc275,_0x584267),window['setTimeout'](_0x584267,0x1d4c0);});}}_0x38eae6['on']('_sendUsageRequest',(_0x4d8ebf,_0xe37da)=>{if(_0xe37da[0x0]!=_0x186692)return _0x316c90('UsageLimit');_0xe37da[0x1]={..._0xe37da[0x1],'requestId':_0x25f764};},{'priority':'high'}),_0x38eae6['on']('_sendUsageRequest',_0x5ecf25=>{_0x559029(_0x5ecf25['return'])&&(_0xdcf104=!0x0,_0x3701f1(_0x5ecf25['return']));},{'priority':'low'}),_0x107e7c['then'](()=>{_0xdcf104||_0x316c90('UsageLimit');});});function _0x7c0a85(){return'auto'==_0x38eae6['editing']['view']['_overlayModeHint'];}function _0x306d9e(){_0x38eae6['editing']['view']['_overlayModeHint']='auto';}}function _0x37a584(_0x32289c){const _0x57969f=[new window['Promise'](_0x5c65c8=>setTimeout(_0x5c65c8,0x93ecc)),_0x107e7c['then'](()=>new window['Promise'](_0x29f521=>{let _0x252ab2=0x0;_0x38eae6['model']['on']('applyOperation',(_0x36f306,_0x18a1c3)=>{_0x18a1c3[0x0]['isDocumentOperation']&&_0x252ab2++,0x5e8==_0x252ab2&&(_0x29f521(),_0x36f306['off']());});}))];return window['Promise']['race'](_0x57969f)['then'](()=>_0x32289c);}async function _0x1bd8af(){await _0x107e7c,_0x38eae6['model']['change']=_0x1b326d,_0x38eae6['model']['enqueueChange']=_0x1b326d,_0x38eae6['enableReadOnlyMode']('model');}function _0xa4e61f(_0x475243){const _0x4e1a50=_0x96e822();_0x38eae6[_0x4e1a50]='aiLicenseKey'+_0x475243,'Valid'!=_0x475243&&_0x1bd8af();}function _0x96e822(){const _0x313579=window['String'](window['performance']['now']())['replace']('.','');let _0x5e4a88='n';for(let _0x5ef1d0=0x0;_0x5ef1d0<_0x313579['length'];_0x5ef1d0+=0x2){let _0x3830b2=window['parseInt'](_0x313579['substring'](_0x5ef1d0,_0x5ef1d0+0x2));_0x3830b2>=0x3e&&(_0x3830b2-=0x3e),_0x5e4a88+=_0xc631f2[_0x3830b2];}return _0x5e4a88;}function _0x32dc32(){const _0x4c8891=_0x2499aa['split']('.');if(0x3!=_0x4c8891['length'])return null;return _0x3db44d(_0x4c8891[0x1]);function _0x3db44d(_0x4920b1){const _0xb291ad=_0x2a4739(_0x4920b1);return _0xb291ad&&_0x37b611()?_0xb291ad:null;function _0x37b611(){const _0xf549b=_0xb291ad['jti'],_0x567c27=window['parseInt'](_0xf549b['substring'](_0xf549b['length']-0x8),0x10),_0x1f9c16={..._0xb291ad,'jti':_0xf549b['substring'](0x0,_0xf549b['length']-0x8)};return delete _0x1f9c16['vc'],_0xef75bd(_0x1f9c16)==_0x567c27;}}}async function _0x1873ee(){let _0x563a40=!0x0;try{const [_0x541c19,_0x273355,_0x16241c]=_0x2499aa['split']('.');return _0x3c5da8(_0x541c19),await _0x105e28(_0x541c19,_0x273355,_0x16241c),_0x563a40;}catch{return!0x1;}function _0x3c5da8(_0x4e73dd){const _0x14fbc7=_0x2a4739(_0x4e73dd);_0x14fbc7&&'ES256'==_0x14fbc7['alg']||(_0x563a40=!0x1);}async function _0x105e28(_0x2e0012,_0x4cfaa8,_0x36ed39){const _0x2776f4=window['Uint8Array']['from'](_0x25b8d7(_0x36ed39),_0x45c0ee=>_0x45c0ee['charCodeAt'](0x0)),_0x1a44de=new window['TextEncoder']()['encode'](_0x2e0012+'.'+_0x4cfaa8),_0x5c476f=window['crypto']['subtle'];if(!_0x5c476f)return;const _0x494688=await _0x5c476f['importKey']('jwk',_0x577d50,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x5c476f['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x494688,_0x2776f4,_0x1a44de)||(_0x563a40=!0x1);}}function _0x2a4739(_0x2e7d7f){return _0x2e7d7f['startsWith']('ey')?JSON['parse'](_0x25b8d7(_0x2e7d7f)):null;}function _0x25b8d7(_0x1a8330){return window['atob'](_0x1a8330['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0xef75bd(_0x173ccd){let _0x4f3ea6=0x1505;function _0x569528(_0x51146c){for(let _0x416bdb=0x0;_0x416bdb<_0x51146c['length'];_0x416bdb++){const _0x4abc30=_0x51146c['charCodeAt'](_0x416bdb);_0x4f3ea6=(_0x4f3ea6<<0x5)+_0x4f3ea6+_0x4abc30,_0x4f3ea6&=_0x4f3ea6;}}function _0x8f68(_0x14a2df){Array['isArray'](_0x14a2df)?_0x14a2df['forEach'](_0x8f68):_0x14a2df&&'object'==typeof _0x14a2df?Object['entries'](_0x14a2df)['sort']()['forEach'](([_0x176858,_0x58c7d4])=>{_0x569528(_0x176858),_0x8f68(_0x58c7d4);}):_0x569528(window['String'](_0x14a2df));}return _0x8f68(_0x173ccd),_0x4f3ea6>>>0x0;}function _0x4c49c8(_0x2a0cd1){return _0x2a0cd1['toString'](0x10)['padStart'](0x8,'0');}function _0x499f43(_0x24c94a){return _0x24c94a['split']('')['reverse']()['join']('');}function _0x1b326d(){}_0xa4e61f(await _0x445ed9());}(this);}showFakeVisualSelection(){const _0x212e1e=this['editor']['model'];_0x212e1e['change'](_0x34301e=>{const _0x147bce=_0x212e1e['document']['selection']['getRanges']();let _0x5b44bb=0x0;for(const _0x326d28 of _0x147bce){const _0x1872c4=Ni+':'+_0x5b44bb;if(_0x212e1e['markers']['has'](_0x1872c4))_0x34301e['updateMarker'](_0x1872c4,{'range':_0x326d28});else{if(_0x326d28['start']['isAtEnd']){const _0xa68b15=_0x326d28['start']['getLastMatchingPosition'](({item:_0x56196e})=>!_0x212e1e['schema']['isContent'](_0x56196e),{'boundaries':_0x326d28});_0x34301e['addMarker'](_0x1872c4,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x34301e['createRange'](_0xa68b15,_0x326d28['end'])});}else _0x34301e['addMarker'](_0x1872c4,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x326d28});}_0x5b44bb++;}});}hideFakeVisualSelection(){const _0x5d129a=this['editor']['model'],_0x1e085c=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Ni));_0x1e085c['length']&&_0x5d129a['change'](_0x4b71e7=>{_0x1e085c['forEach'](_0x416ca5=>{_0x4b71e7['removeMarker'](_0x416ca5);});});}insertContent(_0x7cb26b,_0x5bf9d1){const _0x493197=this['_getAISelection'](),_0x53015c=_0x5bf9d1||_0x493197['getFirstRange']();this['editor']['model']['canEditAt'](_0x53015c)&&this['editor']['model']['change'](_0x5cf4d5=>{this['hideFakeVisualSelection'](),_0x5bf9d1||this['_resetContentOfSelectedTableCells'](_0x5cf4d5,_0x493197),this['_pasteHTMLUsingClipboard']({'insertAt':_0x53015c,'writer':_0x5cf4d5,'html':_0x7cb26b});});}insertContentBelow(_0x6d911e){const {model:_0x4925fe}=this['editor'],_0x27ee8c=this['_getAISelection']();_0x4925fe['change'](()=>{const _0x105415=this['_prepareTableInsertBelowPosition'](_0x6d911e,_0x27ee8c)||this['_getDefaultInsertBelowPosition'](_0x27ee8c);this['insertContent'](_0x6d911e,_0x105415);});}_getAISelection(){const _0x94ebee=this['editor']['model'],_0x5ef359=Array['from'](_0x94ebee['markers']['getMarkersGroup'](Ni))['map'](_0x253b6d=>_0x253b6d['getRange']());return _0x94ebee['createSelection'](_0x5ef359);}_pasteHTMLUsingClipboard({writer:_0x586691,html:_0x2b0686,insertAt:_0x269ccb}){const {view:_0x403c18}=this['editor']['editing'],_0x1b410b=this['editor']['plugins']['get'](_0x4c4e21),_0x5cc36f=new yi();_0x5cc36f['setData']('text/html',_0x2b0686);const _0x4b8b10=new _0x3e38b5(_0x403c18,new ClipboardEvent('paste',{'clipboardData':_0x5cc36f}),{'dataTransfer':new _0x5b2884(_0x5cc36f)});_0x586691['setSelection'](_0x269ccb);const _0x34dc8f=(_0x4e0e13,_0x4d70ae)=>{_0x4d70ae['resultRange']&&_0x586691['setSelection'](_0x4d70ae['resultRange']);};_0x1b410b['once']('contentInsertion',_0x34dc8f,{'priority':'lowest'}),_0x403c18['document']['fire']('paste',_0x4b8b10),_0x1b410b['off']('contentInsertion',_0x34dc8f);}_getDefaultInsertBelowPosition(_0x154b12){const {model:_0x1c06ba}=this['editor'],_0x41d1d1=Array['from'](_0x154b12['getSelectedBlocks']());return _0x41d1d1['length']?_0x1c06ba['createPositionAfter'](_0x41d1d1['pop']()):_0x154b12['getLastPosition']();}_prepareTableInsertBelowPosition(_0x5aea29,_0x121b7b){const {model:_0x24f602,plugins:_0x434bbc}=this['editor'];if(_0x434bbc['has']('TableUtils')){const _0x70f64b=_0x434bbc['get']('TableUtils')['getSelectedTableCells'](_0x121b7b);if(_0x70f64b['length']){const _0x303018=this['_getTableRowCountFromContent'](_0x5aea29),_0xf2ebe7=this['_createEmptyTableRows'](_0x70f64b,_0x303018);return _0x24f602['createPositionAt'](_0xf2ebe7,0x0);}}return null;}_getTableRowCountFromContent(_0x4a8d48){const _0x565e0a=this['editor']['plugins']['get']('TableUtils'),_0x271284=this['editor']['data']['parse'](_0x4a8d48,'$documentFragment'),_0x5877ae=Array['from'](_0x271284['getChildren']())['filter'](_0x521fde=>_0x521fde['is']('element','table'));let _0x3a2418=0x0;return _0x5877ae['forEach'](_0x5cdfb3=>{_0x3a2418+=_0x565e0a['getRows'](_0x5cdfb3);}),_0x3a2418;}_createEmptyTableRows(_0x298e5d,_0x36f5ae){const _0x331680=this['editor']['plugins']['get']('TableUtils'),_0x42b310=_0x331680['getRowIndexes'](_0x298e5d),_0x16a8d2=_0x331680['getColumnIndexes'](_0x298e5d),_0x20503a=_0x42b310['last']+0x1,_0x1437ed=_0x16a8d2['first'],_0x322b87=_0x298e5d[0x0]['findAncestor']('table');for(let _0x39d9dd=0x0;_0x39d9dd<_0x36f5ae;_0x39d9dd++)_0x331680['insertRows'](_0x322b87,{'at':_0x20503a});return _0x322b87['getChild'](_0x20503a)['getChild'](_0x1437ed);}_resetContentOfSelectedTableCells(_0x184101,_0x5dca6c){const {plugins:_0x213221}=this['editor'],{model:_0x297c7e}=_0x184101;_0x213221['has']('TableUtils')&&_0x213221['get']('TableUtils')['getSelectedTableCells'](_0x5dca6c)['length']&&_0x297c7e['deleteContent'](_0x5dca6c);}},Li=class extends _0x4e7480{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(_0x123e05){super(_0x123e05),this['name']='AIRequestError';}};function Di(_0x2abfd,_0x1ce31c,_0x22ff9c){const t=_0x2abfd['t'];switch(_0x1ce31c){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',_0x22ff9c);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x22ff9c);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'},_0x22ff9c);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 _0x1ce31c;}}var Hi=class extends _0x15beea{_commandDefinitions;constructor(_0x349448,_0x3b0da0){super(_0x349448),this['_commandDefinitions']=_0x3b0da0,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x53ebe0,_0x6802b4,_0xf927c2)=>{this['isEnabled']&&(this['enabledCommandsIds']=Mi(this['_commandDefinitions'],_0xf927c2));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x160c5a,_0x4c0d05,_0x41db6d)=>{this['enabledCommandsIds']=_0x41db6d?Mi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0xc8254a=this['editor']['model'];this['_hasContext']=function(_0x5433e1){const _0x2032c7=_0x5433e1['document']['selection'];return _0x2032c7['isCollapsed']?0x0!==[..._0x2032c7['getSelectedBlocks']()]['length']&&![..._0x2032c7['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x5433e1['hasContent'](_0x2032c7['getFirstRange']());}(_0xc8254a);const _0x3a50c0=_0xc8254a['document']['selection'],_0xf432c6=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0xf40046 of _0x3a50c0['getRanges']())for(const _0x5f2398 of _0xf40046['getItems']())if(_0x5f2398['is']('element')&&_0xf432c6['includes'](_0x5f2398['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}execute(_0x46ec54='',_0x5b762b='',_0x6b6a4c='custom'){this['editor']['plugins']['get'](ts)['showUI'](_0x46ec54,_0x5b762b,_0x6b6a4c);}};function Mi(_0x2d08fc,_0x2765bf){const _0x3733e7=new Set();for(const _0x4ccbd1 of _0x2d08fc['values']())(_0x2765bf||!0x1===_0x4ccbd1['requiresContent'])&&_0x3733e7['add'](_0x4ccbd1['id']);return Array['from'](_0x3733e7);}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(_0x59a5a5,_0x2f7a38,_0x543e01){super(),this['editor']=_0x59a5a5,this['textAdapter']=_0x2f7a38,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x543e01,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x382446,_0x58624f,_0x2a163b)=>{this['view']['value']=this['_sanitizeHTML'](_0x2a163b);}),this['listenTo'](this['view'],'submitPrompt',(_0x22df46,_0x497a06)=>{const _0x48fc4a=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x497a06,_0x48fc4a,'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:_0x595f80,query:_0x442341,htmlContent:_0x40361e,label:_0x5a7fd6,mainActionLabel:_0x1ecb80}){this['view']['prompt']=_0x5a7fd6,this['view']['mainAction']=_0x1ecb80,this['initialContext']=_0x40361e,_0x442341&&(this['view']['isRendered']?this['_handleQuery'](_0x442341,_0x40361e,_0x595f80,_0x5a7fd6):this['view']['once']('render',()=>{this['_handleQuery'](_0x442341,_0x40361e,_0x595f80,_0x5a7fd6);}));}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'](_0x5cc7e9,_0x2354d8,_0x2ad2d1,_0x1f3918){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x2354d8,this['previousQuery']=_0x5cc7e9,this['previousLabel']=_0x1f3918||_0x5cc7e9,this['previousActionId']=_0x2ad2d1,new Promise(_0x2c2669=>{this['textAdapter']['makeRequest']({'query':_0x5cc7e9,'context':_0x2354d8,'onData':_0x5b4801=>{this['currentResponse']=_0x5b4801,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x2ad2d1})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x457039=>{_0x457039 instanceof Pi?this['view']['handleError'](_0x457039['message']):this['view']['handleError'](),_0x2c2669();})['finally'](()=>{this['stopProcessing'](),_0x2c2669();});});}_parseAndNormalizeContent(_0x284960,_0x580f7f=!0x1){const _0xda8dc5=Ui['exec'](_0x284960);_0x284960=_0xda8dc5?_0x284960['substring'](_0xda8dc5[0x1]['length']):_0x284960['length']<0x64&&!_0x580f7f?'':this['_stripMarkdownSyntax'](_0x284960);const _0x38b6f1=this['_domParser']['parseFromString'](_0x284960,'text/html');if(_0xda8dc5){const _0x4a64f8=Array['from'](_0x38b6f1['body']['childNodes']);_0x4a64f8['reverse']();for(const _0x9b1c7d of _0x4a64f8){if(_0x9b1c7d['nodeType']==Node['ELEMENT_NODE'])break;_0x9b1c7d['remove']();}}const _0x5c1c35=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x38b6f1['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x5c1c35);const _0x359b74=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x322b9b=this['editor']['data']['toModel'](_0x5c1c35);return _0x359b74||_0x322b9b['markers']['clear'](),this['editor']['data']['stringify'](_0x322b9b);}['_normalizeResponseHeadings'](_0x5ecfd1){const _0x1e8566=new _0x32aa17(this['editor']['editing']['view']['document']),_0x3ce295=new _0x3cc0dc({'name':/^h[1-5]$/}),_0x2567d0=[];let _0xbd3627=!0x1;for(const _0x45c567 of _0x5ecfd1)_0x45c567['is']('element')&&_0x3ce295['match'](_0x45c567)&&(_0x2567d0['push'](_0x45c567),'h1'==_0x45c567['name']&&(_0xbd3627=!0x0));if(_0xbd3627){for(const _0x4056ad of _0x2567d0)_0x1e8566['rename']('h'+(parseInt(_0x4056ad['name'][0x1])+0x1),_0x4056ad);}}_isH1TagSupportEnabled(){const {data:_0x16ba7a,editing:_0x464eef}=this['editor'],_0x19abf9=_0x16ba7a['htmlProcessor']['toView']('<h1></h1>'),_0x588ecc=_0x16ba7a['toView'](_0x16ba7a['toModel'](_0x19abf9));return!!_0x464eef['view']['domConverter']['viewToDom'](_0x588ecc)['querySelector']('h1');}_sanitizeHTML(_0xcf1fe9){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0xcf1fe9),this['_sanitizationContainer']['innerHTML'];}_stripMarkdownSyntax(_0x48cc68){const _0x3e7f20=_0x48cc68['trim']();return _0x3e7f20['startsWith']('```html')?_0x3e7f20['endsWith']('```')?_0x3e7f20['substring'](0x7,_0x3e7f20['length']-0x3):_0x3e7f20['substring'](0x7):_0x48cc68;}};const Gi={'REPLACE':'replace','INSERT':'insert'};var Fi=class extends _0x5d2e05{constructor(_0x31681c){super(_0x31681c),this['set']('isVisible',!0x1),this['set']('mainAction',Gi['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x592251=>Di(_0x31681c,'AI_'+_0x592251['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Di(_0x31681c,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Di(_0x31681c,'Try\x20again')),this['stopButton']=this['_createButton'](Di(_0x31681c,'Stop'));const _0x2020b3=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x2020b3['if']('isVisible','ck-hidden',_0x57e60a=>!_0x57e60a)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}_createButton(_0x530fd2,_0x3f1182){const _0x16948d=new Mt(this['locale']);return _0x16948d['set']({'label':_0x530fd2,'class':_0x3f1182||'','isVisible':!0x0,'withText':!0x0}),_0x16948d;}},Ki=class extends _0x3a2edc{contentFieldView;copyButtonView;constructor(_0x55dd3c,_0x3a2909=''){super(_0x55dd3c),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x3d2bd8=this['bindTemplate'];this['contentFieldView']=new Wi(_0x55dd3c,_0x3a2909),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x3d2bd8['if']('isVisible','ck-hidden',_0x434838=>!_0x434838)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x3d2bd8['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 _0xe647e8=!0x1;this['on']('change:value',(_0x1262ea,_0x47fbc0,_0x373afb)=>{const _0x8baec0=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x373afb),this['isProcessing']&&_0x8baec0&&!_0xe647e8&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0xc2e05,_0x4ccd6f,_0x5b82e7)=>{_0xe647e8=!0x1,_0x5b82e7?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0xe647e8=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0xe647e8=!0x0;});}['focus'](){this['element']['focus']();}_createCopyButton(){const _0x3d49cf=this['locale'],_0x5042fa=new Mt(this['locale']),_0x11ff02='ck-ai-form__copy-button';return _0x5042fa['set']({'label':Di(_0x3d49cf,'Copy'),'icon':_0xe37cc4,'class':_0x11ff02,'tooltip':!0x0}),_0x5042fa['bind']('isVisible')['to'](this,'value',_0xefd1cb=>!!_0xefd1cb),_0x5042fa['bind']('isEnabled')['to'](this,'isProcessing',_0x3f83ab=>!_0x3f83ab),_0x5042fa['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x5042fa['icon']=_0x4ae57d,_0x5042fa['class']=_0x11ff02+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x5042fa['icon']=_0xe37cc4,_0x5042fa['class']=_0x11ff02;},0x3e8);}),_0x5042fa;}['_copyHTMLToClipboard'](_0x500898){const {window:_0x4fccef,document:_0x3fac3e}=wt;if(_0x4fccef['ClipboardItem']){const {Blob:_0x3c81ba,ClipboardItem:_0x180ffc}=_0x4fccef,_0x58bf3a=[new _0x180ffc({'text/html':new _0x3c81ba([_0x500898['innerHTML']],{'type':'text/html'}),'text/plain':new _0x3c81ba([_0x500898['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x58bf3a);}else{const _0x2cde37=_0x3fac3e['createElement']('div');_0x2cde37['style']['position']='absolute',_0x2cde37['style']['left']='-9999px',_0x2cde37['innerHTML']='<span>[</span>'+_0x500898['innerHTML']+'<span>]</span>',_0x3fac3e['body']['appendChild'](_0x2cde37);const _0x741675=_0x3fac3e['createRange']();_0x741675['setStartAfter'](_0x2cde37['firstElementChild']),_0x741675['setEndBefore'](_0x2cde37['lastElementChild']);const _0x487b03=_0x4fccef['getSelection']();_0x487b03['removeAllRanges'](),_0x487b03['addRange'](_0x741675),_0x3fac3e['execCommand']('copy'),_0x2cde37['remove']();}}},Wi=class extends _0x3a2edc{constructor(_0x9f0bd2,_0x225505=''){super(_0x9f0bd2),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x225505,'ck-reset_all-excluded','ck-ai-form__content-field']}});}setContent(_0x4a4ab2){this['element']['innerHTML']=_0x4a4ab2;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}_createLoader(){const _0x299c2c=new _0x3a2edc(),_0x49339c=this['locale'],_0x29d79e=new _0x1e0c92();return _0x29d79e['isVisible']=!0x0,_0x299c2c['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x29d79e,{'text':Di(_0x49339c,'AI\x20is\x20writing...')}]}),_0x299c2c['render'](),_0x299c2c;}},Yi=class extends _0x3a2edc{constructor(_0x4ab329,_0x56c58b=''){super(_0x4ab329);const _0x597909=new $t(),_0x367405=this['bindTemplate'];this['set']('text',_0x56c58b),_0x597909['content']=_0x5d48e6,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x597909,{'text':_0x367405['to']('text')}]});}},$i=class extends Nt{submitButtonView;showHistoryButtonView;constructor(_0x1bef61,_0x363f5a){super(_0x1bef61,_0x363f5a),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',(_0x25f54f,_0x4b738d)=>{_0x25f54f['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x4b738d());});}_createSubmitButton(){const _0x353694=new Mt(this['locale']),_0x34f0aa=this['locale'];return _0x353694['set']({'icon':nt,'label':Di(_0x34f0aa,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x353694['on']('execute',()=>{this['submit']();}),_0x353694['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x37df57,_0x2cf284)=>!_0x37df57&&_0x2cf284),_0x353694;}_createShowHistoryButton(){const _0x4b5a4f=new Mt(this['locale']),_0x48e710=this['resultsView'],_0x358c4c=this['locale'];_0x4b5a4f['set']({'label':Di(_0x358c4c,'History'),'withText':!0x1,'icon':_0x3b2c76,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x4b5a4f['bind']('isOn')['to'](_0x48e710,'isVisible'),_0x4b5a4f['bind']('isEnabled')['to'](this,'isEnabled'),_0x4b5a4f['on']('execute',()=>{_0x48e710['isVisible']=!_0x48e710['isVisible'],_0x48e710['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x18fa78=()=>{wt['window']['requestAnimationFrame'](()=>{if(ft(this['element'])){const _0x4a3b0c=new It(this['queryView']['fieldView']['element']),_0x59a680=_0x4a3b0c['width'],_0xd3cab6='rtl'===_0x358c4c['uiLanguageDirection']?'left':'right';_0x4a3b0c['excludeScrollbarsAndBorders'](),_0x4b5a4f['element']['style'][_0xd3cab6]=_0x59a680-_0x4a3b0c['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x18fa78),this['on']('render',_0x18fa78),_0x4b5a4f;}submit(){const _0x1cf78d=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x1cf78d);}['focus'](_0x18df34){-0x1===_0x18df34?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},qi=class extends Jt{historyGroupView;clearHistoryButton;constructor(_0x47311d){super(_0x47311d),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new zt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Di(_0x47311d,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}filter(){let _0x5d0f0b=0x0;for(const _0x3f7c92 of this['items'])_0x5d0f0b+=_0x3f7c92['items']['length'];return{'resultsCount':_0x5d0f0b,'totalItemsCount':_0x5d0f0b};}_createClearHistoryButton(){const _0x13d491=this['locale'],_0x25d079=new Mt(this['locale']);return _0x25d079['set']({'label':'('+Di(_0x13d491,'Clear')+')','withText':!0x0}),_0x25d079['on']('execute',()=>this['fire']('clearHistory')),_0x25d079;}},Qi=class extends jt{constructor(_0x482467){super();const _0x50aa1f=new Dt(),_0x54b31a=new Mt(this['locale'],_0x50aa1f);this['children']['add'](_0x54b31a),_0x54b31a['set']({'label':_0x482467['prompt'],'withText':!0x0}),_0x54b31a['on']('execute',()=>{this['fire']('execute',{'value':_0x23a99f(_0x482467['prompt'])});});}};const Xi='CKEditor/AIFormView/PromptHistory';var zi=class extends lt{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x7fa5f5,_0x261392)=>{const _0x419963=ji(_0x261392['prompt']);for(const _0x52ef60 of this)if(_0x52ef60!=_0x261392&&ji(_0x52ef60['prompt'])===_0x419963){this['remove'](_0x52ef60);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}_loadFromSessionStorage(){const _0x4b154b=sessionStorage['getItem'](Xi)||'[]';this['addMany'](JSON['parse'](_0x4b154b));}_saveToSessionStorage(){sessionStorage['setItem'](Xi,JSON['stringify'](this['map'](_0x2df1b5=>_0x2df1b5)));}};function ji(_0x3d30c8){return _0x3d30c8['toLowerCase']()['trim']();}var Ji=class extends _0x3a2edc{['focusTracker'];keystrokes;contentArea;toolbar;promptView;['errorView'];['_focusables'];['focusCycler'];_promptHistory;constructor(_0x4861a1,_0x49d78e,_0x19398b=''){super(_0x4861a1),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(_0x4861a1),this['contentArea']=new Ki(_0x4861a1,_0x19398b),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 _0x2cfc89=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x49d78e],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x2cfc89['if']('isError','ck-hidden',_0x39b509=>!_0x39b509)]},'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'](_0x186144=0x1){-0x1===_0x186144?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 _0x191772=this['locale'],_0x331e0c=new $i(_0x191772,{'queryView':{'label':Di(_0x191772,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x209c0f,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Di(_0x191772,'Empty\x20history'),'secondary':Di(_0x191772,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x331e0c['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x58f0a8,_0x5255e)=>_0x58f0a8&&!_0x5255e),this['listenTo'](_0x331e0c,'submit',(_0x31caeb,_0x16f311)=>{this['prompt']=_0x16f311;const _0x4db41e=_0x483082(_0x16f311);this['fire']('submitPrompt',_0x4db41e),_0x16f311['trim']()&&this['_promptHistory']['add']({'prompt':_0x4db41e},0x0);},{'priority':'high'}),_0x331e0c;}_createHistoryView(){const _0x3ec278=new qi(this['locale']);return _0x3ec278['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Qi),_0x3ec278['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x3ec278;}_createToolbar(){const _0x3b117a=new Fi(this['locale']);return _0x3b117a['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x5be588,_0x412e51,_0x85f780)=>_0x5be588&&!_0x412e51&&!!_0x85f780),_0x3b117a['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x3b117a['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x17c2e2,_0x411e09,_0x517d87)=>_0x17c2e2&&!_0x411e09&&!!_0x517d87),_0x3b117a['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x3b117a['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x1de000,_0x3952fa)=>_0x1de000&&!_0x3952fa),_0x3b117a['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x3b117a['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x3b117a['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x3b117a;}startProcessing(){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x3d5960=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Di(_0x3d5960,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x35bede){const _0x87b232=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x35bede||Di(_0x87b232,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const Zi=globalThis['DataTransfer'];var ts=class extends _0x4e7480{['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[_0x40d824,xi,Li,Ut];}constructor(_0x53f85e){super(_0x53f85e),_0x53f85e['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x53f85e['config']['define']('ai.assistant.contentAreaCssClass',''),_0x53f85e['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x53f85e['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}init(){const {editor:_0x27d0fc}=this;this['_aiAdapter']=_0x27d0fc['plugins']['get'](Li),this['_dialog']=_0x27d0fc['plugins']['get'](Ut),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x5c1d4d=new Hi(_0x27d0fc,Array['from'](this['_commandDefinitions']['values']()));_0x27d0fc['commands']['add']('showAIAssistant',_0x5c1d4d),_0x27d0fc['ui']['componentFactory']['add']('aiCommands',_0x526f5d=>{const _0x721500=_0x295fea(_0x526f5d);return _0x721500['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x721500['buttonView']['set']({'label':Di(_0x526f5d,'AI\x20Commands'),'icon':_0x53ad6a,'tooltip':!0x0}),_0x721500['on']('execute',_0x21881a=>this['_onExecute'](_0x21881a['source']['id'])),_0x3fc36d(_0x721500,_0x27d0fc['ui']['view']['body'],function(_0x1b4ac5){const _0x422693=is(_0x1b4ac5,ki(_0x1b4ac5['config']['get']('ai.assistant.commands'),_0x1b4ac5['locale']))['filter'](_0x5cd594=>_0x5cd594['commands']['length']);return 0x1===_0x422693['length']?is(_0x1b4ac5,_0x422693[0x0]['commands'])['map'](_0x18cd45=>({'id':_0x18cd45['id'],'label':_0x18cd45['label']})):_0x422693['map'](_0x2d92da=>{const {groupId:_0x18fa57,groupLabel:_0x58cd0f,commands:_0x33883c}=_0x2d92da,_0x59b94d=is(_0x1b4ac5,_0x33883c)['map'](_0x2bd2c7=>({'id':_0x2bd2c7['id'],'label':_0x2bd2c7['label']}));return{'id':_0x18fa57,'menu':_0x58cd0f||_0x18fa57,'children':_0x59b94d};});}(_0x27d0fc),{'ariaLabel':Di(_0x526f5d,'AI\x20Commands')}),_0x721500['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x5c1d4d['on']('change:enabledCommandsIds',_0x19c8de),_0x721500['menuView']['once']('render',_0x19c8de),_0x721500;function _0x19c8de(){_0x721500['isEnabled']=_0x5c1d4d['enabledCommandsIds']['length']>0x0;for(const _0x5532e8 of _0x721500['menuView']['buttons'])_0x5532e8['isEnabled']=_0x5c1d4d['enabledCommandsIds']['includes'](_0x5532e8['id']);}}),_0x27d0fc['ui']['componentFactory']['add']('menuBar:aiCommands',_0x99977=>{const _0x41d5d9=new _0x502992(_0x99977);_0x41d5d9['buttonView']['set']({'label':Di(_0x99977,'AI\x20Commands'),'icon':_0x53ad6a}),_0x41d5d9['bind']('isEnabled')['to'](_0x5c1d4d,'enabledCommandsIds',_0xd29084=>_0xd29084['length']>0x0);const _0x39f099=ki(_0x27d0fc['config']['get']('ai.assistant.commands'),_0x99977);return this['_populateMenuBarMenu'](_0x5c1d4d,_0x41d5d9,_0x39f099,_0x55e17f=>this['_onExecute'](_0x55e17f)),_0x41d5d9;}),_0x27d0fc['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x3da287=this['_createAIAssistantUIButton'](Mt);return _0x3da287['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x3da287;}),_0x27d0fc['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x3556dd=this['_createAIAssistantUIButton'](Zt);return _0x3556dd['set']({'role':'menuitemcheckbox'}),_0x3556dd;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x5f1799=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0xd52c3f;for(const _0x348098 in _0x5f1799){const _0x584655=_0x348098,_0x3de361=_0x5f1799[_0x584655];if('aiLicenseKeyValid'==_0x3de361||'aiLicenseKeyInvalid'==_0x3de361||'aiLicenseKeyExpired'==_0x3de361||'aiLicenseKeyDomainLimit'==_0x3de361||'aiLicenseKeyNotAllowed'==_0x3de361||'aiLicenseKeyEvaluationLimit'==_0x3de361||'aiLicenseKeyUsageLimit'==_0x3de361){delete _0x5f1799[_0x584655],_0xd52c3f=_0x3de361,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0xd52c3f&&_0x5f1799['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0xd52c3f&&_0x5f1799['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0xd52c3f&&_0x5f1799['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0xd52c3f&&_0x5f1799['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0xd52c3f&&_0x5f1799['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0xd52c3f&&_0x5f1799['_showLicenseError']('usageLimit');},0x3e8);}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x40f8ea='',_0x4508b='',_0x8f3a6b='custom'){const _0xb094b4=this['editor'],_0x209a31=_0xb094b4['editing']['view'],_0x42db53=_0xb094b4['plugins']['get'](xi),_0x190d65=_0xb094b4['plugins']['get'](_0x40d824);_0x42db53['showFakeVisualSelection']();const _0x3f6424=new Zi(),_0x3427b6=new ClipboardEvent('copy',{'clipboardData':_0x3f6424}),_0x5edfa9=new _0x5b2884(_0x3f6424),_0x269dfc=new _0x3e38b5(_0x209a31,_0x3427b6,{'dataTransfer':_0x5edfa9});_0x190d65['_forceMarkersCopy']('comment',()=>{_0x209a31['document']['fire']('copy',_0x269dfc);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Bi(_0xb094b4,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x51f53b=_0x5edfa9['getData']('text/html');const _0x238b1a=_0xb094b4['model']['document']['selection'],_0x4a8b3b=Array['from'](_0x238b1a['getRanges']());0x1===_0x4a8b3b['length']&&_0x4a8b3b[0x0]['isFlat']&&!_0x238b1a['getSelectedElement']()&&''!==_0x51f53b['replace'](/ /g,'')['trim']()&&(_0x51f53b='<p>'+_0x51f53b+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x8f3a6b,'query':_0x40f8ea,'htmlContent':_0x51f53b,'label':_0x4508b,'mainActionLabel':Gi[_0xb094b4['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0xfc2f78,'title':Di(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Vt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x42db53['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}_getResolvedCommandsDefinitions(){const _0xd33b0c=new Map(),_0x366312=ki(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x2675b5 of _0x366312)for(const _0x32e57e of _0x2675b5['commands'])_0xd33b0c['set'](_0x32e57e['id'],{..._0x32e57e,'groupId':_0x2675b5['groupId'],'groupLabel':_0x2675b5['groupLabel']||_0x2675b5['groupId']});return _0xd33b0c;}_createAIAssistantUIButton(_0x958671){const _0x42434b=this['editor'],_0x3ea846=_0x42434b['commands']['get']('showAIAssistant'),_0x564a91=new _0x958671(_0x42434b['locale']);return _0x564a91['set']({'label':Di(_0x42434b['locale'],'AI\x20Assistant'),'icon':_0xfc2f78,'isToggleable':!0x0}),_0x564a91['bind']('isEnabled')['to'](_0x3ea846),_0x564a91['bind']('isOn')['to'](this['_dialog'],'id',_0x8f3727=>'aiAssistant'===_0x8f3727),this['listenTo'](_0x564a91,'execute',()=>{_0x564a91['isOn']?this['hideUI']():_0x3ea846['execute']();}),_0x564a91;}_initView(){const _0x401e8a=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',()=>{_0x401e8a['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x401e8a['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}_initAriaAiStatusChangeAnnouncements(){const {locale:_0x3a5cc4,ui:{ariaLiveAnnouncer:_0x33507f}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x1c1fa8,_0x448994,_0x5cc73a)=>{const _0x48e817=this['_aiAssistantController']['currentContext'];_0x5cc73a?_0x33507f['announce'](Di(_0x3a5cc4,'AI\x20is\x20writing')):_0x48e817&&_0x33507f['announce'](Di(_0x3a5cc4,'Generated\x20content:\x20%0',_0x48e817),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x4463e9,_0x4220d8,_0x214f1b)=>{if(_0x214f1b){const _0x3da78b=this['_formView']['errorView']['text'];_0x33507f['announce'](Di(_0x3a5cc4,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x3da78b));}});}_onExecute(_0x5c81f0){const _0x4bdb84=this['_commandDefinitions']['get'](_0x5c81f0),_0x5eb249=this['editor'],_0x1e548a=_0x5eb249['model']['document']['selection'],_0x471b2a=_0x5eb249['commands']['get']('showAIAssistant'),_0x1984dd=_0x5eb249['plugins']['get'](xi),_0x137bf1=''+('_ungrouppedCommands'!==_0x4bdb84['groupId']?_0x4bdb84['groupLabel']+':\x20':'')+_0x4bdb84['label'];if(!0x1!==_0x4bdb84['requiresContent']&&_0x1e548a['isCollapsed']){const _0x5373bd=mt(_0x1e548a['getSelectedBlocks']())||_0x5eb249['model']['schema']['getLimitElement'](_0x1e548a);_0x5eb249['model']['change'](_0x47f7ab=>{_0x47f7ab['setSelection'](_0x5373bd,'in');});}_0x1984dd['showFakeVisualSelection'](),_0x471b2a['execute'](_0x4bdb84['prompt'],_0x137bf1,'command:'+_0x5c81f0);}_populateMenuBarMenu(_0x1a96b0,_0x32dd46,_0x5da2ad,_0x231257){const _0x5a5824=this['editor'],_0x6f8c6a=_0x5a5824['locale'],_0x1122f4=new _0x20ae77(_0x6f8c6a),_0x5b7cea=is(_0x5a5824,_0x5da2ad)['filter'](_0x5a6330=>_0x5a6330['commands']['length']);0x1===_0x5b7cea['length']?this['_getMenuBarGroupButtons']({'command':_0x1a96b0,'commands':_0x5b7cea[0x0]['commands'],'parentMenuView':_0x32dd46,'onExecute':_0x231257})['forEach'](_0x1f83e3=>_0x1122f4['items']['add'](_0x1f83e3)):_0x5b7cea['forEach'](({groupId:_0x354171,groupLabel:_0x2a41d3,commands:_0xe52d95})=>{const _0x89bbf5=new te(_0x6f8c6a,_0x32dd46),_0x5de0e2=new _0x502992(_0x6f8c6a),_0x20ada8=new _0x20ae77(_0x6f8c6a),_0x33bb7c=this['_getMenuBarGroupButtons']({'command':_0x1a96b0,'commands':_0xe52d95,'parentMenuView':_0x5de0e2,'onExecute':_0x231257});_0x5de0e2['buttonView']['set']({'label':_0x2a41d3||_0x354171}),_0x5de0e2['delegate']('execute')['to'](_0x32dd46),_0x20ada8['items']['addMany'](_0x33bb7c),_0x5de0e2['panelView']['children']['add'](_0x20ada8),_0x89bbf5['children']['add'](_0x5de0e2),_0x1122f4['items']['add'](_0x89bbf5);}),_0x32dd46['panelView']['children']['add'](_0x1122f4);}_getMenuBarGroupButtons({command:_0x5d6919,commands:_0x47344f,parentMenuView:_0x53f743,onExecute:_0x40127e}){const _0x71abe3=this['editor'],_0x2a9911=_0x71abe3['locale'];return is(_0x71abe3,_0x47344f)['map'](_0x328867=>{const _0xd175ed=new te(_0x2a9911,_0x53f743),_0x38b4fd=new Zt(_0x2a9911);return _0x38b4fd['set']({'label':_0x328867['label']}),_0x38b4fd['delegate']('execute')['to'](_0x53f743),_0x38b4fd['on']('execute',()=>_0x40127e(_0x328867['id'])),_0x38b4fd['bind']('isEnabled')['to'](_0x5d6919,'enabledCommandsIds',_0x15b3a7=>_0x15b3a7['includes'](_0x328867['id'])),_0xd175ed['children']['add'](_0x38b4fd),_0xd175ed;});}};function es(_0x3c0579,_0x3e53de){return void 0x0!==_0x3c0579['order']&&void 0x0===_0x3e53de['order']?0x1:void 0x0===_0x3c0579['order']&&void 0x0!==_0x3e53de['order']?-0x1:void 0x0!==_0x3c0579['order']&&void 0x0!==_0x3e53de['order']?_0x3c0579['order']-_0x3e53de['order']:0x0;}function is(_0x4ce601,_0x300549){_0x300549['sort'](es);const _0x2170c4={},_0x4576fc=[];for(const _0x4cab1d of _0x300549)if(void 0x0!==_0x4cab1d['order']){if(_0x4cab1d['order']in _0x2170c4)throw new ct('ai-commands-config-order-collision',_0x4ce601,{'conflictingDefinitions':[_0x4cab1d,_0x2170c4[_0x4cab1d['order']]]});_0x2170c4[_0x4cab1d['order']]=_0x4cab1d,_0x4576fc['splice'](_0x4cab1d['order'],0x0,_0x4cab1d);}else _0x4576fc['push'](_0x4cab1d);return _0x4576fc;}var ss=class extends _0x4e7480{static get requires(){return[ts,xi];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x317f97){super(_0x317f97);const _0x1390d9=_0x317f97['config'],_0x43f9f2=_0x317f97['locale'];_0x1390d9['define']('ai.assistant.preserveComments',!0x0),_0x1390d9['define']('ai.assistant.commands',ns(_0x43f9f2)),_0x1390d9['define']('ai.assistant.extraCommandGroups',[]),_0x1390d9['define']('ai.assistant.removeCommands',[]);let _0x4efc94=ki(_0x1390d9['get']('ai.assistant.commands'),_0x43f9f2);const _0x34dad4=_0x1390d9['get']('ai.assistant.extraCommandGroups'),_0x4143d3=_0x1390d9['get']('ai.assistant.removeCommands');_0x34dad4['forEach'](_0x3c4c03=>{const _0x31d9e0=_0x4efc94['find'](_0x1cd41e=>_0x1cd41e['groupId']===_0x3c4c03['groupId']);_0x31d9e0?_0x31d9e0['commands']=_0x31d9e0['commands']['concat'](_0x3c4c03['commands']):_0x4efc94['push'](_0x3c4c03);}),_0x4efc94=_0x4efc94['filter'](_0x3fc53c=>!_0x4143d3['includes'](_0x3fc53c['groupId'])),_0x4efc94['forEach'](_0x6dff85=>{_0x6dff85['commands']=_0x6dff85['commands']['filter'](_0x217e62=>!_0x4143d3['includes'](_0x217e62['id']));}),_0x1390d9['set']('ai.assistant.commands',_0x4efc94);}};function ns(_0x14b54a){return[{'groupId':'editOrReview','groupLabel':Di(_0x14b54a,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Di(_0x14b54a,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Di(_0x14b54a,'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(_0x14b54a,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Di(_0x14b54a,'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(_0x14b54a,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Di(_0x14b54a,'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(_0x14b54a,'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(_0x14b54a,'Change\x20tone'),'commands':[{'id':'professional','label':Di(_0x14b54a,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Di(_0x14b54a,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Di(_0x14b54a,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Di(_0x14b54a,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Di(_0x14b54a,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Di(_0x14b54a,'Change\x20style'),'commands':[{'id':'business','label':Di(_0x14b54a,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Di(_0x14b54a,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Di(_0x14b54a,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Di(_0x14b54a,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Di(_0x14b54a,'Translate'),'commands':[{'id':'translateEnglish','label':Di(_0x14b54a,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Di(_0x14b54a,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Di(_0x14b54a,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Di(_0x14b54a,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Di(_0x14b54a,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Di(_0x14b54a,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Di(_0x14b54a,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Di(_0x14b54a,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var rs=class extends _0x4e7480{abortController;static get requires(){return[Li];}constructor(_0x59a34b){super(_0x59a34b),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(_0x2d9520){return this['sendRequest'](_0x2d9520)['catch'](_0x162872=>{if(_0x162872 instanceof Pi)return Promise['reject'](_0x162872);if('AbortError'==_0x162872['name'])return Promise['resolve']();throw console['error'](_0x162872),new ct('aitextadapter-send-request-failed',null);});}async _prepareRequestHeaders(_0x328571,_0x412dcc){const _0x948b00=this['editor']['locale'],_0x84ee6f={'Content-Type':'application/json'};if('object'==typeof _0x328571)Object['assign'](_0x84ee6f,_0x328571);else{if(_0x328571)try{const _0x54abca=await _0x328571(_0x412dcc);Object['assign'](_0x84ee6f,_0x54abca);}catch{return Promise['reject'](new Pi(Di(_0x948b00,'AI_ERROR_GET_HEADERS')));}}return _0x84ee6f;}async _prepareRequestParameters(_0x1b440a,_0x29747a){const _0x1f6388=this['editor']['locale'];if('object'==typeof _0x1b440a)return _0x1b440a;try{return await _0x1b440a(_0x29747a);}catch{return Promise['reject'](new Pi(Di(_0x1f6388,'AI_ERROR_GET_PARAMETERS')));}}},os=class extends rs{['_apiUrl'];_requestHeaders;_requestParameters;static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x4d8e90){super(_0x4d8e90),_0x4d8e90['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x4d8e90['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x4d8e90['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x4d8e90['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x4d8e90['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x4d8e90['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async sendRequest({query:_0x19d440,context:_0x1d2193,onData:_0x10226c,actionId:_0x2fb67d}){const _0x56c903=this['editor']['locale'],_0x106b10=await this['prepareMessages'](_0x19d440,_0x1d2193,_0x2fb67d),_0x335680=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x2fb67d),_0x2d58b6=await this['_prepareRequestParameters'](this['_requestParameters'],_0x2fb67d),_0x53110e={'messages':_0x106b10,..._0x2d58b6},_0x2b03ea={'method':'POST','headers':_0x335680,'body':JSON['stringify'](_0x53110e),'signal':this['abortController']['signal']},_0x180d04=await fetch(this['_apiUrl'],_0x2b03ea);if(_0x180d04['ok'])return _0x2d58b6['stream']?await this['_readStreamableResponse'](_0x180d04,_0x10226c):await this['_readStaticResponse'](_0x180d04,_0x10226c),Promise['resolve']();{const _0x365759=await _0x180d04['text']();return _0x365759['includes']('context_length_exceeded')?Promise['reject'](new Pi(Di(_0x56c903,'AI_ERROR_CONTEXT_LENGTH'))):_0x365759['includes']('Moderation')?Promise['reject'](new Pi(Di(_0x56c903,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x365759));}}async['prepareMessages'](_0x1425f2,_0x375413,_0x4c2208){let _0x21d724,_0x589337;return _0x375413?(_0x21d724='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.',_0x589337='Instruction:\x0a'+_0x1425f2+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x375413):(_0x21d724='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.',_0x589337=_0x1425f2),[{'role':'system','content':_0x21d724},{'role':'user','content':_0x589337}];}async _readStreamableResponse(_0x599e63,_0x33c1e0){const _0xd03ddd=_0x599e63['body']['getReader'](),_0x555bf4=new TextDecoder();let _0x1ab931='',_0x153f84='',_0x1d3616='',_0x361604=!0x1;for(;!_0x361604;){const {done:_0x32aefd,value:_0x3d727b}=await _0xd03ddd['read'](),_0x2621c1=_0x1ab931+_0x555bf4['decode'](_0x3d727b);let _0x15780c;_0x361604=_0x32aefd;try{_0x15780c=this['_cleanUpData'](_0x2621c1),_0x1ab931='';}catch{_0x1ab931=_0x2621c1;continue;}_0x153f84+=_0x15780c,!_0x361604&&this['_isBufferIncomplete'](_0x153f84)||_0x153f84&&(_0x1d3616+=_0x153f84,_0x153f84='',_0x33c1e0(_0x1d3616));}return Promise['resolve']();}async _readStaticResponse(_0x4eda5e,_0x340320){return _0x340320((await _0x4eda5e['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}_isBufferIncomplete(_0x4fba76){const _0x10067c=_0x4fba76['split']('<')['length']!==_0x4fba76['split']('>')['length'],_0x303650=_0x4fba76['length']<0x1e;return _0x10067c&&_0x303650;}_cleanUpData(_0x21ce83){return _0x21ce83['split'](/\n(?![^{]*\})/g)['map'](_0x98694=>_0x98694['replace']('data:\x20',''))['filter'](_0x29ba33=>_0x29ba33&&_0x29ba33['length']>0x0&&'[DONE]'!==_0x29ba33)['map'](_0x4b96e9=>{const {choices:_0x30d6c0}=JSON['parse'](_0x4b96e9);if(_0x30d6c0[0x0]?.['delta']?.['content'])return _0x30d6c0[0x0]['delta']['content'];})['filter'](_0x3a0a22=>_0x3a0a22)['join']('');}},as=class extends rs{static get['pluginName'](){return'AWSTextAdapter';}init(){super['init'](),St('ai-aws-adapter-not-supported');}async sendRequest(_0x12b41f){throw bt('ai-aws-adapter-not-supported'),new Pi(Di(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},hs=class extends Mt{constructor(_0x3c81ee,_0xc254a={}){super(_0x3c81ee),this['isToggleable']=!0x0,this['set']('side',_0xc254a['side']||'top');const _0x231dd7=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...vt(_0xc254a['class']||[]),_0x231dd7['to']('side',_0x475d31=>'ck-tab-button_'+_0x475d31),_0x231dd7['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},cs=class extends _0x3a2edc{['children'];constructor(_0x6933d,_0x5503d3={}){super(_0x6933d);const _0x164b5e=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...vt(_0x5503d3['class']||[]),_0x164b5e['to']('class'),_0x164b5e['if']('isVisible','ck-hidden',_0xcbdc3=>!_0xcbdc3)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ls=class extends _0x3a2edc{buttonViews=this['createCollection']();['panelViews']=this['createCollection']();_tabs=new Map();constructor(_0x1c4a29,_0x12e06b={}){super(_0x1c4a29),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x12e06b['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x12e06b['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x131a3a,_0x210c1f)=>_0x131a3a&&!_0x210c1f);const _0x45e434=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...vt(_0x12e06b['class']||[]),_0x45e434['to']('side',_0x68c505=>'ck-tabs_'+_0x68c505),_0x45e434['to']('class'),_0x45e434['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x45e434['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x45e434['to']('side',_0x4f3356=>'ck-tabs__buttons-container_'+_0x4f3356)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x45e434['to']('side',_0x51fda4=>'ck-tabs__panels-container_'+_0x51fda4)]},'children':this['panelViews']},...vt(_0x12e06b['children']||[])]});}getTabIds(){return[...this['_tabs']['keys']()];}getTab(_0x1990ff){const _0x428c5a=this['_tabs']['get'](_0x1990ff);return _0x428c5a||null;}['addTab'](_0x5f099d){const _0xc23993=this['_setupButton']({'id':_0x5f099d['id'],'label':_0x5f099d['buttonLabel'],'icon':_0x5f099d['buttonIcon'],'order':_0x5f099d['order']}),_0x37bedd=new cs(this['locale']);return _0x37bedd['render'](),_0x5f099d['content']&&_0x37bedd['children']['add'](_0x5f099d['content']),this['panelViews']['add'](_0x37bedd),this['_tabs']['set'](_0x5f099d['id'],{'button':_0xc23993,'panel':_0x37bedd,'order':void 0x0!==_0x5f099d['order']?_0x5f099d['order']:null}),this['fire']('addTab:'+_0x5f099d['id'],{'id':_0x5f099d['id'],'button':_0xc23993,'panel':_0x37bedd}),null===this['activeTab']?this['activateTab'](_0x5f099d['id']):this['_hidePanel'](_0x5f099d['id']),{'button':_0xc23993,'panel':_0x37bedd};}activateTab(_0x395672){if(null!==_0x395672&&!this['getTab'](_0x395672))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x395672});if(this['isCollapsed']=!0x1,this['activeTab']===_0x395672)return;const _0x106685=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x395672,_0x395672&&this['_showPanel'](_0x395672),this['fire']('activateTab:'+_0x395672,{'newTab':_0x395672,'oldTab':_0x106685});}toggleTabPanel(_0x50b507){this['activeTab']===_0x50b507?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x50b507);}['showTab'](_0x5fc780){if(!this['getTab'](_0x5fc780))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x5fc780});this['_showPanel'](_0x5fc780),this['_showButton'](_0x5fc780),this['fire']('show:'+_0x5fc780,_0x5fc780);}['hideTab'](_0x48c299){if(!this['getTab'](_0x48c299))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x48c299});const _0x41fdf6=this['activeTab'];this['_hidePanel'](_0x48c299),this['_hideButton'](_0x48c299);const _0x998275=this['getTabIds']();_0x41fdf6===_0x48c299&&_0x998275['length']>0x1&&this['activateTab'](_0x998275['find'](_0x2f79bb=>_0x2f79bb!==_0x48c299)),this['fire']('hide:'+_0x48c299,_0x48c299);}_getPanel(_0x3ae88a){const _0x4ac2eb=this['_tabs']['get'](_0x3ae88a);return _0x4ac2eb?_0x4ac2eb['panel']:null;}['_showPanel'](_0x16d21a){null!==this['activeTab']&&this['activeTab']!==_0x16d21a||this['_getPanel'](_0x16d21a)['show']();}['_hidePanel'](_0xc79c44){const _0x1f8d10=this['_getPanel'](_0xc79c44);_0x1f8d10['isVisible']&&(this['activeTab']===_0xc79c44&&(this['activeTab']=null),_0x1f8d10['hide']());}_getButton(_0x29e245){const _0x3fc698=this['_tabs']['get'](_0x29e245);return _0x3fc698?_0x3fc698['button']:null;}_showButton(_0x405956){this['_getButton'](_0x405956)['show']();}_hideButton(_0xd3584d){this['_getButton'](_0xd3584d)['hide']();}_setupButton(_0x5e40c6){const _0x13a23a=new hs(this['locale'],{'side':this['side']}),_0x2c6a60=this['buttonViews'];if(_0x13a23a['set']({'label':_0x5e40c6['label'],'icon':_0x5e40c6['icon'],'tooltip':!0x0,'withText':!0x0}),_0x13a23a['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x3246e4,_0x1dbf7f)=>_0x3246e4===_0x5e40c6['id']&&!_0x1dbf7f),_0x13a23a['bind']('side')['to'](this,'side'),_0x5e40c6['order']){const _0xd3fe47=[...this['_tabs']]['reduce']((_0x36aefc,_0x271340)=>{const _0x4e0107=_0x271340[0x0],{order:_0x13f83c}=_0x271340[0x1];return!_0x13f83c||_0x13f83c>_0x5e40c6['order']?_0x36aefc:_0x13f83c>=_0x36aefc['order']?{'id':_0x4e0107,'order':_0x13f83c}:_0x36aefc;},{'id':'','order':0x0}),_0x8304c0=_0x2c6a60['getIndex'](this['_getButton'](_0xd3fe47['id']));_0x2c6a60['add'](_0x13a23a,_0x8304c0+0x1);}else _0x2c6a60['add'](_0x13a23a);return _0x13a23a['on']('execute',()=>{this['toggleTabPanel'](_0x5e40c6['id']);}),_0x13a23a;}};const us=['overlay','sidebar','custom'],ds=['left','right'];var _s=class extends ls{constructor(_0x4a53a5,_0x22b6c2={}){super(_0x4a53a5,_0x22b6c2),this['set']('type',_0x22b6c2['type']||'sidebar'),this['set']('side',_0x22b6c2['side']||'right'),this['set']('isVisible',_0x22b6c2['visibleByDefault']??!0x0);const _0x37e049=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x37e049['if']('type','ck-ai-tabs__overlay',_0x338744=>'overlay'===_0x338744),_0x37e049['if']('type','ck-ai-tabs__sidebar',_0x5caa40=>'sidebar'===_0x5caa40),_0x37e049['if']('isVisible','ck-hidden',_0x39a1c2=>!_0x39a1c2)]}}),this['buttonViews']['on']('add',(_0x5da9ab,_0x441d60)=>{_0x441d60['set']('withText',!0x1);});}},gs=class extends _0x57f218{['view'];container=null;showResizeButton=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2b6ffe){if(super(_0x2b6ffe),!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 _0x1a5b1c=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x1a5b1c['showResizeButton']&&(this['showResizeButton']=_0x1a5b1c['showResizeButton']),'sidebar'!==_0x1a5b1c['type']&&'overlay'!==_0x1a5b1c['type']||_0x1a5b1c['side']&&(this['side']=_0x1a5b1c['side']),'sidebar'===_0x1a5b1c['type']){if(this['container']=_0x1a5b1c['element'],this['set']('type','sidebar'),!this['container'])throw new ct('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x1a5b1c['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':_0x1a5b1c['visibleByDefault'],'collapsible':_0x1a5b1c['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 _0x38520b&&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(_0x27aa7b){if(_0x27aa7b&&this['type']!==_0x27aa7b){if(!us['includes'](_0x27aa7b))throw new ct('ai-tabs-unsupported-ui-type');this['type']=_0x27aa7b;}}switchSide(_0x106f24){if(_0x106f24&&this['side']!==_0x106f24){if(!ds['includes'](_0x106f24))throw new ct('ai-tabs-unsupported-ui-side');this['side']=_0x106f24;}}destroy(){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}};function As(_0x596bc5){return{..._0x596bc5,'type':'context'};}var Is=class extends _0x57f218{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}_token;['_decoder'];static get requires(){return[_0x532081];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2ed1b8){if(super(_0x2ed1b8),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 _0x43b565=this['context']['plugins']['get'](_0x532081);if(!_0x43b565['token'])throw new ct('ai-missing-token',this);this['_token']=_0x43b565['token'];}_getExtraHttpHeaders(){const _0x1259fa=this['context']['config']['get']('ai.extraHttpHeaders'),_0x42de99='function'==typeof _0x1259fa?_0x1259fa():_0x1259fa;if(Array['isArray'](_0x42de99)&&_0x42de99['length'])return Object['fromEntries'](_0x42de99['map'](({domain:_0x50228a,headers:_0x5eaaed})=>[_0x50228a,_0x5eaaed]));}startConversation(_0x4f71a1,_0x347717){const _0xad1e0b=this['_sendApiRequest']('/conversations','POST',{'id':_0x4f71a1,'group':_0x347717});return{'getConversation':async()=>(await _0xad1e0b['request'])['json'](),'abortController':_0xad1e0b['abortController']};}queryAssistant({message:_0x5cf58d,conversationId:_0x6e7d1b,parts:_0x53b262,capabilities:_0x1f5506,model:_0x16ff84,attributes:_0xfa94a7}){const _0x57b26c=this['_getExtraHttpHeaders'](),_0x2d5cc5={..._0x5cf58d&&{'prompt':_0x5cf58d},'content':_0x53b262,'model':_0x16ff84,..._0x1f5506&&{'capabilities':_0x1f5506},..._0xfa94a7&&{'attributes':_0xfa94a7},..._0x57b26c&&{'extraHttpHeaders':_0x57b26c}},_0x40c523=this['_sendApiRequest']('/conversations/'+_0x6e7d1b+'/messages','POST',_0x2d5cc5,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x37124a=(await _0x40c523['request'])['body'];return this['_getStreamReader'](_0x37124a);},'abortController':_0x40c523['abortController']};}executeCustomAction({content:_0xb7f7d2,message:_0xcea6fb,model:_0x181809,outputFormat:_0x4cbaf6,contexts:_0x2b5316}){const _0x4d946d={'content':[{'type':'text','content':_0xb7f7d2}],..._0xcea6fb&&{'prompt':_0xcea6fb},'model':_0x181809,'outputFormat':_0x4cbaf6,...ps(_0x2b5316)},_0xf8c95f=this['_sendApiRequest']('/actions/custom/calls','POST',_0x4d946d);return{'getStream':async()=>{const _0x44401d=(await _0xf8c95f['request'])['body'];return this['_getStreamReader'](_0x44401d);},'abortController':_0xf8c95f['abortController']};}executeAction({actionName:_0x524d91,content:_0x344351,args:_0x3497fb,contexts:_0x20422d}){const _0x5a5166={'content':[{'type':'text','content':_0x344351}],'args':_0x3497fb,...ps(_0x20422d)},_0x2aad30=this['_sendApiRequest']('/actions/system/'+_0x524d91+'/calls','POST',_0x5a5166);return{'getStream':async()=>{const _0x295cef=(await _0x2aad30['request'])['body'];return this['_getStreamReader'](_0x295cef);},'abortController':_0x2aad30['abortController']};}['uploadFile'](_0x10effb,_0x515932,_0x52203f){const _0x5e57db=new FormData();_0x5e57db['append']('file',_0x515932,_0x515932['name']),_0x52203f&&_0x5e57db['append']('attributes',JSON['stringify'](_0x52203f));const _0xb52b42=this['_sendApiRequest']('/conversations/'+_0x10effb+'/files','POST',_0x5e57db);return{'getId':async()=>(await _0xb52b42['request'])['json'](),'abortController':_0xb52b42['abortController']};}uploadDocuments(_0x2f9205,_0x16a224){const _0x550dc2={'documents':_0x16a224['map'](_0x2ee5eb=>({'content':_0x2ee5eb['content'],'attributes':{'version':_0x2ee5eb['version'],'sessionId':_0x2ee5eb['sessionId'],'channelId':_0x2ee5eb['channelId'],'rootName':_0x2ee5eb['rootName'],'selections':_0x2ee5eb['selections']},...void 0x0!==_0x2ee5eb['name']?{'name':_0x2ee5eb['name']}:{},...void 0x0!==_0x2ee5eb['description']?{'description':_0x2ee5eb['description']}:{}}))},_0x27c268=this['_sendApiRequest']('/conversations/'+_0x2f9205+'/documents/batch','POST',_0x550dc2);return{'getIds':async()=>(await _0x27c268['request'])['json'](),'abortController':_0x27c268['abortController']};}fetchDocuments(_0x307ef1,_0x2b9fb1){const _0x278b95=new URLSearchParams();_0x278b95['append']('documentIds',_0x2b9fb1['join'](','));const _0x2bb724=this['_sendApiRequest']('/conversations/'+_0x307ef1+'/documents/batch?'+_0x278b95['toString'](),'GET');return{'getDocuments':async()=>(await _0x2bb724['request'])['json'](),'abortController':_0x2bb724['abortController']};}fetchConversations(_0x504f4c,_0x3dfd17={}){const _0x16ff63=new URLSearchParams();_0x16ff63['append']('group',_0x504f4c),_0x16ff63['append']('excludeEmpty',!0x1!==_0x3dfd17['excludeEmpty']?'true':'false'),_0x16ff63['append']('limit',_0x3dfd17['limit']?_0x3dfd17['limit']['toString']():0x64['toString']()),_0x16ff63['append']('sortBy',_0x3dfd17['sortBy']?_0x3dfd17['sortBy']:'createdAt'),_0x16ff63['append']('order',_0x3dfd17['order']?_0x3dfd17['order']:'desc');const _0x9e9064=this['_sendApiRequest']('/conversations?'+_0x16ff63['toString'](),'GET');return{'getConversations':async()=>(await(await _0x9e9064['request'])['json']())['items'],'abortController':_0x9e9064['abortController']};}deleteConversation(_0x377492){const _0x1f7c6a=this['_sendApiRequest']('/conversations/'+_0x377492,'DELETE');return{'execute':async()=>{await _0x1f7c6a['request'];},'abortController':_0x1f7c6a['abortController']};}updateConversation(_0x4d341a,_0x9c60a0){const _0x2bb8c2=this['_sendApiRequest']('/conversations/'+_0x4d341a,'PATCH',_0x9c60a0);return{'getResult':async()=>(await _0x2bb8c2['request'],_0x9c60a0),'abortController':_0x2bb8c2['abortController']};}fetchConversation(_0x206854){const _0x4397ee=this['_sendApiRequest']('/conversations/'+_0x206854,'GET');return{'getConversation':async()=>(await _0x4397ee['request'])['json'](),'abortController':_0x4397ee['abortController']};}fetchConversationMessages(_0xfa346){const _0x145aa5=this['_sendApiRequest']('/conversations/'+_0xfa346+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x145aa5['request'])['json']())['items'],'abortController':_0x145aa5['abortController']};}['uploadUrl'](_0x50f957,_0x17a445,_0x50adc9){const _0x3460f6=this['_sendApiRequest']('/conversations/'+_0x50f957+'/web-resources','POST',{'url':_0x17a445,'attributes':_0x50adc9});return{'getId':async()=>(await _0x3460f6['request'])['json'](),'abortController':_0x3460f6['abortController']};}getModels(_0x5b8a45='en'){const _0x30283a=new URLSearchParams();_0x30283a['append']('language',_0x5b8a45);const _0xd57c91='/models/1?'+_0x30283a['toString'](),_0x3fc08b=this['_sendApiRequest'](_0xd57c91,'GET');return{'list':async()=>await(await _0x3fc08b['request'])['json'](),'abortController':_0x3fc08b['abortController']};}listContexts(_0x507377={}){const _0x286e70=new URLSearchParams();_0x286e70['append']('limit',_0x507377['limit']?_0x507377['limit']['toString']():0x64['toString']()),_0x507377['cursor']&&_0x286e70['append']('cursor',_0x507377['cursor']),_0x507377['order']&&_0x286e70['append']('order',_0x507377['order']);const _0x4cc057=this['_sendApiRequest']('/contexts?'+_0x286e70['toString'](),'GET');return{'getContexts':async()=>(await(await _0x4cc057['request'])['json']())['items'],'abortController':_0x4cc057['abortController']};}deleteFile(_0x2f0109,_0x745b1e){const _0x10cf7a=this['_sendApiRequest']('/conversations/'+_0x2f0109+'/files/'+_0x745b1e,'DELETE');return{'execute':async()=>{await _0x10cf7a['request'];},'abortController':_0x10cf7a['abortController']};}deleteDocument(_0x12eda1,_0x56be6c){const _0x25afc7=this['_sendApiRequest']('/conversations/'+_0x12eda1+'/documents/'+_0x56be6c,'DELETE');return{'execute':async()=>{await _0x25afc7['request'];},'abortController':_0x25afc7['abortController']};}deleteWebResource(_0x4efbbd,_0x54e470){const _0x2753ee=this['_sendApiRequest']('/conversations/'+_0x4efbbd+'/web-resources/'+_0x54e470,'DELETE');return{'execute':async()=>{await _0x2753ee['request'];},'abortController':_0x2753ee['abortController']};}cancelStream(_0x54c73a,_0x18a6e6){const _0x9c07d5=this['_sendApiRequest']('/conversations/'+_0x54c73a+'/messages/'+_0x18a6e6+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x9c07d5['request'];},'abortController':_0x9c07d5['abortController']};}resumeStream(_0x168bac,_0x2fc332,_0x1b5704='0-0'){const _0x36d4bb=new URLSearchParams({'lastEventId':_0x1b5704}),_0x2182c5=this['_sendApiRequest']('/conversations/'+_0x168bac+'/messages/'+_0x2fc332+'/stream?'+_0x36d4bb['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x4e3dac=await _0x2182c5['request'];return this['_getStreamReader'](_0x4e3dac['body']);},'abortController':_0x2182c5['abortController']};}callSystemReview({reviewName:_0xdfa1c7,content:_0x5a5a17,args:_0x46a340,contexts:_0x3291c8}){const _0x5a95bb=this['_sendApiRequest']('/reviews/system/'+_0xdfa1c7+'/calls','POST',{'content':[{'type':'text','content':_0x5a5a17}],'args':_0x46a340,...ps(_0x3291c8)});return{'getStream':async()=>{const _0x438b8e=(await _0x5a95bb['request'])['body'];return this['_getStreamReader'](_0x438b8e);},'abortController':_0x5a95bb['abortController']};}processDocument({content:_0x571c33,prompt:_0x537081,model:_0x57c018,capabilities:_0x178bec,contexts:_0x5ad03c}){const _0x227e54=this['_getExtraHttpHeaders'](),_0x477558=this['_sendApiRequest']('/documents/process','POST',{'content':_0x571c33,'prompt':_0x537081,'model':_0x57c018,..._0x178bec&&{'capabilities':_0x178bec},...ps(_0x5ad03c),..._0x227e54&&{'extraHttpHeaders':_0x227e54}});return{'getResult':async()=>(await _0x477558['request'])['json'](),'abortController':_0x477558['abortController']};}callCustomReview({content:_0x380efd,prompt:_0x5ae363,model:_0x2675f1,contexts:_0x50d705}){const _0x32898a=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x380efd}],..._0x5ae363&&{'prompt':_0x5ae363},'model':_0x2675f1,...ps(_0x50d705)});return{'getStream':async()=>{const _0x5490a8=(await _0x32898a['request'])['body'];return this['_getStreamReader'](_0x5490a8);},'abortController':_0x32898a['abortController']};}upsertAIChatRating(_0x15ca69,_0x51c4bd,_0x1ea590){const _0x1ea621=this['_sendApiRequest']('/conversations/'+_0x15ca69+'/messages/'+_0x51c4bd+'/ratings','PUT',{'positiveCount':_0x1ea590['positiveCount'],'totalCount':_0x1ea590['totalCount'],'modificationId':_0x1ea590['modificationId']});return{'execute':async()=>{await _0x1ea621['request'];},'abortController':_0x1ea621['abortController']};}upsertAIActionRating(_0x3307b7,_0x92fb44,_0x5e4c38){const _0x55e5fd=this['_sendApiRequest']('/actions/system/'+_0x3307b7+'/calls/'+_0x92fb44+'/ratings','PUT',{'positiveCount':_0x5e4c38['positiveCount'],'totalCount':_0x5e4c38['totalCount']});return{'execute':async()=>{await _0x55e5fd['request'];},'abortController':_0x55e5fd['abortController']};}upsertCustomAIActionRating(_0x4195ff,_0x6ea5cc){const _0x5732b9=this['_sendApiRequest']('/actions/custom/calls/'+_0x4195ff+'/ratings','PUT',{'positiveCount':_0x6ea5cc['positiveCount'],'totalCount':_0x6ea5cc['totalCount']});return{'execute':async()=>{await _0x5732b9['request'];},'abortController':_0x5732b9['abortController']};}upsertAIReviewRating(_0x5a77bf,_0x171213,_0x435701,_0x3f18bc){const _0x5eb4eb=this['_sendApiRequest']('/reviews/system/'+_0x5a77bf+'/calls/'+_0x171213+'/ratings','PUT',{'positiveCount':_0x435701['positiveCount'],'totalCount':_0x435701['totalCount'],'dataId':_0x3f18bc});return{'execute':async()=>{await _0x5eb4eb['request'];},'abortController':_0x5eb4eb['abortController']};}upsertCustomAIReviewRating(_0x4d4e2a,_0xd33bc1,_0x1a695c){const _0x1f864d=this['_sendApiRequest']('/reviews/custom/calls/'+_0x4d4e2a+'/ratings','PUT',{'positiveCount':_0xd33bc1['positiveCount'],'totalCount':_0xd33bc1['totalCount'],'dataId':_0x1a695c});return{'execute':async()=>{await _0x1f864d['request'];},'abortController':_0x1f864d['abortController']};}_sendApiRequest(_0x4bd951,_0x1184ae,_0x50a4d4,_0x4121de={}){const {apiUrl:_0x51be32=this['_apiUrl']}=_0x4121de,_0x18cdd1=new AbortController(),_0x2ffa1a=_0x50a4d4 instanceof FormData,_0x2d3b75={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':yt};_0x50a4d4&&!_0x2ffa1a&&(_0x2d3b75['Content-Type']='application/json');const _0x47c45d={'method':_0x1184ae,'headers':_0x2d3b75,'signal':_0x18cdd1['signal']};return _0x50a4d4&&(_0x47c45d['body']=_0x2ffa1a?_0x50a4d4:JSON['stringify'](_0x50a4d4)),{'request':fetch(''+_0x51be32+_0x4bd951,_0x47c45d)['catch'](_0x4d5661=>{this['_handleError'](_0x4d5661);})['then'](_0x4e506b=>_0x4e506b['ok']?_0x4e506b:_0x4e506b['json']()['then'](_0x4dcd41=>{throw{'url':_0x51be32,'path':_0x4bd951,'method':_0x1184ae,'body':_0x50a4d4,'status':(_0x4e506b||{})['status'],'statusText':(_0x4e506b||{})['statusText'],'code':_0x4dcd41['code'],'message':_0x4dcd41['message'],'traceId':_0x4dcd41['traceId'],'data':_0x4dcd41['data']};})),'abortController':_0x18cdd1};}async *_getStreamReader(_0x4306cc){const _0x352757=[],_0x396458=_0x4306cc['getReader'](),_0x24fdd4=_0x26568d({'onError':_0x182c5c=>{this['_handleError'](_0x182c5c);},'onEvent':_0x55c708=>{_0x55c708['data']=JSON['parse'](_0x55c708['data']),_0x352757['push'](_0x55c708);}});try{let _0x5aeed3=!0x1;for(;!_0x5aeed3;){const {done:_0x153bf2,value:_0x4d71e5}=await _0x396458['read']();_0x153bf2&&(_0x5aeed3=!0x0),_0x24fdd4['feed'](this['_decoder']['decode'](_0x4d71e5,{'stream':!0x0})),yield*_0x352757,_0x352757['length']=0x0;}}catch(_0x4e5b2b){this['_handleError'](_0x4e5b2b);}finally{_0x396458['releaseLock'](),_0x24fdd4['reset']();}}['_handleError'](_0x82eb57){if(_0x82eb57 instanceof ct)throw _0x82eb57;if(_0x82eb57 instanceof Error&&'AbortError'===_0x82eb57['name'])throw new ct('ai-request-aborted',this,{'originalError':_0x82eb57});throw new ct('ai-request-failed',this,{'originalError':_0x82eb57});}};function ps(_0xbfca34){return _0xbfca34?.['length']?{'contexts':_0xbfca34['map'](As)}:{};}function Es(_0x1a7330,_0x388b22,_0x37a26d){const t=_0x1a7330['t'];switch(_0x388b22){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'},_0x37a26d);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.'},_0x37a26d);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.'},_0x37a26d);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.'},_0x37a26d);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'},_0x37a26d);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x37a26d);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'},_0x37a26d);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.'},_0x37a26d);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.'},_0x37a26d);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.'},_0x37a26d);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.'},_0x37a26d);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'},_0x37a26d);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.'},_0x37a26d);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 _0x388b22;}}const ms=/* #__PURE__ -- @preserve */
|
|
25
|
+
dt();var Ts=class extends ms{_connector;['_config'];['_locale'];_modelList=[];_modelsRequest=null;constructor({connector:_0x46de6b,config:_0x256a74,locale:_0x3d863b}){super(),this['_connector']=_0x46de6b,this['_config']=_0x256a74,this['_locale']=_0x3d863b;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get _defaultModelId(){return this['_config']?.['defaultModelId'];}async getAllModels(){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()['catch'](_0x4c3756=>{throw this['_modelsRequest']=null,_0x4c3756;})),this['_modelsRequest'];}async getAvailableModels(){const _0x4a8d12=await this['getAllModels']();let _0x2a5f32;return _0x2a5f32=this['_availableModels']?this['_filterModels'](_0x4a8d12,this['_availableModels']):_0x4a8d12['filter'](_0x55b537=>_0x55b537['recommended']),_0x2a5f32;}async['resolveModel'](_0x5610ee){const _0x1d3dbe=await this['getAllModels']();if(!_0x1d3dbe['length'])return null;if(_0x5610ee){const _0x2e68ed=this['_getModelById'](_0x1d3dbe,_0x5610ee);if(_0x2e68ed)return _0x2e68ed;St('ai-chat-model-id-unrecognized',{'modelId':_0x5610ee,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async getDefault(){const _0xa8f575=await this['getAvailableModels']();if(!_0xa8f575['length'])return null;if(this['_defaultModelId']){const _0x1d729f=this['_getModelById'](_0xa8f575,this['_defaultModelId']);if(_0x1d729f)return _0x1d729f;St('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0xa8f575[0x0]['id']});}return _0xa8f575[0x0];}async['isAvailable'](_0x462bf5){return(await this['getAvailableModels']())['some'](_0xe5a7bf=>_0xe5a7bf['name']===_0x462bf5['name']&&_0xe5a7bf['provider']===_0x462bf5['provider']);}async getModel(_0x3e3e18){const _0x204ce6=await this['getAllModels']();return this['_getModelById'](_0x204ce6,_0x3e3e18)||null;}async _retrieveModels(){if(!this['_modelList']['length']){const _0x15d4b5=this['_locale']['uiLanguage']||'en',_0x54d60a=await this['_connector']['getModels'](_0x15d4b5)['list']();this['_modelList']=_0x54d60a['items']['map'](_0xe3161d=>ws(_0xe3161d)?{..._0xe3161d,'name':Es(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0xe3161d);}return[...this['_modelList']];}_filterModels(_0x3fd23b,_0x261c6f){let _0x178e63;if(_0x261c6f){_0x178e63=[];const _0x164184=new Set(),_0x18b946='string'==typeof _0x261c6f?[_0x261c6f['toLocaleLowerCase']()]:_0x261c6f['map'](_0x4bdf36=>_0x4bdf36['toLocaleLowerCase']());for(const _0x7b10e4 of _0x18b946)for(const _0x3deb04 of _0x3fd23b)!_0x164184['has'](_0x3deb04['id'])&&this['_isMatchingFilter'](_0x3deb04,_0x7b10e4)&&(_0x178e63['push'](_0x3deb04),_0x164184['add'](_0x3deb04['id']));}else _0x178e63=_0x3fd23b;return _0x178e63;}_isMatchingFilter(_0xb8ab36,_0x5e8c2e){const _0x2e3f5c=_0xb8ab36['id']['toLocaleLowerCase'](),_0x1cd989=_0xb8ab36['name']['toLocaleLowerCase'](),_0x8b845f=_0xb8ab36['provider']['toLocaleLowerCase']();return _0x2e3f5c===_0x5e8c2e||_0x1cd989===_0x5e8c2e||ws(_0xb8ab36)&&'auto'===_0x5e8c2e||_0x8b845f===_0x5e8c2e||_0x2e3f5c['startsWith'](_0x5e8c2e);}_getModelById(_0x427f6c,_0xa818fc){return _0x427f6c['find'](_0x3aa802=>ws(_0x3aa802)&&'auto'===_0xa818fc?_0x3aa802:_0x3aa802['id']===_0xa818fc)||null;}};function ws(_0x38a53e){return _0x38a53e['id']['startsWith']('agent');}var Cs=class{_connector;_defaultContext;_contextsRequest=null;constructor({connector:_0x4dd73a,defaultContext:_0x185de8}){this['_connector']=_0x4dd73a,this['_defaultContext']=_0x185de8;}async getAllContexts(){return this['_contextsRequest']||(this['_contextsRequest']=this['_connector']['listContexts']()['getContexts']()['catch'](_0xc6971d=>{throw this['_contextsRequest']=null,_0xc6971d;})),[...await this['_contextsRequest']];}async getAvailableContexts(){const _0x1896d2=await this['getAllContexts'](),_0xdcf9dc=new Set((this['_defaultContext']??[])['map'](_0xe800e9=>_0xe800e9['id']));return _0x1896d2['filter'](_0x5917b5=>!_0xdcf9dc['has'](_0x5917b5['id']));}resolveContext({feature:_0x438c7d,ids:_0x278c94=[],extraContexts:_0x3b2d19=[],idScopedOnly:_0x662df4=!0x1,context:_0x1e1f6f}){const _0x36d194=this['_resolveDefaultContext'](_0x438c7d,_0x278c94,_0x662df4);return _0x1e1f6f['addDefaultContext']([..._0x36d194,..._0x3b2d19]),_0x1e1f6f;}_resolveDefaultContext(_0x3da15b,_0x2e20a5,_0x12ceed=!0x1){if(!this['_defaultContext'])return[];const _0x4ea8c0=[];for(const _0x510625 of this['_defaultContext'])this['_entryAppliesToFeature'](_0x510625['features'],_0x3da15b,_0x2e20a5)&&(_0x12ceed&&this['_entryAppliesToFeature'](_0x510625['features'],_0x3da15b,[])||_0x4ea8c0['push'](this['_toContextRef'](_0x510625)));return _0x4ea8c0;}_toContextRef(_0x174f7f){return'promptId'in _0x174f7f?{'id':_0x174f7f['id'],'promptId':_0x174f7f['promptId']}:'fileId'in _0x174f7f?{'id':_0x174f7f['id'],'fileId':_0x174f7f['fileId']}:{'id':_0x174f7f['id']};}_entryAppliesToFeature(_0x99556c,_0x173230,_0x5c834a){if(!_0x99556c)return!0x0;const _0x15c95e=_0x99556c[_0x173230];return!!_0x15c95e&&(!0x0===_0x15c95e||_0x5c834a['some'](_0x389b55=>_0x15c95e['test'](_0x389b55)));}},fs=class extends _0x57f218{['models'];contextLibrary;static get['pluginName'](){return'AICore';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[Is];}init(){const _0x266e73=this['context']['plugins']['get'](Is);this['models']=new Ts({'connector':_0x266e73,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),this['contextLibrary']=new Cs({'connector':_0x266e73,'defaultContext':this['context']['config']['get']('ai.defaultContext')});}};function bs(_0x4f3738){return _0x4f3738?_0x4f3738 instanceof _0x38520b?[_0x4f3738]:_0x4f3738['editors']&&0x0!==_0x4f3738['editors']['length']?Array['from'](_0x4f3738['editors']):[]:[];}function Ss(_0x3d0af1){const _0x358930=bs(_0x3d0af1);if(!_0x358930['length'])throw new ct('ai-get-editor-from-context-no-editor');if(0x1===_0x358930['length'])return _0x358930[0x0];const _0x29c3f8=_0x358930['find'](_0x37123d=>_0x37123d['ui']?.['focusTracker']?.['isFocused']);if(_0x29c3f8)return _0x29c3f8;const _0x34d649=function(_0xf1e44b){if(_0xf1e44b instanceof _0x38520b)return;const _0xca34b2=_0xf1e44b;if(!_0xca34b2['plugins']||!_0xca34b2['plugins']['has']('AIEditing'))return;return _0xca34b2['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x3d0af1);return _0x34d649&&_0x358930['includes'](_0x34d649)?_0x34d649:_0x358930[0x0];}function Rs(_0x34f098,_0x2bf44f){return _0x4b2021(_0x34f098,_0x2bf44f);}function Os(_0x1d0bbc,_0x146d88){return _0x4a5d1b(_0x1d0bbc,_0x146d88);}function vs(_0x379180,_0x7ec389,_0x7d203){const _0x231f04=null!==_0x7ec389?_0x5c702d=>_0x5c702d['attribs'][_0x379180]===_0x7ec389:_0x32b171=>Boolean(_0x32b171['attribs'][_0x379180]);return _0x43283b(_0xedfa5a=>_0x2159f2(_0xedfa5a)&&_0x231f04(_0xedfa5a),_0x7d203);}function ks(_0x5c2e68,_0x3f8aba,_0x188328){const _0x1619e9=null!==_0x3f8aba?_0x4611ce=>_0x4611ce['attribs'][_0x5c2e68]===_0x3f8aba:_0x206039=>Boolean(_0x206039['attribs'][_0x5c2e68]);return _0x10faf7(_0x1e80f4=>_0x2159f2(_0x1e80f4)&&_0x1619e9(_0x1e80f4),_0x188328);}function ys(_0x4e22a1){return _0x10faf7(_0x2a0bf0=>_0x2159f2(_0x2a0bf0)&&function(_0x39cc14){const _0x23d56d=_0x39cc14['toLowerCase']();return'script'===_0x23d56d||'style'===_0x23d56d||_0x23d56d['includes']('-');}(_0x2a0bf0['name']),_0x4e22a1);}const Ns=['comment-start','comment-end','suggestion-start','suggestion-end'];function xs(_0x495334){return _0x2159f2(_0x495334)&&Ns['includes'](_0x495334['name']['toLowerCase']());}function Ls(_0xbbba34){return _0x35ff9d(_0x1080a5=>_0x1b9e99(_0x1080a5),_0xbbba34,!0x0,0x1/0x0);}function Ps(_0x1a6bd8,_0x2ac46d){return _0x1a6bd8&&_0x2159f2(_0x1a6bd8)?_0x1a6bd8['attribs'][_0x2ac46d]:null;}function Ds(_0x4fda1d,_0x179f9c,_0x195620){_0x2159f2(_0x4fda1d)&&(null===_0x195620?delete _0x4fda1d['attribs'][_0x179f9c]:_0x4fda1d['attribs'][_0x179f9c]=_0x195620);}function Hs(_0x364a7f,_0x5aae35,_0x55cff0){const _0x1960b7=_0x5aae35['cloneNode'](!0x0);'beforebegin'===_0x55cff0?ti(_0x364a7f,_0x1960b7):'afterbegin'===_0x55cff0?_0x97bf1a(_0x364a7f,_0x1960b7):'beforeend'===_0x55cff0?_0x49bdc9(_0x364a7f,_0x1960b7):'afterend'===_0x55cff0&&_0x44f81b(_0x364a7f,_0x1960b7);}function Ms(_0x3bf5e2){const _0x42178b=[];let _0x32b166=_0x3bf5e2;for(;_0x32b166;)_0x32b166=_0x2a102(_0x32b166),_0x32b166&&_0x42178b['push'](_0x32b166);return _0x42178b;}function Us(_0x31da87){return _0x31da87['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function Vs(_0x13b077){let _0x29600d=0x0;for(;_0x13b077['parentNode'];)_0x13b077=_0x13b077['parentNode'],_0x29600d++;return _0x29600d;}function Bs(_0x298827){const _0x23c98e=[];let _0x14ff5a=_0x298827['nextSibling'];for(;_0x14ff5a;)_0x23c98e['push'](_0x14ff5a),_0x14ff5a=_0x14ff5a['nextSibling'];_0x23c98e['forEach'](_0x52915d=>{_0x356c4e(_0x52915d);});}function Gs(_0x353e77,_0x423fd4){return!!_0x353e77['model']['document']['getRoot'](_0x423fd4)&&!_0x3c9aa8(_0x353e77,_0x423fd4);}function Fs(_0x143e97,_0x5e99bd){return'<p\x20data-id=\x22'+_0x5e99bd+'\x22>'+_0x143e97+'</p>';}function Ks(_0x30be17){return'p'===_0x30be17['name']['toLowerCase']()&&Boolean(_0x30be17['attribs']['data-id']);}function Ws(_0x3ea8d5){const _0x37a127=Rs(_0x3ea8d5)['children']['filter'](_0x2159f2);return 0x1===_0x37a127['length']&&Ks(_0x37a127[0x0])?_0x37a127[0x0]['children']['map'](_0x1910a1=>Os(_0x1910a1))['join'](''):_0x3ea8d5;}function Ys(_0x2bbd45,_0x2d932a){const _0x3b7436=function(_0x5899bf){const _0x4db82b=_0x5899bf['children']['filter'](_0x2159f2);return 0x1===_0x4db82b['length']&&Ks(_0x4db82b[0x0])?_0x4db82b[0x0]['children']:_0x5899bf['children'];}(_0x2d932a),{blockElements:_0x41afd7}=_0x2bbd45['editing']['view']['domConverter'],_0x5f3841=_0x5dab63=>_0x5dab63['some'](_0x17f9cf=>_0x2159f2(_0x17f9cf)&&('p'!==_0x17f9cf['name']['toLowerCase']()&&_0x41afd7['includes'](_0x17f9cf['name']['toLowerCase']())||_0x5f3841(_0x17f9cf['children'])));if(_0x5f3841(_0x3b7436))return!0x1;const _0x4898e1=_0x3b7436['map'](_0x350625=>Os(_0x350625))['join'](''),_0x27d992=_0x2bbd45['data']['parse'](_0x4898e1,'$root'),{schema:_0x359bbb}=_0x2bbd45['model'];let _0x541f7f=0x0;for(const {item:_0x45843d}of _0x2bbd45['model']['createRangeIn'](_0x27d992))if(_0x45843d['is']('element')&&_0x359bbb['isBlock'](_0x45843d)&&(++_0x541f7f>0x1||'paragraph'!==_0x45843d['name']))return!0x1;return!0x0;}function $s(_0x2b8196,_0x2fa4fd){const _0x15c5d7=_0x2fa4fd['filter'](_0x36b2e3=>'new'!=_0x36b2e3['type'])['map'](_0x44982f=>vs('data-id',_0x44982f['id'],_0x2b8196))['filter'](_0x5c6c78=>null!==_0x5c6c78),_0x18fabc=_0x2fa4fd['filter'](_0x1bc6f3=>'removed'!=_0x1bc6f3['type'])['map'](_0x3cbb82=>_0x3cbb82['node']['cloneNode'](!0x0));let _0x1fc74e=null;if(_0x15c5d7['length']){_0x1fc74e=_0x15c5d7[0x0]['previousSibling'];for(let _0x34a311=0x0;_0x34a311<_0x15c5d7['length'];_0x34a311++)_0x356c4e(_0x15c5d7[_0x34a311]);}if(_0x18fabc['length']){_0x1fc74e||(_0x2fa4fd[0x0]['anchorId']?_0x1fc74e=vs('data-id',_0x2fa4fd[0x0]['anchorId'],_0x2b8196):(_0x1fc74e=_0x18fabc['shift'](),_0x97bf1a(_0x2b8196,_0x1fc74e)));for(let _0x370d9e=0x0;_0x370d9e<_0x18fabc['length'];_0x370d9e++)_0x44f81b(_0x1fc74e,_0x18fabc[_0x370d9e]),_0x1fc74e=_0x18fabc[_0x370d9e];}}function qs(_0x9afe23,_0x337848){const _0x1d8070=new Set();for(const _0x163369 of _0x9afe23){if(!_0x163369['editor']||'destroyed'===_0x163369['editor']['state']||!Gs(_0x163369['editor'],_0x163369['rootName']))continue;const _0x472393=_0x337848['get'](_0x163369['documentId']);let _0x59d4e1;_0x472393?(_0x59d4e1=_0x472393['cloneNode'](!0x0),$s(_0x59d4e1,_0x163369['changes'])):_0x59d4e1=new _0x577dfe(_0x163369['changes']['filter'](_0x266918=>'removed'!=_0x266918['type'])['map'](_0x50f1bc=>_0x50f1bc['node']['cloneNode'](!0x0))),Ys(_0x163369['editor'],_0x59d4e1)||_0x1d8070['add'](_0x163369['index']);}return _0x1d8070;}function Qs(_0x13f080,_0x1900f6,_0x449f0b,_0x282c44){return Gs(_0x13f080,_0x1900f6)?Ys(_0x13f080,Rs(_0x282c44))?{'before':Ws(_0x449f0b),'after':Ws(_0x282c44)}:null:{'before':_0x449f0b,'after':_0x282c44};}function Xs(_0x41cf82,_0x42b91a){return _0x67b283(_0x41cf82,_0x42b91a);}function zs(_0x3c239e,_0x5ccee1){return _0x3c239e['map'](_0x4e715d=>null!==_0x4e715d&&'object'==typeof _0x4e715d?Xs(_0x4e715d,_0x5ccee1):_0x4e715d);}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 _0x57f218{constructor(_0x14094a){super(_0x14094a),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(_0x4f2b6f){let _0x1603e1=this['_sessionIdByEditor']['get'](_0x4f2b6f);return _0x1603e1||(_0x1603e1=_0x4f2b6f['plugins']['has']('RealTimeCollaborationClient')&&_0x4f2b6f['plugins']['get']('RealTimeCollaborationClient')['sessionId']||kt(),this['_sessionIdByEditor']['set'](_0x4f2b6f,_0x1603e1)),_0x1603e1;}async getDocumentData(_0x3934f7){const _0x5a0e0a=bs(this['context']),_0x538789=[],_0x51de17=new Set();for(const _0x379f1b of _0x5a0e0a){if(_0x3934f7&&!_0x3934f7['has'](_0x379f1b['config']['get']('collaboration.channelId')))continue;const _0x1789af=_0x379f1b['config']['get']('roots')||{},_0x2ccc49=this['_getEditorSelectionSignature'](_0x379f1b),_0x12523b=_0x379f1b['config']['get']('collaboration.channelId'),_0x6bf5d3=this['getSessionId'](_0x379f1b);for(const _0x3acd2f of _0x379f1b['model']['document']['getRoots']()){if('$graveyard'===_0x3acd2f['rootName'])continue;const _0xb20785=await this['_getDocumentDataForEditorRoot'](_0x379f1b,_0x3acd2f,_0x51de17),_0x42982c=_0x1789af[_0x3acd2f['rootName']],_0x2e0188=_0x3acd2f['getAttribute']('$description')??_0x42982c?.['description'];let _0x37637f=_0x3acd2f['getAttribute']('$title')??_0x42982c?.['title'];_0x37637f||(_0x37637f=_0x3acd2f['getAttribute']('$rootEditableOptions')?.['label']??_0x42982c?.['label']),_0x37637f||(St('ai-document-root-missing-title',{'editor':_0x379f1b,'rootName':_0x3acd2f['rootName']}),_0x37637f=_0x3acd2f['rootName']),_0x538789['push']({'editor':_0x379f1b,'rootName':_0x3acd2f['rootName'],'content':_0xb20785['content'],'version':_0xb20785['version'],'sessionId':_0x6bf5d3,'channelId':_0x12523b,'selections':_0xb20785['selections'],'selectionSignature':_0x2ccc49,'editorConfig':this['_getEditorConfig'](_0x379f1b),'name':_0x37637f,'description':_0x2e0188});}}return _0x538789;}getEditorsVersions(){const _0x3f8749=bs(this['context']),_0x109a0c=new Map();for(const _0xee584e of _0x3f8749){const _0x3206b0=_0xee584e['config']['get']('collaboration.channelId');_0x109a0c['set'](_0x3206b0,_0xee584e['model']['document']['version']);}return _0x109a0c;}getEditorsSelections(){const _0x555ae5=bs(this['context']),_0x2ccd63=new Map();for(const _0x20a916 of _0x555ae5){const _0x2d291f=_0x20a916['config']['get']('collaboration.channelId'),_0x244d2a=this['_getEditorSelectionSignature'](_0x20a916);_0x2ccd63['set'](_0x2d291f,_0x244d2a);}return _0x2ccd63;}_getEditorSelectionSignature(_0x3e9bd3){return this['_getMarkersInDocumentOrder'](_0x3e9bd3)['map'](_0x189c02=>{const _0x3bdecd=_0x189c02['getRange']();return _0x3bdecd['root']['rootName']+':'+_0x3bdecd['start']['path']['join']('.')+'-'+_0x3bdecd['end']['path']['join']('.');})['join']('|');}async _getDocumentDataForEditorRoot(_0x2a7a17,_0x384d9c,_0x11bba0){const _0x4f6f3c=_0x2a7a17['data']['toView'](_0x384d9c,{'convertAiChatSelectionMarker':!0x0}),_0x4abbb5=new _0x5f45e0(_0x2a7a17['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x4f6f3c,_0x4abbb5,_0x11bba0);let _0x4a5fa7=await this['_getDocumentDataStringFromView'](_0x4f6f3c,_0x2a7a17);Gs(_0x2a7a17,_0x384d9c['rootName'])&&(_0x4a5fa7=Fs(_0x4a5fa7,this['_nextDataId'](_0x11bba0)));const _0x2f338f=this['_getMarkersInDocumentOrder'](_0x2a7a17,_0x384d9c),_0x413c03=[];for(const _0x4188d4 of _0x2f338f){const _0x13b3ed='<'+_0x4188d4['name']+':start></'+_0x4188d4['name']+':start>',_0x1608ff=_0x4a5fa7['indexOf'](_0x13b3ed);_0x4a5fa7=_0x4a5fa7['substring'](0x0,_0x1608ff)+_0x4a5fa7['substring'](_0x1608ff+_0x13b3ed['length']);const _0xf07f2c='<'+_0x4188d4['name']+':end></'+_0x4188d4['name']+':end>',_0xfa7a1=_0x4a5fa7['indexOf'](_0xf07f2c);_0x4a5fa7=_0x4a5fa7['substring'](0x0,_0xfa7a1)+_0x4a5fa7['substring'](_0xfa7a1+_0xf07f2c['length']),_0x413c03['push']({'markerName':_0x4188d4['name'],'start':_0x1608ff,'end':_0xfa7a1,'htmlFragment':_0x4a5fa7['substring'](_0x1608ff,_0xfa7a1)});}return{'content':_0x4a5fa7,'version':_0x2a7a17['model']['document']['version'],'selections':_0x413c03};}afterInit(){this['context']instanceof _0x38520b?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x25c443,_0x2c90ea)=>{_0x2c90ea['on']('ready',()=>{this['_integrateEditor'](_0x2c90ea);});});}_setOutputDataProcessor(_0x409ef6){this['_outputDataProcessor']=_0x409ef6;}async _getDocumentDataStringFromView(_0x57b57a,_0x4ca8bb){let _0x884da1;if(this['_outputDataProcessor']){const _0x1b8c95=_0x4ca8bb['data']['processor']['domConverter']['viewToDom'](_0x57b57a),_0xb5e49=await this['_outputDataProcessor'](_0x1b8c95);_0x884da1=_0x4ca8bb['data']['processor']['htmlWriter']['getHtml'](_0xb5e49);}else _0x884da1=_0x4ca8bb['data']['processor']['toData'](_0x57b57a);return _0x884da1;}_integrateEditor(_0x548f51){if(!_0x548f51['config']['get']('collaboration.channelId'))throw new ct('ai-missing-channel-id',_0x548f51);_0x548f51['ui']['focusTracker']['on']('change:isFocused',(_0x40a021,_0x308fd0,_0x14f365)=>{_0x14f365&&(this['_lastContentFocusedEditor']=_0x548f51);}),_0x548f51['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x548f51&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x548f51['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Js,'view':({markerName:_0x2aa149})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x2aa149['split'](':')[0x1]],'priority':0xc})}),_0x548f51['conversion']['for']('dataDowncast')['markerToElement']({'model':Js+':context','view':(_0x3b895c,{writer:_0x5f50e3,options:_0x4fe060})=>_0x4fe060['convertAiChatSelectionMarker']?_0x5f50e3['createUIElement'](_0x3b895c['markerName']+':'+(_0x3b895c['isOpening']?'start':'end')):null});}showFakeVisualSelection(_0xec9fbb){const _0x6e38dc=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0xec9fbb);const _0x29e3c8=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x6e38dc,_0x29e3c8);}hideFakeVisualSelection(_0x44d88c){const _0x18cee6=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x44d88c);const _0xfcc4ea=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x18cee6,_0xfcc4ea);}async modelToDataWithIds(_0x5e49a0,_0x4cdd33,_0x6f7ec7){const _0x28daf3=_0x4cdd33['data']['toView'](_0x5e49a0),_0x1f512f=new _0x5f45e0(_0x4cdd33['editing']['view']['document']),_0x5d6e73=new Set();this['_setDataIdsOnChildren'](_0x28daf3,_0x1f512f,_0x5d6e73);const _0x4665cf=await this['_getDocumentDataStringFromView'](_0x28daf3,_0x4cdd33);return _0x6f7ec7&&Gs(_0x4cdd33,_0x6f7ec7)?Fs(_0x4665cf,this['_nextDataId'](_0x5d6e73)):_0x4665cf;}_setDataIdsOnChildren(_0x37e53e,_0x563587,_0x5baaca=new Set()){let _0x35a136=!0x1;for(const _0x3fd5bd of _0x37e53e['getChildren']()){if(!_0x3fd5bd['is']('view:element')||Zs['includes'](_0x3fd5bd['name']))continue;const _0x33f55f=_0x3fd5bd['is']('view:containerElement'),_0x41cb19=_0x3fd5bd['is']('view:emptyElement'),_0x39ba5a=_0x3fd5bd['is']('view:rawElement'),_0x319eaf=this['_setDataIdsOnChildren'](_0x3fd5bd,_0x563587,_0x5baaca);_0x3fd5bd['hasAttribute']('data-id')?(_0x35a136=!0x0,_0x5baaca['add'](_0x3fd5bd['getAttribute']('data-id'))):(_0x33f55f||_0x41cb19||_0x39ba5a||_0x319eaf)&&(_0x563587['setAttribute']('data-id',this['_nextDataId'](_0x5baaca),_0x3fd5bd),_0x35a136=!0x0);}return _0x35a136;}_nextDataId(_0x2d9b3d){let _0x4c02e8;do{_0x4c02e8='';for(let _0xa8dfc0=0x0;_0xa8dfc0<0x4;_0xa8dfc0++)_0x4c02e8+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x2d9b3d['has'](_0x4c02e8));return _0x2d9b3d['add'](_0x4c02e8),_0x4c02e8;}getSelectionText(_0x567796){const _0x37b4ac=(_0x567796?_0x567796['model']:Ss(this['context'])['model'])['document']['selection'],_0x462c1b=[],_0x4df7ae=Array['from'](_0x37b4ac['getRanges']());_0x4df7ae['sort']((_0x141536,_0x42b3be)=>_0x141536['start']['isBefore'](_0x42b3be['start'])?-0x1:0x1);for(const _0xa25a02 of _0x4df7ae)for(const _0x2a91f3 of _0xa25a02['getItems']())_0x2a91f3['is']('$textProxy')?_0x462c1b['push'](_0x2a91f3['data']):_0x2a91f3['is']('element')&&_0x462c1b['length']>0x0&&'\x20'!==_0x462c1b[_0x462c1b['length']-0x1]&&_0x462c1b['push']('\x20');return _0x462c1b['length']?'\x22'+_0x462c1b['join']('')['trim']()+'\x22':Es(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}_removeFakeSelectionById(_0x4d6242){for(let _0x521a14=0x0;_0x521a14<this['_fakeSelections']['length'];_0x521a14++)if(this['_fakeSelections'][_0x521a14]['id']==_0x4d6242)return void this['_fakeSelections']['splice'](_0x521a14,0x1);}_addFakeSelection(_0x4586e1){this['_removeFakeSelectionById'](_0x4586e1['id']),Ct(this['_fakeSelections'],_0x4586e1);}_refreshFakeSelection(_0x35a935,_0x4c623b){if(_0x35a935==_0x4c623b)return;const _0x5a5ff8=_0x35a935?_0x35a935['editor']:null,_0x194c91=_0x4c623b?_0x4c623b['editor']:null,_0x35d2a8=(_0xb6d203,_0x4ece64)=>{const _0x23facb=_0x4ece64['model']['markers']['getMarkersGroup'](Js);for(const _0x1c13d4 of _0x23facb)_0xb6d203['removeMarker'](_0x1c13d4);},_0x3371b9=(_0xcbec63,_0xabaf02,_0x4b34d0)=>{const _0x35e968=_0xabaf02['model'];for(let _0x311807=0x0;_0x311807<_0x4b34d0['ranges']['length'];_0x311807++){let _0x43ad70=_0x4b34d0['ranges'][_0x311807];const _0x21e2ca=Js+':'+_0x4b34d0['id']+':'+_0x311807;if(_0x43ad70['start']['isAtEnd']){const _0x34c56d=_0x43ad70['start']['getLastMatchingPosition'](({item:_0x368104})=>!_0x35e968['schema']['isContent'](_0x368104),{'boundaries':_0x43ad70});_0x43ad70=_0xcbec63['createRange'](_0x34c56d,_0x43ad70['end']);}_0xcbec63['addMarker'](_0x21e2ca,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x43ad70});}};_0x5a5ff8&&_0x194c91&&_0x5a5ff8===_0x194c91&&_0x4c623b?_0x5a5ff8['model']['change'](_0x55f7df=>{_0x35d2a8(_0x55f7df,_0x5a5ff8),_0x3371b9(_0x55f7df,_0x194c91,_0x4c623b);}):(_0x5a5ff8&&_0x5a5ff8['model']['change'](_0x31663d=>_0x35d2a8(_0x31663d,_0x5a5ff8)),_0x194c91&&_0x4c623b&&_0x194c91['model']['change'](_0x4309ad=>_0x3371b9(_0x4309ad,_0x194c91,_0x4c623b)));}_getMarkersInDocumentOrder(_0x2f0de9,_0x1000b5){const _0x150af2=Array['from'](_0x2f0de9['model']['markers']['getMarkersGroup'](Js+':context'));return(_0x1000b5?_0x150af2['filter'](_0x4aca73=>{const _0x34e794=_0x4aca73['getRange']();return _0x34e794&&_0x34e794['root']['rootName']===_0x1000b5['rootName'];}):_0x150af2)['sort']((_0xd4f09c,_0x5cd480)=>_0xd4f09c['getStart']()['isBefore'](_0x5cd480['getStart']())?-0x1:_0xd4f09c['getStart']()['isAfter'](_0x5cd480['getStart']())?0x1:0x0);}_getEditorConfig(_0x4f26e0){let _0x5285d4=this['_editorsToConfigs']['get'](_0x4f26e0);return _0x5285d4||(_0x5285d4=function(_0x523ae0){const _0x599987={};if(_0x523ae0['plugins']['has']('AlignmentEditing')&&(_0x599987['alignment']=_0x523ae0['config']['get']('alignment')),_0x523ae0['plugins']['has']('CodeBlockEditing')&&(_0x599987['codeBlock']=_0x523ae0['config']['get']('codeBlock')),_0x523ae0['plugins']['has']('FontBackgroundColorEditing')&&(_0x599987['fontBackgroundColor']=Xs(_0x523ae0['config']['get']('fontBackgroundColor'),['documentColors','columns','colorPicker'])),_0x523ae0['plugins']['has']('FontColorEditing')&&(_0x599987['fontColor']=Xs(_0x523ae0['config']['get']('fontColor'),['documentColors','columns','colorPicker'])),_0x523ae0['plugins']['has']('FontFamilyEditing')&&(_0x599987['fontFamily']=_0x523ae0['config']['get']('fontFamily'),_0x599987['fontFamily']&&_0x599987['fontFamily']['options']&&(_0x599987['fontFamily']['options']=zs(_0x599987['fontFamily']['options'],['model','upcastAlso']))),_0x523ae0['plugins']['has']('FontSizeEditing')&&(_0x599987['fontSize']=_0x523ae0['config']['get']('fontSize'),_0x599987['fontSize']&&_0x599987['fontSize']['options']&&(_0x599987['fontSize']['options']=zs(_0x599987['fontSize']['options'],['upcastAlso']))),_0x523ae0['plugins']['has']('FootnotesEditing')){const _0x15b8e3=_0x523ae0['config']['get']('footnotes')??{};_0x15b8e3['footnotesProperties']&&'object'==typeof _0x15b8e3['footnotesProperties']&&(_0x15b8e3['footnotesProperties']=Xs(_0x15b8e3['footnotesProperties'],['toolbar','listStyles'])),_0x599987['footnotes']=_0x15b8e3;}if(_0x523ae0['plugins']['has']('HeadingEditing')&&(_0x599987['heading']=_0x523ae0['config']['get']('heading'),_0x599987['heading']&&_0x599987['heading']['options']&&(_0x599987['heading']['options']=zs(_0x599987['heading']['options'],['model','icon','class','converterPriority','upcastAlso']))),_0x523ae0['plugins']['has']('HighlightEditing')&&(_0x599987['highlight']=_0x523ae0['config']['get']('highlight'),_0x599987['highlight']&&_0x599987['highlight']['options']&&(_0x599987['highlight']['options']=zs(_0x599987['highlight']['options'],['model','color']))),_0x523ae0['plugins']['has']('ImageBlockEditing')||_0x523ae0['plugins']['has']('ImageInlineEditing')){const _0x336e09=Xs(_0x523ae0['config']['get']('image'),['toolbar','upload','insert','resizeOptions']);_0x523ae0['plugins']['has']('ImageResizeEditing')||delete _0x336e09['resizeUnit'],_0x523ae0['plugins']['has']('ImageStyleEditing')?_0x336e09['styles']?.['options']&&(_0x336e09['styles']['options']=zs(_0x336e09['styles']['options'],['icon'])):delete _0x336e09['styles'],_0x599987['image']=_0x336e09;}if(_0x523ae0['plugins']['has']('IndentBlock')&&(_0x599987['indentBlock']=_0x523ae0['config']['get']('indentBlock')),_0x523ae0['plugins']['has']('LineHeightEditing')&&(_0x599987['lineHeight']=_0x523ae0['config']['get']('lineHeight'),_0x599987['lineHeight']&&(delete _0x599987['lineHeight']['supportAllValues'],_0x599987['lineHeight']['options']&&(_0x599987['lineHeight']['options']=zs(_0x599987['lineHeight']['options'],['model'])))),_0x523ae0['plugins']['has']('LinkEditing')&&(_0x599987['link']=Xs(_0x523ae0['config']['get']('link'),['toolbar'])),_0x523ae0['plugins']['has']('ListEditing')){const _0x4acdef=_0x523ae0['config']['get']('list')??{};delete _0x4acdef['enableListItemMarkerFormatting'],_0x523ae0['plugins']['has']('ListPropertiesEditing')?_0x4acdef['properties']&&_0x4acdef['properties']['styles']&&'object'==typeof _0x4acdef['properties']['styles']&&(_0x4acdef['properties']['styles']=Xs(_0x4acdef['properties']['styles'],['listStyleTypes'])):delete _0x4acdef['properties'],_0x599987['list']=_0x4acdef;}if(_0x523ae0['plugins']['has']('MediaEmbedEditing')&&(_0x599987['mediaEmbed']=_0x523ae0['config']['get']('mediaEmbed'),_0x599987['mediaEmbed']&&(delete _0x599987['mediaEmbed']['toolbar'],_0x523ae0['plugins']['has']('MediaEmbedResizeEditing')?_0x599987['mediaEmbed']['resizeOptions']&&(_0x599987['mediaEmbed']['resizeOptions']=_0x599987['mediaEmbed']['resizeOptions']['map'](_0x54d407=>Xs(_0x54d407,['icon','label']))):delete _0x599987['mediaEmbed']['resizeOptions'],_0x523ae0['plugins']['has']('MediaEmbedStyleEditing')?_0x599987['mediaEmbed']['styles']&&_0x599987['mediaEmbed']['styles']['options']&&(_0x599987['mediaEmbed']['styles']['options']=zs(_0x599987['mediaEmbed']['styles']['options'],['icon','title'])):delete _0x599987['mediaEmbed']['styles'])),_0x523ae0['plugins']['has']('MultiLevelListEditing')&&(_0x599987['listMultiLevel']=_0x523ae0['config']['get']('listMultiLevel')??{}),_0x523ae0['plugins']['has']('MentionEditing')){const _0x2933d8=Xs(_0x523ae0['config']['get']('mention'),['commitKeys','dropdownLimit']);_0x2933d8['feeds']&&(_0x2933d8['feeds']=_0x2933d8['feeds']['map'](_0x40594b=>Xs(_0x40594b,['minimumCharacters','itemRenderer','dropdownLimit']))),_0x599987['mention']=_0x2933d8;}if(_0x523ae0['plugins']['has']('MergeFieldsEditing')){const _0xaa97d8=Xs(_0x523ae0['config']['get']('mergeFields'),['previewModes','initialPreviewMode','previewHtmlValues','sanitizeHtml']);Array['isArray'](_0xaa97d8['definitions'])&&(_0xaa97d8['definitions']=_0xaa97d8['definitions']['map'](_0x136184=>'groupId'in _0x136184?(Array['isArray'](_0x136184['definitions'])&&(_0x136184['definitions']=_0x136184['definitions']['map'](_0x3441ec=>Xs(_0x3441ec,['defaultValue']))),_0x136184):Xs(_0x136184,['defaultValue']))),_0x599987['mergeFields']=_0xaa97d8;}if(_0x523ae0['plugins']['has']('StyleEditing')&&(_0x599987['style']=_0x523ae0['config']['get']('style')),_0x523ae0['plugins']['has']('TableEditing')){const _0x75f9b9=Xs(_0x523ae0['config']['get']('table'),['contentToolbar','tableToolbar','showHiddenBorders']);_0x523ae0['plugins']['has']('TablePropertiesEditing')?_0x75f9b9['tableProperties']&&'object'==typeof _0x75f9b9['tableProperties']&&(_0x75f9b9['tableProperties']=Xs(_0x75f9b9['tableProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x75f9b9['tableProperties'],_0x523ae0['plugins']['has']('TableCellPropertiesEditing')?_0x75f9b9['tableCellProperties']&&'object'==typeof _0x75f9b9['tableCellProperties']&&(_0x75f9b9['tableCellProperties']=Xs(_0x75f9b9['tableCellProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x75f9b9['tableCellProperties'],_0x523ae0['plugins']['has']('TableLayoutEditing')?_0x75f9b9['tableLayout']||(_0x75f9b9['tableLayout']={}):delete _0x75f9b9['tableLayout'],_0x523ae0['plugins']['has']('TableCaptionEditing')?_0x75f9b9['tableCaption']||(_0x75f9b9['tableCaption']={}):delete _0x75f9b9['tableCaption'],_0x599987['table']=_0x75f9b9;}_0x523ae0['plugins']['has']('TextPartLanguageEditing')&&(_0x599987['textPartLanguage']=_0x523ae0['config']['get']('language.textPartLanguage'));for(const [_0x408376,_0xbfd1b1]of js)_0x523ae0['plugins']['has'](_0x408376)&&(_0x599987[_0xbfd1b1]={});return _0x599987;}(_0x4f26e0),this['_editorsToConfigs']['set'](_0x4f26e0,_0x5285d4)),_0x5285d4;}};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(_0x20c5fa){super(),this['_generateUid']=_0x20c5fa||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x35b7c9,_0x21daf9,_0x4dbcd7){this['_uidCounter']=0x0;const _0x25ffa5=_0x35b7c9['cloneNode'](!0x0);on(_0x21daf9,_0x25ffa5);const _0x37c79a=_0x25ffa5['childNodes'],_0x1e4ab8=Array['from'](_0x37c79a)['filter'](_0x25f89e=>!(0x3===_0x25f89e['nodeType']&&''===Os(_0x25f89e)['trim']())),_0x767153=_0x1e4ab8['length'];this['_existingDataIds']=new Set(ks('data-id',null,_0x21daf9)['map'](_0x4eb4a2=>Ps(_0x4eb4a2,'data-id'))['filter'](_0xf71c06=>!!_0xf71c06));for(const _0x3b1da2 of _0x1e4ab8)_0x3b1da2&&_0x2159f2(_0x3b1da2)&&void 0x0===_0x3b1da2['attribs']['data-id']&&Ds(_0x3b1da2,'data-id','new-element');if(ks('data-id',null,_0x25ffa5)['forEach'](_0x1eaa0c=>{const _0x1a71be=Ps(_0x1eaa0c,'data-id');'new-element'===_0x1a71be||this['_existingDataIds']['has'](_0x1a71be)||Ds(_0x1eaa0c,'data-id','new-element');}),0x0===_0x21daf9['childNodes']['length']){const _0x41f9a5=[];return ks('data-id','new-element',_0x25ffa5)['forEach'](_0x481e02=>{const _0x4933a=this['_generateUid']();Ds(_0x481e02,'data-id',_0x4933a),_0x41f9a5['push'](_0x4933a);}),this['_removeSpecialComments'](_0x25ffa5),{'parsedContent':_0x25ffa5,'newNodeIds':_0x41f9a5,'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 _0x371a30=-0x1,_0x51dfb6=!0x1;for(let _0x10e6ab=0x0;_0x10e6ab<_0x767153;_0x10e6ab++){const _0x4642f2=_0x1e4ab8[_0x10e6ab],_0x1aa7d3=_0x1e4ab8[_0x10e6ab+0x1];if(this['_isNewNode'](_0x4642f2)){if(-0x1===_0x371a30&&(_0x371a30=_0x10e6ab),this['_markWrappedElements'](_0x4642f2),!this['_isNewNode'](_0x1aa7d3)){const [_0x3173bc,_0x318766]=this['_findReferenceNode'](_0x4642f2,_0x51dfb6,_0x21daf9);if(_0x3173bc){const _0x3a6cb8=Array['from'](_0x1e4ab8)['slice'](_0x371a30,_0x10e6ab+0x1);this['_insertNodes'](_0x3173bc,_0x3a6cb8,_0x318766),_0x371a30=-0x1;}}}else{if(this['_isExistingContentComment'](_0x4642f2))_0x51dfb6=!0x0;else{if(this['_isExistingNode'](_0x4642f2)){const _0x4f262d=Ps(_0x4642f2,'data-id');if(_0x4f262d&&this['_existingDataIds']['has'](_0x4f262d)){this['_referencedExistingIds']['add'](_0x4f262d);const _0x3042ce=vs('data-id',_0x4f262d,_0x21daf9);this['_replaceNode'](_0x3042ce,_0x4642f2);}}else{if(nn(_0x4642f2)){const _0x3cf891=rn(_0x4642f2);vs('data-id',_0x3cf891,_0x25ffa5)||this['_touchedNodesState']['removedIds']['push'](_0x3cf891);}}}}}for(const _0x134803 of this['_touchedNodesState']['removedIds']){const _0x87251=vs('data-id',_0x134803,_0x21daf9);_0x87251&&(this['_rescueUnwrappedElements'](_0x87251),this['_removeNode'](_0x87251,_0x134803,_0x4dbcd7));}if(ks('data-id','new-element',_0x21daf9)['forEach'](_0x349749=>{const _0x2caf43=this['_getUid'](_0x349749);Ds(_0x349749,'data-id',_0x2caf43),this['_touchedNodesState']['newIds']['push'](_0x2caf43);}),this['_removeSpecialComments'](_0x21daf9),_0x4dbcd7&&_0x4dbcd7['cutAfterUnstable']){const _0x12d978=this['_findLastConfirmationPoint'](_0x1e4ab8),_0x5bdad9=this['_getLastStableElement'](_0x21daf9,_0x12d978);this['_markUnstableElements'](_0x21daf9,_0x5bdad9);}if(this['_processWrappedElements'](_0x21daf9,_0x4dbcd7),_0x4dbcd7&&_0x4dbcd7['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x3b9e84=ks('data-id',this['_touchedNodesState']['lastTouchedId'],_0x21daf9);let _0x2031da=_0x3b9e84[_0x3b9e84['length']-0x1];for(;_0x2031da;)Bs(_0x2031da),_0x2031da=_0x2031da['parentNode'];}return{'parsedContent':_0x21daf9,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}_insertNodes(_0x51b20c,_0x5f4c9e,_0x37f838){for(const _0x7d295b of _0x5f4c9e){const _0x14eeec=this['_getUid'](_0x7d295b);Ds(_0x7d295b,'data-id',_0x14eeec),this['_touchedNodesState']['newIds']['push'](_0x14eeec),this['_touchedNodesState']['lastTouchedId']=_0x14eeec;}const _0xaa96be='afterbegin'===_0x37f838||'afterend'===_0x37f838?_0x5f4c9e['reverse']():_0x5f4c9e;for(const _0x429f49 of _0xaa96be)Hs(_0x51b20c,_0x429f49,_0x37f838);}['_replaceNode'](_0x5d2284,_0x3ae0ae){if(!_0x5d2284)return;if(_0x5b4d3b=_0x3ae0ae,Us(Os(_0x5d2284))===Us(Os(_0x5b4d3b)))return;var _0x5b4d3b;const _0x9a39b0=Ps(_0x5d2284,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x9a39b0),this['_touchedNodesState']['lastTouchedId']=_0x9a39b0,_0x147a80(_0x5d2284,_0x3ae0ae['cloneNode'](!0x0));}['_removeNode'](_0x28b6be,_0x501095,_0xab25a9){if(_0xab25a9&&_0xab25a9['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x501095;const _0x572c11=_0xab25a9['replaceRemovedWith']['cloneNode'](!0x0);Ds(_0x572c11,'data-id',_0x501095),Ds(_0x572c11,'data-removed','true'),_0x147a80(_0x28b6be,_0x572c11);}else _0x356c4e(_0x28b6be);}['_findReferenceNode'](_0x140d9c,_0x34b922,_0x5bcb86){const _0x506883=this['_findPrevElementWithDataId'](_0x140d9c,!0x1);if(_0x506883){const _0x37e865=rn(_0x506883),_0x5c10aa=vs('data-id',_0x37e865,_0x5bcb86);if(_0x5c10aa)return[_0x5c10aa,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x37e865);}const _0x5e15fa=this['_findNextElementWithDataId'](_0x140d9c,!0x1);if(_0x5e15fa){const _0x4d6e95=rn(_0x5e15fa),_0xd0538d=vs('data-id',_0x4d6e95,_0x5bcb86);if(_0xd0538d)return[_0xd0538d,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x4d6e95);}return _0x34b922?_0x140d9c['nextSibling']?this['_findFallbackReferenceNode'](_0x140d9c,_0x5bcb86):[_0x5bcb86['childNodes'][_0x5bcb86['childNodes']['length']-0x1],'afterend']:[_0x5bcb86['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x33c7ca,_0x1afbe5){const _0x29f920=[],_0xcccdb2=this['_findPrevElementWithDataId'](_0x33c7ca,!0x0);if(_0xcccdb2){const _0x414c41=vs('data-id',rn(_0xcccdb2),_0x1afbe5);_0x414c41&&_0x29f920['push']([_0x414c41,'afterend']);}const _0x2c6d63=this['_findNextElementWithDataId'](_0x33c7ca,!0x0);if(_0x2c6d63){const _0xbba932=vs('data-id',rn(_0x2c6d63),_0x1afbe5);_0xbba932&&_0x29f920['push']([_0xbba932,'beforebegin']);}return _0x29f920['length']>0x1?Vs(_0x29f920[0x0][0x0])<=Vs(_0x29f920[0x1][0x0])?_0x29f920[0x0]:_0x29f920[0x1]:0x1===_0x29f920['length']?_0x29f920[0x0]:[_0x1afbe5['lastChild'],'afterend'];}_findNextElementWithDataId(_0x143df7,_0x25268e){let _0x31bd95=_0x143df7['nextSibling'],_0x2d4242=null,_0x5ced9c=!0x1;for(;_0x31bd95;){if(_0x1b9e99(_0x31bd95)){if(nn(_0x31bd95)&&(_0x2d4242=_0x31bd95),this['_isExistingContentComment'](_0x31bd95)&&_0x25268e&&!_0x5ced9c){_0x5ced9c=!0x0,_0x31bd95=_0x31bd95['nextSibling'];continue;}break;}const _0x88e861=Ps(_0x31bd95,'data-id');if(_0x88e861&&'new-element'!==_0x88e861&&this['_existingDataIds']['has'](_0x88e861)){_0x2d4242=_0x31bd95;break;}_0x31bd95=_0x31bd95['nextSibling'];}return _0x2d4242;}_findPrevElementWithDataId(_0x4b7100,_0x48e736){let _0xbcc7db=_0x4b7100['previousSibling'],_0xe393e5=null,_0x2d5b81=!0x1;for(;_0xbcc7db;){if(_0x1b9e99(_0xbcc7db)){if(nn(_0xbcc7db)&&(_0xe393e5=_0xbcc7db),this['_isExistingContentComment'](_0xbcc7db)&&_0x48e736&&!_0x2d5b81){_0x2d5b81=!0x0,_0xbcc7db=_0xbcc7db['previousSibling'];continue;}break;}const _0x13e67b=Ps(_0xbcc7db,'data-id');if(_0x13e67b&&'new-element'!==_0x13e67b&&this['_existingDataIds']['has'](_0x13e67b)){_0xe393e5=_0xbcc7db;break;}_0xbcc7db=_0xbcc7db['previousSibling'];}return _0xe393e5;}_markWrappedElements(_0x1a4577){_0x2159f2(_0x1a4577)&&ks('data-id',null,_0x1a4577)['forEach'](_0x5bc779=>{this['_isExistingNode'](_0x5bc779)&&(Ds(_0x5bc779,'data-wrapped-id',Ps(_0x5bc779,'data-id')),Ds(_0x5bc779,'data-id',null));});}_processWrappedElements(_0x5578f5,_0x4e6b74){ks('data-wrapped-id',null,_0x5578f5)['forEach'](_0x3d70c8=>{const _0x2ccbd1=Ps(_0x3d70c8,'data-wrapped-id');if(this['_hasUnstableParent'](_0x3d70c8))return;const _0x3a403f=vs('data-id',_0x2ccbd1,_0x5578f5);Ds(_0x3d70c8,'data-id',_0x2ccbd1),_0x3a403f&&(this['_removeNode'](_0x3a403f,_0x2ccbd1,_0x4e6b74),this['_touchedNodesState']['removedIds']['push'](_0x2ccbd1),this['_touchedNodesState']['lastTouchedId']=_0x2ccbd1);});}_hasUnstableParent(_0x380bed){let _0x2bd9c8=_0x380bed['parentNode'];for(;_0x2bd9c8;){if(Ps(_0x2bd9c8,'data-unstable'))return!0x0;_0x2bd9c8=_0x2bd9c8['parentNode'];}return!0x1;}_rescueUnwrappedElements(_0x1cbe04){const _0x4e0f86=new Set(this['_touchedNodesState']['removedIds']),_0x1d664d=new Set(this['_touchedNodesState']['newIds']);ks('data-id',null,_0x1cbe04)['forEach'](_0x31b9bf=>{const _0x1e237c=Ps(_0x31b9bf,'data-id'),_0x2453fe=!!_0x1e237c&&this['_referencedExistingIds']['has'](_0x1e237c),_0x3b263f=!!_0x1e237c&&_0x1d664d['has'](_0x1e237c);if(!_0x1e237c||!_0x2453fe&&!_0x3b263f)return;if(_0x4e0f86['has'](_0x1e237c))return;let _0x1a3010=_0x31b9bf['parentNode'],_0xf5fed7=!0x1;for(;_0x1a3010;){if(_0x1a3010===_0x1cbe04){_0xf5fed7=!0x0;break;}const _0x475422=Ps(_0x1a3010,'data-id');if(_0x475422&&(this['_referencedExistingIds']['has'](_0x475422)||_0x1d664d['has'](_0x475422)))return;_0x1a3010=_0x1a3010['parentNode'];}if(_0xf5fed7){if(ti(_0x1cbe04,_0x31b9bf),_0x2453fe){const _0x3d0cdf=this['_generateUid'](),_0x25bfba=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x1e237c);-0x1!==_0x25bfba&&this['_touchedNodesState']['modifiedIds']['splice'](_0x25bfba,0x1),Ds(_0x31b9bf,'data-unwrapped-id',_0x1e237c),Ds(_0x31b9bf,'data-id',_0x3d0cdf),this['_touchedNodesState']['newIds']['push'](_0x3d0cdf),this['_touchedNodesState']['rescuedNewIds']['add'](_0x3d0cdf),this['_touchedNodesState']['lastTouchedId']=_0x3d0cdf;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x1e237c),this['_touchedNodesState']['lastTouchedId']=_0x1e237c;}});}_getUid(_0x20046d){return this['_isExistingNode'](_0x20046d)?Ps(_0x20046d,'data-id'):this['_generateUid']();}_removeSpecialComments(_0xd646cb){Ls(_0xd646cb)['filter'](_0x1b4cc9=>nn(_0x1b4cc9)||this['_isExistingContentComment'](_0x1b4cc9))['forEach'](_0x32270b=>{_0x356c4e(_0x32270b);});}_findLastConfirmationPoint(_0x4725e9){let _0x1b6370=null,_0x28a4c3=null,_0x3b0ae9=null,_0x52538d=null;const _0x5ed1e7=_0x2c127a=>{_0x2c127a&&(_0x1b6370=_0x2c127a),_0x3b0ae9=null,_0x52538d=null;};for(let _0x39d587=0x0;_0x39d587<_0x4725e9['length'];_0x39d587++){const _0x60cf77=_0x4725e9[_0x39d587];if(this['_isExistingContentComment'](_0x60cf77)){_0x5ed1e7(_0x28a4c3);continue;}if(_0x2159f2(_0x60cf77)){const _0xa7f861=Ps(_0x60cf77,'data-id'),_0x4698f6=_0x39d587===_0x4725e9['length']-0x1;if(_0xa7f861&&'new-element'!==_0xa7f861&&this['_touchedNodesState']['modifiedIds']['includes'](_0xa7f861)&&!_0x4698f6){_0x5ed1e7(_0xa7f861),_0x28a4c3=_0xa7f861;continue;}}let _0x2ba472;const _0x27953d=rn(_0x60cf77);if(_0x27953d&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x27953d))_0x28a4c3=_0x27953d;else{if(_0x27953d&&this['_touchedNodesState']['newIds']['includes'](_0x27953d))_0x2ba472='N';else{if(!nn(_0x60cf77))continue;_0x2ba472='R';}_0x2ba472===_0x52538d||null===_0x52538d?_0x52538d=_0x2ba472:null!==_0x3b0ae9?(_0x5ed1e7(_0x28a4c3),_0x52538d=_0x2ba472):(_0x3b0ae9=_0x52538d,_0x52538d=_0x2ba472),_0x28a4c3=_0x27953d;}}const _0x346b52=_0x4725e9[_0x4725e9['length']-0x1];return _0x346b52&&!_0x2159f2(_0x346b52)&&!nn(_0x346b52)&&_0x28a4c3&&_0x5ed1e7(_0x28a4c3),_0x1b6370;}_getLastStableElement(_0x19af65,_0x52c572){if(!_0x52c572)return null;const _0x1f4c47=vs('data-id',_0x52c572,_0x19af65);if(!_0x1f4c47)return null;const _0x2c5d21=[_0x1f4c47,...Ms(_0x1f4c47)]['at'](-0x2);if(_0x2c5d21===_0x1f4c47)return _0x1f4c47;let _0x3da745=_0x2c5d21['previousSibling'];for(;_0x3da745&&!_0x2159f2(_0x3da745);)_0x3da745=_0x3da745['previousSibling'];return _0x3da745;}_markUnstableElements(_0x1900ef,_0x1c19b5){const _0x266a71=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x358305=_0x1c19b5?_0x1c19b5['nextSibling']:_0x1900ef['firstChild'];for(;_0x358305;)_0x2159f2(_0x358305)&&(_0x266a71['has'](Ps(_0x358305,'data-id'))||ks('data-id',null,_0x358305)['some'](_0x399736=>_0x266a71['has'](Ps(_0x399736,'data-id'))))&&Ds(_0x358305,'data-unstable','true'),_0x358305=_0x358305['nextSibling'];}['_isNewNode'](_0x228405){return Boolean('new-element'===Ps(_0x228405,'data-id'));}_isExistingNode(_0x2017ac){return Boolean((Ps(_0x2017ac,'data-id')||'')['length']>0x0&&'new-element'!==Ps(_0x2017ac,'data-id'));}_isExistingContentComment(_0x2d7ba2){return Boolean(_0x1b9e99(_0x2d7ba2)&&Os(_0x2d7ba2)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function nn(_0xe3fcf0){return!!_0xe3fcf0&&Boolean(_0x1b9e99(_0xe3fcf0)&&Os(_0xe3fcf0)['match'](/removed[\s*-]data-id="[^"]+"/));}function rn(_0xd6b281){if(!_0xd6b281)return null;if(_0x2159f2(_0xd6b281))return Ps(_0xd6b281,'data-id')??null;if(_0x1b9e99(_0xd6b281)){const _0x424850=Os(_0xd6b281)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x424850&&_0x424850[0x1])return _0x424850[0x1];}return null;}function on(_0x5530c9,_0x51d1a8){const _0x2c6580=new Map();for(const _0x21fec2 of ys(_0x5530c9))xs(_0x21fec2)||_0x2c6580['set'](Ps(_0x21fec2,'data-id'),_0x21fec2);const _0x38e8ea=new Set();for(const _0x3a716f of ys(_0x51d1a8)){if(xs(_0x3a716f))continue;const _0x68c57c=Ps(_0x3a716f,'data-id'),_0x2125ca=_0x68c57c?_0x2c6580['get'](_0x68c57c):void 0x0;_0x2125ca?(_0x147a80(_0x3a716f,_0x34616a(_0x2125ca,!0x0)),_0x38e8ea['add'](_0x68c57c)):_0x356c4e(_0x3a716f);}for(const _0x15d2cc of Ls(_0x51d1a8))nn(_0x15d2cc)&&_0x2c6580['has'](rn(_0x15d2cc))&&_0x356c4e(_0x15d2cc);const _0x4fe2dd=new Set(ks('data-id',null,_0x51d1a8)['map'](_0x1dfdfc=>Ps(_0x1dfdfc,'data-id')));for(const [_0x1a6ce6,_0x313e43]of _0x2c6580){if(_0x38e8ea['has'](_0x1a6ce6))continue;let _0x52f6bd=_0x313e43['parent'],_0x5557f3=null;for(;_0x52f6bd&&_0x2159f2(_0x52f6bd);){const _0x4c69aa=Ps(_0x52f6bd,'data-id');if(_0x4c69aa&&_0x4fe2dd['has'](_0x4c69aa)){_0x5557f3=_0x4c69aa;break;}_0x52f6bd=_0x52f6bd['parent'];}if(!_0x5557f3)continue;const _0x1d2b33=vs('data-id',_0x5557f3,_0x51d1a8);_0x1d2b33&&_0x49bdc9(_0x1d2b33,_0x34616a(_0x313e43,!0x0));}}const an=/* #__PURE__ -- @preserve */
|
|
27
|
+
At();var hn=class extends an{_m2html;constructor(){super();const _0x159427=Object['entries'](_0x98e2e5),_0x4507be=_0x159427['findIndex'](([_0x2a357f])=>'rehypeDomRaw'===_0x2a357f);if(-0x1===_0x4507be)throw new ct('ai-response-parser-unable-to-set-up-parser');_0x159427['splice'](_0x4507be+0x1,0x0,['rehypeSanitize',_0x5265c1]),this['_m2html']=new _0x570576({'plugins':Object['fromEntries'](_0x159427)});}convertMarkdownToHTML(_0x408ad2){const _0x21eaef=this['_m2html']['parse'](_0x408ad2);return this['parseAndNormalizeHTML'](_0x21eaef);}['parseAndNormalizeHTML'](_0x4cc095){return this['_parseHTML'](_0x4cc095);}['_parseHTML'](_0x19bfe7){const _0x4847bf=Rs('<dummy>'+_0x19bfe7['replace'](/<[^>]*?$/g,'')+'</dummy>');return cn(_0x4847bf),_0x4847bf['children']=_0x4847bf['children'][0x0]['children'],_0x4847bf;}};function cn(_0x348bee){for(const _0x4d3b0c of _0x348bee['children'])_0x2159f2(_0x4d3b0c)?'pre'!==_0x4d3b0c['name']&&cn(_0x4d3b0c):_0x37569a(_0x4d3b0c)&&(_0x4d3b0c['data']=_0x4d3b0c['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function ln({changeGroups:_0x177d52,documentContextContent:_0x1d2447,showDiff:_0x11687a,trimUnchanged:_0x8278c4=!0x0}){const _0x4886ad=qs(_0x177d52,_0x1d2447);return _0x177d52['map'](_0x2fe4b0=>{if(!_0x2fe4b0['editor']||'destroyed'===_0x2fe4b0['editor']['state'])return null;const _0x260a99=Gs(_0x2fe4b0['editor'],_0x2fe4b0['rootName']),_0xceffcd=new _0x577dfe([]),_0x2f01de=new _0x577dfe([]),_0x5103b5=new Set();for(const _0x4ca735 of _0x2fe4b0['changes'])'new'==_0x4ca735['type']&&ks('data-id',null,_0x4ca735['node'])['forEach'](_0x7c9b2=>{_0x5103b5['add'](Ps(_0x7c9b2,'data-id'));});for(const _0x36766d of _0x2fe4b0['changes'])if('removed'!=_0x36766d['type']?_0x2f01de['children']['push'](_0x36766d['node']['cloneNode'](!0x0)):_0x11687a||_0x5103b5['has'](_0x36766d['id'])||_0x2f01de['children']['push'](_0x36766d['node']['cloneNode'](!0x0)),'new'!=_0x36766d['type']&&(_0x11687a||'removed'!=_0x36766d['type'])){const _0x7bbf74=_0x43283b(_0x504742=>Ps(_0x504742,'data-id')==_0x36766d['id'],_0x1d2447['get'](_0x2fe4b0['documentId']),!0x0);_0x7bbf74&&_0xceffcd['children']['push'](_0x7bbf74['cloneNode'](!0x0));}if(_0x260a99&&_0x4886ad['has'](_0x2fe4b0['index']))return{'type':_0x2fe4b0['changes'][0x0]['type'],'index':_0x2fe4b0['index'],'state':_0x2fe4b0['state'],'outdatedReason':_0x2fe4b0['outdatedReason'],'content':new _0x577dfe([]),'hasChanges':!0x1};let _0x14a9c1,_0x4276c3,_0x173a0a;try{({content:_0x14a9c1,hasChanges:_0x4276c3}=un(_0x2fe4b0['editor'],_0xceffcd,_0x2f01de,_0x11687a,_0x8278c4));}catch{return{'type':_0x2fe4b0['changes'][0x0]['type'],'index':_0x2fe4b0['index'],'state':_0x2fe4b0['state'],'outdatedReason':_0x2fe4b0['outdatedReason'],'content':new _0x577dfe([]),'hasChanges':!0x1};}if(_0x260a99){_0x173a0a=_0x2fe4b0['editor']['ui']['getEditableElement'](_0x2fe4b0['rootName'])?.['tagName']['toLowerCase']();const _0xf4292=_0x14a9c1['children']['filter'](_0x2159f2);0x1===_0xf4292['length']&&(_0x14a9c1=new _0x577dfe(_0xf4292[0x0]['children']));}return{'type':_0x2fe4b0['changes'][0x0]['type'],'index':_0x2fe4b0['index'],'state':_0x2fe4b0['state'],'outdatedReason':_0x2fe4b0['outdatedReason'],'content':_0x14a9c1,'hasChanges':_0x4276c3,'wrapperTag':_0x173a0a};})['filter'](_0x222d21=>null!==_0x222d21);}function un(_0x2c3693,_0x379d2a,_0x443260,_0x460395,_0x546948=!0x0){const _0x55e29c=_0x2c3693['plugins']['get']('DocumentCompare'),_0x12e35f=Os(_0x379d2a),_0x164e10=Os(_0x443260),_0x9bf33f=_0x2c3693['data']['parse'](_0x12e35f,'$root'),_0x350975=_0x2c3693['model']['createPositionAt'](_0x9bf33f,0x0),_0x26f9f8=_0x55e29c['getDiff'](_0x12e35f,_0x164e10,{'anchor':_0x350975,'markDeletions':_0x460395,'targetEditor':_0x2c3693})['getOperations']();if(0x0==_0x26f9f8['length'])return{'content':_0x379d2a['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x460395?function(_0x1ff0a1,_0x4d2524,_0xeb29fa){if(0x0==_0x1ff0a1['length'])return;const _0x415e51=_0xeb29fa['plugins']['get']('DocumentCompare'),_0x2fb90d=_0xeb29fa['plugins']['get']('SuggestionsConversion');_0xeb29fa['model']['change'](_0xffae31=>{const _0x5c231d=new Set();for(let _0x77c236=0x0;_0x77c236<_0x1ff0a1['length'];_0x77c236++){const _0x4869f9=_0x1ff0a1[_0x77c236];if(_0x4869f9['baseVersion']=null,_0x4869f9['isDocumentOperation']=!0x1,!_0x4e897d(_0x4869f9)){if(_0x415e51['isMarkedRemoveOperation'](_0x4869f9)){const _0x4d6c21=_0x259db7(_0x4869f9['newRange'],_0xeb29fa['model']),_0x54e80e='suggestion:deletion:'+kt()+':$aiSuggestion';_0x4d2524['markers']['set'](_0x54e80e,_0x4d6c21);}else switch(_0x4869f9['type']){case'rename':{if(_0x4869f9['oldName']==_0x4869f9['newName'])break;_0xffae31['batch']['addOperation'](_0x4869f9),_0xeb29fa['model']['applyOperation'](_0x4869f9);const _0x1c2119='$elementName',_0x653b71=_0x4869f9['position'],_0x43102d=_0xeb29fa['model']['createRange'](_0x653b71,_0xeb29fa['model']['createPositionAt'](_0x653b71['nodeAfter'],'end')),_0x210126='suggestion:attribute:'+_0x1c2119+':'+kt()+':$aiSuggestion';_0x4d2524['markers']['set'](_0x210126,_0x43102d);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x4869f9['oldValue']==_0x4869f9['newValue'])break;_0xffae31['batch']['addOperation'](_0x4869f9),_0xeb29fa['model']['applyOperation'](_0x4869f9);const _0x5664de=_0x4869f9['key'];if(!_0x2fb90d['isRegisteredAttribute'](_0x5664de))break;const _0x1abb51=_0x259db7(_0x4869f9['range'],_0xeb29fa['model']),_0xcbb6ee='suggestion:attribute:'+_0x5664de+':'+kt()+':$aiSuggestion';_0x4d2524['markers']['set'](_0xcbb6ee,_0x1abb51);break;}case'insert':{if(_0xffae31['batch']['addOperation'](_0x4869f9),_0xeb29fa['model']['applyOperation'](_0x4869f9),dn(_0x4d2524,_0x4869f9),_0x1ff0a1[_0x77c236+0x1]&&'move'==_0x1ff0a1[_0x77c236+0x1]['type'])break;const _0x16f733=_0x4869f9['position'],_0xad5e6a=_0x4869f9['howMany'],_0x31e7a2=_0x259db7(_0xeb29fa['model']['createRange'](_0x16f733,_0x16f733['getShiftedBy'](_0xad5e6a)),_0xeb29fa['model']),_0xe721d1='suggestion:insertion:'+kt()+':$aiSuggestion';_0x4d2524['markers']['set'](_0xe721d1,_0x31e7a2);break;}case'split':{_0xffae31['batch']['addOperation'](_0x4869f9),_0xeb29fa['model']['applyOperation'](_0x4869f9),dn(_0x4d2524,_0x4869f9);const _0x49d8d4=_0x4869f9['splitPosition'],_0x42a39e=_0x4869f9['moveTargetPosition'],_0x5950be=_0xeb29fa['model']['createRange'](_0x49d8d4,_0x42a39e),_0x4d7fdc='suggestion:insertion:'+kt()+':$aiSuggestion';_0x4d2524['markers']['set'](_0x4d7fdc,_0x5950be);break;}case'move':{_0xffae31['batch']['addOperation'](_0x4869f9),_0xeb29fa['model']['applyOperation'](_0x4869f9),dn(_0x4d2524,_0x4869f9);const _0x3fb7ed=_0x4869f9['getMovedRangeStart'](),_0x3fc909=_0x4869f9['howMany'];for(let _0x5f0542=0x0;_0x5f0542<_0x3fc909;_0x5f0542++){const _0x18a422=_0x3fb7ed['getShiftedBy'](_0x5f0542)['nodeAfter'];_0x5c231d['add'](_0x18a422);}break;}case'remove':{const _0x2ef3ad=_0x4869f9['sourcePosition'],_0x5afa3d=_0x4869f9['howMany'],_0x5208d8=new _0x150372(_0x2ef3ad,_0x5afa3d);_0xffae31['batch']['addOperation'](_0x5208d8),_0xeb29fa['model']['applyOperation'](_0x5208d8),dn(_0x4d2524,_0x4869f9);break;}}}}for(const _0x34329e of _0x5c231d){const _0x3c1f40=_0xeb29fa['model']['createRangeOn'](_0x34329e),_0x2e2876='suggestion:formatBlock:$fakeWrap:'+kt()+':$aiSuggestion';_0x4d2524['markers']['set'](_0x2e2876,_0x259db7(_0x3c1f40,_0xeb29fa['model']));}});}(_0x26f9f8,_0x9bf33f,_0x2c3693):_0x2c3693['model']['change'](_0x48cb84=>{for(const _0x3a54ba of _0x26f9f8)if(!_0x4e897d(_0x3a54ba)){if('remove'==_0x3a54ba['type']){const _0x20c841=_0x3a54ba['sourcePosition'],_0x130920=_0x3a54ba['howMany'],_0x232551=new _0x150372(_0x20c841,_0x130920);_0x48cb84['batch']['addOperation'](_0x232551),_0x2c3693['model']['applyOperation'](_0x232551),dn(_0x9bf33f,_0x3a54ba);}else{if('marker'==_0x3a54ba['type']){const _0x10b96e=_0x3a54ba['name'],_0x474abd=_0x3a54ba['newRange'];null!==_0x474abd?_0x9bf33f['markers']['set'](_0x10b96e,_0x474abd):_0x9bf33f['markers']['delete'](_0x10b96e);}else _0x3a54ba['baseVersion']=null,_0x3a54ba['isDocumentOperation']=!0x1,_0x48cb84['batch']['addOperation'](_0x3a54ba),_0x2c3693['model']['applyOperation'](_0x3a54ba),dn(_0x9bf33f,_0x3a54ba);}}}),_0x546948){const _0x1204ee=_n(_0x2c3693,_0x26f9f8,_0x9bf33f);An(_0x2c3693['model'],_0x1204ee),function(_0x546913,_0x1cce78){const _0x4c6c5a=_0x1cce78['getFirstRange']()['start'];let _0x43b3c7=_0x1cce78['getFirstRange']()['end'];const _0x48a90f=_0x4c6c5a['root'];(_0x43b3c7['textNode']||_0x43b3c7['nodeAfter']&&_0x43b3c7['nodeAfter']['is']('$text'))&&(_0x24aa70(_0x43b3c7,'...'),En(_0x48a90f,_0x43b3c7,0x3),_0x43b3c7=_0x43b3c7['getShiftedBy'](0x3)),(_0x4c6c5a['textNode']||_0x4c6c5a['nodeBefore']&&_0x4c6c5a['nodeBefore']['is']('$text'))&&(_0x24aa70(_0x4c6c5a,'...'),En(_0x48a90f,_0x4c6c5a,0x3),_0x4c6c5a['parent']==_0x43b3c7['parent']&&(_0x43b3c7=_0x43b3c7['getShiftedBy'](0x3)));const _0x5ab0c1=_0x546913['createRange'](_0x546913['createPositionAt'](_0x48a90f,0x0),_0x4c6c5a),_0x272497=_0x546913['createRange'](_0x43b3c7,_0x546913['createPositionAt'](_0x48a90f,'end')),_0x4b2437=[..._0x5ab0c1['getMinimalFlatRanges'](),..._0x272497['getMinimalFlatRanges']()];_0x4b2437['reverse']();for(const _0x309d87 of _0x4b2437)_0x12f258(_0x309d87),pn(_0x48a90f,_0x309d87);}(_0x2c3693['model'],_0x1204ee);}return{'content':Rs(_0x2c3693['data']['stringify'](_0x9bf33f,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function dn(_0x51ff0c,_0x30cea9){for(const [_0x33928a,_0x578ca2]of _0x51ff0c['markers']){const _0x299ed9=_0x4b6f52['_createFromRanges'](_0x578ca2['getTransformedByOperation'](_0x30cea9));_0x299ed9['root']==_0x51ff0c?_0x51ff0c['markers']['set'](_0x33928a,_0x299ed9):_0x51ff0c['markers']['delete'](_0x33928a);}}function _n(_0x4165a8,_0x3a1ce5,_0x3aff02){const _0x4f98ec=_0x4165a8['plugins']['get']('DocumentCompare');let _0x27b50a=_0x4165a8['model']['createPositionAt'](_0x3aff02,Number['POSITIVE_INFINITY']),_0x481136=_0x4165a8['model']['createPositionAt'](_0x3aff02,0x0);for(const _0x36247c of _0x3a1ce5){let _0x3ad458,_0x53d9f7;if(_0x4f98ec['isMarkedRemoveOperation'](_0x36247c))_0x3ad458=_0x36247c['newRange']['start'],_0x53d9f7=_0x36247c['newRange']['end'];else switch(_0x27b50a=gn(_0x27b50a,_0x36247c),_0x481136=gn(_0x481136,_0x36247c),_0x36247c['type']){case'rename':_0x3ad458=_0x36247c['position'],_0x53d9f7=_0x3ad458['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x3ad458=_0x36247c['range']['start'],_0x53d9f7=_0x36247c['range']['end'];break;case'insert':_0x3ad458=_0x36247c['position'],_0x53d9f7=_0x3ad458['getShiftedBy'](_0x36247c['howMany']);break;case'split':_0x3ad458=_0x36247c['splitPosition'],_0x53d9f7=_0x36247c['moveTargetPosition'];break;case'merge':{const _0x100d1d=_0x36247c['targetPosition']['path']['slice'](0x0,-0x1);_0x3ad458=_0x4165a8['model']['createPositionFromPath'](_0x3aff02,_0x100d1d),_0x53d9f7=_0x3ad458['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x12ffba=_0x36247c['howMany'],_0x47cc86=_0x36247c['sourcePosition']['_getTransformedByInsertion'](_0x36247c['targetPosition'],_0x12ffba),_0x2e7aa6=_0x36247c['getMovedRangeStart']();'remove'==_0x36247c['type']?(_0x3ad458=_0x47cc86,_0x53d9f7=_0x47cc86):(_0x3ad458=_0x2e7aa6,_0x53d9f7=_0x2e7aa6['getShiftedBy'](_0x12ffba));break;}}_0x3ad458&&_0x3ad458['isBefore'](_0x27b50a)&&(_0x27b50a=_0x3ad458['clone'](),_0x27b50a['stickiness']='toNone'),_0x53d9f7&&_0x53d9f7['isAfter'](_0x481136)&&(_0x481136=_0x53d9f7['clone'](),_0x481136['stickiness']='toNone');}return _0x4165a8['model']['createSelection'](_0x4165a8['model']['createRange'](_0x27b50a,_0x481136));}function gn(_0x1ad9b3,_0x26b6bb){return'move'!=_0x26b6bb['type']&&'remove'!=_0x26b6bb['type']||_0x26b6bb['sourceRange']['containsPosition'](_0x1ad9b3)&&((_0x1ad9b3=_0x26b6bb['sourcePosition']['clone']())['stickiness']='toNone'),_0x1ad9b3['getTransformedByOperation'](_0x26b6bb);}function An(_0xdc4c98,_0xbe5538){In(_0xdc4c98,_0xbe5538,'forward');const _0x57e65e=_0xbe5538['getFirstRange']();_0xbe5538['setTo']([]),_0xbe5538['setTo'](_0x57e65e,{'backward':!0x0}),In(_0xdc4c98,_0xbe5538,'backward');}function In(_0x126151,_0x20883a,_0x524490){let _0x1928e=0x14;for(;_0x1928e;){_0x126151['modifySelection'](_0x20883a,{'unit':'word','direction':_0x524490}),_0x1928e--;const _0x29dc2e=_0x20883a['focus']['forward'==_0x524490?'nodeBefore':'nodeAfter'];if(_0x29dc2e&&_0x29dc2e['is']('element')&&_0x126151['schema']['isBlock'](_0x29dc2e)&&_0x126151['schema']['isObject'](_0x29dc2e))break;}}function pn(_0x327c2f,_0x1534fc){for(const [_0x18a06c,_0x39ccbe]of _0x327c2f['markers']){const _0x113cb5=_0x39ccbe['_getTransformedByDeletion'](_0x1534fc['start'],_0x1534fc['end']['offset']-_0x1534fc['start']['offset']);null!=_0x113cb5?_0x327c2f['markers']['set'](_0x18a06c,_0x113cb5):_0x327c2f['markers']['delete'](_0x18a06c);}}function En(_0x42652e,_0x523af7,_0x1e6fef){for(let [_0x5b4c4b,_0x48fe96]of _0x42652e['markers'])_0x48fe96=_0x48fe96['_getTransformedByInsertion'](_0x523af7,_0x1e6fef,!0x1)[0x0],_0x42652e['markers']['set'](_0x5b4c4b,_0x48fe96);}function mn(_0x3602e3,_0x3f6daa){for(const _0x44192e of _0x3602e3)'noop'!==_0x44192e['type']&&(_0x44192e['_aiSource']=_0x3f6daa);}var Tn=class extends _0x57f218{static get['pluginName'](){return'AIGateway';}static get requires(){return[_0x14613c,fs];}get['models'](){return this['context']['plugins']['get'](fs)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['apply'](_0xd43129,_0x4ab95f){const {applyMethod:_0x4848bf,roots:_0x28f12e}=_0x4ab95f,_0x4900ba='suggest'===_0x4848bf;if(_0xd43129['error']||!_0xd43129['results']['length'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0xd43129['status']});if(_0x28f12e){if(0x0===_0x28f12e['length'])throw new ct('ai-gateway-apply-empty-roots',this);for(const {channelId:_0x398890,rootName:_0x3b8036}of _0x28f12e)if(!_0xd43129['results']['some'](_0x22ead4=>_0x22ead4['channelId']===_0x398890&&_0x22ead4['rootName']===_0x3b8036))throw new ct('ai-gateway-apply-root-not-found',this,{'channelId':_0x398890,'rootName':_0x3b8036});}const _0x15214c=_0xd43129['results']['reduce']((_0x42120b,_0x38a61c)=>{if(_0x28f12e&&!_0x28f12e['some'](_0x203c9f=>_0x203c9f['channelId']===_0x38a61c['channelId']&&_0x203c9f['rootName']===_0x38a61c['rootName']))return _0x42120b;if('completed'!==_0x38a61c['status'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0x38a61c['status'],'channelId':_0x38a61c['channelId'],'rootName':_0x38a61c['rootName']});if(_0x4900ba&&!_0x38a61c['editor']['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',this,{'channelId':_0x38a61c['channelId'],'rootName':_0x38a61c['rootName']});let _0x4bfea8=_0x42120b['get'](_0x38a61c['editor']);return _0x4bfea8||(_0x4bfea8=[],_0x42120b['set'](_0x38a61c['editor'],_0x4bfea8)),_0x4bfea8['push'](_0x38a61c),_0x42120b;},new Map()),_0x1635d4=this['context']['plugins']['get'](_0x14613c);for(const [_0x4ba513,_0x4fab11]of _0x15214c){const _0x33d694=_0x4fab11['map'](_0x2f9dbf=>{const _0x1e8282=_0x4ba513['model']['createPositionAt'](_0x4ba513['model']['document']['getRoot'](_0x2f9dbf['rootName']),0x0),_0x4960ed=Qs(_0x4ba513,_0x2f9dbf['rootName'],_0x2f9dbf['contentRawOld'],_0x2f9dbf['contentRawNew']);if(!_0x4960ed)return _0x2f9dbf['droppedUnsupportedInlineChange']=!0x0,null;const _0x5a8aa2=_0x1635d4['getDiff'](_0x4960ed['before'],_0x4960ed['after'],{'anchor':_0x1e8282,'markDeletions':_0x4900ba,'targetEditor':_0x4ba513}),_0x4f84a4=_0x4ba513['model']['document']['history']['getOperations'](_0x2f9dbf['documentVersion']),_0x33cfa8={'document':_0x4ba513['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x4e5d31=_0x1b55c4(_0x5a8aa2['getOperations'](),_0x4f84a4,_0x33cfa8)['operationsA'];return mn(_0x4e5d31,_0x4ab95f['aiSource']??'api'),_0x4e5d31;});_0x4ba513['model']['change'](_0xe433ab=>{for(const _0x3bb918 of _0x33d694)_0x3bb918&&(_0x4900ba?_0x4ba513['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x3bb918):_0x1635d4['applyOperations'](_0xe433ab,_0x3bb918));});}}mergeChangesIntoContent(_0x3c7a8f,_0x2d080a,_0x1936ac){const _0x5dece0=new hn(),_0xba18d8=new sn();let _0x1e49bc=_0x5dece0['parseAndNormalizeHTML'](_0x2d080a);for(const _0x50618c of _0x3c7a8f)try{const _0x6f7e83=_0x5dece0['parseAndNormalizeHTML'](_0x50618c['content']);_0x1e49bc=_0xba18d8['merge'](_0x6f7e83,_0x1e49bc,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x20c32c){throw new ct('ai-gateway-merge-failed',this,{..._0x50618c},_0x20c32c);}return un(_0x1936ac,_0x5dece0['parseAndNormalizeHTML'](_0x2d080a),_0x1e49bc,!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(_0x2a6a8b){const _0xadb9e4={};if(!_0x2a6a8b)return _0xadb9e4;('isWebSearchEnabled'in _0x2a6a8b?_0x2a6a8b['isWebSearchEnabled']:_0x2a6a8b['webSearch'])&&(_0xadb9e4['webSearch']={});const _0x48fbd6='isReasoningEnabled'in _0x2a6a8b?_0x2a6a8b['isReasoningEnabled']:_0x2a6a8b['reasoning'];return _0x48fbd6&&(_0xadb9e4['reasoning']='string'==typeof _0x48fbd6?{'level':_0x48fbd6}:{}),_0xadb9e4;}toggleWebSearch(){this['setWebSearch'](!this['_isWebSearchEnabled']);}toggleReasoning(){this['setReasoning'](!this['_isReasoningEnabled']);}setWebSearch(_0x44336c){_0x44336c!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x44336c,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}setReasoning(_0x4249cc){_0x4249cc!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x4249cc,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}};function bn(_0x11790f,_0x27bcab,_0x12d303,_0x11c01e){if(_0x11790f instanceof ct)return _0x11790f;const _0x28ea24=_0x11790f?.['data'];return new ct(_0x27bcab,_0x12d303,void 0x0!==_0x28ea24?{..._0x11c01e,'backendData':_0x28ea24}:_0x11c01e,_0x11790f);}var Sn=class{_editor;_rootName;['_channelId'];['_sessionId'];_documentVersion;_contentRawOld;_contentRawNew;['_error'];_isAborted=!0x1;_droppedUnsupportedInlineChange=!0x1;constructor(_0x25d712){this['_editor']=_0x25d712['editor'],this['_rootName']=_0x25d712['rootName'],this['_channelId']=_0x25d712['channelId'],this['_sessionId']=_0x25d712['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(_0x428e73){this['_documentVersion']=_0x428e73;}get contentRawOld(){return this['_contentRawOld'];}set contentRawOld(_0x1178a5){this['_contentRawOld']=_0x1178a5;}get contentRawNew(){return this['_contentRawNew'];}set contentRawNew(_0x3c3577){this['_contentRawNew']=_0x3c3577;}get contentOld(){return this['_dropDataIds'](this['_contentRawOld']||'');}get contentNew(){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x2d3e26){this['_error']=_0x2d3e26;}get droppedUnsupportedInlineChange(){return this['_droppedUnsupportedInlineChange'];}set droppedUnsupportedInlineChange(_0x53f99b){this['_droppedUnsupportedInlineChange']=_0x53f99b;}abort(){this['_isAborted']=!0x0;}_dropDataIds(_0x5f4003){return _0x5f4003['replace'](/ data-id="[a-z0-9]+"/g,'');}},Rn=class extends Sn{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0x19ef74){this['_summary']=_0x19ef74;}},On=class{_results;constructor(_0x5bc3ef=[]){this['_results']=_0x5bc3ef;}_status='initialized';['_error'];abort(){'error'!==this['_status']&&(this['_status']='aborted');}get status(){return this['_status'];}set status(_0xf324fe){this['_status']=_0xf324fe;}get['error'](){return this['_error'];}set['error'](_0x27ff11){this['_status']='error',this['_error']=_0x27ff11;}get results(){return this['_results'];}addResult(..._0x3c4a76){this['_results']['push'](..._0x3c4a76);}},vn=class extends _0x57f218{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(_0x3d942e,_0x514b5e){if(!_0x3d942e)throw new ct('ai-documentprocessinggateway-missing-prompt',this);const _0x444ffa=await this['context']['plugins']['get'](tn)['getDocumentData'](),_0x154692=_0x514b5e['roots'];if(0x0===(_0x154692??_0x444ffa)['length'])throw new ct('ai-documentprocessinggateway-empty-roots',this);if(_0x154692){for(const _0x45b62b of _0x154692)if(!_0x444ffa['some'](_0x24d6ac=>_0x24d6ac['rootName']===_0x45b62b['rootName']&&_0x24d6ac['channelId']===_0x45b62b['channelId']))throw new ct('ai-documentprocessinggateway-root-not-found',this,{'channelId':_0x45b62b['channelId'],'rootName':_0x45b62b['rootName']});}const _0xaf4173=_0x154692?_0x444ffa['filter'](_0x46da83=>_0x154692['some'](_0x1712f4=>_0x1712f4['rootName']===_0x46da83['rootName']&&_0x1712f4['channelId']===_0x46da83['channelId'])):_0x444ffa,_0x598604=[],_0x3e37ab=[];for(const _0x443d48 of _0xaf4173){const _0x62673c={'editor':_0x443d48['editor'],'rootName':_0x443d48['rootName'],'sessionId':_0x443d48['sessionId'],'channelId':_0x443d48['channelId'],'contentRawOld':_0x443d48['content'],'documentVersion':_0x443d48['version']};_0x598604['push'](_0x62673c),_0x3e37ab['push']({'type':'document','content':_0x62673c['contentRawOld']});}const _0x1bb740=this['context']['plugins']['get']('AIConnector')['processDocument']({'content':_0x3e37ab,'prompt':_0x3d942e,'model':_0x514b5e['model'],'capabilities':fn['getCapabilitiesRequestData'](_0x514b5e['capabilities']),'contexts':_0x514b5e['contexts']});let _0x3b80c6;if(_0x514b5e?.['signal']){_0x514b5e['signal']['aborted']&&_0x1bb740['abortController']['abort']();const _0x4cf986=_0x514b5e['signal'],_0x1bd5a8=()=>_0x1bb740['abortController']['abort']();_0x4cf986['addEventListener']('abort',_0x1bd5a8),_0x3b80c6=()=>_0x4cf986['removeEventListener']('abort',_0x1bd5a8);}const _0xb22f44=new On();let _0x2e9c6f=[];try{if(_0x2e9c6f=(await _0x1bb740['getResult']())['documents'],!(_0x2e9c6f&&_0x2e9c6f['length']>0x0))throw new ct('ai-documentprocessinggateway-empty-reply',this);if(_0x2e9c6f['length']!==_0x3e37ab['length'])throw new ct('ai-documentprocessinggateway-reply-count-mismatch',this,{'expected':_0x3e37ab['length'],'received':_0x2e9c6f['length']});const _0x56d40b=_0x2e9c6f['findIndex'](({document:_0x4e4d29})=>!_0x4e4d29['length']);if(-0x1!==_0x56d40b){const _0x4c173d=_0x598604[_0x56d40b];throw new ct('ai-documentprocessinggateway-empty-root-content',this,{'channelId':_0x4c173d['channelId'],'rootName':_0x4c173d['rootName']});}_0xb22f44['status']='completed';}catch(_0x331a46){_0x331a46 instanceof Error&&_0x331a46['message']['includes']('ai-request-aborted')?_0xb22f44['abort']():_0xb22f44['error']=bn(_0x331a46,'ai-documentprocessinggateway-run-failed',this);}finally{_0x3b80c6&&_0x3b80c6();}if('completed'===_0xb22f44['status'])for(const [_0x32a6e1,_0x26c721]of _0x598604['entries']()){const {channelId:_0x228e61,contentRawOld:_0x2d6653,documentVersion:_0x4c4da4,editor:_0xcfd945,rootName:_0x62a979,sessionId:_0x539196}=_0x26c721,_0x4ab2c3=new Rn({'channelId':_0x228e61,'editor':_0xcfd945,'rootName':_0x62a979,'sessionId':_0x539196});_0x4ab2c3['contentRawOld']=_0x2d6653,_0x4ab2c3['documentVersion']=_0x4c4da4,_0x4ab2c3['contentRawNew']=_0x2e9c6f[_0x32a6e1]['document'],_0x4ab2c3['summary']=_0x2e9c6f[_0x32a6e1]['summary'],_0xb22f44['addResult'](_0x4ab2c3);}return _0xb22f44;}applyResult(_0x429cad,_0x58d03b){this['context']['plugins']['get']('AIGateway')['apply'](_0x429cad,_0x58d03b);}};function kn(_0x184911){return _0x184911 instanceof Error&&('AbortError'===_0x184911['name']||('AICoreError'===_0x184911['name']?!0x0===_0x184911['isAbort']:_0x184911['message']['startsWith']('ai-request-aborted')));}var yn=class extends Error{['code'];severity;type;context;isAbort;constructor(_0x2e4100){super(_0x2e4100['code'],_0x2e4100['cause']instanceof Error?{'cause':_0x2e4100['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0x2e4100['code'],this['severity']=_0x2e4100['severity']??'error',this['type']=_0x2e4100['type']??'system',this['context']=_0x2e4100['context'],this['isAbort']=_0x2e4100['isAbort']??kn(_0x2e4100['cause']);}},Nn=class extends _0x57f218{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}createReporter(_0x2493a5){return new xn(this,_0x2493a5);}},xn=class{['_sink'];_component;constructor(_0x15216d,_0x2fd695){this['_sink']=_0x15216d,this['_component']=_0x2fd695;}['logError'](_0x3e1b09,_0x28a4fc={}){this['_emit'](_0x3e1b09,_0x28a4fc),this['_defaultLog'](_0x3e1b09);}reportError(_0x2cb759,_0x580023={}){this['_emit'](_0x2cb759,_0x580023);}_emit(_0x119314,_0x2cc057){kn(_0x119314)||this['_sink']['fire']('error',{'error':_0x119314,'component':this['_component'],'context':_0x2cc057['context']});}_defaultLog(_0x4ad013){if(!kn(_0x4ad013)){if(_0x4ad013 instanceof yn){if('user'===_0x4ad013['type']||'network'===_0x4ad013['type'])return;if('warning'===_0x4ad013['severity'])return void console['warn'](this['_component'],_0x4ad013);}console['error'](this['_component'],_0x4ad013);}}};const Ln='ck-ai-button-primary',Pn='ck-ai-button-secondary',Dn='ck-ai-button-tertiary';function Hn(_0x323025,_0x166740){const _0x32ddc1=new Mt(_0x323025),_0x32952b=Es(_0x323025,'AI_TABS_LABEL_MINIMIZE'),_0x423953=Es(_0x323025,'AI_TABS_LABEL_MAXIMIZE');return _0x32ddc1['set']({'withText':!0x1,'icon':_0x325ee5,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+Dn}),_0x32ddc1['bind']('label')['to'](_0x166740,'isMaximized',_0x2ec5b4=>_0x2ec5b4?_0x32952b:_0x423953),_0x32ddc1['bind']('icon')['to'](_0x166740,'isMaximized',_0x579e1c=>_0x579e1c?_0x2e031c:_0x325ee5),_0x32ddc1['bind']('isOn')['to'](_0x166740,'isMaximized'),_0x32ddc1['on']('execute',()=>{_0x166740['fire']('resizeTabs');}),_0x32ddc1;}function Mn(_0x2fbb70){const _0x3aaaa9=new Pt(_0x2fbb70);return _0x3aaaa9['attachToDom'](),_0x3aaaa9['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x3aaaa9;}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:_0x37acd9,isDone:_0x3a4ec2=!0x1,isComplete:_0x37af0c,interactionId:_0xc5a524,areActionsDisabled:_0x1796a7,outdatedReasonByDocumentId:_0x19b266,isFromHistory:_0x5885db=!0x1,documentContextContent:_0x458288,locale:_0x54eddc,id:_0x41254c,channelsToEditors:_0x235884}){super(),this['id']=_0x41254c||kt(),this['interactionId']=_0xc5a524,this['type']=_0x37acd9,this['areActionsDisabled']=!!_0x1796a7,this['_outdatedReasonByDocumentId']=_0x19b266,this['isFromHistory']=_0x5885db,this['locale']=_0x54eddc,this['aiResponseParser']=new hn(),this['aiResponseApplier']=new sn(),this['documentContextContent']=new Map(_0x458288?.['map'](_0x1f40bc=>[_0x1f40bc['id'],Rs(_0x1f40bc['content'])])||[]),this['_documentIdToSource']=new Map(_0x458288?.['map'](_0x14c6d2=>[_0x14c6d2['id'],{'editor':_0x235884['get'](_0x14c6d2['channelId']),'rootName':_0x14c6d2['rootName']}])||[]),this['set']('isDone',_0x3a4ec2),this['set']('isComplete',_0x37af0c??_0x3a4ec2),'text'===this['type']&&this['content']['set']('text','');}appendContent(_0x429ad5,_0x38e461){const _0x25c179='text'===this['type']?'text':_0x38e461;this['content']['has'](_0x25c179)||this['content']['set'](_0x25c179,''),this['content']['set'](_0x25c179,this['content']['get'](_0x25c179)+_0x429ad5),this['onContentChange'](_0x25c179);}['done'](_0x3bb41f=!0x0){this['isComplete']=_0x3bb41f,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}destroy(){this['stopListening']();}setChangeGroupState(_0x2162d8,_0x1a1250,_0x241ccd){this['changeGroups'][_0x2162d8]['state']=_0x1a1250,this['changeGroups'][_0x2162d8]['outdatedReason']=_0x241ccd,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x2162d8,'state':_0x1a1250,'outdatedReason':_0x241ccd});}getContentParts({showDiff:_0x5424a0,groupIndex:_0x515e58}){const _0x28d2a1=this['_getCachedContentParts'](_0x5424a0,_0x515e58);if(_0x28d2a1)return _0x28d2a1;let _0x3f8cac;if(void 0x0===_0x515e58)_0x3f8cac=this['changeGroups'];else{const _0x31cf98=this['changeGroups']['find'](({index:_0x4f1c5a})=>_0x4f1c5a===_0x515e58);if(!_0x31cf98)throw new ct('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x515e58});_0x3f8cac=[_0x31cf98];}const _0x20f434=ln({'showDiff':_0x5424a0,'changeGroups':_0x3f8cac,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x5424a0,_0x20f434),_0x20f434;}_getCachedContentParts(_0xb5356d,_0x48c378){const _0x15da07=_0xb5356d?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x15da07]['length'])return null;const _0xda681e=this['cachedSuggestionContentParts'][_0x15da07];if(void 0x0===_0x48c378)return _0xda681e['length']>0x0&&_0xda681e['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0xb5356d,null),null):_0x2e2ade(_0xda681e);{const _0x55806c=_0xda681e['find'](({index:_0x5f4719})=>_0x5f4719===_0x48c378);if(_0x55806c)return[_0x2e2ade(_0x55806c)];}return null;}_setCachedContentParts(_0x1370b1,_0x7ab91f){const _0x392cec=_0x1370b1?'withDiff':'withoutDiff';_0x7ab91f?_0x7ab91f['forEach'](_0x1abb63=>{const _0x68d66d=this['cachedSuggestionContentParts'][_0x392cec],_0x23b764=_0x68d66d['find'](({index:_0x3568c2})=>_0x3568c2===_0x1abb63['index']);if(_0x23b764){const _0xdfab85=_0x68d66d['indexOf'](_0x23b764);_0x68d66d['splice'](_0xdfab85,0x1,_0x1abb63);}else _0x68d66d['push'](_0x1abb63);}):this['cachedSuggestionContentParts'][_0x392cec]['length']=0x0;}onContentChange(_0x572456){if('modification'===this['type']){if(_0x572456)this['parsedContent']['set'](_0x572456,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x572456)));else{for(const [_0x382a74,_0x1fa58a]of this['content'])this['parsedContent']['set'](_0x382a74,this['aiResponseParser']['parseAndNormalizeHTML'](_0x1fa58a));}const _0x688eab=this['changeGroups'];for(const _0x51f4fd of this['content']['keys']())this['updateChangeGroups'](_0x51f4fd);const _0x28798c=this['_getDifferentChangeGroups'](_0x688eab,this['changeGroups']);(_0x28798c['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x28798c),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(_0x4c0b6d,_0x1ea21b){const _0x2e7edc=[];for(const _0x11e866 of _0x1ea21b){const _0x4fe410=_0x4c0b6d[_0x11e866['index']];_0x4fe410?_0x4fe410['changes']['length']!==_0x11e866['changes']['length']?_0x2e7edc['push'](_0x11e866):_0x4fe410['changes']['forEach']((_0x4ab76a,_0x126be2)=>{const _0x2befcc=_0x11e866['changes'][_0x126be2];_0x4ab76a['id']!==_0x2befcc['id']&&_0x2e7edc['push'](_0x11e866);}):_0x2e7edc['push'](_0x11e866);}return _0x2e7edc;}updateChangeGroups(_0x16259b){const _0xb4afb=this['documentContextContent']['get'](_0x16259b),_0x2ad526=this['parsedContent']['get'](_0x16259b);if(!_0xb4afb||!_0x2ad526)return;const _0x1e08d3=new _0x4f2bc5('p',{},[new _0x4f2bc5('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x2c4665(Es(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x19c057=this['aiResponseApplier']['merge'](_0x2ad526,_0xb4afb['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x1e08d3});this['parsedMergedContent']['set'](_0x16259b,_0x19c057['parsedContent']);let _0x369aee=[];if(_0x10faf7(_0xf38e44=>{const _0x528cdb=Ps(_0xf38e44,'data-id');if(!_0x528cdb||!_0x2bcf2e(_0x528cdb))return!0x1;const _0x2f0d26=[_0xf38e44,...Ms(_0xf38e44)]['at'](-0x2);if(_0xf38e44!=_0x2f0d26){const _0x5d8ed6=Ps(_0x2f0d26,'data-id');_0x2bcf2e(_0x5d8ed6)||(_0x369aee['push']({'node':_0x2f0d26,'id':_0x5d8ed6,'type':'modified'}),_0x19c057['modifiedNodeIds']['push'](_0x5d8ed6));}else _0x19c057['modifiedNodeIds']['includes'](_0x528cdb)?_0x369aee['push']({'node':_0xf38e44,'type':'modified','id':_0x528cdb}):_0x19c057['newNodeIds']['includes'](_0x528cdb)?_0x369aee['push']({'node':_0xf38e44,'type':'new','id':_0x528cdb,'anchorId':Ps(_0xf38e44['previousSibling'],'data-id')}):_0x369aee['push']({'node':_0xf38e44,'type':'removed','id':_0x528cdb});return!0x0;},this['parsedMergedContent']['get'](_0x16259b)),_0x369aee=_0x369aee['filter'](({node:_0x58d2b6})=>[...Ms(_0x58d2b6),_0x58d2b6]['every'](_0x42a74c=>!Ps(_0x42a74c,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x2aefbe=>_0x2aefbe['documentId']!==_0x16259b),0x0==_0x369aee['length'])return;const _0xf73381=[[_0x369aee[0x0]]];for(let _0x5296c8=0x1;_0x5296c8<_0x369aee['length'];_0x5296c8++){const _0x4c5964=_0xf73381[_0xf73381['length']-0x1],_0x45746e=_0x4c5964[_0x4c5964['length']-0x1];_0x369aee[_0x5296c8]['node']['previousSibling']==_0x45746e['node']&&'modified'!=_0x369aee[_0x5296c8]['type']&&'modified'!=_0x45746e['type']?_0x4c5964['push'](_0x369aee[_0x5296c8]):_0xf73381['push']([_0x369aee[_0x5296c8]]);}for(const _0x3eb994 of _0xf73381){const _0x16835d=_0x3eb994[0x0],_0x47c487=_0x3eb994[_0x3eb994['length']-0x1],_0x23332e=_0x5938eb(_0x16835d['node']['previousSibling']);_0x23332e&&_0x3eb994['unshift'](_0x23332e);const _0x19ab11=_0x5938eb(_0x47c487['node']['nextSibling']);_0x19ab11&&_0x3eb994['push'](_0x19ab11);}ks('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x16259b))['forEach'](_0x494032=>{Ds(_0x494032,'data-wrapped-id',null);});const _0x2cf5ae=new Map();ks('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x16259b))['forEach'](_0xb8fbb6=>{const _0x403f2c=Ps(_0xb8fbb6,'data-unwrapped-id'),_0x1f4a12=Ps(_0xb8fbb6,'data-id');_0x2cf5ae['set'](_0x1f4a12,_0x403f2c),Ds(_0xb8fbb6,'data-id',_0x403f2c),Ds(_0xb8fbb6,'data-unwrapped-id',null);});for(const _0x2f081b of _0x369aee){const _0x53686e=_0x2cf5ae['get'](_0x2f081b['id']);_0x53686e&&(_0x2f081b['id']=_0x53686e);}this['changeGroups']['push'](..._0xf73381['map']((_0x347bde,_0x3a0dcb)=>{const _0x4487cc=this['_documentIdToSource']['get'](_0x16259b),_0x6844f3=this['_outdatedReasonByDocumentId']?.['get'](_0x16259b),_0xf39c8e=this['areActionsDisabled']||void 0x0!==_0x6844f3;return{'changes':_0x347bde,'state':_0xf39c8e?'outdated':'pending','outdatedReason':_0xf39c8e?_0x6844f3:void 0x0,'index':_0x3a0dcb,'editor':_0x4487cc['editor'],'rootName':_0x4487cc['rootName'],'documentId':_0x16259b};}));const _0x2239f3=Array['from'](this['documentContextContent']['keys']());function _0x2bcf2e(_0x4bfc95){return _0x19c057['modifiedNodeIds']['includes'](_0x4bfc95)||_0x19c057['newNodeIds']['includes'](_0x4bfc95)||_0x19c057['removedNodeIds']['includes'](_0x4bfc95);}function _0x5938eb(_0x53e91b){if(_0x53e91b&&Ps(_0x53e91b,'data-id')&&!Ps(_0x53e91b,'data-unstable')){const _0x41f9f2=Ps(_0x53e91b,'data-id');if(!_0x2bcf2e(_0x41f9f2))return{'node':_0x53e91b,'type':'context','id':_0x41f9f2};}return null;}this['changeGroups']['sort']((_0x5459d9,_0x1c498e)=>_0x2239f3['indexOf'](_0x5459d9['documentId'])-_0x2239f3['indexOf'](_0x1c498e['documentId'])),this['changeGroups']['forEach']((_0x2b84bc,_0x738766)=>{_0x2b84bc['index']=_0x738766;});}};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:_0x39837c,locale:_0x447275,channelsToEditors:_0x36634a}){super(),this['id']=kt(),this['connector']=_0x39837c,this['isStopped']=!0x0,this['locale']=_0x447275,this['_channelsToEditors']=_0x36634a||new Map();}async start(){await this['_run']();}async['resume'](_0x28d05b){await this['_run'](_0x28d05b);}async['_run'](_0x2dd8be){const _0x3065fb=[];let _0x216201,_0x5583ca,_0x3c831a,_0x1c8818=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x2dd8be||this['sendRequest'](),this['fire']('interactionStarted',this);const _0x191e16=await this['currentRequest']['getStream']();for await(const _0x53aa6e of _0x191e16){if(this['isStopped'])return;if('error'==_0x53aa6e['event'])return void this['fire']('error',{'error':new ct('ai-chat-interaction-error',this)});switch(_0x53aa6e['event']){case'message-metadata':this['messageId']=_0x53aa6e['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x53aa6e['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x53aa6e['data']['conversationTitle'],!0x0);break;case'source':_0x3065fb['push'](_0x53aa6e['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'](),_0x216201='modification-delta'==_0x53aa6e['event']?'modification':'text',_0x5583ca='modification-delta'==_0x53aa6e['event']?_0x53aa6e['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x216201&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x216201,'interactionId':this['id'],'id':_0x5583ca,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x53aa6e['event']&&{'documentId':_0x53aa6e['data']['documentId']}}),'modification'==_0x216201&&(this['currentReply']['sources']=_0x3065fb['splice'](0x0))),this['currentReply']['appendContent'](_0x53aa6e['data']['textDelta'],_0x53aa6e['data']['documentId']);break;case'mcp-tool-result':_0x3c831a=JSON['parse'](_0x53aa6e['data']['result']),this['_handleToolResultData']({'toolName':_0x53aa6e['data']['toolName'],'data':_0x3c831a['data'],'attributes':_0x3c831a['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x53aa6e['data']['toolName'],'data':_0x53aa6e['data']['data']});}}_0x1c8818=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x3065fb['length']>0x0&&(this['currentReply']['sources']=_0x3065fb['splice'](0x0)),this['_finalizeInteraction'](_0x1c8818),this['fire']('interactionFinished',this));}}stop(){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}getReply(_0xfef519){return this['replies']['find'](_0x224698=>_0x224698['id']===_0xfef519);}destroy(){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x7898c5=>_0x7898c5['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}createReply(_0x58ded4){const _0x583e60=this['getDocumentContext'](),_0x323a59=new Vn({'locale':this['locale'],'documentContextContent':_0x583e60?.['documents'],..._0x58ded4});return this['replies']['push'](_0x323a59),_0x323a59['delegate'](...Gn)['to'](this),this['fire']('replyCreated',_0x323a59),_0x323a59;}setConversationTitle(_0x1ef816,_0x3e0186=!0x1){this['fire']('setConversationTitle',_0x1ef816,_0x3e0186);}resetWebSearchState(){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}resetReasoningState(){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}_handleToolResultData(_0x1c21cd){this['fire']('toolDataReceived',{'type':'result','toolName':_0x1c21cd['toolName'],'data':structuredClone(_0x1c21cd['data']||{}),'attributes':structuredClone(_0x1c21cd['attributes']||{})},this);}_handleToolNotificationData(_0x33c2b0){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x33c2b0['toolName'],'data':structuredClone(_0x33c2b0['data'])},this);}_finalizeInteraction(_0x143a16=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x143a16),this['currentRequest']=this['currentReply']=void 0x0;}};const Kn='defaultContextIds',Wn=/* #__PURE__ -- @preserve */
|
|
31
|
+
At();var Yn=class AIContext extends Wn{['_refs'];constructor(_0x692b61=[]){super(),this['_refs']=[..._0x692b61];}get['refs'](){return[...this['_refs']];}get isEmpty(){return 0x0===this['_refs']['length'];}cloneWith(..._0x4b7292){return new AIContext([...this['_refs'],..._0x4b7292]);}addDefaultContext(_0x4240e1){this['_refs']=[...this['_refs'],..._0x4240e1];}toRequestParts(_0x4c3c02=[]){return[...this['_refs']['map'](As),..._0x4c3c02];}toMessageAttributes(_0x1abbf7){return this['isEmpty']?_0x1abbf7:{..._0x1abbf7,[Kn]:[...new Set(this['_refs']['map'](_0x13f094=>_0x13f094['id']))]};}static getDefaultContextIds(_0x586220){const _0x1eac00=_0x586220&&_0x586220[Kn];return new Set(Array['isArray'](_0x1eac00)?_0x1eac00:[]);}};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:_0xafb0a3,config:_0x1e21b4,ownerId:_0x7d66cf}){super(),this['_connector']=_0xafb0a3,this['_config']=_0x1e21b4,this['_ownerId']=_0x7d66cf;}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(_0x46a8b7,_0x2ea417,_0x43be7e=new Set()){const _0x445ae7=new Map(),{contextItem:_0x2dbefb,unmatchedDocumentIds:_0x2b1e9e}=await this['_populateDocumentContextItem'](_0x46a8b7,_0x2ea417);_0x2dbefb&&_0x445ae7['set'](_0x2dbefb['id'],_0x2dbefb);for(const _0x3d3d17 of _0x46a8b7){if('document'===_0x3d3d17['type'])continue;const _0x547ef2=await this['_createContextItemFromContent'](_0x3d3d17,_0x43be7e);'context'!==_0x547ef2['type']&&this['_addToConversationContextItem'](_0x547ef2),_0x445ae7['set'](_0x547ef2['id'],_0x547ef2);}return{'contextItems':_0x445ae7,'hasUnmatched':_0x2b1e9e['size']>0x0,'unmatchedDocumentIds':_0x2b1e9e};}async _populateDocumentContextItem(_0x533e96,_0x2268ca){const _0x1a9819=_0x533e96['filter'](_0x50b224=>'document'===_0x50b224['type']);if(0x0===_0x1a9819['length'])return{'unmatchedDocumentIds':new Set()};const _0x1426cb=_0x1a9819['map'](_0x3109af=>_0x3109af['id']),_0x48f721=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x1426cb)['getDocuments'](),_0x843f43=new Map(_0x48f721['map'](_0x4ee4d6=>[_0x4ee4d6['id'],_0x4ee4d6])),_0x46516a=[],_0x217caf=new Set();for(const _0x4e6b20 of _0x1a9819){const _0x2b0d0d=_0x843f43['get'](_0x4e6b20['id']);_0x2b0d0d&&(this['_matchDocumentToRoot'](_0x2b0d0d,_0x2268ca)||_0x217caf['add'](_0x2b0d0d['id']),_0x46516a['push']({'id':_0x2b0d0d['id'],'content':_0x2b0d0d['content'],'version':_0x2b0d0d['attributes']?.['version']??0x0,'sessionId':_0x2b0d0d['attributes']?.['sessionId']??null,'selection':[],'selectionSignature':'','channelId':_0x2b0d0d['attributes']?.['channelId']??_0x2268ca[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x2b0d0d['attributes']?.['rootName']??_0x2268ca[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??'','editorConfig':_0x4e6b20['editorConfig']}));}const _0x113a34={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x46516a};return this['_addToConversationContextItem'](_0x113a34),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x113a34,'unmatchedDocumentIds':_0x217caf};}_matchDocumentToRoot(_0x81dc09,_0x502fcd){const _0x2a7266=_0x81dc09['attributes']?.['channelId'],_0x209df8=_0x81dc09['attributes']?.['rootName'];if(_0x2a7266&&_0x209df8){for(const _0x121d2e of _0x502fcd)if(_0x121d2e['config']['get']('collaboration.channelId')===_0x2a7266){for(const _0x19e71c of _0x121d2e['model']['document']['getRoots']())if('$graveyard'!==_0x19e71c['rootName']&&_0x19e71c['rootName']===_0x209df8)return{'editor':_0x121d2e,'rootName':_0x19e71c['rootName']};}}}async _createContextItemFromContent(_0xac438f,_0x2416f5=new Set()){return'mcp-tool-context'===_0xac438f['type']?{'id':_0xac438f['id'],'uiId':_0xac438f['id'],'label':_0xac438f['data']?.['label']||_0xac438f['id'],'type':'mcp-tool-context','mcpServerName':_0xac438f['mcpServerName'],'toolName':_0xac438f['toolName'],'data':_0xac438f['data']||{}}:{'id':_0xac438f['id'],'uiId':_0xac438f['id'],'label':_0xac438f['attributes']?.['label']||_0xac438f['name']||_0xac438f['url']||_0xac438f['id'],'type':_0xac438f['type'],..._0xac438f?.['attributes']?.['resourceId']?{'resourceId':_0xac438f['attributes']?.['resourceId']}:{},...'context'===_0xac438f['type']&&_0x2416f5['has'](_0xac438f['id'])?{'hidden':!0x0}:{}};}getSentContextItems(){return new Map(this['_conversationContextItems']);}removeFromContext(_0x136c80){this['_pendingContextItems']['get'](_0x136c80)?.['isReadOnly']||this['_removeContextItem'](_0x136c80);}clearPendingContextItems(){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x2fa189 of this['_pendingContextItems']['values']())'context'!==_0x2fa189['type']&&this['_removeContextItem'](_0x2fa189['uiId']);const _0x2e5419=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x2e5419&&this['_addContextItem']({..._0x2e5419,'isReadOnly':!0x0,'hidden':!0x0});}addToConversationContext(_0x1687e9){for(const _0x533b51 of _0x1687e9['values']())'context'!==_0x533b51['type']&&this['_addToConversationContextItem'](_0x533b51);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(_0x48e2a3){return Array['from'](_0x48e2a3['values']())['flatMap'](_0x462a63=>this['_mapContextItemToRequestData'](_0x462a63));}async addFilesToContext(_0xaf9d5,_0x4e9646,_0x21aeaa='file'){const _0x4c46c6='files-'+kt();this['_startUploadOperation'](_0x4c46c6);try{await Promise['all'](_0xaf9d5['map'](async _0x40e4d2=>{const _0x5e99ff='file-'+kt(),_0xb8ae0f=_0x483082(_0x40e4d2['name']),_0x3f690c='file'===_0x21aeaa&&_0x40e4d2['type']['startsWith']('image/')?'image':_0x21aeaa;try{this['_addContextItem']({'type':_0x3f690c,'label':_0x4e9646?.['label']||_0xb8ae0f,'uiId':_0x5e99ff,'resourceId':_0x4e9646?.['resourceId']},!0x0);const _0x21a31b=this['_connector']['uploadFile'](this['_ownerId'],_0x40e4d2,_0x4e9646);this['_ongoingUploads']['set'](_0x5e99ff,_0x21a31b['abortController']);const {id:_0x5c82c4}=await _0x21a31b['getId']();this['_ongoingUploads']['delete'](_0x5e99ff),this['_finishContextItemLoading']({'type':_0x3f690c,'id':_0x5c82c4,'label':_0x4e9646?.['label']||_0xb8ae0f,'uiId':_0x5e99ff,'resourceId':_0x4e9646?.['resourceId']},!0x1);}catch(_0x21b043){if(this['_ongoingUploads']['delete'](_0x5e99ff),!kn(_0x21b043)){const _0x3717c4=new yn({'code':$n['get'](_0x21b043['code'])||'ai-chat-file-upload-failed','cause':_0x21b043,'context':{'fileName':_0xb8ae0f}});this['fire']('error',{'error':_0x3717c4});}this['_removeContextItem'](_0x5e99ff);}}));}finally{this['_finishUploadOperation'](_0x4c46c6);}}addCurrentDocumentToContext(_0x19cf0b){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x20c269={'type':'document','uiId':'current-document','label':_0x19cf0b,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x20c269);}getCurrentDocumentContext(){return this['_pendingContextItems']['get']('current-document');}async updateCurrentDocuments(_0x273a92,_0x39f6be){const _0x50de2e=this['getCurrentDocumentContext']();if(!_0x50de2e)return;_0x273a92['length']>0x1&&_0x273a92['some'](_0x3fdba0=>!_0x3fdba0['description'])&&St('ai-chat-documents-missing-description');try{const _0x33b79e=(_0x50de2e['documents']||[])['filter'](_0x311d96=>_0x39f6be['has'](_0x311d96['channelId']));if(!_0x273a92['length'])return void(_0x50de2e['documents']=_0x33b79e);const _0x2d57fa=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x273a92)['getIds']();if(_0x2d57fa['length']!==_0x273a92['length']||_0x2d57fa['some'](_0x1a957e=>!_0x1a957e?.['id'])){const _0x555bba=new ct('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x555bba});}const _0x3a9b69=_0x273a92['map']((_0xb1d13b,_0x10565c)=>{return{'id':_0x2d57fa[_0x10565c]['id'],'content':_0xb1d13b['content'],'version':_0xb1d13b['version'],'sessionId':_0xb1d13b['sessionId'],'selection':(_0x58ecbd=_0xb1d13b['selections'],_0x58ecbd?_0x58ecbd['map'](_0x2c3e2d=>({'start':_0x2c3e2d['start'],'end':_0x2c3e2d['end']})):[]),'selectionSignature':_0xb1d13b['selectionSignature'],'channelId':_0xb1d13b['channelId'],'rootName':_0xb1d13b['rootName'],'editorConfig':_0xb1d13b['editorConfig']};var _0x58ecbd;});_0x50de2e['documents']=[..._0x33b79e,..._0x3a9b69];}catch(_0x10e3f5){throw new yn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x10e3f5});}}addSelectionToContext(_0x38a9cf){this['_addContextItem']({'type':'selection','label':_0x38a9cf,'uiId':'selection','content':_0x38a9cf});}removeSelectionFromContext(){this['_removeContextItem']('selection');}async addUrlToContext(_0x17c47d,_0x416827){const _0x157dd7='url-'+kt();this['_startUploadOperation'](_0x157dd7);const _0x39ecbe='url-'+kt();try{this['_addContextItem']({'type':'web-resource','label':_0x416827?.['label']||_0x17c47d,'uiId':_0x39ecbe,'resourceId':_0x416827?.['resourceId']},!0x0);const _0x3a3ef2=this['_connector']['uploadUrl'](this['_ownerId'],_0x17c47d,_0x416827);this['_ongoingUploads']['set'](_0x39ecbe,_0x3a3ef2['abortController']);const {id:_0x4afca2}=await _0x3a3ef2['getId']();this['_ongoingUploads']['delete'](_0x39ecbe),this['_finishContextItemLoading']({'type':'web-resource','id':_0x4afca2,'label':_0x416827?.['label']||_0x17c47d,'uiId':_0x39ecbe,'resourceId':_0x416827?.['resourceId']},!0x1);}catch(_0x464813){this['_ongoingUploads']['delete'](_0x39ecbe),kn(_0x464813)||this['fire']('error',{'error':new ct('ai-chat-url-upload-failed',this,{'url':_0x17c47d,'originalError':_0x464813}),'url':_0x17c47d}),this['_removeContextItem'](_0x39ecbe);}finally{this['_finishUploadOperation'](_0x157dd7);}}addToolItemToContext(_0x1f2759){_0x1f2759['id']=_0x1f2759['id']??kt()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x1f2759['uiId'],_0x1f2759),this['fire']('contextItemAdded',{'contextItem':_0x1f2759,'isLoading':!0x1});}async['loadSourceResources'](_0x77dc1e,_0x3ab3be,_0x1e15b8){const _0x228c6f=this['_addContextOptionsState']['sources']['find'](_0x56db42=>_0x56db42['id']===_0x77dc1e);if(!_0x228c6f)return this['fire']('error',{'error':new ct('ai-chat-source-not-found',this,{'sourceId':_0x77dc1e}),'sourceId':_0x77dc1e}),[];try{const _0x2e5e56=(await _0x228c6f['getResources'](_0x3ab3be))['map'](_0x241824=>{const _0x427b5a=this['_isResourceInContext'](_0x241824['id']);return{..._0x241824,'isInContext':_0x427b5a};});return _0x228c6f['resources']=_0x2e5e56,this['fire']('sourceResourcesLoaded',{'sourceId':_0x77dc1e,'source':_0x228c6f,'resources':_0x2e5e56,'uid':_0x1e15b8}),_0x2e5e56;}catch(_0x21f132){return this['fire']('error',{'error':new ct('ai-chat-source-resources-load-failed',this,{'sourceId':_0x77dc1e,'originalError':_0x21f132}),'sourceId':_0x77dc1e,'sourceLabel':_0x228c6f['label']}),[];}}async addResourceToContext(_0x3bb7e4,_0x3cba65){if(this['_isResourceInContext'](_0x3cba65['id']))return;if('context'===_0x3cba65['type'])return void this['_addContextItem']({'type':'context','id':_0x3cba65['id'],'label':_0x3cba65['label'],'uiId':'context-'+kt(),'resourceId':_0x3cba65['id']});let _0x2d1864=_0x3cba65['data'];if(!_0x2d1864&&_0x3bb7e4['getData'])try{_0x2d1864=await _0x3bb7e4['getData'](_0x3cba65['id']);}catch(_0x5daa1b){return void this['fire']('error',{'error':new ct('ai-chat-resource-load-failed',this,{'resourceId':_0x3cba65['id'],'sourceId':_0x3bb7e4['id'],'originalError':_0x5daa1b}),'resourceId':_0x3cba65['id'],'sourceId':_0x3bb7e4['id']});}if(_0x2d1864)switch(_0x3cba65['type']){case'web-resource':if('string'!=typeof _0x2d1864)return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x3cba65['id'],'sourceId':_0x3bb7e4['id'],'expectedType':'string','actualType':typeof _0x2d1864}),'resourceId':_0x3cba65['id'],'sourceId':_0x3bb7e4['id']});await this['addUrlToContext'](_0x2d1864,{'label':_0x3cba65['label'],'resourceId':_0x3cba65['id']});break;case'file':if(!(_0x2d1864 instanceof File))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x3cba65['id'],'sourceId':_0x3bb7e4['id'],'expectedType':'File','actualType':typeof _0x2d1864}),'resourceId':_0x3cba65['id'],'sourceId':_0x3bb7e4['id']});await this['addFilesToContext']([_0x2d1864],{'label':_0x3cba65['label'],'resourceId':_0x3cba65['id']});break;case'text':if('object'!=typeof _0x2d1864||!('content'in _0x2d1864)||!('type'in _0x2d1864))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x3cba65['id'],'sourceId':_0x3bb7e4['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x2d1864}),'resourceId':_0x3cba65['id'],'sourceId':_0x3bb7e4['id']});_0x2d1864=AIChatContext['_convertTextResourceToFile'](_0x2d1864,_0x3cba65['label']),await this['addFilesToContext']([_0x2d1864],{'label':_0x3cba65['label'],'resourceId':_0x3cba65['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ct('ai-chat-context-unsupported-type',this,{'resourceId':_0x3cba65['id'],'sourceId':_0x3bb7e4['id'],'resourceType':_0x3cba65['type']}),'resourceId':_0x3cba65['id'],'sourceId':_0x3bb7e4['id']});}else this['fire']('error',{'error':new ct('ai-chat-resource-no-data',this,{'resourceId':_0x3cba65['id'],'sourceId':_0x3bb7e4['id']}),'resourceId':_0x3cba65['id'],'sourceId':_0x3bb7e4['id']});}addContextSource(_0x1a6539){this['_addContextOptionsState']['sources']['some'](_0x1e90fe=>_0x1e90fe['id']===_0x1a6539['id'])||(this['_addContextOptionsState']['sources']['push']({..._0x1a6539,'resources':[]}),this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']}));}toggleAddCurrentDocumentOptionVisibility(_0x3ead04){if(void 0x0!==_0x3ead04)this['_addContextOptionsState']['document']['isHidden']=!_0x3ead04;else{const _0xe2b6d2=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0xe2b6d2;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static _convertTextResourceToFile(_0x45f394,_0x120160){switch(_0x45f394['type']){case'markdown':return new File([_0x45f394['content']],_0x120160,{'type':'text/markdown'});case'html':return new File([_0x45f394['content']],_0x120160,{'type':'text/html'});default:return new File([_0x45f394['content']],_0x120160,{'type':'text/plain'});}}static _mapContextItemToRequestData(_0x2831d6){switch(_0x2831d6['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x2831d6['id']}];case'web-resource':return[{'type':'web-resource','id':_0x2831d6['id']}];case'context':return[{'type':'context','id':_0x2831d6['id']}];case'document':return _0x2831d6['documents']?.['length']?_0x2831d6['documents']['map'](({id:_0x430072,editorConfig:_0x4329b3,selection:_0x576e45})=>({'type':'document','id':_0x430072,..._0x4329b3&&{'editorConfig':_0x4329b3},..._0x576e45?.['length']&&{'selection':_0x576e45}})):[];case'mcp-tool-context':{const _0x23f5e0=_0x2831d6;return[{'type':'mcp-tool-context','mcpServerName':_0x23f5e0['mcpServerName'],'toolName':_0x23f5e0['toolName'],'data':{..._0x23f5e0['data'],'label':_0x23f5e0['label']||_0x23f5e0['data']?.['label']||_0x23f5e0['id']},'id':_0x23f5e0['id']}];}default:return[];}}_addContextItem(_0x28c040,_0x31004d=!0x1){if(this['_pendingContextItems']['set'](_0x28c040['uiId'],_0x28c040),_0x28c040['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x28c040,'isLoading':_0x31004d}),'current-document'===_0x28c040['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x28c040['resourceId']){const _0x1daa9d=this['_findSourceIdsByResourceId'](_0x28c040['resourceId']);_0x1daa9d&&_0x1daa9d['forEach'](_0x3dff3c=>{this['_updateResourceInContextState'](_0x3dff3c,_0x28c040['resourceId'],!0x0);});}}_removeContextItem(_0x3c3fff){const _0x616ba0=this['_pendingContextItems']['get'](_0x3c3fff),_0x162fe8=this['_ongoingUploads']['get'](_0x3c3fff);if(_0x162fe8&&(_0x162fe8['abort'](),this['_ongoingUploads']['delete'](_0x3c3fff)),_0x616ba0?.['resourceId']){const _0x26eac9=this['_findSourceIdsByResourceId'](_0x616ba0['resourceId']);_0x26eac9&&_0x26eac9['forEach'](_0x48c0f8=>{this['_updateResourceInContextState'](_0x48c0f8,_0x616ba0['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x3c3fff),this['fire']('contextItemRemoved',{'uiId':_0x3c3fff,'type':_0x616ba0?.['type']}),'current-document'===_0x3c3fff&&this['toggleAddCurrentDocumentOptionVisibility']();}_finishContextItemLoading(_0x535d46,_0x1c400b){if(this['_pendingContextItems']['has'](_0x535d46['uiId'])&&(this['_pendingContextItems']['set'](_0x535d46['uiId'],_0x535d46),this['fire']('contextItemLoadingEnded',{'contextItem':_0x535d46,'isLoading':_0x1c400b}),_0x535d46['resourceId'])){const _0x90313c=this['_findSourceIdsByResourceId'](_0x535d46['resourceId']);_0x90313c&&_0x90313c['forEach'](_0x12db06=>{this['_updateResourceInContextState'](_0x12db06,_0x535d46['resourceId'],!0x0);});}}_addToConversationContextItem(_0x17b294){this['_conversationContextItems']['set'](_0x17b294['uiId'],_0x17b294);}_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'](_0x174a9c=>({..._0x174a9c,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}_getCustomSourcesInitialState(){return this['_config']?.['sources']?.['map'](_0xe5ac50=>({..._0xe5ac50,'resources':[]}))??[];}_isResourceInContext(_0x19b7bd){for(const _0x38a80b of this['_pendingContextItems']['values']())if(_0x38a80b['resourceId']===_0x19b7bd)return!0x0;for(const _0x454044 of this['_conversationContextItems']['values']())if(_0x454044['resourceId']===_0x19b7bd)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x1acbec){const _0x5cc927=[];for(const _0x3f85e0 of this['_addContextOptionsState']['sources'])_0x3f85e0['resources']['find'](_0x3f6006=>_0x3f6006['id']===_0x1acbec)&&_0x5cc927['push'](_0x3f85e0['id']);return 0x0===_0x5cc927['length']?null:_0x5cc927;}_updateResourceInContextState(_0x4ae467,_0x1200c7,_0x504de4){const _0x33a5e7=this['_addContextOptionsState']['sources']['find'](_0x2f77fb=>_0x2f77fb['id']===_0x4ae467);if(!_0x33a5e7)return;const _0x7cce53=_0x33a5e7['resources']['find'](_0x53af63=>_0x53af63['id']===_0x1200c7);_0x7cce53&&(_0x7cce53['isInContext']=_0x504de4,this['fire']('resourceStateChanged',{'sourceId':_0x4ae467,'resourceId':_0x1200c7,'isInContext':_0x504de4}));}_startUploadOperation(_0x5e0884){this['_ongoingUploadOperations']['set'](_0x5e0884,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}_finishUploadOperation(_0x27c115){this['_ongoingUploadOperations']['delete'](_0x27c115),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}},Xn=class extends Fn{['userMessage'];conversationId;contextItems=new Map();capabilities;['model'];attributes;context;constructor(_0xd1257b){super(_0xd1257b),this['conversationId']=_0xd1257b['conversationId'],this['contextItems']=_0xd1257b['contextItems'],this['capabilities']=_0xd1257b['capabilities'],this['userMessage']=_0xd1257b['userMessage'],this['model']=_0xd1257b['model'],this['attributes']=_0xd1257b['attributes'],this['context']=_0xd1257b['context']??new Yn();}sendRequest(){const _0x192dc3=Qn['mapContextItemsToRequestData'](this['contextItems']),_0x40864a=this['context']['toRequestParts'](_0x192dc3);return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':_0x40864a,'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(_0x3462eb){super(),this['options']=_0x3462eb,this['connector']=_0x3462eb['connector'],this['chatModels']=_0x3462eb['chatModels'],this['id']=_0x3462eb['conversationId'],this['isFromHistory']=_0x3462eb['isFromHistory'],this['_channelsToEditors']=_0x3462eb['channelsToEditors'],this['_getSessionId']=_0x3462eb['getSessionId'];}async init(_0x5a0c6a){try{this['chatContext']=new Qn({'connector':this['connector'],'config':_0x5a0c6a,'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 _0x3b8822=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x3b8822});const _0x4ac27e=await this['chatModels']['resolveModel'](this['options']['selectedModelId']);_0x4ac27e&&await this['setModel'](_0x4ac27e);}catch(_0x37a7dc){const _0x48322d=new yn({'code':'ai-chat-conversation-init-failed','cause':_0x37a7dc,'type':'network'});this['fire']('error',{'error':_0x48322d});}}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:_0x45143d}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x45143d,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x20a794){const _0x422c02=new yn({'code':'ai-chat-conversation-start-failed','cause':_0x20a794,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x422c02}),_0x422c02;}}async['load'](_0x54ebd0){try{const _0x5bba9e=await this['connector']['fetchConversation'](_0x54ebd0)['getConversation'](),_0x254168=await this['connector']['fetchConversationMessages'](_0x54ebd0)['getMessages'](),_0x2f5576=_0x254168[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x5bba9e['id'],'title'in _0x5bba9e?this['fire']('setConversationTitle',_0x5bba9e['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']),this['selectedModel']=await this['chatModels']['getModel'](_0x2f5576)??void 0x0,this['fire']('modelSelected',{'selectedModel':this['selectedModel'],'isDisabled':!0x0});const {streamingMessageId:_0x315108}=await this['_processMessagesToInteractions'](_0x254168,_0x2f5576);return _0x315108&&this['currentInteraction']?this['_resumeStream'](_0x315108):this['currentInteraction']=void 0x0,this;}catch(_0x21ca76){const _0x45f525=new yn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x21ca76,'type':'network','context':{'conversationId':_0x54ebd0}});throw this['fire']('error',{'error':_0x45f525}),_0x45f525;}}async _processMessagesToInteractions(_0x44a5c9,_0x2f2071){let _0x3c5f34,_0x3f93df,_0x2b8ea7=new Set();for(const _0x358dff of _0x44a5c9)if('user'===_0x358dff['role']){const {contextItems:_0x5ac6b4,unmatchedDocumentIds:_0x51cc23}=await this['_extractContextItems'](_0x358dff);_0x2b8ea7=_0x51cc23;const _0x112930={'isReasoningEnabled':Object['hasOwn'](_0x358dff['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x358dff['capabilities'],'webSearch')};_0x3c5f34=this['createInteraction']({'userMessage':_0x358dff['prompt'],'contextItems':_0x5ac6b4,'capabilities':_0x112930,'modelId':_0x2f2071,'attributes':_0x358dff['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x3c5f34,_0x3f93df=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x358dff['role']&&_0x3c5f34){if('streaming'===_0x358dff['status']){_0x3f93df=_0x358dff['id'];continue;}if('error'===_0x358dff['status'])continue;const _0x241ae3=[];for(const _0x1195c6 of _0x358dff['content'])switch(_0x1195c6['type']){case'text':case'modification':{const _0x3f9e04=_0x3c5f34['getDocumentContext'](),_0x4808cd=this['_getOutdatedReasonsByDocumentId'](_0x3f9e04,_0x2b8ea7),_0x2dad43=_0x3f9e04?.['documents']??[],_0x106064=_0x2dad43['length']>0x0&&_0x2dad43['every'](_0x1b876c=>_0x4808cd['has'](_0x1b876c['id']));_0x3c5f34['currentReply']?.['type']!==_0x1195c6['type']&&(_0x3c5f34['currentReply']=_0x3c5f34['createReply']({'type':_0x1195c6['type'],'isDone':!0x0,'interactionId':_0x3c5f34['id'],'areActionsDisabled':_0x106064,'outdatedReasonByDocumentId':_0x4808cd,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x241ae3['length']>0x0&&(_0x3c5f34['currentReply']['sources']=_0x241ae3['splice'](0x0))),_0x3c5f34['currentReply']['appendContent'](_0x1195c6['content'],_0x1195c6['documentId']);break;}case'url':_0x241ae3['push'](_0x1195c6);break;case'mcp-tool-result':{const {data:_0x37009d,attributes:_0x4f4c3d}=JSON['parse'](_0x1195c6['content']);_0x3c5f34['_handleToolResultData']({'toolName':_0x1195c6['toolName'],'data':_0x37009d,'attributes':_0x4f4c3d});break;}}'cancelled'===_0x358dff['status']&&this['fire']('error',{'interactionId':_0x3c5f34['id'],'error':new ct('ai-request-aborted',this)});}}return{'streamingMessageId':_0x3f93df};}async _resumeStream(_0x323a47){if(this['currentInteraction'])try{const _0x3052a5=this['connector']['resumeStream'](this['id'],_0x323a47);await this['currentInteraction']['resume'](_0x3052a5);}catch(_0x5f4007){_0x5f4007 instanceof ct&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x5f4007});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async _extractContextItems(_0x36b124){return _0x36b124['content']?this['chatContext']['populateFromMessage'](_0x36b124['content'],Array['from'](this['_channelsToEditors']['values']()),Yn['getDefaultContextIds'](_0x36b124['attributes'])):{'contextItems':new Map(),'unmatchedDocumentIds':new Set()};}async handleUserInteraction({userMessage:_0x49b198,attributes:_0x3a8e46}){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 _0x10f9d3=new Map(this['getPendingContextItems']()),_0x14e7c2=this['chatCapabilities']['getCapabilitiesConfig'](),_0x13cd7b=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x49b198,'contextItems':_0x10f9d3,'capabilities':_0x14e7c2,'modelId':_0x13cd7b,'attributes':_0x3a8e46,'channelsToEditors':this['_channelsToEditors']}),await this['updateCurrentDocumentsInContext'](),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x259b0d){if(_0x259b0d instanceof ct)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x259b0d});else{const _0x5403e7=$n['get'](_0x259b0d['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ct(_0x5403e7,null,{'error':_0x259b0d})});}}finally{this['stopProcessing']();}}stopProcessing(){this['_abortReject']&&(this['_abortReject'](),this['_abortReject']=void 0x0),this['currentInteraction']&&(this['currentInteraction']['stop'](),this['currentInteraction']=void 0x0);}createInteraction({userMessage:_0x267c90,contextItems:_0x1c9c62,capabilities:_0x408f92,modelId:_0x41fdae,attributes:_0x2808b0,channelsToEditors:_0x23ec7c}){const _0x14ec3c=new Xn({'userMessage':_0x267c90,'contextItems':_0x1c9c62,'capabilities':_0x408f92,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x41fdae,'attributes':_0x2808b0,'channelsToEditors':_0x23ec7c,'context':this['chatContext']['isEmpty']?void 0x0:new Yn(this['chatContext']['refs'])});return _0x14ec3c['delegate'](...Gn)['to'](this),this['interactions']['push'](_0x14ec3c),this['fire']('interactionCreated',_0x14ec3c),_0x14ec3c;}getInteraction(_0x55f5fe){return this['interactions']['find'](_0x39457d=>_0x39457d['id']===_0x55f5fe);}removeInteraction(_0x5d13b2){const _0x267fc4=this['getInteraction'](_0x5d13b2);_0x267fc4&&(_0x267fc4['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x267fc4),0x1));}get lastInteraction(){return this['interactions'][this['interactions']['length']-0x1];}cancelLastInteractionStream(){const _0x4424fb=this['lastInteraction'];_0x4424fb?.['conversationId']&&_0x4424fb['messageId']&&this['connector']['cancelStream'](_0x4424fb['conversationId'],_0x4424fb['messageId'])['execute']()['catch'](()=>{});}addCurrentDocumentToContext(_0x2de49d){this['chatContext']['addCurrentDocumentToContext'](_0x2de49d);}async updateCurrentDocumentsInContext(){if(!this['isCurrentDocumentInContext']())return;const {changedIds:_0x457493,unchangedIds:_0xd4ae5}=this['_compareEditorStateWithDocumentContext'](),_0xca773b=new Promise((_0x2ad465,_0x58596a)=>{this['_abortReject']=()=>_0x58596a(new ct('ai-request-aborted',this));}),_0x4d7547=await Promise['race']([this['options']['aiEditing']['getDocumentData'](_0x457493),_0xca773b]);await Promise['race']([this['chatContext']['updateCurrentDocuments'](_0x4d7547,_0xd4ae5),_0xca773b]);}_compareEditorStateWithDocumentContext(){const _0x24a11f=new Set(),_0x21d92d=new Set(),_0x2afee5=this['options']['aiEditing']['getEditorsVersions'](),_0x2cddaf=this['options']['aiEditing']['getEditorsSelections'](),_0x180701=this['chatContext']['getCurrentDocumentContext']()['documents']||[],_0x5f31f9=new Map(_0x180701['map'](({channelId:_0x30505a,version:_0xb8667d})=>[_0x30505a,_0xb8667d])),_0xe1714c=new Map(_0x180701['map'](({channelId:_0x291821,selectionSignature:_0x459d44})=>[_0x291821,_0x459d44]));for(const [_0x2f5109,_0xed8934]of _0x2afee5){const _0x32ec2e=_0x2cddaf['get'](_0x2f5109);_0x5f31f9['get'](_0x2f5109)!=_0xed8934||_0xe1714c['get'](_0x2f5109)!=_0x32ec2e?_0x24a11f['add'](_0x2f5109):_0x5f31f9['has'](_0x2f5109)&&_0x21d92d['add'](_0x2f5109);}return{'changedIds':_0x24a11f,'unchangedIds':_0x21d92d};}toggleAddCurrentDocumentOptionVisibility(_0xac0e0b){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0xac0e0b);}_getOutdatedReasonsByDocumentId(_0x152756,_0xf16434){const _0x5385d3=new Map();if(!_0x152756||!_0x152756['documents'])return _0x5385d3;for(const _0x2a8412 of _0x152756['documents']){const _0x7bd8ae=this['_channelsToEditors']['get'](_0x2a8412['channelId']);_0x7bd8ae&&'destroyed'!==_0x7bd8ae['state']?_0x2a8412['sessionId']!==this['_getSessionId'](_0x7bd8ae)?_0x5385d3['set'](_0x2a8412['id'],'session-changed'):_0xf16434['has'](_0x2a8412['id'])&&_0x5385d3['set'](_0x2a8412['id'],'content-removed'):_0x5385d3['set'](_0x2a8412['id'],'editor-removed');}return _0x5385d3;}addSelectionToContext(_0x32a1ea){this['chatContext']['addSelectionToContext'](_0x32a1ea);}removeSelectionFromContext(){this['chatContext']['removeSelectionFromContext']();}addFilesToContext(_0x452226){this['chatContext']['addFilesToContext'](_0x452226);}addUrlToContext(_0xc64e8a){this['chatContext']['addUrlToContext'](_0xc64e8a);}addToolItemToContext(_0x1405e6){this['chatContext']['addToolItemToContext'](_0x1405e6);}addResourceToContext(_0x2125cf,_0x37bb67){this['chatContext']['addResourceToContext'](_0x2125cf,_0x37bb67);}['loadSourceResources'](_0x5cd6e5,_0x5c215d,_0x20a55b){return this['chatContext']['loadSourceResources'](_0x5cd6e5,_0x5c215d,_0x20a55b);}removeFromContext(_0x2cd25e){this['chatContext']['removeFromContext'](_0x2cd25e);}setWebSearch(_0x5ce06c){this['chatCapabilities']['setWebSearch'](_0x5ce06c);}toggleWebSearch(){this['chatCapabilities']['toggleWebSearch']();}setReasoning(_0x10d276){this['chatCapabilities']['setReasoning'](_0x10d276);}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(_0x3c0830){_0x3c0830['length']&&this['chatContext']['addDefaultContext'](_0x3c0830);}async setModel(_0x378dc7){_0x378dc7?!0x1===await this['chatModels']['isAvailable'](_0x378dc7)&&(St('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x378dc7}),_0x378dc7=(await this['chatModels']['getAvailableModels']())[0x0]):(St('ai-chat-conversation-set-model-null',{'conversation':this}),_0x378dc7=(await this['chatModels']['getAvailableModels']())[0x0]),_0x378dc7['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x378dc7,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x378dc7}));}};function Jn({documentSuggestions:_0x585e21,transform:_0x211485,documentCompare:_0x1724dc,documentCompareOptions:_0x26bb8e}){const _0x501a97=new Map();for(const [_0x25826b,{groups:_0x2da49a,documentContext:_0x5b5773,documentContent:_0x5a20c9,editor:_0x25e33c}]of _0x585e21){const _0x412495=_0x5b5773['content'],_0x890be9=_0x5b5773['version'],_0x2a9726=_0x5a20c9['cloneNode'](!0x0);for(const {changes:_0x1b97ad}of _0x2da49a)$s(_0x2a9726,_0x1b97ad);const _0x51886e=Os(_0x2a9726),_0x270bbe=Qs(_0x25e33c,_0x5b5773['rootName'],_0x412495,_0x51886e);if(!_0x270bbe)continue;const _0x42c59a=_0x1724dc['getDiff'](_0x270bbe['before'],_0x270bbe['after'],{'targetEditor':_0x25e33c,'anchor':_0x5b5773['rootName'],..._0x26bb8e})['getOperations']();if(_0x211485){const _0x5d394e=_0x25e33c['model']['document']['history']['getOperations'](_0x890be9),_0x14b0a1={'document':_0x25e33c['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x501a97['set'](_0x25826b,_0x1b55c4(_0x42c59a,_0x5d394e,_0x14b0a1)['operationsA']);}else _0x501a97['set'](_0x25826b,_0x42c59a);}return _0x501a97;}function Zn({groups:_0x2a7c55,documentContextContent:_0x41cfbd,documents:_0x33883e}){const _0x54984f=new Map();for(const _0x369422 of _0x2a7c55){const {documentId:_0xf12f34}=_0x369422,_0x4996f3=_0x54984f['get'](_0xf12f34);if(_0x4996f3)_0x4996f3['groups']['push'](_0x369422),_0x4996f3['indexes']['push'](_0x369422['index']);else{const _0x3da1df=_0x33883e['find'](_0x3838bc=>_0x3838bc['id']===_0xf12f34),_0x249231=_0x41cfbd['get'](_0xf12f34);if(!_0x3da1df||!_0x249231)continue;_0x54984f['set'](_0xf12f34,{'groups':[_0x369422],'documentContext':_0x3da1df,'documentContent':_0x249231,'editor':_0x369422['editor'],'indexes':[_0x369422['index']]});}}return _0x54984f;}function tr(_0x285841,_0x5ceb70){const _0x200a93=_0x285841['files']['length']>0x0&&_0x285841['files']['every'](_0x26163f=>_0x26163f['type']['startsWith']('image/')),_0x11f660=_0x285841['plainText']['trim']()['length']>0x0;if(_0x285841['files']['length']>0x0&&_0x5ceb70['filesEnabled']&&(!_0x200a93||!_0x11f660)){const _0x520acf=_0x285841['files']['filter'](_0x4af5b5=>_0x4af5b5['name']);return _0x520acf['length']>0x0?{'type':'file','files':_0x520acf}:null;}if(_0x5ceb70['urlsEnabled']){const _0x161a23=function(_0x247a53){const _0x5e4733=_0x247a53['trim']();if(/\s/['test'](_0x5e4733))return null;try{const _0xf351c5=new URL(_0x5e4733);return'http:'!==_0xf351c5['protocol']&&'https:'!==_0xf351c5['protocol']?null:_0xf351c5['toString']();}catch{return null;}}(_0x285841['plainText']);if(_0x161a23)return{'type':'url','url':_0x161a23};}const _0x2201a4=_0x285841['forceTextAttachment']?0x1:_0x5ceb70['longTextThreshold']??0x1/0x0;if(_0x285841['plainText']['length']>=Math['max'](_0x2201a4,0x1)&&_0x5ceb70['filesEnabled']){const _0x229377=_0x5ceb70['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x285841['plainText']],_0x229377,{'type':'text/plain'})]};}return null;}var er=class extends _0x57f218{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,_0x14613c,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 _0x52678d=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x1ed4f7,_0x51e565)=>{this['sendMessage']({'message':_0x51e565});}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',()=>{this['activeConversation']?.['stopProcessing']();}),this['listenTo'](_0x52678d['view'],'change:activeTab',(_0x12bbfa,_0x53661f,_0xe13d57)=>{'chat'!==_0xe13d57&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x21befb,_0x16c410)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x16c410));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x508771,_0x5ea785)=>{this['activeConversation']?.['addUrlToContext'](_0x5ea785);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x147673,_0x545b09)=>{const _0x2ac900=this['activeConversation'];if(!_0x2ac900)return;_0x545b09['hasDirectory']&&(_0x545b09['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+kt()}));const _0x2fb85f=tr(_0x545b09,{'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')});_0x2fb85f&&(_0x545b09['preventDefault'](),'url'===_0x2fb85f['type']?_0x2ac900['addUrlToContext'](_0x2fb85f['url']):_0x2ac900['chatContext']['addFilesToContext'](_0x2fb85f['files'],void 0x0,_0x2fb85f['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x3070ae,_0x593eef)=>{_0x593eef['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x3c0be1,_0x554685)=>{this['activeConversation']?.['addResourceToContext'](_0x554685['source'],_0x554685['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x7eb416,_0x130540)=>{this['_removeFromContext'](_0x130540);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x97fcaa,_0x4001cb)=>{this['activeConversation']?.['loadSourceResources'](_0x4001cb['sourceId'],_0x4001cb['query'],_0x4001cb['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x26d5e7,_0x499755)=>{this['activeConversation']?.['setModel'](_0x499755);}),this['listenTo'](this['_aiChatUi'],'like',(_0x1cd63d,{replyId:_0x477389})=>{console['log']('Liked\x20response',_0x477389);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x35dbec,{replyId:_0x357141})=>{console['log']('Disliked\x20response',_0x357141);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x4b0a12,_0x263292)=>{this['_insertSuggestion'](_0x263292);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x43d96d,{replyId:_0xe7b1af,partIndex:_0x4125fc})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0xe7b1af,_0x4125fc);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x5aef65,{replyId:_0x53ecae,partIndex:_0x202948})=>{const _0x5d168f=this['_getDocumentRangeForReplyChanges'](_0x53ecae,_0x202948);if(!_0x5d168f)return;const {reply:_0x4fc002}=this['getInteractionAndReplyById'](_0x53ecae);'$graveyard'!=_0x5d168f['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x4fc002['changeGroups'][_0x202948]['editor'],'ranges':[_0x5d168f['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x24c8f8,_0x597d15)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x597d15);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x516af5,{replyId:_0x29a305,showDiff:_0x352281})=>{const {interaction:_0xd882ec,reply:_0x2fa2ed}=this['getInteractionAndReplyById'](_0x29a305),_0x2a48ce=_0x2fa2ed['getContentParts']({'showDiff':_0x352281});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0xd882ec['id']+':'+_0x2fa2ed['id'],'parts':_0x2a48ce});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x5e3654,{replyId:_0x4b699a,partIndex:_0x3a9d07})=>{this['_rejectSuggestion']({'replyId':_0x4b699a,'partIndex':_0x3a9d07}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x139bfe,_0x31f9a6)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x31f9a6);}),this['on']('replyCreated',(_0x30687c,_0x56c471)=>{this['_addFeedItemReply'](_0x56c471);});}afterInit(){this['context']instanceof _0x38520b?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x10729f,_0x10fd66)=>{_0x10fd66['on']('ready',()=>{this['_integrateEditor'](_0x10fd66);});}),this['context']['config']['get']('ai.chat.context')?.['contextLibrary']?.['enabled']&&this['_setUpContextLibrarySource'](),this['_initConversation']();}async _initConversation(){const _0x2fe55f=this['context']['config']['get']('ai.chat.initialConversation');let _0x28329a=_0x2fe55f;('lastCreated'!=_0x2fe55f||(_0x28329a=await this['_getLastCreatedConversationId'](),_0x28329a))&&('new'==_0x28329a?await this['_startConversationSafely']():await this['loadConversation'](_0x28329a));}async destroy(){return this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async loadConversation(_0x32b9cc){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'](_0x32b9cc)['getConversation'](),await this['_startConversationSafely']({'id':_0x32b9cc}),await this['activeConversation']['load'](_0x32b9cc),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext'](),this['set']('isConversationReady',!0x0),this['activeConversation']?.['currentInteraction']?this['_aiChatUi']['enableControls']():this['_aiChatUi']['toggleConversationLoading'](!0x1);}catch(_0x450566){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x32b9cc}),this['_reporter']['logError'](new ct('ai-chat-conversation-not-found',this,void 0x0,_0x450566),{'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(_0x3a4d13){let _0xfcf00e=null,_0x5b04df=null;this['on']('toolDataReceived',(_0x16dca2,_0x37b41a,_0x154515)=>{_0x154515['id']!==_0xfcf00e&&(_0xfcf00e=_0x154515['id'],_0x5b04df=this['_getAIChatFeedAPI'](_0x154515)),_0x3a4d13(_0x37b41a,_0x5b04df);});}addCurrentDocumentToChatContext(){bs(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](Es(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async addSelectionToChatContext(_0x4c8c18){const _0x4c5081=this['_aiEditing']['getSelectionText'](_0x4c8c18);this['activeConversation']?.['addSelectionToContext'](_0x4c5081),this['addCurrentDocumentToChatContext']();}removeSelectionFromChatContext(){this['activeConversation']?.['removeSelectionFromContext']();}focusPromptInput(){this['_aiChatUi']['focusPromptInput']();}async startConversation(_0x117a7c){await this['_startConversationSafely']({'modelId':_0x117a7c?.['modelId'],'contexts':_0x117a7c?.['contexts']});}async['sendMessage']({message:_0x13f8e2,attributes:_0x52d204}){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':_0x13f8e2,'attributes':_0x52d204}));}getGroupId(){const _0x3c2f3b=this['context']['config']['get']('collaboration.channelId');if(!_0x3c2f3b)throw new ct('ai-missing-channel-id',this);return _0x3c2f3b;}_handleRemovedConversation(_0x316816){this['activeConversation']['id']===_0x316816&&this['_startConversationSafely']();}['_isGroupReadOnly'](_0x2d4d96){return!(!_0x2d4d96['editor']||'destroyed'===_0x2d4d96['editor']['state']||!_0x2d4d96['editor']['isReadOnly']);}_isGroupWriteable(_0x3e3c05){return!(!_0x3e3c05['editor']||'destroyed'===_0x3e3c05['editor']['state']||_0x3e3c05['editor']['isReadOnly']);}_computeSuggestionGating(_0x22ffbb){const _0x4f7572=new Map();for(const _0x5e6b0e of _0x22ffbb['changeGroups'])_0x4f7572['set'](_0x5e6b0e['index'],this['_isGroupReadOnly'](_0x5e6b0e));const _0x5844e1=new Set(_0x22ffbb['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']})['filter'](_0x48daba=>_0x48daba['hasChanges'])['map'](_0x1a8e3e=>_0x1a8e3e['index']));return{'readOnlyByIndex':_0x4f7572,'isAcceptAllEnabled':_0x22ffbb['changeGroups']['some'](_0x198df7=>'pending'===_0x198df7['state']&&this['_isGroupWriteable'](_0x198df7)&&_0x5844e1['has'](_0x198df7['index']))};}_refreshSuggestionGating(){if(this['activeConversation']){for(const _0x56d393 of this['activeConversation']['interactions'])for(const _0x57f6cd of _0x56d393['replies'])'modification'===_0x57f6cd['type']&&this['_aiChatUi']['hasFeedItem'](_0x57f6cd['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x57f6cd['id'],this['_computeSuggestionGating'](_0x57f6cd));}if(this['_activeBalloon']&&this['_currentPreviewedChangeGroup']){const {reply:_0x4cd1e6}=this['getInteractionAndReplyById'](this['_currentPreviewedChangeGroup']['replyId']),_0x540bd7=_0x4cd1e6['changeGroups']['find'](_0xc7778=>_0xc7778['index']===this['_currentPreviewedChangeGroup']['partIndex']);_0x540bd7&&this['_activeBalloon']['setTargetReadOnly'](this['_isGroupReadOnly'](_0x540bd7));}}_prepareDocumentSuggestions(_0x330374){const {reply:_0x22983a,interaction:_0x4c2b86}=this['getInteractionAndReplyById'](_0x330374['replyId']),_0x803c11=void 0x0!==_0x330374['partIndex']?[_0x22983a['changeGroups'][_0x330374['partIndex']]]:_0x22983a['changeGroups']['filter'](_0xe83395=>'pending'===_0xe83395['state']&&!this['_isGroupReadOnly'](_0xe83395)),_0x47cfc9=_0x803c11['map'](_0x20dee4=>_0x22983a['changeGroups']['indexOf'](_0x20dee4)),_0x25a785=qs(_0x22983a['changeGroups'],_0x22983a['documentContextContent']);return _0x47cfc9['forEach'](_0x5b35b5=>{if(_0x25a785['has'](_0x5b35b5))return;const _0xaa0d72=this['_getDocumentRangeForReplyChanges'](_0x330374['replyId'],_0x5b35b5);_0xaa0d72&&'$graveyard'!=_0xaa0d72['range']['root']['rootName']?(_0x22983a['setChangeGroupState'](_0x5b35b5,'accepted'),void 0x0!==_0x330374['partIndex']&&this['_scrollToSuggestionRange'](_0xaa0d72['range'],!0x1,_0xaa0d72['targetEditor'])):_0x22983a['setChangeGroupState'](_0x5b35b5,'outdated',this['_getOutdatedReason'](_0x22983a['changeGroups'][_0x5b35b5]));}),Zn({'groups':_0x803c11['filter'](_0x5c8f38=>'accepted'===_0x5c8f38['state']),'documentContextContent':_0x22983a['documentContextContent'],'documents':_0x4c2b86['getDocumentContext']()?.['documents']??[]});}_insertSuggestion(_0x93e360){const _0x4d8a21=this['context']['plugins']['get'](_0x14613c),{reply:_0x345853,interaction:_0x3acb0c}=this['getInteractionAndReplyById'](_0x93e360['replyId']),_0x2b4ea3=this['_prepareDocumentSuggestions'](_0x93e360),_0x392d18=Jn({'documentSuggestions':_0x2b4ea3,'transform':!0x0,'documentCompare':_0x4d8a21,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0x996530,_0x5461f7]of _0x392d18){const {editor:_0x3ed008,indexes:_0x22db61}=_0x2b4ea3['get'](_0x996530);if(!_0x3ed008['plugins']['has']('TrackChanges')){St('ai-no-track-changes',{'editor':_0x3ed008});continue;}let _0xad9bb9;mn(_0x5461f7,'chat'),_0x3ed008['model']['change'](_0xfeefa9=>{_0xad9bb9=_0xfeefa9['batch'],_0x3ed008['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x5461f7),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0xad9bb9,{'interactionId':_0x3acb0c['id'],'replyId':_0x345853['id'],'indexes':_0x22db61});}this['_updateRatings'](_0x345853);}_applySuggestion(_0x3300c8){const _0x4b3fda=this['context']['plugins']['get'](_0x14613c),{reply:_0x49d209,interaction:_0x48fec8}=this['getInteractionAndReplyById'](_0x3300c8['replyId']),_0x394162=this['_prepareDocumentSuggestions'](_0x3300c8),_0x628394=Jn({'documentSuggestions':_0x394162,'transform':!0x0,'documentCompare':_0x4b3fda,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0x4fb853,_0x1668f]of _0x628394){const {editor:_0x3fc73c,indexes:_0x8b81c6}=_0x394162['get'](_0x4fb853);let _0x26a46a;mn(_0x1668f,'chat');try{_0x3fc73c['model']['change'](_0x21053a=>{_0x26a46a=_0x21053a['batch'],_0x4b3fda['applyOperations'](_0x21053a,_0x1668f);}),this['_batchToChanges']['set'](_0x26a46a,{'interactionId':_0x48fec8['id'],'replyId':_0x49d209['id'],'indexes':_0x8b81c6});}catch(_0x125da9){throw this['_reporter']['logError'](new yn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x125da9})),_0x125da9;}}this['_updateRatings'](_0x49d209);}_rejectSuggestion(_0x582e94){const {reply:_0x5ed5e7}=this['getInteractionAndReplyById'](_0x582e94['replyId']);_0x5ed5e7['setChangeGroupState'](_0x582e94['partIndex'],'rejected');}['_openBalloonFor'](_0x2ec4a9,_0x318b67){if(!this['_hasAIChatBalloon'])return;const {reply:_0x1a2df4}=this['getInteractionAndReplyById'](_0x2ec4a9),_0x566bdb=_0x1a2df4['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x566bdb['length'])return;let _0x284116,_0x3a3240;if(void 0x0!==_0x318b67?(_0x3a3240=_0x566bdb['find'](_0x180a9e=>_0x180a9e['index']==_0x318b67),_0x284116=_0x3a3240?.['index']):(_0x3a3240=_0x566bdb[0x0],_0x284116=_0x3a3240['index']),!_0x3a3240)return void _0x1a2df4['setChangeGroupState'](_0x318b67??0x0,'outdated','editor-removed');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x2ec4a9&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x284116)return;const _0x56bb9f=this['_getUserPresentableContentPartDocumentRange'](_0x2ec4a9,_0x1a2df4,_0x3a3240),_0x4864a=_0x1a2df4['changeGroups']['find'](_0x531f4c=>_0x531f4c['index']==_0x284116),_0x355c70=_0x4864a['editor'],_0x4f800b=_0x355c70['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x4f800b&&this['_activeBalloon']['close'](),!_0x56bb9f)return _0x4f800b['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x4f800b,this['_currentPreviewedChangeGroup']={'replyId':_0x2ec4a9,'partIndex':_0x284116},this['_scrollToSuggestionRange'](_0x56bb9f,!0x0,_0x355c70);const _0x7cc78b=this['_getPresentableSiblingContentPartIndex'](_0x2ec4a9,_0x284116,'next');_0x4f800b['clearContent'](),_0x4f800b['updateContent']({'part':_0x3a3240,'renderingStrategy':'static'}),_0x4f800b['open']({'index':_0x284116,'title':Es(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x284116+0x1)['toString']()),'showRotator':null!==_0x7cc78b,'ranges':[_0x56bb9f],'areActionsDisabled':_0x1a2df4['areActionsDisabled'],'targetEditor':_0x355c70,'isTargetReadOnly':this['_isGroupReadOnly'](_0x4864a)}),_0x4f800b['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x2ec4a9,_0x284116),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x2ec4a9,'index':_0x284116,'isActive':!0x0});}_closeActiveBalloon(){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}_getPresentableSiblingContentPartIndex(_0xf069d0,_0x47e4f1,_0x34b7eb){const {reply:_0xb541af}=this['getInteractionAndReplyById'](_0xf069d0),_0x4ec4ea=_0xb541af['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x4ec4ea['length'])return null;const _0x58bb43='next'==_0x34b7eb?0x1:-0x1;function _0x4e4c09(_0x3e70db){const _0x179229=(_0x3e70db+_0x58bb43+_0x4ec4ea['length'])%_0x4ec4ea['length'];return{'siblingIndex':_0x179229,'siblingPart':_0x4ec4ea[_0x179229]};}const _0xb36187=_0x4ec4ea['findIndex'](_0x2c209=>_0x2c209['index']==_0x47e4f1);let {siblingIndex:_0x380cd3,siblingPart:_0x1d17a6}=_0x4e4c09(_0xb36187);for(;!this['_getUserPresentableContentPartDocumentRange'](_0xf069d0,_0xb541af,_0x1d17a6);)if({siblingIndex:_0x380cd3,siblingPart:_0x1d17a6}=_0x4e4c09(_0x380cd3),_0x380cd3===_0xb36187)return null;return _0x1d17a6['index'];}_getOutdatedReason(_0x4d3cc2){return _0x4d3cc2?.['editor']&&'destroyed'!==_0x4d3cc2['editor']['state']?'content-removed':'editor-removed';}_getUserPresentableContentPartDocumentRange(_0x52cc40,_0x54e930,_0x24f582){const _0x1dd327=_0x54e930['changeGroups'];if(!_0x24f582['hasChanges'])return null;const _0xb34e19=_0x1dd327['find'](_0x669673=>_0x669673['index']==_0x24f582['index']);if('pending'!==_0xb34e19?.['state'])return null;if(!_0xb34e19?.['editor']||'destroyed'===_0xb34e19['editor']['state'])return _0x54e930['setChangeGroupState'](_0x24f582['index'],'outdated',this['_getOutdatedReason'](_0xb34e19)),null;const _0x36c285=this['_getDocumentRangeForReplyChanges'](_0x52cc40,_0x24f582['index']);if(!_0x36c285)return _0x54e930['setChangeGroupState'](_0x24f582['index'],'outdated',this['_getOutdatedReason'](_0xb34e19)),null;const {range:_0x490ec9,currentIndex:_0x2763f4}=_0x36c285;return'$graveyard'==_0x490ec9['root']['rootName']?(_0x54e930['setChangeGroupState'](_0x2763f4,'outdated',this['_getOutdatedReason'](_0xb34e19)),null):_0x36c285['range'];}_getDocumentRangeForReplyChanges(_0x361c38,_0x1d8a9a){const {reply:_0x2417af,interaction:_0x425353}=this['getInteractionAndReplyById'](_0x361c38),_0x192dde=_0x2417af['changeGroups']['filter'](_0xb15cfb=>'pending'==_0xb15cfb['state']),_0x24671b=_0x192dde['map'](_0x4f7993=>_0x2417af['changeGroups']['indexOf'](_0x4f7993));void 0x0===_0x1d8a9a&&(_0x1d8a9a=_0x24671b[0x0]);const _0xeb50e0=_0x24671b['indexOf'](_0x1d8a9a);if(-0x1==_0xeb50e0)return null;const _0x2c5c03=_0x192dde[_0xeb50e0],_0x239cea=_0x2c5c03['editor'];if(!_0x239cea||'destroyed'===_0x239cea['state'])return null;const _0x324e9f=Gs(_0x239cea,_0x2c5c03['rootName']),_0x59e6b6=_0x2417af['documentContextContent']['get'](_0x2c5c03['documentId']),_0x574599=new _0x577dfe([]),_0x41a5f8=new _0x577dfe([]);for(const _0x5cbc4f of _0x2c5c03['changes'])if('removed'!=_0x5cbc4f['type']&&_0x41a5f8['children']['push'](_0x5cbc4f['node']['cloneNode'](!0x0)),'new'!=_0x5cbc4f['type']){const _0x1de22f=_0x43283b(_0x2098c8=>Ps(_0x2098c8,'data-id')==_0x5cbc4f['id'],_0x59e6b6,!0x0);_0x574599['children']['push'](_0x1de22f['cloneNode'](!0x0));}if(0x0==_0x574599['children']['length']){if(_0x2c5c03['changes'][0x0]['anchorId']){const _0x2c39c1=vs('data-id',_0x2c5c03['changes'][0x0]['anchorId'],_0x59e6b6);_0x574599['children']['unshift'](_0x2c39c1['cloneNode'](!0x0)),_0x41a5f8['children']['unshift'](_0x2c39c1['cloneNode'](!0x0)),_0x2c39c1['nextSibling']&&(_0x574599['children']['push'](_0x2c39c1['nextSibling']['cloneNode'](!0x0)),_0x41a5f8['children']['push'](_0x2c39c1['nextSibling']['cloneNode'](!0x0)));}else{const _0x43a749=_0x59e6b6['children'][0x0];if(!_0x43a749)return null;_0x574599['children']['push'](_0x43a749['cloneNode'](!0x0)),_0x41a5f8['children']['push'](_0x43a749['cloneNode'](!0x0));}}if(_0x324e9f&&qs(_0x2417af['changeGroups'],_0x2417af['documentContextContent'])['has'](_0x2c5c03['index']))return null;const _0x514f4d=_0x425353['getDocumentContext'](),_0xb137c1=_0x514f4d['documents']['find'](_0x411fe7=>_0x411fe7['id']==_0x2c5c03['documentId'])['content'],_0x536d1a=_0x239cea['model']['document']['getRoot'](_0x2c5c03['rootName']),_0x44989c=_0x239cea['data']['parse'](_0xb137c1,_0x536d1a),_0x2e2c1f=_0x324e9f?Ws(Os(_0x574599)):Os(_0x574599),_0x24b60e=_0x239cea['data']['parse'](_0x2e2c1f,_0x536d1a),_0x380d05=_0x239cea['data']['parse'](_0x2e2c1f,_0x536d1a),_0x3e26b3=_0x239cea['model']['createPositionAt'](_0x24b60e,0x0),_0x4bbc08=_0x324e9f?Ws(Os(_0x41a5f8)):Os(_0x41a5f8),_0x14d0c8={'targetEditor':_0x239cea,'anchor':_0x3e26b3,'markDeletions':!0x1};let _0x78c164;try{_0x78c164=_0x239cea['plugins']['get'](_0x14613c)['getDiff'](_0x2e2c1f,_0x4bbc08,_0x14d0c8)['getOperations']();}catch(_0x3d8093){return this['_reporter']['reportError'](new yn({'code':'ai-chat-suggestion-diff-failed','type':'runtime','severity':'warning','cause':_0x3d8093,'context':{'replyId':_0x361c38,'partIndex':_0x1d8a9a}})),null;}if(!_0x78c164['length'])return null;_0x239cea['model']['change'](_0x50f3f7=>{for(const _0x2b5b73 of _0x78c164)if(!_0x4e897d(_0x2b5b73)){if('remove'==_0x2b5b73['type']){const _0x3d139d=_0x2b5b73['sourcePosition'],_0x4300ee=_0x2b5b73['howMany'],_0x3d0faa=new _0x150372(_0x3d139d,_0x4300ee);_0x50f3f7['batch']['addOperation'](_0x3d0faa),_0x239cea['model']['applyOperation'](_0x3d0faa);}else'marker'!==_0x2b5b73['type']&&(_0x2b5b73['baseVersion']=null,_0x2b5b73['isDocumentOperation']=!0x1,_0x50f3f7['batch']['addOperation'](_0x2b5b73),_0x239cea['model']['applyOperation'](_0x2b5b73));}});const _0x4cad63=_n(_0x239cea,_0x78c164,_0x24b60e);An(_0x239cea['model'],_0x4cad63);const _0x3cc082=_0x4cad63['getFirstRange']()['start']['path']['slice'](),_0x70964e=_0x4cad63['getFirstRange']()['end']['path']['slice'](),_0x39b2c3=[];let _0x1caa4d=_0x24b60e,_0xc5eb9e=_0x380d05;for(let _0x23acf2=0x0;_0x23acf2<_0x70964e['length'];_0x23acf2++){const _0x4d3035=_0x1caa4d['maxOffset']-_0x70964e[_0x23acf2];_0x39b2c3[_0x23acf2]=_0xc5eb9e['maxOffset']-_0x4d3035,_0x1caa4d=_0x1caa4d['getChildAtOffset'](_0x70964e[_0x23acf2]),_0xc5eb9e=_0xc5eb9e['getChildAtOffset'](_0x39b2c3[_0x23acf2]);}const _0x3c747e=_0x239cea['model']['createRange'](_0x239cea['model']['createPositionFromPath'](_0x380d05,_0x3cc082),_0x239cea['model']['createPositionFromPath'](_0x380d05,_0x39b2c3)),_0x3f5443=_0x3c747e['start']['path']['slice'](),_0x10f7a5=_0x3c747e['end']['path']['slice']();if(!_0x324e9f){const _0x539ae0=_0x380d05['getChild'](0x0)['getAttribute'](_0x19f2f9),_0x8fa313=Array['from'](_0x44989c['getChildren']())['find'](_0x3d2537=>_0x3d2537['getAttribute'](_0x19f2f9)==_0x539ae0)['getPath']();_0x3f5443[0x0]=_0x8fa313[0x0]+_0x3f5443[0x0],_0x10f7a5[0x0]=_0x8fa313[0x0]+_0x10f7a5[0x0];}let _0x3beb9e=_0x239cea['model']['createRange'](_0x239cea['model']['createPositionFromPath'](_0x239cea['model']['document']['getRoot'](_0x2c5c03['rootName']),_0x3f5443),_0x239cea['model']['createPositionFromPath'](_0x239cea['model']['document']['getRoot'](_0x2c5c03['rootName']),_0x10f7a5));const _0x49ea09=_0x514f4d['documents']['find'](_0x4d4d02=>_0x4d4d02['id']==_0x2c5c03['documentId'])['version'],_0x3f9ce8=_0x239cea['model']['document']['history']['getOperations'](_0x49ea09);for(const _0x1f0278 of _0x3f9ce8)_0x3beb9e=_0x4b6f52['_createFromRanges'](_0x3beb9e['getTransformedByOperation'](_0x1f0278));return{'range':_0x3beb9e,'currentIndex':_0x1d8a9a,'targetEditor':_0x239cea};}_integrateEditorBalloon(_0x54db50){if(!_0x54db50['plugins']['has']('AIChatBalloon'))return;const _0x436864=_0x54db50['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x436864['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x436864,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x1dde5d,partIndex:_0x295ce4}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x5b4d78}=this['getInteractionAndReplyById'](_0x1dde5d),_0x112b29=_0x5b4d78['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x295ce4});_0x436864['updateContent']({'part':_0x112b29[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x436864,'applySuggestion',()=>{const {replyId:_0x20a661,partIndex:_0x2b2409}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x20a661,'partIndex':_0x2b2409}),_0x436864['setState']('accepted');}),this['listenTo'](_0x436864,'insertSuggestion',()=>{const {replyId:_0x424914,partIndex:_0x50dde6}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x424914,'partIndex':_0x50dde6}),_0x436864['setState']('accepted');}),this['listenTo'](_0x436864,'rejectSuggestion',()=>{const {replyId:_0x31c320,partIndex:_0x2e0e4d}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x31c320,'partIndex':_0x2e0e4d}),_0x436864['setState']('rejected');}),this['listenTo'](_0x436864,'showNext',()=>{const {replyId:_0x38cf83,partIndex:_0x577210}=this['_currentPreviewedChangeGroup'],_0x51eea3=this['_getPresentableSiblingContentPartIndex'](_0x38cf83,_0x577210,'next');null!==_0x51eea3&&this['_openBalloonFor'](_0x38cf83,_0x51eea3);}),this['listenTo'](_0x436864,'showPrevious',()=>{const {replyId:_0x268b38,partIndex:_0x4b1c33}=this['_currentPreviewedChangeGroup'],_0x324128=this['_getPresentableSiblingContentPartIndex'](_0x268b38,_0x4b1c33,'previous');null!==_0x324128&&this['_openBalloonFor'](_0x268b38,_0x324128);}),this['listenTo'](_0x436864,'dialogClosed',(_0x4f21ea,{id:_0x464c8b})=>{if('aiChatBalloon'!==_0x464c8b)return;const {replyId:_0x56081a,partIndex:_0x201d16}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x56081a,'index':_0x201d16,'isActive':!0x1}),this['_activeBalloon']===_0x436864&&(this['_activeBalloon']=void 0x0);});}_integrateEditor(_0x2836e1){if(this['_channelsToEditors']['set'](_0x2836e1['config']['get']('collaboration.channelId'),_0x2836e1),this['_integrateEditorBalloon'](_0x2836e1),this['addCurrentDocumentToChatContext'](),this['listenTo'](_0x2836e1,'change:isReadOnly',()=>this['_refreshSuggestionGating']()),_0x2836e1['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x2836e1['plugins']['has']('Undo')){const _0x516cae=_0x2836e1['commands']['get']('undo'),_0x404296=_0x2836e1['commands']['get']('redo');this['listenTo'](_0x516cae,'revert',(_0x43c576,_0x20a817,_0x20c663)=>{const _0x2750d9=this['_batchToChanges']['get'](_0x20a817);if(!_0x2750d9)return;const _0x2e4525=this['activeConversation']['getInteraction'](_0x2750d9['interactionId']),_0x1d9531=_0x2e4525?.['getReply'](_0x2750d9['replyId']);this['_batchToChanges']['delete'](_0x20a817),_0x2e4525&&_0x1d9531&&(_0x2750d9['indexes']['forEach'](_0x127261=>_0x1d9531['setChangeGroupState'](_0x127261,'pending')),this['_batchToChanges']['set'](_0x20c663,_0x2750d9));}),this['listenTo'](_0x404296,'revert',(_0x1582b5,_0x458093,_0x3b52a0)=>{const _0x3d5744=this['_batchToChanges']['get'](_0x458093);if(!_0x3d5744)return;const _0x28e489=this['activeConversation']['getInteraction'](_0x3d5744['interactionId']),_0x574a96=_0x28e489?.['getReply'](_0x3d5744['replyId']);this['_batchToChanges']['delete'](_0x458093),_0x28e489&&_0x574a96&&(_0x3d5744['indexes']['forEach'](_0x1a485d=>_0x574a96['setChangeGroupState'](_0x1a485d,'accepted')),this['_batchToChanges']['set'](_0x3b52a0,_0x3d5744));});}const _0x31c760=_0x2836e1['config']['get']('ai.chat.context');_0x31c760['alwaysAddSelection']&&_0x31c760['document']['enabled']&&this['listenTo'](_0x2836e1['model']['document']['selection'],'change:range',(_0x5d3294,_0x4939de)=>{_0x4939de['directChange']&&'chat'===_0x2836e1['plugins']['get']('AITabs')['view']['activeTab']&&(_0x2836e1['model']['hasContent'](_0x2836e1['model']['document']['selection'])?this['addSelectionToChatContext'](_0x2836e1):this['removeSelectionFromChatContext']());});}async _getLastCreatedConversationId(){const _0x33ec75=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x510f31=await _0x33ec75['getConversations']();return _0x510f31['length']?_0x510f31[0x0]['id']:'new';}catch(_0x437132){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':_0x437132})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async _startConversationSafely(_0x3f97ca={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x3f97ca),_0x3f97ca['id']||this['set']('isConversationReady',!0x0);}catch(_0x1a22f1){this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x3f97ca['id']||kt()}),this['_reporter']['logError'](_0x1a22f1),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}_detachFromActiveConversation(){this['_aiChatUi']['setIsUploadInProgress'](!0x1),this['activeConversation']&&this['stopListening'](this['activeConversation']);}async _handleStartConversation({id:_0x1faa3c,modelId:_0x450caa,contexts:_0x114fa6}={}){this['_detachFromActiveConversation'](),this['_closeActiveBalloon']();let _0x59d57b=_0x450caa;_0x59d57b||(_0x1faa3c||!this['activeConversation']?_0x59d57b=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x59d57b=this['activeConversation']['selectedModel']?.['id'])),this['_stopLastInteraction']();const _0x1ce630=this['getGroupId'](),_0x491793=_0x1faa3c||kt(),_0x4e9cd8=await this['_aiModels']['getAvailableModels']();let _0x4a0c70;this['activeConversation']=new jn({'connector':this['_aiConnector'],'chatModels':this['_aiModels'],'selectedModelId':_0x59d57b,'conversationId':_0x491793,'group':_0x1ce630,'locale':this['context']['locale'],'isFromHistory':!!_0x1faa3c,'channelsToEditors':this['_channelsToEditors'],'contextLibrary':this['_aiContextLibrary'],'extraContexts':_0x114fa6,'getSessionId':_0x486f93=>this['_aiEditing']['getSessionId'](_0x486f93),'aiEditing':this['_aiEditing']}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',()=>{this['_aiChatUi']['createConversation']({'availableModels':_0x4e9cd8}),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x1faa3c||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x5924b6,_0x5cb34a)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x5cb34a['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x53ca3f=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x53ca3f);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x5e477d=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x5e477d);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x2d93d8,_0x3a70d1)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x3a70d1,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x17c890,_0xa75eda)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0xa75eda,{'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',(_0x6810f7,_0x460a94)=>{this['_aiChatUi']['removeFeedInteraction'](_0x460a94['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x518cf6,_0x4aa748,_0x33e317)=>{this['_updateConversationTitle'](_0x4aa748,_0x33e317);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x217010,_0x41310e)=>{void 0x0!==_0x4a0c70&&_0x4a0c70!==_0x41310e['id']&&this['_updateReplyContentThrottled']['flush'](),_0x4a0c70=_0x41310e['id'],_0x41310e['isFromHistory']?await this['_updateReplyContent']({'reply':_0x41310e}):await this['_updateReplyContentThrottled']({'reply':_0x41310e});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x5e0d4d,{reply:_0x45ceb2,index:_0x877932,state:_0x24de3f,outdatedReason:_0x5f2ab2})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x45ceb2['id'],'index':_0x877932,'state':_0x24de3f,'outdatedReason':_0x5f2ab2}),this['_aiChatUi']['hasFeedItem'](_0x45ceb2['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x45ceb2['id'],this['_computeSuggestionGating'](_0x45ceb2)),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x45ceb2['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x877932&&this['_activeBalloon']?.['setState'](_0x24de3f,_0x5f2ab2);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x1e2219,_0x4a622d)=>{if(this['_aiChatUi']['addContextItem'](_0x4a622d['contextItem'],_0x4a622d['isLoading']),'selection'===_0x4a622d['contextItem']['type']){const _0x1e58bd=Ss(this['context']),_0x565caf=[..._0x1e58bd['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x1e58bd,'ranges':_0x565caf,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x1faf79,_0x30a995)=>{this['_aiChatUi']['removeContextItem'](_0x30a995['uiId']),'current-document'==_0x30a995['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x30a995['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0xbf99c2,_0x5375d7)=>{this['_aiChatUi']['setContextItemLoading'](_0x5375d7['contextItem']['uiId'],_0x5375d7['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x3b9ae5,_0x17cd5f)=>{this['_aiChatUi']['setConversationContext'](_0x17cd5f['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0xf6aefb,_0x325750)=>{this['_aiChatUi']['setAddContextOptions'](_0x325750['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x1259ea,_0x1f32df)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x1f32df['sourceId'],_0x1f32df['source'],_0x1f32df['resources'],_0x1f32df['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x27b6e4,_0x2838c3)=>{this['_aiChatUi']['updateResourceState'](_0x2838c3['sourceId'],_0x2838c3['resourceId'],_0x2838c3['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x98f40e,_0x5c8a14)=>{this['_aiChatUi']['updateCapabilities'](_0x5c8a14);}),this['listenTo'](this['activeConversation'],'modelSelected',(_0x36123d,_0x311fce)=>{this['_aiChatUi']['setSelectedModel'](_0x311fce['selectedModel']??null,_0x311fce['isDisabled']);}),this['listenTo'](this['activeConversation'],'error',async(_0x56cbf3,{error:_0x376f50,interactionId:_0x34e880,fileName:_0x5c914b,url:_0x574e5c,sourceId:_0x4d5f68,sourceLabel:_0x108ddf})=>{let _0x26ee99;const _0x413fd0=_0x34e880?_0x34e880+':'+kt():kt();this['_reporter']['reportError'](_0x376f50),this['_aiChatUi']['startAutoScroll'](),_0x376f50['message']['startsWith']('ai-request-aborted')?(this['_cancelProcessing'](),this['activeConversation']?.['cancelLastInteractionStream'](),_0x26ee99=this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Es(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x413fd0})):_0x376f50['message']['startsWith']('ai-chat-conversation-init-failed')||_0x376f50['message']['startsWith']('ai-chat-conversation-start-failed')?_0x26ee99=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x413fd0}):_0x376f50['message']['startsWith']('ai-chat-file-upload-failed')?_0x26ee99=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x5c914b),'id':_0x413fd0}):_0x376f50['message']['startsWith']('ai-chat-url-upload-failed')?_0x26ee99=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x574e5c),'id':_0x413fd0}):_0x376f50['message']['startsWith']('ai-chat-context-invalid-data')?_0x26ee99=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x413fd0}):_0x376f50['message']['startsWith']('ai-chat-context-unsupported-type')?_0x26ee99=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x413fd0}):_0x376f50['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x4d5f68&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x4d5f68),_0x26ee99=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x108ddf||'source'),'id':_0x413fd0})):_0x376f50['message']['startsWith']('ai-chat-resource-load-failed')?_0x26ee99=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x413fd0}):_0x376f50['message']['startsWith']('ai-chat-invalid-request')?_0x26ee99=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x413fd0}):_0x376f50['message']['startsWith']('ai-chat-context-unsupported-file-type')?_0x26ee99=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x413fd0}):_0x376f50['message']['startsWith']('ai-chat-context-file-too-large')?_0x26ee99=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x413fd0}):_0x376f50['message']['startsWith']('ai-chat-context-file-too-many-pages')?_0x26ee99=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x413fd0}):_0x376f50['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?_0x26ee99=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x413fd0}):(this['_cancelProcessing'](),_0x26ee99=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x413fd0}));try{await Promise['race']([_0x26ee99,this['_aiChatUi']['idleUiPromise']]);}finally{this['_aiChatUi']['isBusy']||this['_aiChatUi']['stopAutoScroll']();}}),await this['activeConversation']['init'](this['_buildConversationContextConfig']()),_0x1faa3c||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']());}_buildConversationContextConfig(){const _0x50d8c=this['context']['config']['get']('ai.chat.context');return this['_contextLibrarySource']?{..._0x50d8c,'sources':[..._0x50d8c?.['sources']??[],this['_contextLibrarySource']]}:_0x50d8c;}async _setUpContextLibrarySource(){const _0x5bab0b=await this['_createContextLibrarySource']();_0x5bab0b&&(this['_contextLibrarySource']=_0x5bab0b,this['activeConversation']&&this['activeConversation']['chatContext']['addContextSource'](_0x5bab0b));}async _createContextLibrarySource(){let _0x58875e;try{_0x58875e=await this['_aiContextLibrary']['getAvailableContexts']();}catch{return null;}if(!_0x58875e['length'])return null;const _0x52e426=_0x58875e['map'](_0x15c9f3=>({'id':_0x15c9f3['id'],'type':'context','label':_0x15c9f3['name']||_0x15c9f3['id']}));return{'id':'ck-ai-context-library','label':Es(this['context']['locale'],'AI_CHAT_CONTEXT_LIBRARY_LABEL'),'useDefaultFiltering':!0x0,'getResources':()=>Promise['resolve'](_0x52e426)};}_removeFromContext(_0x4d0edc){this['activeConversation']?.['removeFromContext'](_0x4d0edc);}_toggleWebSearch(){this['activeConversation']?.['toggleWebSearch']();}_toggleReasoning(){this['activeConversation']?.['toggleReasoning']();}getInteractionAndReplyById(_0x550478){const [_0x1262a8,_0x5631ee]=_0x550478['split'](':'),_0x5b1f12=this['activeConversation']['getInteraction'](_0x1262a8);return{'interaction':_0x5b1f12,'reply':_0x5b1f12['getReply'](_0x5631ee)};}_scrollToSuggestionRange(_0x542690,_0x1f8c35=!0x1,_0x119b36){const _0x228d67={'target':_0x119b36['editing']['view']['domConverter']['viewRangeToDom'](_0x119b36['editing']['mapper']['toViewRange'](_0x542690)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x1f8c35};_0x1f8c35&&(_0x228d67['alignToTop']=!0x0),Ot(_0x228d67);}_updateConversationTitle(_0x4c0605,_0x430e27=!0x1){this['_aiChatUi']['setConversationTitle'](_0x4c0605||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x430e27);}_addFeedItemReply(_0x3a3ccf){'text'===_0x3a3ccf['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x3a3ccf):this['_aiChatUi']['addFeedItemAISuggestion'](_0x3a3ccf);}async _updateReplyContent({reply:_0x2fd0ca,renderingStrategy:_0x5662b9}){const {id:_0xac0cfc,interactionId:_0x147719,isDone:_0x1c986c,type:_0x419948,parsedContent:_0x4fc7a4}=_0x2fd0ca,_0x14a1c0=_0x147719+':'+_0xac0cfc;if('modification'===_0x419948){const _0x2762cc=_0x2fd0ca['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x14a1c0,'parts':_0x2762cc,'isDone':_0x1c986c,'skipLoadingEffects':_0x2fd0ca['isFromHistory']}),this['_aiChatUi']['hasFeedItem'](_0x2fd0ca['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x2fd0ca['id'],this['_computeSuggestionGating'](_0x2fd0ca));}else'text'===_0x419948&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x14a1c0,'parsedContent':_0x4fc7a4['get']('text'),'renderingStrategy':_0x5662b9,'isDone':_0x1c986c});_0x1c986c&&_0x2fd0ca['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x14a1c0,_0x2fd0ca['sources']);}_updateReplyContentThrottled=_0x4e27fd(this['_updateReplyContent']['bind'](this),0xc8);_stopLastInteraction(){this['activeConversation']?.['stopProcessing'](),this['_aiChatUi']['stopInteraction'](this['activeConversation']?.['lastInteraction']),this['_updateReplyContentThrottled']['cancel']();}async _flushLastInteractionUI(){const _0x1fa627=this['activeConversation']?.['lastInteraction'];if(_0x1fa627){for await(const _0x23e7c1 of _0x1fa627['replies'])this['_aiChatUi']['hasFeedItem'](_0x23e7c1['id'])||this['_addFeedItemReply'](_0x23e7c1),await this['_updateReplyContent']({'reply':_0x23e7c1,'renderingStrategy':'static'});}}async['_cancelProcessing'](){this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext']();}_updateRatings(_0x68e921){const _0xc52128={'positiveCount':_0x68e921['changeGroups']['filter'](_0x2e753d=>'accepted'===_0x2e753d['state'])['length'],'totalCount':_0x68e921['changeGroups']['length'],'modificationId':_0x68e921['id']},_0x138991=this['activeConversation']['getInteraction'](_0x68e921['interactionId'])['messageId'];_0x138991&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x138991,_0xc52128);}_getAIChatFeedAPI(_0x55dd94){const _0x1918d1=this['_aiChatUi'],_0x237752=()=>{_0x55dd94['resetWebSearchState'](),_0x55dd94['resetReasoningState'](),_0x1918d1['clearLoadingMessage']();},_0x5be31f=()=>{_0x55dd94['currentReply']&&(_0x55dd94['currentReply']['done'](),_0x55dd94['currentReply']=void 0x0);};return{'insertTextReply':(_0x4f543b,_0x43583e)=>{_0x5be31f(),_0x237752();const _0x3431cc=_0x55dd94['currentReply']=_0x55dd94['createReply']({'type':'text','interactionId':_0x55dd94['id'],'id':_0x43583e||kt(),'channelsToEditors':this['_channelsToEditors']});return _0x3431cc['appendContent'](_0x4f543b),_0x5be31f(),_0x3431cc;},'insertCustomElement':async(_0x3c88ba,_0xd5dd37)=>(_0x5be31f(),_0x237752(),_0x1918d1['addFeedItemCustomElement'](_0x3c88ba,_0xd5dd37||kt())),'setLoadingMessage':_0x4014d5=>{_0x1918d1['setLoadingMessage'](_0x4014d5);},'clearLoadingMessage':()=>{_0x1918d1['clearLoadingMessage']();}};}_checkRemoveCurrentDocumentFromChatContext(){bs(this['context'])['find'](_0x8585af=>'destroyed'!==_0x8585af['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(_0x1f661d){const _0x571cbd=new AbortController();return{'promise':new Promise((_0x43d1fd,_0x371860)=>{const _0x563e26=setTimeout(_0x43d1fd,_0x1f661d);_0x571cbd['signal']['addEventListener']('abort',()=>{clearTimeout(_0x563e26),_0x371860();});}),'abortController':_0x571cbd};}var rr=class{options;isStreaming=!0x1;document=null;nodesList=[];currentIndex=0x0;timeoutAbortController=null;lastUpdateTime=0x0;constructor(_0x3c7644){this['options']={'delay':_0x3c7644?.['delay']??0xa,'textNodeStyle':_0x3c7644?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async stream({document:_0x3c9bf9,targetElement:_0x5c339e,abortSignal:_0x2801d8}){this['isStreaming']&&this['stop'](),_0x2801d8?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x34616a(_0x3c9bf9,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x30ebd6=0x0;_0x30ebd6<this['currentIndex'];_0x30ebd6++)this['nodesList'][_0x30ebd6]['shouldBeStreamed']=!0x0;do{const _0x48601c=Date['now'](),_0x401719=this['nodesList'][this['currentIndex']],_0x1578e1=_0x48601c-this['lastUpdateTime'];if(_0x401719){_0x401719['shouldBeStreamed']=!0x0;let _0x13062b=_0x401719['parent'];for(;_0x13062b;)_0x13062b['shouldBeStreamed']=!0x0,_0x13062b=_0x13062b['parent'];}if(_0x1578e1<this['options']['delay'])try{const {promise:_0x512f74,abortController:_0x3a7c2f}=nr(this['options']['delay']-_0x1578e1);this['timeoutAbortController']=_0x3a7c2f,await _0x512f74;}catch(_0xc26fa0){return;}_0x45c20f(_0x5c339e,'<'+_0x5c339e['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x5c339e['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:_0x319e83}){Array['from'](_0x319e83['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0xdd259e=>{_0xdd259e['replaceWith'](_0xdd259e['childNodes'][0x0]);});}stop(){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x4d6c8d){let _0x6fac31='';if(function(_0x3a9a61){return _0x67f576(_0x3a9a61);}(_0x4d6c8d)){for(const _0x23928d of _0x4d6c8d['children'])_0x6fac31+=this['renderNode'](_0x23928d);}else{if(hr(_0x4d6c8d)){if(!_0x4d6c8d['shouldBeStreamed'])return'';const _0x34feb1=_0x4d6c8d,_0x13c147=Object['entries'](_0x34feb1['attribs'])['map'](([_0x564e87,_0x27d427])=>_0x564e87+'=\x22'+_0x27d427+'\x22')['join']('\x20');_0x6fac31+='<'+_0x34feb1['tagName']+(_0x13c147?'\x20'+_0x13c147:'')+'>';for(const _0x5a5cdf of _0x1b1092(_0x34feb1))_0x6fac31+=this['renderNode'](_0x5a5cdf);_0x6fac31+='</'+_0x34feb1['tagName']+'>';}else{if(!ar(_0x4d6c8d))return'';if(!_0x4d6c8d['shouldBeStreamed'])return'';!function(_0x47f2e1){return!(!_0x47f2e1['parent']||!hr(_0x47f2e1['parent']))&&(!!or['includes'](_0x47f2e1['parent']['tagName'])&&!_0x1347c6(_0x47f2e1)['match'](/^\s*[<>]\s*$/));}(_0x4d6c8d)?_0x6fac31+=_0x4a5d1b(_0x4d6c8d):_0x6fac31+=_0x4a5d1b(new _0x4f2bc5('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x4d6c8d]));}}return _0x6fac31;}getParsedDocumentNodeList(){const _0x123111=[];return function(_0x3dcd51,_0x471507){const _0x184b40=_0xfa7dd1=>{if(_0x471507(_0xfa7dd1),_0xfa7dd1 instanceof _0x7ae23c)for(let _0x35c638=0x0;_0x35c638<_0xfa7dd1['children']['length'];_0x35c638++){const _0x3add37=_0xfa7dd1['children'][_0x35c638];_0x184b40(_0x3add37);}};for(let _0x2e5aad=0x0;_0x2e5aad<_0x3dcd51['children']['length'];_0x2e5aad++)_0x184b40(_0x3dcd51['children'][_0x2e5aad]);}(this['document'],_0x5874bf=>{if(ar(_0x5874bf)){const _0x57b352=this['splitTextNodeIntoWordNodes'](_0x5874bf);_0x57b352['length']&&_0x123111['push'](..._0x57b352);}_0x5874bf['isWordSplitSource']||_0x5874bf['isWordSplitResult']||_0x123111['push'](_0x5874bf);}),_0x123111;}splitTextNodeIntoWordNodes(_0x151c74){if(_0x151c74['isWordSplitSource']||_0x151c74['isWordSplitResult'])return[];const _0x376d2e=_0x1347c6(_0x151c74)['match'](/(?:\s*\S+\s*)/g),_0x3c8bfa=[];if(_0x376d2e&&_0x376d2e['length']>0x1){for(const _0x38adbd of _0x376d2e){const _0x210d6f=new _0x2c4665(_0x38adbd);_0x210d6f['isWordSplitResult']=!0x0,ti(_0x151c74,_0x210d6f),_0x3c8bfa['push'](_0x210d6f);}_0x151c74['isWordSplitSource']=!0x0,_0x356c4e(_0x151c74);}return _0x3c8bfa;}};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(_0x112956){return _0x37569a(_0x112956);}function hr(_0x4c2d9b){return _0x2159f2(_0x4c2d9b);}function cr(_0x213d73,_0x44f2df){_0x213d73['cleanUpAnimations']({'targetElement':_0x44f2df}),_0x44f2df['querySelectorAll']('[data-id]')['forEach'](_0x20fc1b=>{_0x20fc1b['removeAttribute']('data-id');});}var lr=class extends _0x3a2edc{options;content='';htmlStreamer;['children'];constructor(_0x5d418f){super();const _0x41a283=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new rr(),this['options']=_0x5d418f,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x41a283['if']('isDone','ck-ai-chat__feed__item_done'),_0x41a283['if']('isVisible','ck-hidden',_0x567c29=>!_0x567c29),'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(_0x2bc62d,_0x381ec3,_0x2dd05f){await this['htmlStreamer']['stream']({'document':_0x2bc62d,'targetElement':_0x381ec3,'abortSignal':_0x2dd05f});}},ur=class extends _0x3a2edc{['showChangesToggleView'];constructor(_0x1cd529,_0xbb3ac1){super(_0x1cd529),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new dr(_0x1cd529),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Dn,'label':Es(_0x1cd529,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0xbb3ac1['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x59a7ca=>_0x59a7ca?it:et),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x5908c2=new $t();_0x5908c2['content']=_0x3495c4,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0xbb3ac1['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x5908c2,{'tag':'span','children':[Es(_0x1cd529,'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':_0x4ae57d,'rejected':_0x1e5963,'outdated':_0x3dc3e9};var gr=class extends _0x3a2edc{statePillView;constructor(_0x30b8ac){super(_0x30b8ac);const _0x56e44b=this['bindTemplate'];this['set']('state','accepted'),this['set']('outdatedReason',void 0x0),this['set']('isVisible',!0x0),this['statePillView']=new _0x55e383(_0x30b8ac),this['statePillView']['bind']('label')['to'](this,'state',_0x305da2=>function(_0x465f0d,_0x23f5a0){return Es(_0x465f0d,'AI_SUGGESTION_CONTENT_PART_STATE_'+_0x23f5a0['toUpperCase']());}(_0x30b8ac,_0x305da2)),this['statePillView']['bind']('icon')['to'](this,'state',_0x2b3719=>_r[_0x2b3719]),this['statePillView']['bind']('class')['to'](this,'state',_0x22bc4b=>'ck-pill_'+_0x22bc4b),this['statePillView']['bind']('tooltip')['to'](this,'state',this,'outdatedReason',(_0x12b431,_0x1307d7)=>function(_0x46903e,_0x38aa0d,_0x2e58d4){if('outdated'!==_0x38aa0d)return;return Es(_0x46903e,_0x2e58d4?Ar[_0x2e58d4]:'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP');}(_0x30b8ac,_0x12b431,_0x1307d7)),this['statePillView']['tooltipPosition']='s',this['statePillView']['tooltipClass']='ck-tooltip_multi-line',this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x56e44b['if']('isVisible','ck-hidden',_0x3f1a20=>!_0x3f1a20)]},'children':[this['statePillView']]});}setState(_0x3a3c53,_0x54d1d7){this['state']=_0x3a3c53,this['outdatedReason']='outdated'===_0x3a3c53?_0x54d1d7: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 _0x5d2e05{_applyButton;_suggestButton;constructor(_0x1e4fc2,_0x1c4ada,_0x68ff45){super(_0x1e4fc2);const _0x368ffa=Boolean(_0x68ff45);this['set']('isEnabled',!_0x368ffa),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x396cae=[];if(!_0x368ffa){_0x1c4ada['includes']('applySuggestion')&&(this['_applyButton']=new Mt(_0x1e4fc2),this['_applyButton']['set']({'label':Es(_0x1e4fc2,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x38bf23}),this['_applyButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0xf03b56,_0x786460)=>_0xf03b56&&!_0x786460),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x4bd994=>!_0x4bd994),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x396cae['push'](this['_applyButton'])),_0x1c4ada['includes']('insertSuggestion')&&(this['_suggestButton']=new Mt(_0x1e4fc2),this['_suggestButton']['set']({'label':Es(_0x1e4fc2,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x2e4b78}),this['_suggestButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0x5f22c9,_0xed3bc9)=>_0x5f22c9&&!_0xed3bc9),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x396cae['push'](this['_suggestButton']));const _0x431d50=new Mt(_0x1e4fc2);_0x431d50['set']({'label':Es(_0x1e4fc2,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x370aca}),_0x431d50['bind']('isEnabled')['to'](this),_0x431d50['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x396cae['push'](_0x431d50);}this['items']['addMany'](_0x396cae);const _0x976653=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x976653['if']('isVisible','ck-hidden',_0x154d05=>!_0x154d05)]}});}setButtonsVisibility({showApplyButton:_0x40851f,showSuggestButton:_0x5d5006}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x40851f),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x5d5006);}},pr=class extends _0x3a2edc{toolbarView;stateView;titleLabelView;['children'];constructor(_0x37ccf1,{part:_0x3e9447,uiIndex:_0x9d2959,availableActions:_0x1af92d,areActionsDisabled:_0xdc37f2}){super(_0x37ccf1),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['toolbarView']=new Ir(_0x37ccf1,_0x1af92d,_0xdc37f2),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x3e9447['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x3e9447['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x3e9447['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn','isTargetReadOnly')['to'](this),this['stateView']=new gr(_0x37ccf1),this['titleLabelView']=new Er(_0x37ccf1,_0x9d2959),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',(_0x368d16,_0x35d20f,_0x184f06,_0x49d65a)=>{'pending'===_0x49d65a?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x184f06?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x184f06,this['outdatedReason']),this['children']['add'](this['stateView']));});}},Er=class extends _0x3a2edc{constructor(_0x587410,_0x29ec1a){super(_0x587410),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Es(_0x587410,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x29ec1a['toString']())]});}},mr=class extends _0x3a2edc{htmlStreamer;constructor(_0x5dafad){super(_0x5dafad),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:_0x2ef49f,renderingStrategy:_0x4d3744,abortSignal:_0x20e584}){this['_ensureHostElementTag'](_0x2ef49f['wrapperTag']||'div');const _0xcb4444=_0x34616a(_0x2ef49f['content'],!0x0);for(const _0x865245 of ys(_0xcb4444))_0x356c4e(_0x865245);'streaming'===_0x4d3744?await this['htmlStreamer']['stream']({'document':_0xcb4444,'targetElement':this['element'],'abortSignal':_0x20e584}):_0x45c20f(this['element'],'<'+this['element']['tagName']+'>'+Os(_0xcb4444)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}cleanUpStreamingArtifacts(){cr(this['htmlStreamer'],this['element']);}_ensureHostElementTag(_0x31eed8){if(!this['element']||this['element']['tagName']['toLowerCase']()===_0x31eed8)return;const _0x1ec0c7=new _0x165444({'tag':_0x31eed8,'attributes':{'class':this['element']['className']}})['render']();this['element']['replaceWith'](_0x1ec0c7),this['element']=_0x1ec0c7;}},Tr=class extends _0x3a2edc{['_children'];['_headerView'];_streamableContentView;constructor(_0x99c856,{part:_0x26bf90,uiIndex:_0x149bea,areActionsDisabled:_0x25f8db,availableActions:_0x18a59f}){super(_0x99c856);const _0x1d6c9e=this['bindTemplate'];this['set']('state',_0x26bf90['state']),this['set']('outdatedReason',_0x26bf90['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 _0x3dfb86=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x25f8db;};this['on']('change:state',_0x3dfb86),this['on']('change:isDone',_0x3dfb86),_0x3dfb86(),this['_children']=this['createCollection'](),this['_headerView']=new pr(_0x99c856,{'part':_0x26bf90,'uiIndex':_0x149bea,'availableActions':_0x18a59f,'areActionsDisabled':_0x25f8db}),this['_headerView']['bind']('isEnabled','outdatedReason','state','isTrackChangesOn','isTargetReadOnly')['to'](this),this['_headerView']['delegate'](...ir)['to'](this),this['_streamableContentView']=new mr(_0x99c856),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x1d6c9e['to']('state',_0x5dcd96=>'ck-ai-suggestion__body__content-part_'+_0x5dcd96),_0x1d6c9e['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x1d6c9e['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x1d6c9e['if']('isVisible','ck-hidden',_0x50e917=>!_0x50e917)]},'children':this['_children'],'on':{'mouseenter':_0x1d6c9e['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x26bf90['index']});}),'mouseleave':_0x1d6c9e['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x26bf90['index']});}),'click':_0x1d6c9e['to'](_0x551fdf=>{const _0x1b3416=_0x551fdf['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x1b3416)&&this['fire']('showChangeInText',{'index':_0x26bf90['index']});})}});}async updateContent({part:_0x485714,showUnchangedParts:_0x5cd19a=!0x1,abortSignal:_0x226fb8}){this['partDefinition']=_0x485714,this['isVisible']=this['partDefinition']['hasChanges']||_0x5cd19a,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x485714,'renderingStrategy':'static','abortSignal':_0x226fb8});}['markAsDone'](){this['isDone']=!0x0;}},wr=class extends _0x3a2edc{constructor(_0x3ccbd8,_0x47fc99){super(_0x3ccbd8),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x145a66=>!_0x145a66)]},'children':this['_createSkeletonItems'](_0x47fc99)});}_createSkeletonItems(_0x50121c){const _0x19cf42=['ck','ck-ai-skeleton__item'];return _0x50121c['map'](_0x6dd6db=>{let _0x195ee8='';switch(_0x6dd6db['attributes']['align']){case'right':_0x195ee8='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x195ee8='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x195ee8='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x6dd6db['tag'],'attributes':{'class':[..._0x19cf42,_0x6dd6db['attributes']['class']?_0x6dd6db['attributes']['class']:''],'style':'width:\x20'+_0x6dd6db['attributes']['width']+';\x20height:\x20'+_0x6dd6db['attributes']['height']+';'+_0x195ee8}};});}};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(_0x2039e0,_0x3a662d,_0x24a3ba,_0x4f0889){return new Array(_0x2039e0)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x3a662d,'height':_0x24a3ba,'align':_0x4f0889}}));}const br=/* #__PURE__ -- @preserve */
|
|
33
|
+
dt();var Sr=class extends br{['queue']=[];['isProcessing']=!0x1;_abortController;async['enqueue'](_0x14042f){const _0x41b32e=this['createTask'](_0x14042f);return this['queue']['push'](_0x41b32e),this['_processQueue'](),_0x41b32e['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(_0x21904c=>{this['once']('_queueEmpty',()=>{_0x21904c();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0xc0488b=this['queue']['shift']();try{await _0xc0488b['callback'](this['_abortController']['signal']),_0xc0488b['resolve']();}catch(_0x198679){_0xc0488b['reject'](_0x198679);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}createTask(_0x2617b7){let _0x3d7ed3,_0x587a7f;const _0x1a8484=new Promise((_0x2503fd,_0x4bf581)=>{_0x3d7ed3=_0x2503fd,_0x587a7f=_0x4bf581;});return{'callback':_0x2617b7,'resolve':_0x3d7ed3,'reject':_0x587a7f,'completePromise':_0x1a8484};}},Rr=class extends lr{constructor(_0x18745d){super(_0x18745d),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x18745d['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}setContent(_0x1ff261){this['element']['innerHTML']=_0x1ff261;}};const Or=['applySuggestion','insertSuggestion'];var vr=class extends _0x3a2edc{_applyChangesButton;_insertSuggestionsButton;['children'];constructor(_0x6207e0,_0x59b4f9=[...Or],_0x4b62ff){super(_0x6207e0);const _0x27a7fc=this['bindTemplate'],_0x38fda2=Boolean(_0x4b62ff);this['set']('isEnabled',!_0x38fda2),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x38fda2||(this['_applyChangesButton']=new Mt(_0x6207e0),this['_applyChangesButton']['set']({'label':Es(_0x6207e0,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x59b4f9['includes']('applySuggestion'),'class':Ln}),this['_insertSuggestionsButton']=new Mt(_0x6207e0),this['_insertSuggestionsButton']['set']({'label':Es(_0x6207e0,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x59b4f9['includes']('insertSuggestion'),'class':Pn}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0xcffab=>{_0xcffab['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',_0x27a7fc['if']('isVisible','ck-hidden',_0x50eac1=>!_0x50eac1)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}updateVisibility(_0x208cc3){this['isVisible']=_0x208cc3;}_switchButtonLabelsPlurality(_0x10383f){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x10383f?(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 _0x3a2edc{['children'];['balloonPanelView'];bodyCollection;constructor(_0x5bca8b,_0x5b6eab){super(_0x5bca8b),this['bodyCollection']=_0x5b6eab,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',_0xe0e8da=>!_0xe0e8da)]},'children':this['children']});const _0xb69ffc=new _0x3a2edc(this['locale']),_0x4ebeec=new $t();_0x4ebeec['content']=ht,_0xb69ffc['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x4ebeec,{'tag':'span','children':[{'text':Es(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0xb69ffc),this['_setupBalloonPanel'](_0x5bca8b);}['addSource'](_0x579362){this['children']['add'](new yr(this['locale'],_0x579362,this['balloonPanelView']));}_setupBalloonPanel(_0x16b90a){this['balloonPanelView']=new xt(_0x16b90a),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},yr=class extends Mt{['balloonPanelView'];['source'];constructor(_0xeafb65,_0x35a204,_0x39fd58){super(_0xeafb65),this['source']=_0x35a204,this['balloonPanelView']=_0x39fd58,this['set']({'label':_0x35a204['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x42391c=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x42391c['to'](()=>{window['open'](_0x35a204['url'],'_blank');}),'mouseenter':_0x42391c['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x42391c['to'](()=>{this['_hideTooltip']();})}}),_0x35a204['favicon']){const _0x35d7e2=new _0x3a2edc(_0xeafb65);_0x35d7e2['setTemplate']({'tag':'img','attributes':{'src':_0x35a204['favicon']||ht,'alt':_0x35a204['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x35d7e2);}else this['set']('icon',ht);}_createTooltipContentView(_0x45d655,_0x56eb41){const _0x426fee=new _0x3a2edc(_0x45d655),_0x29ed3b=[];let _0x88b3c4;_0x56eb41?.['favicon']?(_0x88b3c4=new _0x3a2edc(_0x45d655),_0x88b3c4['setTemplate']({'tag':'img','attributes':{'src':_0x56eb41['favicon'],'alt':_0x56eb41['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x88b3c4=new $t(),_0x88b3c4['content']=ht,_0x88b3c4['extendTemplate']({'attributes':{'alt':_0x56eb41['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x29ed3b['push'](_0x88b3c4);const _0x2bd101=new _0x3a2edc(_0x45d655);_0x2bd101['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x56eb41['url']},'children':[{'text':new URL(_0x56eb41['url'])?.['hostname']}]}),_0x29ed3b['push'](_0x2bd101);const _0x51955f=new _0x3a2edc(_0x45d655);_0x51955f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x29ed3b});const _0x4ebff8=new _0x3a2edc(_0x45d655);return _0x4ebff8['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x56eb41['title']['length']>0x190?_0x56eb41['title']['substring'](0x0,0x190)+'...':_0x56eb41['title']}]}),_0x426fee['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x51955f,_0x4ebff8]}),_0x426fee;}_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 _0x44300a=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x44300a);}},Nr=class extends _0x3a2edc{_actionsView;['_readOnlyByIndex']=new Map();['_sourcesView'];['_children'];_skeletonView;_showSkeletonDebounced=_0x280a1b(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);_skeletonShownAt=null;_areActionsDisabled;_showUnchangedParts;_updateContentPartsPromiseQueue;_emptyPartsWarningView;_availableActions;_cachedContentParts=[];constructor(_0x2d1d7a,_0x3141e6){super(_0x2d1d7a);const {areActionsDisabled:_0x11ccf3,showUnchangedParts:_0xf826ba,availableActions:_0x150481}=_0x3141e6;this['_areActionsDisabled']=_0x11ccf3,this['_showUnchangedParts']=_0xf826ba,this['_availableActions']=_0x150481,this['set']('isTrackChangesOn',!0x1),this['set']('isAcceptAllEnabled',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new wr(_0x2d1d7a,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(_0x2d1d7a,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new vr(_0x2d1d7a,_0x3141e6['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new kr(this['locale'],_0x3141e6['bodyCollection']),_0x3141e6['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'](_0x11c89e=>_0x11c89e instanceof Tr);}async updateContentParts({parts:_0x25841b,abortSignal:_0xa08555,skipLoadingEffects:_0x1de2cb}){this['_cachedContentParts']['length']?_0x25841b['forEach'](_0x24760a=>{const _0x2b27a3=this['_cachedContentParts']['findIndex'](_0x2f9dd7=>_0x2f9dd7['index']==_0x24760a['index']);-0x1===_0x2b27a3?this['_cachedContentParts']['push'](_0x24760a):this['_cachedContentParts'][_0x2b27a3]=_0x24760a;}):this['_cachedContentParts']=_0x25841b;const _0x37bbcb=this['_showUnchangedParts']?_0x25841b:_0x25841b['filter'](_0x40d7a2=>_0x40d7a2['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x37bbcb['length']>0x1),_0x1de2cb&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x10180d of _0x25841b)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x57ed9d=>{let _0x161194=this['getPartView'](_0x10180d['index']);if(_0x161194||_0x10180d['hasChanges']||this['_showUnchangedParts']){if(!_0x161194){if(_0x161194=new Tr(this['locale'],{'part':_0x10180d,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x161194['delegate'](...ir)['to'](this),_0x161194['bind']('isTrackChangesOn')['to'](this),!_0x1de2cb&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x57ed9d),_0x57ed9d['aborted']))return;_0x161194['isTargetReadOnly']=this['_readOnlyByIndex']['get'](_0x10180d['index'])??!0x1,this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x161194,this['_children']['length']-0x1),_0x1de2cb||this['_showSkeletonDebounced']();}await _0x161194['updateContent']({'part':_0x10180d,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x57ed9d}),_0x161194['markAsDone']();}});return _0xa08555?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}updatePartState(_0x14da0e,_0x4f73b5,_0x586463){const _0x50c66f=this['getPartView'](_0x14da0e);_0x50c66f&&(_0x50c66f['outdatedReason']=_0x586463,_0x50c66f['state']=_0x4f73b5);}setGating({readOnlyByIndex:_0x383019,isAcceptAllEnabled:_0x4be3b4}){this['_readOnlyByIndex']=_0x383019,this['isAcceptAllEnabled']=_0x4be3b4;for(const _0x3426cc of this['_contentPartViews'])_0x3426cc['isTargetReadOnly']=_0x383019['get'](_0x3426cc['partDefinition']['index'])??!0x1;}setPartActive(_0x3873ab,_0x12af34){if(!0x1===_0x3873ab){for(const _0x1c758a of this['_contentPartViews'])_0x1c758a['isActive']=!0x1;}else{const _0x183117=this['getPartView'](_0x3873ab);_0x183117&&(_0x183117['isActive']=_0x12af34);}}updateSources(_0xfd99a6){_0xfd99a6['forEach'](_0x1b8adb=>this['_sourcesView']['addSource'](_0x1b8adb)),this['_sourcesView']['isVisible']=!0x0;}getPartView(_0x4f3d28){return this['_contentPartViews']['find'](_0x54a3a2=>_0x54a3a2['partDefinition']['index']==_0x4f3d28)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x1f6a32=!this['_cachedContentParts']['find'](({hasChanges:_0x47e310})=>_0x47e310),_0x2edb92=!!this['_cachedContentParts']['find'](({hasChanges:_0x3ecdff})=>!_0x3ecdff);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x2edb92,_0x1f6a32?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'](_0x1083f3=>_0x1083f3['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']&&!this['_areActionsDisabled']);}async _awaitMinimumSkeletonDisplayTime(_0x500be2){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x48f823=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x48f823>0x0){const {promise:_0x4005df,abortController:_0x3eeea5}=nr(_0x48f823);_0x500be2?.['addEventListener']('abort',()=>_0x3eeea5['abort']()),await _0x4005df['catch'](()=>{});}}get hasNonEmptyParts(){return this['_contentPartViews']['filter'](_0x32a8a9=>_0x32a8a9['partDefinition']['hasChanges'])['length']>0x0;}},xr=class extends _0x3a2edc{['bodyView'];['children'];['headerView'];constructor(_0x59bf29,_0x31b98c,_0x40992f){super(_0x59bf29);const {showDiff:_0xf66f76,areActionsDisabled:_0x253938,showUnchangedParts:_0x519f3f,availableActions:_0x4e8930}=_0x31b98c;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new ur(_0x59bf29,{'showDiff':_0xf66f76}),this['headerView']['on']('toggleShowChanges',(_0x590ca1,_0x2c64eb)=>{this['areChangesVisible']=_0x2c64eb['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x2c64eb['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new Nr(_0x59bf29,{'areActionsDisabled':_0x253938,'showUnchangedParts':!!_0x519f3f,'availableActions':_0x4e8930,'bodyCollection':_0x40992f}),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(_0x264db7){await this['bodyView']['updateContentParts'](_0x264db7);}updateSources(_0x32a69d){this['bodyView']['updateSources'](_0x32a69d);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},Lr=class extends lr{containerView;constructor(_0x42ccc0,_0x34c2c8,_0x5423b3){super(_0x34c2c8),this['set']('isTrackChangesOn',!0x1),this['containerView']=new xr(_0x42ccc0,{'showDiff':_0x34c2c8['showDiff'],'areActionsDisabled':_0x34c2c8['areActionsDisabled'],'availableActions':_0x34c2c8['availableActions']},_0x5423b3),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x473ee3,_0x2a4a70)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x2a4a70['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',(_0x2f3cfb,{index:_0x1cec66})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x1cec66});}),this['containerView']['on']('applySuggestion',(_0x3c849e,{index:_0x23007f}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x23007f});}),this['containerView']['on']('insertSuggestion',(_0x15a4e8,{index:_0x1a4ccc}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x1a4ccc});}),this['containerView']['on']('rejectSuggestion',(_0x214593,{index:_0x13e6e5})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x13e6e5});}),this['containerView']['on']('mouseOverSuggestion',(_0x22d9a1,{index:_0x57d094})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x57d094});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x12600e,{index:_0xf222d5})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0xf222d5});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async updateContent(_0x513ffd){await this['containerView']['updateContent'](_0x513ffd);}updatePartState(_0x3be8f7,_0x213b01,_0x25c965){this['containerView']['bodyView']['updatePartState'](_0x3be8f7,_0x213b01,_0x25c965);}setPartActive(_0x36ee2c,_0x5ab352){!0x1===_0x36ee2c?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x36ee2c,_0x5ab352);}updateSources(_0x396371){this['containerView']['updateSources'](_0x396371);}getPartView(_0x1bd03c){return this['containerView']['bodyView']['getPartView'](_0x1bd03c);}setGating(_0x5effa0){this['containerView']['bodyView']['setGating'](_0x5effa0);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},Pr=class extends lr{replyContainer;_bodyCollection;constructor(_0x1a9843,_0x1d21f8,_0x4378cb){super(_0x1d21f8),this['_bodyCollection']=_0x4378cb,this['locale']=_0x1a9843,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x3a2edc(),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:_0x2fb0d9,renderingStrategy:_0x4184e2,abortSignal:_0x5e308d}){'streaming'===_0x4184e2?await this['streamIntoElement'](_0x2fb0d9,this['replyContainer']['element'],_0x5e308d):this['replyContainer']['element']['innerHTML']=_0x4a5d1b(_0x2fb0d9);}updateSources(_0x4b31e6){const _0x58507c=new kr(this['locale'],this['_bodyCollection']);_0x58507c['children']['addMany'](_0x4b31e6['map'](_0x321970=>new yr(this['locale'],_0x321970,_0x58507c['balloonPanelView']))),_0x58507c['isVisible']=!0x0,this['children']['add'](_0x58507c);}},Dr=class extends _0x1e0c92{constructor(_0x4d867b=void 0x0){super();const _0x4b05a1=_0x4d867b?'ck-ai-spinner_'+_0x4d867b:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x4b05a1]}});}};const Hr={'file':_0x31280d,'image':_0x39a2ad,'document':_0x3495c4,'web-resource':_0x2bc60f,'text':_0x31280d,'selection':tt,'mcp-tool-context':_0x3495c4,'context':_0x3495c4},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(_0x4242f6,_0xa2ad40,_0x2590f8,_0x82059,_0x2cbbc6=!0x1){super(_0x4242f6),this['_isAnimationOnEnterEnabled']=_0x82059,this['_initializeProperties'](_0xa2ad40,_0x2590f8,_0x2cbbc6),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(_0x515fec,_0x1d2e07,_0x451dae){this['set']('label',_0x515fec['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x515fec['type']),this['set']('id',_0x515fec['uiId']),this['set']('readonly',_0x1d2e07),this['set']('isLoading',_0x451dae);}_setupTemplate(){const _0x5ea877=this['_createIconView'](),_0x3ea2e1=this['_createRemoveButton'](),_0x258a65=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x258a65),'children':this['_createTemplateChildren'](_0x5ea877,_0x3ea2e1,_0x258a65)});}_createTemplateAttributes(_0x3f1dab){return{'class':[Mr,_0x3f1dab['if']('itemType',Vr,_0x6ef68e=>'document'==_0x6ef68e),_0x3f1dab['if']('itemType',Ur,_0x3725ab=>'selection'==_0x3725ab)],'data-cke-tooltip-text':_0x3f1dab['to']('label',Yr),'data-cke-tooltip-position':Kr,'data-cke-tooltip-class':Fr};}_createTemplateChildren(_0x4ec3ba,_0x306836,_0x155722){const _0x4ff298=this['_createLabelElement'](_0x155722),_0x19d985=this['_createLoaderIcon']();return this['readonly']?[_0x4ec3ba,_0x4ff298]:[_0x4ec3ba,_0x19d985,_0x4ff298,_0x306836];}_createLabelElement(_0xff06b8){return{'tag':'span','attributes':{'class':Br},'children':[{'text':_0xff06b8['to']('label')}]};}_createRemoveButton(){const _0xfec004=new Mt(this['locale']);return _0xfec004['set']({'label':Es(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x1e5963}),this['_setupRemoveButtonEvent'](_0xfec004),_0xfec004;}_setupRemoveButtonEvent(_0x25c843){_0x25c843['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}_createIconView(){const _0x59e637=this['bindTemplate'],_0x143818=new $t();return _0x143818['content']=Hr[this['itemType']],_0x143818['extendTemplate']({'attributes':{'class':[Gr,_0x59e637['if']('isLoading','ck-hidden',_0x121283=>_0x121283)]}}),_0x143818;}_handleAnimationEndOnce(_0x172909,_0x349156){if(!_0x172909)return;const _0x5a22b1=()=>{_0x349156(),_0x172909['removeEventListener']('animationend',_0x5a22b1),_0x172909['removeEventListener']('webkitAnimationEnd',_0x5a22b1);};_0x172909['addEventListener']('animationend',_0x5a22b1),_0x172909['addEventListener']('webkitAnimationEnd',_0x5a22b1);}_createLoaderIcon(){const _0x13db03=new Dr('small');return _0x13db03['bind']('isVisible')['to'](this,'isLoading',_0x1d6b06=>_0x1d6b06),_0x13db03;}};function Yr(_0x436bda){if(!_0x436bda)return _0x436bda;if(_0x436bda['length']<=0x78)return _0x436bda;const _0x5d7ac9=_0x436bda['slice'](0x0,0x78),_0x20ca71=_0x5d7ac9['lastIndexOf']('\x20');return(_0x20ca71>0x0?_0x5d7ac9['slice'](0x0,_0x20ca71):_0x5d7ac9)+'…';}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(_0x2cac6c,_0x3a9c31,_0x2cbcb8,_0x438126,_0x202183){this['_locale']=_0x2cac6c,this['_visibleChips']=_0x3a9c31,this['_config']={...$r,..._0x2cbcb8,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x2cbcb8['cssClasses']}},this['_overflowChips']=new lt(),this['_bodyCollection']=_0x438126,this['_parentView']=_0x202183||null;}setContainerElement(_0x3688a7){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x3688a7,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 _0x585854=[...this['_visibleChips'],...this['_overflowChips']],_0x291c60=this['_createCalculationContainer'](),_0x36bdb0=this['_calculateOverflowInContainer'](_0x291c60,_0x585854),_0x5c560c=_0x291c60['_ancestorsToRestore'];_0x5c560c&&this['_restoreAncestorVisibility'](_0x5c560c),_0x291c60['remove'](),this['_applyOverflowResults'](_0x585854,_0x36bdb0);}_createShowMoreButton(){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0x5b168d({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}_createShowMoreButtonView(){const _0x15f8ff=new Mt(this['_locale']);_0x15f8ff['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x58dc38=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x58dc38['push'](this['_config']['cssClasses']['controlsButton']),_0x15f8ff['extendTemplate']({'attributes':{'class':_0x58dc38}}),_0x15f8ff;}_createShowMoreBalloonPanelView(){const _0x205dbc=new xt(this['_locale']);return _0x205dbc['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x205dbc),_0x205dbc;}_updateBalloonContent(){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x44bbaa=>{_0x44bbaa['disableAnimationOnEnter']();});const _0x3b92f9=new _0x3a2edc(this['_locale']);_0x3b92f9['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x3b92f9);}}_handleShowMoreButtonClick(){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}_updateShowMoreButtonVisibility(){const _0x248691=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x248691?'':'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(_0x10a312){const _0x166e21=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x2069f5=this['_containerElement']?.['classList'];if(_0x2069f5){const _0x2b1bc1=_0x2069f5[0x0]||'',_0x532355=_0x10a312['querySelector']('.'+_0x2b1bc1),_0x50b80c=_0x10a312['querySelector'](_0x166e21);return _0x532355||_0x50b80c||_0x10a312;}return _0x10a312['querySelector'](_0x166e21)||_0x10a312;}_calculateContainerWidth(){const _0x35dfd3=this['_parentView']?.['element']||this['_containerElement'];if(!_0x35dfd3)return qr;const _0x1d7900=window['getComputedStyle'](_0x35dfd3)['width'];if('auto'===_0x1d7900||'0px'===_0x1d7900||!_0x1d7900){const _0x3ec551=_0x35dfd3['parentElement'];if(_0x3ec551){const _0x4e676b=window['getComputedStyle'](_0x3ec551);return'auto'!==_0x4e676b['width']?_0x4e676b['width']:qr;}return qr;}return _0x1d7900;}_applyCalculationStyles(_0x4790ad,_0x20efa5){this['_config']['cssClasses']['calculationContainer']&&_0x4790ad['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x4790ad['style']['width']=_0x20efa5,_0x4790ad['style']['position']='absolute',_0x4790ad['style']['top']='-9999px',_0x4790ad['style']['left']='-9999px',_0x4790ad['style']['opacity']='0',_0x4790ad['style']['pointerEvents']='none',_0x4790ad['style']['zIndex']='-1',_0x4790ad['style']['visibility']='visible\x20!important',_0x4790ad['style']['display']='block\x20!important',_0x4790ad['style']['boxSizing']='border-box';}_restoreAncestorVisibility(_0x4ece1d){_0x4ece1d['forEach'](({element:_0x3ec728,originalDisplay:_0x1d505f,originalVisibility:_0x3d3b62})=>{_0x3ec728['style']['display']=_0x1d505f,_0x3ec728['style']['visibility']=_0x3d3b62;});}_makeAncestorsVisible(_0x29e545){const _0x391368=[];let _0x4447e4=_0x29e545;for(;_0x4447e4&&_0x4447e4!==document['body'];){const _0x4da627=window['getComputedStyle'](_0x4447e4);'none'!==_0x4da627['display']&&'hidden'!==_0x4da627['visibility']||(_0x391368['push']({'element':_0x4447e4,'originalDisplay':_0x4447e4['style']['display'],'originalVisibility':_0x4447e4['style']['visibility']}),_0x4447e4['style']['display']='block',_0x4447e4['style']['visibility']='visible'),_0x4447e4=_0x4447e4['parentElement'];}return _0x391368;}_createContainerElements(){let _0x47dd0e,_0x9271a4;return this['_parentView']?.['element']?(_0x47dd0e=this['_parentView']['element']['cloneNode'](!0x0),_0x9271a4=this['_findTargetContainer'](_0x47dd0e)):(_0x47dd0e=document['createElement']('div'),_0x9271a4=_0x47dd0e),{'calculationContainer':_0x47dd0e,'targetContainer':_0x9271a4};}_createCalculationContainer(){const {calculationContainer:_0x29b019,targetContainer:_0x3b8f81}=this['_createContainerElements'](),_0x1f9673=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x29b019,_0x1f9673);const _0x3fb37a=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0x3fb37a?_0x3fb37a['appendChild'](_0x29b019):document['body']['appendChild'](_0x29b019),_0x29b019['_targetContainer']=_0x3b8f81;const _0x2dfd28=this['_makeAncestorsVisible'](_0x3fb37a||null);return _0x29b019['offsetWidth'],_0x29b019['_ancestorsToRestore']=_0x2dfd28,_0x29b019;}_calculateOverflowInContainer(_0x4b617c,_0x566771){const _0x341502=_0x4b617c['_targetContainer']||_0x4b617c,_0xa4ae52=[],{rowCount:_0x7bc199}=this['_renderChipsAndCountRows'](_0x341502,_0x566771);if(_0x7bc199<=this['_config']['maxVisibleRows'])return _0xa4ae52;const _0x241b47=_0x566771['slice']();for(;_0x241b47['length']>0x0;){if(this['_testButtonFit'](_0x4b617c,_0x341502,_0x241b47)){const _0x4a34de=_0x566771['filter'](_0x423bd9=>!_0x241b47['includes'](_0x423bd9));_0xa4ae52['push'](..._0x4a34de);break;}if(!_0x241b47['pop']())break;}return _0xa4ae52;}_renderChipsAndCountRows(_0x2724a1,_0x349cae){_0x2724a1['innerHTML']='',_0x349cae['forEach'](_0x3a6a55=>{if(_0x3a6a55['element']){const _0xa9c0b6=_0x3a6a55['element']['cloneNode'](!0x0);_0x2724a1['appendChild'](_0xa9c0b6);}}),_0x2724a1['offsetWidth'];const _0x4ca336=_0x2724a1['children'],_0x45c0b1=[];return Array['from'](_0x4ca336)['forEach'](_0xd64151=>{const _0x2eed91=_0xd64151['getBoundingClientRect']()['top'];_0x45c0b1['some'](_0x2a442b=>Math['abs'](_0x2a442b-_0x2eed91)<this['_config']['rowDetectionTolerance'])||_0x45c0b1['push'](_0x2eed91);}),{'rowCount':_0x45c0b1['length']};}_createMockButton(){const _0x5356e1=document['createElement']('button');return _0x5356e1['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x5356e1['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x5356e1['textContent']='+\x201',_0x5356e1;}_testButtonFit(_0x3bee67,_0x259c76,_0x643a83){this['_renderChipsAndCountRows'](_0x259c76,_0x643a83);const _0x2fa2c2=this['_createMockButton']();_0x3bee67['appendChild'](_0x2fa2c2),_0x3bee67['offsetWidth'];const _0x2b9789=[..._0x259c76['children'],_0x2fa2c2],_0x34fff0=[];_0x2b9789['forEach'](_0x2c4c39=>{const _0x44efe8=_0x2c4c39['getBoundingClientRect']()['top'];_0x34fff0['some'](_0x1ea3a4=>Math['abs'](_0x1ea3a4-_0x44efe8)<this['_config']['rowDetectionTolerance'])||_0x34fff0['push'](_0x44efe8);});const _0x375341=_0x34fff0['length'];return _0x2fa2c2['remove'](),_0x375341<=this['_config']['maxVisibleRows'];}_distributeChips(_0x680e1e,_0x4df296){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x680e1e['forEach'](_0x16b581=>{_0x4df296['includes'](_0x16b581)?this['_overflowChips']['add'](_0x16b581):this['_visibleChips']['add'](_0x16b581);});}_updateOverflowUI(_0x4a2baa){if(_0x4a2baa>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x4a2baa>0x0&&this['_showMoreButtonView']){const _0x177e09=''+this['_config']['showMoreLabelPrefix']+(_0x4a2baa<0x63?_0x4a2baa:'99');this['_showMoreButtonView']['label']=_0x177e09;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}_applyOverflowResults(_0x52e0de,_0x4ca11e){this['_distributeChips'](_0x52e0de,_0x4ca11e),this['_updateOverflowUI'](_0x4ca11e['length']);}_setupVisibilityObserver(){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x4a2356=>{_0x4a2356[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 _0x2fb978=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x2fb978['width']||0x0===_0x2fb978['height'])return!0x1;const _0x2c7023=window['innerHeight']||document['documentElement']['clientHeight'],_0x1417d9=window['innerWidth']||document['documentElement']['clientWidth'];return _0x2fb978['bottom']>=-0xc8&&_0x2fb978['top']<=_0x2c7023+0xc8&&_0x2fb978['right']>=-0xc8&&_0x2fb978['left']<=_0x1417d9+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 _0x3a2edc{_contextChips=this['createCollection']();['_overflowManager'];_bodyCollection;constructor(_0x3842c8,_0x5c8c0e,_0x346a7f){super(_0x3842c8),this['_bodyCollection']=_0x346a7f,this['_createContextChips'](_0x5c8c0e);const _0x4e5b99={'cssClasses':{'showMoreButton':Zr+'\x20'+Dn,'showMoreBalloon':to,'overflowContainer':jr,'controlsButton':Jr}};this['_overflowManager']=new Qr(_0x3842c8,this['_contextChips'],_0x4e5b99,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 _0x22b5aa=this['element']['querySelector']('.'+zr);_0x22b5aa&&(this['_overflowManager']['setContainerElement'](_0x22b5aa),this['_overflowManager']['reorganizeChips']());}destroy(){super['destroy'](),this['_overflowManager']['destroy']();}_createContextChips(_0x4ccbc2){for(const _0x204732 of _0x4ccbc2){const _0x586817=new Wr(this['locale'],_0x204732,!0x0,!0x1);this['_contextChips']['add'](_0x586817);}}},io=class extends lr{_contextChipsView=null;['_locale'];_bodyCollection;_messageContentView;constructor(_0xccb6b4,_0x28a30,_0x296c94){super(_0x28a30),this['_locale']=_0xccb6b4,this['_bodyCollection']=_0x296c94,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'](_0x5f2e0c=>!_0x5f2e0c['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}_createMessageContentView(){this['_messageContentView']=new _0x3a2edc(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(_0x4f57a1,_0x3be002){super(_0x3be002);const {isWebSearchEnabled:_0x2fc4b6,isReasoningEnabled:_0x53dfeb}=_0x3be002['capabilities'],_0x31dcfa=[];let _0x229492='';_0x2fc4b6&&_0x53dfeb?(_0x229492=Es(_0x4f57a1,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x31dcfa['push'](no(ht)),_0x31dcfa['push'](no(_0xa0a8e6))):_0x2fc4b6?(_0x229492=Es(_0x4f57a1,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x31dcfa['push'](no(ht))):_0x53dfeb&&(_0x229492=Es(_0x4f57a1,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x31dcfa['push'](no(_0xa0a8e6))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x229492?'':'ck-hidden']}});const _0x3891f1=new _0x3a2edc();_0x3891f1['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x31dcfa,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x229492]}]}),this['children']['add'](_0x3891f1),this['capabilities']=_0x3be002['capabilities'];}};function no(_0x1a1bdc){const _0x380c41=new $t();return _0x380c41['content']=_0x1a1bdc,_0x380c41;}const ro=['wheel','touchstart','pointerdown','keydown'],oo=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var ao=class{element;animationFrameId;['isRunning'];abortController;['isUserPaused'];['scrollBehavior'];constructor(_0x4c4b8a){this['element']=_0x4c4b8a,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x378a7f of ro){const _0x587705='keydown'!==_0x378a7f;this['element']['addEventListener'](_0x378a7f,this['_onUserEvent']['bind'](this),{'passive':_0x587705,'signal':this['abortController']['signal']});}}start({smooth:_0x2ec682=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x2ec682?'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(_0x3f1c3c){if(this['isRunning']){if('keydown'===_0x3f1c3c['type']){const _0x41400a=_0x3f1c3c['key'];if(!oo['includes'](_0x41400a))return;}_0x3f1c3c instanceof WheelEvent?_0x3f1c3c['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}_isAtBottom(){const {scrollTop:_0x49c939,scrollHeight:_0x23f27a,clientHeight:_0x540d97}=this['element'];return _0x23f27a-_0x49c939-_0x540d97<=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(_0x5fa441){super(_0x5fa441),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 _0x3a2edc{['children'];['scrollManager'];_bodyCollection;constructor(_0x3bb928,_0x268c5f){super(_0x3bb928),this['_bodyCollection']=_0x268c5f,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(_0x2cfe37,_0x299bba){let _0x3dd239;return'ai-reply'===_0x2cfe37?_0x3dd239=new Pr(this['locale'],_0x299bba,this['_bodyCollection']):'ai-suggestion-reply'===_0x2cfe37?(_0x3dd239=new Lr(this['locale'],_0x299bba,this['_bodyCollection']),_0x3dd239['bind']('isTrackChangesOn')['to'](this)):_0x3dd239='user-message'===_0x2cfe37?new io(this['locale'],_0x299bba,this['_bodyCollection']):'interaction-header'===_0x2cfe37?new so(this['locale'],_0x299bba):'custom-element'===_0x2cfe37?new ho(_0x299bba):new Rr(_0x299bba),this['children']['add'](_0x3dd239),_0x3dd239;}async updateReplyItem({id:_0x34085b,parsedContent:_0x16e694,renderingStrategy:_0x4d868f,abortSignal:_0x317347}){const _0x4840cf=this['getItemById'](_0x34085b);if(!(_0x4840cf instanceof Pr))throw new ct('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x4840cf,'id':_0x34085b,'parsedContent':_0x16e694});await _0x4840cf['updateContent']({'parsedContent':_0x16e694,'renderingStrategy':_0x4d868f,'abortSignal':_0x317347});}async updateWebSources(_0x5cfdbc,_0xb694d){const _0x5d2f8e=this['getItemById'](_0x5cfdbc);if(_0x5d2f8e instanceof Lr)_0x5d2f8e['updateSources'](_0xb694d);else{if(!(_0x5d2f8e instanceof Pr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x5d2f8e,'id':_0x5cfdbc,'sources':_0xb694d});_0x5d2f8e['updateSources'](_0xb694d);}}async updateSuggestionItem({id:_0x17ca66,parts:_0xda480f,abortSignal:_0x555e1d,skipLoadingEffects:_0x3c03a1}){const _0x3c1e34=this['getItemById'](_0x17ca66);if(!(_0x3c1e34 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x3c1e34,'id':_0x17ca66,'parts':_0xda480f});await _0x3c1e34['updateContent']({'parts':_0xda480f,'abortSignal':_0x555e1d,'skipLoadingEffects':_0x3c03a1});}updateSuggestionPartState({id:_0x27d6f1,index:_0x59152c,state:_0x14729b,outdatedReason:_0x43a39e}){const _0x27e6d2=this['getItemById'](_0x27d6f1);if(!(_0x27e6d2 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x27d6f1});_0x27e6d2['updatePartState'](_0x59152c,_0x14729b,_0x43a39e);}updateSuggestionGating(_0x3bbc56,_0x5640cf){const _0x4b2d2f=this['getItemById'](_0x3bbc56);if(!(_0x4b2d2f instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x3bbc56});_0x4b2d2f['setGating'](_0x5640cf);}setSuggestionPartActive({id:_0x1257b8,index:_0x275d74,isActive:_0x4f71ae}){const _0x261abe=this['getItemById'](_0x1257b8);if(!(_0x261abe instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x1257b8});this['children']['filter'](_0x4abb7e=>_0x4abb7e instanceof Lr)['forEach'](_0x2d1f76=>{_0x2d1f76['setPartActive'](!0x1);}),_0x261abe['setPartActive'](_0x275d74,_0x4f71ae);}markItemAsDone(_0x159d4b){this['getItemById'](_0x159d4b)['markAsDone']();}getItemIds(){return this['children']['map'](_0xeafabe=>_0xeafabe['options']['id']);}removeItem(_0x45d5c3){this['children']['remove'](this['getItemById'](_0x45d5c3));}hasItem(_0x2fcaf4){return!!this['children']['find'](_0x56a46a=>_0x56a46a['options']['id']['includes'](_0x2fcaf4));}scrollToSuggestion(_0x532edb,_0x5ff87c){const _0x2bfade=this['getItemById'](_0x532edb);if(!(_0x2bfade instanceof Lr))return void St('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x532edb,'partIndex':_0x5ff87c});const _0xe50c1d=_0x2bfade['getPartView'](_0x5ff87c);_0xe50c1d?Rt(_0xe50c1d['element'],0x14,this['element']['parentElement'],!0x0,!0x0):St('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x532edb,'partIndex':_0x5ff87c});}_setupTemplate(){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}_createTemplateChildren(){const _0x59ee5d=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x59ee5d,this['_createFeedLoader']()];}_createSkeletonLoader(){const _0x101752=new wr(this['locale'],Cr['aiFeed']);return _0x101752['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x101752;}_createFeedItems(){const _0x3ee8c2=new _0x3a2edc(this['locale']);return _0x3ee8c2['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x3ee8c2;}_createFeedLoader(){const _0x39b607=new _0x3a2edc(this['locale']);return _0x39b607['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x4ab9a4=>!_0x4ab9a4)]},'children':this['_createLoaderChildren']()}),_0x39b607;}_createLoaderChildren(){const _0x332810=new Dr();return _0x332810['isVisible']=!0x0,[_0x332810,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}getItemById(_0x540b61){const _0x67613c=this['children']['find'](_0x4984da=>_0x4984da['options']['id']['includes'](_0x540b61));if(!_0x67613c)throw new ct('ai-chat-feed-view-item-not-found',this,{'id':_0x540b61});return _0x67613c;}setLoadingMessage(_0x267e05){this['set']('loadingMessage',_0x267e05);}toggleLoadingSkeleton(_0x229e1b){this['set']('isLoadingSkeletonVisible',_0x229e1b);}startAutoScroll(_0xa63358={}){this['scrollManager']['start'](_0xa63358);}stopAutoScroll(){this['scrollManager']['stop']();}},lo=class extends Jt{filter(){let _0x2fffbe=0x0;for(const _0x10ea61 of this['items'])_0x2fffbe+=_0x10ea61['items']['length'];return{'resultsCount':_0x2fffbe,'totalItemsCount':_0x2fffbe};}};function uo(_0x5c8560){const _0x57b260=[];let _0x34ddf2=!0x1;for(const _0x52beff of Array['from'](_0x5c8560['items'])){if('file'!==_0x52beff['kind'])continue;if(_0x52beff['webkitGetAsEntry']()?.['isDirectory']){_0x34ddf2=!0x0;continue;}const _0x325e94=_0x52beff['getAsFile']();_0x325e94&&_0x57b260['push'](_0x325e94);}return{'files':_0x57b260,'hasDirectory':_0x34ddf2};}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(_0x5527f7,_0x4b23fe){super(_0x5527f7,{'queryView':{'label':'','creator':_0x209c0f,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new lo(_0x5527f7),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x4b23fe,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',(_0x3ea50c,_0x524e8a)=>!_0x3ea50c&&!_0x524e8a),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x1b6b24,_0x30e3a4)=>{this['isUploadInProgress']||this['isEmpty']||_0x1b6b24['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x30e3a4());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x4b6a31=>this['_handlePaste'](_0x4b6a31)),this['element']['addEventListener']('drop',_0x4b5790=>this['_handleDrop'](_0x4b5790));}_handlePaste(_0x341757){const _0x55f6c4=_0x341757['clipboardData'];if(!_0x55f6c4)return;const {files:_0x98902a,hasDirectory:_0x487c97}=uo(_0x55f6c4),_0x3be37d={'files':_0x98902a,'plainText':_0x55f6c4['getData']('text/plain'),'hasDirectory':_0x487c97,'forceTextAttachment':!0x1,'preventDefault':()=>_0x341757['preventDefault']()};this['fire']('promptInputPaste',_0x3be37d);}['_handleDrop'](_0x4270f6){const _0x4dfcd8=_0x4270f6['dataTransfer'];if(!_0x4dfcd8)return;const _0x3f0cd9={'files':[],'plainText':_0x4dfcd8['getData']('text/uri-list')||_0x4dfcd8['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x4270f6['preventDefault']()};this['fire']('promptInputPaste',_0x3f0cd9);}destroy(){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}submit(){const _0x434282=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x434282)return this['queryView']['errorText']=Es(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x1e4c11=_0x483082(_0x434282);this['fire']('sendUserMessage',_0x1e4c11),this['queryView']['fieldView']['reset']();}setPlaceholderText(_0x5b751b){this['queryView']['fieldView']['set']('placeholder',_0x5b751b);}['focus'](_0x21ff69=!0x1){super['focus'](),_0x21ff69&&(this['element']['classList']['contains'](_o)||(this['element']['classList']['add'](_o),setTimeout(()=>{this['element']['classList']['remove'](_o);},0x320)));}_createSubmitButton(){const _0x5b8937=new Mt(this['locale']);return _0x5b8937['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}),_0x5b8937['on']('execute',()=>{this['submit']();}),_0x5b8937;}setIsUploadInProgress(_0x25de11){this['isUploadInProgress']=_0x25de11;}_setUpAddContextButtonPositioning(){const _0x47cb99=this['locale'],_0x4d9843=()=>{wt['window']['requestAnimationFrame'](()=>{if(ft(this['element'])){const _0x53fada=new It(this['queryView']['fieldView']['element']),_0x5b08c6=new It(this['_addContextButtonView']['element']),_0xc0c0bc=_0x53fada['width'],_0x2ce36f='rtl'===_0x47cb99['uiLanguageDirection']?'right':'left';_0x53fada['excludeScrollbarsAndBorders']();const _0x404254=_0xc0c0bc-_0x53fada['width']+0x1;this['_addContextButtonView']['element']['style'][_0x2ce36f]='calc('+(_0xc0c0bc-_0x5b08c6['width']-_0x404254)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x4d9843),this['on']('render',()=>{_0x4d9843(),this['_queryViewResizeObserver']=new pt(this['queryView']['fieldView']['element'],()=>{_0x4d9843();});});}},Ao=class extends _0x3a2edc{constructor(_0x362cde){super(_0x362cde),this['set']('isEnabled',!0x0);const _0x3c40a2=new $t();_0x3c40a2['content']=_0x31280d,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x3c40a2,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':Es(_0x362cde,'AI_CHAT_DROP_ZONE_HINT')}]}]});}attach(_0x279bf9){let _0x1b6715=0x0;const _0x2301b0=()=>{_0x279bf9['classList']['toggle']('ck-ai-chat-controls_drag-over',this['isEnabled']&&_0x1b6715>0x0);};this['on']('change:isEnabled',(_0x5c8457,_0x3aae32,_0xf8a2d2)=>{_0xf8a2d2&&_0x1b6715>0x0&&this['fire']('dragEnter'),_0x2301b0();}),_0x279bf9['addEventListener']('dragenter',_0x4a2e39=>{_0x4a2e39['dataTransfer']&&(_0x1b6715++,0x1===_0x1b6715&&this['isEnabled']&&this['fire']('dragEnter'),_0x2301b0());}),_0x279bf9['addEventListener']('dragover',_0x379965=>{_0x379965['dataTransfer']&&_0x379965['preventDefault']();}),_0x279bf9['addEventListener']('dragleave',()=>{--_0x1b6715<0x0&&(_0x1b6715=0x0),_0x2301b0();}),_0x279bf9['addEventListener']('drop',_0x526a29=>{_0x526a29['preventDefault'](),_0x1b6715=0x0,_0x2301b0(),this['isEnabled']&&this['_handleDrop'](_0x526a29);});}['_handleDrop'](_0x703dd2){const _0x266582=_0x703dd2['dataTransfer'];if(!_0x266582)return;const {files:_0x5acbe4,hasDirectory:_0x51d4cd}=uo(_0x266582),_0x36181c={'files':_0x5acbe4,'plainText':_0x266582['getData']('text/uri-list')||_0x266582['getData']('text/plain'),'hasDirectory':_0x51d4cd,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x36181c);}},Io=class extends _0x3a2edc{['dropdownView'];['nameView'];_items;['_config'];constructor(_0x129efc,_0x56dd69){super(_0x129efc),this['_config']=_0x56dd69,this['set']('modelDisplayMode','selector'),this['set']('activeModelId',null),this['set']('activeModelName',null),this['set']('isEnabled',!0x0),this['dropdownView']=this['_createDropdown'](),this['_items']=new lt(),_0x59425e(this['dropdownView'],this['_items']),this['nameView']=new po(_0x129efc,_0x56dd69['nameClass']),this['nameView']['bind']('text')['to'](this,'activeModelName',_0x327d56=>_0x327d56??''),this['nameView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x37a9a3=>'name'===_0x37a9a3),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-model-selector']},'children':[this['dropdownView'],this['nameView']]});}setModels(_0x49f5c5,_0x5a00af){var _0x15a1f5;this['set']('modelDisplayMode',(_0x15a1f5=_0x49f5c5['length'],_0x5a00af?0x1===_0x15a1f5?'name':'selector':'hidden')),this['_items']['clear'](),0x1===_0x49f5c5['length']&&this['set']('activeModelName',_0x49f5c5[0x0]['name']||_0x49f5c5[0x0]['id']);for(const _0x36a5e8 of _0x49f5c5){const _0x1bc632=new _0x1a683d({'label':_0x36a5e8['name'],'withText':!0x0,'role':'menuitemradio','id':_0x36a5e8['id'],'model':_0x36a5e8});_0x1bc632['bind']('isOn')['to'](this,'activeModelId',_0x5afdc0=>_0x5afdc0===_0x36a5e8['id']),this['_items']['add']({'type':'button','model':_0x1bc632,'labelView':new Eo(this['locale'],_0x36a5e8,{'nameClass':this['_config']['itemClasses']['name'],'descriptionClass':this['_config']['itemClasses']['description'],'capabilitiesClass':this['_config']['itemClasses']['capabilities'],'extraContent':this['_config']['showCapabilities']?mo(this['locale'],_0x36a5e8):void 0x0})});}}setSelectedModel(_0x5db58e){this['set']('activeModelId',_0x5db58e?_0x5db58e['id']:null),this['set']('activeModelName',_0x5db58e?_0x5db58e['name']||_0x5db58e['id']:null);}_createDropdown(){const _0x3fbd2e=_0x295fea(this['locale']);return _0x3fbd2e['set']({'panelPosition':this['_config']['panelPosition'],'class':this['_config']['dropdownClass']}),_0x3fbd2e['buttonView']['set']({'withText':!0x0,'tooltipPosition':this['_config']['tooltipPosition'],'class':Dn}),_0x3fbd2e['buttonView']['bind']('label')['to'](this,'activeModelName',_0x5765a1=>_0x5765a1??this['_config']['defaultLabel']??''),_0x3fbd2e['buttonView']['bind']('tooltip')['to'](this,'activeModelName',this,'isEnabled',(_0x3f9cdf,_0x45e306)=>!_0x45e306&&this['_config']['disabledTooltip']?this['_config']['disabledTooltip']:_0x3f9cdf??this['_config']['defaultLabel']??''),_0x3fbd2e['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x4bad1e=>'selector'===_0x4bad1e),_0x3fbd2e['bind']('isEnabled')['to'](this,'isEnabled'),this['listenTo'](_0x3fbd2e,'execute',_0x2c154b=>{this['fire']('selectModel',_0x2c154b['source']['model']);}),_0x3fbd2e;}},po=class extends _0x3a2edc{constructor(_0x341a14,_0x519e9e){super(_0x341a14),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x3dd2dc=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck',_0x519e9e,_0x3dd2dc['if']('isVisible','ck-hidden',_0xfec3a1=>!_0xfec3a1)]},'children':[{'text':_0x3dd2dc['to']('text')}]});}},Eo=class extends Dt{constructor(_0x5f2425,_0xa7e3d2,_0x13643c){super();const _0x43e42a=this['bindTemplate'],_0x1a7f2e=[{'tag':'div','attributes':{'class':[_0x13643c['nameClass']]},'children':[{'tag':'span','children':[{'text':_0x43e42a['to']('text')}]}]},{'tag':'div','attributes':{'class':[_0x13643c['descriptionClass']]},'children':[{'tag':'span','children':[_0xa7e3d2['description']||'']}]}];_0x13643c['extraContent']?.['length']&&_0x13643c['capabilitiesClass']&&_0x1a7f2e['push']({'tag':'div','attributes':{'class':[_0x13643c['capabilitiesClass']]},'children':_0x13643c['extraContent']}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x43e42a['to']('style'),'id':_0x43e42a['to']('id')},'children':_0x1a7f2e});}};function mo(_0x555953,_0x134c43){return[...To(_0x555953,ht,'AI_CHAT_SEARCH_WEB',_0x134c43['capabilities']['webSearch']?.['enabled']??!0x1),...To(_0x555953,_0xa0a8e6,'AI_CHAT_REASONING',_0x134c43['capabilities']['reasoning']?.['enabled']??!0x1)];}function To(_0x35ae9e,_0x540344,_0x27e5f4,_0x125ede){const _0x445410=new $t();_0x445410['content']=_0x540344;const _0xa3d493=new _0x3a2edc(_0x35ae9e);_0xa3d493['setTemplate']({'tag':'span','children':[{'text':Es(_0x35ae9e,_0x27e5f4)+':\x20'}]});const _0x16362c=new _0x3a2edc(_0x35ae9e);return _0x16362c['setTemplate']({'tag':'span','children':[{'text':Es(_0x35ae9e,_0x125ede?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x445410,_0xa3d493,_0x16362c];}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 _0x3a2edc{_webSearchButton;_reasoningButton;_commandsButton;_modelSelector;constructor(_0x4efc60){super(_0x4efc60),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelSelectorEnabled',!0x0),this['_modelSelector']=function(_0x3cf8af){return new Io(_0x3cf8af,{'panelPosition':'ne','dropdownClass':[bo],'nameClass':'ck-ai-chat-controls__model-name','itemClasses':{'name':So,'description':Ro,'capabilities':Oo},'defaultLabel':Es(_0x3cf8af,'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'disabledTooltip':Es(_0x3cf8af,'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP'),'tooltipPosition':vo,'showCapabilities':!0x0});}(_0x4efc60),this['_modelSelector']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x240f60=>_0x240f60),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',_0x3f7bfd=>_0x3f7bfd),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x56946f=>Es(this['locale'],_0x56946f?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x3ea91a=>_0x3ea91a),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x2f1863=>Es(this['locale'],_0x2f1863?'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(_0x211f67){this['set']('webSearchActive',_0x211f67);}setReasoning(_0x503f10){this['set']('reasoningActive',_0x503f10);}setModelList(_0x1ef305,_0x32e6c0){this['_modelSelector']['setModels'](_0x1ef305,!_0x32e6c0);}setModel(_0x2c5870){if(!_0x2c5870)return;this['_modelSelector']['setSelectedModel'](_0x2c5870);const _0x453cd0=_0x2c5870['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x453cd0),this['_webSearchButton']['set']('isVisible',_0x453cd0);const _0x372e28=_0x2c5870['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x372e28),this['_reasoningButton']['set']('isVisible',_0x372e28);}enableModelSelector(){this['set']('modelSelectorEnabled',!0x0);}disableModelSelector(_0x531182){this['set']('modelSelectorEnabled',!0x1),_0x531182&&(this['_modelSelector']['modelDisplayMode']='hidden');}_createWebSearchButton(){const _0x441239=new Mt();return _0x441239['set']({'label':Es(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':ht,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltipPosition':vo}),_0x441239['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x441239;}_createReasoningButton(){const _0x1ddcc8=new Mt();return _0x1ddcc8['set']({'label':Es(this['locale'],'AI_CHAT_REASONING'),'icon':_0xa0a8e6,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltipPosition':vo}),_0x1ddcc8['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x1ddcc8;}_createCommandsButton(){const _0x18cc45=new Mt();return _0x18cc45['set']({'label':Es(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x442f7b,'withText':!0x0,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltip':Es(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':vo}),_0x18cc45['extendTemplate']({'attributes':{'class':[fo]}}),_0x18cc45['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x18cc45;}};const yo='ck-ai-chat-context-controls__url-form',No='ck-ai-chat-context-controls__url-input-section';var xo=class extends _0x3a2edc{['focusTracker'];keystrokes;['_focusables'];['focusCycler'];urlInputField;backButton;confirmButton;constructor(_0x44fd8e){super(_0x44fd8e),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'](_0xe3c3b9=>{this['focusTracker']['add'](_0xe3c3b9['element']),this['keystrokes']['listenTo'](_0xe3c3b9['element']);}),_0x45fbdb({'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(_0x42ae14){this['urlInputField']['errorText']=_0x42ae14,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}_createBackButton(){const _0x4ef0cd=new Mt(this['locale']);return _0x4ef0cd['set']({'icon':_0x212a4e,'tooltip':Es(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x35fb92,_0x39e3bf,_0x11394b)=>{_0x4ef0cd['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x11394b?'':'\x20ck-hidden')]});}),_0x4ef0cd;}_createUrlInputField(){const _0x304012=new Qt(this['locale'],_0x5230ce);return _0x304012['set']({'label':Es(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x304012['fieldView']['set']({'placeholder':Es(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x304012;}_createConfirmButton(){const _0x169898=new Mt(this['locale']);return _0x169898['set']({'icon':_0x4ae57d,'tooltip':Es(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x169898;}_setupTemplate(){const _0x669532=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'});_0x669532['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':yo,'tabindex':'-1'},'children':[_0x669532,{'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',_0x27f84c=>{_0x27f84c['stop'](),this['_handleSubmit']();});}_setupKeystrokes(){this['keystrokes']['set']('esc',(_0x4a84ab,_0x20462)=>{this['clear'](),this['fire']('cancel'),_0x20462();});}_handleSubmit(){const _0x6fe367=this['getValue']()['trim']();_0x6fe367?this['_isValidUrl'](_0x6fe367)?(this['clearError'](),this['fire']('submitUrl',_0x6fe367)):this['setError'](Es(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Es(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}_updateConfirmButtonState(){const _0x50045c=this['getValue']()['trim'](),_0x47f73e=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x50045c['length']>0x0&&!_0x47f73e;}['_isValidUrl'](_0x131d38){try{return!!new URL(_0x131d38);}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(_0x4b06fd,_0x32a509){super(_0x4b06fd),this['resource']=_0x32a509,this['set']('isInContext',!!_0x32a509['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}getResourceIcon(_0x51b383){if(_0x51b383['isInContext'])return _0x4ae57d;switch(_0x51b383['type']){case'document':return _0x3495c4;case'web-resource':return _0x2bc60f;case'file':case'text':return _0x31280d;default:return _0xa2ab13;}}highlightText(_0x272336){if(!_0x272336||''===_0x272336['trim']())return void this['_titleView']['highlightText'](null);const _0x5642fe=new RegExp(_0x5c6661(_0x272336),'gi');this['_titleView']['highlightText'](_0x5642fe);}updateResourceState(_0x17d3fc){this['resource']['isInContext']=_0x17d3fc,this['isInContext']=_0x17d3fc,this['_updateIcon']();}_createTitleView(){const _0x5bb6af=new Yt();return _0x5bb6af['text']=this['resource']['label'],_0x5bb6af['extendTemplate']({'tag':'span','attributes':{'class':[Do]}}),_0x5bb6af;}_createIconView(){const _0x4be04c=new $t();return _0x4be04c['content']=this['getResourceIcon'](this['resource']),_0x4be04c;}_setupTemplate(){const _0x568a40=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[Lo,_0x568a40['if']('isVisible','ck-hidden',_0x21f5e6=>!_0x21f5e6),_0x568a40['if']('isInContext',Po)]},'children':[{'tag':'div','attributes':{'class':[Ho]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x568a40['to']('execute')}});}_updateIcon(){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const Uo='ck-ai-chat-resources__list';var Vo=class extends Jt{['_source'];constructor(_0x248b76,_0x4cf33f){super(_0x248b76),this['_source']=_0x4cf33f,this['extendTemplate']({'attributes':{'class':[Uo]}});}setResources(_0x27ec0c,_0x1c3879){this['items']['clear']();let _0x3890c9=_0x27ec0c;if(this['_source']['useDefaultFiltering']&&_0x1c3879&&''!==_0x1c3879['trim']()){const _0x2e744b=new RegExp(_0x1c3879['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x3890c9=_0x27ec0c['filter'](_0x5c5ebb=>_0x2e744b['test'](_0x5c5ebb['label']));}for(const _0xd8a644 of _0x3890c9){const _0x7e1e5a=new Mo(this['locale'],_0xd8a644);_0x7e1e5a['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0xd8a644);}),this['items']['add'](_0x7e1e5a);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x1c3879);}highlightText(_0x12b125){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x4c9ae7=>{_0x4c9ae7['highlightText'](_0x12b125);});}updateResourceState(_0x1d8592,_0xbb6184){for(const _0x3038b of this['items']){const _0xe8e634=_0x3038b;_0xe8e634['resource']['id']===_0x1d8592&&_0xe8e634['updateResourceState'](_0xbb6184);}}_handleResourceSelection(_0x1e746a,_0x3d638a){this['fire']('addResourceToContext',{'source':_0x1e746a,'resource':_0x3d638a});}},Bo=class extends Qt{['iconView'];resetButtonView;['_viewConfig'];constructor(_0x4de358){const t=_0x4de358['t'],_0x49adf9={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x5230ce,'label':Es(_0x4de358,'AI_CHAT_SEARCH_RESOURCES')};super(_0x4de358,_0x49adf9['creator']),this['label']=_0x49adf9['label'],this['_viewConfig']=_0x49adf9,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x4de358,t),this['_setupEventListeners']();}reset(){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x3da074){this['fire']('search',_0x3da074);}getQuery(){return this['fieldView']['element']?.['value']||'';}_setupSearchIcon(){this['iconView']=new $t(),this['iconView']['content']=_0x28df85,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}_setupResetButton(_0x11f3c3,t){this['resetButtonView']=new Mt(_0x11f3c3),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x1e5963,'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',_0x446685=>!_0x446685),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 _0x3a2edc{['_searchView'];_searchSection;_searchInputVisibleFrom;_resourcesListView;_skeletonLoader;['_source'];['children'];_latestLoadResourcesUid=null;constructor(_0x3a0fac,_0x24fd33){super(_0x3a0fac),this['_source']=_0x24fd33['source'],this['_searchInputVisibleFrom']=_0x24fd33['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 _0x16cf3f([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 _0x336c8e=new _0x3a2edc(this['locale']);return _0x336c8e['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x55e185,_0x2f45b7)=>{this['loadResources'](_0x2f45b7),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x2f45b7);}),_0x336c8e;}_createResourcesListView(){const _0x48c9da=new Vo(this['locale'],this['_source']);return _0x48c9da['delegate']('addResourceToContext')['to'](this),_0x48c9da['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x48c9da;}_createSkeletonView(){const _0x3938df=new wr(this['locale'],Cr['aiChatResources']);return _0x3938df['bind']('isVisible')['to'](this,'isLoading'),_0x3938df;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x467cc9){const _0x5831d4=kt();this['_latestLoadResourcesUid']=_0x5831d4,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x467cc9,'uid':_0x5831d4}),this['isLoading']=!0x0;}setResources(_0x2f8338,_0x4f954f){if(_0x4f954f&&_0x4f954f!==this['_latestLoadResourcesUid'])return;const _0x35647c=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x2f8338,_0x35647c),_0x2f8338['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}updateResourceState(_0x2c9388,_0x1c6f17){this['_resourcesListView']['updateResourceState'](_0x2c9388,_0x1c6f17);}};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(_0x11b732,_0x58d1a2,_0x475697){this['_locale']=_0x11b732,this['_bodyCollection']=_0x58d1a2,this['_config']=_0x475697;}['showSourceResourcesBalloon']({source:_0x2a9485,withBackButton:_0x2026f9}){let _0x390ad4=this['_sourceResourceBalloons']['get'](_0x2a9485['id']);_0x390ad4||(_0x390ad4=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x2a9485['id'],_0x390ad4),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x390ad4)),this['_addSourceResourceContent']({'balloonPanel':_0x390ad4,'source':_0x2a9485,'withBackButton':_0x2026f9}),_0x390ad4['show']();const _0xc5c0b9=this['_config']['getTargetElement']();_0xc5c0b9&&_0x390ad4['pin']({'target':_0xc5c0b9,'limiter':this['_config']['getLimiterElement']()});}populateSourceResourceBalloon(_0x596dfc,_0x11ec25,_0x4a5dac){const _0x173925=this['_sourceResourceBalloons']['get'](_0x596dfc);if(!_0x173925)return;const _0x587c85=this['_getResourcesViewFromBalloon'](_0x173925);_0x587c85&&(_0x587c85['setResources'](_0x11ec25,_0x4a5dac),_0x587c85['once']('change:isLoading',()=>{_0x173925['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x5a5455){const _0x1755d8=this['_sourceResourceBalloons']['get'](_0x5a5455);_0x1755d8&&requestAnimationFrame(()=>{_0x1755d8['hide'](),this['_sourceResourceBalloons']['delete'](_0x5a5455),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x24a278 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x24a278);}['isAnyResourceBalloonVisible'](){for(const _0x386fcc of this['_sourceResourceBalloons']['values']())if(_0x386fcc['isVisible'])return!0x0;return!0x1;}updateResourceState(_0x2ddc48,_0x30d05c,_0x311b78){const _0x348495=this['_sourceResourceBalloons']['get'](_0x2ddc48);if(!_0x348495||!_0x348495['isVisible'])return;const _0x151f6b=this['_config']['getTargetElement']();if(!_0x151f6b)return;_0x348495['pin']({'target':_0x151f6b,'limiter':this['_config']['getLimiterElement']()});const _0x2efc6f=this['_getResourcesViewFromBalloon'](_0x348495);_0x2efc6f&&_0x2efc6f['updateResourceState'](_0x30d05c,_0x311b78);}destroy(){for(const _0x35d997 of this['_sourceResourceBalloons']['values']())_0x35d997['destroy']();this['_sourceResourceBalloons']['clear']();}_createSourceResourceBalloonPanel(){const _0x41b1ca=new xt(this['_locale']);return _0x41b1ca['extendTemplate']({'attributes':{'class':Fo}}),this['_bodyCollection']['add'](_0x41b1ca),_0x41b1ca;}_addSourceResourceContent({balloonPanel:_0x2880da,source:_0x2742bd,withBackButton:_0x28fdf1}){_0x2880da['content']['clear']();const _0x1bc556=this['_createBalloonHeader']({'balloonPanel':_0x2880da,'source':_0x2742bd,'withBackButton':_0x28fdf1});_0x2880da['content']['add'](_0x1bc556);const _0x196324=this['_createBalloonResourcesView'](_0x2742bd);_0x2880da['content']['add'](_0x196324);}_createBalloonHeader({balloonPanel:_0x3a7867,source:_0x236b4b,withBackButton:_0x4c9dc5}){const _0x490954=new Kt(this['_locale'],{'label':_0x236b4b['label'],'class':Wo});return _0x4c9dc5&&_0x490954['children']['add'](this['_createBackButton'](_0x3a7867),0x0),_0x490954;}_createBackButton(_0x4eeb7e){const _0x31bf33=new Mt(this['_locale']);return _0x31bf33['set']({'icon':_0x212a4e,'tooltip':Es(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':Ko}),_0x31bf33['on']('execute',()=>{_0x4eeb7e['hide'](),this['_config']['onBackToContext']();}),_0x31bf33;}_createBalloonResourcesView(_0x1d5c3f){const _0xce7f40=new Go(this['_locale'],{'source':_0x1d5c3f,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0xce7f40['on']('loadSourceResources',(_0x35594e,_0x1fadff)=>{this['_config']['onLoadSourceResources'](_0x1fadff);}),_0xce7f40['on']('addResourceToContext',(_0x660367,_0x3bd54e)=>{this['_config']['onResourceSelected'](_0x3bd54e['source'],_0x3bd54e['resource']),this['closeSourceResourceBalloon'](_0x1d5c3f['id']);}),_0xce7f40;}_getResourcesViewFromBalloon(_0x50f894){const _0x581ef4=_0x50f894['content']['get'](0x1);return _0x581ef4 instanceof Go?_0x581ef4:null;}_setupSingleResourceBalloonClickOutsideHandler(_0x4e2b55){_0x5b168d({'emitter':_0x4e2b55,'contextElements':[_0x4e2b55['element']],'callback':()=>{_0x4e2b55['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x4e2b55['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 _0x3a2edc{addContextButtonView;_currentContextsChips=this['createCollection']();_conversationContextsChips=this['createCollection']();['_overflowManager'];_addContextBalloonPanelView;['_urlBalloonPanelView'];_urlInputView;['_resourcesBalloonView'];_addContextBalloonConfig;_hasExactlyOneSource=!0x1;bodyCollection;constructor(_0xd0dba5,_0x1ad458){super(_0xd0dba5),this['bodyCollection']=_0x1ad458['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0xd0dba5),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0xd0dba5),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0xd0dba5),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0xd0dba5,_0x1ad458);const _0x2edd50={'cssClasses':{'showMoreButton':ia+'\x20'+Dn,'showMoreBalloon':sa,'overflowContainer':ea,'controlsButton':ta}};this['_overflowManager']=new Qr(_0xd0dba5,this['_currentContextsChips'],_0x2edd50,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(_0x4fb333,_0x2bbc66){const _0x4a6aa9=this['_createContextButton'](_0x4fb333,'current',!0x0,_0x2bbc66);this['_addContextToCollection'](_0x4a6aa9,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}removeContextItem(_0x4f7e0e){this['_removeContextFromCollection'](_0x4f7e0e,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x4f7e0e,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}setContextItemLoading(_0x517be9,_0x1fb635){let _0x2ef4e1=this['_currentContextsChips']['find'](_0x584f3a=>_0x584f3a['id']===_0x517be9);_0x2ef4e1||(_0x2ef4e1=this['_overflowManager']['overflowChips']['find'](_0x5d41f9=>_0x5d41f9['id']===_0x517be9)),_0x2ef4e1&&(_0x2ef4e1['isLoading']=_0x1fb635);}setConversationContext(_0x4677de){this['_conversationContextsChips']['clear']();for(const _0x18373d of _0x4677de){const _0x5924bb=this['_createContextButton'](_0x18373d,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x5924bb,this['_conversationContextsChips']);}}clearCurrentContextItems(){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}clearConversationContextItems(){this['_conversationContextsChips']['clear']();}updateResourceState(_0x26c352,_0x3e1f9a,_0x4f7461){this['_resourcesBalloonView']['updateResourceState'](_0x26c352,_0x3e1f9a,_0x4f7461);}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:_0x36138c,withBackButton:_0xb943f3}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x36138c,'withBackButton':_0xb943f3}),this['addContextButtonView']['isOn']=!0x0;}populateSourceResourceBalloon(_0x51b251,_0x4737d0,_0x4ed629,_0x314315){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x51b251,_0x4ed629,_0x314315);}['closeSourceResourceBalloon'](_0xd00310){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0xd00310),this['addContextButtonView']['isOn']=!0x1;}setAddContextOptions(_0x46e814){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x46e814),this['_setAddContextButtonEnabled'](_0x46e814);}_setAddContextButtonEnabled(_0xf0307){const _0x153a73=!_0xf0307['document']['isHidden']&&_0xf0307['document']['enabled'],_0x185cd8=_0xf0307['urls']['enabled'],_0x3f12ca=_0xf0307['files']['enabled'],_0x4c3824=_0xf0307['sources']['length']>0x0,_0x4c0c46=_0xf0307['customItems']&&_0xf0307['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x153a73||_0x185cd8||_0x3f12ca||_0x4c3824||_0x4c0c46;}_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(_0x362ae2){const _0x57ba19=new Mt(_0x362ae2);return _0x57ba19['set']({'label':Es(_0x362ae2,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':ta+'\x20'+zo+'\x20'+Dn,'icon':_0xf5684a,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x57ba19;}_createAddContextBalloonPanelView(_0xdf7c6c){return this['_createBaseBalloonPanel'](_0xdf7c6c,Xo);}_createUrlBalloonPanelView(_0x224ce1){const _0x508ff1=this['_createBaseBalloonPanel'](_0x224ce1,jo);return this['_addUrlContent'](_0x508ff1,_0x224ce1),_0x508ff1;}_createResourcesBalloonView(_0x1152a0,_0x33446b){const _0x23c373={'searchInputVisibleFrom':_0x33446b['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra});},'onResourceSelected':(_0x31441c,_0x3b7892)=>{this['fire']('addResourceToContext',{'source':_0x31441c,'resource':_0x3b7892});},'onLoadSourceResources':_0x18a845=>{this['fire']('loadSourceResources',_0x18a845);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new Yo(_0x1152a0,_0x33446b['bodyCollection'],_0x23c373);}_getLimiterElement(){return this['element']?.['closest']('.'+na)||document['body'];}_createBaseBalloonPanel(_0x285168,_0x5d3697){const _0x5e4caa=new xt(_0x285168);return _0x5e4caa['extendTemplate']({'attributes':{'class':_0x5d3697}}),this['bodyCollection']['add'](_0x5e4caa),_0x5e4caa;}_setBalloonPanelContent(_0x1e8ec7,_0x5197ff,_0x202e85){if(_0x1e8ec7['content']['clear'](),!_0x202e85['document']['isHidden']&&_0x202e85['document']['enabled']){const _0x550bde=this['_createBalloonButton'](_0x5197ff,{'label':Es(_0x5197ff,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x3495c4});_0x550bde['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x1e8ec7['content']['add'](_0x550bde);}if(_0x202e85['urls']['enabled']){const _0x51ef88=this['_createBalloonButton'](_0x5197ff,{'label':Es(_0x5197ff,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x2bc60f});_0x51ef88['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra}),this['_urlInputView']['focus']();}),_0x1e8ec7['content']['add'](_0x51ef88);}if(_0x202e85['files']['enabled']){const _0x332ea0=new Gt(_0x5197ff);_0x332ea0['set']({'label':Es(_0x5197ff,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x281725,'withText':!0x0,'tooltip':!0x0,'class':Jo,'allowMultipleFiles':!0x0}),_0x332ea0['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x332ea0['on']('done',(_0x26097f,_0x59b67e)=>{this['fire']('addFileToContext',_0x59b67e);}),_0x332ea0['tooltip']=!0x0,_0x1e8ec7['content']['add'](_0x332ea0);}for(const _0x4e1e78 of _0x202e85['sources']){const _0x4b50ee=this['_createBalloonButton'](_0x5197ff,{'label':_0x4e1e78['label'],'icon':_0x4e1e78['icon']||_0xa2ab13,'type':'source'});_0x1e8ec7['content']['add'](_0x4b50ee),_0x4b50ee['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x4e1e78,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x1af59c of _0x202e85['customItems']||[]){const _0x459779=this['_createBalloonButton'](_0x5197ff,{'label':_0x1af59c['label'],'icon':_0x1af59c['icon']||_0xa2ab13,'type':'customItem'});_0x1e8ec7['content']['add'](_0x459779),_0x459779['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x1af59c);});}this['_hasExactlyOneSource']=0x1===_0x1e8ec7['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}_addUrlContent(_0xf0f023,_0x487902){this['_urlInputView']=new xo(_0x487902),this['_urlInputView']['on']('submitUrl',(_0x12658c,_0x130e5b)=>{this['_handleUrlSubmit'](_0x130e5b);}),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});}),_0xf0f023['content']['add'](this['_urlInputView']);}_createBalloonButton(_0x26225a,_0x1259e7){const _0x15dc1d='source'===_0x1259e7['type']?new aa(_0x26225a):new Mt(_0x26225a);return _0x15dc1d['set']({'label':_0x1259e7['label'],'icon':_0x1259e7['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':Jo}),_0x15dc1d;}_setupAllBalloonClickOutsideHandlers(){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}_setupUrlBalloonClickOutsideHandler(){_0x5b168d({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}_toggleAddContextBalloon(_0x33abb8){const _0x2b2f7e=this['_addContextBalloonConfig'];_0x2b2f7e['buttonView']['isOn']=_0x33abb8,_0x33abb8?_0x2b2f7e['balloonView']['show']():_0x2b2f7e['balloonView']['hide']();}_setupAddContextBalloonClickOutsideHandler(){const {balloonView:_0x57a76f,buttonView:_0x412c1c,hideMethod:_0x17c875}=this['_addContextBalloonConfig'];_0x5b168d({'emitter':_0x57a76f,'contextElements':[_0x57a76f['element'],_0x412c1c['element']],'callback':()=>{_0x17c875();},'activator':()=>_0x412c1c['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}_createContextButton(_0x247cd6,_0x5a4d31,_0x437874=!0x1,_0x1a78f6=!0x1){const _0x213489='conversation'===_0x5a4d31||!0x0===_0x247cd6['isReadOnly'],_0x477787=new Wr(this['locale'],_0x247cd6,_0x213489,_0x437874,_0x1a78f6);return _0x213489||_0x477787['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x477787['id']);}),_0x477787;}_addContextToCollection(_0x28893b,_0x7cc52b){_0x7cc52b['add'](_0x28893b,0x0);}_removeContextFromCollection(_0x2e50fe,_0xbfad7c){const _0xa5f87a=_0xbfad7c['find'](_0x1cfd7b=>_0x1cfd7b['id']===_0x2e50fe);_0xa5f87a&&_0xbfad7c['remove'](_0xa5f87a);}_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(_0x2f1c4f){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x2f1c4f);}},aa=class extends Mt{['arrowView'];constructor(_0x4c8f70){super(_0x4c8f70),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 _0x3d5c6a=new $t();return _0x3d5c6a['content']=_0x3230ae,_0x3d5c6a['extendTemplate']({'attributes':{'class':Zo+'__arrow'}}),_0x3d5c6a;}},ha=class extends _0x3a2edc{_cancelButtonView;['_loaderView'];constructor(_0x3978fc){super(_0x3978fc),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 _0x4550bd=new Mt(this['locale']);return _0x4550bd['set']({'label':Es(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Pn+'\x20ck-ai-button-stop-generating','icon':st}),_0x4550bd['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x4550bd;}_createLoaderView(){const _0x5512db=new _0x3a2edc(this['locale']);return _0x5512db['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')}]}),_0x5512db;}},ca=class extends _0x3a2edc{_contextPanelView;_promptInputView;['_dropZoneView'];_promptCapabilitiesView;['_loaderView'];['_modelUnavailableMessageView'];_shouldRestorePromptInputFocus;['_filesEnabled'];constructor(_0x3e5335,_0x191340){super(_0x3e5335),this['_filesEnabled']=_0x191340['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x3e5335,{'bodyCollection':_0x191340['bodyCollection'],'searchInputVisibleFrom':_0x191340['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x3e5335),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x3e5335),this['_loaderView']=this['_createLoaderView'](_0x3e5335),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x3e5335),this['_dropZoneView']=new Ao(_0x3e5335),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',_0x447ba6=>!_0x447ba6),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 _0x15a93e=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x15a93e['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x15a93e['if']('isLoading','ck-hidden',_0x14f9a5=>_0x14f9a5||!this['isModelAvailable']),_0x15a93e['if']('isModelAvailable','ck-hidden',_0x5d8eaf=>!_0x5d8eaf||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x15a93e['if']('isLoading','ck-hidden',_0x213529=>!_0x213529)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x15a93e['if']('isModelAvailable','ck-hidden',_0x17c5e7=>_0x17c5e7)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0x5b168d({'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(_0x5c7b4,_0x1cbd5f){return new oa(_0x5c7b4,_0x1cbd5f);}_createPromptInputView(_0x43493c){return new go(_0x43493c,this['_contextPanelView']['addContextButtonView']);}_createPromptCapabilitiesView(_0x42f7d7){return new ko(_0x42f7d7);}_createLoaderView(_0x4c6b1f){return new ha(_0x4c6b1f);}_createModelUnavailableMessageView(_0x319637){const _0x3c713e=new la(_0x319637);return _0x3c713e['delegate']('startConversation')['to'](this),_0x3c713e;}_handlePromptInputFocus(_0x59491f,_0x2a3bd6,_0x1df433){_0x1df433?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}addContextItem(_0x3e602e,_0x13c3e0){this['_contextPanelView']['addContextItem'](_0x3e602e,_0x13c3e0);}removeContextItem(_0x426ebe){this['_contextPanelView']['removeContextItem'](_0x426ebe);}setContextItemLoading(_0x3f19f0,_0xc765a7){this['_contextPanelView']['setContextItemLoading'](_0x3f19f0,_0xc765a7);}setIsUploadInProgress(_0x54f4c6){this['_promptInputView']['setIsUploadInProgress'](_0x54f4c6);}setConversationContext(_0x3aeea7){this['_contextPanelView']['setConversationContext'](_0x3aeea7);}clearPendingContextUI(){this['_contextPanelView']['clearCurrentContextItems']();}clearConversationContextUI(){this['_contextPanelView']['clearConversationContextItems']();}updateResourceState(_0x2a6b01,_0x52cbc4,_0x14dd39){this['_contextPanelView']['updateResourceState'](_0x2a6b01,_0x52cbc4,_0x14dd39);}setWebSearch(_0x589dda){this['_promptCapabilitiesView']['setWebSearch'](_0x589dda);}setReasoning(_0x576eda){this['_promptCapabilitiesView']['setReasoning'](_0x576eda);}resetMessageInput(){this['_promptInputView']['reset']();}setAddContextOptions(_0x43d00d){this['_contextPanelView']['setAddContextOptions'](_0x43d00d);}setInputPlaceholder(_0x45571b){this['_promptInputView']['setPlaceholderText'](_0x45571b);}setModelList(_0x2a9816,_0x392e6b){this['_promptCapabilitiesView']['setModelList'](_0x2a9816,_0x392e6b);}setModel(_0xd44e3b){_0xd44e3b?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0xd44e3b)):this['isModelAvailable']=!0x1;}enableModelSelector(){this['_promptCapabilitiesView']['enableModelSelector']();}disableModelSelector(_0x223dfb){this['_promptCapabilitiesView']['disableModelSelector'](_0x223dfb);}populateSourceResourceBalloon(_0x52d9dc,_0xce35cf,_0x326034,_0x3bac7e){this['_contextPanelView']['populateSourceResourceBalloon'](_0x52d9dc,_0xce35cf,_0x326034,_0x3bac7e);}['closeSourceResourceBalloon'](_0x531f96){this['_contextPanelView']['closeSourceResourceBalloon'](_0x531f96);}focusPromptInput(_0x5e46f6=!0x1){this['_promptInputView']['focus'](_0x5e46f6);}setPromptInputValue(_0x495a5e){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x495a5e;}},la=class extends _0x3a2edc{constructor(_0x111831){super(_0x111831);const _0x3c67c5=new Mt(_0x111831);_0x3c67c5['set']({'label':Es(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x3c67c5['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'},_0x3c67c5]}]});}},ua=class extends Kt{resizeButton;constructor(_0x83c4d9,_0x4c3be3){super(_0x83c4d9,{'label':_0x4c3be3['label'],'class':'ck-ai-header\x20'+_0x4c3be3['class'],'icon':_0x4c3be3['icon']}),this['set']('isMaximized',!0x1),_0x4c3be3['content']&&this['children']['add'](_0x4c3be3['content']),_0x4c3be3['showResizeButton']&&(this['resizeButton']=Hn(_0x83c4d9,this),this['children']['add'](this['resizeButton']));}},da=class extends _0x3a2edc{constructor(_0x225357){super(_0x225357),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Es(_0x225357,'AI_DISCLAIMER_TEXT')}]}]});}};function _a(_0x161d93,_0x4f2260){const _0xa30985=new Mt(_0x161d93);return _0xa30985['set']({'label':Es(_0x161d93,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x38a2ad,'class':'ck-ai-chat__start-conversation\x20'+Pn}),_0xa30985['on']('execute',()=>{_0x4f2260['fire']('startConversation');}),_0xa30985;}var ga=class extends _0x3a2edc{chatHeader;chatFeed;chatControls;chatDisclaimer;_bodyCollection;constructor(_0x3a74ea,_0x4b05e8){super(_0x3a74ea),this['_bodyCollection']=Mn(_0x3a74ea);const _0x195930=_a(_0x3a74ea,this);this['chatHeader']=new ua(_0x3a74ea,{'label':Es(_0x3a74ea,'AI_CHAT_HEADING'),'icon':_0x4f3da7,'class':'ck-ai-header_chat','content':_0x195930,'showResizeButton':_0x4b05e8['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new co(_0x3a74ea,this['_bodyCollection']),this['chatFeed']['delegate'](...sr)['to'](this),this['chatControls']=new ca(_0x3a74ea,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x4b05e8['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x4b05e8['filesEnabled']}),this['chatControls']['delegate'](...sr)['to'](this),this['chatDisclaimer']=new da(_0x3a74ea),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x3a74ea['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}populateSourceResourceBalloon(_0x3d7752,_0x13dfdd,_0x860a22,_0x35f9cb){this['chatControls']['populateSourceResourceBalloon'](_0x3d7752,_0x13dfdd,_0x860a22,_0x35f9cb);}['closeSourceResourceBalloon'](_0x5697b4){this['chatControls']['closeSourceResourceBalloon'](_0x5697b4);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Aa=class extends _0x57f218{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(_0x48d68e){super(_0x48d68e);const _0x5d53b1=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':_0x5d53b1['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'](_0x5d53b1),this['_view']['delegate'](...sr)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x89f390,{showDiff:_0x3d043a})=>{this['showDiff']=_0x3d043a;}),this['disableControls'](),_0x5d53b1['view']['addTab']({'id':'chat','buttonLabel':Es(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x4f3da7,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x5d53b1['view'],'isMaximized',_0xcd5be1=>_0xcd5be1),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isChatStreaming',_0x361fe9=>_0x361fe9),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}destroy(){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}createConversation({availableModels:_0x53b0d4}){const _0xb00106=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'](_0x53b0d4,!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0xb00106}),this['fire']('conversationCreated');}async addFeedItemStaticMessage({id:_0x5ef15a,staticMessage:_0x84332d}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x5ef15a,'initialContent':'<p>'+_0x84332d+'</p>'});});}async addFeedItemUserMessage(_0x877073){const _0x4d0b0e=_0x877073['attributes']?.['displayedPrompt']||_0x877073['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x877073['contextItems']['values']()),'initialContent':'<p>'+_0x4d0b0e+'</p>','id':_0x877073['id']});});}async addFeedItemError({errorMessage:_0x1d77e3,id:_0x271446}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x1d77e3+'</p>','id':_0x271446});});}async addFeedItemAIReply(_0x1ba29f){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x1ba29f['interactionId']+':'+_0x1ba29f['id']}),this['clearLoadingMessage']();});}async addFeedItemAISuggestion(_0x3f9c94){const _0x39fb9a=bs(this['context']),_0x4f711b=_0x39fb9a['map'](_0x146a40=>_0x146a40['config']['get']('ai.availableReplyActions')||[...Or]);let _0x45d178=_0x4f711b['reduce']((_0x267f03,_0x52b208)=>_0x267f03['filter'](_0x5d15df=>_0x52b208['includes'](_0x5d15df)),_0x4f711b[0x0]||[...Or]);const _0x2de387=_0x39fb9a['every'](_0x19cfed=>_0x19cfed['plugins']['has']('TrackChanges')),_0x2b1b79=_0x39fb9a['map'](_0x273358=>_0x273358['commands']['get']('trackChanges'));return _0x2de387?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x2b1b79,'value',(..._0x2864e4)=>_0x2864e4['some'](_0x86a113=>_0x86a113))):_0x45d178=_0x45d178['filter'](_0x3dc3de=>'insertSuggestion'!=_0x3dc3de),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x3f9c94['interactionId']+':'+_0x3f9c94['id'],'areActionsDisabled':_0x3f9c94['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x45d178}),this['clearLoadingMessage']();});}async addFeedInteractionHeader(_0x5212e5,_0x15cf3b){return this['_promiseQueue']['enqueue'](async()=>{const _0x21ca53=this['_view']['chatFeed']['children']['last'];if(_0x21ca53 instanceof so)return this['_view']['chatFeed']['children']['remove'](_0x21ca53),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x5212e5['id'],'capabilities':{'isWebSearchEnabled':_0x21ca53['capabilities']['isWebSearchEnabled']||_0x15cf3b['isWebSearchEnabled'],'isReasoningEnabled':_0x21ca53['capabilities']['isReasoningEnabled']||_0x15cf3b['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x5212e5['id'],'capabilities':_0x15cf3b});});}async addFeedItemCustomElement(_0x539c54,_0x42c364){let _0xf2ef09;return await this['_promiseQueue']['enqueue'](async()=>{_0xf2ef09=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x539c54,'id':_0x42c364});}),_0xf2ef09;}removeFeedItem(_0x106b20){this['_view']['chatFeed']['removeItem'](_0x106b20);}hasFeedItem(_0x58bb12){return this['_view']['chatFeed']['hasItem'](_0x58bb12);}updateFeedInteractionHeader(_0x91475c){const _0x529936=this['_view']['chatFeed']['children']['find'](_0xed191e=>_0xed191e['options']['id']==_0x91475c['id']&&_0xed191e instanceof so);_0x529936&&_0x529936['set']('isVisible',_0x91475c['isVisible']);}async updateFeedItemAIReplyContent(_0x57b440){const _0x435df3=_0x57b440['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x3cda4f=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x57b440,'abortSignal':_0x3cda4f,'renderingStrategy':_0x435df3}),_0x57b440['isDone']&&this['markFeedItemAsDone'](_0x57b440['id']);});}updateFeedItemAIReplySources(_0x30359f,_0x59057d){this['_view']['chatFeed']['updateWebSources'](_0x30359f,_0x59057d);}async updateFeedItemAIReplySuggestionContent(_0x340936){return this['_promiseQueue']['enqueue'](async _0xdaf5ce=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x340936,'abortSignal':_0xdaf5ce}),_0x340936['isDone']&&this['markFeedItemAsDone'](_0x340936['id']);});}updateFeedItemAIReplySuggestionPartState(_0x5cefa4){this['_view']['chatFeed']['updateSuggestionPartState'](_0x5cefa4);}setSuggestionGating(_0x2df6fa,_0x165ec5){this['_view']['chatFeed']['updateSuggestionGating'](_0x2df6fa,_0x165ec5);}setFeedItemAIReplySuggestionPartActive(_0x3badb7){this['_view']['chatFeed']['setSuggestionPartActive'](_0x3badb7);}markFeedItemAsDone(_0x48699d){this['_view']['chatFeed']['markItemAsDone'](_0x48699d);}removeFeedInteraction(_0x305582){this['_view']['chatFeed']['getItemIds']()['filter'](_0x403ff6=>_0x403ff6['startsWith'](_0x305582))['forEach'](_0x1eb309=>this['_view']['chatFeed']['removeItem'](_0x1eb309));}startInteraction(){const _0x5b1671=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x5b1671),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['isChatStreaming']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}stopInteraction(_0x3c13d6){this['_promiseQueue']['abort'](),_0x3c13d6&&this['_view']['chatFeed']['getItemIds']()['filter'](_0x5437c7=>_0x5437c7['startsWith'](_0x3c13d6['id']))['forEach'](_0x1ca8a0=>this['markFeedItemAsDone'](_0x1ca8a0)),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(_0x1b4985,_0x28258d){this['_view']['chatControls']['addContextItem'](_0x1b4985,_0x28258d);}removeContextItem(_0x81f8aa){this['_view']['chatControls']['removeContextItem'](_0x81f8aa);}setContextItemLoading(_0x51b542,_0x1ddac1){this['_view']['chatControls']['setContextItemLoading'](_0x51b542,_0x1ddac1);}setIsUploadInProgress(_0xbb821f){this['_view']['chatControls']['setIsUploadInProgress'](_0xbb821f);}setConversationContext(_0x38bb17){this['_view']['chatControls']['setConversationContext'](_0x38bb17);}clearPendingContextUI(){this['_view']['chatControls']['clearPendingContextUI']();}clearConversationContextUI(){this['_view']['chatControls']['clearConversationContextUI']();}updateResourceState(_0x1093d8,_0x2ba026,_0x29bde1){this['_view']['chatControls']['updateResourceState'](_0x1093d8,_0x2ba026,_0x29bde1);}resetMessageInput(){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}setAddContextOptions(_0x4c9adc){this['_view']['chatControls']['setAddContextOptions'](_0x4c9adc);}updateCapabilities(_0x2af156){this['_view']['chatControls']['setWebSearch'](_0x2af156['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x2af156['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x2af156));}setSelectedModel(_0x3fdc7e,_0x2f2db5){this['_view']['chatControls']['setModel'](_0x3fdc7e),_0x2f2db5&&this['_view']['chatControls']['disableModelSelector'](!0x1);}setFeedItemRenderingStrategy(_0x35a2e2){this['feedItemRenderingStrategy']=_0x35a2e2;}toggleLoadingSkeleton(_0x6f4172){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x6f4172);}resetConversationTitle(){this['setConversationTitle'](Es(this['context']['locale'],'AI_CHAT_HEADING'));}emptyConversationTitle(){this['setConversationTitle']('');}setConversationTitle(_0x593a7a,_0x555014=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0x555014&&!Et()&&_0x593a7a['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x593a7a);this['_view']['chatHeader']['label']=_0x593a7a;}setLoadingMessage(_0x5d5b2d){this['_view']['chatFeed']['setLoadingMessage'](_0x5d5b2d);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}_animateConversationTitle(_0x2bc897){let _0x14f943=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x2bc897[_0x14f943],_0x14f943++,_0x14f943===_0x2bc897['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x280b85){return _0x280b85['isWebSearchEnabled']&&_0x280b85['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x280b85['isWebSearchEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x280b85['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}_getInputPlaceholder(_0x495e1b){return _0x495e1b?_0x495e1b['isWebSearchEnabled']&&_0x495e1b['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x495e1b['isWebSearchEnabled']?Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x495e1b['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(_0x48f049,_0x445c33,_0x2fa7da,_0x518ff3){this['_view']['populateSourceResourceBalloon'](_0x48f049,_0x445c33,_0x2fa7da,_0x518ff3);}['closeSourceResourceBalloon'](_0x1bc4f4){this['_view']['closeSourceResourceBalloon'](_0x1bc4f4);}setPromptInputValue(_0x2711dd){this['_view']['chatControls']['setPromptInputValue'](_0x2711dd);}focusPromptInput(_0x5bd521=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x5bd521);}scrollFeedToSuggestion(_0x10fde1,_0x4a5546){this['_view']['chatFeed']['scrollToSuggestion'](_0x10fde1,_0x4a5546);}startAutoScroll(_0x490644={}){this['_view']['chatFeed']['startAutoScroll'](_0x490644);}stopAutoScroll(){this['_view']['chatFeed']['stopAutoScroll']();}disableControls(){this['_view']['chatControls']['isDisabled']=!0x0;}enableControls(){this['_view']['chatControls']['isDisabled']=!0x1;}toggleConversationLoading(_0x4f2468){_0x4f2468?(this['isBusy']=_0x4f2468,this['disableControls']()):(this['enableControls'](),this['resetChatBusyStateToIdle']());}},Ia=class extends Jt{sections;constructor(_0x7c01d5,_0x68c149){super(_0x7c01d5),this['sections']=_0x68c149,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}filter(_0x2f7ad5){let _0x1269be=0x0,_0x4bf334=0x0;for(const _0x52cbe7 of this['sections']){const {resultsCount:_0x169094,totalItemsCount:_0x4cf50f}=_0x52cbe7['filter'](_0x2f7ad5);_0x1269be+=_0x169094,_0x4bf334+=_0x4cf50f;}return{'resultsCount':_0x1269be,'totalItemsCount':_0x4bf334};}},pa=class extends jt{title;itemsViews;_itemsListView;constructor(_0x2ffd4b,{title:_0x2a49ec,items:_0x1a1d37}){super(_0x2ffd4b);const _0x7c74e6=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x2a49ec,this['itemsViews']=_0x1a1d37;const _0x592b9c=new _0x3a2edc(_0x2ffd4b);_0x592b9c['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new Jt(_0x2ffd4b),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x7c74e6['if']('isVisible','ck-hidden',_0x1eaa49=>!_0x1eaa49)]},'children':[_0x592b9c,this['_itemsListView']]});}filter(_0x961238){const _0x4572fc=this['itemsViews']['length'];let _0x133a93=0x0;for(const _0x36044f of this['itemsViews'])_0x961238?(_0x36044f['isVisible']=!!_0x36044f['isMatching'](_0x961238),_0x36044f['highlightText'](_0x961238)):(_0x36044f['isVisible']=!0x0,_0x36044f['highlightText'](null)),_0x36044f['isVisible']&&_0x133a93++;return this['isVisible']=_0x133a93>0x0,{'resultsCount':_0x133a93,'totalItemsCount':_0x4572fc};}getItem(_0x3c524f){return this['itemsViews']['find'](_0x42be43=>_0x42be43['id']===_0x3c524f);}removeItem(_0x30c676){const _0x17ccd2=this['itemsViews']['indexOf'](_0x30c676);-0x1!==_0x17ccd2&&(this['itemsViews']['splice'](_0x17ccd2,0x1),this['_itemsListView']['items']['remove'](_0x30c676));}};const Ea=/* #__PURE__ -- @preserve */
|
|
34
|
+
_0x24339b(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(_0x546b6e,_0x19be61){super(_0x546b6e);const _0x384b7b=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x19be61['pinned']),this['set']('loadingState',null),this['set']('title',_0x19be61['title']),this['id']=_0x19be61['id'];const {createdAt:_0x2f81c3,active:_0x585f37=!0x1}=_0x19be61;this['_titleView']=new Yt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x317f0b=this['_createCheckView'](),_0x856547=this['_createPinButtonView'](_0x546b6e),_0x343199=this['_createMenuDropdownView'](),_0x49af81=this['_createEditInputView'](_0x546b6e),_0x305619=this['_createAcceptEditButtonView'](_0x546b6e,_0x49af81),_0x104895=this['_createCancelEditButtonView'](_0x546b6e);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x856547),this['actions']['add'](_0x343199),this['on']('change:isEdit',(_0x1ef92e,_0x1b8784,_0x3230f4)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x3230f4?(this['actions']['add'](_0x305619),this['actions']['add'](_0x104895),this['mainContent']['add'](_0x49af81),_0x49af81['element']['value']=this['title']||'',_0x49af81['element']['focus']()):(this['actions']['add'](_0x856547),this['actions']['add'](_0x343199),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x585f37?'ck-ai-chat-history__item--active':'',_0x384b7b['if']('isVisible','ck-hidden',_0x4a408f=>!_0x4a408f),_0x384b7b['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',_0x384b7b['if']('loadingState','ck-hidden',_0x96977b=>!!_0x96977b)]},'children':_0x585f37?[_0x317f0b]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x384b7b['if']('loadingState','ck-hidden',_0x3624b6=>!_0x3624b6)]},'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',_0x384b7b['if']('loadingState','ck-hidden',_0xf13237=>!!_0xf13237)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x384b7b['if']('loadingState','ck-hidden',_0x5aeacf=>!_0x5aeacf)]},'children':[{'text':_0x384b7b['to']('loadingState',_0x14519a=>_0x14519a?Es(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x14519a]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x2f81c3]}]},{'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(_0x4e02ca){this['set']('title',_0x4e02ca);}updateLoadingState(_0x409926,_0x54dec9){this['set']('loadingState',_0x54dec9?_0x409926:null);}_createCheckView(){const _0x2603e5=new $t();return _0x2603e5['set']({'content':_0x4ae57d}),_0x2603e5;}_createPinButtonView(_0x1812e8){const _0xd885e=new Mt(_0x1812e8);return _0xd885e['set']({'label':Es(_0x1812e8,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x30ea52,'withText':!0x1,'tooltip':!0x0}),_0xd885e['bind']('isOn')['to'](this,'pinned'),_0xd885e['on']('execute',()=>{const _0xf5b7c6=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0xf5b7c6});}),_0xd885e;}_createMenuDropdownView(){const _0xb8c2f8=_0x295fea(this['locale']),_0x333d2a=_0xb8c2f8['panelView']['children'];_0xb8c2f8['buttonView']['set']({'label':Es(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':rt}),_0xb8c2f8['panelPosition']='sw';const _0x3d6bd6=new Mt(this['locale']);_0x3d6bd6['label']=Es(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x3d6bd6['withText']=!0x0,_0x3d6bd6['on']('execute',()=>{this['isEdit']=!0x0;});const _0x22cf96=new Mt(this['locale']);_0x22cf96['label']=Es(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x22cf96['withText']=!0x0,_0x22cf96['on']('execute',()=>{this['showConfirm'](Es(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x4c2698=new Jt(this['locale']),_0x2431f3=new jt(this['locale']);_0x2431f3['children']['add'](_0x3d6bd6);const _0xef5026=new jt(this['locale']);return _0xef5026['children']['add'](_0x22cf96),_0x4c2698['items']['addMany']([_0x2431f3,_0xef5026]),_0x333d2a['add'](_0x4c2698),_0xb8c2f8;}_createEditInputView(_0xd03bea){const _0x5de006=new qt(_0xd03bea),_0xe6d7ad=_0x5de006['bindTemplate'];return _0x5de006['extendTemplate']({'on':{'keydown':_0xe6d7ad['to'](_0x5ef9a8=>{'Enter'==_0x5ef9a8['key']&&this['_commitEditInputValue'](_0x5de006);})}}),_0x5de006;}_createAcceptEditButtonView(_0x57a23e,_0x3c844f){const _0x199819=new Mt(_0x57a23e);return _0x199819['set']({'icon':_0x4ae57d,'withText':!0x1,'tooltip':Es(_0x57a23e,'AI_CHAT_HISTORY_ACCEPT')}),_0x199819['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x199819['on']('execute',()=>{this['_commitEditInputValue'](_0x3c844f);}),_0x199819;}_commitEditInputValue(_0x242265){const _0x38a007=_0x242265['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x38a007});}_createCancelEditButtonView(_0x41f43e){const _0x1a5906=new Mt(_0x41f43e);return _0x1a5906['set']({'icon':_0x1e5963,'withText':!0x1,'tooltip':Es(_0x41f43e,'AI_CHAT_HISTORY_CANCEL')}),_0x1a5906['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x1a5906['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x1a5906;}_createSpinnerView(){const _0x5d24aa=new Dr('tiny');return _0x5d24aa['isVisible']=!0x0,_0x5d24aa;}isMatching(_0x541c16){return'string'==typeof this['title']&&this['title']['match'](_0x541c16)?{'title':!0x0}:null;}highlightText(_0x1125fb){this['_titleView']['highlightText'](_0x1125fb);}},Ta=class extends _0x3a2edc{['headerView'];['searchView'];['mainErrorView'];skeletonView;emptyView;sectionsView;constructor(_0x1d3e8b,_0x60e9e5){super(_0x1d3e8b),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x2d0caa=_a(_0x1d3e8b,this);this['headerView']=new ua(_0x1d3e8b,{'label':Es(_0x1d3e8b,'AI_CHAT_HISTORY_HEADING'),'icon':_0x3b2c76,'class':'ck-ai-header_history','content':_0x2d0caa,'showResizeButton':_0x60e9e5}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Ia(_0x1d3e8b,[]),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',_0x13ce2e=>!_0x13ce2e)]}}),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 _0x35020e=new _0x197330(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x57cd98=>Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x57cd98),'secondary':Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x4b9586=this['_createErrorView']();return _0x4b9586['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x2737cb=>!_0x2737cb)]}}),_0x35020e['on']('render',()=>{_0x35020e['children']['add'](_0x4b9586,0x1);}),_0x35020e['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0xdf7ef=>!_0xdf7ef)]}}),_0x35020e;}_createSkeletonView(){const _0x59c325=new wr(this['locale'],Cr['aiHistory']);return _0x59c325['bind']('isVisible')['to'](this,'isLoading'),_0x59c325;}_createErrorView(){const _0xbb5943=new _0x3a2edc(this['locale']),_0x260876=new Mt(this['locale']);_0x260876['set']({'withText':!0x1,'icon':_0x1e5963,'class':'ck-ai-notification_error__dismiss-button'}),_0x260876['bind']('isVisible')['to'](this,'hasItems',_0x97ff2b=>!!_0x97ff2b),_0x260876['on']('execute',()=>{this['errorMessage']='';});const _0x2533fe=this['bindTemplate'];return _0xbb5943['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x2533fe['to']('errorMessage')}]},_0x260876]}),_0xbb5943;}_createEmptyStateView(){const _0x22026a=new _0x3a2edc(this['locale']);return _0x22026a['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x455bc0=>!_0x455bc0)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Es(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x22026a;}_createListItemViews(_0xfe625c,_0xcf353a){const _0x57a2fa=[];for(const _0x4d8c4b of _0xfe625c){const _0x32315e=new ma(_0xcf353a,_0x4d8c4b);_0x32315e['delegate'](...wa)['to'](this),_0x57a2fa['push'](_0x32315e);}return _0x57a2fa;}updateHistoryItemsWithCategories(_0x404024){const _0x309ab4=this['locale']||'en',_0x56e79c=[];for(const _0x20394f of _0x404024){const _0x59c214=this['_createListItemViews'](_0x20394f['items'],_0x309ab4);_0x56e79c['push'](new pa(_0x309ab4,{'title':_0x20394f['title'],'items':_0x59c214}));}this['sectionsView']['sections']=_0x56e79c,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x56e79c),this['hasItems']=_0x404024['some'](_0x3478d2=>_0x3478d2['items']['length']>0x0),this['_refreshSearch']();}removeHistoryItem(_0xc3a922){for(const _0x4bf7bc of this['sectionsView']['sections']){const _0x376471=_0x4bf7bc['getItem'](_0xc3a922);if(_0x376471){if(_0x4bf7bc['removeItem'](_0x376471),0x0===_0x4bf7bc['itemsViews']['length']){const _0x367b06=this['sectionsView']['sections']['indexOf'](_0x4bf7bc);-0x1!==_0x367b06&&(this['sectionsView']['sections']['splice'](_0x367b06,0x1),this['sectionsView']['items']['remove'](_0x4bf7bc));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}updateItemTitle(_0x4c6064,_0x122115){for(const _0x86e627 of this['sectionsView']['sections']){const _0x3fb11f=_0x86e627['getItem'](_0x4c6064);if(_0x3fb11f){_0x3fb11f['updateTitle'](_0x122115);break;}}}updateItemLoadingState(_0x4808b7,_0x546569,_0x4f0302){for(const _0x4c5fd9 of this['sectionsView']['sections']){const _0x1e4bc1=_0x4c5fd9['getItem'](_0x4808b7);if(_0x1e4bc1){_0x1e4bc1['updateLoadingState'](_0x546569,_0x4f0302);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x738897=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x738897);}}};const wa=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var Ca=class extends _0x57f218{static get requires(){return[gs];}_historyView;static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3bd7e4){super(_0x3bd7e4);const _0x54ab91=this['context']['plugins']['get']('AITabs');this['_historyView']=new Ta(this['context']['locale'],_0x54ab91['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x54ab91),this['_historyView']['delegate'](...wa)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x54ab91['view'],'isMaximized',_0x1183b6=>_0x1183b6),_0x54ab91['view']['addTab']({'id':'history','buttonLabel':Es(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x3b2c76,'order':0x0,'content':this['_historyView']});}removeHistoryItem(_0x364b05){this['_historyView']['removeHistoryItem'](_0x364b05);}updateItems(_0x4ddaf4){this['_historyView']['updateHistoryItemsWithCategories'](_0x4ddaf4);}updateItemTitle(_0x135706,_0x4ea578){this['_historyView']['updateItemTitle'](_0x135706,_0x4ea578);}updateItemLoadingState(_0x1286d0,_0x3d2102,_0x264a04){this['_historyView']['updateItemLoadingState'](_0x1286d0,_0x3d2102,_0x264a04);}setLoadingSkeleton(_0x5b807f){this['_historyView']['isLoading']=_0x5b807f;}['showError'](_0x1f883a){this['_historyView']['errorMessage']=_0x1f883a;}['hideError'](){this['_historyView']['errorMessage']='';}};const fa=/* #__PURE__ -- @preserve */
|
|
35
|
+
At();var ba=class extends fa{['id'];createdAt;constructor({id:_0x1b2005,title:_0x34b273,createdAt:_0x194bc8,updatedAt:_0x3546c7,pinned:_0x228ede}){super(),this['id']=_0x1b2005,this['createdAt']=new Date(_0x194bc8),this['set']('title',_0x34b273),this['set']('updatedAt',_0x3546c7?new Date(_0x3546c7):null),this['set']('pinned',_0x228ede||!0x1);}updateTitle(_0x44dd2a){this['set']('title',_0x44dd2a),this['updatedAt']=new Date();}updatePinned(_0x1403c){this['set']('pinned',_0x1403c),this['updatedAt']=new Date();}};const Sa=/* #__PURE__ -- @preserve */
|
|
36
|
+
dt();var Ra=class extends Sa{items=[];connector;['group'];constructor({connector:_0xff88e7,group:_0x5acad7}){super(),this['connector']=_0xff88e7,this['group']=_0x5acad7;}async init(){try{const _0x63f034=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x63f034);}catch(_0x36db54){this['fire']('error',{'error':_0x36db54,'operation':'init'});}}addItem(_0x3cbd26){this['items']['push'](_0x3cbd26);}async removeItem(_0x4560ec){const _0x92a294=this['items']['findIndex'](_0x44421e=>_0x44421e['id']===_0x4560ec);if(-0x1===_0x92a294)return!0x1;try{return await this['connector']['deleteConversation'](_0x4560ec)['execute'](),this['items']['splice'](_0x92a294,0x1),this['fire']('itemRemoved',{'itemId':_0x4560ec}),!0x0;}catch(_0x3d4614){return this['fire']('error',{'error':_0x3d4614,'operation':'removeItem','itemId':_0x4560ec}),!0x1;}}getItem(_0x670ef5){return this['items']['find'](_0x33dee6=>_0x33dee6['id']===_0x670ef5);}async updateItemTitle(_0x23e2b9,_0x54475a){const _0x3d648f=this['getItem'](_0x23e2b9);if(!_0x3d648f)return!0x1;try{return await this['connector']['updateConversation'](_0x23e2b9,{'title':_0x54475a})['getResult'](),_0x3d648f['updateTitle'](_0x54475a),this['fire']('itemUpdated',{'itemId':_0x23e2b9,'updates':{'title':_0x54475a}}),!0x0;}catch(_0x4c952a){return this['fire']('error',{'error':_0x4c952a,'operation':'updateItemTitle','itemId':_0x23e2b9}),!0x1;}}async updateItemPinned(_0x4b8578,_0xcba64){const _0x3152e6=this['getItem'](_0x4b8578);if(!_0x3152e6)return!0x1;try{return await this['connector']['updateConversation'](_0x4b8578,{'pinned':_0xcba64})['getResult'](),_0x3152e6['updatePinned'](_0xcba64),this['fire']('itemUpdated',{'itemId':_0x4b8578,'updates':{'pinned':_0xcba64}}),!0x0;}catch(_0x4c7f46){return this['fire']('error',{'error':_0x4c7f46,'operation':'updateItemPinned','itemId':_0x4b8578}),!0x1;}}loadItems(_0x3e46dc){try{this['items']=[],_0x3e46dc['map'](_0x185b97=>{this['addItem'](new ba(_0x185b97));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x32fc09){this['fire']('error',{'error':_0x32fc09,'operation':'loadItems'});}}getItems(_0x2c2e7f={}){const _0x114028=void 0x0!==_0x2c2e7f['pinned']&&_0x2c2e7f['pinned'],_0x3fcdad=_0x2c2e7f['from']?new Date(_0x2c2e7f['from']['getFullYear'](),_0x2c2e7f['from']['getMonth'](),_0x2c2e7f['from']['getDate']()):null,_0x1a9d3a=_0x2c2e7f['to']?new Date(_0x2c2e7f['to']['getFullYear'](),_0x2c2e7f['to']['getMonth'](),_0x2c2e7f['to']['getDate']()):null;return this['items']['filter'](_0x1e67e6=>{if(_0x1e67e6['pinned']!==_0x114028)return!0x1;if(_0x1a9d3a){const _0xfaa920=new Date(_0x1e67e6['createdAt']['getFullYear'](),_0x1e67e6['createdAt']['getMonth'](),_0x1e67e6['createdAt']['getDate']());return _0x3fcdad?_0x3fcdad['getTime']()===_0x1a9d3a['getTime']()?_0xfaa920['getTime']()===_0x3fcdad['getTime']():_0xfaa920<_0x1a9d3a&&_0xfaa920>=_0x3fcdad:_0xfaa920<_0x1a9d3a;}return!0x0;});}},Oa=class extends _0x57f218{_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 _0x464809=this['context']['plugins']['get'](gs);try{const _0x58eb13=this['_aiChatController']['getGroupId']();this['history']=new Ra({'connector':this['_aiConnector'],'group':_0x58eb13}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x3bc3c8,_0x53d8ec)=>{this['_setItemLoading'](_0x53d8ec['id'],'remove'),this['_handleRemove'](_0x53d8ec['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x30d6a5,_0x4784a2)=>{this['_setItemLoading'](_0x4784a2['id'],'rename'),this['_handleEditTitle'](_0x4784a2['id'],_0x4784a2['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x392276,_0x82b879)=>{void 0x0!==_0x82b879['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x82b879['itemId'],_0x82b879['updates']['title']),void 0x0!==_0x82b879['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x82b879['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x17d1bd,_0x1fa65a)=>{this['_aiChatController']['_handleRemovedConversation'](_0x1fa65a['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x1fa65a['itemId']),this['_clearItemLoading'](_0x1fa65a['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x1a134b,_0x211c53)=>{this['_handleHistoryErrorUI'](_0x211c53['error'],_0x211c53['operation'],_0x211c53['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x176c38,_0x3798b2)=>{this['_handleSelectConversation'](_0x3798b2['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x224b63,_0x4e53c1)=>{const _0x2bf09b=_0x4e53c1['pinned']?'pin':'unpin';this['_setItemLoading'](_0x4e53c1['id'],_0x2bf09b),this['_handleTogglePin'](_0x4e53c1['id'],_0x4e53c1['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x464809['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x464809['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x51a63a){this['_handleHistoryErrorUI'](_0x51a63a,'init');}}async _handleEditTitle(_0x4ed8bf,_0x5de6c7){await this['history']['updateItemTitle'](_0x4ed8bf,_0x5de6c7);}async['_handleTogglePin'](_0x184046,_0x11c5fb){await this['history']['updateItemPinned'](_0x184046,_0x11c5fb);}async['_handleRemove'](_0x5c0d97){await this['history']['removeItem'](_0x5c0d97);}async _handleSelectConversation(_0x230414){await this['_aiChatController']['loadConversation'](_0x230414);}async _showConversationHistory(){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_updateHistoryItemsUI(){const _0x1c97f1=this['_aiChatController']['activeConversation']?.['id'],_0x432882=this['_getCategorizedItems']()['map'](_0x1f8ee8=>({'title':_0x1f8ee8['title'],'items':_0x1f8ee8['items']['map'](_0x1559b8=>({'id':_0x1559b8['id'],'title':_0x1559b8['title']||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x1559b8['createdAt'])['toLocaleDateString'](),'active':_0x1559b8['id']===_0x1c97f1,'pinned':_0x1559b8['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x432882);}_setItemLoading(_0x35d8bb,_0x5c5686){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x35d8bb,_0x5c5686,!0x0);}_clearItemLoading(_0x55d87f){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x55d87f,null,!0x1);}_handleHistoryErrorUI(_0x5ad77d,_0x94cf5f,_0x2dd603){const _0x8da677=this['_generateErrorMessage'](_0x94cf5f,_0x2dd603);this['_aiChatHistoryUi']['showError'](_0x8da677),this['_reporter']['reportError'](_0x5ad77d,{'context':{'operation':_0x94cf5f}}),_0x2dd603&&this['_clearItemLoading'](_0x2dd603),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_generateErrorMessage(_0x4c64d7,_0x418dcf){const _0x14a89f=_0x418dcf?this['history']['getItem'](_0x418dcf):null,_0x2fc77b=_0x14a89f?.['title']||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x4c64d7){case'updateItemTitle':return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x2fc77b);case'updateItemPinned':{const _0x5e2f1d=Es(this['context']['locale'],_0x14a89f?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x5e2f1d,_0x2fc77b]);}case'removeItem':return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x2fc77b);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 _0x1fc9c3=new Date(),_0x3e45ef=new Date(_0x1fc9c3['getFullYear'](),_0x1fc9c3['getMonth'](),_0x1fc9c3['getDate']()),_0xec712d=new Date(_0x3e45ef);_0xec712d['setDate'](_0xec712d['getDate']()-0x1);const _0x1bbd5c=new Date(_0x3e45ef);_0x1bbd5c['setDate'](_0x1bbd5c['getDate']()-0xe);const _0x1efe95=this['history']['getItems']({'pinned':!0x0}),_0x2484c8=this['history']['getItems']({'from':_0x3e45ef,'to':_0x3e45ef}),_0x586ff5=this['history']['getItems']({'from':_0xec712d,'to':_0xec712d}),_0x2ab84f=this['history']['getItems']({'from':_0x1bbd5c,'to':_0xec712d}),_0x592f6c=this['history']['getItems']({'to':_0x1bbd5c}),_0xd7b688=[];return _0x1efe95['length']>0x0&&_0xd7b688['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x1efe95}),_0x2484c8['length']>0x0&&_0xd7b688['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x2484c8}),_0x586ff5['length']>0x0&&_0xd7b688['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x586ff5}),_0x2ab84f['length']>0x0&&_0xd7b688['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x2ab84f}),_0x592f6c['length']>0x0&&_0xd7b688['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x592f6c}),_0xd7b688;}},va=class extends _0x57f218{static get requires(){return[Oa,Ca];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ka=class extends _0x57f218{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(_0x4302bf){super(_0x4302bf),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(_0x3bb3ec,_0x8f32de){super(_0x3bb3ec);const {id:_0x345b88,type:_0x46c416,icon:_0x394882}=_0x8f32de;this['id']=_0x345b88,this['set']({'label':_0x8f32de['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x8f32de['id']}}),_0x394882?this['icon']=_0x394882:'chat'===_0x46c416?this['icon']=_0x4f3da7:'review'===_0x46c416?this['icon']=_0x5a8e02:'translate'===_0x46c416&&(this['icon']=_0x1895f8);}},Na=class extends _0x3a2edc{listView;constructor(_0x47a7e2,_0x3c6f12){super(_0x47a7e2),this['set']('isEnabled',!0x0);const _0x1f06af=_0x3c6f12['map'](_0x5ab321=>{const _0x59e9ec=new jt(this['locale']),_0x420ca5=new ya(this['locale'],_0x5ab321);return _0x420ca5['bind']('isEnabled')['to'](this),_0x59e9ec['children']['add'](_0x420ca5),_0x420ca5['delegate']('execute')['to'](this),_0x59e9ec;});this['listView']=new Jt(this['locale']),this['listView']['items']['addMany'](_0x1f06af),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const xa='chat-shortcuts';var La=class extends _0x57f218{_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 _0x305430=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x764073=_0x305430['activeConversation'];_0x764073['isFromHistory']||this['_injectShortcuts'](_0x764073);}),this['listenTo'](_0x305430,'interactionStarted',()=>{this['_removeShortcuts']();}));}_validateShortcuts(){const _0x36e413=['chat','review','translate'];this['_shortcuts']['forEach'](_0x3c1b29=>{let _0x2ff3a8=!0x0;if(_0x3c1b29['id']&&_0x3c1b29['label']&&_0x36e413['includes'](_0x3c1b29['type'])?'chat'===_0x3c1b29['type']&&(_0x2ff3a8='string'==typeof _0x3c1b29['prompt']):_0x2ff3a8=!0x1,!_0x2ff3a8)throw new ct('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x3c1b29});});}_injectShortcuts(_0x4c13c2){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',_0x901618=>{const _0x765b7e=_0x901618['source']['id'];this['_executeShortcut'](_0x765b7e);}),this['_listenedConversation']=_0x4c13c2,this['listenTo'](_0x4c13c2,'uploadProgressChanged',(_0xe36f5b,_0x4c6b63)=>{this['_shortcutsView']['isEnabled']=!_0x4c6b63['isUploadInProgress'];});}_removeShortcuts(){const _0x3900eb=this['context']['plugins']['get'](Aa);_0x3900eb['hasFeedItem'](xa)&&_0x3900eb['removeFeedItem'](xa),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}_executeShortcut(_0x485456){const _0x4e1780=this['_shortcuts']['find'](_0xef4cb0=>_0xef4cb0['id']===_0x485456),_0x4f1b62=_0x4e1780['type'];'chat'===_0x4f1b62?this['_runChatShortcut'](_0x4e1780):'review'===_0x4f1b62?_0x4e1780['commandId']?this['_runReviewShortcut'](_0x4e1780):this['_switchTab']('reviewMode'):'translate'===_0x4f1b62&&(_0x4e1780['language']?this['_runTranslateShortcut'](_0x4e1780):this['_switchTab']('translate'));}_switchTab(_0x3558ad){if(!this['context']['plugins']['has']('AITabs'))throw new ct('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x3558ad});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x3558ad);}async _runChatShortcut({id:_0x295cac,prompt:_0x178bd8,draftMode:_0x37f5ea,useWebSearch:_0x4c4f9f=!0x1,useReasoning:_0x27b341=!0x1,model:_0x1eb780}){const _0x1891b8=this['context']['plugins']['get']('AIChatController'),_0x58b5bf=_0x1891b8['activeConversation'],_0x3af93b=this['context']['plugins']['get'](fs),_0x213871=await _0x3af93b['models']['resolveModel'](_0x1eb780);_0x213871&&await _0x58b5bf['setModel'](_0x213871),_0x58b5bf['setWebSearch'](_0x4c4f9f),_0x58b5bf['setReasoning'](_0x27b341);const _0x313208=_0x3af93b['contextLibrary']['resolveContext']({'feature':'chat','ids':[_0x295cac],'idScopedOnly':!0x0,'context':new Yn()});_0x58b5bf['addDefaultContext'](_0x313208['refs']),_0x1891b8['addCurrentDocumentToChatContext'](),_0x37f5ea?(this['_aiChatUI']['setPromptInputValue'](_0x178bd8),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x1891b8['sendMessage']({'message':_0x178bd8});}_runReviewShortcut({commandId:_0x3d4554,model:_0xb544f6,prompt:_0x487ca3,params:_0x53ad08}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ct('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x2fd314={'id':_0x3d4554,'isCustom':'custom'===_0x3d4554};_0xb544f6&&_0x487ca3&&(_0x2fd314['args']={'model':_0xb544f6,'prompt':_0x487ca3}),_0x53ad08&&(_0x2fd314['params']=_0x53ad08),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x2fd314);}_runTranslateShortcut({language:_0x69e563}){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':_0x69e563,'args':{'language':_0x69e563}});}},Pa=class extends _0x15beea{constructor(_0x37ac9e){super(_0x37ac9e);const _0x57a043=_0x37ac9e['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x57a043,'isVisible'),this['isEnabled']=!0x0;}execute(){const _0x39cd87=this['editor']['plugins']['get']('AITabs')['view'];_0x39cd87['isVisible']=!_0x39cd87['isVisible'];}},Da=class extends _0x4e7480{static get requires(){return[gs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0xa826e2=this['editor'];_0xa826e2['commands']['add']('toggleAi',new Pa(_0xa826e2)),_0xa826e2['ui']['componentFactory']['add']('toggleAi',()=>{const _0x58a4de=this['_createAIUIButton'](Mt);return _0x58a4de['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x58a4de;}),_0xa826e2['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x57eeb7=this['_createAIUIButton'](Zt);return _0x57eeb7['set']({'role':'menuitemcheckbox'}),_0x57eeb7;});}_createAIUIButton(_0xefe267){const _0x5b1df7=this['editor'],_0x2375c5=_0x5b1df7['commands']['get']('toggleAi'),_0x4b06ca=new _0xefe267(_0x5b1df7['locale']);return _0x4b06ca['set']({'label':Es(_0x5b1df7['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x180f97,'isToggleable':!0x0}),_0x4b06ca['bind']('isEnabled')['to'](_0x2375c5),_0x4b06ca['bind']('isOn')['to'](_0x2375c5,'value',_0xf29e29=>!!_0xf29e29),this['listenTo'](_0x4b06ca,'execute',()=>{_0x2375c5['execute']();}),_0x4b06ca;}};const Ha=['applySuggestion','insertSuggestion','showNext','showPrevious'];var Ma=class extends _0x3a2edc{['_errorView'];constructor(_0x2f306e){super(_0x2f306e),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x19c307){this['showError'](_0x19c307);}['showError'](_0x31b1ee){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x31b1ee,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}_createErrorView(){const _0x4c4bed=new _0x3a2edc(this['locale']),_0x4e4a3d=new _0x3a2edc(this['locale']);return _0x4e4a3d['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x4c4bed['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x4c5971=>!_0x4c5971)]},'children':[_0x4e4a3d]}),_0x4c4bed;}};const Ua=0xa;var Va=class extends _0x57f218{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'](_0x3bac2e){const {id:_0x448641}=this['_currentConfig']??{};this['_currentConfig']=_0x3bac2e,this['_editor']=_0x3bac2e['targetEditor'];const {id:_0x140cee}=this['_currentConfig'];this['isOpen']&&_0x448641===_0x140cee?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x225f43=this['_editor'];if(!_0x225f43)return;const _0x72245=_0x225f43['plugins']['get']('Dialog');_0x72245['isOpen']&&this['_currentConfig']&&_0x72245['id']===this['_currentConfig']['id']&&_0x72245['hide']();}_updateDialog(){const _0x3d8d99=this['_editor']['plugins']['get']('Dialog'),{icon:_0x3e2c38,title:_0xbd6cce}=this['_currentConfig'];_0x3d8d99['view']?.['headerView']&&(_0x3d8d99['view']['headerView']['label']=_0xbd6cce,_0x3d8d99['view']['headerView']['iconView']&&_0x3e2c38&&(_0x3d8d99['view']['headerView']['iconView']['content']=_0x3e2c38)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x3d8d99['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 _0x267da9=this['_editor']['plugins']['get']('Dialog'),{id:_0x57cceb,title:_0x1be46c,icon:_0x599552,class:_0x308534,mainView:_0x4a645f}=this['_currentConfig'];_0x4a645f['delegate'](...Ha)['to'](this),_0x267da9['show']({'title':_0x1be46c,'icon':_0x599552,'hasCloseButton':!0x0,'id':_0x57cceb,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x308534||''),'content':_0x4a645f,'onShow':_0x17b992=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x17b992['view']?.['updatePosition']();const _0x15ae78=this['_getSelectionElements']();_0x15ae78&&_0x15ae78[0x0]&&Ot({'target':_0x15ae78[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x17b992['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x57cceb});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x57cceb}),this['isOpen']=!0x1;}});}_calculateDialogPosition(_0x5e4eba,_0x5573d9,_0x2573b5){const _0x543f3d=_0x5573d9||_0x2573b5;if(!_0x543f3d)return null;const _0x14190f=this['_getSelectionElements']();if(!_0x14190f||0x0===_0x14190f['length'])return{'left':Math['round'](_0x543f3d['left']+_0x543f3d['width']/0x2-_0x5e4eba['width']/0x2),'top':Math['round'](_0x543f3d['top']+_0x543f3d['height']/0x2-_0x5e4eba['height']/0x2)};const _0x405ed0=Math['round'](_0x543f3d['left']+_0x543f3d['width']/0x2-_0x5e4eba['width']/0x2),_0x271333=_0x14190f['map'](_0x2d86b8=>new It(_0x2d86b8)),_0x34d2a5=_0x5e4eba['height'];return{'left':_0x405ed0,'top':this['_calculateOptimalTopPosition'](_0x271333,_0x34d2a5,_0x543f3d)};}_calculateOptimalTopPosition(_0x2b9045,_0x41373f,_0x2883fa){const _0xe5730d=new It(wt['window']),_0x8ed6b6=_0x2b9045['map'](_0x282c3f=>_0x282c3f['getVisible']())['filter'](_0x5b414b=>_0x5b414b),_0x52c7d0=It['getBoundingRect'](_0x8ed6b6);if(!_0x52c7d0)return Math['round'](_0x2883fa['top']+_0x2883fa['height']/0x2);const _0x21fd1a=_0xe5730d['getIntersection'](_0x52c7d0);if(!_0x21fd1a)return Math['round'](_0x2883fa['top']+_0x2883fa['height']/0x2);const _0x370fce=_0x2883fa['getVisible'](),_0xb6560e=_0x370fce&&_0x52c7d0['height']>_0x370fce['height'],_0x223342=_0x21fd1a['top'],_0x2c2d2a=_0x21fd1a['bottom'];if(_0xb6560e){const _0x35235c=_0xe5730d['top']+_0xe5730d['height']/0x2-_0x41373f/0x2,_0x33d739=_0x223342-Ua-_0xe5730d['top'],_0x11c989=_0xe5730d['bottom']-_0x2c2d2a-Ua;return _0x33d739>=_0x41373f?Math['max'](Ua,_0x223342-_0x41373f-Ua):_0x11c989>=_0x41373f?_0x2c2d2a+Ua:Math['max'](Ua,_0x35235c);}const _0xd74e1a=_0x223342-_0x41373f,_0x12f2d2=_0xe5730d['bottom']-_0x2c2d2a-Ua,_0x5f2862=_0x223342-Ua-_0xe5730d['top'];let _0x2c2b19;return _0x2c2b19=_0x12f2d2>=_0x41373f?_0x2c2d2a+Ua:_0x5f2862>=_0x41373f?_0xd74e1a-Ua:_0x223342+_0x52c7d0['height']/0x2-_0x41373f/0x2,_0x2c2b19;}_setupFakeVisualSelectionMarkerRemovalListener(){const _0x11a189=this['_editor'];this['listenTo'](_0x11a189['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x8399f8,data:{newRange:_0x41c541}}of _0x11a189['model']['document']['differ']['getChangedMarkers']())if(_0x8399f8['startsWith']('ai-selection:')&&(_0x41c541&&(_0x41c541['start']['isEqual'](_0x41c541['end'])||'$graveyard'==_0x41c541['root']['rootName'])||null==_0x41c541)){const _0x14c6c6=Es(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x14c6c6),this['fire']('selectionRemoved');}}});}_cleanupFakeVisualSelectionMarkerRemovalListener(){const _0x2e1651=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x2e1651['model']['document']);}_getSelectionElements(){const _0x1c92f1=this['_editor'];return _0x5a452e(_0x1c92f1['editing'],[..._0x1c92f1['model']['markers']['getMarkersGroup']('ai-selection'),..._0x1c92f1['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}_getCurrentDomRootName(){const _0x2c6986=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x2c6986&&_0x2c6986['rootName']?_0x2c6986['rootName']:null;}},Ba=class extends _0x5d2e05{copyButton;likeButton;dislikeButton;showChangesButton;['_config'];constructor(_0x47e8d7,_0x2847cb={}){super(_0x47e8d7),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x2847cb};const _0x11c268=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x11c268?'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(_0x40f35a){this['showChangesButton']['isEnabled']=_0x40f35a;}_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':_0xe37cc4,'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 _0x41ef3b=new $t();_0x41ef3b['set']({'content':_0x4ae57d}),_0x41ef3b['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'](_0x41ef3b);}_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',_0x41264b=>_0x41264b?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(_0x305e37,_0x279616){super(_0x305e37);const _0x421286=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']=_0x279616,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new mr(_0x305e37),this['_partToolbarView']=new Ir(_0x305e37,_0x279616['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_partToolbarView']['bind']('isTargetReadOnly')['to'](this),this['_partToolbarView']['bind']('isEnabled')['to'](this,'areActionsDisabled',this,'_isErrorVisible',(_0x2d5801,_0x16644b)=>!_0x2d5801&&!_0x16644b),this['_togglePartToolbarButtonsVisibility'](_0x279616),this['_stateView']=new gr(_0x305e37),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new Ba(_0x305e37,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new Fa(_0x305e37,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0xc41c7f,_0xca7268,_0x125d6e,_0x56bcda)=>{let _0x179dc3,_0x4d2e81;'pending'===_0x56bcda?(_0x179dc3=this['_partToolbarView'],_0x4d2e81=this['_stateView']):(_0x179dc3=this['_stateView'],_0x4d2e81=this['_partToolbarView']),this['_stateView']['setState'](_0x125d6e,this['_outdatedReason']),_0x179dc3['isVisible']=!0x1,_0x4d2e81['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x421286['to']('_state',_0x51341e=>'ck-ai-chat-balloon-main_state_'+_0x51341e)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x279616);});}['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(_0x3c27df){_0x3c27df?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x3c27df);}clearContent(){this['_streamableContentView']['clear']();}setState(_0x4f065a,_0x84cb73){this['_outdatedReason']=_0x84cb73,this['_state']=_0x4f065a;}['showError'](_0xcbea5c){super['showError'](_0xcbea5c),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}toggleRotatorButtonsVisibility(_0x5541b2){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x5541b2;}_togglePartToolbarButtonsVisibility({showApplyButton:_0x49030a,showSuggestButton:_0x45824b}){_0x49030a=_0x49030a&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x45824b=_0x45824b&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x49030a,'showSuggestButton':_0x45824b});}_createNextButtonView(){const _0x16215a=new Mt(this['locale']);return _0x16215a['set']({'icon':_0x5c20b7,'label':Es(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x16215a['on']('execute',()=>{this['fire']('showNext');}),_0x16215a;}_createPreviousButtonView(){const _0x49b700=new Mt(this['locale']);return _0x49b700['set']({'icon':_0x593583,'label':Es(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x49b700['on']('execute',()=>{this['fire']('showPrevious');}),_0x49b700;}},Fa=class extends _0x3a2edc{constructor(_0x3a3fec,_0x4f7722){super(_0x3a3fec),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x4f7722});}},Ka=class extends _0x4e7480{static get requires(){return[Ut,Va];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}_chatBalloonView;constructor(_0x145bcf){super(_0x145bcf),this['set']('showDiff',!0x1);}['open'](_0x2d65bc){const _0x405840=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x405840['plugins']['get']('AIBalloon')['open']({..._0x2d65bc,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x2d65bc['showRotator']),this['_chatBalloonView']['areActionsDisabled']=_0x2d65bc['areActionsDisabled'],this['_chatBalloonView']['isTargetReadOnly']=_0x2d65bc['isTargetReadOnly'],this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}updateContent(_0x3af87f){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x3af87f);}clearContent(){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}setState(_0x308132,_0x2751c9){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x308132,_0x2751c9);}setTargetReadOnly(_0x5ceef7){this['_chatBalloonView']&&(this['_chatBalloonView']['isTargetReadOnly']=_0x5ceef7);}_createChatBalloonView(){const _0x463057=this['editor'],_0x487024=_0x463057['plugins']['get']('AIBalloon'),_0x2418c7=_0x463057['commands']['get']('trackChanges');let _0x3732f3=_0x463057['config']['get']('ai.availableReplyActions')||[...Or];_0x463057['plugins']['has']('TrackChanges')||(_0x3732f3=_0x3732f3['filter'](_0x378694=>'insertSuggestion'!=_0x378694));const _0x43d52b=new Ga(_0x463057['locale'],{'availableActions':_0x3732f3,'showApplyButton':!0x0,'showSuggestButton':!!_0x2418c7});return _0x43d52b['bind']('showDiff')['to'](this),_0x43d52b['delegate'](...ir)['to'](this),_0x43d52b['delegate']('showPrevious','showNext')['to'](this),_0x487024['delegate']('dialogClosed')['to'](this),_0x43d52b['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x43d52b['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x43d52b['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x2418c7&&_0x43d52b['bind']('isTrackChangesOn')['to'](_0x2418c7,'value'),_0x43d52b['render'](),_0x43d52b;}_toggleRotatorButtonsInDialogHeader(_0x367934){const _0x345d7b=this['editor'],_0x2a60ab=_0x345d7b['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x367934),_0x2a60ab['has'](this['_chatBalloonView']['previousButtonView'])||(_0x2a60ab['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x345d7b['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x2a60ab['remove'](this['_chatBalloonView']['previousButtonView']),_0x2a60ab['remove'](this['_chatBalloonView']['nextButtonView']);}));}_restoreDefaultViewFocus(){this['_chatBalloonView']['focus']();}},Wa=class extends _0x4e7480{static get requires(){return[Da,Ka,_0x4978a0];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function Ya(_0x4554af){const {editor:_0x1a91a8,action:_0x14ede6,withText:_0x30cda0=!0x1,withIcon:_0xb05163=!0x0,isInDropdown:_0x3dea28=!0x0,shouldPreventFocus:_0x53f34d=!0x1,actionButtons:_0x4733f3}=_0x4554af;return()=>{const _0x5430f3=_0x1a91a8['locale'],_0x4d9acb=new Mt(_0x5430f3),_0x525731=_0x4d9acb['bindTemplate'];_0x3dea28&&_0x4d9acb['extendTemplate']({'on':{'mouseenter':_0x525731['to'](()=>{_0x53f34d&&_0x53f34d()||_0x4d9acb['focus']();})}}),_0x4733f3['push']({'buttonView':_0x4d9acb,'action':_0x14ede6});const _0x1e9c80=_0x14ede6['icon']??_0x14ede6['parent']?.['icon'];return _0x4d9acb['set']({'label':_0x14ede6['label'],'withText':_0x30cda0,'role':'menuitem','icon':_0xb05163?_0x1e9c80??_0x4b081c:void 0x0,'tooltip':!_0x30cda0,'class':'ck-ai-quick-actions-button','isEnabled':_0x14ede6['isEnabled']}),_0x4d9acb['on']('execute',()=>{_0x1a91a8['editing']['view']['focus'](),_0x1a91a8['commands']['execute']('aiQuickAction',_0x14ede6);}),_0x4d9acb;};}var $a=class extends Xt{['arrowView'];constructor(_0x17e66f,_0x6acd35){super(_0x17e66f,_0x6acd35);const _0x318192=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',_0x24229f=>String(_0x24229f)),'data-cke-tooltip-disabled':_0x318192['to']('isOn')},'on':{'mouseenter':_0x318192['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}_createArrowView(){const _0x5159b2=new $t();return _0x5159b2['content']=_0x3230ae,_0x5159b2['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x5159b2;}},qa=class extends Jt{_allListItems;_allSearchableItems;constructor(_0x47f749,_0x569e16,_0xcaa01a){super(_0x47f749),this['_allListItems']=_0x569e16,this['_allSearchableItems']=_0xcaa01a;}filter(_0x303bc6){if(!_0x303bc6)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x2c65f3=_0x303bc6['source']['toLowerCase']()['trim'](),_0xfc6011=this['_allSearchableItems']['filter'](_0x4084eb=>(_0x4084eb['groupLabel']?_0x4084eb['label']+'\x20('+_0x4084eb['groupLabel']+')':_0x4084eb['label'])['toLowerCase']()['includes'](_0x2c65f3));return this['items']['clear'](),this['items']['addMany'](_0xfc6011['sort']((_0x30ab1e,_0x38aff4)=>{const _0x48d964=_0x30ab1e['groupLabel'],_0x52bc98=_0x38aff4['groupLabel'];return _0x48d964||_0x52bc98?_0x48d964?0x1:-0x1:0x0;})['map'](_0x37af6f=>_0x37af6f['item'])),this['_highlightQuery'](_0x2c65f3,_0xfc6011),{'resultsCount':_0xfc6011['length'],'totalItemsCount':this['_allSearchableItems']['length']};}_highlightQuery(_0x37dabf,_0x4c2e81){if(!_0x37dabf)return;const _0x31ea8d=new RegExp(_0x5c6661(_0x37dabf),'gi');_0x4c2e81['forEach'](_0x5bcfb4=>{_0x5bcfb4['highlightViews']&&_0x5bcfb4['highlightViews']['forEach'](_0x129bb4=>{'function'==typeof _0x129bb4['highlightText']&&_0x129bb4['highlightText'](_0x31ea8d);});});}_clearHighlight(){this['_allSearchableItems']['forEach'](_0x1caca7=>{_0x1caca7['highlightViews']&&_0x1caca7['highlightViews']['forEach'](_0x30f0d2=>{'function'==typeof _0x30f0d2['highlightText']&&_0x30f0d2['highlightText'](null);});});}};const Qa='menu',Xa='menuitem';var za=class extends _0x3a2edc{_bodyCollection;optionsListView;_searchTextView=null;_allSearchableItems=[];['children'];['focusTracker'];keystrokes;['_focusables'];['focusCycler'];_openNestedPanels=new Set();['_hasSearch'];_actionButtons;constructor(_0x283fce,_0x269366,_0x406724,_0x2ab01c,_0x1a1ff4=!0x1,_0x2342d1=[]){const _0x361c68=_0x283fce['locale'];super(_0x361c68),this['_bodyCollection']=_0x2ab01c,this['_hasSearch']=_0x1a1ff4,this['_actionButtons']=_0x2342d1;const _0x45da7c=this['_createListItems'](_0x283fce,_0x269366,_0x406724);this['optionsListView']=new qa(_0x361c68,_0x45da7c,this['_allSearchableItems']),this['optionsListView']['role']=Qa,this['optionsListView']['items']['addMany'](_0x45da7c),this['focusTracker']=new _t(),this['keystrokes']=new gt(),_0x1a1ff4&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x45da7c,this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x1a1ff4&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x34d1c4=_0x1a1ff4&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x16cf3f(_0x34d1c4),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x361c68['uiLanguageDirection']},'children':this['children']});}_createSearchTextView(){return new _0x197330(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 _0xbd08c2=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0xbd08c2);}_createListItems(_0x343124,_0x204da1,_0x4af0fc){const _0x1c59a6=new _0x16cf3f();return _0x204da1['forEach'](_0x2de5c4=>{if('actions'in _0x2de5c4){const {listItem:_0x13c5e8}=this['_createActionGroupButton'](_0x343124,_0x2de5c4,_0x4af0fc);_0x1c59a6['add'](_0x13c5e8),_0x2de5c4['actions']['forEach'](_0x43e147=>{const {listItem:_0x3594f4,highlightViews:_0x1efb1a}=this['_createSearchResultActionButton'](_0x343124,_0x43e147,_0x2de5c4['label'],_0x2de5c4['icon']);this['_allSearchableItems']['push']({'item':_0x3594f4,'label':_0x43e147['label'],'groupLabel':_0x2de5c4['label'],'highlightViews':_0x1efb1a});});}else{const {listItem:_0x52831b}=this['_createActionButton'](_0x343124,_0x2de5c4);_0x1c59a6['add'](_0x52831b);const _0x309f1a=_0x52831b['children']['first'];if(_0x309f1a){const {listItem:_0x11629a,highlightViews:_0x2cd111}=this['_createSearchResultActionButton'](_0x343124,_0x2de5c4);this['_allSearchableItems']['push']({'item':_0x11629a,'label':_0x309f1a['label']||'','highlightViews':_0x2cd111});}}}),_0x1c59a6;}_createActionButton(_0xc52806,_0x146496,_0x40ad2a,_0x5aee32){const _0x2b7537=new jt(this['locale']);if(_0x40ad2a&&_0x5aee32){const _0x23c9e3=new Mt(this['locale']),_0x49dee2=_0x23c9e3['bindTemplate'],_0x306c5b=new Yt();_0x306c5b['text']=_0x146496['label'];const _0x54b7b1=new Yt();_0x54b7b1['text']=_0x40ad2a;const _0x2b744a=new $t();_0x2b744a['content']=_0x5aee32,_0x2b744a['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x4f62c5=new _0x3a2edc(this['locale']);_0x4f62c5['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x410110=new _0x3a2edc(this['locale']);return _0x410110['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x23c9e3['set']({'label':_0x146496['label']+'\x20('+_0x40ad2a+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x146496['isEnabled']}),_0x23c9e3['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x49dee2['if']('isEnabled','ck-disabled',_0x3e77df=>!_0x3e77df)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x306c5b,_0x4f62c5,_0x2b744a,_0x54b7b1,_0x410110],'on':{'mouseenter':_0x49dee2['to'](()=>{this['_isSearchFocused']()||_0x23c9e3['focus']();}),'click':_0x49dee2['to'](()=>{_0x23c9e3['fire']('execute');})}}),_0x23c9e3['on']('execute',()=>{_0x23c9e3['isEnabled']&&(_0xc52806['editing']['view']['focus'](),_0xc52806['commands']['execute']('aiQuickAction',_0x146496));}),_0x2b7537['children']['add'](_0x23c9e3),this['_actionButtons']['push']({'buttonView':_0x23c9e3,'action':_0x146496}),{'listItem':_0x2b7537,'highlightViews':[_0x306c5b,_0x54b7b1]};}{const _0x50b3fb=new Ht(),_0x1346df=new Mt(this['locale'],_0x50b3fb),_0x40dd20=_0x1346df['bindTemplate'],_0x3c242d=_0x146496['icon']??_0x146496['parent']?.['icon'],_0x3b308b=void 0x0!==_0x146496['icon'];return _0x1346df['set']({'label':_0x146496['label'],'withText':!0x0,'role':'menuitem','icon':_0x3b308b?_0x3c242d??_0x4b081c:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x146496['isEnabled']}),_0x1346df['extendTemplate']({'on':{'mouseenter':_0x40dd20['to'](()=>{this['_isSearchFocused']()||_0x1346df['focus']();})}}),_0x1346df['on']('execute',()=>{_0xc52806['editing']['view']['focus'](),_0xc52806['commands']['execute']('aiQuickAction',_0x146496);}),_0x2b7537['children']['add'](_0x1346df),this['_actionButtons']['push']({'buttonView':_0x1346df,'action':_0x146496}),{'listItem':_0x2b7537,'highlightViews':[_0x50b3fb]};}}_createSearchResultActionButton(_0x226ec8,_0x120b58,_0x12af97,_0x306aaa){return _0x12af97&&_0x306aaa?this['_createSearchResultGroupedActionButton'](_0x226ec8,_0x120b58,_0x12af97,_0x306aaa):this['_createSearchResultIndividualActionButton'](_0x226ec8,_0x120b58);}_createSearchResultGroupedActionButton(_0x4ebc83,_0x336814,_0x17aa59,_0x125495){const _0x2724db=new jt(this['locale']),_0x5dd723=new Mt(this['locale']),_0x555216=_0x5dd723['bindTemplate'],{view:_0x51ff48,highlightView:_0xe3beaf}=this['_createSearchResultGroupRow'](_0x17aa59,_0x125495),{view:_0x522fcf,highlightView:_0x276fa1}=this['_createSearchResultActionRow'](_0x336814['label']),_0x48c1df=this['_createSearchResultContentView'](_0x51ff48,_0x522fcf);return _0x5dd723['set']({'label':_0x336814['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':_0x336814['isEnabled']}),_0x5dd723['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',_0x555216['if']('isEnabled','ck-disabled',_0x1ebb4d=>!_0x1ebb4d)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x48c1df],'on':{'mouseenter':_0x555216['to'](()=>{this['_isSearchFocused']()||_0x5dd723['focus']();}),'click':_0x555216['to'](()=>{this['_handleSearchResultButtonClick'](_0x5dd723);})}}),this['_setupActionButtonExecution'](_0x5dd723,_0x4ebc83,_0x336814),_0x2724db['children']['add'](_0x5dd723),this['_actionButtons']['push']({'buttonView':_0x5dd723,'action':_0x336814}),{'listItem':_0x2724db,'highlightViews':[_0xe3beaf,_0x276fa1]};}_createSearchResultIndividualActionButton(_0x305e5e,_0x587305){const _0x3df2f2=new jt(this['locale']),_0x55902b=new Ht(),_0x5dd808=new Mt(this['locale'],_0x55902b),_0x5233ef=_0x5dd808['bindTemplate'];return _0x5dd808['set']({'label':_0x587305['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x587305['isEnabled']}),_0x5dd808['extendTemplate']({'on':{'mouseenter':_0x5233ef['to'](()=>{this['_isSearchFocused']()||_0x5dd808['focus']();})}}),this['_setupActionButtonExecution'](_0x5dd808,_0x305e5e,_0x587305),_0x3df2f2['children']['add'](_0x5dd808),this['_actionButtons']['push']({'buttonView':_0x5dd808,'action':_0x587305}),{'listItem':_0x3df2f2,'highlightViews':[_0x55902b]};}_createSearchResultGroupRow(_0x26058b,_0x1e3214){const _0xb18e6f=new _0x3a2edc(this['locale']),_0x15513d=new $t();_0x15513d['content']=_0x1e3214,_0x15513d['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x51cade=new Yt();return _0x51cade['text']=_0x26058b,_0xb18e6f['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x15513d,_0x51cade]}),{'view':_0xb18e6f,'highlightView':_0x51cade};}_createSearchResultActionRow(_0x1b7a00){const _0x303501=new _0x3a2edc(this['locale']),_0x3efcfa=new Yt();return _0x3efcfa['text']=_0x1b7a00,_0x303501['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x3efcfa]}),{'view':_0x303501,'highlightView':_0x3efcfa};}_createSearchResultContentView(_0x1d0a50,_0x5b4512){const _0x3a9570=new _0x3a2edc(this['locale']);return _0x3a9570['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x1d0a50,_0x5b4512]}),_0x3a9570;}_setupActionButtonExecution(_0x1b0870,_0x2a0d3c,_0x3c2b9c){_0x1b0870['on']('execute',()=>{_0x1b0870['isEnabled']&&(_0x2a0d3c['editing']['view']['focus'](),_0x2a0d3c['commands']['execute']('aiQuickAction',_0x3c2b9c));});}_createActionGroupButton(_0x25e359,_0x4bb15e,_0x4f944b){const _0x28d906=new jt(this['locale']),_0x32ebef=new Ht(),_0x10cfe1=new $a(this['locale'],_0x32ebef),_0x527b53=_0x10cfe1['bindTemplate'],_0x27d845=this['_getPanelKeystroke'](_0x4f944b),_0x92dd8e=this['_createGroupActionsList'](_0x25e359,_0x4bb15e['actions'],_0x4f944b);_0x10cfe1['set']({'label':_0x4bb15e['label'],'withText':!0x0,'role':Xa,'icon':_0x4bb15e['icon']??_0x4b081c,'isEnabled':_0x4bb15e['actions']['some'](_0x3cbb7b=>_0x3cbb7b['isEnabled'])}),_0x10cfe1['extendTemplate']({'on':{'mouseenter':_0x527b53['to'](()=>{this['_isSearchFocused']()||_0x10cfe1['focus']();})}});const _0x4904d4=new xt(this['locale']);return _0x4904d4['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x527b53['to'](_0x2805ef=>{this['_handlePanelKeydown'](_0x2805ef,_0x27d845,_0x10cfe1,_0x4904d4);})}}),_0x10cfe1['bind']('isOn')['to'](_0x4904d4,'isVisible'),this['_bodyCollection']['add'](_0x4904d4),_0x4904d4['content']['add'](_0x92dd8e),this['_setupGroupMenuBehavior'](_0x10cfe1,_0x4904d4),_0x28d906['children']['add'](_0x10cfe1),this['_actionButtons']['push']({'buttonView':_0x10cfe1,'action':_0x4bb15e}),{'listItem':_0x28d906,'highlightView':_0x32ebef};}_createGroupActionsList(_0x4930a2,_0x3f48b0,_0x1fe34d){const _0x102455=new Jt(this['locale']);return _0x102455['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x3f48b0['forEach'](_0x52c06f=>{const _0x607bc0=new jt(this['locale']),_0x1071eb=Ya({'editor':_0x4930a2,'action':_0x52c06f,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x607bc0['children']['add'](_0x1071eb),_0x1fe34d['focusTracker']['add'](_0x1071eb),_0x102455['items']['add'](_0x607bc0);}),_0x102455;}_setupGroupMenuBehavior(_0x5165b8,_0x4c30c3){const _0x5371d8=_0x5165b8['bindTemplate'],_0x2752e3=this['_getButtonKeystroke'](_0x5165b8);_0x5165b8['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x5371d8['to'](()=>{this['_showNestedPanel'](_0x4c30c3,_0x5165b8);}),'mouseleave':_0x5371d8['to'](_0x4298a2=>{const _0x4c7915=_0x4298a2['relatedTarget'];this['_isMovingToNestedMenu'](_0x4c7915,_0x4c30c3)||this['_hideNestedPanel'](_0x4c30c3);}),'keydown':_0x5371d8['to'](_0x142dd2=>{_0x142dd2['key']==_0x2752e3&&(this['_showNestedPanel'](_0x4c30c3,_0x5165b8),_0x4c30c3['content']['get'](0x0)['focus']());})}}),_0x4c30c3['on']('render',()=>{_0x4c30c3['element']?.['addEventListener']('mouseleave',_0x693205=>{const _0x1e5113=_0x693205['relatedTarget'];_0x5165b8['element']?.['contains'](_0x1e5113)||this['_isMovingToNestedMenu'](_0x1e5113,_0x4c30c3)||this['_hideNestedPanel'](_0x4c30c3);});});}_showNestedPanel(_0x21be82,_0x31c618){this['_openNestedPanels']['forEach'](_0x2bd73e=>{_0x2bd73e!==_0x21be82&&_0x2bd73e['isVisible']&&_0x2bd73e['hide']();}),_0x21be82['show'](),_0x21be82['pin']({'positions':[Bt['eastSouth']],'target':_0x31c618['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x21be82);}_hideNestedPanel(_0x4cb62d){_0x4cb62d['hide'](),this['_openNestedPanels']['delete'](_0x4cb62d);}_hideAllNestedPanels(){this['_openNestedPanels']['forEach'](_0x3c5b88=>_0x3c5b88['hide']()),this['_openNestedPanels']['clear']();}_isMovingToNestedMenu(_0x63d974,_0x4a2c36){if(!_0x63d974)return!0x1;if(_0x4a2c36['element']?.['contains'](_0x63d974))return!0x0;const _0x28ff68=_0x63d974;return _0x28ff68['closest']&&(null!==_0x28ff68['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x28ff68['closest']('.ck-ai-quick-actions-group-list')||null!==_0x28ff68['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(_0x39ca0e){return'rtl'===_0x39ca0e['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}_getButtonKeystroke(_0x3361b7){return'rtl'===_0x3361b7['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x1ffae6,_0x48b300,_0x1ecc80,_0x7c9796){_0x1ffae6['key']==_0x48b300&&(_0x1ecc80['focus'](),this['_hideNestedPanel'](_0x7c9796));}_handleSearchResultButtonClick(_0xc510ef){_0xc510ef['fire']('execute');}};function ja(_0x1243f9){const {editor:_0x2938e7,content:_0x1f82f2,buttonDefinition:_0x3f186c,bodyCollection:_0x32ae3b,hasSearch:_0x1e036d=!0x1,actionButtons:_0x5606c9}=_0x1243f9;return()=>{const _0x3e9ac7=_0x2938e7['locale'],_0x3461e2=_0x2938e7['commands']['get']('aiQuickAction'),_0x5cb775=_0x295fea(_0x3e9ac7);_0x5cb775['bind']('isEnabled')['to'](_0x3461e2),_0x5cb775['buttonView']['set']({'icon':_0x3f186c['icon']??_0x4b081c,'label':_0x3f186c['label'],'tooltip':!0x0}),_0x5cb775['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x4f5829=new za(_0x2938e7,_0x1f82f2,_0x5cb775,_0x32ae3b,_0x1e036d,_0x5606c9);return _0x5cb775['panelView']['children']['add'](_0x4f5829),_0x1e036d&&_0x5cb775['on']('change:isOpen',(_0x4b85cb,_0x2836a4,_0x3b4e01)=>{if(_0x3b4e01){if(_0x2938e7['plugins']['has']('AIEditing')){const _0x2c90cd=_0x2938e7['plugins']['get'](tn),_0xd9c93b=_0x2938e7['model']['document']['selection'],_0x4bda83=Array['from'](_0xd9c93b['getRanges']());_0x4bda83['length']>0x0&&_0x2c90cd['showFakeVisualSelection']({'editor':_0x2938e7,'ranges':_0x4bda83,'id':'quick-action','priority':0x14});}}else _0x2938e7['plugins']['has']('AIEditing')&&_0x2938e7['plugins']['get'](tn)['hideFakeVisualSelection']('quick-action'),_0x4f5829['resetSearch']();}),_0x5cb775;};}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 _0x4e7480{_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 _0x5873c1=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x5873c1),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static getDefaultQuickActions(_0x23c5b8){return function(_0x29cd23){const _0x81341d=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x29cd23['uiLanguage'])||'English';return[{'id':'ask-ai','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x3cb8c5},{'id':'chat-commands','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x3cb8c5,'actions':[{'id':'explain','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Es(_0x29cd23,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':Ja['replace']('%0',_0x81341d),'type':'chat'},{'id':'summarize','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Es(_0x29cd23,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Za['replace']('%0',_0x81341d),'type':'chat'},{'id':'highlight-key-points','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Es(_0x29cd23,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':th['replace']('%0',_0x81341d),'type':'chat'}]},{'id':'improve-writing','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x189daa},{'id':'continue','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x77ad9c},{'id':'fix-grammar','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x264e7a},{'id':'adjust-length','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x480192,'actions':[{'id':'make-shorter','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x2e4961,'actions':[{'id':'make-tone-casual','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x1895f8,'actions':[{'id':'translate-to-english','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Es(_0x29cd23,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x46dd3b,'actions':[]}];}(_0x23c5b8);}_getDefaultAndCustomActions(){const _0x5869c2=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x43cfc7=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0xd8a61b=>({..._0xd8a61b,'type':'chat'===_0xd8a61b['type']?'chat':'action','icon':void 0x0}));return _0x5869c2['find'](_0x4bdac0=>'other'===_0x4bdac0['id'])['actions']['push'](..._0x43cfc7),_0x5869c2;}async _initActionTypeQuickActions(){try{const _0x1bd7eb=this['editor']['plugins']['get'](fs),_0x17aa2a=await _0x1bd7eb['models']['getAllModels'](),_0x4f6759=(await _0x1bd7eb['models']['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x4f6759),this['_enableButtonsByType']('action',_0x6316e4=>!!_0x17aa2a['find'](_0xf30c4f=>_0xf30c4f['id']===_0x6316e4['model'])||void 0x0===_0x6316e4['model']);}catch(_0x18c8a1){const _0x353a6a=new ct('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x18c8a1});this['_reporter']['logError'](_0x353a6a);}}_initChatTypeQuickActions(){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0xc5e03f=this['editor']['plugins']['get']('AIChatController'),_0x217c18=this['editor']['plugins']['has']('AIChatUI')?this['editor']['plugins']['get']('AIChatUI'):null;this['listenTo'](_0xc5e03f,'change:isConversationReady',(_0x1d9bd8,_0x4b7be0,_0x2cf3cb)=>{this['_enableButtonsByType']('chat',()=>_0x2cf3cb&&!_0x217c18?.['isBusy']);}),_0x217c18&&this['listenTo'](_0x217c18,'change:isBusy',(_0x347924,_0x2e8c6c,_0x66428b)=>{this['_enableButtonsByType']('chat',()=>_0xc5e03f['isConversationReady']&&!_0x66428b);}),this['_enableButtonsByType']('chat',()=>_0xc5e03f['isConversationReady']&&!_0x217c18?.['isBusy']);}_enableButtonsByType(_0x12775a,_0x11e3cb){this['_quickActionsDefinition']['forEach'](_0x4589cb=>{'actions'in _0x4589cb?_0x4589cb['actions']['forEach'](_0xa01307=>{_0xa01307['type']===_0x12775a&&(_0xa01307['isEnabled']=_0x11e3cb(_0xa01307));}):_0x4589cb['type']===_0x12775a&&(_0x4589cb['isEnabled']=_0x11e3cb(_0x4589cb));}),this['_actionButtons']['forEach'](_0x248d20=>{if(sh(_0x248d20['action']))return;if(_0x248d20['action']['type']!==_0x12775a)return;const _0x2d71f0=_0x11e3cb(_0x248d20['action']);if(_0x248d20['action']['isEnabled']=_0x2d71f0,_0x248d20['buttonView']['isEnabled']=_0x2d71f0,'action'===_0x12775a&&!_0x2d71f0&&_0x248d20['action']['model']){const _0x4bc396=new ct('ai-quick-actions-unavailable-model',this,{'actionId':_0x248d20['action']['id'],'modelId':_0x248d20['action']['model']});this['_reporter']['logError'](_0x4bc396);}}),this['_actionButtons']['filter'](_0x485698=>sh(_0x485698['action']))['forEach'](_0x4037e2=>{_0x4037e2['buttonView']['isEnabled']=_0x4037e2['action']['actions']['some'](_0x3636f8=>_0x3636f8['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x2305ef,group:_0x5c4b1d})=>{_0x2305ef['isEnabled']=_0x5c4b1d['actions']['some'](_0x403578=>_0x403578['isEnabled']);});}_enableButtonById(_0x37e23f,_0x125e49){this['_quickActionsDefinition']['forEach'](_0x18716d=>{'actions'in _0x18716d?_0x18716d['actions']['forEach'](_0x4eee27=>{_0x4eee27['id']===_0x37e23f&&(_0x4eee27['isEnabled']=_0x125e49(_0x4eee27));}):_0x18716d['id']===_0x37e23f&&(_0x18716d['isEnabled']=_0x125e49(_0x18716d));}),this['_actionButtons']['forEach'](_0x18918a=>{if(sh(_0x18918a['action']))return;if(_0x18918a['action']['id']!==_0x37e23f)return;const _0xafc32b=_0x125e49(_0x18918a['action']);_0x18918a['action']['isEnabled']=_0xafc32b,_0x18918a['buttonView']['isEnabled']=_0xafc32b;});}_assignDefaultModelToCustomActions(_0x351ddd){this['_actionButtons']['forEach'](_0x4caf8d=>{sh(_0x4caf8d['action'])||'action'===_0x4caf8d['action']['type']&&(_0x4caf8d['action']['model']||(_0x4caf8d['action']['model']=_0x351ddd));});}_initializeQuickActionsComponentsAndCommands(){const _0x39ad90=new Pt(this['editor']['locale']);_0x39ad90['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x39ad90),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x39ad90);}_initializeQuickActionsDropdown(_0x36e5a2){const _0x42001d=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',ja({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x4b081c,'label':Es(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x36e5a2,'hasSearch':_0x42001d,'actionButtons':this['_actionButtons']}));}_prepareQuickActionsDefinition(_0xbe34c1){this['_quickActionsDefinition']=_0xbe34c1['map'](_0x1b2c73=>{if('actions'in _0x1b2c73){const _0x4a8fa5=_0x1b2c73;return{..._0x4a8fa5,'actions':_0x4a8fa5['actions']['map'](_0x427082=>{const {actions:_0x428ef5,..._0x1bca7a}=_0x4a8fa5;return{..._0x427082,'isEnabled':!0x1,'parent':_0x1bca7a};})['filter'](_0x586290=>this['_shouldIncludeAction'](_0x586290))};}return{..._0x1b2c73,'isEnabled':!0x1};})['filter'](_0x361a31=>'actions'in _0x361a31?_0x361a31['actions']['length']>0x0:this['_shouldIncludeAction'](_0x361a31));}_shouldIncludeAction(_0x34b4f0){const _0x35ccb8=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](eh[_0x34b4f0['type']])&&!_0x35ccb8['includes'](_0x34b4f0['id'])&&!('chat'===_0x34b4f0['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}_initializeQuickActionsComponents(_0x31b808){this['_quickActionsDefinition']['forEach'](_0x30c651=>{if('actions'in _0x30c651){const _0x4fe4c2=ja({'editor':this['editor'],'content':_0x30c651['actions'],'buttonDefinition':_0x30c651,'bodyCollection':_0x31b808,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x30c651['id'],_0x4fe4c2),_0x30c651['actions']['forEach'](_0x1ac4f9=>{const _0x1631ee=Ya({'editor':this['editor'],'action':_0x1ac4f9,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x1ac4f9['id'],_0x1631ee);});}else{const _0x5b7fb3=Ya({'editor':this['editor'],'action':_0x30c651,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x30c651['id'],_0x5b7fb3);}});}_initializeQuickActionsMenuBar(){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x27b25a=>{const _0x2339a5=this['editor']['commands']['get']('aiQuickAction'),_0x21062f=new _0x502992(_0x27b25a),_0xaf626b=Es(_0x27b25a,'AI_QUICK_ACTIONS_HEADING');_0x21062f['buttonView']['set']({'label':_0xaf626b,'icon':_0x4b081c});const _0x3766cb=new _0x20ae77(_0x27b25a);return _0x3766cb['set']({'ariaLabel':_0xaf626b,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x5ece88=>{if('actions'in _0x5ece88){const _0x243e93=_0x5ece88,_0x144c8b=new te(_0x27b25a,_0x21062f),_0x5972f1=new _0x502992(_0x27b25a),_0x1719a8=new _0x20ae77(_0x27b25a);_0x5972f1['buttonView']['set']({'label':_0x243e93['label'],'icon':_0x243e93['icon']}),_0x243e93['actions']['forEach'](_0x8865d4=>{const _0x205e4e=new te(_0x27b25a,_0x5972f1),_0x1af7b5=new Zt(_0x27b25a);_0x1af7b5['set']({'label':_0x8865d4['label'],'icon':_0x8865d4['icon'],'role':'menuitem','isEnabled':_0x8865d4['isEnabled']}),_0x1af7b5['on']('execute',()=>{this['_executeQuickAction'](_0x8865d4);}),this['_actionButtons']['push']({'buttonView':_0x1af7b5,'action':_0x8865d4}),_0x1af7b5['delegate']('execute')['to'](_0x5972f1),_0x205e4e['children']['add'](_0x1af7b5),_0x1719a8['items']['add'](_0x205e4e);}),_0x5972f1['isEnabled']=_0x243e93['actions']['some'](_0x446f7f=>_0x446f7f['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x5972f1,'group':_0x243e93}),_0x5972f1['panelView']['children']['add'](_0x1719a8),_0x144c8b['children']['add'](_0x5972f1),_0x3766cb['items']['add'](_0x144c8b);}else{const _0x2f4a6d=_0x5ece88,_0xac8969=new te(_0x27b25a,_0x21062f),_0x37e203=new Zt(_0x27b25a);_0x37e203['set']({'label':_0x2f4a6d['label'],'icon':_0x2f4a6d['icon'],'role':'menuitem','isEnabled':_0x2f4a6d['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x37e203,'action':_0x2f4a6d}),_0x37e203['on']('execute',()=>{this['_executeQuickAction'](_0x2f4a6d);}),_0x37e203['delegate']('execute')['to'](_0x21062f),_0xac8969['children']['add'](_0x37e203),_0x3766cb['items']['add'](_0xac8969);}}),Object['values'](eh)['some'](_0x1e79d3=>this['editor']['plugins']['has'](_0x1e79d3))?_0x21062f['bind']('isEnabled')['to'](_0x2339a5):_0x21062f['set']({'isEnabled':!0x1}),_0x21062f['panelView']['children']['add'](_0x3766cb),_0x21062f;});}_executeQuickAction(_0x2178d9){const _0x158ed3=this['editor'];_0x158ed3['editing']['view']['focus'](),_0x158ed3['commands']['execute']('aiQuickAction',_0x2178d9);const _0xef2d77=_0x158ed3['ui']['view']['menuBarView'];_0xef2d77&&_0xef2d77['close']&&_0xef2d77['close']();}};function sh(_0x17e730){return'actions'in _0x17e730;}function nh(_0x527d7a,_0x442211){const _0x5c5661=_0x527d7a['plugins']['get']('AITabs')['view'];_0x5c5661['isVisible']=!0x0,_0x5c5661['activateTab'](_0x442211);}var rh=class extends _0x15beea{execute(_0x45fdcb){switch(this['_expandSelectionIfCollapsed'](),_0x45fdcb['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x301916=Es(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x301916});}this['_handleAIChatAction'](_0x45fdcb);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x43fdfd=Es(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x43fdfd});}this['_handleAIActionsAction'](_0x45fdcb);}}async _handleAIChatAction(_0x33ef48){const _0x45c2e8=this['editor']['plugins']['get']('AIChatController');if(nh(this['editor'],'chat'),'ask-ai'===_0x33ef48['id'])_0x45c2e8['removeSelectionFromChatContext'](),_0x45c2e8['addSelectionToChatContext'](this['editor']),_0x45c2e8['focusPromptInput']();else await _0x45c2e8['startConversation']({'modelId':_0x33ef48['model'],'contexts':this['_resolveActionContexts'](_0x33ef48)}),_0x45c2e8['removeSelectionFromChatContext'](),_0x45c2e8['addSelectionToChatContext'](this['editor']),_0x45c2e8['focusPromptInput'](),await _0x45c2e8['sendMessage']({'message':_0x33ef48['prompt']||_0x33ef48['displayedPrompt']||_0x33ef48['label'],'attributes':{'quickActionData':{'id':_0x33ef48['id']},'displayedPrompt':_0x33ef48['displayedPrompt']}});}_expandSelectionIfCollapsed(){const _0x4f807b=this['editor'],_0xe4f637=_0x4f807b['model']['document']['selection'];if(!_0xe4f637['isCollapsed'])return;const _0x8548d9=mt(_0xe4f637['getSelectedBlocks']())||_0x4f807b['model']['schema']['getLimitElement'](_0xe4f637);_0x4f807b['model']['change'](_0x3ad5c1=>{_0x3ad5c1['setSelection'](_0x8548d9,'in');});}_handleAIActionsActionLabel(_0x2f7831){return _0x2f7831['parent']?.['label']&&'other'!==_0x2f7831['parent']?.['id']?_0x2f7831['parent']['label']+':\x20'+_0x2f7831['label']:_0x2f7831['label'];}async _handleAIActionsAction(_0x528662){const _0xe06671=this['editor']['plugins']['get']('AIActions'),_0x57ab7c=this['_resolveActionContexts'](_0x528662);let _0x103eac;_0x103eac=_0x528662['prompt']?{'userMessage':_0x528662['prompt'],'model':_0x528662['model'],'contexts':_0x57ab7c}:_0x528662['context']?{'model':_0x528662['model'],'contexts':_0x57ab7c}:{'actionName':_0x528662['actionName']||_0x528662['id'],'args':_0x528662['args'],'contexts':_0x57ab7c};const _0x485329=this['_handleAIActionsActionLabel'](_0x528662);await _0xe06671['executeAction'](_0x103eac,_0x485329,_0x528662['icon']);}_resolveActionContexts(_0x377f6e){const _0xeb4e6e=_0x377f6e['parent']?.['id']?[_0x377f6e['id'],_0x377f6e['parent']['id']]:[_0x377f6e['id']];return this['editor']['plugins']['get'](fs)['contextLibrary']['resolveContext']({'feature':'quickActions','ids':_0xeb4e6e,'extraContexts':_0x377f6e['context']?[_0x377f6e['context']]:[],'context':new Yn()})['refs'];}},oh=class extends _0x4e7480{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x235417=this['editor'],_0x304078=new rh(this['editor']);if(_0x235417['commands']['add']('aiQuickAction',_0x304078),_0x235417['plugins']['has']('AIChat')){const _0x46701f=this['editor']['plugins']['get']('AIChatController');_0x235417['model']['document']['selection']['on']('change:range',(_0x3dc421,_0x38ad4)=>{_0x38ad4['directChange']&&_0x46701f['removeSelectionFromChatContext']();});}}},ah=class extends Vn{appendContent(_0x2df924,_0x522084='text'){'modification'===this['type']&&'text'===_0x522084&&(_0x522084=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x2df924,_0x522084);}updateChangeGroups(_0x3c63c5){const _0x2354e0=this['parsedContent']['get'](_0x3c63c5)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x3c63c5,_0x2354e0),this['changeGroups']=[],0x0==_0x2354e0['childNodes']['length'])return;on(this['documentContextContent']['get'](_0x3c63c5),this['parsedMergedContent']['get'](_0x3c63c5));const _0x5cd964=_0x3f58d0(this['documentContextContent']['get'](_0x3c63c5)['children']['map'](_0x1ac8d2=>({'node':_0x1ac8d2,'id':Ps(_0x1ac8d2,'data-id')})),_0x2354e0['children']['map'](_0xde6161=>({'node':_0xde6161,'id':Ps(_0xde6161,'data-id')||kt()})),{'comparator':(_0x2c00e9,_0x3445b2)=>_0x2c00e9['id']==_0x3445b2['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x5cd964['length']&&_0x5cd964[_0x5cd964['length']-0x1]['removed'];)_0x5cd964['pop']();}const _0x294699=_0x5cd964['map'](_0x1506f8=>{const _0x4bcfba=_0x1506f8['added']?'new':_0x1506f8['removed']?'removed':'modified';return{'node':_0x1506f8['value'][0x0]['node'],'type':_0x4bcfba,'id':_0x1506f8['value'][0x0]['id']};}),_0x25c6b0=this['_documentIdToSource']['get'](_0x3c63c5);this['changeGroups']['push']({'changes':_0x294699,'state':'pending','index':this['changeGroups']['length'],'editor':_0x25c6b0['editor'],'rootName':_0x25c6b0['rootName'],'documentId':_0x3c63c5});}_getDifferentChangeGroups(_0x352307,_0x2b3d8b){return _0x2b3d8b;}},hh=class extends Fn{content;['version'];editor;rootName;actionName;['args'];['userMessage'];['model'];contexts;['hasError']=!0x1;stoppedExplicitly=!0x1;constructor(_0x2a294b){super(_0x2a294b),this['content']=_0x2a294b['content'],this['version']=_0x2a294b['version'],this['editor']=_0x2a294b['editor'],this['rootName']=_0x2a294b['rootName'],this['actionName']=_0x2a294b['actionName'],this['args']=_0x2a294b['args'],this['userMessage']=_0x2a294b['userMessage'],this['model']=_0x2a294b['model'],this['contexts']=_0x2a294b['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(_0x1571df){const _0x24123a=this['editor']['config']['get']('collaboration.channelId'),_0x2d88ac=new ah({..._0x1571df,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x24123a,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x24123a,this['editor']]])});return this['replies']['push'](_0x2d88ac),_0x2d88ac['delegate'](...Gn)['to'](this),this['fire']('replyCreated',_0x2d88ac),_0x2d88ac;}},ch=class extends _0x5d2e05{constructor(_0x1224c7,_0xd88c94=!0x0,_0x2f8fd3=!0x0){super(_0x1224c7),this['set']('isEnabled',!0x1),_0xd88c94&&(this['applyButton']=this['_createButton'](Es(_0x1224c7,'AI_BALLOON_APPLY_BUTTON'),Ln),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x2f8fd3&&(this['suggestButton']=this['_createButton'](Es(_0x1224c7,'AI_BALLOON_SUGGEST_BUTTON'),_0xd88c94?Pn:Ln),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0xd88c94,'showSuggestButton':_0x2f8fd3}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}setButtonsVisibility({showApplyButton:_0x5e23e4,showSuggestButton:_0x59a0c6}){this['applyButton']&&(this['applyButton']['isVisible']=_0x5e23e4),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x59a0c6);}_createButton(_0x710820,_0x3d3710){const _0x54f4ea=new Mt(this['locale']);return _0x54f4ea['set']({'label':_0x710820,'class':_0x3d3710,'isVisible':!0x0,'withText':!0x0}),_0x54f4ea;}},lh=class extends _0x3a2edc{constructor(_0x5875e4){super(_0x5875e4),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(_0x5875e4,'AI_DISCLAIMER_TEXT')}]}]});}},uh=class extends _0x3a2edc{constructor(_0x33a13b){super(_0x33a13b),this['set']('isVisible',!0x0);const _0xc9e110=new Dr('small');_0xc9e110['isVisible']=!0x0;const _0x2e15d5=new _0x3a2edc(this['locale']);_0x2e15d5['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',_0x402358=>!_0x402358)]},'children':[_0xc9e110,_0x2e15d5]});}},dh=class extends Ma{['focusCycler'];['_config'];_contentWrapper;_streamableContentView;_toolbarView;['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];_keystrokes;_dialogContent;['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];_navigationPreviousButton;_navigationNextButton;_navigationTryAgainButton;_navigationCounter;constructor(_0x4b4eea,_0x1dccff){super(_0x4b4eea),this['set']('isBusy',!0x1),this['set']('isTargetReadOnly',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x1dccff,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 _0x16cf3f(),this['_addContentWrapper'](_0x1dccff),this['_addDisclaimerView'](),this['_addToolbar'](_0x1dccff),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'](_0x1dccff);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x3662ec of this['_focusables'])this['_focusTracker']['add'](_0x3662ec['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}destroy(){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x40e3d2){-0x1===_0x40e3d2?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}setIsLoading(_0x52b82c){this['_isLoading']=_0x52b82c;}setErrorState(){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}clearErrorState(){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x1d8f4b){super['showError'](_0x1d8f4b),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x3f9c17){super['showBlockingError'](_0x3f9c17),this['setErrorState']();}addMiniToolbarItem(_0x31b33b){this['_miniToolbarView']['items']['has'](_0x31b33b)||this['_miniToolbarView']['items']['add'](_0x31b33b);}removeMiniToolbarItem(_0x30bbf5){this['_miniToolbarView']['items']['has'](_0x30bbf5)&&this['_miniToolbarView']['items']['remove'](_0x30bbf5);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}_toggleToolbarButtonsVisibility({showApplyButton:_0x5c5bc9,showSuggestButton:_0x1816ea}){_0x5c5bc9=_0x5c5bc9&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x1816ea=_0x1816ea&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x5c5bc9,'showSuggestButton':_0x1816ea});}async updateContent(_0x36c5f3){await this['_streamableContentView']['update'](_0x36c5f3);}finalizeContent(){this['_streamableContentView']['cleanUpStreamingArtifacts']();}clearContent(){this['_streamableContentView']['clear']();}_addContentWrapper(_0x4f3039){this['_contentWrapper']=new _0x3a2edc(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'](_0x4f3039['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new lh(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x4652eb,showSuggestButton:_0x3cbb22}){this['_toolbarView']=new ch(this['locale'],_0x4652eb,_0x3cbb22),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',(_0xee86e8,_0x4025c1,_0x13ee08,_0xcdbac5)=>!(_0xee86e8||_0x4025c1||_0x13ee08||_0xcdbac5)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x4652eb,'showSuggestButton':_0x3cbb22}),this['_dialogContent']['add'](this['_toolbarView']);}_createMiniToolbar(_0xafd5ca){return this['_miniToolbarView']=new Ba(this['locale'],_0xafd5ca),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',(_0x40c73a,_0xda3620)=>!(_0x40c73a||_0xda3620)),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 _0x1e718b=new Mt(this['locale']),_0x4dd6c8=new Mt(this['locale']),_0x3e8051=new _h(this['locale']),_0x4c5fdb=new Mt(this['locale']);_0x1e718b['set']({'icon':_0x2a5ea3,'label':Es(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Dn}),_0x4dd6c8['set']({'icon':_0x212a4e,'tooltip':Es(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Dn}),_0x4c5fdb['set']({'icon':_0x43814d,'tooltip':Es(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Dn}),_0x1e718b['bind']('isEnabled')['to'](this,'isBusy',_0x55055d=>!_0x55055d),_0x1e718b['on']('execute',()=>{this['fire']('tryAgain');}),_0x4dd6c8['bind']('isEnabled')['to'](this,'isBusy',_0x3e27e9=>!_0x3e27e9),_0x4dd6c8['on']('execute',()=>{this['fire']('showPrevious');}),_0x4c5fdb['bind']('isEnabled')['to'](this,'isBusy',_0xcb9abc=>!_0xcb9abc),_0x4c5fdb['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x4dd6c8,this['_navigationCounter']=_0x3e8051,this['_navigationNextButton']=_0x4c5fdb,this['_navigationTryAgainButton']=_0x1e718b;}updateMiniToolbarButtons(_0x13602b,_0x407336){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x291057=_0x13602b>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x291057){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x314061=_0x13602b-_0x407336;this['_navigationCounter']['setInteractionCount'](_0x314061+'/'+_0x13602b),this['_navigationPreviousButton']['isEnabled']=_0x407336<_0x13602b-0x1,this['_navigationNextButton']['isEnabled']=_0x407336>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(_0x283968){this['_isLoading']=_0x283968;}resetShowChangesButton(){this['_miniToolbarView']['isShowChangesOn']=!0x1;}_setupMiniToolbarPositioning(){const _0x31ebb8=this['_streamableContentView']['element'],_0xd6b97=this['_miniToolbarView']['element'],_0x5566b5=()=>{wt['window']['requestAnimationFrame'](()=>{const _0x4a7cf1=_0x31ebb8['offsetWidth']-_0x31ebb8['clientWidth'];_0xd6b97['style']['right']='calc('+_0x4a7cf1+'px\x20+\x20var(--ck-spacing-large))';});};_0x5566b5(),this['_miniToolbarResizeObserver']=new pt(_0x31ebb8,()=>{_0x5566b5();});}_initializeScrollManager(){const _0x1420f7=this['_getScrollableElement']();_0x1420f7&&!this['_scrollManager']&&(this['_scrollManager']=new ao(_0x1420f7));}_getScrollableElement(){return this['_streamableContentView']['element'];}},_h=class extends _0x3a2edc{constructor(_0x23b180){super(_0x23b180);const _0x139e14=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x139e14['to']('interactionCount')}]});}setInteractionCount(_0x4f1d7f){this['set']('interactionCount',_0x4f1d7f);}},gh=class extends _0x4e7480{static get requires(){return[Is,Nn,Ut,tn,Va,_0x14613c];}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(_0x3e8494){super(_0x3e8494),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(_0x3787be,_0xd8b4a,_0x3d63de){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x393c38,anchorData:_0x373906,root:_0x117249}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x3787be,_0x393c38,_0x373906,_0x117249,_0xd8b4a,_0x3d63de);}const {modelFragment:_0x2c16b9,anchorData:_0x249386,root:_0x1bcf42}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x3787be,_0x2c16b9,_0x249386,_0x1bcf42,_0xd8b4a,_0x3d63de);}async destroy(){return this['_stopInteraction'](),super['destroy']();}_createActionsBalloonView(){const _0x12f63b=this['editor']['plugins']['has']('TrackChanges');let _0xb84fee=this['editor']['config']['get']('ai.availableReplyActions')||[...Or];_0x12f63b||(_0xb84fee=_0xb84fee['filter'](_0x37b21a=>'insertSuggestion'!=_0x37b21a));const _0x1dd456=this['editor']['commands']['get']('trackChanges'),_0x4599d3=new dh(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x12f63b,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0xb84fee});return _0x4599d3['bind']('isBusy')['to'](this),_0x4599d3['bind']('isTargetReadOnly')['to'](this['editor'],'isReadOnly'),_0x1dd456&&_0x4599d3['bind']('isTrackChangesOn')['to'](_0x1dd456,'value'),_0x4599d3['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x4599d3['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x4599d3['on']('showNext',()=>{this['_navigateToNext']();}),_0x4599d3;}_normalizeSelectionStart(){const _0x45a85b=this['editor']['model'],_0xbd930a=_0x45a85b['document']['selection'],_0x2cb88d=_0xbd930a['getFirstRange']();if(!_0x2cb88d||_0x2cb88d['isCollapsed'])return;const _0x4cd169=mt(_0xbd930a['getSelectedBlocks']());if(!_0x4cd169)return;const _0x243689=_0x45a85b['createPositionAt'](_0x4cd169,0x0);_0x243689['isAfter'](_0x2cb88d['start'])&&_0x45a85b['change'](_0xb0fac3=>{_0xb0fac3['setSelection'](_0xb0fac3['createRange'](_0x243689,_0x2cb88d['end']));});}_getExecuteDataRegular(){const _0x725bde=this['editor']['model']['document']['selection'],_0x25f3fe=_0x725bde['getFirstRange']()['start']['root'];if(_0x725bde['isCollapsed']){const _0x1c6e1e=mt(_0x725bde['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x725bde);this['editor']['model']['change'](_0x5053ea=>{_0x5053ea['setSelection'](_0x1c6e1e,'in');});}this['_normalizeSelectionStart']();const _0x195a58=_0x725bde['getFirstRange'](),_0x4f3927=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x725bde),_0x195a58['start'],_0x195a58['end']);this['_copyMarkersToFragment'](_0x4f3927,_0x725bde,{'isTableSelection':!0x1});const _0x5d2b5c=_0x725bde['getFirstRange']()['start'],_0xe2f517=new Map();let _0x428c8e=_0x4f3927;for(let _0x1e3629=0x0;_0x1e3629<_0x5d2b5c['path']['length'];_0x1e3629++)_0xe2f517['set'](_0x428c8e,_0x5d2b5c['path'][_0x1e3629]),_0x428c8e=_0x428c8e['getChild'](0x0);return{'modelFragment':_0x4f3927,'anchorData':_0xe2f517,'root':_0x25f3fe};}_getExecuteDataInTable(){const _0x47faaa=this['editor']['model']['document']['selection'],_0x45966d=this['editor']['plugins']['get']('TableSelection'),_0x163721=_0x47faaa['getFirstRange']()['start']['root'],_0x51a05c=_0x45966d['getSelectionAsFragment'](),_0x43abce=_0x47faaa['getFirstRange']()['start']['parent']['parent'],_0x274a57=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x43abce),this['editor']['model']['createPositionAfter'](_0x43abce)),_0x2b9012=this['_wrapWithCommonAncestors'](_0x51a05c,_0x274a57['start'],_0x274a57['end']);this['_copyMarkersToFragment'](_0x2b9012,_0x47faaa,{'isTableSelection':!0x0});const _0x2c552e=_0x47faaa['getFirstRange']()['start'],_0x2c2db8=new Map();let _0x137541=_0x2b9012;for(let _0x1549d4=0x0;_0x1549d4<_0x2c552e['path']['length'];_0x1549d4++)if(_0x2c2db8['set'](_0x137541,_0x2c552e['path'][_0x1549d4]),_0x1549d4<_0x2c552e['path']['length']-0x1)_0x137541=_0x137541['getChild'](0x0);else{let _0x106cf2=_0x137541['nextSibling'];for(;_0x106cf2;)_0x2c2db8['set'](_0x106cf2,_0x2c552e['path'][_0x1549d4]),_0x106cf2=_0x106cf2['nextSibling'];}return{'modelFragment':_0x2b9012,'anchorData':_0x2c2db8,'root':_0x163721};}async _executeAction(_0x46a264,_0x543b2c,_0x4b313d,_0x50f074,_0x268b5b,_0x485808){const _0x3ba267=this['editor']['plugins']['get'](tn),_0x44be6c=this['editor']['plugins']['get'](Va),_0x5858ea=this['editor']['model']['document']['selection'],_0x30365b=await _0x3ba267['modelToDataWithIds'](_0x543b2c,this['editor'],_0x50f074['rootName']),_0x2a4889=this['editor']['model']['document']['version'],_0x23fe6c=[..._0x5858ea['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x44be6c['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x268b5b,'icon':_0x485808||_0x4b081c,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x23fe6c,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x44be6c),this['_interactionParams']={'action':_0x46a264,'content':_0x30365b,'version':_0x2a4889,'aiBalloon':_0x44be6c,'modelFragment':_0x543b2c,'anchorData':_0x4b313d,'root':_0x50f074},this['_setupApplyListeners'](),this['listenTo'](_0x44be6c,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x44be6c,'dialogClosed',(_0x3bd121,{id:_0x4a8dde})=>{if('aiActionsBalloon'===_0x4a8dde){for(const _0x59b234 of this['_interactions']){if(0x0===_0x59b234['replies']['length']||_0x59b234['stoppedExplicitly'])continue;const _0x138a7e=_0x59b234['replies'][_0x59b234['replies']['length']-0x1],_0x18bb10=_0x138a7e['changeGroups'][0x0];_0x18bb10&&'pending'===_0x18bb10['state']&&_0x138a7e['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x44be6c);}}),this['_createInteraction'](_0x30365b,_0x2a4889,_0x44be6c,_0x46a264);}_setupApplyListeners(){if(!this['_interactionParams'])return;const {modelFragment:_0x201bb9,anchorData:_0x33a2bd,root:_0x3d683e}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x201bb9,_0x33a2bd,_0x3d683e,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x201bb9,_0x33a2bd,_0x3d683e,!0x0);});}_wrapWithCommonAncestors(_0x24f87c,_0x145c3f,_0x5cd023){const _0x39a8c3=this['editor']['model']['createRange'](_0x145c3f,_0x5cd023)['getCommonAncestor'](),_0x292447=_0x39a8c3['is']('documentFragment')?[]:_0x39a8c3['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x292447['length']){const _0x9bcabe=_0x292447['map'](_0x52e077=>_0x52e077['_clone'](!0x1));for(let _0x42f222=0x1;_0x42f222<_0x9bcabe['length'];_0x42f222++)_0x9bcabe[_0x42f222-0x1]['_appendChild'](_0x9bcabe[_0x42f222]);return _0x9bcabe[_0x9bcabe['length']-0x1]['_appendChild'](_0x24f87c),new _0x5a34ce(_0x9bcabe[0x0]);}return _0x24f87c;}_copyMarkersToFragment(_0x4ca9d9,_0x394cb8,_0x4d122e={'isTableSelection':!0x1}){const _0x302a79=this['editor']['model'],_0x12b956=Array['from'](_0x394cb8['getRanges']()),_0x51979d=_0x394cb8['getFirstRange']()['start'];for(const _0x52064d of _0x302a79['markers']){if(_0x52064d['name']['startsWith']('ai-selection')||!_0x52064d['affectsData'])continue;const _0x2fafe9=_0x52064d['getRange']();if(!_0x12b956['some'](_0x10ee6d=>_0x10ee6d['containsRange'](_0x2fafe9,!0x0)))continue;const _0x423e17=this['_regularCalculateMarkerPath'](_0x2fafe9['start'],_0x51979d,_0x4d122e['isTableSelection']),_0x131239=this['_regularCalculateMarkerPath'](_0x2fafe9['end'],_0x51979d,_0x4d122e['isTableSelection']),_0x541895=_0x302a79['createPositionFromPath'](_0x4ca9d9,_0x423e17),_0x1f4f27=_0x302a79['createPositionFromPath'](_0x4ca9d9,_0x131239);if(!_0x541895['isEqual'](_0x1f4f27)){const _0x733517=_0x302a79['createRange'](_0x541895,_0x1f4f27);_0x4ca9d9['markers']['set'](_0x52064d['name'],_0x733517);}}}_regularCalculateMarkerPath(_0x26772f,_0x504c60,_0x49d2e5=!0x1){const _0xa4adca=[..._0x26772f['path']['slice']()];for(let _0x23c221=0x0;_0x23c221<Math['max'](_0x504c60['path']['length'],_0x26772f['path']['length']);_0x23c221++){const _0x58c2f4=_0x504c60['path'][_0x23c221]||0x0,_0x11f2c5=(_0x26772f['path'][_0x23c221]||0x0)-_0x58c2f4;if(_0xa4adca[_0x23c221]=_0x11f2c5,0x0!==_0x11f2c5&&!_0x49d2e5)break;}return _0xa4adca;}async _createInteraction(_0x49adb6,_0x3724fc,_0x268b54,_0x4c658d){const _0x4e1755=this['editor'],_0x4faf74=_0x4e1755['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0x4c658d,'content':_0x49adb6,'version':_0x3724fc,'aiBalloon':_0x268b54,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x4faf74});const _0x374e85=new hh({'connector':this['_aiConnector'],'locale':_0x4e1755['locale'],'content':_0x49adb6,'version':_0x3724fc,'editor':_0x4e1755,'rootName':_0x4faf74['rootName'],..._0x4c658d});this['_interactions']['push'](_0x374e85);const _0x185aa2=(_0x569917,_0x4cf5f8=!0x1,_0x10210d='streaming')=>{const {isDone:_0x3cdfcc}=_0x569917;return this['_promiseQueue']['enqueue'](async _0x364afc=>{try{if(this['_isUnsupportedInlineRootChange'](_0x569917,_0x4faf74))return this['_actionsBalloonView']['showBlockingError'](Es(_0x4e1755['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')),void(_0x3cdfcc&&this['_actionsBalloonView']['finalizeContent']());const _0x3696b3=ln({'changeGroups':_0x569917['changeGroups'],'documentContextContent':_0x569917['documentContextContent'],'showDiff':_0x4cf5f8,'trimUnchanged':!0x1});_0x3696b3['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x3696b3[0x0],'renderingStrategy':_0x10210d,'abortSignal':_0x364afc}),_0x3cdfcc&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x300894){if(kn(_0x300894))return;throw _0x300894;}});};_0x374e85['on']('replyCreated',(_0x1f8bce,_0x33cfec)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x185aa2(_0x33cfec)['catch'](_0x2c30f8=>{this['_reporter']['logError'](_0x2c30f8,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x374e85,_0x2c30f8);});}),_0x374e85['on']('replyContentUpdated',(_0x45e2ad,_0x1dab72)=>{_0x185aa2(_0x1dab72)['catch'](_0x334266=>{this['_reporter']['logError'](_0x334266,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x374e85,_0x334266);});}),_0x374e85['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x4196b9){this['_reporter']['logError'](_0x4196b9,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x374e85,_0x4196b9);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x1a8c31,{showDiff:_0x16f159})=>{try{this['_balloonShowDiff']=_0x16f159;const _0x3e4630=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x3e4630&&await _0x185aa2(_0x3e4630,_0x16f159,'static');}catch(_0x10f79f){this['_reporter']['logError'](_0x10f79f,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x374e85,_0x10f79f);}}),_0x374e85['on']('replyChangeGroupStateUpdated',()=>{const _0x39a1a0={'positiveCount':_0x374e85['replies']['reduce']((_0x3fbf3c,_0x115e24)=>_0x3fbf3c+_0x115e24['changeGroups']['filter'](_0x33e897=>'accepted'===_0x33e897['state'])['length'],0x0),'totalCount':_0x374e85['replies']['reduce']((_0x22b589,_0x50fcf8)=>_0x22b589+_0x50fcf8['changeGroups']['length'],0x0)},_0x3bbf6b=_0x374e85['actionCallId'],_0x12a39a=_0x374e85['actionName'];_0x12a39a?this['_aiConnector']['upsertAIActionRating'](_0x12a39a,_0x3bbf6b,_0x39a1a0):this['_aiConnector']['upsertCustomAIActionRating'](_0x3bbf6b,_0x39a1a0);}),this['_setLoadingState']();try{const _0x32dd1e=await _0x374e85['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x32dd1e;}catch(_0x1d15a7){kn(_0x1d15a7)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x1d15a7,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x374e85,_0x1d15a7);}}_isUnsupportedInlineRootChange(_0xa5070d,_0x9e70fc){const _0x4e9910=this['editor'];return!!Gs(_0x4e9910,_0x9e70fc['rootName'])&&!Ys(_0x4e9910,new _0x577dfe((_0xa5070d['changeGroups'][0x0]?.['changes']??[])['filter'](_0x407352=>'removed'!==_0x407352['type'])['map'](_0x445658=>_0x445658['node']['cloneNode'](!0x0))));}['_applyChanges'](_0x1fc25a,_0x549c79,_0x5b1e3d,_0x4560f9){const _0x3b6cc3=this['editor'];if(_0x4560f9&&!_0x3b6cc3['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',null);const _0x387c2a=this['editor']['plugins']['get'](_0x14613c),_0x294e78=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x294e78||!_0x294e78['replies']['length'])return;const _0x36f918=_0x294e78['replies'][_0x294e78['replies']['length']-0x1];if(this['_isUnsupportedInlineRootChange'](_0x36f918,_0x5b1e3d))return void this['_actionsBalloonView']['showBlockingError'](Es(_0x3b6cc3['locale'],'AI_SUGGESTION_NO_PARTS_WARNING'));_0x36f918['setChangeGroupState'](0x0,'accepted');const _0x47a7b9=Jn({'documentSuggestions':Zn({'groups':[_0x36f918['changeGroups'][0x0]],'documentContextContent':_0x36f918['documentContextContent'],'documents':_0x294e78['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x387c2a,'documentCompareOptions':{'anchor':_0x3b6cc3['model']['createPositionAt'](_0x1fc25a,0x0),'markDeletions':_0x4560f9}})['values']()['next']()['value']??[],_0x1dd2bb=this['_filterOperationsOutsideRange'](_0x47a7b9,_0x549c79);for(const _0x34e263 of _0x1dd2bb)this['_anchorOperation'](_0x549c79,_0x34e263,_0x5b1e3d);const _0x5c9cc4=_0x294e78['getDocumentContext']()['documents'][0x0]['version'],_0x3c8dae=_0x1b55c4(_0x1dd2bb,_0x3b6cc3['model']['document']['history']['getOperations'](_0x5c9cc4),{'document':_0x3b6cc3['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];mn(_0x3c8dae,'quickActions');try{_0x3b6cc3['model']['change'](_0x494a82=>{_0x494a82['setSelection'](_0x3b6cc3['model']['document']['selection']['focus']),_0x4560f9?_0x3b6cc3['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x3c8dae):_0x387c2a['applyOperations'](_0x494a82,_0x3c8dae);});}catch(_0x441b7b){throw this['_reporter']['logError'](new yn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x441b7b})),_0x441b7b;}this['editor']['plugins']['get']('AIBalloon')['close']();}_filterOperationsOutsideRange(_0x399f11,_0x2e0c09){return _0x399f11['filter'](_0x1a2b5b=>{if('rename'==_0x1a2b5b['type']){const _0x2cba45=_0x1a2b5b['position']['nodeAfter'];return!_0x2e0c09['has'](_0x2cba45);}if(_0x1a2b5b['type']['indexOf']('Attribute')>-0x1){const _0x40a869=_0x1a2b5b['range']['start']['nodeAfter'];return!_0x2e0c09['has'](_0x40a869);}return!0x0;});}_anchorOperation(_0x1623dc,_0x112f01,_0x1779c5){const _0x58ecad=_0x112f01['clone']();for(const _0x19e6ff in _0x112f01){const _0x10f865=_0x112f01[_0x19e6ff];_0x10f865 instanceof _0x4b6f52?_0x112f01[_0x19e6ff]=new _0x4b6f52(_0x23e641(_0x10f865['start']),_0x23e641(_0x10f865['end'])):_0x10f865 instanceof _0x3a6639&&(_0x112f01[_0x19e6ff]=_0x23e641(_0x10f865));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x58ecad['type'])){if(_0x58ecad['isDocumentOperation']=!0x1,_0x58ecad['baseVersion']=null,'remove'==_0x58ecad['type']){const _0x2375da=_0x58ecad['sourcePosition'],_0x3d9c04=_0x58ecad['howMany'];new _0x150372(_0x2375da,_0x3d9c04)['_execute']();}else _0x58ecad['_execute']();}function _0x23e641(_0x43e359){if('$graveyard'==_0x43e359['root']['rootName'])return _0x43e359;const _0x446cd9=[];let _0x5d1226=_0x43e359['root'];for(let _0x48ad25=0x0;_0x48ad25<_0x43e359['path']['length'];_0x48ad25++){const _0x438254=_0x1623dc['get'](_0x5d1226)||0x0;_0x446cd9[_0x48ad25]=_0x43e359['path'][_0x48ad25]+_0x438254,_0x5d1226=_0x5d1226['getChildAtOffset'](_0x43e359['path'][_0x48ad25]);}return new _0x3a6639(_0x1779c5,_0x446cd9,_0x43e359['stickiness']);}}_refreshInteraction(){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x156455,content:_0xed342,version:_0x5525ce,aiBalloon:_0x15c467}=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'](_0xed342,_0x5525ce,_0x15c467,_0x156455)['catch'](_0x24bfd7=>{this['_reporter']['logError'](_0x24bfd7,{'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 _0x1e1429=this['_interactions']['length'];this['_currentInteractionIndex']<_0x1e1429-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}_navigateToNext(){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async _displayInteractionAtIndex(_0xa53c82){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0xa53c82;const _0x14b9a1=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x14b9a1)return;if(_0x14b9a1['hasError'])return this['_setErrorState'](_0x14b9a1),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x14b9a1['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x34baee=_0x14b9a1['replies'][_0x14b9a1['replies']['length']-0x1];if(_0x34baee)try{const _0x3d8e8b=ln({'changeGroups':_0x34baee['changeGroups'],'documentContextContent':_0x34baee['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x53ffc2=>setTimeout(_0x53ffc2,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x3d8e8b[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x4fb0e4){this['_reporter']['logError'](_0x4fb0e4,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}_setLoadingState(){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async _setErrorState(_0x483032,_0x693b0b){if(void 0x0!==_0x693b0b&&kn(_0x693b0b))return;const _0x2b50c5=Es(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x2b50c5),_0x483032['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 _0x4e7480{static get requires(){return[ih,oh,gh];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xd428bf){super(_0xd428bf),_0xd428bf['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Ih=class extends _0x3a2edc{resultResponseView;acceptButtonView;dismissButtonView;infoButtonView;outdatedButtonView;constructor(_0x53d97a,_0x5f4c6b){super(_0x53d97a),this['id']=_0x5f4c6b,this['set']('status','pending'),this['set']('changeId',_0x5f4c6b),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',(_0x3a1c39,_0x38a904)=>{_0x38a904&&_0x38a904['target']&&'A'===_0x38a904['target']['tagName']&&_0x38a904['preventDefault'](),this['fire']('activateChange',{'id':_0x5f4c6b,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x5f4c6b,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x5f4c6b,'source':this});}),this['on']('change:showDiff',()=>this['_syncResponseVisibility']());}['render'](){super['render'](),this['_syncResponseVisibility']();}setItemAsActive(){this['isActive']=!0x0;}setItemAsInactive(){this['isActive']=!0x1;}_createResultResponseView(){const _0x1c09cd=new _0x3a2edc(this['locale']);return _0x1c09cd['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response']}}),_0x1c09cd;}updateResponseContent(_0x5af854,_0x1209c0){const _0x445930=_0x1209c0||'div',_0x40699f=this['resultResponseView']['element'];if(_0x40699f['tagName']['toLowerCase']()!==_0x445930){const _0x62cf28=new _0x165444({'tag':_0x445930,'attributes':{'class':_0x40699f['className']}})['render']();_0x40699f['replaceWith'](_0x62cf28),this['resultResponseView']['element']=_0x62cf28,this['_syncResponseVisibility']();}this['resultResponseView']['element']['innerHTML']=_0x5af854;}_syncResponseVisibility(){this['resultResponseView']['element']?.['classList']['toggle']('ck-hidden',!this['showDiff']);}_createAcceptButtonView(){const _0x5c7375=new Mt(this['locale']);return _0x5c7375['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x5c7375['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x2b5322=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x2b5322['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x42557b=>'pending'!==_0x42557b&&'accepted'!==_0x42557b),this['bindTemplate']['if']('status',Pn,_0x314c12=>'pending'===_0x314c12),this['bindTemplate']['if']('status',Dn,_0x44e79a=>'pending'!==_0x44e79a),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x5ca7d5=>'accepted'===_0x5ca7d5)]}}),this['on']('change:status',(_0x939cea,_0x54c275,_0x36388e)=>{_0x5c7375['isEnabled']='pending'===_0x36388e,'accepted'===_0x36388e&&(_0x5c7375['label']=Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x5c7375['icon']=_0x4ae57d);}),_0x5c7375;}_createDismissButtonView(){const _0x16a414=new Mt(this['locale']);return _0x16a414['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x16a414['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x2c044d=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x2c044d['stopPropagation']();})},'attributes':{'class':[Dn,this['bindTemplate']['if']('status','ck-hidden',_0x4b456d=>'pending'!==_0x4b456d&&'rejected'!==_0x4b456d),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x43637b=>'pending'===_0x43637b),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x46d06=>'rejected'===_0x46d06)]}}),this['on']('change:status',(_0x34825c,_0x21f73e,_0x470d43)=>{_0x16a414['isEnabled']='pending'===_0x470d43,'rejected'===_0x470d43&&(_0x16a414['label']=Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x16a414['icon']=_0x1e5963);}),_0x16a414;}_createInfoButtonView(){const _0x47a8b2=new Mt(this['locale']);return _0x47a8b2['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x33bdef,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Dn+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x47a8b2['bind']('isOn')['to'](this,'isInfoToggleOn',_0x44114a=>_0x44114a),_0x47a8b2['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x47a8b2;}_createOutdatedButtonView(){const _0x42720f=new Mt(this['locale']);return _0x42720f['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0x30ead8,'withText':!0x0,'isEnabled':!0x1}),_0x42720f['extendTemplate']({'attributes':{'class':[Dn,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x18a260=>'outdated'!==_0x18a260)],'disabled':'disabled'}}),_0x42720f;}},ph=class extends xt{resultItemView;_pinnedRectIndex=void 0x0;_pinnedTargetElement=void 0x0;_pinnedTargetChangeId=void 0x0;constructor(_0xd40927,_0x19838f){super(_0xd40927),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']()),_0x19838f['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}updateContent(_0x5964d7){this['resultItemView']['changeId']=_0x5964d7['id'],this['resultItemView']['updateResponseContent'](_0x5964d7['contentDiffed'],_0x5964d7['wrapperTag']);}['showBalloon'](_0x4b190a,_0x48a637,_0x44f149,_0x275291,_0x135db4,_0x24529c){const _0x56afc1=_0x48a637();if(!_0x56afc1)return;this['updateContent'](_0x4b190a),this['show']();const _0x3198c8=Array['from'](_0x56afc1['getClientRects']())['reverse'](),_0x37003f=this['_getPointedRectIndexFromEvent'](_0x44f149,_0x3198c8),_0x270e4f=_0x3198c8[_0x37003f??0x0];'click'===_0x275291?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x48a637(),_0x37003f,_0x4b190a['id'],_0x135db4,_0x24529c)||_0x270e4f})):'hover'===_0x275291&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x48a637(),_0x37003f,_0x4b190a['id'])||_0x270e4f}));}['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(){_0x5b168d({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x19f67e=[this['element']];return this['_pinnedTargetElement']&&_0x19f67e['push'](this['_pinnedTargetElement']),_0x19f67e;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}_createContentView(){const _0x2adb64=new _0x3a2edc();return this['resultItemView']=new Ih(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x2adb64['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']]}]}),_0x2adb64;}_getBestRectPositionOnClick(_0x5269f8,_0x11de09,_0x401441,_0x17a0b6,_0x4e8f2b){if(!_0x5269f8)return null;const _0x15ec07=this['position']['replace']('arrow_',''),_0x466ff9=Array['from'](_0x5269f8['getClientRects']());let _0x545f89,_0x30da93=_0x466ff9['reverse']();return void 0x0!==_0x11de09&&this['_isPinnedRectVisible'](_0x30da93[_0x11de09],_0x17a0b6,_0x4e8f2b)?(_0x545f89=_0x30da93[_0x11de09],this['_pinnedRectIndex']=_0x11de09):this['_isPinnedRectVisible'](_0x30da93[0x0],_0x17a0b6,_0x4e8f2b)&&void 0x0===_0x11de09?_0x545f89=_0x30da93[0x0]:(_0x30da93='s'==_0x15ec07[0x0]?[..._0x466ff9]['reverse']():_0x466ff9,_0x30da93['forEach'](_0x13efcb=>{this['_isPinnedRectVisible'](_0x13efcb,_0x17a0b6,_0x4e8f2b)&&(_0x545f89=_0x13efcb);})),this['_pinnedTargetChangeId']=_0x401441,this['_pinnedTargetElement']=_0x5269f8,_0x545f89||_0x5269f8['getBoundingClientRect']();}_getBestRectPositionOnHover(_0xcc88cb,_0x258c14,_0x37b225){if(!_0xcc88cb)return null;const _0x207515=Array['from'](_0xcc88cb['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x258c14&&this['_pinnedTargetChangeId']!==_0x37b225?(this['_pinnedRectIndex']=_0x258c14,this['_pinnedTargetElement']=_0xcc88cb,this['_pinnedTargetChangeId']=_0x37b225,_0x207515[_0x258c14]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x37b225?_0xcc88cb!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x207515[this['_pinnedRectIndex']]:void 0x0!==_0x258c14&&this['_pinnedTargetChangeId']!==_0x37b225?(this['_pinnedRectIndex']=_0x258c14,this['_pinnedTargetElement']=_0xcc88cb,this['_pinnedTargetChangeId']=_0x37b225,_0x207515[_0x258c14]):_0xcc88cb['getBoundingClientRect']();}_getPointedRectIndexFromEvent(_0x20231b,_0x1c42fc){if(_0x20231b)for(let _0x3a09e6=0x0;_0x3a09e6<_0x1c42fc['length'];_0x3a09e6++){const _0x53c242=_0x1c42fc[_0x3a09e6];if(_0x20231b['clientX']>=_0x53c242['left']-0x3&&_0x20231b['clientX']<=_0x53c242['right']+0x3&&_0x20231b['clientY']>=_0x53c242['top']-0x3&&_0x20231b['clientY']<=_0x53c242['bottom']+0x3)return _0x3a09e6;}}_isPinnedRectVisible(_0x41b2a4,_0x4eb0ae,_0x42d941){const _0x1d5cd5=new It(_0x41b2a4),_0x341742=_0x4eb0ae||document['documentElement'],_0x2f0ecb=_0x1d5cd5['getIntersection'](Tt(_0x42d941)),_0x18d8c3=new It(_0x341742)['getIntersection'](_0x1d5cd5);return!!(_0x2f0ecb&&_0x18d8c3&&_0x1d5cd5['width']>0x0);}};const Eh=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var mh=class extends _0x57f218{['_mainView'];_balloonSuggestionView;_bodyCollection;static get requires(){return[gs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x12da1f){super(_0x12da1f),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 _0x1e9402=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x1e9402);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}setAvailableChecks(_0x383e53){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x1028e2=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x383e53,_0x1028e2);}this['_mainView']['showReviewCheckListView']();}showReviewCheckList(){this['fire']('getReviewCheckList');}showCheckRunResults(_0x4c4e24){_0x4c4e24&&('error-general'!==_0x4c4e24['status']?'error-chunk'!==_0x4c4e24['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}showCheckRunResult(_0x2e4fe8){this['_mainView']['addCheckRunResult'](_0x2e4fe8);}showGeneralResultsErrorView(){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x46dfc5){this['_mainView']['showGeneralReviewCoreErrorView'](_0x46dfc5??Es(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}showUnsupportedInlineChangeView(){this['_mainView']['showUnsupportedInlineChangeView']();}setCheckResultTitle(_0xf355a1,_0x34e4bb){this['_mainView']['reviewCheckResultsView']['setTitle'](_0xf355a1,_0x34e4bb);}setAcceptAllEnabled(_0x5f2805){this['_mainView']['reviewCheckResultsView']['setAcceptAllEnabled'](_0x5f2805);}setActiveStateInResults(_0x1a75a1){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x2da8c3=>{_0x2da8c3['id']===_0x1a75a1&&_0x2da8c3['setItemAsActive']();});}resetActiveStateInResults(){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x55f140=>_0x55f140['setItemAsInactive']());}updateChangeState(_0x11da56,_0x473397){'accepted'===_0x473397||'rejected'===_0x473397||'outdated'===_0x473397?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x11da56,_0x473397):this['_mainView']['reviewCheckResultsView']['showResult'](_0x11da56,_0x473397);}showReviewCompletedView(){this['_mainView']['showReviewCompletedView']();}showActionsWhenResultIsReady(){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}hideActionsWhenResultIsReady(){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x4c8161,_0x23f060,_0x57dedb,_0x3651eb,_0x44c425,_0x26423e){this['_balloonSuggestionView']['showBalloon'](_0x4c8161,_0x23f060,_0x57dedb,_0x3651eb,_0x44c425,_0x26423e);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}getChangeElement(_0x3e9912){const _0x4da1b2=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x4bcf67=>_0x4bcf67['id']===_0x3e9912);return _0x4da1b2?_0x4da1b2['element']:null;}deactivateChange(){this['_balloonSuggestionView']['deactivateChange']();}},Th=class extends _0x3a2edc{constructor(_0x4d76b5){super(_0x4d76b5),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x4bc477=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x4bc477['if']('isVisible','ck-hidden',_0x38de58=>!_0x38de58)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x4bc477['to']('errorMessage')}]}]});}},wh=class extends _0x3a2edc{['reviewCoreHeader'];['generalErrorView'];reviewCheckListView;reviewCheckResultsView;reviewCompletedView;constructor(_0x4a35f2,_0x512869){super(_0x4a35f2),this['reviewCoreHeader']=_0x512869['header'],this['generalErrorView']=new Th(_0x4a35f2),this['reviewCheckListView']=_0x512869['list'],this['reviewCheckListView']['delegate'](...Eh)['to'](this),this['reviewCheckResultsView']=_0x512869['results'],this['reviewCheckResultsView']['delegate'](...Eh)['to'](this),this['reviewCompletedView']=_0x512869['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(_0x12a4a3){this['reviewCheckResultsView']['addResult'](_0x12a4a3),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'](_0xbf9072){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0xbf9072;}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(_0x5b8632,_0x1a18cf){super(_0x1a18cf),this['set']({'label':_0x5b8632,'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(_0x5f061a,_0x23b30c){super(_0x5f061a),this['_contents']=_0x23b30c,this['_resultViews']=new _0x16cf3f(),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(_0x5f061a),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',(_0x16c8b3,_0x2e1b2f)=>_0x16c8b3&&!_0x2e1b2f);const _0x44014b=this['_createCombinedSkeletonLoader'](),_0x38d0bd=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x38d0bd['if']('isLoading','ck-ai_review__check-run_loading',_0x447959=>_0x447959),_0x38d0bd['if']('isResultReady','ck-ai_review__check-run_ready',_0x4c6dc5=>_0x4c6dc5),_0x38d0bd['if']('isVisible','ck-hidden',_0xdb40ed=>!_0xdb40ed)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x44014b,this['reviewDisclaimer']]});}clearResults(){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}getResults(){return this['_resultViews'];}addResult(_0x417213){const _0xd06a89=new Ih(this['locale'],_0x417213['id']);_0xd06a89['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0xd06a89),_0xd06a89['updateResponseContent'](_0x417213['contentDiffed'],_0x417213['wrapperTag']);}hideResult(_0x3c377b,_0x2d3345){if('pending'===_0x2d3345)return;const _0x243f3f=this['_resultViews']['find'](_0x3ecd33=>_0x3ecd33['id']===_0x3c377b);_0x243f3f&&(_0x243f3f['status']=_0x2d3345,_0x243f3f['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}showResult(_0xfb2eb4,_0x1f0ad0){if('pending'!==_0x1f0ad0)return;const _0x1ac249=this['_resultViews']['find'](_0x5016f3=>_0x5016f3['id']===_0xfb2eb4);_0x1ac249&&(_0x1ac249['status']=_0x1f0ad0,_0x1ac249['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}setTitle(_0x25ed88,_0x819dd4){this['headerTitle']=_0x25ed88,this['headerSubtitle']=_0x819dd4||'';}['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(_0x3ba4a1){this['isAcceptAllEnabled']=_0x3ba4a1;}_createSkeletonLoader(){return new wr(this['locale'],Cr['aiReviewChecks']);}_createCombinedSkeletonLoader(){const _0x20dffb=new _0x3a2edc(this['locale']),_0x3c7768=[];for(let _0x301357=0x0;_0x301357<0x10;_0x301357++){const _0xc5e373=this['_createSkeletonLoader']();_0xc5e373['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x3c7768['push'](_0xc5e373);}return _0x20dffb['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x20e5e4=>!_0x20e5e4)]},'children':_0x3c7768}),_0x20dffb;}_createResultsBodyView(){const _0xa439f2=new _0x3a2edc(this['locale']);return _0xa439f2['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x191891=>_0x191891)]},'children':this['_resultViews']}),_0xa439f2;}_createErrorView(){const _0x118e7c=new _0x3a2edc(this['locale']),_0x51a0a6=new Mt(this['locale']),t=this['locale']['t'];return _0x118e7c['delegate']('retryReview')['to'](this),_0x51a0a6['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Pn+'\x20ck-ai_review__check-run-error-retry-button'}),_0x51a0a6['on']('execute',()=>{this['fire']('retryReview');}),_0x118e7c['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x450dce=>!_0x450dce),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x581d32=>'chunk'===_0x581d32)]},'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',_0x232ecb=>'chunk'===_0x232ecb||'unsupported-inline'===_0x232ecb)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x5ee0cf=>'general'!==_0x5ee0cf)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x58c8cd=>'chunk'!==_0x58c8cd)]},'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',_0x2360dd=>'unsupported-inline'!==_0x2360dd)]},'children':[{'text':Es(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')}]}]},_0x51a0a6]}),_0x118e7c;}_createCancelButtonView(){const _0x1cb8d1=new Mt(this['locale']);return _0x1cb8d1['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Pn+'\x20ck-ai-button-stop-generating'],'icon':st}),_0x1cb8d1['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x22c353=>_0x22c353),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x396a06=>_0x396a06)]}}),_0x1cb8d1['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x1cb8d1;}_createToggleDiffButtonView(){const _0x10cb66=new Mt(this['locale']);_0x10cb66['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x10cb66['bind']('isEnabled')['to'](this,'isError',_0x40c748=>!_0x40c748),_0x10cb66['extendTemplate']({'attributes':{'class':[Pn,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x6eeccd=>!_0x6eeccd),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x70f045=>_0x70f045)]}});const _0x360686=Es(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x1a8f1=Es(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x10cb66['bind']('isOn')['to'](this,'isToggleDiffOn',_0x1b685b=>_0x1b685b),_0x10cb66['bind']('icon')['to'](this,'isToggleDiffOn',_0x1bc481=>_0x1bc481?_0x54707b:_0xfd4424),_0x10cb66['bind']('label')['to'](this,'isToggleDiffOn',_0x4a8207=>_0x4a8207?_0x360686:_0x1a8f1),_0x10cb66['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x10cb66;}_createAcceptAllButtonView(){const _0x1930fc=new Mt(this['locale']);return _0x1930fc['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x1930fc['extendTemplate']({'attributes':{'class':[Ln,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x3be611=>!_0x3be611),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5ea1e1=>_0x5ea1e1)]}}),_0x1930fc['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x1930fc;}_createExitReviewButtonView(){const _0x5f5c3f=new Mt(this['locale']);return _0x5f5c3f['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x5f5c3f['extendTemplate']({'attributes':{'class':[Dn,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x383da7=>!_0x383da7),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x38668f=>_0x38668f)]}}),_0x5f5c3f['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x5f5c3f;}_createResultHeaderView(){const _0x2dd70b=new _0x3a2edc(this['locale']),_0x510284=this['_createTitleView']();return _0x2dd70b['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x214048=>_0x214048)]},'children':[_0x510284,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x244a3a=>!_0x244a3a)],'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']]}]}),_0x2dd70b;}_createTitleView(){const _0x4f4675=new _0x3a2edc(this['locale']),_0x11603b=new Dr();return _0x11603b['bind']('isVisible')['to'](this,'isResultReady',_0xa27f7e=>!_0xa27f7e),_0x4f4675['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2b8ff3=>_0x2b8ff3)]},'children':[_0x11603b,{'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')}]}]}]}),_0x4f4675;}_createFinishReviewButtonView(){const _0x5b1548=new Ch(Es(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x5b1548['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x19d9ce=>!_0x19d9ce)]}}),_0x5b1548['delegate']('finishReview')['to'](this),_0x5b1548;}},bh=class extends jt{_resultsHeader;_finishReviewButtonView;constructor(_0x44375f,_0x489cc3){super(_0x44375f),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x489cc3['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x489cc3['headerText']);const _0x13889f=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x13889f['if']('isVisible','ck-hidden',_0x4f8d70=>!_0x4f8d70)]},'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':_0x489cc3['emptyResultsText']}]}]}]});}_createFinishReviewButtonView(_0x20e95b){const _0x272710=new Ch(_0x20e95b,this['locale']);return _0x272710['delegate']('finishReview')['to'](this),_0x272710;}_createResultHeaderView(_0xdba500){const _0x23e987=new _0x3a2edc(this['locale']);return _0x23e987['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0xdba500},'children':[{'text':_0xdba500}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x23e987;}},Sh=class extends _0x3a2edc{['_dropdownView'];_defaultValue;_defaultLabel;constructor(_0xd9df74,_0x39d09e){super(_0xd9df74),this['_defaultValue']=_0x39d09e['default']||(_0x39d09e['data']['length']>0x0?_0x39d09e['data'][0x0]['id']:''),this['_defaultLabel']=_0x39d09e['data']['find'](_0x19d2e1=>_0x19d2e1['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x295fea(this['locale']);const _0x4da65d=this['_prepareListOptions'](_0x39d09e['data']);_0x59425e(this['_dropdownView'],_0x4da65d,{'role':'menu','ariaLabel':_0x39d09e['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x1e942d=>{_0x1e942d['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x195f1c=>{this['formValue']=_0x195f1c['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x195f1c['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(_0x4208b9=[]){const _0x395b0e=new lt();this['resetToDefault']();for(const _0x33c595 of _0x4208b9){const _0x445d7a=new _0x1a683d({'label':_0x33c595['label'],'withText':!0x0,'role':'menuitemradio','id':_0x33c595['id'],'model':_0x33c595});_0x445d7a['bind']('isOn')['to'](this,'formValue',_0x4b7592=>_0x4b7592===_0x445d7a['id']);const _0x56a1bb={'type':'button','model':_0x445d7a};_0x395b0e['add'](_0x56a1bb);}return _0x395b0e;}},Rh=class extends jt{_formItem=null;constructor(_0x2cf396,_0x2e467d,_0x528631){if(super(_0x2cf396),this['argsKey']=_0x2e467d?.['argsKey'],'dropdown'===_0x2e467d['formType'])this['_formItem']=new Sh(this['locale'],_0x2e467d);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x654039=new Wt(this['locale'],{'children':[this['_formItem']],'class':[_0x528631?'ck-form__row_with-submit':'']});_0x528631&&_0x654039['children']['add'](_0x528631),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x654039]});}resetToDefault(){this['_formItem']['resetToDefault']();}},Oh=class AIReviewCorePromptInputView extends _0x195e86{keystrokes;static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x25b9de){super(_0x25b9de),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 _0x3a2edc{['focusTracker']=new _t();keystrokes=new gt();['focusCycler'];['_focusables']=new _0x16cf3f();submitButtonView;cancelButtonView;promptInputView;actionsFooterView;_modelSelector;['_check'];constructor(_0x2c4bcb,_0x5019a6,_0x3bd04d=!0x1){super(_0x2c4bcb),this['_check']=_0x5019a6,this['set']('prompt',''),this['set']('modelId',''),this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new Qt(this['locale'],()=>new Oh(_0x2c4bcb)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelector']=new Io(_0x2c4bcb,{'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',(_0x108e04,_0x1c5002)=>{this['modelId']=_0x1c5002['id'],this['_modelSelector']['setSelectedModel'](_0x1c5002);}),this['_setModelList'](_0x3bd04d),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',(_0x4305ab,_0x22e599)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x22e599()):_0x22e599();}),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'](_0x318cf6=>{this['_focusables']['add'](_0x318cf6),this['focusTracker']['add'](_0x318cf6['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 _0x4d731c of this['_getFormValidators']()){const _0x163c0a=_0x4d731c();if(_0x163c0a)return this['promptInputView']['errorText']=_0x163c0a,!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 _0x13f685=new Mt(this['locale']),t=this['locale']['t'];return _0x13f685['set']({'label':t('Submit'),'withText':!0x0,'class':Ln}),_0x13f685['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x13f685;}_createCancelButtonView(){const _0x42ace1=new Mt(this['locale']),t=this['locale']['t'];return _0x42ace1['set']({'label':t('Cancel'),'withText':!0x0,'class':Dn}),_0x42ace1['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x42c97a=>{_0x42c97a['stopPropagation']();})}}),_0x42ace1['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x42ace1;}_setModelList(_0x342549){this['_modelSelector']['setModels'](this['_check']['models'],!_0x342549),this['resetToDefault']();}_createActionsFooterView(){const _0x44303f=new _0x3a2edc(this['locale']);return _0x44303f['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']]}]}),_0x44303f;}},kh=class extends jt{_formItemsCollection=new _0x16cf3f();_customCheckView=null;['_hideModels']=!0x1;constructor(_0x4ec02e,_0x31c102,_0xc20b65,_0x4e5295=!0x1){super(_0x4ec02e),this['_hideModels']=_0x4e5295,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x31c102['isParameterized']);const _0x2cad70=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',_0x47d76f=>_0x47d76f),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0xef4faa=>_0xef4faa)],'style':{'--ck-ai-review-check-list-item-index':_0xc20b65}},'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':_0x31c102['title']}]},_0x2cad70]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x31c102['description']?[{'text':_0x31c102['description']}]:[]}]}]},..._0x31c102['isParameterized']?[this['_createParameterizedView'](_0x31c102)]:[],...'custom'===_0x31c102['id']?[this['_createCustomView'](_0x31c102,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x31c102['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x31c102['id'],'args':_0x31c102['useArgs']?_0x31c102['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0x5b168d({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}resetToDefault(){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x527cf9=>{_0x527cf9['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}_createIconView(){const _0x215ba4=new $t();return _0x215ba4['content']=_0x26c371,_0x215ba4['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x215ba4;}_createParameterizedView(_0x252c9c){const _0x49c29d=new _0x3a2edc(),_0x5b1226=this['_createFormView'](_0x252c9c);return _0x49c29d['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0xb29344=>!_0xb29344)]},'children':[_0x5b1226]}),_0x49c29d;}_createFormView(_0x5ececf){const _0x5d72a8=new _0x3a2edc(),_0x92761e=Array['isArray'](_0x5ececf['options'])?_0x5ececf['options']:[],_0x27e67f=new Mt(this['locale']),t=this['locale']['t'];_0x27e67f['set']({'label':t('Submit'),'withText':!0x0,'class':Ln}),_0x27e67f['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x3c8c30=>{_0x3c8c30['stopPropagation']();})}}),_0x27e67f['on']('execute',()=>{const _0x275bd9=[],_0x1bbf16={};this['_formItemsCollection']['forEach'](_0x408b08=>{_0x275bd9['push'](_0x408b08['value']),_0x5ececf['useArgs']&&_0x5ececf['options']&&(_0x1bbf16[_0x408b08['argsKey']]=_0x408b08['value']);}),this['fire']('runReviewCheck',{'id':_0x5ececf['id'],'params':_0x275bd9['length']?_0x275bd9:void 0x0,'args':Object['keys'](_0x1bbf16)['length']?_0x1bbf16:void 0x0});});const _0x1d3d00=_0x92761e['length'];return _0x92761e['forEach']((_0x303da0,_0x4a9d10)=>{const _0x4b398d=_0x4a9d10===_0x1d3d00-0x1;this['_formItemsCollection']['add'](new Rh(this['locale'],_0x303da0,_0x4b398d?_0x27e67f:null));}),_0x5d72a8['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x5d72a8;}_createCustomView(_0x5efcb3,_0xdf0fa6=!0x1){return this['_customCheckView']=new vh(this['locale'],_0x5efcb3,_0xdf0fa6),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',_0x297069=>!_0x297069)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x355017,_0x3cbd6e,_0xa13e33)=>{_0xa13e33||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},yh=class extends jt{['_checkViews'];constructor(_0x5d06c2){super(_0x5d06c2),this['_checkViews']=new _0x16cf3f(),this['_setupTemplate']();}setChecks(_0x330e3d,_0x2937a7=!0x1){this['_checkViews']['clear']();for(const [_0x11686c,_0x265d99]of _0x330e3d['entries']()){const _0x14a3b0=new kh(this['locale'],_0x265d99,_0x11686c,_0x2937a7);_0x14a3b0['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x14a3b0);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}resetAllParameterizedChecks(){for(const _0x4ef8c4 of this['_checkViews'])_0x4ef8c4 instanceof kh&&_0x4ef8c4['resetToDefault']();}_setupTemplate(){const _0x6ff057=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x6ff057['if']('isVisible','ck-hidden',_0x23ae66=>!_0x23ae66)]},'children':this['_checkViews']});}},Nh=class extends mh{static get['pluginName'](){return'AIReviewModeUI';}createMainView(){const _0x2bc257=this['context']['plugins']['get']('AITabs'),_0x398117=this['context']['locale'],_0x265b38=new ua(_0x398117,{'label':Es(_0x398117,'AI_REVIEW_MODE'),'icon':_0x5a8e02,'class':'ck-ai-header_review','showResizeButton':_0x2bc257['showResizeButton']});return _0x265b38['delegate']('resizeTabs')['to'](_0x2bc257),_0x265b38['bind']('isMaximized')['to'](_0x2bc257['view'],'isMaximized',_0xb991c7=>_0xb991c7),new wh(this['context']['locale'],{'header':_0x265b38,'list':new yh(_0x398117),'results':new fh(_0x398117,{'generalErrorText':Es(_0x398117,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new bh(_0x398117,{'headerText':Es(_0x398117,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Es(_0x398117,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Es(_0x398117,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}registerTab(){const _0x16b65e=this['context']['plugins']['get']('AITabs');_0x16b65e['view']['on']('activateTab',(_0x3827ae,{newTab:_0x21aed6,oldTab:_0x552749})=>{'reviewMode'===_0x21aed6?this['fire']('getReviewCheckList'):'reviewMode'===_0x552749&&this['fire']('leaveReview');}),_0x16b65e['view']['addTab']({'id':'reviewMode','buttonLabel':Es(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x5a8e02,'order':0x0,'content':this['_mainView']});}},xh=class extends Sn{_affectedBlocks=[];get affectedBlocks(){return this['_affectedBlocks']['slice']();}set affectedBlocks(_0x5dc25c){this['_affectedBlocks']=_0x5dc25c;}};const Lh='review-',Ph=['softBreak'],Dh=['htmlScript','htmlStyle','htmlCustomElement'];var Hh=class extends _0x57f218{static get requires(){return[_0x14613c,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(_0x52632c){super(_0x52632c),this['_domEmitter']=new(ut())(),this['_eventEmitter']=new(dt())();}get emitter(){return this['_eventEmitter'];}afterInit(){const _0x2cd2af=_0x453493=>this['_scheduleAttachReviewEditingToEditor'](_0x453493);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x38520b)return void _0x2cd2af(this['context']);const _0x5e8136=this['context'];for(const _0x2f52c1 of _0x5e8136['editors'])_0x2cd2af(_0x2f52c1);this['listenTo'](_0x5e8136['editors'],'add',(_0x1c167f,_0x26950b)=>{_0x2cd2af(_0x26950b);}),this['listenTo'](_0x5e8136['editors'],'remove',(_0x4753a1,_0x20d131)=>{for(const [_0x204677,_0x1b172d]of this['_markers'])_0x1b172d['editor']===_0x20d131&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x204677,'changeId':_0x1b172d['groupId']}),this['_markers']['delete'](_0x204677));});}_scheduleAttachReviewEditingToEditor(_0x155d53){const _0x2f683d=()=>{'destroyed'!==_0x155d53['state']&&_0x155d53['conversion']&&this['_attachReviewEditingToEditor'](_0x155d53);};if('ready'===_0x155d53['state'])return void _0x2f683d();const _0x2df74f=()=>{this['stopListening'](_0x155d53,'ready',_0x2df74f),_0x2f683d();};this['listenTo'](_0x155d53,'ready',_0x2df74f);}_attachReviewEditingToEditor(_0x9885be){this['_reviewEditingAttachedEditors']['has'](_0x9885be)||(_0x9885be['conversion']['for']('editingDowncast')['markerToElement']({'model':Lh+'insert','view':(_0x5190b5,{writer:_0x37e777})=>{const _0xb2e91a=this['_markers']['get'](_0x5190b5['markerName']),_0x27d139={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0xb2e91a?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x5190b5['markerName']};return _0x37e777['createUIElement']('span',_0x27d139,function(_0x36bcc9){const _0x1e2673=this['toDomElement'](_0x36bcc9);return _0x1e2673['innerHTML']=_0xb2e91a?.['content']?.['asString']||'',_0x1e2673;});}}),_0x9885be['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-only','view':_0x4ed2ae=>{const _0x39087e=this['_markers']['get'](_0x4ed2ae['markerName']),_0x4b5340=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x39087e?.['id']||'')&&_0x4b5340['push']('ck-ai_review__change_active'),{'classes':_0x4b5340,'attributes':{'data-marker-id':_0x4ed2ae['markerName']}};}}),_0x9885be['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-context','view':_0x35e8cc=>{const _0x285353=this['_markers']['get'](_0x35e8cc['markerName']),_0x215052=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x285353?.['id']||'')&&_0x215052['push']('ck-ai_review__change_active'),{'classes':_0x215052,'attributes':{'data-marker-id':_0x35e8cc['markerName']}};}}),_0x9885be['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-text','view':_0x4eb3d4=>{const _0x2abca7=this['_markers']['get'](_0x4eb3d4['markerName']),_0x227617=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x2abca7?.['id']||'')&&_0x227617['push']('ck-ai_review__change_active'),{'classes':_0x227617,'attributes':{'data-marker-id':_0x4eb3d4['markerName']}};}}),_0x9885be['conversion']['for']('dataDowncast')['markerToElement']({'model':Lh+'suggestion-context','view':(_0x40527c,{writer:_0x2415e3})=>_0x2415e3['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x40527c['isOpening']?'start':'end')})}),_0x9885be['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x19f2f9,'view':_0x5f0ba7}),this['_updateMouseMarkerInteractionListeners'](_0x9885be),this['listenTo'](_0x9885be,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x9885be),{'priority':'lowest'}),this['listenTo'](_0x9885be,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x9885be),{'priority':'lowest'}),_0x9885be['model']['document']['registerPostFixer'](_0x287032=>this['_validateMarkers'](_0x9885be,_0x287032)),_0x9885be['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x9885be)),this['_reviewEditingAttachedEditors']['add'](_0x9885be));}_updateMouseMarkerInteractionListeners(_0x2d9f98){let _0x414225=this['_boundEditables']['get'](_0x2d9f98);_0x414225||(_0x414225=new Map(),this['_boundEditables']['set'](_0x2d9f98,_0x414225));const _0x1bc949=new Set(_0x2d9f98['ui']['getEditableElementsNames']());for(const _0x110dc8 of _0x1bc949){if(_0x414225['has'](_0x110dc8))continue;const _0x2ce812=_0x2d9f98['ui']['getEditableElement'](_0x110dc8);_0x414225['set'](_0x110dc8,_0x2ce812),this['_attachMouseMarkerInteractionListeners'](_0x2ce812);}for(const [_0x5bf0a7,_0x6e7550]of _0x414225)_0x1bc949['has'](_0x5bf0a7)||(_0x414225['delete'](_0x5bf0a7),this['_domEmitter']['stopListening'](_0x6e7550));}_attachMouseMarkerInteractionListeners(_0x242db3){this['_domEmitter']['listenTo'](_0x242db3,'mouseup',(_0x8a94cb,_0x527c9d)=>{const _0x27287b=_0x527c9d['target'],_0x53560f=this['_findMarkerElement'](_0x27287b);if(!_0x53560f)return;const _0x4961bf=_0x53560f['getAttribute']('data-marker-id'),_0x48f205=_0x4961bf['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x4961bf,'changeId':_0x48f205,'markerElement':()=>this['_findMarkerElementById'](_0x4961bf),'domEvent':_0x527c9d});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x242db3,'mouseover',(_0x314c06,_0x5027c6)=>{const _0x3bfef1=_0x5027c6['target'],_0x25a529=_0x5027c6['relatedTarget'];let _0x20462f=this['_findMarkerElement'](_0x3bfef1);if(!_0x20462f&&_0x25a529&&(_0x20462f=this['_findMarkerElement'](_0x25a529)),!_0x20462f)return;const _0x4a83c1=_0x20462f['getAttribute']('data-marker-id'),_0x52d2e0=_0x4a83c1['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x52d2e0,'markerElement':()=>this['_findMarkerElementById'](_0x4a83c1),'domEvent':_0x5027c6});});}_registerGlobalBalloonBlurHandler(){this['_domEmitter']['listenTo'](document,'mouseover',_0x280a1b((_0x2faf27,_0x3c933e)=>{const _0x5191b2=_0x3c933e['target'];this['_findMarkerElement'](_0x5191b2)||_0x5191b2['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}getDocumentData(_0x5ad110){const _0x1d07f9=this['context']['plugins']['get']('AIEditing'),_0x4e4822=bs(this['context']);if(!_0x4e4822['length'])throw new ct('ai-get-editor-from-context-no-editor',this);const _0x5e37b2=_0x5ad110?.['roots'];if(_0x5e37b2&&0x0===_0x5e37b2['length'])throw new ct('ai-reviewcoreediting-empty-roots',this);const _0x1c3c70=_0x5e37b2?new Set(_0x5e37b2['map'](_0x5f505c=>_0x5f505c['channelId']+'\x00'+_0x5f505c['rootName'])):null,_0x599d26=_0x1c3c70?new Set():null,_0x4f8156=new Set(),_0x138ede=[],_0x3f1c7a=new Map(),_0x606b8f=[];for(const _0x1a3a4c of _0x4e4822){const _0x5cc21e=_0x1a3a4c['config']['get']('collaboration.channelId');for(const _0x5648bf of _0x1a3a4c['model']['document']['getRoots']()){const _0x2ce6c9=_0x5cc21e+'\x00'+_0x5648bf['rootName'];if(_0x1c3c70&&!_0x1c3c70['has'](_0x2ce6c9))continue;const _0x3b77fb=this['_buildDocumentDataSliceForRoot'](_0x1a3a4c,_0x5648bf,_0x1d07f9,_0x4f8156);_0x138ede['push'](_0x3b77fb['content']);for(const [_0x3041b1,_0x197648]of _0x3b77fb['elements'])_0x3f1c7a['set'](_0x3041b1,_0x197648);_0x606b8f['push']({'channelId':_0x5cc21e,'rootName':_0x5648bf['rootName']}),_0x599d26?.['add'](_0x2ce6c9);}}if(_0x5e37b2&&_0x599d26['size']!==_0x1c3c70['size']){const _0x52fa5a=_0x5e37b2['find'](_0x4fae31=>!_0x599d26['has'](_0x4fae31['channelId']+'\x00'+_0x4fae31['rootName']));throw new ct('ai-reviewcoreediting-root-not-found',this,{'channelId':_0x52fa5a['channelId'],'rootName':_0x52fa5a['rootName']});}return{'elements':_0x3f1c7a,'content':_0x138ede['join'](''),'roots':_0x606b8f};}async['runCheck'](_0x71c101,_0x46625a){const _0xc70e9b=new On(),_0x5eac83=_0x46625a?.['signal'];let _0x228a10;const _0x40d34e=()=>{_0xc70e9b['abort'](),_0x71c101['abort']();};if(_0x5eac83){if(_0x5eac83['aborted'])return _0x40d34e(),_0xc70e9b;_0x5eac83['addEventListener']('abort',_0x40d34e),_0x228a10=()=>_0x5eac83['removeEventListener']('abort',_0x40d34e);}const _0x2efbfc={'apiId':_0x71c101['sourceCheck']['apiId']};try{_0x71c101['on']('reviewCheckRunUpdated',(_0x466a49,_0x1f5f99)=>{'aborted'===_0x1f5f99['status']?_0xc70e9b['abort']():'error-general'!==_0x1f5f99['status']&&'error-chunk'!==_0x1f5f99['status']||(_0xc70e9b['error']=bn(_0x1f5f99['error'],'ai-reviewcoreediting-check-run-failed',this,_0x2efbfc));}),'aborted'!==_0xc70e9b['status']&&await _0x71c101['start']();}catch(_0x29bfe3){_0xc70e9b['error']=bn(_0x29bfe3,'ai-reviewcoreediting-check-run-failed',this,_0x2efbfc);}finally{_0x228a10&&_0x228a10();}return'error'===_0xc70e9b['status']||'aborted'===_0xc70e9b['status']||(_0xc70e9b['addResult'](...this['_buildPerRootResults'](_0x71c101)),_0xc70e9b['status']='completed'),_0xc70e9b;}buildErrorContext(_0x59e1c6){return{'apiId':_0x59e1c6['sourceCheck']['apiId']};}_buildPerRootResults(_0x57bd64){const _0x9678b9=this['buildErrorContext'](_0x57bd64),_0x5deb33=this['context']['plugins']['get']('AIEditing'),_0x13876f=this['context']['plugins']['get']('AIGateway'),_0x57752e=this['_groupElementsByRoot'](_0x57bd64['documentData']['elements']),_0x164377=new Map();for(const _0x56d86f of bs(this['context']))_0x164377['set'](_0x56d86f['config']['get']('collaboration.channelId'),_0x56d86f);return _0x57bd64['documentData']['roots']['map'](({channelId:_0x2cd176,rootName:_0x8980a0})=>{const _0x3321d5=_0x164377['get'](_0x2cd176),_0x40b8ac=new xh({'editor':_0x3321d5,'rootName':_0x8980a0,'channelId':_0x2cd176,'sessionId':_0x5deb33['getSessionId'](_0x3321d5)}),_0x1f6fa3=_0x57752e['get'](_0x40b8ac['editor'])?.['get'](_0x40b8ac['rootName'])??[];_0x40b8ac['contentRawOld']=_0x1f6fa3['map'](_0x2f9aab=>_0x2f9aab['getContent']())['join'](''),_0x40b8ac['documentVersion']=_0x1f6fa3[0x0]?.['documentVersion']??0x1;const _0x6eadb6=this['_collectResultAffectedBlocks'](_0x40b8ac,_0x57bd64['results'],_0x57bd64['documentData']['elements']);_0x40b8ac['affectedBlocks']=_0x6eadb6;try{_0x40b8ac['contentRawNew']=Os(_0x13876f['mergeChangesIntoContent'](_0x6eadb6,_0x40b8ac['contentRawOld'],_0x40b8ac['editor']));}catch(_0x459766){_0x40b8ac['error']=bn(_0x459766,'ai-reviewcoreediting-check-run-failed',this,_0x9678b9);}return _0x40b8ac;});}_collectResultAffectedBlocks(_0x9fdea6,_0x29f716,_0x217260){return _0x29f716['filter'](_0xb31af=>{const _0x19d4de=_0x217260['get'](_0xb31af['id']);return!!_0x19d4de&&_0x19d4de['editor']===_0x9fdea6['editor']&&_0x19d4de['rootName']===_0x9fdea6['rootName'];})['map'](_0x5dd702=>({'id':_0x5dd702['id'],'content':_0x5dd702['contentNew']}));}_groupElementsByRoot(_0x4f93c6){const _0x94dd4b=new Map();for(const _0x1dbb16 of _0x4f93c6['values']()){let _0x14adc3=_0x94dd4b['get'](_0x1dbb16['editor']);_0x14adc3||(_0x14adc3=new Map(),_0x94dd4b['set'](_0x1dbb16['editor'],_0x14adc3));let _0x588522=_0x14adc3['get'](_0x1dbb16['rootName']);_0x588522||(_0x588522=[],_0x14adc3['set'](_0x1dbb16['rootName'],_0x588522)),_0x588522['push'](_0x1dbb16);}return _0x94dd4b;}_buildDocumentDataSliceForRoot(_0x48b6f0,_0x1bae1c,_0x3bc3c7,_0x4b5229){const _0x48cbd6=_0x48b6f0['model'],_0x219ad9=new _0x5a34ce();for(const _0x492270 of _0x1bae1c['getChildren']())_0x219ad9['_appendChild'](_0x492270['_clone'](!0x0));for(const _0x5b5dbb of _0x48cbd6['markers']){const _0xe9ee8e=_0x5b5dbb['getRange']();_0xe9ee8e&&_0xe9ee8e['root']['rootName']===_0x1bae1c['rootName']&&_0x219ad9['markers']['set'](_0x5b5dbb['name'],this['_changeRangeOwnerDocument'](_0xe9ee8e['clone'](),_0x219ad9));}const _0x14db0f=new Map(),_0x1191ca=_0x48cbd6['document']['version'];if(Gs(_0x48b6f0,_0x1bae1c['rootName'])){let _0x4aabd5=this['_inlineRootDataIds']['get'](_0x1bae1c);_0x4aabd5?_0x4b5229['add'](_0x4aabd5):(_0x4aabd5=_0x3bc3c7['_nextDataId'](_0x4b5229),this['_inlineRootDataIds']['set'](_0x1bae1c,_0x4aabd5));const _0xb04432=Fs(_0x48b6f0['data']['processor']['toData'](_0x48b6f0['data']['toView'](_0x219ad9)),_0x4aabd5);return _0x14db0f['set'](_0x4aabd5,{'editor':_0x48b6f0,'rootName':_0x1bae1c['rootName'],'path':[],'documentVersion':_0x1191ca,'getContent':()=>_0xb04432}),{'content':_0xb04432,'elements':_0x14db0f};}const _0x1d43c4=new _0x508ddf({'ignoreElementEnd':!0x0,'startPosition':_0x48cbd6['createPositionAt'](_0x219ad9,0x0)});for(const {item:_0x49d21e}of _0x1d43c4){if(_0x49d21e['is']('element')&&_0x49d21e['name']&&Dh['includes'](_0x49d21e['name'])){const _0x4fc3ad=this['_upsertDataId'](_0x49d21e,()=>_0x3bc3c7['_nextDataId'](_0x4b5229));_0x4b5229['add'](_0x4fc3ad);}if(!_0x49d21e['is']('$textProxy'))continue;const _0x31cc98=_0x49d21e['parent'];if(!_0x31cc98||!_0x31cc98['is']('element'))continue;const _0x121217=this['_upsertDataId'](_0x31cc98,()=>_0x3bc3c7['_nextDataId'](_0x4b5229));_0x4b5229['add'](_0x121217);for(const _0x772462 of _0x31cc98['getChildren']())_0x772462['is']('element')&&(_0x772462['name']&&Ph['includes'](_0x772462['name'])||_0x4b5229['add'](this['_upsertDataId'](_0x772462,()=>_0x3bc3c7['_nextDataId'](_0x4b5229))));let _0x12cc20=_0x31cc98;for(;_0x12cc20['parent']&&!_0x12cc20['parent']['is']('documentFragment');)_0x12cc20=_0x12cc20['parent'],_0x12cc20['hasAttribute'](_0x19f2f9)&&_0x12cc20['_removeAttribute'](_0x19f2f9);_0x14db0f['set'](_0x121217,{'editor':_0x48b6f0,'rootName':_0x1bae1c['rootName'],'path':_0x31cc98['getPath'](),'documentVersion':_0x1191ca,'getContent':this['_createGetContentUsingDataIdFn'](_0x12cc20['_clone'](!0x0),_0x121217,_0x48b6f0['data'])}),_0x1d43c4['jumpTo'](_0x48cbd6['createPositionAfter'](_0x31cc98));}return{'content':_0x48b6f0['data']['processor']['toData'](_0x48b6f0['data']['toView'](_0x219ad9)),'elements':_0x14db0f};}diffContent(_0x90e0f3,_0x1a4bec,_0x1d2218,_0x5c2a5a=!0x1){const {contentInitial:_0x19f723,contentNew:_0x44ab71}=this['_neutralizeChangesOnUnsupportedElements'](_0x1a4bec,_0x1d2218),_0x3b44c7=[],_0x24ab7f=_0x90e0f3['data']['parse'](_0x44ab71,'$documentFragment'),_0x2210e5=_0x90e0f3['data']['parse'](_0x19f723,'$documentFragment'),_0x2f9324=_0x90e0f3['model']['createPositionAt'](_0x2210e5,0x0);if(this['_haveSingleTopLevelElement'](_0x24ab7f)){if(!this['_hasSameTopLevelElement'](_0x2210e5,_0x24ab7f))return _0x3b44c7;}else{const _0x4ac69b=_0x90e0f3['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x2210e5,_0x4ac69b)||!this['_haveOnlyInlineContent'](_0x24ab7f,_0x4ac69b))return _0x3b44c7;}const _0x15fb98=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x19f723,_0x44ab71,{'targetEditor':_0x90e0f3,'anchor':_0x2f9324,'markDeletions':!0x0})['getOperations']()['filter'](_0x4618d8=>'insert'===_0x4618d8['type']||'marker'===_0x4618d8['type']&&_0x4618d8['name']['startsWith']('$markedRemove')),_0x3a08a9=this['_groupAdjacentOperations'](_0x15fb98),_0x43ec10=[];if(_0x5c2a5a){if(_0x3a08a9['length']){const _0x568588=_0x3a08a9[0x0]['operations'][0x0],_0x72ba22='insert'===_0x568588['type']?_0x568588['position']:_0x568588['newRange']['start'],_0x3e7c6d=this['_getPositionLimitingRange'](_0x72ba22,_0x90e0f3,'inside'),_0x309a2f=_0x3e7c6d?_0x24ab7f['getChild'](0x0)['getChildren']():_0x24ab7f['getChildren'](),_0x46e588=_0x3e7c6d||_0x90e0f3['model']['createRangeIn'](_0x2210e5),_0x4cdaad=[new _0x508b00('$markedRemove:synthetic'+kt(),null,_0x46e588,_0x90e0f3['model']['document']['model']['markers'],!0x0,_0x90e0f3['model']['document']['version']+0x1),new _0xdb67b4(_0x46e588['end'],_0x309a2f,_0x90e0f3['model']['document']['version']+0x2)];_0x43ec10['push']({'operations':_0x4cdaad,'operationsIsolated':_0x4cdaad,'groupOffset':0x0});}}else _0x43ec10['push'](..._0x3a08a9);let _0x2fbe03=0x0;return _0x90e0f3['model']['change'](_0x123510=>{for(let _0x2c1a18=0x0;_0x2c1a18<_0x43ec10['length'];_0x2c1a18++){const _0x22977c=_0x43ec10[_0x2c1a18],_0x2e6aad=_0x123510['createDocumentFragment']();for(const _0x15714f of _0x2210e5['getChildren']())_0x123510['append'](_0x15714f['_clone'](!0x0),_0x2e6aad);for(const _0x4a76e7 of _0x22977c['operationsIsolated'])if('insert'===_0x4a76e7['type']){const _0x2dcb07=_0x4a76e7;_0x2dcb07['baseVersion']=null,_0x2dcb07['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x2dcb07,_0x2e6aad),_0x123510['batch']['addOperation'](_0x4a76e7),_0x90e0f3['model']['applyOperation'](_0x4a76e7);const _0x52e74e='suggestion:insertion:id:authorId:'+_0x2fbe03++,_0x490276=_0x90e0f3['model']['createRange'](_0x2dcb07['position'],_0x2dcb07['position']['getShiftedBy'](_0x2dcb07['howMany']));_0x2e6aad['markers']['set'](_0x52e74e,_0x490276);}else{if('marker'===_0x4a76e7['type']&&_0x4a76e7['name']['startsWith']('$markedRemove')){const _0x3fbc17=_0x4a76e7,_0x4be67c='suggestion:deletion:id:authorId:'+_0x2fbe03++;this['_changeOperationOwnerDocument'](_0x3fbc17,_0x2e6aad),_0x2e6aad['markers']['set'](_0x4be67c,_0x3fbc17['newRange']);}}if(_0x5c2a5a)_0x3b44c7['push']({..._0x22977c,'context':this['_createGetContentFn'](_0x2210e5,_0x90e0f3['data']),'content':this['_createGetContentFn'](_0x2210e5,_0x90e0f3['data'])});else{const _0x312898=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x22977c['operationsIsolated'][0x0]),_0x2e6aad),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x22977c['operationsIsolated'][_0x22977c['operationsIsolated']['length']-0x1]),_0x2e6aad),_0x90e0f3);_0x2e6aad['markers']['set'](Lh+'suggestion-context',new _0x4b6f52(_0x312898['start'],_0x312898['end'])),_0x3b44c7['push']({..._0x22977c,'context':this['_createGetContextFn'](_0x2e6aad,_0x90e0f3['data'],{'ellipsisBefore':_0x312898['hasContentBefore'],'ellipsisAfter':_0x312898['hasContentAfter']}),'content':this['_createGetContentFn'](_0x2e6aad,_0x90e0f3['data'])});}}}),_0x3b44c7;}markChangePositionInEditorContent(_0x5f1864,_0x5dd02f){if(!_0x5f1864['length'])return;const _0x37a27a=_0x5f1864[0x0]['parent']['id'],_0x3d07b2=_0x5dd02f['elements']['get'](_0x37a27a);if(!_0x3d07b2)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x37a27a);const _0x365373=_0x3d07b2['path'],_0x186483=_0x3d07b2['editor'],_0x1fe554=_0x186483['model']['document']['getRoot'](_0x3d07b2['rootName']);if(!_0x1fe554)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x3d07b2['rootName']);const _0x2af38f=_0x186483['model']['document']['history']['getOperations'](_0x3d07b2['documentVersion']),_0x283c60=[];for(const _0x10e1bf of _0x5f1864){const _0x362451=_0x10e1bf['operationsIsolated']['map'](_0x320a51=>this['_translateOperationToEditorContent'](_0x320a51,_0x365373,_0x1fe554));if(!_0x362451||!_0x362451['length'])continue;const _0x38785d=_0x362451['every'](_0x13fcee=>'marker'===_0x13fcee['type']&&_0x13fcee['name']['startsWith']('$markedRemove')),_0x7f3de9=_0x1b55c4(_0x362451,_0x2af38f,{'document':_0x186483['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0x1f6c9f of _0x7f3de9)if('insert'===_0x1f6c9f['type']){const _0x3442de=_0x1f6c9f,_0x9f9c22=_0x3442de['nodes'];_0x186483['model']['change'](_0x1a71d9=>{const _0x112c27=_0x1a71d9['createDocumentFragment']();for(const _0x1b96ba of _0x9f9c22)_0x1a71d9['append'](_0x1b96ba['_clone'](!0x0),_0x112c27);_0x283c60['push']({'start':_0x3442de['position'],'end':_0x3442de['position'],'type':'insert','groupId':_0x10e1bf['id'],'content':{'asString':this['_createGetContentFn'](_0x112c27,_0x186483['data'])(),'asFragment':_0x112c27}});});}else{if('marker'===_0x1f6c9f['type']&&_0x1f6c9f['name']['startsWith']('$markedRemove')){const _0x15fffb=_0x1f6c9f;let _0xf8f3a='remove-text';if(_0x38785d){const _0x581e21=this['_findAdjacentContextDistance'](_0x15fffb['newRange']['start'],'backward',_0x186483['model']['schema']),_0x2a22c9=this['_findAdjacentContextDistance'](_0x15fffb['newRange']['end'],'forward',_0x186483['model']['schema']);if(_0x581e21||_0x2a22c9){const _0x2c30f2=_0x15fffb['newRange']['start']['getShiftedBy'](-_0x581e21),_0x4063ae=_0x15fffb['newRange']['end']['getShiftedBy'](_0x2a22c9);_0x283c60['push']({'start':_0x2c30f2,'end':_0x4063ae,'groupId':_0x10e1bf['id'],'type':'remove-context'});}else _0xf8f3a='remove-only';}_0x283c60['push']({'start':_0x15fffb['newRange']['start'],'end':_0x15fffb['newRange']['end'],'groupId':_0x10e1bf['id'],'type':_0xf8f3a});}}}this['_insertMarkers'](_0x283c60,_0x186483);}['clearAllMarkers'](){const _0x399001=new Map();for(const _0x5464cf of this['_markers']['keys']()){const _0x29f82d=this['_markers']['get'](_0x5464cf);_0x29f82d?.['editor']&&(_0x399001['has'](_0x29f82d['editor'])||_0x399001['set'](_0x29f82d['editor'],[]),_0x399001['get'](_0x29f82d['editor'])['push'](_0x5464cf));}for(const [_0x40a3b3,_0x468262]of _0x399001)_0x40a3b3['model']['change'](_0x11ef80=>{for(const _0x501820 of _0x468262)_0x40a3b3['model']['markers']['get'](_0x501820)&&_0x11ef80['removeMarker'](_0x501820);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}switchToReadOnly(){for(const _0x3a0622 of this['getEditors']())_0x3a0622['enableReadOnlyMode']('ai-review');}switchToEdit(){for(const _0x2b9ee6 of this['getEditors']())_0x2b9ee6['disableReadOnlyMode']('ai-review');}['applyChange'](_0x1a0843,_0x15184d=null){const _0x1d7c1a=_0x1a0843['map'](_0x246bc4=>this['_getMarkersDataForGroup'](_0x246bc4))['flat'](),_0x1b52fb=new Map();for(const _0x2923b9 of _0x1d7c1a)_0x1b52fb['has'](_0x2923b9['editor'])||_0x1b52fb['set'](_0x2923b9['editor'],[]),_0x1b52fb['get'](_0x2923b9['editor'])['push'](_0x2923b9);for(const [_0x4aaabc,_0x5d3351]of _0x1b52fb){const _0x3bd092=_0x4aaabc['model'],_0x942369=_0x4aaabc['plugins']['has']('TrackChangesEditing')?_0x4aaabc['plugins']['get']('TrackChangesEditing'):null,_0xbe2ddc=_0x15184d&&_0x942369?new Set(_0x942369['getSuggestions']()['map'](_0x270ff7=>_0x270ff7['id'])):null;_0x3bd092['change'](_0x7601e8=>{const _0x27adb0=_0x7601e8['batch']['operations']['length'];for(const _0x2e9317 of _0x5d3351){const _0x31c5d5=_0x4aaabc['model']['markers']['get'](_0x2e9317['id']);if(_0x31c5d5){if('insert'===_0x2e9317['type']){if(!_0x2e9317['content'])continue;_0x3bd092['insertContent'](_0x2e9317['content']['asFragment']||null,_0x31c5d5['getRange']()['start']);}else'remove-text'!==_0x2e9317['type']&&'remove-only'!==_0x2e9317['type']||_0x3bd092['deleteContent'](_0x3bd092['createSelection'](_0x31c5d5['getRange']()));_0x7601e8['removeMarker'](_0x2e9317['id']),this['_markers']['delete'](_0x2e9317['id']);}}if(_0x15184d&&(mn(_0x7601e8['batch']['operations']['slice'](_0x27adb0),_0x15184d),_0x942369)){for(const _0x40cd6c of _0x942369['getSuggestions']())_0xbe2ddc['has'](_0x40cd6c['id'])||_0x40cd6c['setAttribute']('@ai',{'type':_0x15184d});}});}}rejectChange(_0x3de95e){const _0x1596a2=this['_getMarkersDataForGroup'](_0x3de95e),_0x1e86cb=new Map();for(const _0x1dfb6c of _0x1596a2)_0x1e86cb['has'](_0x1dfb6c['editor'])||_0x1e86cb['set'](_0x1dfb6c['editor'],[]),_0x1e86cb['get'](_0x1dfb6c['editor'])['push'](_0x1dfb6c);for(const [_0x2ccef0,_0x534591]of _0x1e86cb)_0x2ccef0['model']['change'](_0x54dacc=>{for(const _0x3cd3a9 of _0x534591)_0x54dacc['removeMarker'](_0x3cd3a9['id']),this['_markers']['delete'](_0x3cd3a9['id']);});}getEditor(){return Ss(this['context']);}getEditors(){return bs(this['context']);}getEditorForChange(_0x360130){return this['_getMarkersDataForGroup'](_0x360130)[0x0]?.['editor'];}getMarkerElementForChange(_0x47f391){const _0x26c904=Array['from'](this['_markers']['values']())['filter'](_0x4bcf33=>_0x4bcf33['groupId']===_0x47f391);if(!_0x26c904['length'])return null;const _0x291df2=0x1===_0x26c904['length']?_0x26c904[0x0]:this['_sortMarkers'](_0x26c904)[0x0],_0x2634e3=_0x291df2['editor']['model']['markers']['get'](_0x291df2['id']);return _0x2634e3?{'modelRange':_0x2634e3['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x291df2['id'])}:null;}getContentElementForChange(_0x4813fe){const _0x10d498=Array['from'](this['_markers']['values']())['filter'](_0xfe7031=>_0xfe7031['groupId']===_0x4813fe);if(!_0x10d498['length'])return null;const _0xcf98d3=0x1===_0x10d498['length']?_0x10d498[0x0]:this['_sortMarkers'](_0x10d498)[0x0],_0x445c19=_0xcf98d3['editor'],_0x3f17b7=_0x445c19['model']['markers']['get'](_0xcf98d3['id']);if(!_0x3f17b7)return null;const _0x218e61=_0x3f17b7['getRange'](),_0x5b5c15=_0x445c19['editing']['view']['getDomRoot'](_0x218e61['root']['rootName'])||_0x445c19['editing']['view']['getDomRoot']();if(!_0x5b5c15||!_0x218e61)return null;let _0x2479fc=_0x218e61['start']['parent'];for(;_0x2479fc['parent']&&!_0x2479fc['parent']['is']('rootElement');)_0x2479fc=_0x2479fc['parent'];if(!_0x2479fc||!_0x2479fc['name'])return null;const _0xd8a7b=_0x5b5c15['querySelector']('[data-marker-id=\x22'+_0xcf98d3['id']+'\x22]');if(!_0xd8a7b)return null;if(_0x2479fc['is']('rootElement'))return _0xd8a7b;let _0x190dc0=null;_0x445c19['model']['change'](_0x5c9c3a=>{_0x190dc0=_0x5c9c3a['createDocumentFragment'](),_0x5c9c3a['append'](_0x2479fc['_clone'](!0x0),_0x190dc0);});const _0x149679=_0x445c19['data']['toView'](_0x190dc0)['getChild'](0x0);return _0xd8a7b['closest'](_0x149679['name']);}reactivateMarkers(_0x480d5b){const _0x5153a2=this['_getMarkersDataForGroup'](_0x480d5b);if(!_0x5153a2['length'])return;const _0x44d5aa=Array['from'](this['_activeMarkers'])['sort'](),_0x4c6db2=Array['from'](new Set(_0x5153a2['map'](_0x419f25=>_0x419f25['id'])))['sort']();_0x44d5aa['join']('|')!==_0x4c6db2['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x480d5b));}setMarkersInElementAsActive(_0xd6e468){const _0x21eead=this['_getMarkersDataForGroup'](_0xd6e468);if(!_0x21eead['length'])return;const _0x417300=_0x21eead[0x0]['editor'],_0x5a5a3a=new Set(_0x21eead['map'](_0x4bf528=>_0x4bf528['id'])),_0x852686=Array['from'](_0x5a5a3a['values']())['map'](_0x54dc34=>_0x417300['model']['markers']['get'](_0x54dc34))['filter'](_0x549ca7=>!!_0x549ca7);_0x5a5a3a['forEach'](_0x2ef70d=>{this['_activeMarkers']['add'](_0x2ef70d);}),_0x417300['model']['change'](()=>{_0x852686['forEach'](_0x1c8e7b=>{_0x417300['editing']['reconvertMarker'](_0x1c8e7b);});});}setAllMarkersAsInactive(){const _0x4db1e1=Array['from'](this['_activeMarkers']);if(!_0x4db1e1['length'])return;this['_activeMarkers']['clear']();const _0x3463dc=new Map();for(const _0x5040f0 of _0x4db1e1){const _0x3027a7=this['_markers']['get'](_0x5040f0);if(!_0x3027a7)continue;const _0x28d35a=_0x3027a7['editor'],_0x46c5ee=_0x28d35a['model']['markers']['get'](_0x5040f0);_0x46c5ee&&(_0x3463dc['has'](_0x28d35a)||_0x3463dc['set'](_0x28d35a,[]),_0x3463dc['get'](_0x28d35a)['push'](_0x46c5ee));}for(const [_0x39384f,_0x37b457]of _0x3463dc)_0x39384f['model']['change'](()=>{_0x37b457['forEach'](_0x2352be=>{_0x39384f['editing']['reconvertMarker'](_0x2352be);});});}_getPositionLimitingRange(_0x43cbba,_0x2d73bd,_0x51ca54='outside'){if(!_0x43cbba)return null;let _0x2a2ec4=_0x43cbba['parent'];for(;_0x2a2ec4&&_0x2a2ec4['parent']&&!_0x2a2ec4['parent']['is']('rootElement')&&!_0x2d73bd['model']['schema']['isLimit'](_0x2a2ec4)&&!_0x2d73bd['model']['schema']['isBlock'](_0x2a2ec4);)_0x2a2ec4=_0x2a2ec4['parent'];if(!_0x2a2ec4||!_0x2a2ec4['name']||_0x2a2ec4['is']('rootElement'))return null;let _0x1a7b08=null;return _0x2d73bd['model']['change'](_0x26840f=>{_0x1a7b08='inside'===_0x51ca54?_0x26840f['createRangeIn'](_0x2a2ec4):_0x26840f['createRangeOn'](_0x2a2ec4);}),_0x1a7b08;}_validateMarkers(_0x137f40,_0x356b08){const _0x492b0d=Array['from'](this['_markers']['keys']()),_0x4d984c=new Map();for(const _0x27f27a of _0x492b0d){const _0x3693e5=_0x137f40['model']['markers']['get'](_0x27f27a);if(!_0x3693e5)continue;const _0x2feadb=_0x3693e5['getStart']()['root']['rootName']+':'+_0x3693e5['getStart']()['path'][0x0];_0x4d984c['has'](_0x2feadb)||_0x4d984c['set'](_0x2feadb,[]),_0x4d984c['get'](_0x2feadb)['push'](_0x3693e5);}const _0x17b25c=new Set();for(const _0x29cf3b of _0x137f40['model']['document']['differ']['getChanges']()){let _0x5b1109,_0x4ce43e;if('insert'===_0x29cf3b['type'])_0x4ce43e=new _0x4b6f52(_0x29cf3b['position'],_0x29cf3b['position']['getShiftedBy'](_0x29cf3b['length'])),_0x5b1109=_0x29cf3b['position']['root']['rootName']+':'+_0x29cf3b['position']['path'][0x0];else{if('remove'!==_0x29cf3b['type'])continue;_0x4ce43e=new _0x4b6f52(_0x29cf3b['position']),_0x5b1109=_0x29cf3b['position']['root']['rootName']+':'+_0x29cf3b['position']['path'][0x0];}const _0x277fd4=_0x4d984c['get'](_0x5b1109)||[];if(_0x277fd4['length']){for(const _0x4d6455 of _0x277fd4)if(_0x4ce43e['root']['rootName']===_0x4d6455['getRange']()['root']['rootName']&&('insert'!==_0x29cf3b['type']||!_0x4ce43e['containsRange'](_0x4d6455['getRange']()))&&(_0x4ce43e['isIntersecting'](_0x4d6455['getRange']())||_0x4ce43e['start']['isTouching'](_0x4d6455['getRange']()['end'])||_0x4ce43e['end']['isTouching'](_0x4d6455['getRange']()['start']))){const _0x51baf0=this['_parseMarkerName'](_0x4d6455['name']);Array['from'](this['_markers']['values']())['filter'](_0x25999f=>_0x25999f['groupId']===_0x51baf0['groupId'])['forEach'](_0x439be2=>_0x17b25c['add'](_0x439be2['id']));}}}if(_0x17b25c['size']){for(const _0x5ac092 of _0x17b25c)_0x356b08['removeMarker'](_0x5ac092);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x377e35){for(const {name:_0x16ad67,data:_0x3221cb}of _0x377e35['model']['document']['differ']['getChangedMarkers']()){if(!_0x16ad67['startsWith'](Lh))continue;const _0x119e95=_0x3221cb['oldRange'],_0x345b1a=_0x3221cb['newRange'],_0x17a900=_0x119e95&&'$graveyard'===_0x119e95['root']['rootName'],_0x4a18bd=_0x345b1a&&'$graveyard'===_0x345b1a['root']['rootName'];if(_0x17a900&&_0x4a18bd)continue;const _0x29ad9a=this['_parseMarkerName'](_0x16ad67);this['_markers']['get'](_0x16ad67)&&(_0x4a18bd||!_0x345b1a?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x16ad67,'changeId':_0x29ad9a['groupId']}):_0x17a900&&_0x345b1a&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x16ad67,'changeId':_0x29ad9a['groupId']}));}}['_parseMarkerName'](_0x5543dc){const _0x57393f=_0x5543dc['split'](':'),_0x1aa34a=(_0x57393f[0x1]||'')['split']('_');return{'prefix':_0x57393f[0x0],'groupId':_0x1aa34a[0x0],'suffix':_0x1aa34a[0x1]};}_translateOperationToEditorContent(_0x2f9f5b,_0x24a647,_0x46d897){if('insert'===_0x2f9f5b['type']){const _0x877f1e=_0x2f9f5b;return new _0xdb67b4(this['_changePosition'](_0x24a647['concat'](_0x877f1e['position']['offset']),_0x46d897),_0x877f1e['nodes'],_0x877f1e['baseVersion']);}if('marker'===_0x2f9f5b['type']&&_0x2f9f5b['name']['startsWith']('$markedRemove')){const _0x1ac715=_0x2f9f5b;return new _0x508b00(_0x1ac715['name'],_0x1ac715['oldRange'],this['_changeRange'](_0x1ac715['newRange'],_0x24a647['concat'](_0x1ac715['newRange']['start']['offset']),_0x24a647['concat'](_0x1ac715['newRange']['end']['offset']),_0x46d897),_0x1ac715['_markers'],_0x1ac715['affectsData'],_0x1ac715['baseVersion']);}return _0x2f9f5b;}_groupAdjacentOperations(_0xb8860){if(!_0xb8860['length'])return[];const _0x165666=[];let _0x274982=0x0,_0x160c0d=0x0,_0x6d19cc=[];for(let _0x566761=0x0;_0x566761<=_0xb8860['length'];_0x566761++){const _0x3be2d9=_0xb8860[_0x566761],_0x23d21d=_0xb8860[_0x566761-0x1];!_0x3be2d9||_0x23d21d&&!this['_getOperationEnd'](_0x23d21d)['isTouching'](this['_getOperationStart'](_0x3be2d9))?(_0x165666['push']({'operations':_0x6d19cc,'operationsIsolated':_0x6d19cc['map'](_0x2b0e20=>this['_shiftOperation'](_0x2b0e20['clone'](),-_0x160c0d)),'groupOffset':_0x274982}),_0x6d19cc=_0x3be2d9?[_0x3be2d9]:[],_0x160c0d+=_0x274982,_0x274982=0x0):_0x6d19cc['push'](_0x3be2d9),_0x3be2d9&&'insert'===_0x3be2d9['type']&&(_0x274982+=_0x3be2d9['howMany']);}return _0x165666;}_findAdjacentContextDistance(_0x489263,_0x34a146,_0x2cf087,_0x14c471=0x1){const _0x2e72e2=new _0x508ddf({'startPosition':_0x489263,'direction':_0x34a146});let _0x519e25=0x0;for(let _0x5a2611=0x0;_0x5a2611<_0x14c471;_0x5a2611++){let _0x1ed60b=0x0,_0x4da930=!0x1,_0x59c012='forward'===_0x34a146?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x7c6bff}of _0x2e72e2)if(_0x7c6bff['is']('$textProxy')){const _0x1ff736=_0x59c012['exec'](_0x7c6bff['data']);if(_0x1ff736&&_0x1ff736['length']){if(_0x1ed60b+='forward'===_0x34a146?_0x1ff736['index']+_0x1ff736[0x0]['length']:_0x7c6bff['data']['length']-_0x1ff736['index'],_0x1ff736[0x0]['length']!==_0x7c6bff['data']['length'])break;_0x4da930=!0x0,_0x59c012='forward'===_0x34a146?/^\w+/:/\w+$/;}else{if(_0x4da930)break;_0x1ed60b+=_0x7c6bff['offsetSize'];}}else{if(_0x7c6bff['is']('element')){_0x2cf087['isInline'](_0x7c6bff)&&!_0x4da930&&(_0x1ed60b+=0x1);break;}}_0x519e25+=_0x1ed60b,_0x2e72e2['jumpTo'](_0x489263['getShiftedBy']('forward'===_0x34a146?_0x519e25:-_0x519e25));}return _0x519e25;}_getChangeContext(_0x54b190,_0xcf05a7,_0x496427){const _0x38809b=_0x496427['model']['schema'],_0x2102e1=this['_findAdjacentContextDistance'](_0x54b190,'backward',_0x38809b,0x6),_0x1d0a5b=this['_findAdjacentContextDistance'](_0xcf05a7,'forward',_0x38809b,0x6),_0xd6ba4e=_0x54b190['getShiftedBy'](-_0x2102e1),_0x21c7c5=_0xcf05a7['getShiftedBy'](_0x1d0a5b);return{'start':_0xd6ba4e,'end':_0x21c7c5,'hasContentBefore':!_0xd6ba4e['isAtStart'],'hasContentAfter':!_0x21c7c5['isAtEnd']};}_insertMarkers(_0x377a10,_0x4c6722){const _0x5131d1=this['context']['plugins']['get']('AIEditing'),_0x247175=new Set();_0x4c6722['model']['change'](_0x9413a4=>{for(const _0x4869c2 of _0x377a10){const _0x578611=''+Lh+_0x4869c2['type']+':'+_0x4869c2['groupId']+'_'+_0x5131d1['_nextDataId'](_0x247175);this['_markers']['set'](_0x578611,{'id':_0x578611,'groupId':_0x4869c2['groupId'],'type':_0x4869c2['type'],'content':_0x4869c2['content'],'editor':_0x4c6722}),_0x9413a4['addMarker'](_0x578611,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x9413a4['createRange'](_0x4869c2['start'],_0x4869c2['end'])});}});}_createGetContextFn(_0x1d4f3f,_0x1596bb,_0x2d0b6c){let _0x5ca371='';return()=>{if(!_0x5ca371){const _0x53a6b8=_0x1596bb['toView'](_0x1d4f3f,{'showSuggestionHighlights':!0x0});let _0x35eacf=_0x53a6b8['getChild'](0x0);if(_0x35eacf['is']('containerElement')||(_0x35eacf=_0x53a6b8),!_0x35eacf)return'';let _0x21d223=!0x1;const _0xa6baa5=[];for(const _0x1cdc5b of _0x35eacf['getChildren']())_0x1cdc5b['is']('element','span')&&_0x1cdc5b['hasClass']('ck-ai_review-marker_context-end')&&(_0x21d223=!0x1),_0x21d223&&_0xa6baa5['push'](_0x1cdc5b),_0x1cdc5b['is']('element','span')&&_0x1cdc5b['hasClass']('ck-ai_review-marker_context-start')&&(_0x21d223=!0x0);_0x35eacf['_removeChildren'](0x0,_0x35eacf['childCount']),_0x2d0b6c?.['ellipsisBefore']&&_0x35eacf['_appendChild']('…'),_0x35eacf['_appendChild'](_0xa6baa5),_0x2d0b6c?.['ellipsisAfter']&&_0x35eacf['_appendChild']('…');const _0x3513b6=_0x1596bb['htmlProcessor']['domConverter']['viewToDom'](_0x53a6b8),_0x3d83d0=_0x1596bb['htmlProcessor']['htmlWriter']['getHtml'](_0x3513b6);_0x5ca371=this['_removeUnsupportedElements'](_0x3d83d0);}return _0x5ca371;};}_createGetContentFn(_0x1426b1,_0x1b384a){let _0x222c55='';return()=>(_0x222c55||(_0x222c55=this['_removeUnsupportedElements'](_0x1b384a['stringify'](_0x1426b1,{'showSuggestionHighlights':!0x0}))),_0x222c55);}_createGetContentUsingDataIdFn(_0x5bb773,_0x2569ec,_0x4ff11e){let _0x44fde9='';return()=>{if(!_0x44fde9){const _0x363643=_0x4ff11e['toView'](new _0x5a34ce(_0x5bb773));_0x44fde9=_0x4ff11e['htmlProcessor']['domConverter']['viewToDom'](_0x363643)['querySelector']('[data-id=\x22'+_0x2569ec+'\x22]')?.['outerHTML']||'';}return _0x44fde9;};}_removeUnsupportedElements(_0x38187b){if(!_0x38187b)return'';const _0xc3151c=Rs(_0x38187b,{'decodeEntities':!0x1}),_0x4ebde3=ys(_0xc3151c);if(!_0x4ebde3['length'])return _0x38187b;for(const _0x81dac of _0x4ebde3)_0x356c4e(_0x81dac);return Os(_0xc3151c,{'encodeEntities':!0x1});}_neutralizeChangesOnUnsupportedElements(_0x58887e,_0x2429e9){const _0x54845d=Rs(_0x58887e,{'decodeEntities':!0x1}),_0xc2b955=Rs(_0x2429e9,{'decodeEntities':!0x1}),_0x14a6b8=ys(_0x54845d),_0x47fc4e=ys(_0xc2b955);if(!_0x14a6b8['length']&&!_0x47fc4e['length'])return{'contentInitial':_0x58887e,'contentNew':_0x2429e9};const _0x550465=new Map(),_0x12f960=new Map();for(const _0xcd3a4e of _0x14a6b8){const _0x4eb6ca=Ps(_0xcd3a4e,'data-id');if(_0x4eb6ca)_0x550465['set'](_0x4eb6ca,_0xcd3a4e);else{const _0x2a6eff=Os(_0xcd3a4e,{'encodeEntities':!0x1}),_0x1c5d22=_0x12f960['get'](_0x2a6eff);_0x1c5d22?_0x1c5d22['push'](_0xcd3a4e):_0x12f960['set'](_0x2a6eff,[_0xcd3a4e]);}}for(const _0x59b1a3 of _0x47fc4e){const _0x4f0e70=Ps(_0x59b1a3,'data-id');let _0xb8fe5a;if(_0x4f0e70)_0xb8fe5a=_0x550465['get'](_0x4f0e70);else{const _0x589183=_0x12f960['get'](Os(_0x59b1a3,{'encodeEntities':!0x1}));_0xb8fe5a=_0x589183&&_0x589183['length']?_0x589183['shift']():void 0x0;}_0xb8fe5a?_0x147a80(_0x59b1a3,_0x34616a(_0xb8fe5a,!0x0)):_0x356c4e(_0x59b1a3);}return{'contentInitial':Os(_0x54845d,{'encodeEntities':!0x1}),'contentNew':Os(_0xc2b955,{'encodeEntities':!0x1})};}_findMarkerElement(_0x3e40d4,_0x546d56=0x5){let _0x1e5d4=_0x3e40d4,_0x3bd44f=null;for(let _0x211f21=0x0;_0x211f21<_0x546d56&&_0x1e5d4;_0x211f21++)if(_0x1e5d4['className']){if((''+_0x1e5d4['className'])['includes']('ck-ai_review-marker_')){if(!_0x1e5d4['getAttribute']('data-marker-id'))break;_0x3bd44f=_0x1e5d4;break;}_0x1e5d4=_0x1e5d4['parentElement'];}else _0x1e5d4=_0x1e5d4['parentElement'];return _0x3bd44f;}_findMarkerElementById(_0x16f889){const _0x50dd55=this['_markers']['get'](_0x16f889);if(!_0x50dd55)return null;const _0x1ef82a=_0x50dd55['editor']['model']['markers']['get'](_0x16f889);return _0x1ef82a?_0x59f2a2(_0x50dd55['editor']['editing'],_0x1ef82a):null;}_getMarkersDataForGroup(_0x353ad2){return Array['from'](this['_markers']['values']())['filter'](_0x4c2de6=>_0x4c2de6['groupId']===_0x353ad2);}_getOperationStart(_0x3dbca8){return'insert'===_0x3dbca8['type']?_0x3dbca8['position']:_0x3dbca8['newRange']['start'];}_getOperationEnd(_0x255d07,_0xa0c119=!0x1){return'insert'===_0x255d07['type']?_0xa0c119?_0x255d07['position']:_0x255d07['position']['getShiftedBy'](_0x255d07['howMany']):_0x255d07['newRange']['end'];}_shiftOperation(_0x17561c,_0x7058a0){return'insert'===_0x17561c['type']?_0x17561c['position']=_0x17561c['position']['getShiftedBy'](_0x7058a0):'marker'===_0x17561c['type']&&_0x17561c['newRange']&&(_0x17561c['newRange']=new _0x4b6f52(_0x17561c['newRange']['start']['getShiftedBy'](_0x7058a0),_0x17561c['newRange']['end']['getShiftedBy'](_0x7058a0))),_0x17561c;}_changeOperationOwnerDocument(_0x485374,_0x247055){'insert'===_0x485374['type']?_0x485374['position']=this['_changePositionOwnerDocument'](_0x485374['position'],_0x247055):'marker'===_0x485374['type']&&_0x485374['newRange']&&(_0x485374['newRange']=this['_changeRangeOwnerDocument'](_0x485374['newRange'],_0x247055));}_changePositionOwnerDocument(_0x103a76,_0x3ae677){return new _0x3a6639(_0x3ae677,_0x103a76['path']);}_changeRangeOwnerDocument(_0x15b52e,_0x1ac3d6){return new _0x4b6f52(this['_changePositionOwnerDocument'](_0x15b52e['start'],_0x1ac3d6),this['_changePositionOwnerDocument'](_0x15b52e['end'],_0x1ac3d6));}_changePosition(_0x5b4e04,_0x1e9af6){return new _0x3a6639(_0x1e9af6,[..._0x5b4e04]);}['_changeRange'](_0x4cc138,_0x2ad88b,_0x194fc8,_0x1b176b){return new _0x4b6f52(this['_changePosition'](_0x2ad88b,_0x1b176b),this['_changePosition'](_0x194fc8,_0x1b176b));}_sortMarkers(_0x233e37){const _0x28e1fc=_0x42c7c8=>{switch(_0x42c7c8){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x233e37['sort']((_0x4da0b3,_0xe14cbe)=>_0x28e1fc(_0x4da0b3['type'])-_0x28e1fc(_0xe14cbe['type']));}_hasSameTopLevelElement(_0x4c5c08,_0x2d64ac){const _0x561ccd=_0x4c5c08['getChild'](0x0),_0x161e90=_0x2d64ac['getChild'](0x0);return!(!_0x561ccd||!_0x161e90)&&((!_0x561ccd['is']('element')||!_0x161e90['is']('element')||_0x561ccd['name']===_0x161e90['name'])&&!(_0x561ccd['is']('element')&&!_0x161e90['is']('element')||!_0x561ccd['is']('element')&&_0x161e90['is']('element')));}_haveSingleTopLevelElement(_0x2874d5){return 0x1===_0x2874d5['childCount'];}_haveOnlyInlineContent(_0x109a92,_0x431dbd){for(const _0x462d26 of _0x109a92['getChildren']())if(_0x462d26['is']('element')&&!_0x431dbd['isInline'](_0x462d26))return!0x1;return!0x0;}_upsertDataId(_0x429f57,_0x37c1ca){let _0x3b6d1a=_0x429f57['getAttribute'](_0x19f2f9);return _0x3b6d1a||(_0x3b6d1a=_0x37c1ca(),_0x429f57['_setAttribute'](_0x19f2f9,_0x3b6d1a)),_0x3b6d1a;}};const Mh=/* #__PURE__ -- @preserve */
|
|
38
|
+
dt();var Uh=class extends Mh{['id'];contentNew;contentInitial;documentVersion;constructor({id:_0x57a38f,contentNew:_0x1748e0,contentInitial:_0xa51d3a,documentVersion:_0x36e485}){super(),this['id']=_0x57a38f,this['contentNew']=_0x1748e0,this['contentInitial']=_0xa51d3a,this['documentVersion']=_0x36e485;}};const Vh=/* #__PURE__ -- @preserve */
|
|
39
|
+
At();var Bh=class extends Vh{['id'];parent;editor;_data;_editorOperations=[];constructor(_0x41b19f,_0x18bc84,_0x445b30,_0x2376da){super(),this['id']=_0x41b19f,this['parent']=_0x445b30,this['editor']=_0x2376da,this['_data']=_0x18bc84,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(_0x23e12a){const _0x183ca7=Rs(_0x23e12a)['children']['filter'](_0x2159f2);return 0x1!==_0x183ca7['length']?_0x23e12a:_0x183ca7[0x0]['children']['map'](_0x5657aa=>Os(_0x5657aa))['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(_0x5e76f4,_0xc37315,_0x172dff,_0x4278e2,_0x1a336c,_0x14d09e){super(),this['_sourceCheck']=_0xc37315,this['_documentData']=_0x5e76f4,this['_aiConnector']=_0x172dff,this['_reviewParams']=_0x4278e2,this['_reviewArgs']=_0x1a336c,this['_contexts']=_0x14d09e,this['on']('change:status',(_0x3da641,_0x4801a4,_0x56120e)=>{'aborted'==_0x56120e&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x56120e,'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'](_0x30d5dc=>'pending'===_0x30d5dc['status']);}get currentError(){return this['_currentError'];}get results(){return Array['from'](this['_results']['values']());}updateDocumentData(_0x462497){this['_documentData']=_0x462497;}async start(){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x44ef5f=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x56cb62 of _0x44ef5f)'unmodified'!==_0x56cb62['data']['operation']&&('error'!==_0x56cb62['data']['operation']?'review-metadata'!==_0x56cb62['event']?this['_addReviewCheckResult'](_0x56cb62['data']['dataId'],_0x56cb62['data']['textDelta']):this['callId']=_0x56cb62['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(_0x3ff808){this['_currentError']=_0x3ff808,kn(_0x3ff808)?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(_0x23d5f0,_0x89339){const _0x1f83de=this['_results']['get'](_0x23d5f0);if(!_0x1f83de)return;if(0x0===_0x89339['length'])return;const _0x1b952a=this['_documentData']['elements']['get'](_0x23d5f0);if(!_0x1b952a)return;const _0x1b5bc1=[];_0x89339['forEach']((_0x2b10d6,_0x3c146a)=>{const _0x291292=new Bh(_0x1f83de['id']+'-'+_0x3c146a,_0x2b10d6,_0x1f83de,_0x1b952a['editor']);_0x291292['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x291292,'status':_0x291292['status']});}),_0x291292['on']('change:isActivated',()=>{_0x291292['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x291292}):this['fire']('reviewCheckResultDeactivated',{'change':_0x291292});}),this['_changes']['push'](_0x291292),_0x1b5bc1['push'](_0x291292);}),this['fire']('reviewCheckResultReady',{'changes':_0x1b5bc1,'result':_0x1f83de,'source':this});}abort(){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}isChangeActive(_0xb36726){const _0x522693=this['_changes']['find'](_0x10705b=>_0x10705b['id']===_0xb36726);return!(!_0x522693||'pending'!==_0x522693['status']);}isAnyChangeActivated(){return this['_changes']['some'](_0x19fc87=>!0x0===_0x19fc87['isActivated']);}getActiveChanges(){return this['_changes']['filter'](_0x46d967=>'pending'===_0x46d967['status']);}getChangeById(_0x57b37c){return this['_changes']['find'](_0x4050c5=>_0x4050c5['id']===_0x57b37c);}markAllChangesAsAccepted(){for(const _0x447113 of this['_changes'])'pending'===_0x447113['status']&&(_0x447113['status']='accepted');this['_checkIfFinished']();}markChangeAsAccepted(_0xac5ef1){const _0x5a7b92=this['_changes']['find'](_0x2182b7=>_0x2182b7['id']===_0xac5ef1);_0x5a7b92&&'pending'===_0x5a7b92['status']&&(_0x5a7b92['status']='accepted'),this['_checkIfFinished']();}markChangeAsRejected(_0x3a3259){const _0x3dfea5=this['_changes']['find'](_0x460f02=>_0x460f02['id']===_0x3a3259);_0x3dfea5&&'pending'===_0x3dfea5['status']&&(_0x3dfea5['status']='rejected'),this['_checkIfFinished']();}markChangeAsOutdated(_0x306322){const _0x163eca=this['_changes']['find'](_0x2c09e1=>_0x2c09e1['id']===_0x306322);_0x163eca&&'pending'===_0x163eca['status']&&(_0x163eca['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x46b601){const _0x4d7f77=this['_changes']['find'](_0x3271b2=>_0x3271b2['id']===_0x46b601);_0x4d7f77&&'outdated'===_0x4d7f77['status']&&(_0x4d7f77['status']='pending'),this['_checkIfFinished']();}activateChange(_0x4de604){this['_changes']['filter'](_0x26c7a2=>_0x26c7a2['isActivated']&&_0x26c7a2['id']!==_0x4de604)['forEach'](_0xd83889=>{_0xd83889['isActivated']=!0x1;});const _0x3b32f1=this['_changes']['find'](_0x64d2c7=>_0x64d2c7['id']===_0x4de604);_0x3b32f1&&'pending'===_0x3b32f1['status']&&(_0x3b32f1['isActivated']=!0x0);}deactivateChange(){this['_changes']['filter'](_0x12e310=>_0x12e310['isActivated'])['forEach'](_0x2c8cba=>{_0x2c8cba['isActivated']=!0x1;});}forceReadyState(){this['status']='ready';}async sendRating(_0x52d33f){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x42be56;if(_0x52d33f){const _0x35a0a7=this['_changes']['find'](_0x4885a4=>_0x4885a4['id']===_0x52d33f);if(_0x35a0a7&&_0x35a0a7['isRated'])return;_0x35a0a7&&(_0x42be56=_0x35a0a7['parent']['id'],_0x35a0a7['isRated']=!0x0);}const _0x11ceac={'positiveCount':this['_changes']['filter'](_0x5228bc=>'accepted'===_0x5228bc['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x11ceac,this['callId'],_0x42be56);}_addReviewCheckResult(_0x144ef0,_0xbe5ddb){const _0x19f07b=this['_documentData']['elements']['get'](_0x144ef0);if(!_0x19f07b)return;if(Gs(_0x19f07b['editor'],_0x19f07b['rootName'])&&!Ys(_0x19f07b['editor'],Rs(_0xbe5ddb)))return void(this['_hasUnsupportedInlineChange']=!0x0);const _0x5e70d8=_0x19f07b['getContent']();if(_0x5e70d8===_0xbe5ddb)return;const _0x393b7c=new Uh({'id':_0x144ef0,'contentInitial':_0x5e70d8,'contentNew':_0xbe5ddb,'documentVersion':_0x19f07b['documentVersion']});this['_results']['set'](_0x393b7c['id'],_0x393b7c),this['fire']('reviewCheckResultAdded',{'result':_0x393b7c,'source':this,'editor':_0x19f07b['editor'],'rootName':_0x19f07b['rootName']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0x17774a=>'pending'===_0x17774a['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x45746d=>'pending'===_0x45746d['status'])['length']&&(this['status']='finished');}},Kh=class extends Fh{get subTitle(){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x27f2f3=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x25749f=0x0;_0x25749f<this['_reviewParams']['length'];_0x25749f++){if(!this['_reviewParams'][_0x25749f]||!this['_sourceCheck']['options'][_0x25749f])continue;const _0x20680b=this['_sourceCheck']['options'][_0x25749f]['data']?.['find'](_0x153ec9=>_0x153ec9['id']===this['_reviewParams'][_0x25749f]);_0x20680b&&_0x27f2f3['push'](_0x20680b['label']);}return _0x27f2f3['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(_0x3e515f,_0x1fbff9,_0x3e64a6){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x1fbff9,_0x3e515f,_0x3e64a6);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},Wh=class extends _0x57f218{_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',(_0x4eaa68,_0x147962)=>this['runCheck'](_0x147962)),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 _0x372031=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x372031['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x372031['map'](_0x47d30e=>_0x47d30e['id']),this['_aiSource']);const _0x3e99bf=this['_currentReviewCheckRun'];_0x3e99bf['markAllChangesAsAccepted'](),_0x3e99bf['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x5441e3,_0x212636)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x212636['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x212636['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x212636['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x212636['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x29b7c7,_0x1856c9)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x1856c9['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x1856c9['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x1856c9['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x1856c9['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',(_0x593f84,_0x16d5d6)=>{this['_onActivateChange'](_0x16d5d6);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x3f72bc,_0x3b817c)=>{this['_onDeactivateChange'](_0x3b817c);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x107212,_0x11e797)=>{this['_onChangeMarkerClicked'](_0x107212,_0x11e797);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x392680,_0x346b86)=>{this['_onChangeMarkerHovered'](_0x392680,_0x346b86);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x5c8306,_0x24b6dd)=>{this['_onChangeMarkerRemoved'](_0x5c8306,_0x24b6dd);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x3e865d,_0x290569)=>{this['_onChangeMarkerRestored'](_0x3e865d,_0x290569);});}async['runCheck'](_0x2f3c19){if(!this['_availableReviewChecks'])return;const _0x5889e7=this['_availableReviewChecks']['find'](_0x1e5e2a=>_0x1e5e2a['id']===_0x2f3c19['id']);if(!_0x5889e7)return void this['_logError'](new ct('ai-review-mode-source-check-not-found',this,{'checkId':_0x2f3c19['id']}));this['_onReviewCheckRun'](_0x2f3c19),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_aiReviewCoreUi']['setAcceptAllEnabled'](!0x1);const _0x34aac5=this['context']['plugins']['get'](fs)['contextLibrary']['resolveContext']({'feature':this['_defaultContextFeature'],'ids':[_0x2f3c19['id']],'context':new Yn()});this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x2f3c19,_0x5889e7,_0x34aac5);const _0x423e37=this['_currentReviewCheckRun'];_0x423e37['on']('reviewCheckResultChangeStatusUpdated',(_0x5f588a,_0x334269)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x334269['change']['id'],_0x334269['status']),this['_pushAcceptAllEnabled'](_0x423e37);}),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x210e64,_0x3ae3c7)=>{switch(_0x3ae3c7['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x3ae3c7);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'!==_0x3ae3c7['status']&&'error-chunk'!==_0x3ae3c7['status']&&'error-general'!==_0x3ae3c7['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x1bd0e8,_0x1fd1a3)=>{if(!this['_currentReviewCheckRun'])throw new ct('ai-review-mode-no-current-check-run',this);const _0x1a6237=Gs(_0x1fd1a3['editor'],_0x1fd1a3['rootName']);let _0x26716a=_0x1fd1a3['result']['contentInitial'],_0x124d5c=_0x1fd1a3['result']['contentNew'];_0x1a6237&&(_0x26716a=Ws(_0x26716a),_0x124d5c=Ws(_0x124d5c));const _0x492344=this['_diffContent'](_0x1fd1a3['editor'],_0x26716a,_0x124d5c);if(_0x1a6237){const _0x3180e3=_0x1fd1a3['editor']['ui']['getEditableElement'](_0x1fd1a3['rootName'])?.['tagName']['toLowerCase']();for(const _0x32c50e of _0x492344)_0x32c50e['wrapperTag']=_0x3180e3;}_0x1fd1a3['source']['addResultChanges'](_0x1fd1a3['result']['id'],_0x492344);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x5cdc0c,_0x1b45b6)=>{for(const _0x3693fa of _0x1b45b6['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x3693fa);this['_pushAcceptAllEnabled'](_0x1b45b6['source']),this['_markChangePositionInEditorContent'](_0x1b45b6['changes'],_0x1b45b6['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x5701f1,_0xc2312f)=>{this['_onReviewCheckResultActivated'](_0xc2312f);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x3e0125){if(kn(_0x3e0125))return;_0x3e0125 instanceof ct?this['_logError'](_0x3e0125):this['_logError'](new ct('ai-review-mode-check-run-failed',this,void 0x0,_0x3e0125));}}abort(){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}getAvailableChecks(){return(this['_availableReviewChecks']??[])['slice']();}getCurrentCheckRun(){return this['_currentReviewCheckRun'];}_pushAcceptAllEnabled(_0x31b792){this['_aiReviewCoreUi']['setAcceptAllEnabled'](_0x31b792['getActiveChanges']()['length']>0x0);}_createReviewCheckRun(_0x58a119,_0x7989b7,_0x2eb36d=new Yn()){return new Kh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x7989b7,this['_aiConnector'],_0x58a119['params'],_0x58a119['args'],_0x2eb36d['refs']);}['_onChangeMarkerRemoved'](_0x252905,_0x4fc592){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x4fc592['changeId']);}_onChangeMarkerRestored(_0x132897,_0x4e412d){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x4e412d['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}_initRequiredPlugins(){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](Nn)['createReporter']('aireview');}['_onReviewRunLeave'](_0x552715=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x552715&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x2873d4 of this['_aiReviewCoreEditing']['getEditors']())_0x2873d4['editing']['view']['change'](_0x23820a=>{for(const _0x45b978 of _0x2873d4['editing']['view']['document']['getRoots']())_0x23820a['removeClass']('ck-ai_review-diff',_0x45b978),_0x23820a['removeClass']('ck-ai_review-highlights',_0x45b978),_0x23820a['removeClass']('ck-ai-translate-mode-content',_0x45b978);});}['_logError'](_0xed849e){this['_reporter']['logError'](_0xed849e),'ai-review-mode-models-unable-to-retrieve'===function(_0x6062da){return _0x6062da instanceof yn?_0x6062da['code']:_0x6062da instanceof Error?_0x6062da['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0xed849e)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0x1b30d7){if('content'===this['_changeActivationSource']){const _0x14b7fd=this['_aiReviewCoreUi']['getChangeElement'](_0x1b30d7);_0x14b7fd&&Rt(_0x14b7fd['closest']('.ck-ai_review__check-run-result')||_0x14b7fd);}else{if('panel'===this['_changeActivationSource']){const _0x27c913=this['_getChangeContentElement'](_0x1b30d7);if(!_0x27c913)return;Ot({'target':_0x27c913,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},Yh=class extends Fh{_prompt;['_model'];constructor(_0x478b54,_0x19047b,_0x68da6,_0x156312,_0x26a7d3,_0x39487c){super(_0x68da6,_0x156312,_0x26a7d3,void 0x0,void 0x0,_0x39487c),this['_prompt']=_0x478b54,this['_model']=_0x19047b;}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(_0x93a5fd,_0xc535d9,_0x47ae57){return this['_aiConnector']['upsertCustomAIReviewRating'](_0xc535d9,_0x93a5fd,_0x47ae57);}},$h=class{['id'];['commandId'];title;description;isParameterized;['useArgs'];options;['args'];get['apiId'](){return this['commandId'];}constructor(_0x4290c8){this['id']=_0x4290c8['id'],this['commandId']=_0x4290c8['commandId'],this['title']=_0x4290c8['title'],this['description']=_0x4290c8['description'],this['isParameterized']=_0x4290c8['isParameterized'],this['useArgs']=_0x4290c8['useArgs'],this['options']=_0x4290c8['options'],this['args']=_0x4290c8['args'];}},qh=class extends $h{isExtra=!0x0;prompt;context;['model'];_defaultModel=null;constructor(_0x360b2d,_0x5f1a74,_0x149863){super(_0x360b2d),this['prompt']=_0x360b2d['prompt'],this['context']=_0x360b2d['context'],this['model']=_0x360b2d['model'],this['model']?this['_defaultModel']=_0x5f1a74['find'](_0x8782bf=>_0x8782bf['id']===this['model'])||null:this['_defaultModel']=_0x149863;}get defaultModel(){return this['_defaultModel'];}},Qh=class extends Yh{get subTitle(){return'';}set prompt(_0x4cadfb){this['_prompt']=_0x4cadfb;}set['model'](_0x4ab5d8){this['_model']=_0x4ab5d8;}},Xh=class extends _0x57f218{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(_0x50c771){this['_checks']=_0x50c771['map'](_0x1ca639=>new $h(_0x1ca639));}get['checks'](){return this['_checks']['slice']();}getCheckById(_0x5ef6aa){return this['checks']['find'](_0x4a446a=>_0x4a446a['id']===_0x5ef6aa);}['removeCheckById'](_0x110561){this['_checks']=this['_checks']['filter'](_0x3d451d=>_0x3d451d['id']!==_0x110561);}},Zh=class extends $h{['_models']=[];_defaultModel=null;constructor(_0xc8e0df,_0x139a34,_0x4438e9){super(_0xc8e0df),this['_models']=_0x139a34,this['_defaultModel']=_0x4438e9;}get['models'](){return this['_models']['slice']();}get defaultModel(){return this['_defaultModel'];}},tc=class extends Jh{['_allModels']=[];['_recommendedModels']=[];_defaultModel=null;constructor(_0x352131,_0x500db9,_0x3dc1e7){super(),this['_allModels']=_0x352131,this['_recommendedModels']=_0x500db9,this['_defaultModel']=_0x3dc1e7;}get['allModels'](){return this['_allModels']['slice']();}setupChecks(_0x72622d){this['_checks']=_0x72622d['map'](_0x42e8a6=>!0x0===_0x42e8a6['isExtra']?new qh(_0x42e8a6,this['_allModels'],this['_defaultModel']):'custom'===_0x42e8a6['id']?new Zh(_0x42e8a6,this['_recommendedModels'],this['_defaultModel']):new $h(_0x42e8a6));}},ec=class extends Xh{static get['pluginName'](){return'AIReviewModeCheckRegistry';}static get requires(){return[Is,Nn,fs];}['_modelsLoadError']=null;constructor(_0x65701c){super(_0x65701c),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}getExtraChecks(){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0xaac035=>({'id':_0xaac035['id'],'commandId':_0xaac035['id'],'title':_0xaac035['label'],'description':_0xaac035['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0xaac035['prompt'],'context':_0xaac035['context'],'model':_0xaac035['model']}));}async _loadChecksList(){const _0x51a143=[...zh,...this['getExtraChecks']()]['map'](_0x2f872e=>_0x2f872e['isExtra']?_0x2f872e:this['_translateReviewCheck'](_0x2f872e)),_0x1e6e2d=this['context']['plugins']['get'](fs);let _0x4fddde;try{_0x4fddde=new tc(await _0x1e6e2d['models']['getAllModels'](),await _0x1e6e2d['models']['getAvailableModels'](),await _0x1e6e2d['models']['getDefault']()),this['_modelsLoadError']=null;}catch(_0x503845){this['_modelsLoadError']=new ct('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x503845),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),_0x4fddde=new tc([],[],null);}return _0x4fddde['setupChecks'](_0x51a143),_0x4fddde;}_translateReviewCheck(_0x511a82){const _0x516081='AI_REVIEW_CHECK_'+_0x511a82['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x38168a={..._0x511a82,'title':this['_translate'](_0x516081+'_TITLE',_0x511a82['title']),'description':this['_translate'](_0x516081+'_DESCRIPTION',_0x511a82['description'])};return _0x511a82['options']&&(_0x38168a['options']=_0x511a82['options']['map'](_0x15df7b=>({..._0x15df7b,'label':this['_translate'](_0x516081+'_OPTIONS_LABEL',_0x15df7b['label']||''),'data':_0x15df7b['data']?_0x15df7b['data']['map'](_0x13da38=>({..._0x13da38,'label':this['_translate'](_0x516081+'_OPTIONS_DATA_'+_0x13da38['id']['toUpperCase'](),_0x13da38['label'])})):void 0x0}))),_0x38168a;}_translate(_0x216fb0,_0x25006b){const _0x1f03f8=Es(this['context']['locale'],_0x216fb0);return _0x1f03f8===_0x216fb0?_0x25006b:_0x1f03f8;}},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(_0x2ffcfa){super(_0x2ffcfa),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',zh['map'](_0x2b2208=>_0x2b2208['id']));}init(){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x5a219a,_0x2b9b0e)=>{this['_isDiffOn']=_0x2b9b0e['on'],this['_onDiffChange'](this['_isDiffOn']);});}_initRequiredPlugins(){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}_createReviewCheckRun(_0x13a811,_0x109ceb,_0x3e2e5e=new Yn()){if(_0x13a811['isCustom'])return new Yh(_0x13a811['args']['prompt'],_0x13a811['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x109ceb,this['_aiConnector'],_0x3e2e5e['refs']);if(_0x109ceb['isExtra']){const _0x5fd91f=_0x109ceb,_0x17d30e=_0x5fd91f['context']?_0x3e2e5e['cloneWith'](_0x5fd91f['context'])['refs']:_0x3e2e5e['refs'];return new Qh(_0x13a811['args']?.['prompt']??_0x5fd91f['prompt'],_0x13a811['args']?.['model']??_0x5fd91f['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x109ceb,this['_aiConnector'],_0x17d30e);}return new Kh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x109ceb,this['_aiConnector'],_0x13a811['params'],_0x13a811['args'],_0x3e2e5e['refs']);}_onReviewCheckResultActivated(_0x4bc56a){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x4bc56a['change']['id']),this['_scrollToChange'](_0x4bc56a['change']['id']);const _0x4a16ee=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x4bc56a['change']['id']);if(!_0x4a16ee)return;const _0x59e395=this['_aiReviewCoreEditing']['getEditorForChange'](_0x4bc56a['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x4bc56a['change'],()=>_0x4a16ee['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x59e395,_0x4a16ee['modelRange']['root']['rootName']),_0x59e395?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x4bc56a['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}_onActivateChange(_0x439406){this['_currentReviewCheckRun']&&'click'===_0x439406['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x439406['id']));}_onDeactivateChange(_0x5c52c9){this['_currentReviewCheckRun']&&'balloon'===_0x5c52c9['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0xae650d,_0x3f94ef){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x3f94ef['changeId']);const _0x3e85cc=this['_currentReviewCheckRun']['getChangeById'](_0x3f94ef['changeId']);if(!_0x3e85cc)return;const _0x46fc83=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x3f94ef['changeId']),_0x1bfa60=this['_aiReviewCoreEditing']['getEditorForChange'](_0x3f94ef['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x3e85cc,_0x3f94ef['markerElement'],_0x3f94ef['domEvent'],'click',this['_getBalloonDomRoot'](_0x1bfa60,_0x46fc83?.['modelRange']['root']['rootName']),_0x1bfa60?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x24c90b,_0x53449c){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x111d8c=this['_currentReviewCheckRun']['getChangeById'](_0x53449c['changeId']);if(!_0x111d8c)return;const _0x3bf5c5=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x53449c['changeId']),_0x16e028=this['_aiReviewCoreEditing']['getEditorForChange'](_0x53449c['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x111d8c,_0x53449c['markerElement'],_0x53449c['domEvent'],'hover',this['_getBalloonDomRoot'](_0x16e028,_0x3bf5c5?.['modelRange']['root']['rootName']),_0x16e028?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}_getChangeContentElement(_0xfe826e){const _0x2186a0=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0xfe826e);return _0x2186a0?_0x2186a0['getElement']():null;}_markChangePositionInEditorContent(_0x41d6df,_0x2b6d6c){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x41d6df,_0x2b6d6c);}_diffContent(_0x4ba117,_0x1c8bff,_0x307e45){return this['_aiReviewCoreEditing']['diffContent'](_0x4ba117,_0x1c8bff,_0x307e45,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x42a942){_0x42a942?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x3abd2c of this['_aiReviewCoreEditing']['getEditors']())_0x3abd2c['editing']['view']['change'](_0x408ea7=>{for(const _0x1f73f2 of _0x3abd2c['editing']['view']['document']['getRoots']()){for(const _0x3725ce of _0x1f73f2['getClassNames']())_0x3725ce['startsWith']('ck-ai_review-')&&_0x408ea7['removeClass'](_0x3725ce,_0x1f73f2);_0x408ea7['addClass'](_0x42a942?'ck-ai_review-diff':'ck-ai_review-highlights',_0x1f73f2);}});}_getBalloonDomRoot(_0x2434e2,_0x43e762){const _0x1ad156=_0x2434e2['editing']['view'];if(_0x43e762){const _0x1b212a=_0x1ad156['getDomRoot'](_0x43e762);if(_0x1b212a)return _0x1b212a;}return _0x1ad156['getDomRoot']()??void 0x0;}async _getReviewChecks(){const _0x4c9479=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x44a8b8=await _0x4c9479['getChecksList']();_0x4c9479['modelsLoadError']&&this['_logError'](_0x4c9479['modelsLoadError']);let _0x3d45b9=_0x44a8b8['checks'];const _0x120090=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x120090,_0x3d45b9),this['_usesAvailableCommandsConfig']&&(_0x3d45b9=_0x120090['map'](_0x3e945a=>_0x3d45b9['find'](_0x4ac214=>_0x4ac214['id']===_0x3e945a))['filter'](_0x6bad30=>!!_0x6bad30)),this['_filterChecksWithMissingModel'](_0x3d45b9);}_logWarningForNonExistentChecks(_0x4c8b16,_0x4624e1){const _0x2e42d8=_0x4c8b16['filter'](_0x39fb21=>!_0x4624e1['some'](_0x54a98b=>_0x54a98b['id']===_0x39fb21));_0x2e42d8['length']&&this['_reporter']['logError'](new yn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x2e42d8['join'](',\x20')}}));}_filterChecksWithMissingModel(_0x3497cd){const _0x3cc296=[];return _0x3497cd['forEach'](_0x5bf13f=>{(_0x5bf13f instanceof qh&&!_0x5bf13f['defaultModel']||_0x5bf13f instanceof Zh&&!_0x5bf13f['models']['length'])&&_0x3cc296['push'](_0x5bf13f['id']);}),_0x3cc296['length']&&_0x3cc296['forEach'](_0x37fa2e=>{_0x3497cd=_0x3497cd['filter'](_0x38c49e=>_0x38c49e['id']!==_0x37fa2e),this['_reporter']['logError'](new yn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x37fa2e}}));}),_0x3497cd;}},sc=class extends _0x57f218{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'](_0x3a6b9b=>{const _0x222f8f={'id':_0x3a6b9b['id'],'title':_0x3a6b9b['title'],'description':_0x3a6b9b['description']};return'custom'!==_0x3a6b9b['id']&&_0x3a6b9b['options']?.['length']&&(_0x222f8f['parameters']=_0x3a6b9b['options'][0x0]['data']['map'](_0x38e8f0=>({..._0x38e8f0}))),_0x222f8f;});}async['runReview'](_0x44afee,_0xce62a3){const _0x44226c=await this['_resolveReviewCheck'](_0x44afee),_0x26cd43=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x302ed3=this['context']['plugins']['get']('AIConnector'),_0x26b374=_0x26cd43['getDocumentData']({'roots':_0xce62a3?.['roots']}),_0x3e440e=this['_createReviewCheckRun'](_0x44226c,_0x26b374,_0x302ed3,_0xce62a3?.['parameterId'],_0xce62a3?.['contexts']);return _0x26cd43['runCheck'](_0x3e440e,{'signal':_0xce62a3?.['signal']});}async runCustomReview(_0x4bdc0e,_0x5cf16d){const {reviewCheck:_0x19fe52,resolvedModel:_0x5e6ea0}=await this['_resolveCustomReviewCheck'](_0x4bdc0e,_0x5cf16d?.['model']),_0x1efa1f=this['context']['plugins']['get']('AIReviewCoreEditing'),_0xa8527a=this['context']['plugins']['get']('AIConnector'),_0x365c86=new Yh(_0x4bdc0e,_0x5e6ea0,_0x1efa1f['getDocumentData']({'roots':_0x5cf16d?.['roots']}),_0x19fe52,_0xa8527a,_0x5cf16d?.['contexts']);return _0x1efa1f['runCheck'](_0x365c86,{'signal':_0x5cf16d?.['signal']});}['applyReview'](_0x5b8d2f,_0x1dcea0){this['context']['plugins']['get']('AIGateway')['apply'](_0x5b8d2f,{'aiSource':'review',..._0x1dcea0});}async['_resolveReviewCheck'](_0x1f7016){const _0x45993c=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x2c1402=>_0x2c1402['id']===_0x1f7016);if(!_0x45993c)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0x1f7016});if(_0x45993c instanceof Zh)throw new ct('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x1f7016});if(_0x45993c instanceof qh&&!_0x45993c['defaultModel']?.['id'])throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x1f7016});return _0x45993c;}async _resolveCustomReviewCheck(_0x15dccc,_0x4bd435){const _0x1272ff='custom',_0x574a8e=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x2ba26f=>_0x2ba26f['id']===_0x1272ff);if(!_0x574a8e)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0x1272ff});if(!(_0x574a8e instanceof Zh))throw new ct('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x1272ff});if(!_0x15dccc)throw new ct('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x1272ff});const _0x4c51e9=_0x4bd435??_0x574a8e['defaultModel']?.['id'];if(!_0x4c51e9)throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x1272ff});return{'reviewCheck':_0x574a8e,'resolvedModel':_0x4c51e9};}_createReviewCheckRun(_0x3c9235,_0x2340a6,_0x1cebde,_0x30f6d7,_0x2ee339=[]){if(_0x3c9235 instanceof qh){const _0x57c73c=_0x3c9235['context']?[..._0x2ee339,_0x3c9235['context']]:_0x2ee339;return new Qh(_0x3c9235['prompt'],_0x3c9235['defaultModel']['id'],_0x2340a6,_0x3c9235,_0x1cebde,_0x57c73c);}return new Kh(_0x2340a6,_0x3c9235,_0x1cebde,_0x30f6d7?[_0x30f6d7]:void 0x0,void 0x0,_0x2ee339);}},nc=class extends _0x57f218{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(_0x12eaef,_0x2f4bad){if(this['assertStartReviewPreconditions'](_0x12eaef)instanceof Zh)throw new ct('ai-reviewmode-not-a-system-command',this,{'commandId':_0x12eaef});nh(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x12eaef,'params':_0x2f4bad?.['parameterId']?[_0x2f4bad['parameterId']]:void 0x0});}async startCustomReview(_0x553936,_0x40134f){if(!_0x553936)throw new ct('ai-reviewmode-missing-custom-command-prompt',this);const _0x2b46fc=zh['find'](_0x22043d=>'custom'===_0x22043d['commandId'])['id'],_0x16f147=this['assertStartReviewPreconditions'](_0x2b46fc),_0x2c3abd=_0x40134f?.['model']??_0x16f147['defaultModel']?.['id'];if(!_0x2c3abd)throw new ct('ai-reviewmode-missing-custom-command-model',this);nh(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x2b46fc,'isCustom':!0x0,'args':{'prompt':_0x553936,'model':_0x2c3abd}});}getAvailableCommands(){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x8d279f=>{const _0x209b38={'id':_0x8d279f['id'],'title':_0x8d279f['title'],'description':_0x8d279f['description']};return'custom'!==_0x8d279f['id']&&_0x8d279f['options']?.['length']&&(_0x209b38['parameters']=_0x8d279f['options'][0x0]['data']['map'](_0x4e442e=>({..._0x4e442e}))),_0x209b38;});}assertStartReviewPreconditions(_0x59c19d){const _0x5c02dc=this['context']['plugins']['get']('AIReviewModeController');if(_0x5c02dc['getCurrentCheckRun']())throw new ct('ai-reviewmode-review-already-running',this);const _0x385a0f=_0x5c02dc['getAvailableChecks']()['find'](_0x25b658=>_0x25b658['id']===_0x59c19d);if(!_0x385a0f)throw new ct('ai-reviewmode-unknown-command',this,{'commandId':_0x59c19d});return _0x385a0f;}},rc=class extends Kh{_title;constructor(_0x20cf72,_0x43fb31,_0x2b3968,_0x191445,_0x12a268,_0x3f15d6,_0x4764c7){super(_0x20cf72,_0x43fb31,_0x2b3968,_0x12a268,_0x3f15d6,_0x4764c7),this['_title']=_0x191445;}get title(){return this['_title'];}get subTitle(){return this['_sourceCheck']['title'];}},oc=class extends $h{get['apiId'](){return'translate';}},ac=class extends Jh{setupChecks(_0x5a3116){this['_checks']=_0x5a3116['map'](_0x1bd89e=>new oc(_0x1bd89e));}};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(_0x47e44b){super(_0x47e44b),this['context']['config']['define']('ai.translate.languages',hc);}async _loadChecksList(){const _0x418ec2=[],_0x339aef=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x347b51 of _0x339aef)_0x418ec2['push']({'title':_0x347b51['label'],'id':_0x347b51['id'],'commandId':_0x347b51['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x347b51['id']}});const _0x2d1adc=new ac();return _0x2d1adc['setupChecks'](this['_translateChecks'](_0x418ec2)),_0x2d1adc;}_translateChecks(_0x592dc5){const _0xf94d8d=this['context']['locale'];return _0x592dc5['map'](_0x8c04e8=>{const _0x1b63c0='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x8c04e8['title']['toUpperCase']()['replaceAll']('-','_'),_0x3f8136=Es(_0xf94d8d,_0x1b63c0);return{..._0x8c04e8,'title':_0x3f8136===_0x1b63c0?_0x8c04e8['title']:_0x3f8136};});}},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(_0x2a86db,_0x1c8d41,_0x467ee2){return new rc(this['_aiReviewCoreEditing']['getDocumentData'](),_0x1c8d41,this['_aiConnector'],Es(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x2a86db['params'],_0x2a86db['args'],_0x467ee2?.['refs']);}_onReviewCheckResultActivated(_0x1ff099){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x1ff099['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x1ff099['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}_onActivateChange(_0x555d92){this['_currentReviewCheckRun']&&('hover'===_0x555d92['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x555d92['id'])),'click'===_0x555d92['uiInteraction']&&this['_scrollToChange'](_0x555d92['id']));}_onDeactivateChange(_0x2237af){this['_currentReviewCheckRun']&&'panel'===_0x2237af['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x29135c,_0x27363c){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x27363c['changeId']),this['_scrollToChange'](_0x27363c['changeId']));}['_onChangeMarkerHovered'](_0x1e9e5d,_0x132631){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x132631['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x132631['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}_getChangeContentElement(_0xfe4885){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0xfe4885);}_markChangePositionInEditorContent(_0x5cc67c,_0x1b0a6c){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x5cc67c,_0x1b0a6c);}_diffContent(_0x5e6cb5,_0x1ee10f,_0x4659fe){return this['_aiReviewCoreEditing']['diffContent'](_0x5e6cb5,_0x1ee10f,_0x4659fe,!0x0);}['_onReviewCheckRun'](){for(const _0x18f387 of this['_aiReviewCoreEditing']['getEditors']())_0x18f387['editing']['view']['change'](_0x534fff=>{for(const _0x577ee8 of _0x18f387['editing']['view']['document']['getRoots']())_0x534fff['addClass']('ck-ai-translate-mode-content',_0x577ee8);});}async _getReviewChecks(){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},uc=class extends fh{constructor(_0x25fb1c,_0x29f24f){super(_0x25fb1c,_0x29f24f),this['on']('set:isLoading',(_0x1ae94c,_0x1ab9d1,_0xd4f653)=>{_0xd4f653&&(this['headerTitle']=Es(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x3c5a04,_0x241cfe,_0x291799)=>{_0x291799&&(this['headerTitle']=Es(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}_createAcceptAllButtonView(){const _0x110a80=super['_createAcceptAllButtonView']();return _0x110a80['set']('label',Es(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x110a80;}_createExitReviewButtonView(){const _0x482a81=super['_createExitReviewButtonView']();return _0x482a81['set']('label',Es(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x482a81;}},dc=class extends yh{_setupTemplate(){const _0x5997b0=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x5997b0['if']('isVisible','ck-hidden',_0x39b9d1=>!_0x39b9d1)]},'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',_0x5997b0['if']('isVisible','ck-hidden',_0x26dd3e=>!_0x26dd3e)]},'children':this['_checkViews']}]});}},_c=class extends mh{static get['pluginName'](){return'AITranslateUI';}createMainView(){const _0x409863=this['context']['plugins']['get']('AITabs'),_0x2ca28a=this['context']['locale'],_0x4c92bf=new ua(_0x2ca28a,{'label':Es(_0x2ca28a,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x1895f8,'class':'ck-ai-header_review-translate','showResizeButton':_0x409863['showResizeButton']});_0x4c92bf['delegate']('resizeTabs')['to'](_0x409863),_0x4c92bf['bind']('isMaximized')['to'](_0x409863['view'],'isMaximized',_0x6241d6=>_0x6241d6);const _0x2d74b3=new wh(_0x2ca28a,{'header':_0x4c92bf,'list':new dc(_0x2ca28a),'results':new uc(_0x2ca28a,{'generalErrorText':Es(_0x2ca28a,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new bh(_0x2ca28a,{'headerText':Es(_0x2ca28a,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Es(_0x2ca28a,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Es(_0x2ca28a,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x2d74b3['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x2d74b3;}registerTab(){const _0x37ece6=this['context']['plugins']['get']('AITabs');_0x37ece6['view']['on']('activateTab',(_0x4ffeda,{newTab:_0x272322,oldTab:_0x186c10})=>{'translate'===_0x272322?this['fire']('getReviewCheckList'):'translate'===_0x186c10&&this['fire']('leaveReview');}),_0x37ece6['view']['addTab']({'id':'translate','buttonLabel':Es(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x1895f8,'order':0x0,'content':this['_mainView']});}},gc=class extends _0x57f218{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(_0x4f9d1f,_0x329b76){const _0x12358d=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x300615=this['context']['plugins']['get']('AIConnector'),_0x33d427=new oc({'id':_0x4f9d1f,'commandId':_0x4f9d1f,'title':_0x4f9d1f,'description':'','isParameterized':!0x1}),_0x56b509=new Kh(_0x12358d['getDocumentData']({'roots':_0x329b76?.['roots']}),_0x33d427,_0x300615,void 0x0,{'language':_0x4f9d1f},_0x329b76?.['contexts']);return _0x12358d['runCheck'](_0x56b509,{'signal':_0x329b76?.['signal']});}applyTranslate(_0x2c8810,_0x8e90e3){this['context']['plugins']['get']('AIGateway')['apply'](_0x2c8810,_0x8e90e3);}},Ac=class extends _0x57f218{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(_0xaa2020){const _0x421c9d=this['assertStartTranslatePreconditions'](_0xaa2020);nh(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0x421c9d['id'],'args':_0x421c9d['useArgs']?_0x421c9d['args']:void 0x0});}getAvailableLanguages(){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x2728c4=>({'id':_0x2728c4['id'],'label':_0x2728c4['title']}));}assertStartTranslatePreconditions(_0x66e81e){const _0x4c14ef=this['context']['plugins']['get']('AITranslateController');if(_0x4c14ef['getCurrentCheckRun']())throw new ct('ai-translate-translation-already-running',this);const _0x185509=_0x4c14ef['getAvailableChecks']()['find'](_0x3245a4=>_0x3245a4['id']===_0x66e81e);if(!_0x185509)throw new ct('ai-translate-unknown-language',this,{'languageId':_0x66e81e});return _0x185509;}};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};
|